/* design/24: the dashboard renderer's styles. Scoped to gd- classes; colours, font and radius come only from the
   look's CSS variables (render/look.ts), set on .gd-root. Shared by the app, the preview page and (V2) the guest site. */
.gd-root { font-family: var(--gd-font); color: var(--gd-ink); box-sizing: border-box; }
.gd-root *, .gd-root *::before, .gd-root *::after { box-sizing: border-box; }

/* Tiles: 360 px high, a still picture (the tile itself is the click target). */
.gd-tile { height: 360px; background: var(--gd-surface); border: 1px solid var(--gd-rule); border-radius: var(--gd-radius); padding: 14px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 1px 2px rgba(0, 0, 0, .05); overflow: hidden; }
.gd-tile * { pointer-events: none; }
.gd-tile-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; min-width: 0; }
.gd-tile-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gd-tile-asof { font-size: 11px; color: var(--gd-muted); white-space: nowrap; }
.gd-tile-body { flex: 1; min-height: 0; display: flex; }
.gd-open { font-size: 11px; color: var(--gd-watch); }

.gd-grid { flex: 1; display: grid; gap: 10px; min-height: 0; min-width: 0; }
.gd-cell { min-width: 0; min-height: 0; position: relative; display: flex; flex-direction: column; }
.gd-panel { border: 1px solid var(--gd-rule); border-radius: 8px; padding: 10px; }
.gd-w-title { font-size: 12px; font-weight: 600; color: var(--gd-muted); margin-bottom: 4px; }
.gd-chart-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.gd-chart { flex: 1; min-height: 40px; position: relative; }
.gd-chart-empty { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; color: var(--gd-muted); pointer-events: none; }
.gd-chart-empty[hidden] { display: none; }
/* A chart's headline (design/24 phase 4, step 6): the kpi's label, number and change over the chart. In a cell too
   short for both, only the headline shows (the chart would have under about 80 px). */
.gd-has-head { container-type: size; }
.gd-has-head > .gd-kpi-value { font-size: 24px; line-height: 1.15; }
.gd-has-head > .gd-kpi-delta { margin-bottom: 4px; }
@container (max-height: 140px) { .gd-has-head > .gd-chart { display: none; } }

/* KPI text sizes to its own cell (container query units), not the window: tiles come in width ranges. */
.gd-k-kpi { container-type: size; overflow: hidden; }
.gd-kpi-label { font-size: 11px; color: var(--gd-muted); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gd-kpi-value { font-size: clamp(14px, min(15cqw, 32cqh), 32px); font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gd-kpi-delta { font-size: 12px; margin-top: 2px; color: var(--gd-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gd-good { color: var(--gd-positive); }
.gd-bad, .gd-neg { color: var(--gd-negative); }

.gd-callout { border-left: 3px solid var(--gd-primary); padding: 6px 10px; background: var(--gd-muted-surface); border-radius: 0 8px 8px 0; height: 100%; overflow: hidden; }
.gd-callout[data-tone="good"] { border-color: var(--gd-positive); }
.gd-callout[data-tone="watch"] { border-color: var(--gd-watch); }
.gd-callout[data-tone="bad"] { border-color: var(--gd-negative); }
.gd-callout-title { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--gd-muted); }
.gd-callout-text { margin: 4px 0 0; font-size: 14px; line-height: 1.45; }
.gd-text { margin: 0; font-size: 13px; color: var(--gd-muted); line-height: 1.45; }

.gd-table-wrap { overflow: auto; flex: 1; min-height: 0; }
.gd-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.gd-table th, .gd-table td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--gd-rule); }
.gd-table th { color: var(--gd-muted); font-weight: 600; }
.gd-table .gd-n { text-align: right; font-variant-numeric: tabular-nums; }
.gd-table tbody tr:nth-child(even) { background: var(--gd-muted-surface); }
.gd-empty { color: var(--gd-muted); }

.gd-control { display: flex; flex-direction: column; gap: 4px; font-size: 12px; justify-content: center; height: 100%; }
.gd-control-row { flex-direction: row; align-items: center; gap: 8px; }
.gd-control-label { color: var(--gd-muted); font-weight: 600; }
.gd-select { font: inherit; padding: 5px 6px; border: 1px solid var(--gd-rule); border-radius: 6px; background: var(--gd-surface); color: var(--gd-ink); }
.gd-seg { display: flex; gap: 4px; flex-wrap: wrap; }
.gd-seg-b { font: inherit; font-size: 12px; padding: 4px 9px; border: 1px solid var(--gd-rule); border-radius: 999px; background: var(--gd-surface); color: var(--gd-ink); cursor: pointer; }
.gd-seg-b[aria-pressed="true"] { background: var(--gd-primary); border-color: var(--gd-primary); color: var(--gd-surface); }
.gd-range { width: 100%; accent-color: var(--gd-primary); }
.gd-range-out { font-weight: 700; font-size: 14px; }
.gd-range-reset { justify-self: start; font: inherit; font-size: 12px; color: var(--gd-muted); background: none; border: 1px solid var(--gd-rule, currentColor); border-radius: 999px; padding: 2px 10px; cursor: pointer; }
.gd-toggle { accent-color: var(--gd-primary); width: 16px; height: 16px; }

/* Full screen: designed at 1440 x 900, reflows to 1024. */
.gd-screen { position: relative; background: var(--gd-surface); border: 1px solid var(--gd-rule); border-radius: var(--gd-radius); min-height: 860px; display: flex; flex-direction: column; }
.gd-screen-head { padding: 16px 20px; border-bottom: 1px solid var(--gd-rule); display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.gd-screen-title { min-width: 0; }
.gd-client { font-size: 12px; font-weight: 700; color: var(--gd-primary); text-transform: uppercase; letter-spacing: .06em; }
.gd-name { font-size: 20px; font-weight: 700; margin: 2px 0; }
.gd-desc { color: var(--gd-muted); font-size: 13px; max-width: 720px; margin: 0; }
.gd-screen-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 12px; color: var(--gd-muted); }
.gd-screen-actions { display: flex; gap: 6px; margin-top: 4px; }
.gd-button { font: inherit; font-size: 12px; border: 1px solid var(--gd-rule); background: var(--gd-surface); color: var(--gd-ink); border-radius: 6px; padding: 3px 9px; cursor: pointer; }
.gd-button:hover { background: var(--gd-muted-surface); }
.gd-tabs { display: flex; gap: 4px; padding: 10px 20px 0; border-bottom: 1px solid var(--gd-rule); }
.gd-tabs[hidden] { display: none; }
.gd-tab { border: 0; background: none; padding: 8px 12px; font: inherit; font-size: 13px; color: var(--gd-muted); border-bottom: 2px solid transparent; cursor: pointer; }
.gd-tab[aria-selected="true"] { color: var(--gd-ink); border-color: var(--gd-primary); font-weight: 600; }
.gd-page { flex: 1; display: flex; padding: 16px 20px; min-height: 760px; }
.gd-page > .gd-grid { grid-auto-rows: minmax(110px, auto); gap: 14px; }

.gd-drill { position: fixed; z-index: 1000; width: 440px; max-width: calc(100vw - 16px); max-height: 60vh; overflow: auto; background: var(--gd-surface); border: 1px solid var(--gd-rule); border-radius: 10px; box-shadow: 0 8px 30px rgba(0, 0, 0, .18); padding: 14px; }
.gd-drill[hidden] { display: none; }
.gd-drill-title { font-weight: 600; margin-bottom: 8px; padding-right: 24px; }
.gd-drill-close { position: absolute; right: 8px; top: 6px; border: 0; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: var(--gd-muted); }

.gd-root button:focus-visible, .gd-root select:focus-visible, .gd-root input:focus-visible { outline: 2px solid var(--gd-primary); outline-offset: 2px; }

/* Code widgets on the full screen (design/24 phase 4b, step 11): the stand-in draws at once; the host's frame lies over
   it, unseen until the widget says ready, and then the stand-in hides (widget documents are transparent). Print, and any
   stop, show the stand-in. */
.gd-code { position: relative; }
.gd-code-titled { display: flex; flex-direction: column; }
.gd-code-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.gd-gauge-note { flex: none; font-size: 11px; line-height: 15px; color: var(--gd-muted); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gd-code-standin { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.gd-code-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; opacity: 0; pointer-events: none; background: transparent; }
/* A code frame's colour scheme is set inline to the dashboard's mode (codeSlotDom.ts; design/25 B1). */
.gd-code-live > .gd-code-frame { opacity: 1; pointer-events: auto; }
.gd-code-live > .gd-code-standin { visibility: hidden; }
.gd-code-label { position: absolute; right: 8px; bottom: 6px; max-width: calc(100% - 16px); padding: 2px 8px; border-radius: 999px; background: var(--gd-muted-surface, rgba(127, 127, 127, 0.12)); color: var(--gd-muted); font-size: 11px; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gd-code-label[hidden] { display: none; }
@media print {
  .gd-code-frame, .gd-code-label { display: none !important; }
  .gd-code-live > .gd-code-standin { visibility: visible; }
}
