/* Inter (SIL Open Font License, fonts/Inter-OFL.txt), from our own site: modern, light at medium weights, the same on every device */
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900; src: url(/assets/fonts/inter-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900; src: url(/assets/fonts/inter-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
/* TTD dashboards (charts-only pages). Palette = dataviz reference instance (validated
   light + dark); TTD brand ink/blue on the chrome. Charts read these tokens from JS. */
.viz-root {
  color-scheme: light;
  --page: #f3f8fd;
  --surface-1: #fcfcfb;
  --text-primary: #0b2540;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --brand: #1572d3;
  --up-good: #006300;
  --down-bad: #d03b3b;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .viz-root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface-1: #1a1a19;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --brand: #3987e5;
    --up-good: #0ca30c;
    --down-bad: #e66767;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  }
}

/* a dashboard's theme can force light or dark (e.g. dark for a TV); placed after the media query so it wins */
.viz-root[data-mode="light"] {
  color-scheme: light;
  --page: #f3f8fd; --surface-1: #fcfcfb; --text-primary: #0b2540; --text-secondary: #52514e; --text-muted: #898781;
  --grid: #e1e0d9; --axis: #c3c2b7; --border: rgba(11, 11, 11, 0.10); --brand: #1572d3; --up-good: #006300; --down-bad: #d03b3b;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
}
.viz-root[data-mode="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface-1: #1a1a19; --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, 0.10); --brand: #3987e5; --up-good: #0ca30c; --down-bad: #e66767;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-feature-settings: "cv11"; }
.viz-root { background: var(--page); color: var(--text-primary); min-height: 100vh; }

.dash { max-width: 1200px; margin: 0 auto; padding: 24px 16px 32px; }
.dash-head { margin-bottom: 20px; }
.dash-brand { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--brand); margin-bottom: 6px; }
.dash-brand i { width: 12px; height: 12px; border-radius: 0 50% 50% 50%; transform: rotate(45deg); background: var(--brand); }
.dash-head h1 { font-size: 26px; line-height: 1.2; margin: 0 0 4px; font-weight: 700; }
.dash-head p { margin: 0; color: var(--text-secondary); font-size: 15px; }

.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 16px; min-width: 0; }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-6 { grid-column: span 6; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
@media (max-width: 900px) { .span-3 { grid-column: span 6; } .span-4, .span-6, .span-8 { grid-column: span 12; } }
@media (max-width: 520px) { .span-3 { grid-column: span 12; } .dash-head h1 { font-size: 22px; } }

.kpi-label { font-size: calc(15px * var(--ts, 1)); font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }   /* = card titles */
.kpi-value { font-size: calc(32px * var(--ts, 1)); font-weight: 700; line-height: 1.1; }
.kpi-unit { font-size: calc(16px * var(--ts, 1)); font-weight: 500; color: var(--text-secondary); margin-left: 4px; }
.kpi-delta { margin-top: 8px; font-size: calc(13px * var(--ts, 1)); color: var(--text-secondary); display: flex; gap: 6px; align-items: center; }
.kpi-delta b { font-weight: 600; }
.kpi-delta .good { color: var(--up-good); } .kpi-delta .bad { color: var(--down-bad); }

.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.chart-head h2 { font-size: calc(15px * var(--ts, 1)); font-weight: 600; margin: 0; }
.chart-head .unit { color: var(--text-muted); font-weight: 400; font-size: 13px; margin-left: 6px; }
.toggle { font: inherit; font-size: 12px; color: var(--brand); background: none; border: 0; cursor: pointer; padding: 2px 4px; }
.chart-box { position: relative; height: 280px; }
.chart-box.h-short { height: 200px; } .chart-box.h-tall { height: 400px; }
.chart-box.h-cal1 { height: 180px; } .chart-box.h-cal2 { height: 340px; }   /* ttd-dash.js sets the exact height */
.cal-note { display: none; flex-basis: 100%; color: var(--text-muted); font-size: 12px; }
@media (max-width: 520px) { .chart-box.h-cal1, .chart-box.h-cal2 { height: 110px; } .cal-note { display: block; } }

table.data { width: 100%; border-collapse: collapse; font-size: calc(13px * var(--ts, 1)); font-variant-numeric: tabular-nums; }
table.data th { text-align: left; color: var(--text-secondary); font-weight: 600; border-bottom: 1px solid var(--axis); padding: 6px 8px; }
table.data td { border-bottom: 1px solid var(--grid); padding: 6px 8px; }
table.data td.num, table.data th.num { text-align: right; }
.table-wrap { overflow: auto; max-height: 420px; }

.note { font-size: calc(14px * var(--ts, 1)); line-height: 1.55; color: var(--text-secondary); white-space: pre-wrap; }
.dash-foot { margin-top: 20px; font-size: 12px; color: var(--text-muted); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Ask TTD canvas: live edits */
.card.is-pickable { cursor: pointer; transition: box-shadow .2s, border-color .2s; }
.card.is-pickable:hover { border-color: var(--brand); }
.card.is-selected { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.card.is-changed { animation: ttd-in .55s ease both, ttd-glow 1.8s ease .2s both; }
@keyframes ttd-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes ttd-glow {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 45%, transparent); }
  40% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--brand) 22%, transparent); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) { .card.is-changed { animation: none; } }

/* card numbers: shown when the page asks (.show-nums), so people can say "move 3 left" */
.card { position: relative; }
.card-n { display: none; }
.show-nums .card-n { display: flex; align-items: center; justify-content: center; position: absolute; top: 8px; right: 8px; z-index: 2;
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--surface-1); background: var(--text-primary); opacity: .82; pointer-events: none; }
.show-nums .chart-head { padding-right: 30px; }
.card > .note { padding-right: 26px; }   /* room for the corner ⋯ */
.show-nums .card > .note { padding-right: 58px; }

/* headline number with a trend line */
.spark { display: block; width: 100%; height: 32px; margin-top: 10px; overflow: visible; }
.spark polyline { fill: none; stroke: var(--s1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark circle { fill: var(--s1); }
.spark-cell { width: 110px; padding-top: 4px; padding-bottom: 4px; } .spark-cell .spark { width: 96px; height: 22px; margin: 0; }
th.spark-h { font-weight: 500; white-space: nowrap; }

/* gauge */
.gauge-box { position: relative; height: 120px; margin-top: 4px; }
.gauge-value { position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; font-size: calc(26px * var(--ts, 1)); font-weight: 700; line-height: 1; }
.gauge-card .kpi-delta { justify-content: space-between; flex-wrap: wrap; }

/* heat table */
table.heat td { transition: none; }
table.heat td.on-dark { color: #fff; }
table.heat th.row-h { text-align: left; font-weight: 600; color: var(--text-primary); border-bottom: 1px solid var(--grid); padding: 6px 8px; white-space: nowrap; }
.heat-key { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; font-size: calc(12px * var(--ts, 1)); color: var(--text-muted); }
.heat-ramp { flex: 0 1 160px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, color-mix(in srgb, var(--s1) 8%, var(--surface-1)), var(--s1)); }
.heat-ramp.is-bad { background: linear-gradient(90deg, color-mix(in srgb, var(--down-bad) 8%, var(--surface-1)), var(--down-bad)); }
.heat-ramp.is-good { background: linear-gradient(90deg, color-mix(in srgb, var(--up-good) 8%, var(--surface-1)), var(--up-good)); }

/* map card */
.map-card { display: flex; flex-direction: column; }
.map-frame { display: block; width: 100%; height: 380px; border: 0; border-radius: 8px; background: #0b1118; }
.map-frame.h-short { height: 260px; } .map-frame.h-tall { height: 560px; }

/* ECharts (ttd-dash.js): the drawing fills its chart box; tooltips are styled here, never with style attributes (CSP) */
.ec-draw { position: absolute; inset: 0; }
.ttd-tip { min-width: 120px; line-height: 1.45; }
.ttd-tip .tt-h { font-weight: 600; margin-bottom: 2px; }
.ttd-tip .tt-r { display: flex; align-items: center; gap: 8px; }
.ttd-tip .tt-r span { flex: 1; opacity: .85; }
.ttd-tip .tt-r b { font-weight: 600; font-variant-numeric: tabular-nums; }
.ttd-tip .tt-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.ttd-tip .tt-s1 { background: var(--s1); } .ttd-tip .tt-s2 { background: var(--s2); } .ttd-tip .tt-s3 { background: var(--s3); } .ttd-tip .tt-s4 { background: var(--s4); }
.ttd-tip .tt-s5 { background: var(--s5); } .ttd-tip .tt-s6 { background: var(--s6); } .ttd-tip .tt-s7 { background: var(--s7); } .ttd-tip .tt-s8 { background: var(--s8); }

/* board filters: a card that doesn't follow the tab's pickers, one the pick leaves empty, and the redraw in progress */
.card-nf { margin-top: 8px; font-size: calc(11px * var(--ts, 1)); color: var(--text-muted); }
.card-empty { margin: 18px 0 8px; color: var(--text-secondary); font-size: 14px; }
.dash.is-loading .card { opacity: .55; transition: opacity .15s; }
.ttd-tip .tt-hint { margin-top: 6px; font-size: 11px; opacity: .72; }
.heat .tot { font-weight: 700; color: var(--text-primary); background: var(--surface-1); }
.heat thead .tot, .heat td.tot { border-left: 2px solid var(--grid); }
.heat tfoot th, .heat tfoot td { border-top: 2px solid var(--grid); }
/* wide heat tables scroll inside their card: the row names stay put */
table.heat th.row-h, table.heat thead th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface-1); }
.chart-box.h-race { height: 380px; }
.chart-head .race-play { margin-left: auto; margin-right: 10px; }
.card-src { margin-top: 8px; font-size: calc(11px * var(--ts, 1)); line-height: 1.35; color: var(--text-muted); overflow-wrap: anywhere; }
.card-src:empty { display: none; }
.card-src a { color: inherit; text-decoration: underline; text-decoration-color: var(--axis); text-underline-offset: 2px; }
.card-src a:hover { color: var(--text-secondary); }
.note-key { display: none; margin: 8px 0 0; padding-left: 20px; font-size: calc(12px * var(--ts, 1)); color: var(--text-secondary); }
.note-key li { margin: 1px 0; }
.card.notes-num .note-key { display: block; }

/* live cards: a red dot "Live · 3 s ago"; made-up feeds say "Demo data, simulated" (amber, never mistaken for real) */
.live-pill { display: inline-flex; align-items: center; gap: 5px; margin-left: 8px; padding: 2px 8px; border-radius: 999px;
  font-size: calc(11px * var(--ts, 1)); font-weight: 600; line-height: 1.4; white-space: nowrap; vertical-align: middle;
  color: var(--text-primary); background: color-mix(in srgb, var(--down-bad) 12%, transparent); }
.live-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--down-bad); animation: live-dot 2s ease-in-out infinite; }
.live-pill .live-age { font-weight: 400; color: var(--text-secondary); }
.live-pill.is-demo { background: color-mix(in srgb, var(--s4) 24%, transparent); }
.live-pill.is-demo i { background: var(--s4); }
.live-pill.is-stale { color: var(--text-muted); background: color-mix(in srgb, var(--text-muted) 14%, transparent); }
.live-pill.is-stale i { animation: none; background: var(--text-muted); }
.chart-head .live-pill { margin-left: auto; margin-right: 8px; }
.kpi-label .live-pill { margin-left: 6px; }
td.is-flash { animation: live-flash 1.4s ease-out; }
@keyframes live-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes live-flash { 0% { background: color-mix(in srgb, var(--s4) 35%, transparent); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .live-pill i, td.is-flash { animation: none; } }

/* the chooser card's own way back to All: "✕ Kota Tinggi" beside its title */
.pick-clear { margin-left: auto; margin-right: 6px; padding: 3px 10px; border-radius: 999px; color: var(--text-primary);
  background: color-mix(in srgb, var(--brand) 14%, transparent); font-weight: 600; white-space: nowrap; max-width: 60%; overflow: hidden; text-overflow: ellipsis; }
.pick-clear:hover { background: color-mix(in srgb, var(--brand) 24%, transparent); }
.chart-head { flex-wrap: nowrap; align-items: flex-start; }   /* the title wraps inside itself; Table and ⋯ stay on its row */
.chart-head h2 { flex: 1 1 auto; line-height: 1.3; }   /* Tabler gives headings tall line spacing */
.chart-head > .toggle, .chart-head > .card-menu, .chart-head > .pick-clear, .chart-head > .live-pill { flex: none; }
.chart-head h2 { min-width: 0; }

/* the card menu ("⋯": Save image, Copy image); works on pages without aria.css too */
.card { position: relative; }
.card-menu { position: relative; flex: none; }
.card-menu > summary { list-style: none; cursor: pointer; color: var(--text-secondary); padding: 0 8px; line-height: 1.3; font-size: 22px; font-weight: 700; border: 0; background: none; border-radius: 6px; }
.card-menu > summary:hover { background: color-mix(in srgb, var(--brand) 10%, transparent); }
.card-menu > summary::-webkit-details-marker { display: none; }
.card-menu > summary:hover, .card-menu[open] > summary { color: var(--text-primary); }
.card-menu > .dropdown-menu { display: none; position: absolute; right: 0; top: calc(100% + 2px); z-index: 40; min-width: 150px;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 4px 0; box-shadow: 0 8px 24px rgba(0,0,0,.14); }
.card-menu[open] > .dropdown-menu { display: block; }
.card-menu .dropdown-item { display: block; width: 100%; text-align: left; padding: 7px 14px; font: inherit; font-size: 13px; color: var(--text-primary);
  background: none; border: 0; cursor: pointer; white-space: nowrap; }
.card-menu .dropdown-item:hover { background: color-mix(in srgb, var(--brand) 10%, transparent); }
.card-tools { position: absolute; top: 6px; right: 6px; display: flex; align-items: center; gap: 2px; z-index: 3; }
.show-nums .card-tools { right: 34px; }
@media (min-width: 1280px) { body[data-live="1"] .card-menu { display: none; } }   /* a TV shows no buttons; a phone or laptop on /live does */
/* the heading on a saved tab picture */
.snap-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 4px 4px 14px; font-size: 18px; color: var(--text-primary); }
.snap-head span { font-size: 13px; color: var(--text-muted); }

/* lighter type: medium weights instead of bold (Inter stays crisp and readable at 500-650) */
.viz-root h1, .viz-root h2, .viz-root h3 { font-weight: 650; }
.viz-root b, .viz-root strong { font-weight: 600; }
.kpi-label, .chart-head h2 { font-weight: 550; }
.kpi-value, .gauge-value { font-weight: 650; }
.dash-head h1 { font-weight: 650; }
.snap-foot { margin-top: 10px; text-align: right; font-size: 11px; color: var(--text-muted); letter-spacing: .02em; }
#dash > .snap-foot { padding: 0 4px 6px; }

/* the Share button beside each card's ⋯ */
.card-share-btn { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 30px; padding: 0;
  border: 0; border-radius: 6px; background: none; color: var(--brand); cursor: pointer; }
.card-share-btn svg { width: 20px; height: 20px; fill: currentColor; }
.card-share-btn:hover { background: color-mix(in srgb, var(--brand) 10%, transparent); }
@media (min-width: 1280px) { body[data-live="1"] .card-share-btn, body[data-live="1"] .card-tools { display: none; } }
.card > .note { padding-right: 64px; }
.show-nums .card > .note { padding-right: 92px; }
.kpi-label, .gauge-card .kpi-label { padding-right: 64px; }

/* the standalone dashboard page's brand line: the ARIA wordmark (brand kit), then "talk to your data" */
.dash-brand i { display: none; }
.dash-brand::before { content: ""; display: inline-block; width: 52px; height: 16px; margin-right: 8px; background: var(--text-primary);
  -webkit-mask: url(/assets/brand/aria-wordmark.svg) left center / contain no-repeat; mask: url(/assets/brand/aria-wordmark.svg) left center / contain no-repeat; }
.snap-foot img { height: 14px; width: auto; vertical-align: middle; }
/* play over time: the frame on show (a year) beside Pause/Play; on numbers, under the value */
.chart-head .play-frame { margin-left: auto; margin-right: 8px; font-weight: 700; font-size: calc(15px * var(--ts, 1)); color: var(--text-primary); font-variant-numeric: tabular-nums; }
.chart-head .play-frame + .race-play { margin-left: 0; }
.play-row .play-frame { font-size: calc(14px * var(--ts, 1)); color: var(--text-primary); font-variant-numeric: tabular-nums; }
.play-row .race-play { margin-left: auto; }
.kpi-value { font-variant-numeric: tabular-nums; }
/* the video sheet: shape, Make video, progress, the video, Share / Save */
.vid-sheet { border: 0; border-radius: 14px; padding: 20px; width: min(440px, calc(100vw - 32px)); background: var(--surface-1); color: var(--text-primary); box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.vid-sheet::backdrop { background: rgba(10, 16, 24, .45); }
.vid-sheet h3 { margin: 0 0 12px; font-size: 17px; font-weight: 650; }
.vid-shapes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.vid-shape { display: flex; flex-direction: column; gap: 2px; padding: 10px 8px; border: 1.5px solid var(--grid); border-radius: 10px; background: none; color: inherit; cursor: pointer; text-align: left; font: inherit; }
.vid-shape b { font-size: 14px; font-weight: 600; } .vid-shape span { font-size: 12px; color: var(--text-muted); }
.vid-shape.is-on { border-color: var(--s1); box-shadow: inset 0 0 0 1px var(--s1); }
.vid-go { width: 100%; }
.vid-bar { height: 6px; border-radius: 3px; background: var(--grid); overflow: hidden; margin: 6px 0 4px; }
.vid-bar i { display: block; height: 100%; width: 0; background: var(--s1); transition: width .2s linear; }
.vid-note { margin: 10px 0; font-size: 13px; color: var(--text-secondary); }
.vid-preview { width: 100%; max-height: 52vh; border-radius: 8px; background: #000; }
.vid-acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }

/* picture cards (Kelly 16 Nov): the photo fills the box (cover) or shows whole (contain), a caption under it */
.pic-box { position: relative; height: 280px; border-radius: 10px; overflow: hidden; background: var(--surface-2, rgba(127,127,127,.08)); }
.pic-box.h-short { height: 200px; } .pic-box.h-tall { height: 400px; }
.pic-box img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pic-box.fit-contain img { object-fit: contain; }
.pic-box.pic-gone { display: flex; align-items: center; justify-content: center; color: var(--text-secondary); font-size: 13px; }
.pic-caption { margin-top: 8px; font-size: calc(13.5px * var(--ts, 1)); line-height: 1.45; color: var(--text-secondary); }
