:root {
  --bg: #f4f5f7; --card: #fff; --ink: #1c2430; --muted: #6b7683;
  --line: #e2e6ea; --primary: #0b6bcb; --grey: #9aa4af;
  --red: #d64545; --red-bg: #fdf3f2; --green: #1e8e3e; --green-bg: #f1f9f3;
  --danger: #c0392b;
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.45 -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
#app { max-width: 1100px; margin: 0 auto; padding: 16px; }
h1 { margin: 0 0 4px; font-size: 1.5rem; }
.muted { color: var(--muted); }
.err { color: var(--danger); min-height: 1.2em; }
.hint { font-size: .85rem; margin: 4px 0 12px; }
button { font: inherit; padding: 10px 14px; border: 1px solid var(--line); background: #fff; border-radius: 8px; cursor: pointer; }
button.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
button.link { border: none; background: none; color: var(--primary); padding: 3px 6px; font-size: .85rem; }
button.link.danger { color: var(--danger); }
input, select { font: inherit; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; width: 100%; background: #fff; }
input:disabled { background: #f0f1f3; color: #aab2bb; }
label { display: block; margin: 8px 0; font-size: .9rem; color: var(--muted); }

.card { max-width: 360px; margin: 12vh auto; background: var(--card); padding: 24px; border-radius: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.06); text-align: center; }
.card input { margin: 12px 0; text-align: center; letter-spacing: .3em; }

.topbar { display: flex; gap: 14px; align-items: end; flex-wrap: wrap; margin-bottom: 6px; }
.topbar label { margin: 0; }
.topbar #date { width: auto; }
.counts { font-weight: 700; }
#save-day { margin-left: auto; }
#save-state { min-width: 8ch; }
.badge { background: var(--red); color: #fff; padding: 4px 10px; border-radius: 999px; font-size: .8rem; }

/* ---- capture grid ---- */
.grid-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table.grid { width: 100%; border-collapse: collapse; background: #fff; min-width: 760px; }
table.grid th, table.grid td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.grid thead th { position: sticky; top: 0; background: #eef2f6; font-size: .8rem; z-index: 1; }
table.grid select, table.grid input { padding: 6px 8px; }
.c-state { width: 26px; text-align: center; }
.c-name { width: 190px; }
.c-num { width: 92px; }
.c-act { width: 110px; white-space: nowrap; }
.g-name { display: block; font-weight: 600; }
.g-role { display: block; font-size: .75rem; }
.g-split { font-size: .8rem; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--grey); }

tr.grow.empty { background: var(--red-bg); }
tr.grow.empty .dot { background: var(--red); }
tr.grow.incomplete { background: var(--red-bg); }
tr.grow.incomplete .dot { background: var(--red); box-shadow: 0 0 0 3px rgba(214,69,69,.18); }
tr.grow.complete { background: var(--green-bg); }
tr.grow.complete .dot { background: var(--green); }

/* ---- admin ---- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.controls { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-bottom: 14px; }
.controls label { margin: 0; }
table.edit, table.report { width: 100%; border-collapse: collapse; background: #fff; }
table.edit th, table.edit td, table.report th, table.report td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; font-size: .88rem; }
table.report th { background: #eef2f6; }
table.edit input, table.edit select { border: none; padding: 4px; }
.summary { display: flex; gap: 20px; flex-wrap: wrap; background: #eef4fb; border: 1px solid #d6e4f5; padding: 12px 16px; border-radius: 10px; margin-bottom: 12px; }
.summary dt { font-size: .78rem; color: var(--muted); }
.summary dd { margin: 0; font-size: 1.15rem; font-weight: 700; }
.presets { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.presets button { padding: 6px 12px; }
h4.grp { margin: 12px 0 4px; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.site-subtotal { font-weight: 700; margin: 8px 0 0; }
.site-block { margin: 0 0 26px; }
.site-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; border-bottom: 2px solid var(--line); padding-bottom: 4px; margin-bottom: 8px; }
.site-head h3 { margin: 0; font-size: 1.05rem; }
.site-tot { font-weight: 700; }
tr.subtotal td { font-weight: 700; background: #eef4fb; border-top: 2px solid #d6e4f5; }
.prod { margin: 6px 0 0; font-size: .85rem; }
.savebar { display: flex; gap: 12px; align-items: center; justify-content: flex-end; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
hr { border: none; border-top: 1px solid var(--line); margin: 14px 0; }
