:root {
  /* Brand */
  --brand: #e11b22;
  --brand-d: #b5141a;
  --brand-soft: #fdecec;
  --brand-grad: linear-gradient(135deg, #f0353b 0%, #c8141a 100%);
  --accent: #6d5efc; /* subtle secondary accent for variety */
  /* Neutrals (light) */
  --bg: #f4f5f8;
  --bg-grad:
    radial-gradient(1100px 560px at 100% -8%, rgba(109,94,252,.07), transparent 55%),
    radial-gradient(900px 520px at -8% 4%, rgba(225,27,34,.06), transparent 50%);
  --panel: #ffffff;
  --panel-2: #f1f3f7;
  --border: #e8ebf1;
  --border-2: #d6dce6;
  --text: #151b27;
  --muted: #69727f;
  --muted-2: #98a1af;
  /* Status */
  --ok: #1f9d6b;
  --ok-soft: #e6f6ef;
  --warn: #c77700;
  --warn-soft: #fdf2e0;
  --info: #2563d6;
  --info-soft: #e8f0fd;
  --danger: #d92d36;
  --danger-soft: #fdecec;
  /* Shape & elevation (modern SaaS depth) */
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06);
  --shadow: 0 1px 3px rgba(16,24,40,.05), 0 6px 16px -8px rgba(16,24,40,.12);
  --shadow-md: 0 8px 24px -8px rgba(16,24,40,.16);
  --shadow-lg: 0 24px 60px -16px rgba(16,24,40,.30);
  --ring: 0 0 0 3px rgba(225,27,34,.16);
  --sidebar-w: 252px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.02em; }
a { color: var(--brand); }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 5px; font-size: 12px; }
.muted { color: var(--muted); }
.hint { color: var(--muted-2); font-weight: 400; font-size: 12px; }

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

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--brand); color: #fff; font-weight: 800;
  display: grid; place-items: center; font-size: 17px;
  box-shadow: 0 4px 10px rgba(225,27,34,.35);
}
.brand-name { font-size: 16px; font-weight: 600; }
.brand-name strong { color: var(--brand); font-weight: 800; }

.nav { flex: 1; overflow-y: auto; padding: 6px 10px 10px; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); margin: 14px 10px 6px; font-weight: 700; }
.nav-item {
  width: 100%; display: flex; align-items: center; gap: 11px;
  background: transparent; border: none; color: var(--muted);
  padding: 9px 11px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 13.5px; font-weight: 600; font-family: inherit; text-align: left;
  margin-bottom: 2px; position: relative;
}
.nav-item svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
.nav-item span:not(.nav-count) { flex: 1; }
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); }
.nav-item.active::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.nav-item:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.nav-count { background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; }

.sidebar-foot { border-top: 1px solid var(--border); padding: 12px 16px; font-size: 12px; color: var(--muted); }
.foot-row { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted-2); flex: none; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--danger); } .dot.warn { background: var(--warn); }

.scrim { position: fixed; inset: 0; background: rgba(16,24,40,.4); z-index: 39; }

/* ── Main / topbar ───────────────────────────────────────── */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  background: rgba(255,255,255,.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border); padding: 12px 24px;
}
.page-title { flex: 1; min-width: 0; }
.page-title h1 { font-size: 19px; }
.page-sub { margin: 1px 0 0; font-size: 12.5px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.menu-btn { display: none; }

.icon-btn {
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer;
  color: var(--muted); font-size: 22px; line-height: 1;
}
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

.content { padding: 24px; max-width: 1200px; width: 100%; margin: 0 auto; }
.page { display: block; }
[hidden] { display: none !important; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  background: var(--panel); border: 1px solid var(--border-2); color: var(--text);
  padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 13px; font-weight: 600; font-family: inherit;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
}
.btn:hover { background: var(--panel-2); border-color: var(--muted-2); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.btn-ico { width: 16px; height: 16px; fill: currentColor; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-d); border-color: var(--brand-d); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-ok { color: var(--ok); border-color: var(--border-2); }
.btn-ok:hover { background: var(--ok-soft); border-color: var(--ok); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-danger-solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger-solid:hover { filter: brightness(.94); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.link-btn { background: none; border: none; color: var(--brand); font-weight: 600; cursor: pointer; font-size: 13px; font-family: inherit; padding: 0; }
.link-btn:hover { text-decoration: underline; }

/* ── Pills / badges ──────────────────────────────────────── */
.pill { padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-bad { background: var(--danger-soft); color: var(--danger); }
.pill-muted { background: var(--panel-2); color: var(--muted); }

.badge { padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-draft { background: var(--info-soft); color: var(--info); }
.badge-for_approval { background: #eef1ff; color: #4f46e5; }
.badge-needs_revision { background: var(--warn-soft); color: var(--warn); }
.badge-approved { background: var(--ok-soft); color: var(--ok); }
.badge-published { background: var(--ok); color: #fff; }
.badge-rejected { background: var(--danger-soft); color: var(--danger); }
.badge-archived { background: var(--panel-2); color: var(--muted-2); }
.badge-gap { background: var(--warn-soft); color: var(--warn); }
.badge-idea, .badge-queued, .badge-used { background: var(--panel-2); color: var(--muted); }

/* Status history timeline */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.timeline li { position: relative; padding-left: 16px; border-left: 2px solid var(--border); padding-bottom: 2px; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); border: 2px solid var(--panel); }
.tl-meta { color: var(--muted); font-size: 12px; margin-left: 8px; }
.tl-note { margin-top: 5px; font-size: 13px; background: var(--panel-2); border-radius: 6px; padding: 6px 9px; }

/* ── Summary / dashboard ─────────────────────────────────── */
.summary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat-card .stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-card .stat-ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; }
.stat-card .stat-ico svg { width: 18px; height: 18px; }
.stat-card .num { font-size: 26px; font-weight: 800; margin-top: 8px; letter-spacing: -.02em; }
.stat-card .label { color: var(--text); font-size: 13px; font-weight: 600; }
.stat-card .desc { color: var(--muted); font-size: 12px; margin-top: 2px; }
.ico-brand { background: var(--brand-soft); color: var(--brand); }
.ico-ok { background: var(--ok-soft); color: var(--ok); }
.ico-warn { background: var(--warn-soft); color: var(--warn); }
.ico-info { background: var(--info-soft); color: var(--info); }
.ico-danger { background: var(--danger-soft); color: var(--danger); }
.stat-ico svg { fill: currentColor; }

.quick-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }

.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.dash-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.dash-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dash-card-head h2 { font-size: 15px; }

.mini-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); cursor: pointer; }
.mini-row:first-child { border-top: none; }
.mini-row:hover { background: var(--panel-2); margin: 0 -8px; padding: 10px 8px; border-radius: 8px; }
.mini-thumb { width: 44px; height: 32px; border-radius: 6px; object-fit: cover; background: var(--panel-2); flex: none; }
.mini-thumb.empty { display: grid; place-items: center; color: var(--muted-2); font-size: 16px; }
.mini-main { flex: 1; min-width: 0; }
.mini-title { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Toolbar / filters ───────────────────────────────────── */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }

/* Status tabs above the Drafts list */
.status-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--border); padding-bottom: 2px; }
.status-tab { display: inline-flex; align-items: center; gap: 7px; background: none; border: none; border-bottom: 2px solid transparent; padding: 8px 12px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; border-radius: 8px 8px 0 0; }
.status-tab:hover { color: var(--text); background: var(--panel-2); }
.status-tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.status-tab-n { font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--panel-2); color: var(--muted); display: inline-grid; place-items: center; }
.status-tab.active .status-tab-n { background: var(--brand-soft); color: var(--brand); }
.search-box { position: relative; flex: 1; min-width: 220px; }
.search-box svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; fill: var(--muted-2); }
.search-box input { width: 100%; padding-left: 36px; }

input, select, textarea {
  background: var(--panel); border: 1px solid var(--border-2); color: var(--text);
  border-radius: var(--radius-sm); padding: 9px 11px; font-family: inherit; font-size: 13px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { width: 100%; resize: vertical; }
label { display: block; margin: 12px 0; font-size: 12.5px; color: var(--muted); font-weight: 600; }
label input, label select, label textarea { display: block; width: 100%; margin-top: 6px; color: var(--text); font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }

.panel-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.panel-card h2 { font-size: 15px; margin-bottom: 4px; }

/* ── Blog list cards ─────────────────────────────────────── */
.cards-list { display: flex; flex-direction: column; gap: 12px; }
.blog-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; display: flex; gap: 14px; align-items: center; box-shadow: var(--shadow);
}
.blog-card .card-thumb { width: 84px; height: 60px; border-radius: 8px; object-fit: cover; background: var(--panel-2); flex: none; }
.blog-card .card-thumb.empty { display: grid; place-items: center; color: var(--muted-2); }
.blog-card .card-thumb.empty svg { width: 22px; height: 22px; fill: currentColor; }
.card-main { flex: 1; min-width: 0; }
.card-title { font-weight: 700; font-size: 15px; margin-bottom: 5px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-size: 12px; color: var(--muted); }
.card-meta .sep { color: var(--border-2); }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; justify-content: flex-end; flex: none; }
/* Star toggle on each blog card */
.fav-btn { border: none; background: none; cursor: pointer; font-size: 20px; line-height: 1; padding: 4px; border-radius: 8px; color: var(--border-2); transition: color .12s ease, transform .12s ease; }
.fav-btn:hover { color: #f0b400; transform: scale(1.12); background: var(--panel-2); }
.fav-btn.on { color: #f5b301; }
/* "Favorites" filter toggle in the toolbar */
.btn-fav-filter .fav-star { color: #f5b301; }
.btn-fav-filter.active { background: #fff8e6; border-color: #f5b301; color: #8a6100; }
.seo-chip { font-weight: 700; font-size: 11px; padding: 2px 8px; border-radius: 999px; }
.seo-hi { background: var(--ok-soft); color: var(--ok); }
.seo-mid { background: var(--warn-soft); color: var(--warn); }
.seo-lo { background: var(--danger-soft); color: var(--danger); }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; }
tbody tr:hover { background: var(--panel-2); }

.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 12px; }
.kv { background: var(--panel-2); border-radius: 8px; padding: 10px 12px; }
.kv .k { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.kv .v { font-size: 14px; font-weight: 600; margin-top: 2px; }

/* ── Empty / loading / states ────────────────────────────── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state .empty-ico { width: 56px; height: 56px; border-radius: 14px; background: var(--panel-2); display: grid; place-items: center; margin: 0 auto 14px; color: var(--muted-2); }
.empty-state .empty-ico svg { width: 28px; height: 28px; fill: currentColor; }
.empty-state h3 { font-size: 15px; color: var(--text); margin-bottom: 4px; }
.empty-state p { margin: 0 auto 16px; max-width: 340px; font-size: 13px; }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 28px; justify-content: center; }
.skeleton { background: linear-gradient(90deg, var(--panel-2) 25%, #e8ebf0 50%, var(--panel-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton-card { height: 88px; margin-bottom: 12px; }

.spinner { display: inline-block; width: 15px; height: 15px; border: 2px solid var(--border-2); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.result { margin-top: 14px; font-size: 13px; min-height: 0; }
.result.ok { color: var(--ok); } .result.err { color: var(--danger); }

/* Live progress bar (generation jobs) */
.prog { display: flex; flex-direction: column; gap: 8px; }
.prog-bar { height: 8px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.prog-bar > span { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 999px; transition: width .45s ease; }
.prog-msg { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; }
.prog-msg > span { flex: 1; }
.prog-msg em { font-style: normal; color: var(--text); font-variant-numeric: tabular-nums; }

/* Buttons in a loading state */
button.is-busy { opacity: .9; cursor: progress; }
button.is-busy .spinner { width: 12px; height: 12px; border-width: 2px; }

/* ── Segmented control ───────────────────────────────────── */
.seg { display: inline-flex; background: var(--panel-2); border-radius: 9px; padding: 3px; }
.seg-btn { background: transparent; border: none; padding: 6px 14px; border-radius: 7px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; font-family: inherit; }
.seg-btn.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.cal-nav { display: flex; align-items: center; gap: 10px; font-weight: 600; }

/* ── Calendar ────────────────────────────────────────────── */
/* grid-auto-rows keeps every week row the same height; min-width:0 on cells is
   what stops a long event title from stretching its column and squeezing the
   rest (grid items default to min-width:auto = their widest no-wrap content). */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: minmax(116px, auto); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-dow { background: var(--panel-2); padding: 9px 8px; text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cal-cell { background: var(--panel); min-width: 0; padding: 6px 6px 8px; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal-cell.out { background: var(--panel-2); }
.cal-cell.weekend:not(.out) { background: color-mix(in srgb, var(--panel-2) 45%, var(--panel)); }
.cal-date { font-size: 12px; color: var(--muted); font-weight: 600; flex: 0 0 auto; margin-bottom: 1px; }
.cal-cell.today .cal-date { background: var(--brand); color: #fff; border-radius: 50%; width: 22px; height: 22px; display: grid; place-items: center; }
.cal-ev { font-size: 11px; line-height: 1.35; padding: 3px 7px; border-radius: 6px; cursor: pointer; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid; transition: filter .12s ease, transform .12s ease; }
.cal-ev:hover { filter: brightness(.97); transform: translateX(1px); }
.cal-ev.s-draft { background: var(--info-soft); color: var(--info); border-color: var(--info); }
.cal-ev.s-approved, .cal-ev.s-published { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.cal-ev.s-needs_revision { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.cal-ev.s-rejected { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.cal-more { font-size: 10.5px; font-weight: 600; color: var(--muted); padding: 1px 6px; cursor: pointer; border-radius: 5px; align-self: flex-start; }
.cal-more:hover { color: var(--text); background: var(--panel-2); }

/* ── Drawer / editor ─────────────────────────────────────── */
.drawer { position: fixed; inset: 0; background: rgba(16,24,40,.45); display: flex; justify-content: flex-end; z-index: 60; }
.drawer-inner { width: min(760px, 100%); height: 100%; background: var(--bg); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px 22px 14px; background: var(--panel); border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: 17px; }
.drawer-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 7px; font-size: 12px; color: var(--muted); }
.editor-tabs { display: flex; gap: 2px; padding: 0 14px; background: var(--panel); border-bottom: 1px solid var(--border); overflow-x: auto; }
.etab { background: none; border: none; padding: 11px 14px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; font-family: inherit; border-bottom: 2px solid transparent; white-space: nowrap; }
.etab:hover { color: var(--text); }
.etab.active { color: var(--brand); border-bottom-color: var(--brand); }
.etab:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.editor-body { flex: 1; overflow-y: auto; padding: 20px 22px 40px; }
.etab-panel { display: none; }
.etab-panel.active { display: block; }
.section-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; }
.section-card > h3 { font-size: 14px; margin-bottom: 6px; }

/* live length indicators */
.field-meter { font-size: 11px; color: var(--muted); float: right; font-weight: 600; }
.field-meter.warn { color: var(--warn); } .field-meter.bad { color: var(--danger); } .field-meter.ok { color: var(--ok); }

/* checklist */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { padding: 7px 0; font-size: 13px; border-top: 1px solid var(--border); display: flex; align-items: baseline; gap: 9px; }
.checklist li:first-child { border-top: none; }
.chk-badge { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; padding: 2px 7px; border-radius: 5px; flex: none; }
.chk-ok .chk-badge { background: var(--ok-soft); color: var(--ok); }
.chk-bad .chk-badge { background: var(--warn-soft); color: var(--warn); }
.checklist li em { color: var(--muted); font-style: normal; display: block; font-size: 12px; }

.score-ring { display: flex; align-items: center; gap: 12px; }
.score-num { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }

/* thumbnail */
.thumb-preview { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); margin-bottom: 14px; background: var(--panel-2); }
.thumb-empty { background: var(--panel-2); border: 1.5px dashed var(--border-2); border-radius: 10px; padding: 28px; text-align: center; color: var(--muted); margin-bottom: 14px; }
.thumb-empty .empty-ico { width: 48px; height: 48px; border-radius: 12px; background: var(--panel); display: grid; place-items: center; margin: 0 auto 10px; color: var(--muted-2); }
.thumb-empty .empty-ico svg { width: 24px; height: 24px; fill: currentColor; }
.thumb-controls { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.thumb-controls input { flex: 1; min-width: 0; }
.thumb-controls .btn { flex: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.gap-box { background: var(--warn-soft); border: 1px solid #f3dcae; border-radius: 10px; padding: 14px; margin-bottom: 14px; }
.gap-box ul { margin: 6px 0 0; padding-left: 18px; }
.prose { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 18px; max-height: 420px; overflow-y: auto; }
.prose h2 { font-size: 18px; margin: 18px 0 8px; } .prose h3 { font-size: 15px; margin: 14px 0 6px; }
.prose a { color: var(--brand); } .prose p { margin: 0 0 10px; }
/* Inline article editing */
.prose.editing { outline: 2px solid var(--brand); outline-offset: 2px; background: #fffdfa; min-height: 240px; cursor: text; }
.prose.editing:focus { outline-color: var(--brand); }
.art-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 6px; margin-bottom: 8px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; }
.art-btn { border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 4px 8px; font-size: 12.5px; font-weight: 600; color: var(--text); cursor: pointer; line-height: 1; }
.art-btn:hover { background: #fff; border-color: var(--border); }
.art-sep { width: 1px; align-self: stretch; background: var(--border-2); margin: 2px 4px; }
.art-hint { font-size: 11.5px; align-self: center; }
.art-autosave { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--ok); opacity: 0; transition: opacity .2s ease; }
.art-autosave.show { opacity: 1; }

/* WordPress sync status badge */
.wp-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-left: 8px; vertical-align: middle; }
.wp-badge.ok { background: var(--ok-soft); color: var(--ok); }
.wp-badge.syncing { background: var(--info-soft); color: var(--info); }
.wp-badge.err { background: var(--danger-soft); color: var(--danger); }

/* Version history */
.rev-list { list-style: none; margin: 6px 0 0; padding: 0; }
.rev-item { border-top: 1px solid var(--border); padding: 10px 0; }
.rev-item:first-child { border-top: none; }
.rev-row { display: flex; align-items: center; gap: 12px; }
.rev-main { flex: 1; min-width: 0; }
.rev-title { font-weight: 600; font-size: 13px; }
.rev-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.rev-actions { display: flex; gap: 6px; flex: none; }
.rev-preview { margin-top: 10px; }
.rev-preview .prose { max-height: 300px; }

/* prepublish checklist */
.prepub li { display: flex; align-items: center; gap: 9px; padding: 6px 0; font-size: 13px; }
.prepub .tick { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; flex: none; color: #fff; }
.prepub .tick.ok { background: var(--ok); } .prepub .tick.no { background: var(--muted-2); }

/* ── Modal ───────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; background: rgba(16,24,40,.45); display: grid; place-items: center; z-index: 70; padding: 20px; }
.modal-inner { background: var(--panel); border-radius: var(--radius); padding: 22px; width: min(520px, 100%); box-shadow: var(--shadow-lg); max-height: 90vh; overflow-y: auto; }
.modal-sm { width: min(420px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.modal-head h2 { font-size: 17px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ── Toast ───────────────────────────────────────────────── */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 12px 20px; border-radius: 10px; z-index: 90; box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 600; max-width: 90vw; }
.toast.err { background: var(--danger); } .toast.ok { background: var(--ok); }

.schedule-preview { background: var(--info-soft); color: var(--info); border-radius: 8px; padding: 10px 12px; font-size: 13px; font-weight: 600; margin: 4px 0 14px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 18px; font-size: 13px; color: var(--muted); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s ease; width: var(--sidebar-w); }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: grid; }
  .dash-cols { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .content { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .blog-card { flex-wrap: wrap; }
  .blog-card .card-thumb { width: 100%; height: 130px; }
  .card-actions { justify-content: flex-start; width: 100%; }
  .cal-grid { display: none; }
  .topbar-actions .btn-primary span, .topbar { gap: 10px; }
  table thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  tbody tr { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px; padding: 6px; }
  td { border: none; padding: 4px 8px; }
  td::before { content: attr(data-label); font-weight: 700; color: var(--muted); margin-right: 8px; }
}

/* ── Login screen ────────────────────────────────────────── */
.login-screen {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, var(--brand-soft), var(--bg) 60%);
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 28px 26px;
  display: flex; flex-direction: column; gap: 12px;
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.login-card h1 { font-size: 22px; }
.login-sub { margin: -4px 0 6px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; }
.login-card input { width: 100%; }
.login-hint { background: var(--info-soft); color: var(--info); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 12px; font-weight: 600; }
.btn-block { width: 100%; justify-content: center; margin-top: 4px; }
.form-error { background: var(--danger-soft); color: var(--danger); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px; font-weight: 600; }

/* ── Avatars ─────────────────────────────────────────────── */
.avatar, .avatar-md, .profile-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; overflow: hidden; background: var(--brand-soft); color: var(--brand);
  font-weight: 700; flex: none;
}
.avatar { width: 28px; height: 28px; font-size: 12px; }
.avatar-md { width: 44px; height: 44px; font-size: 15px; }
.profile-avatar { width: 76px; height: 76px; font-size: 26px; }
.avatar img, .avatar-md img, .profile-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Header user menu ────────────────────────────────────── */
.user-menu { position: relative; }
.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 10px 4px 4px; cursor: pointer; font: inherit; font-weight: 600; color: var(--text);
}
.user-chip:hover { background: var(--panel-2); }
.user-chip-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .caret { width: 16px; height: 16px; fill: var(--muted); }
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  width: 230px; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; overflow: hidden;
}
.user-dropdown-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.user-dropdown-name { font-weight: 700; }
.user-dropdown-email { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.user-dropdown-item {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background: none; border: 0; border-radius: var(--radius-sm); padding: 9px 10px;
  font: inherit; font-weight: 600; color: var(--text); cursor: pointer; text-align: left;
}
.user-dropdown-item:hover { background: var(--panel-2); }
.user-dropdown-item svg { width: 17px; height: 17px; fill: var(--muted); }

/* ── Notification bell ───────────────────────────────────── */
.notif-menu { position: relative; }
.notif-btn { position: relative; }
.notif-btn svg { width: 20px; height: 20px; fill: var(--muted); }
.notif-count {
  position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px; padding: 0 4px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff; font-size: 10px; font-weight: 700; border-radius: 999px;
  border: 2px solid var(--panel); box-sizing: content-box;
}
.notif-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  width: 340px; max-width: 90vw; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden;
}
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notif-list { max-height: 60vh; overflow-y: auto; }
.notif-empty { padding: 28px 14px; text-align: center; color: var(--muted); }
.notif-item {
  width: 100%; display: flex; gap: 10px; align-items: flex-start; text-align: left;
  background: none; border: 0; border-bottom: 1px solid var(--border); padding: 11px 14px;
  cursor: pointer; font: inherit; color: var(--text);
}
.notif-item:hover { background: var(--panel-2); }
.notif-item.unread { background: var(--brand-soft); }
.notif-item.unread:hover { background: #fbe2e2; }
.notif-ico { font-size: 16px; line-height: 1.3; flex: none; }
.notif-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-title { font-weight: 700; font-size: 13px; }
.notif-body { font-size: 12.5px; color: var(--muted); }
.notif-time { font-size: 11px; color: var(--muted-2); margin-top: 2px; }
.link-btn { background: none; border: 0; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }

/* ── My Account page ─────────────────────────────────────── */
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 16px; }
.profile-head { display: flex; align-items: center; gap: 16px; }
.account-grid label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; margin-bottom: 10px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }

/* ── Users list ──────────────────────────────────────────── */
.user-row { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }

/* ── Featured-image template ─────────────────────────────── */
.tpl-layout { display: grid; grid-template-columns: 1fr 1.1fr; gap: 20px; align-items: start; }
.tpl-controls { display: flex; flex-direction: column; gap: 12px; }
.tpl-controls input[type="color"] { width: 100%; height: 38px; padding: 2px; cursor: pointer; }
.tpl-controls input[type="range"] { width: 100%; accent-color: var(--brand); }
.tpl-check { display: flex; align-items: center; gap: 8px; align-self: end; font-weight: 600; font-size: 13px; }
.tpl-check input { width: 16px; height: 16px; accent-color: var(--brand); }
.tpl-preview { position: relative; }
.tpl-preview img { width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2); display: block; }
.tpl-preview .muted { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; }
@media (max-width: 720px) { .tpl-layout { grid-template-columns: 1fr; } }

/* ── Reader analytics tab ────────────────────────────────── */
.an-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.an-stat { background: var(--panel-2); border-radius: 10px; padding: 12px 14px; text-align: center; }
.an-num { font-size: 24px; font-weight: 800; color: var(--text); line-height: 1.1; }
.an-label { font-size: 11.5px; color: var(--muted); margin-top: 3px; font-weight: 600; }
.an-bars { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.an-bar-row { display: grid; grid-template-columns: 160px 1fr 48px; align-items: center; gap: 10px; font-size: 12.5px; }
.an-bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-bar { height: 8px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.an-bar-fill { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.an-bar-n { text-align: right; font-weight: 700; color: var(--muted); }
.an-links { display: flex; flex-direction: column; gap: 8px; }
.an-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.an-link:first-child { border-top: none; }
.an-link a { font-size: 12.5px; color: var(--brand); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-link-n { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; flex: none; }
.an-spark { display: flex; align-items: flex-end; gap: 3px; height: 60px; margin-top: 12px; }
.an-spark-bar { flex: 1; min-width: 2px; background: var(--brand-soft); border-radius: 2px 2px 0 0; }
.an-spark-bar:hover { background: var(--brand); }

/* ── Team / permissions ──────────────────────────────────── */
.team-card { align-items: flex-start; }
.perm-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.perm-chip { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); }
.perm-chip.perm-all { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.perm-chip.perm-none { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.perm-head { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 12px 0 8px; }
.perm-grid { display: grid; gap: 6px; }
.perm-opt { display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; transition: border-color .12s ease, background .12s ease; }
.perm-opt:hover { border-color: var(--muted-2); background: var(--panel-2); }
.perm-opt input { margin-top: 2px; flex: none; width: 16px; height: 16px; accent-color: var(--brand); }
.perm-opt span { display: flex; flex-direction: column; gap: 1px; line-height: 1.3; }
.perm-opt strong { font-size: 13px; font-weight: 600; }
.perm-opt em { font-size: 11.5px; color: var(--muted); font-style: normal; }

@media (max-width: 640px) {
  .user-chip-name { display: none; }
  .account-grid { grid-template-columns: 1fr; }
}

/* ── Phase 4: polish & micro-interactions ────────────────── */
::selection { background: var(--brand-soft); }

/* Smooth, consistent transitions on interactive surfaces */
.btn, .icon-btn, .nav-item, .user-chip, .notif-btn, .stat-card, .blog-card,
.dash-card, .notif-item, input, select, textarea, .seg-btn, .etab, .link-btn, .mini-row {
  transition: background-color .15s ease, border-color .15s ease, color .15s ease,
    box-shadow .15s ease, transform .08s ease;
}
.btn:active:not(:disabled) { transform: translateY(1px); }

/* Subtle lift on hover for cards (clearer affordance + depth) */
.stat-card:hover, .blog-card:hover { box-shadow: 0 6px 18px rgba(16,24,40,.10); border-color: var(--border-2); }

/* Consistent keyboard focus ring on the remaining interactive elements */
.nav-item:focus-visible, .user-chip:focus-visible, .link-btn:focus-visible,
.notif-item:focus-visible, .notif-btn:focus-visible {
  outline: none; box-shadow: 0 0 0 3px var(--brand-soft); border-radius: var(--radius-sm);
}

/* Refined scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }

/* Tighter, less-crowded header on small screens */
@media (max-width: 640px) {
  .topbar { padding: 10px 14px; gap: 8px; }
  #statusPill { display: none; }
  .topbar-actions { gap: 8px; }
  #newBlogBtn span { display: none; }   /* collapse "Generate blog" to its icon */
  #newBlogBtn { padding: 8px; }
  .notif-dropdown { width: 300px; }
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ── Schedules ───────────────────────────────────────────── */
.sched-card { align-items: flex-start; }
.sched-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.sched-icon svg { width: 22px; height: 22px; fill: currentColor; }
.sched-icon.on { background: var(--ok-soft); color: var(--ok); }
.sched-icon.off { background: var(--panel-2); color: var(--muted-2); }
.sched-title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 5px; flex-wrap: wrap; }
.sched-card .card-meta { margin-top: 4px; }
.sched-instr { margin: 8px 0 0; font-size: 13px; font-style: italic; }
.sched-actions { align-items: center; }

/* Toggle switch */
.autopilot-card { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand-soft) inset; }
.switch { position: relative; display: inline-block; width: 40px; height: 23px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: var(--border-2); border-radius: 999px; cursor: pointer; transition: background-color .15s ease; }
.switch .slider::before { content: ''; position: absolute; height: 17px; width: 17px; left: 3px; top: 3px; background: #fff; border-radius: 50%; box-shadow: var(--shadow); transition: transform .15s ease; }
.switch input:checked + .slider { background: var(--ok); }
.switch input:checked + .slider::before { transform: translateX(17px); }
.switch input:focus-visible + .slider { box-shadow: 0 0 0 3px var(--brand-soft); }
.switch input:disabled + .slider { opacity: .6; cursor: progress; }

/* Advanced schedule fields + run history */
.check-row { display: flex; align-items: center; gap: 8px; margin: 12px 0; font-weight: 600; font-size: 13px; color: var(--text); }
.check-row input { width: auto; margin: 0; display: inline-block; flex: none; }
.sched-runs { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 8px; }
.sched-runs-head { font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.sched-run { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.sched-run:hover { background: var(--panel-2); }
.sched-run-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }

/* ── Topics ──────────────────────────────────────────────── */
.gen-toolbar { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.gen-toolbar label { margin: 0; flex: 1 1 180px; }
.gen-toolbar > .btn { flex: none; }
.topics-filterbar { margin-bottom: 16px; }

.topics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; align-items: stretch; }
.topic-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
  transition: box-shadow .15s ease, border-color .15s ease, transform .08s ease;
}
.topic-card:hover { box-shadow: 0 6px 18px rgba(16,24,40,.10); border-color: var(--border-2); transform: translateY(-1px); }
.topic-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.topic-top .badge::before { display: none; } /* badges here use emojis/labels, not the dot */
.topic-body { flex: 1; }
.topic-title { font-size: 15px; font-weight: 700; line-height: 1.35; margin: 0 0 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.topic-desc { color: var(--muted); font-size: 13px; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.topic-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.topic-date { color: var(--muted-2); font-size: 12px; font-weight: 600; flex: none; }
.topic-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

/* Category / keyword chips */
.badge-cat { background: var(--panel-2); color: var(--text); }
.badge-kw { background: var(--brand-soft); color: var(--brand-d); font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* Topic status badges (distinct colors per status) */
.tb-idea { background: var(--info-soft); color: var(--info); }
.tb-used { background: var(--panel-2); color: var(--muted); }
.tb-drafted { background: #f3e8ff; color: #7c3aed; }
.tb-approval { background: var(--warn-soft); color: var(--warn); }
.tb-approved { background: var(--ok-soft); color: var(--ok); }
.tb-published { background: var(--ok); color: #fff; }
.tb-rejected { background: var(--danger-soft); color: var(--danger); }

@media (max-width: 480px) {
  .topics-grid { grid-template-columns: 1fr; }
  .topic-foot { flex-direction: column; align-items: flex-start; }
  .topic-actions { justify-content: flex-start; }
}

/* ── Dashboard ───────────────────────────────────────────── */
.stat-card.clickable { cursor: pointer; }
.stat-card.clickable:hover { box-shadow: 0 6px 18px rgba(16,24,40,.12); border-color: var(--border-2); transform: translateY(-1px); }
.stat-card.clickable:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.stat-top { align-items: flex-start; }
.trend { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); }
.trend.up::before { content: '▲ '; font-size: 8px; }

/* Recent-blogs filter pills */
.dash-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.dash-pill { background: var(--panel-2); border: 1px solid transparent; color: var(--muted); border-radius: 999px;
  padding: 4px 12px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; transition: background-color .15s ease, color .15s ease; }
.dash-pill:hover { color: var(--text); }
.dash-pill.active { background: var(--brand); color: #fff; }

/* Dashboard list items (recent + review) */
.dash-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border); }
.dash-item:first-child { border-top: none; }
.dash-item .mini-thumb { width: 46px; height: 34px; }
.dash-item-main { flex: 1; min-width: 0; }
.dash-item-title { font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-item-title:hover { color: var(--brand); }
.dash-item-actions { display: flex; gap: 6px; flex: none; }
.review-item { align-items: flex-start; }
.review-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; flex: none; max-width: 230px; }
.dash-excerpt { margin: 6px 0 0; font-size: 12.5px; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Agent activity feed */
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; align-items: center; gap: 11px; padding: 9px 0; border-top: 1px solid var(--border); }
.activity li:first-child { border-top: none; }
.activity .act-ico { font-size: 16px; flex: none; width: 24px; text-align: center; }
.activity .act-main { display: flex; flex-direction: column; min-width: 0; }
.activity .act-text { font-size: 13px; font-weight: 600; }
.activity .act-time { font-size: 11.5px; color: var(--muted); }
.activity li.act-err .act-text { color: var(--danger); }

@media (max-width: 560px) {
  .dash-item { flex-wrap: wrap; }
  .review-actions, .dash-item-actions { max-width: none; width: 100%; justify-content: flex-start; }
  .dash-item-title { white-space: normal; }
}

/* ── AI Usage page ───────────────────────────────────────── */
.usage-breakdowns { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 18px; }
.usage-toolbar { gap: 8px; }
.usage-toolbar input[type="date"] { flex: none; }
.bk-list { display: flex; flex-direction: column; gap: 12px; }
.bk-row { display: flex; flex-direction: column; gap: 5px; }
.bk-top { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.bk-key { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-val { color: var(--muted); flex: none; }
.bk-bar { height: 7px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.bk-bar > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }

/* AI revision applied banner (editor Content tab) */
.revision-banner { border-color: var(--brand); background: var(--brand-soft); }
.revision-banner h3 { color: var(--brand-d); font-size: 14px; }

/* ── Floating task bar ───────────────────────────────────── */
.task-bar {
  position: fixed; right: 18px; bottom: 18px; z-index: 95;
  width: 320px; max-width: calc(100vw - 36px);
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden;
}
.task-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; background: var(--panel-2); border-bottom: 1px solid var(--border); }
.task-title { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.task-head-actions { display: flex; gap: 2px; }
.task-head-actions .icon-btn { width: 26px; height: 26px; font-size: 15px; }
.task-list { max-height: 50vh; overflow-y: auto; }
.task-item { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.task-item:last-child { border-bottom: none; }
.task-item.done .task-label { color: var(--ok); }
.task-item.error .task-label { color: var(--danger); }
.task-row { display: flex; align-items: center; gap: 8px; }
.task-ico { width: 18px; text-align: center; flex: none; }
.task-label { font-weight: 600; font-size: 13px; flex: 1; min-width: 0; }
.task-row .btn { flex: none; }
.task-msg { font-size: 12px; color: var(--muted); margin: 4px 0 0 26px; }
.task-item .prog-bar { margin: 8px 0 0 26px; }
@media (max-width: 480px) { .task-bar { right: 10px; left: 10px; bottom: 10px; width: auto; } }

/* ── Buffer social compose modal ─────────────────────────── */
.modal-lg { max-width: 640px; width: 94%; }
.bf-section { padding: 12px 0; border-top: 1px solid var(--border); }
.bf-section:first-child { border-top: none; }
.bf-section h3 { margin: 0 0 8px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.bf-channels { display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow: auto; }
.bf-chan { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 13px; }
.bf-chan:hover { background: var(--panel-2); }
.bf-chan input { width: auto; }
.bf-ico { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; background: var(--panel-2); font-weight: 700; font-size: 12px; flex: none; }
/* Square icon-only channel tiles */
.bf-tiles { display: flex; flex-wrap: wrap; gap: 12px; }
.bf-tile { position: relative; width: 64px; height: 64px; border: 1.5px solid var(--border-2); border-radius: 14px; background: var(--panel); cursor: pointer; display: grid; place-items: center; padding: 0; transition: border-color .12s, box-shadow .12s, transform .08s; }
.bf-tile:hover { border-color: var(--muted-2); background: var(--panel-2); }
.bf-tile:active { transform: scale(.96); }
.bf-tile svg { width: 30px; height: 30px; fill: var(--muted-2); transition: fill .12s; }
.bf-tile.selected { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.bf-tile:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.bf-tile-check { position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; display: none; place-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.bf-tile.selected .bf-tile-check { display: grid; }
/* Brand colors, always on for recognizability */
.svc-facebook svg { fill: #1877F2; }
.svc-linkedin svg { fill: #0A66C2; }
.svc-instagram svg { fill: #E4405F; }
.svc-twitter svg, .svc-x svg { fill: #0f1419; }
.svc-youtube svg { fill: #FF0000; }
.svc-pinterest svg { fill: #E60023; }
.svc-tiktok svg, .svc-threads svg, .svc-mastodon svg { fill: var(--text); }
.bf-variants { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.bf-var { padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--panel); cursor: pointer; font-size: 12px; font-weight: 600; }
.bf-var.active { background: var(--brand, var(--info)); color: #fff; border-color: transparent; }
.bf-counts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.bf-count { font-size: 11px; color: var(--muted); padding: 2px 8px; border-radius: 999px; background: var(--panel-2); }
.bf-count.bad { background: var(--danger-soft); color: var(--danger); font-weight: 700; }
.bf-modes { display: flex; flex-direction: column; gap: 6px; }
.bf-mode { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.bf-mode input { width: auto; }
.btn-xs { padding: 2px 8px; font-size: 11px; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.check-row input { width: auto; }

/* ── Integrations / API key settings ─────────────────────── */
.intg-group { padding: 12px 0; border-top: 1px solid var(--border); }
.intg-group:first-child { border-top: none; padding-top: 4px; }
.intg-group h3 { font-size: 13px; color: var(--muted); margin: 0 0 8px; text-transform: uppercase; letter-spacing: .04em; }
.intg-field { display: block; margin-bottom: 10px; }
.intg-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.intg-field input { width: 100%; }

/* ── Knowledge base upload ───────────────────────────────── */
.kb-drop { border: 2px dashed var(--border-2); border-radius: 14px; padding: 26px; text-align: center; cursor: pointer; transition: border-color .12s, background .12s; background: var(--panel-2); }
.kb-drop:hover, .kb-drop.drag { border-color: var(--brand); background: var(--brand-soft); }
.kb-drop-inner { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.kb-drop-inner strong { font-size: 14px; }
#kbUploadStatus { margin-top: 12px; }

/* ════════════════════════════════════════════════════════════
   Modern SaaS theme refresh — depth, glass, gradient accents.
   (Layered on top; tokens above already cascade everywhere.)
   ════════════════════════════════════════════════════════════ */

/* Brand mark → gradient chip */
.brand-mark {
  background: var(--brand-grad);
  border-radius: 11px;
  box-shadow: 0 6px 16px -4px rgba(225,27,34,.5);
}

/* Glassy sidebar + topbar */
.sidebar {
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(160%) blur(12px);
}
.topbar {
  background: rgba(255,255,255,.72);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(232,235,241,.9);
}

/* Navigation — smoother, softer active pill */
.nav-item { transition: background-color .15s ease, color .15s ease; }
.nav-item.active {
  background: var(--brand-soft);
  color: var(--brand-d);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(225,27,34,.10);
}
.nav-item.active svg { fill: var(--brand); }

/* Buttons — gradient primary, tactile feedback */
.btn { border-radius: 10px; transition: background-color .14s ease, border-color .14s ease, box-shadow .15s ease, transform .08s ease, filter .14s ease; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-primary {
  background: var(--brand-grad);
  border-color: transparent;
  box-shadow: 0 4px 14px -4px rgba(225,27,34,.5);
}
.btn-primary:hover { background: var(--brand-grad); border-color: transparent; box-shadow: 0 7px 20px -5px rgba(225,27,34,.62); transform: translateY(-1px); filter: brightness(1.04); }
.btn:not(.btn-primary):not(.btn-danger-solid):hover { border-color: var(--border-2); box-shadow: var(--shadow-sm); }
.btn-danger-solid { background: var(--danger); box-shadow: 0 4px 14px -4px rgba(217,45,54,.5); }

/* Inputs — modern focus ring */
input, select, textarea { border-radius: 10px; transition: border-color .15s ease, box-shadow .15s ease; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: var(--ring); outline: none; }

/* Cards — real depth + hover lift */
.stat-card, .dash-card, .panel-card, .blog-card, .topic-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .14s ease, box-shadow .18s ease, border-color .15s ease;
}
.stat-card:hover, .blog-card:hover, .topic-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-2);
}
.section-card { border-radius: 14px; }

/* Stat icons get a soft gradient wash */
.stat-card .stat-ico { box-shadow: inset 0 0 0 1px rgba(255,255,255,.6); }
.stat-card .num { font-weight: 800; letter-spacing: -.03em; }

/* Pills & badges — crisper */
.pill, .badge { letter-spacing: .01em; }
.pill { box-shadow: inset 0 0 0 1px rgba(16,24,40,.04); }

/* Modals & drawers — deeper, softer overlay */
.modal, .drawer { background: rgba(16,24,40,.5); backdrop-filter: blur(2px); }
.modal-inner, .drawer-inner { border-radius: 18px; box-shadow: var(--shadow-lg); }
.drawer-inner { border-radius: 18px 0 0 18px; }

/* Selection + focus polish */
::selection { background: var(--brand-soft); }
a { text-decoration: none; }
a:hover { text-decoration: underline; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .btn, .nav-item, .stat-card, .blog-card, .topic-card, input, select, textarea { transition: none !important; }
  .stat-card:hover, .blog-card:hover, .topic-card:hover, .btn:hover { transform: none !important; }
}
