:root {
  --bg: #f0f3ee;
  --surface: #ffffff;
  --ink: #16231c;
  --muted: #58695f;
  --line: #d8dfd6;
  --accent: #1f6b4a;
  --accent-ink: #ffffff;
  --accent-soft: #e1efe7;
  --warn: #a2530a;
  --warn-bg: #fbebd8;
  --bad: #a32a2a;
  --bad-bg: #f8e1e1;
  --st-new: #3c5a99;
  --st-follow: #b4570a;
  --st-ordered: #1f6b4a;
  --st-delivered: #58695f;
  --font-display: "Segoe UI Semibold", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
  --font-body: "Segoe UI", "Nirmala UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1713; --surface: #17221c; --ink: #e6efe8; --muted: #93a59a; --line: #2a3a31;
    --accent: #5cc594; --accent-ink: #0b1a12; --accent-soft: #1c3a2b;
    --warn: #eca75f; --warn-bg: #3a2814; --bad: #ee8f8f; --bad-bg: #3b1d1d;
    --st-new: #8fabe8; --st-follow: #eca75f; --st-ordered: #5cc594; --st-delivered: #93a59a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.45;
  padding-block: 20px 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.wrap { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.top { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; justify-content: space-between; }
.top h1 { font-size: clamp(26px, 5vw, 36px); font-weight: 700; letter-spacing: -0.01em; line-height: 1.1; }
.top p { margin: 4px 0 0; color: var(--muted); }
.top-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.search { min-width: 0; width: 230px; max-width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.btn { border: 1px solid var(--line); background: var(--surface); padding: 9px 14px; border-radius: 8px; cursor: pointer; font-weight: 500; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.danger { color: var(--bad); }
.btn.danger.armed { background: var(--bad); color: var(--surface); border-color: var(--bad); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.stat .k { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.stat .v { font-family: var(--font-display); font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat.alert .v { color: var(--warn); }

.notice { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 10px 14px; }

.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; align-items: start; }
.col { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 0 2px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.col-head h2 { font-size: 16px; font-weight: 700; }
.col-head .n { margin-left: auto; order: 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.empty-col { border: 1px dashed var(--line); border-radius: 10px; padding: 16px; color: var(--muted); font-size: 14px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.card.late { border-color: var(--warn); }
.card .nm { font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
.card .ph { color: var(--muted); font-variant-numeric: tabular-nums; user-select: all; }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.chip.late { background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.chip.val { background: transparent; border: 1px solid var(--line); color: var(--ink); font-variant-numeric: tabular-nums; }
.card .note { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; white-space: pre-wrap; }
.card .acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.card select { padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: 13px; }
a.wa { text-decoration: none; display: inline-block; color: inherit; }

.overlay { position: fixed; inset: 0; background: rgba(10, 20, 14, 0.55); display: flex; align-items: flex-start; justify-content: center; padding: 16px; overflow-y: auto; z-index: 20; }
.sheet { background: var(--surface); border-radius: 12px; width: 100%; max-width: 520px; padding: 18px; margin-block: auto; display: flex; flex-direction: column; gap: 14px; }
.sheet h2 { font-size: 22px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.full { grid-column: 1 / -1; }
.mapline { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); min-width: 0; }
label.f input, label.f select, label.f textarea { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font-size: 15px; width: 100%; }
label.f textarea { min-height: 80px; resize: vertical; }
.sheet .row { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.err { color: var(--bad); font-size: 14px; min-height: 1em; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 8px; z-index: 60; max-width: 90vw; }
.hello { background: var(--surface); border: 1px dashed var(--line); border-radius: 12px; padding: 22px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.hello h3 { font-size: 20px; }
.hello p { margin: 0; color: var(--muted); max-width: 60ch; }

.lockwrap { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto; z-index: 50; }
.help { margin: 0; color: var(--muted); font-size: 14px; }
.help.s { font-size: 13px; }
.lockwrap .sheet { margin-block: 0; }
.pinstat { grid-column: 1 / -1; margin: -4px 0 0; font-size: 13px; color: var(--muted); min-height: 1em; }
.pinstat.ok { color: var(--accent); }
.pinstat.bad { color: var(--warn); }
