/* Social Pilot — whitelabel theme. All colors flow from the CSS variables set by
   the active theme (see /api/theme). Neutral, minimalist, a few subtle FX. */

:root {
  --sp-bg: #0f1115;
  --sp-surface: #171a21;
  --sp-border: #262a33;
  --sp-fg: #e6e8ee;
  --sp-muted: #8a8f9c;
  --sp-accent: #5b8cff;
  --sp-accent-2: #8a5bff;
  --sp-success: #3fbf7f;
  --sp-warning: #e0a33c;
  --sp-danger: #e05b5b;
  --sp-radius: 10px;
  --sp-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sp-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

/* The `hidden` attribute must always win over any `display:` rule below
   (e.g. `.modal-overlay { display:flex }` was overriding `hidden`, so the
   media modal showed on load and its close button appeared dead). */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--sp-bg);
  color: var(--sp-fg);
  font-family: var(--sp-font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body::before {
  /* subtle top hairline glow — the only "futuristic" flourish */
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--sp-accent) 30%, var(--sp-accent-2) 70%, transparent);
  opacity: 0.5;
  pointer-events: none;
}

a { color: var(--sp-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- auth ---------- */

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius);
  padding: 32px 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.auth-brand { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.auth-brand span { color: var(--sp-accent); }
.auth-sub { color: var(--sp-muted); font-size: 13px; margin: 2px 0 24px; }

label { display: block; font-size: 12.5px; color: var(--sp-muted); margin: 16px 0 6px; }
label:first-of-type { margin-top: 0; }

input, select, textarea {
  width: 100%;
  background: var(--sp-bg);
  border: 1px solid var(--sp-border);
  color: var(--sp-fg);
  border-radius: 7px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--sp-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sp-accent) 18%, transparent);
}

.form-error { color: var(--sp-danger); font-size: 13px; margin-top: 12px; min-height: 18px; }
.hint { color: var(--sp-muted); font-size: 13px; margin: 4px 0 14px; }

/* ---------- buttons ---------- */

button { font-family: inherit; cursor: pointer; border: none; border-radius: 7px; font-size: 14px; }
.btn-primary {
  width: 100%;
  margin-top: 20px;
  padding: 11px 14px;
  background: linear-gradient(135deg, var(--sp-accent), var(--sp-accent-2));
  color: #fff;
  font-weight: 600;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.55; cursor: default; }

.btn-ghost {
  width: 100%;
  margin-top: 8px;
  padding: 9px 12px;
  background: transparent;
  border: 1px solid var(--sp-border);
  color: var(--sp-fg);
}
.btn-ghost:hover { border-color: var(--sp-accent); }

.btn-sm {
  padding: 6px 10px;
  font-size: 12.5px;
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  color: var(--sp-fg);
  border-radius: 6px;
}
.btn-sm:hover { border-color: var(--sp-accent); }
.btn-danger { border-color: color-mix(in srgb, var(--sp-danger) 45%, transparent); color: var(--sp-danger); }
.btn-danger:hover { border-color: var(--sp-danger); }
.btn-back { border-color: var(--sp-border); color: var(--sp-muted); background: transparent; }
.btn-back:hover { border-color: var(--sp-muted); color: var(--sp-fg); }
.btn-accent {
  padding: 6px 14px;
  background: linear-gradient(135deg, var(--sp-accent), var(--sp-accent-2));
  color: #fff; font-weight: 600; border-radius: 6px; font-size: 12.5px;
}
.btn-accent:hover { filter: brightness(1.08); }

/* ---------- app shell ---------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 168px;
  flex-shrink: 0;
  border-right: 1px solid var(--sp-border);
  background: var(--sp-surface);
  display: flex;
  flex-direction: column;
  padding: 16px 8px;
}

.brand { font-size: 15px; font-weight: 650; padding: 0 10px 16px; letter-spacing: -0.02em; }
.brand span { color: var(--sp-accent); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--sp-muted);
  cursor: pointer;
  border: 1px solid transparent;
  font-size: 12.5px;
  user-select: none;
}
.nav-item:hover { color: var(--sp-fg); }
.nav-item.active {
  color: var(--sp-fg);
  background: var(--sp-bg);
  border-color: var(--sp-border);
}
.nav-item.active .dot { background: var(--sp-accent); box-shadow: 0 0 8px var(--sp-accent); }
.nav-item .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sp-border); }

.sidebar-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--sp-border); }
.sidebar-user { font-size: 13px; font-weight: 600; }
.sidebar-role { font-size: 11.5px; color: var(--sp-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.logout { margin-top: 10px; width: 100%; }
.lang-switch { display: inline-flex; border: 1px solid var(--sp-border); border-radius: 8px; overflow: hidden; margin-bottom: 12px; }
.lang-switch .seg-btn { flex: 1; }
.auth-lang { margin-top: 16px; }
.brand-select { width: 100%; margin-bottom: 10px; padding: 5px 8px; background: var(--sp-bg); color: var(--sp-fg); border: 1px solid var(--sp-border); border-radius: 6px; font-size: 12px; }

.main { flex: 1; padding: 28px 32px; overflow-y: auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.page-head { margin-bottom: 24px; }
.page-title { font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }
.page-desc { color: var(--sp-muted); font-size: 13.5px; margin-top: 2px; }

/* ---------- cards / grids ---------- */

.card {
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius);
  padding: 20px;
  margin-bottom: 16px;
}
.card-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--sp-muted); margin-bottom: 14px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.empty-state {
  border: 1px dashed var(--sp-border);
  border-radius: var(--sp-radius);
  padding: 48px 24px;
  text-align: center;
  color: var(--sp-muted);
}
.empty-state .big { font-size: 15px; color: var(--sp-fg); font-weight: 600; margin-bottom: 6px; }
.badge {
  display: inline-block;
  font-size: 10.5px;
  font-family: var(--sp-mono);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--sp-border);
  color: var(--sp-muted);
  letter-spacing: 0.03em;
}
.badge-concept_validated { color: var(--sp-muted); border-color: var(--sp-border); }
.badge-media_ready { color: var(--sp-accent); border-color: color-mix(in srgb, var(--sp-accent) 45%, transparent); background: color-mix(in srgb, var(--sp-accent) 10%, transparent); }
.badge-compliance_ok { color: var(--sp-success); border-color: color-mix(in srgb, var(--sp-success) 45%, transparent); background: color-mix(in srgb, var(--sp-success) 12%, transparent); }
.badge-approved { color: var(--sp-accent-2); border-color: color-mix(in srgb, var(--sp-accent-2) 45%, transparent); background: color-mix(in srgb, var(--sp-accent-2) 12%, transparent); }
.badge-scheduled, .badge-publishing { color: var(--sp-warning); border-color: color-mix(in srgb, var(--sp-warning) 45%, transparent); background: color-mix(in srgb, var(--sp-warning) 14%, transparent); }
.badge-published { color: var(--sp-success); border-color: color-mix(in srgb, var(--sp-success) 50%, transparent); background: color-mix(in srgb, var(--sp-success) 16%, transparent); font-weight: 650; }
.badge-failed { color: var(--sp-danger); border-color: color-mix(in srgb, var(--sp-danger) 45%, transparent); background: color-mix(in srgb, var(--sp-danger) 14%, transparent); }

/* performance */
.perf-kpis { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.kpi {
  flex: 1; min-width: 130px; background: var(--sp-surface);
  border: 1px solid var(--sp-border); border-radius: 10px; padding: 14px 16px;
}
.kpi-val { font-size: 22px; font-weight: 650; }
.kpi-label { font-size: 12px; color: var(--sp-muted); margin-top: 2px; }
.trunc { max-width: 360px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.insight-block { margin-bottom: 14px; }
.insight-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 13px; }
.insight-row .trunc { flex: 1; max-width: none; }

/* best-time heatmap */
.bt-legend { display: flex; gap: 14px; font-size: 12px; color: var(--sp-muted); margin-bottom: 8px; flex-wrap: wrap; align-items: center; }
.bt-legend span { display: inline-flex; align-items: center; }
.bt-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }
.bt-grid { display: grid; grid-template-columns: 34px repeat(24, 1fr); gap: 2px; }
.bt-hlabel, .bt-dlabel { font-size: 9px; color: var(--sp-muted); display: flex; align-items: center; justify-content: center; }
.bt-cell { aspect-ratio: 1; border-radius: 3px; min-height: 12px; }
.bt-good { background: color-mix(in srgb, var(--sp-success) 65%, transparent); }
.bt-neutral { background: color-mix(in srgb, var(--sp-muted) 28%, transparent); }
.bt-bad { background: color-mix(in srgb, var(--sp-danger) 55%, transparent); }
.bt-empty { background: var(--sp-bg); border: 1px solid var(--sp-border); }

/* community manager */
.cm-card { border: 1px solid var(--sp-border); border-left: 3px solid var(--sp-muted); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; background: var(--sp-surface); }
.cm-green { border-left-color: var(--sp-success); }
.cm-orange { border-left-color: var(--sp-warning); }
.cm-red { border-left-color: var(--sp-danger); }
.cm-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.cm-text { font-size: 14px; margin-bottom: 8px; white-space: pre-wrap; }
.cm-actions { display: flex; align-items: center; gap: 8px; }
.cm-reply { flex: 1; resize: vertical; min-height: 40px; background: var(--sp-bg); border: 1px solid var(--sp-border); color: var(--sp-fg); border-radius: 6px; padding: 8px 10px; font: inherit; font-size: 13px; }
.cm-reply:focus { outline: none; border-color: var(--sp-accent); }
.badge-cm-green { color: var(--sp-success); border-color: color-mix(in srgb, var(--sp-success) 45%, transparent); background: color-mix(in srgb, var(--sp-success) 12%, transparent); }
.badge-cm-orange { color: var(--sp-warning); border-color: color-mix(in srgb, var(--sp-warning) 45%, transparent); background: color-mix(in srgb, var(--sp-warning) 14%, transparent); }
.badge-cm-red { color: var(--sp-danger); border-color: color-mix(in srgb, var(--sp-danger) 45%, transparent); background: color-mix(in srgb, var(--sp-danger) 14%, transparent); }
.cm-check { width: 15px; height: 15px; accent-color: var(--sp-accent); flex: none; }
.cm-batch-bar { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border: 1px solid var(--sp-border); border-radius: 8px; margin-bottom: 10px; background: var(--sp-bg); font-size: 13px; }
.cm-batch-bar .spacer { flex: 1; }
.cm-batch-bar label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

/* ---------- tables ---------- */

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--sp-muted); padding: 8px 10px; border-bottom: 1px solid var(--sp-border); }
td { padding: 10px; border-bottom: 1px solid var(--sp-border); }
tr:last-child td { border-bottom: none; }
.mono { font-family: var(--sp-mono); font-size: 12.5px; }

/* ---------- theme swatches ---------- */

.swatches { display: flex; gap: 12px; flex-wrap: wrap; }
.swatch {
  width: 130px;
  padding: 12px;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius);
  cursor: pointer;
  text-align: left;
  background: var(--sp-surface);
}
.swatch.active { border-color: var(--sp-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sp-accent) 18%, transparent); }
.swatch-name { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.swatch-row { display: flex; gap: 4px; margin-bottom: 4px; }
.swatch-row span { width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(0,0,0,0.2); }

/* ---------- 2FA ---------- */

.qr-box { text-align: center; margin: 8px 0 16px; }
.qr-box svg, .qr-box img { max-width: 160px; height: auto; }
.secret { font-family: var(--sp-mono); font-size: 12px; color: var(--sp-muted); word-break: break-all; background: var(--sp-bg); padding: 8px; border-radius: 6px; border: 1px solid var(--sp-border); }

.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.status-pill .led { width: 7px; height: 7px; border-radius: 50%; }
.status-pill.ok .led { background: var(--sp-success); }
.status-pill.off .led { background: var(--sp-border); }

.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input { width: auto; flex: 1; min-width: 160px; }
.muted { color: var(--sp-muted); font-size: 13px; }
.spacer { height: 12px; }

/* ---------- autocomplete ---------- */

.ac { position: relative; }
.ac-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  max-height: 260px;
  overflow-y: auto;
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: 7px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
.ac-item {
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--sp-border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover { background: var(--sp-bg); }
.ac-item .muted { font-size: 12px; }

/* ---------- generation tab ---------- */

.gen-layout { display: flex; gap: 16px; height: calc(100vh - 100px); }

.gen-sessions {
  width: 165px; flex-shrink: 0; overflow-y: auto; overflow-x: hidden;
  border-right: 1px solid var(--sp-border); padding-right: 10px;
}
.gen-sessions.collapsed { width: 44px; padding-right: 6px; }
.gen-sessions.collapsed #session-list,
.gen-sessions.collapsed .session-item,
.gen-sessions.collapsed #new-session-btn { display: none; }
.gen-sessions.collapsed .gen-sessions-head { justify-content: center; }
.gen-sessions-head { display: flex; gap: 6px; margin-bottom: 10px; }
.gen-sessions-head .btn-sm { padding: 6px 8px; }
.session-item {
  padding: 8px 10px; border-radius: 7px; cursor: pointer;
  color: var(--sp-muted); font-size: 13px; border: 1px solid transparent;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.session-item:hover { color: var(--sp-fg); }
.session-item.active { background: var(--sp-surface); border-color: var(--sp-border); color: var(--sp-fg); }

.gen-chat { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 4px 8px; }

.gen-panel { width: 250px; flex-shrink: 0; overflow-y: auto; }

.msg { margin-bottom: 12px; max-width: 92%; }
.msg.user { margin-left: auto; }
.msg .bubble { padding: 10px 14px; border-radius: 12px; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.msg.user .bubble { background: linear-gradient(135deg, var(--sp-accent), var(--sp-accent-2)); color: #fff; border-bottom-right-radius: 3px; }
.msg.assistant .bubble { background: var(--sp-surface); border: 1px solid var(--sp-border); border-bottom-left-radius: 3px; }

.chat-input-row { display: flex; gap: 8px; padding-top: 12px; border-top: 1px solid var(--sp-border); align-items: center; }
.chat-input-row input { flex: 1; }
.chat-input-row textarea {
  flex: 1; resize: vertical; min-height: 46px; max-height: 220px;
  background: var(--sp-bg); border: 1px solid var(--sp-border); color: var(--sp-fg);
  border-radius: 8px; padding: 10px 12px; font: inherit; font-size: 14px; line-height: 1.45;
}
.chat-input-row textarea:focus { outline: none; border-color: var(--sp-accent); }
.chat-input-row select { width: auto; }
.chat-input-row .btn-primary { width: auto; margin-top: 0; padding: 10px 18px; }

.proposal { border: 1px solid var(--sp-border); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; background: var(--sp-surface); }
.proposal.validated { border-color: var(--sp-success); }
.proposal-head { margin-bottom: 8px; }
.proposal-num { font-weight: 650; font-size: 14px; }
.proposal-caption { white-space: pre-wrap; margin-bottom: 8px; }
.hashtags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.hashtags span { font-family: var(--sp-mono); font-size: 11.5px; color: var(--sp-accent); }
.prop-meta { font-size: 12.5px; color: var(--sp-muted); margin-bottom: 4px; }
.prop-meta strong { color: var(--sp-fg); }
.media-prompt {
  font-size: 12.5px; color: var(--sp-muted); background: var(--sp-bg);
  border: 1px solid var(--sp-border); border-radius: 6px; padding: 8px 10px; margin-bottom: 10px;
}
.prop-actions { display: flex; gap: 8px; }

.thumb { max-width: 120px; max-height: 120px; border-radius: 6px; border: 1px solid var(--sp-border); }
.thumb-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.pill {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--sp-border); color: var(--sp-muted);
}
.loading { color: var(--sp-muted); font-size: 13px; padding: 8px; }
.error-msg {
  margin: 8px 0; padding: 10px 12px; border-radius: 8px; font-size: 13px;
  color: var(--sp-danger); background: color-mix(in srgb, var(--sp-danger) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--sp-danger) 40%, transparent);
}
.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid var(--sp-border); border-top-color: var(--sp-accent);
  border-radius: 50%; animation: sp-spin 0.8s linear infinite;
  vertical-align: -2px; margin-right: 6px;
}
@keyframes sp-spin { to { transform: rotate(360deg); } }
.media-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-top: 8px; }
.media-cell { position: relative; border-radius: 6px; overflow: hidden; border: 1px solid var(--sp-border); cursor: pointer; }
.media-cell img { width: 100%; height: 58px; object-fit: cover; display: block; }
.media-cell.attached { border-color: var(--sp-accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--sp-accent) 35%, transparent); }

.pending-item {
  position: relative; display: inline-flex; flex-direction: column; align-items: center;
  margin-right: 6px; border: 1px solid var(--sp-border); border-radius: 6px; padding: 3px;
}
.pending-item img { width: 54px; height: 54px; object-fit: cover; border-radius: 4px; }
.pending-name { font-size: 10px; color: var(--sp-muted); max-width: 60px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pending-x {
  position: absolute; top: -7px; right: -7px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--sp-danger); color: #fff; font-size: 12px;
  line-height: 1; padding: 0; border: none; cursor: pointer;
}

.mp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.btn-mini { padding: 2px 7px; font-size: 11px; border-radius: 5px; background: var(--sp-bg); border: 1px solid var(--sp-border); color: var(--sp-muted); cursor: pointer; }
.btn-mini:hover { border-color: var(--sp-accent); color: var(--sp-fg); }

/* session delete */
.session-item { position: relative; }
.session-del {
  position: absolute; top: 4px; right: 4px; width: 16px; height: 16px;
  border-radius: 50%; background: transparent; color: var(--sp-danger);
  border: none; cursor: pointer; font-size: 12px; line-height: 1; padding: 0;
  display: none;
}
.session-item:hover .session-del { display: block; }

/* options panel */
.field-label { display: block; font-size: 11px; color: var(--sp-muted); margin: 10px 0 4px; }
.panel-subtitle {
  font-size: 11px; font-weight: 650; color: var(--sp-muted);
  text-transform: uppercase; letter-spacing: 0.4px; margin: 2px 0 6px;
}
.divider { height: 1px; background: var(--sp-border); margin: 12px 0; }
#branding-consignes select { width: 100%; margin: 2px 0 8px; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 6px 0; cursor: pointer; }
.chk input { width: auto; }

/* network picker */
.net-picker { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.net-card {
  display: flex; align-items: center; gap: 8px; padding: 12px 16px;
  border: 1px solid var(--sp-border); border-radius: 10px; background: var(--sp-bg);
  color: var(--sp-fg); cursor: pointer; font-size: 14px; font-weight: 600; flex: 1;
}
.net-card svg { width: 22px; height: 22px; }
.net-card:hover { border-color: var(--sp-muted); }
.net-card.selected {
  border-color: var(--sp-accent);
  background: color-mix(in srgb, var(--sp-accent) 14%, transparent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--sp-accent) 30%, transparent);
}

/* modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  width: 100%; max-width: 720px; max-height: 80vh; overflow-y: auto;
  background: var(--sp-bg); border: 1px solid var(--sp-border);
  border-radius: 12px; padding: 20px;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-sm { max-width: 480px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
#adjust-text {
  width: 100%; resize: vertical; min-height: 140px; margin-top: 12px;
  background: var(--sp-bg); border: 1px solid var(--sp-border); color: var(--sp-fg);
  border-radius: 8px; padding: 12px; font: inherit; font-size: 14px; line-height: 1.5;
}
#adjust-text:focus { outline: none; border-color: var(--sp-accent); }
.media-modal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.media-modal-cell { position: relative; border: 1px solid var(--sp-border); border-radius: 8px; overflow: hidden; }
.media-modal-cell img { width: 100%; height: 90px; object-fit: cover; display: block; }
.media-modal-cell .name { font-size: 10px; color: var(--sp-muted); padding: 3px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-modal-cell.attached { border-color: var(--sp-accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--sp-accent) 35%, transparent); }
.mm-actions { display: flex; gap: 4px; padding: 4px 6px; }
.mm-actions button { flex: 1; font-size: 10px; padding: 3px 4px; }

/* post production pipeline */
.post-pipeline { margin-top: 4px; }
.pp-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.net-select { display: flex; gap: 14px; margin-bottom: 4px; }
.thumb-lg { width: 170px; height: 170px; object-fit: cover; border-radius: 8px; border: 1px solid var(--sp-border); }
.schedule-input { background: var(--sp-bg); border: 1px solid var(--sp-border); color: var(--sp-fg); border-radius: 6px; padding: 6px 8px; font-size: 13px; }
.compl { padding: 8px 10px; border-radius: 7px; font-size: 13px; margin-top: 8px; border: 1px solid; }
.compl-pass { color: var(--sp-success); border-color: color-mix(in srgb, var(--sp-success) 40%, transparent); background: color-mix(in srgb, var(--sp-success) 10%, transparent); }
.compl-risk { color: var(--sp-warning); border-color: color-mix(in srgb, var(--sp-warning) 40%, transparent); background: color-mix(in srgb, var(--sp-warning) 10%, transparent); }
.compl-fail { color: var(--sp-danger); border-color: color-mix(in srgb, var(--sp-danger) 40%, transparent); background: color-mix(in srgb, var(--sp-danger) 10%, transparent); }
.pp-links { margin-top: 10px; }
.pub-link { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 12.5px; }
.pub-link a { color: var(--sp-accent); word-break: break-all; }

.post-caption {
  white-space: pre-wrap; margin-top: 10px; font-size: 14px; line-height: 1.5;
  background: var(--sp-bg); border: 1px solid var(--sp-border); border-radius: 8px;
  padding: 10px 12px; max-height: 220px; overflow-y: auto;
}
.caption-edit { margin-top: 10px; }
.caption-edit textarea {
  width: 100%; resize: vertical; min-height: 110px; font: inherit; font-size: 14px; line-height: 1.5;
  background: var(--sp-bg); border: 1px solid var(--sp-border); color: var(--sp-fg);
  border-radius: 8px; padding: 10px 12px; white-space: pre-wrap;
}
.caption-edit textarea:focus { outline: none; border-color: var(--sp-accent); }

.pp-previews { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
.pp-previews-wrap { margin-top: 12px; }
.pp-previews-head { display: flex; align-items: center; justify-content: space-between; }
.seg { display: inline-flex; border: 1px solid var(--sp-border); border-radius: 8px; overflow: hidden; }
.seg-btn { padding: 4px 12px; font-size: 12px; background: var(--sp-bg); color: var(--sp-muted); border: none; border-radius: 0; }
.seg-btn + .seg-btn { border-left: 1px solid var(--sp-border); }
.seg-btn.active { background: var(--sp-surface); color: var(--sp-fg); font-weight: 600; }

/* editorial calendar (month grid) */
.ec-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.ec-nav-title { font-size: 15px; font-weight: 600; min-width: 170px; text-align: center; }
.ec-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 4px; }
.ec-dow span { text-align: center; font-size: 11px; color: var(--sp-muted); text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 0; }
.ec-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.ec-cell { min-height: 92px; border: 1px solid var(--sp-border); border-radius: 8px; padding: 5px; background: var(--sp-surface); }
.ec-cell.outside { opacity: 0.35; }
.ec-cell.today { border-color: var(--sp-accent); }
.ec-cell-num { font-size: 12px; color: var(--sp-muted); margin-bottom: 4px; }
.ec-cell.today .ec-cell-num { color: var(--sp-accent); font-weight: 700; }
.ec-chips { display: flex; flex-direction: column; gap: 2px; }
.ec-chip { display: flex; align-items: center; gap: 4px; font-size: 10.5px; padding: 2px 5px; border-radius: 5px; cursor: pointer; white-space: nowrap; overflow: hidden; }
.ec-chip.scheduled { background: color-mix(in srgb, var(--sp-accent) 18%, transparent); color: var(--sp-accent); }
.ec-chip.published { background: color-mix(in srgb, var(--sp-success) 18%, transparent); color: var(--sp-success); }
.ec-chip .ec-thumb { width: 14px; height: 14px; border-radius: 3px; object-fit: cover; flex: none; }
.ec-chip .ec-time { font-weight: 600; flex: none; }
.ec-chip .ec-platform { overflow: hidden; text-overflow: ellipsis; }
.brand-row { display: flex; align-items: center; gap: 6px; padding: 4px 0; }
.pp-previews.desktop .net-preview.ig { width: 420px; }
.pp-previews.desktop .net-preview.tt { width: 300px; }
.net-preview {
  width: 230px; border: 1px solid var(--sp-border); border-radius: 12px;
  overflow: hidden; background: var(--sp-surface); flex-shrink: 0;
}
.net-preview img { width: 100%; display: block; }
/* Instagram feed card */
.ig-top { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 13px; }
.ig-avatar { width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, var(--sp-accent), var(--sp-accent-2)); }
.ig-name { font-weight: 600; flex: 1; }
.ig-dots { color: var(--sp-muted); }
.ig-media { aspect-ratio: 1/1; background: #000; }
.ig-media img { height: 100%; object-fit: cover; }
.ig-icons { display: flex; gap: 14px; padding: 8px 10px 0; font-size: 15px; }
.ig-caption { font-size: 13px; padding: 6px 10px; white-space: pre-wrap; }
.ig-tags { font-size: 12px; color: var(--sp-accent); padding: 0 10px 10px; }
/* TikTok vertical card */
.tt { position: relative; width: 180px; }
.tt-media { aspect-ratio: 9/16; background: #000; }
.tt-media img { height: 100%; object-fit: cover; }
.tt-rail { position: absolute; right: 8px; bottom: 70px; display: flex; flex-direction: column; gap: 12px; font-size: 16px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.6); }
.tt-caption { font-size: 12.5px; padding: 8px 10px 2px; white-space: pre-wrap; }
.tt-tags { font-size: 11.5px; color: var(--sp-accent); padding: 0 10px 10px; }
/* LinkedIn feed card */
.pp-previews.desktop .net-preview.li { width: 360px; }
.li-top { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 13px; }
.li-avatar { width: 26px; height: 26px; border-radius: 4px; background: #0a66c2; flex: none; }
.li-name { font-weight: 600; }
.li-meta { font-size: 11px; color: var(--sp-muted); }
.li-text { font-size: 13px; padding: 4px 10px 8px; white-space: pre-wrap; }
.li-media img { width: 100%; object-fit: cover; max-height: 200px; }
.li-actions { display: flex; gap: 16px; padding: 8px 10px; border-top: 1px solid var(--sp-border); font-size: 13px; color: var(--sp-muted); }
/* X (Twitter) card */
.pp-previews.desktop .net-preview.x { width: 360px; }
.x-top { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 13px; }
.x-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--sp-accent); flex: none; }
.x-name { font-weight: 600; }
.x-handle { font-size: 11px; color: var(--sp-muted); }
.x-text { font-size: 13px; padding: 4px 10px 8px; white-space: pre-wrap; }
.x-media img { width: 100%; object-fit: cover; max-height: 220px; border-radius: 8px; }
.x-actions { display: flex; gap: 20px; padding: 8px 10px; border-top: 1px solid var(--sp-border); font-size: 13px; color: var(--sp-muted); }
/* Facebook feed card */
.pp-previews.desktop .net-preview.fb { width: 360px; }
.fb-top { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 13px; }
.fb-avatar { width: 26px; height: 26px; border-radius: 50%; background: #1877f2; flex: none; }
.fb-name { font-weight: 600; }
.fb-meta { font-size: 11px; color: var(--sp-muted); }
.fb-text { font-size: 13px; padding: 4px 10px 8px; white-space: pre-wrap; }
.fb-media img { width: 100%; object-fit: cover; max-height: 220px; }
.fb-actions { display: flex; gap: 20px; padding: 8px 10px; border-top: 1px solid var(--sp-border); font-size: 13px; color: var(--sp-muted); }
/* YouTube card */
.pp-previews.desktop .net-preview.yt { width: 320px; }
.yt-thumb { position: relative; }
.yt-thumb img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.yt-play { position: absolute; inset: 0; margin: auto; width: 40px; height: 28px; background: rgba(0,0,0,.75); color: #fff; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 12px; }
.yt-title { font-size: 13px; font-weight: 600; padding: 8px 10px 2px; }
.yt-meta { font-size: 11px; color: var(--sp-muted); padding: 0 10px 10px; }
/* Pinterest card */
.pp-previews.desktop .net-preview.pi { width: 240px; }
.pi-media img { width: 100%; object-fit: cover; border-radius: 12px; }
.pi-title { font-size: 12px; padding: 6px 4px; }
/* Threads card */
.pp-previews.desktop .net-preview.th { width: 340px; }
.th-top { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 13px; }
.th-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--sp-accent); flex: none; }
.th-name { font-weight: 600; }
.th-text { font-size: 13px; padding: 4px 10px 8px; white-space: pre-wrap; }
.th-media img { width: 100%; object-fit: cover; max-height: 200px; border-radius: 8px; }
.th-actions { display: flex; gap: 20px; padding: 8px 10px; border-top: 1px solid var(--sp-border); font-size: 13px; color: var(--sp-muted); }
/* Google Business card */
.pp-previews.desktop .net-preview.gb { width: 340px; }
.gb-top { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 13px; }
.gb-avatar { width: 26px; height: 26px; border-radius: 50%; background: #4285f4; flex: none; }
.gb-name { font-weight: 600; }
.gb-meta { font-size: 11px; color: var(--sp-muted); }
.gb-text { font-size: 13px; padding: 4px 10px 8px; white-space: pre-wrap; }
.gb-media img { width: 100%; object-fit: cover; max-height: 200px; }
.gb-cta { display: flex; gap: 12px; padding: 8px 10px; border-top: 1px solid var(--sp-border); font-size: 12px; color: var(--sp-accent); }
/* Bluesky card */
.pp-previews.desktop .net-preview.bs { width: 340px; }
.bs-top { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 13px; }
.bs-avatar { width: 26px; height: 26px; border-radius: 50%; background: #1185fe; flex: none; }
.bs-name { font-weight: 600; }
.bs-handle { font-size: 11px; color: var(--sp-muted); }
.bs-text { font-size: 13px; padding: 4px 10px 8px; white-space: pre-wrap; }
.bs-media img { width: 100%; object-fit: cover; max-height: 200px; border-radius: 8px; }
.bs-actions { display: flex; gap: 20px; padding: 8px 10px; border-top: 1px solid var(--sp-border); font-size: 13px; color: var(--sp-muted); }

/* calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-title { font-weight: 600; font-size: 14px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-dow { margin-bottom: 4px; color: var(--sp-muted); font-size: 11px; text-align: center; }
.cal-cell {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 13px; border-radius: 7px; cursor: pointer; color: var(--sp-fg);
  border: 1px solid transparent;
}
.cal-cell:hover { background: var(--sp-surface); border-color: var(--sp-border); }
.cal-cell.empty { cursor: default; }
.cal-cell.past { color: var(--sp-muted); opacity: 0.4; cursor: not-allowed; }
.cal-cell.selected { background: var(--sp-accent); color: #fff; }
.cal-time { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.cal-time label { font-size: 13px; color: var(--sp-muted); }
.cal-time input { background: var(--sp-bg); border: 1px solid var(--sp-border); color: var(--sp-fg); border-radius: 6px; padding: 6px 8px; font-size: 14px; }
