:root {
  --navy: #11293e;
  --navy-deep: #0b2032;
  --teal: #087d78;
  --teal-light: #e7f5f2;
  --canvas: #f3f6f8;
  --ink: #1a3042;
  --muted: #566b7c;
  --line: #dce5eb;
  --warning: #86530a;
  --danger: #a32936;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.6; }
[hidden] { display: none !important; }
a { color: var(--teal); text-underline-offset: 3px; }
button, input, select { font: inherit; }
button, select, input { border: 1px solid #adbdc9; border-radius: 8px; }
button { background: #fff; color: var(--ink); padding: 10px 15px; font-weight: 600; cursor: pointer; min-height: 44px; }
button:hover:not(:disabled) { border-color: var(--teal); background: var(--teal-light); }
button.primary { color: #fff; background: var(--teal); border-color: var(--teal); }
button.primary:hover:not(:disabled) { background: #06655f; }
button:disabled { opacity: .55; cursor: not-allowed; }
input, select { width: 100%; padding: 10px 11px; min-height: 44px; color: var(--ink); background: #fff; }
input[type="checkbox"] { width: 19px; min-height: 19px; height: 19px; flex-shrink: 0; margin: 3px 0 0; accent-color: var(--teal); }
input:disabled, select:disabled { background: #edf1f4; }
:focus-visible { outline: 3px solid #d67e15; outline-offset: 3px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(27px, 3vw, 36px); line-height: 1.2; letter-spacing: -.8px; margin-bottom: 10px; }
h2 { font-size: 20px; letter-spacing: -.3px; margin-bottom: 18px; }
h3 { font-size: 16px; margin-bottom: 16px; }
p { margin-bottom: 14px; }
.sidebar { width: 244px; background: var(--navy-deep); color: #e5edf3; position: fixed; inset: 0 auto 0 0; padding: 35px 20px; display: flex; flex-direction: column; z-index: 5; }
.brand { color: #fff; text-decoration: none; display: flex; align-items: center; gap: 12px; font-size: 29px; font-weight: 750; letter-spacing: -.7px; padding: 0 12px; }
.brand-mark { display: grid; place-items: center; width: 37px; height: 42px; background: #1eafa0; color: var(--navy-deep); border-radius: 13px 13px 13px 3px; font-size: 31px; }
.brand small { display: block; color: #b1c3d0; font-size: 11px; font-weight: 400; letter-spacing: .6px; }
.nav-label { text-transform: uppercase; letter-spacing: 1.7px; color: #9eb5c6; font-size: 10px; margin: 47px 14px 15px; }
nav { display: grid; gap: 7px; }
nav a { display: flex; align-items: center; gap: 12px; color: #c9d7e1; text-decoration: none; padding: 13px 14px; border-radius: 9px; font-weight: 550; }
nav a span { font-size: 10px; opacity: .7; }
nav a:hover { background: #19374d; }
nav a[aria-current="page"] { background: #164347; color: #b9f5e7; box-shadow: inset 3px 0 #43ceba; }
.sidebar-note { margin-top: auto; padding: 24px 12px 0; color: #c6d5df; font-size: 12px; }
.sidebar-note p { margin: 8px 0 0; color: #9eb5c6; font-size: 11px; }
.local-dot { display: inline-block; width: 7px; height: 7px; background: #53cbb1; border-radius: 50%; margin-right: 6px; }
.workspace { margin-left: 244px; }
.topbar { background: var(--navy); color: #fff; padding: 23px 38px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.eyebrow { font-size: 10px; text-transform: uppercase; letter-spacing: 1.7px; font-weight: 700; color: var(--teal); margin-bottom: 10px; }
.topbar .eyebrow { color: #afc4d4; }
.topbar p { margin: 4px 0 0; font-size: 14px; }
main { max-width: 1680px; margin: auto; padding: 34px 38px 22px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 12px; }
.page-heading p:last-child { margin: 0; color: var(--muted); }
.actions { display: flex; gap: 9px; flex-wrap: wrap; }
.status-line { font-size: 12px; color: var(--muted); margin: 12px 0 25px; min-height: 20px; }
.section-heading, .card-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.badge { display: inline-block; font-size: 11px; font-weight: 650; border-radius: 6px; padding: 4px 8px; color: #426275; background: #edf2f5; white-space: normal; }
.badge.dark { background: #234156; color: #d8e9f2; }
.badge.warning { color: var(--warning); background: #fff1d8; }
.badge.success { color: #08675f; background: var(--teal-light); }
.notice { border: 1px solid #c8dee4; border-left: 3px solid #5696a5; border-radius: 8px; background: #eff7fa; padding: 15px 18px; margin-bottom: 22px; font-size: 13px; }
.notice.warning { background: #fff9ec; border-color: #efd8ad; border-left-color: #be8725; color: #6c4c18; }
.notice.danger { background: #fff1f2; border-color: #edc3c8; border-left-color: var(--danger); color: var(--danger); }
.notice p:last-child, .notice ul:last-child { margin-bottom: 0; }
.notice details summary { cursor: pointer; font-weight: 650; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 17px; margin-bottom: 23px; }
.metric { border: 1px solid var(--line); border-radius: 13px; background: #fff; padding: 22px; min-width: 0; box-shadow: 0 3px 10px #11293e03; }
.metric.accent { background: var(--navy); color: #fff; border-color: var(--navy); }
.metric-label { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
.metric-value { font-size: clamp(21px, 2.1vw, 30px); font-weight: 750; letter-spacing: -.7px; line-height: 1.25; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric-note { font-size: 11px; color: var(--muted); margin: 10px 0 0; }
.accent .metric-label, .accent .metric-note { color: #c0d5e1; }
.two-column { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.card { border: 1px solid var(--line); border-radius: 13px; background: #fff; padding: 24px; margin-bottom: 23px; min-width: 0; box-shadow: 0 3px 10px #11293e03; }
.muted { color: var(--muted); }
.small, .field-help { font-size: 12px; }
.field-help { color: var(--muted); margin: 8px 0 18px; }
.empty { padding: 25px 16px; background: #f7f9fb; border: 1px dashed #c8d5df; border-radius: 8px; color: var(--muted); text-align: center; }
.amount-list { margin: 0 0 17px; }
.amount-row { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; padding: 10px 0; border-bottom: 1px solid #edf1f4; }
.amount-row dt { color: var(--muted); font-size: 13px; }
.amount-row dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.amount-row.total { border-top: 1px solid var(--line); border-bottom: none; margin-top: 8px; }
.amount-row.total dt, .amount-row.total dd { color: var(--ink); font-weight: 750; }
.steps { padding-left: 24px; margin: 10px 0; }
.steps li { padding: 9px 0 9px 3px; border-bottom: 1px solid #edf1f4; }
.step-line { display: flex; justify-content: space-between; gap: 15px; }
.step-line strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
details.calculation { margin-top: 15px; }
details.calculation > summary { cursor: pointer; font-weight: 650; color: var(--teal); padding: 6px 0; }
.table-scroll { max-width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
caption { text-align: left; color: var(--muted); padding: 12px; font-size: 11px; background: #fafcfd; }
th { text-align: left; background: #f1f5f8; color: #4e6677; font-size: 10px; text-transform: uppercase; letter-spacing: .55px; font-weight: 750; padding: 12px; border-bottom: 1px solid var(--line); }
td { padding: 13px 12px; border-bottom: 1px solid #e9eef2; vertical-align: top; overflow-wrap: anywhere; min-width: 90px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcfd; }
td.numeric, th.numeric { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.description { min-width: 210px; max-width: 330px; }
td.evidence { min-width: 170px; max-width: 280px; }
.cell-title { font-weight: 650; }
.cell-detail { color: var(--muted); font-size: 11px; margin-top: 4px; overflow-wrap: anywhere; }
.positive { color: #087467; }
.negative { color: #9a3e40; }
.category-select { min-width: 180px; font-size: 12px; }
.filter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; align-items: end; }
label { display: grid; gap: 7px; font-size: 12px; font-weight: 650; }
.search-field { grid-column: span 3; }
.chart-legend { display: flex; gap: 17px; font-size: 11px; color: var(--muted); margin-bottom: 16px; }
.chart-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }
.legend-income { background: var(--teal); }
.legend-out { background: #627f9e; }
.month-row { display: grid; grid-template-columns: 33px minmax(40px, 1fr) 105px; gap: 10px; align-items: center; margin-bottom: 10px; }
.month-label { font-size: 11px; color: var(--muted); }
.month-bars { display: grid; gap: 4px; }
meter { appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 9px; border: none; background: #edf2f5; border-radius: 3px; overflow: hidden; }
meter::-webkit-meter-bar { background: #edf2f5; border: 0; border-radius: 3px; height: 9px; }
meter::-webkit-meter-optimum-value { background: var(--teal); border-radius: 3px; }
meter::-moz-meter-bar { background: var(--teal); border-radius: 3px; }
meter.outflow::-webkit-meter-optimum-value { background: #627f9e; }
meter.outflow::-moz-meter-bar { background: #627f9e; }
.month-values { text-align: right; font-size: 10px; font-variant-numeric: tabular-nums; line-height: 1.5; }
.month-values span { display: block; }
.category-row { margin: 16px 0; }
.category-row > div { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; font-size: 12px; }
.category-row strong { white-space: nowrap; font-variant-numeric: tabular-nums; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 18px; padding-top: 20px; font-size: 12px; }
fieldset { margin: 0 0 24px; border: 0; border-bottom: 1px solid var(--line); padding: 0 0 24px; }
legend { font-size: 16px; font-weight: 700; margin-bottom: 15px; padding: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.check-label { display: flex; align-items: flex-start; gap: 11px; font-size: 13px; }
.confirmation { margin-bottom: 24px; max-width: 850px; }
.form-footer { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.feedback-error { color: var(--danger); font-size: 13px; padding: 10px 0; }
.feedback-success { color: var(--teal); font-size: 13px; padding: 10px 0; }
.loading-panel { display: flex; justify-content: center; align-items: center; gap: 15px; padding: 80px 20px; color: var(--muted); }
.spinner { display: inline-block; border: 3px solid var(--line); border-top-color: var(--teal); border-radius: 50%; width: 24px; height: 24px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
footer { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 11px; margin-top: 25px; padding-top: 20px; border-top: 1px solid var(--line); }
.skip-link { position: fixed; top: -90px; left: 15px; z-index: 10; background: #fff; padding: 12px 20px; border-radius: 8px; }
.skip-link:focus { top: 12px; }
.topbar .actions { align-items: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 32px 20px; background: var(--navy-deep); }
.login-layout { width: 100%; max-width: 960px; display: grid; grid-template-columns: 1fr 1fr; padding: 0; border-radius: 20px; overflow: hidden; box-shadow: 0 24px 70px #0003; }
.login-intro { padding: 48px 40px; background: var(--navy); color: #e5edf3; display: flex; flex-direction: column; align-items: flex-start; }
.login-intro .brand { padding: 0; margin-bottom: 64px; }
.login-intro .eyebrow { color: #8fe0d3; }
.login-intro h1 { font-size: clamp(32px, 4vw, 44px); margin-bottom: 22px; }
.login-intro > p:not(.eyebrow) { color: #c0d5e1; max-width: 30ch; }
.login-privacy { margin-top: auto; padding-top: 38px; font-size: 13px; font-weight: 650; }
.login-privacy p { margin: 8px 0 0; font-size: 12px; font-weight: 400; color: #c0d5e1; }
.login-card { background: #fff; padding: 48px 40px; }
.login-card h2 { font-size: 28px; margin-bottom: 12px; }
.login-card fieldset { display: grid; gap: 9px; border: 0; padding: 0; margin: 25px 0 0; min-width: 0; }
.login-card input { margin-bottom: 12px; }
.login-card button { margin-top: 8px; width: 100%; }
.login-status { min-height: 24px; margin: 12px 0; font-size: 12px; }
.login-support { border-top: 1px solid var(--line); padding-top: 20px; margin: 24px 0 0; }
@media (max-width: 640px) {
  .login-page { padding: 16px; }
  .login-layout { grid-template-columns: 1fr; }
  .login-intro, .login-card { padding: 28px 24px; }
  .login-intro .brand { margin-bottom: 28px; }
  .login-intro .brand small { display: block; }
  .login-intro > p:not(.eyebrow) { max-width: none; }
  .login-privacy { padding-top: 12px; }
}
@media (min-width: 1600px) { .metric-value { font-size: 31px; } }
@media (max-width: 1200px) {
  .sidebar { width: 213px; padding-left: 13px; padding-right: 13px; }
  .workspace { margin-left: 213px; }
  main { padding: 28px 24px; }
  .topbar { padding: 22px 24px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-column { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
@media (max-width: 760px) {
  .sidebar { position: static; width: 100%; padding: 18px; }
  .brand { font-size: 24px; padding-left: 0; }
  .brand small, .nav-label, .sidebar-note { display: none; }
  nav { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 18px; }
  nav a { padding: 10px; font-size: 12px; }
  .workspace { margin-left: 0; }
  .topbar { padding: 15px 20px; }
  .topbar .eyebrow { font-size: 8px; letter-spacing: 1px; }
  .topbar p { font-size: 12px; }
  main { padding: 24px 16px; }
  .card { padding: 18px; }
  .metric { padding: 17px; }
  .metric-grid { gap: 11px; }
  .metric-value { font-size: 23px; }
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-field { grid-column: 1 / -1; }
  .form-grid { grid-template-columns: 1fr; }
  .badge { font-size: 10px; }
  .amount-row { gap: 12px; }
  .amount-row dd { max-width: 58%; white-space: normal; }
}
@media (max-width: 390px) {
  .metric-grid, .filter-grid { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
  .pagination { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
@media print {
  .sidebar, .topbar, .actions, .pagination, .skip-link, #filters, #profile-form button { display: none; }
  .workspace { margin: 0; }
  main { padding: 0; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .two-column { display: block; }
  .card, .metric { box-shadow: none; break-inside: avoid; }
  .metric.accent { background: #fff; color: #000; }
  .accent .metric-label, .accent .metric-note { color: #333; }
  .table-scroll { overflow: visible; }
}