/* slidefarm — light 1:1 ReelFarm theme. No build step; hand-authored. */

/* Real slide fonts, served from /fonts (same TTFs Satori renders with) so the
   editor preview matches rendered slides. See src/app.ts + src/render/fonts.ts. */
@font-face { font-family: "TikTokSans"; src: url("/fonts/TikTokSans-w400.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "TikTokSans"; src: url("/fonts/TikTokSans-w500.ttf") format("truetype"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "TikTokSans"; src: url("/fonts/TikTokSans-w600.ttf") format("truetype"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "TikTokSans"; src: url("/fonts/TikTokSans-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Bebas"; src: url("/fonts/BebasNeue-Regular.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Cormorant"; src: url("/fonts/CormorantGaramond-Static.ttf") format("truetype"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Cormorant"; src: url("/fonts/CormorantGaramond-Italic-Static.ttf") format("truetype"); font-weight: 500; font-style: italic; font-display: swap; }

:root {
  --bg: #f4f2ec;
  --surface: #fff;
  --surface-2: #faf8f3;
  --line: #e7e3d9;
  --txt: #1c1b19;
  --dim: #8a857b;
  --primary: #fe5b25;
  --primary-weak: #ffece3;
  /* RF's link/focus blue (#388EFF; blue-500 on text links). */
  --blue: #388eff;
  --ok: #1fae5a;
  --off: #c2beb4;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 18, 15, 0.04), 0 4px 16px rgba(20, 18, 15, 0.04);
  --shadow-lg: 0 12px 40px rgba(20, 18, 15, 0.16);
  --sidebar-w: 232px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--txt);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 14px; color: var(--txt); }
/* Default inline-icon size; class-scoped rules (.btn svg, .nav svg) override. */
svg { width: 16px; height: 16px; flex: 0 0 auto; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .logo {
  font-size: 20px; font-weight: 800; letter-spacing: -0.02em;
  padding: 6px 10px 18px; display: flex; align-items: center; gap: 8px;
}
.sidebar .logo .dot { width: 12px; height: 12px; border-radius: 4px; background: var(--primary); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  color: var(--dim); font-weight: 600; transition: background .12s, color .12s;
}
.nav a svg { width: 18px; height: 18px; flex: 0 0 18px; }
.nav a:hover { background: var(--surface-2); color: var(--txt); }
.nav a.active { background: var(--primary-weak); color: var(--primary); }
.sidebar .spacer { flex: 1; }
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.user-card .meta { min-width: 0; }
.user-card .meta .name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card .meta .sub { color: var(--dim); font-size: 12px; }
.sidebar .signout { width: 100%; margin-top: 8px; justify-content: center; color: var(--dim); }
.sidebar .signout:hover { color: var(--txt); }

.content { flex: 1; min-width: 0; padding: 28px 34px 60px; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.view-head h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.view-head .sub { color: var(--dim); margin-top: 2px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  border: 1px solid var(--line); background: var(--surface); color: var(--txt);
  padding: 9px 15px; border-radius: 999px; font-weight: 650; font-size: 13.5px;
  transition: background .12s, border-color .12s, transform .04s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: #ef4f1c; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; }
.btn.icon { padding: 7px; width: 34px; height: 34px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.danger { color: #d6432b; border-color: #f2cabf; }
.btn.danger:hover { background: #fdece7; }

/* ── Cards / grids ──────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
/* 3-column compact grid, matching RF's 306px tracks + 16px gutter at 1280. */
.cards-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--off); flex: 0 0 9px; }
.status-dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(31,174,90,.16); }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.thumb { position: relative; aspect-ratio: 9/16; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.tappable { cursor: pointer; transition: border-color .12s ease, transform .12s ease; }
.thumb.tappable:hover { border-color: var(--primary); transform: translateY(-1px); }
.thumb .overlay { position: absolute; left: 0; right: 0; bottom: 0; padding: 5px 6px; display: flex; gap: 8px; font-size: 11px; font-weight: 700; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.6)); }
.acct { display: flex; align-items: center; gap: 9px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: var(--surface-2); border: 1px solid var(--line); flex: 0 0 30px; }
.avatar.sm { width: 22px; height: 22px; flex-basis: 22px; }
.avatar.lg { width: 46px; height: 46px; flex-basis: 46px; }
.avatar.fallback { display: grid; place-items: center; font-weight: 800; color: var(--dim); font-size: 12px; text-transform: uppercase; }
.acct .handle { font-weight: 700; font-size: 13px; }
.acct .dname { color: var(--dim); font-size: 12px; }
.handle-label .at { font-weight: 700; }
.handle-label .dn { color: var(--dim); font-size: 12px; }
.handle-label:not(.inline) { display: flex; flex-direction: column; }
.handle-label.inline { display: inline-flex; align-items: baseline; gap: 6px; }
.newcard {
  border: 1.5px dashed var(--off); background: transparent; border-radius: 8px;
  display: grid; place-items: center; min-height: 200px; color: var(--dim); font-weight: 700; gap: 8px;
}
.newcard:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-weak); }

/* ── Automation card (RF-faithful) ──────────────────────────────────────────
   Geometry copied from live reel.farm at 1280 (306x334 card, 3x 16px grid).
   Internals are `ac-` scoped: `.thumb`/`.acct`/`.overlay` stay as-is for the
   editor + side panel, which share those classes. */
.auto-card {
  position: relative; padding: 0; overflow: visible;
  background: #fff; border: none; border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px -1px rgba(0,0,0,.1);
}

/* Status + star float over the single-row header (RF: absolute top-2 l/r). */
.ac-status {
  position: absolute; top: 8px; left: 8px; z-index: 10;
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px; border-radius: 6px; background: #fff; border: none;
  cursor: default; transition: opacity .12s;
}
.ac-status .dot { width: 8px; height: 8px; border-radius: 999px; background: #ef4444; flex: 0 0 8px; }
.ac-status .dot.on { background: var(--ok); }
.ac-status .lbl { font-size: 12px; font-weight: 500; color: #333; text-transform: none; letter-spacing: normal; }
.ac-star {
  position: absolute; top: 8px; right: 8px; z-index: 10;
  padding: 6px; border-radius: 6px; background: #fff; border: none;
  display: inline-flex; color: #777; cursor: pointer; transition: background .12s, color .12s;
}
.ac-star svg { width: 16px; height: 16px; }
.ac-star:hover { background: #f9fafb; }
.ac-star.on { color: #f4b400; }
.ac-star.on svg { fill: currentColor; }

/* Header: one row, title centred between the floating status + star. */
.ac-head {
  padding: 12px 8px; text-align: center; background: #fff;
  border: 1px solid #eee; border-bottom: none; border-radius: 8px 8px 0 0;
}
.ac-title-wrap { display: flex; align-items: center; justify-content: center; gap: 4px; min-width: 0; cursor: pointer; }
.ac-title-text {
  font-size: 12px; font-weight: 500; color: #333; transition: color .12s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ac-title-wrap:hover .ac-title-text { color: #388eff; }
.ac-title-wrap:hover .ac-pencil { color: #388eff; }
.ac-pencil { color: #b8b8b8; background: none; border: none; padding: 0; display: inline-flex; flex-shrink: 0; cursor: pointer; transition: color .12s; }
.ac-pencil svg { width: 10px; height: 10px; }
/* Rename swaps the label for an input in place, keeping the row centred. */
.ac-title-input {
  font: inherit; font-size: 12px; font-weight: 500; color: #333; text-align: center;
  border: none; background: transparent; padding: 0; border-radius: 4px; max-width: 100%;
}
.ac-title-input:focus { outline: 2px solid var(--primary); background: var(--surface-2); }

/* Edge-to-edge filmstrip: no gaps, flush to the card edges. */
.ac-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.ac-thumb { position: relative; aspect-ratio: 4 / 5; background: #b8b8b8; overflow: hidden; cursor: pointer; transition: opacity .12s; }
.ac-thumb:hover { opacity: .75; }
.ac-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
/* Per-thumb metrics, overlaid bottom-left on a dark gradient. */
.ac-ov {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
  font-size: 10px; font-weight: 500; color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,.7), transparent);
}
.ac-ov .m { display: flex; align-items: center; gap: 4px; }
.ac-ov .m svg { width: 12px; height: 12px; flex-shrink: 0; }
.ac-notpub {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 6px;
  font-size: 10px; font-weight: 500; color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,.7), transparent);
}

/* Account row: avatar + handle + switcher, then the detail chevron. */
.ac-acct { padding: 8px 8px 4px; }
.ac-acct-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; }
.ac-acct-btn {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  background: none; border: none; padding: 0; text-align: left; cursor: pointer; transition: opacity .12s;
}
.ac-acct-btn:hover { opacity: .65; }
.ac-acct-btn .avatar { width: 40px; height: 40px; flex: 0 0 40px; border: none; }
.ac-acct-btn .handle-label .at { font-size: 14px; font-weight: 500; color: #191919; }
.ac-acct-btn .handle-label .dn { font-size: 12px; color: #333; }
.ac-switch { color: #9ca3af; display: inline-flex; flex-shrink: 0; }
.ac-switch svg { width: 16px; height: 16px; }
.ac-chev { color: #b8b8b8; background: none; border: none; padding: 8px; display: inline-flex; cursor: pointer; transition: color .12s; }
.ac-chev svg { width: 24px; height: 24px; }
.ac-chev:hover { color: #191919; }

/* Next post: label above the two times, clock at the left. */
.ac-next {
  margin-top: 4px; border-top: 1px solid #eee; padding: 8px 16px 0;
  display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; white-space: nowrap;
}
.ac-next > svg { width: 24px; height: 24px; color: #777; flex-shrink: 0; }
.ac-next-col { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ac-next-label { font-size: 12px; font-weight: 500; color: #777; }
.ac-next-times { display: flex; align-items: center; gap: 8px; overflow: hidden; }
.ac-time { font-size: 12px; font-weight: 600; color: #191919; }
/* RF strikes the times through while an automation is paused. */
.ac-next.paused .ac-time { opacity: .35; text-decoration: line-through; }

/* Post Bridge truth row — ours, not RF's. Kept, but demoted to a quiet
   secondary line so it doesn't bloat the card. */
/* Strictly one line: it must never grow the card. Every slot + status is on the
   row's tooltip, and the side panel carries the full detail. */
.ac-pb {
  padding: 6px 16px 0; font-size: 11px; color: var(--dim);
  display: flex; align-items: center; flex-wrap: nowrap; gap: 5px;
  min-width: 0; overflow: hidden; white-space: nowrap;
}
.ac-pb > * { flex-shrink: 0; }
.ac-pb b { color: #777; font-weight: 500; }
.ac-pb .pb-dot { width: 6px; height: 6px; flex-basis: 6px; box-shadow: none; }
.ac-pb .pb-slot { gap: 4px; }
.ac-pb .pb-badge { font-size: 9.5px; padding: 1px 5px; }
.ac-pb.err { color: #b3271e; }

/* Actions: small outline buttons, Generate left / Resume+Edit right. */
.ac-actions { padding: 8px 16px 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ac-actions .right { display: flex; align-items: center; gap: 8px; }
.ac-btnwrap {
  display: inline-flex; align-items: center; background: #fff;
  border: 1px solid #eee; border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px -1px rgba(0,0,0,.1);
}
.ac-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 8px; font-size: 12px; border: none; border-radius: 8px;
  background: transparent; color: #191919; cursor: pointer; transition: opacity .12s;
}
.ac-btn:hover { opacity: .5; }
.ac-btn:disabled { opacity: .5; cursor: default; }
.ac-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.ac-btn.gen { color: #2563eb; font-weight: 500; }
.ac-btn.resume { color: #166534; background: #f0fdf4; }
/* RF's own automations are all paused, so its Pause styling can't be observed;
   this mirrors the Resume tint idiom in amber. */
.ac-btn.pause { color: #92400e; background: #fffbeb; }

/* Toolbar text buttons (RF: borderless, chevron-down, hover fade). */
.tb-link {
  display: inline-flex; align-items: center; gap: 4px;
  background: transparent; border: none; box-shadow: none;
  padding: 0 8px; height: 32px; border-radius: 6px;
  font-size: 16px; font-weight: 500; color: var(--txt); cursor: pointer; transition: opacity .12s;
}
.tb-link:hover { opacity: .5; }
.tb-link svg { width: 16px; height: 16px; }

/* Limits menu: per-account 24h posting headroom. */
.dd-menu.limits { min-width: 256px; padding: 4px; }
.dd-menu.limits .lim-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; font-size: 14px; }
.dd-menu.limits .lim-row .avatar { width: 20px; height: 20px; flex-basis: 20px; border: none; }
.dd-menu.limits .lim-row .h { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-menu.limits .lim-row .n { margin-left: auto; color: var(--dim); flex-shrink: 0; }
.dd-menu.limits .lim-row .n.full { color: #b3271e; font-weight: 600; }
.dd-menu.limits .lim-note { font-size: 12px; color: var(--dim); padding: 6px 8px 4px; white-space: normal; line-height: 1.4; }

/* Account switcher menu (mirrors RF's w-72 search + list). */
.dd-menu.acctsw { min-width: 288px; padding: 0; }
.dd-menu.acctsw .sw-search { padding: 8px; border-bottom: 1px solid #eee; }
.dd-menu.acctsw .sw-search input {
  width: 100%; padding: 6px 10px; font-size: 12px; border-radius: 6px;
  border: 1px solid #eee; background: #fafafa; outline: none;
}
.dd-menu.acctsw .sw-search input:focus { border-color: #ccc; }
.dd-menu.acctsw .sw-list { max-height: 260px; overflow-y: auto; padding: 4px; display: flex; flex-direction: column; gap: 2px; }
.dd-menu.acctsw .sw-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; }
.dd-menu.acctsw .sw-item .avatar { width: 28px; height: 28px; flex-basis: 28px; border: none; }
.dd-menu.acctsw .sw-item .t { min-width: 0; }
.dd-menu.acctsw .sw-item .t .a { font-size: 13px; font-weight: 500; color: #191919; }
.dd-menu.acctsw .sw-item .t .b { font-size: 11px; color: #777; }
.dd-menu.acctsw .sw-item.on { background: var(--primary-weak); }
.dd-menu.acctsw .sw-empty { padding: 10px; font-size: 12px; color: var(--dim); text-align: center; }

/* ── Dropdown ───────────────────────────────────────────────────────────── */
.dd { position: relative; }
.dd-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; min-width: 200px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.dd-menu button, .dd-menu label {
  text-align: left; background: none; border: none; padding: 8px 10px; border-radius: 8px;
  font-size: 13px; display: flex; align-items: center; gap: 8px; color: var(--txt);
}
.dd-menu button:hover { background: var(--surface-2); }
.field-select, input.field, textarea.field {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm);
  padding: 8px 11px; width: 100%;
}
input.field:focus, textarea.field:focus, .field-select:focus { outline: 2px solid var(--primary); border-color: transparent; }
textarea.field { resize: vertical; min-height: 64px; line-height: 1.5; }
.field-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field-row > label { font-weight: 650; font-size: 13px; }
.field-row .hint { color: var(--dim); font-size: 12px; }
.inline { display: flex; align-items: center; gap: 10px; }

/* ── Toggle / segmented ─────────────────────────────────────────────────── */
.toggle { width: 40px; height: 23px; border-radius: 999px; background: var(--off); border: none; position: relative; flex: 0 0 40px; transition: background .15s; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle.on { background: var(--primary); }
.toggle.on::after { left: 19px; }
.toggle.disabled, .toggle:disabled { opacity: .45; cursor: not-allowed; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--surface-2); }
.seg button { border: none; background: none; padding: 6px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 650; color: var(--dim); }
.seg button.on { background: var(--surface); color: var(--txt); box-shadow: var(--shadow); }
.chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 650; color: var(--dim); }
.chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.pill-tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); color: var(--dim); }

/* ── Modal ──────────────────────────────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20,18,15,.4); z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 960px; max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; }
.modal.wide { max-width: 1080px; }
.modal.narrow { max-width: 520px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 17px; font-weight: 750; }
.modal-body { padding: 20px; overflow: auto; }
.modal-close { border: none; background: var(--surface-2); border-radius: 50%; width: 34px; height: 34px; display: grid; place-items: center; color: var(--txt); font-size: 17px; }
.modal-close:hover { background: var(--line); }
/* chrome:false — no head, no body padding: the content owns the whole box (see
   openModal). RF's automation editor is a fixed 800px box like this. */
.modal.bare { width: 800px; max-width: 100%; }
.modal-body.bare { padding: 0; overflow: hidden; display: flex; flex-direction: column; }

/* ── Editor ─────────────────────────────────────────────────────────────── */
/* RF's editor is a 256px menu + pane inside an 800x645 chromeless modal. */
.editor-grid { display: grid; grid-template-columns: 256px 1fr; height: 645px; max-height: calc(100vh - 40px); }
.editor-menu {
  border-right: 1px solid var(--line); background: var(--surface-2);
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: var(--radius) 0 0 var(--radius);
}
.editor-nav { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; overflow-y: auto; }
.editor-menu-foot { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.editor-menu button { text-align: left; border: none; background: none; padding: 8px 12px; border-radius: 8px; font-weight: 500; font-size: 14px; color: var(--dim); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.editor-menu .menu-item:hover { background: var(--surface); color: var(--txt); }
/* RF marks the active row with weight + full-contrast text and a › chevron —
   no fill, no shadow. */
.editor-menu .menu-item.active { background: none; color: var(--txt); font-weight: 600; box-shadow: none; }
.editor-menu .mi-label { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.editor-menu .mi-label svg { width: 16px; height: 16px; flex-shrink: 0; }
.editor-menu .menu-item > svg { width: 16px; height: 16px; flex-shrink: 0; }
/* "Unvisited section" nudge — RF's w-1.5 h-1.5 #FF4A20 dot. */
.editor-menu .menu-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); flex-shrink: 0; }
.editor-menu .menu-sep { border-bottom: 1px solid var(--line); margin: 8px 0; }
.editor-menu .count { font-size: 11px; color: var(--dim); }
.editor-menu .count.err { color: #fff; background: #d6432b; font-weight: 800; width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.editor-menu .menu-item.has-err { color: #d6432b; }
.editor-menu .menu-item.danger { color: #d6432b; }
.editor-menu .menu-item.danger:hover { background: #fdecea; color: #b3271e; }
.field-error { color: #d6432b; font-size: 12px; font-weight: 600; margin: 6px 0 2px; }
/* RF's Generate: white, outlined, full width — not an orange lightning CTA. */
.editor-menu .gen { width: 100%; height: 40px; justify-content: center; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--txt); font-weight: 500; box-shadow: var(--shadow); }
.editor-menu .gen:hover { background: var(--surface); border-color: var(--dim); }
.editor-menu .gen svg { width: 18px; height: 18px; stroke-width: 3; }
.editor-menu .save-changes { width: 100%; height: 40px; justify-content: center; border-radius: 12px; font-weight: 600; }
.editor-pane { padding: 24px; overflow-y: auto; }

/* ── Editor · Overview ──────────────────────────────────────────────────── */
/* RF bleeds the banner to the pane edges, so the pane's own padding is undone. */
.ov { margin: -24px -24px 0; }
.ov-banner { position: relative; width: 100%; aspect-ratio: 4 / 1; background: #b8b8b8; overflow: hidden; }
/* RF's banner IS the account avatar, blurred/scaled/saturated — not a gradient. */
.ov-banner-img { width: 100%; height: 100%; object-fit: cover; display: block; transform: scale(1.5); filter: blur(40px) saturate(1.5) contrast(1.5); }
.ov-avatar { position: absolute; left: 50%; transform: translateX(-50%); bottom: -32px; }
.ov-avatar .avatar { width: 64px; height: 64px; flex-basis: 64px; border: 3px solid #fff; box-shadow: var(--shadow); font-size: 22px; }
.ov-head { display: flex; flex-direction: column; align-items: center; margin: 44px 0 16px; padding: 0 24px; }
.ov-title-row { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; max-width: 100%; }
.ov-title-row:hover .ov-title, .ov-title-row:hover svg { color: var(--blue); }
.ov-title { margin: 0; font-size: 18px; font-weight: 600; color: var(--txt); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-title-row svg { width: 14px; height: 14px; color: #b8b8b8; flex-shrink: 0; }
.ov-title-input {
  font: inherit; font-size: 18px; font-weight: 600; color: var(--txt); text-align: center;
  border: none; background: transparent; padding: 4px 8px; border-radius: 8px; max-width: 100%;
}
.ov-title-input:focus { outline: 1px solid var(--blue); background: var(--surface); }
.ov-handle { font-size: 14px; color: var(--dim); margin-top: 2px; }
/* RF: ONE bordered container, 4 divided cells, value bold ABOVE a Title-Case label. */
.ov-stats { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 12px; margin: 0 24px 16px; overflow: hidden; }
.ov-stats .hint { padding: 16px; grid-column: 1 / -1; }
.ov-stat { padding: 16px 12px; display: flex; flex-direction: column; align-items: center; }
.ov-stat + .ov-stat { border-left: 1px solid var(--line); }
.ov-stat .v { font-size: 17px; font-weight: 600; color: var(--txt); font-variant-numeric: tabular-nums; line-height: 1.25; }
.ov-stat .k { font-size: 11px; color: var(--dim); margin-top: 2px; }
.ov-recent-head { display: flex; align-items: center; justify-content: space-between; padding: 0 24px; margin-bottom: 12px; }
.ov-sort { display: inline-flex; align-items: center; gap: 4px; border: none; background: none; padding: 0; font-size: 14px; font-weight: 600; color: var(--txt); }
.ov-sort:hover { color: var(--blue); }
.ov-sort svg { width: 14px; height: 14px; }
.ov-sort-menu { min-width: 140px; }
/* RF's View all is a plain blue text link, not a pill. */
.ov-viewall { border: none; background: none; padding: 0; font-size: 14px; font-weight: 500; color: var(--blue); }
.ov-viewall:hover { color: #2f7de0; text-decoration: underline; }
.ov-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 24px 24px; }
.ov-grid .hint { grid-column: 1 / -1; }
.ov-thumb { position: relative; aspect-ratio: 4 / 5; background: var(--surface-2); border-radius: 8px; overflow: hidden; cursor: pointer; transition: opacity .12s; }
.ov-thumb:hover { opacity: .8; }
.ov-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.ov-thumb-ph { width: 100%; height: 100%; background: var(--surface-2); }
.ov-thumb .overlay {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 6px;
  display: flex; gap: 8px; font-size: 10px; color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,.6), transparent);
}
.ov-thumb .overlay span { display: inline-flex; align-items: center; gap: 2px; }
.ov-thumb .overlay svg { width: 10px; height: 10px; flex-shrink: 0; }
.fmt-layout { display: grid; grid-template-columns: 1fr 300px; gap: 22px; }
.tabs { display: inline-flex; gap: 4px; background: var(--surface-2); padding: 3px; border-radius: 999px; margin-bottom: 16px; }
.tabs button { border: none; background: none; padding: 7px 16px; border-radius: 999px; font-weight: 650; font-size: 13px; color: var(--dim); }
.tabs button.on { background: var(--surface); color: var(--txt); box-shadow: var(--shadow); }
.collection-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; background: var(--surface); }
.collection-row .name { font-weight: 650; flex: 1; }
.collection-row > svg { width: 20px; height: 20px; color: var(--dim); }
.thumb .overlay svg, .kpi svg { width: 12px; height: 12px; }
.status-dot + svg { width: 13px; height: 13px; }
.collection-row .strip { display: flex; gap: 4px; }
.collection-row .strip img, .collection-row .strip .ph { width: 30px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--surface-2); border: 1px solid var(--line); }
.advanced { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }
.collapse-head { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; cursor: pointer; color: var(--txt); background: none; border: none; padding: 4px 0; }
.slider { width: 100%; accent-color: var(--primary); }

/* override cards */
.ov-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px; display: flex; flex-direction: column; gap: 9px; background: var(--surface-2); margin-bottom: 10px; }
.ov-card .top { display: flex; align-items: center; gap: 10px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); overflow: hidden; }
.stepper button { border: none; background: none; padding: 4px 10px; font-size: 15px; color: var(--txt); }
.stepper .val { padding: 0 8px; font-weight: 700; font-size: 13px; min-width: 46px; text-align: center; }
.stepper .lbl { padding: 0 4px 0 10px; font-size: 12px; color: var(--dim); font-weight: 650; }
.trash { margin-left: auto; color: var(--dim); background: none; border: none; padding: 6px; border-radius: 8px; }
.trash:hover { background: #fdece7; color: #d6432b; }
.tbox-editor { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 8px; background: var(--surface); }
.tbox-editor .grid4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 8px; }

/* preview carousel */
.preview { position: sticky; top: 0; }
.slide-frame { aspect-ratio: 9/16; border-radius: 14px; overflow: hidden; position: relative; background: #222; box-shadow: var(--shadow); }
.slide-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.slide-frame .shade { position: absolute; inset: 0; background: #000; }
.slide-frame .noimg { position: absolute; inset: 0; display: grid; place-items: center; color: #fff8; font-size: 12px; }
/* text zones — items sharing a vertical position stack instead of overlapping */
.slide-frame .txt-zone { position: absolute; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
/* Insets mirror TEXT_INSETS in src/render/slide.ts (RF-calibrated: top block
   at ~14%; bottom mirrored; "padnone" = per-item Top/Bottom Padding "None"). */
.slide-frame .txt-zone.top { top: 14%; }
.slide-frame .txt-zone.top.padnone { top: 2.5%; }
.slide-frame .txt-zone.center { top: 50%; transform: translateY(-50%); }
.slide-frame .txt-zone.bottom { bottom: 14%; }
.slide-frame .txt-zone.bottom.padnone { bottom: 2.5%; }
.slide-frame .txt-item { text-align: center; line-height: 1.15; cursor: pointer; max-width: 100%; box-sizing: border-box; word-break: break-word; }
.slide-frame .txt-item.selected { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.slide-frame .label { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.dots { display: flex; gap: 6px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.dots button { width: 8px; height: 8px; border-radius: 50%; border: none; background: var(--off); padding: 0; }
.dots button.on { background: var(--primary); width: 20px; border-radius: 999px; }

/* preview style bar — always visible, RF two-row layout */
.style-bar { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.style-bar .sb-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.style-bar .sb-ctl { display: flex; flex-direction: column; gap: 3px; flex: 1 1 0; min-width: 96px; }
.style-bar .sb-ctl label { font-size: 11px; color: var(--dim); font-weight: 650; }
.style-bar .sb-ctl select { padding: 6px 8px; font-size: 12px; width: 100%; }
.style-bar .sb-actions { align-items: flex-end; }
.style-bar .sb-btns { display: flex; gap: 6px; flex: 2 1 auto; justify-content: flex-end; }
/* white rounded select look, per RF */
.style-bar .sb-ctl select, .style-bar .sb-style-trigger { background: #fff; color: #111; border: 1px solid var(--line); border-radius: 8px; }
/* custom Style dropdown */
.sb-style-trigger { display: flex; align-items: center; gap: 6px; padding: 5px 8px; font-size: 12px; width: 100%; cursor: pointer; }
.sb-style-trigger .sb-style-name { flex: 1; text-align: left; }
.sb-style-trigger svg { width: 14px; height: 14px; opacity: .6; }
.sw-box { display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #8a8a8a, #5c5c5c); border-radius: 5px; padding: 3px 7px; min-width: 30px; }
.sw-txt { font-size: 13px; line-height: 1; }
.sb-style-menu { min-width: 220px; max-height: 320px; overflow: auto; }
.sb-style-menu button { justify-content: flex-start; }
.sb-style-menu button.on { background: var(--surface-2); font-weight: 700; }

/* overview stats */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat-tile { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; background: var(--surface-2); }
.stat-tile .k { font-size: 11px; color: var(--dim); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.stat-tile .v { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; margin-top: 3px; }
.ov-title { font-size: 16px; font-weight: 750; margin-bottom: 4px; }

/* schedule rows */
.sched-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 8px; background: var(--surface); }

/* ── KPI / analytics ────────────────────────────────────────────────────── */
/* Analytics header: title+subtitle left, controls right, all on ONE row (RF). */
.analytics-head { flex-wrap: nowrap; align-items: flex-start; }
.analytics-head .toolbar { flex-wrap: nowrap; align-items: center; gap: 12px; }
/* Refresh sits ABOVE its "Last updated …" caption, as one unit. */
.refresh-group { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.refresh-group .btn { padding: 4px 8px; font-size: 13px; border-color: transparent; }
.refresh-group .btn:hover { background: var(--surface-2); }
.refresh-group .btn svg { width: 14px; height: 14px; }
.last-updated { font-size: 12px; color: var(--dim); white-space: nowrap; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.kpi { padding: 16px; }
/* RF: icon + Title-Case label on one row, value below. Not ALL-CAPS. */
.kpi .k { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--dim); font-weight: 600; text-transform: none; letter-spacing: 0; }
.kpi .k svg { width: 16px; height: 16px; flex: 0 0 16px; }
.kpi .v { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; margin-top: 8px; }

.chart-card { padding: 18px; margin-bottom: 20px; }
.chart-card h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 14px; }
.chart-card h3 svg { width: 15px; height: 15px; }
/* Chart grid: [y-labels][plot] over [gutter][x-labels]. */
.chart { display: grid; grid-template-columns: auto 1fr; grid-template-rows: 160px auto; column-gap: 8px; }
.y-axis { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; font-size: 12px; color: var(--dim); }
.y-tick { line-height: 1; transform: translateY(-50%); }
.y-tick:first-child { transform: translateY(0); }
.y-tick:last-child { transform: translateY(-100%); }
.plot { position: relative; }
.gridlines { position: absolute; inset: 0; display: flex; flex-direction: column-reverse; justify-content: space-between; }
.gridline { border-top: 1px dashed #eaeaea; height: 0; }
.bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 3px; }
.bars .bar { flex: 1; max-width: 18px; margin: 0 auto; height: 100%; display: flex; align-items: flex-end; }
.bars .bar > span { width: 100%; background: var(--primary); border-radius: 2px 2px 0 0; }
.x-axis { display: flex; gap: 3px; margin-top: 6px; }
.x-tick { flex: 1; text-align: center; font-size: 11px; color: var(--dim); white-space: nowrap; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; min-width: 720px; }
table.data th, table.data td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 13px; }
/* RF header row: Title-Case, not ALL-CAPS; only sortable columns get a pointer. */
table.data th { font-size: 12px; color: var(--dim); text-transform: none; letter-spacing: 0; cursor: default; user-select: none; position: sticky; top: 0; background: var(--surface-2); }
table.data th.sortable { cursor: pointer; }
table.data th .caret { display: inline-flex; margin-left: 5px; opacity: .45; vertical-align: middle; }
table.data th .caret svg { width: 12px; height: 12px; }
table.data th.sorted { color: var(--primary); }
table.data th.sorted .caret { opacity: 1; }
table.data tr:last-child td { border-bottom: none; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
/* "—" for a post whose metrics have never been synced (never a hard 0). */
table.data td.pending { color: var(--off); }
/* Engagement Rate badge (RF: rounded-md, 12px, subtle fill). */
table.data .pill { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; }
table.data td.actions { text-align: left; }
.btn.icon-only { padding: 6px; border-radius: 8px; border-color: transparent; background: transparent; }
.btn.icon-only svg { width: 15px; height: 15px; }
.btn.icon-only:hover { background: var(--surface-2); }
.btn.icon-only:disabled { opacity: .3; pointer-events: none; }

/* analytics grid mode */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }

/* ── Calendar ───────────────────────────────────────────────────────────── */
.cal { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.cal-dow div { padding: 8px; font-size: 11px; font-weight: 700; color: var(--dim); text-transform: uppercase; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-cell { min-height: 104px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.pad { background: var(--surface-2); }
.cal-cell .dnum { font-size: 12px; font-weight: 700; color: var(--dim); align-self: flex-start; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-cell.today .dnum { background: var(--primary); color: #fff; }
.ev { display: flex; align-items: center; gap: 5px; padding: 3px 6px; border-radius: 7px; font-size: 11px; font-weight: 650; background: var(--surface-2); border: 1px solid var(--line); }
.ev.posted { background: #e7f6ec; border-color: #c4e9d1; color: #146c39; }
.ev .avatar { width: 16px; height: 16px; flex-basis: 16px; }
.ev .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-more { font-size: 11px; color: var(--dim); font-weight: 650; padding-left: 4px; }

/* ── Library / images grids ─────────────────────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.tile { position: relative; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.tile .cover { aspect-ratio: 9/16; background: var(--surface-2); position: relative; }
/* Only the direct cover image fills the tile — not the nested avatar overlay
   (.cover .av .avatar), which must keep its small overlay size. */
.tile .cover > img { width: 100%; height: 100%; object-fit: cover; }
.tile .cover .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--dim); font-size: 12px; text-align: center; padding: 8px; }
.tile .cover .av { position: absolute; left: 6px; bottom: 6px; }
.tile .cap { padding: 8px 9px; font-size: 12px; line-height: 1.35; max-height: 54px; overflow: hidden; }
.tile .statuspill { position: absolute; top: 6px; right: 6px; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: #000a; color: #fff; text-transform: uppercase; }
.pager { display: flex; align-items: center; gap: 12px; justify-content: center; margin-top: 18px; color: var(--dim); font-weight: 650; }

.coll-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.coll-card { padding: 0; overflow: hidden; cursor: pointer; }
.coll-card .cover { aspect-ratio: 3/2; background: var(--surface-2); }
.coll-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.coll-card .body { padding: 11px 13px; }
.coll-card .name { font-weight: 700; }
.coll-card .count { color: var(--dim); font-size: 12px; margin-top: 2px; }
.coll-card .nocap { color: #2f6fdb; font-size: 12px; font-weight: 650; margin-top: 6px; display: inline-block; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.img-cell { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.img-cell .ph { aspect-ratio: 1; background: var(--surface-2); }
.img-cell img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.img-cell .cap { padding: 6px 8px; }
.img-cell .cap input { border: none; background: transparent; width: 100%; font-size: 12px; padding: 2px; }
.img-cell .cap input:focus { outline: 1px solid var(--primary); border-radius: 4px; }
.img-cell .foot { display: flex; justify-content: flex-end; padding: 0 6px 6px; }
.img-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; }
.img-picker-grid .pick { border: 2px solid transparent; border-radius: 8px; overflow: hidden; padding: 0; background: var(--surface-2); }
.img-picker-grid .pick.on { border-color: var(--primary); }
.img-picker-grid .pick img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }

/* ── Toast ──────────────────────────────────────────────────────────────── */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--txt); color: #fff; padding: 11px 15px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-weight: 600; font-size: 13px; max-width: 340px; animation: slidein .16s ease; }
.toast.ok { background: #12803f; } .toast.err { background: #c0341f; }
@keyframes slidein { from { transform: translateY(8px); opacity: 0; } }

/* ── skeleton / empty ───────────────────────────────────────────────────── */
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--radius-sm); }
@keyframes sk { to { background-position: -200% 0; } }
.empty { color: var(--dim); text-align: center; padding: 50px 20px; }

/* ── Slide viewer (Flow B) ──────────────────────────────────────────────── */
.sv-backdrop { position: fixed; inset: 0; background: rgba(20,18,15,.5); z-index: 200; display: grid; place-items: center; padding: 24px; }
.sv-modal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 820px; max-height: 94vh; display: flex; flex-direction: column; overflow: hidden; padding: 14px 18px 18px; }
.sv-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.sv-title { font-weight: 750; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sv-close { border: none; background: var(--surface-2); border-radius: 50%; width: 34px; height: 34px; display: grid; place-items: center; color: var(--txt); flex: 0 0 34px; }
.sv-close:hover { background: var(--line); }
.sv-stage { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 6px 0; min-height: 0; }
.sv-slide { width: 55%; max-width: 340px; aspect-ratio: 9/16; border-radius: 14px; overflow: hidden; background: var(--surface-2); box-shadow: var(--shadow); flex: 0 0 auto; max-height: 66vh; }
.sv-slide-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sv-nav { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--txt); font-size: 24px; line-height: 1; display: grid; place-items: center; box-shadow: var(--shadow); }
.sv-nav:hover { background: var(--surface-2); }
.sv-strip { display: flex; gap: 8px; overflow-x: auto; padding: 12px 2px 4px; justify-content: flex-start; }
.sv-thumb { flex: 0 0 auto; height: 64px; aspect-ratio: 9/16; border-radius: 8px; overflow: hidden; border: 2px solid transparent; padding: 0; background: var(--surface-2); }
.sv-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sv-thumb.on { border-color: #2f6fdb; box-shadow: 0 0 0 1px #2f6fdb; }
.sv-engagement { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 16px; color: var(--dim); font-size: 12.5px; font-weight: 600; margin-top: 12px; }
.sv-metric { display: inline-flex; align-items: center; gap: 4px; }
.sv-metric svg { width: 13px; height: 13px; }
.sv-counter { text-align: center; color: var(--dim); font-size: 12px; font-weight: 650; margin-top: 8px; }
.sv-empty { color: var(--dim); text-align: center; padding: 40px 20px; }

/* ── Automation side panel (Flow A) ─────────────────────────────────────── */
.ap-backdrop { position: fixed; inset: 0; background: rgba(20,18,15,.45); z-index: 150; display: flex; justify-content: flex-end; }
.ap-panel { position: relative; width: 64%; max-width: 900px; height: 100%; background: var(--surface); overflow-y: auto; box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .18s ease; padding-bottom: 32px; }
.ap-panel.open { transform: translateX(0); }
.ap-close { position: absolute; top: 14px; right: 14px; z-index: 5; border: none; background: rgba(255,255,255,.92); border-radius: 50%; width: 36px; height: 36px; display: grid; place-items: center; color: var(--txt); box-shadow: var(--shadow); }
.ap-close:hover { background: #fff; }
.ap-banner-wrap { position: relative; height: 260px; overflow: hidden; background: var(--surface-2); }
.ap-banner { position: absolute; inset: -12%; background-size: cover; background-position: center; filter: blur(14px) brightness(.62); transform: scale(1.12); }
.ap-banner.empty { background: linear-gradient(135deg, #2a2824, #4a453c); filter: none; transform: none; inset: 0; }
.ap-status { position: absolute; top: 14px; left: 14px; z-index: 4; display: inline-flex; align-items: center; gap: 7px; background: rgba(255,255,255,.94); border: none; border-radius: 999px; padding: 6px 13px; font-weight: 700; font-size: 12.5px; color: var(--txt); box-shadow: var(--shadow); }
.ap-banner-actions { position: absolute; top: 14px; right: 62px; z-index: 4; display: flex; gap: 8px; }
.ap-pill { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.94); border: none; border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 12.5px; color: var(--txt); box-shadow: var(--shadow); }
.ap-pill:hover { background: #fff; }
.ap-pill svg { width: 14px; height: 14px; }
.ap-pill:disabled { opacity: .55; }
.ap-avatar { display: flex; justify-content: center; margin-top: -55px; position: relative; z-index: 3; }
.ap-avatar .avatar.xl { width: 110px; height: 110px; flex-basis: 110px; border: 4px solid #fff; box-shadow: var(--shadow); font-size: 34px; }
.ap-title { text-align: center; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin-top: 12px; padding: 0 24px; }
.ap-handle { text-align: center; color: var(--dim); font-weight: 600; margin-top: 2px; padding: 0 24px; }
.ap-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 20px 24px 4px; }
.ap-stat { border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px; background: var(--surface); text-align: center; }
.ap-stat-k { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--dim); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.ap-stat-k svg { width: 12px; height: 12px; }
.ap-stat-v { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin-top: 5px; }
.ap-tabs { display: flex; justify-content: center; gap: 4px; background: transparent; padding: 18px 24px 12px; }
.ap-tab { border: none; background: transparent; padding: 7px 15px; border-radius: 999px; font-weight: 650; font-size: 13px; color: var(--dim); }
.ap-tab:hover { color: var(--txt); }
.ap-tab.on { background: var(--surface); color: var(--txt); box-shadow: var(--shadow); border: 1px solid var(--line); }
.ap-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; padding: 4px 24px 0; }
.ap-tile { position: relative; aspect-ratio: 9/16; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; transition: transform .12s ease, border-color .12s ease; }
.ap-tile:hover { transform: translateY(-2px); border-color: var(--primary); }
.ap-tile > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ap-tile-ph { position: absolute; inset: 0; background: var(--surface-2); }
.ap-tile-stats { position: absolute; right: 5px; bottom: 5px; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; color: #fff; font-size: 10.5px; font-weight: 700; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.ap-tile-stats span { display: inline-flex; align-items: center; gap: 3px; }
.ap-tile-stats svg { width: 11px; height: 11px; }
.ap-publish { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); display: none; align-items: center; gap: 5px; background: rgba(255,255,255,.95); border: none; border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: 11.5px; color: var(--txt); box-shadow: var(--shadow); white-space: nowrap; }
.ap-publish svg { width: 12px; height: 12px; }
.ap-tile:hover .ap-publish { display: inline-flex; }
.ap-empty { grid-column: 1 / -1; color: var(--dim); text-align: center; padding: 40px 20px; }

/* ── Mobile ─────────────────────────────────────────────────────────────── */
.mobile-tabbar { display: none; }
@media (max-width: 768px) {
  #app { flex-direction: column; }
  .sidebar { display: none; }
  .mobile-tabbar {
    display: flex; position: sticky; top: 0; z-index: 50; background: var(--surface);
    border-bottom: 1px solid var(--line); overflow-x: auto; padding: 8px 10px; gap: 6px; align-items: center;
  }
  .mobile-tabbar .logo { font-weight: 800; font-size: 16px; padding: 6px 10px; display: flex; align-items: center; gap: 6px; }
  .mobile-tabbar .logo .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--primary); }
  .mobile-tabbar a { padding: 8px 12px; border-radius: 999px; font-weight: 650; color: var(--dim); white-space: nowrap; }
  .mobile-tabbar a.active { background: var(--primary-weak); color: var(--primary); }
  .content { padding: 18px 14px 80px; }
  .cards-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  /* Editor is web-only (1024+); these keep it merely usable on a narrow screen:
     the menu and its foot collapse into one horizontal scroller above the pane. */
  .editor-grid { grid-template-columns: 1fr; height: auto; max-height: none; }
  .editor-menu { border-right: none; border-bottom: 1px solid var(--line); border-radius: 0; }
  .editor-nav, .editor-menu-foot { flex-direction: row; overflow-x: auto; gap: 6px; padding: 8px 10px; align-items: center; flex-wrap: nowrap; }
  .editor-menu-foot { padding-top: 0; }
  .editor-menu .menu-sep { display: none; }
  .editor-menu button { white-space: nowrap; height: 36px; padding: 0 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; flex: 0 0 auto; justify-content: center; gap: 6px; }
  .editor-menu .menu-item.active { background: var(--primary-weak); color: var(--primary); box-shadow: none; }
  .editor-menu .menu-item.active > svg { display: none; }
  .editor-menu .gen, .editor-menu .save-changes { margin-bottom: 0; height: 36px; width: auto; }
  .editor-menu .count { font-size: 11px; }
  .ov { margin: -24px -24px 0; }
  .fmt-layout { grid-template-columns: 1fr; }
  .preview { position: static; max-width: 260px; margin: 0 auto; }
  .modal { max-height: 100vh; max-width: 100%; border-radius: 0; }
  .modal-backdrop { padding: 0; align-items: stretch; }

  /* Slide viewer — fill the screen, slide fits width, strip scrolls. */
  .sv-backdrop { padding: 0; align-items: stretch; place-items: stretch; }
  .sv-modal { max-width: 100%; max-height: 100vh; border-radius: 0; padding: 12px 12px 16px; }
  .sv-slide { width: auto; max-width: 78%; max-height: 60vh; }
  .sv-nav { width: 38px; height: 38px; font-size: 21px; }

  /* Side panel — full-screen; ✕ stays reachable (36px). */
  .ap-panel { width: 100%; max-width: 100%; }
  .ap-stats { grid-template-columns: repeat(2, 1fr); }
  .ap-grid { grid-template-columns: repeat(2, 1fr); }
  .ap-banner-actions { right: 60px; }
  .ap-publish { display: inline-flex; } /* no hover on touch — always visible */
}

/* ── Post Bridge surfacing ─────────────────────────────────────────────────── */
:root { --pb: #3b6fe0; --pb-weak: #e9f0ff; --pb-line: #c6d8fb; --pb-ink: #1f47a8; }
.pb-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pb); flex: 0 0 8px; display: inline-block; box-shadow: 0 0 0 3px rgba(59,111,224,.14); }
.pb-dot.off { background: var(--off); box-shadow: none; }
.pb-badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 750; letter-spacing: .2px; background: var(--pb-weak); border: 1px solid var(--pb-line); color: var(--pb-ink); white-space: nowrap; }
.pb-badge.pb-posted { background: #e7f6ec; border-color: #c4e9d1; color: #146c39; }
.pb-badge.pb-processing { background: #fff4e2; border-color: #f6dcae; color: #9a6412; }
.pb-badge.pb-failed { background: #fdeceb; border-color: #f4c9c5; color: #b3271e; }
.pb-badge.pb-pending { background: var(--surface-2); border-color: var(--line); color: var(--dim); }
/* Automation card PB row */
.pb-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--dim); margin-top: 2px; }
.pb-row b { color: var(--txt); font-weight: 650; }
.pb-row.muted { color: var(--dim); }
.pb-slot { display: inline-flex; align-items: center; gap: 5px; }
/* Panel PB section */
.ap-pb { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; margin: 4px 0 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.ap-pb-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; }
.ap-pb-hint { font-size: 12px; color: var(--dim); }
.ap-pb-slot { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.ap-pb-slot .t { color: var(--txt); font-weight: 600; }
.ap-pb-slot .err { color: #b3271e; font-size: 11.5px; }
.ap-pb-slot.failed { color: #b3271e; }
/* Panel tile PB badge */
.ap-tile { position: relative; }
.ap-tile-pb { position: absolute; top: 6px; left: 6px; z-index: 2; }
/* Calendar PB event chip */
.ev.pb { background: var(--pb-weak); border-color: var(--pb-line); color: var(--pb-ink); }
.ev.pb.failed { background: #fdeceb; border-color: #f4c9c5; color: #b3271e; }
.ev .pb-mark { font-size: 9px; }

/* ── System alert banner (AI-copy-unavailable / fallback-blocked) ─────────────
   Appended additively — do not reformat the rest of this file. Owner requirement:
   a loud red banner across the top of the app whenever the server is holding
   posts back. Fixed to the top so it overlays every view; body gets padding-top
   only while active so nothing is covered. Auto-hidden when alerts resolve. */
#sf-alert-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9999;
  background: #b3271e;
  color: #fff;
  box-shadow: 0 2px 12px rgba(120, 20, 12, 0.35);
  font-size: 13.5px;
  font-weight: 600;
}
#sf-alert-banner[hidden] { display: none; }
body.sf-alert-active { padding-top: 44px; }
.sf-alert-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 18px;
  min-height: 44px;
}
.sf-alert-msg { flex: 1; min-width: 0; line-height: 1.35; }
.sf-alert-toggle {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.sf-alert-toggle:hover { background: rgba(255, 255, 255, 0.28); }
.sf-alert-list {
  margin: 0;
  padding: 4px 18px 12px 36px;
  font-weight: 500;
  font-size: 12.5px;
  line-height: 1.5;
  max-height: 40vh;
  overflow: auto;
}
@media (max-width: 640px) {
  body.sf-alert-active { padding-top: 60px; }
  .sf-alert-bar { min-height: 60px; }
}

/* ── Slideshow Editor (manual builder — Fastlane Create New flow) ──────────── */
.modal.wide.bare { width: 1040px; max-width: 100%; }
.sf-studio { display: flex; flex-direction: column; max-height: calc(100vh - 40px); min-height: 480px; }

/* Compose step */
.sf-compose { padding: 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.sf-compose-head { display: flex; align-items: center; gap: 12px; }
.sf-compose-head .field { flex: 1; font-weight: 650; }
.sf-card { border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: var(--surface); }
.sf-card-title { font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.sf-drop { border: 2px dashed var(--line); border-radius: 12px; padding: 20px; display: flex; align-items: center; gap: 12px; cursor: pointer; color: var(--dim); }
.sf-drop.over { border-color: var(--primary); background: var(--surface-2); }
.sf-drop.busy { opacity: .6; pointer-events: none; }
.sf-drop svg { width: 26px; height: 26px; flex-shrink: 0; }
.sf-drop strong { color: var(--txt); }
.sf-thumbrow { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.sf-thumb { width: 54px; height: 72px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.sf-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sf-pill { font-size: 12px; font-weight: 700; padding: 6px 13px; border-radius: 999px; background: var(--surface-2); color: var(--txt); }
.sf-gen-row { display: flex; justify-content: center; padding: 4px 0 8px; }
.btn.lg { padding: 13px 34px; font-size: 15px; }

/* Edit step */
.sf-edit { display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.sf-edit-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.sf-edit-head .sf-title { flex: 1; font-weight: 650; }
.sf-edit-grid.editor-grid { height: 620px; max-height: calc(100vh - 130px); }
.sf-rail { padding: 16px; gap: 2px; overflow-y: auto; }
.sf-rail-sec { padding: 4px 6px 8px; }
.sf-rail-label { font-size: 11px; font-weight: 700; color: var(--dim); text-transform: uppercase; margin-bottom: 8px; }
.sf-stage-pane { display: flex; flex-direction: column; align-items: center; }
.sf-stage { position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; }
.sf-frame { height: 380px; width: auto; }
.sf-frame .txt-item { position: relative; }
.sf-chev { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--txt); font-size: 20px; line-height: 1; box-shadow: var(--shadow); flex-shrink: 0; cursor: pointer; }
.sf-chev:disabled { opacity: .25; cursor: default; }
.sf-delchip { position: absolute; top: -10px; right: -10px; width: 22px; height: 22px; border-radius: 50%; background: #d6432b; color: #fff; border: 2px solid #fff; font-size: 11px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.sf-dots { margin-top: 14px; }
.sf-stage-pane .style-bar { width: 100%; max-width: 520px; }

/* ── Monthly generation usage badge (appended additively — do not reformat the
   rest of this file). A small top-right pill showing this month's AI generations
   against the cap. Minimal/neutral by default, amber past 90%, red at the cap.
   pointer-events:none so it is purely informational and never blocks a click. */
#sf-usage-badge {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: var(--dim);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  user-select: none;
  pointer-events: none;
}
#sf-usage-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
}
#sf-usage-badge[hidden] { display: none; }
#sf-usage-badge.warn {
  color: #9a5b00;
  border-color: #f2c879;
  background: #fff6e6;
}
#sf-usage-badge.warn::before { background: #e08a00; }
#sf-usage-badge.full {
  color: #fff;
  border-color: #b3271e;
  background: #b3271e;
}
#sf-usage-badge.full::before { background: #fff; }
/* Drop below the fixed alert banner while it is active so the pill never overlaps it. */
body.sf-alert-active #sf-usage-badge { top: 54px; }
@media (max-width: 640px) {
  body.sf-alert-active #sf-usage-badge { top: 70px; }
}
