/* FloorTalk SOS v2 (PREVIEW 2026-09-29). Deliberately NOT scoped to any ftf-* flag: emergency UI must always render.
   Tokens from /workspace/company/PREMIUM_DARK_UI.md. Red is used only as the emergency state colour, flat (no gradients/glow). */
:root { --sos-red: #ef4444; --sos-red-bg: #450a0a; --sos-red-surface: #2a0707; --sos-pill-h: 52px; }
html.sos-lock, html.sos-lock body { overflow: hidden !important; }

#sos-takeover *, #sos-pill *, #sos-hc *, #sos-sheet *, .sos-pill { box-sizing: border-box; }
/* ---------- SOS-01 takeover: above everything (modals 180, call 100, sheets 120, old overlay 200) ---------- */
.sos-takeover { position: fixed; inset: 0; z-index: 2147483000; background: var(--sos-red-bg); color: #fafafa;
  overflow-y: auto; -webkit-overflow-scrolling: touch; padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  font-family: Inter, system-ui, sans-serif; }
.sos-takeover.hidden, .sos-pill.hidden, .sos-hc.hidden, .sos-sheet.hidden { display: none !important; }
.sos-takeover.test { background: #0c2340; }
.sos-inner { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.sos-top { display: flex; gap: 8px; align-items: center; }
.sos-badge { display: inline-block; background: #fafafa; color: #7f1d1d; font-weight: 800; letter-spacing: .08em; font-size: 13px;
  padding: 6px 14px; border-radius: 999px; }
.sos-badge.amber { background: #f59e0b; color: #1c1917; }
.sos-takeover.test .sos-badge { color: #0c4a6e; }
.sos-h1 { font-size: 34px; line-height: 1.1; font-weight: 750; margin: 2px 0 0; }
.sos-instr { font-size: 19px; line-height: 1.4; margin: 0; color: #fff; }
.sos-meta { font-size: 14px; color: #fecaca; margin: 0; }
.sos-meta.warn { color: #fde68a; font-weight: 600; }
.sos-takeover.test .sos-meta { color: #bae6fd; }
.sos-card { background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.14); border-radius: 16px; padding: 14px; }
.sos-card.ok { border-color: #22c55e; }
.sos-card.warn { border-color: #f59e0b; background: rgba(245,158,11,.10); }
.sos-card .big { font-size: 26px; font-weight: 700; margin: 4px 0; }
.sos-h2 { font-size: 18px; line-height: 1.3; font-weight: 650; margin: 0 0 10px; }
.sos-h2.red { color: #fca5a5; }
.sos-muted { color: #d4d4d8; font-size: 14px; margin: 0; }
.sos-cps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sos-cp { min-height: 76px; border-radius: 14px; border: 2px solid rgba(255,255,255,.28); background: rgba(255,255,255,.07); color: #fff;
  text-align: left; padding: 12px; display: flex; flex-direction: column; justify-content: center; gap: 2px; cursor: pointer; font: inherit; }
.sos-cp .code { font-size: 20px; font-weight: 750; line-height: 1.15; overflow-wrap: anywhere; }
.sos-cp .nm { font-size: 13px; color: #e4e4e7; line-height: 1.3; }
.sos-cp.sel { border-color: #22c55e; background: rgba(34,197,94,.22); box-shadow: inset 0 0 0 2px #22c55e; }
.sos-cp.off { border-style: dashed; }
.sos-cp:focus-visible, .sos-btn:focus-visible, .sos-pill button:focus-visible { outline: 3px solid #fafafa; outline-offset: 2px; }
.sos-free { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.sos-free label { font-size: 14px; font-weight: 600; color: #fafafa; }
.sos-free-row { display: flex; gap: 8px; }
.sos-free input, .sos-free-row select { flex: 1; min-width: 0; min-height: 52px; font-size: 20px; border-radius: 12px; border: 1px solid rgba(255,255,255,.35);
  background: rgba(0,0,0,.35); color: #fff; padding: 0 12px; text-transform: uppercase; }
.sos-free-row select { text-transform: none; font-size: 16px; }
.sos-err { color: #fde68a; font-weight: 600; min-height: 0; margin: 4px 0 0; font-size: 14px; }
.sos-err:empty { display: none; }
.sos-btn { min-height: 56px; border-radius: 14px; border: 1px solid rgba(255,255,255,.4); background: transparent; color: #fff; font: inherit;
  font-size: 17px; font-weight: 650; padding: 0 18px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.sos-btn.sm { min-height: 44px; font-size: 15px; padding: 0 12px; }
.sos-btn.safe { background: #22c55e; border-color: #22c55e; color: #052e16; font-size: 20px; min-height: 64px; width: 100%; }
.sos-btn.safe[disabled] { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.2); color: #e4e4e7; cursor: not-allowed; }
.sos-btn.light { background: #fafafa; color: #7f1d1d; border-color: #fafafa; }
.sos-btn.danger { background: #ef4444; border-color: #ef4444; color: #fff; }
.sos-btn.ghost { background: rgba(0,0,0,.2); }
.sos-row { display: flex; gap: 10px; flex-wrap: wrap; }
.sos-row > .sos-btn { flex: 1 1 180px; }
.sos-takeover #sos-confirm { position: sticky; bottom: 0; box-shadow: 0 -12px 24px var(--sos-red-bg); }
.sos-takeover.test #sos-confirm { box-shadow: 0 -12px 24px #0c2340; }
.sos-sound { min-height: 64px; width: 100%; border-radius: 14px; border: 2px dashed #fde68a; background: rgba(253,230,138,.12); color: #fde68a;
  font-size: 18px; font-weight: 700; cursor: pointer; }
.sos-mgr { border-top: 1px solid rgba(255,255,255,.18); padding-top: 12px; }

/* ---------- SOS-02 pill: persistent while active, pushes the page down instead of covering the header ---------- */
.sos-pill { position: fixed; top: 0; left: 0; right: 0; z-index: 2147482000; min-height: var(--sos-pill-h); background: #b91c1c; color: #fff;
  display: flex; align-items: stretch; padding-top: env(safe-area-inset-top); border-bottom: 1px solid #7f1d1d; }
.sos-pill.test { background: #1d4ed8; border-color: #1e3a8a; }
.sos-pill-main { flex: 1; min-width: 0; background: none; border: 0; color: inherit; font: inherit; text-align: left; padding: 6px 12px;
  display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; row-gap: 0; cursor: pointer; min-height: var(--sos-pill-h); }
.sos-pill-main strong { font-size: 15px; white-space: nowrap; }
.sos-pill-main .sub { font-size: 13px; opacity: .95; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.sos-pill-main .dot { width: 10px; height: 10px; border-radius: 50%; background: #fff; flex: none; animation: sosblink 1.2s steps(2, start) infinite; }
.sos-pill-tag { font-size: 12px; background: #f59e0b; color: #1c1917; border-radius: 999px; padding: 1px 8px; font-weight: 700; }
.sos-pill-btn { background: #fafafa; color: #7f1d1d; border: 0; font: inherit; font-weight: 700; font-size: 14px; padding: 0 14px; min-width: 44px; cursor: pointer; }
@keyframes sosblink { to { visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .sos-pill-main .dot { animation: none; } }
html.sos-pill-on body { padding-top: calc(var(--sos-pill-h) + env(safe-area-inset-top)); }
html.sos-pill-on .app-header { top: calc(var(--sos-pill-h) + env(safe-area-inset-top)); }
@media (min-width: 900px) { html.sos-pill-on.ftf-ipad_layout .bottom-nav { top: calc(var(--sos-pill-h) + env(safe-area-inset-top)); } }
/* the old mini banner never shows next to the pill */
html.sos-pill-on #emergency-mini-banner, html.sos-lock #emergency-mini-banner { display: none !important; }

/* ---------- SOS-20 headcount page ---------- */
.sos-hc { position: fixed; inset: 0; z-index: 2147481000; background: #0a0a0b; color: #fafafa; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(var(--sos-pill-h) + env(safe-area-inset-top) + 12px) 16px max(24px, env(safe-area-inset-bottom)); font-family: Inter, system-ui, sans-serif; }
.sos-hc-inner { max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.sos-hc-head { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.sos-hc-head .grow { flex: 1; min-width: 180px; }
.sos-hc-title { font-size: 22px; line-height: 1.25; margin: 0; font-weight: 650; }
.sos-chip { display: inline-flex; align-items: center; min-height: 28px; border-radius: 999px; padding: 0 10px; font-size: 13px; font-weight: 650;
  background: #27272a; color: #e4e4e7; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sos-chip.red { background: #ef4444; color: #fff; }
.sos-chip.green { background: rgba(34,197,94,.18); color: #86efac; }
.sos-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sos-kpi { background: #18181b; border: 1px solid #27272a; border-radius: 14px; padding: 12px; }
.sos-kpi .n { font-size: 32px; font-weight: 700; line-height: 1.05; }
.sos-kpi .l { font-size: 14px; color: #d4d4d8; }
.sos-kpi.red { border-color: #ef4444; } .sos-kpi.red .n { color: #fca5a5; }
.sos-kpi.green { border-color: #166534; } .sos-kpi.green .n { color: #86efac; }
.sos-def { font-size: 12px; color: #a1a1aa; margin: -4px 0 0; }
.sos-hc-cols { display: grid; grid-template-columns: 1fr; gap: 16px; }
.sos-col { background: #18181b; border: 1px solid #27272a; border-radius: 16px; padding: 14px; min-width: 0; }
.sos-person { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid #27272a; min-height: 56px; }
.sos-person:first-of-type { border-top: 0; }
.sos-person .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sos-person strong { font-size: 16px; }
.sos-person.late { background: rgba(239,68,68,.14); border: 1px solid #ef4444; border-radius: 12px; padding: 10px; margin-bottom: 8px; }
.sos-group h3 { display: flex; align-items: center; gap: 8px; margin: 12px 0 4px; font-size: 15px; font-weight: 650; color: #fafafa; }
.sos-group h3 .n { background: #27272a; border-radius: 999px; padding: 0 10px; font-size: 14px; }
.sos-group .grow { flex: 1; }
.sos-empty { color: #86efac; font-size: 15px; margin: 6px 0; }
.sos-hc-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.sos-hc-actions > * { flex: 1 1 200px; }
.sos-hc #sos-hc-ack { position: sticky; top: 0; z-index: 2; }
.sos-hc .sos-btn.ghost { background: #18181b; border-color: #3f3f46; }
.sos-hc .sos-card.warn { color: #fafafa; }
.sos-settings { background: #18181b; border: 1px solid #27272a; border-radius: 14px; padding: 12px; }
.sos-settings summary { cursor: pointer; min-height: 32px; font-weight: 600; }
.sos-settings label { display: block; font-size: 14px; color: #d4d4d8; margin: 8px 0 6px; }
.sos-settings .sos-free-row select { background: #111113; border-color: #3f3f46; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- sheets (manual mark / change checkpoint / end event) ---------- */
.sos-sheet { position: fixed; inset: 0; z-index: 2147483200; background: rgba(0,0,0,.7); display: flex; align-items: flex-end; justify-content: center; }
.sos-sheet-card { width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: #1f1f23; color: #fafafa; border: 1px solid #3f3f46;
  border-radius: 20px 20px 0 0; padding: 18px 16px max(18px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.sos-sheet-card .sos-cp { border-color: #3f3f46; background: #111113; }
.sos-sheet-card .sos-cp.sel { border-color: #22c55e; background: rgba(34,197,94,.18); }
.sos-sheet-card .sos-free input { background: #111113; border-color: #3f3f46; }
.sos-sheet-card .sos-btn.ghost { background: #18181b; border-color: #3f3f46; }
.sos-warn-line { color: #fca5a5; font-weight: 650; margin: 0; }
.sos-sheet-card p { margin: 0; }

@media (min-width: 768px) {
  .sos-h1 { font-size: 44px; }
  .sos-instr { font-size: 22px; }
  .sos-cps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sos-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sos-hc-cols { grid-template-columns: 1fr 1fr; align-items: start; }
  .sos-sheet { align-items: center; }
  .sos-sheet-card { border-radius: 20px; }
}
@media (max-width: 360px) { .sos-h1 { font-size: 30px; } .sos-cp .code { font-size: 18px; } }
.sos-free input::placeholder { text-transform: none; color: #a1a1aa; }
/* UX pass: on tablets the takeover used phone type sizes in a 640 px column (lots of dead space on an iPad).
   Scale it up so it reads as an alarm from arm's length. */
@media (min-width: 768px) and (min-height: 700px) {
  .sos-takeover .sos-inner { max-width: 820px; gap: 18px; padding-top: 2vh; }
  .sos-takeover .sos-h1 { font-size: 56px; }
  .sos-takeover .sos-instr { font-size: 26px; }
  .sos-takeover .sos-meta { font-size: 17px; }
  .sos-takeover .sos-h2 { font-size: 22px; }
  .sos-takeover .sos-cp { min-height: 104px; }
  .sos-takeover .sos-cp .code { font-size: 26px; }
  .sos-takeover .sos-cp .nm { font-size: 15px; }
  .sos-takeover .sos-btn.safe { min-height: 76px; font-size: 24px; }
  .sos-takeover .sos-badge { font-size: 16px; }
}
