/* FeedCue Console — design tokens ported from docs/mockups/console-prototype.html,
   trimmed to what Phase 2a's pages (login, dashboard, displays) actually use.
   No framework, no build step — matches the mockup's own approach and
   NDITVApp/Server/WebUI.swift's color-scheme-variable convention. */

:root {
    color-scheme: light dark;
    --bg: #f5f5f7;
    --surface: #ffffff;
    --surface-2: #f2f2f4;
    --border: #d9d9de;
    --text: #1a1a1c;
    --text-muted: #6b6b72;
    --accent: #0a66c2;
    --accent-text: #ffffff;
    --ok: #1a7f37;
    --crit: #b3261e;
    --warn: #855a00;
    --border-strong: #767680;
    --focus: #1a1a1c;
    --side-bg: #16171b;
    --side-text: #e8e8ea;
    --side-text-muted: #b4b4bc;
    --side-border: #8a8a93;
    --side-active-bg: #24252b;
    --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --radius: 10px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #121214;
        --surface: #1c1c1f;
        --surface-2: #232326;
        --border: #34343a;
        --text: #f0f0f2;
        --text-muted: #a0a0a8;
        --accent: #4da3ff;
        --accent-text: #0a1420;
        --ok: #4bd07a;
        --crit: #ff6b60;
        --warn: #e3b341;
        --border-strong: #7d7d86;
        --focus: #f0f0f2;
    }
}

* { box-sizing: border-box; }

/* Keyboard focus + motion + skip link (WCAG 2.4.7, 2.3.3, 2.4.1) */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sidebar :focus-visible { outline-color: #ffffff; }
.skip-link {
    position: absolute; left: 12px; top: -100px; z-index: 100;
    background: var(--accent); color: var(--accent-text); padding: 10px 16px;
    border-radius: 8px; font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; }
.sr-only {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 15px;
}

a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.main { scroll-margin-top: 0; }
.main:focus { outline: none; }

.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--side-bg);
    color: var(--side-text);
    display: flex;
    flex-direction: column;
    padding: 20px 12px;
}

.side-top { padding: 0 8px 20px; }
.side-brand { font-weight: 700; font-size: 18px; }
.org-name { color: var(--side-text-muted); font-size: 13px; margin-top: 4px; }

/* Vendor console gets a visibly distinct sidebar color — a vendor operator
   should never be able to mistake this for a customer Org's own console,
   even at a glance. */
.sidebar.vendor { background: #3b2a52; }
.sidebar.vendor .side-link:hover,
.sidebar.vendor .side-link.active { background: #4d3868; }

.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.side-link {
    display: block;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--side-text);
    text-decoration: none;
    font-size: 14px;
}
.side-link:hover { background: var(--side-active-bg); }
.side-link.active { background: var(--side-active-bg); font-weight: 600; }

.side-bottom { padding: 0 8px; display: flex; flex-direction: column; gap: 10px; }
.side-user { color: var(--side-text-muted); font-size: 12px; word-break: break-all; }

.main { flex: 1; min-width: 0; }
.content { max-width: 1000px; margin: 0 auto; padding: 32px 28px; }

h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0; }
.page-subtitle { color: var(--text-muted); margin: 0 0 24px; }

.grid { display: grid; gap: 16px; margin-bottom: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 760px) {
    .grid-2, .grid-4 { grid-template-columns: 1fr; }
    .content { padding: 20px 16px; }
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

.stat-card { display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.stat-value { font-size: 22px; font-weight: 700; }
.stat-value.crit { color: var(--crit); }
.stat-sub { font-size: 12px; color: var(--text-muted); }
.stat-sub.crit { color: var(--crit); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--surface-2); }
.ok { color: var(--ok); }
.muted { color: var(--text-muted); }

.empty-state { color: var(--text-muted); margin: 0; }

.detail-list { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.detail-list dt { color: var(--text-muted); font-size: 13px; }
.detail-list dd { margin: 0; font-size: 14px; }

.back-link { display: inline-block; margin-bottom: 12px; font-size: 14px; text-decoration: none; }

/* A wrapping row of pill links — used for the Content Library's "jump to
   a catalog type" nav, which used to be a run-on sentence of inline links
   in the page subtitle and got unreadable once it grew past ~6 types. */
.chip-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; }
.chip-link {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}
.chip-link { min-height: 32px; border-color: var(--border-strong); }
.chip-link:hover { background: var(--surface); border-color: var(--accent); color: var(--accent); }

.alert { padding: 12px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.alert-error { background: color-mix(in srgb, var(--crit) 15%, var(--surface)); color: var(--crit); }
.alert-info { background: var(--surface-2); color: var(--text-muted); }

.btn {
    display: inline-block;
    min-height: 36px;
    border: none;
    border-radius: 8px;
    padding: 9px 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); }
.btn-ghost { background: transparent; color: var(--side-text); border: 1px solid var(--side-border); }
.btn-block { width: 100%; }

.btn-grid { display: flex; flex-direction: column; gap: 8px; max-width: 360px; }

.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.login-screen { width: 100%; max-width: 380px; padding: 20px; }
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
}
.login-brand { font-weight: 700; font-size: 20px; margin-bottom: 4px; }
.login-card h1 { font-size: 17px; margin: 0 0 18px; color: var(--text-muted); font-weight: 500; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 5px; }
.field-help { font-size: 13px; color: var(--text-muted); margin: 5px 0 0; }
.field input, .field select {
    width: 100%;
    padding: 9px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-strong);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}

.control-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 800px) {
    .control-grid { grid-template-columns: 1fr; }
}
.control-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.control-actions form { display: contents; }

/* License & Plan (WEB_CONSOLE_COMPLETION_PLAN.md item 3) */
.badge { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; padding: 3px 8px; border-radius: 5px; }
.badge-flag-on { background: color-mix(in srgb, var(--ok) 18%, var(--surface)); color: var(--ok); }
.badge-flag-off { background: var(--surface-2); color: var(--text-muted); }
.flag-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 20px; }
@media (max-width: 700px) {
    .flag-list { grid-template-columns: 1fr; }
}
.flag-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }

/* Content Library (WEB_CONSOLE_COMPLETION_PLAN.md item 7) */
.content-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.content-tile { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.content-tile-thumb { aspect-ratio: 16/10; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.content-tile-body { padding: 10px 12px; }
.content-tile-name { font-size: 13.5px; font-weight: 600; margin-bottom: 2px; }
.content-tile-meta { font-size: 12px; color: var(--text-muted); }
.content-tile-pushed { font-size: 11px; color: var(--ok); margin-top: 6px; }
.content-tile-actions { display: flex; gap: 6px; padding: 0 12px 10px; }

/* Collections and archive: the per-item "Organize" disclosure and its forms. */
.content-tile-organize, .pl-list-row .content-tile-organize { padding: 0 12px 10px; font-size: 13px; }
.content-tile-organize summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--accent); font-weight: 600; }
.content-tile-organize-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px; margin-top: 6px; }
.content-tile-organize-form label { display: flex; flex-direction: column; gap: 2px; flex: 1 1 140px; color: var(--text-muted); font-size: 12px; }
.content-tile-organize-form input[type="text"] { min-height: 44px; }
.content-tile-organize-form .btn { min-height: 44px; }

/* The archive button on a card or row: a boxed button, at least 44px tall. */
.content-tile-actions { flex-wrap: wrap; }
.btn-box { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; border: 1.5px solid var(--border-strong, var(--border)); }
.btn-box svg { flex: none; }

/* Cards or list, and the bar that appears when files are selected. */
.library-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.view-toggle { display: inline-flex; gap: 0; }
.view-toggle .btn { min-height: 44px; border-radius: 0; }
.view-toggle .btn:first-child { border-radius: 8px 0 0 8px; }
.view-toggle .btn:last-child { border-radius: 0 8px 8px 0; margin-left: -1px; }
.view-toggle .btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.bulk-bar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; padding: 10px 12px; margin-bottom: 12px; background: var(--surface); border: 1px solid var(--accent); border-radius: 10px; }
.bulk-bar[hidden], .content-list[hidden], .content-grid[hidden] { display: none; }
.bulk-bar .btn, .bulk-bar input[type="text"] { min-height: 44px; }
.bulk-bar #bulkCount { font-weight: 600; align-self: center; margin-right: 4px; }
.bulk-collection { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--text-muted); }
.content-list { overflow-x: auto; }
.content-list table { min-width: 640px; }
.content-list th, .content-list td { padding: 8px 10px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
.content-list .col-check { width: 44px; }
.content-list .col-check input { width: 22px; height: 22px; }
.content-list .col-name { font-weight: 600; font-size: 13.5px; }
.content-list .col-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.content-list .col-actions .btn { min-height: 44px; }
.content-list .col-actions .content-tile-organize { padding: 0; }
.badge-archived { display: inline-block; padding: 1px 8px; font-size: 11px; font-weight: 600; border: 1px solid var(--border); border-radius: 999px; color: var(--text-muted); }

/* Support session (WEB_CONSOLE_COMPLETION_PLAN.md item 6) */
.support-banner { background: color-mix(in srgb, var(--warn) 20%, var(--surface)); border-bottom: 1px solid color-mix(in srgb, var(--warn) 45%, var(--border)); padding: 10px 28px; font-size: 13.5px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.support-banner strong { color: var(--warn); }
.badge-vendor-operator { background: color-mix(in srgb, var(--warn) 20%, var(--surface)); color: var(--warn); }

/* Settings (WEB_CONSOLE_COMPLETION_PLAN.md item 4) */
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); gap: 16px; }
.toggle-row:last-child { border-bottom: none; }
.toggle-row-label { font-size: 14px; }
.toggle-row-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track { position: absolute; inset: 0; background: var(--border-strong); border-radius: 24px; transition: background 0.15s; }
.switch-track::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: var(--surface); border-radius: 50%; transition: transform 0.15s; }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::before { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--focus); outline-offset: 2px; }
.disabled-section { opacity: 0.55; pointer-events: none; position: relative; }
.coming-soon-tag { font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; background: var(--surface-2); color: var(--text-muted); padding: 3px 8px; border-radius: 5px; }

.side-link, .btn, .chip-link, .back-link, .skip-link, a.row-link { text-decoration: none; }
a.row-link { color: var(--accent); font-weight: 600; }
a.row-link:hover, a.row-link:focus-visible { text-decoration: underline; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* License editor: feature flags grouped by category, each with a description. */
.lic-intro { margin: 0 0 14px; color: var(--text-muted); font-size: 14px; }
.lic-group { border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 16px; padding: 4px 14px 8px; min-width: 0; }
.lic-group legend { padding: 0 6px; font-size: 14px; font-weight: 600; color: var(--text); }
.lic-flag { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.lic-group legend + .lic-flag { border-top: 0; }
.lic-flag input[type="checkbox"] { flex: none; width: 24px; height: 24px; margin: 1px 0 0; accent-color: var(--accent); }
.lic-flag-text { min-width: 0; }
.lic-flag-text label { display: block; margin: 0; font-size: 15px; font-weight: 600; color: var(--text); }
.lic-flag-text p { margin: 2px 0 0; font-size: 14px; line-height: 1.4; color: var(--text-muted); }
