:root {
  color-scheme: dark;
  --bg: #101410;
  --card: #1a221c;
  --card-2: #243028;
  --ink: #f4f7f2;
  --muted: #a7b5ab;
  --line: #314038;
  --accent: #d6ff3c;
  --accent-ink: #142000;
  --warn: #ffb020;
  --danger: #ff5a3c;
  --good: #3dff9a;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { min-height: 100dvh; }
button, input, textarea, select { font: inherit; color: inherit; }
button { touch-action: manipulation; }
img { max-width: 100%; }

#app { min-height: 100dvh; }
.shell { width: min(480px, 100%); margin: 0 auto; padding: 12px 14px calc(88px + env(safe-area-inset-bottom)); }
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 10px; }
.brand { font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
h1 { font-size: 28px; line-height: 1.05; margin: 2px 0 0; }
.muted { color: var(--muted); }
.sync-wrap { display: flex; flex-direction: column; gap: 8px; }
.sync { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 8px 0; font-size: 14px; font-weight: 700; text-align: left; }
.sync[data-state="synced"] { color: var(--good); }
.sync[data-state="pending"], .sync[data-state="offline"] { color: var(--warn); }
.sync[data-state="error"] { color: var(--danger); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; }

.banner, .card, .panel, .sheet { background: var(--card); border: 1px solid var(--line); border-radius: 18px; }
.banner { padding: 12px 14px; margin: 10px 0; background: #1d2912; border-color: #425818; }
.banner strong { display: block; color: var(--accent); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 4px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.chip, .btn, .step, .rir { min-height: 48px; border-radius: 14px; border: 1px solid var(--line); background: var(--card-2); }
.chip, .rir { padding: 0 12px; font-weight: 700; }
.chip[aria-pressed="true"], .rir[aria-pressed="true"], .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn { padding: 12px 14px; font-weight: 800; width: 100%; }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; color: var(--danger); border-color: #6a342b; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }

.card { padding: 14px; margin: 12px 0; box-shadow: var(--shadow); }
.card header { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.order { color: var(--accent); font-weight: 800; margin-right: 6px; }
.card h2 { font-size: 22px; margin: 0; line-height: 1.1; }
.meta { color: var(--muted); margin: 6px 0; }
.caution { color: var(--warn); margin: 8px 0; font-weight: 700; }
.last { margin: 8px 0; font-size: 16px; }
.superset { font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-ink); background: var(--accent); border-radius: 999px; padding: 4px 8px; }
.tag { display: inline-block; margin-left: 6px; border-radius: 999px; padding: 2px 8px; font-size: 12px; font-weight: 800; background: #3a2a12; color: var(--warn); }
.tag.verified { background: #143226; color: var(--good); }
.tag.pain { background: #3a1612; color: #ffb0a3; }

.set { background: var(--card-2); border-radius: 16px; padding: 10px; margin-top: 10px; }
.set-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 8px; }
.stepper { display: grid; grid-template-columns: 56px 1fr 56px; gap: 8px; align-items: center; margin-top: 8px; }
.step { width: 56px; height: 56px; font-size: 28px; font-weight: 700; }
.value { text-align: center; }
.value b { display: block; font-size: 34px; font-variant-numeric: tabular-nums; line-height: 1; }
.value span, .side { color: var(--muted); font-size: 13px; }
.rirs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.draft { color: var(--warn); font-size: 13px; font-weight: 700; }
.saved { color: var(--good); font-size: 13px; font-weight: 700; }
label.field { display: block; margin-top: 10px; color: var(--muted); font-size: 13px; font-weight: 700; }
input, textarea, select {
  width: 100%; min-height: 48px; margin-top: 4px; border-radius: 12px; border: 1px solid var(--line);
  background: #101610; padding: 10px 12px; font-size: 16px;
}
input[type="file"] { padding: 12px; }
textarea { min-height: 76px; }
details.day { margin-top: 8px; }
details.day summary { min-height: 48px; display: flex; align-items: center; font-weight: 800; cursor: pointer; }
.nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: min(480px, 100%);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(16, 20, 16, 0.94); border-top: 1px solid var(--line); }
.nav button { min-height: 48px; border-radius: 12px; border: 0; background: transparent; font-weight: 800; }
.nav button[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }

.login { padding-top: 28px; }
.dots { display: flex; gap: 8px; min-height: 18px; margin: 8px 0 12px; }
.dots i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent); display: block; }
.dots i.on { background: var(--accent); }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pad button { min-height: 64px; font-size: 28px; font-weight: 800; border-radius: 16px; border: 1px solid var(--line); background: var(--card); }
.error { color: #ffb0a3; font-weight: 700; }
.history-item, .admin-card { width: 100%; text-align: left; padding: 14px; margin: 8px 0; }
.chart { width: 100%; height: auto; background: #101610; border-radius: 12px; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 3; }
.chart .pb { fill: var(--accent); }
.chart circle { fill: var(--ink); }
.sheet { position: fixed; inset: auto 0 0 0; margin: 0 auto; width: min(480px, 100%); padding: 16px; z-index: 5; box-shadow: var(--shadow); }
.empty { padding: 18px; text-align: center; }
.file input { margin-top: 6px; min-height: 48px; }
.key-row { margin-top: 8px; }
.key-row .btn { margin-top: 6px; }
.top .btn.danger { width: auto; min-height: 48px; padding: 0 14px; }
.pb-badge { display: inline-block; background: var(--accent); color: var(--accent-ink); font-weight: 800; border-radius: 999px; padding: 4px 10px; }
@media (min-width: 800px) {
  body { background: radial-gradient(circle at top, #1a2418, #101410 46%); }
}
