:root {
  --bg: #f2f2ee; --surface: #fff; --ink: #0b0b0b; --ink2: #33322f; --muted: #5e5d58; --line: #c9c8c0;
  --accent: #1c5cab; --go: #0a7d0a; --go-bg: #dff3df; --warn: #8a5a00; --warn-bg: #ffefc2;
  --stop: #b42318; --stop-bg: #fde4e4; --hole: #2a78d6; --delay: #eb6834;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 20px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom); }
button, input, select, textarea { font: inherit; color: inherit; }
.bar { position: sticky; top: 0; z-index: 5; background: #12161c; color: #fff; display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); }
.brand { font-weight: 900; font-size: 22px; } .brand span { color: #ffb21a; }
.ctx { flex: 1; font-size: 16px; color: #d7d9de; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync { min-height: 48px; border-radius: 24px; border: 0; padding: 0 16px; font-weight: 800; font-size: 16px; cursor: pointer; }
.sync.ok { background: var(--go-bg); color: var(--go); }
.sync.wait { background: var(--warn-bg); color: var(--warn); }
.sync.err { background: var(--stop-bg); color: var(--stop); }
main { max-width: 900px; margin: 0 auto; padding: 14px; }
h1 { font-size: 28px; margin: 6px 0 14px; } h2 { font-size: 22px; margin: 18px 0 10px; }
.loading { font-size: 22px; text-align: center; margin-top: 30vh; }
.muted { color: var(--muted); }
.card { background: var(--surface); border: 2px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 14px; }

/* big buttons */
.btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 64px; border-radius: 14px;
  border: 3px solid var(--accent); background: var(--accent); color: #fff; font-weight: 800; font-size: 22px; cursor: pointer;
  padding: 8px 14px; text-align: center; }
.btn:active { transform: scale(.98); }
.btn.ghost { background: #fff; color: var(--accent); }
.btn.go { background: var(--go); border-color: var(--go); }
.btn.stop { background: var(--stop); border-color: var(--stop); }
.btn.delay { background: var(--delay); border-color: #c4501f; color: #111; }
.btn.huge { min-height: 96px; font-size: 28px; }
.btn[disabled] { opacity: .45; }
.btn { flex-wrap: wrap; }
.btn small { display: block; flex-basis: 100%; font-size: 15px; font-weight: 600; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.grid2 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.pick { min-height: 72px; border-radius: 14px; border: 3px solid var(--line); background: #fff; font-weight: 800; font-size: 21px;
  cursor: pointer; padding: 8px 12px; text-align: left; }
.pick small { display: block; font-weight: 500; font-size: 15px; color: var(--muted); }
.pick.on { border-color: var(--accent); background: #e6eefa; box-shadow: inset 0 0 0 2px var(--accent); }

/* fields */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-weight: 700; font-size: 18px; }
.field input, .field select, .field textarea { min-height: 60px; border: 3px solid #8f8e88; border-radius: 12px; padding: 8px 12px;
  font-size: 22px; background: #fff; width: 100%; }
.field textarea { min-height: 90px; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 4px solid #ffb21a; outline-offset: 1px; }
.err { color: var(--stop); font-weight: 700; }

/* checklist */
.chk { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.chk:last-child { border-bottom: 0; }
.yn { display: flex; gap: 8px; }
.yn button { min-width: 84px; min-height: 56px; border-radius: 12px; border: 3px solid var(--line); background: #fff; font-weight: 900; font-size: 20px; cursor: pointer; }
.yn button.y.on { background: var(--go); border-color: var(--go); color: #fff; }
.yn button.n.on { background: var(--stop); border-color: var(--stop); color: #fff; }
.chk .note { grid-column: 1 / -1; }
.chk .note input { width: 100%; min-height: 56px; border: 3px solid var(--stop); border-radius: 12px; padding: 6px 10px; }

/* main shift screen */
.progress { background: var(--surface); border: 2px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 14px; }
.progress .big { font-size: 52px; font-weight: 900; line-height: 1; }
.progress .big small { font-size: 22px; color: var(--muted); font-weight: 700; }
.meter { height: 22px; background: #e2e1db; border-radius: 11px; overflow: hidden; margin: 12px 0 8px; }
.meter i { display: block; height: 100%; background: var(--hole); border-radius: 0 11px 11px 0; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats div { font-size: 15px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.stats b { display: block; font-size: 26px; color: var(--ink); }
.delaybox { background: var(--warn-bg); border: 3px solid var(--delay); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; }
.delaybox .t { font-size: 44px; font-weight: 900; font-variant-numeric: tabular-nums; }
.actions { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; margin-bottom: 14px; }
.actions .full { grid-column: 1 / -1; }
.log { list-style: none; margin: 0; padding: 0; }
.log li { display: flex; gap: 10px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 18px; }
.log li .when { min-width: 64px; font-weight: 800; font-variant-numeric: tabular-nums; }
.log li .tag { font-size: 13px; font-weight: 900; padding: 2px 8px; border-radius: 6px; color: #fff; }
.tag.h { background: var(--hole); } .tag.d { background: #c4501f; } .tag.c { background: #555; }
.blocked { border-color: var(--stop); background: var(--stop-bg); margin-top: 12px; }
.locked { background: #e3ebf7; border: 3px solid var(--accent); border-radius: 14px; padding: 14px; margin-bottom: 14px; font-weight: 700; }

/* bottom sheet */
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet-inner { background: var(--bg); width: 100%; max-width: 900px; max-height: 94vh; overflow-y: auto; border-radius: 18px 18px 0 0;
  padding: 16px 14px calc(16px + env(safe-area-inset-bottom)); }
.sheet-inner h2 { margin-top: 0; }
.sheet .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 420px; margin: 0 auto; }
.pinpad button { min-height: 72px; font-size: 30px; font-weight: 900; border-radius: 14px; border: 3px solid var(--line); background: #fff; cursor: pointer; }
.pindots { text-align: center; font-size: 44px; letter-spacing: 16px; min-height: 60px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #12161c; color: #fff; padding: 14px 20px;
  border-radius: 12px; font-weight: 700; z-index: 30; max-width: 92vw; }
@media (max-width: 480px) {
  body { font-size: 18px; }
  .progress .big { font-size: 42px; }
  .sheet .row, .grid2 { grid-template-columns: 1fr; }
  /* phone: one action per row so "Start delay" etc. stay on one line */
  .actions { grid-template-columns: 1fr; }
  .btn.huge { font-size: 24px; min-height: 80px; }
  .ctx { display: none; }
}
