/* =====================================================================
 * setup-brand.css — fresh brand-aligned stylesheet for setup-brand.html
 *
 * Tier:  Demo page (web.pages.gitlab.nanocosmos.cloud)
 * Fonts: Lexend Deca (display, Google Fonts) + Source Sans 3 (body, Google Fonts)
 *        Cocogoose is reserved for marketing surfaces and is never loaded here.
 * Tokens: see :root below — canonical brand tokens from
 *        nanocosmos-brand-guidelines/references/web-css-shared.md.
 *
 * Built from scratch — no rules borrowed from styles.css. Only the layout
 * primitives (workbench grid, upload grid, sections, sticky preview,
 * sliders + value-input shape) are preserved by intent.
 * ===================================================================== */


/* ---------- Brand tokens (light demo theme) ---------- */
:root {
    /* Brand colors */
    --orange:          #F48220;
    --orange-dark:     #EF7D00;
    --blue:            #0F8DC8;
    --blue-dark:       #0A6FA0;
    --navy:            #00486C;
    --hero-navy:       #0A436A;
    --platform-navy:   #0E2A3F;

    /* Surfaces */
    --bg:              #FFFFFF;
    --bg-soft:         #EFF2F4;
    --bg-sunken:       #EFF2F4;
    --bg-card:         #FFFFFF;
    --bg-dark:         #00486C;

    /* Text */
    --ink:             #0F8DC8;
    --muted:           #0F8DC8;
    --grey:            #0F8DC8;
    --text-on-dark:    #FFFFFF;
    --text-on-dark-soft: #C9D8E2;

    /* Lines */
    --line:            #E5E5E5;
    --line-strong:     #D2D7DC;
    --line-faint:      #EEF1F3;

    /* Status (brand-friendly) */
    --ok:              #2E7D32;
    --ok-soft:         #E8F4E9;
    --err:             #C0392B;
    --err-soft:        #FDECEA;
    --warn:            #B26A00;
    --warn-soft:       #FDF1DE;

    /* Typography */
    --font-display:    'Lexend Deca', Helvetica, Arial, sans-serif;
    --font-body:       'Source Sans 3', 'Open Sans', Helvetica, Arial, sans-serif;
    --font-mono:       ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* Geometry */
    --container:       1400px;
    --radius:          8px;
    --radius-sm:       6px;
    --radius-lg:       12px;
    --shadow-sm:       0 1px 2px rgba(0, 72, 108, 0.06);
    --shadow:          0 4px 18px rgba(0, 72, 108, 0.08);
    --shadow-lg:       0 12px 48px rgba(0, 72, 108, 0.14);
}


/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { background:
    radial-gradient(ellipse at top left, rgba(15, 141, 200, 0.7) 0%, transparent 55%) fixed,
    linear-gradient(260deg, #2b87da 0%, #00486c 55%, #05283d 100%) fixed; }

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    background:
    radial-gradient(ellipse at top left, rgba(15, 141, 200, 0.7) 0%, transparent 55%) fixed,
    linear-gradient(260deg, #2b87da 0%, #00486c 55%, #05283d 100%) fixed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.2;
    color: var(--navy);
    margin: 0 0 12px;
    letter-spacing: 0;
    text-transform: none;
}
h1 { font-size: clamp(24px, 3.2vw, 32px); line-height: 1.15; }
h3 { font-size: 18px; }
h4 { font-size: 14px; }

p { margin: 0 0 12px; }

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); text-decoration: underline; }

code, pre { font-family: var(--font-mono); font-size: 0.9em; }
code { background: var(--bg-sunken); padding: 1px 6px; border-radius: 4px; color: var(--navy); }

::selection { background: rgba(15, 141, 200, 0.22); }

.hidden { display: none !important; }


/* ---------- Demo header (brand: navy bg, logo + title) ---------- */
.demo-header {
    background: var(--navy);
    padding: 16px 24px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 30;
}

.demo-header-inner {
    max-width: var(--container);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.demo-logo-link { display: inline-flex; align-items: center; }
.demo-logo      { height: 28px; width: auto; display: block; }
.studio-logo    { height: 34px; width: auto; display: block; flex: none; }

.demo-header-titles { display: flex; flex-direction: column; min-width: 0; }
.demo-eyebrow {
    margin: 0;
    color: #fff;
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.demo-title {
    margin: 2px 0 0;
    color: #fff;
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.15;
}

.demo-header-meta { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.demo-chip {
    font-family: var(--font-body);
    font-size: 12px;
    color: #fff;
    padding: 5px 10px;
    border: 1px solid var(--blue);
    border-radius: 999px;
    background: var(--blue);
}


/* ---------- Page layout ---------- */
body > details,
body > #configurationSection,
body > script + footer { /* sections live directly under body */ }

/* Outer page padding wrapper using direct child rules */
body > details.section,
body > #configurationSection {
    width: min(calc(100% - 48px), var(--container));
    margin: 16px auto;
}


/* ---------- Section card ---------- */
.section,
details.section {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 18px 22px;
    margin: 0 0 16px;
}

.section h3 { margin: 0 0 16px; }

/* Collapsible <details>/<summary> as section header */
details.collapsible > summary {
    list-style: none;
    cursor: pointer;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    background: var(--blue);
    width: fit-content;
    padding: 8px 16px 8px 34px;
    margin: 0 0 14px;
    border-radius: var(--radius-sm);
    position: relative;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 12px;
}
details.collapsible > summary > select {
    width: auto;
    margin: 0;
    padding: 4px 8px;
    font-size: 13px;
    background: var(--bg);
    color: var(--ink);
    border: 1px solid var(--line-strong);
    border-left: 3px solid var(--orange);
    cursor: pointer;
}
details.collapsible:not([open]) > summary { margin-bottom: 0; }
details.collapsible { padding-top: 12px; padding-bottom: 12px; }
details.collapsible > summary::-webkit-details-marker { display: none; }
details.collapsible > summary::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: translateY(-65%) rotate(-45deg);
    transition: transform 0.18s ease;
}
details.collapsible[open] > summary::before {
    transform: translateY(-50%) rotate(45deg);
}

.section-subhead {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 13px;
    color: var(--navy);
    margin: 20px 0 10px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.section-actions { margin-top: 20px; }


/* ---------- Forms ---------- */
label {
    display: block;
    margin: 0 0 6px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 13px;
    color: var(--navy);
    letter-spacing: 0.01em;
}

input,
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    margin: 0 0 14px;
    border: 1px solid var(--line-strong);
    border-left: 3px solid var(--orange);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.4;
    transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder, textarea::placeholder { color: var(--grey); }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--blue);
    border-left-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(15, 141, 200, 0.18);
}
input[type="checkbox"], input[type="radio"] {
    width: 16px; height: 16px;
    margin: 0;
    flex: 0 0 auto;
    border: 0;
    border-left: 0;
    background: transparent;
    padding: 0;
    accent-color: var(--orange);
}

textarea {
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.55;
    min-height: 110px;
    resize: vertical;
}

/* Range sliders */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 22px;
    padding: 0;
    margin: 0 0 4px;
    border: 0;
    background: transparent;
    cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    background: var(--line-strong);
    border-radius: 999px;
}
input[type="range"]::-moz-range-track {
    height: 4px;
    background: var(--line-strong);
    border-radius: 999px;
    border: 0;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px; height: 16px;
    margin-top: -6px;
    border-radius: 50%;
    background: var(--orange);
    border: 2px solid #fff;
    box-shadow: var(--shadow-sm);
    transition: transform 0.12s, box-shadow 0.12s;
}
input[type="range"]::-moz-range-thumb {
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--orange);
    border: 2px solid #fff;
    box-shadow: var(--shadow-sm);
}
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.1); box-shadow: 0 0 0 4px rgba(244, 130, 32, 0.18); }

input[type="range"].red::-webkit-slider-thumb,   input[type="range"].red::-moz-range-thumb   { background: #E53935; }
input[type="range"].green::-webkit-slider-thumb, input[type="range"].green::-moz-range-thumb { background: #2E8B57; }
input[type="range"].blue::-webkit-slider-thumb,  input[type="range"].blue::-moz-range-thumb  { background: var(--blue); }


/* ---------- Buttons ---------- */
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 14px;
    line-height: 1;
    letter-spacing: 0.01em;
    color: #fff;
    background: var(--orange);
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.06s, box-shadow 0.15s;
    margin-right: 8px;
}
button:hover { background: var(--orange-dark); }
button:active { transform: translateY(1px); }
button:focus-visible { outline: 3px solid rgba(15, 141, 200, 0.35); outline-offset: 2px; }
button:disabled {
    background: var(--line);
    color: var(--grey);
    cursor: not-allowed;
    opacity: 0.85;
}

/* Secondary — blue */
.btn-secondary {
    background: var(--blue);
    color: #fff;
}
.btn-secondary:hover { background: var(--blue-dark); }

/* Tertiary — outline navy (low emphasis utility actions) */
.btn-xs {
    background: var(--orange);
    color: #fff;
    border: 1px solid var(--orange);
}
.btn-xs:hover {
    background: var(--orange-dark);
    border-color: var(--orange-dark);
}
.btn-outline {
    background: var(--bg);
    color: var(--blue);
    border: 1px solid var(--blue);
}
.btn-outline:hover {
    color: #fff;
    border-color: var(--blue-dark);
    background: var(--blue);
}

/* Size variants */
.btn-sm { padding: 8px 14px; font-size: 13px; margin: 0; white-space: nowrap; }
.btn-xs { padding: 5px 10px; font-size: 12px; margin: 0; }
.btn-glyph { color: #fff; font-size: 12px; line-height: 1; }

/* Hidden native color-picker — keeps label clickable */
.native-picker-hidden {
    width: 0; height: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    position: absolute;
    pointer-events: none;
}


/* ---------- Layout helpers ---------- */
.form-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
}
.form-row.tight { gap: 6px; }
.form-row.wrap  { flex-wrap: wrap; }
.form-row > label { margin: 0; white-space: nowrap; flex-shrink: 0; }
.form-row > .grow { flex: 1; min-width: 0; }
.form-row > input,
.form-row > select { margin: 0; }

.action-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.action-row > .grow { flex: 1; min-width: 0; }

.adj-status-row { margin-top: 10px; min-height: 0; }
.adj-status-row:empty { display: none; }

.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.overlay-center {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}


/* ---------- Info / banner / result ---------- */
.info {
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-left: 3px solid var(--line-strong);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin: 8px 0;
    font-size: 13px;
    color: var(--ink);
}
.info.sm { font-size: 12px; padding: 8px 12px; margin-bottom: 12px; }
.info code { background: rgba(15, 141, 200, 0.12); color: var(--navy); padding: 1px 6px; border-radius: 4px; }

.result {
    background: var(--bg-sunken);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-top: 10px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--ink);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 320px;
    overflow-y: auto;
}
.success { background: var(--bg-sunken); border-left: 3px solid var(--line-strong); color: var(--ink); }
.error   { background: var(--err-soft); border-left: 3px solid var(--err); color: #8E1A0B; }


/* ---------- Mode tabs (Create / Reuse) ---------- */
.mode-tabs-row {
    display: flex;
    gap: 10px;
    margin: 4px 0 18px;
}
.mode-tab {
    flex: 1;
    padding: 6px 16px;
    margin: 0;
    border-radius: var(--radius);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
}
.mode-tab.left {
    background: var(--bg);
    color: var(--orange);
    border: 1px solid var(--orange);
}
.mode-tab.left:hover,
.mode-tab.left.active {
    background: var(--orange);
    color: #fff;
    border-color: var(--orange);
}
.mode-tab.left.active:hover { background: var(--orange-dark); border-color: var(--orange-dark); }
.mode-tab.right {
    background: var(--bg);
    color: var(--blue);
    border: 1px solid var(--blue);
}
.mode-tab.right:hover,
.mode-tab.right.active {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}
.mode-tab.right.active:hover { background: var(--blue-dark); border-color: var(--blue-dark); }

/* ---------- Auth tabs (API Key | Email & Password) — pill/segmented ---------- */
.auth-tabs-row {
    display: inline-flex;
    gap: 0;
    margin: 4px 0 10px;
    border: 1px solid var(--blue);
    border-radius: var(--radius);
    overflow: hidden;
}
.auth-tab {
    padding: 5px 16px;
    margin: 0;
    border-radius: 0;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    background: var(--bg);
    color: var(--blue);
    border: 0;
    transition: background 0.15s, color 0.15s;
}
.auth-tab + .auth-tab { border-left: 1px solid var(--blue); }
.auth-tab:hover { background: rgba(15, 141, 200, 0.08); }
.auth-tab.active { background: var(--blue); color: #fff; }
.auth-tab.active:hover { background: var(--blue-dark); }
.auth-pane { /* shown/hidden by JS */ }

/* ---------- Chroma section (light card inside a section) ---------- */
.chroma-section {
    background: var(--bg-sunken);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    margin: 0 0 14px;
}
.chroma-section h4 {
    margin: 0 0 12px;
    color: var(--navy);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.slider-header label { margin: 0; }

.value-badge,
.value-input {
    display: inline-block;
    min-width: 56px;
    padding: 3px 10px;
    background: var(--orange);
    color: #fff;
    border: 1px solid var(--orange);
    border-radius: 999px;
    text-align: center;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
}
.value-input {
    width: 76px;
    margin: 0;
    -moz-appearance: textfield;
}
.value-input::-webkit-outer-spin-button,
.value-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.value-input:focus { outline: 2px solid #fff; outline-offset: -3px; }

.param-slider { width: 100%; margin: 0 0 6px; }

.help-text {
    font-size: 12.5px;
    color: var(--muted);
    margin: 8px 0 0;
    line-height: 1.45;
}


/* ---------- Key Color picker ---------- */
.color-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--ink);
}
.color-indicator .swatch-box {
    width: 22px; height: 22px;
    border-radius: 6px;
    background: #00FF00;
    border: 2px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.preset-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    margin: 0;
    background: var(--bg);
    color: var(--navy);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.preset-btn:hover:not(.active) {
    border-color: var(--navy);
    background: var(--bg-sunken);
}
.preset-btn.active {
    background: var(--orange);
    border-color: var(--orange);
    color: #fff;
}
.preset-btn .swatch {
    width: 16px; height: 16px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
    display: inline-block;
}
.preset-btn .swatch.green { background: #00FF00; }
.preset-btn .swatch.blue  { background: #0057FF; }
.preset-btn.picker-label  { cursor: pointer; }

.color-compact {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 16px;
    align-items: start;
}
.color-left  { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.color-right { display: flex; flex-direction: column; gap: 10px; }
.color-preview-compact {
    width: 76px; height: 76px;
    border-radius: 10px;
    background: #00FF00;
    border: 2px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.rgb-inline { display: flex; gap: 12px; align-items: center; }
.rgb-channel { display: flex; gap: 8px; align-items: center; flex: 1; min-width: 0; }
.rgb-label   { font-size: 12px; font-weight: 700; width: 14px; text-align: center; }
.rgb-label.red   { color: #E53935; }
.rgb-label.green { color: #2E8B57; }
.rgb-label.blue  { color: var(--blue); }
.rgb-slider { flex: 1; margin: 0; min-width: 0; }
.rgb-value {
    width: 52px;
    margin: 0;
    padding: 4px 6px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 12px;
    color: var(--ink);
}

.hex-row-compact {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}
.hex-row-compact .hex-prefix { font-size: 14px; color: var(--muted); font-weight: 700; }
.hex-row-compact input {
    flex: 1;
    margin: 0;
    padding: 6px 10px;
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}


/* ---------- Despill control row ---------- */
.despill-fields {
    display: grid;
    grid-template-columns: auto auto minmax(240px, 1fr);
    align-items: center;
    gap: 12px;
}
.despill-enable { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; }
.despill-type   { display: inline-flex; align-items: center; gap: 8px; }
.despill-mix    { display: flex; align-items: center; gap: 10px; min-width: 0; }
.despill-mix label { margin: 0; font-size: 12px; color: var(--muted); }
.despill-mix .param-slider { flex: 1 1 auto; min-width: 90px; margin: 0; }
.despill-mix .value-input  { width: 76px; }

/* Hide sub-options when Despill/EQ checkboxes are unchecked. Keeps the
   checkbox + its label visible so users can still toggle. !important
   is required because #despillAdvanced / #eqFields use inline display:grid. */
.chroma-section:has(#despillEnabled:not(:checked)) .despill-type,
.chroma-section:has(#despillEnabled:not(:checked)) .despill-mix,
.chroma-section:has(#despillEnabled:not(:checked)) .despill-fields > button,
.chroma-section:has(#despillEnabled:not(:checked)) #despillAdvanced,
.chroma-section:has(#despillEnabled:not(:checked)) #despillPreview {
    display: none !important;
}
.chroma-section:has(#eqEnabled:not(:checked)) #eqFields,
.chroma-section:has(#eqEnabled:not(:checked)) #eqPreview {
    display: none !important;
}

.color-radio {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 7px 12px;
    background: var(--bg);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    color: var(--ink);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.color-radio input { position: absolute; opacity: 0; pointer-events: none; }
.color-radio-square {
    width: 20px; height: 20px;
    border: 2px solid #fff;
    border-radius: 5px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}
.color-radio-green .color-radio-square { background: #00FF00; }
.color-radio-blue .color-radio-square  { background: #0057FF; }
.color-radio:has(input:checked) {
    border-color: var(--orange);
    box-shadow: 0 0 0 2px rgba(244, 130, 32, 0.22);
    color: var(--navy);
}


/* ---------- Stream info table ---------- */
#streamInfo { margin: 6px 0 18px; }

.stream-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
    margin-bottom: 12px;
}
.stream-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.stream-table th,
.stream-table td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    white-space: nowrap;
}
.stream-table th {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    color: var(--navy);
    background: var(--bg-sunken);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.stream-table tr:last-child td { border-bottom: 0; }
.stream-table tr:hover td { background: rgba(15, 141, 200, 0.05); }
.stream-table .mono {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 12.5px;
    padding: 2px 8px;
    background: var(--bg-sunken);
    color: var(--navy);
    border-radius: 6px;
    -webkit-user-select: all;
    user-select: all;
}
.stream-table a.mono { color: var(--blue); background: var(--bg-sunken); }
.stream-table a.mono:hover { color: var(--blue-dark); text-decoration: underline; }
.stream-table .stream-bg-select,
.stream-table .stream-bg-input {
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 4px;
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--text);
    max-width: 260px;
    width: 100%;
}
.stream-table .copyable { cursor: pointer; color: var(--navy); }
.stream-table .copyable:hover { color: var(--blue); }
.stream-table .muted { color: var(--grey); }
.stream-table .copy-btn {
    background: transparent;
    color: var(--muted);
    border: 0;
    padding: 0 6px;
    margin: 0 0 0 4px;
    font-size: 13px;
    cursor: pointer;
    transition: color 0.15s;
}
.stream-table .copy-btn:hover { color: var(--blue); }

.stream-meta {
    font-size: 12.5px;
    color: var(--muted);
    margin: 4px 0 12px;
}
.stream-meta code { background: var(--bg-sunken); color: var(--navy); padding: 1px 6px; border-radius: 4px; }

.stream-type-badge {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}
.ingest-badge {
    background: rgba(0, 72, 108, 0.10);
    color: var(--navy);
}
.target-badge {
    background: rgba(244, 130, 32, 0.12);
    color: var(--orange-dark);
}

.bg-select {
    width: 100%;
    margin: 0;
    padding: 6px 8px;
    font-size: 13px;
}


/* ---------- Upload area + file list + preview ---------- */
.upload-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(240px, 1.1fr) minmax(280px, 1.4fr);
    gap: 16px;
    margin-top: 10px;
}
@media (max-width: 900px) { .upload-grid { grid-template-columns: 1fr; } }
.upload-grid > div { min-width: 0; }

.upload-col-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 8px;
    font-size: 13px;
}
.upload-col-title strong {
    color: var(--navy);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 13px;
}

.upload-area {
    border: 2px dashed var(--line-strong);
    border-radius: var(--radius);
    background: var(--bg-sunken);
    color: var(--muted);
    text-align: center;
    cursor: pointer;
    padding: 24px 12px;
    min-height: 130px;
    display: grid;
    place-content: center;
    gap: 4px;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--orange);
    background: #FFF6EE;
    color: var(--navy);
}
.upload-area.compact { padding: 18px 10px; font-size: 13px; }
.upload-area .drop-icon {
    width: 36px;
    height: 28px;
    margin: 0 auto 6px;
    border: 2px solid var(--orange);
    border-top-width: 8px;
    border-radius: 4px 4px 6px 6px;
    opacity: 0.95;
}

.upload-card-heading {
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin: 10px 0 8px;
    font-size: 12.5px;
}
.upload-card-heading ul {
    margin: 6px 0 0;
    padding-left: 18px;
    color: var(--muted);
    font-size: 12px;
}

.upload-progress {
    margin-top: 10px;
    padding: 10px 12px;
    background: var(--bg-sunken);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-size: 12.5px;
    color: var(--muted);
}
.upload-progress .bar {
    height: 6px;
    margin-top: 6px;
    background: var(--line);
    border-radius: 999px;
    overflow: hidden;
}
.upload-progress .fill {
    height: 100%;
    width: 0%;
    background: var(--orange);
    transition: width 0.3s;
}

.file-list-empty {
    color: var(--grey);
    font-size: 12.5px;
    padding: 18px 8px;
    text-align: center;
}
.file-list-box {
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 4px;
    max-height: 280px;
    overflow-y: auto;
}
.file-list-item {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12.5px;
    color: var(--ink);
    border: 1px solid transparent;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.file-list-item:hover    { background: var(--bg-sunken); color: var(--navy); }
.file-list-item.selected {
    background: rgba(15, 141, 200, 0.08);
    border-color: var(--blue);
    color: var(--navy);
}
.file-list-item .fname {
    font-family: var(--font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}
.file-list-item .fmeta {
    color: var(--muted);
    font-size: 11.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.preview-box {
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 20px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
}
.preview-box img,
.preview-box video {
    max-width: 100%;
    max-height: 260px;
    border-radius: var(--radius-sm);
    background: #000;
}
.preview-box .placeholder {
    color: var(--grey);
    font-size: 12.5px;
    text-align: center;
}
.preview-box .fname-line {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--muted);
    word-break: break-all;
    text-align: center;
    margin: 0;
}


/* ---------- Validation list (rendered by JS) ---------- */
.validation-item {
    list-style: none;
    padding: 7px 0;
    border-bottom: 1px solid var(--line-faint);
}
.validation-item .title { font-weight: 600; }
.validation-item .meta  { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.validation-item.ok    { color: var(--ok); }
.validation-item.warn  { color: var(--warn); }
.validation-item.err   { color: var(--err); }
.validation-item.warn .meta.accent { color: var(--warn); }
.validation-loading    { color: var(--muted); list-style: none; padding: 6px 0; }


/* ---------- Switch (inline checkbox + label) ---------- */
.switch-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    color: var(--ink);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.switch-label input[type="checkbox"] { accent-color: var(--orange); cursor: pointer; }


/* ---------- Workbench layout (preview on left, controls on right) ---------- */
.workbench-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    max-width: var(--container);
    margin: 22px auto 14px;
    padding: 16px 20px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.workbench-header .eyebrow {
    margin: 0 0 4px;
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--orange);
}
.workbench-header h3 {
    margin: 0;
    color: var(--navy);
    font-size: 20px;
}
.workbench-status {
    font-size: 12.5px;
    color: var(--muted);
    padding: 6px 12px;
    background: var(--bg-sunken);
    border: 1px solid var(--line);
    border-radius: 999px;
    white-space: nowrap;
}

.workbench-layout {
    display: grid;
    grid-template-columns: minmax(720px, 1fr) minmax(440px, 520px);
    gap: 24px;
    align-items: start;
    max-width: var(--container);
    margin: 0 auto 24px;
}
.workbench-preview,
.workbench-controls { min-width: 0; }

.workbench-preview {
    position: sticky;
    top: 96px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 16px;
}

.workbench-controls {
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 18px;
}
.workbench-controls .chroma-section { margin-bottom: 0; }
.workbench-controls > .grid-2col { grid-template-columns: 1fr; }
.workbench-controls #despillAdvanced,
.workbench-controls #eqFields { grid-template-columns: 1fr 1fr !important; gap: 12px; }
.workbench-controls .despill-fields { grid-template-columns: auto 1fr; gap: 14px; }
.workbench-controls .despill-mix {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto minmax(180px, 1fr) 76px;
    gap: 10px;
}
.workbench-controls .despill-fields > button {
    grid-column: 1 / -1;
    justify-self: start;
}
.workbench-controls > .action-row {
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin: 4px 0 0;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 -8px 24px rgba(0, 72, 108, 0.06);
}

#configurationSection {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
    margin: 16px auto;
}
#configurationSection > .section,
#configurationSection > .mode-tabs-row,
#configurationSection > h3,
#configurationSection > h4,
#configurationSection > .section-subhead,
#configurationSection > #targetCountRow,
#configurationSection > #streamInfo,
#configurationSection > #createPane,
#configurationSection > #reusePane {
    max-width: var(--container);
    margin-left: auto;
    margin-right: auto;
}
#configurationSection > h3 {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 18px 22px;
    margin: 0 0 16px;
}
#configurationSection > h4,
#configurationSection > .section-subhead,
#configurationSection > #targetCountRow,
#configurationSection > #streamInfo,
#configurationSection > #createPane,
#configurationSection > #reusePane,
#configurationSection > .mode-tabs-row {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 18px 22px;
    margin: 0 0 16px;
}
#configurationSection > .mode-tabs-row { padding: 8px 22px; }

/* Adjust-panel (legacy; kept hidden by JS but styled for completeness) */
.adjust-panel {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 18px;
    margin: 14px 0;
}
.adjust-panel > h4 { color: var(--navy); font-size: 14px; margin: 0 0 12px; }
.adj-mode {
    padding: 6px 14px;
    background: var(--bg);
    color: var(--navy);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    font-size: 12px;
    cursor: pointer;
}
.adj-mode.active { background: var(--orange); border-color: var(--orange); color: #fff; }


/* ---------- Player section ---------- */
.player-section { margin: 0; }
.player-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.player-header h4 {
    margin: 0;
    color: var(--navy);
    font-family: var(--font-display);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.player-tabs-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    min-height: 36px;
}
.player-tab {
    padding: 7px 14px;
    margin: 0;
    background: var(--bg);
    color: var(--navy);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.player-tab:hover {
    border-color: var(--navy);
    background: var(--bg-sunken);
}
.player-tab.active {
    background: var(--orange);
    border-color: var(--orange);
    color: #fff;
}

.player-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--line);
}
#playerDiv { width: 100%; height: 100%; }
#playerDiv > * { max-width: 100%; }
.player-placeholder {
    color: rgba(255, 255, 255, 0.55);
    font-size: 13px;
    text-align: center;
}


/* ---------- Text helpers ---------- */
.text-muted    { color: var(--muted); font-size: 12.5px; }
.text-muted-sm { color: var(--muted); font-size: 11.5px; }


/* ---------- Demo footer ---------- */
.demo-footer {
    background: var(--orange);
    padding: 18px 24px;
    margin-top: 48px;
}
.demo-footer-inner {
    max-width: var(--container);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: #fff;
}
.demo-footer-inner a { color: #fff; }
.demo-footer-inner a:hover { color: rgba(255,255,255,0.75); }

.page-version {
    display: flex;
    gap: 8px;
    font-family: var(--font-body);
    font-size: 12px;
    color: #fff;
    letter-spacing: 0.02em;
}


/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
    .workbench-layout { grid-template-columns: 1fr; }
    .workbench-preview { position: static; }
    .player-stage { min-height: 0; }
}

@media (max-width: 760px) {
    body { font-size: 14.5px; }
    .demo-header-inner { gap: 12px; }
    .demo-header-meta { display: flex; }
    .section, details.section,
    #configurationSection > h3,
    #configurationSection > h4,
    #configurationSection > .section-subhead,
    #configurationSection > #targetCountRow,
    #configurationSection > #streamInfo,
    #configurationSection > #createPane,
    #configurationSection > #reusePane,
    #configurationSection > .mode-tabs-row,
    .workbench-header,
    .workbench-preview,
    .workbench-controls { padding: 14px; }
    .grid-2col,
    .workbench-controls #despillAdvanced,
    .workbench-controls #eqFields,
    .despill-fields { grid-template-columns: 1fr !important; }
    .color-compact { grid-template-columns: 1fr; }
    .mode-tabs-row { flex-direction: column; }
    .mode-tab.left, .mode-tab.right { margin: 0 0 4px; }
    .btn-sm, .btn-xs, button { width: 100%; margin-right: 0; }
}


/* ---------- Dark grey workspace theme ---------- */
:root {
    --orange: #ff821f;
    --orange-dark: #f06f12;
    --blue: #1f9bd1;
    --blue-dark: #1479a8;
    --navy: #f2f4f6;
    --hero-navy: #f2f4f6;
    --platform-navy: #23272d;

    --bg: #15171b;
    --bg-soft: #1d2025;
    --bg-sunken: #101216;
    --bg-card: #24282e;
    --bg-dark: #1e2227;
    --surface-2: #30363d;

    --ink: #e8edf2;
    --text: #e8edf2;
    --muted: #9da6b0;
    --grey: #8f98a3;
    --text-muted: #9da6b0;
    --text-on-dark: #ffffff;
    --text-on-dark-soft: #b7c0ca;

    --line: #3a4048;
    --line-strong: #4a515b;
    --line-faint: rgba(255, 255, 255, 0.07);
    --border: #3a4048;

    --ok: #44c767;
    --ok-soft: rgba(68, 199, 103, 0.13);
    --err: #ff6b5f;
    --err-soft: rgba(255, 107, 95, 0.13);
    --warn: #ffc15a;
    --warn-soft: rgba(255, 193, 90, 0.14);
    --accent-green: #34d163;

    --container: 1520px;
    --radius: 6px;
    --radius-sm: 5px;
    --radius-lg: 9px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
    --shadow: 0 12px 34px rgba(0, 0, 0, 0.24);
    --shadow-lg: 0 22px 70px rgba(0, 0, 0, 0.34);
}

html {
    background: #0d0f12;
}

body {
    color: var(--ink);
    background:
        linear-gradient(180deg, rgba(8, 72, 105, 0.16) 0, rgba(8, 72, 105, 0) 180px) fixed,
        linear-gradient(135deg, #13171b 0%, #0f1216 54%, #0b0d10 100%) fixed;
}

h1, h2, h3, h4, h5,
label,
.section-subhead,
.upload-col-title strong {
    color: var(--navy);
}

a:hover { color: #58b8e4; }

code {
    background: rgba(255, 255, 255, 0.06);
    color: #dce9f2;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

::selection {
    background: rgba(255, 130, 31, 0.34);
    color: #fff;
}

.demo-header {
    background:
        linear-gradient(115deg, transparent 0%, rgba(255, 255, 255, 0.12) 44%, transparent 58%),
        linear-gradient(180deg, #0c6f9e 0%, #07587f 46%, #043c5b 100%);
    border-bottom: 2px solid var(--orange);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.09),
        0 12px 36px rgba(2, 20, 28, 0.48);
    padding: 14px 28px;
}

.demo-header-inner {
    max-width: var(--container);
    gap: 18px;
}

.demo-logo {
    height: 26px;
}

.demo-eyebrow {
    color: #fff;
    font-size: 10px;
    letter-spacing: 0.18em;
}

.demo-title {
    color: #fff;
    font-family: var(--font-display);
    font-size: 18px;
}

.demo-chip {
    color: #e8edf2;
    background: rgba(0, 72, 108, 0.36);
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    letter-spacing: 0.02em;
}

body > details.section,
body > #configurationSection {
    width: min(calc(100% - 48px), var(--container));
    margin: 18px auto;
}

.section,
details.section {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #252a30 0%, #20252a 100%);
    border-color: #313740;
    border-radius: var(--radius-lg);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.055),
        inset 0 -1px 0 rgba(0, 0, 0, 0.28),
        0 14px 42px rgba(0, 0, 0, 0.30);
}

details.collapsible > summary {
    color: #fff;
    background: transparent;
    border: 1px solid var(--line);
    border-left: 3px solid var(--orange);
    border-radius: var(--radius);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 8px 14px 8px 32px;
}

details.collapsible > summary:hover {
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, 0.03);
}

details.collapsible > summary > select,
input,
select,
textarea,
.value-input,
.rgb-value,
.hex-row-compact input,
.stream-table .stream-bg-select,
.stream-table .stream-bg-input,
.bg-select {
    color: var(--ink);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0)),
        #151c23;
    border-color: var(--line);
    border-left-color: var(--orange);
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

input::placeholder,
textarea::placeholder {
    color: #737d88;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--orange);
    border-left-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(255, 130, 31, 0.18);
}

input[type="range"]::-webkit-slider-runnable-track {
    background: linear-gradient(180deg, #5a626b 0%, #343b44 100%);
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.35);
}

input[type="range"]::-moz-range-track {
    background: linear-gradient(180deg, #5a626b 0%, #343b44 100%);
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.35);
}

input[type="range"]::-webkit-slider-thumb {
    border-color: #1e2227;
    box-shadow: 0 0 0 1px rgba(255, 130, 31, 0.5);
}

input[type="range"]::-moz-range-thumb {
    border-color: #1e2227;
    box-shadow: 0 0 0 1px rgba(255, 130, 31, 0.5);
}

button,
.btn-xs {
    background: linear-gradient(180deg, #ff9d43 0%, var(--orange) 48%, #ea6a10 100%);
    border-color: var(--orange);
    color: #fff;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        0 8px 18px rgba(0, 0, 0, 0.18);
}

button:hover,
.btn-xs:hover {
    background: linear-gradient(180deg, #ffa955 0%, var(--orange-dark) 56%, #dc640f 100%);
    border-color: var(--orange-dark);
}

.btn-secondary,
.btn-outline {
    color: #e8edf2;
    background: linear-gradient(180deg, #303740 0%, #222831 100%);
    border-color: var(--line-strong);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 6px 14px rgba(0, 0, 0, 0.12);
}

.btn-secondary:hover,
.btn-outline:hover {
    color: #fff;
    background: #30363d;
    border-color: var(--orange);
}

button:disabled {
    color: #6f7882;
    background: #262b31;
    border-color: #333941;
}

.info,
.result,
.upload-card-heading,
.upload-progress,
.file-list-box,
.preview-box {
    color: var(--ink);
    background: linear-gradient(180deg, rgba(34, 39, 46, 0.92), rgba(25, 28, 33, 0.98));
    border-color: #303741;
}

.info {
    border-left-color: var(--blue);
}

.success {
    background: var(--ok-soft);
    border-left-color: var(--ok);
    color: #dff8e7;
}

.error {
    background: var(--err-soft);
    border-left-color: var(--err);
    color: #ffdcd8;
}

.mode-tabs-row,
.auth-tabs-row {
    border-color: var(--line);
}

.mode-tab.left,
.mode-tab.right,
.auth-tab,
.preset-btn,
.color-radio,
.player-tab {
    color: var(--ink);
    background: linear-gradient(180deg, #242b33 0%, #171d24 100%);
    border-color: var(--line);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.mode-tab.left:hover,
.mode-tab.right:hover,
.auth-tab:hover,
.preset-btn:hover:not(.active),
.player-tab:hover {
    color: #fff;
    background: #252a31;
    border-color: var(--line-strong);
}

.mode-tab.left.active,
.mode-tab.right.active,
.auth-tab.active,
.preset-btn.active,
.player-tab.active,
.adj-mode.active {
    color: #fff;
    background: linear-gradient(180deg, #ff9d43 0%, var(--orange) 52%, #ea6a10 100%);
    border-color: var(--orange);
}

.auth-tabs-row {
    background: var(--bg-sunken);
    overflow: hidden;
}

.auth-tab + .auth-tab {
    border-left-color: var(--line);
}

.chroma-section {
    background: var(--bg-soft);
    border-color: var(--line);
}

.chroma-section h4,
.player-header h4 {
    color: #fff;
    letter-spacing: 0.12em;
}

.help-text,
.text-muted,
.text-muted-sm,
.stream-meta,
.file-list-item .fmeta,
.preview-box .placeholder,
.preview-box .fname-line {
    color: var(--muted);
}

.color-indicator {
    color: var(--ink);
}

.color-indicator .swatch-box,
.color-preview-compact {
    border-color: #111418;
    box-shadow: 0 0 0 1px var(--line);
}

.hex-row-compact {
    border-top-color: var(--line);
}

.color-radio:has(input:checked) {
    color: #fff;
    border-color: var(--orange);
    box-shadow: 0 0 0 2px rgba(255, 130, 31, 0.22);
}

.stream-table-wrap {
    background: var(--bg-sunken);
    border-color: var(--line);
}

.stream-table th {
    color: #fff;
    background: #252a31;
}

.stream-table td {
    border-bottom-color: var(--line-faint);
}

.stream-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

.stream-table .mono,
.stream-meta code,
.stream-table a.mono {
    color: #dce9f2;
    background: rgba(255, 255, 255, 0.06);
}

.stream-table .copyable {
    color: #dce9f2;
}

.stream-table .copyable:hover,
.stream-table .copy-btn:hover {
    color: var(--orange);
}

.ingest-badge {
    background: rgba(31, 155, 209, 0.14);
    color: #73c7ec;
}

.target-badge {
    background: rgba(255, 130, 31, 0.14);
    color: #ffae6d;
}

.upload-area {
    color: var(--muted);
    background: var(--bg-sunken);
    border-color: var(--line-strong);
}

.upload-area:hover,
.upload-area.drag-over {
    color: #fff;
    background: #252a31;
    border-color: var(--orange);
}

.file-list-item {
    color: var(--ink);
}

.file-list-item:hover,
.file-list-item.selected {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--orange);
}

#configurationSection {
    background: transparent;
}

#configurationSection > h3,
#configurationSection > h4,
#configurationSection > .section-subhead,
#configurationSection > #targetCountRow,
#configurationSection > #streamInfo,
#configurationSection > #createPane,
#configurationSection > #reusePane,
#configurationSection > .mode-tabs-row {
    background: linear-gradient(180deg, #252a30 0%, #20252a 100%);
    border-color: #313740;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.055),
        inset 0 -1px 0 rgba(0, 0, 0, 0.28),
        0 14px 42px rgba(0, 0, 0, 0.30);
}

#configurationSection > h3 {
    border-left: 3px solid var(--orange);
}

#workbenchBlock {
    width: min(calc(100% - 96px), var(--container));
    margin: 18px auto 30px;
}

.workbench-header {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0 2px;
    margin: 0 0 8px;
    max-width: none;
    width: 100%;
}

.workbench-header .eyebrow {
    color: var(--orange);
    letter-spacing: 0.16em;
}

.workbench-header h3 {
    color: #fff;
    font-size: 21px;
}

.workbench-status {
    flex: 0 1 560px;
    min-width: 220px;
    max-width: 100%;
    color: #cbd6de;
    background: rgba(4, 42, 61, 0.54);
    border-color: #2e5870;
    border-left: 3px solid var(--blue);
    border-radius: var(--radius);
    overflow-wrap: anywhere;
    text-align: right;
    white-space: normal;
}

.workbench-layout {
    grid-template-columns: minmax(720px, 1fr) minmax(390px, 440px);
    gap: 18px;
    max-width: none;
    width: 100%;
    margin: 0;
}

.workbench-preview,
.workbench-controls {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #252a30 0%, #20252a 100%);
    border: 1px solid #343b45;
    border-radius: var(--radius-lg);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.055),
        inset 0 -1px 0 rgba(0, 0, 0, 0.36),
        0 22px 64px rgba(0, 0, 0, 0.36);
}

.workbench-preview {
    position: static;
    border-top: 2px solid #2e5870;
    padding: 16px;
}

.workbench-controls {
    border-top: 2px solid #2e5870;
    position: sticky;
    top: 92px;
    max-height: calc(100vh - 116px);
    overflow: auto;
    padding: 18px;
    scrollbar-color: #59616b #242930;
}

.workbench-controls .chroma-section {
    background: transparent;
    border: 0;
    border-top: 1px solid #303842;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    padding: 16px 0 0;
}

.workbench-controls .chroma-section:first-child {
    border-top: 0;
    padding-top: 0;
}

.workbench-controls > .grid-2col {
    gap: 0;
}

.workbench-controls > .grid-2col .chroma-section + .chroma-section {
    margin-top: 16px;
}

.workbench-controls > .action-row {
    background: rgba(17, 20, 24, 0.96);
    border: 1px solid #303842;
    border-radius: var(--radius);
    box-shadow: 0 -12px 26px rgba(0, 0, 0, 0.18);
}

.player-tabs-row {
    gap: 8px;
}

.player-tab {
    min-height: 34px;
    background: #151b21;
    border-color: #344a58;
}

.player-stage {
    background: #050607 !important;
    border-color: #08090b;
    border-radius: var(--radius);
    box-shadow:
        inset 0 0 0 2px rgba(0, 0, 0, 0.62),
        inset 0 0 0 1px rgba(255, 255, 255, 0.04),
        0 1px 0 rgba(255, 255, 255, 0.04),
        0 12px 30px rgba(0, 0, 0, 0.24);
}

#previewCanvas {
    background: #050607;
}

.player-placeholder {
    color: rgba(255, 255, 255, 0.62);
}

.source-inputs {
    margin-top: 12px;
}

.source-row-label {
    color: var(--muted) !important;
}

.source-upload,
.source-select,
.stream-group {
    color: var(--ink) !important;
    background: #141f27 !important;
    border-color: #344a58 !important;
}

.source-upload:hover {
    color: #fff !important;
    border-color: var(--orange) !important;
    background: #252a31 !important;
}

.stream-group input {
    color: var(--ink) !important;
    background: transparent !important;
}

.stream-group input::placeholder {
    color: #737d88 !important;
}

.stream-group-btn {
    color: #fff !important;
    background: #252a31 !important;
    border-left-color: var(--line) !important;
}

.stream-group-btn:hover {
    background: var(--orange) !important;
}

.source-status,
.scrub-time {
    color: var(--muted) !important;
}

#fgMiniPlayer {
    border-color: var(--line) !important;
}

#despillPreview,
#eqPreview,
.ffmpeg-cmd {
    color: #cbd4dd !important;
    background: #141f27 !important;
    border-color: #344a58 !important;
}

#applyModeHint {
    color: var(--muted) !important;
}

.switch-label {
    color: var(--ink);
}

.adj-status-row {
    color: var(--muted);
}

.demo-footer {
    background: #1f2227;
    border-top: 2px solid var(--orange);
}

.demo-footer-inner,
.page-version {
    color: #dce3ea;
}

@media (max-width: 1180px) {
    .workbench-controls {
        position: static;
        max-height: none;
        overflow: visible;
    }
}

@media (max-width: 760px) {
    body > details.section,
    body > #configurationSection,
    #workbenchBlock {
        width: min(calc(100% - 24px), var(--container));
    }

    .demo-header {
        padding: 12px 16px;
    }

    .workbench-header {
        display: block;
    }

    .workbench-status {
        display: inline-block;
        margin-top: 10px;
        text-align: left;
        white-space: normal;
    }
}
