/* Clipper dashboard — "midnight precision instrument".
   Dark-only. Elevation via hairline borders, never shadows. Acid lime = the primary action only. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/static/fonts/inter-cyrillic-wght-normal.woff2) format("woff2-variations");
  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(/static/fonts/inter-latin-wght-normal.woff2) format("woff2-variations");
  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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;
  /* surfaces */
  --void: #08090a;
  --carbon: #0f1011;
  --obsidian: #161718;
  --graphite: #23252a;
  --smoke: #383b3f;
  /* text */
  --ash: #62666d;
  --fog: #8a8f98;
  --mist: #d0d6e0;
  --bone: #e5e5e6;
  --paper: #ffffff;
  /* accents */
  --lime: #e4f222;
  --green: #27a644;
  --coral: #eb5757;
  --teal: #02b8cc;
  --iris: #6366f1;
  --lavender: #8b5cf6;

  --hair: inset 0 0 0 1px var(--graphite);
  --r-sm: 4px;
  --r: 6px;
  --r-card: 12px;
  --mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "cv01" on, "ss03" on, "zero" on;
}

* { box-sizing: border-box; }
html { background: var(--void); }
body {
  margin: 0;
  background: var(--void);
  color: var(--mist);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(228, 242, 34, 0.25); color: var(--paper); }
a { color: var(--mist); text-decoration: none; transition: color .12s; }
a:hover { color: var(--paper); }
h1, h2, h3 { color: var(--paper); font-weight: 510; margin: 0; }
code, pre, .mono { font-family: var(--mono); font-size: 12px; letter-spacing: -0.013em; }
code { color: var(--fog); }
pre {
  white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow: auto;
  background: var(--void); box-shadow: var(--hair); padding: 10px 12px; border-radius: var(--r);
  color: var(--fog);
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--graphite); border-radius: 10px; border: 2px solid var(--void); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 28px;
  height: 52px; padding: 0 24px;
  background: rgba(8, 9, 10, 0.82);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--graphite);
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--paper); font-weight: 510; font-size: 15px; letter-spacing: -0.012em; }
.brand:hover { color: var(--paper); }
.brand svg { width: 20px; height: 20px; }
.topbar nav { display: flex; gap: 2px; flex: 1; }
.topbar nav a {
  position: relative; padding: 6px 10px; border-radius: var(--r);
  font-size: 13px; color: var(--fog);
}
.topbar nav a:hover { color: var(--paper); background: rgba(255, 255, 255, 0.03); }
.topbar nav a.active { color: var(--paper); }
.topbar nav a.active::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -14px; height: 2px;
  background: var(--lime); border-radius: 2px;
}
.logout { margin: 0; }

main { max-width: 1240px; margin: 0 auto; padding: 32px 24px 96px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; line-height: 1.33; letter-spacing: -0.288px; }
.page-head p { margin: 4px 0 0; color: var(--fog); font-size: 13px; }

/* ---------- buttons ---------- */
button, .button {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 13px; font-weight: 510; letter-spacing: -0.011em;
  color: var(--mist);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--graphite);
  border-radius: var(--r);
  padding: 7px 12px;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
  white-space: nowrap;
}
button:hover, .button:hover { background: rgba(255, 255, 255, 0.08); border-color: var(--smoke); color: var(--paper); }
button.primary, .button.primary {
  background: var(--lime); color: var(--void); border-color: transparent;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
button.primary:hover, .button.primary:hover { background: #eef65a; color: var(--void); }
button.ghost { background: transparent; }
button.ghost:hover { background: rgba(255, 255, 255, 0.04); }
button.small, .button.small { font-size: 12px; padding: 4px 10px; }
button.link { background: none; border: 0; color: var(--fog); padding: 6px 4px; font-weight: 400; }
button.link:hover { color: var(--paper); background: none; }
button.htmx-request { opacity: .55; pointer-events: none; }
button:focus-visible, .button:focus-visible, a:focus-visible {
  outline: none; box-shadow: 0 0 0 2px var(--void), 0 0 0 4px rgba(228, 242, 34, 0.55);
}

/* ---------- inputs ---------- */
input, textarea, select {
  font: inherit; font-size: 13px; color: var(--mist);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r);
  padding: 8px 11px;
  transition: border-color .12s, background .12s;
}
input::placeholder, textarea::placeholder { color: var(--ash); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--mist); background: rgba(255, 255, 255, 0.03); }
textarea { width: 100%; resize: vertical; line-height: 1.55; }
select { padding-right: 28px; }

/* ---------- surfaces ---------- */
.card { background: var(--carbon); box-shadow: var(--hair); border-radius: var(--r-card); padding: 20px 24px; margin-bottom: 16px; }
.card h2 { font-size: 15px; letter-spacing: -0.011em; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--carbon); box-shadow: var(--hair); border-radius: var(--r-card); padding: 18px 20px; display: flex; flex-direction: column; gap: 2px; }
.tile-label { color: var(--fog); font-size: 13px; }
.tile-value { color: var(--paper); font-size: 32px; font-weight: 510; line-height: 1.13; letter-spacing: -0.704px; font-variant-numeric: tabular-nums; margin: 6px 0 4px; }
.tile a { font-size: 12px; color: var(--fog); }
.tile a:hover { color: var(--paper); }

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

.kv { display: grid; grid-template-columns: 170px 1fr; gap: 10px 16px; margin: 0; font-size: 13px; }
.kv dt { color: var(--fog); }
.kv dd { margin: 0; color: var(--mist); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* segmented tabs */
.tabs { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; margin-bottom: 16px; background: var(--carbon); box-shadow: var(--hair); border-radius: 8px; }
.tabs a { padding: 5px 11px; border-radius: var(--r); font-size: 13px; color: var(--fog); }
.tabs a:hover { color: var(--paper); }
.tabs a.active { background: var(--graphite); color: var(--paper); }
.count { font-family: var(--mono); font-size: 11px; color: var(--ash); margin-left: 6px; }
.tabs a.active .count { color: var(--fog); }

/* ---------- tables ---------- */
.table-wrap { background: var(--carbon); box-shadow: var(--hair); border-radius: var(--r-card); overflow: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 10px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid rgba(35, 37, 42, 0.7); }
.table th { color: var(--ash); font-weight: 400; font-size: 12px; background: transparent; border-bottom-color: var(--graphite); white-space: nowrap; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.table tr:last-child td { border-bottom: 0; }
.table.compact td { padding: 8px 4px; }
.card .table td:first-child, .card .table th:first-child { padding-left: 0; }
.card .table td:last-child, .card .table th:last-child { padding-right: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th.num a { justify-content: flex-end; }
.title a { color: var(--bone); }
.title a:hover { color: var(--paper); }
.thumb { width: 88px; height: 50px; object-fit: cover; border-radius: var(--r); display: block; box-shadow: var(--hair); background: var(--obsidian); }
.lang { font-family: var(--mono); font-size: 10px; color: var(--ash); margin-left: 6px; border: 1px solid var(--graphite); border-radius: var(--r-sm); padding: 0 4px; vertical-align: 1px; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions button + button { margin-left: 4px; }
th a.sort { display: inline-flex; gap: 4px; color: var(--ash); }
th a.sort:hover { color: var(--mist); }
th a.sort.active { color: var(--paper); }

/* score */
.score {
  display: inline-block; min-width: 32px; text-align: center;
  font-family: var(--mono); font-size: 12px; padding: 2px 6px; border-radius: var(--r-sm);
  cursor: help; font-variant-numeric: tabular-nums;
}
.score-high { color: #4cd36b; background: rgba(39, 166, 68, 0.14); }
.score-mid { color: #3fd0e0; background: rgba(2, 184, 204, 0.12); }
.score-low, .score-none { color: var(--fog); background: rgba(255, 255, 255, 0.05); }

/* badges with status dots */
.pill {
  --dot: var(--ash);
  display: inline-flex; align-items: center; gap: 6px;
  padding: 1px 7px; border-radius: var(--r-sm);
  font-size: 12px; color: var(--fog);
  background: rgba(255, 255, 255, 0.05);
  white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--dot); flex: none; }
a.pill:hover { color: var(--paper); background: rgba(255, 255, 255, 0.08); }
.st-candidate, .st-ready, .st-done, .st-rendered, .pill.posted { --dot: var(--green); }
.st-selected, .st-queued, .st-running, .st-pending, .st-downloaded { --dot: var(--teal); }
.st-failed, .st-dead { --dot: var(--coral); }
.st-duplicate { --dot: var(--lavender); }
.st-rejected, .st-skipped { --dot: var(--ash); }
.pill.archived { --dot: var(--iris); }

.muted { color: var(--fog); }
.small { font-size: 12px; }
.ok { color: #4cd36b; }
.error { color: var(--coral); }
.warn { color: var(--lime); }
.note { font-size: 13px; color: var(--mist); background: rgba(255, 255, 255, 0.03); box-shadow: inset 2px 0 0 var(--lime); padding: 7px 12px; border-radius: var(--r); }

/* ---------- switches on the overview ---------- */
.control-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; margin-bottom: 16px; }
@media (max-width: 900px) { .control-row { grid-template-columns: 1fr; } }
.auto-switch {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  background: var(--carbon); box-shadow: var(--hair); border-radius: var(--r-card); padding: 14px 18px;
}
.auto-switch strong { color: var(--paper); font-weight: 510; }
.auto-switch .muted { flex: 1; min-width: 220px; }
.auto-switch .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(39, 166, 68, 0.15); animation: pulse 2.4s ease-in-out infinite; }
.auto-switch.off .dot { background: var(--ash); box-shadow: 0 0 0 4px rgba(98, 102, 109, 0.18); animation: none; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(39, 166, 68, 0.05); } }
@media (prefers-reduced-motion: reduce) { .auto-switch .dot { animation: none; } }

.mode-switch { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--carbon); box-shadow: var(--hair); border-radius: var(--r-card); padding: 10px 14px; }
.segmented { display: inline-flex; gap: 2px; padding: 3px; background: var(--void); box-shadow: var(--hair); border-radius: 8px; }
.segmented form { margin: 0; }
.segmented button { background: transparent; border-color: transparent; color: var(--fog); font-weight: 400; padding: 4px 10px; font-size: 12px; }
.segmented button:hover { color: var(--paper); background: transparent; }
.segmented button.on { background: var(--graphite); color: var(--paper); }

/* alerts */
.alerts h2 .count { margin: 0; }
.alert-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid rgba(35, 37, 42, 0.7); flex-wrap: wrap; font-size: 13px; }
.alert-row:last-child { border-bottom: 0; padding-bottom: 0; }
.alert-row .text { flex: 1; min-width: 240px; color: var(--mist); }
.lvl-error .pill { --dot: var(--coral); }
.lvl-warning .pill { --dot: var(--lime); }
.lvl-info .pill { --dot: var(--teal); }
.problems p { margin: 8px 0; font-size: 13px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }

/* ---------- videos ---------- */
.videos { display: flex; flex-direction: column; gap: 16px; }
.video-card {
  display: grid; grid-template-columns: 210px minmax(0, 1fr) 272px; gap: 22px;
  background: var(--carbon); box-shadow: var(--hair); border-radius: var(--r-card); padding: 18px;
}
.player video, .placeholder { width: 100%; aspect-ratio: 9 / 16; background: #000; border-radius: 10px; display: block; box-shadow: var(--hair); }
.placeholder { display: flex; flex-direction: column; gap: 6px; align-items: center; justify-content: center; text-align: center; color: var(--fog); padding: 14px; background: var(--obsidian); font-size: 13px; }
.placeholder code { font-size: 11px; color: var(--ash); word-break: break-word; }
.placeholder.failed { background: linear-gradient(rgba(235, 87, 87, 0.05), rgba(235, 87, 87, 0.05)), var(--obsidian); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--graphite); border-top-color: var(--lime); animation: spin .9s linear infinite; margin-bottom: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

.vc-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.vc-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.vc-head strong { color: var(--paper); font-weight: 510; font-size: 16px; letter-spacing: -0.011em; }
.vc-id { color: var(--ash); font-size: 12px; }
.vc-sources { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.vc-sources a { display: flex; align-items: center; min-width: 0; color: var(--fog); }
.vc-sources a:hover { color: var(--paper); }
.vc-sources b { color: var(--mist); font-weight: 510; margin-right: 8px; flex: none; }
.vc-sources .plat { flex: none; }
.vc-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vc-n { color: var(--ash); width: 16px; flex: none; font-size: 12px; }
.vc-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.03); box-shadow: var(--hair); color: var(--mist); white-space: nowrap; }
.chip .k { color: var(--ash); }
.chip b { font-weight: 510; }
.chip-ok { color: #4cd36b; }
.chip-bad { color: var(--coral); }
.vc-caption { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.vc-caption-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.vc-caption-head .label { margin: 0; }
.vc-tools { display: flex; gap: 2px; }
.vc-tools button.link { padding: 2px 6px; }
.vc-caption textarea { min-height: 132px; font-size: 13px; }
.vc-caption-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.vc-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.vc-block { background: var(--obsidian); box-shadow: var(--hair); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.vc-block h3 { margin: 0; font-size: 11px; font-weight: 510; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ash); }
.vc-stack { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.vc-stack input, .vc-stack select { width: 100%; min-width: 0; }
.vc-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.vc-pair > * { width: 100%; justify-content: center; text-align: center; }
.vc-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.vc-line button.link { padding: 2px 0; }
.vc-err { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.button.block, button.block { display: flex; width: 100%; justify-content: center; text-align: center; }
.vc-archive { align-self: center; font-size: 12px; }
.tt-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--graphite); border-radius: 8px; overflow: hidden; }
.tt-grid div { background: var(--carbon); padding: 7px 10px; display: flex; flex-direction: column; }
.tt-grid b { color: var(--paper); font-weight: 590; font-size: 15px; font-variant-numeric: tabular-nums; }
.tt-grid span { color: var(--ash); font-size: 11px; }
/* Narrower screens: actions move under the caption, blocks side by side when they fit. */
@media (max-width: 1100px) {
  .video-card { grid-template-columns: 190px minmax(0, 1fr); }
  .vc-side { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .vc-side > .button, .vc-side > .vc-archive { grid-column: 1 / -1; }
  .vc-side > .vc-block:last-of-type:nth-of-type(odd) { grid-column: 1 / -1; }
  .vc-archive { justify-self: center; }
}
@media (max-width: 640px) {
  .video-card { grid-template-columns: 1fr; padding: 14px; gap: 16px; }
  .player { max-width: 260px; margin: 0 auto; width: 100%; }
  .vc-side { grid-template-columns: 1fr; }
}
.label { font-size: 12px; color: var(--ash); display: block; margin-bottom: 6px; }
.row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
form.inline { display: flex; gap: 6px; align-items: center; margin: 0; }
form.grow { flex: 1; }
form.grow input { flex: 1; min-width: 160px; }
.divider { height: 1px; background: var(--graphite); margin: 2px 0; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 30;
  background: var(--obsidian); box-shadow: var(--hair), 0 8px 24px rgba(0, 0, 0, 0.4);
  color: var(--mist); font-size: 13px; padding: 10px 14px; border-radius: 8px;
  opacity: 0; transform: translateY(8px); transition: all .18s; pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }
.toast.error { color: var(--coral); }

/* ---------- login ---------- */
.login-page {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: radial-gradient(1200px 600px at 50% 120%, rgba(208, 214, 224, 0.08), transparent 60%), var(--void);
}
.login-box { background: var(--carbon); box-shadow: var(--hair); border-radius: var(--r-card); padding: 32px; width: 360px; display: flex; flex-direction: column; gap: 16px; }
.login-box .brand { font-size: 16px; }
.login-box h1 { font-size: 20px; letter-spacing: -0.24px; margin-top: 8px; }
.login-box label { display: flex; flex-direction: column; gap: 6px; color: var(--fog); font-size: 13px; }
.login-box button { justify-content: center; padding: 9px 16px; font-size: 14px; }
.login-box p { margin: 0; font-size: 13px; }
.nowrap { white-space: nowrap; }

/* ---------- platforms: Twitch (priority, automatic) vs Kick (manual) ---------- */
.plat { display: inline-block; font-size: 10px; font-weight: 590; letter-spacing: 0.02em; text-transform: uppercase; padding: 1px 5px; border-radius: var(--r-sm); margin-right: 8px; vertical-align: 1px; }
.plat-twitch { color: #b9a6ff; background: rgba(139, 92, 246, 0.14); }
.plat-kick { color: #53fc18; background: rgba(83, 252, 24, 0.10); }
.platform-bar { margin-bottom: 12px; }
.segmented.platforms a { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: var(--r); color: var(--fog); font-size: 13px; }
.segmented.platforms a.on { background: var(--graphite); color: var(--paper); }
.segmented.platforms a .plat { margin-right: 6px; }
.kick-panel { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; background: linear-gradient(90deg, rgba(83, 252, 24, 0.06), transparent 60%), var(--carbon); box-shadow: inset 0 0 0 1px rgba(83, 252, 24, 0.22); border-radius: var(--r-card); padding: 14px 18px; margin-bottom: 16px; }
.kick-panel > div { flex: 1; min-width: 260px; }
.kick-panel strong { color: var(--paper); font-weight: 510; }
.kick-panel p { margin: 4px 0 0; }
.table-wrap.kick { box-shadow: inset 0 0 0 1px rgba(83, 252, 24, 0.18); }
.kick-btn .plat { margin-right: 2px; }
.control-row.single { grid-template-columns: 1fr; }
.auto-switch.stats .dot { background: var(--teal); box-shadow: 0 0 0 4px rgba(2, 184, 204, 0.15); animation: none; }
.auto-switch.stats.off .dot { background: var(--ash); box-shadow: 0 0 0 4px rgba(98, 102, 109, 0.18); }

/* TikTok stats on video cards */

/* ---------- ⚙ settings ---------- */
.gear { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--r); color: var(--fog); }
.gear:hover, .gear.active { color: var(--paper); background: rgba(255, 255, 255, 0.05); }
.gear.active { box-shadow: inset 0 -2px 0 var(--lime); }
.gear svg { width: 18px; height: 18px; }
.settings-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .settings-layout { grid-template-columns: 1fr; } }
.settings-side { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 0; }
.settings-group h2 { margin-bottom: 2px; }
.group-sub { margin: 0 0 16px; }
.fields { display: flex; flex-direction: column; gap: 18px; }
.fields-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 18px; }
.field label { display: flex; align-items: center; gap: 8px; color: var(--bone); font-size: 13px; margin-bottom: 6px; }
.field .control { display: flex; align-items: center; gap: 8px; }
.field input[type=number] { width: 160px; font-variant-numeric: tabular-nums; }
.fields-grid .field input[type=number] { width: 100%; }
.field textarea { font-family: var(--mono); font-size: 12px; }
.unit { color: var(--ash); font-size: 12px; }
.field-help { margin: 6px 0 0; font-size: 12px; color: var(--ash); line-height: 1.5; }
.field-help .default { color: var(--ash); }
.field-error { margin: 6px 0 0; font-size: 12px; color: var(--coral); }
.field.has-error input, .field.has-error textarea { border-color: var(--coral); }
.field.is-changed > label { color: var(--paper); }
.pill.changed { --dot: var(--lime); font-size: 11px; }
.save-bar { position: sticky; bottom: 16px; z-index: 5; display: flex; gap: 10px; align-items: center; justify-content: flex-end; background: rgba(15, 16, 17, 0.92); backdrop-filter: blur(10px); box-shadow: var(--hair), 0 8px 24px rgba(0, 0, 0, 0.35); border-radius: var(--r-card); padding: 12px 16px; }
.save-bar .muted { margin-right: auto; }
.compact-kv { grid-template-columns: 110px 1fr; margin-bottom: 10px; }
.error-note { box-shadow: inset 2px 0 0 var(--coral); }
.hidden-form { display: none; }

/* ---------- disk widget & charts ---------- */
:root {
  /* Validated dark categorical slots (dataviz validator on #0f1011, all-pairs). */
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
}
.h2-actions { margin-left: auto; display: inline-flex; gap: 8px; align-items: center; font-weight: 400; }
.icon-btn svg { width: 14px; height: 14px; }
.disk-body { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.donut { position: relative; width: 160px; height: 160px; margin: 0; flex: none; }
.donut svg { width: 100%; height: 100%; display: block; }
.donut-track { fill: none; stroke: rgba(255, 255, 255, 0.04); stroke-width: 22; }
.donut-seg { stroke: var(--carbon); stroke-width: 2; stroke-linejoin: round; transition: opacity .12s; cursor: default; }
.donut svg:hover .donut-seg { opacity: .55; }
.donut svg .donut-seg:hover { opacity: 1; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; text-align: center; }
.donut-value { color: var(--paper); font-size: 18px; font-weight: 510; letter-spacing: -0.24px; font-variant-numeric: tabular-nums; }
.donut-label { color: var(--fog); font-size: 11px; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 200px; }
.legend li { display: grid; grid-template-columns: 10px 1fr auto 44px; gap: 10px; align-items: center; font-size: 13px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; }
.swatch-1 { background: var(--series-1); }
.swatch-2 { background: var(--series-2); }
.swatch-3 { background: var(--series-3); }
.legend-label { color: var(--mist); }
.legend-value { color: var(--paper); font-variant-numeric: tabular-nums; }
.legend-pct { color: var(--fog); font-family: var(--mono); font-size: 12px; text-align: right; }
.capacity { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--graphite); }
.capacity-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.capacity-row b { color: var(--paper); font-weight: 510; }
.capacity-bar { width: 100%; height: 6px; display: block; border-radius: 3px; overflow: hidden; }
.capacity-track { fill: rgba(255, 255, 255, 0.06); }
.capacity-fill { fill: var(--mist); }
.capacity-fill.warn { fill: var(--coral); }

/* hover tooltip for [data-tip] (charts) */
.viz-tip { position: fixed; z-index: 40; pointer-events: none; background: var(--obsidian); color: var(--paper); font-size: 12px; padding: 6px 9px; border-radius: 6px; box-shadow: var(--hair), 0 6px 18px rgba(0, 0, 0, 0.45); opacity: 0; transition: opacity .08s; white-space: nowrap; }
.viz-tip.show { opacity: 1; }

/* ---------- pipeline widget ---------- */
.pipe-status { display: flex; flex-direction: column; gap: 2px; margin-bottom: 18px; }
.pipe-line { display: grid; grid-template-columns: 8px 110px 1fr auto; gap: 12px; align-items: center; padding: 9px 12px; border-radius: 8px; background: rgba(255, 255, 255, 0.02); font-size: 13px; }
.pipe-name { color: var(--fog); }
.pipe-value { color: var(--paper); }
.pipe-meta { color: var(--ash); font-size: 11px; }
.pdot { width: 8px; height: 8px; border-radius: 50%; background: var(--ash); }
.pdot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(39, 166, 68, 0.16); }
.pdot.off { background: var(--ash); }
.pdot.idle { background: var(--fog); }
.pipe-sub { font-size: 12px; font-weight: 400; color: var(--ash); margin: 0 0 8px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.stat-grid:last-child { margin-bottom: 0; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 8px; background: rgba(255, 255, 255, 0.02); box-shadow: var(--hair); transition: background .12s, box-shadow .12s; }
.stat:hover { background: rgba(255, 255, 255, 0.04); box-shadow: inset 0 0 0 1px var(--smoke); }
.stat-value { color: var(--paper); font-size: 20px; font-weight: 510; letter-spacing: -0.24px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { display: inline-flex; align-items: center; gap: 6px; color: var(--fog); font-size: 12px; }
.sdot { width: 6px; height: 6px; border-radius: 50%; background: var(--dot, var(--ash)); display: inline-block; }
.stat.alert { box-shadow: inset 0 0 0 1px rgba(235, 87, 87, 0.45); background: rgba(235, 87, 87, 0.06); }
.stat.alert .stat-value { color: #ff8a8a; }
@media (max-width: 560px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------- top Twitch candidates ---------- */
.top-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.top-item { display: grid; grid-template-columns: 18px 96px minmax(0, 1fr) auto 40px; gap: 14px; align-items: center; padding: 10px 8px; margin: 0 -8px; border-radius: 8px; transition: background .1s; }
.top-item + .top-item { border-top: 1px solid rgba(35, 37, 42, 0.6); }
.top-item:hover { background: rgba(255, 255, 255, 0.02); }
.top-rank { color: var(--ash); font-size: 12px; text-align: right; }
.top-thumb { position: relative; display: block; width: 96px; height: 54px; border-radius: 6px; overflow: hidden; background: var(--obsidian); box-shadow: var(--hair); }
.top-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.top-dur { position: absolute; right: 4px; bottom: 4px; font-size: 10px; color: var(--paper); background: rgba(8, 9, 10, 0.75); padding: 0 4px; border-radius: 3px; }
.top-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.top-title { color: var(--bone); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-title:hover { color: var(--paper); }
.top-sub { color: var(--fog); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-sub .sep { margin: 0 6px; color: var(--ash); }
.top-nums { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-variant-numeric: tabular-nums; }
.top-views { color: var(--paper); font-size: 13px; }
.top-vph { font-size: 11px; }
.top-item .score { justify-self: end; }
@media (max-width: 640px) { .top-item { grid-template-columns: 72px minmax(0, 1fr) 40px; } .top-rank, .top-nums { display: none; } .top-thumb { width: 72px; height: 40px; } }

/* ---------- overview: header summary, tiles, top TikTok ---------- */
.page-head p .hl { color: var(--paper); font-weight: 510; }
.tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile-link { color: inherit; transition: box-shadow .12s, background .12s; }
.tile-link:hover { color: inherit; background: #121315; box-shadow: inset 0 0 0 1px var(--smoke); }
.tile-label { display: inline-flex; align-items: center; gap: 8px; }
.tile-label svg { width: 16px; height: 16px; color: var(--ash); flex: none; }
.tile-hot .tile-label svg { color: var(--lime); }
.tile-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12px; margin-top: 2px; }
.tile-foot .go { color: var(--ash); transition: color .12s; white-space: nowrap; }
.tile-link:hover .go { color: var(--paper); }
.delta { font-variant-numeric: tabular-nums; }
.delta.up { color: #4cd36b; }

.best-list { list-style: none; margin: 0; padding: 0; }
.best-item { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto 130px; gap: 16px; align-items: center; padding: 10px 8px; margin: 0 -8px; border-radius: 8px; }
.best-item + .best-item { border-top: 1px solid rgba(35, 37, 42, 0.6); }
.best-item:hover { background: rgba(255, 255, 255, 0.02); }
.best-rank { color: var(--ash); font-size: 12px; text-align: right; }
.best-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.best-title { color: var(--bone); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.best-title:hover { color: var(--paper); }
.best-sub { color: var(--fog); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.best-sub .sep { margin: 0 6px; color: var(--ash); }
.best-stats { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.best-views { color: var(--paper); font-size: 16px; font-weight: 510; font-variant-numeric: tabular-nums; }
.best-meta { color: var(--fog); font-size: 11px; font-variant-numeric: tabular-nums; }
.best-growth { text-align: right; font-size: 12px; }
@media (max-width: 640px) { .best-item { grid-template-columns: minmax(0, 1fr) auto; } .best-rank, .best-growth { display: none; } }
.empty { display: flex; gap: 14px; align-items: flex-start; padding: 6px 0; }
.empty svg { width: 22px; height: 22px; color: var(--ash); flex: none; margin-top: 2px; }
.empty p { margin: 0 0 4px; font-size: 13px; }

/* ---------- webcam editor ---------- */
.fc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .fc-layout { grid-template-columns: 1fr; } }
.fc-stage { position: relative; overflow: hidden; border-radius: 8px; background: #000; box-shadow: var(--hair); cursor: crosshair; touch-action: none; user-select: none; }
.fc-stage video { display: block; width: 100%; aspect-ratio: 16 / 9; pointer-events: none; }
.fc-box { position: absolute; box-shadow: 0 0 0 1.5px var(--lime), 0 0 0 9999px rgba(8, 9, 10, 0.55); cursor: move; }
.fc-h { position: absolute; width: 12px; height: 12px; background: var(--lime); border-radius: 2px; }
.fc-h.nw { left: -6px; top: -6px; cursor: nwse-resize; }
.fc-h.se { right: -6px; bottom: -6px; cursor: nwse-resize; }
.fc-h.ne { right: -6px; top: -6px; cursor: nesw-resize; }
.fc-h.sw { left: -6px; bottom: -6px; cursor: nesw-resize; }
.fc-controls { display: flex; gap: 10px; align-items: center; margin: 12px 0 10px; }
.fc-controls input[type="range"] { flex: 1; padding: 0; accent-color: var(--lime); background: none; border: 0; }
.fc-presets { margin-bottom: 6px; }
.fc-presets .label { margin: 0 4px 0 0; }
.fc-side canvas { display: block; width: 100%; aspect-ratio: 9 / 16; background: #000; border-radius: 8px; box-shadow: var(--hair); margin-bottom: 14px; }
.fc-side form { margin: 0 0 10px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.fc-side form button.primary { width: 100%; }
.fc-pos label { display: inline-flex; cursor: pointer; }
.fc-pos input { position: absolute; opacity: 0; pointer-events: none; }
.fc-pos span { padding: 4px 12px; font-size: 12px; color: var(--fog); border-radius: var(--r); }
.fc-pos input:checked + span { background: var(--graphite); color: var(--paper); }
.fc-pos input:focus-visible + span { outline: 1px solid var(--mist); }

/* ---------- clips: add by link, bulk actions ---------- */
.add-clip { display: flex; gap: 6px; align-items: center; margin: 0; }
.add-clip input { width: 320px; max-width: 60vw; }
.add-result { margin: -14px 0 14px; min-height: 0; }
.add-result:empty { display: none; }
.bulk-bar { display: flex; gap: 8px; align-items: center; margin: 0 0 10px; padding: 8px 12px; background: var(--carbon); box-shadow: var(--hair); border-radius: var(--r); }
.bulk-bar b { color: var(--paper); font-weight: 510; }
.bulk-bar button:disabled { opacity: .4; pointer-events: none; }
.table th.check, .table td.check { width: 28px; padding-right: 0; }
.check input { accent-color: var(--lime); width: 14px; height: 14px; margin: 0; vertical-align: middle; cursor: pointer; }

/* ---------- tabs row with a destructive action on the right ---------- */
.tabs-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tabs-row form { margin: 0; }
button.danger { display: inline-flex; align-items: center; gap: 6px; color: var(--coral); background: rgba(235, 87, 87, 0.06); border-color: rgba(235, 87, 87, 0.25); }
button.danger:hover { color: #ff7b7b; background: rgba(235, 87, 87, 0.12); border-color: rgba(235, 87, 87, 0.45); }
button.danger svg { width: 14px; height: 14px; }
button.danger .count { color: inherit; opacity: .7; font-variant-numeric: tabular-nums; }

/* ---------- banner sets ---------- */
.banner-default { display: flex; align-items: center; gap: 8px; margin: 0; flex-wrap: wrap; }
.banner-default select { min-width: 160px; }
.vc-field { display: flex; flex-direction: column; gap: 4px; }
.vc-field > span { font-size: 11px; color: var(--ash); }

/* ---------- publications (TikTok / Instagram posts of a video) ---------- */
.pubs { --plat: var(--fog); background: rgba(255, 255, 255, 0.015); box-shadow: var(--hair); border-radius: 10px; overflow: hidden; }
.pub-tiktok { --plat: #4fd8e8; --plat-bg: rgba(79, 216, 232, 0.12); }
.pub-instagram { --plat: #f472b6; --plat-bg: rgba(244, 114, 182, 0.12); }

.pubs-head { display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 14px; flex-wrap: wrap; }
.pubs-title { font-size: 13px; font-weight: 510; color: var(--paper); display: inline-flex; align-items: center; gap: 7px; margin-right: auto; }
.pubs-count { font-size: 11px; font-weight: 590; color: var(--fog); background: var(--graphite); border-radius: 999px; padding: 0 7px; line-height: 18px; font-variant-numeric: tabular-nums; }
.pubs-kpi { font-size: 12px; color: var(--ash); }
.pubs-kpi b { color: var(--paper); font-weight: 590; font-variant-numeric: tabular-nums; margin-right: 2px; }
.pubs-refresh { padding: 4px; border-radius: 6px; background: none; border-color: transparent; color: var(--ash); display: inline-flex; }
.pubs-refresh svg { width: 15px; height: 15px; }
.pubs-refresh:hover { color: var(--paper); background: rgba(255, 255, 255, 0.06); border-color: transparent; }

.pubs-scroll { overflow-x: auto; border-top: 1px solid var(--graphite); }
.pubs-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 520px; }
.pubs-table th { font-size: 10.5px; font-weight: 510; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ash); text-align: left; padding: 8px 7px 6px; white-space: nowrap; background: rgba(255, 255, 255, 0.015); }
.pubs-table td { padding: 8px 7px; border-top: 1px solid rgba(255, 255, 255, 0.045); vertical-align: middle; white-space: nowrap; color: var(--mist); font-variant-numeric: tabular-nums; }
.pubs-table th:first-child, .pubs-table td:first-child { padding-left: 14px; }
.pubs-table th:last-child, .pubs-table td:last-child { padding-right: 8px; }
.pubs-table tbody tr { transition: background .12s; }
.pubs-table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.pubs-table .num { text-align: right; }

.pub-plat { display: inline-flex; align-items: center; gap: 8px; color: var(--paper); font-weight: 510; }
.pub-icon { width: 24px; height: 24px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; color: var(--plat); background: var(--plat-bg); flex: none; }
.pub-icon svg { width: 14px; height: 14px; }
.pub-arrow { color: var(--ash); font-size: 11px; opacity: 0; transition: opacity .12s; }
.pub-plat:hover .pub-arrow { opacity: 1; }
.pub-views-n { color: var(--paper); font-weight: 590; }
.pub-empty { color: var(--smoke); }

/* select styled as a compact pill (banner set) */
.chip-select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  font-size: 12px; font-weight: 510; color: var(--mist); line-height: 1.4;
  padding: 3px 24px 3px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.04) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238a8f98' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 9px center / 9px 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.chip-select:hover { border-color: var(--smoke); color: var(--paper); }
.chip-select:focus { border-color: var(--mist); }
.chip-select.unset { color: var(--ash); border-style: dashed; }
.chip-select option { background: var(--obsidian); color: var(--mist); }
.pub-banner { margin: 0; }

.pub-views { margin: 0; display: inline-block; }
.pub-views input {
  width: 84px; font-size: 13px; font-weight: 590; color: var(--paper); text-align: right;
  padding: 3px 8px; border-radius: 6px; background: transparent; border: 1px dashed rgba(255, 255, 255, 0.12);
  font-variant-numeric: tabular-nums;
}
.pub-views input:hover { border-color: var(--smoke); }
.pub-views input:focus { border-style: solid; border-color: var(--mist); background: rgba(255, 255, 255, 0.03); }
.pub-views input::placeholder { font-weight: 400; }

.pub-status > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pub-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--fog); }
.pub-state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--dot, var(--ash)); flex: none; }
.pub-state.ok { --dot: var(--green); }
.pub-state.bad { --dot: var(--coral); color: var(--coral); cursor: help; }
.pub-state.wait { --dot: var(--teal); }
.pub-x { padding: 4px; border-radius: 6px; background: none; border-color: transparent; color: var(--ash); display: inline-flex; opacity: 0; transition: opacity .12s; }
.pub-x svg { width: 13px; height: 13px; }
.pubs-table tr:hover .pub-x, .pub-x:focus-visible { opacity: 1; }
.pub-x:hover { color: var(--coral); background: rgba(235, 87, 87, 0.1); border-color: transparent; }
@media (hover: none) { .pub-x, .pub-arrow { opacity: 1; } }

.pub-add { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; margin: 0; padding: 10px 12px 10px 14px; border-top: 1px solid var(--graphite); background: rgba(0, 0, 0, 0.12); }
.pub-add-field { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--ash); }
.pub-add-field svg { width: 15px; height: 15px; flex: none; }
.pub-add-field input { flex: 1; min-width: 0; background: transparent; border-color: transparent; padding: 6px 4px; }
.pub-add-field input:focus { background: transparent; border-color: transparent; }
.pub-add-field:focus-within { color: var(--mist); }
.pub-add .chip-select { padding-top: 5px; padding-bottom: 5px; }
@media (max-width: 640px) { .pub-add { grid-template-columns: 1fr auto; } .pub-add-field { grid-column: 1 / -1; } }
.pubs-mark { display: block; margin: 0; padding: 0 14px 10px; background: rgba(0, 0, 0, 0.12); width: 100%; text-align: left; font-size: 12px; }
button.pubs-mark { border: 0; border-radius: 0; color: var(--ash); }
button.pubs-mark:hover { color: var(--paper); background: rgba(0, 0, 0, 0.12); }
.pubs-mark button.link { padding: 0; }
/* overview: stats per banner set */
.banner-table td.num, .banner-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.banner-table .set-name { color: var(--paper); font-weight: 510; }
.banner-table .plat-split { color: var(--ash); font-size: 12px; }
.pub-tag { font-size: 11px; font-weight: 590; }
.pub-tag.pub-tiktok { color: #4fd8e8; }
.pub-tag.pub-instagram { color: #f472b6; }
.banner-scroll { overflow-x: auto; }

/* ---------- poster of a video whose file was deleted ---------- */
.poster { position: relative; margin: 0; aspect-ratio: 9 / 16; border-radius: 10px; overflow: hidden; box-shadow: var(--hair); background: var(--obsidian); }
.poster img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(0.85) brightness(0.8); }
.poster figcaption { position: absolute; inset: auto 0 0 0; padding: 28px 12px 12px; background: linear-gradient(transparent, rgba(8, 9, 10, 0.92)); color: var(--paper); font-size: 13px; font-weight: 510; display: flex; flex-direction: column; gap: 2px; }
.poster figcaption span { font-size: 11px; font-weight: 400; color: var(--fog); }
.vc-free { justify-content: center; }
