:root {
    --bg: #f3f6f0;
    --bg-accent: #e7efe4;
    --surface: #ffffff;
    --surface-muted: #f8faf6;
    --text: #183028;
    --text-soft: #5f726a;
    --line: #d9e4dc;
    --primary: #1c7a62;
    --primary-dark: #0f5443;
    --primary-soft: #d6eee5;
    --danger: #bf4d4d;
    --danger-soft: #f9e1e1;
    --warning: #c7852c;
    --warning-soft: #fbe9c8;
    --info: #2d6f91;
    --info-soft: #d8edf8;
    --shadow: 0 20px 40px rgba(24, 48, 40, 0.08);
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --sidebar-width: 270px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Trebuchet MS", Verdana, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(28, 122, 98, 0.15), transparent 26%),
        radial-gradient(circle at bottom right, rgba(199, 133, 44, 0.14), transparent 24%),
        var(--bg);
    color: var(--text);
}

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

button,
input,
select {
    font: inherit;
}

.auth-body {
    min-height: 100vh;
}

.auth-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
}

.auth-layout--reverse {
    grid-template-columns: 0.95fr 1.05fr;
}

.auth-hero,
.auth-card {
    padding: 56px clamp(24px, 4vw, 60px);
}

.auth-hero {
    background:
        linear-gradient(145deg, rgba(15, 84, 67, 0.96), rgba(28, 122, 98, 0.93)),
        var(--primary);
    color: #f6fbf8;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 22px;
}

.auth-hero h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 4rem);
    line-height: 1.02;
}

.auth-hero p {
    margin: 0;
    max-width: 42rem;
    color: rgba(246, 251, 248, 0.82);
    line-height: 1.7;
}

.auth-hero__stats {
    display: grid;
    gap: 16px;
    margin-top: 16px;
}

.auth-hero__stats article {
    padding: 18px 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(4px);
}

.auth-hero__stats span {
    display: block;
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(246, 251, 248, 0.7);
}

.auth-hero__stats strong {
    display: block;
    margin-top: 6px;
    font-size: 1rem;
}

.auth-hero--compact {
    justify-content: center;
}

.auth-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-card__header h2 {
    margin: 0 0 8px;
    font-size: 2rem;
}

.auth-card__header p,
.auth-switch {
    color: var(--text-soft);
}

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

.stack-form--three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
}

.stack-form label,
.inline-form label,
.inline-filter label {
    display: grid;
    gap: 8px;
    color: var(--text-soft);
    font-size: 0.95rem;
}

input,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text);
    padding: 14px 16px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(28, 122, 98, 0.12);
}

.btn {
    border: 0;
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
    padding: 12px 18px;
    font-weight: 700;
}

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

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-secondary {
    background: var(--surface-muted);
    color: var(--text);
    border: 1px solid var(--line);
}

.btn-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.btn-block {
    width: 100%;
}

.btn-small {
    padding: 9px 14px;
    font-size: 0.9rem;
}

.auth-switch {
    margin-top: 18px;
}

.auth-switch a,
.text-link {
    color: var(--primary-dark);
    font-weight: 700;
}

.alert {
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin: 18px 0;
    border: 1px solid transparent;
}

.alert-success {
    background: #e5f4ee;
    border-color: #b8dfcf;
    color: #135540;
}

.alert-error {
    background: #fbe7e7;
    border-color: #efc0c0;
    color: #8e3333;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background:
        linear-gradient(180deg, rgba(15, 84, 67, 0.98), rgba(10, 51, 42, 0.98));
    color: #ecf8f2;
    padding: 28px 22px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.sidebar__brand strong,
.sidebar__brand span {
    display: block;
}

.sidebar__brand span {
    color: rgba(236, 248, 242, 0.7);
    font-size: 0.9rem;
}

.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    font-weight: 800;
    background: rgba(255, 255, 255, 0.16);
    color: #fff7e5;
}

.sidebar__nav {
    display: grid;
    gap: 8px;
}

.sidebar__nav a,
.sidebar__logout {
    padding: 13px 15px;
    border-radius: 14px;
    color: rgba(236, 248, 242, 0.76);
    transition: background 0.2s ease, color 0.2s ease;
}

.sidebar__nav a:hover,
.sidebar__nav a.is-active,
.sidebar__logout:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.sidebar__footer {
    margin-top: auto;
    padding: 20px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.08);
}

.sidebar__footer p {
    margin-top: 0;
    color: rgba(236, 248, 242, 0.78);
    line-height: 1.6;
}

.main-content {
    width: 100%;
    margin-left: var(--sidebar-width);
    padding: 26px clamp(18px, 3vw, 34px) 30px;
}

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

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.74rem;
    color: var(--text-soft);
    margin: 0 0 8px;
}

.topbar h1 {
    margin: 0;
    font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.topbar__subtitle {
    margin: 8px 0 0;
    color: var(--text-soft);
}

.topbar__user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(217, 228, 220, 0.8);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.topbar__user span {
    display: block;
    color: var(--text-soft);
    font-size: 0.88rem;
}

.topbar__avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary-dark);
    display: grid;
    place-items: center;
    font-weight: 800;
}

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

.hero-panel,
.panel,
.metric-card {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(217, 228, 220, 0.76);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}

.hero-panel {
    padding: clamp(22px, 4vw, 34px);
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(228, 243, 236, 0.96));
}

.hero-panel h2 {
    margin: 0 0 8px;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.hero-panel p {
    margin: 0;
    color: var(--text-soft);
}

.hero-panel__metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    min-width: 260px;
}

.hero-panel__metrics div {
    padding: 16px;
    background: rgba(255, 255, 255, 0.72);
    border-radius: 18px;
}

.hero-panel__metrics span,
.stat-stack span {
    display: block;
    color: var(--text-soft);
    font-size: 0.9rem;
}

.hero-panel__metrics strong,
.stat-stack strong {
    display: block;
    margin-top: 6px;
    font-size: 1.4rem;
}

.card-grid {
    display: grid;
    gap: 18px;
    margin-top: 22px;
}

.card-grid--metrics {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.metric-card {
    padding: 20px;
}

.metric-card__icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-weight: 800;
    margin-bottom: 16px;
}

.metric-card p,
.panel__header p,
.goal-card p,
.reminder-item p,
.mini-list p,
.site-footer p,
.empty-state,
.breakdown-item__header span,
.goal-card__values,
.stat-stack article,
.inline-filter span,
.inline-form span {
    color: var(--text-soft);
}

.metric-card p,
.metric-card h3 {
    margin: 0;
}

.metric-card h3 {
    margin-top: 6px;
    font-size: 1.8rem;
}

.metric-card small {
    display: block;
    margin-top: 10px;
    color: var(--text-soft);
}

.content-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 18px;
    margin-top: 22px;
}

.panel {
    padding: 22px;
}

.panel--wide {
    min-width: 0;
}

.panel__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.panel__header h2 {
    margin: 0 0 8px;
}

.table-wrap {
    overflow-x: auto;
}

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

th,
td {
    text-align: left;
    padding: 15px 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    font-size: 0.86rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-soft);
}

.empty-state {
    padding: 10px 0;
}

.reminder-list,
.goal-list,
.mini-list,
.breakdown-list,
.stat-stack {
    display: grid;
    gap: 14px;
}

.reminder-item,
.goal-card,
.mini-list article,
.stat-stack article {
    padding: 16px 18px;
    background: var(--surface-muted);
    border: 1px solid var(--line);
    border-radius: 18px;
}

.reminder-item {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.83rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.badge-warning {
    background: var(--warning-soft);
    color: #935b0b;
}

.badge-info {
    background: var(--info-soft);
    color: var(--info);
}

.goal-card__meta,
.goal-card__values,
.breakdown-item__header,
.action-row,
.inline-filter,
.goal-card__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.goal-card__meta strong {
    font-size: 1.35rem;
}

.goal-card__meta h3,
.goal-card__meta p,
.breakdown-item__header strong,
.breakdown-item__header span {
    margin: 0;
}

.goal-card--full {
    padding: 20px;
}

.progress-bar {
    width: 100%;
    height: 12px;
    border-radius: 999px;
    background: #e5ece6;
    overflow: hidden;
    margin: 14px 0 10px;
}

.progress-bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary), #36a484);
}

.inline-form {
    display: flex;
    align-items: end;
    gap: 12px;
    flex-wrap: wrap;
}

.action-row {
    align-items: stretch;
    flex-wrap: wrap;
}

.site-footer {
    margin-top: 24px;
    text-align: center;
    padding: 12px;
}

@media (max-width: 1180px) {
    .card-grid--metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

    .stack-form--three {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 920px) {
    .auth-layout,
    .auth-layout--reverse {
        grid-template-columns: 1fr;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

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

    .mobile-overlay {
        position: fixed;
        inset: 0;
        background: rgba(11, 25, 21, 0.45);
        z-index: 15;
    }

    body.nav-open .mobile-overlay {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding-top: 18px;
    }

    .topbar {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 46px;
        height: 46px;
        border: 1px solid var(--line);
        background: var(--surface);
        border-radius: 14px;
        box-shadow: var(--shadow);
        cursor: pointer;
    }

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

    .hero-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-panel__metrics {
        min-width: auto;
    }
}

@media (max-width: 640px) {
    .auth-hero,
    .auth-card,
    .panel,
    .hero-panel {
        padding: 20px;
    }

    .card-grid--metrics,
    .hero-panel__metrics {
        grid-template-columns: 1fr;
    }

    .topbar__user,
    .goal-card__meta,
    .goal-card__values,
    .goal-card__actions,
    .panel__header,
    .inline-filter,
    .inline-form,
    .reminder-item {
        flex-direction: column;
        align-items: flex-start;
    }

    table {
        min-width: 520px;
    }
}

