/* Clipper 2.0 design system: one accent, calm surfaces, clear status colours. Light + dark. */
:root {
  --accent: #6D4AFF; --accent-h: #5A3BE6; --accent-soft: #EFEBFF; --accent-ink: #4B2FD6;
  --good: #16A34A; --good-soft: #E8F7EE; --warn: #D97706; --warn-soft: #FEF3E2; --bad: #DC2626; --bad-soft: #FDECEC;
  --info: #2563EB; --info-soft: #E8F0FE;
  --bg: #F7F7FB; --surface: #FFFFFF; --surface-2: #F3F3F8; --border: #E6E6EF; --text: #14141F; --muted: #6B6B80;
  --shadow: 0 1px 2px rgba(20,20,40,.04), 0 2px 8px rgba(20,20,40,.04);
  --shadow-lg: 0 10px 40px rgba(20,20,40,.18);
  --r: 10px; --r-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --accent: #8B6FFF; --accent-h: #9D85FF; --accent-soft: #241D45; --accent-ink: #B9A8FF;
  --good: #34C46E; --good-soft: #10291A; --warn: #F0A030; --warn-soft: #2D2210; --bad: #F05252; --bad-soft: #301414;
  --info: #5B8DEF; --info-soft: #14213A;
  --bg: #0E0E14; --surface: #17171F; --surface-2: #1E1E28; --border: #262633; --text: #ECECF3; --muted: #9A9AB0;
  --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 10px 40px rgba(0,0,0,.6);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
body.noscroll { overflow: hidden; }
a { color: var(--accent-ink); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; } h2 { font-size: 18px; } h3 { font-size: 15px; font-weight: 650; }
p { margin: 0; }
.muted { color: var(--muted); } .sm { font-size: 12px; } .xs { font-size: 11px; } .num, .stat-value, .ring b { font-variant-numeric: tabular-nums; }
.good-t { color: var(--good); } .bad-t { color: var(--bad); } .warn-t { color: var(--warn); }
.icon { flex: none; vertical-align: -3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- layout / shell ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: 232px; flex: none; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px;
  padding: 18px 12px; background: var(--surface); border-right: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 10px 18px; font-weight: 750; font-size: 16px; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 9px; color: var(--muted); font-weight: 550; }
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.on { background: var(--accent-soft); color: var(--accent-ink); }
.nav-item .count { margin-left: auto; }
.side-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.me-chip { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 9px; }
.me-chip .who { min-width: 0; flex: 1; } .me-chip b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main { flex: 1; min-width: 0; }
.content { max-width: 1180px; margin: 0 auto; padding: 28px 32px 80px; }
.topbar, .tabbar { display: none; }
.offline { background: var(--warn-soft); color: var(--warn); text-align: center; padding: 6px; font-size: 13px; font-weight: 600; }

@media (max-width: 760px) {
  .side { display: none; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 5; padding: 10px 16px;
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
  .topbar .brand { padding: 0; font-size: 15px; } .topbar .grow { flex: 1; }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; bottom: 0; left: 0; right: 0; z-index: 6;
    background: var(--surface); border-top: 1px solid var(--border); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; color: var(--muted); font-size: 11px; font-weight: 600; position: relative; min-height: 48px; justify-content: center; }
  .tabbar a.on { color: var(--accent-ink); } .tabbar a:hover { text-decoration: none; }
  .tabbar .count { position: absolute; top: 2px; left: calc(50% + 6px); }
  .content { padding: 18px 14px 96px; }
  h1 { font-size: 21px; }
}

/* ---------- page parts ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; max-width: 680px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.stack { display: flex; flex-direction: column; gap: 14px; } .stack.tight { gap: 8px; } .stack.loose { gap: 22px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .row.end { justify-content: flex-end; } .row.between { justify-content: space-between; }
.row.nowrap { flex-wrap: nowrap; } .grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3, .split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .g2 { grid-template-columns: minmax(0, 1fr); } }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 10px; }
.section-title h2 { font-size: 16px; }
.hr { height: 1px; background: var(--border); margin: 4px 0; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; }
.card.pad { padding: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.card-head h3 { display: inline; }
.card.click:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.card.accent { background: linear-gradient(135deg, var(--accent) 0%, #8F6BFF 100%); border: 0; color: #fff; }
.card.accent .muted { color: rgba(255,255,255,.8); }

/* ---------- stats ---------- */
.stat { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); color: inherit; min-width: 0; }
a.stat:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.stat-top { display: flex; align-items: center; gap: 8px; }
.stat-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.stat-icon.accent { background: var(--accent-soft); color: var(--accent-ink); } .stat-icon.good { background: var(--good-soft); color: var(--good); }
.stat-icon.warn { background: var(--warn-soft); color: var(--warn); } .stat-icon.bad { background: var(--bad-soft); color: var(--bad); }
.stat-icon.info { background: var(--info-soft); color: var(--info); }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.stat-value { font-size: 28px; font-weight: 750; margin-top: 6px; letter-spacing: -.02em; line-height: 1.1; }
.stat-sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.bar { height: 6px; background: var(--surface-2); border-radius: 9px; overflow: hidden; margin-top: 10px; }
.bar.thin { height: 4px; margin-top: 6px; } .bar i { display: block; height: 100%; background: var(--accent); border-radius: 9px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: 600 14px var(--font); border-radius: var(--r-sm);
  padding: 0 16px; min-height: 40px; border: 1px solid transparent; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s;
  color: var(--text); background: var(--surface); border-color: var(--border); text-decoration: none !important; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); } .btn.primary:hover { background: var(--accent-h); }
.btn.good { background: var(--good); color: #fff; border-color: var(--good); } .btn.good:hover { filter: brightness(.95); }
.btn.danger { background: var(--surface); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); } .btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); } .btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.white { background: #fff; color: var(--accent-ink); border-color: #fff; }
.btn.sm { min-height: 32px; padding: 0 11px; font-size: 13px; } .btn.lg { min-height: 48px; padding: 0 22px; font-size: 15px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { all: unset; cursor: pointer; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.spin { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
.spin.dark { border-color: var(--border); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field-label { font-size: 12px; font-weight: 650; color: var(--muted); }
.field-help { font-size: 12px; color: var(--muted); } .field-error { font-size: 12px; color: var(--bad); }
input, select, textarea { font: 14px var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 9px 12px; width: 100%; min-height: 40px; transition: border-color .15s, box-shadow .15s; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); flex: none; margin: 0; }
textarea { min-height: 88px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.check-row { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.pin-input { font-size: 24px; letter-spacing: 10px; text-align: center; font-variant-numeric: tabular-nums; }
fieldset { border: 0; padding: 0; margin: 0; }
.form-section { padding: 18px 0; border-top: 1px solid var(--border); } .form-section:first-child { border-top: 0; padding-top: 0; }
.form-section > h3 { margin-bottom: 12px; }
.choice { display: flex; gap: 8px; flex-wrap: wrap; }
.choice label { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-weight: 600; min-height: 44px; }
.choice label.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; align-items: center; margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--border); }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; padding: 10px 12px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--text); text-decoration: none; }
.tabs .on { color: var(--accent-ink); border-bottom-color: var(--accent); }
.tabs-right { margin-left: auto; display: flex; gap: 8px; align-items: center; padding-left: 12px; }
.tabs-right select { min-height: 34px; padding: 5px 10px; width: auto; }

/* ---------- chips / counts ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--muted); white-space: nowrap; line-height: 18px; }
.chip.good { background: var(--good-soft); color: var(--good); } .chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.warn { background: var(--warn-soft); color: var(--warn); } .chip.info { background: var(--info-soft); color: var(--info); }
.chip.accent { background: var(--accent-soft); color: var(--accent-ink); }
.chip.tag { background: var(--surface-2); color: var(--text); font-weight: 500; }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: var(--accent); color: #fff; }
.count.muted { background: var(--surface-2); color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.appicon { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; font-size: 11px; color: #fff; background: #111; flex: none; }
.appicon.instagram { background: linear-gradient(45deg, #F58529, #DD2A7B, #8134AF); } .appicon.youtube { background: #FF0033; } .appicon.facebook { background: #0866FF; font-weight: 800; }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-top: 1px solid var(--border); min-width: 0; }
.list-row:first-child { border-top: 0; }
.list-row .main-col { flex: 1; min-width: 0; }
.list-row .title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; }
.list-row.click { cursor: pointer; border-radius: 8px; } .list-row.click:hover { background: var(--surface-2); }
.kv { display: flex; gap: 18px; flex-wrap: wrap; } .kv div { font-size: 12px; color: var(--muted); } .kv b { display: block; font-size: 15px; color: var(--text); }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl-wrap { overflow-x: auto; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px 18px; margin: 0; }
.facts dt { font-size: 11px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.facts dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.log { font-size: 13px; } .log td { padding: 6px 10px; } .log .lv-error td { color: var(--bad); } .log .lv-warn td { color: var(--warn); }

/* ---------- empty / skeleton ---------- */
.empty { text-align: center; padding: 42px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-icon { width: 54px; height: 54px; border-radius: 16px; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; margin-bottom: 4px; }
.empty p { max-width: 420px; } .empty .btn { margin-top: 8px; }
.skel-wrap { display: flex; flex-direction: column; gap: 12px; }
.skel { border-radius: var(--r); background: linear-gradient(90deg, var(--surface-2) 0%, var(--border) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- score ring / checks / points ---------- */
.ring { position: relative; flex: none; } .ring svg { width: 100%; height: 100%; }
.ring circle { fill: none; stroke-width: 6; } .ring .track { stroke: var(--surface-2); } .ring .val { stroke-linecap: round; transition: stroke-dasharray .4s; }
.ring.good .val { stroke: var(--good); } .ring.warn .val { stroke: var(--warn); } .ring.bad .val { stroke: var(--bad); } .ring.muted .val { stroke: var(--muted); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 18px; font-weight: 750; }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.checks li { display: flex; gap: 10px; align-items: flex-start; }
.checks .mark { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; flex: none; margin-top: 1px; }
.checks .yes .mark { background: var(--good-soft); color: var(--good); } .checks .no .mark { background: var(--bad-soft); color: var(--bad); }
.checks .maybe .mark { background: var(--warn-soft); color: var(--warn); }
.points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.pl-top { display: flex; justify-content: space-between; font-weight: 600; }

/* ---------- clip cards ---------- */
.clip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.clip { display: flex; flex-direction: column; overflow: hidden; }
.clip video { width: 100%; aspect-ratio: 9 / 16; max-height: 64vh; background: #000; display: block; object-fit: contain; }
.clip .clip-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.clip .clip-title { font-weight: 700; font-size: 15px; line-height: 1.3; }
.clip .ai { background: var(--accent-soft); border-radius: 8px; padding: 8px 10px; font-size: 13px; color: var(--text); }
.clip .ai b { color: var(--accent-ink); }
.clip .hype { color: var(--warn); font-size: 13px; font-weight: 600; }
.clip .quote { font-size: 12px; color: var(--muted); font-style: italic; }
.clip .clip-actions { display: flex; gap: 8px; padding: 0 16px 16px; flex-wrap: wrap; } .clip .clip-actions .btn { flex: 1; min-height: 44px; }
.post-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.post-row input { min-height: 36px; padding: 6px 10px; flex: 1; min-width: 160px; }
.countdown { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; font-size: 13px; padding: 3px 10px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.countdown.good { background: var(--good-soft); color: var(--good); } .countdown.warn { background: var(--warn-soft); color: var(--warn); } .countdown.bad { background: var(--bad-soft); color: var(--bad); }

/* ---------- scorer ---------- */
.drop { border: 2px dashed color-mix(in srgb, var(--accent) 35%, var(--border)); border-radius: 14px; padding: 18px; background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop textarea { background: var(--surface); min-height: 96px; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; } .thumbs div { position: relative; } .thumbs img { width: 76px; height: 76px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.thumbs button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--text); color: var(--surface); cursor: pointer; font-size: 12px; }
.cand { display: flex; gap: 16px; align-items: flex-start; }
.cand .cand-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.cand-money { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; } .cand-money b { font-size: 15px; }
.suggest { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }

/* ---------- campaign cards (members) ---------- */
.scroller { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 320px); gap: 14px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.scroller > * { scroll-snap-align: start; }
.copyrow { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); }
.copyrow > div { flex: 1; min-width: 0; } .copyval { font-weight: 600; overflow-wrap: anywhere; }
.rules { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }

/* ---------- home ---------- */
.hello { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.big-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.big-action { display: flex; flex-direction: column; gap: 4px; padding: 18px; border-radius: 14px; color: inherit; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); min-height: 120px; }
.big-action:hover { text-decoration: none; border-color: var(--accent); }
.big-action .n { font-size: 38px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.big-action.hot { background: var(--accent); border-color: var(--accent); color: #fff; } .big-action.hot .muted { color: rgba(255,255,255,.85); }
.need { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--border); color: inherit; }
.need:first-child { border-top: 0; } a.need:hover { text-decoration: none; background: var(--surface-2); border-radius: 8px; }
.need .dot { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.dot.accent { background: var(--accent-soft); color: var(--accent-ink); } .dot.warn { background: var(--warn-soft); color: var(--warn); }
.dot.bad { background: var(--bad-soft); color: var(--bad); } .dot.good { background: var(--good-soft); color: var(--good); } .dot.info { background: var(--info-soft); color: var(--info); }
.tip { display: flex; gap: 12px; align-items: flex-start; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); display: inline-block; box-shadow: 0 0 0 0 rgba(220,38,38,.5); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(220,38,38,0); } 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0); } }

/* ---------- avatar ---------- */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; font-weight: 750; flex: none; }
:root[data-theme="dark"] .avatar { filter: saturate(.8) brightness(.9); }

/* ---------- sheets / toasts ---------- */
.sheet-back { position: fixed; inset: 0; background: rgba(15,15,30,.42); z-index: 40; display: grid; place-items: center; padding: 20px; animation: fade .15s; }
.sheet { background: var(--surface); border-radius: 16px; width: min(520px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: rise .18s ease; }
.sheet.wide { width: min(760px, 100%); }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 6px; }
.sheet-body { padding: 10px 20px 20px; overflow-y: auto; }
.sheet-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 760px) {
  .sheet-back { place-items: end stretch; padding: 0; }
  .sheet, .sheet.wide { width: 100%; border-radius: 18px 18px 0 0; max-height: 92vh; padding-bottom: env(safe-area-inset-bottom); }
}
@keyframes fade { from { opacity: 0; } } @keyframes rise { from { transform: translateY(16px); opacity: 0; } }
#toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 460px); }
.toast { background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 13px; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; white-space: pre-line; text-align: center; }
.toast.in { opacity: 1; transform: none; } .toast.good { background: var(--good); color: #fff; } .toast.bad { background: var(--bad); color: #fff; }
@media (max-width: 760px) { #toasts { bottom: 84px; } }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 600px at 10% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.auth-card { width: min(400px, 100%); }
.auth-card .brand { justify-content: center; padding-bottom: 8px; font-size: 18px; }
.auth-card h1 { text-align: center; font-size: 22px; } .auth-card .lead { text-align: center; margin: 6px 0 20px; }
.notice { padding: 10px 12px; border-radius: 10px; background: var(--info-soft); color: var(--info); font-size: 13px; }
.notice.warn { background: var(--warn-soft); color: var(--warn); } .notice.bad { background: var(--bad-soft); color: var(--bad); } .notice.good { background: var(--good-soft); color: var(--good); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }
.setup-code { font-family: ui-monospace, Menlo, monospace; font-size: 22px; font-weight: 700; letter-spacing: 3px; text-align: center; padding: 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); }
.hide-phone { } @media (max-width: 760px) { .hide-phone { display: none !important; } }
.only-phone { display: none; } @media (max-width: 760px) { .only-phone { display: initial; } }
.need-dot { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.list-row.on { background: var(--accent-soft); border-radius: 8px; }
details > summary { cursor: pointer; list-style: none; } details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸ "; color: var(--muted); } details[open] > summary::before { content: "▾ "; }

/* ---------- clip editor ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .editor { grid-template-columns: minmax(0, 1fr); } }
.ed-player { overflow: hidden; }
.ed-player video { display: block; width: 100%; max-height: 56vh; background: #000; object-fit: contain; }
.ed-bar { position: relative; height: 34px; margin: 12px 14px 6px; border-radius: 8px; background: var(--surface-2); cursor: pointer; touch-action: manipulation; }
.ed-sel { position: absolute; top: 0; bottom: 0; background: var(--accent-soft); border: 2px solid var(--accent); border-radius: 8px; }
.ed-peak { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1px; background: var(--warn); border-radius: 2px; }
.ed-head { position: absolute; top: -6px; bottom: -6px; width: 2px; margin-left: -1px; background: var(--text); pointer-events: none; }
.ed-read { display: flex; justify-content: space-between; padding: 0 14px; font-size: 13px; color: var(--muted); }
.ed-read b { color: var(--text); font-variant-numeric: tabular-nums; }
.ed-controls { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 14px; flex-wrap: wrap; }
.ed-nudge { display: flex; align-items: center; gap: 4px; }
.ed-nudge .icon-btn { font-size: 18px; font-weight: 700; width: 36px; height: 36px; }
.ed-line { display: flex; gap: 8px; align-items: center; }
.ed-time { flex: none; font: 600 12px ui-monospace, Menlo, monospace; color: var(--accent-ink); background: var(--accent-soft); border: 0; border-radius: 6px; padding: 6px 8px; cursor: pointer; min-height: 36px; }
.ed-result { display: block; width: 100%; max-height: 60vh; margin-top: 12px; border-radius: 10px; background: #000; }

/* ---------- studio ---------- */
.studio-new { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .studio-new { grid-template-columns: minmax(0, 1fr); } }
.chip.pick { border: 1px solid var(--border); background: var(--surface); cursor: pointer; padding: 6px 12px; font-size: 13px; min-height: 34px; }
.chip.pick.accent { border-color: var(--accent); background: var(--accent-soft); }
.pickrow { cursor: pointer; align-items: center; } .pickrow input[type=checkbox] { width: 20px; height: 20px; flex: none; }
.pickrow.off { opacity: .55; cursor: default; }
.facts-row { display: flex; gap: 22px; margin: 12px 0 6px; flex-wrap: wrap; }
.facts-row > div { display: flex; flex-direction: column; } .facts-row b { font-size: 18px; }
.studio-bar { position: sticky; bottom: 0; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 12px 0;
  background: linear-gradient(transparent, var(--bg) 30%); z-index: 3; }
@media (max-width: 760px) { .studio-bar { bottom: 64px; } }
.seg { padding: 14px 16px; }
.seg-head { display: flex; gap: 12px; align-items: center; }
.seg-rank { flex: none; min-width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 16px;
  background: var(--bad); color: #fff; }
.seg-vo { margin: 8px 0 0 54px; color: var(--muted); font-style: italic; }
@media (max-width: 760px) { .seg-vo { margin-left: 0; } }
.seg-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; margin-top: 14px; }
.seg-body video { width: 100%; border-radius: 10px; background: #000; max-height: 320px; }
@media (max-width: 900px) { .seg-body { grid-template-columns: minmax(0, 1fr); } }
.icon .flip, svg.flip { transform: rotate(180deg); }
.studio-result video { width: 100%; border-radius: 10px; background: #000; max-height: 70vh; }
.studio-result video.vertical { max-height: 72vh; aspect-ratio: 9/16; width: auto; max-width: 100%; margin: 0 auto; display: block; }
.desc { white-space: pre-wrap; font: 13px/1.5 inherit; font-family: inherit; background: var(--surface-2); padding: 10px 12px; border-radius: 10px; max-height: 220px; overflow: auto; margin: 6px 0 8px; }
.thumb-prev { width: 100%; max-width: 360px; border-radius: 10px; border: 1px solid var(--border); }
.sm-choice label { padding: 6px 10px; min-height: 36px; font-size: 13px; }

/* page picker in "I'm posting now" */
.page-pick { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; min-height: 48px; }
.page-pick.on { border-color: var(--accent); background: var(--accent-soft); }
.page-pick.off { opacity: .6; cursor: not-allowed; }
.page-pick .grow { min-width: 0; }

.code { background: var(--bg-soft, rgba(127,127,127,.12)); padding: 10px 12px; border-radius: 8px; font-family: ui-monospace, Menlo, monospace; overflow-x: auto; }

.mini-select { width: auto; min-height: 26px; padding: 2px 6px; font-size: 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.mini-select.warn { background: var(--warn-soft, rgba(255,170,0,.15)); color: var(--warn); }

/* account screens (Step B3) */
.auth-card .center, .center { text-align: center; }
.btn.google { display: flex; align-items: center; justify-content: center; gap: 10px; background: #fff; color: #1f1f1f; border: 1px solid #dadce0; font-weight: 600; }
[data-theme="dark"] .btn.google { background: #131314; color: #e3e3e3; border-color: #8e918f; }
.or { display: flex; align-items: center; gap: 10px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.ws-switch { display: flex; flex-direction: column; gap: 4px; padding: 0 8px 8px; }
.ws-switch select { width: 100%; }

/* the running version (clipper/version.py), bottom left */
.version { font-size: 11px; color: var(--muted); padding: 6px 8px 0; font-variant-numeric: tabular-nums; user-select: all; }
.version.fixed { position: fixed; left: 12px; bottom: 10px; padding: 0; opacity: .8; }
.phone-only { display: none; text-align: center; }
@media (max-width: 760px) { .phone-only { display: block; } }

/* Ops › Server logs */
.logbox { margin-top: 12px; max-height: 60vh; overflow: auto; background: var(--bg, #0b0b10); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.logline { white-space: pre-wrap; word-break: break-word; }
.logline.bad-t { color: var(--bad); } .logline.warn-t { color: var(--warn); }
