/* ============================================================
   camRedorder — design system
   ============================================================ */
:root {
    --bg-0: #0a0a0c;
    --bg-1: #15151a;
    --bg-2: #1d1d24;
    --bg-3: #262630;
    --border: #2a2a32;
    --border-strong: #3a3a44;
    --text-0: #f4f4f6;
    --text-1: #a5a5b0;
    --text-2: #6a6a74;
    --accent: #6b8bff;
    --accent-2: #a855f7;
    --accent-grad: linear-gradient(135deg, #6b8bff 0%, #a855f7 100%);
    --danger: #ef4a4a;
    --danger-bg: #2a1216;
    --success: #37c27a;
    --warn: #f5a623;
    --info: #4dc4ff;

    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-pill: 999px;

    --s-1: 4px;
    --s-2: 8px;
    --s-3: 12px;
    --s-4: 16px;
    --s-5: 24px;
    --s-6: 32px;

    --shadow-1: 0 1px 2px rgba(0,0,0,.25), 0 8px 24px rgba(0,0,0,.25);
    --shadow-2: 0 2px 4px rgba(0,0,0,.3), 0 16px 40px rgba(0,0,0,.35);

    --focus-ring: 0 0 0 3px rgba(107, 139, 255, 0.35);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", sans-serif;
    background: var(--bg-0);
    color: var(--text-0);
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "tnum" 1, "ss01" 1;
    /* Web app: dejamos selección de texto habilitada por defecto. La regla
       `user-select: none` que estaba acá venía de la versión Electron para
       imitar UI nativa. */
}
#root { height: 100%; }

/* Custom scrollbar (WebKit) */
.app-main::-webkit-scrollbar,
.app-sidebar::-webkit-scrollbar,
.modal-body::-webkit-scrollbar { width: 10px; height: 10px; }
.app-main::-webkit-scrollbar-track,
.app-sidebar::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track { background: transparent; }
.app-main::-webkit-scrollbar-thumb,
.app-sidebar::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
    background: var(--bg-3);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
.app-main::-webkit-scrollbar-thumb:hover,
.app-sidebar::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: padding-box; }
.app-main, .app-sidebar, .modal-body {
    scrollbar-width: thin;
    scrollbar-color: var(--bg-3) transparent;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.2; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: inherit; }
img, video { display: block; max-width: 100%; }
.hidden { display: none !important; }

/* Utilities */
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; }
.muted { color: var(--text-1); }
.dim { color: var(--text-2); }

/* ============================================================
   Icons
   ============================================================ */
.ic {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}
.ic-sm { width: 14px; height: 14px; }
.ic-lg { width: 22px; height: 22px; }
.ic-xl { width: 28px; height: 28px; }

/* ============================================================
   App shell / sidebar
   ============================================================ */
.app-shell {
    display: flex;
    height: 100vh;
    align-items: stretch;
    overflow: hidden;
}
.app-main {
    flex: 1;
    min-width: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}
.app-sidebar {
    width: 240px;
    flex-shrink: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
    padding: 16px 12px;
    background: var(--bg-1);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 20;
}
.brand {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    font-weight: 600;
    font-size: 15px;
    letter-spacing: 0.2px;
}
.brand-logo {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--accent-grad);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.08) inset, 0 4px 12px rgba(107,139,255,.35);
    flex-shrink: 0;
}
.brand-logo .ic { color: #fff; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    font-weight: 600;
    font-size: 15px;
    letter-spacing: 0.2px;
    padding: 4px 8px 4px 4px;
    flex-wrap: wrap;
}
.sidebar-brand-text { flex: 1; min-width: 0; }
.sidebar-offline { margin-left: auto; }

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--text-1);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    border: none;
    background: transparent;
    text-align: left;
    text-decoration: none;
    transition: color .15s, background .15s;
}
.sidebar-item:hover { color: var(--text-0); background: var(--bg-2); }
.sidebar-item.active {
    background: var(--bg-3);
    color: var(--text-0);
    box-shadow: 0 1px 2px rgba(0,0,0,.25) inset;
}
.sidebar-label { flex: 1; min-width: 0; }
.sidebar-counter { padding: 0 7px; font-size: 11px; }
.sidebar-dot { margin-left: auto; }

.rec-badge {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 7px 2px 6px;
    border-radius: 999px;
    background: rgba(239, 74, 74, 0.14);
    border: 1px solid rgba(239, 74, 74, 0.45);
    color: var(--danger);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.rec-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--danger);
    box-shadow: 0 0 6px rgba(239, 74, 74, 0.75);
    animation: rec-pulse 1.2s ease-in-out infinite;
}
.rec-count {
    padding-left: 4px;
    border-left: 1px solid rgba(239, 74, 74, 0.35);
    font-weight: 600;
}
.fav-badge-group {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.fav-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(79, 172, 254, 0.14);
    border: 1px solid rgba(79, 172, 254, 0.5);
    color: #4fa3ff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.4px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.fav-badge.fav-badge-priv {
    background: rgba(245, 166, 35, 0.14);
    border-color: rgba(245, 166, 35, 0.5);
    color: #f5a623;
}
@keyframes rec-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.35; transform: scale(0.82); }
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

/* Responsive sidebar: collapse to icon-only rail on narrow viewports */
@media (max-width: 900px) {
    .app-sidebar {
        width: 64px;
        padding: 12px 6px;
        align-items: center;
    }
    .app-sidebar .sidebar-brand-text,
    .app-sidebar .sidebar-label,
    .app-sidebar .sidebar-offline,
    .app-sidebar .rec-badge .rec-count { display: none; }
    .app-sidebar .sidebar-brand { justify-content: center; padding: 4px; }
    .app-sidebar .sidebar-item {
        justify-content: center;
        padding: 10px;
        gap: 0;
        width: 44px;
        height: 44px;
        position: relative;
    }
    .app-sidebar .sidebar-item .ic { width: 20px; height: 20px; }
    .app-sidebar .rec-badge,
    .app-sidebar .sidebar-dot {
        position: absolute;
        top: 4px; right: 4px;
        padding: 0;
    }
    .app-sidebar .rec-badge {
        width: 8px; height: 8px;
        border-radius: 50%;
        background: var(--danger, #ef4a4a);
        font-size: 0;
        overflow: hidden;
    }
    .app-sidebar .rec-badge .rec-dot { display: none; }
}
@media (max-width: 560px) {
    .app-shell { flex-direction: column; height: 100vh; overflow: hidden; }
    .app-main {
        height: auto;
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
    }
    .app-sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 8px;
        gap: 4px;
        overflow-x: auto;
        overflow-y: hidden;
        position: sticky;
        top: 0;
        z-index: 25;
    }
    .app-sidebar .sidebar-brand { display: none; }
    .app-sidebar .sidebar-nav,
    .app-sidebar .sidebar-footer {
        flex-direction: row;
        border-top: none;
        padding-top: 0;
        margin-top: 0;
        gap: 4px;
    }
    .app-sidebar .sidebar-footer { margin-left: auto; }
}

/* ============================================================
   Profile / settings
   ============================================================ */
.profile-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border-radius: 10px;
    background: var(--bg-2);
    border: 1px solid var(--border);
}
.profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-grad);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}
.profile-avatar .ic { width: 28px; height: 28px; color: #fff; }
.profile-info { display: flex; flex-direction: column; gap: 4px; }
.profile-name { font-weight: 600; font-size: 15px; }
.profile-sub { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2, #888); }

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.settings-section:last-child { border-bottom: none; }
.settings-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-0);
}
.settings-hint { font-size: 12px; margin: 0; }

/* JSON paste modal */
.json-paste-area {
    width: 100%;
    min-height: 320px;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 12px;
    line-height: 1.5;
    resize: vertical;
    white-space: pre;
}

/* Loaded custom list chip (Trailers page) */
.json-loaded-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px 6px 12px;
    background: rgba(55, 194, 122, 0.12);
    border: 1px solid rgba(55, 194, 122, 0.35);
    border-radius: 999px;
    color: var(--success);
    font-size: 12px;
    align-self: flex-start;
}
.json-loaded-chip .ic { width: 14px; height: 14px; }
.json-loaded-chip .btn-sm {
    padding: 2px 6px;
    color: var(--text-1);
}
.btn-sm { padding: 4px 8px; font-size: 12px; }

/* ============================================================
   Global download bar (sticky top of app-main)
   ============================================================ */
.global-dl-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    padding: 8px 20px 10px;
    background: rgba(21, 21, 26, 0.92);
    backdrop-filter: saturate(1.2) blur(10px);
    -webkit-backdrop-filter: saturate(1.2) blur(10px);
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text-1);
    text-align: left;
    cursor: pointer;
    font: inherit;
    transition: background .15s;
}
.global-dl-bar:hover { background: rgba(30, 30, 40, 0.96); color: var(--text-0); }

.global-dl-track {
    width: 100%;
    height: 4px;
    background: var(--bg-0);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}
.global-dl-fill {
    height: 100%;
    background: var(--accent-grad);
    width: 0%;
    border-radius: 999px;
    transition: width .3s ease;
    box-shadow: 0 0 8px rgba(107,139,255,.55);
}
.global-dl-track.indeterminate .global-dl-fill {
    width: 35%;
    position: absolute;
    left: 0;
    animation: global-dl-slide 1.3s ease-in-out infinite;
    transition: none;
}
@keyframes global-dl-slide {
    0%   { left: -40%; }
    100% { left: 100%; }
}

.global-dl-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.global-dl-meta .ic { color: var(--accent); width: 14px; height: 14px; }
.global-dl-user { font-weight: 600; color: var(--text-0); }
.global-dl-status { color: var(--text-1); }
.global-dl-file {
    color: var(--text-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

/* ============================================================
   Layout
   ============================================================ */
.container {
    max-width: min(720px, calc(100vw - 32px));
    margin: 0 auto;
    padding: var(--s-6) var(--s-5);
    display: flex;
    flex-direction: column;
    gap: var(--s-5);
}
.container > .panel:first-child {
    transition: margin-top 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
    margin-top: 0;
}
.container.container-stripchat,
.container.container-gallery {
    max-width: calc(100vw - 32px);
}
.container-empty { min-height: calc(100vh - 48px); }
.container-empty > .panel:first-child {
    margin-top: calc((100vh - 48px) / 2 - 120px);
}
@keyframes panel-slide-in {
    from { opacity: 0; transform: translateY(-14px); }
    to { opacity: 1; transform: translateY(0); }
}
.panel-slide-in { animation: panel-slide-in 0.4s cubic-bezier(0.22, 0.61, 0.36, 1); }
.rec-list .rec-card { animation: panel-slide-in 0.3s ease; }
.container-wide {
    max-width: 1440px;
    margin: 0 auto;
    padding: var(--s-5);
}

/* ============================================================
   Panels (cards)
   ============================================================ */
.panel {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
    overflow: hidden;
}

/* Compact panel design for Record / Trailers (inside .container) */
.container > .panel {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 60%),
        var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.03) inset,
        0 10px 30px rgba(0, 0, 0, 0.35);
}
.container > .panel > .panel-header {
    padding: 12px 16px;
    background: linear-gradient(180deg, var(--bg-2), rgba(0, 0, 0, 0));
    border-bottom: 1px solid var(--border);
    position: relative;
}
.container > .panel > .panel-header::after {
    content: "";
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent, #6b8bff) 50%, transparent);
    opacity: 0.35;
    pointer-events: none;
}
.container > .panel > .panel-header h2 {
    font-size: 13px;
    letter-spacing: 0.2px;
}
.container > .panel > .panel-body {
    padding: 16px;
    gap: var(--s-3);
}
.container > .panel > .panel-body .hint {
    font-size: 12px;
}
.container > .panel > .panel-body .input-row .input {
    height: 36px;
}
.container > .panel > .panel-body .input-row .btn-primary {
    height: 36px;
}
.panel-header {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
}
.panel-header h2 {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.2px;
    color: var(--text-0);
}
.panel-header .ic { color: var(--text-1); }
.panel-header { flex-wrap: wrap; row-gap: 6px; }
.panel-header h2 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-header-actions {
    margin-left: auto;
    display: flex;
    gap: var(--s-2);
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    min-width: 0;
}
.panel-header-actions > .btn { flex: 0 0 auto; }

/* Responsive: collapse button labels to icons on narrow screens */
@media (max-width: 900px) {
    .panel-header-actions .btn .btn-label { display: none; }
    .panel-header-actions .btn.btn-sm {
        padding: 0;
        width: 28px;
        justify-content: center;
    }
    .panel-header-actions .btn {
        padding-inline: 10px;
    }
    .panel-header h2 { font-size: 13px; }
}
@media (max-width: 720px) {
    .panel-header-actions { gap: 6px; }
    .panel-header-actions .btn .btn-label,
    .panel-header-actions .btn > span:not(.ic) { display: none; }
    .panel-header-actions .btn {
        padding: 0;
        width: 32px;
        height: 32px;
        min-width: 32px;
        justify-content: center;
    }
    .panel-header-actions .btn.btn-sm {
        width: 28px;
        height: 28px;
        min-width: 28px;
    }
}
@media (max-width: 560px) {
    .panel-header { gap: 6px; padding-inline: 12px; flex-wrap: nowrap; }
    .panel-header h2 { flex: 1 1 auto; min-width: 0; font-size: 12px; }
    .panel-header > .btn-ghost .btn-label { display: none; }
    .panel-header > .btn-ghost {
        padding: 0;
        width: 32px;
        height: 32px;
        justify-content: center;
        flex: 0 0 auto;
    }
    .panel-header-actions {
        flex: 0 0 auto;
        margin-left: auto;
        justify-content: flex-end;
        flex-wrap: nowrap;
        max-width: 60%;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
    }
    .panel-header-actions::-webkit-scrollbar { display: none; }
    .panel-header-actions .counter { font-size: 11px; padding: 2px 6px; flex: 0 0 auto; }
    .panel-header-actions .btn {
        width: 30px;
        height: 30px;
        min-width: 30px;
    }
}
.panel-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
}
.panel-body .hint {
    color: var(--text-1);
    font-size: 13px;
    margin: -4px 0 0;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-2);
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--border);
    background: var(--bg-2);
    color: var(--text-0);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
    white-space: nowrap;
}
.btn:hover { background: var(--bg-3); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn .ic { width: 16px; height: 16px; }

.btn-primary {
    background: var(--accent-grad);
    border: none;
    color: #fff;
    box-shadow: 0 1px 0 rgba(255,255,255,.1) inset, 0 6px 16px rgba(107,139,255,.25);
}
.btn-primary:hover { filter: brightness(1.1); background: var(--accent-grad); }
.btn-primary:disabled { filter: grayscale(0.6); }

.btn-danger {
    background: var(--danger-bg);
    border-color: rgba(239, 74, 74, 0.35);
    color: #ff8585;
}
.btn-danger:hover { background: #3a171c; border-color: rgba(239,74,74,0.55); color: #ffa5a5; }

.btn-ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--text-1);
}
.btn-ghost:hover { color: var(--text-0); background: var(--bg-2); }

.btn-icon {
    width: 36px;
    padding: 0;
    justify-content: center;
}
.btn-icon .ic { width: 18px; height: 18px; }

.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-sm .ic { width: 14px; height: 14px; }
.btn-sm.btn-icon { width: 28px; }

.btn-block { width: 100%; }

/* record pulse on primary REC buttons */
.btn-primary.recording {
    background: linear-gradient(135deg, #ef4a4a, #c22);
    box-shadow: 0 0 0 0 rgba(239,74,74,.6);
    animation: recpulse 1.4s infinite;
}
@keyframes recpulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(239,74,74,.5); }
    50% { box-shadow: 0 0 0 8px rgba(239,74,74,0); }
}

/* ============================================================
   Inputs
   ============================================================ */
.input, .select {
    width: 100%;
    height: 40px;
    padding: 0 14px;
    background: var(--bg-0);
    color: var(--text-0);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }
.input::placeholder { color: var(--text-2); }
textarea.input {
    height: auto;
    min-height: 120px;
    padding: 12px 14px;
    resize: vertical;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 12px;
    line-height: 1.5;
}
.select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a5a5b0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}

.input-row {
    display: flex;
    gap: var(--s-3);
    align-items: stretch;
}
.input-row > .input, .input-row > .select { flex: 1 1 auto; }

/* Toggle (styled checkbox) */
.toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    font-size: 13px;
    color: var(--text-1);
    cursor: pointer;
    user-select: none;
}
.toggle input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 34px;
    height: 20px;
    border-radius: 12px;
    background: var(--bg-3);
    border: 1px solid var(--border-strong);
    position: relative;
    cursor: pointer;
    transition: background .15s;
    flex-shrink: 0;
}
.toggle input[type="checkbox"]::after {
    content: "";
    position: absolute;
    top: 1px;
    left: 1px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text-0);
    transition: transform .15s;
}
.toggle input[type="checkbox"]:checked {
    background: var(--accent-grad);
    border-color: transparent;
}
.toggle input[type="checkbox"]:checked::after { transform: translateX(14px); }
.toggle .ic { color: var(--text-1); }

/* Labels */
.field-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-2);
    font-weight: 500;
    margin-bottom: var(--s-1);
    display: block;
}

/* ============================================================
   Chips / badges
   ============================================================ */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 22px;
    padding: 0 8px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    font-size: 11px;
    color: var(--text-1);
    white-space: nowrap;
}
.chip .ic { width: 12px; height: 12px; }
.chip-accent { color: var(--accent); border-color: rgba(107,139,255,0.35); background: rgba(107,139,255,0.08); }
.chip-live { color: var(--danger); border-color: rgba(239,74,74,0.4); background: rgba(239,74,74,0.08); }
.chip-success { color: var(--success); border-color: rgba(55,194,122,0.35); background: rgba(55,194,122,0.08); }
.chip-warn { color: var(--warn); border-color: rgba(245,166,35,0.35); background: rgba(245,166,35,0.08); }
.chip-off { color: #aaa; border-color: rgba(170,170,170,0.35); background: rgba(170,170,170,0.10); }
.chip-live-status { color: #2ecc71; border-color: rgba(46,204,113,0.4); background: rgba(46,204,113,0.10); }
.chip-group-status { color: #b47cdf; border-color: rgba(155,89,182,0.4); background: rgba(155,89,182,0.10); }
.chip-p2p-status { color: #57b8ef; border-color: rgba(52,152,219,0.4); background: rgba(52,152,219,0.10); }

.model-search {
    position: relative;
    flex: 1 1 280px;
    max-width: 420px;
    min-width: 180px;
}
.model-search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.model-search-icon {
    position: absolute;
    left: 10px;
    width: 14px;
    height: 14px;
    color: var(--text-2);
    pointer-events: none;
}
.model-search-input {
    width: 100%;
    padding-left: 32px;
    padding-right: 30px;
    height: 34px;
}
.model-search-clear {
    position: absolute;
    right: 6px;
    background: transparent;
    border: none;
    color: var(--text-2);
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
}
.model-search-clear:hover { background: rgba(255,255,255,0.06); color: var(--text-0); }
.model-search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg-2, #1d1d24);
    border: 1px solid var(--border, #2a2a32);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    max-height: 360px;
    overflow-y: auto;
}
.model-search-empty {
    padding: 12px 14px;
    color: var(--text-2);
    font-size: 13px;
    text-align: center;
}
.model-search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    width: 100%;
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    text-align: left;
}
.model-search-item.focused,
.model-search-item:hover { background: rgba(255,255,255,0.05); }
.model-search-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: #000;
}
.model-search-avatar.placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.06);
    color: var(--text-2);
}
.model-search-avatar.placeholder .ic { width: 16px; height: 16px; }
.model-search-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}
.model-search-username {
    font-weight: 600;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.model-search-meta .chip { font-size: 10px; padding: 1px 7px; align-self: flex-start; }
.chip-ok { color: #e74c3c; border-color: rgba(231,76,60,0.35); background: rgba(231,76,60,0.08); }
.fp-btn.is-active { background: rgba(231,76,60,0.18); border-color: rgba(231,76,60,0.5); color: #ff6b5a; }
.chip-dim { color: var(--text-2); }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: 20px;
    padding: 0 7px;
    border-radius: var(--r-sm);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-2);
    color: var(--text-1);
    border: 1px solid var(--border);
}
.badge-trailers { color: var(--accent); background: rgba(107,139,255,0.1); border-color: rgba(107,139,255,0.3); }
.badge-lives { color: var(--danger); background: rgba(239,74,74,0.1); border-color: rgba(239,74,74,0.3); }

/* ============================================================
   Counter pill (e.g. 2/4)
   ============================================================ */
.counter {
    font-size: 12px;
    color: var(--text-1);
    background: var(--bg-2);
    border: 1px solid var(--border);
    padding: 2px 10px;
    border-radius: var(--r-pill);
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   Status dot
   ============================================================ */
.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-2);
    flex-shrink: 0;
}
.dot.active { background: var(--success); box-shadow: 0 0 6px var(--success); }
.dot.error { background: var(--danger); box-shadow: 0 0 6px var(--danger); }

/* ============================================================
   Progress bar
   ============================================================ */
.progress {
    width: 100%;
    height: 8px;
    background: var(--bg-0);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--accent-grad);
    width: 0%;
    transition: width .3s ease;
}
.progress-legend {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-1);
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   Error / notice boxes
   ============================================================ */
.error-box {
    padding: 12px 14px;
    background: var(--danger-bg);
    border: 1px solid rgba(239,74,74,0.4);
    border-radius: var(--r-md);
    color: #ff9d9d;
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: var(--s-2);
}
.error-box .ic { color: var(--danger); margin-top: 2px; }

/* ============================================================
   Current item / stat row
   ============================================================ */
.current-item {
    padding: 12px 14px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
}
.current-item .label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-2);
    margin-bottom: 4px;
}
.current-item .title {
    font-size: 14px;
    color: var(--text-0);
    margin-bottom: 8px;
    word-break: break-word;
}
.current-item .meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
}

/* ============================================================
   Details disclosure
   ============================================================ */
details.collapse {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
}
details.collapse > summary {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-1);
    user-select: none;
    display: flex;
    align-items: center;
    gap: var(--s-2);
    list-style: none;
}
details.collapse > summary::-webkit-details-marker { display: none; }
details.collapse[open] > summary { border-bottom: 1px solid var(--border); color: var(--text-0); }
details.collapse .details-body { padding: 14px 16px; }

/* ============================================================
   Recording cards (grid)
   ============================================================ */
.rec-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.rec-list:empty { display: none; }

.rec-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color .15s;
}

/* List (row) layout — overrides the card-column defaults when inside .rec-list */
.rec-list .rec-card {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 16px;
    padding: 12px;
    overflow: visible;
}
.rec-list .rec-thumb-wrap {
    width: 160px;
    aspect-ratio: 16 / 10;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    align-self: start;
}
.rec-list .rec-live-dot { top: 6px; left: 6px; padding: 2px 6px; font-size: 9px; }
.rec-list .rec-status-pill { top: 6px; right: 6px; padding: 2px 6px; font-size: 9px; }
.rec-list .rec-body {
    padding: 0;
    min-width: 0;
    gap: 6px;
    align-self: center;
}
.rec-list .rec-body .rec-channel {
    font-size: 14px;
    font-weight: 600;
}
.rec-list .rec-body .rec-meta { font-size: 11px; }
.rec-list .rec-body .rec-extra {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.rec-list .rec-card.finished { grid-template-columns: 160px minmax(0, 1fr); }
.rec-list .rec-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    grid-column: 3;
    grid-row: 1;
    align-self: center;
    flex-shrink: 0;
}
.rec-list .rec-actions .btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    white-space: nowrap;
}

.rec-list .status-log {
    min-width: 0;
    margin-top: 6px;
    font-size: 10.5px;
}
.rec-list .status-log > summary { padding: 4px 8px; }
.rec-list .status-log-list { max-height: 120px; padding: 4px 8px; }

@media (max-width: 720px) {
    .rec-list .rec-card {
        grid-template-columns: 112px minmax(0, 1fr);
        grid-template-rows: auto auto;
        gap: 10px;
        padding: 10px;
    }
    .rec-list .rec-thumb-wrap { width: 112px; }
    .rec-list .rec-actions {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-content: flex-end;
        flex-wrap: wrap;
    }
}
@media (max-width: 480px) {
    .rec-list .rec-card { grid-template-columns: 1fr; }
    .rec-list .rec-thumb-wrap {
        width: 100%;
        aspect-ratio: 16 / 9;
    }
}
.rec-card:hover { border-color: var(--border-strong); }
.rec-card.finished { opacity: 0.7; }

.rec-thumb-wrap {
    position: relative;
    aspect-ratio: 16 / 10;
    background: linear-gradient(135deg, #0a0a0c, #18181f);
    overflow: hidden;
}
.rec-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.rec-thumb.placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-2);
    padding: 8px;
    text-align: center;
}
.rec-thumb.placeholder .ic { width: 28px; height: 28px; opacity: 0.7; }
.rec-thumb-channel {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.rec-thumb-button {
    position: absolute;
    inset: 0;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    display: block;
}
.rec-thumb-button .rec-thumb { pointer-events: none; }
.rec-thumb-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease;
    background: rgba(0, 0, 0, 0.35);
    pointer-events: none;
}
.rec-thumb-play .ic {
    width: 48px;
    height: 48px;
    color: #fff;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.6));
}
.rec-thumb-button:hover .rec-thumb-play,
.rec-thumb-button:focus-visible .rec-thumb-play { opacity: 1; }

.live-preview-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.live-preview-modal {
    width: min(100%, 960px);
    background: #0a0a0c;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.live-preview-chrome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(20, 20, 24, 0.95);
    border-bottom: 1px solid var(--border);
}
.live-preview-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-0);
    font-weight: 600;
    font-size: 13px;
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: wrap;
}
.live-preview-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-weight: 500;
}
.live-preview-meta .chip {
    font-size: 11px;
    padding: 2px 8px;
}
.live-preview-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff3b30;
    box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.2);
    animation: rec-pulse 1.6s ease-in-out infinite;
}
.live-preview-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.live-preview-modal video {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    display: block;
}
.live-preview-modal-backdrop.fullscreen {
    padding: 0;
}
.live-preview-modal.fullscreen {
    width: 100vw;
    height: 100vh;
    max-width: none;
    border-radius: 0;
    border: none;
    display: flex;
    flex-direction: column;
}
.live-preview-modal.fullscreen video {
    aspect-ratio: auto;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.live-preview-error {
    padding: 10px 14px;
    color: var(--danger, #ff5a5a);
    background: rgba(255, 90, 90, 0.08);
    border-top: 1px solid var(--border);
    font-size: 12px;
}

.live-preview-floating {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 8700;
}
.live-preview-floating-frame {
    position: fixed;
    bottom: 16px;
    right: 16px;
    width: min(360px, calc(100vw - 32px));
    pointer-events: auto;
    background: var(--bg-2, #1d1d24);
    border: 1px solid var(--border, #2a2a32);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    display: flex;
    flex-direction: column-reverse;
    animation: live-preview-floating-in 0.2s ease-out;
}
.live-preview-floating-frame.is-dragged {
    animation: none;
    bottom: auto;
    right: auto;
}
.live-preview-floating.is-hidden,
.live-preview-modal-backdrop.is-hidden { display: none !important; }
.live-preview-floating-frame {
    cursor: grab;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
}
.live-preview-floating-frame.is-dragged { cursor: grabbing; }
.live-preview-floating-frame .fp-btn { cursor: pointer; }

.chip.chip-quality {
    background: rgba(107, 139, 255, 0.15);
    border-color: rgba(107, 139, 255, 0.4);
    color: var(--accent, #6b8bff);
    font-variant-numeric: tabular-nums;
}
.live-preview-floating-stage {
    position: relative;
    cursor: pointer;
    background: #000;
}
.live-preview-floating-stage video {
    width: 100%;
    aspect-ratio: 16 / 9;
    display: block;
    object-fit: cover;
}
.live-preview-floating-stage .live-preview-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-1, #c7c7cd);
    font-size: 12px;
    background: rgba(0, 0, 0, 0.4);
}
.live-preview-floating-chrome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px;
    border-top: 1px solid var(--border, #2a2a32);
}
.live-preview-floating-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-0, #f4f4f6);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.live-preview-floating-title .chip {
    padding: 1px 5px;
    font-size: 10px;
}
.live-preview-floating-actions {
    display: inline-flex;
    gap: 4px;
    flex-shrink: 0;
}
.live-preview-floating-actions .fp-btn {
    padding: 4px 6px;
}
@keyframes live-preview-floating-in {
    from { transform: translateY(12px) scale(0.96); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.rec-live-dot {
    position: absolute;
    top: 10px;
    left: 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: var(--r-sm);
    background: rgba(239,74,74,0.95);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    animation: recpulse 1.4s infinite;
    box-shadow: 0 2px 8px rgba(239,74,74,.3);
}
.rec-live-dot::before {
    content: "";
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
}

.rec-status-pill {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: var(--r-pill);
    background: rgba(10,10,12,0.8);
    backdrop-filter: blur(6px);
    color: var(--text-0);
    font-size: 10px;
    font-weight: 600;
    border: 1px solid rgba(255,255,255,0.1);
}
.rec-status-pill.public { color: #4ade80; border-color: rgba(74,222,128,0.5); }
.rec-status-pill.offline { color: #f87171; border-color: rgba(248,113,113,0.5); }
.rec-status-pill.private { color: #fbbf24; border-color: rgba(251,191,36,0.5); }

.rec-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}
.rec-channel {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-0);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rec-channel .ic { color: var(--text-2); }
.rec-extra {
    font-size: 11px;
    color: var(--text-2);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 14px;
}
.rec-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 11px;
    color: var(--text-1);
    font-variant-numeric: tabular-nums;
}

.rec-card.finished .rec-stop-btn { display: none; }

/* ============================================================
   RecordCard v2 — diseño compacto y consistente
   ============================================================ */
.rec-card-v2 { background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent), var(--bg-2); }
.rec-card-v2 .rec-row-top {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.rec-card-v2 .rec-title {
    font-size: 11px;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.rec-card-v2 .rec-error {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(239, 74, 74, 0.12);
    color: var(--danger, #ef4a4a);
    border: 1px solid rgba(239, 74, 74, 0.25);
    margin-top: 2px;
}

.rec-log-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 8px;
    cursor: pointer;
    color: var(--text-1);
    font-size: 11px;
    width: 100%;
    text-align: left;
    margin-top: 4px;
    transition: border-color 0.15s, background 0.15s;
}
.rec-log-toggle:hover { border-color: var(--border-strong); background: var(--bg-0, #0a0a0c); }
.rec-log-toggle .ic { width: 12px; height: 12px; flex-shrink: 0; }
.rec-log-current {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rec-log-count {
    font-variant-numeric: tabular-nums;
    color: var(--text-2);
    background: var(--bg-2);
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 10px;
    flex-shrink: 0;
}
.rec-log-list {
    list-style: none;
    margin: 4px 0 0;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-1);
    max-height: 140px;
    overflow-y: auto;
    font-size: 10.5px;
}
.rec-log-list li {
    display: grid;
    grid-template-columns: auto auto 1fr;
    gap: 6px;
    padding: 3px 0;
    align-items: baseline;
}
.rec-log-time { color: var(--text-2); font-variant-numeric: tabular-nums; font-size: 10px; }
.rec-log-stage {
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 9px;
    background: var(--bg-2);
    padding: 1px 5px;
    border-radius: 4px;
}
.rec-log-msg {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Hidden the old .rec-extra inline file path & status-log when inside v2 cards */
.rec-card-v2 .rec-extra,
.rec-card-v2 .status-log { display: none; }

@media (max-width: 720px) {
    .rec-list .rec-card-v2 .rec-log-toggle { font-size: 10.5px; }
}

/* ============================================================
   Gallery — folders view
   ============================================================ */
.folders {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--s-4);
}
.category-section-title {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: var(--s-2);
    color: var(--text-2);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 600;
    margin-top: var(--s-4);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.category-section-title:first-child { margin-top: 0; }

.folder-card {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    cursor: pointer;
    transition: transform .15s, border-color .15s, box-shadow .15s;
    position: relative;
}
.folder-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-2);
}
.folder-thumb-wrap {
    position: relative;
    aspect-ratio: 16 / 10;
    background: linear-gradient(135deg, #0a0a0c, #18181f);
    overflow: hidden;
}
.folder-thumb {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.folder-thumb.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-2);
}
.folder-thumb.placeholder .ic { width: 44px; height: 44px; }

.folder-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity .15s, transform .15s;
}
.folder-card:hover .folder-actions { opacity: 1; transform: translateY(0); }
.folder-actions .btn {
    height: 28px;
    width: 28px;
    padding: 0;
    background: rgba(10,10,12,0.85);
    backdrop-filter: blur(6px);
    border-color: rgba(255,255,255,0.1);
}
.folder-actions .btn .ic { width: 14px; height: 14px; }
.folder-actions .btn:hover { background: rgba(30,30,36,0.95); }
.folder-actions .btn.btn-danger:hover { background: rgba(60,20,25,0.95); }

.folder-info {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(180deg, rgba(107,139,255,0.06), rgba(107,139,255,0.02));
    border-top: 1px solid var(--border);
}
.gallery-controls { align-items: center; gap: 8px; flex-wrap: wrap; }
.gallery-search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 200px;
    max-width: 360px;
    margin-left: auto;
    height: 34px;
    padding: 0 10px 0 32px;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.15s, background 0.15s;
}
.gallery-search:focus-within {
    border-color: rgba(107, 139, 255, 0.5);
    background: var(--bg-0);
}
.gallery-search > .ic {
    position: absolute;
    left: 10px;
    width: 14px;
    height: 14px;
    color: var(--text-2);
    pointer-events: none;
}
.gallery-search input {
    flex: 1;
    min-width: 0;
    height: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-0);
    font-size: 13px;
    padding: 0;
}
.gallery-search input::placeholder { color: var(--text-2); }
.gallery-search-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-2);
    cursor: pointer;
}
.gallery-search-clear:hover { background: var(--bg-2); color: var(--text-0); }
.gallery-search-clear .ic { width: 14px; height: 14px; }
.folder-info-text {
    flex: 1;
    min-width: 0;
}
.folder-name {
    font-size: 15px;
    color: var(--text-0);
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.folder-sub {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    flex-wrap: wrap;
}
.folder-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-1);
    font-variant-numeric: tabular-nums;
    padding: 3px 8px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    line-height: 1;
}
.folder-count:first-child {
    color: var(--accent);
    background: rgba(107,139,255,0.12);
    border-color: rgba(107,139,255,0.35);
}
.folder-count.folder-count-muted {
    padding: 0;
    background: transparent;
    border: none;
    color: var(--text-2);
}
.folder-count.folder-count-muted.live { color: #6eda8a; }
.folder-count .ic { width: 12px; height: 12px; }

/* Stripchat model card */
.model-card { border-radius: var(--r-md); overflow: hidden; }
.model-card .folder-thumb-wrap { aspect-ratio: 16 / 10; }

.model-top-chips {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 2;
}
.model-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(10,10,12,0.72);
    backdrop-filter: blur(6px);
    color: #fff;
}
.model-chip .ic { width: 13px; height: 13px; }
.model-chip.chip-recording {
    width: auto;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    background: rgba(231,76,60,0.9);
    color: #fff;
    animation: model-rec-pulse 1.4s ease-in-out infinite;
}
@keyframes model-rec-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(231,76,60,0.7); }
    50% { box-shadow: 0 0 0 6px rgba(231,76,60,0); }
}
.model-card.is-recording .folder-thumb-wrap {
    outline: 2px solid rgba(231,76,60,0.75);
    outline-offset: -2px;
    border-radius: inherit;
}
.model-chip.chip-warn {
    width: auto;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: rgba(220, 90, 40, 0.85);
    color: #fff;
}
.model-chip.chip-new {
    width: auto;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: linear-gradient(135deg, rgba(79,172,254,0.95), rgba(139,93,255,0.95));
    color: #fff;
    border-color: transparent;
}
.model-chip.chip-off {
    width: auto;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: rgba(40, 40, 40, 0.85);
    color: #ddd;
    border-color: transparent;
}
.model-chip.chip-live,
.model-chip.chip-group,
.model-chip.chip-p2p {
    width: auto;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #fff;
    border-color: transparent;
}
.model-chip.chip-live { background: rgba(46, 204, 113, 0.85); }
.model-chip.chip-group { background: rgba(155, 89, 182, 0.88); }
.model-chip.chip-p2p { background: rgba(52, 152, 219, 0.88); }
.model-top-chips-left {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    max-width: calc(100% - 60px);
}
.model-viewers-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(10,10,12,0.75);
    backdrop-filter: blur(6px);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    pointer-events: none;
}
.model-viewers-chip .ic { width: 12px; height: 12px; }

.model-record-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.25);
    background: rgba(220, 50, 50, 0.85);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s, transform .15s;
    z-index: 3;
}
.folder-card:hover .model-record-btn { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.model-record-btn:hover { background: rgba(220, 50, 50, 1); }
.model-record-btn .ic { width: 20px; height: 20px; }

.model-bottom {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 22px 10px 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.85) 80%);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.4px;
    z-index: 1;
}
.model-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff3b3b;
    box-shadow: 0 0 0 3px rgba(255, 59, 59, 0.25);
    animation: model-live-pulse 1.8s ease-in-out infinite;
    flex: 0 0 auto;
}
@keyframes model-live-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(255, 59, 59, 0.25); }
    50%      { box-shadow: 0 0 0 5px rgba(255, 59, 59, 0.15); }
}
.model-username {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.model-flag {
    font-size: 18px;
    line-height: 1;
    flex: 0 0 auto;
}

/* Stripchat page */
.stripchat-section { margin-bottom: 28px; }
.stripchat-section .gallery {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.stripchat-section .model-card {
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.stripchat-section .model-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.stripchat-section .model-card:focus-visible {
    outline: 2px solid var(--accent, #4aa3ff);
    outline-offset: 2px;
}

.live-preview-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    letter-spacing: 0.3px;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.35);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    z-index: 2;
}

.live-preview-loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #fff;
    background: radial-gradient(ellipse at center, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.75) 100%);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    pointer-events: none;
    z-index: 3;
    animation: live-preview-overlay-in 0.18s ease-out;
}
.live-preview-loading-overlay.is-floating {
    gap: 6px;
}
.live-preview-loading-label {
    font-size: 13px;
    letter-spacing: 0.3px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}
.live-preview-loading-overlay.is-floating .live-preview-loading-label {
    font-size: 11px;
}
.live-preview-spinner {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.18);
    border-top-color: var(--accent, #6b8bff);
    animation: live-preview-spin 0.9s linear infinite;
}
.live-preview-loading-overlay.is-floating .live-preview-spinner {
    width: 22px;
    height: 22px;
    border-width: 2px;
}
@keyframes live-preview-spin {
    to { transform: rotate(360deg); }
}
@keyframes live-preview-overlay-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Hide native play button + progress timeline on the modal video controls */
.live-preview-stage video::-webkit-media-controls-play-button,
.live-preview-stage video::-webkit-media-controls-timeline,
.live-preview-stage video::-webkit-media-controls-current-time-display,
.live-preview-stage video::-webkit-media-controls-time-remaining-display {
    display: none !important;
}

.live-preview-stage {
    position: relative;
    background: #000;
}
.live-preview-stage video {
    position: relative;
    z-index: 1;
}
.live-preview-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(12px) brightness(0.7);
    transform: scale(1.05);
    z-index: 0;
    pointer-events: none;
}
.live-preview-modal.fullscreen .live-preview-stage {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
}
.live-preview-modal.fullscreen .live-preview-stage video {
    flex: 1 1 auto;
}
.live-preview-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 44px;
    height: 64px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    background: rgba(10, 12, 16, 0.55);
    color: #fff;
    cursor: pointer;
    backdrop-filter: blur(6px);
    transition: background 120ms ease, transform 120ms ease, opacity 120ms ease;
    opacity: 0.55;
}
.live-preview-nav:hover {
    opacity: 1;
    background: rgba(10, 12, 16, 0.8);
}
.live-preview-nav:active {
    transform: translateY(-50%) scale(0.96);
}
.live-preview-nav .ic {
    width: 28px;
    height: 28px;
}
.live-preview-nav-prev { left: 12px; }
.live-preview-nav-next { right: 12px; }

/* Live preview modal — recording details panel */
.live-preview-details {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-2, rgba(0, 0, 0, 0.25));
    max-height: 240px;
    overflow-y: auto;
    font-size: 12px;
}
.live-preview-details dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 12px;
    margin: 0;
}
.live-preview-details dt {
    color: var(--text-2, #9aa3b1);
    font-weight: 500;
}
.live-preview-details dd {
    margin: 0;
    color: var(--text-1);
    word-break: break-all;
}
.live-preview-details .muted {
    margin: 0;
}
.stripchat-section-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 10px 4px;
    color: var(--text-1);
    letter-spacing: 0.2px;
}
.stripchat-section-title .muted { font-weight: 400; font-size: 12px; }

.stripchat-more-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px 0;
    gap: 12px;
}

.stripchat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px 20px;
    color: var(--text-2);
    text-align: center;
}
.stripchat-empty .ic { width: 48px; height: 48px; color: var(--text-2); }
.stripchat-empty p { margin: 0; }

.stripchat-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
    border-radius: 8px;
    background: rgba(200, 60, 60, 0.1);
    border: 1px solid rgba(200, 60, 60, 0.3);
    color: #f4a7a7;
    font-size: 13px;
}

/* ModelCard live/viewers badges + record action */
.folder-badge {
    position: absolute;
    left: 8px;
    bottom: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(220, 50, 50, 0.92);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.folder-badge .ic { width: 12px; height: 12px; }

.folder-badge-tr {
    left: auto;
    right: 8px;
    bottom: auto;
    top: 8px;
    background: rgba(20, 20, 24, 0.8);
    font-weight: 500;
}

.folder-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(20,20,24,0.85);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.folder-action-btn:hover { background: rgba(107,139,255,0.9); border-color: rgba(107,139,255,1); }
.folder-action-btn .ic { width: 14px; height: 14px; }
.folder-card:hover .folder-info {
    background: linear-gradient(180deg, rgba(107,139,255,0.12), rgba(107,139,255,0.04));
}

.empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-2);
}
.empty .ic { width: 48px; height: 48px; margin-bottom: 12px; color: var(--text-2); }
.empty-title { color: var(--text-1); font-size: 15px; margin-bottom: 4px; }

/* ============================================================
   Gallery — player view
   ============================================================ */
.player-wrap {
    background: #000;
    border-radius: var(--r-lg);
    overflow: hidden;
    margin-bottom: var(--s-4);
    box-shadow: var(--shadow-2);
}
.player-wrap video.main {
    width: 100%;
    max-height: 70vh;
    display: block;
    background: #000;
}

.floating-player {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 360px;
    max-width: calc(100vw - 40px);
    background: #000;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    display: none;
    flex-direction: column;
    animation: floating-player-in 0.2s ease;
}
.floating-player.show {
    display: flex;
}
.floating-player.is-hidden {
    display: none !important;
}
.floating-player video.main {
    width: 100%;
    height: 202px;
    max-height: none;
    display: block;
    background: #000;
    object-fit: contain;
}
.floating-player-chrome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    background: linear-gradient(180deg, rgba(20,20,25,0.95), rgba(12,12,16,0.95));
    border-top: 1px solid var(--border);
}
.floating-player-title {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1;
    color: var(--text-0);
    font-size: 12px;
    font-weight: 600;
}
.floating-player-title > .ic {
    width: 14px;
    height: 14px;
    color: var(--accent);
    flex-shrink: 0;
}
.floating-player-title > span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.floating-player-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.fp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-1);
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.fp-btn:hover {
    background: var(--bg-2);
    color: var(--text-0);
    border-color: var(--border);
}
.fp-btn .ic { width: 15px; height: 15px; }
.fp-btn-labeled {
    width: auto;
    gap: 6px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 600;
}
.fp-btn-rec { color: #ff8a7a; }
.fp-btn-rec:hover { color: #ff6b5a; }
.fp-btn-rec.is-active {
    background: rgba(231,76,60,0.22);
    border-color: rgba(231,76,60,0.6);
    color: #ff5a47;
    animation: fp-pulse-rec 1.4s ease-in-out infinite;
}
@keyframes fp-pulse-rec {
    0%, 100% { box-shadow: 0 0 0 0 rgba(231,76,60,0.55); }
    50% { box-shadow: 0 0 0 5px rgba(231,76,60,0); }
}
.fp-btn-pause { color: var(--text-0); }
.fp-btn-pause.is-paused {
    background: rgba(245,166,35,0.2);
    border-color: rgba(245,166,35,0.55);
    color: #ffb74d;
    animation: fp-pulse-pause 1.6s ease-in-out infinite;
}
@keyframes fp-pulse-pause {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245,166,35,0.5); }
    50% { box-shadow: 0 0 0 5px rgba(245,166,35,0); }
}
.fp-btn:disabled { opacity: 0.45; cursor: not-allowed; animation: none; }
.fp-quality {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 26px;
    padding: 0 8px;
    border-radius: var(--r-sm);
    background: rgba(255,255,255,0.06);
    color: var(--text-0);
    font-size: 12px;
    font-weight: 600;
}
.fp-quality .ic { width: 13px; height: 13px; opacity: 0.8; }
.fp-quality-select {
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    outline: none;
    cursor: pointer;
    max-width: 180px;
}
.fp-quality-select option { background: #1a1a1a; color: #fff; }
@keyframes floating-player-in {
    from { transform: translateY(16px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Responsive player layout: stacked on narrow, split on wide */
.player-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--s-4);
}
.player-side { min-width: 0; display: flex; flex-direction: column; container-type: inline-size; container-name: playerside; }
.player-side .player-controls { margin-bottom: 0; }
.player-layout-full { grid-column: 1 / -1; }
.player-gallery {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--s-2);
}
.player-gallery .card { border-radius: var(--r-md); }
.player-gallery .card .title {
    font-size: 11px;
    padding: 6px 8px;
    line-height: 1.35;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (min-width: 1200px) {
    .player-layout {
        grid-template-columns: minmax(0, 1fr) clamp(360px, 34vw, 520px);
        align-items: start;
    }
    .player-gallery {
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
        max-height: calc(100vh - 180px);
        overflow-y: auto;
        padding-right: 4px;
    }
}
@media (min-width: 1600px) {
    .player-layout {
        grid-template-columns: minmax(0, 1fr) 480px;
    }
}

/* Theater mode: fills the app window (like YouTube's "T" shortcut) */
.container-wide.theater {
    position: fixed;
    inset: 0;
    width: 100vw;
    max-width: none;
    height: 100vh;
    padding: 0;
    margin: 0;
    z-index: 9000;
    background: var(--bg-1, #0e0e0e);
    overflow: auto;
}
.container-wide.theater > .panel {
    height: 100vh;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    border: none;
}
.container-wide.theater > .panel > .panel-body.player-layout {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    grid-template-columns: minmax(0, 1fr) clamp(320px, 28vw, 460px);
    align-items: stretch;
}
.container-wide.theater .player-side { height: 100%; }
.container-wide.theater .player-wrap video.main {
    max-height: calc(100vh - 220px);
    height: calc(100vh - 220px);
    object-fit: contain;
}
.container-wide.theater .player-gallery {
    max-height: calc(100vh - 140px);
    overflow-y: auto;
}
@media (max-width: 1199px) {
    .container-wide.theater > .panel > .panel-body.player-layout {
        grid-template-columns: 1fr;
    }
    .container-wide.theater .player-wrap video.main {
        max-height: 60vh;
        height: auto;
    }
}

/* Expand mode: only the video fills the app window (no sidebar) */
.container-wide.expand {
    position: fixed;
    inset: 0;
    width: 100vw;
    max-width: none;
    height: 100vh;
    padding: 0;
    margin: 0;
    z-index: 9000;
    background: #000;
    overflow: hidden;
}
.container-wide.expand > .panel {
    height: 100vh;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    border: none;
    background: #000;
}
.container-wide.expand > .panel > .panel-header {
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 2;
    background: linear-gradient(to bottom, rgba(0,0,0,.75), rgba(0,0,0,0));
    border: none;
    opacity: 0;
    transition: opacity .2s ease;
}
.container-wide.expand:hover > .panel > .panel-header,
.container-wide.expand > .panel > .panel-header:focus-within {
    opacity: 1;
}
.container-wide.expand > .panel > .panel-body.player-layout {
    flex: 1 1 auto;
    min-height: 0;
    grid-template-columns: 1fr;
    padding: 0;
    gap: 0;
}
.container-wide.expand .player-gallery-wrap,
.container-wide.expand .player-controls,
.container-wide.expand .player-filmstrip,
.container-wide.expand .now-playing { display: none; }
.container-wide.expand .player-side {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.container-wide.expand .player-wrap {
    width: 100%;
    height: 100%;
    border-radius: 0;
    background: #000;
    box-shadow: none;
}
.container-wide.expand .player-wrap video.main {
    width: 100vw;
    height: 100vh;
    max-height: none;
    object-fit: contain;
}
.now-playing {
    padding: 12px 16px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    font-size: 13px;
    color: var(--text-0);
    margin-bottom: var(--s-3);
    display: flex;
    align-items: center;
    gap: var(--s-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.now-playing .ic { color: var(--accent); flex-shrink: 0; }

.controls {
    display: flex;
    gap: var(--s-2);
    flex-wrap: wrap;
    margin-bottom: var(--s-3);
    align-items: center;
}
.controls .btn.active {
    background: rgba(107,139,255,0.15);
    border-color: rgba(107,139,255,0.45);
    color: var(--accent);
}
.controls label {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    font-size: 12px;
    color: var(--text-1);
}
.controls label .select { height: 32px; font-size: 12px; min-width: 130px; }

/* Player controls bar (gallery player) */
.player-controls {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: var(--s-3);
    padding: 10px 12px;
    margin-bottom: var(--s-3);
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    min-width: 0;
}
.player-controls-group {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    flex-wrap: nowrap;
    min-width: 0;
}
.player-controls-filters {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    margin-left: auto;
    flex-wrap: wrap;
}
.player-controls-center {
    justify-content: center;
}
.player-gallery-wrap {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    min-width: 0;
    padding: var(--s-3);
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
}
.player-gallery-filters {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    flex-wrap: wrap;
    padding: 6px 8px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm, 6px);
}
.player-gallery-filters .select-label { flex: 1; min-width: 140px; }
.player-gallery-filters .filter-counter {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-1);
    padding: 4px 10px;
    background: var(--bg-1);
    border-radius: 999px;
    border: 1px solid var(--border);
}
.player-controls .btn.active {
    background: rgba(107,139,255,0.18);
    border-color: rgba(107,139,255,0.55);
    color: var(--accent);
    box-shadow: 0 0 0 1px rgba(107,139,255,0.25) inset;
}

/* Modern playback button — shared base */
.pc-btn {
    position: relative;
}
.pc-btn .ic {
    transition: transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1), color 180ms ease;
    will-change: transform;
}
.pc-btn:hover:not(:disabled) .ic { transform: scale(1.15); }
.pc-btn:active:not(:disabled) .ic { transform: scale(0.92); }

/* Custom tooltip — visible on hover in icon-only mode */
.pc-btn[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translate(-50%, 4px);
    background: var(--bg-3, #1f2433);
    color: var(--text-0, #fff);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 160ms ease, transform 160ms ease;
    z-index: 20;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.pc-btn[data-tip]:hover:not(:disabled)::after {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* Autoplay: when active, icon slides forward to reinforce "auto-advance" */
.pc-autoplay.active .ic {
    animation: pc-forward 1.6s ease-in-out infinite;
}
@keyframes pc-forward {
    0%, 100% { transform: translateX(0); }
    50%      { transform: translateX(2px); }
}

/* Repeat: when active, icon rotates slowly to reinforce "looping" */
.pc-repeat.active .ic {
    animation: pc-spin 3.2s linear infinite;
    transform-origin: 50% 50%;
}
@keyframes pc-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Prev / Next: nudge in direction on hover */
.pc-prev:hover:not(:disabled) .ic { transform: translateX(-2px) scale(1.12); }
.pc-next:hover:not(:disabled) .ic { transform: translateX(2px) scale(1.12); }

/* Delete: soft tilt on hover */
.pc-delete:hover:not(:disabled) .ic { transform: rotate(-6deg) scale(1.12); }

/* Reveal in Finder: gentle lift on hover */
.pc-reveal:hover:not(:disabled) .ic { transform: translateY(-1px) scale(1.1); }

@media (prefers-reduced-motion: reduce) {
    .pc-btn .ic,
    .pc-autoplay.active .ic,
    .pc-repeat.active .ic { animation: none !important; transition: none !important; transform: none !important; }
}

/* Responsive: keep player controls on a single row; collapse to icons when narrow */
@container playerside (max-width: 720px) {
    .player-controls .btn .btn-label { display: none; }
    .player-controls .btn {
        padding: 0;
        width: 32px;
        min-width: 32px;
        height: 32px;
        gap: 0;
        justify-content: center;
        flex: 0 0 32px;
    }
    .player-controls .btn-segment { flex: 0 0 auto; }
    .player-controls .btn-segment .btn {
        width: 32px;
        min-width: 32px;
        flex: 0 0 32px;
    }
    .player-controls-group { gap: 6px; flex-wrap: nowrap; }
    .player-controls { gap: 8px; padding: 8px; }
}
.btn-segment {
    display: inline-flex;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
}
.btn-segment .btn {
    border: none;
    background: transparent;
    border-radius: 0;
    padding: 7px 12px;
    box-shadow: none;
}
.btn-segment .btn + .btn { border-left: 1px solid var(--border); }
.btn-segment .btn:hover:not(:disabled) { background: var(--bg-3); }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; }
.select-label {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    font-size: 12px;
    color: var(--text-1);
}
.select-label .select { height: 32px; font-size: 12px; min-width: 140px; }

.filter-counter {
    color: var(--text-2);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    margin-left: auto;
}

/* Gallery grid */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--s-3);
}
.card {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    cursor: pointer;
    transition: transform .15s, border-color .15s, box-shadow .15s;
    position: relative;
}
.card:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-1);
}
.card.playing {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(107,139,255,0.25);
}
.thumb-wrap {
    position: relative;
    aspect-ratio: 16 / 10;
    background: #000;
    overflow: hidden;
}
.thumb-wrap video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.thumb-wrap .thumb-video-slot {
    width: 100%;
    height: 100%;
}
.card .title {
    padding: 8px 10px;
    font-size: 12px;
    color: var(--text-0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card .badge {
    position: absolute;
    height: 18px;
    padding: 0 5px;
    font-size: 9px;
    letter-spacing: 0.5px;
    background: rgba(10,10,12,0.85);
    backdrop-filter: blur(4px);
    border-color: rgba(255,255,255,0.1);
    color: var(--text-0);
}
.card .badge-likes { bottom: 6px; left: 6px; color: #ff9eb5; border-color: rgba(255,80,120,0.4); }
.card .badge-audio { bottom: 6px; right: 6px; }
.card .badge-audio.sound { color: #4ade80; }
.card .badge-audio.muted { color: var(--text-2); }
.card .badge-duration { top: 6px; right: 6px; font-variant-numeric: tabular-nums; }
.card .delete-btn {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 28px;
    height: 28px;
    padding: 0;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity .15s, transform .15s;
    background: rgba(60,20,25,0.9) !important;
    border: 1px solid rgba(239,74,74,0.4);
    color: #ff9d9d;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.card .delete-btn .ic { width: 14px; height: 14px; }
.card:hover .delete-btn { opacity: 1; transform: translateY(0); }
.card .delete-btn:hover { background: rgba(90,30,35,0.95) !important; }

/* ============================================================
   Status log (recording activity)
   ============================================================ */
.status-log {
    margin-top: 8px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm, 6px);
    background: var(--bg-1);
    font-size: 11px;
}
.status-log > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    color: var(--text-1);
}
.status-log > summary::-webkit-details-marker { display: none; }
.status-log > summary .ic { width: 12px; height: 12px; flex-shrink: 0; }
.status-log-current {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.status-log-count {
    font-variant-numeric: tabular-nums;
    color: var(--text-2);
    background: var(--bg-2);
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 10px;
}
.status-log-list {
    list-style: none;
    margin: 0;
    padding: 4px 8px 6px;
    border-top: 1px solid var(--border);
    max-height: 160px;
    overflow-y: auto;
}
.status-log-list li {
    display: grid;
    grid-template-columns: auto auto 1fr;
    gap: 6px;
    padding: 3px 0;
    color: var(--text-1);
    align-items: baseline;
}
.status-log-time { color: var(--text-2); font-variant-numeric: tabular-nums; font-size: 10px; }
.status-log-stage {
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 9px;
    background: var(--bg-2);
    padding: 1px 5px;
    border-radius: 4px;
}
.status-log-msg { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.log-success, .log-success .ic { color: var(--success, #4ade80); }
.log-warn, .log-warn .ic { color: var(--warning, #f5a623); }
.log-error, .log-error .ic { color: var(--danger, #ef4a4a); }
.log-info, .log-info .ic { color: var(--text-1); }

/* Modal */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.65);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 20px;
}
.modal {
    background: var(--bg-1, #161616); color: var(--text-1, #eee);
    border-radius: 12px; border: 1px solid var(--border, #2a2a2a);
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    max-width: 960px; width: 100%; max-height: calc(100vh - 40px);
    display: flex; flex-direction: column; overflow: hidden;
}
.modal-sm { max-width: 460px; }
.modal-header {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 18px; border-bottom: 1px solid var(--border, #2a2a2a);
}
.modal-header h3 { margin: 0; font-size: 15px; flex: 1; }
.modal-header .btn-ghost { padding: 4px 8px; }
.modal-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.modal-footer {
    display: flex; gap: 8px; justify-content: flex-end;
    padding: 12px 18px; border-top: 1px solid var(--border, #2a2a2a);
    background: rgba(0,0,0,0.2);
}

/* Trim editor */
.trim-video { width: 100%; max-height: 50vh; background: #000; border-radius: 8px; }

.trim-bar-wrap { margin-top: 14px; }
.trim-bar {
    position: relative;
    height: 72px;
    background: var(--bg-2, #1a1a1a);
    border: 1px solid var(--border, #2a2a2a);
    border-radius: 10px;
    overflow: hidden;
    user-select: none;
    cursor: pointer;
    transition: background 0.25s ease;
}
.trim-bar-filmstrip {
    position: absolute;
    inset: 0;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 1;
    z-index: 0;
    pointer-events: none;
    border-radius: inherit;
}
.player-filmstrip {
    position: relative;
    width: 100%;
    height: 80px;
    margin-top: 8px;
    border-radius: 8px;
    overflow: hidden;
    cursor: grab;
    user-select: none;
    touch-action: none;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    transition: box-shadow 0.15s ease;
    background: #0a0a0a;
}
.player-filmstrip:hover {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}
.player-filmstrip.dragging {
    cursor: grabbing;
    box-shadow: inset 0 0 0 1px rgba(255, 59, 48, 0.5);
}
.player-filmstrip-inner {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: left center;
    will-change: transform;
    pointer-events: none;
}
.player-filmstrip-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #ff3b30;
    box-shadow: 0 0 6px rgba(255, 59, 48, 0.8);
    pointer-events: none;
    will-change: left;
}
.trim-bar-cut {
    position: absolute; top: 0; bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        rgba(239, 74, 74, 0.18) 0 8px,
        rgba(239, 74, 74, 0.10) 8px 16px
    );
    pointer-events: none;
    transition: left 0.25s ease, width 0.25s ease, right 0.25s ease;
}
.trim-bar-keep {
    position: absolute; top: 0; bottom: 0;
    background: linear-gradient(180deg, rgba(74,222,128,0.25) 0%, rgba(74,222,128,0.12) 100%);
    border-top: 2px solid rgba(74,222,128,0.55);
    border-bottom: 2px solid rgba(74,222,128,0.55);
    pointer-events: none;
}
.trim-bar-pending {
    position: absolute; top: 0; bottom: 0;
    background: linear-gradient(180deg, rgba(107,139,255,0.28) 0%, rgba(107,139,255,0.14) 100%);
    border-top: 2px dashed rgba(107,139,255,0.75);
    border-bottom: 2px dashed rgba(107,139,255,0.75);
    z-index: 2;
    cursor: grab;
    touch-action: none;
    transition: background 0.15s;
}
.trim-bar-pending:hover {
    background: linear-gradient(180deg, rgba(107,139,255,0.38) 0%, rgba(107,139,255,0.2) 100%);
}
.trim-bar-pending.dragging {
    cursor: grabbing;
    background: linear-gradient(180deg, rgba(107,139,255,0.45) 0%, rgba(107,139,255,0.25) 100%);
}
.trim-fragment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding: 10px;
    background: var(--bg-2, #1a1a1a);
    border: 1px solid var(--border, #2a2a2a);
    border-radius: 10px;
}
.trim-fragment-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 4px 4px 10px;
    background: rgba(74,222,128,0.12);
    border: 1px solid rgba(74,222,128,0.45);
    border-radius: 999px;
    font-size: 12px;
    color: var(--text-0, #eee);
    cursor: pointer;
    font-variant-numeric: tabular-nums;
    transition: background 0.15s, border-color 0.15s;
}
.trim-fragment-chip:hover {
    background: rgba(74,222,128,0.2);
    border-color: rgba(74,222,128,0.7);
}
.trim-fragment-index {
    color: rgba(74,222,128,0.9);
    font-weight: 600;
}
.trim-fragment-dur {
    color: var(--text-2, #888);
    font-size: 11px;
}
.trim-fragment-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,0.3);
    border: none;
    color: var(--text-1, #ccc);
    cursor: pointer;
    padding: 0;
}
.trim-fragment-remove:hover {
    background: rgba(239,74,74,0.4);
    color: #fff;
}
.trim-fragment-remove .ic { width: 12px; height: 12px; }
.trim-bar-playhead {
    position: absolute; top: -2px; bottom: -2px;
    width: 2px; background: #fff;
    box-shadow: 0 0 6px rgba(255,255,255,0.8);
    pointer-events: none;
    transform: translateX(-1px);
    z-index: 4;
}
.trim-bar-playhead.inside {
    background: #a5f3fc;
    box-shadow: 0 0 8px rgba(165,243,252,0.9);
}
.trim-bar-playhead-badge {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-1, #161616);
    color: var(--text-0, #fff);
    border: 1px solid var(--border, #2a2a2a);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    pointer-events: none;
}
.trim-bar-playhead.inside .trim-bar-playhead-badge {
    border-color: rgba(165,243,252,0.6);
    color: #a5f3fc;
}
.trim-handle {
    position: absolute; top: -4px; bottom: -4px;
    width: 14px;
    background: linear-gradient(180deg, #4ade80 0%, #22c55e 100%);
    border-radius: 4px;
    cursor: ew-resize;
    transform: translateX(-7px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.25);
    display: flex; align-items: center; justify-content: center;
    z-index: 3;
    transition: background 0.15s ease;
}
.trim-handle.active, .trim-handle:hover {
    background: linear-gradient(180deg, #86efac 0%, #4ade80 100%);
}
.trim-handle-grip {
    display: block; width: 2px; height: 24px;
    background: rgba(0,0,0,0.35);
    box-shadow: 4px 0 0 rgba(0,0,0,0.35), -4px 0 0 rgba(0,0,0,0.35);
    border-radius: 1px;
}
.trim-bar-labels {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 8px; font-variant-numeric: tabular-nums; font-size: 12px;
    color: var(--text-2, #aaa);
}
.trim-bar-current {
    display: inline-flex; align-items: center; gap: 6px;
}
.chip-time {
    font-variant-numeric: tabular-nums;
    background: var(--bg-2, #1e1e1e); padding: 3px 8px; border-radius: 6px;
    min-width: 64px; text-align: center; font-size: 12px;
}

.trim-hint { color: var(--text-2, #888); font-size: 12px; margin-top: 12px; line-height: 1.5; }
.ic.flip-h { transform: scaleX(-1); }

/* Stats grid shown above the trim bar */
.trim-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 14px;
}
.trim-stat {
    display: flex; flex-direction: column; gap: 2px;
    padding: 10px 12px;
    background: var(--bg-2, #1a1a1a);
    border: 1px solid var(--border, #2a2a2a);
    border-radius: 8px;
}
.trim-stat-label {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-2, #888);
}
.trim-stat-value {
    font-size: 15px; font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-1, #eee);
}
.trim-stat-keep { border-color: rgba(74,222,128,0.35); background: rgba(74,222,128,0.06); }
.trim-stat-keep .trim-stat-value { color: #86efac; }
.trim-stat-cut { border-color: rgba(239,74,74,0.3); background: rgba(239,74,74,0.05); }
.trim-stat-cut .trim-stat-value { color: #fca5a5; }

/* Time tick marks inside the bar */
.trim-bar-tick {
    position: absolute; top: 0; bottom: 0;
    width: 1px; background: rgba(255,255,255,0.06);
    pointer-events: none;
    z-index: 1;
}
.trim-bar-tick.major { background: rgba(255,255,255,0.12); }
.trim-bar-tick-label {
    position: absolute; top: 2px; left: 4px;
    font-size: 10px; color: var(--text-2, #777);
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}

/* Time badge floating above each handle */
.trim-handle-badge {
    position: absolute; bottom: calc(100% + 6px);
    left: 50%; transform: translateX(-50%);
    background: var(--bg-1, #161616);
    color: var(--text-1, #eee);
    border: 1px solid var(--border, #2a2a2a);
    padding: 3px 7px; border-radius: 5px;
    font-size: 11px; font-variant-numeric: tabular-nums;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0; transform-origin: bottom center;
    transition: opacity 0.15s ease;
}
.trim-handle:hover .trim-handle-badge,
.trim-handle.active .trim-handle-badge { opacity: 1; }

/* Bar footer with playhead + selection length */
.trim-bar-footer {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 10px; font-size: 12px;
    color: var(--text-2, #aaa);
    font-variant-numeric: tabular-nums;
}
.trim-selection b { color: var(--text-1, #eee); font-weight: 600; }

/* Toolbar of cut actions */
.trim-toolbar {
    display: flex; align-items: center; gap: 8px;
    margin-top: 14px;
    padding: 8px;
    background: var(--bg-2, #1a1a1a);
    border: 1px solid var(--border, #2a2a2a);
    border-radius: 10px;
    flex-wrap: wrap;
}
/* Override global .btn-sm.btn-icon { width:28px } so labeled buttons can grow */
.trim-toolbar .btn.btn-sm.btn-icon {
    width: auto;
    min-width: 0;
    padding: 0 10px;
    flex: 0 0 auto;
}
.trim-toolbar > .btn { flex: 0 0 auto; }
.trim-toolbar-group {
    display: flex; align-items: center; gap: 6px;
    flex: 0 0 auto;
    flex-wrap: wrap;
}
.trim-toolbar-group > .btn { flex: 0 0 auto; }
.trim-toolbar-sep {
    width: 1px; align-self: stretch;
    background: var(--border, #2a2a2a);
    margin: 0 4px;
    flex: 0 0 auto;
}
.trim-toolbar-spacer { flex: 1 1 auto; min-width: 0; }

/* Responsive: when space is tight, collapse labels to icons */
@media (max-width: 900px) {
    .trim-toolbar .btn.btn-sm > span:not(.ic) { display: none; }
    .trim-toolbar .btn.btn-sm,
    .trim-toolbar .btn.btn-sm.btn-icon,
    .trim-toolbar .btn.btn-sm.btn-primary,
    .trim-toolbar .btn.btn-sm.btn-ghost {
        width: 32px;
        min-width: 32px;
        height: 32px;
        padding: 0;
        gap: 0;
        justify-content: center;
        align-items: center;
        flex: 0 0 32px;
        box-shadow: none;
    }
    .trim-toolbar .btn.btn-sm .ic { width: 16px; height: 16px; }
    .trim-toolbar-spacer { flex-basis: 100%; height: 0; }
}
.btn-icon {
    display: inline-flex; align-items: center; gap: 6px;
}
.btn-icon .ic { width: 14px; height: 14px; }

/* Processing overlay */
.trim-processing { animation: trimProcIn 0.2s ease; }
@keyframes trimProcIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
.trim-progress-phase {
    display: flex; align-items: center; gap: 10px;
    font-size: 14px; font-weight: 500;
    color: var(--text-1, #eee);
    margin-bottom: 14px;
}
.trim-progress-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 0 0 rgba(74,222,128,0.6);
    animation: trimPulse 1.2s infinite;
}
.trim-progress-dot.err { background: var(--danger, #ef4a4a); animation: none; }
@keyframes trimPulse {
    0%   { box-shadow: 0 0 0 0 rgba(74,222,128,0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(74,222,128,0); }
    100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); }
}
.trim-progress-elapsed {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    color: var(--text-2, #aaa);
    font-size: 12px;
    font-weight: 400;
}
.trim-progress-bar {
    position: relative;
    height: 12px;
    background: var(--bg-2, #141414);
    border: 1px solid var(--border, #2a2a2a);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 12px;
}
.trim-progress-fill {
    position: absolute; inset: 0 auto 0 0;
    background: linear-gradient(90deg, #22c55e 0%, #4ade80 100%);
    box-shadow: 0 0 12px rgba(74,222,128,0.35);
    transition: width 0.3s ease;
}
.trim-progress-fill.err {
    background: linear-gradient(90deg, #ef4a4a 0%, #fca5a5 100%);
    box-shadow: none;
}
.trim-progress-pct {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.7);
    font-variant-numeric: tabular-nums;
}
.trim-progress-detail {
    font-size: 13px;
    color: var(--text-1, #eee);
    font-variant-numeric: tabular-nums;
}
.trim-progress-detail b { font-weight: 600; }
.trim-progress-note {
    margin-top: 14px;
    font-size: 11px;
    color: var(--text-2, #888);
    padding-top: 10px;
    border-top: 1px solid var(--border, #2a2a2a);
}

.toast-host {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: min(380px, calc(100vw - 32px));
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-2, #1d1d24);
    border: 1px solid var(--border, #2a2a32);
    border-left: 3px solid var(--accent, #6b8bff);
    border-radius: 8px;
    color: var(--text-0, #f4f4f6);
    font-size: 13px;
    line-height: 1.35;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    animation: toast-slide-in 0.22s ease-out;
}
.toast .ic { width: 16px; height: 16px; flex-shrink: 0; }
.toast .toast-spin { animation: toast-spin 1.2s linear infinite; }
.toast-thumb {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: #000;
}
.toast-clickable { cursor: pointer; }
.toast-clickable:hover { border-color: rgba(79,172,254,0.5); }
.toast-info { border-left-color: #4fa3ff; }
.toast-msg { flex: 1; min-width: 0; word-break: break-word; }
.toast-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
    flex-shrink: 0;
}
.toast-close:hover { opacity: 1; background: rgba(255, 255, 255, 0.06); }
.toast-close .ic { width: 14px; height: 14px; }
.toast-progress { border-left-color: var(--accent, #6b8bff); }
.toast-success { border-left-color: var(--success, #37c27a); }
.toast-success .ic:first-child { color: var(--success, #37c27a); }
.toast-error { border-left-color: var(--danger, #ef4a4a); }
.toast-error .ic:first-child { color: var(--danger, #ef4a4a); }
@keyframes toast-slide-in {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes toast-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== Login / Auth ===== */
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg, #0d0f14);
    padding: 24px;
}
.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface, #161922);
    border: 1px solid var(--border, #232734);
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.login-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}
.login-header h1 { margin: 0; font-size: 22px; font-weight: 600; }
.login-header .ic { width: 22px; height: 22px; color: var(--accent, #6b8bff); }
.login-sub { margin: 0 0 22px; font-size: 13px; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted, #8a8f9b); }
.login-field input {
    background: var(--bg, #0d0f14);
    border: 1px solid var(--border, #232734);
    color: var(--text, #e6e8ee);
    padding: 9px 11px;
    border-radius: 7px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
}
.login-field input:focus { border-color: var(--accent, #6b8bff); }
.login-error {
    background: rgba(239, 74, 74, 0.1);
    border: 1px solid rgba(239, 74, 74, 0.3);
    color: var(--danger, #ef4a4a);
    padding: 8px 11px;
    border-radius: 7px;
    font-size: 13px;
}
.login-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0;
    color: var(--muted, #8a8f9b);
    font-size: 12px;
}
.login-divider::before, .login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border, #232734);
}
.btn-block { width: 100%; justify-content: center; }
.login-toggle {
    margin: 20px 0 0;
    text-align: center;
    font-size: 13px;
    color: var(--muted, #8a8f9b);
}
.link-btn {
    background: none;
    border: none;
    color: var(--accent, #6b8bff);
    cursor: pointer;
    padding: 0;
    font-size: inherit;
    text-decoration: underline;
}
.link-btn:hover { opacity: 0.85; }

/* Telegram link card */
.tg-link-card {
    background: var(--surface, #161922);
    border: 1px solid var(--border, #232734);
    border-radius: 10px;
    padding: 16px;
    margin: 12px 0;
}
.tg-link-card h4 { margin: 0 0 8px; font-size: 14px; }
.tg-link-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    margin-left: 8px;
}
.tg-link-status.linked { background: rgba(55, 194, 122, 0.15); color: var(--success, #37c27a); }
.tg-link-status.unlinked { background: rgba(239, 74, 74, 0.15); color: var(--danger, #ef4a4a); }
.tg-token-box {
    background: var(--bg, #0d0f14);
    border: 1px dashed var(--border, #232734);
    border-radius: 7px;
    padding: 10px 12px;
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: 13px;
    margin: 10px 0;
    user-select: all;
    word-break: break-all;
}
