/* Rolling Menus — Operator Command Center.
 *
 * Brand tokens are the real ones from rollingmenus-site/src/styles/global.css
 * (red sampled from the actual logo ink, not guessed). The site commits to ONE
 * dark theme rather than a light/dark toggle, and this tool follows it: an
 * operator console runs all day, and the map basemap is CARTO dark.
 *
 * Density is deliberate. This is a working surface, not a marketing page — the
 * job is to fit a day's book of business on one screen without scrolling to
 * find a coverage gap. */

@font-face {
  font-family: "Fraunces Display";
  src: url("../public/fonts/fraunces-display.woff2") format("woff2");
  font-weight: 400 900; font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("../public/fonts/nunito.woff2") format("woff2");
  font-weight: 200 1000; font-display: swap;
}

:root {
  --bg: #0D0B0A;
  --panel: #1C1613;
  --panel-2: #241C18;
  --rule: #322722;
  --ink: #F2EAE0;
  --muted: #B8A99A;
  --dim: #8B7C6E;

  --red: #C6342E;
  --red-deep: #931E1F;
  --red-soft: rgba(198, 52, 46, 0.16);

  --good: #4FA86B;
  --good-soft: rgba(79, 168, 107, 0.16);
  --warn: #D99A2B;
  --warn-soft: rgba(217, 154, 43, 0.16);
  --bad: #D24B3F;
  --bad-soft: rgba(210, 75, 63, 0.16);
  --info: #5B8FB9;
  --info-soft: rgba(91, 143, 185, 0.16);

  --r: 10px;
  --gap: 12px;
}

* { box-sizing: border-box; }

/* The `hidden` attribute must win over the layout rules below. `hidden` works
 * only through the UA sheet's `[hidden] { display: none }`, which ANY explicit
 * author `display` overrides — so `.gate { display: grid }` and
 * `.shell { display: flex }` would both render at once, stacked, with the shell
 * pushed below the fold. Caught by screenshotting the demo build. */
[hidden] { display: none !important; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--ink);
  font-family: "Nunito", ui-sans-serif, system-ui, sans-serif;
  font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: "Fraunces Display", Georgia, serif; margin: 0; font-weight: 600; }
button, input, textarea, select { font: inherit; color: inherit; }
.dim { color: var(--dim); font-weight: 400; }

/* ---------- gate ---------- */
.gate { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.gate-card {
  background: var(--panel); border: 1px solid var(--rule); border-radius: 16px;
  padding: 36px 32px; max-width: 420px; text-align: center;
}
.gate-card h1 { font-size: 1.5rem; margin: 14px 0 2px; }
.gate-sub { color: var(--muted); margin: 0 0 18px; }
.gate-msg { color: var(--warn); min-height: 1em; margin: 0 0 16px; }
.gate-fine { color: var(--dim); font-size: 0.8rem; margin: 16px 0 0; }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid var(--rule); background: var(--panel-2); color: var(--ink);
  border-radius: 8px; padding: 8px 14px; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: #2C221C; border-color: #4A3A32; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; font-weight: 700; }
.btn-primary:hover { background: var(--red-deep); border-color: var(--red-deep); }
.btn-danger { color: #F3B0AA; border-color: #5A2A26; }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 11px; font-size: .86rem; }
.btn-xs { padding: 4px 9px; font-size: .78rem; border-radius: 6px; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* ---------- shell ---------- */
.shell { display: flex; flex-direction: column; height: 100%; }

.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 10px 16px; border-bottom: 1px solid var(--rule);
  background: var(--panel); flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand strong { display: block; font-family: "Fraunces Display", serif; font-size: .98rem; }
.brand-sub { color: var(--dim); font-size: .78rem; }
.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.me { text-align: right; line-height: 1.2; }
.me #who { display: block; font-weight: 700; font-size: .86rem; }
.role { color: var(--dim); font-size: .74rem; }

.tiles { display: flex; gap: 8px; flex-wrap: wrap; }
.tile {
  background: var(--panel-2); border: 1px solid var(--rule); border-radius: 8px;
  padding: 5px 11px; min-width: 74px; text-align: center;
}
.tile-n { display: block; font-family: "Fraunces Display", serif; font-size: 1.12rem; font-weight: 700; }
.tile-l { display: block; color: var(--dim); font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; }
.tile-warn { border-color: var(--warn); background: var(--warn-soft); }
.tile-bad  { border-color: var(--bad);  background: var(--bad-soft); }
.tile-good { border-color: var(--good); background: var(--good-soft); }

.demo-banner {
  margin: 0; padding: 7px 16px; background: var(--warn-soft);
  border-bottom: 1px solid var(--warn); color: #F0D69A; font-size: .82rem;
}

/* ---------- three-panel grid ---------- */
.grid {
  flex: 1; min-height: 0;
  display: grid; gap: var(--gap); padding: var(--gap);
  grid-template-columns: minmax(240px, 1fr) minmax(420px, 2.1fr) minmax(280px, 1.1fr);
}
.panel {
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r);
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.panel-head {
  padding: 10px 12px; border-bottom: 1px solid var(--rule);
  display: flex; flex-direction: column; gap: 8px;
}
.panel-head h2 { font-size: .94rem; }

/* map */
.map { height: 260px; flex: none; border-bottom: 1px solid var(--rule); background: #14100E; }
.loc-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; min-height: 0; }
.locrow {
  padding: 8px 9px; border-radius: 8px; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px; border: 1px solid transparent;
}
.locrow:hover { background: var(--panel-2); }
.locrow.on { background: var(--red-soft); border-color: var(--red); }
.locname { font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.locmeta { color: var(--muted); font-size: .78rem; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* map pins */
.pin { width: 20px; height: 20px; display: grid; place-items: center; cursor: pointer; position: relative; }
.pin-dot {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid #0D0B0A; box-shadow: 0 0 0 1.5px rgba(255,255,255,.35);
}
.pin-good .pin-dot { background: var(--good); }
.pin-warn .pin-dot { background: var(--warn); }
.pin-bad  .pin-dot { background: var(--bad); }
.pin-sel .pin-dot { background: var(--red); transform: scale(1.35); }
.pin-badge {
  position: absolute; top: -7px; right: -9px; background: #0D0B0A; color: var(--ink);
  border: 1px solid var(--rule); border-radius: 9px; font-size: .62rem;
  padding: 0 4px; font-weight: 700;
}
.maplibregl-popup-content { background: var(--panel-2); color: var(--ink); border: 1px solid var(--rule); border-radius: 8px; font-size: .8rem; }
.maplibregl-popup-tip { border-top-color: var(--panel-2) !important; border-bottom-color: var(--panel-2) !important; }
.pop-sub { color: var(--muted); }

/* board */
.board-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#board-search {
  flex: 1; min-width: 180px; background: var(--bg); border: 1px solid var(--rule);
  border-radius: 8px; padding: 6px 10px;
}
.chk, .dr-pick { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .82rem; cursor: pointer; }
.loc-chip { margin: 0; color: var(--muted); font-size: .8rem; display: flex; gap: 8px; align-items: center; }

.board-list { overflow-y: auto; padding: 10px 12px 18px; flex: 1; min-height: 0; }
.daygroup { margin-bottom: 18px; }
.dayhead {
  font-size: .84rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em;
  display: flex; justify-content: space-between; align-items: baseline;
  padding-bottom: 6px; border-bottom: 1px solid var(--rule); margin-bottom: 10px;
  font-family: "Nunito", sans-serif; font-weight: 700;
}
.daymeta { color: var(--dim); font-size: .76rem; letter-spacing: 0; text-transform: none; }
.cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
.card {
  background: var(--panel-2); border: 1px solid var(--rule); border-left: 3px solid var(--rule);
  border-radius: 9px; padding: 11px 12px; cursor: pointer; transition: border-color .15s, background .15s;
}
.card:hover { background: #2C221C; border-color: #4A3A32; }
.card-short { border-left-color: var(--warn); }
.card header { display: flex; justify-content: space-between; align-items: start; gap: 8px; margin-bottom: 5px; }
.card h4 { font-size: .96rem; }
.card .where, .card .when { margin: 0 0 4px; font-size: .82rem; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.cov { height: 6px; background: #150F0D; border-radius: 4px; overflow: hidden; display: flex; margin: 7px 0 5px; }
.cov-fill { height: 100%; }
.cov-good { background: var(--good); }
.cov-warn { background: var(--warn); }
.cov-bad  { background: var(--bad); }
.cov-backup { height: 100%; background: repeating-linear-gradient(45deg, #3B2E28, #3B2E28 3px, #2A211C 3px, #2A211C 6px); }
.cov-label { margin: 0; font-size: .8rem; color: var(--muted); }
.cov-label .need { color: var(--warn); }
.cov-label .ok { color: var(--good); }
.flags { margin: 6px 0 0; display: flex; gap: 5px; flex-wrap: wrap; }

/* pills + flags */
.pill {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: .7rem; font-weight: 700; white-space: nowrap;
  border: 1px solid transparent; text-transform: uppercase; letter-spacing: .03em;
}
.pill-good { background: var(--good-soft); color: #8FD3A4; border-color: #2F5C3E; }
.pill-warn { background: var(--warn-soft); color: #EAC079; border-color: #6B5220; }
.pill-bad  { background: var(--bad-soft);  color: #F0A79E; border-color: #6B2E28; }
.pill-info { background: var(--info-soft); color: #A7C9E0; border-color: #2F4C61; }
.pill-calm { background: #241C18; color: var(--dim); border-color: var(--rule); }
.pill-public  { background: var(--info-soft); color: #A7C9E0; border-color: #2F4C61; }
.pill-hybrid  { background: var(--warn-soft); color: #EAC079; border-color: #6B5220; }
.pill-private { background: #2A1D1C; color: #E2A9A3; border-color: #5A2A26; }

.flag {
  font-size: .7rem; padding: 1px 7px; border-radius: 5px;
  background: #241C18; border: 1px solid var(--rule); color: var(--muted);
}
.flag-warn { background: var(--warn-soft); color: #EAC079; border-color: #6B5220; }
.flag-bad  { background: var(--bad-soft);  color: #F0A79E; border-color: #6B2E28; }
.flag-good { background: var(--good-soft); color: #8FD3A4; border-color: #2F5C3E; }

/* queue */
.queue-tabs { display: flex; gap: 5px; flex-wrap: wrap; }
.qtab {
  border: 1px solid var(--rule); background: transparent; color: var(--muted);
  border-radius: 999px; padding: 3px 10px; font-size: .76rem; cursor: pointer;
}
.qtab.on { background: var(--red-soft); border-color: var(--red); color: var(--ink); }
.qtab span { color: var(--dim); font-weight: 700; }

.queue-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; min-height: 0; }
.qrow {
  display: flex; gap: 9px; padding: 9px; border-radius: 8px; cursor: pointer;
  border-left: 3px solid var(--rule); margin-bottom: 5px; background: var(--panel-2);
}
.qrow:hover { background: #2C221C; }
.qp1 { border-left-color: var(--bad); }
.qp2 { border-left-color: var(--warn); }
.qp3 { border-left-color: var(--info); }
.qkind { color: var(--muted); font-size: .96rem; line-height: 1.3; }
.qbody { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.qtitle { font-weight: 700; font-size: .86rem; }
.qdetail {
  color: var(--muted); font-size: .78rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.qmeta { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.qdue { color: var(--dim); font-size: .74rem; }
.qdue.bad { color: #F0A79E; font-weight: 700; }

/* drawer */
.drawer-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 94vw);
  background: var(--panel); border-left: 1px solid var(--rule);
  overflow-y: auto; z-index: 41; padding: 20px 22px 40px;
  box-shadow: -18px 0 40px rgba(0,0,0,.45);
}
.drawer-close {
  position: absolute; top: 12px; right: 14px; background: transparent; border: 0;
  color: var(--muted); font-size: 1.6rem; line-height: 1; cursor: pointer;
}
/* padding-right keeps the status pill clear of the absolutely-positioned close
 * button in the top-right corner. */
.dr-head { display: flex; justify-content: space-between; gap: 14px; align-items: start; padding-right: 30px; }
.dr-eyebrow { margin: 0 0 3px; color: var(--red); font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; }
.dr-head h2 { font-size: 1.28rem; margin-bottom: 4px; }
.dr-sub { margin: 0 0 3px; color: var(--muted); font-size: .84rem; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.dr-status { text-align: right; }
.dr-rev { color: var(--dim); font-size: .72rem; margin: 5px 0 0; }
.dr-cov { margin: 14px 0 10px; }
.dr-note { color: var(--muted); font-size: .8rem; background: var(--panel-2); border: 1px solid var(--rule); border-radius: 8px; padding: 7px 10px; margin: 0 0 12px; }
.dr-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--rule); margin: 6px 0 14px; }
.dr-tab {
  background: transparent; border: 0; border-bottom: 2px solid transparent;
  color: var(--muted); padding: 7px 11px; cursor: pointer; font-weight: 700; font-size: .86rem;
}
.dr-tab.on { color: var(--ink); border-bottom-color: var(--red); }
.dr-h3 { font-size: .94rem; margin: 16px 0 8px; display: flex; gap: 7px; align-items: baseline; }
.dr-list { list-style: none; margin: 0 0 10px; padding: 0; }
.dr-row {
  display: flex; justify-content: space-between; gap: 12px; align-items: start;
  padding: 9px 10px; border: 1px solid var(--rule); border-radius: 8px;
  margin-bottom: 6px; background: var(--panel-2);
}
.dr-row-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dr-name { font-weight: 700; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.dr-meta { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.dr-quote { color: var(--muted); font-size: .82rem; font-style: italic; }
.dr-reason { color: #E2A9A3; font-size: .78rem; }
.dr-row-acts { display: flex; gap: 5px; flex-wrap: wrap; justify-content: end; flex: none; }
.dr-actions { display: flex; gap: 7px; flex-wrap: wrap; margin: 10px 0 4px; }
.dr-cands { max-height: 44vh; overflow-y: auto; }
.dr-invite { margin-top: 12px; display: flex; flex-direction: column; gap: 9px; }
.fld { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; color: var(--muted); }
.fld textarea, .fld input {
  background: var(--bg); border: 1px solid var(--rule); border-radius: 8px;
  padding: 7px 9px; color: var(--ink); resize: vertical;
}
.dr-more { margin: 6px 0 12px; color: var(--muted); font-size: .84rem; }
.dr-more summary { cursor: pointer; padding: 5px 0; }

/* timeline */
.tl { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 1px solid var(--rule); }
.tl-item { position: relative; padding: 0 0 15px 14px; }
.tl-dot {
  position: absolute; left: -21px; top: 5px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--red); border: 2px solid var(--panel);
}
.tl-title { margin: 0; font-weight: 700; font-size: .86rem; }
.tl-meta { margin: 1px 0 0; color: var(--dim); font-size: .74rem; }
.tl-reason { margin: 3px 0 0; color: var(--muted); font-size: .8rem; font-style: italic; }
.tl-sub { margin: 5px 0 0; padding-left: 15px; color: var(--muted); font-size: .8rem; }

/* misc */
.empty { padding: 22px 14px; text-align: center; color: var(--muted); }
.empty p { margin: 0 0 4px; }
.empty .sub { color: var(--dim); font-size: .82rem; }
.error { background: var(--bad-soft); border: 1px solid var(--bad); color: #F0A79E; padding: 10px 12px; border-radius: 8px; }

.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%) translateY(140%);
  background: var(--panel-2); border: 1px solid var(--rule); color: var(--ink);
  padding: 10px 18px; border-radius: 999px; z-index: 60;
  transition: transform .22s ease; max-width: 90vw; box-shadow: 0 8px 26px rgba(0,0,0,.5);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast-good { border-color: var(--good); }
.toast-bad  { border-color: var(--bad); }

/* Narrow screens: the three panels stack. An operator on a phone at a site
   still needs the queue and the board, just not side by side. */
@media (max-width: 1080px) {
  .grid { grid-template-columns: 1fr; overflow-y: auto; }
  .panel { min-height: 320px; }
  .map { height: 220px; }
  .board-list, .queue-list, .loc-list { overflow-y: visible; }
}
@media (max-width: 640px) {
  .topbar { gap: 10px; }
  .tiles { order: 3; width: 100%; }
  .tile { flex: 1; min-width: 62px; }
}
