/* Rebma — product web design system.
   A distinct creator-tool identity: dark near-black cool surfaces, a vivid
   aqua→violet accent gradient, Space Grotesk display + Inter body. One
   embedded stylesheet, no build step. */

:root {
  /* surfaces */
  --bg:        #0B0F14;
  --bg-soft:   #0F141B;
  --surface:   #141A22;
  --surface-2: #1A222C;
  --surface-3: #212B37;
  --hairline:  rgba(255,255,255,.08);
  --hairline-2:rgba(255,255,255,.14);

  /* text */
  --text:      #E6EDF3;
  --text-dim:  #9AA7B4;
  --text-mut:  #6B7785;

  /* accent gradient (cyan -> violet) */
  --acc-cyan:  #22D3EE;
  --acc-violet:#8B5CF6;
  --accent:    linear-gradient(115deg, #22D3EE 0%, #8B5CF6 100%);
  --accent-ink:#06121A;
  --acc-glow:  0 8px 28px rgba(34,211,238,.22), 0 4px 22px rgba(139,92,246,.28);
  --acc-ring:  0 0 0 3px rgba(99,160,255,.30);

  /* status colors */
  --st-processing: #F59E0B;
  --st-done:       #34D399;
  --st-failed:     #FB7185;
  --st-uploaded:   #60A5FA;

  --radius:    18px;
  --radius-lg: 22px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --shadow:    0 18px 50px rgba(0,0,0,.45);
  --shadow-sm: 0 6px 20px rgba(0,0,0,.30);

  --maxw:      1160px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Space Grotesk", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
}

/* ambient glows on the page background */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 480px at 12% -8%, rgba(34,211,238,.10), transparent 60%),
    radial-gradient(900px 520px at 92% 4%, rgba(139,92,246,.12), transparent 60%);
}

a { color: var(--acc-cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-family: var(--display); line-height: 1.12; margin: 0 0 .4em; font-weight: 700; letter-spacing: -.02em; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.dim   { color: var(--text-dim); }
.small { font-size: 13px; }
.num   { text-align: right; font-variant-numeric: tabular-nums; }
.mono  { font-family: var(--mono); }
.inline-form { display: inline; margin: 0; }

/* gradient text utility for key numbers/logo */
.grad-text {
  background: var(--accent); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 15px;
  padding: 11px 20px; border-radius: var(--radius-pill);
  border: 1px solid transparent; cursor: pointer;
  transition: transform .08s, box-shadow .18s, background .18s, border-color .18s, opacity .15s;
  text-decoration: none; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  background: var(--accent); color: var(--accent-ink); font-weight: 700;
  box-shadow: var(--acc-glow);
}
.btn-primary:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 12px 34px rgba(34,211,238,.30), 0 8px 30px rgba(139,92,246,.36); }
.btn-ghost { background: rgba(255,255,255,.03); color: var(--text); border-color: var(--hairline-2); }
.btn-ghost:hover { background: var(--surface-2); text-decoration: none; }
.btn-danger { background: rgba(251,113,133,.12); color: #ffb3bf; border-color: rgba(251,113,133,.4); }
.btn-danger:hover { background: rgba(251,113,133,.20); text-decoration: none; }
.btn-lg { padding: 14px 26px; font-size: 16px; }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---------- brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); font-weight: 800; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  overflow: hidden; flex: none;
  box-shadow: 0 6px 18px rgba(232,89,12,.22);
}
.brand-mark svg { display: block; width: 100%; height: 100%; }
.brand-name { font-family: var(--display); font-size: 20px; letter-spacing: -.03em; }

/* ---------- public header / footer ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(11,15,20,.72);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--hairline);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 70px; }
.site-nav { display: flex; align-items: center; gap: 18px; }
.nav-link { color: var(--text-dim); font-weight: 600; }
.nav-link:hover { color: var(--text); text-decoration: none; }

.site-footer { border-top: 1px solid var(--hairline); margin-top: 90px; padding: 30px 0; }
.footer-inner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* ---------- hero ---------- */
.hero { padding: 92px 0 50px; position: relative; overflow: hidden; }
.hero-inner { display: grid; grid-template-columns: 1.25fr .75fr; gap: 52px; align-items: center; position: relative; }
.eyebrow {
  display: inline-block; font-size: 12.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--acc-cyan);
  background: rgba(34,211,238,.10); border: 1px solid rgba(34,211,238,.28);
  padding: 6px 13px; border-radius: var(--radius-pill); margin-bottom: 20px;
}
.hero-title { font-size: clamp(34px, 4.8vw, 58px); margin-bottom: 20px; }
.hero-sub { font-size: 18px; color: var(--text-dim); max-width: 580px; margin: 0 0 30px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-note { margin-top: 18px; }

.hero-art { display: grid; place-items: center; }
.phone {
  width: 224px; height: 440px; border-radius: 40px; padding: 11px;
  background: linear-gradient(160deg, var(--surface-3), var(--surface));
  border: 1px solid var(--hairline-2); box-shadow: var(--shadow);
}
.phone-screen {
  width: 100%; height: 100%; border-radius: 30px; position: relative;
  background: linear-gradient(180deg, #1c2740, #0c111c);
  overflow: hidden;
}
.phone-screen::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 60% at 50% 0%, rgba(139,92,246,.28), transparent 60%);
}
.phone-caption {
  position: absolute; left: 16px; right: 16px; bottom: 58px; z-index: 1;
  font-family: var(--display); font-weight: 700; font-size: 17px; text-align: center;
  text-shadow: 0 2px 8px rgba(0,0,0,.7);
}
.phone-badge {
  position: absolute; top: 16px; right: 16px; z-index: 1;
  background: rgba(34,211,238,.16); color: var(--acc-cyan);
  border: 1px solid rgba(34,211,238,.4);
  font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: var(--radius-pill);
}

/* ---------- sections ---------- */
.section { padding: 62px 0; }
.section-alt { background: var(--bg-soft); border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.section-title { font-size: 30px; text-align: center; margin-bottom: 40px; }

.value-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.value-card {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 26px;
  transition: transform .15s, border-color .15s;
}
.value-card:hover { transform: translateY(-3px); border-color: var(--hairline-2); }
.value-card h3 { font-size: 17px; }
.value-ico { font-size: 26px; margin-bottom: 12px; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.step { text-align: center; }
.step-num {
  width: 48px; height: 48px; margin: 0 auto 16px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 19px;
  color: var(--accent-ink); background: var(--accent); box-shadow: var(--acc-glow);
}

.cta-band { text-align: center; }
.cta-inner h2 { font-size: 28px; margin-bottom: 24px; }

/* ---------- auth ---------- */
.auth-wrap { display: grid; place-items: center; padding: 70px 24px; }
.auth-card {
  width: 100%; max-width: 430px;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius-lg); padding: 36px; box-shadow: var(--shadow);
}
.auth-title { font-size: 26px; margin-bottom: 6px; }
.auth-sub { margin: 0 0 24px; }
.auth-alt { text-align: center; margin: 20px 0 0; }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-dim); }
.field-hint { font-size: 12px; }
.input, .select {
  width: 100%; font: inherit; color: var(--text);
  background: var(--bg-soft); border: 1px solid var(--hairline-2);
  border-radius: var(--radius-sm); padding: 11px 13px;
  transition: border-color .15s, box-shadow .15s;
}
.select { appearance: none; cursor: pointer; padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-mut) 50%), linear-gradient(135deg, var(--text-mut) 50%, transparent 50%);
  background-position: calc(100% - 16px) center, calc(100% - 11px) center;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.input:focus, .select:focus { outline: none; border-color: var(--acc-cyan); box-shadow: var(--acc-ring); }
.input.file { padding: 10px 12px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.input-color { width: 46px; height: 40px; padding: 3px; border-radius: var(--radius-sm); background: var(--bg-soft); border: 1px solid var(--hairline-2); cursor: pointer; }

/* Catch-all so every form control matches the dark theme, even unclassed
   ones (browsers default text/file inputs to a white background). */
input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=range]),
select, textarea {
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--hairline-2);
  border-radius: var(--radius-sm);
  font: inherit;
}
input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=range]):focus,
select:focus, textarea:focus {
  outline: none; border-color: var(--acc-cyan); box-shadow: var(--acc-ring);
}
input::placeholder, textarea::placeholder { color: var(--text-mut); }
/* Autofilled fields: cover the browser's light autofill background with an
   inset shadow. !important is required — the high-specificity catch-all
   :focus rule above otherwise replaces box-shadow with the focus ring and
   the autofill colour bleeds through on the autofocused field. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--bg-soft) inset !important;
  caret-color: var(--text);
  border: 1px solid var(--hairline-2);
}
input:-webkit-autofill:focus,
textarea:-webkit-autofill:focus,
select:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--bg-soft) inset, var(--acc-ring) !important;
  border-color: var(--acc-cyan);
}
/* Native file input + its button (the most stubborn white surface). */
input[type=file] { color: var(--text-mut); padding: 9px 12px; }
input[type=file]::file-selector-button,
input[type=file]::-webkit-file-upload-button {
  margin-right: 12px; padding: 7px 13px; cursor: pointer; font-weight: 600;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--hairline-2); border-radius: var(--radius-sm);
}
input[type=file]::file-selector-button:hover { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

/* ---------- upload dropzone ---------- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 7px; text-align: center; cursor: pointer; position: relative;
  padding: 38px 22px; border-radius: var(--radius);
  border: 1.5px dashed var(--hairline-2); background: var(--bg-soft);
  color: var(--text-dim);
  transition: border-color .15s, background .15s, box-shadow .18s, transform .08s;
}
.dropzone:hover { border-color: var(--acc-cyan); background: var(--surface); }
.dropzone:focus-visible { outline: none; border-color: var(--acc-cyan); box-shadow: var(--acc-ring); }
.dropzone.is-drag {
  border-style: solid; border-color: var(--acc-violet);
  background: rgba(139, 92, 246, .10); box-shadow: var(--acc-glow);
  transform: translateY(-1px);
}
.dropzone.is-busy { cursor: default; opacity: .9; }
.dz-icon { width: 40px; height: 40px; color: var(--acc-cyan); transition: color .15s, transform .12s; }
.dropzone:hover .dz-icon { transform: translateY(-2px); }
.dropzone.is-drag .dz-icon { color: var(--acc-violet); }
.dz-title { font-family: var(--display); font-size: 17px; font-weight: 700; color: var(--text); }
.dz-sub { font-size: 13px; color: var(--text-dim); }
.dz-link { color: var(--acc-cyan); font-weight: 600; }
.dz-file {
  margin-top: 4px; font-size: 13px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--hairline-2);
  border-radius: var(--radius-pill); padding: 5px 13px;
}

/* ---------- alerts ---------- */
.alert {
  border-radius: var(--radius-sm); padding: 12px 15px; margin: 0 0 16px;
  font-size: 14px; border: 1px solid transparent;
}
.alert.small { font-size: 13px; padding: 8px 11px; margin-top: 10px; }
.alert-error { background: rgba(251,113,133,.12); border-color: rgba(251,113,133,.4); color: #ffb3bf; }
.alert-ok { background: rgba(52,211,153,.12); border-color: rgba(52,211,153,.4); color: #8af0c8; }

/* ---------- app shell ---------- */
.app { background: var(--bg); }
.app-shell { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, var(--bg-soft), var(--bg));
  border-right: 1px solid var(--hairline);
  display: flex; flex-direction: column; padding: 24px 16px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 0 8px 26px; }
.side-nav { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.side-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; border-radius: var(--radius-sm);
  color: var(--text-dim); font-weight: 600;
}
.side-link:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.side-link.active {
  background: var(--accent); color: var(--accent-ink); font-weight: 700;
  box-shadow: var(--acc-glow);
}
.side-link.active .side-ico { opacity: 1; }
.side-ico { width: 20px; height: 20px; display: inline-grid; place-items: center; opacity: .85; }
.side-ico svg { width: 18px; height: 18px; }
.side-foot { border-top: 1px solid var(--hairline); padding-top: 16px; }
.side-acct {
  font-size: 13px; color: var(--text-dim); padding: 0 4px 10px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.app-main { min-width: 0; }
.app-topbar {
  height: 62px; display: flex; align-items: center; justify-content: flex-end; gap: 16px;
  padding: 0 32px; border-bottom: 1px solid var(--hairline);
  background: rgba(11,15,20,.55); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.topbar-acct { font-size: 13.5px; color: var(--text-dim); }
.app-content { max-width: 1040px; margin: 0 auto; padding: 34px 32px 90px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.page-title { font-size: 30px; margin: 0; }
.page-sub { margin: 8px 0 0; max-width: 620px; }
.section-head { font-size: 20px; margin: 38px 0 16px; }
.back-link { color: var(--text-dim); font-weight: 600; }

/* tabs (settings) */
.tabs { display: flex; gap: 6px; margin: 0 0 26px; border-bottom: 1px solid var(--hairline); }
.tab {
  padding: 10px 16px; font-weight: 600; color: var(--text-dim);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--text); border-bottom-color: var(--acc-cyan); }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm);
}
.card-hover { transition: transform .15s, border-color .15s, box-shadow .15s; }
.card-hover:hover { transform: translateY(-3px); border-color: var(--hairline-2); box-shadow: var(--shadow); }
.card-title { font-family: var(--display); font-size: 18px; margin: 0 0 16px; }
.table-card { padding: 8px 8px 4px; overflow-x: auto; }

/* ---------- filter toolbar ---------- */
.toolbar {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 22px;
}
.toolbar .field { gap: 5px; min-width: 150px; }
.toolbar .field.grow { flex: 1; }
.toolbar .select { padding: 9px 30px 9px 12px; }

/* ---------- uploader ---------- */
.uploader { margin-bottom: 22px; }
.upload-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.upload-row .input.file { flex: 1; min-width: 220px; }
.uploader progress { width: 100%; height: 10px; margin-top: 14px; -webkit-appearance: none; appearance: none; border: none; border-radius: var(--radius-pill); overflow: hidden; background: var(--surface-2); }
.uploader progress::-webkit-progress-bar { background: var(--surface-2); border-radius: var(--radius-pill); }
.uploader progress::-webkit-progress-value { background: var(--accent); border-radius: var(--radius-pill); }
.uploader progress::-moz-progress-bar { background: var(--acc-violet); border-radius: var(--radius-pill); }
.upload-note { margin: 10px 0 0; }
.status { display: inline-block; margin-top: 8px; }

/* ---------- film grid (library) ---------- */
.film-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.film-card { display: flex; flex-direction: column; gap: 12px; }
.film-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.film-card-name { font-family: var(--display); font-size: 17px; margin: 0; font-weight: 700; }
.film-card-name a { color: var(--text); }
.film-card-name a:hover { color: var(--acc-cyan); }
.film-card-meta { display: flex; align-items: center; gap: 10px; color: var(--text-dim); font-size: 13px; flex-wrap: wrap; }
.film-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- tables ---------- */
.grid { width: 100%; border-collapse: collapse; font-size: 15px; }
.grid th {
  text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-mut);
  padding: 13px 15px; border-bottom: 1px solid var(--hairline);
}
.grid td { padding: 13px 15px; border-bottom: 1px solid var(--hairline); }
.grid tbody tr:last-child td { border-bottom: none; }
.grid tbody tr:hover { background: var(--surface-2); }
.grid-compact { font-size: 13px; margin-top: 14px; }
.grid-compact th, .grid-compact td { padding: 7px 10px; }
.film-link { font-weight: 600; color: var(--text); }
.film-link:hover { color: var(--acc-cyan); }

/* ---------- badges / chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: var(--radius-pill);
  background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--hairline-2);
}
.badge[data-status="processing"] { background: rgba(245,158,11,.14); color: var(--st-processing); border-color: rgba(245,158,11,.38); }
.badge[data-status="uploaded"]   { background: rgba(96,165,250,.14); color: var(--st-uploaded); border-color: rgba(96,165,250,.38); }
.badge[data-status="done"]       { background: rgba(52,211,153,.14); color: var(--st-done); border-color: rgba(52,211,153,.38); }
.badge[data-status="failed"]     { background: rgba(251,113,133,.14); color: var(--st-failed); border-color: rgba(251,113,133,.38); }
.badge-score { background: rgba(34,211,238,.12); color: var(--acc-cyan); border-color: rgba(34,211,238,.36); }
.badge[data-conn="active"] { background: rgba(52,211,153,.14); color: var(--st-done); border-color: rgba(52,211,153,.38); }
.badge[data-conn="error"]  { background: rgba(251,113,133,.14); color: var(--st-failed); border-color: rgba(251,113,133,.38); }
.badge-muted { background: var(--surface-2); color: var(--text-mut); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: var(--radius-pill);
  background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--hairline-2);
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ---------- empty ---------- */
.empty { text-align: center; padding: 48px 22px; }
.empty-ico {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: linear-gradient(160deg, rgba(34,211,238,.14), rgba(139,92,246,.14));
  border: 1px solid var(--hairline-2);
  color: var(--acc-cyan);
}
.empty-ico svg { width: 30px; height: 30px; display: block; }
.empty-title { font-family: var(--display); font-weight: 700; margin: 0 0 4px; }

/* ---------- film detail ---------- */
.film-header { margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.film-header-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.film-header-live { display: flex; align-items: center; gap: 8px; color: var(--st-processing); font-weight: 600; font-size: 14px; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--st-processing); box-shadow: 0 0 0 0 rgba(245,158,11,.6); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(245,158,11,.5);} 70% { box-shadow: 0 0 0 10px rgba(245,158,11,0);} 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0);} }

/* clip re-render status: the indicator + the "busy" button label stay hidden
   until the form's request is in flight (htmx adds .htmx-request to the form
   for the request's duration; hx-disabled-elt greys out the controls). */
.rerender-ind { display: none; align-items: center; gap: 7px; margin-top: 8px; color: var(--st-processing); font-weight: 600; }
.rerender-btn-busy { display: none; }
.rerender-form.htmx-request .rerender-ind { display: inline-flex; }
.rerender-form.htmx-request .rerender-btn-idle { display: none; }
.rerender-form.htmx-request .rerender-btn-busy { display: inline; }

.clip-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.clip-card { display: flex; flex-direction: column; gap: 8px; }
.clip-head { display: flex; align-items: center; justify-content: space-between; }
.clip-idx { font-family: var(--mono); color: var(--text-mut); font-size: 13px; }
.clip-title { font-size: 17px; margin: 0; }
.clip-hook { font-style: italic; color: var(--text); margin: 0; }
.clip-why { margin: 0; }
.clip-meta { display: flex; gap: 8px; }
.clip-video { width: 100%; border-radius: var(--radius-sm); background: #000; margin-top: 6px; max-height: 320px; }

/* ---------- stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.stat-card { text-align: left; padding: 22px; }
.stat-card.card-hover:hover { transform: translateY(-3px); }
.stat-num { font-family: var(--display); font-size: 32px; font-weight: 800; letter-spacing: -.03em; }
.stat-label { font-size: 13px; margin-top: 4px; }

.bars { display: flex; flex-direction: column; gap: 16px; }
.bar-row { display: grid; grid-template-columns: 180px 1fr auto; gap: 14px; align-items: center; }
.bar-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.bar-track { height: 12px; background: var(--surface-2); border-radius: var(--radius-pill); overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: var(--radius-pill); min-width: 2px; box-shadow: var(--acc-glow); }
.bar-val { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 14px; }

/* ---------- audience portrait ---------- */
.audience-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.audience-grid .card { padding: 20px; }
.audience-grid .bars { gap: 12px; }
.audience-grid .bar-row { grid-template-columns: 96px 1fr auto; gap: 12px; }
.card-cap { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; margin-bottom: 16px; }

/* ---------- insights ---------- */
.insight-reco { display: flex; gap: 10px; align-items: baseline; font-size: 15px; font-weight: 600; margin-bottom: 14px; border-left: 3px solid var(--accent); }
.reco-mark { color: var(--accent); font-weight: 800; }

/* ---------- views trend ---------- */
.trend-card { padding: 20px; }
.trend-svg { width: 100%; height: 160px; display: block; }
.trend-area { fill: var(--accent); opacity: .12; }
.trend-line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 0 6px var(--acc-glow-col, rgba(99,102,241,.4))); }
.trend-axis { display: flex; justify-content: space-between; font-size: 12px; margin-top: 8px; }
.trend-spark { height: 56px; }

/* ---------- stats slices ---------- */
.slices-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--radius-pill); padding: 3px; }
.seg-item { padding: 6px 16px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 600; color: var(--text-mut); text-decoration: none; transition: background .15s, color .15s; }
.seg-item:hover { color: var(--text); }
.seg-active { background: var(--accent); color: #fff; box-shadow: var(--acc-glow); }
.seg-active:hover { color: #fff; }
.slice-list { display: flex; flex-direction: column; gap: 14px; }
.slice-card { display: flex; flex-direction: column; gap: 14px; }
.slice-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.slice-title { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.slice-metrics { display: flex; gap: 18px; font-size: 13px; }
.slice-metrics b { color: var(--text); font-variant-numeric: tabular-nums; }
.slice-bar { height: 8px; }
.badge { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; padding: 2px 8px; border-radius: var(--radius-pill); background: var(--surface-2); color: var(--text-mut); }

/* ---------- projects page ---------- */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.proj-card { display: flex; flex-direction: column; gap: 12px; }
.proj-card-head { display: flex; align-items: center; gap: 10px; }
.proj-card-name { font-family: var(--display); font-size: 18px; margin: 0; font-weight: 700; flex: 1; }
.proj-counts { display: flex; gap: 14px; color: var(--text-dim); font-size: 13px; }
.proj-counts b { color: var(--text); }
.folder-list { display: flex; flex-direction: column; gap: 6px; }
.folder-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: var(--radius-sm); background: var(--bg-soft); border: 1px solid var(--hairline); font-size: 14px; }
.folder-name { display: flex; align-items: center; gap: 8px; }
.inline-add { display: flex; gap: 8px; }
.inline-add .input { padding: 8px 11px; }
.tag-manager { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--radius-pill); background: var(--surface-2); border: 1px solid var(--hairline-2); font-size: 13.5px; font-weight: 600; }
.tag-pill .x { color: var(--text-mut); font-weight: 700; cursor: pointer; background: none; border: none; padding: 0 0 0 2px; font-size: 15px; line-height: 1; }
.tag-pill .x:hover { color: var(--st-failed); }
.palette { display: flex; gap: 8px; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--hairline-2); cursor: pointer; }
.icon-btn { background: none; border: none; color: var(--text-mut); cursor: pointer; padding: 2px 6px; font-size: 14px; }
.icon-btn:hover { color: var(--st-failed); }

/* ---------- modal / popover ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: rgba(5,8,12,.66); backdrop-filter: blur(3px); padding: 24px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  width: 100%; max-width: 460px; background: var(--surface);
  border: 1px solid var(--hairline-2); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 26px; max-height: 86vh; overflow-y: auto;
}
.modal-wide { max-width: 880px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.modal-title { font-size: 19px; margin: 0; }
.modal-close { background: none; border: none; color: var(--text-mut); font-size: 22px; cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--text); }

/* настройки проекта: формы группами в 2 колонки внутри широкой модалки */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px 28px; }
.settings-group { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.settings-group-wide { grid-column: 1 / -1; }
@media (max-width: 720px) { .settings-grid { grid-template-columns: 1fr; } }

/* ---------- AI drawer (правый дравер: чат + метаданные) ---------- */
.drawer-launch {
  position: fixed; right: 22px; bottom: 22px; z-index: 80;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 16px; border-radius: var(--radius-pill);
  background: var(--acc-violet, #8B5CF6); color: #fff; font-weight: 600; font-size: 14px;
  border: none; cursor: pointer; box-shadow: var(--shadow);
}
.drawer-launch:hover { filter: brightness(1.08); }
.drawer-scrim {
  position: fixed; inset: 0; z-index: 88; background: rgba(5,8,12,.5);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.ai-drawer {
  position: fixed; top: 0; right: 0; z-index: 89; height: 100vh; width: min(440px, 92vw);
  display: flex; flex-direction: column; background: var(--surface);
  border-left: 1px solid var(--hairline-2); box-shadow: var(--shadow);
  transform: translateX(100%); transition: transform .2s ease;
}
.drawer-toggle:checked ~ .ai-drawer { transform: none; }
.drawer-toggle:checked ~ .drawer-scrim { opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--hairline); }
.drawer-title { font-size: 16px; margin: 0; }
.drawer-close { background: none; border: none; color: var(--text-mut); font-size: 22px; line-height: 1; cursor: pointer; }
.drawer-close:hover { color: var(--text); }
.drawer-body { flex: 1; min-height: 0; display: flex; }
/* drawer holds the chat only (metadata lives on the page's «Исходный ролик» tab) */
.ai-pane { display: flex; flex: 1; min-height: 0; flex-direction: column; padding: 14px 16px; overflow-y: auto; }

/* page tabs on the film page (клипы | исходный ролик) */
.filmtabs { margin-top: 8px; }
.filmtabs .tab-radio { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
#ft-clips:checked ~ #panel-clips,
#ft-source:checked ~ #panel-source { display: block; }
.source-section { margin-top: 18px; }

/* chat */
.chat-log { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }
.chat-msg { display: flex; }
.chat-user { justify-content: flex-end; }
.chat-bubble { max-width: 85%; padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.45; }
.chat-ai .chat-bubble { background: var(--surface-2); border: 1px solid var(--hairline-2); border-bottom-left-radius: 4px; }
.chat-user .chat-bubble { background: var(--acc-violet, #8B5CF6); color: #fff; border-bottom-right-radius: 4px; }
.chat-err { background: rgba(239,68,68,.12) !important; border-color: rgba(239,68,68,.4) !important; color: var(--text) !important; }
.chat-form { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.chat-form .input { flex: 1; }
.manual-cut { margin-top: 12px; border-top: 1px solid var(--hairline); padding-top: 10px; }
.manual-cut > summary { cursor: pointer; list-style: none; }
.manual-cut > summary::-webkit-details-marker { display: none; }
.manual-form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.manual-row { display: flex; gap: 8px; }
.manual-row .input { flex: 1; min-width: 0; }

/* metadata */
.meta-block { margin-bottom: 22px; }
.meta-head { font-family: var(--display); font-size: 15px; margin: 0 0 10px; }
.meta-source { width: 100%; border-radius: var(--radius-sm); background: #000; max-height: 240px; }
.meta-moments { display: flex; flex-direction: column; gap: 10px; }
.meta-moment { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bg-soft); border: 1px solid var(--hairline); }
.meta-moment-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.meta-moment-title { font-weight: 600; margin-top: 4px; }
.meta-tc { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12.5px; color: var(--acc-cyan, #22D3EE); }
.meta-transcript { display: flex; flex-direction: column; gap: 4px; }
.meta-line { margin: 0; font-size: 13.5px; line-height: 1.5; }
.meta-line .meta-tc { margin-right: 8px; }

/* добавление по ссылке (URL-ingest) под дропзоной */
.ingest-row { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--hairline); }
.ingest-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: center; }
.ingest-form .input { flex: 1; min-width: 220px; }
.ingest-form .select { min-width: 150px; }

/* поля стиля субтитров: компактная адаптивная сетка */
.subtitle-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 16px; }

/* живое превью стиля субтитров: сетка пустых 9:16-кадров (без картинки) с
   разными текстами; инлайн-стили накатывает subtitle-preview.js по полям формы */
.subtitle-preview { margin-top: 18px; }
.sub-preview-head { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.sub-frames { display: grid; grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); gap: 12px; }
.sub-frame { position: relative; aspect-ratio: 9 / 16; background: linear-gradient(160deg, #2a2f3a, #14171d); border: 1px solid var(--hairline-2); border-radius: 10px; overflow: hidden; }
.sub-cap { position: absolute; left: 6%; right: 6%; bottom: 18%; margin: 0; text-align: center; line-height: 1.14; overflow-wrap: anywhere; color: #fff; font-size: 14px; }
.sub-tag { position: absolute; top: 6px; left: 6px; z-index: 1; font-size: 10px; padding: 1px 6px; border-radius: 6px; background: rgba(0, 0, 0, .45); color: #cbd5e1; letter-spacing: .02em; }
.sub-preview-note { margin-top: 10px; }

.season-subs { margin-top: 12px; }
.season-subs > summary { cursor: pointer; list-style: none; width: max-content; }
.season-subs > summary::-webkit-details-marker { display: none; }

/* модалка подтверждения (замена нативного confirm) */
.confirm-modal { max-width: 440px; }
.confirm-msg { margin: 0 0 22px; color: var(--text); line-height: 1.55; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }
.tag-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-check { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: var(--radius-pill); background: var(--bg-soft); border: 1px solid var(--hairline-2); cursor: pointer; font-size: 13.5px; font-weight: 600; user-select: none; }
.tag-check input { accent-color: var(--acc-violet); }
.tag-check:has(input:checked) { border-color: var(--acc-cyan); background: rgba(34,211,238,.10); }

/* ---------- settings ---------- */
.settings-section { margin-bottom: 10px; }
.settings-note { margin: 0 0 16px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 28px; margin: 0 0 12px; }
.kv dt { font-size: 14px; }
.kv dd { margin: 0; }
.conn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.conn-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.conn-name { font-size: 17px; margin: 0; }
.conn-soon { opacity: .65; }

/* ---------- scheduled-post status pills ---------- */
.badge[data-sched="pending"]    { background: rgba(96,165,250,.14); color: var(--st-uploaded); border-color: rgba(96,165,250,.38); }
.badge[data-sched="publishing"] { background: rgba(245,158,11,.14); color: var(--st-processing); border-color: rgba(245,158,11,.38); }
.badge[data-sched="published"]  { background: rgba(52,211,153,.14); color: var(--st-done); border-color: rgba(52,211,153,.38); }
.badge[data-sched="failed"]     { background: rgba(251,113,133,.14); color: var(--st-failed); border-color: rgba(251,113,133,.38); }
.badge[data-sched="canceled"]   { background: var(--surface-2); color: var(--text-mut); }

/* ---------- project list cards (home) ---------- */
.proj-link { text-decoration: none; color: inherit; }
.proj-link:hover { text-decoration: none; }
.proj-open { color: var(--acc-cyan); font-weight: 600; margin-top: auto; }
.proj-card .proj-counts { flex-wrap: wrap; }

/* ---------- project hub ---------- */
.head-actions { display: flex; align-items: flex-start; gap: 10px; }
.head-menu { position: relative; }
.head-menu > summary { list-style: none; cursor: pointer; }
.head-menu > summary::-webkit-details-marker { display: none; }
.hub-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat-mini { padding: 18px; }
.stat-mini .stat-num { font-size: 26px; }
.upload-grid { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; }
.upload-grid .dropzone { min-height: 150px; }
.hub-cols { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; margin-top: 26px; }
.section-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.season { margin-bottom: 16px; display: flex; flex-direction: column; gap: 10px; }
.season-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.season-name { font-family: var(--display); font-size: 17px; margin: 0; }
.season-meta { display: flex; align-items: center; gap: 10px; }
.episode-list { display: flex; flex-direction: column; gap: 7px; }
.episode-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 13px; border-radius: var(--radius-sm);
  background: var(--bg-soft); border: 1px solid var(--hairline);
  color: var(--text); transition: border-color .14s, background .14s;
}
.episode-row:hover { border-color: var(--hairline-2); background: var(--surface-2); text-decoration: none; }
.episode-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.episode-meta { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* ---------- cross-post target checklist ---------- */
.target-list { display: flex; flex-direction: column; gap: 8px; }
.target-check {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--bg-soft); border: 1px solid var(--hairline-2);
  cursor: pointer; user-select: none;
}
.target-check input { accent-color: var(--acc-violet); width: 16px; height: 16px; }
.target-check:has(input:checked) { border-color: var(--acc-cyan); background: rgba(34,211,238,.08); }
.target-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.target-platform { font-weight: 600; font-size: 14px; }
.target-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- settings popover groups ---------- */
.menu-divider { height: 1px; background: var(--hairline-2); margin: 16px 0; }
.field-group-head { font-family: var(--display); font-weight: 700; font-size: 14px; margin-bottom: 2px; }

/* ---------- internal tags (private organization) ---------- */
.episode-chips { display: inline-flex; margin-left: 8px; vertical-align: middle; }
.episode-chips .chip { font-size: 11px; padding: 2px 8px; }
.tag-manager-chips { gap: 8px; }
.chip-removable { padding-right: 6px; }
.chip-x {
  background: none; border: none; color: var(--text-mut); cursor: pointer;
  font-size: 11px; line-height: 1; padding: 2px 3px; border-radius: 4px;
}
.chip-x:hover { color: var(--st-failed); background: rgba(251,113,133,.14); }
.chip-removable .inline-form { display: inline-flex; }
.tag-assign { margin: 8px 0 18px; padding: 16px 18px; }
.tag-assign-summary { font-family: var(--display); font-weight: 700; cursor: pointer; }
.tag-assign-summary::-webkit-details-marker { color: var(--text-mut); }
.tag-check-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; }
.tag-check input { accent-color: var(--acc-violet); width: 15px; height: 15px; }
.tag-check:has(input:checked) .chip { border-color: var(--acc-cyan); }

/* ---------- clip scheduling on film detail ---------- */
.clip-actions { margin-top: auto; padding-top: 6px; }
.clip-sched { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.sched-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- clip curation ---------- */
.curate-hint { margin: -6px 0 16px; }
.clip-status-wrap { display: inline-flex; align-items: center; gap: 8px; }
.clip-caption {
  margin: 0; color: var(--text-dim);
  border-left: 2px solid var(--hairline-2); padding-left: 9px;
}

/* status pills (reuse .badge, keyed by data-clip) */
.badge[data-clip="suggested"] { background: var(--surface-2); color: var(--text-dim); border-color: var(--hairline-2); }
.badge[data-clip="approved"]  { background: rgba(52,211,153,.14); color: var(--st-done); border-color: rgba(52,211,153,.38); }
.badge[data-clip="discarded"] { background: rgba(251,113,133,.12); color: var(--st-failed); border-color: rgba(251,113,133,.34); }

/* discarded clips render de-emphasized and sort visually to the back */
.clip-card[data-clip="discarded"] { opacity: .55; order: 1; }
.clip-card[data-clip="discarded"]:hover { opacity: .85; }

.clip-curate { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--hairline); }
.clip-curate-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.clip-curate-arrange { gap: 6px; }
.btn-icon { padding: 6px 11px; font-family: var(--mono); min-width: 34px; }

/* ---------- inline SVG icons (no emoji) ---------- */
.ico-inline { width: 15px; height: 15px; vertical-align: -2px; margin-right: 5px; }
/* buttons already gap their children — drop the icon's own margin there */
.btn .ico-inline { margin-right: 0; }
/* icon-only buttons: no text margin, centered */
.icon-btn .ico-inline, .chip-x .ico-inline, .move-btn .ico-inline { margin-right: 0; width: 14px; height: 14px; vertical-align: middle; }
/* back link: icon + text */
.back-link { display: inline-flex; align-items: center; gap: 5px; }
.back-link .ico-inline { margin-right: 0; }
/* trailing arrow (e.g. "Открыть проект →") */
.with-arrow { display: inline-flex; align-items: center; gap: 5px; }
.with-arrow .ico-inline { margin-right: 0; }
/* landing value icons */
.value-ico { color: var(--acc-cyan); margin-bottom: 12px; line-height: 0; }
.value-ico svg { width: 30px; height: 30px; }

/* ---------- connections (multi-account) ---------- */
.conn-security {
  display: flex; align-items: center; gap: 2px;
  margin: 0 0 26px; padding: 9px 13px;
  background: var(--bg-soft); border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
}

.conn-section { margin-bottom: 34px; }
.conn-section-head {
  display: flex; align-items: center; gap: 14px; margin-bottom: 16px;
  padding-bottom: 14px; border-bottom: 1px solid var(--hairline);
}
.conn-section-meta { flex: 1; min-width: 0; }
.conn-section-title { font-family: var(--display); font-size: 18px; margin: 0; }
.conn-section-sub { margin: 3px 0 0; max-width: 560px; }
.conn-add-btn { flex-shrink: 0; }
.conn-soon-pill { flex-shrink: 0; }

/* platform glyph tile */
.conn-glyph {
  width: 44px; height: 44px; flex-shrink: 0;
  display: grid; place-items: center; border-radius: 13px;
  font-family: var(--display); font-weight: 800; font-size: 15px; letter-spacing: -.01em;
  color: var(--text); background: var(--surface-2); border: 1px solid var(--hairline-2);
}
.conn-glyph-sm { width: 38px; height: 38px; border-radius: 11px; font-size: 13px; }
.conn-glyph[data-platform="telegram"] { background: rgba(96,165,250,.16); color: #8cc4ff; border-color: rgba(96,165,250,.42); }
.conn-glyph[data-platform="vk"]       { background: rgba(34,211,238,.14); color: var(--acc-cyan); border-color: rgba(34,211,238,.40); }
.conn-glyph[data-platform="youtube"]  { background: rgba(251,113,133,.14); color: #ff9aa8; border-color: rgba(251,113,133,.40); }

.conn-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.conn-card { display: flex; flex-direction: column; gap: 12px; padding: 18px; transition: border-color .15s, transform .12s; }
.conn-card:hover { border-color: var(--hairline-2); transform: translateY(-2px); }
.conn-card-top { display: flex; align-items: center; gap: 12px; }
.conn-card-id { flex: 1; min-width: 0; }
.conn-card-name { font-family: var(--display); font-size: 16px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-card-meta { display: block; margin-top: 1px; }
.conn-card-err { margin: 0; }
.conn-card-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 2px; }
.conn-card-actions .inline-form { margin-left: auto; }

.conn-empty {
  padding: 22px; text-align: center; border-radius: var(--radius);
  border: 1px dashed var(--hairline-2); background: var(--bg-soft);
}
.conn-empty p { margin: 0; }
.conn-empty p + p { margin-top: 4px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hub-cols { grid-template-columns: 1fr; }
  .hub-summary { grid-template-columns: repeat(2, 1fr); }
  .upload-grid { grid-template-columns: 1fr; }
  .hero-inner { grid-template-columns: 1fr; }
  .hero-art { display: none; }
  .value-grid { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .clip-grid { grid-template-columns: 1fr; }
  .conn-grid { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 120px 1fr auto; }
  .app-shell { grid-template-columns: 1fr; }
  .app-topbar { display: none; }
  .sidebar {
    position: static; height: auto; flex-direction: row; align-items: center;
    flex-wrap: wrap; gap: 8px; padding: 12px 16px;
  }
  .sidebar .brand { padding: 0 8px 0 0; }
  .side-nav { flex-direction: row; flex: 1; flex-wrap: wrap; }
  .side-foot { border-top: none; padding-top: 0; }
  .side-acct { display: none; }
  .app-content { padding: 22px 18px 70px; }
}
@media (max-width: 560px) {
  .value-grid, .stat-grid { grid-template-columns: 1fr; }
}

/* Billing / subscription plans */
.plan-current { font-size: 15px; }
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.plan-card {
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  padding: 18px;
  background: rgba(255,255,255,.02);
}
.plan-card-current { border-color: rgba(120,170,255,.45); background: rgba(120,170,255,.06); }
.plan-name { font-weight: 600; font-size: 16px; }
.plan-price { font-size: 22px; font-weight: 700; margin: 6px 0 14px; }
.plan-features { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 6px; }
.plan-features li { font-size: 13px; opacity: .8; padding-left: 18px; position: relative; }
.plan-features li::before { content: "✓"; position: absolute; left: 0; opacity: .7; }
.plan-actions { display: flex; flex-direction: column; gap: 8px; }

/* =====================================================================
   Billing — tabbed subscription page (CSS-only tabs, no JS).
   Also styles data-table / form-grid / radio-inline / link / usage-bar,
   which были без стилей (отсюда «отвратительная» вёрстка). Эти классы
   используются ещё и на /app/team — там тоже станет аккуратно.
   ===================================================================== */
.billtabs { margin-top: 4px; }
.billtabs .tab-radio { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.tab-nav {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--hairline); margin: 0 0 22px;
}
.tab-nav label {
  padding: 10px 16px; cursor: pointer; font-weight: 600; font-size: 14px;
  color: var(--text-dim); border-bottom: 2px solid transparent; margin-bottom: -1px;
  border-radius: 10px 10px 0 0;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.tab-nav label:hover { color: var(--text); background: rgba(255,255,255,.03); }
.tab-panel { display: none; }
#bt-plan:checked    ~ #panel-plan,
#bt-history:checked ~ #panel-history,
#bt-req:checked     ~ #panel-req { display: block; }
#bt-plan:checked    ~ .tab-nav label[for="bt-plan"],
#bt-history:checked ~ .tab-nav label[for="bt-history"],
#bt-req:checked     ~ .tab-nav label[for="bt-req"] { color: var(--text); border-bottom-color: var(--acc-cyan); }
#bt-plan:focus-visible    ~ .tab-nav label[for="bt-plan"],
#bt-history:focus-visible ~ .tab-nav label[for="bt-history"],
#bt-req:focus-visible     ~ .tab-nav label[for="bt-req"] { box-shadow: var(--acc-ring); border-radius: 10px; }

/* current-plan summary */
.plan-summary { margin-bottom: 24px; }
.plan-summary-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.plan-summary-name { font-family: var(--display); font-size: 26px; font-weight: 700; margin-top: 2px; }

.usage { margin-top: 18px; }
.usage-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.usage-val { font-variant-numeric: tabular-nums; font-weight: 600; }
.usage-bar { height: 8px; border-radius: 999px; background: rgba(255,255,255,.07); overflow: hidden; }
.usage-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .3s ease; }
.usage-bar-over > span { background: linear-gradient(90deg, #F59E0B, #FB7185); }
.usage-note { margin: 10px 0 0; font-size: 13px; color: var(--st-failed); }

.subhead { font-family: var(--display); font-size: 16px; font-weight: 600; margin: 4px 0 14px; }
.plan-foot { margin-top: 14px; }

/* plan cards inside the tab */
.plan-card { position: relative; display: flex; flex-direction: column; }
.plan-card .plan-actions { margin-top: auto; padding-top: 14px; }
.plan-card-current { border-color: rgba(34,211,238,.45); box-shadow: inset 0 0 0 1px rgba(34,211,238,.22); }
.plan-badge { position: absolute; top: 12px; right: 12px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--accent-ink); background: var(--accent);
  padding: 3px 8px; border-radius: 999px; }

/* status badges */
.badge-ok  { background: rgba(52,211,153,.16); color: #6ee7b7; }
.badge-mut { background: rgba(255,255,255,.07); color: var(--text-dim); }

/* data tables (billing history, team) */
.table-wrap { overflow-x: auto; margin-top: 6px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table thead th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-mut); padding: 0 14px 10px; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
.data-table tbody td { padding: 12px 14px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: rgba(255,255,255,.02); }
.data-table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* inline links */
.link { color: var(--acc-cyan); font-weight: 600; }
.link:hover { text-decoration: underline; }

/* requisites form */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; margin-top: 16px; }
.form-grid .field-full { grid-column: 1 / -1; }
.radio-row { display: flex; gap: 18px; flex-wrap: wrap; }
.radio-inline { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--text); cursor: pointer; }
.empty-inline { padding: 18px 4px; }

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .tab-nav label { flex: 1; text-align: center; padding: 10px 8px; }
}

/* long provider labels ("Оплатить · Тест-оплата (мок)") wrap inside narrow cards */
.plan-actions .btn { white-space: normal; line-height: 1.25; }

.footer-legal{display:flex;gap:16px;flex-wrap:wrap;margin-left:auto}
.footer-legal a{font-size:13px}
@media(max-width:640px){.footer-legal{margin-left:0;width:100%}}
