/* Operator console. Colours and fonts come from ../shared/tokens.css. */

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ground);
  color: var(--ink);
  font: 14px/1.4 var(--font);
  display: flex;
  flex-direction: column;
}
[hidden] { display: none !important; }
button, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.act { color: var(--act-ink); }

/* ---------- header ---------- */
.top {
  display: flex;
  align-items: stretch;
  gap: 28px;
  height: 56px;
  padding: 0 24px;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}
.top > * { display: flex; align-items: center; }
.brand { color: inherit; text-decoration: none; font-size: 18px; font-weight: 800; padding-right: 14px; margin-right: -14px; position: relative; }
.brand::after { content: ""; position: absolute; right: 0; top: 16px; bottom: 16px; width: 1px; background: var(--rule); }
.dam { gap: 14px; white-space: nowrap; }
.dam b { font-weight: 700; }
.dam span { color: var(--ink-2); font-size: 13px; }
.dam .tag { color: var(--ink); border: 1px solid var(--ink); padding: 2px 6px 0; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; }
.modes { gap: 4px; align-items: stretch; }
.mode {
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  border-top: 3px solid transparent;
  padding: 2px 14px 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
}
.mode:hover { color: var(--ink); }
.mode.active { color: var(--ink); font-weight: 800; border-bottom-color: var(--ink); }
body[data-mode="live"] .mode.active { border-bottom-color: var(--act-ink); }
body[data-mode="drill"] .mode.active { border-bottom-color: var(--soon); }
.sel { gap: 8px; color: var(--ink-2); font-size: 13px; }
select {
  background: var(--ground);
  border: 1px solid var(--ink);
  border-radius: 3px;
  padding: 6px 8px 4px;
  font-weight: 700;
}
.now { margin-left: auto; gap: 12px; color: var(--ink-2); font-size: 13px; white-space: nowrap; }
#tlabel { display: inline-flex; align-items: baseline; gap: 12px; }
#t-rel { font-size: 24px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
#t-clock { font-size: 15px; font-variant-numeric: tabular-nums; }
#operator { margin-left: 14px; }

.exercise {
  background: var(--soon);
  color: var(--on-soon);
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 7px 8px 5px;
  flex-shrink: 0;
}

/* ---------- layout ---------- */
.layout { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 420px; min-height: 0; }
.mapcol { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.mapbox { position: relative; flex: 1; min-height: 320px; display: flex; }
#map { flex: 1; background: var(--map-land); }

.legend {
  position: absolute;
  left: 0;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  padding: 9px 16px 7px;
  background: var(--ground);
  border-top: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  font-size: 12px;
  color: var(--ink-2);
}
.legend span { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.sw { width: 16px; height: 10px; }
.sw.water-all { background: var(--water-all); }
.sw.water-fast { background: var(--water-fast); }
.ln { width: 18px; height: 0; border-top: 3px solid var(--road); }
.ln.closed { border-top-style: dashed; border-color: var(--act-ink); }
.ln.soon { border-color: var(--soon-ink); }
.ln.route { border-top-width: 5px; border-color: var(--way-ink); }

/* ---------- timeline ---------- */
.timebar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 32px 8px 24px;
  border-top: 1px solid var(--rule);
  flex-shrink: 0;
}
#play {
  width: 44px; height: 44px; flex-shrink: 0;
  border: 1px solid var(--ink);
  border-radius: 3px;
  background: var(--ink);
  cursor: pointer;
  position: relative;
}
#play::before {
  content: ""; position: absolute; left: 17px; top: 15px;
  border-left: 11px solid var(--ground); border-top: 7px solid transparent; border-bottom: 7px solid transparent;
}
#play.on::before { left: 15px; top: 15px; width: 4px; height: 14px; border: 0; border-left: 4px solid var(--ground); border-right: 4px solid var(--ground); }
.tl { flex: 1; position: relative; min-width: 0; }
.ticks { position: relative; height: 20px; }
.tick { position: absolute; bottom: -15px; width: 2px; height: 18px; background: var(--soon-ink); pointer-events: none; z-index: 1; }
.tick.closed { background: var(--act-ink); }
.tick span { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--ink-2); white-space: nowrap; }
#slider {
  -webkit-appearance: none; appearance: none;
  display: block; width: 100%; height: 12px; margin: 0;
  background: transparent; cursor: pointer;
  --p: 0%;
}
#slider::-webkit-slider-runnable-track {
  height: 4px;
  background: linear-gradient(to right, var(--river) var(--p), var(--rule) var(--p));
}
#slider::-moz-range-track { height: 4px; background: linear-gradient(to right, var(--river) var(--p), var(--rule) var(--p)); }
#slider::-webkit-slider-thumb { -webkit-appearance: none; width: 4px; height: 22px; margin-top: -9px; background: var(--ink); border: 0; border-radius: 0; }
#slider::-moz-range-thumb { width: 4px; height: 22px; background: var(--ink); border: 0; border-radius: 0; }
#slider:focus-visible { outline: 2px solid var(--soon); outline-offset: 6px; }
.axis { position: relative; height: 18px; margin-top: 6px; font-size: 11px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.axis span:first-child { transform: none; }
.axis span:last-child { transform: translateX(-100%); }
.attr { font-size: 11px; color: var(--ink-2); padding: 0 24px 6px; flex-shrink: 0; }

/* ---------- panel ---------- */
.panel { border-left: 1px solid var(--rule); overflow-y: auto; }
.sec { padding: 18px 24px 16px; border-bottom: 1px solid var(--rule); }
.sec:last-child { border-bottom: 0; }
.sec h2 { font-size: 15px; font-weight: 800; margin: 0 0 8px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.sec h2 span { font-size: 13px; font-weight: 400; color: var(--ink-2); }
.sec h2.big { font-size: 20px; margin-bottom: 2px; }
.sec p { margin: 0; }

.leave { display: flex; align-items: baseline; gap: 10px; margin-top: 10px !important; }
.leave b { font-size: 40px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--rule); }
.two span { display: block; font-size: 13px; color: var(--ink-2); }
.two b { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }

.total { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px !important; }
.total b { font-size: 32px; font-weight: 800; line-height: 1.1; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 700; font-size: 12px; padding: 6px 0 4px; border-bottom: 2px solid var(--ink); white-space: nowrap; }
th.num { text-align: right; padding-left: 12px; }
td { padding: 7px 0 5px; border-bottom: 1px solid var(--rule); }
td.num { padding-left: 12px; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--hover); }
tr.hot td:first-child { font-weight: 800; }
tr.hot td.lt { color: var(--act-ink); font-weight: 800; }
td.lt { color: var(--ink-2); }
tr.sel td { background: var(--hover); font-weight: 700; }
tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--ink); padding-left: 10px; }

table.zones th { border-bottom: 0; font-weight: 400; color: var(--ink-2); }
table.zones th:first-child { font-size: 15px; font-weight: 800; color: var(--ink); }
table.zones td { border-bottom: 0; padding: 5px 0 3px; }
.zsq { display: inline-block; width: 11px; height: 11px; margin-right: 10px; border: 1.5px solid var(--ink); }
.zone[data-zone="A"] .zsq { background: var(--act-ink); border-color: var(--act-ink); }
.zone[data-zone="C"] .zsq { background: var(--soon); border-color: var(--soon); }

.cap { border: 1px solid var(--rule); padding: 12px 14px 10px; }
.cap-text { font-size: 15px; line-height: 1.4; }
textarea.cap-text { width: 100%; min-height: 76px; resize: vertical; background: var(--ground); border: 1px solid var(--ink); padding: 8px; }
.cap .small { margin-top: 6px; }
.camf { font: 12px/1.6 var(--mono); color: var(--ink-2); margin: 10px 0 2px; word-spacing: 2px; }
details summary { display: inline; cursor: pointer; color: var(--ink); list-style: none; }
details summary::-webkit-details-marker { display: none; }
dl.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; margin: 8px 0 0; font-size: 13px; }
dl.kv dt { color: var(--ink-2); }
dl.kv dd { margin: 0; }
.row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; align-items: center; }

.btn {
  padding: 10px 16px 8px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  background: var(--ground);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.btn.primary { background: var(--ink); color: var(--ground); }
.btn:disabled { border-color: var(--rule); color: var(--ink-2); cursor: not-allowed; }
.btn:focus-visible, .mode:focus-visible, select:focus-visible { outline: 3px solid var(--soon); outline-offset: 2px; }

.report { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0 8px; border-top: 1px solid var(--rule); }
.report:first-of-type { border-top: 0; padding-top: 0; }
.report b { display: block; font-size: 15px; }
.report .done { font-size: 13px; font-weight: 700; color: var(--way-ink); max-width: 110px; text-align: right; }

.log { font: 12px/1.5 var(--mono); }
.log div { padding: 2px 0; }

/* ---------- map markers ---------- */
.nd { width: 11px; height: 11px; border-radius: 50%; background: var(--node-fill); border: 2px solid var(--ink); cursor: pointer; box-sizing: border-box; }
:root[data-theme="dark"] .nd { border-color: #121212; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .nd { border-color: #121212; } }
.nd.safe { border-radius: 0; width: 13px; height: 13px; background: var(--way-ink); border: 2px solid var(--route-casing); }
.nd.sel { border-radius: 0; width: 17px; height: 17px; background: var(--ink); border: 2.5px solid var(--route-casing); box-shadow: 0 0 0 1px var(--ink); }
.nd.zb { box-shadow: 0 0 0 9px transparent, 0 0 0 10px var(--ink); }
.maplbl.zone { font-size: 12px; font-weight: 800; }

.flag { width: 26px; height: 33px; cursor: default; }
.flag b {
  position: absolute; left: 0; top: 0;
  width: 26px; height: 26px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--way-ink);
  border: 2px solid var(--way-ink);
}
.flag i { position: absolute; left: 0; top: 0; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; font: 800 10px var(--font); color: var(--ground); font-style: normal; }
.flag.low b { background: var(--map-land); border-color: var(--act-ink); }
.flag.low i { color: var(--act-ink); font-size: 14px; }
.flag.medium b { background: var(--soon); border-color: var(--soon); }
.flag.rejected { opacity: 0.45; }
.rbtns { display: flex; flex-direction: column; gap: 6px; align-items: stretch; flex: none; }
.rbtns .done { font-size: 13px; font-weight: 700; }
.flag.confirmed b { box-shadow: 0 0 0 3px var(--route-casing), 0 0 0 5px var(--way-ink); }

.maplibregl-ctrl-attrib { background: none !important; color: var(--ink-2); font: 11px var(--font); }
.maplibregl-ctrl-attrib a { color: inherit; }

@media (max-width: 1000px) {
  body { height: auto; }
  .top { height: auto; flex-wrap: wrap; gap: 6px 20px; padding: 8px 16px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .mapbox { height: 60vh; flex: none; }
  .panel { border-left: 0; border-top: 1px solid var(--rule); }
  .legend { display: none; }
}

/* ---------- plan on real data ---------- */
.profile { gap: 0; }
.pf {
  background: var(--ground);
  border: 1px solid var(--ink);
  padding: 7px 12px 5px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.pf + .pf { border-left: 0; }
.pf:first-child { border-radius: 3px 0 0 3px; }
.pf:last-child { border-radius: 0 3px 3px 0; }
.pf.on { background: var(--ink); color: var(--ground); }
.maphint {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%);
  padding: 8px 14px 6px;
  background: var(--ink); color: var(--ground);
  font-size: 14px; font-weight: 700;
  pointer-events: none;
  white-space: nowrap;
}
.sw.river { background: var(--river); }
.sw.safe { background: color-mix(in srgb, var(--way-ink) 22%, var(--map-land)); }
.ticks { height: 20px; }
.tickcap { position: absolute; left: 0; bottom: 6px; font-size: 11px; color: var(--ink-2); white-space: nowrap; }
.tick { bottom: -15px; }
.maplbl.place { font-size: 14px; font-weight: 700; letter-spacing: 0.01em; }
.maplbl.place.strong { font-weight: 800; }
.zone[data-zone="B1"] .zsq { background: transparent; border-color: var(--ink); }
.zone[data-zone="B2"] .zsq { background: var(--ink); border-color: var(--ink); }
#street-via { margin-top: 8px; }
.report + .two { margin-top: 4px; }
.maplibregl-ctrl-group { border-radius: 3px; box-shadow: 0 0 0 1px var(--ink); }
.axis span:last-child { transform: translateX(-50%); }
td.num, th.num { white-space: nowrap; }
.sw.safe { background: color-mix(in srgb, var(--way-ink) 14%, var(--map-land)); }
#cases { max-width: 270px; font-weight: 600; font-size: 13px; }

/* ---------- roads by closing time, map marks, legend ---------- */
.ln.later { border-color: var(--road-later); }
.ln.never { border-color: var(--road-never); }
.sw.water-fresh { background: var(--water-ink); }
.ol { width: 16px; height: 10px; border-radius: 50%; border: 2px solid var(--ink); }
.ol.main { border-width: 1.5px; border-style: dashed; background: color-mix(in srgb, var(--ink) 6%, transparent); }
.ol.evac { border-color: var(--soon); border-width: 2.5px; }
.lg-alert, .lg-evac, .lg-zone { display: none !important; }
body[data-alert-area="main"] .lg-alert,
body[data-alert-area="evac"] .lg-alert,
body[data-alert-area="evac"] .lg-evac,
body[data-zones="1"] .lg-zone { display: inline-flex !important; }
/* zone fills as on the map, edged in the colour of the Zones table chips */
.sw.zone-a { background: color-mix(in srgb, var(--act-ink) 12%, var(--map-land)); border: 1.5px solid var(--act-ink); }
.sw.zone-c { background: color-mix(in srgb, var(--soon) 14%, var(--map-land)); border: 1.5px solid var(--soon); }
/* map labels: a light halo, so they read over roads and the route */
.maplbl:not(.water) { text-shadow: 0 0 2px var(--route-casing), 0 0 2px var(--route-casing), 0 0 3px var(--route-casing), 0 0 4px var(--route-casing), 0 0 5px var(--route-casing); }
#case-title { margin-bottom: 4px; }
#street-cut { margin-top: 6px; }
/* high ground: a diamond, rotated inside the marker element */
.hgw { width: 14px; height: 14px; display: flex; align-items: center; justify-content: center; cursor: default; }
.hg { width: 9px; height: 9px; background: var(--ink); border: 1.5px solid var(--route-casing); transform: rotate(45deg); box-sizing: content-box; }
.hg.big { width: 12px; height: 12px; border-width: 2px; }
.dm { width: 8px; height: 8px; margin: 0 4px; background: var(--ink); transform: rotate(45deg); }
/* selected point: a ring, unlike the high-ground diamonds and the green square of the way out */
.nd.sel { border-radius: 50%; width: 20px; height: 20px; background: var(--node-fill); border: 5px solid var(--ink); box-shadow: 0 0 0 2px var(--route-casing); }
.nw { white-space: nowrap; }
.two b .nw { display: inline; font-size: inherit; color: inherit; }
#street-flood-note { margin-top: 8px; }
.pf { white-space: nowrap; }

@media (max-width: 1366px) {
  .top { gap: 16px; }
  #tcaption { display: none; }
}
/* long column names wrap instead of squeezing the names */
th.wrap { white-space: normal; min-width: 8.5em; max-width: 10em; vertical-align: bottom; line-height: 1.25; }
th { vertical-align: bottom; }

/* ---------- map in the look of the routing module, operator areas ---------- */
.sw.water-all { background: #1e6ebe; }
.sw.water-fresh { background: #1ebeff; }
.sw.safe { background: rgba(40, 150, 80, 0.4); }
.ln.closed { border-top-style: solid; border-color: #3a3f46; opacity: 0.6; }
.ln.route { border-color: #111111; }
.lg-roads { gap: 4px 14px !important; flex-wrap: wrap; }
.lg-roads span { gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #8e44ad; box-shadow: 0 0 0 1.5px #fff, 0 0 0 2.5px #8e44ad; margin: 0 3px; }
.ol.evac { border-color: #0b7a3b; border-width: 2.5px; background: rgba(11, 122, 59, 0.1); }
.ol.blocked { border: 2px dashed #c0392b; background: rgba(192, 57, 43, 0.16); }
.lg-op { display: none !important; }
body:not([data-areas="0"]) .lg-op { display: inline-flex !important; }
.nd.safe { background: #111111; border-radius: 50%; }
.nd.refuge { width: 14px; height: 14px; border-radius: 50%; background: #8e44ad; border: 2.5px solid #ffffff; }
.maplbl.area { font-size: 12px; font-weight: 800; pointer-events: none; }
.maplbl.area.evac, .maplbl.area.safe { color: #0b5c2e; }
.maplbl.area.blocked { color: #a12a1e; }
.maplbl.area.unsafe { color: #3a3f46; }
body[data-arming]:not([data-arming=""]) .maphint { background: #0b7a3b; }
body[data-arming="blocked"] .maphint, body[data-arming="unsafe"] .maphint { background: #a12a1e; }

.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.btn.tool { text-align: left; padding-left: 10px; border-left-width: 5px; }
.btn.tool.evac, .btn.tool.safe { border-left-color: #0b7a3b; }
.btn.tool.blocked { border-left-color: #c0392b; }
.btn.tool.unsafe { border-left-color: #3a3f46; }
.btn.tool.on { background: var(--ink); color: var(--ground); }
.row.radius { justify-content: space-between; align-items: center; margin-top: 10px; }
.row.radius input, .arad input { width: 5.2em; font: inherit; padding: 4px 6px 2px; border: 1px solid var(--rule); border-radius: 3px; text-align: right; }
.armed { margin-top: 8px; font-weight: 700; }
#area-list { margin-top: 12px; }
.area { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--rule); cursor: pointer; }
.area .asw { flex: none; width: 14px; height: 14px; margin-top: 7px; border-radius: 50%; border: 3px solid #0b7a3b; }
.area.blocked .asw { border: 2px dashed #c0392b; background: rgba(192, 57, 43, 0.16); }
.area.safe .asw { background: rgba(40, 150, 80, 0.4); border-width: 1.5px; }
.area.unsafe .asw { border: 2px dashed #3a3f46; }
.abody { flex: 1; min-width: 0; }
.aline { display: flex; gap: 8px; align-items: center; }
.aname { flex: 1; min-width: 0; font: inherit; font-weight: 700; padding: 4px 6px 2px; border: 1px solid transparent; border-radius: 3px; background: transparent; color: inherit; }
.aname:hover, .aname:focus { border-color: var(--rule); background: var(--ground); }
.arad { white-space: nowrap; font-size: 13px; color: var(--ink-2); }
.btn.x { padding: 4px 8px 2px; font-size: 12px; }
.abody p { margin-top: 3px; }
