* { box-sizing:border-box }
:root {
  color-scheme:light;
  --bg:#f5f6fa; --surface:#fff; --ink:#181b2d; --muted:#555d73;
  --line:#e2e5ee; --control:#cdd2e2; --accent:#5235c7; --accent-strong:#4026aa;
  --accent-soft:#eeebff; --shadow:0 1px 2px #20204508,0 8px 24px #20204508;
  --radius:16px;
  font:15px/1.5 "Aptos","Segoe UI",system-ui,sans-serif;
}
body { margin:0; background:var(--bg); color:var(--ink); min-height:100vh }
.signed-in { display:grid; grid-template-columns:248px minmax(0,1fr) }
.bar { display:flex; flex-direction:column; background:var(--surface); border-inline-end:1px solid var(--line); padding:24px 16px }
.signed-in .bar { position:sticky; top:0; height:100vh; height:100dvh; overflow:auto }
.identity { display:flex; gap:11px; align-items:center; padding:0 5px }
.identity > div { display:grid; gap:2px }
.identity > div > span { color:var(--muted); font-size:.76rem }
.brand { color:var(--ink); font-size:.91rem; font-weight:760; text-decoration:none; line-height:1.22 }
.monogram,.avatar { flex:none; display:grid; place-items:center; color:white; background:var(--accent); font-weight:760 }
.monogram { width:41px; height:41px; border-radius:13px; font-size:.77rem; letter-spacing:.07em }
.avatar { width:34px; height:34px; border-radius:50%; background:var(--accent-soft); color:var(--accent-strong) }
nav { display:grid; gap:4px; margin-top:34px }
nav a { display:flex; align-items:center; gap:9px; min-height:43px; padding:0 11px; border-radius:9px;
  white-space:nowrap; text-decoration:none; color:var(--muted); font-weight:630; font-size:.9rem }
nav a:hover { background:#f5f3fd; color:var(--ink) }
nav a[aria-current] { background:var(--accent-soft); color:var(--accent-strong); font-weight:740 }
.nav-icon { width:21px; text-align:center; font-size:1.05rem; font-weight:650; flex:none }
.sidebar-footer { display:flex; align-items:center; gap:9px; margin-top:auto; padding:14px 5px 0; border-top:1px solid var(--line); font-size:.85rem }
.sidebar-footer strong { overflow-wrap:anywhere }
.sidebar-footer button { color:var(--muted); padding:0; min-height:24px; background:none; border:0; font-size:.78rem }
.sidebar-footer button:hover { background:none; color:var(--accent); text-decoration:underline }
main { width:min(calc(100% - 72px),1320px); min-width:0; margin:32px auto 56px }
.page-top { display:flex; align-items:end; justify-content:space-between; flex-wrap:wrap; gap:12px; margin-bottom:24px }
.page-context { display:block; color:var(--muted); font-size:.83rem; font-weight:650; margin-bottom:5px }
h1,h2,h3 { line-height:1.17; margin:0 0 .7rem; letter-spacing:-.024em }
h1 { font-size:clamp(2rem,4vw,2.78rem); letter-spacing:-.055em; font-weight:780; margin:0 }
h2 { font-size:1.25rem; font-weight:740 }
h3 { font-size:1.02rem; font-weight:740 }
p { margin:.65rem 0 1rem }
section,details,.card { min-width:0; margin:0 0 15px; padding:clamp(16px,2.2vw,26px); background:var(--surface);
  border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow) }
section > p,.intro-note,.intro > p,small { color:var(--muted) }
small { display:block; font-size:.79rem; line-height:1.5; overflow-wrap:anywhere }
details > :last-child,section > :last-child { margin-bottom:0 }
details details,section details { box-shadow:none; background:#f8f9fc; margin:14px 0 }
summary { cursor:pointer; font-weight:710 }
summary::marker { color:var(--accent) }
a { color:var(--accent-strong); text-underline-offset:3px }
a:hover { color:var(--accent) }
button,input,select,.button { font:inherit }
form { display:grid; gap:14px; max-width:42rem }
.form-row { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px }
.period-filter { grid-template-columns:minmax(6rem,9rem) minmax(10rem,1fr) auto; align-items:end }
.quarter-selector { display:grid; gap:14px }
.year-navigation { display:flex; align-items:center; gap:10px; font-variant-numeric:tabular-nums }
.year-navigation .button { min-height:33px; padding:2px 11px; font-size:1.15rem }
.quarter-tabs { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; max-width:40rem }
.quarter-tabs a { display:grid; min-width:0; padding:8px 10px; text-decoration:none; color:var(--ink);
  border:1px solid var(--line); border-radius:10px; background:#fcfcfe }
.quarter-tabs a:hover,.quarter-tabs a[aria-current] { background:var(--accent-soft); color:var(--accent-strong); border-color:#ad9cec }
.quarter-tabs a[aria-current] strong { color:var(--accent-strong) }
.notice ul { margin:6px 0 0; padding-inline-start:1.25rem }
.field,label:not(.upload-area,.camera-button) { display:grid; min-width:0; gap:6px; font-size:.86rem; font-weight:690 }
.field-label { color:#383e55 }
input:not([type=hidden]),select {
  width:100%; min-width:0; min-height:44px; padding:9px 12px;
  border:1px solid var(--control); border-radius:10px; background:#fcfcfe; color:var(--ink);
  font-size:.93rem; font-weight:550;
  transition:border-color .15s,box-shadow .15s,background .15s;
}
input:not([type=hidden]):hover,select:hover { border-color:#989bb6; background:white }
input:not([type=hidden]):focus,select:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px #5235c724; background:white }
select { appearance:none; cursor:pointer; padding-inline-end:34px }
.field--select { position:relative }
.field--select::after { content:""; position:absolute; right:15px; bottom:19px; width:7px; height:7px;
  border:solid var(--muted); border-width:0 2px 2px 0; transform:rotate(45deg); pointer-events:none }
@supports (appearance:base-select) and selector(select::picker(select)) {
  select,select::picker(select) { appearance:base-select }
  .field--select::after { display:none }
  select { padding-inline-end:12px }
  select::picker-icon { color:var(--muted); transition:rotate .15s }
  select:open::picker-icon { rotate:180deg }
  select::picker(select) { margin-block:5px; max-height:min(340px,55vh); border:1px solid var(--line); border-radius:13px;
    padding:5px; background:white; box-shadow:0 14px 40px #26214a26; color:var(--ink) }
  option { min-height:38px; padding:8px 11px; border-radius:7px; font-size:.9rem; gap:8px }
  option:hover,option:focus-visible { background:#f3f0ff }
  option:checked { color:var(--accent-strong); background:var(--accent-soft); font-weight:720 }
}
.field--date input { font-variant-numeric:tabular-nums; color:#323650; cursor:pointer }
.field--date input::-webkit-calendar-picker-indicator { width:17px; height:17px; padding:4px;
  border-radius:6px; background-color:var(--accent-soft); cursor:pointer }
button,.button { display:inline-flex; align-items:center; justify-content:center; justify-self:start; gap:.4rem;
  max-width:100%; min-height:41px; padding:8px 15px; border:1px solid transparent; border-radius:10px;
  background:var(--accent); color:white; font-size:.86rem; font-weight:710; cursor:pointer; text-decoration:none;
  transition:background .15s,box-shadow .15s }
button:hover,.button:hover { background:var(--accent-strong); color:white }
.secondary,.match-search button { color:#383653; background:white; border-color:var(--control) }
.secondary:hover,.match-search button:hover { color:var(--accent-strong); background:var(--accent-soft); border-color:#b8a8fb }
:focus-visible { outline:2px solid var(--accent); outline-offset:3px }
.intro,.actions { display:flex; align-items:center; flex-wrap:wrap; gap:.65rem }
.intro { justify-content:space-between; margin-bottom:16px }
.intro > p { margin:0 }
.cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,218px),1fr)); gap:14px; margin:0 0 18px }
.card { display:grid; gap:5px; margin:0; text-decoration:none; color:var(--ink) }
a.card:hover { border-color:#a999ea; color:var(--ink); box-shadow:0 8px 22px #5235c714 }
.card span { color:var(--muted); font-size:.85rem }
.card span:first-child { font-weight:730 }
.card strong,.record-amount { font-size:clamp(1.6rem,4vw,2.45rem); letter-spacing:-.055em; font-variant-numeric:tabular-nums }
.guide { display:grid; gap:12px; border:1px solid #e4ddff; border-radius:13px; padding:14px; background:#f8f6ff }
.guide p { margin:0; font-size:.88rem; color:#44395c }
.guide p:empty { display:none }
.notice { margin:0 0 14px; padding:10px 13px; border:1px solid #cae9db; border-radius:10px; background:#ebf8f2; color:#205540 }
.warning { border-color:#eedeb1; background:#fffaeb; color:#684e1f }
.error { border-color:#f1c9c5; background:#fff1ef; color:#922d25 }
.scroll { overflow:auto; border:1px solid var(--line); border-radius:11px; margin-top:12px }
table { width:100%; border-collapse:collapse; text-align:left; font-size:.88rem }
th,td { padding:11px 13px; text-align:left; vertical-align:top; border-bottom:1px solid var(--line) }
th { color:var(--muted); background:#f6f6fb; font-size:.76rem; font-weight:760; letter-spacing:.02em }
tbody tr:last-child td { border-bottom:0 }
tbody tr:hover { background:#faf9ff }
code { overflow-wrap:anywhere }
dd { margin:0 0 .65rem }
.chart-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,330px),1fr)); gap:14px; align-items:start; margin-bottom:14px }
.chart-grid section { margin:0 }
.chart-grid td:first-child { width:6rem; font-variant-numeric:tabular-nums; color:var(--accent-strong); font-weight:750 }
.document-row { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:10px; padding:11px 12px;
  border:1px solid var(--line); border-radius:12px; background:#fafafe; margin:9px 0 }
.document-row strong,.match-row a { overflow-wrap:anywhere }
.document-row .button,.match-row button { min-height:37px; font-size:.81rem }
.record-header { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; flex-wrap:wrap;
  background:linear-gradient(114deg,#fff 35%,#f0ebff); border-color:#e4dcfc }
.record-header p { margin:.35rem 0 }
.record-workspace { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:15px; align-items:start }
.match-panel { margin-top:20px; padding-top:17px; border-top:1px solid var(--line) }
.match-search { grid-template-columns:minmax(0,1fr) auto; align-items:end; margin-bottom:10px }
.match-row { display:grid; grid-template-columns:minmax(0,1fr) auto auto; align-items:center; gap:10px; border-top:1px solid var(--line); padding:11px 0 }
.match-panel .match-row { grid-template-columns:minmax(0,1fr) auto }
.match-row a { font-weight:710 }
.match-status { display:inline-block; margin-top:4px; border-radius:999px; padding:2px 9px; background:#e4f6ec; color:#215840; font-size:.75rem; font-weight:710 }
.match-amount { white-space:nowrap; font-variant-numeric:tabular-nums }
.record-totals { display:grid; justify-items:end; gap:3px }
.movement-tags { display:flex; flex-wrap:wrap; gap:4px; margin-top:4px }
.movement-chip { display:inline-flex; align-items:center; white-space:nowrap; padding:2px 8px;
  border-radius:999px; font-size:.73rem; font-weight:720; line-height:1.5 }
.movement-chip--in { color:#14543d; background:#dff4e9 }
.movement-chip--out { color:#932d27; background:#fae5e3 }
.movement-chip--review { color:#714c0a; background:#fff0c5 }
.movement-chip--void { color:#545c70; background:#e9ebf2 }
.inbox-upload { background:linear-gradient(155deg,#fff 54%,#f4f0ff) }
.inbox-workspace { display:grid; grid-template-columns:minmax(0,1.15fr) minmax(0,1fr); gap:15px; align-items:start }
.inbox-lists { min-width:0 }
.upload-control { display:grid; gap:8px; min-width:0 }
.upload-area,.camera-button { position:relative; cursor:pointer; overflow-wrap:anywhere }
.upload-area { display:flex; align-items:center; gap:13px; min-height:90px; padding:14px 16px;
  border:1.5px dashed #88aaa5; border-radius:13px; background:#f3faf8; transition:border-color .15s,background .15s }
.upload-area.compact { min-height:70px; padding:11px }
.upload-area input,.camera-button input { position:absolute; inset:0; opacity:0; cursor:pointer; width:100%; height:100%; margin:0 }
.upload-area small { margin-top:3px; font-weight:450 }
.upload-icon { display:grid; place-items:center; flex:0 0 38px; height:38px; border-radius:11px; color:#145944; background:#dbefe7; font-size:1.3rem; font-weight:760 }
.upload-area:hover,.upload-area:focus-within,.upload-area.is-dragging { background:#e3f4ed; border-color:#437e67 }
.upload-area:focus-within,.camera-button:focus-within { outline:2px solid var(--accent); outline-offset:3px }
.upload-area.has-file { border-style:solid; border-color:#6aa890 }
.upload-area.has-error { background:#fff0ed; border-color:#b34738 }
.camera-button { display:none; align-items:center; gap:8px; justify-self:start; min-height:43px; padding:8px 12px;
  border:1px solid var(--control); border-radius:10px; background:white; color:#403968; font-size:.85rem; font-weight:720 }
.camera-button:hover { background:var(--accent-soft) }
.upload-caption { color:var(--muted); font-size:.86rem; margin:0 }
.signed-out .bar { align-items:center; border-inline-end:0; border-bottom:1px solid var(--line) }
.signed-out main { width:min(calc(100% - 32px),460px); margin:7vh auto }
.login { padding:clamp(22px,6vw,36px) }
.login h1 { margin-bottom:1rem }
.login button { width:100%; margin-top:5px }
@media (max-width:1120px) { main { width:calc(100% - 42px) } .signed-in { grid-template-columns:208px minmax(0,1fr) } }
@media (max-width:950px) { .record-workspace,.inbox-workspace { grid-template-columns:minmax(0,1fr) } }
@media (max-width:760px) {
  .signed-in { display:block }
  .signed-in .bar { position:static; height:auto; overflow:visible; padding:13px 14px 7px; border-inline-end:0; border-bottom:1px solid var(--line) }
  .identity { padding:0 }
  .identity > div { padding-inline-end:80px }
  .signed-in .bar { position:relative }
  .sidebar-footer { position:absolute; right:15px; top:14px; padding:0; margin:0; border:0 }
  .sidebar-footer .avatar,.sidebar-footer strong { display:none }
  nav { display:flex; overflow:auto; margin:10px -4px 0; padding:3px 4px; scrollbar-width:thin }
  nav a { min-height:40px; padding:0 9px; font-size:.82rem; gap:5px }
  nav .nav-icon { width:15px }
  main { width:calc(100% - 28px); margin-top:23px }
  .page-top { margin-bottom:16px; align-items:center }
  .page-top .button { min-height:38px; padding-inline:10px }
}
@media (pointer:coarse), (max-width:760px) { .camera-button.camera-ready { display:inline-flex } }
@media (max-width:480px) {
  .match-row { grid-template-columns:minmax(0,1fr) auto }
  .match-row > form { grid-column:1/-1 }
  .form-row,.period-filter { grid-template-columns:minmax(0,1fr) }
}
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { transition:none !important } }
