:root {
  color-scheme: light;
  --canvas: #f4f6f2; --surface: #ffffff; --soft: #e9eee8;
  --ink: #172c28; --muted: #60736b; --line: #d7e0d7;
  --accent: #176654; --accent-hover: #104d40; --accent-soft: #e2f1e9;
  --highlight: #d5ed89; --danger: #a5323c; --danger-soft: #fff0f0;
  --focus: #3d9875; --shadow: 0 12px 35px rgba(22, 53, 40, .07);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px; line-height: 1.45; color: var(--ink); background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #111d1a; --surface: #1b2b25; --soft: #25392f;
  --ink: #edf5ec; --muted: #b4c7b9; --line: #3d5547;
  --accent: #a0dbb3; --accent-hover: #c4ebca; --accent-soft: #244535;
  --highlight: #b7db70; --danger: #ffb5ba; --danger-soft: #492a2e;
  --focus: #b3dfbb; --shadow: 0 12px 35px rgba(0, 0, 0, .13);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scrollbar-color: var(--muted) var(--canvas); scrollbar-width: thin; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: var(--canvas); }
::-webkit-scrollbar-thumb { background: var(--muted); border: 2px solid var(--canvas); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
body { margin: 0 auto; min-width: 280px; max-width: 720px; min-height: 100vh; padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, p { margin-top: 0; }
.eyebrow { display: block; color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .17em; line-height: 1.35; }
.app-header { display: grid; grid-template-columns: 42px 1fr; gap: 0 12px; align-items: center; padding: 18px 22px 14px; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px 13px 13px 4px; background: var(--ink); color: var(--highlight); box-shadow: 3px 3px 0 var(--highlight); }
.brand-mark span { font-size: 24px; font-weight: 850; line-height: 1; letter-spacing: -.08em; transform: translateX(-2px); }
.brand-copy .eyebrow { margin-bottom: 2px; }
h1 { margin: 0; font-size: 23px; font-weight: 800; letter-spacing: -.06em; line-height: 1.05; }
.brand-dot { color: var(--accent); }
#context { grid-column: 1 / -1; margin: 21px 0 0; padding: 11px 14px 11px 33px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; position: relative; }
#context::before { content: ''; position: absolute; top: 16px; left: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tab-nav { display: flex; gap: 4px; margin: 0 22px; padding: 5px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft); }
.tab-nav button { flex: 1; min-height: 43px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; transition: background .16s ease, color .16s ease, box-shadow .16s ease; }
.tab-nav button:hover { color: var(--ink); background: var(--accent-soft); }
.tab-nav button[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: 0 2px 9px rgba(17, 46, 29, .1); }
.tab-nav button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.admin-action { padding: 20px; }
.admin-action h3 { margin: 0 0 8px; font-size: 17px; }
.admin-action p { color: var(--muted); font-size: 14px; line-height: 1.5; }
.admin-action #sync-result { margin: 14px 0 0; color: var(--ink); }
main { padding: 20px 22px 0; }
.screen-intro { margin-bottom: 18px; }
.screen-intro .eyebrow, #review > .eyebrow { margin-bottom: 9px; }
.screen-intro h2, #review h2 { margin: 0; font-size: clamp(25px, 6vw, 31px); font-weight: 780; letter-spacing: -.045em; line-height: 1.15; }
.screen-intro h2 em { color: var(--accent); font-style: normal; }
.screen-intro p { margin: 0; max-width: 34ch; color: var(--muted); font-size: 14px; line-height: 1.5; }
form { display: grid; gap: 17px; }
label { display: grid; gap: 8px; min-width: 0; color: var(--ink); font-size: 13px; font-weight: 720; }
input, select, textarea { width: 100%; min-width: 0; min-height: 50px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; outline: none; background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 510; line-height: 1.35; transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 94px; resize: none; }
select { height: 56px; min-height: 56px; padding: 12px 35px 12px 15px; font-size: 17px; line-height: normal; }
#contact-field { gap: 8px; }
#contact-field input { margin-bottom: 2px; }
.amount-field { margin: 3px 0; }
.amount-control { display: flex; align-items: center; min-height: 75px; border: 1px solid var(--accent); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); transition: border-color .16s ease, box-shadow .16s ease; }
.amount-control:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px var(--accent-soft); }
.amount-control > span { padding-left: 18px; color: var(--accent); font-size: 27px; font-weight: 700; }
.amount-control input { flex: 1; min-height: 73px; border: 0; border-radius: 14px; box-shadow: none !important; background: transparent; font-size: 32px; font-weight: 710; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.amount-field small { color: var(--muted); font-size: 12px; font-weight: 450; }
.period { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: end; }
.period label { grid-template-rows: auto 56px; }
.period select, .period input { display: block; height: 56px; min-height: 56px; margin: 0; font-size: 17px; line-height: normal; }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 51px; padding: 12px 17px; border-radius: 11px; font-size: 14px; font-weight: 720; transition: background .16s ease, transform .16s ease, box-shadow .16s ease; }
.primary-button { border: 1px solid var(--ink); background: var(--ink); color: var(--highlight); box-shadow: 0 5px 0 var(--highlight); }
.primary-button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.primary-button:active, .secondary-button:active { transform: translateY(2px); box-shadow: none; }
.primary-button span { font-size: 19px; font-weight: 400; line-height: 0; }
.secondary-button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.secondary-button:hover { background: var(--soft); border-color: var(--accent); }
button:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
button:disabled { cursor: wait; opacity: .65; box-shadow: none; }
#movement-form > .primary-button { width: 100%; margin-top: 10px; }
.surface { padding: 21px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: var(--shadow); }
#review h2 { margin-bottom: 20px; font-size: 26px; }
dl { display: grid; grid-template-columns: minmax(90px, 34%) 1fr; column-gap: 14px; margin: 0; }
dt, dd { margin: 0; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 13px; overflow-wrap: anywhere; }
dt { color: var(--muted); font-weight: 520; }
dd { color: var(--ink); font-weight: 680; text-align: right; }
dt:last-of-type, dd:last-of-type { border-bottom: 0; }
.actions { display: flex; gap: 10px; margin-top: 22px; }
.actions .secondary-button { flex: 0 0 auto; }
.actions .primary-button { flex: 1; }
#save-message:not(:empty) { margin: 20px 0 0; padding: 15px 16px; border: 1px solid var(--accent); border-radius: 12px; background: var(--accent-soft); color: var(--ink); font-size: 13px; line-height: 1.5; }
#filters { gap: 14px; }
#filters .secondary-button { width: 100%; margin-top: 2px; }
#history-list { display: grid; gap: 10px; margin: 22px 0; padding: 0; list-style: none; }
#history-list button { display: grid; gap: 8px; width: 100%; min-height: 79px; padding: 16px 17px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-size: 14px; font-weight: 550; line-height: 1.45; text-align: left; transition: border-color .16s ease, transform .16s ease; }
#history-list button:hover { border-color: var(--accent); transform: translateY(-2px); }
#history-list button:active { transform: translateY(0); }
.history-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-weight: 710; }
.history-top strong { white-space: nowrap; color: var(--accent); font-size: 18px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.history-meta { color: var(--muted); font-size: 12px; font-weight: 470; }
#more { width: 100%; }
.back-button { margin: 0 0 25px; padding: 8px 0; min-height: 44px; border: 0; background: none; color: var(--accent); font-size: 13px; font-weight: 720; }
.back-button:hover { text-decoration: underline; }
#detail-data { margin-top: 20px; }
#error:not(:empty) { margin: 20px 22px; padding: 14px 16px; border: 1px solid var(--danger); border-radius: 11px; background: var(--danger-soft); color: var(--danger); font-size: 13px; line-height: 1.5; }
@media (max-width: 360px) { .app-header { padding-inline: 17px; } .tab-nav { margin-inline: 17px; } main { padding-inline: 17px; } .period { gap: 8px; } .actions { flex-direction: column-reverse; } }
@media (forced-colors: active) { .brand-mark, .primary-button, #history-list button { border: 1px solid CanvasText; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
.history-empty { padding: 26px 20px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); background: var(--surface); text-align: center; font-size: 14px; }
