:root {
    --page: #f3f6f9;
    --surface: #ffffff;
    --surface-alt: #f7f9fb;
    --surface-strong: #edf2f6;
    --line: #cfd7df;
    --line-strong: #aebbc7;
    --text: #1c2733;
    --muted: #667789;
    --primary: #246b9e;
    --primary-dark: #194f77;
    --primary-soft: #e8f2f9;
    --success: #247855;
    --success-soft: #e5f5ed;
    --warning: #9b6700;
    --warning-soft: #fff4d5;
    --danger: #a6373f;
    --danger-soft: #fdebed;
    --shadow: 0 8px 24px rgba(29, 50, 69, .08);
    --shadow-soft: 0 2px 8px rgba(29, 50, 69, .07);
    --radius: 10px;
    --radius-small: 6px;
    --page-top: #eef3f7;
    --accent: #d19822;
    --topbar-bg: #ffffff;
    --topbar-text: #162738;
    --brand-font: "Segoe UI", Arial, sans-serif;
    --brand-logo-max-height: 40px;
    font-family: var(--brand-font);
    color-scheme: light;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--page); }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: linear-gradient(180deg, var(--page-top) 0, var(--page) 240px);
    font-size: 14px;
    line-height: 1.42;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }

/* Shell */
.topbar {
    min-height: 62px;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 8px 22px;
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 2px 12px rgba(24, 48, 68, .07);
    position: sticky;
    top: 0;
    z-index: 40;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--topbar-text);
    font-size: 20px;
    font-weight: 750;
    letter-spacing: .1px;
    white-space: nowrap;
}
.brand:hover { text-decoration: none; color: var(--topbar-text); }
.brand-mark {
    width: 31px;
    height: 31px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(145deg, var(--primary), var(--primary-dark));
    box-shadow: var(--shadow-soft);
    font-size: 14px;
    font-weight: 800;
}
.nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}
.nav a {
    color: var(--topbar-text);
    padding: 8px 9px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}
.nav a:hover {
    color: var(--primary-dark);
    background: var(--primary-soft);
    text-decoration: none;
}
.userbox {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    color: var(--muted);
}
.user-identity { display: flex; flex-direction: column; line-height: 1.15; text-align: right; }
.user-identity strong { color: var(--text); font-size: 13px; }
.user-identity span { font-size: 11px; }
.userbox form, .inline, .clip-actions form, .button-row form, .toolbar form { display: inline-flex; margin: 0; }
.link-button { border: 0; background: none; color: var(--primary); padding: 4px; cursor: pointer; }
.page-shell { width: min(1680px, calc(100% - 28px)); margin: 20px auto 52px; }
.footer { padding: 20px; text-align: center; color: var(--muted); border-top: 1px solid var(--line); background: var(--surface); }

h1, h2, h3 { line-height: 1.18; margin: 0 0 8px; color: var(--text); }
h1 { font-size: 28px; font-weight: 680; }
h2 { font-size: 18px; font-weight: 680; }
h3 { font-size: 14px; font-weight: 700; }
p { margin: 0 0 11px; }
.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}
.page-heading p { color: var(--muted); }
.compact-heading { margin-bottom: 10px; }
.compact-heading h1 { font-size: 25px; }
.breadcrumbs { color: var(--muted); margin-bottom: 7px; font-size: 12px; }

/* Surfaces and common layout */
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}
.compact-panel { padding: 12px 14px; }
.narrow { max-width: 690px; margin: 38px auto; }
.wide { max-width: 1120px; }
.form-panel { max-width: 920px; margin-left: auto; margin-right: auto; }
.table-panel { padding: 0; overflow: auto; }
.table-panel > table { min-width: 820px; }
.panel-title-row, .section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 10px;
}
.panel-title-row h2, .section-heading h2 { margin-bottom: 2px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.two-wide { grid-template-columns: minmax(0, 1.45fr) minmax(330px, .75fr); }
.detail-grid { align-items: stretch; }
.muted, .help { color: var(--muted); font-size: 12.5px; }
.empty, .empty-state { padding: 24px; color: var(--muted); text-align: center; }
.empty-state { border: 1px dashed var(--line-strong); border-radius: 8px; background: var(--surface-alt); }
.top-gap { margin-top: 11px !important; }
.grow { flex: 1; min-width: 0; }
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Buttons */
.button {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid #9eacb9;
    background: linear-gradient(var(--surface), var(--surface-strong));
    color: var(--text);
    border-radius: 6px;
    padding: 7px 12px;
    cursor: pointer;
    white-space: nowrap;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(22, 39, 56, .06);
}
.button:hover { background: var(--surface-strong); border-color: var(--primary); text-decoration: none; color: var(--text); }
.button.primary { color: #fff; background: linear-gradient(var(--primary), var(--primary-dark)); border-color: var(--primary-dark); }
.button.primary:hover { background: var(--primary-dark); color: #fff; }
.button.danger { color: #8b252d; background: var(--danger-soft); border-color: #d9a6aa; }
.button.danger:hover { background: #f8d9dc; color: #751e25; }
.button.small { min-height: 29px; padding: 4px 9px; font-size: 12px; }
.button.tiny { min-height: 24px; padding: 2px 7px; font-size: 11px; }
.button.wide { width: 100%; }
.button[disabled], .button:disabled { cursor: not-allowed; opacity: .55; }
.button-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.button-column { display: flex; flex-direction: column; gap: 3px; }
.action-column { display: flex; flex-direction: column; gap: 8px; }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 16px; margin-bottom: 17px; }
.span-2 { grid-column: 1 / -1; }
label { display: block; color: var(--text); font-weight: 650; margin-bottom: 5px; }
input, select, textarea {
    width: 100%;
    min-height: 34px;
    border: 1px solid var(--line-strong);
    background: #fff;
    color: var(--text);
    border-radius: 5px;
    padding: 6px 8px;
    outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #5b9cca; box-shadow: 0 0 0 3px rgba(41, 118, 170, .12); }
input[readonly], input:disabled, select:disabled, textarea:disabled { background: #eef2f5; color: #6b7885; }
textarea { resize: vertical; }
.check, .compact-check {
    display: flex;
    align-items: center;
    gap: 7px;
    font-weight: 500;
    margin: 0;
    padding: 5px 0;
}
.check input, .compact-check input, .checkbox-form input, .exclude-check input { width: auto; min-height: 0; }
.inline-form, .search-form, .compact-inline { display: flex; align-items: center; gap: 7px; }
.compact-inline input, .compact-inline select { min-height: 30px; padding: 4px 7px; }
.time-fields { border: 1px solid var(--line); border-radius: 7px; padding: 9px; display: flex; align-items: center; gap: 5px; }
.time-fields legend { color: var(--muted); padding: 0 5px; }
.time-fields input { width: 68px; text-align: center; }
.review-note-field { min-width: 220px; flex: 1; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    color: #4b6072;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .045em;
    background: #edf2f6;
}
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f7fafc; }
.compact th, .compact td { padding: 7px 9px; }
.result-cell { max-width: 450px; white-space: normal; }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }

/* Badges and tags */
.badge { display: inline-block; padding: 3px 7px; border-radius: 999px; font-size: 11px; font-weight: 700; background: #e8edf1; color: #405364; }
.badge.succeeded { background: var(--success-soft); color: var(--success); }
.badge.pending, .badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.running { background: var(--primary-soft); color: var(--primary-dark); }
.badge.failed { background: var(--danger-soft); color: var(--danger); }
.badge.canceled, .badge.neutral { background: #e8edf1; color: #526374; }
.status-stack { display: flex; gap: 5px; flex-wrap: wrap; }
.status-stack.inline { margin-top: 7px; }
.tag-list { display: flex; gap: 5px; flex-wrap: wrap; }
.tag-list.large { gap: 7px; }
.tag { display: inline-flex; align-items: center; gap: 5px; background: var(--primary-soft); border: 1px solid #b7d4e7; color: #245b7c; border-radius: 999px; padding: 3px 8px; font-size: 12px; }
.tag-x { border: 0; background: none; color: #326f94; cursor: pointer; padding: 0; font-size: 15px; }

/* Messages and login */
.alert { border-radius: 7px; padding: 10px 13px; margin-bottom: 14px; }
.alert.success { background: var(--success-soft); border: 1px solid #aad8c2; color: #1f6749; }
.alert.error { background: var(--danger-soft); border: 1px solid #e0aeb2; color: #8f2c34; }
.login-card { width: min(440px, calc(100% - 28px)); margin: 80px auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 31px; }
.login-card label { margin-top: 14px; }

/* Dashboard and main-menu cards */
.stat-grid { display: grid; grid-template-columns: repeat(6, minmax(120px, 1fr)); gap: 11px; margin-bottom: 16px; }
.stat-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--text); box-shadow: var(--shadow-soft); }
.stat-card:hover { border-color: #7faed0; text-decoration: none; transform: translateY(-1px); }
.stat-card strong { font-size: 27px; color: var(--primary-dark); }
.stat-card span { color: var(--muted); }
.action-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.action-card { display: flex; flex-direction: column; gap: 4px; padding: 13px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-alt); color: var(--text); }
form.action-card { align-items: flex-start; }
.action-card:hover { border-color: #7faed0; background: var(--primary-soft); text-decoration: none; }
.action-card span { color: var(--muted); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 13px; }
.collection-card { display: flex; flex-direction: column; justify-content: space-between; min-height: 165px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 17px; box-shadow: var(--shadow-soft); }

/* Generic details/lists */
.details { display: grid; grid-template-columns: 150px 1fr; gap: 8px 13px; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }
.clip-list, .list-stack { display: flex; flex-direction: column; gap: 7px; }
.clip-card { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; background: var(--surface-alt); border: 1px solid var(--line); border-radius: 7px; padding: 11px; }
.clip-card.disabled, .job-clip.disabled { opacity: .58; }
.clip-main { flex: 1; min-width: 0; }
.clip-main p { margin: 4px 0 7px; }
.clip-actions { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.time { font-family: Consolas, monospace; color: #245b7c; margin-left: 7px; }
.priority { color: var(--muted); margin-left: 7px; font-size: 12px; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 11px; background: var(--surface-alt); border: 1px solid var(--line); border-radius: 7px; padding: 9px 10px; }
.job-clip { display: flex; align-items: center; gap: 9px; background: var(--surface-alt); border: 1px solid var(--line); border-radius: 7px; padding: 9px; }
.order-box { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 6px; background: #dfeaf2; font-weight: 800; color: #31546d; }
.danger-zone { border-color: #e2b7ba; background: #fffafa; }

/* Toolbars and tabs */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; }
.toolbar.wrap, .button-row.wrap { flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a { padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius-small); background: var(--surface); color: var(--text); font-weight: 600; }
.tabs a.active { border-color: #76a8cb; color: #184d72; background: var(--primary-soft); }

/* Files / Set Cut Scenes workbench */
.workbench-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px;
    margin-bottom: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
}
.workbench-filter { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; flex: 1; }
.workbench-filter select { width: auto; min-width: 180px; }
.workbench-filter input[type="search"], .workbench-filter input[name="search"] { min-width: 260px; }
.file-workbench { display: grid; grid-template-columns: minmax(250px, 31%) minmax(0, 1fr); gap: 12px; align-items: start; }
.file-selector-panel { padding: 0; overflow: hidden; position: sticky; top: 76px; }
.file-selector-panel .panel-title-row { padding: 11px 12px 8px; border-bottom: 1px solid var(--line); margin: 0; background: var(--surface-alt); }
.file-selector-list { max-height: calc(100vh - 180px); overflow-y: auto; }
.file-selector-item { display: block; padding: 8px 10px; border-bottom: 1px solid var(--line); color: var(--text); background: var(--surface); }
.file-selector-item:nth-child(even) { background: var(--surface-alt); }
.file-selector-item:hover { background: var(--primary-soft); text-decoration: none; }
.file-selector-item.active { background: var(--primary-soft); box-shadow: inset 4px 0 0 var(--primary); }
.file-selector-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.file-selector-meta { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; margin-top: 2px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: #98a7b4; }
.status-dot.reviewed { background: var(--success); }
.status-dot.later { background: var(--warning); }
.status-dot.missing { background: var(--danger); }
.status-dot.shortened { background: var(--primary); }
.workbench-main { min-width: 0; }
.file-state-panel { padding: 10px 12px; }
.file-state-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.file-state-form .status-options { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.workbench-upper-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(310px, .75fr); gap: 12px; }
.category-transfer-card, .priority-panel { margin-bottom: 12px; }
.dual-list-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 9px; }
.dual-list-grid > div > h3 { margin: 0 0 5px; }
.transfer-list { min-height: 126px; max-height: 190px; overflow-y: auto; border: 1px solid var(--line-strong); border-radius: var(--radius-small); background: var(--surface); }
.transfer-list.tall, .tall-list { min-height: 205px; max-height: 360px; }
.transfer-list form { margin: 0; }
.transfer-item { width: 100%; min-height: 27px; display: flex; justify-content: space-between; align-items: center; text-align: left; padding: 4px 7px; border: 0; border-bottom: 1px solid #e2e7eb; background: #fff; color: var(--text); cursor: pointer; }
.transfer-item:hover { background: var(--primary-soft); }
.transfer-item.assigned, .assigned { background: var(--primary-soft); }
.transfer-arrow-column { display: none; }
.priority-tools { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.priority-tools select { min-width: 220px; width: auto; }
.marker-legend { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; color: var(--muted); font-size: 11px; margin-top: 8px; }
.marker { width: 11px; height: 11px; border-radius: 3px; display: inline-block; border: 1px solid rgba(0,0,0,.2); }
.marker.yellow, .marker-button.yellow { background: #f1df27; }
.marker.blue, .marker-button.blue { background: #2e8fd0; }
.marker.green, .marker-button.green { background: #2ca779; }
.marker.red, .marker-button.red { background: #df3948; }
.source-clip-note { background: var(--warning-soft); border: 1px solid #ecd58f; color: #75520d; border-radius: 5px; padding: 5px 8px; margin-top: 7px; }
.clip-editor-panel { padding: 0; overflow: hidden; }
.clip-editor-panel .panel-title-row { padding: 10px 12px; margin: 0; border-bottom: 1px solid var(--line); background: var(--surface-alt); }
.clip-grid-table { overflow-x: auto; }
.clip-grid-header, .clip-grid-row {
    min-width: 940px;
    display: grid;
    grid-template-columns: 58px 58px 58px 58px 58px minmax(300px, 1fr) 255px 58px;
    align-items: center;
    column-gap: 5px;
    padding: 4px 7px;
}
.clip-grid-header { min-height: 30px; background: var(--surface-strong); color: var(--muted); border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 700; }
.clip-grid-row { min-height: 39px; border-bottom: 1px solid #dde3e8; }
.clip-grid-row:nth-child(even) { background: var(--surface-alt); }
.clip-grid-row:hover { background: var(--primary-soft); }
.clip-grid-row input[type="number"] { min-height: 29px; padding: 3px 5px; text-align: center; }
.clip-grid-row .clip-description { min-height: 29px; padding: 3px 6px; }
.clip-id-link { font-weight: 700; color: #2b5878; text-align: center; }
.clip-row-actions { display: flex; align-items: center; gap: 4px; min-width: 0; }
.clip-row-actions form { margin: 0; display: inline-flex; }
.icon-button, .marker-button {
    width: 25px;
    height: 25px;
    min-width: 25px;
    padding: 0;
    border-radius: 5px;
    border: 1px solid #8899a7;
    background: linear-gradient(#fff, #e6ebef);
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    color: #3d4f5f;
    font-size: 11px;
    text-decoration: none;
}
.icon-button:hover { background: #dce5eb; text-decoration: none; }
.icon-button.save { background: var(--success-soft); color: #176847; border-color: #78b99b; font-weight: 800; }
.marker-button { border-color: rgba(35, 52, 66, .5); }
.marker-button:hover { filter: brightness(.92); text-decoration: none; }
.exclude-check { display: inline-flex; align-items: center; gap: 3px; margin: 0 0 0 3px; font-size: 10px; color: var(--muted); font-weight: 500; }
.priority-number { text-align: center; font-weight: 700; color: #4c6072; }
.clip-category-panel { margin-top: 0; }
.clip-category-transfer { grid-template-columns: minmax(0, 1fr) 36px minmax(0, 1fr); }
.clip-category-transfer .transfer-arrow-column { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; color: #4f687b; }

/* Shortened videos */
.shortened-table-panel { overflow: hidden; padding: 0; }
.shortened-table { width: 100%; }
.shortened-table th, .shortened-table td { padding: 6px 9px; }
.shortened-table tbody tr:nth-child(even) { background: #eef1f3; }
.shortened-table .checkbox-column { width: 42px; text-align: center; }
.shortened-table .action-column { width: 42px; }
.checkbox-form { display: inline-flex; align-items: center; justify-content: center; margin: 0; }
.process-single-button { width: 25px; height: 25px; min-height: 25px; padding: 0; border-radius: 5px; }

/* Collections */
.collection-create-bar { display: grid; grid-template-columns: minmax(230px, 360px) auto; gap: 8px; align-items: end; margin-bottom: 13px; }
.collection-workspace { display: grid; grid-template-columns: minmax(250px, 330px) minmax(0, 1fr); gap: 12px; }
.collection-list { max-height: 580px; overflow-y: auto; border: 1px solid var(--line); border-radius: 7px; }
.collection-selector-row { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.collection-selector-form { display: flex; align-items: end; gap: 7px; flex: 1; }
.collection-selector-form select { min-width: 240px; }
.collection-metadata-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 9px; align-items: end; margin-bottom: 12px; }
.collection-transfer-grid { display: grid; grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr); gap: 10px; }
.large-transfer-arrows { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; color: #4f687b; font-size: 17px; }
.transfer-heading { margin-bottom: 6px; }
.file-transfer-item { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid #e1e6ea; background: #fff; color: var(--text); padding: 6px 8px; cursor: pointer; overflow-wrap: anywhere; }
.file-transfer-item:hover { background: var(--primary-soft); }

/* Jobs workbench */
.jobs-workbench { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 12px; }
.job-selected-list, .job-available-list { max-height: 620px; overflow-y: auto; }
.job-clip.compact-row { padding: 7px; }
.job-clip .clip-title { font-weight: 650; }

@media (max-width: 1280px) {
    .stat-grid { grid-template-columns: repeat(3, 1fr); }
    .topbar { align-items: flex-start; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
    .nav { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
    .userbox { margin-left: auto; }
    .workbench-upper-grid { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
    .page-shell { width: min(100% - 18px, 1680px); }
    .grid.two, .grid.two-wide, .file-workbench, .collection-workspace, .jobs-workbench { grid-template-columns: 1fr; }
    .file-selector-panel { position: static; }
    .file-selector-list { max-height: 300px; }
    .collection-metadata-form { grid-template-columns: 1fr 1fr; }
    .collection-metadata-form .button { grid-column: 1 / -1; }
    .page-heading { flex-direction: column; }
}

@media (max-width: 720px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .action-grid, .form-grid, .dual-list-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .workbench-toolbar, .workbench-filter, .file-state-form, .collection-selector-row, .collection-selector-form { align-items: stretch; flex-direction: column; }
    .workbench-filter input[type="search"], .workbench-filter input[name="search"], .workbench-filter select, .collection-selector-form select { width: 100%; min-width: 0; }
    .clip-category-transfer, .collection-transfer-grid { grid-template-columns: 1fr; }
    .clip-category-transfer .transfer-arrow-column, .large-transfer-arrows { flex-direction: row; min-height: 30px; }
    .collection-create-bar, .collection-metadata-form { grid-template-columns: 1fr; }
    .collection-metadata-form .button { grid-column: auto; }
    .details { grid-template-columns: 120px 1fr; }
    .clip-card { flex-direction: column; }
    .userbox { width: 100%; justify-content: flex-end; }
}

@media (max-width: 500px) {
    .page-shell { width: calc(100% - 12px); margin-top: 10px; }
    .panel { padding: 12px; border-radius: 7px; }
    .stat-grid { grid-template-columns: 1fr; }
    .toolbar, .search-form, .inline-form, .compact-inline { align-items: stretch; flex-direction: column; }
    .button-row { align-items: stretch; }
    .button { width: 100%; }
    .details { grid-template-columns: 1fr; }
    .details dt { margin-top: 7px; }
    .details dd { padding-bottom: 6px; border-bottom: 1px solid var(--line); }
    h1 { font-size: 24px; }
}
.status-dot.success, .status-dot.reviewed { background: var(--success); }
.status-dot.warning, .status-dot.later { background: var(--warning); }
.status-dot.danger, .status-dot.missing { background: var(--danger); }
.status-dot.pending { background: #8d9ba8; }
.clip-grid-row.selected { box-shadow: inset 4px 0 0 var(--primary); background: var(--primary-soft); }
.clip-grid-row.excluded { opacity: .62; }


.maintenance-block {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border, #d6dbe1);
}

.maintenance-block h2 {
    margin-top: 0;
}

.alert.warning {
    background: var(--warning-soft);
    border: 1px solid #e3c36d;
    color: #75520d;
}

.disabled-card {
    cursor: not-allowed;
    opacity: .68;
    background: #f3f5f7;
    border-style: dashed;
}


/* Settings-driven branding */
.brand-copy { display: flex; flex-direction: column; min-width: 0; line-height: 1.08; }
.brand-name { font-weight: 750; overflow: hidden; text-overflow: ellipsis; }
.brand-tagline { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 10px; font-weight: 500; margin-top: 2px; }
.brand-logo { display: block; max-height: var(--brand-logo-max-height); max-width: 210px; width: auto; object-fit: contain; }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.login-brand h1 { margin-bottom: 4px; }
.login-brand p { color: var(--muted); margin: 0; }
.login-logo { display: block; max-height: 76px; max-width: 180px; width: auto; object-fit: contain; }
.login-mark { width: 54px; height: 54px; min-width: 54px; font-size: 20px; border-radius: var(--radius); }
.branding-settings-grid > h3 { margin-top: 4px; }
.branding-upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.color-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 9px; }
.color-grid label { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 9px; background: var(--surface-alt); border: 1px solid var(--line); border-radius: var(--radius-small); font-size: 12px; }
.color-grid input[type="color"] { width: 42px; min-height: 30px; padding: 2px; border-radius: 5px; }
.branding-preview { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.branding-preview-header { display: flex; align-items: center; gap: 8px; padding: 10px 12px; color: var(--topbar-text); background: var(--topbar-bg); border-bottom: 1px solid var(--line); }
.branding-preview-mark { width: 28px; height: 28px; display: grid; place-items: center; border-radius: var(--radius-small); color: #fff; background: linear-gradient(145deg, var(--primary), var(--primary-dark)); font-size: 11px; font-weight: 800; }
.branding-preview-body { padding: 14px; color: var(--text); background: var(--surface); }
.branding-preview-body p { color: var(--muted); }

@media (max-width: 760px) {
    .branding-upload-grid { grid-template-columns: 1fr; }
    .brand-tagline { display: none; }
    .brand-logo { max-width: 130px; }
}

.settings-feature-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 1rem 1.1rem;
    margin-bottom: 1.25rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--primary-soft);
}
.settings-feature-card h2 { margin: 0 0 .25rem; }
.settings-feature-card p { margin: 0; }
.sticky-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    padding: .8rem;
    margin: 1rem -.25rem -.25rem;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    border-top: 1px solid var(--line);
}
@media (max-width: 720px) {
    .settings-feature-card { align-items: stretch; flex-direction: column; }
}

/* Compact density and asynchronous Set Cut Scenes revision */
body { font-size: 13px; line-height: 1.3; }
.topbar { min-height: 52px; gap: 11px; padding: 5px 14px; }
.brand { gap: 7px; font-size: 18px; }
.brand-mark { width: 28px; height: 28px; border-radius: 6px; font-size: 12px; }
.nav a { padding: 5px 7px; font-size: 12px; }
.userbox { gap: 7px; }
.page-shell { width: min(1760px, calc(100% - 16px)); margin: 10px auto 30px; }
.footer { padding: 11px; }
h1, h2, h3 { margin-bottom: 5px; }
h1 { font-size: 23px; }
h2 { font-size: 16px; }
h3 { font-size: 12.5px; }
p { margin-bottom: 7px; }
.page-heading { gap: 10px; margin-bottom: 8px; }
.compact-heading { margin-bottom: 6px; }
.compact-heading h1 { font-size: 22px; }
.panel { padding: 11px 12px; margin-bottom: 9px; box-shadow: var(--shadow-soft); }
.compact-panel { padding: 7px 9px; }
.panel-title-row, .section-heading { gap: 8px; margin-bottom: 6px; }
.grid { gap: 9px; }
.grid.two-wide { grid-template-columns: minmax(0, 1.6fr) minmax(280px, .65fr); }
.empty, .empty-state { padding: 14px; }
.top-gap { margin-top: 6px !important; }
.button { min-height: 29px; gap: 4px; padding: 4px 9px; border-radius: 5px; }
.button.small { min-height: 25px; padding: 2px 7px; font-size: 11.5px; }
.button.tiny { min-height: 21px; padding: 1px 5px; }
.button-row { gap: 5px; }
.action-column { gap: 5px; }
.form-grid { gap: 8px 10px; margin-bottom: 10px; }
label { margin-bottom: 3px; font-size: 12.5px; }
input, select, textarea { min-height: 29px; padding: 4px 6px; border-radius: 4px; }
.check, .compact-check { gap: 5px; padding: 2px 0; }
.inline-form, .search-form, .compact-inline { gap: 5px; }
.compact-inline input, .compact-inline select { min-height: 27px; padding: 3px 5px; }
.time-fields { padding: 6px; gap: 4px; }
.time-fields input { width: 58px; }
th, td { padding: 6px 8px; }
.compact th, .compact td { padding: 4px 6px; }
.badge { padding: 2px 6px; font-size: 10.5px; }
.alert { padding: 7px 9px; margin-bottom: 8px; }
.login-card { margin: 42px auto; padding: 19px; }
.login-card h1 { font-size: 26px; }
.login-card label { margin-top: 9px; }
.stat-grid { gap: 7px; margin-bottom: 10px; }
.stat-card { padding: 9px 11px; }
.stat-card strong { font-size: 23px; }
.action-grid { gap: 7px; }
.action-card { gap: 2px; padding: 9px; }
.card-grid { gap: 8px; }
.collection-card { min-height: 130px; padding: 11px; }
.details { grid-template-columns: 135px 1fr; gap: 5px 9px; }
.clip-list, .list-stack { gap: 4px; }
.clip-card { gap: 8px; padding: 7px; }
.list-row, .job-clip { gap: 7px; padding: 6px 7px; }
.toolbar { gap: 6px; margin-bottom: 8px; }
.tabs a { padding: 4px 7px; }

.workbench-toolbar { padding: 6px 7px; margin-bottom: 7px; }
.workbench-filter {
    display: grid;
    grid-template-columns: minmax(150px, 190px) minmax(330px, 2fr) minmax(145px, .65fr) minmax(170px, .75fr) auto;
    align-items: start;
    gap: 5px 7px;
}
.filter-field { min-width: 0; display: flex; flex-direction: column; align-self: start; }
.filter-field label { min-height: 16px; margin-bottom: 2px; line-height: 16px; }
.video-filter-field select { width: 100%; min-width: 0; }
.search-filter-field input { min-width: 0 !important; }
.compact-field select { width: 100%; min-width: 0; }
.filter-count { display: block; margin-top: 1px; color: var(--muted); font-size: 10px; line-height: 1.1; }
.toolbar-actions { display: flex; align-items: center; align-self: start; gap: 5px; margin-top: 18px; padding-bottom: 0; }
.file-workbench, .file-workbench-wide { display: block; }
.workbench-main { width: 100%; }
.file-state-panel { padding: 7px 9px; }
.file-state-form { gap: 5px 9px; }
.review-note-field { min-width: 180px; }
.workbench-upper-grid { grid-template-columns: minmax(0, 1.55fr) minmax(260px, .6fr); gap: 8px; }
.category-transfer-card, .priority-panel { margin-bottom: 8px; }
.dual-list-grid { gap: 6px; }
.transfer-list { min-height: 105px; max-height: 160px; }
.transfer-list.tall, .tall-list { min-height: 170px; max-height: 280px; }
.transfer-item { min-height: 23px; padding: 2px 5px; font-size: 12px; }
.transfer-empty { padding: 7px; color: var(--muted); font-size: 11px; }
.priority-tools { gap: 5px; }
.priority-tools select { min-width: 185px; }
.marker-legend { gap: 6px; margin-top: 5px; font-size: 10px; }
.source-clip-note { padding: 3px 6px; margin-top: 4px; }
.clip-editor-panel .panel-title-row { padding: 6px 8px; }
.clip-grid-header, .clip-grid-row {
    min-width: 875px;
    grid-template-columns: 50px 48px 48px 48px 48px minmax(280px, 1fr) 222px 48px;
    column-gap: 3px;
    padding: 2px 5px;
}
.clip-grid-header { min-height: 25px; }
.clip-grid-row { min-height: 33px; }
.clip-grid-row input[type="number"], .clip-grid-row .clip-description { min-height: 25px; padding: 2px 4px; }
.clip-row-actions { gap: 2px; }
.icon-button, .marker-button { width: 22px; height: 22px; min-width: 22px; border-radius: 4px; }
.exclude-check { margin-left: 1px; font-size: 9.5px; }
.clip-category-transfer { grid-template-columns: minmax(0, 1fr) 26px minmax(0, 1fr); }
.clip-category-transfer .transfer-arrow-column { gap: 3px; }
.clip-category-panel.is-loading { opacity: .6; pointer-events: none; }
.clip-category-status { min-height: 0; color: var(--danger); font-size: 11px; }
.shortened-table th, .shortened-table td { padding: 4px 6px; }
.collection-create-bar { gap: 5px; margin-bottom: 8px; }
.collection-workspace, .collection-transfer-grid { gap: 7px; }
.collection-selector-row { gap: 5px; margin-bottom: 7px; }
.collection-metadata-form { gap: 5px; margin-bottom: 7px; }
.file-transfer-item { padding: 4px 6px; }
.jobs-workbench { gap: 8px; }
.job-clip.compact-row { padding: 5px; }
.branding-upload-grid { gap: 8px; }
.color-grid { gap: 5px; }
.color-grid label { gap: 5px; padding: 4px 6px; }
.branding-preview-header { padding: 6px 8px; }
.branding-preview-body { padding: 9px; }
.settings-feature-card { gap: .7rem; padding: .65rem .75rem; margin-bottom: .75rem; }
.sticky-actions { padding: .5rem; margin-top: .6rem; }
.maintenance-block { margin-top: .8rem; padding-top: .7rem; }

@media (max-width: 1180px) {
    .workbench-filter { grid-template-columns: minmax(150px, .65fr) minmax(280px, 1.5fr) minmax(150px, .65fr) minmax(170px, .7fr); }
    .toolbar-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 760px) {
    .page-shell { width: calc(100% - 10px); margin-top: 6px; }
    .workbench-filter { display: grid; grid-template-columns: 1fr; }
    .toolbar-actions { grid-column: auto; }
    .workbench-upper-grid { grid-template-columns: 1fr; }
}

/* Inline clip creation */
.clip-grid-row.new-clip-row {
    background: color-mix(in srgb, var(--primary-soft) 65%, var(--surface));
    border-bottom: 2px solid var(--line-strong);
}
.clip-grid-row.new-clip-row:hover { background: color-mix(in srgb, var(--primary-soft) 75%, var(--surface)); }
.new-clip-label { text-align: center; font-weight: 800; color: var(--primary); }
.new-clip-actions { justify-content: flex-start; }
.new-clip-actions .button { white-space: nowrap; min-height: 25px; padding: 3px 8px; }
.clip-grid-status { margin-left: auto; font-size: 11px; font-weight: 700; }
.clip-grid-status.success { color: var(--success); }
.clip-grid-status.error { color: var(--danger); }
#clip-grid-container.is-loading { opacity: .62; pointer-events: none; }

/* Video upload dialog */
.upload-dialog {
    width: min(560px, calc(100vw - 24px));
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 18px 60px rgba(18, 35, 52, .28);
}
.upload-dialog::backdrop { background: rgba(12, 24, 36, .45); }
.upload-dialog form { display: grid; gap: 8px; padding: 12px; }
.upload-dialog input[type="file"] { width: 100%; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.dialog-heading h2 { margin: 0; }
.dialog-heading p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.dialog-close {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 23px;
    line-height: 1;
    cursor: pointer;
}
.dialog-actions { justify-content: flex-end; margin-top: 2px; }
.upload-limit { font-size: 11px; }
.upload-progress-wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.upload-progress-wrap progress { width: 100%; height: 12px; accent-color: var(--primary); }
.upload-progress-wrap span { min-width: 92px; text-align: right; font-size: 11px; color: var(--muted); }
.upload-status { min-height: 17px; font-size: 12px; font-weight: 700; }
.upload-status.success { color: var(--success); }
.upload-status.error { color: var(--danger); }

/* Concise processing results */
.task-result-summary { font-weight: 600; }
.task-log { margin-top: 3px; font-size: 10px; color: var(--muted); overflow-wrap: anywhere; }
.task-log summary { cursor: pointer; color: var(--primary); }
.task-log code { display: block; margin-top: 2px; white-space: normal; }


/* Processing log modal viewer */
.task-log-trigger {
    display: inline-block;
    margin-top: 3px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--primary);
    font: inherit;
    font-size: 10.5px;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
.task-log-trigger:hover { color: var(--primary-strong); }
.task-log-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.processing-log-dialog {
    width: min(1100px, calc(100vw - 24px));
    max-width: none;
    max-height: calc(100vh - 24px);
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 18px 60px rgba(18, 35, 52, .32);
}
.processing-log-dialog::backdrop { background: rgba(12, 24, 36, .48); }
.processing-log-shell { display: grid; grid-template-rows: auto auto minmax(220px, 1fr) auto; gap: 7px; padding: 11px; }
.processing-log-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.processing-log-heading h2 { margin: 0; font-size: 19px; }
.processing-log-heading p { margin: 2px 0 0; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.processing-log-status { min-height: 17px; font-size: 11.5px; font-weight: 700; }
.processing-log-status.loading { color: var(--muted); }
.processing-log-status.success { color: var(--success); }
.processing-log-status.warning { color: var(--warning); }
.processing-log-status.error { color: var(--danger); }
.processing-log-content {
    box-sizing: border-box;
    width: 100%;
    min-height: 280px;
    max-height: min(68vh, 720px);
    margin: 0;
    padding: 9px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--surface-alt);
    color: var(--text);
    font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
    font-size: 11px;
    line-height: 1.35;
    white-space: pre;
    tab-size: 4;
}
.processing-log-shell .dialog-actions { margin-top: 0; }
@media (max-width: 760px) {
    .processing-log-dialog { width: calc(100vw - 10px); max-height: calc(100vh - 10px); }
    .processing-log-shell { padding: 8px; }
    .processing-log-content { min-height: 220px; max-height: 65vh; }
}

/* Access-compatible filename proposal and rename panel */
.rename-proposal { margin-bottom: .65rem; }
.rename-proposal .inline-form { align-items: center; }
.rename-proposal .inline-form input { flex: 1 1 28rem; }
.field-help { margin-top: .22rem; color: var(--muted, #667789); font-size: .78rem; line-height: 1.25; }
.notice.info { margin: .55rem 0; border-left: 3px solid var(--primary, #246b9e); background: var(--primary-soft, #e8f2f9); padding: .45rem .6rem; }

/* Left sidebar application shell - revision 4 */
body.sidebar-layout {
    background: var(--page);
    overflow-x: hidden;
}
.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
}
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--topbar-bg);
    color: var(--topbar-text);
    border-right: 1px solid var(--line);
    box-shadow: 5px 0 22px rgba(25, 49, 70, .045);
    z-index: 80;
}
.sidebar-header {
    min-height: 68px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 14px;
    border-bottom: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
}
.sidebar-brand {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--topbar-text);
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -.2px;
}
.sidebar-brand:hover { color: var(--topbar-text); text-decoration: none; }
.sidebar-logo {
    width: auto;
    max-width: 48px;
    max-height: min(42px, var(--brand-logo-max-height));
    object-fit: contain;
}
.sidebar-brand-mark {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(145deg, var(--primary), var(--primary-dark));
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 24%, transparent);
    font-size: 13px;
}
.sidebar-brand-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-close {
    display: none;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 24px;
    cursor: pointer;
}
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 9px;
    scrollbar-width: thin;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    margin: 2px 0;
    padding: 7px 10px;
    border-radius: 8px;
    color: color-mix(in srgb, var(--topbar-text) 88%, var(--muted));
    font-size: 12.5px;
    font-weight: 650;
    transition: background .14s ease, color .14s ease, transform .14s ease;
}
.sidebar-link:hover {
    color: var(--primary-dark);
    background: color-mix(in srgb, var(--primary-soft) 76%, var(--surface));
    text-decoration: none;
    transform: translateX(1px);
}
.sidebar-link.active {
    color: var(--primary-dark);
    background: var(--primary-soft);
    box-shadow: inset 3px 0 0 var(--primary);
}
.sidebar-icon {
    width: 21px;
    height: 21px;
    flex: 0 0 21px;
    display: grid;
    place-items: center;
    color: currentColor;
    font-size: 16px;
    line-height: 1;
}
.sidebar-divider {
    height: 1px;
    margin: 9px 8px;
    background: var(--line);
}
.sidebar-footer {
    padding: 10px;
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-alt) 74%, var(--surface));
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin-bottom: 7px;
}
.sidebar-user-avatar {
    width: 31px;
    height: 31px;
    flex: 0 0 31px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(145deg, var(--primary), var(--primary-dark));
    font-size: 12px;
    font-weight: 800;
}
.sidebar-user-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.16;
}
.sidebar-user-copy strong,
.sidebar-user-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-user-copy strong { font-size: 11.5px; }
.sidebar-user-copy small { color: var(--muted); font-size: 10px; }
.sidebar-footer form { margin: 0; }
.sidebar-signout {
    width: 100%;
    min-height: 30px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border: 0;
    border-radius: 6px;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-size: 11.5px;
    font-weight: 650;
}
.sidebar-signout:hover { color: var(--danger); background: var(--danger-soft); }
.app-content {
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--page-top) 0, var(--page) 230px);
}
.app-content .page-shell {
    width: min(1760px, calc(100% - 28px));
    flex: 1;
    margin: 12px auto 28px;
}
.app-content .footer {
    margin-top: auto;
    padding: 10px 18px;
    text-align: left;
    font-size: 11px;
    background: transparent;
}
.mobile-appbar { display: none; }
.sidebar-overlay { display: none; }

/* Dashboard polish for sidebar layout */
.sidebar-layout .stat-grid {
    grid-template-columns: repeat(6, minmax(125px, 1fr));
    gap: 9px;
}
.sidebar-layout .stat-card {
    position: relative;
    min-height: 92px;
    justify-content: center;
    padding: 12px 14px 11px 58px;
    overflow: hidden;
}
.sidebar-layout .stat-card::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 50%;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    transform: translateY(-50%);
    background: linear-gradient(145deg, var(--primary-soft), color-mix(in srgb, var(--primary) 22%, #fff));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 18%, transparent);
}
.sidebar-layout .stat-card::after {
    content: '●';
    position: absolute;
    left: 25px;
    top: 50%;
    transform: translateY(-52%);
    color: var(--primary);
    font-size: 14px;
}
.sidebar-layout .stat-card strong { font-size: 24px; line-height: 1; }
.sidebar-layout .stat-card span { margin-top: 5px; font-size: 11px; }
.sidebar-layout .panel { border-color: color-mix(in srgb, var(--line) 90%, transparent); }
.sidebar-layout .action-card { min-height: 74px; justify-content: center; }
.sidebar-layout .page-heading { align-items: center; }

/* Keep dense work areas usable with the narrower content viewport */
.sidebar-layout .workbench-filter {
    grid-template-columns: minmax(130px, 170px) minmax(280px, 1.7fr) minmax(135px, .7fr) minmax(155px, .75fr) auto;
}
.sidebar-layout .clip-grid-header,
.sidebar-layout .clip-grid-row {
    min-width: 850px;
}

/* Unauthenticated shell */
.public-layout { min-height: 100vh; }
.public-header {
    min-height: 58px;
    display: flex;
    align-items: center;
    padding: 8px 18px;
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--line);
}
.public-content { min-height: calc(100vh - 58px); padding: 1px; }

@media (max-width: 1320px) {
    .app-shell { grid-template-columns: 210px minmax(0, 1fr); }
    .sidebar-layout .stat-grid { grid-template-columns: repeat(3, 1fr); }
    .sidebar-layout .workbench-filter {
        grid-template-columns: minmax(130px, .65fr) minmax(250px, 1.5fr) minmax(135px, .65fr) minmax(150px, .72fr);
    }
    .sidebar-layout .toolbar-actions { grid-column: 1 / -1; margin-top: 0; }
}

@media (max-width: 900px) {
    .app-shell { display: block; }
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: min(284px, 86vw);
        transform: translateX(-102%);
        transition: transform .2s ease;
        box-shadow: 14px 0 40px rgba(12, 28, 44, .22);
    }
    body.sidebar-open { overflow: hidden; }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-close { display: block; }
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        display: block;
        z-index: 70;
        background: rgba(12, 24, 36, .44);
    }
    .sidebar-overlay[hidden] { display: none; }
    .mobile-appbar {
        position: sticky;
        top: 0;
        z-index: 50;
        min-height: 48px;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 6px 10px;
        background: var(--topbar-bg);
        border-bottom: 1px solid var(--line);
        box-shadow: 0 2px 10px rgba(24, 48, 68, .07);
    }
    .sidebar-toggle {
        width: 34px;
        height: 34px;
        padding: 0;
        border: 1px solid var(--line);
        border-radius: 7px;
        background: var(--surface);
        color: var(--text);
        cursor: pointer;
        font-size: 18px;
    }
    .mobile-appbar-title { font-weight: 800; }
    .app-content .page-shell { width: calc(100% - 14px); margin-top: 7px; }
}

@media (max-width: 620px) {
    .sidebar-layout .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .sidebar-layout .stat-card { min-height: 82px; padding-left: 50px; }
    .sidebar-layout .stat-card::before { left: 10px; width: 30px; height: 30px; }
    .sidebar-layout .stat-card::after { left: 20px; }
    .sidebar-layout .workbench-filter { grid-template-columns: 1fr; }
    .sidebar-layout .toolbar-actions { grid-column: auto; }
    .sidebar-layout .page-heading { align-items: stretch; }
}

/* Theme-specific form control colors. Kept separate from general page text. */
input, select, textarea { color: var(--input-text); background-color: var(--input-bg); }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--input-text) 55%, transparent); }
