:root {
  --bg: #f6f3ec;
  --card: #ffffff;
  --ink: #1d2419;
  --muted: #5f6a5a;
  --line: #e2ddd1;
  --green: #2f5233;
  --green-ink: #ffffff;
  --green-soft: #e4eee3;
  --amber: #b8741a;
  --amber-soft: #fbefdc;
  --red: #a63d2f;
  --red-soft: #f8e4e0;
  --blue-soft: #e3ebf5;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 20px rgba(29,36,25,.06);
  font-size: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171a15; --card: #22271f; --ink: #eef0e8; --muted: #a7b09e; --line: #343b30;
    --green: #7fb585; --green-ink: #10170f; --green-soft: #243326; --amber: #e0a24a; --amber-soft: #3a2d16;
    --red: #e07a6b; --red-soft: #3d221e; --blue-soft: #243040;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0 0 .35em; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
p { margin: .3em 0; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.tiny { font-size: .78rem; }
.mono { font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack { display: grid; gap: 12px; }
.hide { display: none !important; }

.topbar { position: sticky; top: 0; z-index: 5; background: var(--green); color: var(--green-ink); padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar .brand { font-weight: 700; letter-spacing: .02em; text-decoration: none; }
.topbar .brand small { font-weight: 500; opacity: .8; margin-left: 6px; }
.topbar nav { display: flex; gap: 4px; }
.topbar .brand { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.topbar nav { flex: none; }
.topbar nav a { color: inherit; text-decoration: none; padding: 6px 10px; border-radius: 999px; opacity: .85; font-size: .92rem; white-space: nowrap; }
@media (max-width: 420px) { .topbar .brand small { display: none; } }
.topbar nav a.on { background: rgba(255,255,255,.18); opacity: 1; }
main { max-width: 760px; margin: 0 auto; padding: 16px 16px 72px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.card.tappable { display: block; text-decoration: none; }
.card.tappable:active { transform: scale(.995); }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--green-soft); color: var(--green); white-space: nowrap; }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.grey { background: var(--line); color: var(--muted); }
.pill.blue { background: var(--blue-soft); color: var(--ink); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--green); background: var(--green); color: var(--green-ink); border-radius: 12px; padding: 12px 18px; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 44px; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.danger { background: transparent; color: var(--red); border-color: var(--red); }
.btn.sm { padding: 6px 12px; min-height: 36px; font-size: .9rem; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: default; }

label.f { display: grid; gap: 4px; font-size: .9rem; color: var(--muted); }
label.f > span { font-weight: 600; }
.in { width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 11px 12px; min-height: 44px; }
textarea.in { min-height: 88px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .grid2 { grid-template-columns: 1fr; } }

.item { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item .price { color: var(--muted); font-size: .9rem; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bg); }
.stepper button { width: 44px; height: 44px; border: 0; background: transparent; font-size: 1.3rem; cursor: pointer; color: var(--ink); }
.stepper input { width: 56px; text-align: center; border: 0; background: transparent; height: 44px; font-weight: 600; font-size: 1.05rem; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }

.choice { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.choice + .choice { margin-top: 8px; }
.choice input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
.choice.on { border-color: var(--green); background: var(--green-soft); }
.choice b { display: block; }

.totals { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; display: grid; gap: 6px; }
.totals .t { display: flex; justify-content: space-between; }
.totals .grand { font-weight: 700; font-size: 1.15rem; }

.status-steps { display: flex; gap: 4px; margin: 8px 0; }
.status-steps span { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.status-steps span.done { background: var(--green); }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 600; box-shadow: var(--shadow); z-index: 20; max-width: calc(100vw - 32px); }
.toast.err { background: var(--red); color: #fff; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tablewrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }

.kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.kpi .k { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.kpi .k b { display: block; font-size: 1.25rem; }
.kpi .k span { font-size: .78rem; color: var(--muted); }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.card.confirm { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft), var(--shadow); }
.confirm-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.confirm-head .check { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--green); color: var(--green-ink); display: grid; place-items: center; font-size: 1.3rem; font-weight: 700; }
.next { margin-top: 12px; padding: 12px; background: var(--bg); border-radius: 10px; }
.next ol { margin: 6px 0 8px; padding-left: 20px; display: grid; gap: 4px; }
.sat { margin-top: 10px; padding: 10px 12px; background: var(--blue-soft); border-radius: 10px; }
