/*
 * F4S – shared stylesheet for the client area and the admin panel.
 *
 * Built from the Claude Design exports in /design (f4s Account / f4s Admin):
 *   - fonts: Public Sans (UI) + JetBrains Mono (numbers, ids)
 *   - radius .375rem, soft card shadow, blue accent #3f6ad8
 *   - light and dark palettes switched by <html data-theme="dark">
 * No build step: plain CSS with custom properties. See docs/design-guidelines.md.
 */

/* ------------------------------------------------------------------ tokens */
:root {
    --bg: #edf2f9;
    --card: #ffffff;
    --line: #e3ebf6;
    --line2: #edf2f9;
    --ink: #1b2333;
    --dim: #5f6a7d;
    --faint: #6d7688;
    --soft: #f9fafd;
    --accent: #3f6ad8;
    --accent-hover: #2d51ad;
    --accent-text: #3f6ad8;
    --accent-soft: #eef2fc;
    --ph1: #e7eaf1;
    --ph2: #f2f4f8;
    --ok-bg: #e6f5ec;
    --ok-fg: #2f8f5b;
    --warn-bg: #fdf3e0;
    --warn-fg: #a8761c;
    --danger-bg: #fdecea;
    --danger-fg: #c9453a;
    --neutral-bg: #eef0f5;
    --neutral-fg: #5f6a7d;
    --info-bg: #eef2fc;
    --info-fg: #3f6ad8;
    --chrome: #edf2f9;
    --chrome-ink: #1b2333;
    --chrome-dim: #5f6a7d;
    --chrome-line: #d8e2ef;
    --chrome-fill: rgba(255, 255, 255, .75);
    --chrome-active: #ffffff;
    --shadow: 0 2px 5px rgba(19, 24, 38, .08);
    --shadow-btn: 0 1px 3px rgba(19, 24, 38, .12);
    --drop: #c7d0e4;
    --scroll: #c2cfe0;
    --radius: .375rem;
    --sidebar-w: 250px;
    --sidebar-w-collapsed: 74px;
    --font: 'Public Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #0b1727;
    --card: #121e2d;
    --line: #1f2f42;
    --line2: #1b2a3c;
    --ink: #e8ebf2;
    --dim: #98a1b3;
    --faint: #8b96a8;
    --soft: #162231;
    --accent-text: #9ab2ec;
    --accent-soft: #22304f;
    --ph1: #1c2b3d;
    --ph2: #16232f;
    --ok-bg: #1b3a29;
    --ok-fg: #5ec489;
    --warn-bg: #3d3320;
    --warn-fg: #e0b054;
    --danger-bg: #3b2320;
    --danger-fg: #ee7b6f;
    --neutral-bg: #1f2f42;
    --neutral-fg: #9aa3b4;
    --info-bg: #22304f;
    --info-fg: #9ab2ec;
    --chrome: #0b1727;
    --chrome-ink: #e8ebf2;
    --chrome-dim: #8e97a8;
    --chrome-line: #1f2f42;
    --chrome-fill: rgba(255, 255, 255, .05);
    --chrome-active: rgba(255, 255, 255, .07);
    --shadow: 0 4px 14px rgba(0, 0, 0, .42);
    --drop: #394154;
    --scroll: #2a3a50;
    color-scheme: dark;
}

/* -------------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 14px/1.5 var(--font);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { color: var(--accent-hover); }
:root[data-theme="dark"] a:hover { color: #c3d2f5; }
img, video, svg { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
p { margin: 0 0 .75em; }
code, .mono { font-family: var(--mono); }
hr { border: 0; border-top: 1px solid var(--line2); margin: 16px 0; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 9px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--dim); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-end { margin-left: auto; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); align-items: start; }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.span-2 { grid-column: span 2; min-width: 0; }
@media (max-width: 760px) { .span-2 { grid-column: auto; } }

/* ------------------------------------------------------------- app shell */
.app { display: flex; min-height: 100vh; align-items: stretch; }
.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--chrome);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: auto;
    transition: width .18s ease, flex-basis .18s ease;
    z-index: 20;
}
.sidebar-brand { height: 62px; flex: 0 0 62px; display: flex; align-items: center; gap: 10px; padding: 0 16px; position: relative; }
.brand-mark {
    width: 32px; height: 32px; flex: 0 0 32px; border-radius: 6px;
    background: var(--accent); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
}
.brand-text { flex: 1; line-height: 1.15; min-width: 0; }
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: -.02em; color: var(--chrome-ink); }
.brand-name small, .brand-sub { display: block; font-size: 10px; font-weight: 400; letter-spacing: .1em; color: var(--chrome-dim); }
.collapse-btn {
    width: 26px; height: 26px; flex: 0 0 26px; border: 0; border-radius: var(--radius);
    background: var(--chrome-fill); color: var(--chrome-dim); cursor: pointer; font-size: 12px;
}
.nav-section { padding: 14px 20px 6px; font-size: 10px; font-weight: 700; letter-spacing: .12em; color: var(--chrome-dim); opacity: .75; }
.nav-item {
    position: relative; display: flex; align-items: center; gap: 12px;
    margin: 1px 10px; padding: 10px 12px; border-radius: var(--radius);
    font-size: 13px; color: var(--chrome-dim); cursor: pointer;
    background: transparent; border: 0; width: calc(100% - 20px); text-align: left; font-family: inherit;
}
.nav-item:hover { color: var(--chrome-ink); background: var(--chrome-fill); }
.nav-item.is-active { font-weight: 600; background: var(--chrome-active); color: var(--accent-text); }
.nav-item.is-active::before {
    content: ''; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px;
    border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav-item svg { flex: 0 0 17px; }
.nav-label { flex: 1; white-space: nowrap; overflow: hidden; }
.nav-badge { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 20px; background: var(--accent); color: #fff; }
.nav-badge.is-danger { background: #c9453a; }
.sidebar-foot { margin-top: auto; padding: 14px; }
.sidebar-card { background: var(--chrome-fill); border-radius: var(--radius); padding: 13px; }
.sidebar-card-title { font-size: 12px; font-weight: 600; color: var(--chrome-ink); margin-bottom: 3px; }
.sidebar-card-sub { font-size: 11px; color: var(--chrome-dim); margin-bottom: 9px; }

/* collapsed sidebar (desktop) */
.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); flex-basis: var(--sidebar-w-collapsed); }
.sidebar-collapsed .brand-text,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .nav-badge,
.sidebar-collapsed .sidebar-foot { display: none; }
.sidebar-collapsed .nav-item { justify-content: center; padding: 10px 0; }
.sidebar-collapsed .nav-section { font-size: 0; height: 14px; padding: 14px 0 6px; }
.sidebar-collapsed .collapse-btn { position: absolute; left: 50%; transform: translateX(-50%); top: 46px; width: 30px; height: 22px; z-index: 3; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    min-height: 62px; background: var(--chrome);
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 12px 24px; position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-size: 15px; font-weight: 600; letter-spacing: -.01em; color: var(--chrome-ink); }
.topbar-sub { font-size: 12px; color: var(--chrome-dim); margin-top: 1px; }
.topbar-tools { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.chip-btn {
    display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px;
    background: var(--chrome-fill); border: 0; border-radius: 6px; cursor: pointer;
    font: 500 12px var(--font); color: var(--chrome-dim);
}
.chip-btn:hover { color: var(--chrome-ink); }
.theme-glyph { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--chrome-dim); }
:root[data-theme="dark"] .theme-glyph { background: var(--accent); }
.search-box {
    display: flex; align-items: center; gap: 8px; width: 230px; max-width: 100%;
    background: var(--chrome-fill); border-radius: 6px; padding: 0 12px; height: 34px;
}
.search-box input { border: 0; background: transparent; color: var(--chrome-ink); font: 12.5px var(--font); width: 100%; outline: none; }
.search-glyph { width: 11px; height: 11px; flex: 0 0 11px; border: 1.5px solid var(--chrome-dim); border-radius: 50%; }
.user-chip { display: flex; align-items: center; gap: 9px; padding-left: 12px; }
.user-chip-name { font-size: 12.5px; font-weight: 600; color: var(--chrome-ink); line-height: 1.3; }
.user-chip-role { font-size: 10.5px; color: var(--chrome-dim); }
.avatar {
    width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%;
    background: var(--accent); color: #fff; object-fit: cover;
    display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.avatar-soft { background: var(--accent-soft); color: var(--accent-text); font-size: 11px; }
.avatar-lg { width: 56px; height: 56px; flex-basis: 56px; font-size: 18px; }
.main { padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.menu-toggle { display: none; }

@media (max-width: 900px) {
    .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }
    .nav-open .sidebar { transform: translateX(0); }
    .nav-open .sidebar-backdrop { display: block; }
    .sidebar-collapsed .sidebar { width: var(--sidebar-w); }
    .collapse-btn { display: none; }
    .menu-toggle { display: inline-flex; }
    .topbar { padding: 10px 14px; }
    .main { padding: 16px 12px; }
    .search-box { display: none; }
    .user-chip-text { display: none; }
}
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(8, 12, 20, .45); z-index: 15; }

/* ------------------------------------------------------------ public shell */
.site-header {
    position: sticky; top: 0; z-index: 10; background: var(--chrome);
    border-bottom: 1px solid var(--chrome-line);
}
.site-header-inner { max-width: 1280px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 14px; }
.site-brand { display: flex; align-items: center; gap: 10px; color: var(--chrome-ink); }
.site-brand:hover { color: var(--chrome-ink); }
.site-nav { display: flex; gap: 4px; margin-left: 12px; }
.site-nav a { padding: 8px 12px; border-radius: var(--radius); color: var(--chrome-dim); font-size: 13px; font-weight: 500; }
.site-nav a:hover, .site-nav a.is-active { background: var(--chrome-active); color: var(--accent-text); }
.site-main { max-width: 1280px; margin: 0 auto; padding: 24px 20px 48px; }
.site-footer { border-top: 1px solid var(--chrome-line); color: var(--faint); font-size: 12px; }
.site-footer-inner { max-width: 1280px; margin: 0 auto; padding: 18px 20px; display: flex; gap: 12px; flex-wrap: wrap; }
@media (max-width: 640px) { .site-nav { display: none; } .site-main { padding: 16px 12px 32px; } }

/* -------------------------------------------------------------------- card */
.card {
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
    min-width: 0;
}
.card-body { padding: 20px; }
.card-head {
    background: var(--soft); padding: 15px 18px; border-bottom: 1px solid var(--line2);
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    border-radius: var(--radius) var(--radius) 0 0;
}
.card-title { font-size: 14.5px; font-weight: 600; }
.card-sub { font-size: 12px; color: var(--dim); margin-top: 2px; }
.card-foot { padding: 13px 18px; border-top: 1px solid var(--line2); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.section-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--faint); text-transform: uppercase; }

/* stat tile */
.stat { padding: 17px 18px 15px; }
.stat-value { font: 700 26px/1.2 var(--mono); letter-spacing: -.03em; margin-top: 8px; }
.stat-hint { font-size: 11.5px; color: var(--dim); margin-top: 4px; }
.delta-up { color: var(--ok-fg); font-size: 11.5px; font-weight: 600; }
.delta-down { color: var(--danger-fg); font-size: 11.5px; font-weight: 600; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 26px; margin-top: 12px; }
.spark span { flex: 1; border-radius: 2px; background: var(--accent); min-height: 2px; }

/* key/value list */
.kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 8px 18px; font-size: 13px; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* list rows (uploads, devices, settings rows) */
.list-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line2); flex-wrap: wrap; }
.list-row:last-child { border-bottom: 0; }
.list-row-main { flex: 1; min-width: 180px; }
.list-row-title { font-size: 13.5px; font-weight: 600; }
.list-row-meta { font-size: 11.5px; color: var(--faint); margin-top: 2px; }

/* ------------------------------------------------------------------- table */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th {
    background: var(--soft); text-align: left; padding: 11px 14px;
    font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint);
    white-space: nowrap;
}
.table td { padding: 12px 14px; border-top: 1px solid var(--line2); vertical-align: middle; }
.table tr:hover td { background: color-mix(in srgb, var(--soft) 60%, transparent); }
.table .num { font-family: var(--mono); white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.cell-media { display: flex; align-items: center; gap: 11px; min-width: 0; }
.cell-title { font-size: 13px; font-weight: 500; }
.cell-sub { font-size: 11px; color: var(--faint); }

/* thumbnails & placeholders */
.thumb {
    width: 74px; height: 44px; flex: 0 0 74px; border-radius: 4px; overflow: hidden; object-fit: cover;
    background: repeating-linear-gradient(135deg, var(--ph1) 0 5px, var(--ph2) 5px 10px);
    display: block;
}
.thumb-sm { width: 52px; height: 30px; flex-basis: 52px; }

/* --------------------------------------------------------------------- tag */
.tag {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; white-space: nowrap;
    background: var(--neutral-bg); color: var(--neutral-fg);
}
.tag-ok { background: var(--ok-bg); color: var(--ok-fg); }
.tag-warn { background: var(--warn-bg); color: var(--warn-fg); }
.tag-danger { background: var(--danger-bg); color: var(--danger-fg); }
.tag-accent { background: var(--accent-soft); color: var(--accent-text); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; }
.dot-pulse { animation: pulseDot 1.6s infinite; }
@keyframes pulseDot { 0%, 100% { opacity: 1; } 50% { opacity: .2; } }

/* ------------------------------------------------------------------ button */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    font: 600 12.5px/1 var(--font); padding: 10px 16px; border-radius: var(--radius);
    border: 1px solid var(--line); background: var(--card); color: var(--ink);
    cursor: pointer; text-decoration: none; white-space: nowrap;
    box-shadow: 0 1px 3px rgba(19, 24, 38, .06);
    transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent-text); }
.btn:disabled, .btn.is-disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: var(--shadow-btn); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-secondary { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.btn-danger { background: var(--danger-bg); border-color: transparent; color: var(--danger-fg); box-shadow: none; }
.btn-danger:hover { background: var(--danger-fg); color: #fff; border-color: var(--danger-fg); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--dim); }
.btn-sm { padding: 7px 11px; font-size: 12px; }
.btn-xs { padding: 4px 8px; font-size: 11px; font-weight: 500; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; padding: 0; color: var(--accent-text); font: 500 12px var(--font); cursor: pointer; }
.btn-link.is-danger { color: var(--danger-fg); }
.btn .spinner { width: 12px; height: 12px; }
form.inline { display: inline; }

/* filter chips */
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter {
    font-size: 12.5px; font-weight: 500; padding: 8px 13px; border-radius: var(--radius);
    border: 1px solid var(--line); background: var(--card); color: var(--dim);
    box-shadow: 0 1px 3px rgba(19, 24, 38, .06);
}
.filter:hover { color: var(--accent-text); }
.filter.is-active { font-weight: 600; border-color: var(--accent); background: var(--accent); color: #fff; }

/* -------------------------------------------------------------------- form */
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-full { grid-column: 1 / -1; }
.field-label { font-size: 11.5px; font-weight: 600; color: var(--dim); display: flex; justify-content: space-between; gap: 8px; }
.field-link { font-weight: 500; }
.field-hint { font-size: 11px; color: var(--faint); }
.field-error { font-size: 11.5px; color: var(--danger-fg); font-weight: 500; }
.input, .select, .textarea {
    width: 100%; border: 1px solid var(--line); background: var(--soft); color: var(--ink);
    border-radius: var(--radius); padding: 10px 12px; font: 13px var(--font);
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--card); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--danger-fg); }
.input[readonly] { color: var(--dim); }
.input-mono { font-family: var(--mono); font-size: 12px; }
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(135deg, var(--dim) 50%, transparent 50%); background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--accent); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0; }
legend { font-size: 12px; font-weight: 600; color: var(--dim); padding: 0 6px; }

/* toggle switch: <label class="switch"><input type="checkbox"><span></span></label> */
.switch { position: relative; display: inline-block; width: 38px; height: 21px; flex: 0 0 38px; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 20px; background: var(--line); transition: background .15s; }
.switch span::after {
    content: ''; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px;
    border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s;
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(17px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.setting-row { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line2); }
.setting-row:last-child { border-bottom: 0; }
.setting-row-text { flex: 1; min-width: 0; }
.setting-row-label { font-size: 12.5px; font-weight: 500; }
.setting-row-hint { font-size: 11.5px; color: var(--faint); margin-top: 1px; }

/* ------------------------------------------------------------------- alert */
.alert { padding: 11px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 12px; border: 1px solid transparent; }
.alert:last-child { margin-bottom: 0; }
.alert-ok { background: var(--ok-bg); color: var(--ok-fg); }
.alert-warn { background: var(--warn-bg); color: var(--warn-fg); }
.alert-danger { background: var(--danger-bg); color: var(--danger-fg); }
.alert-info { background: var(--info-bg); color: var(--info-fg); }
.flash-stack:empty { display: none; }

/* ---------------------------------------------------------------- progress */
.progress { height: 5px; background: var(--line); border-radius: 5px; overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 5px; transition: width .25s ease; }
.progress-ok > span { background: var(--ok-fg); }
.progress-danger > span { background: var(--danger-fg); }
.progress-indeterminate > span { width: 35%; animation: indeterminate 1.2s infinite ease-in-out; }
@keyframes indeterminate { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* -------------------------------------------------------------- pagination */
.pagination { display: flex; gap: 5px; margin-left: auto; flex-wrap: wrap; }
.page-link {
    min-width: 28px; text-align: center; font-size: 12px; font-weight: 500;
    padding: 5px 8px; border-radius: var(--radius); border: 1px solid var(--line); color: var(--dim);
}
.page-link.is-active { font-weight: 600; background: var(--accent); border-color: var(--accent); color: #fff; }
.page-link.is-disabled { opacity: .45; pointer-events: none; }

/* ------------------------------------------------------------- empty state */
.empty { padding: 42px 20px; text-align: center; color: var(--dim); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-icon { width: 46px; height: 46px; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent-text); display: flex; align-items: center; justify-content: center; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--ink); }

/* ---------------------------------------------------------------- drop zone */
.dropzone {
    background: var(--card); border: 1.5px dashed var(--drop); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 38px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer; text-align: center;
    transition: border-color .15s, background .15s;
}
.dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-title { font-size: 15px; font-weight: 600; }
.dropzone-hint { font-size: 12.5px; color: var(--dim); max-width: 460px; }

/* ------------------------------------------------------------ modal/toast */
.modal { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(8, 12, 20, .5); }
.modal.is-open { display: flex; }
.modal-dialog { width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line2); }
.modal-title { font-size: 15px; font-weight: 600; }
.modal-close { margin-left: auto; background: none; border: 0; font-size: 20px; line-height: 1; color: var(--dim); cursor: pointer; }
.modal-body { padding: 18px; }
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--line2); display: flex; justify-content: flex-end; gap: 8px; }
.toast-stack { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.toast { min-width: 240px; max-width: 380px; padding: 11px 14px; border-radius: var(--radius); box-shadow: var(--shadow); font-size: 13px; background: var(--card); border: 1px solid var(--line); animation: toastIn .18s ease; }
.toast-ok { border-left: 3px solid var(--ok-fg); }
.toast-danger { border-left: 3px solid var(--danger-fg); }
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* code / log output */
.log {
    background: #0f1623; color: #cfd8e6; font: 12px/1.55 var(--mono);
    border-radius: var(--radius); padding: 14px; max-height: 520px; overflow: auto; white-space: pre-wrap; word-break: break-word;
}
.log-line-ok { color: #5ec489; }
.log-line-failed { color: #ee7b6f; }
.log-line-running { color: #e0b054; }
.copy-field { display: flex; gap: 8px; }
.copy-field .input { font-family: var(--mono); font-size: 12px; }

/* ------------------------------------------------------------- video grid */
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.video-card { display: block; color: var(--ink); min-width: 0; }
.video-card:hover { color: var(--ink); }
.video-card:hover .video-card-title { color: var(--accent-text); }
.video-thumb {
    position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden;
    background: repeating-linear-gradient(135deg, var(--ph1) 0 6px, var(--ph2) 6px 12px);
}
.video-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-duration {
    position: absolute; right: 8px; bottom: 8px; font: 10px var(--mono);
    background: rgba(15, 18, 26, .72); color: #fff; padding: 2px 6px; border-radius: 3px;
}
.video-card-title { font-size: 13.5px; font-weight: 600; margin-top: 9px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.video-card-meta { font-size: 11.5px; color: var(--faint); margin-top: 3px; }
.section-head { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; }
.section-title { font-size: 17px; font-weight: 700; }

/* ------------------------------------------------------------------ player */
.player-wrap { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; }
.player-wrap video { width: 100%; height: 100%; display: block; background: #000; }
.player-state {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    color: #cfd6e4; text-align: center; padding: 20px; background: radial-gradient(circle at center, #1a2436, #070b12);
}
.player-state[hidden] { display: none; }
.player-state-title { font-size: 16px; font-weight: 600; color: #fff; }
.watch-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
@media (max-width: 1080px) { .watch-layout { grid-template-columns: 1fr; } }
.watch-title { font-size: 20px; font-weight: 700; margin-top: 14px; }
.watch-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; color: var(--dim); font-size: 13px; }
.watch-desc { margin-top: 14px; white-space: pre-line; font-size: 13.5px; line-height: 1.6; }
.related-item { display: flex; gap: 10px; color: var(--ink); padding: 6px 0; }
.related-item .thumb { width: 150px; height: 84px; flex-basis: 150px; }

/* embed page: full-bleed player, no chrome */
.embed-body { background: #000; margin: 0; overflow: hidden; }
.embed-body .player-wrap { border-radius: 0; height: 100vh; aspect-ratio: auto; }

/* --------------------------------------------------------------------- auth */
.auth-body { min-height: 100vh; }
.auth-shell { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; gap: 18px; }
.auth-brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.auth-brand:hover { color: var(--ink); }
.auth-card { width: 100%; max-width: 420px; padding: 28px; }
.auth-title { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.auth-sub { color: var(--dim); font-size: 13px; margin-bottom: 18px; }
.auth-alt { text-align: center; margin: 18px 0 0; font-size: 13px; color: var(--dim); }
.auth-foot { font-size: 12px; color: var(--faint); margin: 0; }
.auth-icon { width: 46px; height: 46px; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent-text); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }

/* -------------------------------------------------------------- error page */
.error-page { text-align: center; padding: 64px 16px; }
.error-code { font: 700 56px/1 var(--mono); color: var(--accent-text); letter-spacing: -.04em; }
.error-title { font-size: 20px; font-weight: 700; margin-top: 12px; }
.error-message { color: var(--dim); margin: 8px auto 22px; max-width: 460px; }
.player-start {
    width: 68px; height: 68px; border-radius: 50%; border: 0; cursor: pointer;
    background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .35); transition: transform .15s;
}
.player-start:hover { transform: scale(1.06); }
.player-start svg { margin-left: 4px; fill: currentColor; }
