/* ACE Basin war room — dark "tidewater" theme built on the OLT palette (PMS 574 green, Warm Grey 3C, PMS 5415 blue).
   Numbers are always set in the body face with lining, tabular figures (never Apolline or old-style numerals). */
:root {
  --bg: #121c1a;
  --panel: rgba(21, 33, 31, .93);
  --panel-solid: #172421;
  --raise: #1f302c;
  --line: rgba(189, 180, 170, .2);
  --text: #ebe6de;
  --muted: #b3ab9f;
  --green: #55732f;
  --green-l: #9dbd6b;
  --blue: #5f7f93;
  --blue-l: #8fb0c4;
  --amber: #e8b04b;
  --danger: #e07a62;
  --stats-w: clamp(23rem, 29vw, 35rem);
  --rail-w: 5.6rem;
  --body: Calibri, Carlito, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --display: Apolline, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
html { font-size: 16px; }
html.room { font-size: 20px; }
@media (min-width: 2400px) { html.room { font-size: 26px; } }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); }
body { font-family: var(--body); font-variant-numeric: lining-nums tabular-nums; font-feature-settings: "lnum" 1, "tnum" 1; overflow: hidden; -webkit-font-smoothing: antialiased; }
.num { font-family: var(--body); font-variant-numeric: lining-nums tabular-nums; font-feature-settings: "lnum" 1, "tnum" 1; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1, h2 { font-family: var(--display); }
h3 { font-family: var(--body); font-size: .95rem; color: var(--muted); font-weight: 600; margin-bottom: .55rem; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--blue-l); outline-offset: 2px; }
.small { font-size: .78rem; color: var(--muted); line-height: 1.35; margin: .5rem 0 0; }

#map { position: fixed; inset: 0; }
.maplibregl-ctrl-attrib { font-size: .62rem !important; background: rgba(18, 28, 26, .7) !important; color: var(--muted) !important; }
.maplibregl-ctrl-attrib a { color: var(--muted) !important; }
.maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { display: none; }
.maplibregl-popup-content { background: var(--panel-solid); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: .8rem 1rem; font-family: var(--body); min-width: 13rem; }
.maplibregl-popup-tip { display: none; }
.maplibregl-popup-close-button { color: var(--muted); font-size: 1.2rem; padding: .2rem .5rem; }
.popup h4 { margin: 0 0 .25rem; font-family: var(--display); font-size: 1.05rem; }
.popup dl { margin: .4rem 0 0; display: grid; grid-template-columns: auto 1fr; gap: .15rem .8rem; font-size: .85rem; }
.popup dt { color: var(--muted); }
.popup dd { margin: 0; }

/* Title */
#titlebar { position: fixed; top: 1rem; left: 1rem; display: flex; align-items: center; gap: .8rem; padding: .55rem 1.1rem .55rem .7rem; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; z-index: 5; }
.mark { width: 2.6rem; height: 2.6rem; flex: none; }
.titles h1 { font-size: 1.35rem; line-height: 1.1; }
.titles p { margin: .1rem 0 0; font-size: .85rem; color: var(--muted); }

/* Rail */
#rail { position: fixed; left: 1rem; top: 5.6rem; bottom: 1rem; width: var(--rail-w); display: flex; flex-direction: column; gap: .45rem; z-index: 5; overflow-y: auto; scrollbar-width: none; }
#rail::-webkit-scrollbar { display: none; }
.rail-btn { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; min-height: 3.5rem; padding: .4rem .2rem; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; font-size: .78rem; color: var(--text); }
.rail-btn svg { width: 1.45rem; height: 1.45rem; fill: currentColor; }
.rail-btn:hover { background: var(--raise); }
.rail-btn[aria-expanded="true"], .rail-btn[aria-pressed="true"] { background: var(--green); border-color: var(--green-l); }
.rail-btn.small { min-height: 2.9rem; }
.rail-btn .big { font-size: 1.6rem; line-height: 1; }
.rail-gap { flex: 1 1 .2rem; min-height: .2rem; }
#pendingDot { position: absolute; top: .35rem; right: .45rem; width: .7rem; height: .7rem; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 3px rgba(232, 176, 75, .3); }
@media (prefers-reduced-motion: no-preference) { #pendingDot { animation: pulse 1.8s ease-in-out infinite; } }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(232, 176, 75, 0); } }

/* Sheet */
.sheet { position: fixed; left: calc(var(--rail-w) + 1.6rem); top: 5.6rem; width: 25rem; max-width: calc(100vw - var(--rail-w) - var(--stats-w) - 3.6rem); max-height: calc(100vh - 12rem); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; z-index: 6; }
.sheet[hidden] { display: none; }
.sheet > header { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; padding: .8rem 1rem; background: var(--panel-solid); border-bottom: 1px solid var(--line); z-index: 1; }
.sheet h2 { font-size: 1.2rem; }
#sheetClose { width: 2.4rem; height: 2.4rem; border-radius: 50%; border: 1px solid var(--line); background: transparent; font-size: 1.4rem; line-height: 1; }
#sheetBody { padding: .4rem 1rem 1.1rem; }
.sec { padding: .85rem 0; border-bottom: 1px solid var(--line); }
.sec:last-child { border-bottom: 0; }
.sec h3 { margin-bottom: .6rem; }
.seg { display: flex; flex-wrap: wrap; gap: .3rem; }
.seg button { flex: 1 1 auto; min-height: 2.5rem; padding: .35rem .75rem; border-radius: 999px; border: 1px solid var(--line); background: transparent; font-size: .88rem; white-space: nowrap; }
.seg button.on { background: var(--green); border-color: var(--green-l); color: #fff; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: .8rem; width: 100%; min-height: 2.8rem; padding: .3rem .1rem; background: none; border: 0; text-align: left; }
.toggle .sw { flex: none; width: 2.7rem; height: 1.5rem; border-radius: 999px; background: #3a4a46; position: relative; transition: background .15s; }
.toggle .sw::after { content: ""; position: absolute; top: .18rem; left: .2rem; width: 1.14rem; height: 1.14rem; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle[aria-checked="true"] .sw { background: var(--green); }
.toggle[aria-checked="true"] .sw::after { transform: translateX(1.15rem); }
.toggle[disabled] { opacity: .45; cursor: not-allowed; }
.btn { min-height: 2.7rem; padding: .4rem 1rem; border-radius: 999px; border: 1px solid var(--line); background: var(--raise); }
.btn.primary, button.primary { background: var(--green); border-color: var(--green-l); color: #fff; }
.btn.warn { border-color: var(--danger); color: var(--danger); background: transparent; }
.btn:hover { filter: brightness(1.12); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.field { display: grid; gap: .25rem; margin: .5rem 0; font-size: .88rem; color: var(--muted); }
.field input, .field select { min-height: 2.6rem; padding: .35rem .7rem; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
.swatch { display: inline-block; width: .9rem; height: .9rem; border-radius: 3px; margin-right: .5rem; vertical-align: -.1rem; border: 1px solid rgba(255,255,255,.25); }
.lay { display: grid; grid-template-columns: auto 1fr auto; gap: .6rem; align-items: center; padding: .55rem 0; border-top: 1px solid var(--line); }
.lay:first-of-type { border-top: 0; }
.lay .meta { font-size: .78rem; color: var(--muted); }
.qr { display: block; margin: .6rem auto; background: #fff; padding: .6rem; border-radius: 8px; max-width: 100%; }
.url { word-break: break-all; font-size: .8rem; color: var(--blue-l); text-align: center; }
.fact { padding: .6rem 0; border-top: 1px solid var(--line); }
.fact:first-of-type { border-top: 0; }
.fact b { font-weight: 700; }
.fact .src { display: block; margin-top: .25rem; font-size: .78rem; color: var(--muted); }
table.chk { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.chk th, table.chk td { text-align: right; padding: .3rem .3rem; border-bottom: 1px solid var(--line); }
table.chk th:first-child, table.chk td:first-child { text-align: left; }
.good { color: var(--green-l); }
.bad { color: var(--danger); }

/* Legend + time + footer */
.legend { position: fixed; left: calc(var(--rail-w) + 1.6rem); bottom: 6.6rem; max-width: 17rem; padding: .7rem .9rem; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; z-index: 4; font-size: .82rem; }
.legend h4 { margin: 0 0 .4rem; font-size: .82rem; color: var(--muted); font-weight: 600; }
.legend div { display: flex; align-items: center; min-height: 1.3rem; }
.timebar { position: fixed; left: calc(var(--rail-w) + 1.6rem); right: calc(var(--stats-w) + 2rem); bottom: 2rem; display: flex; align-items: center; gap: 1rem; padding: .6rem 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; z-index: 4; max-width: 44rem; }
.timebar button { min-width: 4.6rem; min-height: 2.8rem; border-radius: 999px; border: 1px solid var(--green-l); background: var(--green); color: #fff; font-weight: 600; }
.slider { flex: 1; display: grid; gap: .15rem; }
.slider label { font-size: .85rem; color: var(--muted); }
input[type=range] { width: 100%; accent-color: var(--green-l); height: 1.8rem; }
.footchip { position: fixed; left: calc(var(--rail-w) + 1.6rem); bottom: .55rem; right: calc(var(--stats-w) + 2rem); margin: 0; font-size: .68rem; color: var(--muted); text-shadow: 0 0 4px #000, 0 0 8px #000; z-index: 4; line-height: 1.2; }

.loading { position: fixed; left: 50%; top: 42%; transform: translateX(-50%); min-width: 20rem; max-width: 30rem; padding: 1rem 1.3rem; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 10px; z-index: 9; text-align: center; }
.loading[hidden], .drawbar[hidden], .drophint[hidden], .legend[hidden] { display: none; }
.loading .prog { height: .5rem; border-radius: 99px; background: #2b3c38; overflow: hidden; margin-top: .6rem; }
.loading .prog i { display: block; height: 100%; width: 0; background: var(--green-l); transition: width .2s; }
.loading .row { justify-content: center; margin-top: .7rem; }
.drawbar { position: fixed; left: 50%; bottom: 8.5rem; transform: translateX(-50%); display: flex; gap: .6rem; align-items: center; padding: .6rem .8rem .6rem 1.1rem; background: var(--panel-solid); border: 1px solid var(--green-l); border-radius: 999px; z-index: 8; }
.drawbar button { min-height: 2.6rem; padding: 0 1.1rem; border-radius: 999px; border: 1px solid var(--line); background: var(--raise); }
.drophint { position: fixed; inset: 1rem; display: grid; place-items: center; border: 3px dashed var(--green-l); border-radius: 14px; background: rgba(18, 28, 26, .82); font-family: var(--display); font-size: 1.6rem; z-index: 20; text-align: center; padding: 2rem; pointer-events: none; }

/* Stats */
#stats { position: fixed; top: 1rem; right: 1rem; bottom: 1rem; width: var(--stats-w); overflow-y: auto; padding: 1.1rem 1.2rem 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; z-index: 5; }
.area-head h2 { font-size: 1.55rem; line-height: 1.15; margin-bottom: .7rem; }
.radius { display: grid; grid-template-columns: auto 1fr auto; gap: .6rem; align-items: center; margin-top: .6rem; font-size: .88rem; color: var(--muted); }
.hero { margin: 1.1rem 0 .4rem; padding: 1rem 0 1.1rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); transition: opacity .2s; }
.hero.busy { opacity: .55; }
.hero-num { font-size: 4.1rem; font-weight: 700; line-height: 1; letter-spacing: -.01em; color: #fff; }
.hero-label { margin-top: .35rem; color: var(--muted); font-size: 1rem; }
.share { height: .65rem; border-radius: 99px; background: #2b3c38; margin-top: .9rem; overflow: hidden; }
.share i, #shareBar { display: block; height: 100%; width: 0; background: var(--green-l); border-radius: 99px; transition: width .35s; }
.share-text { margin-top: .4rem; font-size: .9rem; color: var(--text); }
.block { padding: .95rem 0 .3rem; }
.fp { display: grid; grid-template-columns: 4.2rem 1fr 5.6rem; gap: .6rem; align-items: center; margin: .45rem 0; font-size: .95rem; }
.fp-bar { height: .8rem; border-radius: 99px; background: #2b3c38; overflow: hidden; }
.fp-bar i { display: block; height: 100%; width: 0; border-radius: 99px; transition: width .35s; }
.fp-bar i.ce { background: var(--blue-l); }
.fp-bar i.fee { background: var(--green-l); }
.fp-val { text-align: right; font-weight: 600; }
.bars .b { display: grid; grid-template-columns: minmax(0, 11rem) 1fr 5.2rem; gap: .6rem; align-items: center; margin: .42rem 0; font-size: .88rem; }
.bars .b span.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .b .track { height: .7rem; border-radius: 99px; background: #2b3c38; overflow: hidden; }
.bars .b .track i { display: block; height: 100%; border-radius: 99px; transition: width .35s; }
.bars .b .v { text-align: right; font-weight: 600; }
.yearchart { display: grid; grid-template-columns: repeat(9, 1fr); gap: .3rem; align-items: end; height: 7rem; padding-top: .3rem; }
.yearchart .col { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: .3rem; justify-items: center; }
.yearchart .bar { align-self: end; width: 100%; min-height: 2px; border-radius: 4px 4px 0 0; background: var(--blue-l); transition: height .35s, opacity .2s; }
.yearchart .col.dim .bar { opacity: .25; }
.yearchart .lab { font-size: .6rem; color: var(--muted); text-align: center; line-height: 1.1; }
.ucard { margin: .6rem 0 1rem; padding: .8rem .9rem; background: var(--raise); border-radius: 8px; border-left: 4px solid var(--amber); }
.ucard h4 { margin: 0; font-size: 1.02rem; font-family: var(--display); }
.ucard .meta { font-size: .78rem; color: var(--muted); margin-bottom: .5rem; }
.ucard .big { font-size: 1.7rem; font-weight: 700; }
.ucard table { width: 100%; border-collapse: collapse; margin-top: .6rem; font-size: .8rem; }
.ucard td { padding: .25rem .2rem; border-top: 1px solid var(--line); }
.ucard td.r { text-align: right; white-space: nowrap; }
.note { margin-top: 1rem; }
.stats-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin: .9rem 0 .2rem; }
.stats-actions button { flex: 1; min-height: 2.6rem; border-radius: 999px; border: 1px solid var(--line); background: var(--raise); }

.toasts { position: fixed; top: 1rem; left: 50%; transform: translateX(-50%); display: grid; gap: .5rem; z-index: 30; width: min(28rem, 92vw); }
.toast { display: flex; gap: .8rem; align-items: center; justify-content: space-between; padding: .7rem 1rem; background: var(--panel-solid); border: 1px solid var(--green-l); border-radius: 10px; font-size: .92rem; }
.toast.err { border-color: var(--danger); }
.toast button { min-height: 2.3rem; padding: 0 .9rem; border-radius: 999px; border: 1px solid var(--line); background: var(--raise); white-space: nowrap; }

.lbl { color: #fff; font: 600 .78rem var(--body); text-shadow: 0 0 3px #000, 0 0 6px #000; pointer-events: none; white-space: nowrap; letter-spacing: .02em; }
.lbl.focus { font: 600 1.05rem var(--display); color: var(--green-l); letter-spacing: .03em; }

@media (max-width: 900px) {
  html { font-size: 15px; }
  #rail { top: auto; bottom: auto; left: 0; right: 0; flex-direction: row; top: 4.9rem; padding: 0 .6rem; width: auto; overflow-x: auto; }
  .rail-btn { min-width: 4.4rem; }
  .rail-gap { display: none; }
  #stats { top: auto; left: .6rem; right: .6rem; bottom: .6rem; width: auto; max-height: 46vh; }
  .sheet { left: .6rem; right: .6rem; width: auto; max-width: none; top: 8.4rem; }
  .timebar, .footchip, .legend { display: none; }
  #titlebar { left: .6rem; top: .6rem; }
  .hero-num { font-size: 2.8rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

body.public .rail-btn[data-panel="meeting"], body.public #legend { display: none; }
canvas.qr { image-rendering: pixelated; width: min(100%, 16rem); height: auto; }
