:root {
  --ground: #F5F5F2; --surface: #FFFFFF; --ink: #15191E; --ink-2: #3A4148; --muted: #5B636B;
  --line: #E2E3DF; --line-2: #C9CBC5; --accent: #1E6B47; --accent-ink: #14502F; --accent-tint: #E6F0EA; --accent-line: #BFD8C9;
  --warn-bg: #FFF4DC; --warn-line: #F0D9A6; --warn-ink: #3D2A00; --warn-head: #7A4F00;
  --bad: #9A2A1F; --bad-bg: #FBE9E7;
  --radius: 14px; --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --display: "Inter Tight", Inter, system-ui, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--font); font-size: 15px; -webkit-text-size-adjust: 100%; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-family: var(--display); font-size: 30px; line-height: 1.12; letter-spacing: -0.02em; margin: 0; font-weight: 700; }
h2 { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
p { margin: 0; }

.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 18px 16px calc(96px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 20px; }
.topbar { display: flex; justify-content: space-between; align-items: center; min-height: 44px; gap: 8px; }
.brand { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; text-decoration: none; font-weight: 600; color: var(--accent); }
.sub { color: var(--muted); font-size: 14px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 380px) { .grid2 { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.tight { padding: 4px 14px; }
.card.accent { background: var(--accent-tint); border-color: var(--accent-line); color: var(--accent-ink); }
.card.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.card.warn h2 { color: var(--warn-head); }
.list-row { display: flex; gap: 12px; align-items: center; padding: 13px 2px; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); min-height: 56px; }
.card.tight .list-row:first-child { border-top: 0; }
.list-row .t { font-weight: 600; }
.list-row .s { color: var(--muted); font-size: 13px; margin-top: 2px; }
.time { width: 62px; font-weight: 600; font-size: 14px; flex-shrink: 0; }
.chev { color: var(--muted); flex-shrink: 0; }

.btn { white-space: nowrap; min-height: 48px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 600; padding: 0 16px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.outline { color: var(--accent); border-color: var(--accent); }
.btn.big { min-height: 54px; font-size: 16px; }
.btn.small { min-height: 40px; font-size: 14px; padding: 0 12px; }
.btn.danger { color: var(--bad); border-color: #E3B9B3; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 0 6px; min-height: 44px; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.block { width: 100%; }

.pill { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: #EEEFEB; color: var(--ink-2); white-space: nowrap; }
.pill.green { background: var(--accent-tint); color: var(--accent-ink); }
.pill.amber { background: var(--warn-bg); color: var(--warn-head); }
.pill.red { background: var(--bad-bg); color: var(--bad); }
.pill.blue { background: #E5EEF8; color: #1D4F86; }

label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input, select.input, textarea.input { min-height: 48px; border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px; background: var(--surface); font-weight: 400; font-size: 16px; width: 100%; }
textarea.input { min-height: 90px; resize: vertical; }
.input:focus, .btn:focus-visible { outline: 3px solid #9CC9B0; outline-offset: 1px; }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; font-size: 15px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.err { color: var(--bad); font-size: 14px; }

.nav { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); display: flex; justify-content: center; padding: 6px 6px calc(8px + var(--safe-bottom)); z-index: 20; }
.nav-inner { display: flex; width: 100%; max-width: 760px; }
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; text-decoration: none; color: var(--muted); font-size: 11.5px; font-weight: 600; min-height: 48px; }
.nav a.on { color: var(--accent); }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(88px + var(--safe-bottom)); background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 14px; z-index: 50; max-width: calc(100vw - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.toast.bad { background: var(--bad); }

.sheet-bg { position: fixed; inset: 0; background: rgba(20,24,28,.45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--ground); width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto; border-radius: 18px 18px 0 0; padding: 18px 16px calc(20px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 18px; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head strong { font-size: 18px; }

.big-number { font-family: var(--display); font-size: 34px; font-weight: 700; letter-spacing: -0.02em; }
.money-row { display: flex; justify-content: space-between; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.money-row:last-child { border-bottom: 0; }
.seg { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; overflow-x: auto; }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; font-size: 14px; color: var(--ink-2); cursor: pointer; white-space: nowrap; padding: 0 10px; }
.seg button.on { background: var(--accent); color: #fff; }
.daystrip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.daystrip button { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; font-size: 12px; color: var(--muted); }
.daystrip button b { font-size: 17px; color: var(--ink); }
.daystrip button.on { background: var(--accent); border-color: var(--accent); color: #E6F0EA; }
.daystrip button.on b { color: #fff; }
.daystrip .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.daystrip button.on .dot { background: #fff; }
.banner { border-radius: 12px; padding: 12px 14px; font-size: 14px; background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-line); }
.empty { color: var(--muted); text-align: center; padding: 28px 10px; font-size: 14px; }
.msg { border-top: 1px solid var(--line); padding: 10px 0; font-size: 14px; }
.msg:first-child { border-top: 0; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--accent-line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.center { display: flex; justify-content: center; padding: 40px; }
.item-row { display: grid; grid-template-columns: 90px 1fr 36px; gap: 8px; align-items: end; padding: 10px 0; border-top: 1px solid var(--line); }
.item-row:first-child { border-top: 0; }
.item-row > :first-child { grid-column: 1 / -1; }
.item-row label.f { font-size: 12px; gap: 4px; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
