/* Components inside the column and on the map. Uses the tokens of theme.css only. */

/* ---- topic card */
#topic { display: flex; flex-direction: column; gap: var(--s2); }
#topic h2 { font-size: 15px; line-height: 20px; font-weight: 600; letter-spacing: -.005em; }
.big { display: flex; align-items: baseline; gap: 6px; margin-top: var(--s1); font-size: 32px; line-height: 36px; font-weight: 300; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.big small { font-size: 13px; letter-spacing: 0; color: var(--ink-2); font-weight: 400; }
.bigl { font-size: 12px; line-height: 16px; color: var(--mut); margin-top: calc(-1 * var(--s1)); }
#topic p, .story p { font-size: 13px; line-height: 20px; color: var(--ink-2); }
.seg2 { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 2px; background: var(--subtle); border: 1px solid var(--line); border-radius: var(--r2); }
.seg2 button { height: 28px; border: 0; border-radius: var(--r1); background: transparent; font-size: 12px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.seg2 button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(20, 38, 41, .12), 0 0 0 1px var(--line); }

/* ---- legend */
.legend { display: flex; flex-direction: column; gap: 6px; margin-top: var(--s1); }
.lg-bar { position: relative; height: 10px; border-radius: 3px; }
.lg-bar .tick { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(20, 38, 41, .35); border-radius: 1px; }
.lg-ends { position: relative; display: flex; justify-content: space-between; font-size: 12px; line-height: 16px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.lg-ends b { font-weight: 600; color: var(--ink); }
.lg-ends .tk { position: absolute; transform: translateX(-50%); color: var(--ink); font-weight: 600; }
.lg-note { font-size: 12px; line-height: 16px; color: var(--mut); }
.legend-strip:empty { display: none; }
.legend-strip { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--s2); font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; margin-top: calc(-1 * var(--s2)); }
.legend-strip .lg-bar { height: 8px; }

/* ---- tool bar, filter, pins */
.toolbar { display: flex; align-items: center; gap: var(--s2); }
body .toolbar .seg { appearance: none; color: inherit; font-size: inherit; flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 2px; height: var(--h-ctl); background: var(--subtle); border: 1px solid var(--line); border-radius: var(--r2); }
.toolbar .seg button { display: flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: var(--r1); background: transparent; font-size: 12px; font-weight: 500; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.toolbar .seg button .ic { width: 16px; height: 16px; }
.toolbar .seg button:hover { color: var(--ink); }
.toolbar .seg button.on { background: #fff; color: var(--teal-d); font-weight: 600; box-shadow: 0 1px 2px rgba(20, 38, 41, .12), 0 0 0 1px var(--line); }
.toolbar > .btn { height: var(--h-ctl); padding: 0 10px; font-size: 12px; gap: 6px; }
.toolbar > .btn .ic { width: 16px; height: 16px; }
.toolbar > .btn.on { background: var(--teal-t); border-color: var(--teal); color: var(--teal-d); }
.inset { display: flex; flex-direction: column; gap: var(--s3); padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r2); }
.inset-h { display: flex; align-items: center; justify-content: space-between; min-height: 24px; }
.chipset { display: flex; flex-wrap: wrap; gap: 6px; }
.chipset .btn { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 14px; }
.chipset .btn.on { background: var(--teal-t); border-color: var(--teal); color: var(--teal-d); }
label.row { display: grid; grid-template-columns: auto 1fr; column-gap: var(--s2); font-size: 12px; color: var(--ink-2); }
label.row > span, label.row > b { text-align: right; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
label.row input { grid-column: 1 / -1; }
label.check { display: flex; align-items: center; gap: var(--s2); font-size: 13px; }
input[type=range] { width: 100%; accent-color: var(--teal); margin: 6px 0 0; }
input[type=checkbox] { accent-color: var(--teal); width: 16px; height: 16px; margin: 0; }
.dual { position: relative; height: 24px; }
.dual input { position: absolute; inset: 0; margin: 0; pointer-events: none; background: none; -webkit-appearance: none; appearance: none; }
.dual input::-webkit-slider-thumb { pointer-events: auto; -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid var(--teal); cursor: pointer; }
.dual input::-moz-range-thumb { pointer-events: auto; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--teal); cursor: pointer; }
.dual .track { position: absolute; left: 0; right: 0; top: 9px; height: 6px; border-radius: 3px; opacity: .9; }
.dual .dim { position: absolute; top: 9px; height: 6px; background: rgba(255, 255, 255, .78); }
.range-vals { display: flex; justify-content: space-between; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.pinrow { display: grid; grid-template-columns: 20px 52px 1fr auto; align-items: center; gap: var(--s2); height: 28px; font-size: 13px; }
.pinrow .where { color: var(--ink-2); font-size: 12px; }
.pinrow .bar, .rank .bar { height: 6px; border-radius: 3px; background: var(--subtle); overflow: hidden; }
.pinrow .bar i, .rank .bar i { display: block; height: 100%; border-radius: 3px; background: var(--teal); }
.pinrow b { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; min-width: 64px; }
.pinrow b small, .rank b small { font-weight: 400; }
.dot { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--teal); color: #fff; font-size: 11px; font-weight: 700; }
.dot.b { background: #c46a1b; }

/* ---- rank list and compare */
.rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.rank li { display: grid; grid-template-columns: 20px minmax(0, 1fr) 64px 56px; align-items: center; gap: var(--s2); height: 32px; padding: 0 var(--s1); border-radius: var(--r1); font-size: 13px; cursor: pointer; }
.rank li:hover { background: var(--subtle); }
.rank li.sel { background: var(--teal-t); }
.rank li.sel2 { background: #fbeee2; }
.rank .rn { color: var(--mut); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
.rank .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank .nm small { margin-left: 4px; }
.rank b { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-head { display: grid; grid-template-columns: 20px minmax(0, 1fr) 64px 56px; gap: var(--s2); padding: 0 var(--s1); font-size: 11px; color: var(--mut); text-transform: uppercase; letter-spacing: .05em; }
.rank-head span:last-child { text-align: right; }
table.cmp { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.cmp th { font-size: 12px; font-weight: 600; text-align: right; padding: 0 0 6px; vertical-align: bottom; }
.cmp th:first-child { text-align: left; color: var(--mut); font-weight: 400; }
.cmp td { padding: 6px 0; border-top: 1px solid var(--line); text-align: right; }
.cmp td:first-child { text-align: left; color: var(--ink-2); white-space: nowrap; }
.cmp td.cur { color: var(--ink); font-weight: 600; }
.cmp th .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--teal); }
.cmp th .sw.b { background: #c46a1b; }
.cmp td + td { width: 72px; }
.cmp td small { margin-left: 2px; }
.cmp .w { color: var(--teal-d); font-weight: 600; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.card-h h3 { font-size: 15px; line-height: 20px; font-weight: 600; }
.kicker { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.kicker .sw { width: 10px; height: 10px; border-radius: 2px; background: var(--teal); }
.kicker .sw.b { background: #c46a1b; }
.kicker .nm2 { font-size: 13px; font-weight: 600; color: var(--ink); }

/* ---- stories */
.story-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r2); overflow: hidden; }
.story-list button { display: grid; grid-template-columns: 1fr 16px; align-items: center; gap: var(--s3); min-height: 48px; padding: var(--s2) var(--s3); border: 0; border-top: 1px solid var(--line); background: #fff; text-align: left; cursor: pointer; }
.story-list button:first-child { border-top: 0; }
.story-list button:hover { background: var(--subtle); }
.story-list .t { font-size: 13px; font-weight: 500; line-height: 18px; }
.story-list .s { display: block; font-size: 12px; color: var(--mut); line-height: 16px; margin-top: 2px; }
.story-list .chev { width: 16px; height: 16px; color: var(--mut); }
/* story widget: fixed size, body scrolls, footer never moves (Back · n / N · Next, fixed widths) */
.story { display: flex; flex-direction: column; height: 400px; border: 1px solid var(--line); border-radius: var(--r2); background: #fff; overflow: hidden; }
.story-h { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: var(--s3) var(--s2) 0 var(--s4); }
.story .steps { display: flex; gap: 4px; padding: var(--s2) var(--s4) 0; }
.steps i { flex: 1; height: 3px; border-radius: 2px; background: var(--line); }
.steps i.on { background: var(--teal); }
.story-b { flex: 1; min-height: 0; overflow-y: auto; padding: var(--s4); display: flex; flex-direction: column; gap: var(--s2); }
.story-b h3 { font-size: 15px; line-height: 20px; font-weight: 600; }
.story-b p { font-size: 13px; line-height: 20px; color: var(--ink-2); }
.story-f { flex: none; display: grid; grid-template-columns: 96px 1fr 96px; align-items: center; gap: var(--s2); padding: var(--s3) var(--s4); border-top: 1px solid var(--line); background: var(--subtle); }
.story-f .btn { width: 96px; gap: 4px; padding: 0 8px; }
.story-f .btn .ic { width: 16px; height: 16px; }
.st-n { text-align: center; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
/* ---- building card (ForgeKit layout): no inner boxes, one accent, tabular figures; max width 300 px */
#popup { position: absolute; left: 0; top: 0; z-index: 5; width: 280px; max-width: 300px; padding: var(--s4); font-variant-numeric: tabular-nums; box-shadow: 0 2px 4px rgba(20, 38, 41, .08), 0 8px 24px rgba(20, 38, 41, .16); }
#leader { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 4; pointer-events: none; visibility: hidden; overflow: visible; }
#leader line { stroke: var(--ink); stroke-width: 1.5; opacity: .7; }
#leader circle { fill: #fff; stroke: var(--teal); stroke-width: 2.5; }
#popup .x { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; }
#popup .x .ic { width: 16px; height: 16px; }
#popup h3 { display: flex; align-items: baseline; gap: var(--s2); padding-right: 28px; font-size: 15px; line-height: 20px; font-weight: 600; }
#popup h3 span { font-size: 15px; font-weight: 300; color: var(--ink-2); white-space: nowrap; }
#popup .sub { font-size: 12px; color: var(--mut); line-height: 16px; }
#popup .pk { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); margin: var(--s4) 0 var(--s3); }
#popup .pk b { display: flex; align-items: baseline; gap: 3px; font-size: 28px; line-height: 32px; font-weight: 300; color: var(--ink); white-space: nowrap; }
#popup .pk small { font-size: 12px; }
#popup .pk span { display: block; font-size: 12px; line-height: 16px; color: var(--mut); margin-top: 2px; }
#popup .pc { margin: 0 0 var(--s4); font-size: 13px; line-height: 18px; color: var(--ink-2); }
#popup .pc i { font-style: normal; color: var(--teal); }
#popup .ph { margin-bottom: var(--s2); font-size: 11px; line-height: 16px; letter-spacing: .06em; text-transform: uppercase; color: var(--teal); font-weight: 600; }
#popup .pb { display: grid; grid-template-columns: 48px 1fr 40px; align-items: center; gap: var(--s2); height: 16px; font-size: 12px; }
#popup .pb span { color: var(--mut); white-space: nowrap; }
#popup .pb .bar { height: 5px; border-radius: 3px; background: var(--subtle); overflow: hidden; }
#popup .pb .bar i { display: block; height: 100%; border-radius: 3px; background: var(--teal); }
#popup .pb b { text-align: right; font-weight: 500; }
#popup .pb.na b { color: var(--mut); font-weight: 400; }
#popup .pf { margin-top: var(--s3); font-size: 11px; line-height: 14px; color: var(--mut); }
/* ---- advanced, live, timeline */
#hist { width: 100%; height: 75px; }
#pg-advanced .small a { color: var(--teal); }
.live-status { display: flex; flex-direction: column; gap: var(--s1); }
.live-now { display: flex; align-items: baseline; gap: var(--s2); }
.live-now b { font-size: 32px; line-height: 36px; font-weight: 300; font-variant-numeric: tabular-nums; }
.tl { display: flex; flex-direction: column; gap: 6px; }
.tl-h { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); }
.tl-h b { color: var(--ink); }
.tl-hours { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; }
.tl-hours button { height: 24px; border: 0; padding: 0; border-radius: 3px; background: var(--subtle); cursor: pointer; font-size: 10px; color: var(--mut); font-variant-numeric: tabular-nums; }
.tl-hours button:hover { background: var(--line); }
.tl-hours button.now { box-shadow: inset 0 -2px 0 var(--live); color: var(--ink); font-weight: 600; }
.tl-hours button.on { background: var(--teal); color: #fff; }
@media (max-width: 700px) {
  /* phone: the card docks at the bottom; the two KPIs stay side by side, bars tight */
  #popup { width: 220px; padding: var(--s3); }
  #popup.docked { position: fixed; left: 0; right: 0; top: auto; bottom: 0; width: auto; max-width: none; z-index: 12; padding: var(--s3) var(--s4) var(--s4); border-radius: 16px 16px 0 0; border-bottom: 0; }
  #popup.docked .x { top: 6px; right: 8px; }
  /* story open: the card docks under the top bar, compact (no bars), so the story sheet stays free */
  body.story-on #popup.docked { top: 52px; bottom: auto; border-radius: 0 0 16px 16px; border-top: 0; border-bottom: 1px solid var(--line); padding-top: var(--s2); padding-bottom: var(--s2); }
  body.story-on #popup.docked .ph, body.story-on #popup.docked .pb, body.story-on #popup.docked .pc { display: none; }
  #popup h3, #popup h3 span { font-size: 14px; line-height: 18px; }
  #popup .pk { margin: var(--s3) 0 var(--s2); gap: var(--s3); }
  #popup .pk b { font-size: 24px; line-height: 28px; }
  #popup .pc { margin-bottom: var(--s3); font-size: 12px; line-height: 16px; }
  #popup .pb { grid-template-columns: 48px 1fr 36px; height: 14px; font-size: 11px; }
  #popup .pf { margin-top: var(--s2); }
}
@media (max-width: 700px) { .tl-hours button { font-size: 0; } }
/* ---- districts drill-down (districts.js, unitmap.js): crumb, legend, fixed card slot, ranked unit list, tooltip */
#pg-districts > .page-title, #pg-districts > .legend-strip { display: none; }
.u-crumb { display: flex; align-items: center; gap: 2px; min-height: 28px; font-size: 15px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; }
.u-crumb button { border: 0; background: none; padding: 4px 6px 4px 0; font: 500 15px/1.25 var(--font); color: var(--teal); cursor: pointer; }
.u-crumb button:hover { text-decoration: underline; }
.u-crumb .ic { width: 14px; height: 14px; color: var(--mut); }
.u-crumb .on { overflow: hidden; text-overflow: ellipsis; padding-left: 2px; }
.u-lg { display: flex; flex-direction: column; gap: 4px; }
.u-lg .lg-bar { height: 8px; }
.u-lg-e { display: grid; grid-template-columns: auto 1fr auto; gap: var(--s2); font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.u-lg-e .small { text-align: center; }
.u-card { height: 222px; box-sizing: border-box; overflow: hidden; display: flex; flex-direction: column; gap: 6px; padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r2); background: #fff; }
.u-card.u-ctx { background: var(--subtle); }
.u-card.u-empty { justify-content: flex-start; gap: var(--s2); }
.u-card .card-h { min-height: 28px; }
.u-card .card-h h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.u-card .kicker { min-width: 0; }
.u-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: -4px; }
.u-card table.cmp { font-size: 12px; }
.u-card .cmp td { padding: 3px 0; }
.u-card .cmp tr.cur td { color: var(--ink); font-weight: 600; }
.u-card .cmp th { font-weight: 600; font-size: 12px; max-width: 84px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-card .cmp th .sw { margin-right: 4px; vertical-align: -1px; }
.u-card .cmp td + td { width: 84px; }
.u-act { display: flex; align-items: center; gap: var(--s2); margin-top: auto; min-height: 32px; }
.u-act .u-hint { flex: 1; margin: 0; color: var(--ink-2); }
.u-hint { margin: 0; }
.u-act .btn .ic { width: 16px; height: 16px; }
.pt { font-style: normal; font-size: 10px; line-height: 14px; padding: 0 4px; margin-left: 6px; border: 1px dashed var(--line-2); border-radius: 3px; color: var(--mut); vertical-align: 1px; white-space: nowrap; }
.u-lists { display: flex; flex-direction: column; gap: 4px; }
.u-eb { margin-top: var(--s2); }
.u-head, .u-rank li { display: grid; grid-template-columns: 20px minmax(0, 1fr) 44px 42px 36px; align-items: center; gap: 6px; padding: 0 var(--s1); }
.u-head.dr, .u-rank.dr li { grid-template-columns: 20px minmax(0, 1fr) 40px 40px 34px 24px; }
.u-head { font-size: 11px; color: var(--mut); text-transform: uppercase; letter-spacing: .05em; }
.u-head span:nth-child(4), .u-head span:nth-child(5) { text-align: right; }
.u-rank li { height: 32px; }
.u-rank li.hov:not(.sel):not(.sel2) { background: var(--subtle); }
.u-rank .pp { font-size: 12px; color: var(--mut); text-align: right; font-variant-numeric: tabular-nums; }
.u-rank .nm { display: flex; align-items: center; min-width: 0; }
.u-rank .nm { overflow: hidden; text-overflow: ellipsis; }
.u-rank .icon-btn.dr { width: 24px; height: 24px; }
.u-rank .icon-btn.dr .ic { width: 16px; height: 16px; }
.u-link { display: grid; grid-template-columns: 20px 1fr auto 16px; align-items: center; gap: var(--s3); height: var(--h-row); margin-top: var(--s2); padding: 0 var(--s3); border: 1px solid var(--line); border-radius: var(--r2); background: #fff; text-align: left; cursor: pointer; font: 500 13px var(--font); color: var(--ink); }
.u-link:hover { background: var(--subtle); }
.u-link .meta { font-size: 12px; color: var(--mut); font-weight: 400; }
.u-link .chev { width: 16px; height: 16px; color: var(--mut); }
.u-more { align-self: flex-start; }
.u-tip { position: fixed; z-index: 8; pointer-events: none; padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; font-size: 12px; min-width: 120px; }
.u-tip b { font-size: 13px; }
.u-tip .tv { display: flex; justify-content: space-between; gap: var(--s3); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }
@media (max-width: 700px) { .u-card { height: 214px; } .u-tip { display: none; } }
.tpu { font-size: 10px; font-weight: 400; color: #7a8a8c; white-space: nowrap; }
.u-rank .nm > span:first-child { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cmp th small.tpu { display: block; }
/* districts legend: hatch swatch for units without street data */
.nd-sw { display: inline-block; width: 14px; height: 10px; margin: 0 4px 0 6px; vertical-align: -1px; border: 1px solid var(--line); background: repeating-linear-gradient(90deg, rgba(122,138,140,.55) 0 3px, rgba(255,255,255,.4) 3px 6px); }
