/* ============================================================
   Techtonic Admin — light minimalist design system
   Palette: light surface + slate text + electric-cyan accent
   (cyan #00E5FF is decorative only; interactive = teal-600 for
    WCAG 4.5:1 contrast on white)
   ============================================================ */
:root {
  --bg: #F7F9FC;
  --surface: #FFFFFF;
  --border: #E6EAF2;
  --border-strong: #D2D9E7;
  --text: #0F172A;
  --text-2: #55617A;
  --text-3: #8A94AB;
  --accent: #00E5FF;          /* brand glow — decorative */
  --accent-ink: #0E7490;      /* interactive cyan — accessible */
  --accent-soft: #E6FBFF;
  --navy: #0A0E27;
  --green: #16A34A;  --green-soft: #EAF8EF;
  --red: #DC2626;    --red-soft: #FDECEC;
  --amber: #B45309;  --amber-soft: #FEF4E2;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, .07);
  --font: 'Heebo', 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--font); line-height: 1.55;
  min-height: 100dvh;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
:focus-visible { outline: 3px solid var(--accent-ink); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100dvh; }
.sidebar {
  background: var(--surface); border-inline-end: 1px solid var(--border);
  padding: 24px 16px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100dvh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 12px 20px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; background: #010320;
  display: grid; place-items: center; color: var(--accent);
  font-family: var(--font-display); font-weight: 700; font-size: 17px;
}
.brand-mark img { width: 22px; height: auto; display: block; }
.login-card .brand-mark img { width: 32px; }
.fb-avatar-img {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  object-fit: cover; background: #010320;
}
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: .3px; }
.brand-name .t { color: var(--accent-ink); }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 10px; color: var(--text-2);
  font-weight: 500; font-size: 14.5px; min-height: 44px;
  transition: background .18s ease, color .18s ease;
}
.nav-item:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav-item svg { width: 19px; height: 19px; flex: none; }
.nav-badge {
  margin-inline-start: auto; background: var(--accent-ink); color: #fff;
  font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 1px 8px;
}
.sidebar-footer { margin-top: auto; padding: 12px; }
.mode-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700; border-radius: 999px; padding: 5px 12px;
}
.mode-pill.dry { background: var(--amber-soft); color: var(--amber); }
.mode-pill.live { background: var(--green-soft); color: var(--green); }
.mode-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.brand.brand { text-decoration: none; }
.brand-context {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px 4px;
  font-weight: 700; font-size: 14px; color: var(--text);
}
.brand-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* ---------- brands landing ---------- */
.brands-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.brand-card {
  display: block; text-decoration: none; color: inherit; overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease; position: relative;
}
.brand-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); text-decoration: none; }
.brand-card .bc-head {
  padding: 22px 22px 16px; display: flex; align-items: center; gap: 14px;
  border-bottom: 1px solid var(--border);
}
.bc-logo {
  width: 52px; height: 52px; border-radius: 13px; flex: none; display: grid;
  place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 22px;
}
.bc-logo img { width: 34px; height: auto; }
.bc-name { font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.bc-niche { font-size: 12.5px; color: var(--text-3); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }
.bc-pills { display: flex; gap: 6px; margin-inline-start: auto; flex-direction: column; align-items: flex-end; }
.bc-body { display: grid; grid-template-columns: repeat(4, 1fr); }
.bc-stat { padding: 14px 8px; text-align: center; border-inline-start: 1px solid var(--border); }
.bc-stat:first-child { border-inline-start: none; }
.bc-stat-v { font-family: var(--font-display); font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums; }
.bc-stat-l { font-size: 11px; color: var(--text-3); }
.brand-new-card {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  color: var(--accent-ink); font-weight: 700; font-size: 15px; min-height: 150px;
  transition: all .15s ease;
}
.brand-new-card:hover { border-color: var(--accent-ink); background: var(--accent-soft); text-decoration: none; }

/* ---------- main ---------- */
.main { padding: 32px 44px 64px; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; gap: 16px; flex-wrap: wrap; }
.page-title { font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -.3px; }
.page-sub { color: var(--text-2); font-size: 14px; margin-top: 2px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 10px; font-weight: 600; font-size: 14px;
  padding: 11px 20px; min-height: 44px; border: 1px solid transparent;
  transition: filter .18s ease, background .18s ease, transform .12s ease;
}
.btn:active { transform: scale(.98); }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { filter: brightness(1.25); }
.btn-accent { background: var(--accent-ink); color: #fff; }
.btn-accent:hover { filter: brightness(1.12); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { filter: brightness(1.08); }
.btn-outline { background: var(--surface); border-color: var(--border-strong); color: var(--text-2); }
.btn-outline:hover { border-color: var(--accent-ink); color: var(--accent-ink); }
.btn-danger-outline { background: var(--surface); border-color: #F3C4C4; color: var(--red); }
.btn-danger-outline:hover { background: var(--red-soft); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------- cards / KPI ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.kpi { padding: 20px 22px; position: relative; overflow: hidden; }
.kpi::after {
  content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; inset-inline-end: auto; width: 4px;
  background: linear-gradient(180deg, var(--accent), var(--accent-ink));
  opacity: 0; transition: opacity .2s ease;
}
.kpi:hover::after { opacity: 1; }
.kpi-label { font-size: 12.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .8px; }
.kpi-value { font-family: var(--font-display); font-size: 32px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi-hint { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }

/* ---------- approval / post preview ---------- */
.draft-grid { display: grid; gap: 20px; }
.draft-card { display: grid; grid-template-columns: 340px 1fr; }
.draft-card .visual { padding: 20px; border-inline-end: 1px solid var(--border); }
.draft-card .visual img { width: 100%; border-radius: 10px; border: 1px solid var(--border); display: block; }
.draft-card .body { padding: 20px 24px; display: flex; flex-direction: column; gap: 12px; }
.draft-meta { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-3); flex-wrap: wrap; }
.score-chip { background: var(--accent-soft); color: var(--accent-ink); border-radius: 999px; padding: 2px 10px; font-weight: 700; }
.field-label { font-size: 11.5px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--text-3); }
textarea.post-text {
  width: 100%; border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--bg); color: var(--text); padding: 12px 14px;
  font-size: 14px; font-family: inherit; line-height: 1.6;
  min-height: 130px; resize: vertical; transition: border-color .18s ease;
}
textarea.post-text:focus { border-color: var(--accent-ink); outline: none; background: var(--surface); }
textarea.post-text[dir="rtl"] { text-align: right; }
.draft-actions { display: flex; gap: 10px; margin-top: 4px; flex-wrap: wrap; align-items: center; }
.regen-box { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border-strong); }
.regen-hint { font-size: 12px; color: var(--text-3); }

/* ---------- approval block + facebook preview ---------- */
.approval-block { overflow: hidden; }
.approval-head { padding: 16px 24px; border-bottom: 1px solid var(--border); }
.score-reason { font-size: 12.5px; color: var(--text-3); margin-top: 6px; line-height: 1.5; }
.approval-body { display: grid; grid-template-columns: 1fr 420px; }
.edit-col { padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.preview-col { padding: 20px 24px; background: #EDF0F5; border-inline-start: 1px solid var(--border); }
.preview-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.ptab {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
  border-radius: 999px; padding: 7px 16px; font-size: 12.5px; font-weight: 600;
  transition: all .15s ease;
}
.ptab.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.hidden { display: none; }
.device-toggle {
  margin-inline-start: auto; display: flex; gap: 2px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 3px;
}
.dtab {
  background: none; border: none; border-radius: 999px; padding: 5px 11px;
  color: var(--text-3); display: grid; place-items: center; transition: all .15s ease;
}
.dtab svg { width: 15px; height: 15px; }
.dtab.active { background: var(--accent-ink); color: #fff; }

/* authentic-ish Facebook post mock */
.fb-post {
  background: #fff; border-radius: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.15);
  font-family: 'Heebo', 'Segoe UI', Helvetica, Arial, sans-serif;
  max-width: 400px; margin: 0 auto;
  transition: max-width .25s ease;
}
/* desktop feed view — FB desktop post column is ~590px */
.preview-col.desktop .fb-post { max-width: 590px; }
.preview-col.desktop .fb-text { font-size: 15px; }
.fb-head { display: flex; align-items: center; gap: 9px; padding: 12px 14px 6px; }
.fb-avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--navy);
  color: var(--accent); display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 19px; flex: none;
}
.fb-name { font-weight: 700; font-size: 14.5px; color: #050505; }
.fb-sub { font-size: 12.5px; color: #65676B; display: flex; align-items: center; gap: 4px; }
.fb-dots { margin-inline-start: auto; color: #65676B; font-weight: 700; letter-spacing: 1px; }
.fb-text {
  padding: 6px 14px 10px; font-size: 14.5px; line-height: 1.45; color: #050505;
  white-space: pre-wrap; word-wrap: break-word;
}
.fb-hashtag { color: #1877F2; }
.fb-img { width: 100%; display: block; }
.fb-stats {
  display: flex; justify-content: space-between; padding: 9px 14px;
  font-size: 13px; color: #65676B; border-bottom: 1px solid #E4E6EB;
}
.fb-actions { display: flex; padding: 3px 8px; }
.fb-actions span {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 0; font-size: 13.5px; font-weight: 600; color: #65676B;
  border-radius: 6px; cursor: default;
}
.fb-actions span:hover { background: #F2F2F2; }
.fb-actions svg { width: 17px; height: 17px; }

/* telegram channel mock */
.tg-chat {
  background: linear-gradient(160deg, #9BB0C7, #7E96B3);
  border-radius: 12px; padding: 18px 12px; max-width: 400px; margin: 0 auto;
  transition: max-width .25s ease;
}
.preview-col.desktop .tg-chat { max-width: 560px; }
.tg-msg {
  background: #fff; border-radius: 14px; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.2); max-width: 340px;
}
.preview-col.desktop .tg-msg { max-width: 480px; }
.tg-head { display: flex; align-items: center; gap: 9px; padding: 10px 12px 8px; }
.tg-name { font-weight: 700; font-size: 14px; color: #2481CC; }
.tg-sub { font-size: 12px; color: #8b9aa8; }
.tg-img { width: 100%; display: block; }
.tg-text {
  padding: 8px 12px 4px; font-size: 14px; line-height: 1.45; color: #111;
  white-space: pre-wrap; word-wrap: break-word;
}
.tg-text .fb-hashtag { color: #2481CC; }
.tg-meta {
  display: flex; justify-content: flex-end; gap: 10px; padding: 2px 12px 8px;
  font-size: 12px; color: #8b9aa8;
}
.plat-toggle .dtab { font-size: 12.5px; font-weight: 600; gap: 6px; display: inline-flex; align-items: center; padding: 6px 14px; }

@media (max-width: 1100px) {
  .approval-body { grid-template-columns: 1fr; }
  .preview-col { border-inline-start: none; border-top: 1px solid var(--border); }
}

/* ---------- sources page ---------- */
.source-row { overflow: hidden; }
.source-off { opacity: .55; }
.source-main {
  display: grid; grid-template-columns: 1fr auto auto; gap: 20px;
  align-items: center; padding: 16px 20px;
}
.source-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.src-kind-badge {
  flex: none; font-size: 11px; font-weight: 700; border-radius: 7px; padding: 5px 9px;
}
.src-kind-badge.rss { background: var(--accent-soft); color: var(--accent-ink); }
.src-kind-badge.tg { background: #E7F1FD; color: #1D6FC2; }
.source-name { font-weight: 700; font-size: 14.5px; }
.source-url { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-stats { display: flex; gap: 20px; }
.sstat { text-align: center; min-width: 44px; }
.sstat-v { font-family: var(--font-display); font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }
.sstat-l { font-size: 11px; color: var(--text-3); }
.source-controls { display: flex; align-items: center; gap: 10px; }
.rating { display: flex; gap: 1px; }
.star {
  background: none; border: none; font-size: 21px; line-height: 1;
  color: var(--border-strong); padding: 2px; transition: color .12s ease, transform .12s ease;
}
.star.on { color: #F5A623; }
.star:hover { transform: scale(1.15); color: #F5A623; }
.btn-sm { padding: 7px 13px; min-height: 36px; font-size: 12.5px; }
.source-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 20px; border-top: 1px solid var(--border); background: var(--bg);
  font-size: 12.5px; color: var(--text-3);
}
.scan-status.err { color: var(--red); font-weight: 600; }
.link-btn {
  background: none; border: none; color: var(--accent-ink); font-weight: 600;
  font-size: 12.5px; display: inline-flex; align-items: center; gap: 4px;
}
.link-btn svg { width: 14px; height: 14px; }
.source-log { border-top: 1px solid var(--border); max-height: 340px; overflow-y: auto; }
.log-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 20px;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
.log-item:last-child { border-bottom: none; }
.log-title { color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-time { color: var(--text-3); font-size: 12px; flex: none; }
@media (max-width: 1000px) {
  .source-main { grid-template-columns: 1fr; gap: 12px; }
}

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: start; padding: 12px 16px; color: var(--text-3);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .8px;
  border-bottom: 1px solid var(--border);
}
table.data td { padding: 13px 16px; border-bottom: 1px solid var(--border); color: var(--text-2); font-variant-numeric: tabular-nums; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--bg); }
.status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 11px;
}
.status .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.published, .status.approved { background: var(--green-soft); color: var(--green); }
.status.pending { background: var(--amber-soft); color: var(--amber); }
.status.rejected, .status.failed { background: var(--red-soft); color: var(--red); }
.status.dry { background: #EDF0F7; color: var(--text-2); }

/* ---------- forms / settings ---------- */
.form-grid { display: grid; gap: 20px; }
.form-row label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.form-row .help { font-size: 12.5px; color: var(--text-3); margin-top: 5px; }
input.field, select.field {
  width: 100%; min-height: 46px; border: 1px solid var(--border-strong);
  border-radius: 10px; background: var(--surface); color: var(--text);
  padding: 10px 14px; font-size: 14.5px; font-family: inherit;
  transition: border-color .18s ease;
}
input.field:focus, select.field:focus { border-color: var(--accent-ink); outline: none; }
.section-title { font-family: var(--font-display); font-size: 17px; font-weight: 700; margin: 36px 0 14px; }
.card-pad { padding: 24px; }

/* ---------- flash / empty ---------- */
.flash { border-radius: 12px; padding: 14px 18px; font-size: 14px; font-weight: 500; margin-bottom: 20px; display: flex; gap: 10px; align-items: center; }
.flash.ok { background: var(--green-soft); color: var(--green); }
.flash.err { background: var(--red-soft); color: var(--red); }
.empty {
  text-align: center; padding: 56px 24px; color: var(--text-3);
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
}
.empty svg { width: 40px; height: 40px; margin-bottom: 12px; opacity: .5; }

/* ---------- wizard ---------- */
.radio-opt { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.feed-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px;
  border-bottom: 1px solid var(--border); cursor: pointer; font-size: 13.5px;
}
.feed-row:last-child { border-bottom: none; }
.feed-row:hover { background: var(--bg); }
.feed-status { font-size: 12.5px; font-weight: 600; flex: none; }
.feed-status.ok { color: var(--green); }
.feed-status.bad { color: var(--text-3); }

/* ---------- login ---------- */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(600px 400px at 85% 10%, rgba(0,229,255,.10), transparent 60%),
    radial-gradient(500px 350px at 10% 90%, rgba(14,116,144,.08), transparent 60%),
    var(--bg);
}
.login-card { width: 100%; max-width: 400px; padding: 44px 40px; text-align: center; box-shadow: var(--shadow-md); }
.login-card .brand-mark { width: 52px; height: 52px; font-size: 25px; border-radius: 14px; margin: 0 auto 14px; }
.login-title { font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.login-sub { color: var(--text-2); font-size: 13.5px; margin: 4px 0 26px; }
.login-card form { display: grid; gap: 14px; text-align: start; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; padding: 12px 16px; }
  .brand { padding: 0 12px 0 0; }
  .sidebar-footer { margin: 0; margin-inline-start: auto; padding: 0; }
  .main { padding: 20px 16px 48px; }
  .draft-card { grid-template-columns: 1fr; }
  .draft-card .visual { border-inline-end: none; border-bottom: 1px solid var(--border); }
}


/* ---------- grid utilities (collapse on mobile) ---------- */
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.g3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.g4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; align-items: end; }
.gsrc { display: grid; grid-template-columns: 140px 1fr 2fr auto; gap: 12px; align-items: end; }

/* ---------- mobile ---------- */
@media (max-width: 760px) {
  .g2, .g3, .g4, .gsrc { grid-template-columns: 1fr; }
  .main { padding: 16px 12px 56px; }
  .page-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .page-title { font-size: 21px; }
  .page-head .btn, .page-head form .btn { width: 100%; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px 16px; }
  .kpi-value { font-size: 24px; }
  .sidebar { flex-wrap: wrap; gap: 2px; padding: 10px 10px; height: auto; }
  .brand { padding: 0 8px 0 0; }
  .brand-name { display: none; }
  .brand-context { width: auto; padding: 8px 8px 4px; font-size: 13px; }
  .nav-item { padding: 9px 10px; font-size: 13px; min-height: 40px; gap: 8px; }
  .nav-item svg { width: 17px; height: 17px; }
  .sidebar-footer { display: flex; align-items: center; gap: 8px; padding: 4px; }
  .sidebar-footer form { margin-top: 0 !important; }
  .sidebar-footer .btn { padding: 8px 12px; min-height: 38px; width: auto !important; }
  .approval-head { padding: 12px 14px; }
  .edit-col { padding: 14px; }
  .preview-col { padding: 14px 10px; }
  .fb-post, .tg-chat { max-width: 100%; }
  .draft-actions .btn { flex: 1; padding: 11px 8px; font-size: 13px; }
  .brands-grid { grid-template-columns: 1fr; }
  .bc-body { grid-template-columns: repeat(4, 1fr); }
  .source-stats { flex-wrap: wrap; gap: 12px; }
  .source-controls { flex-wrap: wrap; }
  .section-title { margin: 24px 0 10px; }
  .card-pad { padding: 16px; }
  .login-card { padding: 32px 22px; }
  table.data { font-size: 12.5px; }
  table.data td, table.data th { padding: 9px 10px; }
}

.fb-avatar-mono { display: grid; place-items: center; font-family: var(--font-display);
  font-weight: 700; font-size: 18px; }

/* engine failure banner — silent scheduler errors must be loud */
.engine-alert {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--red-soft); border: 1px solid #F3C4C4;
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 22px;
}
.engine-alert svg { width: 22px; height: 22px; color: var(--red); flex: none; margin-top: 2px; }
.ea-title { font-weight: 700; color: var(--red); font-size: 15px; }
.ea-msg { color: var(--text); font-size: 14px; margin-top: 3px; }
.ea-when { color: var(--text-3); font-size: 12.5px; margin-top: 5px; }

/* daily budget meter */
.budget-card { margin-bottom: 22px; }
.budget-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.budget-nums { font-family: var(--font-display); font-weight: 700; font-size: 22px; display: flex; gap: 8px; align-items: baseline; }
.budget-of { font-size: 13px; color: var(--text-3); font-weight: 500; }
.budget-track { height: 9px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); margin: 12px 0 8px; overflow: hidden; }
.budget-fill { height: 100%; background: var(--accent-ink); border-radius: 999px; transition: width .3s ease; }
.budget-fill.over { background: var(--red); }

/* never let a page push the shell sideways — content wraps, it doesn't widen */
.main { min-width: 0; max-width: 100%; overflow-x: hidden; }
.shell { max-width: 100vw; }
.sugg-actions { flex: 0 0 auto; }

/* background shade picker */
.bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.bg-opt { overflow: hidden; }
.bg-opt img { width: 100%; height: auto; display: block; }
.bg-opt.is-current { outline: 2px solid var(--accent-ink); outline-offset: -2px; }
.bg-opt-foot { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.bg-opt-label { font-weight: 700; font-size: 14.5px; }
.bg-opt-hex { font-size: 12.5px; color: var(--text-3); font-family: var(--font-display); }

/* ============================================================
   Suggestions queue — scannable decision list
   Score rail (tabular) | headline + meta | actions. Sort is
   URL-driven and details/summary is native, so zero JS (CSP).
   ============================================================ */
.sort-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.sort-label { display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--text-2); }
.sort-label svg { width: 15px; height: 15px; }
.segmented { display: inline-flex; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 3px; gap: 2px; }
.seg { padding: 8px 15px; border-radius: 8px; font-size: 13.5px; font-weight: 600;
  color: var(--text-2); min-height: 36px; display: inline-flex; align-items: center;
  transition: background .15s ease, color .15s ease; }
.seg:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.seg.active { background: var(--accent-soft); color: var(--accent-ink); }

.sugg-list { display: flex; flex-direction: column; gap: 10px; max-width: 100%; }
.sugg {
  display: grid; grid-template-columns: 62px minmax(0, 1fr) auto;
  gap: 18px; align-items: start; max-width: 100%;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 16px 18px; transition: box-shadow .15s ease, border-color .15s ease;
}
.sugg:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.sugg > * { min-width: 0; }

.sugg-score { display: grid; place-items: center; gap: 1px; padding: 8px 4px;
  border-radius: 10px; background: var(--bg); border: 1px solid var(--border); }
.sugg-score.warm { background: var(--amber-soft); border-color: #F3DFBC; }
.sugg-score.hot { background: var(--green-soft); border-color: #C6E9D3; }
.ss-num { font-family: var(--font-display); font-weight: 700; font-size: 19px;
  font-variant-numeric: tabular-nums; line-height: 1.1; }
.sugg-score.warm .ss-num { color: var(--amber); }
.sugg-score.hot .ss-num { color: var(--green); }
.ss-cap { font-size: 10.5px; color: var(--text-3); }

.sugg-main > * { overflow-wrap: anywhere; }
.sugg-title { font-family: var(--font-display); font-weight: 700; font-size: 17px;
  line-height: 1.4; color: var(--text); margin-bottom: 6px; }
.sugg-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--text-3); }
.sm-source { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; color: var(--text-2); }
.sm-source svg { width: 13px; height: 13px; }
.sm-dot { color: var(--border-strong); }
.sugg-reason { display: flex; align-items: flex-start; gap: 6px; margin-top: 9px;
  font-size: 13px; color: var(--text-2); }
.sugg-reason svg { width: 14px; height: 14px; flex: none; margin-top: 2px; color: var(--accent-ink); }
.sugg-more { margin-top: 9px; }
.sugg-more summary { font-size: 12.5px; color: var(--accent-ink); cursor: pointer;
  font-weight: 600; width: fit-content; padding: 3px 0; }
.sugg-orig { font-size: 12.5px; color: var(--text-3); margin-top: 7px; }
.sugg-summary { font-size: 13.5px; color: var(--text-2); margin-top: 6px; line-height: 1.6; }

.sugg-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.sugg-actions .btn { white-space: nowrap; }

@media (max-width: 760px) {
  .sugg { grid-template-columns: 52px minmax(0, 1fr); gap: 12px; }
  .sugg-actions { grid-column: 1 / -1; flex-direction: row; }
  .sugg-actions form { flex: 1; }
  .sugg-actions .btn { width: 100%; }
  .segmented { width: 100%; }
  .seg { flex: 1; justify-content: center; }
}

.check-row { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.check-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent-ink); }

/* ---------- confirm modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(10, 14, 39, .45); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px;
  opacity: 0; transition: opacity .16s ease;
}
.modal-backdrop.open { opacity: 1; }
.modal {
  background: var(--surface); border-radius: 18px; padding: 28px 26px 22px;
  width: min(440px, 100%); box-shadow: 0 20px 60px rgba(15, 23, 42, .28);
  text-align: center; transform: translateY(8px) scale(.98);
  transition: transform .16s ease;
}
.modal-backdrop.open .modal { transform: none; }
.modal-icon {
  width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 16px;
  display: grid; place-items: center;
}
.modal-icon svg { width: 26px; height: 26px; }
.modal-icon.warn { background: var(--amber-soft); color: var(--amber); }
.modal-icon.danger { background: var(--red-soft); color: var(--red); }
.modal-icon.ok { background: var(--green-soft); color: var(--green); }
.modal-title { font-family: var(--font-display); font-weight: 700; font-size: 19px; }
.modal-body { color: var(--text-2); font-size: 14.5px; margin-top: 8px; line-height: 1.6; }
.modal-actions { display: flex; gap: 10px; margin-top: 22px; }
.modal-actions .btn { flex: 1; }
@media (prefers-reduced-motion: reduce) {
  .modal-backdrop, .modal { transition: none; }
}


/* ============================================================
   JobProgress — shared panel for scan / write / publish
   ============================================================ */
.jobp {
  display: flex; align-items: center; gap: 22px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow-md);
  padding: 22px 24px; margin-bottom: 24px;
  position: relative; overflow: hidden;
}
.jobp::before {           /* soft accent glow that hints "working" */
  content: ''; position: absolute; inset-inline-start: -30%; top: -60%;
  width: 60%; height: 220%; pointer-events: none;
  background: radial-gradient(closest-side, var(--accent-soft), transparent);
  animation: jobp-sweep 2.6s ease-in-out infinite;
}
@keyframes jobp-sweep {
  0%, 100% { transform: translateX(0); opacity: .55; }
  50%      { transform: translateX(120%); opacity: .9; }
}

.jobp-ring { position: relative; width: 92px; height: 92px; flex: none; }
.jobp-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.jobp-ring circle { fill: none; stroke-width: 8; stroke-linecap: round; }
.jr-bg { stroke: var(--bg); }
.jr-fg {
  stroke: var(--accent-ink);
  transition: stroke .3s ease;
  filter: drop-shadow(0 0 6px rgba(0, 229, 255, .45));
}
.jobp-pct {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 21px;
  font-variant-numeric: tabular-nums; color: var(--text);
}

.jobp-main { min-width: 0; flex: 1; }
.jobp-title { font-family: var(--font-display); font-weight: 700; font-size: 17px; }
.jobp-detail { color: var(--text-2); font-size: 13.5px; margin-top: 3px;
  overflow-wrap: anywhere; min-height: 19px; }

.jobp-steps { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.jobp-step {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--text-3);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 12px 5px 9px;
  transition: all .25s ease;
}
.jobp-step i {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--border-strong); transition: all .25s ease;
}
.jobp-step.is-active {
  color: var(--accent-ink); background: var(--accent-soft);
  border-color: rgba(14, 116, 144, .3);
}
.jobp-step.is-active i {
  background: var(--accent-ink);
  animation: jobp-pulse 1s ease-in-out infinite;
}
@keyframes jobp-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.5); opacity: .5; }
}
.jobp-step.is-done { color: var(--green); background: var(--green-soft); border-color: #C6E9D3; }
.jobp-step.is-done i { background: var(--green); }

.jobp-time { font-size: 12.5px; color: var(--text-3); margin-top: 10px;
  font-variant-numeric: tabular-nums; }

.jobp.is-done { border-color: #C6E9D3; }
.jobp.is-done::before { animation: none; opacity: 0; }
.jobp.is-done .jr-fg { stroke: var(--green); filter: none; }
.jobp.is-error { border-color: #F3C4C4; }
.jobp.is-error::before { animation: none; opacity: 0; }
.jobp.is-error .jr-fg { stroke: var(--red); filter: none; }

@media (max-width: 760px) {
  .jobp { flex-direction: column; align-items: flex-start; gap: 16px; }
  .jobp-ring { width: 72px; height: 72px; }
  .jobp-pct { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  .jobp::before, .jobp-step.is-active i { animation: none; }
}

/* ---------- floating job dock (every page) ---------- */
.jobdock {
  position: fixed; inset-block-end: 18px; inset-inline-end: 18px;
  z-index: 60; display: flex; flex-direction: column; gap: 10px;
  width: min(340px, calc(100vw - 36px)); pointer-events: none;
}
.jd-card {
  pointer-events: auto;
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-md);
  padding: 12px 14px;
  animation: jd-in .28s cubic-bezier(.2, .9, .3, 1);
}
@keyframes jd-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.jd-dial { position: relative; width: 38px; height: 38px; flex: none; }
.jd-pct {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 10px; font-weight: 700; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.jd-card.is-done .jd-pct { color: #15803D; }
.jd-card.is-error .jd-pct { color: #DC2626; }
.jd-ring { width: 38px; height: 38px; flex: none; transform: rotate(-90deg); }
.jd-ring-bg { fill: none; stroke: var(--border); stroke-width: 3.5; }
.jd-ring-fg {
  fill: none; stroke: var(--accent-ink); stroke-width: 3.5; stroke-linecap: round;
  transition: stroke .3s;
}
.jd-body { min-width: 0; flex: 1; }
.jd-title {
  font-weight: 600; font-size: 13px; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.jd-detail {
  font-size: 12px; color: var(--muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.jd-go {
  flex: none; font-size: 12px; font-weight: 600; padding: 5px 11px;
  border-radius: 8px; background: var(--accent-soft); color: var(--accent-ink);
}
.jd-go:hover { text-decoration: none; filter: brightness(.96); }
.jd-x {
  flex: none; border: 0; background: none; cursor: pointer;
  color: var(--muted); font-size: 19px; line-height: 1; padding: 2px 4px;
  border-radius: 6px;
}
.jd-x:hover { color: var(--ink); background: var(--border); }
.jd-card.is-done .jd-ring-fg { stroke: #15803D; }
.jd-card.is-done { border-color: #86EFAC; }
.jd-card.is-error .jd-ring-fg { stroke: #DC2626; }
.jd-card.is-error { border-color: #FCA5A5; }
@media (max-width: 760px) {
  .jobdock { inset-inline: 12px; inset-block-end: 12px; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .jd-card { animation: none; }
}

/* ---------- suggestions: multi-select ---------- */
.sugg-pick { display: grid; place-items: center; padding-top: 6px; flex: none; }
.sugg-pick input { width: 20px; height: 20px; cursor: pointer; accent-color: var(--accent-ink); }
.sugg { grid-template-columns: 28px 62px minmax(0, 1fr) auto; }
.sugg:has(.batch-pick:checked) {
  border-color: var(--accent-ink);
  box-shadow: 0 0 0 1px var(--accent-ink), var(--shadow-md);
}
.btn-link {
  background: none; border: none; color: var(--text-2);
  font-size: 13.5px; font-weight: 600; padding: 8px 4px;
  text-decoration: underline; text-underline-offset: 3px;
}
.btn-link:hover { color: var(--text); }
@media (max-width: 760px) { .sugg { grid-template-columns: 28px 52px minmax(0, 1fr); } }

/* filtered-out rows read as archive, not as a live queue */
.filtered-row { grid-template-columns: 62px minmax(0, 1fr) auto; opacity: .82; }
.filtered-row:hover { opacity: 1; }
.filtered-row .sugg-title { font-size: 16px; }

.head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
@media (max-width: 760px) {
  .head-actions { width: 100%; }
  .head-actions form, .head-actions .btn { flex: 1; }
}

/* ---------- broadcast status banner ---------- */
.live-banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; flex-wrap: wrap; margin-bottom: 24px;
  padding: 18px 22px; border-radius: var(--radius);
  background: var(--amber-soft); border: 1px solid #F3DFBC;
}
.live-banner.is-live { background: var(--green-soft); border-color: #C6E9D3; }
.lb-main { display: flex; align-items: center; gap: 14px; }
.lb-dot {
  width: 12px; height: 12px; border-radius: 50%; flex: none;
  background: var(--amber); box-shadow: 0 0 0 4px rgba(180, 83, 9, .15);
}
.live-banner.is-live .lb-dot {
  background: var(--green); box-shadow: 0 0 0 4px rgba(22, 163, 74, .15);
  animation: lb-pulse 1.8s ease-in-out infinite;
}
@keyframes lb-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(22, 163, 74, .15); }
  50%      { box-shadow: 0 0 0 9px rgba(22, 163, 74, .05); }
}
.lb-title { font-family: var(--font-display); font-weight: 700; font-size: 16.5px; }
.live-banner .lb-title { color: var(--amber); }
.live-banner.is-live .lb-title { color: var(--green); }
.lb-sub { color: var(--text-2); font-size: 13.5px; margin-top: 2px; }
@media (max-width: 760px) {
  .live-banner { flex-direction: column; align-items: stretch; }
  .live-banner .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .live-banner.is-live .lb-dot { animation: none; } }
