/* Launchpad. Calm by default: stages in plain words with progress dots (grey -> blue -> green), red only for warnings. */
:root {
  --bg: #f1f2f6; --surface: #ffffff; --surface-2: #f5f6fa;
  --ink: #161b2e; --ink-2: #3a4258; --muted: #646c82;
  --line: #dadde7; --line-strong: #bfc4d3;
  --accent: #2f4bb3; --accent-ink: #ffffff; --accent-soft: #e2e7fa;
  --s1: #a7adbd; --s1r: #8f9fc9; --s2: #6f8fd8; --s3: #3d63c9; --s4: #2f4bb3; --s5: #1d7446;
  --good: #1d7446; --good-bg: #e0f1e6;
  --warn: #8d5600; --warn-bg: #f8ecd6;
  --bad: #b3261e; --bad-bg: #fbe4e1;
  --shadow: 0 1px 2px rgba(22, 27, 46, .05), 0 6px 20px rgba(22, 27, 46, .05);
  --body: "Source Sans 3", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --r: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1018; --surface: #151a26; --surface-2: #1b2130; --ink: #e6e9f2; --ink-2: #c0c6d6; --muted: #8e96ab;
    --line: #262d3f; --line-strong: #3a4359; --accent: #8fa6ff; --accent-ink: #0d1330; --accent-soft: #1f2a50;
    --s1: #5a6276; --s1r: #56638a; --s2: #5b77c0; --s3: #7290e6; --s4: #8fa6ff; --s5: #6fd39a;
    --good: #6fd39a; --good-bg: #13301f; --warn: #f2b64f; --warn-bg: #33270f; --bad: #ff8a7e; --bad-bg: #3a1a17;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1018; --surface: #151a26; --surface-2: #1b2130; --ink: #e6e9f2; --ink-2: #c0c6d6; --muted: #8e96ab;
  --line: #262d3f; --line-strong: #3a4359; --accent: #8fa6ff; --accent-ink: #0d1330; --accent-soft: #1f2a50;
  --s1: #5a6276; --s1r: #56638a; --s2: #5b77c0; --s3: #7290e6; --s4: #8fa6ff; --s5: #6fd39a;
  --good: #6fd39a; --good-bg: #13301f; --warn: #f2b64f; --warn-bg: #33270f; --bad: #ff8a7e; --bad-bg: #3a1a17;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--body); }
h1, h2 { margin: 0; text-wrap: balance; letter-spacing: -.005em; }
h1 { font-size: clamp(24px, 4vw, 32px); font-weight: 700; line-height: 1.15; }
h2 { font-size: 18px; font-weight: 700; }
p { margin: 0; }
a { color: var(--accent); }
img { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
code, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { font-size: .95em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.err { color: var(--bad); font-weight: 600; }
.eyebrow { font: 600 11.5px/1.2 var(--body); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.d { display: block; }

/* Header */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-in { max-width: 1100px; margin: 0 auto; padding: 10px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.brand { font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand .mark { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); display: inline-block; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { padding: 6px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 600; }
.nav a:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.sync { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.sync form { margin: 0; }
.out { margin: 0; }
.banner { padding: 10px 0; }
.wrap-in { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.err-bg { background: var(--bad-bg); color: var(--bad); }
.good-bg { background: var(--good-bg); color: var(--good); border-radius: var(--r); margin-bottom: 16px; }

/* Layout */
.wrap { max-width: 1100px; margin: 0 auto; padding: 20px 16px 48px; display: flex; flex-direction: column; gap: 18px; }
.intro { display: flex; flex-direction: column; gap: 4px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.card h2 { margin-bottom: 8px; }
.card.slim { padding: 10px 14px; }
.calm p { color: var(--good); font-weight: 600; }
.crumb { margin-bottom: -8px; }
.foot { margin-top: 4px; }

/* Buttons and tags */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover { background: var(--surface-2); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.good { background: var(--good); border-color: var(--good); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn[disabled] { opacity: .55; cursor: default; }
form.inline { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line);
  color: var(--ink-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag.good { background: var(--good-bg); border-color: transparent; color: var(--good); }
.tag.warn { background: var(--warn-bg); border-color: transparent; color: var(--warn); }
.tag.bad { background: var(--bad-bg); border-color: transparent; color: var(--bad); }

/* Stage strip */
.pipe { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.pipe-step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; position: relative;
  display: flex; flex-direction: column; gap: 2px; border-top: 4px solid var(--s1); }
.pipe-step .n { font-size: 22px; font-weight: 500; line-height: 1.1; }
.pipe-step .lbl { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.pipe-step.empty .n, .pipe-step.empty .lbl { color: var(--muted); font-weight: 400; }
.pipe-step.s-warming { border-top-color: var(--s1); }
.pipe-step.s-ready { border-top-color: var(--s1r); }
.pipe-step.s-test1 { border-top-color: var(--s2); }
.pipe-step.s-test2 { border-top-color: var(--s3); }
.pipe-step.s-decide { border-top-color: var(--s4); }
.pipe-step.s-keep { border-top-color: var(--s5); }
@media (max-width: 860px) { .pipe { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Progress dots */
.dots { display: inline-flex; gap: 3px; vertical-align: middle; margin-right: 6px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); display: inline-block; }
.dots.s-setup i.on, .dots.s-warming i.on { background: var(--s1); }
.dots.s-ready i.on { background: var(--s1r); }
.dots.s-test1 i.on { background: var(--s2); }
.dots.s-test2 i.on { background: var(--s3); }
.dots.s-decide i.on { background: var(--s4); }
.dots.s-keep i.on { background: var(--s5); }

/* Needs you */
.needs { border-left: 4px solid var(--bad); }
.need-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.need { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.need-who { font-weight: 700; color: var(--ink); }
.need-what { color: var(--ink-2); }
.need-what.k-proxy, .need-what.k-setup, .need-what.k-youtube { color: var(--bad); }
.need-what.k-quiet { color: var(--warn); }
.need-what.k-decide { color: var(--accent); font-weight: 600; }
.need .need-what + .need-what::before { content: "· "; color: var(--muted); }

/* Channel rows */
.group { display: flex; flex-direction: column; gap: 8px; }
.group h2 { display: flex; align-items: baseline; gap: 8px; }
.group-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.count { font-size: 13px; color: var(--muted); font-weight: 500; }
.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.row { display: grid; grid-template-columns: 40px minmax(150px, 1.6fr) minmax(120px, 1fr) minmax(110px, 1fr) minmax(130px, 1.2fr) 100px;
  align-items: center; gap: 6px 14px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); color: var(--ink); text-decoration: none; }
a.row:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.row.has-warn { border-left: 3px solid var(--bad); }
.av { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--surface-2); }
.av-ph { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: var(--muted); border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--line); }
.who { display: flex; flex-direction: column; min-width: 0; }
.nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage { display: flex; align-items: center; white-space: nowrap; }
.vids, .px { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.px > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.px .tag, .vids .tag { align-self: flex-start; }
.trust .tag { font-weight: 600; }
.warns { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.w { color: var(--bad); font-size: 13px; font-weight: 600; }
.w.k-decide { color: var(--accent); }
.w.k-quiet { color: var(--warn); }
.stopped-group summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; list-style: none; }
.stopped-group summary::-webkit-details-marker { display: none; }
.stopped-group summary h2::before { content: "▸ "; color: var(--muted); }
.stopped-group[open] summary h2::before { content: "▾ "; }
.stopped-group .rows { margin-top: 8px; opacity: .8; }
@media (max-width: 820px) {
  .row { grid-template-columns: 40px 1fr auto; }
  .row .stage { grid-column: 3; grid-row: 1; }
  .row .vids, .row .px, .row .trust { grid-column: 2 / -1; }
  .row .vids { flex-direction: row; flex-wrap: wrap; gap: 0 8px; align-items: baseline; }
  .row .px { flex-direction: row; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
  .row .trust:empty { display: none; }
}

/* Channel page */
.ch-head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.ch-head .av { width: 64px; height: 64px; font-size: 24px; }
.ch-title { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ch-stage { display: flex; align-items: center; gap: 4px; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 2fr); gap: 8px; }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fact .big { font-size: 20px; font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 820px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fact.wide { grid-column: 1 / -1; } }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.two > div { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.two h2 { margin: 0; }
@media (max-width: 720px) { .two { grid-template-columns: 1fr; } }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.vid-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.vid-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.vid-list li a { color: var(--ink); text-decoration: none; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.vid-list li a:hover { color: var(--accent); }

/* Proxies */
.add label { display: block; font-weight: 600; margin-bottom: 6px; }
.add textarea { width: 100%; padding: 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-2);
  font: 13px/1.5 var(--mono); resize: vertical; }
.fields { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 12px 0 14px; }
.fields label { font-weight: 400; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 0; }
.fields input:not([type=checkbox]) { padding: 5px 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); }
.fields input[name=provider], .fields input[name=name_base] { width: 120px; }
.fields input[name=cycle_days] { width: 52px; text-align: center; }
.prow { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(150px, 1.1fr) minmax(130px, 1.4fr) minmax(150px, 1.4fr) 110px auto; }
.prow.free { border-style: dashed; }
.prow .users a { color: var(--ink); font-weight: 600; }
.chk, .users { display: block; min-width: 0; overflow-wrap: anywhere; }
.acts { display: flex; align-items: center; gap: 4px; justify-content: flex-end; position: relative; }
.edit summary { list-style: none; }
.edit summary::-webkit-details-marker { display: none; }
.edit[open] form { position: absolute; right: 0; top: 34px; z-index: 3; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r); padding: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; width: 240px; }
.edit form label { display: flex; flex-direction: column; font-size: 13px; gap: 2px; }
.edit form input { padding: 5px 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); }
@media (max-width: 820px) {
  .prow { grid-template-columns: 1fr auto; }
  .prow > .addr, .prow > .users, .prow > .chk, .prow > .renew { grid-column: 1 / -1; }
  .prow > .acts { grid-column: 2; grid-row: 1; }
}
.slim form span { margin-right: 4px; }
.slim input { padding: 4px 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); }
.log summary { cursor: pointer; list-style: none; }
.log summary::-webkit-details-marker { display: none; }
.log ul { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.log .lv-warn { color: var(--warn); }
.log .lv-error { color: var(--bad); }

/* Preview */
.lead { font-size: 17px; margin: 6px 0 4px; }
.tbl { width: 100%; border-collapse: collapse; margin: 12px 0 16px; }
.tbl th, .tbl td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.tbl th { font-weight: 600; color: var(--muted); }
.tbl tr.st-exists td, .tbl tr.st-repeat td { color: var(--muted); }
.confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
@media (max-width: 560px) { .tbl th:nth-child(3), .tbl td:nth-child(3) { display: none; } }

/* Login and messages */
.login { max-width: 380px; margin: 60px auto; display: flex; flex-direction: column; gap: 12px; }
.login form { display: flex; flex-direction: column; gap: 10px; }
.login input { padding: 9px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-2); }
.msg { display: flex; flex-direction: column; gap: 12px; max-width: 640px; }
