/* ============================================================
   StreamGuardian — Broadcast Master Control
   ============================================================
   Inspirado en patch panels SDI / master control rooms / NLE
   software (DaVinci Resolve). Slate profundo + amber LED +
   cyan live + magenta alert. Diseño técnico, denso y legible
   para operadores en ambientes de baja luz.
   ============================================================ */
:root {
    /* Surfaces — slate profundo, mat */
    --bg-base:        #0a0e14;   /* deep slate, room ambient */
    --bg-mantle:      #11161e;   /* panel base */
    --bg-crust:       #060a0f;   /* deepest, modal back */
    --bg-surface0:    #1c2330;   /* hairline / separator */
    --bg-surface1:    #2a3344;   /* hover / elevated */
    --bg-surface2:    #404a5e;

    /* Text — slightly warm white */
    --text:           #d8dde6;
    --text-subtext:   #8a93a3;
    --text-overlay:   #5d6678;

    /* Signal palette — patch panel LEDs */
    --accent:         #ffb23a;   /* amber LED — primary */
    --accent-soft:    rgba(255, 178, 58, 0.10);
    --accent-glow:    rgba(255, 178, 58, 0.30);
    --blue:           #5be0e0;   /* cyan — LIVE / active signal */
    --green:          #6ee7a1;   /* OK / online */
    --yellow:         #ffd466;   /* warn */
    --orange:         #ff8e5c;   /* hot */
    --red:            #ff4b91;   /* magenta — ALERT / fault */
    --pink:           #ff7ed4;
    --teal:           #4dd6c4;

    --sidebar-w:      240px;
    --sidebar-w-min:  64px;
    --topbar-h:       56px;
    --radius:         2px;        /* sharp control panel feel */
    --radius-pill:    999px;
    --transition:     160ms cubic-bezier(.4, 0, .2, 1);

    /* Typography — distinctive, contextual */
    --font-sans:      "Schibsted Grotesk", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-display:   "B612 Mono", "JetBrains Mono", monospace;  /* cockpit-grade mono */
    --font-mono:      "JetBrains Mono", "SF Mono", Menlo, monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    background: var(--bg-base);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 13.5px;
    font-weight: 400;
    line-height: 1.55;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "ss01" 1, "ss02" 1, "tnum" 1;  /* tabular nums by default */
}

/* Faint scanline texture — ambient broadcast vibe, very subtle */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    background-image: repeating-linear-gradient(
        0deg,
        transparent 0,
        transparent 2px,
        rgba(255, 255, 255, 0.012) 2px,
        rgba(255, 255, 255, 0.012) 3px
    );
    mix-blend-mode: overlay;
}

a { color: var(--blue); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* Display heading utility — for technical readouts */
.mono, .display { font-family: var(--font-display); letter-spacing: 0.02em; }

/* LED dot indicator */
.led {
    display: inline-block;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--text-overlay);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.4) inset;
    flex-shrink: 0;
}
.led.on    { background: var(--green); box-shadow: 0 0 6px var(--green); }
.led.amber { background: var(--accent); box-shadow: 0 0 6px var(--accent-glow); }
.led.live  { background: var(--blue);   box-shadow: 0 0 6px var(--blue); animation: led-pulse 1.6s ease-in-out infinite; }
.led.alert { background: var(--red);    box-shadow: 0 0 6px var(--red); animation: led-pulse 0.9s ease-in-out infinite; }
@keyframes led-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.45; }
}

/* ----------------------------------------------------- App shell */
.app {
    display: grid;
    grid-template-rows: var(--topbar-h) 1fr;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-areas:
        "topbar topbar"
        "sidebar main";
    height: 100vh;
    transition: grid-template-columns var(--transition);
}
.app.sidebar-collapsed,
html.pre-collapsed .app { grid-template-columns: var(--sidebar-w-min) 1fr; }

/* ----------------------------------------------------- Topbar */
.topbar {
    grid-area: topbar;
    background: var(--bg-mantle);
    border-bottom: 1px solid var(--bg-surface0);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 16px;
    z-index: 10;
}
.topbar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.topbar .brand .logo {
    width: 28px; height: 28px;
    background: var(--accent);
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    color: #1a1207;
    font-weight: 700;
    box-shadow: 0 0 12px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.25);
}
.topbar .search {
    flex: 1;
    max-width: 480px;
    position: relative;
}
.topbar .search input {
    width: 100%;
    background: var(--bg-base);
    border: 1px solid var(--bg-surface0);
    border-radius: var(--radius);
    color: var(--text);
    padding: 8px 10px 8px 32px;
    font-size: 12.5px;
    font-family: var(--font-mono);
    outline: none;
    transition: all var(--transition);
}
.topbar .search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.topbar .search input::placeholder { color: var(--text-overlay); font-family: var(--font-sans); }
.topbar .search .icon {
    position: absolute;
    left: 10px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-overlay);
}
.topbar .actions {
    display: flex; align-items: center; gap: 8px; margin-left: auto;
}
.topbar .icon-btn {
    width: 36px; height: 36px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-subtext);
    border-radius: var(--radius);
    display: grid; place-items: center;
    transition: all var(--transition);
}
.topbar .icon-btn:hover { background: var(--bg-surface0); color: var(--text); }
.topbar .user {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 10px 4px 4px;
    border-radius: var(--radius);
    background: var(--bg-surface0);
    color: var(--text-subtext);
    font-size: 13px;
}
.topbar .user .avatar {
    width: 28px; height: 28px;
    background: var(--accent);
    border-radius: 50%;
    display: grid; place-items: center;
    color: #1a1207;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 12px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
}
.topbar .user-menu {
    position: relative;
    cursor: pointer;
    user-select: none;
}
.user-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 180px;
    background: var(--bg-mantle);
    border: 1px solid var(--bg-surface0);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    padding: 4px;
    display: none;
    z-index: 50;
}
.user-menu.open .user-dropdown { display: block; }
.user-dropdown a {
    display: block;
    padding: 9px 12px;
    border-radius: 5px;
    color: var(--text);
    font-size: 13px;
    text-decoration: none;
}
.user-dropdown a:hover { background: var(--bg-surface0); text-decoration: none; }

/* ----------------------------------------------------- Sidebar */
.sidebar {
    grid-area: sidebar;
    background: var(--bg-mantle);
    border-right: 1px solid var(--bg-surface0);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sidebar .toggle {
    background: transparent;
    border: none;
    color: var(--text-overlay);
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color var(--transition);
}
.sidebar .toggle:hover { color: var(--text); }
.sidebar nav { flex: 1; overflow-y: auto; padding: 4px 8px; }
.sidebar a.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px 9px 14px;
    color: var(--text-subtext);
    border-radius: var(--radius);
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: all var(--transition);
    position: relative;
    margin-bottom: 1px;
    text-decoration: none;
    white-space: nowrap;
}
.sidebar a.nav-item:hover {
    background: var(--bg-surface0);
    color: var(--text);
    text-decoration: none;
}
.sidebar a.nav-item.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}
.sidebar a.nav-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%; transform: translateY(-50%);
    height: 60%;
    width: 2px;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}
.sidebar a.nav-item .icon {
    flex-shrink: 0;
    width: 18px; height: 18px;
    display: grid; place-items: center;
}
.sidebar a.nav-item .label { flex: 1; }
.sidebar a.nav-item .badge {
    background: var(--bg-surface0);
    color: var(--text-subtext);
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 600;
}
.sidebar a.nav-item.active .badge { background: var(--accent); color: var(--bg-base); }
.sidebar .divider {
    height: 1px;
    background: var(--bg-surface0);
    margin: 8px 12px;
}

/* Sidebar collapsed (runtime + pre-render) */
.app.sidebar-collapsed .sidebar a.nav-item .label,
.app.sidebar-collapsed .sidebar a.nav-item .badge,
.app.sidebar-collapsed .sidebar .toggle .label,
html.pre-collapsed .sidebar a.nav-item .label,
html.pre-collapsed .sidebar a.nav-item .badge,
html.pre-collapsed .sidebar .toggle .label {
    display: none;
}
.app.sidebar-collapsed .sidebar a.nav-item,
html.pre-collapsed .sidebar a.nav-item {
    justify-content: center;
    padding: 9px 0;
}
.app.sidebar-collapsed .sidebar .toggle,
html.pre-collapsed .sidebar .toggle {
    justify-content: center;
    padding: 12px 0;
}

/* ----------------------------------------------------- Main */
.main {
    grid-area: main;
    overflow-y: auto;
    background: var(--bg-base);
}
.page {
    padding: 28px 36px 48px;
    max-width: 1600px;
}
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
    flex-wrap: wrap;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--bg-surface0);
    position: relative;
}
.page-header::after {
    /* Hairline accent bar bottom-left — broadcast tape mark */
    content: "";
    position: absolute;
    left: 0; bottom: -1px;
    height: 1px;
    width: 64px;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}
.page-header h1 {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.1;
}
.page-header .subtitle {
    color: var(--text-overlay);
    font-size: 12.5px;
    margin-top: 6px;
    letter-spacing: 0.01em;
    max-width: 720px;
}

/* ----------------------------------------------------- Cards */
.card {
    background: var(--bg-mantle);
    border: 1px solid var(--bg-surface0);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
    position: relative;
}
.card-title {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-subtext);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--bg-surface0);
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-title::before {
    content: "";
    display: inline-block;
    width: 4px; height: 4px;
    background: var(--accent);
    box-shadow: 0 0 4px var(--accent-glow);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}
.kpi {
    background: var(--bg-mantle);
    border: 1px solid var(--bg-surface0);
    border-radius: var(--radius);
    padding: 16px 18px 18px 22px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.kpi:hover { border-color: var(--bg-surface1); }
.kpi::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}
.kpi.k-blue::before   { background: var(--blue);   box-shadow: 0 0 8px rgba(91,224,224,0.4); }
.kpi.k-green::before  { background: var(--green);  box-shadow: 0 0 8px rgba(110,231,161,0.4); }
.kpi.k-yellow::before { background: var(--yellow); box-shadow: 0 0 8px rgba(255,212,102,0.4); }
.kpi.k-red::before    { background: var(--red);    box-shadow: 0 0 8px rgba(255,75,145,0.4); }
.kpi .kpi-label {
    font-family: var(--font-display);
    font-size: 10.5px;
    color: var(--text-subtext);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    margin-bottom: 8px;
    font-weight: 700;
}
.kpi .kpi-value {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 700;
    color: var(--text);
    font-feature-settings: "tnum";
    line-height: 1;
    letter-spacing: -0.01em;
}
.kpi .kpi-trend {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--text-overlay);
    margin-top: 8px;
    letter-spacing: 0.02em;
}

/* ----------------------------------------------------- Tables */
.table-wrapper {
    background: var(--bg-mantle);
    border: 1px solid var(--bg-surface0);
    border-radius: var(--radius);
    overflow: hidden;
}
.table-toolbar {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--bg-surface0);
    flex-wrap: wrap;
}
.table-toolbar input.filter {
    background: var(--bg-base);
    border: 1px solid var(--bg-surface0);
    color: var(--text);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    width: 240px;
    outline: none;
}
.table-toolbar input.filter:focus { border-color: var(--accent); }

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
table.data th, table.data td {
    text-align: left;
    padding: 11px 16px;
    border-bottom: 1px solid var(--bg-surface0);
}
table.data th {
    background: var(--bg-mantle);
    color: var(--text-subtext);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    user-select: none;
    position: sticky; top: 0;
    border-bottom: 1px solid var(--bg-surface1);
}
table.data tbody tr {
    transition: background var(--transition);
}
table.data tbody tr:hover { background: rgba(255, 178, 58, 0.03); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data.sortable th[data-sort]:hover { color: var(--accent); cursor: pointer; }
table.data .sort-ind { color: var(--accent); font-weight: 700; }
table.data td.mono, table.data td .mono { font-family: var(--font-mono); font-size: 12.5px; }

/* ----------------------------------------------------- Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: var(--radius);
    font-family: var(--font-display);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    background: var(--bg-surface0);
    color: var(--text-subtext);
    border: 1px solid transparent;
    line-height: 1.4;
}
.badge.b-green  { background: rgba(110,231,161,0.10); color: var(--green); border-color: rgba(110,231,161,0.25); }
.badge.b-blue   { background: rgba(91,224,224,0.10);  color: var(--blue);  border-color: rgba(91,224,224,0.25); }
.badge.b-yellow { background: rgba(255,212,102,0.10); color: var(--yellow); border-color: rgba(255,212,102,0.25); }
.badge.b-red    { background: rgba(255,75,145,0.10);  color: var(--red);   border-color: rgba(255,75,145,0.25); }
.badge.b-amber  { background: rgba(255,178,58,0.10);  color: var(--accent); border-color: rgba(255,178,58,0.25); }
.badge.b-orange { background: rgba(250,179,135,0.15); color: var(--orange); }
.badge.b-red    { background: rgba(243,139,168,0.15); color: var(--red); }
.badge.b-pink   { background: rgba(245,194,231,0.15); color: var(--pink); }
.badge.b-mauve  { background: rgba(203,166,247,0.15); color: var(--accent); }

/* ----------------------------------------------------- Tabs */
.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--bg-surface0);
    margin-bottom: 16px;
}
.tabs button {
    background: transparent;
    border: none;
    color: var(--text-subtext);
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
}
.tabs button:hover { color: var(--text); }
.tabs button.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.tabs button .count {
    margin-left: 6px;
    color: var(--text-overlay);
    font-size: 11px;
}

/* ----------------------------------------------------- Buttons */
.btn {
    background: var(--bg-surface0);
    border: 1px solid var(--bg-surface1);
    color: var(--text);
    padding: 7px 14px;
    border-radius: var(--radius);
    font-family: var(--font-display);
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1.3;
}
.btn:hover {
    background: var(--bg-surface1);
    border-color: var(--bg-surface2);
}
.btn:active { transform: translateY(1px); }
.btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #1a1207;
    box-shadow: 0 0 12px var(--accent-glow);
}
.btn.primary:hover {
    background: #ffc25c;
    border-color: #ffc25c;
    box-shadow: 0 0 18px var(--accent-glow);
}
.btn.ghost {
    background: transparent;
    border-color: var(--bg-surface0);
    color: var(--text-subtext);
}
.btn.ghost:hover {
    border-color: var(--bg-surface1);
    color: var(--text);
}
.btn:disabled, .btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Play button — icono ▶ ubicuo en filas con m3u8 */
.btn-play {
    width: 30px; height: 30px;
    background: var(--bg-surface0);
    border: 1px solid var(--bg-surface1);
    color: var(--accent);
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    transition: all var(--transition);
    flex-shrink: 0;
}
.btn-play:hover {
    background: var(--accent);
    color: var(--bg-base);
    transform: scale(1.05);
}
.btn-play svg { width: 12px; height: 12px; margin-left: 2px; }

/* ----------------------------------------------------- Modal */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.modal-backdrop.open { display: flex; }
.modal {
    background: var(--bg-mantle);
    border: 1px solid var(--bg-surface0);
    border-radius: var(--radius);
    width: 100%;
    max-width: 960px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.modal-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--bg-surface0);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-body {
    padding: 0;
    overflow-y: auto;
    flex: 1;
}
.modal-close {
    background: transparent;
    border: none;
    color: var(--text-overlay);
    width: 30px; height: 30px;
    border-radius: 6px;
    display: grid; place-items: center;
}
.modal-close:hover { background: var(--bg-surface0); color: var(--text); }

/* ----------------------------------------------------- Player container */
.player-frame {
    background: #000;
    aspect-ratio: 16 / 9;
    display: grid; place-items: center;
    position: relative;
}
.player-frame video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}
.player-stats {
    padding: 10px 16px;
    background: var(--bg-base);
    border-top: 1px solid var(--bg-surface0);
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: var(--text-subtext);
    font-family: var(--font-mono);
    flex-wrap: wrap;
}
.player-stats .stat-label { color: var(--text-overlay); }
.player-stats .stat-value { color: var(--text); }

/* ----------------------------------------------------- Player page layout */
.player-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 16px;
    height: calc(100vh - var(--topbar-h) - 48px);
}
.player-list {
    background: var(--bg-mantle);
    border: 1px solid var(--bg-surface0);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.player-list-header {
    padding: 12px;
    border-bottom: 1px solid var(--bg-surface0);
}
.player-list-header input {
    width: 100%;
    background: var(--bg-base);
    border: 1px solid var(--bg-surface0);
    color: var(--text);
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
}
.player-list-header input:focus { border-color: var(--accent); }
.player-list-body {
    flex: 1;
    overflow-y: auto;
    padding: 4px;
}
.player-list .group-title {
    font-size: 11px;
    color: var(--text-overlay);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 12px 6px;
    font-weight: 600;
}
.player-list .item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-subtext);
    transition: all var(--transition);
}
.player-list .item:hover { background: var(--bg-surface0); color: var(--text); }
.player-list .item.active {
    background: var(--accent-soft);
    color: var(--accent);
}
.player-list .item .dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--bg-surface2);
    flex-shrink: 0;
}
.player-list .item.live .dot { background: var(--green); }

/* Grupos colapsables */
.pl-group { border-bottom: 1px solid var(--bg-surface0); }
.pl-group .group-title:hover { background: var(--bg-surface0); }
.pl-group-body.collapsed { display: none; }
.pl-group .pl-group { padding-left: 8px; border-left: 1px solid var(--bg-surface0); margin-left: 8px; }
.cand-grp-btn {
    background: transparent; color: var(--text-overlay);
    border: 1px solid var(--bg-surface0);
    padding: 2px 7px; border-radius: 4px;
    font-size: 11px; cursor: pointer;
    font-family: inherit;
}
.cand-grp-btn:hover { color: var(--text); }
.cand-grp-btn.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

.player-stage {
    background: var(--bg-mantle);
    border: 1px solid var(--bg-surface0);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.player-toolbar {
    padding: 12px;
    border-bottom: 1px solid var(--bg-surface0);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.player-toolbar input.url-input {
    flex: 1;
    min-width: 280px;
    background: var(--bg-base);
    border: 1px solid var(--bg-surface0);
    color: var(--text);
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-family: var(--font-mono);
    outline: none;
}
.player-toolbar input.url-input:focus { border-color: var(--accent); }

/* TV-wall */
.tv-wall {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 8px;
    padding: 8px;
    flex: 1;
    background: #000;
}
.tv-wall .cell {
    background: #000;
    position: relative;
    overflow: hidden;
    border-radius: 4px;
}
.tv-wall .cell video {
    width: 100%; height: 100%; object-fit: contain;
}
.tv-wall .cell .label {
    position: absolute; left: 8px; bottom: 8px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
}

/* ----------------------------------------------------- Activity feed */
.activity {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.activity .item {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    background: var(--bg-base);
    border: 1px solid var(--bg-surface0);
    align-items: center;
}
.activity .item .icon {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid; place-items: center;
    flex-shrink: 0;
}
.activity .item .body { flex: 1; min-width: 0; }
.activity .item .body .title {
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
}
.activity .item .body .meta {
    color: var(--text-overlay);
    font-size: 11px;
    margin-top: 2px;
}
.activity .item .time {
    color: var(--text-overlay);
    font-size: 11px;
    font-family: var(--font-mono);
}

/* ----------------------------------------------------- Overview grid */
.overview-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 16px;
}
@media (max-width: 1024px) {
    .overview-grid { grid-template-columns: 1fr; }
    .player-layout { grid-template-columns: 1fr; height: auto; }
}

/* Quality Tests grid */
.quality-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
.quality-card {
    background: var(--bg-mantle);
    border: 1px solid var(--bg-surface0);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    color: var(--text);
}
.quality-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    text-decoration: none;
}
.quality-card .thumb {
    width: 100%; aspect-ratio: 16/9;
    background: var(--bg-surface0);
    display: grid; place-items: center;
    color: var(--text-overlay);
}
.quality-card .body { padding: 12px; }
.quality-card .body .name { font-size: 13px; font-weight: 500; }
.quality-card .body .meta { color: var(--text-overlay); font-size: 11px; margin-top: 4px; }

/* Iframe wrapper */
.iframe-wrap {
    height: calc(100vh - var(--topbar-h) - 100px);
    border: 1px solid var(--bg-surface0);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-mantle);
}
.iframe-wrap iframe { width: 100%; height: 100%; border: none; background: white; }

/* Empty/loading states */
.state {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-overlay);
}
.state .icon { font-size: 32px; margin-bottom: 8px; opacity: 0.6; }
.state .title { color: var(--text-subtext); font-size: 14px; margin-bottom: 4px; }

/* Code/url inline */
code, .mono {
    font-family: var(--font-mono);
    font-size: 12px;
    background: var(--bg-surface0);
    padding: 1px 6px;
    border-radius: 4px;
    color: var(--accent);
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--bg-surface0); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--bg-surface1); }
