/* ============================================================
   digiview.sh: the console kit (js/kit.js renders the markup).
   Recreates Digiview's console (shadcn/Tailwind components in
   web/src/components/ui, spec 09 tokens) at demo scale. The tokens
   are the page's own (css/tokens.css), so the app follows the OS
   theme like the site. Everything is scoped under .app (k-* classes);
   the wall screens (.scr) are always on Ink, whatever the theme.
   Sizes are the product's px; .app is zoomed per width tier, and
   every caption under 13px is written max(<px>, var(--ix-fmin)) so
   nothing renders under 11px on screen.
   ============================================================ */

.ix-wrap { container: ixapp / inline-size; position: relative; }
.app {
  --ix-zoom: .82;
  --ix-fmin: calc(11.02px / var(--ix-zoom));
  zoom: var(--ix-zoom);
  position: relative; text-align: left; color: var(--text);
  font-family: var(--font-sans); font-size: 15px; line-height: 22px; font-feature-settings: "tnum";
}
@container ixapp (max-width: 799px) { .app { --ix-zoom: .8; } }
@container ixapp (max-width: 559px) { .app { --ix-zoom: .9; } .app .hide-sm { display: none !important; } }
@container ixapp (max-width: 419px) { .app { --ix-zoom: .86; } }
.app * { box-sizing: border-box; }
.app section { padding: 0; }
.app h2, .app h3, .app h4 { letter-spacing: 0; }
.app .k-ic { display: inline-block; flex: none; }

/* Window: a console page in a light frame (the browser chrome is drawn, never real). */
.k-window { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--canvas); box-shadow: var(--elev-md); }
.k-win-bar { display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 14px; background: var(--surface); border-bottom: 1px solid var(--border); }
.k-win-lights { display: flex; gap: 6px; }
.k-win-lights i { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.k-win-url { flex: 1; min-width: 0; text-align: center; color: var(--text-muted); font-size: max(12px, var(--ix-fmin)); font-family: var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-win-body { padding: 20px 24px 22px; }

.k-live { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; border: 1px solid; font-size: max(12px, var(--ix-fmin)); font-weight: 500; white-space: nowrap; }
.k-live i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.k-live-live { color: var(--success); border-color: color-mix(in srgb, var(--success) 40%, transparent); background: color-mix(in srgb, var(--success) 10%, transparent); }
.k-live-reconnecting, .k-live-connecting { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 40%, transparent); background: color-mix(in srgb, var(--warning) 10%, transparent); }

.k-ph { margin-bottom: 18px; }
.k-h1 { font-size: 24px; line-height: 32px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.k-ph-d { margin-top: 4px; color: var(--text-muted); font-size: 15px; line-height: 22px; max-width: 72ch; }

/* Card */
.k-card { display: flex; flex-direction: column; gap: 16px; padding: 20px 0; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--elev-sm); min-width: 0; }
.k-card-h { display: grid; gap: 4px; padding: 0 20px; }
.k-card-t { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-size: 18px; line-height: 26px; font-weight: 600; letter-spacing: 0; }
.k-card-d { margin: 0; color: var(--text-muted); font-size: max(14px, var(--ix-fmin)); line-height: 20px; }
.k-card-c { padding: 0 20px; min-width: 0; }

/* Badge */
.k-badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: max(13px, var(--ix-fmin)); line-height: 18px; font-weight: 500; white-space: nowrap; width: fit-content; }
.k-b-ok { background: var(--success-subtle); color: var(--success); }
.k-b-warn { background: var(--warning-subtle); color: var(--warning); }
.k-b-bad { background: var(--danger-subtle); color: var(--danger); }
.k-b-info { background: var(--info-subtle); color: var(--info); }
.k-b-outline { box-shadow: inset 0 0 0 1px var(--border); color: var(--text); }
.k-b-secondary { background: var(--surface-sunken); color: var(--text-muted); box-shadow: inset 0 0 0 1px var(--border); }
.k-b-brand { background: var(--brand-subtle); color: var(--text-brand); }
.k-b-l0 { background: var(--layer-l0); color: var(--on-fill); }
.k-b-l2 { background: var(--layer-l2); color: var(--on-fill); }
.k-b-house { background: var(--layer-house); color: var(--on-fill); }
.k-badge.is-pop { animation: dv-fade-in var(--dur-fade) var(--curve-out) backwards, dv-pop var(--dur-spring-bouncy) var(--spring-bouncy) backwards; --dv-pop-from: var(--motion-pop-glyph); }

/* Table */
.k-table-wrap { position: relative; width: 100%; overflow: hidden; border-radius: 10px; }
.k-table { width: 100%; border-collapse: collapse; font-size: max(14px, var(--ix-fmin)); line-height: 20px; }
.k-table th { height: 36px; padding: 0 8px; background: var(--surface-sunken); color: var(--text-muted); font-size: max(13px, var(--ix-fmin)); font-weight: 500; text-align: left; white-space: nowrap; }
.k-table th:first-child { border-top-left-radius: 10px; }
.k-table th:last-child { border-top-right-radius: 10px; }
.k-table td { height: 34px; padding: 4px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.k-table tr:last-child td { border-bottom: 0; }
.k-table .k-muted { color: var(--text-muted); font-size: max(12px, var(--ix-fmin)); }
.k-table td.k-wrap { white-space: normal; font-size: max(12px, var(--ix-fmin)); line-height: 16px; }
.k-table .k-name { font-weight: 500; }
.k-table tr.is-flash td { animation: k-flash 1.4s var(--curve-out); }
@keyframes k-flash { from { background: var(--brand-subtle); } to { background: transparent; } }

/* Button */
.k-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent; font-size: 15px; font-weight: 500; white-space: nowrap; transition: scale var(--dur-spring-snappy) var(--spring-snappy); }
.k-btn-default { background: var(--brand); color: var(--text-on-brand); }
.k-btn-outline { border-color: var(--border-strong); background: var(--surface); color: var(--text); box-shadow: var(--elev-sm); }
.k-btn-ghost { color: var(--text); }
.k-btn-sm { height: 32px; padding: 0 12px; border-radius: 6px; font-size: max(14px, var(--ix-fmin)); }
.k-btn-icon { width: 40px; padding: 0; color: var(--text-muted); }
.k-btn.is-press { scale: var(--motion-press); transition-duration: var(--dur-press); transition-timing-function: var(--curve-out); }
.k-btn .k-dots { display: inline-flex; gap: 4px; }
.k-btn .k-dots i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .45; }
.k-btn .k-dots i.on { opacity: 1; translate: 0 -3px; }

/* Forms (the booking draft) */
.k-form { display: grid; gap: 16px; }
.k-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.k-field { display: grid; gap: 6px; min-width: 0; }
.k-label { font-size: max(14px, var(--ix-fmin)); font-weight: 500; line-height: 20px; }
.k-input { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 15px; min-width: 0; white-space: nowrap; overflow: hidden; }
.k-input.is-empty { color: var(--text-muted); }
.k-input.is-focus { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.k-input .k-caret { width: 1.5px; height: 18px; background: var(--text); margin-left: -6px; }
.k-input .k-ic { margin-left: auto; color: var(--text-muted); }
.k-hint { color: var(--text-muted); font-size: max(13px, var(--ix-fmin)); line-height: 18px; }
.k-check { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-size: max(14px, var(--ix-fmin)); }
.k-check i { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--border-strong); display: grid; place-items: center; color: var(--text-on-brand); flex: none; }
.k-check.on i { background: var(--brand); border-color: var(--brand); }
.k-check small { display: block; color: var(--text-muted); font-size: max(12px, var(--ix-fmin)); line-height: 16px; }
.k-stepper { display: flex; align-items: center; gap: 8px; }
.k-stepper .k-input { width: 64px; justify-content: center; }

/* Definition list (validation, screen detail) */
.k-dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 16px; margin: 0; font-size: max(14px, var(--ix-fmin)); line-height: 20px; }
.k-dl dt { color: var(--text-muted); }
.k-dl dd { margin: 0; }
.k-conflict { margin-top: 8px; padding: 2px 8px; border-radius: 4px; background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); font-size: max(12px, var(--ix-fmin)); line-height: 16px; }
.k-h4 { margin: 0 0 4px; font-size: max(14px, var(--ix-fmin)); font-weight: 500; }
.k-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; font-size: max(12px, var(--ix-fmin)); line-height: 16px; }
.k-list li.is-pick { color: var(--text-brand); font-weight: 600; }

/* Stat (Plays today) */
.k-stat { display: grid; gap: 2px; }
.k-stat-l { color: var(--text-muted); font-size: max(13px, var(--ix-fmin)); }
.k-stat-v { font-size: 32px; line-height: 40px; font-weight: 700; letter-spacing: -0.02em; font-feature-settings: "tnum"; }
.k-roll { display: inline-block; animation: dv-roll-in var(--dur-spring-snappy) var(--spring-snappy); }

/* Loop strip (schedule/loop-visualiser.tsx): booked by line item, house grey, free outlined */
.k-loop { position: relative; display: flex; gap: 2px; height: 44px; }
.k-slot { position: relative; display: flex; flex-direction: column; justify-content: center; flex-basis: 0; min-width: 0; padding: 0 8px; border-radius: 6px; overflow: hidden; white-space: nowrap; font-size: max(12px, var(--ix-fmin)); line-height: 15px; color: var(--on-fill); }
.k-slot b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.k-slot small { opacity: .85; font-size: max(11px, var(--ix-fmin)); }
.k-slot-a { background: var(--layer-l2); }
.k-slot-b { background: var(--chart-1); }
.k-slot-c { background: var(--chart-2); }
.k-slot-house { background: var(--layer-house); }
.k-slot-free { background: var(--canvas); color: var(--text-muted); box-shadow: inset 0 0 0 1px var(--border); background-image: repeating-linear-gradient(135deg, transparent 0 6px, var(--line-soft) 6px 8px); }
.k-slot.is-new { transform-origin: 50% 100%; animation: dv-fade-in var(--dur-fade) var(--curve-out) backwards, dv-pop var(--dur-spring-bouncy) var(--spring-bouncy) backwards; --dv-pop-from: var(--motion-pop-glyph); }
.k-playhead { position: absolute; top: -4px; bottom: -4px; width: 2px; border-radius: 2px; background: var(--text); box-shadow: 0 0 0 2px var(--surface); }
.k-loop-ticks { display: flex; justify-content: space-between; margin-top: 4px; color: var(--text-muted); font-size: max(11px, var(--ix-fmin)); }

/* ---------- Wall screens: always Ink, 16:9, signage ratios (1 unit = 1/1080 of the height) ---------- */
.scr { position: relative; padding: 5%; padding: max(4px, 2.2%); border-radius: 10px; background: #0b0b10; box-shadow: 0 10px 24px -10px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,.06); }
.scr-panel { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 3px; background: #191923; container-type: size; --sg: calc(100cqh / 1080); color: #f6f5f2; }
.scr-panel > * { position: absolute; inset: 0; }
.scr-label { margin: 6px 0 0; color: var(--text-muted); font-size: max(12px, var(--ix-fmin)); line-height: 16px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scr.is-off .scr-panel { background: #000; }

/* Ads: flat fields and an Inter headline, deterministic art for the seed's advertisers */
.ad { display: grid; align-content: end; padding: calc(96 * var(--sg)) calc(110 * var(--sg)); overflow: hidden; }
.ad b { position: relative; font-size: calc(150 * var(--sg)); line-height: 1; font-weight: 800; letter-spacing: -0.03em; }
.ad span { position: relative; margin-top: calc(28 * var(--sg)); font-size: calc(52 * var(--sg)); font-weight: 600; opacity: .9; }
.ad-kopi { background: #3b2418; color: #f3e3c8; }
.ad-kopi .ad-cup { position: absolute; right: calc(140 * var(--sg)); top: calc(160 * var(--sg)); width: calc(560 * var(--sg)); height: calc(560 * var(--sg)); border-radius: 50%; background: #c8873e; box-shadow: 0 0 0 calc(60 * var(--sg)) #5a3826; }
.ad-hawker { background: #f2a541; color: #191923; }
.ad-hawker .ad-band { position: absolute; left: 0; right: 0; top: calc(130 * var(--sg)); height: calc(170 * var(--sg)); background: #1a8079; box-shadow: 0 calc(240 * var(--sg)) 0 #e85d3a; }
.ad-run { background: #0060c1; color: #ffffff; }
.ad-run .ad-stripes { position: absolute; inset: 0; background: repeating-linear-gradient(-30deg, transparent 0 calc(120 * var(--sg)), rgba(232,226,255,.16) calc(120 * var(--sg)) calc(200 * var(--sg))); }
.ad-house { background: #7755e8; color: #ffffff; align-content: center; justify-items: start; }
.ad-house .ad-sym { width: calc(180 * var(--sg)); height: auto; margin-bottom: calc(50 * var(--sg)); }
.ad-black { background: #000; }

/* Device states (screens.md; internal/media/idlegen): idle with the clock, the stinger */
.dv-idle { background: #191923; }
.dv-idle .dv-glow { position: absolute; inset: -6%; background: radial-gradient(45% 60% at 35% 45%, #2c2551, transparent 72%); }
.dv-idle .dv-lock { position: absolute; left: calc(96 * var(--sg)); top: calc(54 * var(--sg)); width: calc(320 * var(--sg)); height: auto; }
.dv-idle .dv-time { position: absolute; left: calc(108 * var(--sg)); top: calc(190 * var(--sg)); font-size: calc(140 * var(--sg)); line-height: calc(152 * var(--sg)); font-weight: 600; letter-spacing: -0.02em; color: #f6f5f2; font-feature-settings: "tnum"; }
.dv-idle .dv-date { position: absolute; left: calc(108 * var(--sg)); top: calc(350 * var(--sg)); font-size: calc(48 * var(--sg)); line-height: calc(64 * var(--sg)); color: #a9a7b8; }
.dv-idle .dv-line { position: absolute; left: calc(96 * var(--sg)); top: calc(740 * var(--sg)); font-size: calc(80 * var(--sg)); line-height: calc(96 * var(--sg)); font-weight: 600; letter-spacing: -0.01em; color: #f6f5f2; }
.dv-sting { display: grid; place-items: center; background: #191923; }
.dv-sting svg { width: 46%; height: auto; overflow: visible; }

/* Clock overlay chip used by the demos (outside the panel, never on it) */
.k-clockchip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); font-size: max(13px, var(--ix-fmin)); font-weight: 600; font-feature-settings: "tnum"; color: var(--text); }
.k-clockchip .k-ic { color: var(--text-brand); }

/* Column and block hiding by the stage's width (the product's own tables scroll instead). */
@container ixapp (max-width: 1099px) { .app .hide-lg { display: none !important; } }
@container ixapp (max-width: 799px) { .app .hide-md { display: none !important; } }

/* Text on a small panel would fall under the 11 px floor: drop it, keep the art (the panel is a size container). */
@container (max-height: 300px) { .ad span, .dv-idle .dv-date { display: none; } }
@container (max-height: 190px) { .dv-idle .dv-line { display: none; } }
@container (max-height: 110px) { .ad b, .dv-idle .dv-time { display: none; } }
