@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 100 900; src: url(/fonts/inter-cyrillic-ext.woff2) format('woff2'); unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 100 900; src: url(/fonts/inter-cyrillic.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 100 900; src: url(/fonts/inter-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 100 900; src: url(/fonts/inter-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ============ tokens: warm beige ============ */
:root {
  --bg: #ebe3d5;
  --surface: #f6f1e8;
  --surface-2: #efe8dc;
  --surface-3: #e5dccd;
  --line: #ddd2c1;
  --line-2: #cbbea9;
  --text: #29221c;
  --text-2: #5a4f45;
  --muted: #8a7d6f;
  --accent: #6c47d4;
  --accent-hover: #5b37c2;
  --accent-soft: rgba(108, 71, 212, .11);
  --accent-ink: #fff;
  --green: #2c8655;
  --green-soft: rgba(44, 134, 85, .12);
  --red: #bf3b30;
  --red-soft: rgba(191, 59, 48, .1);
  --amber: #a86a12;
  --amber-soft: rgba(196, 136, 30, .14);
  --side: #2a231d;
  --side-2: #362d26;
  --side-text: #ece3d5;
  --side-muted: #a5978a;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --shadow: 0 1px 2px rgba(70, 48, 25, .06), 0 2px 10px rgba(70, 48, 25, .05);
  --shadow-lg: 0 12px 40px rgba(50, 34, 18, .18);
  --side-w: 240px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: 'cv11', 'ss01'; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 4px; letter-spacing: -.02em; font-weight: 750; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 700; display: flex; align-items: center; gap: 8px; letter-spacing: -.01em; }
h3 { margin: 0; font-size: 15px; }
p { margin: 0 0 10px; }
code { background: var(--surface-3); padding: 1px 6px; border-radius: 5px; font-size: 12px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.center { text-align: center; margin: 24px 0 8px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack-sm > * + * { margin-top: 4px; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }

/* ============ controls ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); padding: 8px 14px; font: inherit; font-weight: 600; font-size: 13.5px;
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; text-decoration: none !important;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; padding: 11px; }
.btn-icon { padding: 7px; }

input, select, textarea {
  background: var(--surface); color: var(--text); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  padding: 8px 11px; font: inherit; min-width: 0; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: #a99c8d; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select { cursor: pointer; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
input[type=range] { accent-color: var(--accent); padding: 0; border: 0; background: transparent; box-shadow: none; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 12px; }
.field input, .field textarea, .field select { font-weight: 400; font-size: 14px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; margin: 4px 0; }
.card form .check, form.card .check { display: flex; }
.chip { background: var(--surface); border: 1px solid var(--line-2); color: var(--text); border-radius: 999px; padding: 4px 11px; font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }

.seg { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; flex: none; }
.seg button { background: none; border: 0; color: var(--text-2); padding: 6px 13px; border-radius: 8px; cursor: pointer; font: inherit; font-weight: 600; font-size: 13px; white-space: nowrap; display: inline-flex; align-items: center; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg-icons button { padding: 6px 9px; }

.alert { padding: 10px 14px; border-radius: var(--r); border: 1px solid; font-size: 13.5px; word-break: break-word; }
.alert-error { background: var(--red-soft); border-color: rgba(191, 59, 48, .3); color: #8f2a21; }
.alert-warn { background: var(--amber-soft); border-color: rgba(168, 106, 18, .3); color: #6e4609; }
.alert a { font-weight: 600; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }

/* ============ auth ============ */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(800px 420px at 50% -5%, rgba(108, 71, 212, .14), transparent), var(--bg); }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 30px; box-shadow: var(--shadow-lg); }
.auth-card .muted { margin-bottom: 20px; }

/* ============ shell ============ */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; color: inherit; text-decoration: none !important; }
.brand-lg { font-size: 24px; margin-bottom: 4px; }
.logo { width: 28px; height: 28px; border-radius: 8px; background: url(/favicon.svg) center/cover; flex: none; }
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--side); color: var(--side-text);
  display: flex; flex-direction: column; padding: 20px 14px; padding-top: calc(20px + env(safe-area-inset-top, 0px)); z-index: 30;
}
.sidebar .brand { padding: 0 8px 22px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; color: var(--side-muted); padding: 9px 11px; border-radius: 9px; font-weight: 550; text-decoration: none; transition: background .15s, color .15s; }
.nav a:hover { background: var(--side-2); color: var(--side-text); }
.nav a.active { background: var(--side-2); color: #fff; }
.nav a.active svg { color: #b79cff; }
.nav .badge-count { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.side-status { margin-top: auto; font-size: 12px; color: var(--side-muted); padding: 12px; border-radius: 10px; background: var(--side-2); line-height: 1.45; }
.side-status b { color: var(--side-text); font-weight: 600; }
.side-status .line { display: flex; align-items: center; gap: 8px; }
.side-user { margin-top: 10px; display: flex; align-items: center; gap: 10px; background: none; border: 0; color: var(--side-text); padding: 8px; border-radius: 10px; cursor: pointer; font: inherit; text-align: left; }
.side-user:hover { background: var(--side-2); }
.side-user-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.side-user-text small { color: var(--side-muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #8b6cf0, #c98b5a); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; border: 0; flex: none; text-transform: uppercase; cursor: pointer; font-family: inherit; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; display: inline-block; }
.status-dot.ok { background: #4ccf8a; box-shadow: 0 0 0 3px rgba(76, 207, 138, .2); }
.status-dot.busy { background: #f0b43c; animation: pulse 1s infinite alternate; }
.status-dot.err { background: #e5604f; }
@keyframes pulse { to { opacity: .35; } }

.mobile-bar, .tabbar { display: none; }
.main { margin-left: var(--side-w); padding: 28px 32px 48px; max-width: calc(var(--side-w) + 1480px); }
.banner { margin-bottom: 18px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .muted { margin: 0; }

/* ============ trends ============ */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.kpi-label { color: var(--muted); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 24px; font-weight: 750; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 18px; }
.search { position: relative; flex: 1 1 240px; display: flex; }
.search input { width: 100%; padding-left: 34px; }
.search .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); display: flex; }

.clips.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.clip { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; position: relative; box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s, border-color .18s; }
.clip:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(70, 48, 25, .13); border-color: var(--line-2); }
.thumb { position: relative; aspect-ratio: 16/9; background: var(--surface-3); overflow: hidden; cursor: pointer; display: block; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.clip:hover .thumb img { transform: scale(1.03); }
.badge { position: absolute; font-size: 12px; font-weight: 650; padding: 2px 8px; border-radius: 6px; line-height: 1.5; display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.b-views { left: 8px; bottom: 8px; background: rgba(20, 14, 9, .75); color: #fff; }
.b-dur { right: 8px; bottom: 8px; background: rgba(20, 14, 9, .75); color: #fff; }
.b-rank { left: 8px; top: 8px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); min-width: 28px; justify-content: center; }
.b-rank.top { background: var(--accent); color: #fff; }
.b-hot { right: 8px; top: 8px; background: #2c8655; color: #fff; }
.thumb-actions { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; background: rgba(20, 14, 9, .35); opacity: 0; transition: opacity .18s; }
.clip:hover .thumb-actions, .thumb:focus-within .thumb-actions { opacity: 1; }
.round-btn { width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .95); color: var(--text); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow-lg); transition: transform .15s; }
.round-btn:hover { transform: scale(1.08); }
.round-btn svg { width: 20px; height: 20px; }
.round-btn.accent { background: var(--accent); color: #fff; }
.clip-body { padding: 12px 14px 14px; }
.clip-title { font-weight: 650; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; word-break: break-word; cursor: pointer; }
.clip-meta { color: var(--muted); font-size: 12.5px; margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.clip-meta a { color: var(--text-2); font-weight: 600; }
.clip-meta .game { color: var(--accent); font-weight: 550; }
.clip-foot { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 12.5px; }
.up { color: var(--green); font-weight: 650; white-space: nowrap; }
.speed { color: var(--amber); font-weight: 600; white-space: nowrap; }
.tag { font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--surface-3); color: var(--text-2); text-transform: uppercase; letter-spacing: .03em; }
.mk-vertical { margin-left: auto; }

.clips.list { display: flex; flex-direction: column; gap: 8px; }
.clips.list .clip { display: grid; grid-template-columns: 40px 168px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 8px 16px 8px 8px; }
.clips.list .clip:hover { transform: none; }
.clips.list .thumb { border-radius: 9px; }
.clips.list .b-rank, .clips.list .b-hot, .clips.list .b-views, .clips.list .thumb-actions .round-btn.accent { display: none; }
.clips.list .clip-body { padding: 0; }
.clips.list .clip-title { min-height: 0; -webkit-line-clamp: 1; }
.clips.list .clip-foot { border: 0; padding: 0; margin-top: 4px; }
.clips.list .clip-meta { margin-top: 2px; }
.list-rank { font-weight: 800; color: var(--muted); text-align: center; font-size: 16px; font-variant-numeric: tabular-nums; }
.list-views { text-align: right; font-weight: 750; font-size: 17px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.list-views small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.clips.grid .list-rank, .clips.grid .list-views { display: none; }

.empty { grid-column: 1/-1; text-align: center; padding: 56px 20px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--r-lg); }
.empty h3 { color: var(--text); margin: 0 0 6px; font-size: 17px; }
.empty .btn { margin-top: 14px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--r-lg); min-height: 260px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ============ categories / tables ============ */
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 14px; }
.cat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); display: flex; gap: 14px; padding: 12px; cursor: pointer; transition: border-color .15s, box-shadow .15s; box-shadow: var(--shadow); }
.cat:hover { border-color: var(--accent); }
.cat img { width: 66px; height: 88px; border-radius: 8px; object-fit: cover; background: var(--surface-3); flex: none; }
.cat > div { flex: 1; min-width: 0; }
.cat-name { font-weight: 700; line-height: 1.25; word-break: break-word; }
.cat-stats { font-size: 12.5px; display: grid; grid-template-columns: auto 1fr; gap: 1px 10px; margin-top: 8px; color: var(--muted); }
.cat-stats b { color: var(--text); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cat-stats b.up { color: var(--green); }
.star { color: var(--accent); }

.table-card { overflow: hidden; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 650; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table img.mini { width: 92px; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; display: block; background: var(--surface-3); }
.pill { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.pill-ok { background: var(--green-soft); color: var(--green); }
.pill-err { background: var(--red-soft); color: var(--red); }
.pill-muted { background: var(--surface-3); color: var(--text-2); }
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.pill-warn { background: var(--amber-soft); color: var(--amber); }

/* ============ tracking ============ */
.track-form { margin-bottom: 18px; }
.track-grid { display: grid; grid-template-columns: 2fr 2fr 150px 130px; gap: 0 12px; }
.ac { position: relative; }
.ac input { width: 100%; }
.ac-list { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); max-height: 320px; overflow: auto; box-shadow: var(--shadow-lg); padding: 4px; }
.ac-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; cursor: pointer; border-radius: 8px; font-weight: 500; color: var(--text); }
.ac-item:hover, .ac-item.sel { background: var(--surface-2); }
.ac-item img { width: 30px; height: 40px; object-fit: cover; border-radius: 4px; background: var(--surface-3); }
.tracked-list { display: grid; gap: 12px; }
.tracked { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 16px; padding: 16px; }
.tracked.off { opacity: .65; }
.tracked img { width: 76px; height: 101px; object-fit: cover; border-radius: 10px; background: var(--surface-3); }
.tracked-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.tracked-head h3 { font-size: 17px; }
.thr-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.facts { display: flex; flex-wrap: wrap; gap: 4px 20px; color: var(--muted); font-size: 12.5px; margin-bottom: 12px; }
.facts b { color: var(--text); font-weight: 650; }
.tracked-edit { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tracked-edit .thr { flex: 1 1 200px; }
.tracked-edit .age { width: 80px; }
.tracked-edit .lang { width: 120px; }

/* ============ settings ============ */
.settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.span-2 { grid-column: 1/-1; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
details.more { margin: 6px 0 12px; }
details.more summary { cursor: pointer; color: var(--text-2); font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.users { display: grid; gap: 2px; margin-bottom: 14px; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.user-row .avatar { width: 30px; height: 30px; font-size: 12px; cursor: default; }
.user-row .who { flex: 1; min-width: 120px; }
.user-row select { padding: 5px 8px; font-size: 13px; }
.user-form input { flex: 1 1 160px; }

/* ============ modal ============ */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(36, 26, 17, .55); display: grid; place-items: center; padding: 24px; backdrop-filter: blur(3px); overflow-y: auto; }
.modal-box { position: relative; width: min(1100px, 100%); background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-sm { width: min(420px, 100%); }
.modal-x { position: absolute; top: 12px; right: 12px; z-index: 3; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(36, 26, 17, .55); color: #fff; cursor: pointer; display: grid; place-items: center; }
.modal-x:hover { background: rgba(36, 26, 17, .8); }
.clip-view { display: grid; grid-template-columns: minmax(0, 1fr) 320px; }
.player { aspect-ratio: 16/9; background: #120d09; }
.player iframe { width: 100%; height: 100%; border: 0; display: block; }
.clip-side { padding: 20px; display: flex; flex-direction: column; gap: 14px; border-left: 1px solid var(--line); }
.clip-side h3 { font-size: 17px; line-height: 1.3; padding-right: 30px; word-break: break-word; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 9px 11px; }
.stat small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 600; }
.stat b { font-size: 16px; font-variant-numeric: tabular-nums; }
.spark { width: 100%; height: 80px; display: block; }
.spark-box { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: 12px; color: var(--muted); }
.clip-side .actions { display: grid; gap: 8px; margin-top: auto; }

/* ============ studio ============ */
.renders { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 18px; }
.render { display: flex; flex-direction: column; overflow: hidden; }
.render-media { position: relative; aspect-ratio: 9/16; max-height: 460px; background: #1b140f; display: grid; place-items: center; overflow: hidden; }
.render-media video, .render-media img { width: 100%; height: 100%; object-fit: contain; display: block; }
.render-media img.dim { filter: blur(2px) brightness(.55); object-fit: cover; }
.render-progress { position: absolute; left: 16px; right: 16px; bottom: 50%; transform: translateY(50%); color: #fff; text-align: center; font-weight: 650; }
.bar { height: 6px; background: rgba(255, 255, 255, .25); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; background: #b79cff; border-radius: 99px; transition: width .4s; }
.render-body { padding: 14px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.render-title { font-weight: 650; line-height: 1.35; word-break: break-word; }
.render-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); }
.render textarea { width: 100%; font-size: 13px; min-height: 96px; }
.render-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.render-actions .btn { flex: 1 1 auto; }
.render-actions .btn-primary { flex-basis: 100%; }
.render-actions .btn-icon { flex: 0 0 38px; }

.drop { border: 2px dashed var(--line-2); border-radius: var(--r-lg); padding: 40px 24px; text-align: center; background: var(--surface-2); transition: border-color .15s, background .15s; cursor: pointer; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop svg { width: 40px; height: 40px; color: var(--accent); margin-bottom: 8px; }
.drop h3 { font-size: 17px; margin-bottom: 4px; }
.upload-box { padding: 28px; }
.upload-box ol { color: var(--text-2); padding-left: 20px; margin: 14px 0 0; line-height: 1.7; }

.editor-box { width: min(1180px, 100%); }
.editor { display: grid; grid-template-columns: auto minmax(0, 1fr); min-height: 560px; }
.ed-preview { background: #1d1611; padding: 22px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ed-preview canvas { height: min(68vh, 640px); aspect-ratio: 9/16; border-radius: 14px; background: #000; box-shadow: 0 8px 30px rgba(0, 0, 0, .4); display: block; }
.ed-preview .muted { color: #a3958a; font-size: 12px; text-align: center; max-width: 300px; }
.ed-controls { padding: 24px; overflow-y: auto; max-height: calc(100vh - 48px); display: flex; flex-direction: column; gap: 18px; }
.ed-controls h2 { margin: 0; padding-right: 40px; }
.ed-section > .label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 8px; display: block; }
.layouts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.layout-opt { border: 1.5px solid var(--line-2); background: var(--surface); border-radius: var(--r); padding: 10px 8px; cursor: pointer; text-align: center; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-2); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.layout-opt:hover { border-color: var(--muted); }
.layout-opt.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.layout-opt .mini { width: 30px; height: 52px; border-radius: 4px; border: 1.5px solid currentColor; position: relative; overflow: hidden; }
.mini-blur::before { content: ''; position: absolute; left: 0; right: 0; top: 34%; height: 32%; background: currentColor; opacity: .8; }
.mini-blur::after { content: ''; position: absolute; inset: 0; background: currentColor; opacity: .18; }
.mini-crop::before { content: ''; position: absolute; inset: 0; background: currentColor; opacity: .8; }
.mini-split::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 38%; background: currentColor; opacity: .45; }
.mini-split::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 60%; background: currentColor; opacity: .85; }
.slider { display: grid; grid-template-columns: 110px 1fr 48px; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.slider output { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; }
.cam-picker { position: relative; width: 100%; aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; background: #000; user-select: none; touch-action: none; }
.cam-picker img { width: 100%; height: 100%; object-fit: fill; display: block; pointer-events: none; }
.cam-rect { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .45); border-radius: 4px; cursor: move; }
.cam-rect::after { content: 'Камера'; position: absolute; top: 4px; left: 6px; color: #fff; font-size: 11px; font-weight: 700; text-shadow: 0 1px 2px #000; }
.cam-handle { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; background: #fff; border-radius: 50%; cursor: nwse-resize; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.trim video { width: 100%; border-radius: 10px; background: #000; max-height: 220px; display: block; }
.trim-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.trim-row input { width: 86px; }
.ed-text input[type=text] { width: 100%; }
.caption-box textarea { width: 100%; min-height: 120px; font-size: 13px; }
.counter { font-size: 12px; color: var(--muted); text-align: right; margin-top: 4px; }
.ed-foot { display: flex; gap: 8px; justify-content: flex-end; padding-top: 4px; position: sticky; bottom: -24px; background: var(--surface); padding-bottom: 4px; }

/* ============ one-click jobs ============ */
.jobs { position: fixed; left: calc(var(--side-w) + 24px); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 90; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100% - 32px)); }
.job { background: var(--surface); border: 1px solid var(--line-2); border-left: 4px solid var(--accent); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow-lg); animation: tin .2s; }
.job.ok { border-left-color: var(--green); }
.job.err { border-left-color: var(--red); }
.job-title { font-weight: 650; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-sub { color: var(--text-2); font-size: 12.5px; margin: 2px 0 8px; word-break: break-word; }
.job .bar { background: var(--surface-3); margin: 0; }
.job .bar > i { background: var(--accent); }
.job-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.bar > i.indeterminate { width: 35% !important; animation: indet 1.1s ease-in-out infinite; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(290%); } }

/* ============ toasts ============ */
.toasts { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: calc(100% - 32px); }
.toast { background: var(--side); color: var(--side-text); padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); max-width: 420px; animation: tin .2s; word-break: break-word; display: flex; align-items: center; gap: 10px; font-weight: 500; }
.toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #b79cff; flex: none; }
.toast.ok::before { background: #4ccf8a; }
.toast.err::before { background: #e5604f; }
@keyframes tin { from { transform: translateY(10px); opacity: 0; } }

/* ============ responsive ============ */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .track-grid { grid-template-columns: 1fr 1fr; }
  .clip-view { grid-template-columns: 1fr; }
  .clip-side { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 900px) {
  .sidebar { display: none; }
  .mobile-bar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 30; background: var(--side); color: var(--side-text); padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  .mobile-bar .brand { flex: 1; }
  .mobile-bar .avatar { width: 32px; height: 32px; font-size: 13px; }
  .main { margin-left: 0; padding: 18px 16px calc(84px + env(safe-area-inset-bottom, 0px)); }
  .jobs { left: 16px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); overflow-x: auto; scrollbar-width: none; }
  .tabbar a { flex: 1 0 64px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: 10.5px; font-weight: 600; padding: 4px 2px; border-radius: 8px; text-decoration: none; white-space: nowrap; }
  .tabbar a svg { width: 21px; height: 21px; }
  .tabbar a.active { color: var(--accent); }
  h1 { font-size: 22px; }
  .page-head { align-items: flex-start; }
  .page-head .seg { width: 100%; }
  .page-head .seg button { flex: 1; justify-content: center; padding: 7px 4px; }
  .settings { grid-template-columns: 1fr; }
  .editor { grid-template-columns: 1fr; }
  .ed-preview canvas { height: min(56vh, 520px); }
  .ed-controls { max-height: none; }
  .modal { padding: 0; place-items: stretch; }
  .modal-box { border-radius: 0; min-height: 100%; }
  .modal-sm { min-height: 0; margin: auto 16px; border-radius: 20px; }
}
@media (max-width: 560px) {
  .kpi-value { font-size: 20px; }
  .clips.grid { grid-template-columns: 1fr; gap: 14px; }
  .clips.list .clip { grid-template-columns: 112px minmax(0, 1fr); gap: 10px; padding: 8px; }
  .clips.list .list-rank { display: none; }
  .clips.list .list-views { grid-column: 2; text-align: left; font-size: 14px; }
  .clips.list .list-views small { display: inline; margin-left: 4px; }
  .filters select { flex: 1 1 calc(50% - 4px); }
  .track-grid, .field-grid { grid-template-columns: 1fr; }
  .tracked { grid-template-columns: 54px minmax(0, 1fr); gap: 12px; }
  .tracked img { width: 54px; height: 72px; }
  .slider { grid-template-columns: 90px 1fr 42px; }
}
