:root {
  --bg: #0b1017;
  --panel: #111824;
  --panel-2: #0f1420;
  --border: #1e293b;
  --text: #e6edf3;
  --muted: #9ba5b4;
  --accent: #2dd4bf;
  --ok: #34d399;
  --no: #f87171;
  --warn: #fbbf24;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; overscroll-behavior: none;
}
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; padding-bottom: 76px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; position: sticky; top: 0; background: var(--bg); z-index: 5;
  border-bottom: 1px solid var(--border);
}
.who { font-weight: 700; font-size: 16px; }
.acting-chip {
  display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 10px;
  background: var(--accent, #1f6f6b); color: #fff; font-size: 11px; font-weight: 600;
  cursor: pointer; vertical-align: middle; white-space: nowrap;
}
.acting-chip:hover { opacity: .85; }
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; }
.tabs {
  display: flex; gap: 8px; overflow-x: auto; padding: 10px 12px;
  background: var(--panel-2); border-bottom: 1px solid var(--border);
}
.navbtn {
  background: transparent; border: 2px solid var(--border); color: var(--muted);
  padding: 9px 14px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.navbtn.active { color: var(--text); border-color: var(--accent); background: #0c2b29; box-shadow: 0 0 0 1px var(--accent); }
.crumbs { display: flex; align-items: center; gap: 6px; padding: 8px 14px; font-size: 13px; background: var(--bg); border-bottom: 1px solid var(--border); color: var(--muted); }
.crumb-sep { color: var(--muted); opacity: .6; }
.crumb-link { color: var(--accent); cursor: pointer; font-weight: 600; }
.crumb-link:hover { text-decoration: underline; }
.crumb-current { color: var(--text); font-weight: 700; }
.view { padding: 12px; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px; margin-bottom: 12px;
}
.card.center { text-align: center; padding-top: 48px; }
.card h2 { margin: 0 0 8px; }
.card h3 { margin: 0 0 10px; font-size: 15px; }
.muted { color: var(--muted); font-size: 13px; }
.lbl { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
.inp {
  width: 100%; background: #0b0f17; border: 1px solid var(--border); color: var(--text);
  padding: 11px 12px; border-radius: 10px; font-size: 15px; margin-bottom: 6px;
}
.btn {
  background: #0f1420; border: 1px solid var(--border); color: var(--text);
  padding: 11px 14px; border-radius: 10px; font-size: 14px; cursor: pointer; width: 100%;
  font-weight: 600; margin-top: 6px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #04201d; }
.btn.ghost { background: transparent; color: var(--muted); width: auto; padding: 7px 12px; }
.btn.small { width: auto; padding: 6px 10px; font-size: 12px; margin: 0 0 0 4px; }
.btn.ok { background: #0c2b29; border-color: var(--ok); color: var(--ok); }
.btn.no { background: #2a1414; border-color: var(--no); color: var(--no); }
.btn.big { font-size: 17px; padding: 16px; margin-top: 14px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: none; }
.row.clickable { cursor: pointer; transition: background 0.12s; border-radius: 6px; }
.row.clickable:hover, .row.clickable:active { background: #0f1420; }
.errbox { display: block; margin-top: 10px; padding: 10px 12px; border-radius: 8px;
  background: #2a1414; color: #ff9a9a; border: 1px solid #ff5a5a; font-size: 13px; font-weight: 600; }
.status-pill.err { background: #2a1414; color: #ff9a9a; border-color: #ff5a5a; }
.status-pill { display: inline-block; margin-top: 8px; padding: 6px 12px; border-radius: 999px;
  background: #0c2b29; color: var(--accent); font-size: 13px; border: 1px solid var(--accent); }
.clockbig { font-size: 64px; font-weight: 800; letter-spacing: 2px; color: var(--accent); }
.badge { font-size: 11px; padding: 3px 8px; border-radius: 999px; text-transform: capitalize; }
.badge.pending { background: #2a2410; color: var(--warn); }
.badge.approved { background: #0c2b29; color: var(--ok); }
.badge.denied { background: #2a1414; color: var(--no); }
.badge.assigned { background: #0c2230; color: #7dd3fc; }
.callsign-badge { display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 24px; padding: 0 6px; margin-right: 8px;
  border-radius: 6px; background: #10202b; color: var(--info);
  font-weight: 800; font-size: 12px; letter-spacing: 0.5px;
  border: 1px solid #1d3a4d; text-transform: uppercase; }
.badge.completed { background: #0c2b29; color: var(--ok); }
.badge.complete { background: #0c2b29; color: var(--ok); border: 1px solid var(--ok); }
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px);
  background: #1b2433; color: var(--text); padding: 11px 16px; border-radius: 12px;
  border: 1px solid var(--border); opacity: 0; pointer-events: none; transition: all .25s; z-index: 50;
  max-width: 90vw; font-size: 14px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: var(--no); }

/* ---- Home launch buttons ---- */
.home-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px; }
.home-btn, .dept-btn {
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
  background: var(--panel); border: 2px solid var(--accent); border-radius: 12px;
  padding: 18px 16px; cursor: pointer; text-align: left; color: var(--text);
  box-shadow: 0 0 0 1px var(--accent);
}
.home-btn:active, .dept-btn:active { background: #0c2b29; }
@keyframes homeGlow {
  0%, 100% { box-shadow: 0 0 0 1px var(--warn), 0 0 8px 1px rgba(251, 191, 36, 0.35); }
  50% { box-shadow: 0 0 0 1px var(--warn), 0 0 16px 3px rgba(251, 191, 36, 0.7); }
}
.navbtn.glow {
  border-color: var(--warn);
  box-shadow: 0 0 0 1px var(--warn), 0 0 10px 1px rgba(251, 191, 36, 0.5);
  animation: homeGlow 1.4s ease-in-out infinite;
}
.hb-title { font-size: 17px; font-weight: 800; letter-spacing: 0.5px; }
.hb-sub { font-size: 12px; color: var(--muted); }
.tabular { font-variant-numeric: tabular-nums; }

/* ---- Modal (crew-leader clock actions + laborer QR) ---- */
.inp.invalid { border-color: var(--no); box-shadow: 0 0 0 1px var(--no); }
.err-msg { color: var(--no); font-weight: 600; }
.chk-list { display: flex; flex-direction: column; gap: 4px; margin: 4px 0; }
.chk-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--card);
  cursor: pointer; font-size: 14px; }
.chk-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.modal-overlay {
  position: fixed; inset: 0; background: rgba(3, 7, 12, 0.72);
  display: none; align-items: center; justify-content: center;
  padding: 18px; z-index: 100;
}
.modal-overlay.show { display: flex; }
.modal-box {
  position: relative;
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 18px; width: min(420px, 94vw); max-height: 88vh; overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.05);
}
.modal-box h3 { margin: 0; font-size: 17px; text-align: center; letter-spacing: 2px; }
.modal-box .modal-close {
  position: absolute; top: 10px; right: 14px; background: transparent;
  border: none; color: var(--muted); font-size: 22px; cursor: pointer; line-height: 1;
}
.modal-actions { display: flex; gap: 12px; justify-content: center; margin: 16px 0 6px; }
.modal-actions .btn { width: auto; min-width: 120px; font-size: 17px; padding: 16px 18px; flex: 1; }
.modal-actions .btn:disabled { opacity: .35; }
.modal-today { text-align: center; font-size: 13px; color: var(--muted); margin-top: 6px; }
.modal-today b { color: var(--text); font-size: 16px; }
.modal-qr {
  margin: 14px auto 4px; width: 200px; height: 200px; background: #fff;
  border-radius: 12px; padding: 8px; display: flex; align-items: center; justify-content: center;
}
.modal-qr svg, .modal-qr img { width: 100%; height: 100%; }
.modal-qr-note { text-align: center; font-size: 12px; color: var(--muted); margin-top: 8px; }

/* Job Status: sub-sections stack, Requests above Crew (visual reorder). */
.status-members { display: flex; flex-direction: column; }
.status-sub:has(.sub-head[data-sub="requests"]) { order: 1; }
.status-sub:has(.sub-head[data-sub="crew"]) { order: 2; }

/* Blinking indicator for jobs that have an open (pending/active) request. */
@keyframes req-blink {
  0%   { opacity: 1;   box-shadow: 0 0 0 0 rgba(255, 176, 32, 0.7); }
  50%  { opacity: .35; box-shadow: 0 0 0 6px rgba(255, 176, 32, 0); }
  100% { opacity: 1;   box-shadow: 0 0 0 0 rgba(255, 176, 32, 0); }
}
.req-blink {
  display: inline-block;
  background: #ffb020;
  color: #1a1206;
  font-weight: 800;
  font-size: 10px;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 999px;
  letter-spacing: .3px;
  animation: req-blink 1.1s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .req-blink { animation: none; opacity: 1; }
}

