﻿html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}



/* Override default ASP.NET Core focus styles */
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: none;
    outline: none;
}

/* Reset Bootstrap's default styles */
/**:focus {
    box-shadow: none !important;
    outline: none !important;
}*/

.btn,
.btn-primary,
.btn-secondary,
.form-control {
    transition: none;
}

    /* Only allow our custom transitions */ .btn:hover {
        transition: background-color 0.2s ease;
    }

/* Custom button focus styles to match design */
.btn {
    transition: all 0.2s ease;
}

    .btn:focus {
        border-color: var(--accent);
    }

html {
    position: relative;
    min-height: 100%;
}

body {
    margin-bottom: 60px;
}

/* ---------- PALETTE ---------- */
:root {
    --bg-darker: #121212;
    --bg-dark: #1e1e1e;
    --bg-light: #242424;
    --fg: #e0e0e0;
    --muted: #8a8a8a;
    --accent: #ff914d;
    --accent-dk: #cf5e14;
    --radius: 6px;
    --pad: 12px;
    font-family: Inter,Arial,Helvetica,sans-serif;
}

    :root[data-theme='light'] {
        --bg-darker: #f2f2f2;
        --bg-dark: #e8e8e8;
        --bg-light: #dcdcdc;
        --fg: #1e1e1e;
        --muted: #5c5c5c;
    }

/* ---------- RESET ---------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    color: var(--fg);
}

html, body {
    height: 100%;
    background: var(--bg-darker);
    overflow: hidden;
}

/* ---------- TOP BAR ---------- */
#topbar {
    height: 48px;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    padding: 0 var(--pad);
    gap: var(--pad);
    border-bottom: 1px solid #000;
}

    #topbar input {
        flex: 1;
        background: var(--bg-dark);
        border: none;
        border-radius: var(--radius);
        padding: 7px 10px;
        font-size: .95rem;
    }

        #topbar input::placeholder {
            color: var(--muted);
        }

    #topbar button {
        background: transparent;
        border: none;
        color: var(--fg);
        font-size: 1.25rem;
        cursor: pointer;
    }

        #topbar button:hover {
            color: var(--accent);
        }

#user {
    color: var(--muted);
    font-size: .9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 220px;
}

    #user span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

/* ---------- LAYOUT ---------- */
#viewport {
    display: flex;
    height: calc(100% - 48px);
}

#sidebar {
    width: 280px;
    min-width: 220px;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    border-right: 1px solid #000;
    transition: width .25s;
}

    #sidebar.collapsed {
        width: 0;
        overflow: hidden;
    }

#main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ---------- BROWSER ---------- */
#browser {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill,minmax(190px,1fr));
    grid-auto-flow: row;
    gap: var(--pad);
    padding: var(--pad);
    /*overflow:auto;*/
    background: var(--bg-darker);
    align-content: flex-start;
}

/* Selection outline (template shows orange outline) */
.item.selected {
    outline: 2px solid var(--accent);
    box-shadow: 0 0 0 3px rgba(255,145,77,.25) inset;
}

/* Label row layout (match template) */
.item .label {
    padding: 7px;
    font-size: .8rem;
    display: flex; /* was missing */
    align-items: center;
    gap: 8px;
    white-space: normal; /* let .labelText handle truncation */
}

.label .labelText {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Bin kebab search UI */
.kebab-menu .kebab-search{display:flex;align-items:center;gap:8px;padding:8px 10px;border-bottom:1px solid #000;background:var(--bg-dark)}
.kebab-menu .kebab-search i{color:var(--muted);font-size:.85rem}
.kebab-menu .kebab-search input{flex:1;min-width:0;background:var(--bg-light);border:1px solid #2d2d2d;border-radius:6px;padding:6px 8px;font-size:.75rem;color:var(--fg);outline:none}
.kebab-menu .kebab-search input::placeholder{color:var(--muted)}

/* Per-card kebab in label: visible only when expanded (template behavior) */
.rowMenuBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid #2d2d2d;
    background: #222;
    border-radius: 8px;
    color: #ddd;
    cursor: pointer
}

    .rowMenuBtn:hover {
        background: #2a2a2a;
        color: var(--accent);
    }

.item .label .rowMenuBtn {
    display: none;
}

.item.expanded .label .rowMenuBtn {
    display: inline-flex;
}

/* Controls area look & feel (already similar, reaffirm to match template) */
.controls {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 7px;
}

.item.expanded .controls {
    display: flex;
}

.ctrl-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .75rem;
    position: relative;
}
    /* Pin the duration block to the top-right of the controls row */
    .ctrl-row .ctrl-right {
        position: absolute;
        right: 0;
        top: 0;
        padding-top: 5px;
    }

    .ctrl-row button {
        background: linear-gradient(145deg,var(--bg-dark) 0%,var(--bg-light) 100%);
        border: 1px solid #2d2d2d;
        border-radius: 4px;
        padding: 4px 6px;
        cursor: pointer;
    }

        .ctrl-row button:hover {
            background: #2a2a2a;
        }

.timecode {
    font-family: monospace;
}

.range {
    flex: 1;
    accent-color: var(--accent);
}

/* Thumb and expanded sizes (same as template) */
.thumb {
    height: 120px;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.item.expanded .thumb {
    height: 170px;
}

.item video, .item img {
/*    width: 100%; don't open it*/
    height: 100%;
    /*object-fit: cover; don't open it*/
}

/* Overlay icon bug fix: top/left must use ":" not "=" */
.overlay-icon {
    position: absolute;
    top: 4px; /* was "top=4px" → invalid CSS */
    left: 4px;
    background: rgba(0,0,0,.55);
    padding: 4px;
    border-radius: 50%;
    font-size: .75rem;
}

/* ---------- RESIZER ---------- */
#resizer {
    width: 5px;
    cursor: col-resize;
    background: var(--bg-light);
}

    #resizer:hover {
        background: var(--accent);
    }

/* ---------- META ---------- */
#meta {
    width: 280px;
    min-width: 180px;
    max-width: 600px;
    background: var(--bg-dark);
    border-left: 1px solid #000;
    padding: var(--pad);
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: .85rem;
}

/* ---------- TREE ---------- */
ul.tree {
    flex: 1 1 auto;
    overflow: auto;
    white-space: nowrap;
    padding: var(--pad);
    color: var(--fg);
    position: relative;
    z-index: 1;
}

    ul.tree li {
        list-style: none;
        margin-left: 14px;
        margin-top: 4px;
    }

        ul.tree li span {
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 8px;
            position: relative;
        }

            ul.tree li span:hover {
                color: var(--accent);
            }

        ul.tree li .children {
            margin-left: 18px;
        }

.selected {
    color: var(--accent);
    font-weight: 600;
}

/* ---------- KEBAB ---------- */
ul.tree li span {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    padding-right: 26px; /* ? spazio per il bottone */
}

.kebab-btn {
    position: absolute;
    top: 0;
    right: 0; /* ? ora resta dentro lo span */
    background: none;
    border: none;
    color: var(--muted);
    font-size: .9rem;
    cursor: pointer;
    display: none;
    padding: 2px;
}

    .kebab-btn:hover {
        color: var(--accent);
    }

ul.tree li span:hover > .kebab-btn,
ul.tree li span:focus-within > .kebab-btn {
    display: inline;
}

/* ---------- KEBAB MENU ---------- */
.kebab-menu {
    position: fixed;
    background: var(--bg-light);
    border: 1px solid #000;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    min-width: 150px;
    z-index: 1000;
    box-shadow: 0 8px 20px rgba(0,0,0,.6);
}

    .kebab-menu button {
        background: none;
        border: none;
        text-align: left;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 8px 12px;
        font-size: .9rem;
        cursor: pointer;
        color: var(--fg);
    }

        .kebab-menu button:hover {
            background: var(--bg-dark);
            color: var(--accent);
        }

/* ---------- QUICK SEARCH PANEL ---------- */
#quickSearchPanel {
    position: fixed;
    background: var(--bg-light);
    border: 1px solid #000;
    border-radius: var(--radius);
    padding: 8px 12px;
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 20px rgba(0,0,0,.6);
}

    #quickSearchPanel input {
        width: 200px;
        padding: 6px 8px;
        border: none;
        border-radius: var(--radius);
        background: var(--bg-dark);
        color: var(--fg);
        font-size: .9rem;
    }

        #quickSearchPanel input::placeholder {
            color: var(--muted);
        }

/* ---------- SIDEBAR HEADER ---------- */
#sbHeader {
    display: flex;
    gap: 8px;
    align-items: center;
    background: var(--bg-light);
    padding: var(--pad);
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

    #sbHeader button {
        background: linear-gradient(145deg,var(--bg-dark) 0%,var(--bg-light) 100%);
        border: 1px solid #2d2d2d;
        border-radius: var(--radius);
        color: var(--fg);
        padding: 7px;
        cursor: pointer;
        font-size: 1rem;
    }

        #sbHeader button:hover {
            background: #2a2a2a;
        }

/* ---------- FOLDER SEARCH ---------- */
#folderSearchWrap {
    max-height: 0;
    overflow: hidden;
    padding: 0 var(--pad);
    transition: max-height .25s ease, padding .25s ease;
    position: relative;
    z-index: 5;
    background: var(--bg-dark);
    flex-shrink: 0;
}

    #folderSearchWrap.open {
        max-height: 60px;
        padding: 6px var(--pad);
    }

#folderSearch {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 8px 10px;
    min-height: 36px;
    border: none;
    border-radius: var(--radius);
    background: var(--bg-light);
    color: var(--fg);
    font-size: .95rem;
    outline: none;
}

#myFolderSearch {
    outline: none;
}

    #folderSearch::placeholder {
        color: var(--muted);
    }

    #folderSearch:focus {
        outline: none;
    }

/* ---------- SIDEBAR MENU ---------- */
.sidebar-menu {
    padding: var(--pad);
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid #000;
}

    .sidebar-menu a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 7px;
        border-radius: var(--radius);
        text-decoration: none;
        font-size: .92rem;
        line-height: 1.25;
    }

        .sidebar-menu a:hover {
            background: var(--bg-light);
            color: var(--accent);
        }

.menu-section {
    margin-top: var(--pad);
    border-top: 1px solid #000;
    padding-top: var(--pad);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ---------- THEME SWITCH ---------- */
.switch {
    position: relative;
    width: 44px;
    height: 22px;
}

    .switch input {
        opacity: 0;
        width: 0;
        height: 0;
    }

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--muted);
    border-radius: 22px;
    transition: .3s;
}

    .slider:before {
        content: '';
        position: absolute;
        height: 18px;
        width: 18px;
        left: 2px;
        top: 2px;
        background: #fff;
        border-radius: 50%;
        transition: .3s;
    }

input:checked + .slider {
    background: var(--accent);
}

    input:checked + .slider:before {
        transform: translateX(22px);
    }

/* ---------- CARDS ---------- */
.item {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-light);
    display: flex;
    flex-direction: column;
    transition: transform .15s,box-shadow .15s;
    align-self: start;
}

    .item:hover {
        transform: translateY(-3px);
        box-shadow: 0 5px 12px rgba(0,0,0,.6);
    }

    .item.expanded {
        grid-column: span 2;
        height: 290px;
    }

.thumb {
    height: 120px;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.item.expanded .thumb {
    height: 170px;
}

/*.item video, .item img {
    width: 100%;
    height: auto;
    object-fit: cover;
}*/

#browser .item.expanded[data-assetfiletype="Video"] .thumb {
    height: 194px;
}

#browser .item.expanded[data-assetfiletype="Image"] .thumb {
    height: 249px;
}

#browser .item.expanded[data-assetfiletype="Audio"] .thumb {
    height: auto;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#browser .item.expanded[data-assetfiletype="Audio"] .audio-player {
    width: 100%;
    max-width: 280px;
    margin-top: 8px;
}

.item .label {
    padding: 7px;
    font-size: .8rem;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.overlay-icon {
    position: absolute;
    top =4px;
    left =4px;
    background: rgba(0,0,0,.55);
    padding: 4px;
    border-radius: 50%;
    font-size: .75rem;
}

.controls {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 7px;
}

.item.expanded .controls {
    display: flex;
}

.ctrl-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .75rem;
}

    .ctrl-row button {
        background: linear-gradient(145deg,var(--bg-dark) 0%,var(--bg-light) 100%);
        border: 1px solid #2d2d2d;
        border-radius: 4px;
        padding: 4px 6px;
        cursor: pointer;
    }

        .ctrl-row button:hover {
            background: #2a2a2a;
        }

.timecode {
    font-family: monospace;
}

.range {
    flex: 1;
    accent-color: var(--accent);
}

/* ---------- MODALS ---------- */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    visibility: hidden;
    opacity: 0;
    transition: opacity .25s;
}

    .modal.active {
        visibility: visible;
        opacity: 1;
    }

.modal-content {
    position: relative;
    width: 80%;
    max-width: 960px;
}

.modal .btn[data-role="save"],
.modal button[data-role="save"],
.rs-modal .btn[data-role="save"] {
    background: var(--accent) !important;
    color: var(--bg-darker) !important;
    border-color: var(--accent) !important;
    font-weight: 600 !important;
}

    .modal .btn[data-role="save"]:hover,
    .modal button[data-role="save"]:hover,
    .rs-modal .btn[data-role="save"]:hover {
        background: var(--accent-dk) !important;
        border-color: var(--accent-dk) !important;
        color: var(--bg-darker) !important;
    }

#closeModal {
    position: absolute;
    top: -32px;
    right: -32px;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #fff;
    cursor: pointer;
}

    #closeModal:hover {
        color: var(--accent);
    }

/* ---------- RICH EDITOR ---------- */
#trimSlider .noUi-connect {
    background: var(--accent);
}

#trimSlider .noUi-handle {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    top: -6px;
    background: var(--accent);
    border: 2px solid #fff;
    cursor: ew-resize;
}

#trimSlider.noUi-horizontal {
    height: 5px;
    background: #666;
    border-radius: 2px;
}

#playHead {
    position: absolute;
    top: -2px;
    width: 2px;
    height: 9px;
    background: var(--accent-dk);
}

/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 3px;
}

/* ---------- USER & NOTIFICHE ---------- */
#userArea {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    line-height: 1;
    margin-top: -4px; /* spinge leggermente in alto l'user */
}

#userNotifs {
    display: flex;
    gap: 10px;
    font-size: .9rem;
}

    #userNotifs i {
        position: relative;
        color: var(--muted);
    }

.notif-alert::after {
    content: '', position:absolute, top:-3px;
    right: -3px;
    width: 6px;
    height: 6px;
    background: #ff4545; /* rosso alert */
}

.notif-online {
    color: #2ecc71;
}


/* ---------- PICTURE-IN-PICTURE ---------- */
.pip-btn {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0,0,0,.55);
    border: none;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: .85rem;
    color: #fff;
}

    .pip-btn:hover {
        background: rgba(0,0,0,.8);
    }

/* ---------- SECURITY PANEL ---------- */
#securityPanel {
    position: fixed;
    right: -340px;
    top: 0;
    height: 100%;
    width: 340px;
    background: var(--bg-dark);
    border-left: 1px solid #000;
    transition: right .3s;
    z-index: 999;
    display: flex;
    flex-direction: column;
}

    #securityPanel.active {
        right: 0;
    }

#securityHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-light);
    padding: var(--pad);
    border-bottom: 1px solid #000;
}

    #securityHeader h3 {
        font-size: 1rem;
        margin: 0;
    }

    #securityHeader button {
        background: none;
        border: none;
        font-size: 1.25rem;
        color: var(--fg);
        cursor: pointer;
    }

        #securityHeader button:hover {
            color: var(--accent);
        }

.security-body {
    padding: var(--pad);
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: .9rem;
}

    .security-body input {
        accent-color: var(--accent);
    }

/* ---------- TAB HANDLE ---------- */
#tabHandle {
    height: 6px;
    background: var(--bg-light);
    cursor: row-resize;
}

    #tabHandle:hover {
        background: var(--accent);
    }

/* ---------- TAB BAR ---------- */
#tabBar {
    height: 30px;
    background: var(--bg-light);
    display: flex;
    border-top: 1px solid #000;
}

.tabBtn {
    background: none;
    border: none;
    padding: 6px 14px;
    color: var(--muted);
    cursor: pointer;
    font-size: .8rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

    .tabBtn:hover,
    .tabBtn:hover > *,
    .tabBtn.active,
    .tabBtn.active > * {
        color: var(--accent);
    }

.tabKebab {
    background: none;
    border: none;
    margin-left: 12px; /* spazio fra testo e kebab */
    color: var(--muted);
    cursor: pointer;
    font-size: .8rem;
}

    .tabKebab:hover {
        color: var(--accent);
    }

#tabPanel {
    height: 220px;
    transition: height .25s ease;
    background: var(--bg-dark);
}

    #tabPanel.collapsed {
        height: 0;
    }

.pane {
    padding: 8px;
    overflow: auto;
    display: none;
    height: 100%;
}

    .pane.active {
        display: block;
    }

#basketList {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

    #basketList li {
        background: var(--bg-light);
        border: 1px solid #444;
        border-radius: var(--radius);
        padding: 6px 8px;
        font-size: .8rem;
        cursor: grab;
    }

        #basketList li:active {
            cursor: grabbing;
        }

#logTable {
    width: 100%;
    border-collapse: collapse;
    font-size: .8rem;
}

    #logTable thead {
        background: var(--bg-light);
    }

    #logTable th, #logTable td {
        border: 1px solid #444;
        padding: 4px 6px;
        text-align: left;
    }

.status.success {
    color: #2ecc71;
}

.status.failed {
    color: #e74c3c;
}

.status.progress {
    color: #f1c40f;
}

/* Process tab action icons color fix */
#logTable .logAct {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    opacity: 0.7;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/*#logTable .logAct:hover {
    opacity: 1;
}*/

/*#logTable .logAct i {
    color: var(--fg);
    font-size: 14px;
}*/

/*#logTable .logAct:hover i {
    color: var(--accent);
}*/

.basketPreview {
    position: absolute;
    background: var(--bg-dark);
    border: 1px solid #000;
    border-radius: var(--radius);
    padding: 6px;
    box-shadow: 0 6px 18px rgba(0,0,0,.7);
    z-index: 1500;
    max-width: 260px;
}

    .basketPreview video,
    .basketPreview img {
        width: 100%;
        height: auto;
        border-radius: var(--radius);
    }

    .basketPreview::after { /* freccia fumetto */
        content: '';
        position: absolute;
        bottom: -8px;
        left: 20px;
        border: 8px solid transparent;
        border-top-color: var(--bg-dark);
    }

#tabPanel {
    position: relative;
}
/* serve per ancorare il FAB */

/* === Template match: final overrides (do not change #browser overflow) === */

/* Keep label as a flex row so spacing and kebab align like the template */
#browser .item .label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px;
    font-size: .8rem;
    white-space: normal; /* truncation handled by .labelText */
}

#browser .label .labelText {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Kebab only visible when expanded (template behavior) */
#browser .item .label .rowMenuBtn {
    display: none;
}

#browser .item.expanded .label .rowMenuBtn {
    display: inline-flex;
}

/* Controls bar: exact row spacing and right-aligned “Durata” */
#browser .item .controls {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 7px;
}

#browser .item.expanded .controls {
    display: flex;
}

#browser .item .ctrl-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .75rem;
    line-height: 1; /* compact like template */
}

#browser .item .timecode {
    font-family: monospace;
}

#browser .item .range {
    flex: 1;
    accent-color: var(--accent);
}

/* Ensure the right side block stays flush-right even if other rules interfere */
#browser .item .ctrl-row > span[style*="margin-left:auto"] {
    margin-left: auto !important;
}

/* Overlay icon (ensure final syntax wins) */
#browser .overlay-icon {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(0,0,0,.55);
    padding: 4px;
    border-radius: 50%;
    font-size: .75rem;
}

/* Expanded outline like the template screenshot */
#browser .item.expanded {
    outline: 2px solid var(--accent);
    box-shadow: 0 0 0 3px rgba(255,145,77,.25) inset;
    border-radius: 12px;
}

/* Duration block aligned to the right in the controls row */
/*#browser .controls .ctrl-right{
  margin-left:auto;
  white-space:nowrap;
  font-weight:600;
}
#browser .controls .ctrl-right .duration{ font-weight:700; }*/

/* === List view overrides (synced with rdo/index.html sample) === */
#browser.listMode{display:block;padding:0;overflow:auto;background:var(--bg-darker);} /* ensure scroll */
#browser.listMode .listTable{
    width:max-content;          /* grow to intrinsic width so container scrolls */
    min-width:100%;             /* still fill when large viewport */
    border-collapse:collapse;
    font-family:Inter,Arial,Helvetica,sans-serif;
    font-size:.92rem;
    table-layout:auto;          /* allow natural sizing (no forced shrink) */
}
#browser.listMode .listTable thead{position:sticky;top:0;background:var(--bg-light);z-index:2;}
#browser.listMode .listTable th,#browser.listMode .listTable td{border-bottom:1px solid #333;padding:9px 10px;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
#browser.listMode .listTable tbody tr:hover{background:rgba(255,255,255,.03);} 
#browser.listMode .listTable tbody tr.selected{background:rgba(255,145,77,.14);outline:1px solid rgba(255,145,77,.35);} 
#browser.listMode .listTable .col-name{width:40%;min-width:560px;font-weight:500;} /* keep wide like template; triggers horizontal scroll when needed */
#browser.listMode .listTable tbody tr[data-kind="category"]{cursor:pointer;}
#browser.listMode .listTable tbody tr[data-kind="category"] .col-name{color:var(--accent,#ff914d);}
#browser.listMode .listTable .col-type{width:7rem;}
#browser.listMode .listTable .col-codec{width:14rem;}
#browser.listMode .listTable .col-res{width:10rem;}
#browser.listMode .listTable .col-dur{width:9rem;font-family:monospace;}
#browser.listMode .listTable .col-owner{width:10rem;}
#browser.listMode .listTable .col-act{width:46px;text-align:right;}
#browser.listMode .rowMenuBtn{width:26px;height:26px;border:1px solid #2d2d2d;background:#222;border-radius:7px;color:#ddd;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;font-size:.85rem;padding:0;}

/* Metadata loading placeholders with shimmer effect */
.metadata-placeholder {
    display: inline-block;
    width: 30px;
    height: 1em;
    background: linear-gradient(90deg, #333 25%, #444 50%, #333 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
    border-radius: 2px;
    vertical-align: middle;
}

@keyframes loading-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.listTable tbody tr.loading-metadata {
    opacity: 0.7;
}

.insightCard .cardHead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    cursor: pointer;
}

.insightHeadMain {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.insightCard .cardHead h3 {
    margin: 0;
    font-size: 14px;
    letter-spacing: .1px;
    text-transform: none;
    color: #cfd6e3;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.insightCard .count {
    color: #f4f6ff;
    font-weight: 700;
    background: #1b2333;
    border-radius: 8px;
    padding: 2px 10px;
    display: inline-flex;
    align-items: center;
    font-size: 18px;
    line-height: 1.2;
}

.insightHeadActions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.insightHeadBtn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid #202634;
    background: #1a1f2a;
    color: #e0e0e0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}

.insightCard .cardToggle {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: #1a1f2a;
    border: 1px solid #202634;
    color: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s;
}

.insightCard .cardHead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    cursor: pointer;
}

.insightCard.collapsed .cardBody {
    display: none;
}

.insKeywordList, .insMarkerList {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
    overflow: auto;
    padding-right: 6px;
}

.insMarker.selected {
    outline: 1px solid rgba(116, 224, 131, .45);
    box-shadow: 0 0 0 2px rgba(116, 224, 131, .18) inset;
}

.insKeyword, .insMarker {
    position: relative;
}

.insMarker {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid #2d2d2d;
    border-radius: 12px;
    background: #141924;
    padding: 12px;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}

.insKeyword .head, .insMarker .head {
    flex-wrap: wrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.insKeyword .tc, .insMarker .tc {
    min-width: auto;
    padding-right: 6px;
    font-size: 12px;
}

.insMarker .tc {
    color: #74e083;
    font-weight: 700;
}

.insMarker .kws {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    color: #9fb0c8;
    font-size: 11px;
}

.insMarker .head .markerStarsRead {
    margin-left: auto;
}

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

.insMarker .kws .badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #212633;
    border: 1px solid #2d2d2d;
    border-radius: 999px;
    padding: 4px 8px;
    color: #dbe3ef;
}
.insMarker .txt {
    margin-top: 4px;
    color: #dbe3ef;
    font-size: 13px;
    white-space: normal;
}

.insMarker .txt {
    line-height: 1.4;

}



#richModal .modal-content {
    width: 96vw;
    max-width: 1550px;
    height: 92vh;
    background: #0c0e12;
    border-radius: 14px;
    padding: 20px 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-sizing: border-box;
    font-family: "Inter",sans-serif;
    border: 1px solid #0b0c0f;
    box-shadow: 0 24px 60px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.03) inset;
    position: relative;
}

#richModal .closeX {
    position: absolute;
    top: -34px;
    right: -34px;
    background: none;
    border: none;
    font-size: 2.3rem;
    color: #fff;
    cursor: pointer;
}

/* GRID principale */
#rmGrid {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0,1fr) minmax(300px,35%);
    gap: 12px;
    overflow: hidden;
    min-height: 0;
}

#rmLeft {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}
/* Player box */
#rmPlayerWrap {
    --box-w: 1280px;
    --box-h: 760px;
    --scrollbar-w: 16px;
    position: relative;
    width: min(var(--box-w), calc(100% - var(--scrollbar-w)));
    height: var(--box-h);
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    outline: 1px solid #151821;
    box-shadow: 0 10px 24px rgba(0,0,0,.5);
    margin-inline: auto;
}

    #rmPlayerWrap #bboxOverlay {
        position: absolute;
        inset: 0;
        pointer-events: none;
        z-index: 5;
        display: flex;
        align-items: flex-start;
        justify-content: center;
    }

        #rmPlayerWrap #bboxOverlay.active {
            pointer-events: auto;
            cursor: crosshair;
        }

        #rmPlayerWrap #bboxOverlay .bbox-canvas {
            position: relative;
            flex: 1;
            height: 100%;
        }

        #rmPlayerWrap #bboxOverlay .bbox-rect {
            position: absolute;
            border: 2px solid rgba(255,138,51,.95);
            background: rgba(255,138,51,.16);
            box-shadow: 0 0 0 1px rgba(0,0,0,.35);
            cursor: move;
            box-sizing: border-box;
            touch-action: none;
        }

            #rmPlayerWrap #bboxOverlay .bbox-rect.hidden {
                display: none;
            }

            #rmPlayerWrap #bboxOverlay .bbox-rect .bbox-handle {
                position: absolute;
                width: 10px;
                height: 10px;
                background: #ff8a33;
                border: 1px solid rgba(12,12,18,.75);
                border-radius: 50%;
                box-shadow: 0 0 0 1px rgba(0,0,0,.2);
            }

                #rmPlayerWrap #bboxOverlay .bbox-rect .bbox-handle.nw {
                    left: -6px;
                    top: -6px;
                    cursor: nwse-resize;
                }

                #rmPlayerWrap #bboxOverlay .bbox-rect .bbox-handle.ne {
                    right: -6px;
                    top: -6px;
                    cursor: nesw-resize;
                }

                #rmPlayerWrap #bboxOverlay .bbox-rect .bbox-handle.sw {
                    left: -6px;
                    bottom: -6px;
                    cursor: nesw-resize;
                }

                #rmPlayerWrap #bboxOverlay .bbox-rect .bbox-handle.se {
                    right: -6px;
                    bottom: -6px;
                    cursor: nwse-resize;
                }

                #rmPlayerWrap #bboxOverlay .bbox-rect .bbox-handle.n {
                    top: -6px;
                    left: calc(50% - 5px);
                    cursor: ns-resize;
                }

                #rmPlayerWrap #bboxOverlay .bbox-rect .bbox-handle.s {
                    bottom: -6px;
                    left: calc(50% - 5px);
                    cursor: ns-resize;
                }

                #rmPlayerWrap #bboxOverlay .bbox-rect .bbox-handle.w {
                    left: -6px;
                    top: calc(50% - 5px);
                    cursor: ew-resize;
                }

                #rmPlayerWrap #bboxOverlay .bbox-rect .bbox-handle.e {
                    right: -6px;
                    top: calc(50% - 5px);
                    cursor: ew-resize;
                }

        #rmPlayerWrap #bboxOverlay .bbox-instructions {
            position: absolute;
            top: 12px;
            left: 50%;
            transform: translateX(-50%);
            padding: 6px 12px;
            border-radius: 999px;
            background: rgba(8,11,18,.82);
            border: 1px solid rgba(255,255,255,.12);
            color: #dbe3ef;
            font-size: 12px;
            letter-spacing: .2px;
            white-space: nowrap;
            pointer-events: none;
            opacity: 0;
            transition: opacity .15s;
        }

        #rmPlayerWrap #bboxOverlay.active .bbox-instructions.visible {
            opacity: 1;
        }

        #rmPlayerWrap #bboxOverlay .bbox-toast {
            position: absolute;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            padding: 6px 12px;
            border-radius: 8px;
            background: rgba(19,24,36,.94);
            border: 1px solid rgba(255,255,255,.12);
            color: #fff;
            font-size: 12px;
            letter-spacing: .2px;
            box-shadow: 0 12px 28px rgba(0,0,0,.45);
            opacity: 0;
            pointer-events: none;
            transition: opacity .18s;
        }

            #rmPlayerWrap #bboxOverlay .bbox-toast.visible {
                opacity: 1;
            }

        #rmPlayerWrap #bboxOverlay .bbox-preview-layer {
            position: absolute;
            inset: 0;
            pointer-events: none;
            overflow: visible;
            z-index: 0;
        }

        #rmPlayerWrap #bboxOverlay .bbox-preview {
            position: absolute;
            border: 2px solid rgba(255,138,51,.85);
            box-sizing: border-box;
            background: rgba(255,138,51,.12);
            border-radius: 4px;
            pointer-events: none;
        }

            #rmPlayerWrap #bboxOverlay .bbox-preview .bbox-preview-label {
                position: absolute;
                left: 0;
                padding: 2px 8px;
                font-size: 11px;
                letter-spacing: .2px;
                color: #111622;
                background: rgba(255,255,255,.85);
                border-radius: 6px;
                box-shadow: 0 4px 14px rgba(0,0,0,.35);
                font-weight: 600;
                pointer-events: none;
                white-space: nowrap;
            }

                #rmPlayerWrap #bboxOverlay .bbox-preview .bbox-preview-label.keyword {
                    background: rgba(180,215,255,.88);
                    color: #0d1628;
                }

                #rmPlayerWrap #bboxOverlay .bbox-preview .bbox-preview-label.unnamed {
                    font-style: italic;
                }

        #rmPlayerWrap #bboxOverlay .bbox-controls {
            position: absolute;
            bottom: 18px;
            right: 18px;
            display: flex;
            gap: 8px;
            pointer-events: none;
            opacity: 0;
            transition: opacity .18s;
        }

        #rmPlayerWrap #bboxOverlay.active .bbox-controls.visible {
            pointer-events: auto;
            opacity: 1;
        }

        #rmPlayerWrap #bboxOverlay .bbox-controls button {
            background: rgba(20,27,40,.92);
            border: 1px solid rgba(255,255,255,.12);
            border-radius: 999px;
            color: #dbe3ef;
            font-size: 12px;
            padding: 6px 12px;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            transition: background .15s, border-color .15s, color .15s;
        }

            #rmPlayerWrap #bboxOverlay .bbox-controls button:disabled {
                opacity: .45;
                cursor: default;
            }

            #rmPlayerWrap #bboxOverlay .bbox-controls button.cancel {
                background: rgba(50,22,26,.9);
                border-color: rgba(255,120,130,.28);
                color: #ff98a3;
            }

            #rmPlayerWrap #bboxOverlay .bbox-controls button.delete {
                background: rgba(46,18,21,.92);
                border-color: rgba(255,120,130,.38);
                color: #ff9aa7;
            }

    #rmPlayerWrap .video-js {
        width: 100% !important;
        height: 100% !important;
    }

    #rmPlayerWrap.cineOn .video-js .vjs-control-bar {
        display: flex !important;
    }

    #rmPlayerWrap .vjs-tech {
        width: 100%;
        height: 100%;
        object-fit: contain !important;
        background: #000;
    }

#rmImageWrap {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 24px;
    display: none;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(28,32,43,.94), rgba(14,16,23,.92));
}

    #rmImageWrap img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        border-radius: 14px;
        box-shadow: 0 24px 48px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.06) inset;
    }

    #rmImageWrap .imageStatus {
        position: absolute;
        left: 50%;
        bottom: 28px;
        transform: translateX(-50%);
        padding: 8px 16px;
        background: rgba(10,13,20,.85);
        border-radius: 999px;
        border: 1px solid rgba(255,255,255,.08);
        color: #d6dae7;
        font-size: 13px;
        letter-spacing: .2px;
        box-shadow: 0 12px 24px rgba(0,0,0,.35);
        backdrop-filter: blur(6px);
    }

        #rmImageWrap .imageStatus.hidden {
            display: none;
        }

        #rmImageWrap .imageStatus.error {
            background: rgba(64,16,20,.86);
            border-color: rgba(255,117,117,.35);
            color: #ffb7b7;
        }

/* Waveform overlay */
#wfOverlay {
    --wf-h: 220px;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--wf-h);
    background: linear-gradient(180deg, rgba(0,0,0,.0), rgba(0,0,0,.45));
    border-top: 1px solid rgba(255,255,255,.06);
    padding: 6px 8px 8px;
    pointer-events: auto;
    z-index: 6;
    transition: opacity .15s;
}

    #wfOverlay.hidden {
        opacity: 0;
        pointer-events: none;
    }

    #wfOverlay .vjs-wavesurfer {
        height: 100% !important;
        overflow-x: auto !important;
    }

    #wfOverlay canvas {
        border-radius: 6px;
    }

/* Fallback when plugin renders in Video.js default container */
#rmPlayerWrap .video-js .vjs-wavesurfer {
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    height: 48% !important;
    z-index: 6 !important;
    overflow: hidden !important;
}

#rmPlayerWrap .video-js .vjs-wavesurfer wave,
#rmPlayerWrap .video-js .vjs-wavesurfer waveform {
    height: 100% !important;
}

#wfZoomControls {
    position: absolute;
    top: 8px;
    right: 8px;
    display: none;
    gap: 6px;
    align-items: center;
    z-index: 7;
}

    #wfZoomControls.visible {
        display: flex;
    }

.wfZoomBtn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(18,22,31,.85);
    border: 1px solid rgba(255,255,255,.12);
    color: #e9eaf0;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s,color .15s;
}

    .wfZoomBtn:hover {
        background: rgba(35,41,54,.9);
        color: #fff;
    }

    .wfZoomBtn:active {
        transform: translateY(1px);
    }

/* Nascondi controlbar VJS */
#richModal .video-js .vjs-control-bar {
    display: none !important;
}

#richModal.image-mode #rmPlayerWrap {
    height: auto;
    min-height: 420px;
    background: #0d0f15;
}

#richModal.image-mode #rmImageWrap {
    display: flex;
}

#richModal.image-mode #rmPlayerWrap .video-js,
#richModal.image-mode #rmPlayerWrap .vjs-tech,
#richModal.image-mode #wfOverlay {
    display: none !important;
}

#richModal.image-mode #vPanel,
#richModal.image-mode #rmTools {
    display: none !important;
}

#richModal.image-mode #rmGrid {
    grid-template-columns: minmax(0,1fr) minmax(280px,32%);
}

#richModal.image-mode #sideHelpBtn,
#richModal.image-mode #sideHelpPopup {
    display: none !important;
}

#richModal.image-mode #sideTabs [data-tab="timeline"],
#richModal.image-mode #panel_timeline {
    display: none !important;
}

#richModal.image-mode #insightScenesCard,
#richModal.image-mode #insightMarkersCard {
    display: none !important;
}

#imageNavigator {
    display: none;
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(15,18,26,.82);
    border: 1px solid rgba(31,36,48,.88);
    box-shadow: inset 0 0 0 1px rgba(10,12,18,.35), 0 12px 32px rgba(0,0,0,.35);
    gap: 10px;
    justify-content: center;
    align-items: center;
}

    #imageNavigator .imgNavList {
        display: flex;
        gap: 10px;
        align-items: center;
    }

    #imageNavigator .imgNavArrow {
        width: 36px;
        height: 70px;
        border-radius: 10px;
        border: 1px solid rgba(255,255,255,.08);
        background: rgba(18,22,31,.82);
        color: #d0d6e8;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        cursor: pointer;
        transition: background .18s, color .18s, border-color .18s, transform .18s;
        padding: 0;
    }

        #imageNavigator .imgNavArrow:hover {
            background: rgba(30,36,50,.92);
            color: #fff;
        }

        #imageNavigator .imgNavArrow:disabled {
            opacity: .35;
            cursor: default;
            pointer-events: none;
        }

        #imageNavigator .imgNavArrow:focus-visible {
            outline: 2px solid rgba(255,255,255,.25);
            outline-offset: 2px;
        }

    #imageNavigator .imgNavItem {
        width: 94px;
        height: 70px;
        border-radius: 10px;
        border: 1px solid rgba(255,255,255,.1);
        background: #161b26 center/cover no-repeat;
        position: relative;
        cursor: pointer;
        transition: border-color .18s, transform .18s, box-shadow .18s;
        padding: 0;
    }

        #imageNavigator .imgNavItem::after {
            content: "";
            position: absolute;
            inset: 0;
            border-radius: inherit;
            background: linear-gradient(180deg, rgba(10,12,18,0) 0%, rgba(10,12,18,.55) 100%);
            opacity: .55;
            transition: opacity .18s;
        }

        #imageNavigator .imgNavItem.current {
            border-color: #ff8a33;
            box-shadow: 0 0 0 1px rgba(255,138,51,.45), 0 0 0 4px rgba(255,138,51,.18);
            transform: translateY(-2px);
        }

            #imageNavigator .imgNavItem.current::after {
                opacity: .15;
            }

        #imageNavigator .imgNavItem:hover::after {
            opacity: .25;
        }

        #imageNavigator .imgNavItem:focus-visible {
            outline: 2px solid rgba(255,255,255,.25);
            outline-offset: 2px;
        }

        #imageNavigator .imgNavItem .badge {
            position: absolute;
            bottom: 5px;
            right: 6px;
            padding: 1px 5px;
            font-size: 9px;
            background: rgba(12,15,22,.82);
            color: #cfd6e3;
            border-radius: 6px;
        }

        #imageNavigator .imgNavItem.current .badge {
            background: #ff8a33;
            color: #0c0d11;
        }

    #imageNavigator .imgNavEmpty {
        color: #818aa3;
        font-size: 12px;
        letter-spacing: .2px;
    }

#richModal.image-mode #imageNavigator {
    display: flex;
}

/* Sotto-player */
#vPanel {
    position: relative;
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #11141b;
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: inset 0 0 0 1px #0b0d13, 0 4px 16px rgba(0,0,0,.35);
    outline: 1px solid #0b0d13;
    overflow: visible;
}

/* Play slider */
#playSlider.noUi-target {
    height: 10px;
    border: none;
    background: linear-gradient(90deg,#2b2f3b 0%,#242833 100%);
    border-radius: 7px;
}

#playSlider .noUi-connect {
    background: linear-gradient(90deg,#ff6a3d 0%, #ff2c7d 80%);
    border-radius: 7px;
}

#playSlider .noUi-handle {
    width: 16px;
    height: 16px;
    top: -3px;
    border-radius: 50%;
    background: #ffd1c2;
    border: 0;
    cursor: ew-resize;
    box-shadow: 0 0 0 2px #0c0e12, 0 4px 12px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.05) inset;
}

#playSlider .noUi-tooltip {
    background: #0f1218;
    color: #ffd1c2;
    border: 1px solid #2b2f3b;
    border-radius: 6px;
    font-size: 12px;
    padding: 4px 6px;
}

/* Timestamp + speed row */
#vpRow {
    position: relative;
    z-index: 31;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    overflow: visible;
}

#timeRow {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

    #timeRow .timeControlGroup {
        display: flex;
        gap: 8px;
        align-items: center;
        justify-content: center;
        margin: 0 auto;
    }

#timestamp {
    font-size: 14px;
    color: #ff936b;
    font-weight: 700;
    letter-spacing: .2px;
    font-variant-numeric: tabular-nums;
}

    #timestamp .lbl {
        color: #a6abbc;
        font-weight: 500;
        margin-right: 6px
    }

#timestampDur {
    font-size: 14px;
    color: #cbd3e6;
    font-weight: 700;
    letter-spacing: .2px;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    margin-left: auto;
}

    #timestampDur .lbl {
        color: #a6abbc;
        font-weight: 500;
        margin-right: 6px
    }

#speedRow {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.spdBtn {
    background: #1a1f2a;
    border: 1px solid #202634;
    border-radius: 8px;
    color: #e1e4ea;
    font-size: 13px;
    padding: 6px 12px;
    cursor: pointer;
    transition: .15s;
    box-shadow: 0 1px 0 rgba(255,255,255,.03) inset;
}

    .spdBtn.active {
        background: #ff8a33;
        color: #0c0d11;
        font-weight: 800;
        border-color: #ffc9a1
    }

    .spdBtn:hover {
        background: #2a3040;
        color: #fff
    }

.spdSep {
    color: #3d465d;
    padding: 0 6px;
    user-select: none;
    font-weight: 500;
}

.tlSep {
    display: inline-flex;
    align-items: center;
}

/* Sidebar con tabs */
#rmSide {
    background: linear-gradient(180deg,#121521 0%, #0d1017 100%);
    border-radius: 12px;
    box-shadow: inset 0 0 0 1px #0a0d14, 0 12px 28px rgba(0,0,0,.45);
    container-type: inline-size;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

#sideHead {
    display: grid;
    grid-template-areas: "thumb meta actions";
    grid-template-columns: 48px minmax(0,1fr) auto;
    gap: 10px;
    align-items: center;
    background: #151926;
    border-bottom: 1px solid #0a0d14;
    padding: 10px 12px;
    position: relative;
    overflow: visible;
}

#sideHelpBtn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid #23283a;
    background: #1c2230;
    color: #95a3cd;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    margin-left: auto;
}

    #sideHelpBtn:hover,
    #sideHelpBtn:focus-visible {
        background: #242b3b;
        color: #fff;
        border-color: #2f3650;
    }

    #sideHelpBtn:focus-visible {
        outline: 2px solid rgba(255,255,255,.18);
        outline-offset: 2px;
    }

    #sideHelpBtn .fa {
        font-size: 13px;
    }

.sideHelpPopup {
    position: absolute;
    top: calc(100% + 6px);
    right: 12px;
    min-width: 220px;
    max-width: 320px;
    background: #10141f;
    border: 1px solid #20283a;
    border-radius: 12px;
    box-shadow: 0 18px 40px rgba(0,0,0,.45);
    padding: 12px 14px;
    display: none;
    flex-direction: column;
    gap: 10px;
    z-index: 20;
}

    .sideHelpPopup.active {
        display: flex;
    }

.sideHelpTitle {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .2px;
    color: #cfd6e3;
}

    .sideHelpTitle .fa {
        font-size: 12px;
        color: #ff8a33;
    }

.sideHelpList {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

    .sideHelpList li {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        font-size: 12px;
        color: #aeb6cf;
    }

    .sideHelpList .k {
        flex: 0 0 auto;
        background: #1f2535;
        border: 1px solid #2c3448;
        color: #eef2ff;
        border-radius: 6px;
        padding: 2px 8px;
        font-weight: 600;
        font-size: 11px;
        font-variant: small-caps;
    }

    .sideHelpList .d {
        flex: 1 1 auto;
        text-align: right;
        color: #d2d7e6;
    }

#sideHead .ico {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #1c2230;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #90a4d4;
    outline: 1px solid #0b0e15;
}

#sideHead .thumb {
    grid-area: thumb;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 8px;
    background: #222;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
}

#sideHead .meta {
    display: flex;
    flex-direction: column;
    grid-area: meta;
    gap: 2px;
    min-width: 0;
    overflow: hidden;
}

#sideHead .title {
    display: -webkit-box;
    font-size: 15px;
    font-weight: 600;
    color: #e9eaf0;
    line-height: 1.3;
    overflow: hidden;
    overflow-wrap: anywhere;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

#sideHead .sub {
    font-size: 11px;
    color: #98a0b8;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#sideHead > .actions {
    display: flex;
    grid-area: actions;
    align-items: center;
    justify-self: end;
    gap: 6px;
    min-width: max-content;
}

@container (max-width: 460px) {
    #sideHead {
        grid-template-areas:
            "thumb meta"
            "actions actions";
        grid-template-columns: 48px minmax(0,1fr);
    }

    #sideHead > .actions {
        margin-top: 2px;
    }
}

#sideSearchWrap {
    display: grid;
    grid-template-columns: minmax(160px,1fr) minmax(140px,auto);
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    background: #121521;
    border-bottom: 1px solid #0a0d14;
    position: relative;
}

    #sideSearchWrap input, #sideSearchWrap select {
        background: #1a1f2a;
        border: 1px solid #202634;
        border-radius: 8px;
        color: #e0e0e0;
        font-size: 13px;
        padding: 8px 10px;
        min-width: 0;
    }

    #sideSearchWrap select {
        width: 100%;
    }

.side-ghost {
    position: absolute;
    pointer-events: none;
    top: 8px;
    left: 10px;
    color: #60697c;
    font-size: 13px;
    line-height: 1.4;
    white-space: pre;
    padding: 8px 10px;
    border-radius: 8px;
    z-index: 2;
    display: none;
    box-sizing: border-box;
    width: calc(100% - 20px);
}

    .side-ghost span {
        white-space: pre;
    }

    .side-ghost .ghost-before,
    .side-ghost .ghost-prefix,
    .side-ghost .ghost-after {
        visibility: hidden;
    }

    .side-ghost .ghost-tail {
        visibility: visible;
    }

    .side-ghost.is-visible {
        display: block;
    }

.side-suggest {
    position: absolute;
    z-index: 5;
    min-width: 200px;
    max-height: 220px;
    overflow: auto;
    background: #101622;
    border: 1px solid #202634;
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(0,0,0,.4);
    padding: 6px 0;
    display: none;
    box-sizing: border-box;
}

    .side-suggest button {
        all: unset;
        display: block;
        width: 100%;
        padding: 7px 14px;
        font-size: 13px;
        color: #d9dde6;
        cursor: pointer;
    }

        .side-suggest button:hover,
        .side-suggest button.active {
            background: rgba(255,138,51,.22);
            color: #ffb47a;
        }

    .side-suggest.is-visible {
        display: block;
    }

#sideMagicRow {
    display: none;
    grid-column: 1 / -1;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px;
}

.sideToggle {
    background: #1a1f2a;
    border: 1px solid #202634;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 13px;
    padding: 8px 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px
}

    .sideToggle .dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #a4aab6
    }

    .sideToggle.on {
        background: #1f2a36;
        border-color: #2c3d54
    }

        .sideToggle.on .dot {
            background: #74e083
        }

#sideBody mark {
    background: #2b3a5c;
    color: #fff;
    border-radius: 3px;
    padding: 0 2px;
}

#sideTabsWrap {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px;
    background: #121521;
    border-bottom: 1px solid #0a0d14;
}

#sideTabs {
    display: flex;
    gap: 6px;
    flex: 1;
    overflow: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

    #sideTabs::-webkit-scrollbar {
        display: none;
    }

.sideTabScroll {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #23283a;
    background: #171b26;
    color: #9aa3be;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s,color .15s,border-color .15s;
}

    .sideTabScroll:hover {
        background: #22283a;
        color: #fff;
        border-color: #2b3046;
    }

    .sideTabScroll:disabled {
        opacity: .35;
        cursor: default;
        pointer-events: none;
    }

.sideTab {
    flex: 0 0 auto;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid #23283a;
    background: #171b26;
    color: #9aa3be;
    font-size: 12px;
    cursor: pointer;
}

    .sideTab.active {
        background: #22283a;
        border-color: #2b3046;
        color: #fff
    }

#sideBody {
    padding: 12px;
    flex: 1;
    overflow: auto
}

.sidePanel {
    display: none
}

    .sidePanel.active {
        display: block
    }

/* Cards */
#sideBody .card {
    background: #121521;
    border: 1px solid #1b2031;
    border-radius: 12px;
    padding: 12px;
    margin: 0 0 10px
}

    #sideBody .card h3 {
        margin: 0 0 8px;
        font-size: 12px;
        letter-spacing: .2px;
        text-transform: uppercase;
        color: #cfd6e3
    }

#sideBody .kv {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 10px
}

    #sideBody .kv .row {
        background: #161b27;
        border: 1px solid #1b2031;
        border-radius: 10px;
        padding: 8px 10px;
        display: flex;
        gap: 8px;
        align-items: flex-start;
        min-width: 0
    }

    #sideBody .kv .k {
        color: #9fb0c8;
        font-size: 11px;
        flex: 0 0 auto;
        min-width: 90px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis
    }

    #sideBody .kv .v {
        color: #e8ecf4;
        font-weight: 600;
        flex: 1 1 auto;
        min-width: 0;
        white-space: normal;
        word-break: break-word
    }

.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px
}

.badge {
    background: #212633;
    color: #cfd6e3;
    border: 1px solid #2d2d2d;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 11px;
    display: inline-flex;
    gap: 6px;
    max-width: 100%
}

/* Draft version badge (M365 edit-lifecycle redesign) — distinct from .badge's neutral "Current"
   look, since a Draft is provisional (no proxy/thumbnail yet) rather than settled. */
.badge-draft {
    background: #3a2e12;
    color: #f0c36b;
    border-color: #5a4720;
}

/* Timeline toolbar (chiude il gap con i tab) */
.tl-toolbar {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 6px;
    background: #14171e;
    border: 1px solid #2d2d2d;
    border-radius: 12px;
    padding: 4px 6px;
    margin-bottom: 10px;
    flex-wrap: nowrap;
    overflow: visible;
}

#panel_timeline {
    margin-top: -12px !important;
}
/* elimina il vuoto tra tabs e toolbar */
.tl-toolbar .group {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-wrap: nowrap;
}

.tlIconWrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
}

    .tlIconWrap .shareMenu,
    .tlIconWrap .dlMenu {
        top: calc(100% + 6px);
        right: 0;
    }

#imageActions {
    margin-left: auto;
    display: none;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

    #imageActions.active {
        display: flex;
    }

    #imageActions .tlIconWrap {
        margin-left: 0;
    }

.tl-toolbar .spdBtn {
    height: 34px;
    display: inline-flex;
    align-items: center;
}

.navBtn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid #2d2d2d;
    background: #1a2029;
    color: #e6e7ea;
    display: flex;
    align-items: center;
    justify-content: center
}

    .navBtn i {
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        line-height: 0
    }

.pillBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid #2d2d2d;
    background: #222;
    color: #e6e7ea;
    border-radius: 9px;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

    .pillBtn:hover:not(:disabled) {
        background: #2c2c2c;
        border-color: #454545;
        transform: translateY(-1px);
    }

    .pillBtn:disabled {
        cursor: not-allowed;
        opacity: 0.55;
    }

    .pillBtn.primary {
        background: #ff8a33;
        color: #0c0d11;
        font-weight: 800;
        border-color: #ffc9a1
    }

    .pillBtn.active,
    .pillBtn.markerOn {
        background: #ff8a33;
        color: #0c0d11;
        font-weight: 800;
        border-color: #ffc9a1
    }

.countBox {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 4px 0;
    border: 1px solid #2d2d2d;
    border-radius: 9px;
    background: #18202b;
    color: #dbe3ef;
    font-weight: 700
}

    .countBox span {
        font-size: 12px;
        line-height: 1
    }

.countArrow {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    border: none;
    background: transparent;
    color: #dbe3ef;
    font-size: 10px;
    line-height: 1;
    cursor: pointer;
    padding: 0
}

    .countArrow:hover {
        color: #ff8a33
    }

    .countArrow:disabled {
        opacity: .35;
        cursor: default
    }

.toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    padding: 0 12px;
    border: 1px solid #2d2d2d;
    border-radius: 9px;
    background: #1a2029;
    color: #cbd5e1;
    font-size: 12px;
    line-height: 1
}
/* 2) Defensive reset for the left tree caret icon */
#treeRoot .folder-node .toggle {
    display: inline-block !important;
    width: 14px !important;
    height: auto !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    color: currentColor !important;
    text-align: center !important;
    line-height: 1 !important;
}

.miniInp {
    width: 48px;
    background: #1a1f2a;
    border: 1px solid #202634;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 12px;
    padding: 5px 6px;
    line-height: 1;
}

#timelineMarkerControls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 6px 0;
}

/* Timeline panel - enable scrolling for infinite scroll */
section.panel[data-panel="timeline"] {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Respect hidden attribute - must come after display:flex rule */
section.panel[data-panel="timeline"][hidden] {
    display: none !important;
}

section.panel[data-panel="timeline"] .tl-toolbar {
    flex-shrink: 0;
}

.tl-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    flex: 1;
    padding: 8px;
}

/* Timeline empty/end messages */
.tl-empty, .tl-end {
    text-align: center;
    padding: 20px;
    color: #888;
    font-size: 13px;
}

.tl-empty i, .tl-end i {
    margin-right: 6px;
    font-size: 12px;
}

.tl-item {
    border: 1px solid #2d2d2d;
    border-radius: 10px;
    background: #161a21;
    padding: 8px 10px;
    cursor: pointer
}

    .tl-item.active {
        outline: 1px solid rgba(116,224,131,.45);
        box-shadow: 0 0 0 2px rgba(116,224,131,.18) inset
    }

    .tl-item .tl-head {
        display: flex;
        gap: 8px;
        align-items: center;
        min-width: 0;
        margin-bottom: 4px
    }

    .tl-item .tl-tc {
        color: #74e083;
        font-weight: 800;
        min-width: 84px;
        white-space: nowrap
    }

    .tl-item .tl-type {
        color: #a2bed8;
        font-size: 11px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis
    }

.tl-body {
    color: #dbe3ef;
    font-size: 13px;
    white-space: normal;
    display: flex;
    flex-direction: column;
    gap: 6px
}

.tl-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 4px 0;
    border-top: 1px solid #1f232c
}

    .tl-section:first-child {
        border-top: none;
        padding-top: 0
    }

.tl-sectionTitle {
    font-size: 11px;
    letter-spacing: .2px;
    color: #9fb0c8;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px
}

    .tl-sectionTitle .fa {
        font-size: 10px
    }

.tl-entry {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 6px 8px;
    border: 1px solid #2d2d2d;
    border-radius: 6px;
    background: #1b1f28;
    font-size: 12px;
    color: #dbe3ef
}

.tl-entryLabel {
    font-weight: 600;
    color: #dbe3ef;
    white-space: normal;
    display: flex;
    align-items: center;
    gap: 10px
}

    .tl-entryLabel img {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        object-fit: cover;
        border: 1px solid #2b3344;
        cursor: zoom-in
    }

.tl-entryText {
    display: inline
}

.tl-entryMeta {
    color: #9fb0c8;
    font-size: 11px;
    white-space: normal;
    margin-left: 0
}

.tl-entryEmpty {
    font-size: 11px;
    color: #6f7a92;
    padding: 4px 0
}

.tl-item .head {
    display: flex;
    gap: 8px;
    align-items: center
}

.tl-item .tc {
    color: #74e083;
    font-weight: 800;
    min-width: 84px;
    white-space: nowrap
}

.tl-item .txt {
    color: #dbe3ef;
    font-size: 13px;
    white-space: normal
}

.tl-item .kws {
    color: #9fb0c8;
    font-size: 11px;
    margin-top: 3px
}

/* Star rating widget (markers) — shared by popup.js and sidebar-insights-renderer.js */
.starRating {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 13px;
}

.starRating .fa-solid {
    color: var(--accent);
}

.starRating .fa-regular {
    color: #5a6478;
}

.starRating.editable i {
    cursor: pointer;
}

.tl-item .head .markerStarsRead {
    margin-left: auto;
}

/* Timeline tab: marker type badge + read-only stars share one head row inside .tl-entry */
.tl-entry .tl-entryHead {
    display: flex;
    align-items: center;
    gap: 8px;
    align-self: stretch;
}

    .tl-entry .tl-entryHead .markerStarsRead {
        margin-left: auto;
    }

/* Insight markers/keywords */
.insightCard {
    position: relative;
}

    .insightCard .cardHead {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        margin-bottom: 10px;
        cursor: pointer;
    }

        .insightCard .cardHead h3 {
            margin: 0;
            font-size: 14px;
            letter-spacing: .1px;
            text-transform: none;
            color: #cfd6e3;
            display: flex;
            align-items: baseline;
            gap: 8px;
        }

    .insightCard .cardToggle {
        width: 26px;
        height: 26px;
        border-radius: 8px;
        background: #1a1f2a;
        border: 1px solid #202634;
        color: #e0e0e0;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: background .15s;
    }

        .insightCard .cardToggle:hover {
            background: #232a39;
        }

    .insightCard .count {
        color: #f4f6ff;
        font-weight: 700;
        background: #1b2333;
        border-radius: 8px;
        padding: 2px 10px;
        display: inline-flex;
        align-items: center;
        font-size: 18px;
        line-height: 1.2;
    }

    .insightCard .cardBody {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .insightCard.collapsed .cardBody {
        display: none;
    }

.insightHeadMain {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

    .insightHeadMain h3 {
        display: flex;
        align-items: center;
        gap: 6px;
        margin: 0;
        flex: 1;
    }

.insightHeadActions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.insightHeadBtn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid #202634;
    background: #1a1f2a;
    color: #e0e0e0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}

    .insightHeadBtn:hover {
        background: #232a39;
        color: #fff;
    }

    .insightHeadBtn.active {
        background: #ff8a33;
        color: #0c0d11;
        border-color: #ffc9a1;
        box-shadow: 0 0 0 1px rgba(255,255,255,.12) inset;
    }

/* Hide Add buttons for Keywords, People, Scenes - insights come from Azure Video Indexer */
#insAddKeyword,
#insAddPerson,
#insAddScene {
    display: none !important;
}

.insightChipArea {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.insightChipToggle {
    align-self: flex-start;
    background: none;
    border: none;
    color: #98a3be;
    font-size: 12px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: color .15s;
}

    .insightChipToggle[hidden] {
        display: none;
    }

    .insightChipToggle:hover {
        color: #dbe3ef;
    }

    .insightChipToggle i {
        font-size: 10px;
    }

.insightTimeline {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(18,22,32,.85);
    border-radius: 12px;
    border: 1px solid #1d2433;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.03);
}

    .insightTimeline.hidden {
        display: none;
    }

.insightTimelineBar {
    position: relative;
    flex: 1;
    height: 14px;
    border-radius: 999px;
    background: linear-gradient(90deg,#1b2434,#212d42);
    overflow: hidden;
}

.insightTimelineTrack {
    position: absolute;
    inset: 0;
    background: rgba(93,139,255,.18);
}

.insightTimelineMarkers {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.insightTimelineMarker {
    position: absolute;
    top: -2px;
    width: 4px;
    height: calc(100% + 4px);
    border-radius: 4px;
    background: #cdd7ff;
    opacity: .55;
    transform: translateX(-50%);
    pointer-events: auto;
    cursor: pointer;
    outline: none;
    transition: opacity .15s, box-shadow .15s, background .15s;
}

    .insightTimelineMarker:hover,
    .insightTimelineMarker:focus {
        opacity: 1;
        box-shadow: 0 0 0 2px rgba(255,255,255,.12);
    }

    .insightTimelineMarker.active {
        opacity: 1;
        background: #61b4ff;
        box-shadow: 0 0 0 2px rgba(97,180,255,.35), 0 0 12px rgba(97,180,255,.45);
    }

.insightTimelinePlayhead {
    position: absolute;
    top: -4px;
    width: 2px;
    height: calc(100% + 8px);
    border-radius: 4px;
    background: #ff8a33;
    transform: translateX(-50%);
    box-shadow: 0 0 0 1px rgba(0,0,0,.35);
    pointer-events: none;
}

.insightTimelineNav {
    background: #181d29;
    border: 1px solid #242c3f;
    border-radius: 9px;
    color: #d6dbed;
    font-size: 12px;
    padding: 6px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: background .15s,border-color .15s,color .15s;
}

    .insightTimelineNav:disabled {
        opacity: .4;
        cursor: default;
    }

    .insightTimelineNav:not(:disabled):hover {
        background: #232c3f;
        color: #fff;
        border-color: #2d3a54;
    }

    .insightTimelineNav i {
        font-size: 11px;
    }

#insightKwBadges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

    #insightKwBadges .badge {
        cursor: pointer;
        transition: background .15s,color .15s,border-color .15s,box-shadow .15s;
        padding: 7px 12px;
        font-size: 12px;
        border-color: #293040;
    }

        #insightKwBadges .badge i {
            font-size: 12px;
        }

        #insightKwBadges .badge.selected {
            background: #ff8a33;
            color: #0c0d11;
            border-color: #ffc9a1;
            box-shadow: 0 0 0 1px rgba(255,255,255,.12) inset;
            font-weight: 700;
        }

.insightPager {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 10px;
}

    .insightPager.hidden {
        display: none;
    }

#insightScenesCard .cardBody {
    gap: 12px;
}

#panel_insight .scene-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 8px;
}

#panel_insight .scene-card {
    position: relative;
    background: #0f1318;
    border: 1px solid #2d2d2d;
    border-radius: 10px;
    overflow: hidden;
    min-width: 0;
}

    #panel_insight .scene-card img {
        display: block;
        width: 100%;
        aspect-ratio: 16 / 9;
        object-fit: cover;
    }

#panel_insight .scene-cap {
    display: flex;
    gap: 8px;
    justify-content: space-between;
    padding: 6px 8px;
    color: #cfd6e3;
    font-size: 11px;
    background: linear-gradient(180deg,#141924,#11151d);
}

#panel_insight .scene-tc {
    color: #74e083;
    font-weight: 700;
    white-space: nowrap;
}

#panel_insight .scene-cap .cap {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
}

#panel_insight .scene-card .scene-actions {
    position: absolute;
    bottom: 36px;
    left: 0;
    right: 0;
    display: flex;
    gap: 6px;
    padding: 8px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    opacity: 0;
    transition: opacity .2s;
}

#panel_insight .scene-card:hover .scene-actions {
    opacity: 1;
}

#panel_insight .scene-card .scene-actions button {
    border: 1px solid #2d2d2d !important;
    background: #151a24 !important;
    color: #dbe3ef !important;
    border-radius: 6px !important;
    padding: 4px 6px !important;
    font-size: 11px !important;
    cursor: pointer;
    transition: background .15s, color .15s;
}

    #panel_insight .scene-card .scene-actions button i {
        color: #dbe3ef !important;
    }

    #panel_insight .scene-card .scene-actions button:hover {
        background: #2d3649 !important;
        color: #fff !important;
    }

        #panel_insight .scene-card .scene-actions button:hover i {
            color: #fff !important;
        }

#panel_insight .scene-pager,
#panel_insight .people-pager {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    margin-top: 4px;
}



#panel_insight .pagerBtn {
    border: 1px solid #2d2d2d;
    background: #1a2029;
    color: #cfd6e3;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
    transition: background .15s,color .15s,border-color .15s;
}

    #panel_insight .pagerBtn.active {
        background: #ff8a33;
        color: #0c0d11;
        border-color: #ffc9a1;
        font-weight: 700;
    }

    #panel_insight .pagerBtn:hover {
        background: #232a39;
        color: #fff;
    }

#panel_insight .pagerArrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    padding: 4px;
}

    #panel_insight .pagerArrow[disabled] {
        opacity: .35;
        cursor: default;
        pointer-events: none;
    }

#panel_insight .pagerEllipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    padding: 4px 2px;
    color: #6f7a96;
    font-size: 11px;
    user-select: none;
}

#insightKwBadges .badge .countBadge {
    margin-left: 6px;
    background: #202738;
    border-radius: 999px;
    padding: 2px 6px;
    font-size: 10px;
    color: #dbe3ef;
    border: 1px solid rgba(255,255,255,.06);
}

.insKeyword.selected {
    outline: 1px solid rgba(255,138,51,.45);
    box-shadow: 0 0 0 2px rgba(255,138,51,.18) inset;
}

.insMarker.selected {
    outline: 1px solid rgba(116,224,131,.45);
    box-shadow: 0 0 0 2px rgba(116,224,131,.18) inset;
}

.insKwManager {
    display: none;
    border: 1px solid #1b2031;
    border-radius: 10px;
    background: #161a21;
    padding: 12px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}

    .insKwManager.active {
        display: block;
    }

    .insKwManager .insKeywordList {
        max-height: 260px;
        overflow: auto;
        padding-right: 6px;
    }

    .insKwManager .kwManagerHead {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 10px;
        gap: 8px;
    }

    .insKwManager .kwManagerTitle {
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: .2px;
        color: #cfd6e3;
    }

    .insKwManager .kwCloseBtn {
        width: 26px;
        height: 26px;
        border-radius: 8px;
        background: #1a1f2a;
        border: 1px solid #202634;
        color: #e0e0e0;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

        .insKwManager .kwCloseBtn:hover {
            background: #232a39;
        }

.insSceneManager {
    display: none;
    border: 1px solid #1b2031;
    border-radius: 10px;
    background: #161a21;
    padding: 12px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}

    .insSceneManager.active {
        display: block;
    }

    .insSceneManager .sceneManagerHead {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        margin-bottom: 10px;
    }

    .insSceneManager .sceneManagerTitle {
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: .2px;
        color: #cfd6e3;
    }

    .insSceneManager .kwCloseBtn {
        width: 26px;
        height: 26px;
        border-radius: 8px;
        background: #1a1f2a;
        border: 1px solid #202634;
        color: #e0e0e0;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

        .insSceneManager .kwCloseBtn:hover {
            background: #232a39;
        }

    .insSceneManager .insSceneList {
        display: flex;
        flex-direction: column;
        gap: 8px;
        max-height: 260px;
        overflow: auto;
        padding-right: 6px;
    }

.insSceneRow {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(17,22,32,.85);
    border: 1px solid transparent;
    transition: border-color .15s, background .15s;
}

    .insSceneRow:hover {
        border-color: #2c3a52;
        background: rgba(19,24,34,.95);
    }

    .insSceneRow.selected {
        border-color: rgba(255,138,51,.6);
        box-shadow: 0 0 0 1px rgba(255,138,51,.18) inset;
    }

    .insSceneRow .thumb {
        width: 72px;
        height: 40px;
        border-radius: 6px;
        overflow: hidden;
        background: #0f1219;
        border: 1px solid #272d3d;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

        .insSceneRow .thumb img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }

        .insSceneRow .thumb .placeholder {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 4px;
            color: #39425a;
            font-size: 12px;
            text-align: center;
            padding: 0 6px;
        }

            .insSceneRow .thumb .placeholder i {
                font-size: 18px;
            }

    .insSceneRow .info {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 2px;
        min-width: 0;
    }

    .insSceneRow .title {
        font-size: 13px;
        color: #eef2ff;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .insSceneRow .meta {
        font-size: 11px;
        color: #848fa8;
    }

    .insSceneRow .tools {
        display: flex;
        gap: 6px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

.insKeywordList,
.insMarkerList {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
    overflow: auto;
    padding-right: 6px;
}

.insKeywordList {
    max-height: 260px;
}

.insKeyword,
.insMarker {
    position: relative;
}

    .insKeyword .head,
    .insMarker .head {
        flex-wrap: wrap;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .insKeyword .tc,
    .insMarker .tc {
        min-width: auto;
        padding-right: 6px;
        font-size: 12px;
    }

    .insMarker .tp {
        color: #9fb0c8;
        font-size: 12px;
        font-weight: 700;
    }

    .insMarker .txt {
        margin-top: 4px;
        color: #dbe3ef;
        font-size: 13px;
        white-space: normal;
    }

.kwBadge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.insKeywordFields,
.insMarker.editing {
    -webkit-user-select: text;
    user-select: text;
}

.insMarkerFields {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

    .insKeywordFields label,
    .insMarkerFields label {
        font-size: 11px;
        letter-spacing: .2px;
        text-transform: uppercase;
        color: #9fb0c8;
    }

    .insKeywordFields input,
    .insMarkerFields input,
    .insMarkerFields textarea,
    .insMarkerFields select {
        background: #1a1f2a;
        border: 1px solid #202634;
        border-radius: 8px;
        color: #e0e0e0;
        font-size: 13px;
        padding: 7px 9px;
        width: 100%;
        box-sizing: border-box;
    }

    .insKeywordFields input {
        min-height: 0;
    }

    .insMarkerFields textarea {
        min-height: 66px;
        resize: vertical;
    }

.insKeywordActions,
.insMarkerActions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.smallBtn.danger {
    background: #2a1418;
    border-color: #402127;
    color: #ff9aa7;
}

    .smallBtn.danger:hover {
        background: #38191f;
    }

.insightEmpty {
    padding: 12px;
    border: 1px dashed #2d2d2d;
    border-radius: 10px;
    color: #717a94;
    font-size: 12px;
    text-align: center;
}

.insPeopleManager {
    display: none;
    border: 1px solid #1b2031;
    border-radius: 10px;
    background: #161a21;
    padding: 12px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
    overflow-x: hidden;
}

    .insPeopleManager.active {
        display: block;
    }

    .insPeopleManager .peopleManagerHead {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 10px;
        gap: 8px;
    }

.peopleManagerTitle {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .2px;
    color: #cfd6e3;
}

.insPeopleManager .kwCloseBtn {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: #1a1f2a;
    border: 1px solid #202634;
    color: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

    .insPeopleManager .kwCloseBtn:hover {
        background: #232a39;
    }

.insPeopleManager .insPeopleList {
    max-height: 260px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 6px;
}

.insPerson {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 100%;
}

    .insPerson .head {
        flex-wrap: wrap;
    }

.insPerson {
    position: relative;
}

    .insPerson .head {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
    }

    .insPerson .avatar {
        width: 28px;
        height: 28px;
        border-radius: 50%;
        object-fit: cover;
        border: 1px solid rgba(255,255,255,.12);
    }

    .insPerson .tp {
        color: #dbe3ef;
        font-size: 13px;
        font-weight: 600;
    }

.insPeopleFields {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    width: 100%;
    max-width: 100%;
}

.insPeopleField {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.insPeopleImageStatus {
    font-size: 12px;
    color: #7d859b;
    word-break: break-word;
}

    .insPeopleImageStatus.has-image {
        color: #9bd2ff;
    }

.insPeopleFields label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .2px;
    color: #9fb0c8;
}

.insPeopleInput {
    background: #1a1f2a;
    border: 1px solid #202634;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 13px;
    padding: 7px 9px;
    width: 100%;
    box-sizing: border-box;
}

.insPeopleActions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 10px;
    width: 100%;
    justify-content: flex-start;
}

    .insPeopleActions .smallBtn {
        flex: 0 0 auto;
    }

.insPeopleImport {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
}

    .insPeopleImport label {
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: .2px;
        color: #9fb0c8;
    }

.insPeopleSelect {
    background: #1a1f2a;
    border: 1px solid #202634;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 12px;
    padding: 6px 8px;
    flex: 1 1 160px;
    min-width: 140px;
    max-width: 100%;
}

.insPeopleInSection {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.insPeopleInSection {
    width: 100%;
}

.insPeopleInHeader {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

    .insPeopleInHeader .label {
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: .2px;
        color: #9fb0c8;
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }

    .insPeopleInHeader .labelGroup {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .insPeopleInHeader .countBadge {
        background: #202738;
        border-radius: 999px;
        padding: 3px 8px;
        font-size: 11px;
        color: #dbe3ef;
        border: 1px solid rgba(255,255,255,.08);
    }

    .insPeopleInHeader .actions {
        display: flex;
        gap: 6px;
        flex-wrap: wrap;
    }

        .insPeopleInHeader .actions .smallBtn {
            white-space: nowrap;
        }

.insPeopleInChips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    max-height: 96px;
    overflow: auto;
    overflow-x: hidden;
    padding-right: 4px;
    width: 100%;
}

.insPeopleInChip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    border: 1px solid #202634;
    background: #1a1f2a;
    color: #e0e0e0;
    font-size: 12px;
    padding: 4px 10px;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}

    .insPeopleInChip:hover {
        background: #232a39;
        border-color: #2b3244;
        color: #fff;
    }

    .insPeopleInChip .time {
        font-variant-numeric: tabular-nums;
        letter-spacing: .2px;
    }

    .insPeopleInChip .del {
        border: none;
        background: none;
        color: #8a93aa;
        cursor: pointer;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 11px;
    }

        .insPeopleInChip .del:hover {
            color: #ff8a9c;
        }

    .insPeopleInChip.more {
        cursor: default;
        opacity: .75;
        border-style: dashed;
    }

.insPeopleInEmpty {
    font-size: 12px;
    color: #7d859b;
}

.insPeopleInModalRow.bbox-active,
.insKeywordInModalRow.bbox-active {
    border-color: #2c3a52;
    background: rgba(19,24,34,.95);
}

.insPeopleInModalRow .bboxMeta,
.insKeywordInModalRow .bboxMeta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 11px;
    color: #9fb0c8;
}

    .insPeopleInModalRow .bboxMeta .value,
    .insKeywordInModalRow .bboxMeta .value {
        font-family: "SFMono-Regular","Fira Code","Consolas",monospace;
        color: #dbe3ef;
    }

#insKeywordInModal {
    position: fixed;
    top: 96px;
    right: 32px;
    width: 420px;
    max-height: calc(100vh - 140px);
    z-index: 1200;
    display: none;
}

    #insKeywordInModal.active {
        display: block;
    }

    #insKeywordInModal .modalBackdrop {
        display: none;
    }

    #insKeywordInModal .modalDialog {
        position: relative;
        width: 100%;
        max-height: 100%;
        background: #101420;
        border: 1px solid #1c2334;
        border-radius: 14px;
        padding: 18px;
        display: flex;
        flex-direction: column;
        gap: 12px;
        box-shadow: 0 28px 80px rgba(0,0,0,.6);
        z-index: 1;
    }

    #insKeywordInModal .modalHeader {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    #insKeywordInModal .modalTitle {
        font-size: 15px;
        font-weight: 700;
        color: #eef2ff;
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
    }

    #insKeywordInModal .modalClose {
        width: 30px;
        height: 30px;
        border-radius: 10px;
        border: 1px solid #202634;
        background: #161b26;
        color: #d8ddef;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

        #insKeywordInModal .modalClose:hover {
            background: #232a39;
            color: #fff;
        }

    #insKeywordInModal .modalBody {
        display: flex;
        flex-direction: column;
        gap: 12px;
        flex: 1;
        min-height: 0;
    }

.insKeywordInActions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

    .insKeywordInActions .inputGroup {
        display: flex;
        gap: 6px;
        align-items: center;
    }

    .insKeywordInActions input {
        background: #1a1f2a;
        border: 1px solid #202634;
        border-radius: 8px;
        color: #e0e0e0;
        font-size: 13px;
        padding: 7px 9px;
        min-width: 140px;
    }

    .insKeywordInActions .hint {
        font-size: 11px;
        color: #7d859b;
    }

.insKeywordInModalList {
    flex: 1;
    min-height: 0;
    overflow: auto;
    border: 1px solid #1d2433;
    border-radius: 12px;
    background: rgba(22,27,38,.85);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.insKeywordInModalRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(17,22,32,.85);
    border: 1px solid transparent;
    transition: border-color .15s, background .15s;
}

    .insKeywordInModalRow:hover {
        border-color: #2c3a52;
        background: rgba(19,24,34,.95);
    }

    .insKeywordInModalRow .tc {
        font-variant-numeric: tabular-nums;
        color: #f0f3ff;
        font-size: 13px;
        font-weight: 600;
    }

    .insKeywordInModalRow .tools {
        display: flex;
        gap: 6px;
    }

        .insKeywordInModalRow .tools .smallBtn {
            white-space: nowrap;
        }

.insKeywordInModalEmpty {
    padding: 16px;
    text-align: center;
    font-size: 13px;
    color: #8490a8;
}

.insKeywordInSection {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.insKeywordInHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

    .insKeywordInHeader .label {
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: .2px;
        color: #9fb0c8;
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }

    .insKeywordInHeader .labelGroup {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .insKeywordInHeader .countBadge {
        background: #202738;
        border-radius: 999px;
        padding: 3px 8px;
        font-size: 11px;
        color: #dbe3ef;
        border: 1px solid rgba(255,255,255,.08);
    }

    .insKeywordInHeader .actions {
        display: flex;
        gap: 6px;
        flex-wrap: wrap;
    }

.insKeywordInChips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    max-height: 90px;
    overflow: auto;
    padding-right: 4px;
}

.insKeywordInChip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    border: 1px solid #202634;
    background: #1a1f2a;
    color: #e0e0e0;
    font-size: 12px;
    padding: 4px 9px;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}

    .insKeywordInChip:hover {
        background: #232a39;
        border-color: #2b3244;
        color: #fff;
    }

    .insKeywordInChip .time {
        font-variant-numeric: tabular-nums;
        letter-spacing: .2px;
    }

    .insKeywordInChip .del {
        border: none;
        background: none;
        color: #8a93aa;
        cursor: pointer;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 11px;
    }

        .insKeywordInChip .del:hover {
            color: #ff8a9c;
        }

    .insKeywordInChip.more {
        cursor: default;
        opacity: .75;
        border-style: dashed;
    }

.insKeywordInEmpty {
    font-size: 12px;
    color: #7d859b;
}

#insPeopleInModal {
    position: fixed;
    top: 96px;
    right: 32px;
    width: 420px;
    max-height: calc(100vh - 140px);
    z-index: 1200;
    display: none;
}

    #insPeopleInModal.active {
        display: block;
    }

    #insPeopleInModal .modalBackdrop {
        display: none;
    }

    #insPeopleInModal .modalDialog {
        position: relative;
        width: 100%;
        max-height: 100%;
        background: #101420;
        border: 1px solid #1c2334;
        border-radius: 14px;
        padding: 18px;
        display: flex;
        flex-direction: column;
        gap: 12px;
        box-shadow: 0 28px 80px rgba(0,0,0,.6);
        z-index: 1800;
    }

    #insPeopleInModal .modalHeader {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    #insPeopleInModal .modalTitle {
        font-size: 16px;
        font-weight: 700;
        color: #eef2ff;
        line-height: 1.2;
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
    }

    #insPeopleInModal .modalClose {
        width: 30px;
        height: 30px;
        border-radius: 10px;
        border: 1px solid #202634;
        background: #161b26;
        color: #d8ddef;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

        #insPeopleInModal .modalClose:hover {
            background: #232a39;
            color: #fff;
        }

    #insPeopleInModal .modalBody {
        display: flex;
        flex-direction: column;
        gap: 12px;
        flex: 1;
        min-height: 0;
    }

#insSceneModal {
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: none;
    padding: 40px 16px;
    background: rgba(8,10,16,.72);
    align-items: center;
    justify-content: center;
}

    #insSceneModal.active {
        display: flex;
    }

    #insSceneModal .modalDialog {
        width: min(520px, 96vw);
        background: #101420;
        border: 1px solid #1c2334;
        border-radius: 14px;
        padding: 20px;
        box-shadow: 0 28px 80px rgba(0,0,0,.6);
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    #insSceneModal .modalHeader {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    #insSceneModal .modalTitle {
        font-size: 16px;
        font-weight: 700;
        color: #eef2ff;
    }

    #insSceneModal .modalClose {
        width: 30px;
        height: 30px;
        border-radius: 10px;
        border: 1px solid #202634;
        background: #161b26;
        color: #d8ddef;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

        #insSceneModal .modalClose:hover {
            background: #232a39;
            color: #fff;
        }

    #insSceneModal .modalBody {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    #insSceneModal .formGroup {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

        #insSceneModal .formGroup label {
            font-size: 12px;
            text-transform: uppercase;
            letter-spacing: .2px;
            color: #9fb0c8;
        }

        #insSceneModal .formGroup input[type="text"] {
            background: #1a1f2a;
            border: 1px solid #202634;
            border-radius: 8px;
            color: #e0e0e0;
            font-size: 13px;
            padding: 8px 10px;
        }

        #insSceneModal .formGroup .hint {
            font-size: 11px;
            color: #7d859b;
        }

    #insSceneModal .imagePicker {
        display: flex;
        gap: 12px;
        align-items: flex-start;
    }

    #insSceneModal .imagePreview {
        width: 160px;
        height: 90px;
        border-radius: 8px;
        overflow: hidden;
        border: 1px solid #1d2433;
        background: #0f1219;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

        #insSceneModal .imagePreview img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: none;
        }

            #insSceneModal .imagePreview img.visible {
                display: block;
            }

        #insSceneModal .imagePreview .placeholder {
            color: #36405a;
            font-size: 12px;
            text-align: center;
            padding: 0 8px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 6px;
        }

            #insSceneModal .imagePreview .placeholder i {
                font-size: 18px;
            }

    #insSceneModal .imageActions {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

        #insSceneModal .imageActions input[type="file"] {
            display: none;
        }

    #insSceneModal .modalFooter {
        display: flex;
        justify-content: flex-end;
        gap: 8px;
        flex-wrap: wrap;
    }

    #insSceneModal .errorMessage {
        font-size: 12px;
        color: #ff9aa7;
    }

#insMarkerModal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    pointer-events: none;
}

    #insMarkerModal.active {
        display: flex;
        pointer-events: auto;
    }

    #insMarkerModal .modalBackdrop {
        position: absolute;
        inset: 0;
        background: rgba(6,9,15,.78);
        backdrop-filter: blur(2px);
    }

    #insMarkerModal .modalDialog {
        position: relative;
        width: min(420px, 92vw);
        background: #101620;
        border: 1px solid #1f2736;
        border-radius: 14px;
        padding: 18px 20px;
        display: flex;
        flex-direction: column;
        gap: 14px;
        box-shadow: 0 28px 80px rgba(0,0,0,.6);
        z-index: 1;
    }

    #insMarkerModal .modalHeader {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    #insMarkerModal .modalTitle {
        font-size: 15px;
        font-weight: 700;
        color: #eef2ff;
    }

    #insMarkerModal .modalClose {
        width: 30px;
        height: 30px;
        border-radius: 10px;
        border: 1px solid #202634;
        background: #161b26;
        color: #d8ddef;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

        #insMarkerModal .modalClose:hover {
            background: #232a39;
            color: #fff;
        }

    #insMarkerModal .modalBody {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

.markerModalSummary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    background: #0e1320;
    border: 1px solid #1f2a38;
    border-radius: 10px;
    padding: 10px 12px;
}

    .markerModalSummary .seg {
        display: flex;
        gap: 6px;
        align-items: center;
        font-size: 12px;
        color: #8fa1ba;
        font-variant-numeric: tabular-nums;
    }

    .markerModalSummary .value {
        color: #74e083;
        font-weight: 700;
        letter-spacing: .3px;
    }

.markerModalLabel {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .2px;
    color: #9fb0c8;
}

#insMarkerModal input,
#insMarkerModal textarea,
#insMarkerModal select {
    background: #1a1f2a;
    border: 1px solid #202634;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 13px;
    padding: 8px 10px;
    width: 100%;
    box-sizing: border-box;
}

select.insMarkerType {
    appearance: none;
    -webkit-appearance: none;
    background: #1a1f2a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%239fb0c8'/%3E%3C/svg%3E") no-repeat right 10px center;
    padding-right: 28px;
    cursor: pointer;
}

select.insMarkerType:focus {
    border-color: #3a7bd5;
    outline: none;
}

/* #insMarkerModal select (ID selector) otherwise outranks select.insMarkerType (class selector)
   and clobbers the chevron background-image + padding-right with its plain background/padding. */
#insMarkerModal select.insMarkerType {
    appearance: none;
    -webkit-appearance: none;
    background: #1a1f2a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%239fb0c8'/%3E%3C/svg%3E") no-repeat right 10px center;
    padding-right: 28px;
}

select.insMarkerType option {
    background: #1a1f2a;
    color: #e0e0e0;
    padding: 6px 10px;
}

/* ── Marker type combo-box (predefined + free text) ── */
.mtype-combo {
    position: relative;
    width: 100%;
}

.mtype-combo input.insMarkerType {
    padding-right: 30px;
}

.mtype-combo-arrow {
    position: absolute;
    right: 1px;
    top: 1px;
    bottom: 1px;
    width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #9fb0c8;
    font-size: 11px;
    border-radius: 0 7px 7px 0;
}

.mtype-combo-arrow:hover {
    color: #e0e0e0;
    background: rgba(255,255,255,.05);
}

.mtype-combo-dropdown {
    position: absolute;
    top: calc(100% + 3px);
    left: 0;
    right: 0;
    background: #1a1f2a;
    border: 1px solid #2a3344;
    border-radius: 8px;
    max-height: 180px;
    overflow-y: auto;
    z-index: 10000;
    box-shadow: 0 8px 24px rgba(0,0,0,.45);
    padding: 4px 0;
}

.mtype-combo-item {
    padding: 7px 12px;
    font-size: 13px;
    color: #d0d8e8;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mtype-combo-item:hover,
.mtype-combo-item.active {
    background: #263048;
    color: #fff;
}

#insMarkerModal textarea {
    min-height: 90px;
    resize: vertical;
}

.markerModalActions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

    .markerModalActions .smallBtn {
        white-space: nowrap;
    }

.insPeopleInModalActions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

    .insPeopleInModalActions .inputGroup {
        display: flex;
        gap: 6px;
        align-items: center;
    }

    .insPeopleInModalActions input {
        background: #1a1f2a;
        border: 1px solid #202634;
        border-radius: 8px;
        color: #e0e0e0;
        font-size: 13px;
        padding: 7px 9px;
        min-width: 140px;
    }

    .insPeopleInModalActions .hint {
        font-size: 11px;
        color: #7d859b;
    }

.insPeopleInModalList {
    flex: 1;
    min-height: 0;
    overflow: auto;
    border: 1px solid #1d2433;
    border-radius: 12px;
    background: rgba(22,27,38,.85);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.insPeopleInModalRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(17,22,32,.85);
    border: 1px solid transparent;
    transition: border-color .15s, background .15s;
}

    .insPeopleInModalRow:hover {
        border-color: #2c3a52;
        background: rgba(19,24,34,.95);
    }

    .insPeopleInModalRow .tc {
        font-variant-numeric: tabular-nums;
        color: #f0f3ff;
        font-size: 13px;
        font-weight: 600;
    }

    .insPeopleInModalRow .tools {
        display: flex;
        gap: 6px;
    }

        .insPeopleInModalRow .tools .smallBtn {
            white-space: nowrap;
        }

.insPeopleInModalEmpty {
    padding: 18px;
    text-align: center;
    font-size: 13px;
    color: #8490a8;
}

.people {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
}

.person {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #161b27;
    border: 1px solid #1b2031;
    border-radius: 12px;
    padding: 8px 10px;
    min-width: 0;
    cursor: pointer;
    transition: background .15s, border-color .15s, box-shadow .15s;
}

    .person img {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        object-fit: cover;
        border: 1px solid rgba(255,255,255,.12);
        box-shadow: 0 2px 6px rgba(0,0,0,.3);
    }

    .person .name {
        font-size: 12px;
        font-weight: 600;
        color: #e8ecf4;
        white-space: nowrap;
    }

    .person .count {
        color: #9aa3be;
        font-size: 11px;
        font-weight: 600;
        margin-left: 6px;
    }

    .person.selected {
        outline: 1px solid rgba(255,138,51,.45);
        box-shadow: 0 0 0 2px rgba(255,138,51,.18) inset;
    }

    .person:hover:not(.selected) {
        border-color: #2b3448;
        background: #1c2434;
    }

/* Tools/Trim */
#rmTools {
    background: linear-gradient(180deg,#121521 0%, #10131a 100%);
    border-radius: 12px;
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: inset 0 0 0 1px #0a0d14, 0 10px 24px rgba(0,0,0,.45);
    outline: 1px solid #0b0d13;
}

#rmToolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px
}

.tGroup {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap
}

.bigBtn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1a1f2a;
    border: 1px solid #202634;
    border-radius: 10px;
    color: #e0e0e0;
    font-size: 13px;
    padding: 6px 12px;
    cursor: pointer
}

    .bigBtn:hover {
        background: #232a39
    }

    .bigBtn.loopOn {
        background: #ff8a33;
        color: #0c0d11;
        border-color: #ffc9a1;
        font-weight: 700;
    }

.smallBtn {
    background: #1a1f2a;
    border: 1px solid #202634;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 13px;
    padding: 5px 8px;
    cursor: pointer
}

    .smallBtn:hover {
        background: #232a39
    }

    .smallBtn.primary {
        background: #ff8a33;
        border-color: #ffc9a1;
        color: #0c0d11;
        font-weight: 700;
    }

        .smallBtn.primary:hover {
            background: #ff9e55;
        }

.iconBtn {
    background: #1a1f2a;
    border: 1px solid #202634;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 16px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

    .iconBtn:hover {
        background: #232a39
    }

.shareMenu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 180px;
    display: none;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    background: #1a1f2a;
    border: 1px solid #202634;
    border-radius: 10px;
    box-shadow: 0 16px 28px rgba(0,0,0,.35);
    z-index: 40;
}

    .shareMenu.open {
        display: flex;
    }

.miniShareBtn {
    background: #1a1f2a;
    border: 1px solid #202634;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 12px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

    .miniShareBtn:hover {
        background: #232a39;
    }

#rmTime {
    color: #cbd3e6;
    font-size: 13px;
    letter-spacing: .2px;
    font-variant-numeric: tabular-nums;
}

    #rmTime .inTime {
        color: #74e083;
        font-weight: 600;
    }

    #rmTime .outTime {
        color: #ff6c6c;
        font-weight: 600;
    }

    #rmTime .durTime,
    #timestampDur .durTime {
        color: #ff9f4d;
        font-weight: 600;
    }

/* Trim slider */
#rmSlider.noUi-target {
    height: 14px;
    background: linear-gradient(90deg,#2b2f3b 0%,#242833 100%);
    border-radius: 7px;
    border: none;
    position: relative;
    box-shadow: inset 0 0 0 1px #0c0f16;
}

#rmSlider .noUi-connect {
    background: linear-gradient(90deg,rgba(255,44,125,0.7) 0%, rgba(255,138,51,0.7) 100%);
    border-radius: 7px;
}

#rmSlider .noUi-handle {
    width: 20px;
    height: 20px;
    top: -8px;
    border-radius: 50%;
    background: #ff2c7d;
    border: 0;
    cursor: ew-resize;
    box-shadow: 0 0 0 2px #0c0e12, 0 5px 16px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.05) inset;
}

    #rmSlider .noUi-handle:nth-child(3) {
        background: #ff8a33
    }

#rmSlider .noUi-tooltip {
    background: #0f1218;
    color: #ffd1c2;
    border: 1px solid #2b2f3b;
    border-radius: 6px;
    font-size: 12px;
    padding: 3px 5px;
    top: -34px !important;
    bottom: auto !important;
    z-index: 80;
    box-shadow: 0 10px 22px rgba(0,0,0,.45);
}

.handleLabel {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: -22px;
    top: auto;
    background: #0f1218;
    border: 1px solid #2b2f3b;
    border-radius: 6px;
    color: #e9eaf0;
    font-size: 11px;
    padding: 2px 5px;
    white-space: nowrap;
    pointer-events: none;
}

.trimWrap {
    position: relative;
    padding-bottom: 24px;
}

#rmPlayHead {
    position: absolute;
    top: -4px;
    width: 2px;
    height: 14px;
    background: #ec4141;
    box-shadow: 0 0 0 1px #0c0e12
}

#miniWrap {
    position: relative;
    height: 34px;
    margin-top: 8px;
}

    #miniWrap::before {
        content: "";
        position: absolute;
        top: 9px;
        left: 0;
        right: 0;
        height: 2px;
        background: #2a2f3c;
        border-radius: 2px;
    }

    #miniWrap .tick {
        position: absolute;
        top: 16px;
        transform: translateX(-50%);
        font: 11px "Inter",sans-serif;
        color: #8d8d8d;
    }

    #miniWrap .sel {
        position: absolute;
        top: 9px;
        height: 6px;
        background: linear-gradient(90deg,rgba(255,44,125,.6),rgba(255,138,51,.6));
        border-radius: 3px;
    }

#thumbStrip {
    position: relative;
    height: 86px;
    margin-top: 8px;
    background: #10131a;
    border-radius: 10px;
    border: 1px solid #1b2031;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.02), 0 6px 18px rgba(0,0,0,.35);
    overflow: hidden;
}

    #thumbStrip canvas {
        width: 100%;
        height: 100%;
        display: block;
    }

#thumbOverlay {
    position: absolute;
    top: 0;
    bottom: 0;
    display: none;
    background: rgba(255,138,51,.18);
    border: 1px solid rgba(255,138,51,.45);
    pointer-events: none;
}

#thumbStrip .thumb-status {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #8e94ad;
    background: linear-gradient(180deg,rgba(16,19,26,.82),rgba(16,19,26,.55));
    pointer-events: none;
    transition: opacity .2s ease, visibility .2s ease;
}

    #thumbStrip .thumb-status.hidden {
        opacity: 0;
        visibility: hidden;
    }

/* Download menu (tools) */
.dlMenu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 220px;
    background: #1a1f2a;
    border: 1px solid #202634;
    border-radius: 10px;
    display: none;
    flex-direction: column;
    box-shadow: 0 16px 28px rgba(0,0,0,.35);
    z-index: 40;
}

    .dlMenu button {
        background: none;
        border: none;
        color: #e0e0e0;
        padding: 9px 12px;
        text-align: left;
        font-size: 13px;
        cursor: pointer;
    }

        .dlMenu button:hover {
            background: #232a39
        }

#tlDownloadModal,
#tlSaveAsModal {
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: none;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 96px 32px 32px;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(2px);
}

    #tlDownloadModal.active,
    #tlSaveAsModal.active {
        display: flex;
    }

    #tlDownloadModal .modalBackdrop,
    #tlSaveAsModal .modalBackdrop {
        display: none;
    }

    #tlDownloadModal .modalDialog,
    #tlSaveAsModal .modalDialog {
        position: relative;
        width: 420px;
        max-height: calc(100vh - 160px);
        background: #101420;
        border: 1px solid #1c2334;
        border-radius: 14px;
        padding: 18px;
        box-shadow: 0 28px 80px rgba(0,0,0,.6);
        display: flex;
        flex-direction: column;
        gap: 14px;
    }

    #tlDownloadModal .modalHeader,
    #tlSaveAsModal .modalHeader {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    #tlDownloadModal .modalTitle,
    #tlSaveAsModal .modalTitle {
        font-size: 15px;
        font-weight: 700;
        color: #eef2ff;
        display: flex;
        align-items: center;
        gap: 8px;
    }

        #tlDownloadModal .modalTitle i,
        #tlSaveAsModal .modalTitle i {
            color: #ff914d;
        }

    #tlDownloadModal .modalSub,
    #tlSaveAsModal .modalSub {
        font-size: 13px;
        color: #9aa3be;
        margin: 0;
    }

    #tlDownloadModal .modalClose,
    #tlSaveAsModal .modalClose {
        width: 30px;
        height: 30px;
        border-radius: 10px;
        border: 1px solid #202634;
        background: #161b26;
        color: #d8ddef;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

        #tlDownloadModal .modalClose:hover,
        #tlSaveAsModal .modalClose:hover {
            background: #232a39;
            color: #fff;
        }

    #tlDownloadModal .modalBody,
    #tlSaveAsModal .modalBody {
        display: flex;
        flex-direction: column;
        gap: 14px;
    }

    #tlDownloadModal .downloadFields {
        display: grid;
        gap: 10px;
        grid-template-columns: 1fr;
    }

        #tlDownloadModal .downloadFields.empty label input {
            background: #161b26;
            opacity: .8;
            cursor: text;
        }

    #tlDownloadModal label,
    #tlSaveAsModal label {
        display: flex;
        flex-direction: column;
        gap: 6px;
        font-size: 12px;
        color: #9aa3be;
    }

    #tlDownloadModal input,
    #tlSaveAsModal input {
        background: #161b26;
        border: 1px solid #202634;
        border-radius: 9px;
        padding: 8px 10px;
        color: #eef2ff;
        font-size: 13px;
        outline: none;
    }

        #tlDownloadModal input:focus,
        #tlSaveAsModal input:focus,
        #tlSaveAsModal select:focus {
            border-color: #ff914d;
            box-shadow: 0 0 0 1px rgba(255,145,77,.25);
        }

    #tlDownloadModal .filenamePreview,
    #tlSaveAsModal .filenamePreview {
        background: linear-gradient(145deg,#1b1f2b 0%, #121722 100%);
        border: 1px solid #202634;
        border-radius: 10px;
        padding: 10px 12px;
        font-size: 13px;
        color: #cfd6e3;
        display: flex;
        align-items: center;
        gap: 6px;
    }

        #tlDownloadModal .filenamePreview strong,
        #tlSaveAsModal .filenamePreview strong {
            color: #fff;
        }

    #tlDownloadModal .metaEmptyMsg {
        font-size: 12px;
        color: #78809b;
        background: rgba(20,25,36,.55);
        border: 1px dashed #252c3c;
        border-radius: 10px;
        padding: 10px 12px;
    }

    #tlSaveAsModal .modalDialog {
        width: 460px;
        max-width: 480px;
    }

    #tlSaveAsModal .saveAsFields {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    #tlSaveAsModal select {
        background: #161b26;
        border: 1px solid #202634;
        border-radius: 9px;
        padding: 8px 10px;
        color: #eef2ff;
        font-size: 13px;
        outline: none;
        min-height: 36px;
        appearance: none;
    }

    #tlSaveAsModal .folderSelectWrap {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        align-items: center;
    }

        #tlSaveAsModal .folderSelectWrap select,
        #tlSaveAsModal .folderSelectWrap input {
            flex: 1 1 220px;
            max-width: 100%;
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

    #tlSaveAsModal .folderHint {
        font-size: 11px;
        color: #6f7389;
    }

    #tlSaveAsModal .saveAsActions {
        display: flex;
        justify-content: flex-end;
        gap: 10px;
        margin-top: 4px;
    }

#tlFolderPickerModal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(2px);
}

    #tlFolderPickerModal.active {
        display: flex;
    }

    #tlFolderPickerModal .modalBackdrop {
        display: none;
    }

    #tlFolderPickerModal .modalDialog {
        position: relative;
        z-index: 1;
        width: 420px;
        max-width: 480px;
        max-height: 80vh;
        background: #101420;
        border: 1px solid #1c2334;
        border-radius: 14px;
        padding: 18px;
        box-shadow: 0 28px 80px rgba(0,0,0,.6);
        display: flex;
        flex-direction: column;
        gap: 14px;
    }

    #tlFolderPickerModal .modalHeader {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    #tlFolderPickerModal .modalTitle {
        font-size: 15px;
        font-weight: 700;
        color: #eef2ff;
        display: flex;
        align-items: center;
        gap: 8px;
    }

        #tlFolderPickerModal .modalTitle i {
            color: #ffb347;
        }

    #tlFolderPickerModal .modalClose {
        width: 30px;
        height: 30px;
        border-radius: 10px;
        border: 1px solid #202634;
        background: #161b26;
        color: #d8ddef;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

        #tlFolderPickerModal .modalClose:hover {
            background: #232a39;
            color: #fff;
        }

    #tlFolderPickerModal .modalBody {
        display: flex;
        flex-direction: column;
        gap: 14px;
    }

    #tlFolderPickerModal .folderTree {
        background: #131927;
        border: 1px solid #1f2636;
        border-radius: 10px;
        padding: 6px 0;
        max-height: 48vh;
        overflow: auto;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    #tlFolderPickerModal .folderNodeBtn {
        min-width: 100%;
        width: max-content;
        background: none;
        border: none;
        color: #dde3f3;
        text-align: left;
        display: flex;
        align-items: center;
        gap: 10px;
        font-size: 13px;
        padding: 6px 12px 6px calc(16px + var(--depth,0)*16px);
        cursor: pointer;
        border-radius: 8px;
        transition: background .15s ease, color .15s ease;
    }

        #tlFolderPickerModal .folderNodeBtn .folderNodeExpander {
            width: 16px;
            flex-shrink: 0;
            display: inline-flex;
            justify-content: center;
            align-items: center;
            cursor: pointer;
            color: #8f99b0;
            transition: color .15s ease;
        }

        #tlFolderPickerModal .folderNodeBtn .folderNodeExpander.empty {
            visibility: hidden;
        }

        #tlFolderPickerModal .folderNodeBtn .folderNodeIcon {
            width: 18px;
            flex-shrink: 0;
            display: inline-flex;
            justify-content: center;
            color: #ffb347;
        }

        #tlFolderPickerModal .folderNodeBtn .folderNodeLabel {
            flex: 1 1 auto;
            white-space: nowrap;
        }

        #tlFolderPickerModal .folderNodeBtn:hover {
            background: #1f2636;
        }

        #tlFolderPickerModal .folderNodeBtn.selected {
            background: #ff8a33;
            color: #0c0d11;
            font-weight: 700;
        }

            #tlFolderPickerModal .folderNodeBtn.selected .folderNodeIcon {
                color: #0c0d11;
            }

    #tlFolderPickerModal .folderNodeEmpty {
        padding: 16px;
        text-align: center;
        font-size: 12px;
        color: #8f99b0;
    }

    #tlFolderPickerModal .folderPickerFooter {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    #tlFolderPickerModal .selectedPath {
        font-size: 12px;
        color: #8f99b0;
        background: #171d2a;
        border: 1px solid #1f2636;
        border-radius: 8px;
        padding: 8px 10px;
        display: flex;
        align-items: center;
        gap: 6px;
        min-height: 32px;
    }

        #tlFolderPickerModal .selectedPath strong {
            color: #dee5f5;
        }

    #tlFolderPickerModal .folderPickerActions {
        display: flex;
        justify-content: flex-end;
        gap: 10px;
    }

#tlDownloadModal .variantGrid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

    #tlDownloadModal .variantGrid button {
        flex: 1 1 150px;
        border: 1px solid #202634;
        border-radius: 10px;
        padding: 10px 12px;
        background: linear-gradient(145deg,#161b26 0%, #1f2534 100%);
        color: #eef2ff;
        font-size: 13px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        cursor: pointer;
        transition: transform .15s ease, background .15s ease;
    }

        #tlDownloadModal .variantGrid button:hover:not(:disabled) {
            transform: translateY(-1px);
            background: #232a39;
            color: #ff914d;
        }

        #tlDownloadModal .variantGrid button:disabled {
            opacity: .45;
            cursor: not-allowed;
        }

        #tlDownloadModal .variantGrid button i {
            font-size: 14px;
        }

#tlDownloadModal .optionGrid,
#tlSaveAsModal .optionGrid {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

    #tlDownloadModal .optionGrid .optionRow,
    #tlSaveAsModal .optionGrid .optionRow {
        display: flex;
        flex-wrap: wrap;
        gap: 16px 20px;
        align-items: center;
    }

#tlDownloadModal .toggleSwitch,
#tlSaveAsModal .toggleSwitch {
    position: relative;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    font-size: 13px;
    color: #eef2ff;
    cursor: pointer;
    user-select: none;
}

    #tlDownloadModal .toggleSwitch input,
    #tlSaveAsModal .toggleSwitch input {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }

    #tlDownloadModal .toggleSwitch .switchTrack,
    #tlSaveAsModal .toggleSwitch .switchTrack {
        width: 38px;
        height: 20px;
        border-radius: 999px;
        background: #1f2431;
        border: 1px solid #2a3241;
        position: relative;
        transition: background .18s,border-color .18s;
    }

    #tlDownloadModal .toggleSwitch .switchThumb,
    #tlSaveAsModal .toggleSwitch .switchThumb {
        width: 16px;
        height: 16px;
        border-radius: 50%;
        background: #cfd6e3;
        position: absolute;
        top: 1px;
        left: 1px;
        transition: transform .18s,background .18s;
    }

    #tlDownloadModal .toggleSwitch input:checked + .switchTrack,
    #tlSaveAsModal .toggleSwitch input:checked + .switchTrack {
        background: #ff914d;
        border-color: #ff914d;
    }

        #tlDownloadModal .toggleSwitch input:checked + .switchTrack .switchThumb,
        #tlSaveAsModal .toggleSwitch input:checked + .switchTrack .switchThumb {
            background: #121622;
            transform: translateX(18px);
        }

    #tlDownloadModal .toggleSwitch .labelText,
    #tlSaveAsModal .toggleSwitch .labelText {
        color: #eef2ff;
    }

    #tlDownloadModal .toggleSwitch.disabled,
    #tlSaveAsModal .toggleSwitch.disabled {
        opacity: .55;
        cursor: not-allowed;
    }

        #tlDownloadModal .toggleSwitch.disabled .switchTrack,
        #tlSaveAsModal .toggleSwitch.disabled .switchTrack {
            background: #1f2431;
            border-color: #2a3241;
        }

#tlDownloadModal .profileLabel {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    color: #9aa3be;
    min-width: 200px;
}

    #tlDownloadModal .profileLabel select {
        background: #161b26;
        border: 1px solid #202634;
        border-radius: 9px;
        padding: 8px 10px;
        color: #eef2ff;
        font-size: 13px;
    }

        #tlDownloadModal .profileLabel select:disabled {
            opacity: .45;
            cursor: not-allowed;
        }

    #tlDownloadModal .toggleSwitch.hidden,
    #tlSaveAsModal .toggleSwitch.hidden,
    #tlDownloadModal .optionRow.hidden,
    #tlSaveAsModal .optionRow.hidden,
    #tlDownloadModal .profileLabel.hidden {
        display: none !important;
    }

#richModal .video-js .vjs-tech {
    object-fit: contain !important;
    background: #000
}
/*---------------------------*/
/* —— Container Queries —— */
@container (max-width: 399px) {
    .kv {
        grid-template-columns: 1fr
    }

    .scene-grid {
        grid-template-columns: 1fr
    }

    .rs-header .title {
        font-size: 12px
    }
}

.scene-cap .cap {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
}

.insKeywordFields input, .insMarkerFields input, .insMarkerFields textarea {
    background: #1a1f2a;
    border: 1px solid #202634;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 13px;
    padding: 7px 9px;
    width: 100%;
    box-sizing: border-box;
}


.insMarkerActions button:hover {
    background: #2d3649;
}

.insMarkerActions button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #2d2d2d;
    background: #232a39;
    color: #dbe3ef;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
}


.insMarkerActions button.danger {
    background: #2a1418;
    border-color: #402127;
    color: #ff9aa7;
}

.insMarkerActions button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #2d2d2d;
    background: #232a39;
    color: #dbe3ef;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
}

/* Right sidebar managers: honor aria-hidden toggles (match rdo/index.html) */
.insKwManager,
.insPeopleManager {
    display: none;
}

    .insKwManager[aria-hidden="false"],
    .insPeopleManager[aria-hidden="false"] {
        display: flex !important; /* ensure override of any accidental display:none */
    }


.insKwManager, .insPeopleManager {
    margin-top: 14px;
    flex-direction: column;
    gap: 10px;
}

    .insKwManager .kwManagerHead {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 10px;
        gap: 8px;
    }

    .insKwManager .kwManagerTitle {
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: .2px;
        color: #cfd6e3;
    }

    .insKwManager .kwCloseBtn {
        width: 26px;
        height: 26px;
        border-radius: 8px;
        background: #1a1f2a;
        border: 1px solid #202634;
        color: #e0e0e0;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }
.insKeyword.selected {
    outline: 1px solid rgba(255, 138, 51, .45);
    box-shadow: 0 0 0 2px rgba(255, 138, 51, .18) inset;
    border-color: var(--accent);
}

.insKeyword, .insMarker {
    position: relative;
}

.insKeyword {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #1a1f2a;
    border: 1px solid #2d2d2d;
    color: #dbe3ef;
    font-size: 13px;
}

    .insKeyword .info {
        display: flex;
        flex-direction: column;
        gap: 2px;

    box-sizing: border-box;
    margin: 0;
    padding: 0;
    color: var(--fg);
}

.insightFrames {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;


}

.insightFrame {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border: 1px solid #2d2d2d;
    border-radius: 999px;
    background: #1f2633;
    font-size: 11px;
    color: #dbe3ef;

}

    .insightFrame .frameTime {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        font-weight: 600;

}

    .insightFrame .frameMeta {
        color: #9fb0c8;
        font-weight: 500;


}
.insKeyword .actions {
    display: flex;
    gap: 6px;
    align-self: flex-end;
}
.insKeyword button {
    background: #232a39;
    border: 1px solid #2d2d2d;
    border-radius: 6px;
    color: #dbe3ef;
    padding: 4px 6px;
    font-size: 12px;
    cursor: pointer;
}

.insPeopleManager .peopleManagerHead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 8px;
}

.insPeopleManager .insPeopleList {
    max-height: 260px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 6px;
}

.insPersonRow {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #1a1f2a;
    border: 1px solid #2d2d2d;
    color: #dbe3ef;
    font-size: 13px;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}

.insPersonRow.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(255, 145, 77, .35);
}
.insPersonRow .info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.insightFrames {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}
.insPersonRow .actions {
    display: flex;
    gap: 6px;
    align-self: flex-end;
}

.insPersonRow .info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.insPersonRow .info .avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #2b3344;
    flex: 0 0 auto;
    cursor: zoom-in;
}






/* Right sidebar: Image preview overlay */
.rs-imagePreview {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 4000;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s;
}

    .rs-imagePreview.active {
        opacity: 1;
        pointer-events: auto;
    }

    .rs-imagePreview figure {
        position: absolute;
        top: 0;
        left: 0;
        transform-origin: top left;
        background: #15191f;
        border: 1px solid #2d2d2d;
        border-radius: 12px;
        padding: 16px;
        max-width: min(420px, 80vw);
        max-height: 80vh;
        display: flex;
        flex-direction: column;
        gap: 12px;
        box-shadow: 0 12px 32px rgba(0,0,0,.45);
    }

    .rs-imagePreview img {
        max-width: min(360px, 60vw);
        max-height: 60vh;
        border-radius: 12px;
        object-fit: contain;
    }

    .rs-imagePreview figcaption {
        color: #dbe3ef;
        font-size: 14px;
        text-align: center;
    }

    .rs-imagePreview button {
        align-self: flex-end;
        border: none;
        background: transparent;
        color: #dbe3ef;
        font-size: 18px;
        cursor: pointer;
    }

/* Right sidebar: Generic modal */
body.modal-open {
    overflow: hidden;
}

.rs-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: transparent;
    z-index: 1600;
}

    .rs-modal.active {
        display: flex;
    }

.rs-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10,12,18,.78);
    backdrop-filter: blur(2px);
}

.rs-modal-dialog {
    position: relative;
    background: var(--bg-dark, #1e1e1e);
    border: 1px solid #2d2d2d;
    border-radius: 14px;
    padding: 20px;
    min-width: 320px;
    max-width: 420px;
    width: 90%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 22px 46px rgba(0,0,0,.55);
}

.rs-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.rs-modal-close {
    border: none;
    background: transparent;
    color: var(--fg, #e0e0e0);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
}

    .rs-modal-close:hover {
        color: var(--accent, #ff914d);
    }

.rs-modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.rs-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

    .rs-field label {
        font-size: 12px;
        letter-spacing: .2px;
        text-transform: uppercase;
        color: #8a96ad;
    }

    .rs-field input {
        padding: 8px 10px;
        border-radius: 8px;
        border: 1px solid #2d2d2d;
        background: var(--bg-dark, #1e1e1e);
        color: var(--fg, #e0e0e0);
    }

        .rs-field input:focus {
            outline: 1px solid var(--accent, #ff914d);
        }

.rs-modal-avatar {
    display: flex;
    align-items: center;
    gap: 16px;
}

    .rs-modal-avatar img {
        width: 72px;
        height: 72px;
        border-radius: 50%;
        object-fit: cover;
        border: 2px solid #2d2d2d;
        background: #1e242f;
    }

.rs-modal-avatar-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rs-modal-upload {
    border: 1px dashed #2d2d2d;
    background: #1b1f29;
    color: #dbe3ef;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

    .rs-modal-upload:hover {
        background: #232a39;
        color: #fff;
    }

.rs-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}


.insPersonRow .actions {
    display: flex;
    gap: 6px;
    align-self: flex-end;
}

.insPersonRow button {
    border: 1px solid #2d2d2d;
    background: #232a39;
    color: #dbe3ef;
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 12px;
    cursor: pointer;
}


.rel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.rel-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-light);
    display: flex;
    flex-direction: column;
    border: 1px solid #2d2d2d;
    transition: transform .15s, box-shadow .15s;
    align-self: start;
}

.rel-thumb {
    height: 120px;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
    .rel-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.rel-overlay {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(0, 0, 0, .55);
    padding: 4px;
    border-radius: 8px;
    font-size: .8rem;
}

.rel-duration {
    position: absolute;
    left: 6px;
    bottom: 6px;
    background: rgba(0, 0, 0, .6);
    padding: 2px 6px;
    border-radius: 6px;
    font-size: .78rem;
}

.rel-hint {
    margin-top: 12px;
    color: var(--muted);
    font-size: 12px;
}

.rel-label {
    padding: 9px 10px;
    font-size: .88rem;
}

.rel-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rel-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    align-items: center;
    flex-wrap: wrap;
}
.rel-chip {
    font-size: 12px;
    border: 1px solid #2d2d2d;
    padding: 4px 8px;
    border-radius: 8px;
    color: #cfd6e3;
    cursor: pointer;
}







/* Generic modal */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.75);
    visibility: hidden;
    opacity: 0;
    transition: opacity .25s;
    z-index: 1600;
}

    .modal.active {
        visibility: visible;
        opacity: 1;
    }

    .modal .modal-content {
        background: var(--bg-dark,#1e1e1e);
        border: 1px solid #000;
        border-radius: 14px;
        padding: 22px 24px;
        box-shadow: 0 18px 45px rgba(0,0,0,.6);
        max-width: 960px;
        width: min(90vw,960px);
    }
