/* ==========================================================================
   Stream Manager — dark UI built on Apple's Human Interface Guidelines
   Tokens mirror Apple's dark semantic system: elevated grays, system colors,
   continuous-corner radii, 17/15/13pt type ramp, and a 44px min touch target.
   ========================================================================== */

:root {
    /* System colors (dark variants, Apple HIG) */
    --blue:        #0A84FF;
    --blue-press:  #0972DC;
    --green:       #30D158;
    --red:         #FF453A;
    --red-press:   #DC3A31;
    --orange:      #FF9F0A;
    --purple:      #BF5AF2;
    --pink:        #FF375F;
    --teal:        #64D2FF;

    /* Backgrounds: base → elevated */
    --bg:          #000000;
    --bg-elev-1:   #1C1C1E;
    --bg-elev-2:   #2C2C2E;
    --bg-elev-3:   #3A3A3C;
    --bg-sidebar:  rgba(22, 22, 24, 0.72);
    --bg-fill:     rgba(120, 120, 128, 0.20);   /* systemFill */
    --bg-fill-2:   rgba(120, 120, 128, 0.28);
    --bg-fill-3:   rgba(120, 120, 128, 0.36);

    /* Labels */
    --label:       rgba(255, 255, 255, 0.96);
    --label-2:     rgba(235, 235, 245, 0.62);
    --label-3:     rgba(235, 235, 245, 0.34);
    --label-4:     rgba(235, 235, 245, 0.20);

    --separator:   rgba(84, 84, 88, 0.55);
    --hairline:    rgba(255, 255, 255, 0.08);

    /* Radii — Apple continuous corners */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 22px;
    --r-pill: 999px;

    /* Elevation */
    --shadow-1: 0 1px 2px rgba(0,0,0,.4);
    --shadow-2: 0 8px 24px rgba(0,0,0,.45);
    --shadow-3: 0 24px 64px rgba(0,0,0,.6);

    /* Motion — Apple's standard ease */
    --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
    --spring: cubic-bezier(0.32, 0.72, 0, 1);

    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
            "Inter", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
    --mono: "SF Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.45;
    letter-spacing: -0.01em;
    color: var(--label);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Ambient light behind the whole app (very subtle, Apple-ish) */
.app-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(60% 55% at 12% -5%,  rgba(10,132,255,.16), transparent 70%),
        radial-gradient(50% 45% at 92% 0%,   rgba(191,90,242,.12), transparent 70%),
        radial-gradient(70% 60% at 50% 110%, rgba(48,209,88,.07),  transparent 70%);
}

/* ---------------------------------- Shell -------------------------------- */

.shell {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px 16px;
    background: var(--bg-sidebar);
    backdrop-filter: saturate(180%) blur(24px);
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    border-right: 1px solid var(--hairline);
}

.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px; }

.brand-mark {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border-radius: 11px;
    background: linear-gradient(160deg, var(--blue), #5E5CE6);
    color: #fff;
    box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255,255,255,.25);
}
.brand-mark .ui-icon { width: 21px; height: 21px; }

.brand-text h1 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.brand-tagline {
    margin: 1px 0 0;
    font-size: 12px;
    color: var(--label-3);
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--label-2);
    font: inherit;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background .18s var(--ease), color .18s var(--ease);
}
.nav-item:hover { background: rgba(255,255,255,.06); color: var(--label); }
.nav-item.active {
    background: var(--blue);
    color: #fff;
    box-shadow: var(--shadow-1);
}
.nav-item.active .nav-icon { color: #fff; }
.nav-icon { width: 19px; height: 19px; flex: none; color: var(--label-3); }
.nav-item:hover .nav-icon { color: var(--label); }

.nav-live-dot {
    margin-left: auto;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--red);
    box-shadow: 0 0 0 4px rgba(255,69,58,.22);
    animation: pulse 2s var(--ease) infinite;
}

.sidebar-foot { margin-top: auto; }

.connection-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: var(--r-sm);
    background: var(--bg-fill);
    font-size: 13px;
    font-weight: 500;
    color: var(--label-2);
}
.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--label-3);
    flex: none;
    transition: background .2s var(--ease), box-shadow .2s var(--ease);
}
.status-dot.connected {
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(48,209,88,.18);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: .45; }
}

/* --------------------------------- Content ------------------------------- */

.content {
    padding: 32px 32px 72px;
    max-width: 1280px;
    width: 100%;
}

.section { display: none; animation: sectionIn .28s var(--spring); }
.section.active { display: block; }

@keyframes sectionIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}
.section-head h2 {
    margin: 0;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.028em;
}
.section-head p {
    margin: 4px 0 0;
    font-size: 14px;
    color: var(--label-2);
}

/* ---------------------------------- Cards -------------------------------- */

.card {
    background: var(--bg-elev-1);
    border: 1px solid var(--hairline);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
    overflow: hidden;
    margin-bottom: 18px;
}

.card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--hairline);
}
.card-head-compact { padding: 14px 18px; }
.card-head h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.015em;
}
.card-desc {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--label-3);
}
.card-head-icon {
    width: 20px; height: 20px;
    flex: none;
    color: var(--blue);
}
.card-head-actions { margin-left: auto; margin-bottom: 0; }

.card-body { padding: 18px; }
.card-body > *:last-child { margin-bottom: 0; }

/* ---------------------------------- Forms -------------------------------- */

.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0 16px;
}

label {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--label-2);
    letter-spacing: -0.005em;
}
.label-hint {
    font-weight: 400;
    color: var(--label-3);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 11px 13px;
    font: inherit;
    font-size: 15px;
    color: var(--label);
    background: var(--bg-elev-2);
    border: 1px solid transparent;
    border-radius: var(--r-md);
    outline: none;
    transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
    appearance: none;
    -webkit-appearance: none;
}
textarea { resize: vertical; min-height: 76px; line-height: 1.5; }

input::placeholder, textarea::placeholder { color: var(--label-3); }

input:focus, select:focus, textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3.5px rgba(10,132,255,.28);
    background: var(--bg-elev-3);
}
input[readonly] { color: var(--label-2); background: var(--bg-fill); }

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23EBEBF5' stroke-opacity='.55' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5 12 15.5 18 9.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    background-size: 16px;
    padding-right: 34px;
    cursor: pointer;
}
select option { background: var(--bg-elev-2); color: var(--label); }

input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(1) opacity(.55); cursor: pointer; }

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--label-3);
}

.input-with-action { display: flex; gap: 8px; }
.input-with-action select { flex: 1; }

/* --------------------------------- Buttons ------------------------------- */
/* Apple button hierarchy: filled → tinted → plain. 44px comfortable target. */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 16px;
    min-height: 38px;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #fff;
    background: var(--bg-fill-2);
    border: 0;
    border-radius: var(--r-md);
    cursor: pointer;
    white-space: nowrap;
    transition: transform .12s var(--ease), filter .18s var(--ease), background .18s var(--ease);
    -webkit-user-select: none;
    user-select: none;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(0.97); filter: brightness(0.92); }
.btn:focus-visible { outline: 3px solid rgba(10,132,255,.55); outline-offset: 2px; }
.btn:disabled { opacity: .38; pointer-events: none; }

.btn-icon { width: 17px; height: 17px; flex: none; }

.btn-primary   { background: var(--blue); }
.btn-primary:active { background: var(--blue-press); }
.btn-secondary { background: rgba(10,132,255,.18); color: var(--blue); }   /* tinted */
.btn-plain     { background: var(--bg-fill); color: var(--label); }
.btn-danger    { background: var(--red); }
.btn-warning   { background: rgba(255,159,10,.20); color: var(--orange); }
.btn-accent    { background: var(--purple); }
.btn-ghost     { background: transparent; color: var(--label-2); }
.btn-ghost:hover { background: var(--bg-fill); color: var(--label); }

.btn-sm { padding: 7px 12px; min-height: 32px; font-size: 13.5px; border-radius: var(--r-sm); }
.btn-sm .btn-icon { width: 15px; height: 15px; }
.btn-small { padding: 6px 11px; min-height: 30px; font-size: 13px; border-radius: var(--r-sm); background: var(--bg-fill); }
.btn-icon-only { padding: 0; width: 44px; flex: none; }
.btn-full { width: 100%; }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.btn-row:last-child { margin-bottom: 0; }

/* The primary "go live" action — big, unmistakable. */
#stream-toggle-btn {
    width: 100%;
    min-height: 50px;
    font-size: 17px;
    border-radius: var(--r-md);
    background: var(--red);
    box-shadow: 0 6px 20px rgba(255,69,58,.28);
}
#stream-toggle-btn.btn-live {
    background: linear-gradient(180deg, #FF5F55, #FF3B30);
}
#stream-toggle-btn.btn-danger {
    background: var(--bg-fill-3);
    color: var(--label);
    box-shadow: none;
}

/* -------------------------- Tabs & segmented control --------------------- */

.tabs {
    display: flex;
    gap: 2px;
    padding: 4px;
    margin: 14px 18px 0;
    background: var(--bg-fill);
    border-radius: 11px;
}
.tab-btn {
    flex: 1;
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--label-2);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s var(--ease), color .2s var(--ease);
}
.tab-btn:hover { color: var(--label); }
.tab-btn.active {
    background: var(--bg-elev-3);
    color: var(--label);
    box-shadow: var(--shadow-1);
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: sectionIn .22s var(--spring); }

.segmented {
    display: inline-flex;
    padding: 3px;
    background: var(--bg-fill);
    border-radius: 10px;
}
.segment-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--label-2);
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s var(--ease), color .2s var(--ease);
}
.segment-btn.active {
    background: var(--bg-elev-3);
    color: var(--label);
    box-shadow: var(--shadow-1);
}
.segment-icon { width: 15px; height: 15px; }

/* --------------------------------- Go live ------------------------------- */

.golive-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 18px;
    align-items: start;
}
.golive-rail { position: sticky; top: 32px; }

.card-status { background: var(--bg-elev-1); }

.status-chips {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--hairline);
}
.status-chip {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 13px 16px;
    background: var(--bg-elev-1);
}
.status-chip-full { grid-column: 1 / -1; }
.chip-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--label-3);
}
.chip-value {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--label);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chip-value-wrap { white-space: normal; word-break: break-word; }

.broadcast-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid var(--hairline);
}
.broadcast-actions .btn-row { margin-bottom: 0; }
.broadcast-actions .btn-row .btn { flex: 1; }

.scheduled-list { margin-top: 12px; font-size: 13px; color: var(--label-2); }
.scheduled-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: var(--bg-elev-2);
    border-radius: var(--r-sm);
}
.scheduled-row > span:first-child { flex: 1; min-width: 200px; }
.schedule-playlist { display: block; margin-top: 3px; color: var(--label-3, var(--label-2)); }

/* --------------------------------- Library ------------------------------- */

.library-split {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
    align-items: start;
}

.breadcrumb-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 6px 6px 14px;
    background: var(--bg-elev-1);
    border: 1px solid var(--hairline);
    border-radius: var(--r-pill);
}
.breadcrumb-path { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; }
.crumb-icon { width: 16px; height: 16px; color: var(--blue); }
.breadcrumb-value { font-family: var(--mono); font-size: 13px; color: var(--label-2); }

.pane-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}
.pane-title-icon { width: 18px; height: 18px; color: var(--blue); }

.folder-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.folder-controls input, .folder-controls select { flex: 1; min-width: 160px; }

.folder-list { display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow-y: auto; }

.folder-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    background: var(--bg-elev-2);
    border-radius: var(--r-md);
    cursor: pointer;
    transition: background .18s var(--ease), transform .12s var(--ease);
}
.folder-item:hover { background: var(--bg-elev-3); }
.folder-item:active { transform: scale(.99); }
.folder-name {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 1;
    min-width: 0;
    font-size: 14.5px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.folder-row-icon { width: 18px; height: 18px; flex: none; color: var(--blue); }
.folder-info { font-size: 12.5px; color: var(--label-3); white-space: nowrap; }
.folder-actions { display: flex; gap: 6px; }

.bunny-item { cursor: default; }
.bunny-item .folder-name { cursor: pointer; }
.bunny-check { width: 18px; height: 18px; accent-color: var(--blue); cursor: pointer; }

/* Go Live: a Bunny collection is a tickable row that opens into its play-order preview. */
.bunny-collection { background: var(--bg-elev-2); border-radius: var(--r-md); }
.bunny-collection > summary { list-style: none; cursor: pointer; background: none; }
.bunny-collection > summary::-webkit-details-marker { display: none; }
.bunny-collection > summary::after { content: '›'; color: var(--label-3); transition: transform .18s var(--ease); }
.bunny-collection[open] > summary::after { transform: rotate(90deg); }
.bunny-collection-videos { margin: 0; padding: 0 13px 11px 40px; font-size: 13px; color: var(--label-2); }
.bunny-collection-videos li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.bunny-collection-videos li span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bunny-notice {
    padding: 12px 14px;
    border-radius: var(--r-md);
    background: rgba(255,159,10,.12);
    color: var(--orange);
    font-size: 13.5px;
}

/* Drop zone */
.drop-zone {
    display: grid;
    place-items: center;
    padding: 30px 18px;
    border: 1.5px dashed var(--separator);
    border-radius: var(--r-lg);
    background: var(--bg-elev-2);
    text-align: center;
    transition: border-color .2s var(--ease), background .2s var(--ease);
}
.drop-zone.drag-over {
    border-color: var(--blue);
    background: rgba(10,132,255,.10);
}
.drop-zone.disabled { opacity: .5; }
.drop-zone-content { display: grid; justify-items: center; gap: 8px; }
.drop-hero { width: 34px; height: 34px; color: var(--label-3); }
.drop-title { margin: 0; font-size: 15px; font-weight: 600; }
.drop-zone-or { margin: 0; font-size: 12.5px; color: var(--label-3); }

/* Progress */
.progress-container {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 42px;   /* bar gets its own column so % widths are exact */
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}
.progress-container::before {
    content: "";
    position: absolute;
    left: 0; right: 52px;
    height: 6px;
    border-radius: var(--r-pill);
    background: var(--bg-fill-2);
}
.progress-bar {
    position: relative;
    height: 6px;
    width: 0;
    max-width: 100%;
    border-radius: var(--r-pill);
    background: var(--blue);
    transition: width .25s var(--ease);
}
#upload-progress-text, #bunny-progress-text {
    text-align: right;
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--label-2);
}

.upload-queue { margin-top: 16px; }
.upload-queue h4 { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--label-2); }
.upload-queue-item {
    padding: 10px 12px;
    margin-bottom: 6px;
    background: var(--bg-elev-2);
    border-radius: var(--r-sm);
}
.upload-item-header { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.upload-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item-size { color: var(--label-3); font-size: 12px; }
.upload-item-status { font-size: 12px; font-weight: 600; color: var(--label-2); }
.upload-item-status.done, .upload-item-status.completed { color: var(--green); }
.upload-item-status.error, .upload-item-status.failed { color: var(--red); }
.upload-item-progress {
    height: 4px;
    margin-top: 8px;
    border-radius: var(--r-pill);
    background: var(--bg-fill-2);
    overflow: hidden;
}
.upload-item-progress-bar { height: 100%; width: 0; background: var(--blue); border-radius: var(--r-pill); transition: width .25s var(--ease); }

/* Video toolbar + lists */
.video-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 18px;
    border-bottom: 1px solid var(--hairline);
}
.video-toolbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.view-list { display: flex; flex-direction: column; }
.view-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 14px;
    padding: 18px;
}

.video-item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--hairline);
    transition: background .16s var(--ease);
}
.video-item:last-child { border-bottom: 0; }
.video-item:hover { background: rgba(255,255,255,.03); }
.video-item.selected { background: rgba(10,132,255,.12); }

.video-checkbox input { width: 19px; height: 19px; accent-color: var(--blue); cursor: pointer; }

.video-item-thumbnail {
    display: grid;
    place-items: center;
    width: 52px; height: 34px;
    flex: none;
    border-radius: var(--r-sm);
    background: var(--bg-elev-2);
    color: var(--label-3);
}
.video-thumb-icon { width: 19px; height: 19px; }

.video-item-details { flex: 1; min-width: 0; }
.video-item-title {
    font-size: 14.5px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.video-item-meta, .video-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 3px;
    font-size: 12.5px;
    color: var(--label-3);
}
.video-meta-item { display: inline-flex; align-items: center; gap: 5px; }
.video-meta-icon { width: 13px; height: 13px; }
.video-actions { display: flex; gap: 6px; }

.video-card {
    background: var(--bg-elev-2);
    border: 1px solid transparent;
    border-radius: var(--r-md);
    overflow: hidden;
    transition: transform .16s var(--ease), border-color .16s var(--ease);
}
.video-card:hover { transform: translateY(-2px); }
.video-card.selected { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(10,132,255,.22); }
.video-thumbnail {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 16 / 9;
    background: linear-gradient(160deg, #2C2C2E, #1C1C1E);
    color: var(--label-3);
}
.video-thumbnail .video-thumb-icon { width: 30px; height: 30px; }
.video-thumbnail-overlay { position: absolute; top: 8px; left: 8px; }
.video-thumbnail-overlay input { width: 19px; height: 19px; accent-color: var(--blue); cursor: pointer; }
.video-card-body { padding: 11px 12px 12px; }
.video-title {
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.video-card-actions { display: flex; gap: 6px; margin-top: 10px; }
.video-card-actions .btn { flex: 1; }

.selected-videos-display {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 160px;
    overflow-y: auto;
    padding: 10px;
    background: var(--bg-elev-2);
    border-radius: var(--r-md);
}
.selected-video-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px 5px 11px;
    border-radius: var(--r-pill);
    background: rgba(10,132,255,.18);
    color: var(--blue);
    font-size: 12.5px;
    font-weight: 500;
}
.selected-video-tag button {
    border: 0;
    width: 17px; height: 17px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: rgba(10,132,255,.25);
    color: inherit;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
}

/* ------------------------------ Diagnostics ------------------------------ */

.logs-container, .system-info {
    max-height: 420px;
    overflow: auto;
    padding: 16px 18px;
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.65;
    color: var(--label-2);
    background: #0B0B0D;
    white-space: pre-wrap;
    word-break: break-word;
}
.system-info { margin-top: 12px; border-radius: var(--r-md); max-height: 260px; }

.loading {
    margin: 0;
    padding: 18px;
    text-align: center;
    font-size: 13.5px;
    color: var(--label-3);
}

/* --------------------------- Disclosure (details) ------------------------ */

.ingest-advanced {
    margin-top: 14px;
    padding: 0 14px;
    background: var(--bg-elev-2);
    border-radius: var(--r-md);
}
.ingest-advanced[open] { padding-bottom: 14px; }
.ingest-advanced-summary {
    padding: 12px 0;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--label-2);
    cursor: pointer;
    list-style: none;
}
.ingest-advanced-summary::-webkit-details-marker { display: none; }
.ingest-advanced-summary::before {
    content: "›";
    display: inline-block;
    margin-right: 8px;
    transition: transform .2s var(--ease);
}
.ingest-advanced[open] .ingest-advanced-summary::before { transform: rotate(90deg); }

/* ---------------------------------- Sheets ------------------------------- */

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.modal.show { display: flex; animation: fadeIn .2s var(--ease); }

.modal-content {
    width: 100%;
    max-width: 460px;
    max-height: 88vh;
    overflow-y: auto;
    background: #1C1C1E;
    border: 1px solid var(--hairline);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-3);
    animation: sheetIn .32s var(--spring);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetIn {
    from { opacity: 0; transform: translateY(16px) scale(.97); }
    to   { opacity: 1; transform: none; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--hairline);
}
.modal-header h3 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.modal-close {
    display: grid; place-items: center;
    width: 30px; height: 30px;
    border: 0;
    border-radius: 50%;
    background: var(--bg-fill-2);
    color: var(--label-2);
    cursor: pointer;
    transition: background .18s var(--ease), color .18s var(--ease);
}
.modal-close:hover { background: var(--bg-fill-3); color: var(--label); }
.modal-close-icon { width: 15px; height: 15px; }

.modal-body { padding: 20px; }
.modal-body > p { margin-top: 0; font-size: 14px; color: var(--label-2); }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--hairline);
}

/* ------------------------------- Notification ---------------------------- */

.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    z-index: 200;
    padding: 12px 20px;
    border-radius: var(--r-pill);
    background: rgba(44,44,46,.86);
    backdrop-filter: saturate(180%) blur(22px);
    -webkit-backdrop-filter: saturate(180%) blur(22px);
    border: 1px solid var(--hairline);
    box-shadow: var(--shadow-2);
    color: var(--label);
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transform: translate(-50%, -22px);
    pointer-events: none;
    transition: opacity .28s var(--ease), transform .34s var(--spring);
}
.notification.show { opacity: 1; transform: translate(-50%, 0); }
.notification.success { background: rgba(48,209,88,.20); color: #7DE79A; }
.notification.error   { background: rgba(255,69,58,.20);  color: #FF9A93; }
.notification.warning { background: rgba(255,159,10,.20); color: #FFCB6B; }

/* -------------------------------- Utilities ------------------------------ */

.ui-icon { width: 18px; height: 18px; display: inline-block; vertical-align: middle; }

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(120,120,128,.35);
    border: 3px solid transparent;
    background-clip: content-box;
    border-radius: var(--r-pill);
}
::-webkit-scrollbar-thumb:hover { background: rgba(120,120,128,.55); background-clip: content-box; }

/* ------------------------------- Responsive ------------------------------ */

@media (max-width: 1080px) {
    .golive-grid { grid-template-columns: 1fr; }
    .golive-rail { position: static; }
}

@media (max-width: 860px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar {
        position: sticky;
        top: 0;
        z-index: 50;
        height: auto;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        padding: 10px 14px;
        border-right: 0;
        border-bottom: 1px solid var(--hairline);
        overflow-x: auto;
    }
    .brand-text, .sidebar-foot { display: none; }
    .nav { flex-direction: row; gap: 4px; }
    .nav-item span:not(.nav-live-dot) { display: none; }
    .nav-item { padding: 10px; }
    .content { padding: 20px 16px 56px; }
    .section-head h2 { font-size: 24px; }
    .status-chips { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
