:root {
  --ink: #26251f;
  --muted: #6f6b60;
  --paper: #f7f4ed;
  --card: rgba(255, 253, 248, 0.92);
  --line: #dfd8c9;
  --line-strong: #cfc5b1;
  --amber: #edb92f;
  --amber-strong: #d99f08;
  --amber-soft: #fff3c7;
  --green: #2f765c;
  --red: #a34d40;
  --shadow: 0 22px 70px rgba(69, 56, 26, 0.09);
  --radius: 22px;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: light; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }

.ambient { position: fixed; z-index: -1; border-radius: 999px; filter: blur(4px); pointer-events: none; }
.ambient-one { width: 520px; height: 520px; right: -220px; top: -180px; background: rgba(240, 190, 56, 0.13); }
.ambient-two { width: 360px; height: 360px; left: 30%; bottom: -230px; background: rgba(255, 231, 155, 0.17); }

.hidden { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 7px; color: #968a6f; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.17em; }
.form-error { min-height: 1.25rem; margin: 0; color: var(--red); font-size: 0.86rem; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(430px, 100%);
  padding: 44px;
  border: 1px solid rgba(207, 197, 177, 0.82);
  border-radius: 30px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 13px;
  color: #2c291f;
  background: linear-gradient(145deg, #ffd960, var(--amber));
  box-shadow: 0 10px 24px rgba(217, 159, 8, 0.25);
  font-weight: 900;
}
.login-card .brand-mark { width: 58px; height: 58px; margin-bottom: 30px; border-radius: 17px; font-size: 1.3rem; }
.login-card h1 { margin: 0 0 10px; font-size: clamp(1.8rem, 6vw, 2.4rem); letter-spacing: -0.05em; }
.login-card > .muted { margin: 0 0 32px; line-height: 1.7; }
.login-form { display: grid; gap: 12px; }
.login-form label, .field > span, .filters label > span { color: #5d594f; font-size: 0.78rem; font-weight: 750; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.76);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
input, select { min-height: 48px; padding: 0 14px; }
textarea { padding: 13px 14px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--amber-strong); background: #fff; box-shadow: 0 0 0 4px rgba(237, 185, 47, 0.14); }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: 246px;
  flex-direction: column;
  padding: 26px 18px;
  border-right: 1px solid rgba(207, 197, 177, 0.65);
  background: rgba(248, 245, 238, 0.87);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 13px; padding: 2px 8px 30px; }
.brand strong { display: block; max-width: 150px; overflow: hidden; font-size: 0.92rem; text-overflow: ellipsis; white-space: nowrap; }
.brand small { display: block; margin-top: 3px; color: #989184; font-size: 0.66rem; letter-spacing: 0.11em; text-transform: uppercase; }
.side-nav { display: grid; gap: 7px; }
.nav-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 0;
  border-radius: 13px;
  color: #726d61;
  background: transparent;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 700;
  text-align: left;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.7); }
.nav-item.active { color: var(--ink); background: #fff; box-shadow: 0 8px 25px rgba(70, 55, 20, 0.07); }
.nav-icon { display: grid; width: 25px; height: 25px; place-items: center; border: 1px solid var(--line); border-radius: 8px; font-size: 1rem; }
.nav-item.active .nav-icon { border-color: #edc85f; background: var(--amber-soft); }
.sidebar-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding: 12px 8px 0; }
.status-badge { padding: 6px 9px; border: 1px solid #e4d6a9; border-radius: 999px; color: #77632a; background: #fff8dc; font-size: 0.67rem; font-weight: 800; }
.text-button { padding: 6px; border: 0; color: #716b5e; background: transparent; cursor: pointer; font-size: 0.78rem; font-weight: 750; }
.text-button:hover { color: var(--ink); }

.workspace { min-height: 100vh; margin-left: 246px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  min-height: 96px;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(24px, 4vw, 64px);
  border-bottom: 1px solid rgba(207, 197, 177, 0.48);
  background: rgba(247, 244, 237, 0.8);
  backdrop-filter: blur(20px);
}
.topbar h1 { margin: 0; font-size: 1.35rem; letter-spacing: -0.035em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.month-control { display: flex; align-items: center; gap: 10px; padding: 5px 5px 5px 13px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.67); }
.month-control span { color: var(--muted); font-size: .72rem; font-weight: 700; }
.month-control input { min-height: 35px; width: 140px; padding: 0 8px; border: 0; background: transparent; box-shadow: none; }

main { width: min(1220px, 100%); margin: 0 auto; padding: 46px clamp(24px, 4vw, 64px) 90px; }
.page { display: none; animation: fade-in 220ms ease both; }
.page.active { display: block; }
@keyframes fade-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.hero-row, .section-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.hero-row h2, .section-intro h2, .review-head h2 { margin: 12px 0 8px; font-size: clamp(1.6rem, 3.4vw, 2.6rem); letter-spacing: -0.055em; line-height: 1.08; }
.hero-row p, .review-head p { margin: 0; color: var(--muted); line-height: 1.65; }
.step-pill { display: inline-flex; padding: 7px 10px; border: 1px solid #e2cf8b; border-radius: 999px; color: #755e1c; background: rgba(255, 246, 207, 0.65); font-size: 0.68rem; font-weight: 850; letter-spacing: .05em; }
.trust-note { flex: 0 0 auto; padding: 14px 17px; border: 1px solid #d4dfd9; border-radius: 15px; color: #3c6655; background: rgba(248, 255, 251, .8); font-size: .78rem; font-weight: 750; line-height: 1.35; }
.trust-note span { display: inline-grid; width: 20px; height: 20px; margin-right: 6px; place-items: center; border-radius: 999px; color: #fff; background: var(--green); }
.trust-note small { padding-left: 30px; color: #74877f; font-weight: 500; }

.scan-grid, .summary-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(290px, .8fr); gap: 22px; align-items: start; }
.card { border: 1px solid rgba(207, 197, 177, 0.78); border-radius: var(--radius); background: var(--card); box-shadow: 0 16px 50px rgba(76, 61, 25, .055); backdrop-filter: blur(12px); }
.upload-card, .tips-card, .review-card, #page-expenses > .card, .summary-grid > .card { padding: clamp(20px, 3vw, 31px); }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.card-heading h3 { margin: 0; font-size: 1.05rem; letter-spacing: -.025em; }
.card-number { color: #b6aa91; font-size: .72rem; font-weight: 850; letter-spacing: .08em; }

.drop-zone { position: relative; min-height: 310px; overflow: hidden; border: 1.5px dashed #cdbb7e; border-radius: 18px; background: linear-gradient(145deg, rgba(255,250,229,.74), rgba(255,255,255,.7)); cursor: pointer; transition: border-color 150ms, background 150ms, transform 150ms; }
.drop-zone:hover, .drop-zone.dragging { border-color: var(--amber-strong); background: #fff8de; transform: translateY(-1px); }
.drop-zone:focus-visible { outline: 4px solid rgba(237,185,47,.2); }
.upload-empty { position: absolute; inset: 0; display: grid; place-content: center; padding: 32px; text-align: center; }
.capture-icon { display: grid; width: 62px; height: 62px; margin: 0 auto 18px; place-items: center; border: 1px solid #ead084; border-radius: 19px; background: #ffe9a2; box-shadow: 0 12px 25px rgba(203, 151, 18, .16); font-size: 1.7rem; }
.upload-empty h4 { margin: 0 0 8px; font-size: 1.05rem; }
.upload-empty p { max-width: 300px; margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.6; }
.receipt-preview { position: absolute; inset: 0; }
.receipt-preview img { width: 100%; height: 100%; object-fit: contain; background: #e9e6de; }
.preview-meta { position: absolute; right: 12px; bottom: 12px; left: 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px; border: 1px solid rgba(255,255,255,.7); border-radius: 13px; background: rgba(255,255,255,.88); backdrop-filter: blur(12px); }
.preview-meta strong { min-width: 0; overflow: hidden; font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.preview-meta span { flex: 0 0 auto; color: var(--muted); font-size: .7rem; }
.capture-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }

.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 8px; padding: 0 17px; border: 1px solid transparent; border-radius: 13px; cursor: pointer; font-weight: 800; transition: transform 140ms, box-shadow 140ms, background 140ms; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0); }
.button:disabled { opacity: .42; cursor: not-allowed; }
.button-primary { border-color: #e6b32c; color: #27241b; background: linear-gradient(135deg, #ffd864, var(--amber)); box-shadow: 0 10px 24px rgba(218, 159, 8, .18); }
.button-primary:hover:not(:disabled) { box-shadow: 0 13px 28px rgba(218, 159, 8, .25); }
.button-secondary { border-color: var(--line); background: rgba(255,255,255,.75); }
.button-dark { color: #fffdf7; background: #2c2b26; }
.button-ghost { border-color: transparent; color: var(--muted); background: transparent; }
.button-block { width: 100%; }
.button-large { min-height: 52px; padding-inline: 25px; }

.scan-status { display: flex; align-items: center; gap: 9px; margin: 15px 0 13px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: #faf8f2; font-size: .76rem; }
.scan-status.busy { color: #755e1c; border-color: #ead692; background: #fff8dc; }
.scan-status.success { color: var(--green); border-color: #cadfd5; background: #f3fbf7; }
.scan-status.error { color: var(--red); border-color: #e8cbc6; background: #fff6f4; }
.status-dot { width: 7px; height: 7px; border-radius: 999px; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 12%, transparent); }
.scan-status.busy .status-dot { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.8); } }
#reset-receipt-button { display: block; margin: 10px auto 0; }
.manual-entry-inline { display: block; margin: 8px auto 0; }

.tip-list { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.tip-list li { display: flex; gap: 13px; padding: 14px 0; border-bottom: 1px solid #e9e3d8; }
.tip-list li:last-child { border-bottom: 0; }
.tip-list li > span { display: grid; width: 27px; height: 27px; place-items: center; flex: 0 0 auto; border: 1px solid #ead58b; border-radius: 9px; color: #82691f; background: #fff6d5; font-size: .7rem; font-weight: 850; }
.tip-list strong { font-size: .84rem; }
.tip-list p, .privacy-note p { margin: 4px 0 0; color: var(--muted); font-size: .75rem; line-height: 1.55; }
.privacy-note { margin-top: 18px; padding: 16px; border-radius: 14px; background: #f1eee6; }
.privacy-note strong { font-size: .78rem; }

.review-card { margin-top: 22px; }
.review-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding-bottom: 25px; border-bottom: 1px solid var(--line); }
.review-head h2 { font-size: 1.7rem; }
.confidence-badge { padding: 8px 11px; border: 1px solid #e5d59f; border-radius: 999px; color: #765f1e; background: #fff7d9; font-size: .72rem; font-weight: 850; white-space: nowrap; }
.confidence-badge.good { color: var(--green); border-color: #cce0d6; background: #f1faf6; }
.warning-box { margin: 20px 0 0; padding: 14px 16px; border: 1px solid #e8d593; border-radius: 13px; color: #715d23; background: #fff9e4; font-size: .78rem; line-height: 1.6; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 25px; }
.field { display: grid; align-content: start; gap: 8px; }
.field-wide { grid-column: 1 / -1; }
.input-prefix { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.76); transition: border-color 150ms, box-shadow 150ms; }
.input-prefix:focus-within { border-color: var(--amber-strong); background: #fff; box-shadow: 0 0 0 4px rgba(237,185,47,.14); }
.input-prefix b { padding-left: 14px; color: #8b8069; font-size: .75rem; }
.input-prefix input { border: 0; background: transparent; box-shadow: none; }
.select-action { display: grid; grid-template-columns: 1fr 48px; gap: 7px; }
.select-action button { border: 1px solid var(--line); border-radius: 13px; background: #fff; cursor: pointer; font-size: 1.1rem; }
.review-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 25px; padding-top: 22px; border-top: 1px solid var(--line); }

.section-intro { align-items: center; }
.section-intro h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
.filters { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(180px, .4fr); gap: 12px; margin-bottom: 20px; }
.filters label { display: grid; gap: 7px; }
.expense-list { display: grid; }
.expense-row { display: grid; grid-template-columns: 105px minmax(160px, 1.2fr) minmax(120px, .8fr) minmax(110px, .7fr) 130px 40px; align-items: center; gap: 13px; padding: 16px 4px; border-bottom: 1px solid #e7e1d5; }
.expense-row:first-child { border-top: 1px solid #e7e1d5; }
.expense-row .date { color: var(--muted); font-size: .78rem; }
.expense-row .vendor { min-width: 0; }
.expense-row .vendor strong { display: block; overflow: hidden; font-size: .86rem; text-overflow: ellipsis; white-space: nowrap; }
.expense-row .vendor small, .expense-row .project { display: block; overflow: hidden; margin-top: 4px; color: var(--muted); font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.category-chip { justify-self: start; padding: 6px 9px; border-radius: 999px; color: #66592f; background: #f4efdd; font-size: .68rem; font-weight: 800; }
.expense-row .amount { justify-self: end; font-size: .88rem; font-weight: 850; font-variant-numeric: tabular-nums; }
.receipt-link { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid var(--line); border-radius: 10px; color: #6e685c; background: #fff; font-size: .8rem; }
.empty-state { padding: 70px 20px; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--ink); }
.empty-state p { margin: 8px 0 0; font-size: .82rem; }

.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 22px; }
.metric-card { padding: 23px; border: 1px solid var(--line); border-radius: 19px; background: linear-gradient(145deg, rgba(255,255,255,.9), rgba(255,250,231,.7)); box-shadow: 0 12px 35px rgba(69,55,21,.045); }
.metric-card span, .metric-card small { display: block; color: var(--muted); font-size: .72rem; }
.metric-card strong { display: block; margin: 12px 0 7px; font-size: clamp(1.4rem, 2.7vw, 2rem); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.summary-grid { grid-template-columns: 1fr 1fr; }
.bar-list { display: grid; gap: 17px; }
.bar-item { display: grid; grid-template-columns: minmax(80px, .65fr) minmax(120px, 1.4fr) auto; align-items: center; gap: 12px; }
.bar-label { overflow: hidden; font-size: .76rem; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { width: 100%; height: 8px; overflow: hidden; border: 0; border-radius: 999px; background: #eee9df; appearance: none; }
.bar-track::-webkit-progress-bar { border-radius: 999px; background: #eee9df; }
.bar-track::-webkit-progress-value { border-radius: 999px; background: linear-gradient(90deg, #ffd761, var(--amber)); }
.bar-track::-moz-progress-bar { border-radius: 999px; background: linear-gradient(90deg, #ffd761, var(--amber)); }
.bar-value { color: var(--muted); font-size: .7rem; font-variant-numeric: tabular-nums; }
.bar-empty { padding: 40px 0; color: var(--muted); font-size: .78rem; text-align: center; }

.mobile-nav { display: none; }
.toast { position: fixed; z-index: 100; right: 26px; bottom: 26px; max-width: min(380px, calc(100vw - 32px)); padding: 13px 17px; border: 1px solid #c9ded4; border-radius: 13px; color: #285d48; background: #f2fbf7; box-shadow: 0 15px 45px rgba(30,48,39,.15); opacity: 0; pointer-events: none; transform: translateY(15px); transition: opacity 180ms, transform 180ms; font-size: .82rem; font-weight: 750; }
.toast.show { opacity: 1; transform: none; }
.toast.error { color: var(--red); border-color: #e6c7c1; background: #fff6f4; }

dialog { width: min(460px, calc(100vw - 30px)); padding: 0; border: 0; border-radius: 23px; background: #fffdf8; box-shadow: 0 35px 100px rgba(40,35,24,.28); }
dialog::backdrop { background: rgba(35,32,25,.42); backdrop-filter: blur(4px); }
.dialog-card { padding: 31px; text-align: center; }
.dialog-icon { display: grid; width: 50px; height: 50px; margin: 0 auto 17px; place-items: center; border-radius: 999px; color: #7d6320; background: #ffedaa; font-size: 1.3rem; font-weight: 900; }
.dialog-card h2 { margin: 0 0 8px; font-size: 1.4rem; }
.dialog-card > p { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.6; }
.duplicate-detail { margin: 19px 0; padding: 14px; border-radius: 13px; background: #f5f1e9; font-size: .78rem; line-height: 1.6; text-align: left; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }

@media (max-width: 900px) {
  .sidebar { width: 210px; }
  .workspace { margin-left: 210px; }
  .scan-grid { grid-template-columns: 1fr; }
  .tips-card { display: none; }
  .expense-row { grid-template-columns: 95px minmax(130px, 1fr) 95px 40px; }
  .expense-row .project, .expense-row .category-chip { display: none; }
}

@media (max-width: 700px) {
  .sidebar { display: none; }
  .workspace { margin-left: 0; }
  .topbar { min-height: 76px; padding: 13px 17px; }
  .topbar .eyebrow { display: none; }
  .topbar h1 { font-size: 1.08rem; }
  .topbar-actions { gap: 7px; }
  .month-control { padding: 4px; }
  .month-control span { display: none; }
  .month-control input { width: 128px; }
  #manual-entry-button { display: none; }
  main { padding: 27px 15px calc(105px + env(safe-area-inset-bottom)); }
  .hero-row { align-items: flex-start; margin-bottom: 22px; }
  .hero-row h2 { font-size: 1.85rem; }
  .hero-row p { font-size: .82rem; }
  .trust-note { display: none; }
  .scan-grid { gap: 15px; }
  .upload-card, .review-card, #page-expenses > .card, .summary-grid > .card { padding: 19px; border-radius: 19px; }
  .drop-zone { min-height: 335px; }
  .capture-actions { grid-template-columns: 1fr; }
  .capture-actions .button { min-height: 49px; }
  .form-grid { grid-template-columns: 1fr; gap: 15px; }
  .field-wide { grid-column: auto; }
  .review-head h2 { font-size: 1.45rem; }
  .review-head p { font-size: .78rem; }
  .review-actions { flex-direction: column; }
  .review-actions .button { width: 100%; }
  .review-actions .button-primary { order: -1; }
  .section-intro { align-items: flex-end; }
  .section-intro h2 { font-size: 1.55rem; }
  .section-intro .button { min-height: 40px; padding-inline: 12px; font-size: .72rem; }
  .filters { grid-template-columns: 1fr; }
  .expense-row { grid-template-columns: minmax(0, 1fr) auto 36px; gap: 10px; padding: 15px 1px; }
  .expense-row .date { grid-column: 1; grid-row: 2; font-size: .68rem; }
  .expense-row .vendor { grid-column: 1; grid-row: 1; }
  .expense-row .amount { grid-column: 2; grid-row: 1 / 3; }
  .receipt-link { grid-column: 3; grid-row: 1 / 3; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card:first-child { grid-column: 1 / -1; }
  .metric-card { padding: 18px; }
  .summary-grid { grid-template-columns: 1fr; }
  .mobile-nav {
    position: fixed;
    right: 14px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    left: 14px;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding: 7px;
    border: 1px solid rgba(207,197,177,.8);
    border-radius: 19px;
    background: rgba(255,253,248,.93);
    box-shadow: 0 16px 50px rgba(56,47,27,.18);
    backdrop-filter: blur(18px);
  }
  .mobile-nav button { display: grid; gap: 2px; place-items: center; min-height: 53px; border: 0; border-radius: 14px; color: #7b7569; background: transparent; font-size: .66rem; font-weight: 750; }
  .mobile-nav button span { font-size: 1.1rem; }
  .mobile-nav button.active { color: #3d361e; background: #fff3c7; }
  .toast { right: 16px; bottom: calc(91px + env(safe-area-inset-bottom)); left: 16px; }
  .login-card { padding: 30px 24px; border-radius: 24px; }
}

@media (max-width: 390px) {
  .month-control input { width: 118px; font-size: .78rem; }
  .drop-zone { min-height: 300px; }
  .preview-meta { align-items: flex-start; flex-direction: column; gap: 4px; }
  .confidence-badge { display: none; }
  .metric-card strong { font-size: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}


.role-badge { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--card); font-size: .7rem; font-weight: 800; }
.theme-toggle { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--card); cursor: pointer; font-size: 1rem; }
.theme-toggle:hover { border-color: var(--amber-strong); transform: translateY(-1px); }
.login-form select { min-height: 48px; }

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f2efe8;
  --muted: #a9a49a;
  --paper: #17191d;
  --card: rgba(31, 34, 40, .94);
  --line: #3b3f47;
  --line-strong: #555b66;
  --amber-soft: #423717;
  --green: #83c7a8;
  --red: #ef9b8b;
  --shadow: 0 22px 70px rgba(0, 0, 0, .3);
}
:root[data-theme="dark"] body { background: var(--paper); }
:root[data-theme="dark"] .ambient-one { background: rgba(218, 160, 24, .12); }
:root[data-theme="dark"] .ambient-two { background: rgba(95, 88, 45, .15); }
:root[data-theme="dark"] .sidebar, :root[data-theme="dark"] .topbar { border-color: var(--line); background: rgba(23, 25, 29, .88); }
:root[data-theme="dark"] .login-card, :root[data-theme="dark"] .card, :root[data-theme="dark"] .metric-card, :root[data-theme="dark"] dialog { border-color: var(--line); background: var(--card); }
:root[data-theme="dark"] input, :root[data-theme="dark"] select, :root[data-theme="dark"] textarea, :root[data-theme="dark"] .month-control, :root[data-theme="dark"] .input-prefix, :root[data-theme="dark"] .select-action button { border-color: var(--line); color: var(--ink); background: #22252b; }
:root[data-theme="dark"] input:focus, :root[data-theme="dark"] select:focus, :root[data-theme="dark"] textarea:focus { background: #292d34; }
:root[data-theme="dark"] .button-secondary, :root[data-theme="dark"] .receipt-link, :root[data-theme="dark"] .mobile-nav { border-color: var(--line); color: var(--ink); background: #22252b; }
:root[data-theme="dark"] .drop-zone { border-color: #7d6b32; background: linear-gradient(145deg, #302a1b, #23262b); }
:root[data-theme="dark"] .upload-empty p, :root[data-theme="dark"] .privacy-note, :root[data-theme="dark"] .duplicate-detail { color: var(--muted); background: #25282e; }
:root[data-theme="dark"] .preview-meta { border-color: var(--line); background: rgba(31, 34, 40, .9); }
:root[data-theme="dark"] .scan-status { border-color: var(--line); background: #22252b; }
:root[data-theme="dark"] .expense-row { border-color: var(--line); }
:root[data-theme="dark"] .category-chip { color: #e6ce85; background: #3c351b; }
:root[data-theme="dark"] .bar-track, :root[data-theme="dark"] .bar-track::-webkit-progress-bar { background: #343840; }
:root[data-theme="dark"] .nav-item.active { background: #292d34; }
