/* ==========================================================================
   Tokens
   ========================================================================== */
:root {
  --bg: #0b0b12;
  --bg-elev: #12121c;
  --surface: #161622;
  --surface-2: #1d1d2c;
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .14);
  --text: #ececf4;
  --text-muted: #9a9ab0;
  --text-faint: #6b6b82;

  --accent: #7c5cff;
  --accent-2: #ff5c8a;
  --accent-soft: rgba(124, 92, 255, .14);
  --gradient: linear-gradient(135deg, #7c5cff 0%, #b45cff 50%, #ff5c8a 100%);

  --success: #2ecc8f;
  --success-soft: rgba(46, 204, 143, .13);
  --warning: #f5b14c;
  --warning-soft: rgba(245, 177, 76, .13);
  --danger: #ff5d6c;
  --danger-soft: rgba(255, 93, 108, .13);
  --info: #4cb4ff;
  --info-soft: rgba(76, 180, 255, .13);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 10px 30px -12px rgba(0, 0, 0, .6);
  --ring: 0 0 0 3px rgba(124, 92, 255, .35);

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Manrope', var(--font);
  --sidebar-w: 256px;

  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f6fb;
    --bg-elev: #ffffff;
    --surface: #ffffff;
    --surface-2: #f1f1f8;
    --border: rgba(20, 20, 50, .09);
    --border-strong: rgba(20, 20, 50, .16);
    --text: #15151f;
    --text-muted: #5f5f75;
    --text-faint: #8e8ea3;
    --accent-soft: rgba(124, 92, 255, .1);
    --shadow: 0 1px 2px rgba(20, 20, 50, .04), 0 8px 24px -12px rgba(20, 20, 50, .15);
    color-scheme: light;
  }
}

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; margin: 0; letter-spacing: -.02em; }
p { margin: 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.gradient-text { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-lg { width: 22px; height: 22px; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface-2); color: var(--text);
  font: 600 14px/1 var(--font); cursor: pointer; white-space: nowrap;
  transition: transform .12s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease, opacity .15s;
}
.btn:hover { border-color: var(--text-faint); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }
.btn.is-loading .icon { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-primary {
  background: var(--gradient); border-color: transparent; color: #fff;
  box-shadow: 0 8px 24px -10px rgba(124, 92, 255, .8);
}
.btn-primary:hover { border-color: transparent; filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }
.btn-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: transparent; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 50px; padding: 0 24px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; padding: 0; }

/* ==========================================================================
   Badges / pills
   ========================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--text-muted);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.no-dot::before { display: none; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-pulse::before { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 999px; font-size: 12.5px; color: var(--text-muted);
}

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.card-body { padding: 24px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 24px; border-bottom: 1px solid var(--border);
}
.card-header h2, .card-header h3 { font-size: 16px; }
.card-header p { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 12px; justify-content: flex-end; }

/* ==========================================================================
   Forms
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field-label { font-size: 13px; font-weight: 600; color: var(--text); }
.field .help { font-size: 12.5px; color: var(--text-faint); }
.field .errorlist, .errorlist { list-style: none; margin: 0; padding: 0; color: var(--danger); font-size: 12.5px; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }

input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], select, textarea {
  width: 100%; min-height: 42px; padding: 10px 12px;
  background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 10px;
  font: 14px/1.4 var(--font);
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 64px; }
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
select {
  appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%239a9ab0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
input[type=color] {
  width: 56px; height: 42px; padding: 4px; border: 1px solid var(--border-strong);
  border-radius: 10px; background: var(--bg-elev); cursor: pointer;
}
input[type=file] { font: 13px var(--font); color: var(--text-muted); }
input[type=file]::file-selector-button {
  margin-right: 12px; height: 34px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font: 600 13px var(--font); cursor: pointer;
}
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

.range-row { display: flex; align-items: center; gap: 12px; }
.range-row output { min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }

.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { margin-top: 2px; }

/* Toggle switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 14px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 40px; height: 24px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--border-strong); position: relative; transition: background .2s;
}
.switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--text-muted); transition: transform .2s, background .2s;
}
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); background: #fff; }
.switch input:focus-visible + .track { box-shadow: var(--ring); }

/* Radio cards */
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.radio-cards label { display: block; cursor: pointer; }
.radio-cards input { position: absolute; opacity: 0; }
.radio-card {
  display: flex; align-items: center; gap: 12px; padding: 16px;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--bg-elev);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.radio-cards input:checked + .radio-card { border-color: var(--accent); box-shadow: var(--ring); background: var(--accent-soft); }
.radio-cards input:focus-visible + .radio-card { box-shadow: var(--ring); }
.radio-card strong { display: block; font-size: 15px; }
.radio-card small { color: var(--text-muted); font-size: 12.5px; }

.form-grid { display: grid; gap: 18px; }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-actions { display: flex; gap: 12px; align-items: center; justify-content: flex-end; }

/* ==========================================================================
   Tables
   ========================================================================== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-faint); padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .w-check { width: 44px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.td-title { width: 100%; max-width: 0; }
.video-title { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.video-title:hover { color: var(--accent); }
details.error-details summary { cursor: pointer; color: var(--danger); font-size: 12.5px; list-style: none; }
details.error-details summary::-webkit-details-marker { display: none; }
details.error-details pre {
  white-space: pre-wrap; word-break: break-word; max-width: 420px; margin: 8px 0 0;
  padding: 10px; border-radius: 8px; background: var(--danger-soft); color: var(--text); font-size: 12px;
}

/* ==========================================================================
   Messages
   ========================================================================== */
.messages { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.message {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface);
  font-size: 14px; animation: slide-in .25s ease;
}
.message .icon { margin-top: 1px; }
.message.success { border-color: rgba(46, 204, 143, .35); background: var(--success-soft); }
.message.success .icon { color: var(--success); }
.message.error { border-color: rgba(255, 93, 108, .35); background: var(--danger-soft); }
.message.error .icon { color: var(--danger); }
.message.warning { border-color: rgba(245, 177, 76, .35); background: var(--warning-soft); }
.message.warning .icon { color: var(--warning); }
.message.info { border-color: rgba(76, 180, 255, .35); background: var(--info-soft); }
.message.info .icon { color: var(--info); }
.message-close { margin-left: auto; background: none; border: 0; color: var(--text-muted); cursor: pointer; padding: 0; }
@keyframes slide-in { from { opacity: 0; transform: translateY(-6px); } }

/* ==========================================================================
   App shell
   ========================================================================== */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.scrim { display: none; }
.content { min-width: 0; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 8px;
  padding: 20px 14px; background: var(--bg-elev); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; font: 800 19px var(--font-display); letter-spacing: -.02em; }
.brand-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px;
  background: var(--gradient); color: #fff; box-shadow: 0 6px 18px -6px rgba(124, 92, 255, .9);
}
.brand-mark .icon { width: 18px; height: 18px; stroke-width: 2.2; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { padding: 14px 12px 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); }
.nav a {
  display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px;
  border-radius: 10px; color: var(--text-muted); font-weight: 500; font-size: 14px;
  transition: background .12s, color .12s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--text); }
.nav a.active .icon { color: var(--accent); }
.nav .count { margin-left: auto; font-size: 12px; color: var(--text-faint); }

.usage-card {
  margin-top: auto; padding: 16px; border-radius: var(--radius); border: 1px solid var(--border);
  background: linear-gradient(160deg, rgba(124, 92, 255, .12), rgba(255, 92, 138, .06) 70%), var(--surface);
}
.usage-card .row { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; }
.usage-card .plan-name { font-weight: 700; font-size: 14px; }
.progress { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 10px 0 12px; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--gradient); transition: width .4s ease; }
.progress.is-full > span { background: var(--warning); }

.user-menu {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius);
  border: 1px solid var(--border);
}
.avatar {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%;
  background: var(--gradient); color: #fff; font-weight: 700; font-size: 14px; text-transform: uppercase;
}
.user-menu .who { min-width: 0; flex: 1; }
.user-menu .who strong { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu .who span { font-size: 12px; color: var(--text-faint); }

.main { min-width: 0; padding: 32px 40px 64px; }
.topbar-mobile { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; }
.page-head p { color: var(--text-muted); margin-top: 6px; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 13.5px; margin-bottom: 12px; }
.back-link:hover { color: var(--text); }

.stack { display: flex; flex-direction: column; gap: 24px; }
.grid { display: grid; gap: 20px; }
.grid > * { min-width: 0; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }

/* Stat tiles */
.stat { padding: 20px; }
.stat .label { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 13px; font-weight: 500; }
.stat .label .icon { width: 16px; height: 16px; }
.stat .value { font: 800 30px/1.1 var(--font-display); margin-top: 10px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 16px; color: var(--text-faint); font-weight: 600; }
.stat-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; }
.stat-icon.accent { background: var(--accent-soft); color: var(--accent); }
.stat-icon.success { background: var(--success-soft); color: var(--success); }
.stat-icon.warning { background: var(--warning-soft); color: var(--warning); }
.stat-icon.danger { background: var(--danger-soft); color: var(--danger); }

/* Channel cards */
.channel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; }
.channel-card { display: flex; flex-direction: column; padding: 20px; gap: 16px; transition: transform .15s ease, border-color .15s ease; }
.channel-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.channel-card .top { display: flex; align-items: flex-start; gap: 12px; }
.channel-card h3 { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-card .meta { font-size: 12.5px; color: var(--text-faint); margin-top: 2px; }
.channel-card .numbers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px; border-radius: var(--radius); background: var(--surface-2); }
.channel-card .numbers div { text-align: center; }
.channel-card .numbers strong { display: block; font: 700 18px var(--font-display); font-variant-numeric: tabular-nums; }
.channel-card .numbers span { font-size: 11.5px; color: var(--text-muted); }
.channel-card .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }

.platform-icon {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; color: #fff;
}
.platform-icon svg { width: 20px; height: 20px; }
.platform-0 { background: linear-gradient(135deg, #ff3b3b, #d60000); }
.platform-1 { background: linear-gradient(135deg, #25f4ee 0%, #111 45%, #111 55%, #fe2c55 100%); }
.platform-2 { background: linear-gradient(135deg, #feda75, #d62976 50%, #4f5bd5); }

.add-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 220px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg);
  color: var(--text-muted); font-weight: 600; transition: border-color .15s, color .15s, background .15s;
}
.add-card:hover { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.add-card .plus { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2); }
.add-card.locked { cursor: pointer; }

/* Empty state */
.empty { text-align: center; padding: 56px 24px; }
.empty .art {
  display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 20px;
  background: var(--accent-soft); color: var(--accent);
}
.empty .art .icon { width: 28px; height: 28px; }
.empty h3 { font-size: 18px; margin-bottom: 6px; }
.empty p { color: var(--text-muted); max-width: 420px; margin: 0 auto 20px; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--border); font-size: 14px; }
.list li:last-child { border-bottom: 0; }
.time-pill {
  display: inline-grid; place-items: center; min-width: 58px; height: 30px; padding: 0 10px; border-radius: 8px;
  background: var(--surface-2); font-weight: 700; font-variant-numeric: tabular-nums; font-size: 13.5px;
}

/* Tabs / filter pills */
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); overflow-x: auto; }
.tabs a { padding: 7px 14px; border-radius: 9px; font-size: 13.5px; font-weight: 500; color: var(--text-muted); white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.toolbar .bulk { display: flex; gap: 8px; align-items: center; }

.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; padding: 16px; font-size: 13px; color: var(--text-muted); }

/* Formset rows */
.formset-row {
  display: grid; gap: 14px; align-items: end; padding: 16px 24px; border-bottom: 1px solid var(--border);
}
.formset-row.sources { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.4fr) 130px auto 40px; }
.deep-scan { align-items: center; height: 42px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.deep-scan input { margin-top: 0; }
.formset-row.schedule { grid-template-columns: minmax(0, 1fr) 40px; max-width: 360px; }
.formset-row.is-deleted { display: none; }
.formset-row .delete-btn { height: 42px; }
.formset-empty { padding: 20px 24px; color: var(--text-muted); font-size: 14px; }
.schedule-grid { display: flex; flex-wrap: wrap; gap: 10px; padding: 20px 24px; }
.schedule-item { display: flex; align-items: center; gap: 4px; padding: 4px 4px 4px 4px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--bg-elev); }
.schedule-item select { width: 104px; min-height: 36px; padding: 6px 30px 6px 10px; border: 0; background-color: transparent; font-weight: 600; }
.schedule-item select:focus { box-shadow: none; }
.schedule-item .btn-icon { width: 30px; height: 30px; }
.schedule-item.has-error { border-color: var(--danger); }
.schedule-item.is-deleted { display: none; }

/* Platform setup block */
.setup { border-bottom: 1px solid var(--border); }
.setup:last-child { border-bottom: 0; }
.setup-head { display: flex; align-items: center; gap: 14px; padding: 18px 24px; }
.setup-head .title { flex: 1; }
.setup-head .title strong { display: block; }
.setup-head .title span { font-size: 13px; color: var(--text-muted); }
.setup-body { padding: 4px 24px 24px 78px; }
.setup:not(.is-on) .setup-body { display: none; }
.banner-preview {
  position: relative; width: 150px; aspect-ratio: 9 / 16; border-radius: 14px; overflow: hidden; flex: none;
  background: repeating-linear-gradient(45deg, var(--surface-2) 0 10px, var(--bg-elev) 10px 20px);
  border: 1px solid var(--border-strong);
}
.banner-preview .banner-box {
  position: absolute; aspect-ratio: 3 / 1; border-radius: 4px; background: var(--gradient); opacity: .9;
  display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .05em;
}
.setup-layout { display: flex; gap: 28px; align-items: flex-start; }
.setup-layout .form-grid { flex: 1; }

/* Settings nav */
.section-nav { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 2px; }
.section-nav a { padding: 8px 12px; border-radius: 8px; color: var(--text-muted); font-size: 14px; }
.section-nav a:hover { color: var(--text); background: var(--surface-2); }
.save-bar {
  position: sticky; bottom: 16px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 12px 12px 20px; border-radius: var(--radius-lg); border: 1px solid var(--border-strong);
  background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: blur(14px); box-shadow: var(--shadow);
}
.save-bar span { font-size: 13.5px; color: var(--text-muted); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; text-align: right; font-weight: 500; }

/* Аккаунты публикации */
.social-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 20px 24px; }
.social {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius);
  border: 1px dashed var(--border-strong); background: var(--bg-elev); min-width: 0;
}
.social .platform-icon { width: 36px; height: 36px; border-radius: 10px; filter: grayscale(1); opacity: .5; }
.social.is-connected { border-style: solid; }
.social.is-connected .platform-icon { filter: none; opacity: 1; }
.social strong { display: block; font-size: 14px; }
.social span { font-size: 12.5px; color: var(--text-muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.social > div { flex: 1; }
.social .badge { flex: none; }

/* Медиатека */
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; padding: 20px 24px; }
.asset { position: relative; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-elev); overflow: hidden; }
.asset-thumb {
  aspect-ratio: 9 / 12; display: grid; place-items: center; overflow: hidden;
  background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--bg-elev) 0 50%) 0 0 / 16px 16px;
}
.asset-thumb img, .asset-thumb video { width: 100%; height: 100%; object-fit: contain; }
.frame-thumb { aspect-ratio: 9 / 16; background: linear-gradient(160deg, #3a3a5a, #1d1d2c); }
.frame-thumb img { object-fit: fill; }
.asset-meta { padding: 8px 10px; }
.asset-meta strong { display: block; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-meta span { font-size: 11.5px; color: var(--text-faint); }
.asset-delete { position: absolute; top: 6px; right: 6px; background: color-mix(in srgb, var(--surface) 80%, transparent); backdrop-filter: blur(6px); opacity: 0; transition: opacity .15s; }
.asset:hover .asset-delete, .asset-delete:focus-visible { opacity: 1; }
@media (hover: none) { .asset-delete { opacity: 1; } }

.anatomy { display: flex; align-items: center; gap: 8px; }
.anatomy-seg { font-size: 11.5px; font-weight: 600; text-align: center; color: var(--text-muted); line-height: 1.3; }
.anatomy-seg small { font-weight: 400; color: var(--text-faint); }
.anatomy-seg.intro, .anatomy-seg.outro { flex: 1; padding: 10px 4px; border-radius: 10px; background: var(--surface-2); }
.anatomy-seg.main { flex: none; }
.anatomy-phone { position: relative; width: 110px; aspect-ratio: 9 / 16; border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.anatomy-top { position: relative; flex: 1; display: grid; place-items: center; background: var(--accent-soft); color: var(--text); padding: 4px; }
.anatomy-bottom { flex: 1; display: grid; place-items: center; background: repeating-linear-gradient(45deg, var(--warning-soft) 0 8px, transparent 8px 16px); color: var(--text); padding: 4px; }
.anatomy-banner { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); padding: 1px 6px; border-radius: 4px; background: var(--gradient); color: #fff; font-size: 9px; }
.anatomy-frame { position: absolute; inset: 0; z-index: 2; border: 4px solid var(--accent-2); border-radius: 12px; pointer-events: none; }

/* Превью настроек оформления */
.fx-group { padding: 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-elev); }
.fx-group > .field-label { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.banner-preview .preview-split { position: absolute; left: 0; right: 0; bottom: 0; background: repeating-linear-gradient(45deg, var(--warning-soft) 0 8px, transparent 8px 16px); border-top: 1px solid var(--border-strong); display: none; }
.banner-preview .preview-frame { position: absolute; top: 0; height: 100%; z-index: 3; display: none; pointer-events: none; }
.banner-preview .preview-safe { position: absolute; top: 0; bottom: 0; z-index: 4; display: none; border-left: 1px dashed rgba(255, 255, 255, .55); border-right: 1px dashed rgba(255, 255, 255, .55); pointer-events: none; }
.banner-preview .banner-box { z-index: 2; }
.preview-strip { display: flex; gap: 6px; justify-content: center; margin-top: 8px; }
.preview-strip span { font-size: 10.5px; padding: 2px 6px; border-radius: 6px; background: var(--surface-2); color: var(--text-faint); }
.preview-strip span.on { background: var(--accent-soft); color: var(--accent); }
.hint-warning { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--warning); margin-top: 6px; }

/* AI-нарезка без доступа и неактивные блоки */
.clip-teaser { display: flex; flex-direction: column; gap: 14px; }
.clip-teaser-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-muted); }
.clip-teaser-list li { display: flex; gap: 8px; align-items: center; }
.clip-teaser-list .icon { width: 15px; height: 15px; color: var(--success); }
.card.is-inactive { opacity: .6; }
.card.is-inactive .card-body { filter: grayscale(1); }

/* Модальные окна */
.modal { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; padding: 16px; }
.modal.is-open { display: grid; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5, 5, 12, .62); backdrop-filter: blur(4px); animation: fade-in .2s ease; }
.modal-card {
  position: relative; width: 100%; max-width: 440px; max-height: calc(100vh - 32px); overflow-y: auto; padding: 32px;
  border-radius: 22px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6);
  animation: pop-in .25s cubic-bezier(.2, .9, .3, 1.2);
}
.modal-card h2 { font-size: 22px; }
.modal-icon { display: grid; place-items: center; width: 60px; height: 60px; margin: 0 auto 18px; border-radius: 18px; background: var(--gradient); color: #fff; box-shadow: 0 14px 34px -12px rgba(124, 92, 255, .9); }
.modal-email { display: inline-block; margin: 8px 0 14px; padding: 6px 14px; border-radius: 999px; background: var(--accent-soft); font-weight: 600; word-break: break-all; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }

/* Онбординг */
.tour-card { max-width: 520px; padding: 0; text-align: left; }
.tour-visual { display: grid; place-items: center; height: 168px; background: radial-gradient(260px 120px at 50% 120%, rgba(255, 255, 255, .18), transparent), var(--gradient); color: #fff; position: relative; }
.tour-visual .icon { width: 56px; height: 56px; stroke-width: 1.4; }
.tour-visual .tour-step-no { position: absolute; top: 16px; left: 18px; font-size: 12px; font-weight: 700; letter-spacing: .08em; opacity: .85; }
.tour-skip { position: absolute; top: 10px; right: 10px; color: rgba(255, 255, 255, .85) !important; }
.tour-body { padding: 26px 30px 8px; min-height: 170px; }
.tour-body h2 { font-size: 21px; margin-bottom: 10px; }
.tour-body p { color: var(--text-muted); font-size: 14.5px; }
.tour-body ul { margin: 12px 0 0; padding-left: 18px; color: var(--text-muted); font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.tour-step { display: none; }
.tour-step.is-active { display: block; animation: fade-in .25s ease; }
.tour-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 30px 26px; }
.tour-dots { display: flex; gap: 6px; }
.tour-dots span { width: 7px; height: 7px; border-radius: 999px; background: var(--border-strong); transition: width .2s, background .2s; }
.tour-dots span.is-active { width: 22px; background: var(--accent); }
.tour-foot { flex-wrap: wrap; }
.tour-foot .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.tour-card { overflow-x: hidden; }

/* Инструкции */
.guide { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; align-items: start; }
.guide-toc { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 2px; }
.guide-toc a { padding: 8px 12px; border-radius: 8px; color: var(--text-muted); font-size: 14px; }
.guide-toc a:hover { background: var(--surface-2); color: var(--text); }
.guide-section { scroll-margin-top: 24px; }
.guide-section .card-body > * + * { margin-top: 14px; }
.guide-section h3 { font-size: 15.5px; margin-top: 22px !important; }
.guide-section p, .guide-section li { color: var(--text-muted); font-size: 14.5px; line-height: 1.65; }
.guide-section strong { color: var(--text); }
.guide-section ol, .guide-section ul { padding-left: 20px; margin-bottom: 0; display: flex; flex-direction: column; gap: 6px; }
.guide-steps { list-style: none; padding: 0 !important; counter-reset: gs; gap: 14px !important; }
.guide-steps li { position: relative; padding-left: 44px; }
.guide-steps li::before {
  counter-increment: gs; content: counter(gs); position: absolute; left: 0; top: 0;
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font: 800 14px var(--font-display);
}
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--accent-soft); font-size: 14px; color: var(--text) !important; }
.callout .icon { color: var(--accent); margin-top: 2px; }
.callout.warn { background: var(--warning-soft); }
.callout.warn .icon { color: var(--warning); }
.spec { width: 100%; border-collapse: collapse; font-size: 14px; }
.spec th, .spec td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.spec th { color: var(--text-faint); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.spec td:first-child { font-weight: 600; white-space: nowrap; }
.spec td { color: var(--text-muted); }

/* ==========================================================================
   Pricing
   ========================================================================== */
.pricing { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; align-items: stretch; }
.plan {
  position: relative; display: flex; flex-direction: column; gap: 20px; padding: 28px;
  border-radius: 22px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.plan.is-highlighted {
  border-color: transparent;
  background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--gradient) border-box;
  border: 1.5px solid transparent;
  box-shadow: 0 30px 60px -30px rgba(124, 92, 255, .7);
}
.plan.is-current { border-color: var(--accent); }
.plan-ribbon {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  padding: 4px 12px; border-radius: 999px; background: var(--gradient); color: #fff; font-size: 12px; font-weight: 700; white-space: nowrap;
}
.plan h3 { font-size: 18px; }
.plan .tagline { color: var(--text-muted); font-size: 14px; margin-top: 4px; min-height: 42px; }
.plan .price { display: flex; align-items: baseline; gap: 6px; }
.plan .price strong { font: 800 42px/1 var(--font-display); letter-spacing: -.04em; }
.plan .price span { color: var(--text-muted); font-size: 14px; }
.plan .limit {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px;
  background: var(--accent-soft); font-weight: 600; font-size: 14px;
}
.plan .limit strong { font: 800 22px var(--font-display); }
.plan ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.plan li { display: flex; gap: 10px; align-items: flex-start; }
.plan li .icon { color: var(--success); width: 17px; height: 17px; margin-top: 2px; }
.plan .cta { margin-top: auto; }

/* ==========================================================================
   Public site (landing & auth)
   ========================================================================== */
.site { position: relative; overflow-x: clip; }
.glow {
  position: absolute; inset: -200px 0 auto; height: 900px; pointer-events: none; z-index: 0;
  background:
    radial-gradient(600px 380px at 20% 30%, rgba(124, 92, 255, .28), transparent 70%),
    radial-gradient(520px 340px at 80% 20%, rgba(255, 92, 138, .2), transparent 70%);
}
.container { position: relative; z-index: 1; width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.site-header { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px); background: color-mix(in srgb, var(--bg) 70%, transparent); border-bottom: 1px solid var(--border); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 20px; }
.site-header .brand { padding: 0; }
.site-nav { display: flex; align-items: center; gap: 28px; font-size: 14.5px; color: var(--text-muted); }
.site-nav a:hover { color: var(--text); }
.site-header .actions { display: flex; gap: 10px; }

.hero { padding: 96px 0 72px; text-align: center; }
.hero .eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 13px; color: var(--text-muted); }
.hero .eyebrow b { padding: 2px 8px; border-radius: 999px; background: var(--gradient); color: #fff; font-size: 11.5px; }
.hero h1 { font-size: clamp(38px, 6vw, 68px); font-weight: 800; letter-spacing: -.045em; margin: 24px auto 20px; max-width: 900px; }
.hero p.lead { font-size: clamp(16px, 2vw, 19px); color: var(--text-muted); max-width: 640px; margin: 0 auto 36px; }
.hero .ctas { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero .note { margin-top: 16px; font-size: 13px; color: var(--text-faint); }

.flow {
  display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; gap: 16px;
  max-width: 900px; margin: 64px auto 0; padding: 28px; border-radius: 24px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.flow-step { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.flow-step .platforms { display: flex; gap: 6px; }
.flow-step .platforms .platform-icon { width: 38px; height: 38px; border-radius: 11px; }
.flow-step strong { font-size: 14.5px; }
.flow-step span { font-size: 12.5px; color: var(--text-muted); }
.flow-core {
  display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; background: var(--gradient); color: #fff;
  box-shadow: 0 16px 40px -12px rgba(124, 92, 255, .9);
}
.flow-core .icon { width: 28px; height: 28px; }
.flow-arrow { color: var(--text-faint); }
.flow-arrow svg { width: 40px; height: 16px; }

.section { padding: 88px 0; scroll-margin-top: 40px; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 48px; }
.section-head .kicker { font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.section-head h2 { font-size: clamp(28px, 4vw, 40px); margin: 12px 0 14px; letter-spacing: -.035em; }
.section-head p { color: var(--text-muted); font-size: 16.5px; }

.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.feature { padding: 26px; }
.feature .ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: var(--accent-soft); color: var(--accent); margin-bottom: 18px; }
.feature h3 { font-size: 17px; margin-bottom: 8px; }
.feature p { color: var(--text-muted); font-size: 14.5px; }

.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; counter-reset: step; }
.step { padding: 26px; position: relative; }
.step::before {
  counter-increment: step; content: counter(step);
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--gradient); color: #fff; font: 800 15px var(--font-display); margin-bottom: 16px;
}
.step h3 { font-size: 17px; margin-bottom: 8px; }
.step p { color: var(--text-muted); font-size: 14.5px; }

.faq { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.faq details { padding: 0; }
.faq summary { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 24px; cursor: pointer; font-weight: 600; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .icon { transition: transform .2s; color: var(--text-muted); }
.faq details[open] summary .icon { transform: rotate(45deg); }
.faq details p { padding: 0 24px 22px; color: var(--text-muted); }

.cta-band {
  text-align: center; padding: 56px 32px; border-radius: 28px; position: relative; overflow: hidden;
  background: radial-gradient(500px 200px at 50% 0%, rgba(255, 255, 255, .16), transparent), var(--gradient); color: #fff;
}
.cta-band h2 { font-size: clamp(26px, 4vw, 38px); margin-bottom: 12px; }
.cta-band p { opacity: .85; margin-bottom: 28px; }
.cta-band .btn { background: #fff; color: #1a1033; border-color: transparent; }

.site-footer { position: relative; z-index: 1; margin-top: 40px; padding: 56px 0 28px; border-top: 1px solid var(--border); background: var(--bg-elev); }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); gap: 40px; }
.footer-brand .brand { padding: 0 0 14px; }
.footer-brand p { color: var(--text-muted); font-size: 14px; max-width: 340px; }
.footer-col { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.footer-col h4 { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 4px; }
.footer-col a:not(.tg-button) { color: var(--text-muted); font-size: 14.5px; transition: color .15s; }
.footer-col a:not(.tg-button):hover { color: var(--text); }
.footer-note { color: var(--text-muted); font-size: 13.5px; }
.tg-button {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px;
  background: #229ED9; color: #fff; font-weight: 600; font-size: 14px; transition: filter .15s, transform .12s;
}
.tg-button:hover { filter: brightness(1.08); }
.tg-button:active { transform: translateY(1px); }
.footer-bottom { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--border); color: var(--text-faint); font-size: 13px; }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }

/* Главная: цифры, витрина уникализации */
.showcase { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 56px; align-items: center; }
.showcase .kicker { font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.showcase h2 { font-size: clamp(28px, 4vw, 40px); margin: 12px 0 14px; letter-spacing: -.035em; }
.showcase-text > p { font-size: 16px; margin-bottom: 26px; }
.feature-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.feature-list li { display: flex; gap: 14px; align-items: flex-start; }
.feature-list strong { display: block; font-size: 15.5px; margin-bottom: 2px; }
.feature-list span { color: var(--text-muted); font-size: 14.5px; }
.fl-ico { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.fl-ico .icon { width: 18px; height: 18px; }

.showcase-visual { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.phone { width: 260px; padding: 10px; border-radius: 38px; background: #0d0d14; border: 1px solid var(--border-strong); box-shadow: 0 40px 80px -30px rgba(124, 92, 255, .55); }
.phone-screen { position: relative; aspect-ratio: 9 / 19.5; border-radius: 30px; overflow: hidden; display: flex; flex-direction: column; }
.ph-top { position: relative; flex: 1.1; display: grid; place-items: center; background: linear-gradient(160deg, #3b2a7a, #7c5cff 60%, #b45cff); }
.ph-bottom { flex: 1; display: grid; place-items: center; background: repeating-linear-gradient(135deg, #ffb86b 0 14px, #ff7eb3 14px 28px, #7cd4ff 28px 42px); animation: slime 6s linear infinite; background-size: 200% 200%; }
@keyframes slime { to { background-position: 100% 100%; } }
.ph-label { padding: 4px 10px; border-radius: 999px; background: rgba(0, 0, 0, .45); color: #fff; font-size: 11.5px; font-weight: 600; }
.ph-banner { position: absolute; bottom: 7%; left: 50%; transform: translateX(-50%); padding: 10px 22px; border-radius: 10px; background: #fff; color: #1a1033; font-size: 15px; font-weight: 800; letter-spacing: .06em; box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .45); animation: float 4s ease-in-out infinite; white-space: nowrap; }
@keyframes float { 50% { transform: translate(-46%, 4px); } }
.timeline { display: flex; gap: 6px; width: 260px; }
.tl { padding: 8px 6px; border-radius: 10px; font-size: 12px; font-weight: 600; text-align: center; }
.tl.intro, .tl.outro { flex: 1; background: var(--surface-2); color: var(--text-muted); }
.tl.main { flex: 3; background: var(--gradient); color: #fff; }

@media (max-width: 860px) {
  .showcase { grid-template-columns: 1fr; gap: 40px; }
}

/* Auth */
.btn-google { background: #fff; color: #1f1f1f; border-color: #dadce0; font-weight: 600; }
.btn-google:hover { background: #f8f9fa; border-color: #c4c7c5; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--text-faint); font-size: 13px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border-strong); }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 40px 16px; position: relative; }
.auth-card { width: 100%; max-width: 420px; padding: 36px; position: relative; z-index: 1; }
.auth-card .brand { justify-content: center; padding: 0 0 24px; }
.auth-card h1 { font-size: 24px; text-align: center; }
.auth-card .sub { text-align: center; color: var(--text-muted); margin: 8px 0 28px; font-size: 14.5px; }
.auth-card .alt { text-align: center; margin-top: 22px; font-size: 14px; color: var(--text-muted); }
.auth-card .alt a { color: var(--accent); font-weight: 600; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
  .setup-layout { flex-direction: column-reverse; }
  .setup-layout > div:last-child { display: flex; gap: 16px; align-items: flex-end; }
  .setup-layout > div:last-child > .field-label { display: none; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
  .pricing { grid-template-columns: 1fr; max-width: 460px; margin: 0 auto; }
  .features, .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .formset-row.sources { grid-template-columns: 1fr 1fr; }
  .formset-row.sources .delete-cell { grid-column: 2; justify-self: end; }
}

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 40; transform: translateX(-100%);
    transition: transform .25s ease, box-shadow .25s ease;
  }
  .app.nav-open .sidebar { transform: none; box-shadow: 20px 0 60px rgba(0, 0, 0, .5); }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .5); }
  .topbar-mobile {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: sticky; top: 0; z-index: 20; height: 60px; padding: 0 16px;
    background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border);
  }
  .topbar-mobile .brand { padding: 0; font-size: 17px; }
  .main { padding: 24px 16px 48px; }
  .page-head h1 { font-size: 24px; }
  .page-head .actions, .page-head .actions form { flex: 1; }
  .page-head .actions .btn { width: 100%; }
  .site-nav { display: none; }
  .flow { grid-template-columns: 1fr; }
  .flow-arrow { transform: rotate(90deg); justify-self: center; }
  .setup-body { padding: 4px 16px 20px; }
  .setup-layout { flex-direction: column; }
  .card-body { padding: 18px; }
  .card-header, .formset-row, .list li { padding-left: 18px; padding-right: 18px; }
  .section-nav { display: none; }
  .guide { grid-template-columns: 1fr; }
  .guide-toc { display: none; }
  .tour-body, .tour-foot { padding-left: 20px; padding-right: 20px; }
}

@media (max-width: 600px) {
  .grid-4, .grid-3, .grid-2, .features, .steps { grid-template-columns: 1fr; }
  .form-grid.cols-2, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .formset-row.sources { grid-template-columns: 1fr; }
  .social-list { grid-template-columns: 1fr; }
  .formset-row.sources .delete-cell { grid-column: auto; }
  .hero { padding: 64px 0 48px; }
  .site-header .actions .btn-ghost { display: none; }
  .table .hide-sm { display: none; }
  .table th, .table td { padding-left: 10px; padding-right: 10px; }
  .td-title { min-width: 150px; }
  .video-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .save-bar span { display: none; }
  .auth-card { padding: 28px 22px; }
}

/* AI-нарезка */
.clip-jobs { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.clip-jobs li { display: grid; gap: 4px; padding: 12px 24px; border-bottom: 1px solid var(--border); }
.clip-jobs li:last-child { border-bottom: 0; }
.clip-job-head { display: flex; gap: 10px; align-items: center; justify-content: space-between; min-width: 0; }
.clip-job-head .video-title { min-width: 0; font-size: 13.5px; }
.clip-job-head .badge { flex-shrink: 0; }
.clip-job-error { font-size: 12px; color: var(--danger); }
.clip-jobs form { margin-top: 2px; }
.source-checks { display: grid; gap: 4px; align-content: center; }
.source-checks .deep-scan { height: auto; }
.balance-history { width: 100%; }
.balance-history td.amount { text-align: right; font-weight: 600; white-space: nowrap; }
.balance-history td.amount.plus { color: var(--success); }
