:root {
  /* Shared premium dark palette (FloorTalk / ShopBoss / HomeLink) */
  --bg: #0a0a0b;
  --bg2: #111113;
  --panel: #18181b;
  --panel2: #1f1f23;
  --border: #27272a;
  --text: #fafafa;
  --muted: #a1a1aa;
  --accent: #2dd4bf;
  --accent-dim: rgba(45, 212, 191, 0.14);
  --accent-ink: #042f2e;
  /* Status only — not decorative chrome */
  --amber: #f59e0b;
  --orange: #ea580c;
  --green: #22c55e;
  --red: #ef4444;
  --blue: #38bdf8;
  --purple: #a78bfa;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h: 68px;
  --radius: 14px;
  --radius-sm: 10px;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  letter-spacing: -0.01em;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  -webkit-tap-highlight-color: transparent;
}
body { padding-bottom: calc(var(--nav-h) + var(--safe-bottom)); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--accent); }

.app-header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: rgba(10,10,11,.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.brand {
  display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0;
}
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(145deg, #2dd4bf, #14b8a6);
  display: grid; place-items: center; font-weight: 800; color: var(--accent-ink);
  box-shadow: 0 0 0 1px rgba(45,212,191,.25);
}
.brand h1 { margin: 0; font-size: 1.05rem; letter-spacing: .02em; }
.brand .sub { font-size: .72rem; color: var(--muted); }
.pill {
  font-size: .7rem; padding: 4px 8px; border-radius: 999px;
  background: var(--panel2); color: var(--muted); border: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.pill.role-supervisor { color: var(--accent); border-color: rgba(45,212,191,.35); }
.pill.role-operator { color: var(--text); border-color: var(--border); }
.pill.role-maintenance { color: var(--text); border-color: var(--border); }
.pill.role-sanitation { color: var(--text); border-color: var(--border); }

.screen { display: none; padding: 14px; max-width: 720px; margin: 0 auto; }
.screen.active { display: block; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 0 rgba(255,255,255,.03);
}
.card h2 { margin: 0 0 12px; font-size: 1.05rem; font-weight: 650; letter-spacing: -0.02em; }
.card h3 { margin: 0 0 8px; font-size: .88rem; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); font-size: .85rem; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: .78rem; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 12px;
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 16px; border-radius: 12px; font-weight: 650;
  background: var(--panel2); border: 1px solid var(--border); color: var(--text);
}
.btn:active { transform: scale(.98); }
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink); border: none;
  font-weight: 700;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-danger { background: rgba(239,68,68,.15); color: #fecaca; border-color: rgba(239,68,68,.35); }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.seed-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px;
}
.seed-btn {
  text-align: left; padding: 10px 12px; border-radius: 12px;
  background: var(--bg2); border: 1px solid var(--border);
}
.seed-btn strong { display: block; }
.seed-btn span { font-size: .75rem; color: var(--muted); }

/* Bottom nav */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; gap: 2px;
  padding: 6px 6px calc(6px + var(--safe-bottom));
  background: rgba(10,10,11,.94);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(14px);
  gap: 4px;
  padding: 8px 10px calc(8px + var(--safe-bottom));
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 10px 6px; border-radius: 12px; color: var(--muted); font-size: .7rem;
  font-weight: 550; letter-spacing: 0.01em;
}
.nav-item .ico { font-size: 1.2rem; line-height: 1; opacity: .9; }
.nav-item.active { color: var(--accent); background: var(--accent-dim); }
.nav-item.hidden { display: none; }

/* Walkie */
.channel-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; }
.channel-tabs button {
  flex: 0 0 auto; padding: 8px 12px; border-radius: 999px;
  background: var(--bg2); border: 1px solid var(--border); color: var(--muted); font-size: .8rem;
}
.channel-tabs button.active { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); font-weight: 700; }

.msg-list {
  display: flex; flex-direction: column; gap: 8px;
  max-height: min(48vh, 420px); overflow-y: auto;
  padding: 4px 2px 8px;
}
.msg {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px;
}
.msg .meta { display: flex; gap: 8px; align-items: baseline; font-size: .75rem; color: var(--muted); margin-bottom: 4px; }
.msg .meta .name { color: var(--text); font-weight: 650; font-size: .85rem; }
.msg .body { font-size: .95rem; line-height: 1.35; }
.msg .subtitle { font-size: .8rem; color: var(--blue); margin-top: 4px; font-style: italic; }
.msg audio { width: 100%; margin-top: 6px; height: 32px; }

.ptt-wrap { margin-top: 12px; text-align: center; }
.ptt {
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fbbf24, var(--orange));
  color: #111; font-weight: 800; font-size: .95rem;
  box-shadow: 0 8px 28px rgba(234,88,12,.35), inset 0 1px 0 rgba(255,255,255,.35);
  user-select: none; touch-action: none;
}
.ptt.recording {
  background: radial-gradient(circle at 35% 30%, #f87171, #b91c1c);
  color: #fff;
  box-shadow: 0 0 0 6px rgba(239,68,68,.25), 0 8px 28px rgba(185,28,28,.45);
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
  50% { transform: scale(1.04); }
}
.ptt-hint { margin-top: 8px; font-size: .78rem; color: var(--muted); }
#walkie-radio-status { margin: 0 0 8px; }
#walkie-radio-status.on-air { color: var(--accent); font-weight: 700; }
#walkie-radio-mute[hidden], #walkie-radio-unlock[hidden], #walkie-radio-status[hidden] { display: none; }
#walkie-radio-player { position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none; }

.text-compose { display: flex; gap: 8px; margin-top: 12px; }
.text-compose input { flex: 1; background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }

.lang-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.lang-row select { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.note {
  font-size: .75rem; color: var(--muted);
  background: rgba(56,189,248,.08); border: 1px dashed rgba(56,189,248,.3);
  border-radius: 10px; padding: 8px 10px; margin-bottom: 10px;
}

/* Alerts */
.alert-banner {
  position: sticky; top: 57px; z-index: 35;
  background: linear-gradient(90deg, #7f1d1d, #9a3412);
  border-bottom: 1px solid rgba(254,202,202,.3);
  padding: 10px 14px; display: none;
}
.alert-banner.show { display: block; }
.alert-banner .title { font-weight: 750; font-size: .9rem; }
.alert-banner .msg { font-size: .85rem; opacity: .95; margin: 2px 0 8px; }
.alert-item {
  border-left: 4px solid var(--amber);
  padding-left: 10px;
}
.alert-item.type-spill { border-color: var(--orange); }
.alert-item.type-equipment { border-color: var(--purple); }
.alert-item.type-safety { border-color: var(--red); }
.alert-item.type-info { border-color: var(--blue); }
.badge {
  display: inline-block; font-size: .68rem; padding: 2px 7px; border-radius: 6px;
  background: var(--panel2); text-transform: uppercase; letter-spacing: .04em;
}
.ack-list { font-size: .78rem; color: var(--muted); margin-top: 6px; }

/* Dashboard */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 12px;
}
.stat .n { font-size: 1.6rem; font-weight: 800; color: var(--accent); line-height: 1; }
.stat .l { font-size: .75rem; color: var(--muted); margin-top: 4px; }
.person {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.person:last-child { border-bottom: none; }
.dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--green);
  display: inline-block; margin-right: 6px; box-shadow: 0 0 0 3px rgba(34,197,94,.2);
}

.coming-soon {
  text-align: center; padding: 40px 16px; color: var(--muted);
}
.coming-soon .big { font-size: 2.5rem; margin-bottom: 8px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px + var(--safe-bottom));
  transform: translateX(-50%);
  background: #111; border: 1px solid var(--border); color: var(--text);
  padding: 10px 14px; border-radius: 10px; font-size: .85rem;
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 80;
  max-width: 90vw;
}
.toast.show { opacity: 1; }

.hidden { display: none !important; }

/* ---- v2 modules + chat ---- */
.tab-bar { display:flex; gap:6px; overflow-x:auto; margin-bottom:10px; }
.tab-bar button { flex:0 0 auto; padding:8px 12px; border-radius:999px; background:var(--bg2);
  border:1px solid var(--border); color:var(--muted); font-size:.8rem; }
.tab-bar button.active { background:var(--accent); color:var(--accent-ink); border-color:var(--accent); font-weight:700; }

.task-item, .wo-item, .station-card, .chat-row {
  background:var(--bg2); border:1px solid var(--border); border-radius:12px; padding:10px 12px; margin-bottom:8px;
}
.prio-critical { border-left:4px solid #ef4444; }
.prio-high { border-left:4px solid #f97316; }
.prio-med { border-left:4px solid #eab308; }
.prio-low { border-left:4px solid #64748b; }
.status-running { color:#22c55e; }
.status-down { color:#ef4444; }
.status-idle { color:#94a3b8; }
.status-pending { color:#fbbf24; }
.status-done { color:#22c55e; }

.chat-layout { display:flex; flex-direction:column; gap:8px; }
.chat-list { max-height:42vh; overflow-y:auto; display:flex; flex-direction:column; gap:8px; }
.chat-bubble { background:var(--bg2); border:1px solid var(--border); border-radius:12px; padding:8px 10px; }
.chat-bubble.mine { border-color:rgba(245,158,11,.4); }
.chat-bubble .meta { font-size:.72rem; color:var(--muted); margin-bottom:4px; }
.chat-bubble .tr { font-size:.8rem; color:var(--blue); font-style:italic; margin-top:4px; }
.chat-bubble .receipts { font-size:.68rem; color:var(--muted); margin-top:4px; }
.mention { color:var(--accent); font-weight:700; }

.channel-item { display:flex; justify-content:space-between; align-items:center; gap:8px;
  padding:10px 12px; border-radius:12px; background:var(--bg2); border:1px solid var(--border); margin-bottom:6px; }
.channel-item.active { border-color:var(--accent); }
.unread-dot { background:var(--orange); color:#111; font-size:.68rem; font-weight:800;
  min-width:18px; height:18px; border-radius:999px; display:inline-grid; place-items:center; padding:0 5px; }

.toggle { display:inline-flex; align-items:center; gap:6px; font-size:.78rem; color:var(--muted); }
.toggle input { accent-color:var(--accent); }

.photo-preview { max-width:100%; max-height:120px; border-radius:8px; margin-top:6px; }
.bottom-nav .nav-item { font-size:.7rem; }

.call-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.92);
  display: flex; align-items: stretch; justify-content: center;
}
.call-overlay.hidden { display: none !important; }
.call-card { margin: auto; text-align: center; padding: 24px; max-width: 360px; }
.call-card .big { font-size: 3rem; }
.call-stage { display: flex; flex-direction: column; width: 100%; height: 100%; }
.video-wrap { position: relative; flex: 1; background: #000; min-height: 40vh; }
#remote-video { width: 100%; height: 100%; object-fit: contain; background: #111; }
#draw-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#draw-canvas.drawing { pointer-events: auto; cursor: crosshair; }
#local-video {
  position: absolute; right: 10px; bottom: 10px; width: 28%; max-width: 160px;
  border-radius: 10px; border: 2px solid var(--accent); background: #222;
}
.call-side { padding: 10px 12px calc(12px + var(--safe-bottom)); background: var(--bg); border-top: 1px solid var(--border); }
.call-controls { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.draw-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.call-chat { margin-top: 8px; border: 1px solid var(--border); border-radius: 12px; padding: 8px; background: var(--bg2); }
.call-chat-list { max-height: 22vh; overflow-y: auto; font-size: .85rem; }
.call-chat-list .line { margin-bottom: 4px; }
.thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; margin-top: 6px; border: 1px solid var(--border); }
.photo-row { display: flex; gap: 8px; flex-wrap: wrap; }
@media (min-width: 800px) {
  .call-stage { flex-direction: row; }
  .video-wrap { flex: 1.4; }
  .call-side { width: 340px; border-top: none; border-left: 1px solid var(--border); }
  .call-chat-list { max-height: 40vh; }
}
.call-overlay { position:fixed; inset:0; z-index:100; background:rgba(0,0,0,.92); display:flex; }
.call-overlay.hidden { display:none !important; }
.call-card { margin:auto; text-align:center; padding:24px; }
.call-stage { display:flex; flex-direction:column; width:100%; height:100%; }
.video-wrap { position:relative; flex:1; background:#000; min-height:40vh; }
#remote-video { width:100%; height:100%; object-fit:contain; }
#draw-canvas { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
#draw-canvas.drawing { pointer-events:auto; cursor:crosshair; }
#local-video { position:absolute; right:10px; bottom:10px; width:28%; max-width:160px; border-radius:10px; border:2px solid var(--accent); }
.call-side { padding:10px 12px; background:var(--bg); border-top:1px solid var(--border); }
.call-controls,.draw-tools { display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }
.call-chat { margin-top:8px; border:1px solid var(--border); border-radius:12px; padding:8px; background:var(--bg2); }
.call-chat-list { max-height:22vh; overflow-y:auto; font-size:.85rem; }
.thumb,.thumb-img { width:72px; height:72px; object-fit:cover; border-radius:8px; margin-top:6px; }
.photo-row { display:flex; gap:8px; flex-wrap:wrap; }
@media(min-width:800px){
  .call-stage{flex-direction:row;}
  .video-wrap{flex:1.4;}
  .call-side{width:340px;border-top:none;border-left:1px solid var(--border);}
}


/* Copilot */
.copilot-chat {
  max-height: 42vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0;
  min-height: 120px;
}
.copilot-bubble {
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--bg2);
  white-space: pre-wrap;
  font-size: .9rem;
  line-height: 1.35;
}
.copilot-bubble.user {
  align-self: flex-end;
  max-width: 92%;
  border-color: rgba(245,158,11,.45);
  background: rgba(245,158,11,.12);
}
.copilot-bubble.assistant {
  align-self: flex-start;
  max-width: 96%;
  border-color: rgba(59,130,246,.35);
}
.copilot-bubble.system {
  align-self: center;
  max-width: 96%;
  font-size: .8rem;
  color: var(--muted);
  background: transparent;
}
.copilot-bubble .cite {
  font-size: .72rem;
  color: var(--muted);
  margin-top: 6px;
}


/* Headcount / presence */
.status-chips { display:flex; flex-wrap:wrap; gap:6px; }
.chip {
  border:1px solid var(--border);
  background:var(--bg2);
  color:var(--text);
  border-radius:999px;
  padding:6px 12px;
  font-size:.8rem;
  cursor:pointer;
}
.chip.active { border-color:var(--accent); background:var(--accent-dim); }
.presence-panel { border-top:1px solid var(--border); padding-top:10px; }
.hc-role { margin-top:12px; border:1px solid var(--border); border-radius:12px; padding:10px; background:var(--bg2); }
.hc-role h3 { margin:0 0 6px; font-size:.95rem; }
.hc-badges { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:8px; }
.badge-hc {
  font-size:.72rem; border-radius:999px; padding:2px 8px;
  border:1px solid var(--border);
}
.badge-hc.on { background:rgba(34,197,94,.15); border-color:rgba(34,197,94,.4); }
.badge-hc.away { background:rgba(245,158,11,.15); border-color:rgba(245,158,11,.45); }
.badge-hc.missing { background:rgba(239,68,68,.12); border-color:rgba(239,68,68,.4); }
.hc-person {
  display:flex; justify-content:space-between; gap:8px; align-items:center;
  padding:6px 0; border-bottom:1px solid var(--border); font-size:.85rem;
}
.hc-person:last-child { border-bottom:0; }
.hc-eta { color:var(--muted); font-size:.75rem; }

/* ===== Emergency ===== */
.emergency-fab {
  position: fixed; right: 16px; bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
  z-index: 70; width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(145deg, #dc2626, #7f1d1d);
  color: #fff; font-weight: 800; font-size: 1rem; letter-spacing: .04em;
  box-shadow: 0 8px 24px rgba(220,38,38,.45); border: 2px solid #fecaca;
}
.emergency-fab.hidden { display: none; }
.emergency-overlay {
  position: fixed; inset: 0; z-index: 200; background: #450a0a;
  color: #fff; overflow: auto; padding: 24px 16px 40px;
}
.emergency-overlay.test-mode { background: #1e3a5f; }
.emergency-overlay.hidden { display: none; }
.emergency-overlay-inner { max-width: 520px; margin: 0 auto; text-align: center; }
.emergency-badge {
  display: inline-block; padding: 6px 14px; border-radius: 999px;
  background: #fef2f2; color: #991b1b; font-weight: 800; letter-spacing: .08em;
  margin-bottom: 12px;
}
.emergency-overlay.test-mode .emergency-badge { background: #e0f2fe; color: #075985; }
.emergency-overlay h1 { font-size: 1.8rem; margin: 0 0 12px; }
.emergency-instr { font-size: 1.15rem; line-height: 1.4; margin: 0 0 16px; }
.emergency-checkin { margin-top: 20px; text-align: left; background: rgba(0,0,0,.25); border-radius: 14px; padding: 14px; }
.emergency-cp-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 12px; }
.emergency-cp-list button {
  text-align: left; padding: 12px 14px; border-radius: 10px;
  background: rgba(255,255,255,.08); border: 2px solid transparent; color: #fff;
}
.emergency-cp-list button.selected { border-color: #86efac; background: rgba(34,197,94,.2); }
.emergency-safe-btn { font-size: 1.05rem; padding: 14px; }
.ok-msg { color: #86efac; font-size: 1.2rem; font-weight: 700; }
.emergency-compose-card { max-width: 480px; }
.emergency-type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.emergency-type-grid button {
  padding: 12px 8px; border-radius: 10px; background: var(--panel2);
  border: 2px solid var(--border); font-weight: 600;
}
.emergency-type-grid button.selected { border-color: #ef4444; background: rgba(239,68,68,.15); }
.emerg-board-person {
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .88rem;
}
.emerg-board-person.overdue { background: rgba(239,68,68,.12); margin: 0 -8px; padding: 8px; border-radius: 8px; }
.badge-red { background: rgba(239,68,68,.2); color: #fecaca; border: 1px solid rgba(239,68,68,.45); border-radius: 999px; padding: 2px 8px; font-size: .72rem; }
.badge-green { background: rgba(34,197,94,.15); color: #86efac; border: 1px solid rgba(34,197,94,.4); border-radius: 999px; padding: 2px 8px; font-size: .72rem; }
.modal { position: fixed; inset: 0; z-index: 180; background: rgba(0,0,0,.65); display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
.modal.hidden { display: none; }
.modal-card { background: var(--panel); border: 1px solid var(--border); border-radius: 16px 16px 12px 12px; padding: 16px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; }

/* Sticky mini banner while emergency active but overlay dismissed */
.emergency-mini-banner {
  position: sticky; top: 57px; z-index: 90;
  background: linear-gradient(90deg, #7f1d1d, #b91c1c);
  color: #fff; padding: 10px 14px; cursor: pointer;
  border-bottom: 2px solid #fecaca;
  box-shadow: 0 4px 12px rgba(127,29,29,.35);
}
.emergency-mini-banner.hidden { display: none; }
.emergency-mini-banner.test-mode {
  background: linear-gradient(90deg, #1e3a5f, #075985);
  border-bottom-color: #7dd3fc;
}
.emergency-mini-banner .emerg-mini-inner {
  display: flex; flex-direction: column; gap: 2px; max-width: 720px; margin: 0 auto;
}
.emergency-mini-banner strong { font-size: .88rem; letter-spacing: .04em; }
.emergency-mini-banner span { font-size: .78rem; opacity: .92; }

/* Call-off / staffing */
.staff-pill { display:inline-block; padding:4px 10px; border-radius:999px; font-size:.75rem; font-weight:700; margin:2px 4px 2px 0; }
.staff-pill.green { background:rgba(34,197,94,.18); color:#86efac; border:1px solid rgba(34,197,94,.4); }
.staff-pill.amber { background:rgba(245,158,11,.18); color:#fcd34d; border:1px solid rgba(245,158,11,.45); }
.staff-pill.red { background:rgba(239,68,68,.2); color:#fecaca; border:1px solid rgba(239,68,68,.5); }
.calloff-item, .ot-offer-item {
  border:1px solid var(--border); border-radius:12px; padding:10px 12px; margin:8px 0; background:var(--panel2);
}
.calloff-item .meta, .ot-offer-item .meta { font-size:.78rem; color:var(--muted); margin-top:4px; }
.co-rec-active { outline:2px solid #ef4444; background:rgba(239,68,68,.15) !important; }

/* Announcements */
.announcement-overlay {
  position: fixed; inset: 0; z-index: 195; background: #0f172a;
  color: #fff; overflow: auto; padding: 24px 16px 40px;
}
.announcement-overlay.urgent { background: #450a0a; }
.announcement-overlay.hidden { display: none; }
.announcement-overlay-inner { max-width: 560px; margin: 0 auto; text-align: center; }
.announcement-badge {
  display: inline-block; padding: 6px 14px; border-radius: 999px;
  background: #e0f2fe; color: #075985; font-weight: 800; letter-spacing: .08em; margin-bottom: 12px;
}
.announcement-overlay.urgent .announcement-badge { background: #fef2f2; color: #991b1b; }
.announcement-overlay h1 { font-size: 1.7rem; margin: 0 0 12px; }
.announcement-body { font-size: 1.1rem; line-height: 1.4; margin: 0 0 16px; }
.ann-carousel { display: flex; gap: 8px; overflow-x: auto; margin: 12px 0; scroll-snap-type: x mandatory; }
.ann-carousel img { max-height: 220px; border-radius: 12px; scroll-snap-align: center; }
.announcement-mini-banner {
  position: sticky; top: 57px; z-index: 88;
  background: linear-gradient(90deg, #0c4a6e, #0369a1);
  color: #fff; padding: 10px 14px; cursor: pointer;
  border-bottom: 2px solid #7dd3fc;
}
.announcement-mini-banner.urgent { background: linear-gradient(90deg, #7f1d1d, #b91c1c); border-bottom-color: #fecaca; }
.announcement-mini-banner.hidden { display: none; }
.announcement-mini-banner .ann-mini-inner { display: flex; flex-direction: column; gap: 2px; }
.ann-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin: 8px 0; background: var(--panel2);
}
.ann-card.urgent { border-color: rgba(239,68,68,.5); }
.ann-card img { max-width: 100%; border-radius: 10px; margin-top: 8px; }

.nav-badge {
  display:inline-block; min-width:18px; padding:1px 6px; margin-left:4px;
  border-radius:999px; background:#ef4444; color:#fff; font-size:.65rem; font-weight:800;
}
.nav-badge.hidden { display:none; }
.pol-reader-body {
  max-height: 280px; overflow:auto; text-align:left; background:rgba(0,0,0,.25);
  border-radius:12px; padding:12px; margin:10px 0; line-height:1.45; white-space:pre-wrap;
}
.pol-pdf { width:100%; height:320px; border:0; border-radius:12px; background:#111; margin:8px 0; }
.pol-item { border:1px solid var(--border); border-radius:12px; padding:10px 12px; margin:8px 0; background:var(--panel2); }
.pol-item.overdue { border-color:rgba(239,68,68,.55); }
.pol-item.blocking { border-color:#f59e0b; }

.ai-monitor-banner {
  background:rgba(14,165,233,.15); border:1px solid rgba(56,189,248,.4);
  color:#7dd3fc; padding:8px 12px; font-size:.8rem; border-radius:10px; margin:8px 0;
}
.ai-monitor-banner.hidden { display:none; }
.sop-card { border:1px solid var(--border); border-radius:12px; padding:10px 12px; margin:8px 0; background:var(--panel2); white-space:pre-wrap; font-size:.85rem; }
.sop-suggest { border-left:3px solid #38bdf8; padding:8px 10px; margin:8px 0; background:rgba(14,165,233,.1); border-radius:8px; }

.mtg-recording-banner {
  background:#b91c1c; color:#fff; font-weight:800; letter-spacing:.04em;
  text-align:center; padding:12px; border-radius:12px; margin-bottom:8px;
  animation: mtg-pulse 1.4s ease-in-out infinite;
}
@keyframes mtg-pulse { 0%,100%{opacity:1;} 50%{opacity:.72;} }
.mtg-consent-banner {
  background:rgba(234,179,8,.15); border:1px solid rgba(234,179,8,.45);
  color:#fde68a; padding:8px 10px; border-radius:10px; font-size:.8rem; margin-bottom:8px;
}
.mtg-transcript {
  max-height:260px; overflow:auto; background:var(--panel2);
  border:1px solid var(--border); border-radius:10px; padding:8px; font-size:.82rem;
  white-space:pre-wrap;
}
.mtg-attendee-picks label { display:block; font-size:.82rem; margin:2px 0; }
.mtg-hit { border-left:3px solid #38bdf8; padding:6px 8px; margin:6px 0; background:rgba(14,165,233,.08); border-radius:8px; }
.mtg-action { border:1px solid var(--border); border-radius:10px; padding:8px; margin:6px 0; background:var(--panel2); }
.mtg-action.overdue { border-color:#f87171; }
.mtg-action.carry { border-left:3px solid #fbbf24; }

.mod-tab.active { background:var(--accent); color:var(--accent-ink); }
.scada-line { border:1px solid var(--border); border-radius:12px; padding:10px; margin:8px 0; background:var(--panel2); }
.scada-line.down { border-color:#f87171; }
.scada-line.running { border-color:#4ade80; }
.chk-step { border:1px solid var(--border); border-radius:10px; padding:8px; margin:6px 0; }
.chk-step.done { opacity:.75; border-color:#4ade80; }


/* ===== Hub / More (UX redesign) ===== */
.hub-greet { margin: 4px 0 18px; }
.hub-greet h2 { margin: 0 0 4px; font-size: 1.35rem; font-weight: 650; letter-spacing: -0.03em; }
.hub-greet p { margin: 0; color: var(--muted); font-size: .9rem; }
.hub-section { margin-bottom: 20px; }
.hub-section-title {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; padding: 0 2px;
}
.hub-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.hub-grid.one-col { grid-template-columns: 1fr; }
.hub-card {
  text-align: left; padding: 14px 14px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px; min-height: 76px;
  transition: border-color .15s, background .15s;
}
.hub-card:active { transform: scale(.985); }
.hub-card .hub-ico { font-size: 1.25rem; line-height: 1; margin-bottom: 2px; }
.hub-card strong { font-size: .92rem; font-weight: 650; letter-spacing: -0.01em; }
.hub-card span { font-size: .75rem; color: var(--muted); line-height: 1.3; }
.hub-card.accent {
  border-color: rgba(45,212,191,.35);
  background: linear-gradient(160deg, rgba(45,212,191,.12), var(--panel));
}
.hub-card.danger {
  border-color: rgba(239,68,68,.35);
  background: linear-gradient(160deg, rgba(239,68,68,.1), var(--panel));
}
.hub-card .hub-badge {
  align-self: flex-start; margin-top: 4px;
}
.more-list { display: flex; flex-direction: column; gap: 8px; }
.more-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 14px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--border);
  text-align: left; width: 100%;
}
.more-row .hub-ico { font-size: 1.2rem; width: 28px; text-align: center; }
.more-row .grow { display: flex; flex-direction: column; gap: 2px; }
.more-row strong { font-size: .95rem; font-weight: 600; }
.more-row span { font-size: .75rem; color: var(--muted); }
.more-row .chev { color: var(--muted); font-size: .9rem; }
.screen-pad-tight { padding-top: 10px; }

/* ---- Press-and-hold dual translator (2026-09-25) ---- */
.lang-row { flex-wrap: wrap; }
.tr-open-btn { margin-left: auto; padding: 8px 12px; font-size: .85rem; }
.tr-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.tr-head h2 { margin: 0; font-size: 1.2rem; }
.tr-intro { font-size: .8rem; margin: 4px 0 10px; }
.tr-langs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; margin-bottom: 12px; }
.tr-langs select { width: 100%; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 8px; font-size: .95rem; color: var(--text); }
.tr-swap { font-size: 1.2rem; padding: 8px 14px; }
.tr-pads { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tr-hold {
  min-height: 170px; border-radius: 22px; border: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px;
  background: linear-gradient(160deg, rgba(45,212,191,.22), rgba(45,212,191,.06));
  color: var(--text); text-align: center;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none;
  -webkit-tap-highlight-color: transparent; cursor: pointer;
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease;
}
.tr-hold.side-b { background: linear-gradient(160deg, rgba(56,189,248,.22), rgba(56,189,248,.06)); }
.tr-hold * { pointer-events: none; }
.tr-hold-ico { font-size: 2.1rem; line-height: 1; }
.tr-hold-label { font-size: .95rem; font-weight: 700; line-height: 1.2; }
.tr-hold-lang { font-size: .8rem; color: var(--muted); }
.tr-hold.recording {
  background: radial-gradient(circle at 50% 35%, #f87171, #b91c1c); color: #fff; border-color: #ef4444;
  box-shadow: 0 0 0 6px rgba(239,68,68,.25), 0 10px 30px rgba(185,28,28,.45);
  animation: pulse 1s ease-in-out infinite;
}
.tr-hold.recording .tr-hold-lang { color: #fee2e2; }
.tr-hold.busy { opacity: .55; }
.tr-hold:disabled { opacity: .45; }
.tr-status { margin: 12px 0 6px; text-align: center; font-size: .9rem; color: var(--muted); min-height: 1.3em; }
.tr-status.live { color: #fca5a5; font-weight: 700; }
.tr-status.err { color: #fecaca; background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.35); border-radius: 10px; padding: 8px; }
.tr-options { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; }
.tr-options select { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; color: var(--text); }
.tr-log { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.tr-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.tr-card .tr-orig { font-size: .85rem; color: var(--muted); }
.tr-card .tr-out { font-size: 1.15rem; font-weight: 650; margin-top: 6px; line-height: 1.35; }
.tr-card .tr-meta { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: .72rem; color: var(--muted); }
.tr-card .tr-meta .grow { flex: 1; }
.tr-card .btn { padding: 6px 10px; font-size: .8rem; }
@media (max-width: 360px) { .tr-hold { min-height: 140px; } .tr-hold-label { font-size: .85rem; } }

/* ---- Store-ready (2026-09-28): plant switch, legal links, account & deletion ---- */
.plant-switch { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 12px; padding: 8px 12px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.plant-switch strong { color: var(--text); font-weight: 600; }
.btn-sm { padding: 6px 10px; font-size: .85rem; min-height: 36px; }
.legal-links { text-align: center; font-size: .85rem; color: var(--muted); margin: 16px 0 8px; }
.legal-links a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.account-links { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: .9rem; }
.account-links a { color: var(--accent); }
.del-list { margin: 8px 0 12px; padding-left: 18px; color: var(--muted); font-size: .9rem; }
.del-list li { margin: 6px 0; }
.acct-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.acct-row:last-child { border-bottom: 0; }
.acct-row .grow { flex: 1; min-width: 0; }
.acct-row .grow span { display: block; color: var(--muted); font-size: .8rem; }

/* store-ready 2026-09-28: keep the chat thread header on one tidy line on narrow phones */
#chat-thread > .row { gap: 6px; flex-wrap: nowrap; }
#chat-thread > .row .btn { padding: 8px 10px; font-size: .85rem; white-space: nowrap; flex-shrink: 0; }
#chat-thread > .row .toggle { white-space: nowrap; flex-shrink: 0; }
#chat-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* store-ready 2026-09-28: dark fallback for any bare form control (previously browser-default white boxes,
   e.g. SCADA "Set target", module config). Zero-specificity :where() so every existing rule still wins. */
:where(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]):not([type=hidden]), select, textarea) {
  background: var(--bg2); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px;
}
:where(input, select, textarea):focus { outline: none; border-color: var(--accent); }

/* store-ready 2026-09-28: compose rows overflowed the viewport on 360px phones (Send/Translate pushed
   off-screen, page scrolled sideways and covered the bottom nav). Let the input shrink instead. */
.text-compose input { min-width: 0; width: auto; }
.text-compose .btn { flex-shrink: 0; }

/* store-ready 2026-09-28: when the SOS button is showing, leave room so it never sits on top of the
   last controls on a screen (e.g. Translate/Send on 360px phones). */
body:has(#emergency-fab:not(.hidden)) { padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 96px); }
/* On small phones, lift and shrink the SOS button on screens whose compose row sits near the bottom
   (chat thread, walkie, translator) so it never covers Send / Translate. */
@media (max-width: 420px) {
  body:has(#screen-translate.active) .emergency-fab,
  body:has(#screen-walkie.active) .emergency-fab,
  body:has(#chat-thread:not(.hidden)):has(#screen-channels.active) .emergency-fab {
    width: 52px; height: 52px; font-size: .85rem; right: 12px;
    bottom: calc(var(--nav-h) + var(--safe-bottom) + 80px);
  }
}
@media (max-width: 420px) {
  body:has(#chat-thread:not(.hidden)):has(#screen-channels.active) .emergency-fab { bottom: calc(var(--nav-h) + var(--safe-bottom) + 100px); }
}

/* UGC safeguards (2026-09-28): message ⋯ menu, report sheet, moderation queue */
.msg .meta, .chat-bubble .meta { position: relative; }
.msg-more {
  margin-left: auto; float: right; background: transparent; border: 1px solid transparent; color: var(--muted);
  font-size: 1.1rem; line-height: 1; padding: 2px 8px; border-radius: 8px; cursor: pointer; min-width: 32px; min-height: 28px;
}
.msg .meta { display: flex; align-items: center; gap: 6px; }
.msg-more:hover, .msg-more:focus-visible { border-color: var(--border); color: var(--text); background: var(--panel2); }
.msg, .chat-bubble { -webkit-touch-callout: none; }
.ma-actions { display: flex; flex-direction: column; gap: 8px; }
.rep-reasons { display: flex; flex-direction: column; gap: 2px; }
.rep-reasons label { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--bg2); font-size: .92rem; cursor: pointer; }
.rep-reasons label:has(input:checked) { border-color: var(--accent); background: var(--accent-dim); }
.rep-reasons input { accent-color: var(--accent); }
.report-row { border: 1px solid var(--border); border-radius: 12px; padding: 10px; margin-top: 8px; background: var(--bg2); }
.report-row .report-text { margin: 4px 0; white-space: pre-wrap; word-break: break-word; }
.report-row .thumb { max-width: 160px; border-radius: 8px; margin: 4px 0; }
.report-row audio { width: 100%; margin: 4px 0; }
