/* ===========================================================================
   Voiply Testimonials — Admin Portal "Command Center"
   Dark-first, marketer-oriented. Built on the Voiply design tokens.
   =========================================================================== */

@import url("https://api.fontshare.com/v2/css?f[]=aspekta@100,200,300,400,500,600,700,800,900&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap");

/* ── Brand constants (theme-independent) ──────────────────────────────── */
:root {
  --voiply-orange:       #F53900;
  --voiply-orange-press: #DF3400;
  --voiply-orange-coral: #FB522C;
  --voiply-orange-soft:  #F87A54;

  --acc-indigo: #6461FC;
  --acc-lime:   #C6FF00;
  --acc-amber:  #F5B400;
  --acc-green:  #16C784;
  --acc-red:    #FD3844;
  --acc-cyan:   #25F4EE;

  /* platform brand hues */
  --pf-facebook:  #0866FF;
  --pf-instagram: #E1306C;
  --pf-youtube:   #FF0033;
  --pf-tiktok:    #25F4EE;

  --font-heading: "Aspekta", "Inter", system-ui, sans-serif;
  --font-body:    "Aspekta", "Inter", system-ui, sans-serif;
  --font-utility: "Inter", "Aspekta", system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, monospace;

  --radius-1: 6px;
  --radius-2: 10px;
  --radius-3: 14px;
  --radius-4: 20px;
  --radius-pill: 999px;

  --sidebar-w: 240px;
  --accent: var(--voiply-orange);       /* overridable by Tweaks */
  --accent-press: var(--voiply-orange-press);
  --accent-rgb: 245, 57, 0;

  /* density — overwritten by [data-density] */
  --pad-card: 22px;
  --row-gap: 12px;
  --row-pad: 16px;
}

/* ── Dark theme (default) ─────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg-0:    #0B0C0F;       /* app base */
  --bg-1:    #121419;       /* panels / sidebar */
  --bg-2:    #181B22;       /* cards */
  --bg-3:    #20242D;       /* raised / hover */
  --bg-inset:#0E1014;       /* wells, video frames */
  --bg-glass: rgba(18, 20, 25, 0.72);

  --line:    #262B35;       /* hairline */
  --line-soft: #1C2029;

  --fg:      #F4F6FA;        /* primary text */
  --fg-muted:#9AA3B2;        /* secondary */
  --fg-quiet:#646C7B;        /* tertiary */
  --fg-faint:#3D434F;

  --accent-wash: rgba(var(--accent-rgb), 0.14);
  --accent-line: rgba(var(--accent-rgb), 0.38);

  --shadow-card: 0 1px 0 rgba(255,255,255,0.02) inset, 0 18px 40px -20px rgba(0,0,0,0.7);
  --shadow-pop:  0 24px 60px -16px rgba(0,0,0,0.7);
  --grid-line: rgba(255,255,255,0.035);

  color-scheme: dark;
}

/* ── Light theme ──────────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg-0:    #F4F5F7;
  --bg-1:    #FFFFFF;
  --bg-2:    #FFFFFF;
  --bg-3:    #F1F2F5;
  --bg-inset:#EEF0F3;
  --bg-glass: rgba(255,255,255,0.82);

  --line:    #E4E6EB;
  --line-soft: #EDEEF1;

  --fg:      #0B0C10;
  --fg-muted:#585F6B;
  --fg-quiet:#8A909C;
  --fg-faint:#C2C7D0;

  --accent-wash: rgba(var(--accent-rgb), 0.10);
  --accent-line: rgba(var(--accent-rgb), 0.30);

  --shadow-card: 0px 18px 40px -20px rgba(80,90,110,0.22);
  --shadow-pop:  0px 28px 64px -18px rgba(60,70,90,0.28);
  --grid-line: rgba(10,12,16,0.035);

  color-scheme: light;
}

[data-density="compact"] { --pad-card: 16px; --row-gap: 8px;  --row-pad: 12px; }
[data-density="comfy"]   { --pad-card: 28px; --row-gap: 16px; --row-pad: 20px; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg-0);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 15px;
  line-height: 1.5;
}
#root { height: 100%; }
::selection { background: var(--accent); color: #fff; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
input, select, textarea { font-family: inherit; }

/* scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--fg-faint); background-clip: padding-box; }

/* ===========================================================================
   App shell
   =========================================================================== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────────────────── */
.sidebar {
  background: var(--bg-1);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  gap: 4px;
  position: relative;
  z-index: 5;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 18px;
}
.sidebar-logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--accent);
  display: grid; place-items: center;
  box-shadow: 0 6px 18px -6px rgba(var(--accent-rgb), 0.7);
  flex-shrink: 0;
}
.sidebar-logo svg { width: 20px; height: 20px; }
.sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.sidebar-brand-text b { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.sidebar-brand-text span { font-size: 11px; color: var(--fg-quiet); font-weight: 500; }

.nav-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--fg-quiet); padding: 14px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--radius-2);
  color: var(--fg-muted); background: transparent; border: 0;
  width: 100%; text-align: left; font-size: 14px; font-weight: 500;
  transition: background .15s, color .15s;
  position: relative;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-3); color: var(--fg); }
.nav-item.active { background: var(--accent-wash); color: var(--fg); font-weight: 600; }
.nav-item.active::before {
  content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; background: var(--accent); border-radius: 0 3px 3px 0;
}
.nav-item .nav-badge {
  margin-left: auto; font-size: 11px; font-weight: 700;
  background: var(--accent); color: #fff; border-radius: 999px;
  min-width: 20px; height: 20px; padding: 0 6px; display: grid; place-items: center;
}
.nav-item.active .nav-badge { box-shadow: 0 0 0 3px var(--accent-wash); }
.nav-item .nav-badge.muted { background: var(--bg-3); color: var(--fg-muted); }

.sidebar-spacer { flex: 1; }
.sidebar-foot {
  border-top: 1px solid var(--line); padding-top: 12px; margin-top: 8px;
}
.sb-user {
  display: flex; align-items: center; gap: 10px; padding: 8px;
  border-radius: var(--radius-2); cursor: pointer;
}
.sb-user:hover { background: var(--bg-3); }
.sb-user-av {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px;
  background: linear-gradient(135deg, var(--acc-indigo), #9b51e0);
}
.sb-user-text { line-height: 1.15; overflow: hidden; }
.sb-user-text b { font-size: 13px; display: block; }
.sb-user-text span { font-size: 11px; color: var(--fg-quiet); }

/* ── Main column ──────────────────────────────────────────────────────── */
.main {
  display: flex; flex-direction: column; min-width: 0;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(var(--accent-rgb), 0.05), transparent 60%),
    var(--bg-0);
}
.topbar {
  height: 64px; flex-shrink: 0;
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 4;
}
.topbar-title { display: flex; flex-direction: column; line-height: 1.1; }
.topbar-title h1 { font-size: 19px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.topbar-title span { font-size: 12px; color: var(--fg-quiet); font-weight: 500; }
.topbar-spacer { flex: 1; }

.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius-pill); padding: 7px 14px; width: 280px;
  color: var(--fg-quiet); transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-wash); }
.search svg { width: 15px; height: 15px; flex-shrink: 0; }
.search input { background: 0; border: 0; outline: 0; color: var(--fg); font-size: 13.5px; width: 100%; }
.search input::placeholder { color: var(--fg-quiet); }

.icon-btn {
  width: 38px; height: 38px; border-radius: var(--radius-2);
  background: var(--bg-2); border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--fg-muted);
  transition: background .15s, color .15s, border-color .15s;
  position: relative; flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg-3); color: var(--fg); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg-2); }

/* primary button */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border-radius: var(--radius-1); border: 1px solid transparent;
  font-size: 13.5px; font-weight: 600; padding: 9px 16px; white-space: nowrap;
  transition: background .15s, transform .08s, box-shadow .15s, border-color .15s, color .15s;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), 0 8px 20px -8px rgba(var(--accent-rgb), 0.6);
}
.btn-primary:hover { background: var(--accent-press); }
.btn-ghost { background: var(--bg-2); color: var(--fg); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg-3); }
.btn-quiet { background: transparent; color: var(--fg-muted); }
.btn-quiet:hover { background: var(--bg-3); color: var(--fg); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn:disabled { opacity: .5; pointer-events: none; }

.content {
  flex: 1; overflow-y: auto; padding: 26px 28px 60px;
}
.content-narrow { max-width: 1180px; margin: 0 auto; width: 100%; }

/* ===========================================================================
   Generic primitives: cards, pills, stats
   =========================================================================== */
.card {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius-3); box-shadow: var(--shadow-card);
}
.card-pad { padding: var(--pad-card); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.01em;
  padding: 3px 10px; border-radius: var(--radius-pill);
  border: 1px solid transparent; white-space: nowrap; line-height: 1.4;
}
.pill svg { width: 12px; height: 12px; }
.pill-new      { background: var(--accent-wash); color: var(--accent); border-color: var(--accent-line); }
.pill-approved { background: rgba(22,199,132,0.14); color: var(--acc-green); border-color: rgba(22,199,132,0.32); }
.pill-paid     { background: rgba(22,199,132,0.14); color: var(--acc-green); border-color: rgba(22,199,132,0.32); }
.pill-used     { background: rgba(245,180,0,0.16); color: var(--acc-amber); border-color: rgba(245,180,0,0.34); }
.pill-rejected { background: rgba(253,56,68,0.14); color: var(--acc-red); border-color: rgba(253,56,68,0.32); }
.pill-gray     { background: var(--bg-3); color: var(--fg-muted); border-color: var(--line); }
.pill-indigo   { background: rgba(100,97,252,0.16); color: #8f8dff; border-color: rgba(100,97,252,0.34); }
.pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--fg-quiet);
}
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 14px; }
.section-head h2 { font-size: 16px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.section-head .sub { font-size: 12.5px; color: var(--fg-quiet); }

/* stat / KPI tiles */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-3);
  padding: 18px 20px; box-shadow: var(--shadow-card); position: relative; overflow: hidden;
}
.kpi-top { display: flex; align-items: center; gap: 8px; color: var(--fg-quiet); font-size: 12.5px; font-weight: 600; margin-bottom: 10px; }
.kpi-top .kpi-ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--bg-3); color: var(--fg-muted); }
.kpi-top .kpi-ico svg { width: 15px; height: 15px; }
.kpi-val { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; font-feature-settings: "tnum"; }
.kpi-val .unit { font-size: 16px; font-weight: 600; color: var(--fg-quiet); margin-left: 2px; }
.kpi-foot { margin-top: 10px; font-size: 12px; color: var(--fg-muted); display: flex; align-items: center; gap: 6px; }
.trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-size: 11.5px; padding: 2px 7px; border-radius: 999px; }
.trend.up   { color: var(--acc-green); background: rgba(22,199,132,0.13); }
.trend.down { color: var(--acc-red); background: rgba(253,56,68,0.13); }
.trend svg { width: 11px; height: 11px; }
.kpi-spark { position: absolute; right: 0; bottom: 0; left: 0; height: 38px; opacity: .9; }

/* avatars */
.avatar { border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; flex-shrink: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ===========================================================================
   Review inbox
   =========================================================================== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab {
  background: 0; border: 0; padding: 10px 14px 12px; font-size: 13.5px; font-weight: 600;
  color: var(--fg-muted); position: relative; display: flex; align-items: center; gap: 7px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--fg); }
.tab.active { color: var(--fg); border-bottom-color: var(--accent); }
.tab .tab-count { font-size: 11px; font-weight: 700; background: var(--bg-3); color: var(--fg-muted); border-radius: 999px; padding: 1px 7px; }
.tab.active .tab-count { background: var(--accent-wash); color: var(--accent); }

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-2); padding: 3px; gap: 2px; }
.seg button { background: 0; border: 0; padding: 6px 13px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--fg-muted); }
.seg button.active { background: var(--bg-3); color: var(--fg); box-shadow: var(--shadow-card); }
.select {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-2);
  color: var(--fg); padding: 8px 12px; font-size: 13px; font-weight: 500;
}

.inbox-list { display: flex; flex-direction: column; gap: var(--row-gap); }
.sub-row {
  display: flex; align-items: center; gap: 14px; padding: var(--row-pad);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-3);
  cursor: pointer; transition: border-color .15s, background .15s, transform .08s;
  position: relative; text-align: left; width: 100%;
}
.sub-row:hover { border-color: var(--accent-line); background: var(--bg-3); }
.sub-row.unread { border-left: 3px solid var(--accent); }
.sub-row .row-av { width: 44px; height: 44px; font-size: 14px; }
.sub-main { flex: 1; min-width: 0; }
.sub-top { display: flex; align-items: center; gap: 9px; margin-bottom: 3px; }
.sub-name { font-size: 14.5px; font-weight: 700; }
.sub-email { font-size: 12.5px; color: var(--fg-quiet); }
.sub-meta { display: flex; align-items: center; gap: 8px; margin-top: 7px; flex-wrap: wrap; }
.chip { font-size: 11.5px; color: var(--fg-muted); display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.chip strong { color: var(--fg); }
.sub-when { font-size: 12px; color: var(--fg-quiet); font-weight: 600; white-space: nowrap; }
.sub-when.urgent { color: var(--acc-red); }

/* AI score badge */
.ai-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 2px 8px 2px 5px; border-radius: 999px; }
.ai-badge .ai-ring { width: 16px; height: 16px; }
.score-good { background: rgba(22,199,132,0.13); color: var(--acc-green); }
.score-fair { background: rgba(245,180,0,0.15); color: var(--acc-amber); }
.score-poor { background: rgba(253,56,68,0.14); color: var(--acc-red); }
.score-pending { background: var(--bg-3); color: var(--fg-quiet); }

/* clip strip thumbnails on a row */
.clip-strip { display: flex; gap: 5px; }
.clip-dot { width: 30px; height: 40px; border-radius: 6px; background: var(--bg-inset); border: 1px solid var(--line); position: relative; overflow: hidden; flex-shrink: 0; }
.clip-dot .cd-state { position: absolute; inset: auto 0 0 0; height: 3px; }

/* ===========================================================================
   Review detail (split)
   =========================================================================== */
.review { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start; }
.review-rail { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 84px; }
.rail-clip {
  display: flex; gap: 11px; align-items: center; padding: 9px; border-radius: var(--radius-2);
  border: 1px solid var(--line); background: var(--bg-2); width: 100%; text-align: left;
  transition: border-color .15s, background .15s;
}
.rail-clip:hover { background: var(--bg-3); }
.rail-clip.active { border-color: var(--accent); background: var(--accent-wash); }
.rail-thumb { width: 46px; height: 60px; border-radius: 7px; background: var(--bg-inset); position: relative; overflow: hidden; flex-shrink: 0; display: grid; place-items: center; color: var(--fg-faint); }
.rail-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rail-num { position: absolute; top: 3px; left: 4px; font-size: 9.5px; font-weight: 800; background: rgba(0,0,0,0.55); color: #fff; border-radius: 4px; padding: 0 4px; }
.rail-score { position: absolute; bottom: 3px; right: 3px; width: 17px; height: 17px; border-radius: 5px; font-size: 9.5px; font-weight: 800; display: grid; place-items: center; }
.rail-info { min-width: 0; flex: 1; }
.rail-info .rt { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-info .rm { display: flex; gap: 6px; align-items: center; margin-top: 4px; }

.player {
  aspect-ratio: 16/9; background: var(--bg-inset); border-radius: var(--radius-3);
  border: 1px solid var(--line); position: relative; overflow: hidden;
  display: grid; place-items: center;
}
.player.vertical { aspect-ratio: 9/16; max-height: 460px; margin: 0 auto; }
.player img { width: 100%; height: 100%; object-fit: cover; opacity: .8; }
.player-play { position: absolute; width: 64px; height: 64px; border-radius: 50%; background: rgba(255,255,255,0.92); display: grid; place-items: center; box-shadow: var(--shadow-pop); transition: transform .15s; }
.player:hover .player-play { transform: scale(1.06); }
.player-play svg { width: 24px; height: 24px; color: #111; margin-left: 3px; }
.player-bar { position: absolute; left: 14px; right: 14px; bottom: 12px; display: flex; align-items: center; gap: 10px; }
.player-track { flex: 1; height: 4px; background: rgba(255,255,255,0.25); border-radius: 999px; overflow: hidden; }
.player-track i { display: block; height: 100%; width: 34%; background: var(--accent); border-radius: 999px; }
.player-time { font-size: 11px; font-weight: 700; color: #fff; font-family: var(--font-mono); }
.player-badge { position: absolute; top: 12px; left: 12px; }

.detail-block { margin-top: 18px; }
.detail-label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-quiet); margin-bottom: 9px; display: flex; align-items: center; gap: 8px; }
.transcript { background: var(--bg-inset); border: 1px solid var(--line); border-radius: var(--radius-2); padding: 14px 16px; font-size: 14px; color: var(--fg-muted); line-height: 1.65; }
.transcript mark { background: var(--accent-wash); color: var(--fg); padding: 0 2px; border-radius: 3px; }
.fills { display: flex; flex-direction: column; gap: 8px; }
.fill { display: flex; gap: 10px; font-size: 13.5px; }
.fill .fk { font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-quiet); text-transform: uppercase; letter-spacing: .04em; padding-top: 3px; min-width: 64px; }
.fill .fv { color: var(--fg); }

.action-bar { display: flex; gap: 10px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); flex-wrap: wrap; align-items: center; }
.kbd { font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; background: rgba(255,255,255,0.08); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; color: var(--fg-muted); margin-left: 4px; }
[data-theme="light"] .kbd { background: var(--bg-3); }

/* AI verify card */
.verify {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-3);
  padding: 16px 18px; display: flex; gap: 16px; align-items: flex-start;
}
.verify-ring { flex-shrink: 0; width: 58px; height: 58px; position: relative; }
.verify-ring .vr-num { position: absolute; inset: 0; display: grid; place-items: center; font-size: 18px; font-weight: 800; }
.verify-body { flex: 1; min-width: 0; }
.verify-facets { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.facet { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--bg-3); color: var(--fg-muted); }
.facet svg { width: 12px; height: 12px; }
.facet.ok { color: var(--acc-green); }
.facet.bad { color: var(--acc-red); }

/* ===========================================================================
   Studio (Creatomate version generator)
   =========================================================================== */
.studio { display: grid; grid-template-columns: 300px 1fr; gap: 22px; align-items: start; }
.studio-src { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 16px; }
.src-clip-card { padding: 14px; }
.src-video { aspect-ratio: 9/16; max-width: 200px; margin: 0 auto 12px; border-radius: var(--radius-2); overflow: hidden; background: var(--bg-inset); position: relative; display:grid; place-items:center; }
.src-video img { width: 100%; height: 100%; object-fit: cover; }

.preset-grid { display: grid; gap: 10px; }
.opt-row { display: flex; flex-direction: column; gap: 7px; }
.opt-row > .detail-label { margin-bottom: 0; }
.chip-select { display: flex; gap: 7px; flex-wrap: wrap; }
.chip-opt {
  border: 1px solid var(--line); background: var(--bg-2); color: var(--fg-muted);
  border-radius: var(--radius-2); padding: 7px 11px; font-size: 12.5px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px; transition: all .14s;
}
.chip-opt:hover { border-color: var(--accent-line); color: var(--fg); }
.chip-opt.on { border-color: var(--accent); background: var(--accent-wash); color: var(--fg); }
.chip-opt .ar-glyph { border: 1.5px solid currentColor; border-radius: 2px; display: block; opacity: .8; }

/* version grid */
.ver-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.ver-card {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-3);
  overflow: hidden; box-shadow: var(--shadow-card); transition: border-color .15s, transform .12s;
  position: relative;
}
.ver-card:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.ver-card.new-ph { border-style: dashed; background: transparent; box-shadow: none; display: grid; place-items: center; min-height: 240px; color: var(--fg-quiet); }
.ver-card.new-ph:hover { border-color: var(--accent); color: var(--accent); }
.ver-frame { position: relative; background: var(--bg-inset); display: grid; place-items: center; overflow: hidden; }
.ver-frame img { width: 100%; height: 100%; object-fit: cover; }
.ver-frame .ver-ar { position: absolute; top: 8px; left: 8px; font-size: 10px; font-weight: 800; background: rgba(0,0,0,0.6); color: #fff; padding: 2px 7px; border-radius: 5px; }
.ver-cap { position: absolute; left: 8px; right: 8px; bottom: 12px; text-align: center; font-size: 11px; font-weight: 800; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.8); line-height: 1.2; }
.ver-cap.karaoke span { color: var(--acc-lime); }
.ver-status-ov { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(11,12,15,0.62); backdrop-filter: blur(2px); color: #fff; gap: 8px; }
.ver-prog { width: 60%; height: 5px; background: rgba(255,255,255,0.2); border-radius: 999px; overflow: hidden; }
.ver-prog i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s; }
.ver-info { padding: 12px 13px; }
.ver-info .vt { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.ver-info .vm { font-size: 11.5px; color: var(--fg-quiet); margin-top: 3px; display: flex; gap: 6px; flex-wrap: wrap; }
.ver-actions { display: flex; gap: 6px; padding: 0 13px 13px; }
.ver-actions .btn { flex: 1; }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,0.25); border-top-color: #fff; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* platform mini icons */
.pf-ico { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; flex-shrink: 0; }
.pf-ico svg { width: 12px; height: 12px; color: #fff; }
.pf-facebook  { background: var(--pf-facebook); }
.pf-instagram { background: linear-gradient(135deg,#FEDA75,#FA7E1E,#D62976,#962FBF); }
.pf-youtube   { background: var(--pf-youtube); }
.pf-tiktok    { background: #010101; }
.pf-tiktok svg { color: var(--pf-tiktok); }

/* ── Live pipeline flow board ─────────────────────────────────────────── */
.flow-card { padding: var(--pad-card); margin-bottom: 18px; }
.flow-live { display: inline-flex; align-items: center; gap: 7px; font-size: 15px; font-weight: 700; }
.flow {
  display: flex; align-items: stretch; gap: 0; overflow-x: auto; padding-bottom: 4px;
  scrollbar-width: none;
}
.flow::-webkit-scrollbar { display: none; }
.flow-node {
  flex: 1 1 108px; min-width: 104px; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius-3); padding: 14px 10px 12px; display: flex; flex-direction: column;
  align-items: center; gap: 6px; text-align: center; position: relative; cursor: pointer;
  transition: border-color .15s, transform .1s, background .15s;
}
.flow-node:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.flow-node.auto { background: linear-gradient(180deg, var(--accent-wash), transparent 70%); }
.flow-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--bg-3); }
.flow-node.auto .flow-ico { background: var(--bg-2); box-shadow: 0 0 0 1px var(--accent-line); }
.flow-count { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; font-feature-settings: "tnum"; }
.flow-name { font-size: 12.5px; font-weight: 600; color: var(--fg-muted); }
.flow-auto {
  display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700;
  padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-3);
  color: var(--fg-quiet); margin-top: 2px; transition: all .15s;
}
.flow-auto svg { width: 11px; height: 11px; }
.flow-auto.on { background: var(--accent-wash); color: var(--accent); border-color: var(--accent-line); }
.flow-auto-sub { font-size: 9.5px; color: var(--fg-quiet); font-weight: 500; }

.flow-link { flex: 0 0 34px; align-self: center; height: 3px; position: relative; display: flex; align-items: center; justify-content: center; margin: 0 -2px; }
.flow-link::before { content: ""; position: absolute; inset: 0; height: 2px; top: 50%; transform: translateY(-50%); border-radius: 2px; }
.flow-link.flowing::before { background: var(--accent-line); }
.flow-link.gated::before { background: var(--line); border-top: 2px dashed var(--line); height: 0; }
.flow-dot { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); top: 50%; left: 0; transform: translateY(-50%); box-shadow: 0 0 6px var(--accent); animation: flowmove linear infinite; }
@keyframes flowmove { from { left: 0; opacity: 0; } 12% { opacity: 1; } 88% { opacity: 1; } to { left: 100%; opacity: 0; } }
.flow-gate { width: 18px; height: 18px; border-radius: 50%; background: var(--bg-1); border: 1px solid var(--line); display: grid; place-items: center; color: var(--fg-quiet); position: relative; z-index: 1; }
@media (prefers-reduced-motion: reduce) { .flow-dot { animation: none; opacity: .6; } }

.flow-legend { display: flex; align-items: center; gap: 18px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--fg-muted); flex-wrap: wrap; }
.flow-legend span { display: inline-flex; align-items: center; gap: 7px; }
.lg-dot { width: 8px; height: 8px; border-radius: 50%; }
.lg-dot.flowing { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.lg-dot.gated { background: transparent; border: 1.5px dashed var(--fg-quiet); }

/* activity feed */
.feed { display: flex; flex-direction: column; }
.feed-row { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.feed-row:last-child { border-bottom: 0; padding-bottom: 0; }
.feed-ico { width: 30px; height: 30px; border-radius: 9px; background: var(--bg-3); display: grid; place-items: center; flex-shrink: 0; }
.feed-body { min-width: 0; flex: 1; }
.feed-txt { font-size: 13px; }
.feed-txt b { font-weight: 700; }
.feed-meta { display: flex; align-items: center; gap: 10px; margin-top: 3px; }
.feed-auto { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700; color: var(--acc-indigo); }
.feed-manual { font-size: 10.5px; font-weight: 700; color: var(--fg-quiet); }
.feed-meta .muted { font-size: 11px; }

/* ── Pipeline stepper ─────────────────────────────────────────────────── */
.pipe { display: flex; align-items: center; gap: 8px; margin-bottom: 22px; }
.pipe-step {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-pill);
  transition: border-color .15s, background .15s;
}
.pipe-step.active { border-color: var(--accent); background: var(--accent-wash); }
.pipe-step.done .pipe-num { background: var(--acc-green); color: #fff; }
.pipe-num {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; background: var(--bg-3); color: var(--fg-muted); flex-shrink: 0;
}
.pipe-step.active .pipe-num { background: var(--accent); color: #fff; }
.pipe-txt { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.pipe-txt b { font-size: 13px; font-weight: 700; }
.pipe-txt span { font-size: 11px; color: var(--fg-quiet); }
.pipe-line { flex: 1; height: 2px; background: var(--line); border-radius: 2px; max-width: 70px; }
.pipe-line.done { background: var(--acc-green); }

/* ── Reframe / crop picker ────────────────────────────────────────────── */
.reframe {
  position: relative; margin: 0 auto; border-radius: var(--radius-2); overflow: hidden;
  background: var(--bg-inset); border: 1px solid var(--line); cursor: crosshair; touch-action: none;
  user-select: none;
}
.reframe img { width: 100%; height: 100%; object-fit: cover; transition: object-position .08s linear; }
.reframe-grid { position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 33.33% 33.33%;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}
.reframe-focus {
  position: absolute; width: 26px; height: 26px; transform: translate(-50%, -50%); pointer-events: none;
  border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 2px rgba(0,0,0,0.45), 0 2px 8px rgba(0,0,0,0.5);
}
.reframe-focus::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px rgba(255,255,255,0.9); }
.zoom-range { -webkit-appearance: none; appearance: none; width: 100%; height: 5px; border-radius: 999px; background: var(--bg-3); outline: none; }
.zoom-range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,0.4); border: 2px solid var(--bg-1); }
.zoom-range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 2px solid var(--bg-1); }
.crop-previews { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.crop-prev { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.crop-prev-box { border-radius: 5px; overflow: hidden; background: var(--bg-inset); border: 1px solid var(--line); }
.crop-prev-box img { width: 100%; height: 100%; object-fit: cover; transition: object-position .08s linear; }
.crop-prev span { font-size: 9.5px; font-weight: 700; color: var(--fg-quiet); }

.pipe-handoff { margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-color: var(--accent-line); background: linear-gradient(90deg, var(--accent-wash), transparent); }

/* ── Templates editor ─────────────────────────────────────────────────── */
.tpl-layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
.tpl-list { display: flex; flex-direction: column; gap: 8px; position: sticky; top: 84px; }
.tpl-item { display: flex; align-items: center; gap: 11px; padding: 11px; border-radius: var(--radius-2); border: 1px solid var(--line); background: var(--bg-2); text-align: left; transition: border-color .15s, background .15s; }
.tpl-item:hover { background: var(--bg-3); }
.tpl-item.active { border-color: var(--accent); background: var(--accent-wash); }
.tpl-ar { flex-shrink: 0; border: 1.5px solid var(--fg-quiet); border-radius: 3px; display: grid; place-items: center; font-size: 8px; font-weight: 800; color: var(--fg-quiet); }
.tpl-item.active .tpl-ar { border-color: var(--accent); color: var(--accent); }
.tpl-item-main { flex: 1; min-width: 0; }
.tpl-item-name { font-size: 13px; font-weight: 700; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl-item-meta { font-size: 10.5px; color: var(--fg-quiet); }

.tpl-detail { min-width: 0; }
.tpl-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.tpl-body { display: grid; grid-template-columns: 300px 1fr; gap: 22px; align-items: start; }
.tpl-preview-wrap { position: sticky; top: 84px; }
.tpl-canvas { position: relative; margin: 8px auto 0; border-radius: var(--radius-2); overflow: hidden; background: #080808; border: 1px solid var(--line); box-shadow: var(--shadow-card); }
.tpl-canvas-bg { position: absolute; inset: 0; }
.tpl-canvas-vid { position: absolute; inset: 0; width: 100%; height: 100%; }
.tpl-ov { position: absolute; z-index: 2; }
.tpl-disc { top: 4%; left: 50%; transform: translateX(-50%); font-size: 9px; font-weight: 500; font-family: var(--font-utility); background: rgba(0,0,0,0.4); padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.tpl-logo { top: 6%; left: 7%; width: 22px; height: 22px; }
.tpl-logo svg { width: 100%; height: 100%; }
.tpl-cap { bottom: 19%; left: 8%; right: 8%; text-align: center; font-size: 16px; font-weight: 800; line-height: 1.1; text-shadow: 0 2px 6px rgba(0,0,0,0.7); }
.tpl-name { bottom: 11%; left: 0; right: 0; text-align: center; font-size: 11px; font-weight: 600; text-shadow: 0 1px 4px rgba(0,0,0,0.8); }
.tpl-cta { bottom: 0; left: 0; right: 0; padding: 9px 8px; text-align: center; font-size: 11px; font-weight: 800; color: #fff; }
.tpl-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }

.tpl-editor { min-width: 0; }
.layer-list { display: flex; flex-direction: column; gap: 10px; }
.layer-row { display: flex; gap: 12px; padding: 13px 15px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-2); }
.layer-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--bg-3); color: var(--fg-muted); flex-shrink: 0; }
.layer-ico[data-t="video"] { background: var(--accent-wash); color: var(--accent); }
.layer-ico[data-t="text"] { background: rgba(100,97,252,0.16); color: #8f8dff; }
.layer-main { flex: 1; min-width: 0; }
.layer-name { font-size: 13px; font-weight: 700; }
.layer-type { font-size: 10.5px; color: var(--fg-quiet); margin-left: auto; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.layer-desc { font-size: 12px; color: var(--fg-muted); margin-top: 2px; }
.layer-token { margin-top: 7px; font-size: 12px; background: var(--bg-inset); border: 1px dashed var(--accent-line); color: var(--accent); padding: 6px 10px; border-radius: 6px; }
.layer-input { margin-top: 7px; width: 100%; background: var(--bg-inset); border: 1px solid var(--line); border-radius: 6px; color: var(--fg); padding: 7px 10px; font-size: 13px; outline: none; }
.layer-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.color-input { width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; cursor: pointer; flex-shrink: 0; }
.layer-sub { font-size: 11px; margin-top: 6px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.swatch-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; border: 1px solid var(--line); margin: 0 1px; }

.code-block { background: var(--bg-inset); border: 1px solid var(--line); border-radius: var(--radius-2); padding: 16px; font-family: var(--font-mono); font-size: 12px; line-height: 1.6; color: var(--fg-muted); overflow-x: auto; white-space: pre; margin: 0; }

@media (max-width: 820px) {
  .tpl-layout { grid-template-columns: 1fr; }
  .tpl-list { position: static; }
}
@media (max-width: 1180px) {
  .tpl-body { grid-template-columns: 1fr; }
  .tpl-preview-wrap { position: static; }
  .tpl-canvas { max-width: 220px !important; }
}

/* ===========================================================================
   Distribution
   =========================================================================== */
.dist-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; align-items: start; }
.dist-col { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius-3); display: flex; flex-direction: column; min-height: 200px; }
.dist-col-head { display: flex; align-items: center; gap: 9px; padding: 13px 15px; border-bottom: 1px solid var(--line); }
.dist-col-head .pf-ico { width: 24px; height: 24px; border-radius: 7px; }
.dist-col-head .pf-ico svg { width: 14px; height: 14px; }
.dist-col-head b { font-size: 13.5px; font-weight: 700; }
.dist-col-head .ct { margin-left: auto; font-size: 11.5px; font-weight: 700; color: var(--fg-quiet); background: var(--bg-3); border-radius: 999px; padding: 1px 8px; }
.dist-col-body { padding: 12px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.dist-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-2); padding: 11px; }
.dist-card-top { display: flex; gap: 10px; align-items: center; }
.dist-thumb { width: 34px; height: 46px; border-radius: 6px; background: var(--bg-inset); overflow: hidden; flex-shrink: 0; position: relative; }
.dist-thumb img { width: 100%; height: 100%; object-fit: cover; }
.dist-card-meta { min-width: 0; flex: 1; }
.dist-card-meta .dn { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dist-card-meta .ds { font-size: 11px; color: var(--fg-quiet); }
.dist-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; }
.dist-metric { font-size: 11px; color: var(--fg-muted); display: inline-flex; gap: 4px; align-items: center; font-weight: 600; }
.dist-metric svg { width: 12px; height: 12px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--acc-green); box-shadow: 0 0 0 0 rgba(22,199,132,0.6); animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(22,199,132,0.55);} 70%{box-shadow:0 0 0 7px rgba(22,199,132,0);} 100%{box-shadow:0 0 0 0 rgba(22,199,132,0);} }

/* ===========================================================================
   Modal
   =========================================================================== */
.overlay { position: fixed; inset: 0; background: rgba(5,6,8,0.6); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 50; padding: 24px; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius-4); box-shadow: var(--shadow-pop); width: 100%; max-width: 480px; animation: pop .18s cubic-bezier(.2,.9,.3,1.2); }
@keyframes pop { from { transform: scale(.96) translateY(8px); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 0; }
.modal-head h3 { margin: 0; font-size: 18px; font-weight: 700; }
.modal-body { padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--fg-muted); }
.field input, .field textarea, .field select {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-2);
  color: var(--fg); padding: 10px 12px; font-size: 14px; outline: none;
}
.field input:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.checkbox { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--fg); cursor: pointer; }
.checkbox input { width: 17px; height: 17px; accent-color: var(--accent); }

/* toast */
.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast {
  background: var(--bg-1); border: 1px solid var(--line); border-left: 3px solid var(--acc-green);
  border-radius: var(--radius-2); padding: 12px 16px; box-shadow: var(--shadow-pop);
  display: flex; align-items: center; gap: 11px; font-size: 13.5px; font-weight: 600; min-width: 280px;
  animation: toastin .25s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes toastin { from { transform: translateY(16px); opacity: 0; } }
.toast .t-ico { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: rgba(22,199,132,0.16); color: var(--acc-green); flex-shrink: 0; }
.toast .t-ico svg { width: 15px; height: 15px; }

/* empty */
.empty { display: grid; place-items: center; text-align: center; padding: 70px 20px; gap: 14px; }
.empty-ico { width: 64px; height: 64px; border-radius: 18px; background: var(--bg-2); border: 1px solid var(--line); display: grid; place-items: center; color: var(--fg-quiet); }
.empty-ico svg { width: 28px; height: 28px; }
.empty b { font-size: 16px; }
.empty span { font-size: 13.5px; color: var(--fg-quiet); max-width: 320px; }

/* misc utilities */
.row { display: flex; align-items: center; gap: 10px; }
.muted { color: var(--fg-quiet); }
.mono { font-family: var(--font-mono); }
.grow { flex: 1; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
hr.soft { border: 0; border-top: 1px solid var(--line); margin: 0; }

/* mobile bottom nav — hidden on desktop */
.mobnav { display: none; }

@media (max-width: 1080px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dist-board { grid-template-columns: repeat(2, 1fr); }
  .review, .studio { grid-template-columns: 1fr; }
  .review-rail, .studio-src { position: static; }
}

/* ── Tablet / small ───────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }

  .topbar { height: 58px; padding: 0 16px; gap: 10px; }
  .topbar-title h1 { font-size: 17px; }
  .topbar-title span { display: none; }
  .topbar .search { display: none; }
  .mob-only { display: inline-flex !important; }

  .content { padding: 18px 16px 96px; }

  /* bottom tab bar */
  .mobnav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: var(--bg-glass); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    justify-content: space-around;
  }
  .mobnav-item {
    flex: 1; background: 0; border: 0; display: flex; flex-direction: column;
    align-items: center; gap: 3px; padding: 6px 2px; color: var(--fg-quiet);
    border-radius: var(--radius-2); position: relative; min-width: 0;
  }
  .mobnav-item svg { width: 21px; height: 21px; }
  .mobnav-item span { font-size: 10px; font-weight: 600; letter-spacing: -0.01em; }
  .mobnav-item.active { color: var(--accent); }
  .mobnav-badge {
    position: absolute; top: 2px; left: 50%; margin-left: 4px;
    min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
    background: var(--accent); color: #fff; font-size: 9.5px; font-weight: 800;
    display: grid; place-items: center;
  }
  .mobnav-badge.muted { background: var(--bg-3); color: var(--fg-muted); }

  /* studio: reframe preview not full-bleed */
  .reframe { max-width: 220px !important; }
  .crop-previews { justify-content: center; }
  .ver-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .ver-card.new-ph { min-height: 180px; }

  /* templates */
  .tpl-detail-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .tpl-detail-head > .row:last-child { flex-wrap: wrap; }

  /* tabs + toolbars scroll horizontally instead of wrapping awkwardly */
  .tabs, .pipe { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; flex-wrap: nowrap; }
  .tabs::-webkit-scrollbar, .pipe::-webkit-scrollbar { display: none; }
  .tab, .pipe-step { white-space: nowrap; flex-shrink: 0; }
  .pipe-line { min-width: 24px; }

  /* review detail header action button full width */
  .action-bar .btn { flex: 1 1 auto; }
}

.mob-only { display: none; }

/* ── Phone ────────────────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi { padding: 14px 15px; }
  .kpi-val { font-size: 25px; }
  .dist-board { grid-template-columns: 1fr; }

  /* overview two-up rows stack */
  .content-narrow > div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

  .sub-row { gap: 10px; padding: 13px; flex-wrap: wrap; }
  .sub-row .clip-strip { order: 5; width: 100%; }
  .sub-row > svg:last-child { display: none; }
  .sub-when { margin-left: auto; }

  /* review detail header: stack name + pay button */
  .review .card .row[style*="flex-start"] { flex-wrap: wrap; }
  .review .card .btn-lg { width: 100%; }
  .review .card > div[style*="repeat(4"] { grid-template-columns: repeat(2, 1fr) !important; gap: 14px !important; }

  .modal { max-width: 100%; }
  .toast { min-width: 0; width: calc(100vw - 32px); }
  .toast-wrap { left: 16px; right: 16px; transform: none; }

  .player.vertical { max-height: 60vh; }
}
