:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --soft: #f7f9fc;
    --line: #e4eaf3;
    --line-strong: #d5deec;
    --ink: #252934;
    --muted: #8995aa;
    --sidebar: #141923;
    --sidebar-soft: #1f2531;
    --blue: #2f63f6;
    --blue-dark: #1f50d8;
    --blue-soft: #e8efff;
    --pink: #ff3d78;
    --pink-soft: #ffe8f0;
    --teal: #12a889;
    --teal-soft: #ddf5ef;
    --orange: #ff7a30;
    --orange-soft: #fff0e6;
    --cyan: #42c6df;
    --danger: #ff3d67;
    --danger-soft: #ffe7ee;
    --warning: #f6a623;
    --warning-soft: #fff5de;
    --shadow: 0 18px 45px rgba(22, 32, 54, 0.06);
    --shadow-strong: 0 22px 70px rgba(22, 32, 54, 0.14);
    --radius: 8px;
    --sidebar-width: 270px;
}

* {
    box-sizing: border-box;
}

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

body {
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    letter-spacing: 0;
    line-height: 1.48;
    margin: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--blue);
    text-decoration: none;
}

a:hover {
    color: var(--blue-dark);
}

svg {
    display: block;
    fill: currentColor;
    height: 18px;
    width: 18px;
}

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

h1 {
    color: var(--ink);
    font-size: 22px;
    font-weight: 820;
    letter-spacing: 0;
    line-height: 1.2;
    margin: 0;
}

h2 {
    color: var(--ink);
    font-size: 17px;
    font-weight: 820;
    letter-spacing: 0;
    line-height: 1.25;
    margin: 0;
}

h3 {
    color: var(--ink);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.25;
    margin: 0;
}

small,
.muted {
    color: var(--muted);
}

button,
input,
select,
textarea {
    font: inherit;
    letter-spacing: 0;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.52;
    transform: none;
}

button:disabled:hover {
    box-shadow: none;
    transform: none;
}

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

.sidebar {
    background: var(--sidebar);
    bottom: 0;
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 18px;
    left: 0;
    overflow-y: auto;
    padding: 26px 16px;
    position: fixed;
    top: 0;
    width: var(--sidebar-width);
    z-index: 30;
}

.brand {
    align-items: center;
    color: #fff;
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    min-height: 42px;
}

.brand:hover {
    color: #fff;
}

.brand-mark {
    align-items: center;
    background: linear-gradient(135deg, var(--pink), var(--orange));
    border-radius: 7px 7px 7px 2px;
    color: #fff;
    display: inline-flex;
    flex: 0 0 32px;
    font-size: 14px;
    font-weight: 900;
    height: 32px;
    justify-content: center;
    width: 32px;
}

.brand strong {
    color: #fff;
    display: block;
    font-size: 20px;
    font-weight: 860;
    line-height: 1.05;
}

.brand small {
    color: #8f9aad;
    display: block;
    font-size: 12px;
    font-weight: 680;
    margin-top: 3px;
}

.sidebar-section {
    color: #8d96a9;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: 0;
    padding: 0 18px;
    text-transform: uppercase;
}

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

.nav a {
    align-items: center;
    border-radius: var(--radius);
    color: #a6b0c2;
    display: grid;
    font-size: 14px;
    font-weight: 760;
    gap: 12px;
    grid-template-columns: 24px minmax(0, 1fr) auto;
    min-height: 44px;
    padding: 9px 14px;
    transition: background 0.16s ease, color 0.16s ease;
}

.nav a:hover,
.nav a.active {
    background: var(--sidebar-soft);
    color: #fff;
}

.nav a.active .nav-icon {
    color: var(--blue);
}

.nav a small {
    background: #2bc4d3;
    border-radius: 999px;
    color: #fff;
    font-size: 10px;
    font-weight: 850;
    padding: 3px 7px;
}

.nav-icon {
    align-items: center;
    color: #71809a;
    display: flex;
    justify-content: center;
}

.side-mini {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius);
    margin-top: auto;
    padding: 16px;
}

.side-mini span {
    color: #8d96a9;
    display: block;
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
}

.side-mini strong {
    color: #fff;
    display: block;
    font-size: 22px;
    font-weight: 860;
    margin: 8px 0;
}

.side-mini small {
    color: #97a2b4;
}

.workspace {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.topbar {
    align-items: center;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 18px;
    justify-content: space-between;
    min-height: 74px;
    padding: 16px 24px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-title,
.topbar-actions {
    align-items: center;
    display: flex;
    gap: 12px;
    min-width: 0;
}

.topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.topbar-icon,
.month-icon {
    align-items: center;
    border-radius: var(--radius);
    display: inline-flex;
    flex: 0 0 auto;
    height: 40px;
    justify-content: center;
    width: 40px;
}

.topbar-icon {
    background: var(--blue-soft);
    color: var(--blue);
}

.topbar-title h1 {
    font-size: 20px;
}

.sr-only {
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.month-switcher {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: 0 10px 24px rgba(25, 37, 63, 0.04);
    display: grid;
    gap: 8px;
    grid-template-columns: 34px minmax(132px, 1fr) auto;
    min-height: 46px;
    padding: 5px;
}

.month-icon {
    background: var(--soft);
    color: #52627f;
    height: 34px;
    width: 34px;
}

.month-switcher input {
    border: 0;
    color: var(--ink);
    min-height: 34px;
    padding: 0 4px;
}

.month-switcher input:focus {
    box-shadow: none;
}

.month-switcher button {
    min-height: 34px;
    padding: 7px 13px;
}

.quick-add {
    min-height: 46px;
}

.month-switcher button,
.quick-add {
    white-space: nowrap;
}

.top-icon {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: var(--radius);
    color: #43506a;
    cursor: pointer;
    display: inline-flex;
    height: 36px;
    justify-content: center;
    padding: 0;
    width: 36px;
}

.top-icon:hover {
    background: var(--soft);
}

.searchbox {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: #29354f;
    display: flex;
    gap: 10px;
    height: 42px;
    padding: 0 15px;
    width: 300px;
}

.searchbox input {
    border: 0;
    color: var(--ink);
    min-height: 0;
    padding: 0;
}

.searchbox input:focus {
    box-shadow: none;
}

.avatar {
    align-items: center;
    background: linear-gradient(135deg, #172033, #415577);
    border-radius: 999px;
    color: #fff;
    display: inline-flex;
    font-size: 11px;
    font-weight: 850;
    height: 34px;
    justify-content: center;
    width: 34px;
}

.page {
    padding: 26px 24px 28px;
}

.page-bar {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
}

.breadcrumbs {
    align-items: center;
    color: #7180a6;
    display: flex;
    font-size: 13px;
    font-weight: 700;
    gap: 8px;
}

.breadcrumbs strong {
    color: var(--blue);
}

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

.dashboard-toolbar p {
    color: var(--muted);
    margin: 0;
}

.toolbar-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.button,
button,
.quick-add,
.account-link,
.logout-button,
.soft-action,
.action-grid a {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink);
    cursor: pointer;
    display: inline-flex;
    font-size: 14px;
    font-weight: 800;
    gap: 8px;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.button:hover,
button:hover,
.quick-add:hover,
.account-link:hover,
.logout-button:hover,
.soft-action:hover,
.action-grid a:hover {
    border-color: #cbd6e8;
    box-shadow: var(--shadow);
    color: var(--ink);
    transform: translateY(-1px);
}

.button.primary,
button.primary,
.quick-add {
    background: var(--blue);
    border-color: var(--blue);
    box-shadow: 0 12px 26px rgba(47, 99, 246, 0.22);
    color: #fff;
}

.button.primary:hover,
button.primary:hover,
.quick-add:hover {
    background: var(--blue-dark);
    border-color: var(--blue-dark);
    color: #fff;
}

.topbar .quick-add {
    min-height: 48px;
}

.quick-add span {
    color: inherit;
}

.account-link,
.logout-button {
    background: #fff;
    color: #52627f;
    min-height: 48px;
}

.account-link span,
.logout-button span {
    color: inherit;
}

.logout-form {
    margin: 0;
}

.logout-button {
    box-shadow: none;
}

.soft-action {
    background: var(--blue-soft);
    border-color: var(--blue-soft);
    color: var(--blue);
}

.soft-action.pink {
    background: var(--pink-soft);
    border-color: var(--pink-soft);
    color: var(--pink);
}

.icon-button {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: var(--radius);
    color: #98a5bb;
    display: inline-flex;
    font-size: 22px;
    font-weight: 900;
    height: 32px;
    justify-content: center;
    line-height: 1;
    min-height: 32px;
    padding: 0;
    width: 32px;
}

.icon-button:hover {
    background: var(--soft);
    box-shadow: none;
}

.inline-filter {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(150px, 1fr) auto;
    padding: 6px;
}

label {
    color: #5d6a85;
    display: grid;
    font-size: 12px;
    font-weight: 820;
    gap: 7px;
}

input,
select,
textarea {
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    color: var(--ink);
    font-size: 14px;
    min-height: 42px;
    padding: 10px 12px;
    width: 100%;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(47, 99, 246, 0.10);
    outline: 0;
}

textarea {
    min-height: 96px;
    resize: vertical;
}

.dashboard-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-grid > *,
.transaction-overview-grid > *,
.monthly-command-grid > *,
.goal-command-grid > *,
.split > *,
.kpi-grid > *,
.transaction-mini-grid > * {
    min-width: 0;
}

.span-2 {
    grid-column: span 2;
}

.dashboard-kpis,
.dashboard-report {
    grid-column: span 2;
}

.dashboard-history {
    grid-column: 1 / -1;
}

.promo-card,
.balance-card,
.system-card,
.kpi-card,
.goal-tile,
.monthly-goal-card,
.summary-card,
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 1px 0 rgba(30, 43, 69, 0.02);
}

.promo-card {
    background:
        radial-gradient(circle at 80% 12%, rgba(255, 255, 255, 0.28), transparent 28%),
        linear-gradient(135deg, #2351f4 0%, #4427c8 55%, #592bd0 100%);
    color: #fff;
    min-height: 220px;
    overflow: hidden;
    padding: 28px;
    position: relative;
}

.promo-card::after {
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    content: "";
    height: 230px;
    position: absolute;
    right: -55px;
    top: -85px;
    width: 230px;
}

.promo-card span {
    color: rgba(255, 255, 255, 0.74);
    display: block;
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
}

.promo-card h2 {
    color: #fff;
    font-size: 25px;
    line-height: 1.15;
    margin: 14px 0;
    max-width: 340px;
}

.promo-card p {
    color: rgba(255, 255, 255, 0.74);
    margin-bottom: 18px;
    max-width: 380px;
}

.promo-card a {
    background: var(--pink);
    border-radius: var(--radius);
    color: #fff;
    display: inline-flex;
    font-weight: 850;
    padding: 10px 14px;
}

.balance-card {
    min-height: 220px;
    overflow: hidden;
    padding: 26px;
    position: relative;
}

.balance-card::after {
    background: radial-gradient(circle, rgba(47, 99, 246, 0.08) 0 2px, transparent 2px);
    background-size: 9px 9px;
    content: "";
    height: 190px;
    opacity: 0.7;
    position: absolute;
    right: -20px;
    top: -10px;
    width: 190px;
}

.card-head,
.section-title {
    align-items: center;
    display: flex;
    gap: 14px;
    justify-content: space-between;
    margin-bottom: 18px;
    position: relative;
    z-index: 1;
}

.card-head small,
.section-title small {
    display: block;
    margin-top: 4px;
}

.balance-card > strong,
.kpi-card strong,
.summary-card strong {
    color: var(--ink);
    display: block;
    font-size: 26px;
    font-weight: 860;
    line-height: 1;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}

.balance-card > small {
    color: var(--muted);
    display: block;
    font-weight: 750;
    position: relative;
    z-index: 1;
}

.card-chip {
    background: var(--teal-soft);
    border-radius: 999px;
    color: var(--teal);
    font-size: 12px;
    font-weight: 850;
    padding: 5px 10px;
}

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

.mini-progress {
    background: #edf1f7;
    border-radius: 999px;
    height: 8px;
    margin: 22px 0;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.mini-progress span {
    background: linear-gradient(90deg, var(--blue), var(--teal));
    display: block;
    height: 100%;
}

.balance-actions {
    display: flex;
    gap: 8px;
    position: relative;
    z-index: 1;
}

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

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

.kpi-card,
.summary-card {
    min-height: 98px;
    overflow: hidden;
    padding: 22px;
    position: relative;
}

.kpi-card::after {
    background: var(--pink-soft);
    border-radius: 40px 0 0 0;
    bottom: 0;
    content: "";
    height: 72px;
    position: absolute;
    right: 0;
    width: 84px;
}

.kpi-card span,
.summary-card span,
.eyebrow {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 820;
    text-transform: uppercase;
}

.kpi-card small,
.summary-card small {
    color: var(--muted);
    position: relative;
    z-index: 1;
}

.kpi-card.success strong,
.good-text {
    color: var(--teal);
}

.kpi-card.danger strong,
.danger-text {
    color: var(--danger);
}

.system-card,
.panel {
    padding: 24px;
}

.report-card {
    min-height: 430px;
}

.bar-report {
    align-items: end;
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(12, minmax(24px, 1fr));
    min-height: 310px;
    padding-top: 20px;
}

.bar-month {
    align-items: center;
    display: grid;
    gap: 10px;
    justify-items: center;
}

.bar-stack {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
    height: 240px;
    justify-content: center;
}

.bar-income,
.bar-expense {
    border-radius: 999px;
    display: block;
    width: 12px;
}

.bar-income {
    background: var(--teal);
}

.bar-expense {
    background: #e6ebf2;
}

.bar-month small {
    color: var(--ink);
}

.chart-tip {
    cursor: help;
    outline: none;
    position: relative;
}

.chart-tip::after,
.chart-tip::before {
    left: 50%;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    transform: translate(-50%, 8px);
    transition: opacity 0.16s ease, transform 0.16s ease;
    z-index: 80;
}

.chart-tip::after {
    background: #101827;
    border-radius: 7px;
    bottom: calc(100% + 11px);
    box-shadow: 0 16px 34px rgba(16, 24, 39, 0.22);
    color: #fff;
    content: attr(data-tooltip);
    font-size: 12px;
    font-weight: 760;
    line-height: 1.35;
    max-width: 230px;
    padding: 8px 10px;
    text-align: center;
    white-space: normal;
    width: max-content;
}

.chart-tip::before {
    border: 6px solid transparent;
    border-top-color: #101827;
    bottom: calc(100% - 1px);
    content: "";
}

.chart-tip:hover::after,
.chart-tip:hover::before,
.chart-tip:focus-visible::after,
.chart-tip:focus-visible::before {
    opacity: 1;
    transform: translate(-50%, 0);
}

.select-pill {
    background: var(--soft);
    border-radius: var(--radius);
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
    padding: 10px 14px;
}

.gauge {
    align-items: center;
    aspect-ratio: 2 / 1;
    background:
        radial-gradient(circle at 50% 100%, #fff 0 44%, transparent 45%),
        conic-gradient(from 270deg, var(--blue) var(--value), #e8eef8 0 50%, transparent 0);
    border-radius: 220px 220px 0 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    margin: 16px auto 20px;
    max-width: 230px;
    padding-bottom: 26px;
}

.gauge strong {
    font-size: 23px;
    font-weight: 850;
}

.gauge span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
}

.cash-split,
.plan-health-grid,
.goal-money-grid,
.monthly-card-metrics,
.compact-stats {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cash-split span,
.plan-health-grid span,
.goal-money-grid span,
.monthly-card-metrics span,
.compact-stats span,
.split-row,
.transfer-mini-list span {
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    padding: 10px;
    text-transform: uppercase;
}

.cash-split strong,
.plan-health-grid strong,
.goal-money-grid strong,
.monthly-card-metrics strong,
.compact-stats strong {
    color: var(--ink);
    display: block;
    font-size: 15px;
    margin-top: 4px;
    text-transform: none;
}

.insight-box,
.success-strip {
    background: #dff4ef;
    border-radius: var(--radius);
    color: var(--teal);
    font-weight: 820;
    margin-top: 18px;
    padding: 14px;
}

.plan-snapshot-card .compact-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rate-list {
    display: grid;
}

.rate-list div {
    align-items: center;
    border-bottom: 1px dashed var(--line);
    display: flex;
    justify-content: space-between;
    padding: 11px 0;
}

.rate-list div:last-child {
    border-bottom: 0;
}

.rate-list span {
    color: var(--ink);
    font-weight: 760;
}

.rate-list strong {
    color: var(--teal);
}

.donut {
    aspect-ratio: 1;
    background:
        radial-gradient(circle at center, #fff 0 58%, transparent 59%),
        conic-gradient(var(--blue) 0 var(--progress), #df613c var(--progress) 78%, var(--cyan) 78% 100%);
    border-radius: 50%;
    margin: 22px auto;
    max-width: 220px;
    width: 72%;
}

.donut.compact {
    max-width: 150px;
    width: 150px;
}

.legend-row {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.legend-row span {
    align-items: center;
    color: var(--muted);
    display: inline-flex;
    gap: 6px;
}

.legend-row i {
    border-radius: 999px;
    display: inline-block;
    height: 12px;
    width: 12px;
}

.legend-row .blue {
    background: var(--blue);
}

.legend-row .orange {
    background: #df613c;
}

.legend-row .cyan {
    background: var(--cyan);
}

.action-list-card {
    display: grid;
    gap: 12px;
}

.action-list-card a {
    align-items: center;
    border-bottom: 1px dashed var(--line);
    color: var(--ink);
    display: flex;
    font-weight: 800;
    justify-content: space-between;
    padding: 12px 0;
}

.action-list-card a:last-child {
    border-bottom: 0;
}

.transaction-overview-grid,
.monthly-command-grid,
.goal-command-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: 1fr 2fr;
    margin-bottom: 24px;
}

.monthly-command-grid {
    grid-template-columns: 1.05fr 1.05fr 1fr;
}

.goal-command-grid {
    grid-template-columns: 1fr 2fr;
}

.transaction-mix-card {
    align-items: center;
    display: grid;
    gap: 28px;
    grid-template-columns: 220px minmax(0, 1fr);
}

.payment-stat-stack {
    display: grid;
    gap: 24px;
}

.plan-health-card {
    align-items: center;
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 0.9fr);
    margin-bottom: 24px;
}

.plan-health-card.good {
    background: linear-gradient(90deg, #fff, #f0fbf7);
}

.plan-health-card.warning {
    background: linear-gradient(90deg, #fff, #fff2f5);
}

.monthly-plan-form {
    margin: 0;
}

.table-card {
    margin-bottom: 24px;
}

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

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

th,
td {
    border-bottom: 1px dashed var(--line);
    padding: 14px 12px;
    text-align: left;
    vertical-align: middle;
}

th {
    background: #f1f4f9;
    color: #101827;
    font-size: 13px;
    font-weight: 820;
}

td strong {
    display: block;
}

td small {
    color: var(--muted);
    display: block;
    margin-top: 2px;
}

.clean-table table {
    min-width: 720px;
}

.transfer-row td {
    background: #fbfcff;
    padding-top: 0;
}

.status-pill {
    background: var(--teal-soft);
    border-radius: 999px;
    color: var(--teal);
    display: inline-flex;
    font-size: 12px;
    font-weight: 850;
    padding: 5px 10px;
}

.status-pill.paused {
    background: var(--warning-soft);
    color: #e18a12;
}

.status-pill.completed {
    background: var(--blue-soft);
    color: var(--blue);
}

.table-input {
    min-width: 150px;
}

.split {
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.goal-grid,
.monthly-goal-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.goal-tile,
.monthly-goal-card {
    padding: 18px;
}

.goal-tile-header {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 12px;
}

.goal-tile-header h3 {
    margin-top: 8px;
}

.goal-tile-header > strong {
    color: var(--blue);
    font-size: 24px;
}

.progress {
    background: #edf1f7;
    border-radius: 999px;
    height: 7px;
    overflow: hidden;
}

.progress div {
    background: linear-gradient(90deg, var(--blue), var(--teal));
    height: 100%;
}

.goal-money-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 14px;
}

.goal-note {
    background: var(--soft);
    border-left: 3px solid var(--blue);
    color: var(--muted);
    margin: 14px 0 0;
    padding: 10px;
}

.goal-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 14px;
}

.empty-state {
    align-items: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 260px;
    padding: 28px;
    text-align: center;
}

.empty-icon {
    align-items: center;
    background: var(--blue-soft);
    border-radius: 999px;
    color: var(--blue);
    display: flex;
    height: 62px;
    justify-content: center;
    margin-bottom: 14px;
    width: 62px;
}

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

.form-grid,
.modal-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.category-field,
.category-chips,
label.wide {
    grid-column: 1 / -1;
}

.amount-field {
    grid-row: span 2;
}

.amount-input {
    font-size: 36px;
    font-weight: 860;
    min-height: 116px;
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    background: #f6f8fc;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 780;
    min-height: 34px;
    padding: 7px 12px;
}

.chip:hover,
.chip.active {
    background: var(--blue);
    color: #fff;
}

.toggle-card {
    align-items: center;
    background: #fbfcff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    display: flex;
    gap: 12px;
    padding: 13px;
}

.toggle-card input {
    flex: 0 0 auto;
    min-height: 18px;
    width: 18px;
}

.toggle-card strong {
    display: block;
}

.split-toggle {
    background: var(--orange-soft);
    border-color: #ffd9c2;
}

.split-preview {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
}

.split-preview[hidden] {
    display: none;
}

.split-grid,
.transfer-mini-list {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.transfer-mini-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 8px;
}

.split-row {
    min-height: 96px;
}

.split-row span,
.split-row small,
.split-row strong {
    display: block;
}

.split-row strong {
    color: var(--blue);
    font-size: 18px;
    margin-top: 10px;
}

.modal-lock {
    overflow: hidden;
}

.modal {
    align-items: center;
    display: none;
    inset: 0;
    justify-content: center;
    padding: 24px;
    position: fixed;
    z-index: 100;
}

.modal.open {
    display: flex;
}

.modal-backdrop {
    background: rgba(16, 22, 34, 0.42);
    backdrop-filter: blur(5px);
    inset: 0;
    position: absolute;
}

.modal-panel {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-strong);
    max-height: calc(100vh - 48px);
    max-width: 1060px;
    overflow-y: auto;
    position: relative;
    width: min(1060px, 100%);
    z-index: 1;
}

.compact-modal {
    max-width: 760px;
}

.modal-header {
    align-items: flex-start;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding: 24px 26px;
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
}

.modal-header h2 {
    font-size: 24px;
}

.modal-form {
    display: grid;
    gap: 16px;
    padding: 24px 26px 26px;
}

.modal-actions {
    align-items: center;
    border-top: 1px solid var(--line);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin: 4px -26px -26px;
    padding: 18px 26px;
}

.notice {
    border-radius: var(--radius);
    margin: 18px 0;
    padding: 12px 14px;
}

.notice.success {
    background: var(--teal-soft);
    border: 1px solid #bce6dc;
    color: var(--teal);
}

.notice.danger {
    background: var(--danger-soft);
    border: 1px solid #ffc8d5;
    color: var(--danger);
}

.auth-body {
    align-items: center;
    background: linear-gradient(90deg, #101622 0 38%, var(--bg) 38% 100%);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    overflow-x: hidden;
    padding: 24px;
}

.auth-shell {
    background: #fff;
    border: 1px solid rgba(213, 222, 236, 0.9);
    border-radius: var(--radius);
    box-shadow: var(--shadow-strong);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 430px;
    min-height: 640px;
    overflow: hidden;
    width: min(1080px, 100%);
}

.auth-panel {
    background: var(--sidebar);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 36px;
    position: relative;
}

.auth-brand {
    align-items: center;
    color: #fff;
    display: flex;
    gap: 12px;
}

.auth-brand:hover {
    color: #fff;
}

.auth-brand strong {
    color: #fff;
    display: block;
    font-size: 22px;
}

.auth-brand small,
.auth-copy p {
    color: #9aa5b8;
}

.auth-copy {
    margin-top: 96px;
}

.auth-copy h1 {
    color: #fff;
    font-size: 38px;
    line-height: 1.08;
    margin: 12px 0 16px;
    max-width: 420px;
}

.auth-copy p {
    font-size: 15px;
    margin-bottom: 0;
    max-width: 430px;
}

.auth-stat-row {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding-top: 18px;
}

.auth-stat-row span {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius);
    color: #8f9aad;
    font-size: 11px;
    font-weight: 820;
    padding: 12px;
    text-transform: uppercase;
}

.auth-stat-row strong {
    color: #fff;
    display: block;
    font-size: 13px;
    margin-top: 4px;
    text-transform: none;
}

.auth-card {
    align-content: center;
    background: #fff;
    border: 0;
    box-shadow: none;
    display: grid;
    padding: 44px;
}

.auth-card-head {
    margin-bottom: 24px;
}

.auth-card-head h2 {
    font-size: 28px;
    line-height: 1.15;
    margin-top: 8px;
}

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

.auth-form label {
    font-size: 13px;
}

.auth-form input {
    min-height: 48px;
}

.auth-submit {
    margin-top: 6px;
    min-height: 50px;
    width: 100%;
}

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

.account-summary {
    text-align: left;
}

.account-avatar {
    align-items: center;
    background: linear-gradient(135deg, var(--blue), var(--teal));
    border-radius: 999px;
    color: #fff;
    display: flex;
    font-size: 26px;
    font-weight: 900;
    height: 78px;
    justify-content: center;
    margin: 8px 0 18px;
    width: 78px;
}

.inline-account-form {
    padding: 0;
}

.account-actions {
    margin: 4px 0 0;
    padding: 18px 0 0;
}

.user-command-grid {
    margin-top: 0;
}

.users-table-card {
    margin-top: 0;
}

.user-cell {
    align-items: center;
    display: flex;
    gap: 12px;
}

.user-avatar {
    align-items: center;
    background: linear-gradient(135deg, var(--blue), var(--teal));
    border-radius: 999px;
    color: #fff;
    display: inline-flex;
    flex: 0 0 38px;
    font-size: 14px;
    font-weight: 900;
    height: 38px;
    justify-content: center;
    width: 38px;
}

.admin-note {
    align-items: center;
    background: var(--blue-soft);
    border: 1px solid #d5e0ff;
    border-radius: var(--radius);
    color: var(--blue);
    display: grid;
    gap: 4px 12px;
    grid-template-columns: 38px minmax(0, 1fr);
    padding: 14px;
}

.admin-note span {
    align-items: center;
    background: #fff;
    border-radius: 999px;
    display: flex;
    grid-row: span 2;
    height: 38px;
    justify-content: center;
    width: 38px;
}

.admin-note strong {
    color: var(--ink);
}

.admin-note small {
    color: #687794;
}

.setup-body {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 20px;
}

.setup-panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 580px;
    padding: 30px;
}

@media (max-width: 1280px) {
    .dashboard-grid,
    .monthly-command-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-kpis,
    .dashboard-cash,
    .dashboard-goal-pressure,
    .dashboard-donut,
    .dashboard-plan {
        grid-column: span 1;
    }

    .dashboard-report,
    .dashboard-history {
        grid-column: 1 / -1;
    }

    .rate-card,
    .action-list-card {
        grid-column: span 1;
    }

    .goal-command-grid,
    .transaction-overview-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1040px) {
    :root {
        --sidebar-width: 92px;
    }

    .sidebar {
        align-items: center;
        padding: 20px 10px;
    }

    .brand span:not(.brand-mark),
    .sidebar-section,
    .side-mini,
    .nav a span:not(.nav-icon),
    .nav a small {
        display: none;
    }

    .nav a {
        display: flex;
        justify-content: center;
        padding: 10px;
        width: 48px;
    }

    .searchbox {
        width: 230px;
    }

    .dashboard-grid,
    .monthly-command-grid,
    .split {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: span 1;
    }

    .dashboard-kpis,
    .dashboard-report,
    .dashboard-history,
    .dashboard-cash,
    .dashboard-goal-pressure,
    .dashboard-donut,
    .dashboard-plan {
        grid-column: 1 / -1;
    }

    .auth-shell {
        grid-template-columns: 1fr;
        max-width: 560px;
        min-height: 0;
    }

    .auth-panel {
        min-height: 300px;
    }

    .auth-card {
        border-left: 0;
    }

    .auth-copy {
        margin-top: 48px;
    }

    .auth-copy h1 {
        font-size: 31px;
    }
}

@media (max-width: 760px) {
    .topbar {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
        padding: 14px;
    }

    .topbar-title,
    .topbar-actions {
        justify-content: space-between;
        width: 100%;
    }

    .topbar-actions {
        align-items: stretch;
    }

    .searchbox {
        flex: 1;
        width: auto;
    }

    .month-switcher,
    .quick-add,
    .account-link,
    .logout-form,
    .logout-button {
        flex: 1;
        min-width: min(100%, 240px);
    }

    .logout-button {
        width: 100%;
    }

    .flag-dot,
    .avatar {
        display: none;
    }

    .page {
        padding: 20px 14px;
    }

    .page-bar,
    .dashboard-toolbar,
    .card-head,
    .section-title {
        align-items: flex-start;
        flex-direction: column;
    }

    .breadcrumbs {
        display: none;
    }

    .kpi-grid,
    .transaction-mini-grid,
    .cash-split,
    .plan-health-grid,
    .goal-money-grid,
    .monthly-card-metrics,
    .compact-stats,
    .split-grid,
    .transfer-mini-list,
    .form-grid,
    .modal-grid {
        grid-template-columns: 1fr;
    }

    .transaction-mix-card,
    .plan-health-card {
        grid-template-columns: 1fr;
    }

    .bar-report {
        gap: 10px;
        overflow-x: auto;
    }

    .bar-month {
        min-width: 42px;
    }

    .modal {
        padding: 18px 14px 18px calc(var(--sidebar-width) + 14px);
    }

    .modal-panel {
        border-radius: var(--radius);
        max-height: calc(100vh - 36px);
        min-height: 0;
        width: 100%;
    }

    .modal-actions {
        flex-direction: column-reverse;
    }

    .modal-actions .button,
    .modal-actions button {
        width: 100%;
    }

    .auth-body {
        background: var(--bg);
        padding: 14px;
    }

    .auth-shell {
        min-height: 0;
        width: 100%;
    }

    .auth-panel,
    .auth-card {
        padding: 24px;
    }

    .auth-copy h1 {
        font-size: 27px;
    }

    .auth-stat-row {
        display: none;
    }
}

@media (max-width: 520px) {
    :root {
        --sidebar-width: 0px;
    }

    .sidebar {
        display: none;
    }

    .workspace {
        margin-left: 0;
    }

    .modal {
        padding: 0;
    }

    .modal-panel {
        border-radius: 0;
        max-height: 100vh;
        min-height: 100vh;
    }
}
