/* demo.drovr.ai: one working column; a play reads as a sentence first, its facts as a ledger under it.
   Every color is a token; dark follows the system unless the viewer picks a theme. */
:root {
  --bg: #f3f4f6; --panel: #ffffff; --ink: #161b26; --dim: #566074; --faint: #8a93a4; --line: #d9dde5;
  --accent: #1f3a8a; --accent-soft: #e6ebf8; --new: #9a5b00; --new-soft: #fbf0d9; --closed: #2c6b4a; --closed-soft: #e3f1e9;
  --warn: #8a3a2a; --warn-soft: #f7e6e1; --tag: #6b4fa0; --tag-soft: #eee8f8;
  --land: #fbfbfc; --county: #d5dae3; --state: #6b7486; --t1: #d6def5; --t2: #9fb2e8; --t3: #5673cf; --t4: #1f3a8a; --call: #b4530a;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #14171e; --panel: #1c212b; --ink: #e7eaf0; --dim: #a3acbd; --faint: #737d90; --line: #2f3644;
    --accent: #9db4ff; --accent-soft: #232c47; --new: #f0b657; --new-soft: #3a2d14; --closed: #7fcfa3; --closed-soft: #17301f;
    --warn: #f0a090; --warn-soft: #3a1f1a; --tag: #c3adf2; --tag-soft: #2b2440; color-scheme: dark;
    --land: #191d26; --county: #313949; --state: #8a94a8; --t1: #27324f; --t2: #3b4f86; --t3: #5f7fd6; --t4: #9db4ff; --call: #ffb066;
  }
}
:root[data-theme='dark'] {
  --bg: #14171e; --panel: #1c212b; --ink: #e7eaf0; --dim: #a3acbd; --faint: #737d90; --line: #2f3644;
  --accent: #9db4ff; --accent-soft: #232c47; --new: #f0b657; --new-soft: #3a2d14; --closed: #7fcfa3; --closed-soft: #17301f;
  --warn: #f0a090; --warn-soft: #3a1f1a; --tag: #c3adf2; --tag-soft: #2b2440; color-scheme: dark;
  --land: #191d26; --county: #313949; --state: #8a94a8; --t1: #27324f; --t2: #3b4f86; --t3: #5f7fd6; --t4: #9db4ff; --call: #ffb066;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.5; padding: 0 16px 48px; }
.wrap { max-width: 1000px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
a { color: var(--accent); }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.top { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; padding-top: 14px; }
.brand { font-family: var(--mono); font-weight: 600; font-size: 17px; text-decoration: none; color: var(--ink); }
nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
nav a { border: 1px solid transparent; border-radius: 5px; padding: 6px 10px; font-family: var(--mono); font-size: 13px; color: var(--dim); text-decoration: none; }
nav a[aria-current='true'] { background: var(--panel); border-color: var(--line); color: var(--ink); }
.ghost { background: none; border: 1px solid var(--line); border-radius: 5px; padding: 5px 9px; font-family: var(--mono); font-size: 12px; color: var(--dim); cursor: pointer; }
main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
h1 { font-family: var(--mono); font-weight: 600; font-size: clamp(21px, 4.2vw, 28px); line-height: 1.15; margin: 0; letter-spacing: -0.02em; text-wrap: balance; }
h2 { font-family: var(--mono); font-weight: 600; font-size: 15px; margin: 0; }
h3 { font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: 0.08em; color: var(--faint); margin: 0; border-bottom: 1px solid var(--line); padding-bottom: 4px; text-transform: uppercase; }
.kick { font-family: var(--mono); font-size: 12px; color: var(--faint); letter-spacing: 0.04em; }
.meta { font-family: var(--mono); font-size: 12.5px; color: var(--dim); margin: 7px 0 0; letter-spacing: 0.01em; }
.hint { font-family: var(--mono); font-size: 11.5px; color: var(--faint); }
.note { font-size: 13px; color: var(--dim); max-width: 72ch; margin: 0; }
.tagnote { font-family: var(--mono); font-size: 10.5px; color: var(--tag); background: var(--tag-soft); padding: 1px 6px; border-radius: 3px; letter-spacing: 0.03em; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--panel); }
.seg button { background: none; border: 0; padding: 6px 12px; font-family: var(--mono); font-size: 12.5px; color: var(--dim); cursor: pointer; }
.seg button[aria-pressed='true'] { background: var(--accent); color: var(--panel); }
.filters { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.filters label { font-family: var(--mono); font-size: 12px; color: var(--faint); display: flex; gap: 6px; align-items: center; min-width: 0; max-width: 100%; }
.filters select { max-width: 200px; min-width: 0; }
.filters input[type='search'] { width: 46ch; max-width: 100%; min-width: 0; }
select, input[type='search'] { background: var(--panel); border: 1px solid var(--line); border-radius: 5px; padding: 5px 8px; font-family: var(--mono); font-size: 12.5px; max-width: 100%; }
.g { font-family: var(--mono); margin-right: 5px; }
.g-stated { color: var(--accent); } .g-inferred { color: var(--new); } .g-none { color: var(--faint); }
.legend { font-family: var(--mono); font-size: 12px; color: var(--dim); display: flex; flex-wrap: wrap; gap: 4px 16px; }

/* the call plan */
.plan { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px 18px 16px; }
.pl { border-top: 1px solid var(--line); padding: 12px 0; display: flex; flex-direction: column; gap: 5px; }
.pl:first-of-type { border-top: 0; }
.plh { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.plh a { font-weight: 600; }
.tagline { font-family: var(--mono); font-size: 11.5px; color: var(--faint); }
.pline { margin: 0; font-size: 16px; max-width: 64ch; }
.plan .pl { cursor: pointer; }
.pl.on { box-shadow: inset 3px 0 0 var(--call); padding-left: 12px; }
.fold { border-top: 1px solid var(--line); padding: 10px 0 0; }
.fold summary { font-family: var(--mono); font-size: 12.5px; color: var(--dim); cursor: pointer; }
.fold[open] summary { margin-bottom: 8px; }
.counts { display: flex; flex-wrap: wrap; gap: 8px 22px; font-family: var(--mono); font-size: 13px; color: var(--dim); font-variant-numeric: tabular-nums; }
.counts b { color: var(--ink); font-size: 20px; font-weight: 600; margin-right: 6px; }
/* the Equipment count strip: each part filters the unit list (EQUIPMENT PAGE PLAN) */
.strip button, .strip a { font: inherit; color: inherit; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; text-decoration: none; }
.strip span { padding: 6px 0; }
.strip button[aria-pressed='true'] { border-color: var(--ink); background: var(--panel); }
.note.foot { font-size: 11.5px; }

/* the brief */
.brief { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; }
.bhead { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; justify-content: space-between; }
.bname { font-family: var(--mono); font-weight: 600; font-size: 20px; letter-spacing: -0.01em; }
.bmeta { font-family: var(--mono); font-size: 12.5px; color: var(--dim); }
.bsec { display: flex; flex-direction: column; gap: 7px; }
.bline { font-size: 16px; margin: 0; max-width: 66ch; }
.kv { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; font-size: 13.5px; margin: 0; }
.kv dt { font-family: var(--mono); font-size: 12px; color: var(--faint); white-space: nowrap; }
.kv dd { margin: 0; min-width: 0; }
.kv .rec { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.nolink { color: var(--faint); }
.factline .rec { font-family: var(--mono); font-size: 12px; }
.plain { margin: 0; font-size: 14px; }
.factline { font-size: 17px; margin: 0; border-left: 3px solid var(--accent); padding-left: 12px; }
.flagline { font-family: var(--mono); font-size: 12.5px; color: var(--warn); background: var(--warn-soft); border-radius: 5px; padding: 5px 9px; }
/* the brief's aerial: the whole frame (2:1), so the scale bar measures true against the frame's width in metres */
.aerial { position: relative; margin: 0; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--panel); }
.aerial img { display: block; width: 100%; height: auto; aspect-ratio: 2 / 1; object-fit: cover; }
.aerial .credit { position: absolute; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.62); color: #fff; font-family: var(--mono); font-size: 11px; padding: 3px 8px; border-top-left-radius: 6px; }
.aerial .scale { position: absolute; left: 10px; bottom: 8px; white-space: nowrap; color: #fff; font-family: var(--mono); font-size: 11px; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); }
.aerial .scale i { display: block; height: 3px; background: #fff; margin-bottom: 3px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
@media (max-width: 560px) {
  /* a phone puts the credit in a strip under the image, so it never covers the scale bar */
  .aerial .credit { position: static; display: block; border-radius: 0; font-size: 10px; }
}
.aerial .frame { position: relative; }

/* tables */
.tbl { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 12px; border-top: 1px solid var(--line); vertical-align: top; }
thead th { border-top: 0; font-family: var(--mono); font-size: 11.5px; font-weight: 500; color: var(--faint); letter-spacing: 0.04em; white-space: nowrap; }
td.n, th.n { font-variant-numeric: tabular-nums; font-family: var(--mono); white-space: nowrap; text-align: right; }
.pill { font-family: var(--mono); font-size: 11.5px; padding: 1px 6px; border-radius: 3px; white-space: nowrap; background: var(--accent-soft); color: var(--accent); }
.pill.mine { background: var(--closed-soft); color: var(--closed); }
.bar { height: 9px; background: var(--accent); border-radius: 2px; }
.lock { font-family: var(--mono); font-size: 12.5px; color: var(--dim); border: 1px dashed var(--line); border-radius: 6px; padding: 10px 12px; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.slots label { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; font-family: var(--mono); font-size: 12px; color: var(--faint); min-width: 0; }
.slots select { width: 100%; }
/* the maps (src/maps.js): the map, then what the selected thing says; they stack on a phone */
.mapwrap { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.stage { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.stage.under { grid-template-columns: minmax(0, 1fr); }
.mapbox { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; min-width: 0; }
.mapbox svg { display: block; width: 100%; height: auto; touch-action: manipulation; }
/* a row above the map, so the buttons never cover a county */
.zoombar { display: flex; justify-content: flex-end; gap: 6px; padding: 6px 8px 0; }
.zoombar button { min-width: 34px; min-height: 34px; padding: 4px 10px; font-family: var(--mono); font-size: 16px; line-height: 1; background: var(--panel); }
.side { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pname { font-family: var(--mono); font-weight: 600; font-size: 15px; line-height: 1.25; overflow-wrap: anywhere; }
.pmeta { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.pfact { margin: 0; }
.mlist { display: flex; flex-direction: column; max-height: 330px; overflow: auto; }
.mlist button, .mlist .mrow { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; background: none; border: 0; border-top: 1px solid var(--line); padding: 6px 0; text-align: left; font-size: 13.5px; }
.mlist button { cursor: pointer; }
.mlist > :first-child { border-top: 0; }
.mlist b { font-weight: 500; overflow-wrap: anywhere; }
.mlist span { font-family: var(--mono); font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.maplegend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-family: var(--mono); font-size: 12px; color: var(--dim); align-items: center; }
.maplegend i { display: inline-block; margin-right: 6px; vertical-align: -1px; }
.sw { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid var(--accent); }
.sw.fill { background: var(--accent); }
.sw.none { border-color: var(--faint); }
.sw.call { background: var(--call); border-color: var(--call); }
.sq { width: 14px; height: 11px; border: 1px solid var(--county); }
.sq.c1 { background: var(--t1); } .sq.c2 { background: var(--t2); } .sq.c3 { background: var(--t3); } .sq.c4 { background: var(--t4); }
.cty { stroke: var(--county); stroke-width: 0.7; vector-effect: non-scaling-stroke; }
.cty.hit { cursor: pointer; }
.cty.selc { fill: none; stroke: var(--accent); stroke-width: 2; }
.c0 { fill: var(--land); } .c1 { fill: var(--t1); } .c2 { fill: var(--t2); } .c3 { fill: var(--t3); } .c4 { fill: var(--t4); }
.stl { fill: none; stroke: var(--state); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.stlab { font-family: var(--mono); font-weight: 600; fill: var(--dim); letter-spacing: 0.22em; text-anchor: middle; pointer-events: none; paint-order: stroke; stroke: var(--panel); stroke-linejoin: round; }
.dot { fill: var(--accent); stroke: var(--accent); stroke-width: 1.2; vector-effect: non-scaling-stroke; cursor: pointer; }
.dot.none { fill: var(--panel); stroke: var(--faint); stroke-width: 1; }
.dot.sel { stroke: var(--call); stroke-width: 3; }
.lab { font-family: var(--sans); fill: var(--ink); paint-order: stroke; stroke: var(--panel); stroke-linejoin: round; pointer-events: none; }
.cnt { font-family: var(--mono); font-weight: 600; text-anchor: middle; pointer-events: none; fill: var(--ink); }
.cnt.inv { fill: var(--panel); }
.callpin { fill: var(--call); stroke: var(--panel); stroke-width: 1.5; vector-effect: non-scaling-stroke; cursor: pointer; }
.callpin.sel { stroke: var(--ink); stroke-width: 2.5; }
.callnum { font-family: var(--mono); font-weight: 600; fill: var(--panel); text-anchor: middle; pointer-events: none; }
.ring { fill: none; stroke: var(--call); stroke-width: 1.2; vector-effect: non-scaling-stroke; stroke-dasharray: 5 4; }
.ringlab { font-family: var(--mono); fill: var(--call); text-anchor: middle; }
.dot.still { cursor: default; }
.cty.np { fill: url(#notplaced); }
.np-bg { fill: var(--land); }
.np-line { stroke: var(--county); stroke-width: 2; }
.sq.np { background: repeating-linear-gradient(45deg, var(--land) 0 3px, var(--county) 3px 5px); }
.dot:focus-visible, .cty.hit:focus-visible, .callpin:focus-visible { outline: none; stroke: var(--call); stroke-width: 3; }
@media (max-width: 760px) { .stage { grid-template-columns: 1fr; } }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; max-height: 420px; overflow: auto; }
.checks label { font-size: 13.5px; display: flex; gap: 8px; align-items: baseline; }
.primary { background: var(--accent); color: var(--panel); border: 0; border-radius: 6px; padding: 8px 14px; font-family: var(--mono); font-size: 13px; cursor: pointer; }
.about { border-top: 1px solid var(--line); padding-top: 12px; font-size: 12.5px; color: var(--faint); }
.about p { margin: 0; max-width: 80ch; }

@media (max-width: 560px) {
  .top nav { order: 3; flex-basis: 100%; }
  .top .ghost { margin-left: auto; }
  .kv { grid-template-columns: auto 1fr; }
  .kv .rec { grid-column: 2; }
  .brief { padding: 16px 14px; }
  .plan { padding: 4px 14px 14px; }
}

/* the brief prints as one sheet */
@media print {
  /* the same selectors as the dark theme, so a dark viewer still prints light */
  :root, :root[data-theme], :root:not([data-theme='light']) { --bg: #fff; --panel: #fff; --ink: #000; --dim: #333; --faint: #555; --line: #999; --accent: #000; --accent-soft: #fff; --warn: #000; --warn-soft: #fff; --tag: #333; --tag-soft: #fff; --new: #000; --new-soft: #fff; --closed: #000; --closed-soft: #fff; --land: #fff; --county: #bbb; --state: #555; --t1: #e6e6e6; --t2: #bdbdbd; --t3: #888; --t4: #444; --call: #000; color-scheme: light; }
  body { padding: 0; font-size: 11px; }
  .top, .about, .noprint, .filters { display: none !important; }
  .wrap { max-width: none; gap: 8px; }
  .brief, .plan { border: 0; padding: 0; gap: 9px; }
  .bname { font-size: 16px; }
  .bline, .factline, .pline { font-size: 12px; }
  table { font-size: 10.5px; }
  th, td { padding: 3px 6px; }
  .tbl { border: 0; overflow: visible; }
  a { text-decoration: none; }
  /* a printed sheet keeps each record's address */
  a[href^='http']::after { content: ' ' attr(href); font-family: var(--mono); font-size: 8px; color: var(--dim); overflow-wrap: anywhere; }
  .kv .rec { white-space: normal; }
  .bsec { break-inside: avoid; }
  .bsec:has(.tbl) { break-inside: auto; }
}
