:root {
    color-scheme: light;
    --bg: #f6f7f9;
    --bg-start: #ffffff;
    --surface: #ffffff;
    --surface-panel: rgba(255, 255, 255, 0.88);
    --surface-elevated: #ffffff;
    --surface-soft: #f0f4f8;
    --text: #15171a;
    --text-soft: #344054;
    --muted: #667085;
    --line: #d8dee7;
    --line-soft: rgba(216, 222, 231, 0.9);
    --sidebar-bg: rgba(255, 255, 255, 0.78);
    --primary: #22C55E;
    --primary-dark: #15803D;
    --green: #22C55E;
    --red: #c24137;
    --amber: #b7791f;
    --danger-bg: #fff1ef;
    --danger-line: #ffd5d0;
    --success-bg: #ecfdf5;
    --success-line: #bbf7d0;
    --warning-bg: #fff8eb;
    --warning-line: #fed7aa;
    --track: #e5eaf1;
    --shadow: 0 18px 48px rgba(31, 41, 55, 0.10);
    --radius: 8px;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f141b;
    --bg-start: #151b24;
    --surface: #171e28;
    --surface-panel: rgba(23, 30, 40, 0.9);
    --surface-elevated: #1d2632;
    --surface-soft: #222d3a;
    --text: #eef3f8;
    --text-soft: #c9d3df;
    --muted: #93a2b3;
    --line: #334052;
    --line-soft: rgba(51, 64, 82, 0.88);
    --sidebar-bg: rgba(18, 24, 33, 0.86);
    --primary: #86EFAC;
    --primary-dark: #22C55E;
    --green: #86EFAC;
    --red: #ff8b82;
    --amber: #f3c36b;
    --danger-bg: rgba(194, 65, 55, 0.14);
    --danger-line: rgba(255, 139, 130, 0.34);
    --success-bg: rgba(22, 132, 91, 0.15);
    --success-line: rgba(95, 208, 165, 0.34);
    --warning-bg: rgba(183, 121, 31, 0.16);
    --warning-line: rgba(243, 195, 107, 0.36);
    --track: #293544;
    --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    overflow-x: hidden;
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background: linear-gradient(180deg, var(--bg-start) 0%, var(--bg) 38%);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select {
    font: inherit;
}

.auth-page {
    display: flex;
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    align-items: center;
    justify-content: center;
    padding: 24px 32px;
}

body.auth-page {
    overflow: hidden;
    background:
        linear-gradient(
            rgba(255, 255, 255, 0.82),
            rgba(255, 255, 255, 0.82)
        ),
        url("/assets/img/fundo.png");
    background-attachment: fixed;
    background-position: center;
    background-size: cover;
}

html[data-theme="dark"] body.auth-page {
    background:
        linear-gradient(
            rgba(31, 41, 55, 0.62),
            rgba(31, 41, 55, 0.62)
        ),
        url("/assets/img/fundo.png");
    background-attachment: fixed;
    background-position: center;
    background-size: cover;
}

.auth-shell {
    display: grid;
    width: min(100%, 1180px);
    grid-template-columns: minmax(0, 1fr) minmax(390px, 520px);
    gap: clamp(30px, 5vw, 76px);
    align-items: center;
}

.auth-panel,
.panel,
.metric-card {
    background: var(--surface-panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.auth-panel {
    padding: 32px;
}

body.auth-page .auth-panel {
    max-width: 520px;
    width: 100%;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(216, 222, 231, 0.78);
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(12px);
    padding: clamp(30px, 3.2vw, 44px);
}

html[data-theme="dark"] body.auth-page .auth-panel {
    background: rgba(31, 41, 55, 0.9);
    border-color: rgba(134, 239, 172, 0.18);
}

html[data-theme="dark"] body.auth-page .auth-panel h1 {
    color: #ffffff;
}

body.auth-page .form-stack {
    gap: 15px;
}

body.auth-page label {
    gap: 9px;
}

body.auth-page label > span:first-child {
    color: #1F2937;
    font-size: 0.92rem;
}

html[data-theme="dark"] body.auth-page label > span:first-child {
    color: #eef3f8;
}

body.auth-page .input-shell {
    display: grid;
    position: relative;
    align-items: center;
}

body.auth-page .input-shell > svg,
body.auth-page .password-toggle {
    position: absolute;
    color: #16a34a;
}

body.auth-page .input-shell > svg {
    left: 17px;
    width: 22px;
    height: 22px;
    pointer-events: none;
}

body.auth-page svg {
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.25;
}

body.auth-page input {
    min-height: 50px;
    padding: 12px 48px 12px 54px;
    background: rgba(255, 255, 255, 0.86);
    border-color: rgba(34, 197, 94, 0.45);
    border-radius: 12px;
}

body.auth-page input::placeholder {
    color: #7d8aa0;
}

body.auth-page .button-primary {
    min-height: 52px;
    border-radius: 12px;
    font-size: 1.02rem;
    font-weight: 800;
    box-shadow: 0 14px 28px rgba(21, 128, 61, 0.26);
}

body.auth-page .button-primary svg {
    width: 21px;
    height: 21px;
    stroke-width: 2.6;
}

.password-toggle {
    right: 14px;
    display: grid;
    width: 34px;
    min-height: 34px;
    place-items: center;
    padding: 0;
    border: 0;
    cursor: pointer;
    background: transparent;
}

.password-toggle svg {
    width: 21px;
    height: 21px;
}

.auth-showcase {
    display: grid;
    justify-items: center;
    gap: 22px;
}

.auth-showcase img {
    display: block;
    width: min(100%, 430px);
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 18px 32px rgba(21, 128, 61, 0.13));
}

.showcase-note {
    display: grid;
    grid-template-columns: 48px minmax(0, 310px);
    gap: 18px;
    align-items: center;
    color: #555f6f;
    font-size: 1rem;
    line-height: 1.45;
}

.showcase-note span {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    color: #22C55E;
    border: 2px solid rgba(34, 197, 94, 0.75);
    border-radius: 999px;
    font-size: 1.55rem;
    font-weight: 850;
}

.showcase-note p {
    margin: 0;
}

.showcase-note strong {
    color: #15803D;
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 750;
    color: var(--text);
}

.sidebar .brand-lockup {
    display: flex;
    min-height: 58px;
    justify-content: center;
    padding: 6px 2px 14px;
    border-bottom: 1px solid var(--line-soft);
}

.brand-logo {
    display: block;
    width: min(100%, 156px);
    height: 54px;
    object-fit: contain;
    filter: drop-shadow(0 8px 14px rgba(21, 128, 61, 0.12));
    transition: filter 0.2s ease, transform 0.2s ease;
}

.brand-lockup:hover .brand-logo {
    filter: drop-shadow(0 10px 18px rgba(34, 197, 94, 0.22));
    transform: translateY(-1px);
}

.auth-brand {
    display: flex;
    justify-content: center;
}

.auth-brand img {
    display: block;
    width: auto;
    max-width: min(100%, 252px);
    height: 68px;
    object-fit: contain;
    opacity: 1;
    transition: filter 0.22s ease, transform 0.22s ease;
}

.auth-brand img:hover {
    filter: drop-shadow(0 10px 18px rgba(34, 197, 94, 0.24));
    transform: translateY(-2px) scale(1.02);
}

.auth-copy {
    margin: 30px 0 24px;
    text-align: left;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--primary);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    font-size: clamp(2rem, 7vw, 3.4rem);
    line-height: 0.98;
    letter-spacing: 0;
}

.auth-panel h1 {
    margin-bottom: 12px;
    color: #1F2937;
    font-size: clamp(2.05rem, 3.3vw, 2.6rem);
    line-height: 1.05;
}

h2 {
    margin-bottom: 0;
    font-size: 1.05rem;
    letter-spacing: 0;
}

.auth-copy p:last-child {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.6;
}

.auth-panel .auth-copy p:last-child {
    max-width: 390px;
    font-size: 1.02rem;
    line-height: 1.45;
}

body.auth-register .auth-copy {
    margin: 24px 0 20px;
}

body.auth-register .auth-brand img {
    height: 62px;
}

body.auth-register .auth-panel h1 {
    font-size: clamp(1.95rem, 3vw, 2.45rem);
}

.form-stack,
.form-grid {
    display: grid;
    gap: 16px;
}

.form-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
}

.form-grid.compact {
    gap: 12px;
}

.full {
    grid-column: 1 / -1;
}

label {
    display: grid;
    gap: 7px;
}

label span {
    color: var(--text-soft);
    font-size: 0.88rem;
    font-weight: 700;
}

input,
select {
    width: 100%;
    min-height: 46px;
    padding: 11px 13px;
    color: var(--text);
    background: var(--surface-elevated);
    border: 1px solid var(--line);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input:focus,
select:focus {
    border-color: #22C55E;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
}

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button-primary {
    color: #ffffff;
    background: var(--primary);
    box-shadow: 0 12px 28px rgba(34, 197, 94, 0.24);
}

.button-primary:hover {
    background: var(--primary-dark);
}

.button-secondary {
    color: var(--text);
    background: var(--surface-elevated);
    border-color: var(--line);
}

.button-danger {
    color: var(--red);
    background: var(--danger-bg);
    border-color: var(--danger-line);
}

.auth-switch {
    margin: 26px 0 0;
    padding-top: 20px;
    border-top: 1px solid rgba(216, 222, 231, 0.78);
    color: var(--muted);
    text-align: center;
    font-size: 1rem;
}

.auth-switch a,
.panel-heading a {
    color: var(--primary);
    font-weight: 800;
}

.auth-footer {
    position: fixed;
    right: 0;
    bottom: 18px;
    left: 0;
    color: #7d8796;
    font-size: 0.95rem;
    font-weight: 500;
    pointer-events: none;
    text-align: center;
}

@media (min-width: 981px) and (max-height: 720px) {
    .auth-page {
        padding: 14px 28px 28px;
    }

    .auth-shell {
        width: min(100%, 1080px);
        grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
        gap: clamp(24px, 4vw, 58px);
    }

    body.auth-page .auth-panel {
        max-width: 430px;
        padding: 26px 34px;
        border-radius: 22px;
    }

    .auth-brand img {
        height: 50px;
        max-width: min(100%, 205px);
    }

    .auth-copy {
        margin: 22px 0 18px;
    }

    .eyebrow {
        margin-bottom: 6px;
        font-size: 0.68rem;
    }

    .auth-panel h1 {
        margin-bottom: 8px;
        font-size: 2rem;
    }

    .auth-panel .auth-copy p:last-child {
        font-size: 0.92rem;
        line-height: 1.38;
    }

    body.auth-page .form-stack {
        gap: 12px;
    }

    body.auth-page label {
        gap: 6px;
    }

    body.auth-page label > span:first-child {
        font-size: 0.82rem;
    }

    body.auth-page input {
        min-height: 42px;
        padding-top: 9px;
        padding-bottom: 9px;
    }

    body.auth-page .input-shell > svg {
        width: 18px;
        height: 18px;
    }

    body.auth-page .button-primary {
        min-height: 46px;
        font-size: 0.94rem;
    }

    body.auth-page .button-primary svg,
    .password-toggle svg {
        width: 18px;
        height: 18px;
    }

    .auth-switch {
        margin-top: 16px;
        padding-top: 14px;
        font-size: 0.86rem;
    }

    .auth-showcase {
        gap: 14px;
    }

    .auth-showcase img {
        width: min(100%, 330px);
    }

    .showcase-note {
        grid-template-columns: 40px minmax(0, 280px);
        gap: 14px;
        font-size: 0.9rem;
        line-height: 1.35;
    }

    .showcase-note span {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .auth-footer {
        bottom: 8px;
        font-size: 0.78rem;
    }

    body.auth-register .auth-brand img {
        height: 44px;
    }

    body.auth-register .auth-copy {
        margin: 16px 0 14px;
    }

    body.auth-register .auth-panel h1 {
        font-size: 1.8rem;
    }

    body.auth-register .auth-panel .auth-copy p:last-child {
        font-size: 0.86rem;
    }

    body.auth-register .auth-switch {
        margin-top: 12px;
        padding-top: 12px;
    }
}

.alert {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 700;
    transition: opacity 0.25s ease;
}

.alert-error {
    color: var(--red);
    background: var(--danger-bg);
    border: 1px solid var(--danger-line);
}

.alert-success {
    color: var(--green);
    background: var(--success-bg);
    border: 1px solid var(--success-line);
}

.alert.is-fading {
    opacity: 0.72;
}

.app-shell {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    height: 100vh;
    flex-direction: column;
    gap: 18px;
    padding: 18px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--line-soft);
    backdrop-filter: blur(18px);
}

.nav-list {
    display: grid;
    gap: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    min-height: 42px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--muted);
    background: transparent;
    font-weight: 750;
    text-align: left;
}

.nav-item:hover,
.nav-item.active {
    color: var(--primary-dark);
    background: var(--success-bg);
}

.nav-item.active {
    border: 1px solid var(--success-line);
    font-weight: 850;
}

.nav-item.muted {
    margin-top: auto;
    color: var(--muted);
}

.theme-toggle {
    display: grid;
    width: 42px;
    min-height: 42px;
    place-items: center;
    align-self: flex-start;
    padding: 0;
    cursor: pointer;
    color: var(--text);
    background: var(--surface-elevated);
    border: 1px solid var(--line);
    font-size: 1.12rem;
    line-height: 1;
}

.theme-toggle:hover {
    background: var(--surface-soft);
}

.sidebar .theme-toggle {
    margin-top: auto;
}

.sidebar .theme-toggle + .nav-item.muted {
    margin-top: 0;
}

.theme-toggle-floating {
    position: fixed;
    top: 18px;
    right: 18px;
    display: grid;
    width: 42px;
    min-height: 40px;
    place-items: center;
    padding: 0;
    color: var(--text);
    background: var(--surface-panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    font-size: 1.12rem;
    font-weight: 800;
    line-height: 1;
    z-index: 20;
}

.auth-theme-toggle {
    z-index: 40;
}

.mobile-menu-btn,
.sidebar-overlay {
    display: none;
}

.content {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: clamp(18px, 2.4vw, 32px);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.topbar h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.8rem);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.insight-card {
    display: grid;
    align-content: start;
    gap: 12px;
}

.mini-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.mini-metrics div {
    display: grid;
    gap: 5px;
    padding: 12px;
    background: var(--surface-elevated);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.mini-metrics span,
.insight-card small {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 700;
}

.mini-metrics strong,
.insight-value {
    color: var(--text);
    font-size: 1.28rem;
    font-weight: 850;
}

.compact-alert {
    margin-bottom: 0;
    padding: 10px 12px;
    font-size: 0.86rem;
}

.metric-card {
    display: grid;
    gap: 8px;
    min-height: 128px;
    padding: clamp(16px, 2vw, 20px);
}

.metric-card.highlight {
    color: #ffffff;
    background: linear-gradient(135deg, #1F2937, #15803D);
    border-color: transparent;
}

.metric-card span,
.metric-card small {
    color: inherit;
    opacity: 0.72;
}

.metric-card strong {
    font-size: clamp(1.45rem, 3vw, 2.2rem);
    letter-spacing: 0;
}

.positive {
    color: var(--green);
}

.negative {
    color: var(--red);
}

.two-column {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 390px), 1fr));
    gap: 18px;
}

.align-start {
    align-items: start;
}

.panel {
    min-width: 0;
    padding: 20px;
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.panel-heading span {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.list,
.goal-list {
    display: grid;
    gap: 10px;
}

.list-row,
.goal-item {
    padding: 14px;
    background: var(--surface-elevated);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.list-row div,
.goal-title {
    display: grid;
    gap: 4px;
}

.list-row span,
.goal-item small {
    color: var(--muted);
    font-size: 0.9rem;
}

.goal-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.goal-title span {
    color: var(--primary);
    font-weight: 850;
}

.progress-track {
    height: 9px;
    margin: 12px 0 8px;
    overflow: hidden;
    background: var(--track);
    border-radius: 999px;
}

.progress-track span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--green));
    border-radius: inherit;
}

.goal-adjust-form {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) auto auto;
    gap: 8px;
    align-items: end;
    margin-top: 14px;
}

.goal-edit-form {
    display: grid;
    grid-template-columns: minmax(180px, 1.3fr) repeat(3, minmax(112px, 1fr)) auto;
    gap: 8px;
    align-items: end;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.goal-edit-form label,
.goal-delete-form {
    min-width: 0;
}

.goal-adjust-form label {
    gap: 5px;
}

.goal-adjust-form input,
.goal-edit-form input {
    min-height: 40px;
}

.goal-adjust-form .button,
.goal-edit-form .button,
.goal-delete-form .button {
    min-height: 40px;
    padding: 8px 12px;
}

.goal-delete-form {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.investment-chart {
    display: grid;
    grid-template-columns: minmax(110px, 140px) minmax(0, 1fr);
    gap: 18px;
    align-items: center;
}

.donut-chart {
    position: relative;
    display: grid;
    width: min(140px, 100%);
    aspect-ratio: 1;
    place-items: center;
    border-radius: 50%;
    background: var(--track);
}

.donut-chart::after {
    position: absolute;
    width: 58%;
    aspect-ratio: 1;
    content: "";
    background: var(--surface-elevated);
    border-radius: 50%;
}

.donut-chart span {
    position: relative;
    z-index: 1;
    color: var(--text);
    font-weight: 850;
}

.chart-list,
.bar-list {
    display: grid;
    gap: 10px;
}

.chart-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 9px;
    row-gap: 3px;
    align-items: center;
}

.chart-row small {
    grid-column: 2;
    color: var(--muted);
    font-weight: 650;
}

.chart-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
}

.bar-row {
    display: grid;
    gap: 8px;
    padding: 13px;
    background: var(--surface-elevated);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.bar-row div:first-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.bar-row span {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 650;
}

.bar-track {
    height: 9px;
    overflow: hidden;
    background: var(--track);
    border-radius: 999px;
}

.bar-track span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--green));
    border-radius: inherit;
}

.monthly-chart {
    display: grid;
    min-height: 180px;
    grid-template-columns: repeat(12, minmax(28px, 1fr));
    gap: 8px;
    align-items: end;
    padding-top: 10px;
}

.month-bar {
    display: grid;
    min-height: 150px;
    align-items: end;
    gap: 8px;
}

.month-bar span {
    display: block;
    min-height: 8px;
    background: linear-gradient(180deg, var(--primary), var(--green));
    border-radius: 8px 8px 3px 3px;
}

.month-bar small {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 750;
    text-align: center;
}

.empty-state {
    margin: 0;
    color: var(--muted);
    text-align: center;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.chip {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 6px 10px;
    color: var(--text-soft);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 750;
}

.chip.income {
    color: var(--green);
    background: var(--success-bg);
    border-color: var(--success-line);
}

.chip.expense {
    color: var(--red);
    background: var(--danger-bg);
    border-color: var(--danger-line);
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.check-row {
    display: flex;
    min-height: 46px;
    align-items: center;
    gap: 10px;
}

.check-row input {
    width: 18px;
    min-height: 18px;
}

.admin-list {
    display: grid;
    gap: 14px;
}

.admin-account {
    display: grid;
    gap: 14px;
    padding: 14px;
    background: var(--surface-elevated);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.admin-account-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.admin-account-title div {
    display: grid;
    gap: 4px;
}

.admin-account-title span,
td small {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 650;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 9px;
    white-space: nowrap;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text-soft);
    background: var(--surface-soft);
    font-size: 0.78rem;
    font-weight: 850;
}

.badge.active,
.badge.paid {
    color: var(--green);
    background: var(--success-bg);
    border-color: var(--success-line);
}

.badge.blocked,
.badge.canceled {
    color: var(--red);
    background: var(--danger-bg);
    border-color: var(--danger-line);
}

.badge.expired,
.badge.pending {
    color: var(--amber);
    background: var(--warning-bg);
    border-color: var(--warning-line);
}

.inline-form {
    display: inline-flex;
    margin: 2px 4px 2px 0;
}

.inline-form .button {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 0.85rem;
}

table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 9px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

th {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 850;
    text-transform: uppercase;
}

td {
    color: var(--text-soft);
    font-weight: 650;
}

.text-right {
    text-align: right;
}

@media (min-width: 981px) and (max-width: 1180px) {
    .app-shell {
        grid-template-columns: 188px minmax(0, 1fr);
    }

    .sidebar {
        gap: 14px;
        padding: 14px;
    }

    .sidebar .brand-lockup {
        min-height: 52px;
        padding-bottom: 10px;
    }

    .brand-logo {
        width: min(100%, 132px);
        height: 46px;
    }

    .nav-item {
        min-height: 40px;
        padding: 9px 10px;
        font-size: 0.92rem;
    }

    .content {
        padding: 20px;
    }

    .topbar {
        margin-bottom: 18px;
    }

    .topbar h1 {
        font-size: 2.35rem;
        line-height: 1.04;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .metric-card {
        min-height: 112px;
        padding: 15px;
    }

    .metric-card strong {
        font-size: 1.58rem;
    }

    .two-column {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .panel {
        padding: 16px;
    }

    .form-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
        gap: 12px;
    }

    .investment-chart {
        grid-template-columns: 112px minmax(0, 1fr);
        gap: 12px;
    }

    .donut-chart {
        width: 112px;
    }

    .chart-row {
        column-gap: 8px;
    }

    .bar-row div:first-child {
        display: grid;
        gap: 3px;
    }

    .monthly-chart {
        min-height: 150px;
        grid-template-columns: repeat(12, minmax(20px, 1fr));
        gap: 6px;
    }

    .month-bar {
        min-height: 122px;
    }

    .goal-edit-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .goal-edit-form .button {
        grid-column: 1 / -1;
    }

    .goal-adjust-form {
        grid-template-columns: minmax(0, 1fr) 1fr 1fr;
    }

    th,
    td {
        padding: 10px 8px;
        font-size: 0.9rem;
    }
}

@media (max-width: 980px) {
    body.sidebar-open {
        overflow: hidden;
    }

    .app-shell {
        grid-template-columns: 1fr;
    }

    .mobile-menu-btn {
        position: fixed;
        top: 14px;
        left: 14px;
        z-index: 80;
        display: grid;
        width: 44px;
        height: 44px;
        place-items: center;
        gap: 4px;
        padding: 11px;
        background: var(--surface-panel);
        border: 1px solid var(--line);
        border-radius: 8px;
        box-shadow: var(--shadow);
    }

    .mobile-menu-btn span {
        display: block;
        width: 20px;
        height: 2px;
        background: var(--text);
        border-radius: 999px;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 60;
        display: block;
        pointer-events: none;
        background: rgba(0, 0, 0, 0.58);
        opacity: 0;
        transition: opacity 0.22s ease;
    }

    .sidebar-overlay.open {
        pointer-events: auto;
        opacity: 1;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 70;
        width: min(82vw, 300px);
        height: 100dvh;
        flex-direction: column;
        align-items: stretch;
        gap: 18px;
        overflow-y: auto;
        padding: 22px 18px;
        border-right: 1px solid var(--line-soft);
        border-bottom: 0;
        box-shadow: 22px 0 60px rgba(0, 0, 0, 0.28);
        transform: translateX(-100%);
        transition: transform 0.24s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .nav-list {
        display: grid;
        gap: 8px;
        min-width: 0;
    }

    .nav-item {
        width: 100%;
        min-height: 44px;
        justify-content: flex-start;
        padding: 10px 12px;
        text-align: left;
    }

    .theme-toggle {
        width: 42px;
    }

    .sidebar .theme-toggle {
        margin-top: 0;
    }

    .nav-item.muted {
        margin-top: auto;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .insights-grid {
        grid-template-columns: 1fr;
    }

    .two-column {
        grid-template-columns: 1fr;
    }

    .content {
        padding: 72px 18px 28px;
    }

    body.auth-page {
        overflow-y: auto;
    }

    .auth-page {
        padding: 24px 18px;
    }

    .auth-shell {
        width: min(100%, 520px);
        grid-template-columns: 1fr;
    }

    .auth-showcase {
        display: none;
    }

    .auth-footer {
        position: static;
        margin-top: 18px;
    }
}

@media (max-width: 640px) {
    body:not(.auth-page) {
        background: var(--bg);
    }

    .auth-page {
        padding: 14px;
    }

    body:not(.auth-page) .auth-panel,
    .panel,
    .metric-card {
        box-shadow: none;
    }

    body.auth-page .auth-panel {
        padding: 26px 20px;
        border-radius: 22px;
        box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12);
    }

    .auth-brand img {
        height: 62px;
        max-width: min(100%, 218px);
    }

    .auth-copy {
        margin: 28px 0 22px;
        text-align: left;
    }

    .auth-panel h1 {
        font-size: clamp(1.9rem, 10vw, 2.35rem);
    }

    .auth-panel .auth-copy p:last-child {
        font-size: 1rem;
    }

    body.auth-page input {
        min-height: 50px;
    }

    body.auth-page .button-primary {
        min-height: 52px;
    }

    .auth-switch {
        margin-top: 20px;
        padding-top: 16px;
        font-size: 0.94rem;
    }

    body.auth-register .auth-brand img {
        height: 56px;
    }

    body.auth-register .auth-copy {
        margin: 22px 0 18px;
    }

    .content {
        padding: 70px 12px 24px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar .button {
        width: 100%;
    }

    .metrics-grid,
    .form-grid,
    .mini-metrics {
        grid-template-columns: 1fr;
    }

    .metric-card {
        min-height: 112px;
    }

    .sidebar {
        width: min(86vw, 292px);
        gap: 14px;
    }

    .sidebar .brand-lockup span:last-child {
        display: inline;
    }

    .nav-list {
        display: grid;
        grid-template-columns: 1fr;
    }

    .nav-item {
        justify-content: flex-start;
        min-width: 0;
        text-align: left;
    }

    .list-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .goal-adjust-form {
        grid-template-columns: 1fr;
    }

    .goal-edit-form {
        grid-template-columns: 1fr;
    }

    .goal-delete-form {
        justify-content: stretch;
    }

    .goal-delete-form .button {
        width: 100%;
    }

    .investment-chart {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .chart-list {
        width: 100%;
    }

    .bar-row div:first-child {
        align-items: flex-start;
        flex-direction: column;
    }

    .monthly-chart {
        overflow-x: auto;
        grid-template-columns: repeat(12, 38px);
    }

    .panel {
        padding: 14px;
    }

    .panel-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .table-wrap {
        margin-inline: -4px;
        padding-bottom: 4px;
    }

    table {
        min-width: 560px;
        font-size: 0.88rem;
    }

    th,
    td {
        padding: 10px 8px;
    }
}

@media (max-width: 420px) {
    .topbar h1 {
        font-size: 2rem;
    }
}
