:root {
  --ground: #FFF8F0; --surface: #FFFFFF; --border: #EADFD3; --text: #1F1A17; --text2: #3D3530; --muted: #6B625B;
  --accent: #F7941D; --accent-text: #A85400; --soft: #FFF1E0; --chip: #F3ECE4; --note: #FFF8F0;
  --strong: #1F1A17; --input: #FFFFFF; --input-border: #E5DCD2;
  --off-bg: #FFFFFF; --off-fg: #3D3530; --off-bd: #E5DCD2;
  --no-bg: #3D3530; --no-fg: #FFFFFF; --mid-bg: #FDE7C8; --mid-fg: #6B3A00; --mid-bd: #E8B06A;
  --error-bg: #FDECEA; --error-fg: #8A1C12;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #16120F; --surface: #221C17; --border: #3A3029; --text: #F5EFE8; --text2: #E2D8CD; --muted: #B5A99D;
    --accent-text: #FFB45C; --soft: #3A2A18; --chip: #2E2620; --note: #1B1612; --strong: #3A2A18;
    --input: #1B1612; --input-border: #4A3E35; --off-bg: #221C17; --off-fg: #E2D8CD; --off-bd: #4A3E35;
    --no-bg: #F5EFE8; --no-fg: #1F1A17; --mid-bg: #4A3216; --mid-fg: #FFD9A8; --mid-bd: #8A5A22;
    --error-bg: #3D1712; --error-fg: #FFB4A8;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #16120F; --surface: #221C17; --border: #3A3029; --text: #F5EFE8; --text2: #E2D8CD; --muted: #B5A99D;
  --accent-text: #FFB45C; --soft: #3A2A18; --chip: #2E2620; --note: #1B1612; --strong: #3A2A18;
  --input: #1B1612; --input-border: #4A3E35; --off-bg: #221C17; --off-fg: #E2D8CD; --off-bd: #4A3E35;
  --no-bg: #F5EFE8; --no-fg: #1F1A17; --mid-bg: #4A3216; --mid-fg: #FFD9A8; --mid-bd: #8A5A22;
  --error-bg: #3D1712; --error-fg: #FFB4A8;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--text); font-family: 'DM Sans', system-ui, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
.shell { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.pad { padding: 24px 16px; }
.center { text-align: center; }
.muted { color: var(--muted); }

header { padding: calc(20px + env(safe-area-inset-top)) 20px 12px; display: flex; flex-direction: column; gap: 4px; }
.topline { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.brand { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); }
h1 { margin: 6px 0 0; font-size: 28px; line-height: 1.15; }
.sub { margin: 0; font-size: 15px; color: var(--muted); }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; cursor: pointer; padding: 0; }
.row-tight { display: flex; gap: 6px; align-items: center; }
.link-btn { border: none; background: none; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; min-height: 44px; padding: 0 8px; }
form.card { margin: 0; }
.admin-bar { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.admin-bar select { min-height: 36px; }

main { flex: 1; padding: 4px 16px 24px; display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.card.highlight { border-color: var(--accent); }
.card.warn { border-color: var(--mid-bd); }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.between { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.name { font-size: 16px; font-weight: 600; }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.note { font-size: 13px; color: var(--text2); background: var(--note); border-radius: 10px; padding: 8px 10px; }
.chip { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 10px; background: var(--chip); color: var(--text2); white-space: nowrap; }
.chip.pending { background: var(--mid-bg); color: var(--mid-fg); border: 1px solid var(--mid-bd); }
.progress { height: 8px; background: var(--chip); border-radius: 999px; overflow: hidden; }
.progress > div { height: 8px; background: var(--accent); border-radius: 999px; }

label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text2); }
select, input[type="date"], input[type="text"], input[type="email"], textarea {
  min-height: 44px; border: 1.5px solid var(--input-border); border-radius: 12px; padding: 0 10px;
  font-size: 15px; background: var(--input); width: 100%;
}
textarea { padding: 10px; min-height: 96px; resize: vertical; }

.btn { min-height: 44px; border-radius: 12px; font-size: 14px; font-weight: 600; cursor: pointer; border: 1.5px solid var(--off-bd); background: var(--off-bg); color: var(--off-fg); padding: 0 12px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1F1A17; }
.btn.big { min-height: 52px; font-size: 16px; font-weight: 700; width: 100%; border-radius: 14px; }
.btn.outline { border-color: var(--text); background: var(--surface); color: var(--text); }
.btn[aria-pressed="true"].yes { background: var(--accent); border-color: var(--accent); color: #1F1A17; }
.btn[aria-pressed="true"].mid { background: var(--mid-bg); border-color: var(--mid-bd); color: var(--mid-fg); }
.btn[aria-pressed="true"].no { background: var(--no-bg); border-color: var(--no-bg); color: var(--no-fg); }
.btn:disabled { opacity: .6; cursor: default; }
.banner { background: var(--strong); color: #FFFFFF; border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.banner .small { color: #E6DDD4; }
.error { background: var(--error-bg); color: var(--error-fg); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.ok { background: var(--soft); border: 1.5px solid var(--accent); border-radius: 14px; padding: 12px 14px; font-weight: 600; }

nav { position: sticky; bottom: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 8px 10px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); }
nav button { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 56px; justify-content: center; border: none; border-radius: 14px; cursor: pointer; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; }
nav button[aria-current="page"] { background: var(--soft); color: var(--accent-text); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
