/* ── Self-hosted webfont ─────────────────────────────────────────────
   Inter (OFL-licensed), 4 static weights, downloaded once rather than
   loaded from Google's CDN — matches the rest of this app's zero
   third-party-request policy. Falls back to the system-font stack
   below if a file ever fails to load. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/web/Inter-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/web/Inter-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/web/Inter-SemiBold.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/web/Inter-Bold.woff2') format('woff2');
}

/* ── Design tokens ──────────────────────────────────────────────────
   Single source of truth for color/spacing/radius/shadow, replacing
   what used to be ~15 ad hoc grays, 3 competing blues, and 4 shadow
   opacities scattered across this file. Every rule below should
   reference these instead of a literal hex/px value. */
:root {
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --color-brand: #5B4FE8;
  --color-brand-hover: #4438C7;
  --color-brand-tint: #EFECFE;
  --color-brand-light: #C9C2FA;

  --color-accent: #FF6B57;
  --color-accent-hover: #E5503C;

  --gray-900: #171717;
  --gray-700: #3A3A3A;
  --gray-600: #5B5B5B;
  --gray-500: #7A7A7A;
  --gray-400: #9B9B9B;
  --gray-200: #E4E2DC;
  --gray-100: #F5F4F0;
  --gray-50:  #F3F2EF;

  --color-success-bg: #E6F4EA;
  --color-success-text: #1E7E34;
  --color-warning-bg: #FFF3E0;
  --color-warning-text: #E65100;
  --color-danger-bg: #FDECEA;
  --color-danger-text: #C0392B;
  --color-danger-border: #F3C6C1;
  --color-info-bg: var(--color-brand-tint);
  --color-info-text: var(--color-brand);
  --color-neutral-bg: #F1F0EC;
  --color-neutral-text: var(--gray-600);
  --color-purple-bg: #F3E8FF;
  --color-purple-text: #7B1FA2;

  /* Card/sidebar/input backgrounds — kept as its own token (rather than
     literal white) so [data-theme="dark"] below can redefine it in one
     place instead of hunting down every hardcoded "white"/"#fff". */
  --color-surface: #FFFFFF;
  --color-surface-alt: var(--gray-100);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 48px;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 14px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 4px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.14);

  --focus-ring: 0 0 0 3px rgba(91,79,232,0.25);
}

/* ── Dark theme ──────────────────────────────────────────────────────
   Every rule in this file reads colors from the tokens above, so a
   dark theme is just redefining those same custom properties — no
   rule below this point needs to know which theme is active.
   includes/layout_top.php sets data-theme="dark"/"light" on <html>
   from the user's saved preference (api/set_theme.php); when unset
   (no preference saved yet) the prefers-color-scheme block mirrors
   the same values so a first visit still respects the OS setting. */
:root[data-theme="dark"] {
  --color-brand: #8B7FFF;
  --color-brand-hover: #A79BFF;
  --color-brand-tint: rgba(91,79,232,0.18);
  --color-brand-light: #B3A8FA;

  --color-accent: #FF8A78;
  --color-accent-hover: #FFA697;

  --gray-900: #E8EAF0;
  --gray-700: #C7CAD3;
  --gray-600: #9CA0AC;
  --gray-500: #6B7280;
  --gray-400: #565B66;
  --gray-200: #2A2D3A;
  --gray-100: #20232E;
  --gray-50:  #0F1117;

  --color-success-bg: rgba(16,185,129,0.15);
  --color-success-text: #34D399;
  --color-warning-bg: rgba(245,158,11,0.15);
  --color-warning-text: #FBBF24;
  --color-danger-bg: rgba(239,68,68,0.15);
  --color-danger-text: #F87171;
  --color-danger-border: rgba(239,68,68,0.35);
  --color-info-bg: var(--color-brand-tint);
  --color-info-text: #A79BFF;
  --color-neutral-bg: rgba(255,255,255,0.06);
  --color-neutral-text: var(--gray-600);
  --color-purple-bg: rgba(168,85,247,0.15);
  --color-purple-text: #C084FC;

  --color-surface: #1A1D27;
  --color-surface-alt: var(--gray-100);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-brand: #8B7FFF;
    --color-brand-hover: #A79BFF;
    --color-brand-tint: rgba(91,79,232,0.18);
    --color-brand-light: #B3A8FA;

    --color-accent: #FF8A78;
    --color-accent-hover: #FFA697;

    --gray-900: #E8EAF0;
    --gray-700: #C7CAD3;
    --gray-600: #9CA0AC;
    --gray-500: #6B7280;
    --gray-400: #565B66;
    --gray-200: #2A2D3A;
    --gray-100: #20232E;
    --gray-50:  #0F1117;

    --color-success-bg: rgba(16,185,129,0.15);
    --color-success-text: #34D399;
    --color-warning-bg: rgba(245,158,11,0.15);
    --color-warning-text: #FBBF24;
    --color-danger-bg: rgba(239,68,68,0.15);
    --color-danger-text: #F87171;
    --color-danger-border: rgba(239,68,68,0.35);
    --color-info-bg: var(--color-brand-tint);
    --color-info-text: #A79BFF;
    --color-neutral-bg: rgba(255,255,255,0.06);
    --color-neutral-text: var(--gray-600);
    --color-purple-bg: rgba(168,85,247,0.15);
    --color-purple-text: #C084FC;

    --color-surface: #1A1D27;
    --color-surface-alt: var(--gray-100);
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--gray-50);
  color: var(--gray-900);
  font-size: 15px;
}

a { color: var(--color-brand); }

/* Visible on every focusable element — the previous version only had
   :hover states, leaving keyboard users with no indication of focus. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

/* ── Layout ── */
.app { display: flex; height: 100vh; overflow: hidden; }

.main {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-7) var(--space-6);
}

/* ── Sidebar ── */
.sidebar {
  width: 220px;
  background: var(--color-surface);
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--space-5) var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--gray-200);
}
.sidebar-brand svg { width: 26px; height: 26px; flex-shrink: 0; }
.sidebar-brand span { font-weight: 700; font-size: 15px; color: var(--color-brand); }

nav { padding: 12px 0; flex: 1; }
nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px var(--space-5);
  color: var(--gray-600);
  text-decoration: none;
  font-size: 14px;
  border-right: 3px solid transparent;
  transition: background 0.12s, color 0.12s;
}
nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
nav a:hover { background: var(--gray-50); color: var(--gray-900); }
nav a.active { background: var(--color-brand-tint); color: var(--color-brand); font-weight: 600; border-right-color: var(--color-brand); }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--gray-200);
}
.avatar {
  width: 34px; height: 34px;
  background: var(--color-brand); color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.user-name { font-size: 13px; font-weight: 600; color: var(--gray-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-link { font-size: 12px; color: var(--gray-500); text-decoration: none; }
.logout-link:hover { color: var(--color-danger-text); }

.theme-toggle-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border: 1px solid var(--gray-200);
  border-radius: 50%;
  background: var(--color-surface);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.theme-toggle-btn:hover { border-color: var(--color-brand); }

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: var(--space-6);
}
.page-header h1 { font-size: 22px; font-weight: 700; color: var(--gray-900); }
.date-label { font-size: 14px; color: var(--gray-500); }

/* ── Post card ── */
.post-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.post-meta-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

.badge {
  padding: 3px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-campaign       { background: var(--color-info-bg); color: var(--color-info-text); }
.badge-single-image   { background: var(--color-success-bg); color: var(--color-success-text); }
.badge-carousel       { background: var(--color-warning-bg); color: var(--color-warning-text); }
.badge-text-post      { background: var(--color-neutral-bg); color: var(--color-neutral-text); }
.badge-poll           { background: var(--color-purple-bg); color: var(--color-purple-text); }

.post-title-text { font-size: 14px; color: var(--gray-700); font-weight: 500; }

.post-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}

/* ── Slide preview ── */
.slides-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  background: var(--gray-100);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}
.slide-frame img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
  display: block;
}
.slide-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  color: var(--gray-600);
}
.slide-btn {
  background: var(--color-surface);
  border: 1px solid var(--gray-200);
  border-radius: 50%;
  width: 32px; height: 32px;
  cursor: pointer;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.12s;
}
.slide-btn:hover { border-color: var(--color-brand); color: var(--color-brand); }
.slide-hint { font-size: 12px; color: var(--gray-500); }
.no-slides { text-align: center; color: var(--gray-500); padding: 40px 0; }
.no-slides .hint { font-size: 12px; margin-top: 6px; }

/* ── Editor ── */
.editor-panel { display: flex; flex-direction: column; gap: 10px; }
.editor-label { font-size: 13px; font-weight: 600; color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.04em; }

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: var(--space-2) var(--space-3);
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.tool-btn {
  padding: 4px 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  cursor: pointer;
  font-size: 14px;
  color: var(--gray-700);
  transition: all 0.12s;
}
.tool-btn:hover { background: var(--color-brand-tint); border-color: var(--color-brand); color: var(--color-brand); }
.bold-btn   { font-weight: 900; }
.italic-btn { font-style: italic; font-weight: 600; }
.clear-btn  { font-size: 12px; color: var(--gray-500); }
.toolbar-divider { width: 1px; height: 20px; background: var(--gray-200); margin: 0 4px; }
.toolbar-spacer { flex: 1; }
.char-count { font-size: 12px; color: var(--gray-500); white-space: nowrap; }

.toolbar-picker-wrap { position: relative; }
.emoji-picker {
  position: absolute;
  top: 36px;
  left: 0;
  z-index: 20;
  grid-template-columns: repeat(10, 1fr);
  gap: 2px;
  width: 260px;
  padding: var(--space-2);
  background: var(--color-surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}
.mention-picker {
  grid-template-columns: 1fr;
  width: 240px;
  max-height: 220px;
  overflow-y: auto;
}
.mention-option {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
}
.mention-option:hover { background: var(--color-brand-tint); }
.mention-option .mention-type { color: var(--gray-500); font-size: 11px; margin-left: 6px; }
.mention-picker-empty { padding: 10px; font-size: 13px; color: var(--gray-500); }
.emoji-option {
  border: none;
  background: none;
  font-size: 18px;
  line-height: 1;
  padding: 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.emoji-option:hover { background: var(--color-brand-tint); }

.caption-editor {
  width: 100%;
  height: 260px;
  padding: var(--space-4);
  border: 1px solid var(--gray-200);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.65;
  resize: vertical;
  outline: none;
  color: var(--gray-900);
  background: var(--color-surface);
}
.caption-editor:focus { border-color: var(--color-brand); box-shadow: var(--focus-ring); }

.editor-footer { }
.editor-hint { font-size: 12px; color: var(--gray-400); }

.post-status {
  padding: 11px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  text-align: center;
  font-weight: 500;
}
.post-status.success { background: var(--color-success-bg); color: var(--color-success-text); }
.post-status.error   { background: var(--color-danger-bg); color: var(--color-danger-text); }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--gray-500);
}
.empty-state svg { margin-bottom: 20px; }
.empty-state h2 { font-size: 20px; color: var(--gray-700); margin-bottom: 8px; }
.empty-state a { color: var(--color-brand); text-decoration: none; }

/* ── Calendar ── */
.calendar-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: var(--space-2);
}
.cal-weekdays span {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 0;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-cell {
  min-height: 84px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cal-cell.empty { background: transparent; border-color: transparent; }
.cal-cell.is-today { border-color: var(--color-brand); border-width: 2px; }
.cal-cell.has-post { background: var(--color-brand-tint); overflow-y: auto; }

.cal-post-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 3px 4px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
}
.cal-post-row:hover { background: var(--color-surface); }
.cal-post-row + .cal-post-row { margin-top: 2px; }
.cal-day { font-size: 13px; font-weight: 700; color: var(--gray-900); }
.is-today .cal-day { color: var(--color-brand); }
.cal-fmt {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  align-self: flex-start;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.cal-fmt-single-image { background: var(--color-success-bg); color: var(--color-success-text); }
.cal-fmt-carousel     { background: var(--color-warning-bg); color: var(--color-warning-text); }
.cal-fmt-text-post    { background: var(--color-neutral-bg); color: var(--color-neutral-text); }
.cal-fmt-poll         { background: var(--color-purple-bg); color: var(--color-purple-text); }
.cal-badges { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.cal-status {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.cal-status-draft     { background: var(--color-neutral-bg); color: var(--color-neutral-text); }
.cal-status-scheduled { background: var(--color-info-bg); color: var(--color-info-text); }
.cal-status-posted    { background: var(--color-success-bg); color: var(--color-success-text); }
.cal-status-failed    { background: var(--color-danger-bg); color: var(--color-danger-text); }
.cal-title { font-size: 11px; color: var(--gray-600); line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.cal-legend {
  display: flex;
  gap: 20px;
  margin-top: var(--space-4);
  padding: 0 4px;
}
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--gray-500); }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-image    { background: var(--color-success-text); }
.dot-carousel { background: var(--color-warning-text); }
.dot-text-post { background: var(--gray-400); }
.dot-poll { background: var(--color-purple-text); }

/* ── Auth / Setup pages ── */
body.centered-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--gray-50);
}
.auth-card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.auth-logo { margin-bottom: var(--space-4); }
.auth-card h1 { font-size: 22px; font-weight: 700; margin-bottom: var(--space-2); }
.subtitle { color: var(--gray-500); font-size: 14px; margin-bottom: var(--space-7); line-height: 1.5; }

.form-group { text-align: left; margin-bottom: var(--space-5); }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.optional { font-weight: 400; color: var(--gray-400); }
.hint { font-size: 12px; color: var(--gray-500); margin-top: 4px; }

.redirect-notice {
  background: var(--color-warning-bg);
  border: 1px solid var(--color-warning-text);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: 13px;
  color: var(--gray-600);
  text-align: left;
  margin-bottom: var(--space-6);
  line-height: 1.6;
}
.redirect-notice code {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-warning-text);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--color-brand);
  word-break: break-all;
}

/* ── Buttons ──────────────────────────────────────────────────────
   .btn-primary / .btn-linkedin / .post-btn were three independent
   near-identical pill-button definitions — merged into one rule so a
   "primary action" looks identical everywhere, keeping all 3 class
   names since dozens of pages already reference them. */
.btn-primary,
.btn-linkedin,
.post-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--color-brand);
  color: white;
  border: none;
  border-radius: var(--radius-pill);
  padding: 13px 32px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
.btn-primary,
.post-btn { width: 100%; }
.btn-primary:hover,
.btn-linkedin:hover,
.post-btn:hover:not(:disabled) { background: var(--color-brand-hover); }
.post-btn:disabled { background: var(--gray-400); cursor: not-allowed; }

.link-muted { color: var(--gray-500); font-size: 13px; text-decoration: none; white-space: nowrap; }
.link-muted:hover { color: var(--gray-600); }

/* ── Flash messages, cards, forms, accounts, import wizard ── */
.flash { padding: var(--space-3) var(--space-5); border-radius: var(--radius-md); font-size: 14px; margin-bottom: var(--space-5); }
.flash-error   { background: var(--color-danger-bg); color: var(--color-danger-text); }
.flash-success { background: var(--color-success-bg); color: var(--color-success-text); }

/* Shared input styling for every form container in the app (formerly
   6 near-duplicate blocks: .form-group, .stacked-form, .field-row,
   .nickname-input, .mapping-select, .editor-panel — all still work,
   they just resolve through one rule now). The :not(:where(...))
   exclusion keeps this OFF checkbox/radio/color inputs — without it a
   checkbox nested anywhere in a .stacked-form/.form-group inherited
   width:100% and 14px padding, stretching the native control into a
   huge invisible click target with its tiny glyph adrift somewhere
   inside (every .checkbox-row across Settings/Knowledge Hub/News
   Studio had this bug), and a color swatch/hex pair (.color-field
   below) got stretched and squashed the same way. Wrapping the
   exclusion list in :where(...) keeps its specificity contribution at
   zero — a plain :not(a):not(b) chain would otherwise outrank
   .color-field's own dedicated sizing rules further down this file and
   reintroduce the exact bug it was meant to avoid. max-width keeps a
   field from stretching edge-to-edge on a wide card — a one-word
   "Personal" in an ~1100px-wide input read as broken/dated, not just
   spacious. Textareas get a wider cap since paragraph content needs
   more room per line than a single value. */
.form-group input:not(:where([type="checkbox"], [type="radio"], [type="color"])),
.form-group select,
.stacked-form input:not(:where([type="checkbox"], [type="radio"], [type="color"])),
.stacked-form select,
.stacked-form textarea,
.field-row input[type="text"],
.field-row textarea,
.nickname-input,
.mapping-select,
.editor-panel input[type=text],
.editor-panel input[type=date],
.editor-panel input[type=time],
.editor-panel select {
  width: 100%;
  max-width: 520px;
  padding: 10px 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  color: var(--gray-900);
  background: var(--color-surface);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.stacked-form textarea,
.field-row textarea {
  max-width: 720px;
}
.form-group input:focus,
.form-group select:focus,
.stacked-form input:focus,
.stacked-form select:focus,
.stacked-form textarea:focus,
.field-row input[type="text"]:focus,
.field-row textarea:focus,
.nickname-input:focus,
.mapping-select:focus,
.editor-panel input:focus,
.editor-panel select:focus {
  border-color: var(--color-brand);
  box-shadow: var(--focus-ring);
}
.nickname-input, .mapping-select { width: auto; padding: 5px 10px; border-radius: var(--radius-sm); font-size: 13px; }
.mapping-select { min-width: 260px; }

/* Groups short fields (Name/Email, three-field rows like Founded/Size/
   HQ) side by side instead of .stacked-form's default one-per-row —
   wrap the relevant <label> elements in a <div class="form-grid"> and
   each becomes its own grid cell. auto-fit + minmax means it still
   collapses to one column on a narrow card/viewport without a separate
   mobile override. */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
  max-width: 720px;
}
.form-grid label { margin: 0; }

/* .btn-primary/.post-btn default to width:100% for a narrow single-
   column context (the auth card — login/signup/accept-invite all use
   .stacked-form too — and a single post's action button) — but inside
   a wide Settings/Knowledge Hub/Blog Studio .card, a full-bleed
   ~1100px button below now-capped-width fields (see .stacked-form
   input above) read as mismatched, not just spacious. Scoped to
   ".card .stacked-form" specifically (not bare .stacked-form) so the
   auth pages' intentionally full-width "Sign in"/"Create account"
   button is untouched — .auth-card is a separate, narrower container
   these rules never match. */
.card .stacked-form button[type="submit"],
.card .form-group button[type="submit"] {
  width: auto;
  align-self: flex-start;
}

.stacked-form { text-align: left; display: flex; flex-direction: column; gap: var(--space-4); }
/* flex column (not display:block) so the label text and its field
   reliably stack as two lines regardless of the field's own width —
   plain display:block only forced that stacking by accident before,
   because every field used to be width:100% and had no room to sit
   beside the label text on one line. Now that fields have a sane
   max-width (see .stacked-form input above), a short label like
   "Industry" DOES have room next to a capped-width input, which read
   as broken for anything bigger than one line (a textarea's label
   floating beside it rather than above). flex-direction:column forces
   the label text (and any inline .muted note beside it) onto its own
   line every time, field below, gap between instead of margin. */
.stacked-form label { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; font-size: 13px; font-weight: 600; color: var(--gray-700); }
/* Checkbox/radio rows want the opposite: control and text side by
   side on one line, not stacked — explicit flex-direction:row (rather
   than relying on the row default) so it isn't silently inherited away
   by the column rule above, which otherwise wins on source order for
   any property .checkbox-row doesn't itself redeclare. */
.stacked-form label.checkbox-row,
.form-group label.checkbox-row {
  display: flex;
  flex-direction: row;
  align-items: center;
}

/* Progressive-disclosure wrapper for optional KB fields (Settings —
   Knowledge Hub profile) — collapsed by default so the primary form
   stays short; native <details>, no JS needed. */
.kb-details { border: 1px solid var(--gray-200); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); }
.kb-details summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--gray-700); }
.kb-details[open] summary { margin-bottom: var(--space-3); }
.kb-details label { margin-top: var(--space-3); }
.kb-details label:first-of-type { margin-top: var(--space-3); }

/* Settings — Brand Palettes, redesigned as an actual palette manager
   instead of a dense settings-form wall: saved palettes render as a
   card grid with a real swatch-strip preview, and the add/edit form's
   7 optional color overrides render as small cards in a grid instead
   of one long stacked-form column. */
.palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.palette-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-surface);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.palette-card:hover { border-color: var(--color-brand-light); box-shadow: var(--shadow-sm); }
.palette-card-swatches { display: flex; height: 56px; }
.palette-card-swatches span { flex: 1; }
.palette-card-photo { display: block; width: 100%; height: 56px; object-fit: cover; }
.palette-card-body { padding: var(--space-3) var(--space-4) var(--space-4); }
.palette-card-title { display: flex; align-items: center; gap: 8px; margin-bottom: var(--space-3); }
.palette-card-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.palette-card .kb-details { margin-top: var(--space-3); padding: var(--space-2) var(--space-3); }
.palette-card .kb-details summary { font-size: 12px; }
.palette-card input[type="file"] { font-size: 12px; max-width: 170px; }

.palette-editor {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}
.palette-editor h3 { font-size: 16px; margin-bottom: var(--space-3); }
.palette-editor-subhead { font-size: 13px; font-weight: 700; color: var(--gray-700); margin: var(--space-2) 0 0; }
.palette-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: var(--space-3);
}
.palette-field-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.palette-field-note { font-size: 11px; margin: -4px 0 0; }

/* Color picker: a real swatch (not the generic 100%-width input rule,
   which stretched the native input[type=color] into an illegible gray
   bar) paired with a hex text field so the current value is always
   readable and directly editable, not just guessable from a tiny chip. */
.color-field { display: flex; align-items: center; gap: var(--space-2); }
.color-field input[type="color"] {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  cursor: pointer;
  flex-shrink: 0;
}
.color-field input[type="color"]:disabled { cursor: not-allowed; opacity: 0.5; }
.color-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.color-field input[type="color"]::-webkit-color-swatch { border: none; border-radius: var(--radius-sm); }
.color-field .hex-input {
  width: 110px;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  text-transform: uppercase;
  color: var(--gray-900);
  background: var(--color-surface);
}
.color-field .hex-input:disabled { background: var(--gray-50); color: var(--gray-400); }
.color-field .hex-input:focus { border-color: var(--color-brand); box-shadow: var(--focus-ring); outline: none; }

/* Workspace switcher at the top of the sidebar */
.workspace-switcher { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--gray-200); }
.workspace-switcher select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  background: var(--gray-50);
  cursor: pointer;
}


.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-5);
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-4); }
.card-header h2 { font-size: 16px; font-weight: 700; }

.muted { color: var(--gray-500); font-size: 13px; }

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-brand);
  border: 1px solid var(--color-brand);
  border-radius: var(--radius-pill);
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  white-space: nowrap;
}
.btn-secondary:hover { background: var(--color-brand-tint); }

.btn-tiny {
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--gray-200);
  background: var(--color-surface);
  font-size: 12px;
  cursor: pointer;
}
.btn-tiny.btn-danger { color: var(--color-danger-text); border-color: var(--color-danger-border); }
.btn-tiny.btn-danger:hover { background: var(--color-danger-bg); }

.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-top: 1px solid var(--gray-200);
  gap: var(--space-3);
  flex-wrap: wrap;
}
.account-row:first-of-type { border-top: none; }
.account-info { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.inline-form { display: inline-flex; align-items: center; gap: 6px; }

/* ── Item grid ──────────────────────────────────────────────────────
   Two-up card grid for list sections that used to be a single flat
   column (News Studio's headlines/drafts, Blog Studio's post lists) —
   auto-fit so it drops to one column itself below ~740px rather than
   needing a separate mobile override. Each item becomes a bordered
   .item-card instead of relying on a border-top divider, since cards
   sit side by side rather than stacked. */
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: var(--space-4);
  align-items: start;
}
.item-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  background: var(--color-surface);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.item-card:hover { border-color: var(--color-brand-light); box-shadow: var(--shadow-sm); }
/* .account-row/.content-row keep their own internal layout when used
   standalone in a flat list (border-top dividers). Both classes
   usually land on the same element (e.g. class="account-row
   item-card") — that merged-class case must NOT also zero out
   .item-card's own padding. .account-row's padding (var(--space-3) 0)
   and .content-row's (var(--space-4) 0) are both single-class rules
   with the same specificity as .item-card's own — whichever is later
   in this file wins the cascade regardless of which makes sense, and
   .content-row happens to come after .item-card, so its 0-left/right
   half silently overrode the card's horizontal padding. Repeating
   padding explicitly in this compound (two-class, so unarguably more
   specific) selector removes the source-order dependency entirely. */
.item-card.account-row,
.item-card.content-row {
  border-top: none;
  padding: var(--space-4);
}
.item-card .account-row,
.item-card .content-row {
  border-top: none;
  padding: 0;
}

/* ── Content-row list pattern ──────────────────────────────────────
   A less congested alternative to .account-row for rows that need
   several small generation controls (format/length/slide-count) next
   to their action button — News Studio's headline list, Blog Studio's
   generator form. Content on its own line, controls in a labeled
   strip below rather than everything crammed onto one flex line. */
.content-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4) 0;
  border-top: 1px solid var(--gray-200);
}
.content-row:first-of-type { border-top: none; }
.content-row-title { font-weight: 600; color: var(--gray-900); text-decoration: none; }
.content-row-title:hover { color: var(--color-brand); }
.content-row-meta { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

.control-strip {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.control-strip.control-strip-secondary {
  padding-top: var(--space-3);
  border-top: 1px dashed var(--gray-200);
}
.control-field { display: flex; flex-direction: column; gap: 4px; }
.control-field label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-500);
}
.control-field select {
  padding: 7px 28px 7px 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 13px;
  background: var(--color-surface);
  color: var(--gray-900);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23697386' stroke-width='2'%3E%3Cpath d='M5 8l5 5 5-5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
}
.control-field select:focus { border-color: var(--color-brand); box-shadow: var(--focus-ring); outline: none; }
.control-strip form { display: flex; align-items: flex-end; gap: var(--space-3); flex-wrap: wrap; }

.badge-warning { background: var(--color-warning-bg); color: var(--color-warning-text); }
.badge-active  { background: var(--color-success-bg); color: var(--color-success-text); }
.badge-draft     { background: var(--color-neutral-bg); color: var(--color-neutral-text); }
.badge-scheduled { background: var(--color-info-bg); color: var(--color-info-text); }
.badge-posted    { background: var(--color-success-bg); color: var(--color-success-text); }
.badge-failed    { background: var(--color-danger-bg); color: var(--color-danger-text); }
.badge-format    { background: var(--color-neutral-bg); color: var(--color-neutral-text); }

.checkbox-row { display: flex; align-items: center; gap: 10px; text-align: left; font-size: 14px; padding: var(--space-2) 0; }

.mapping-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) 0; border-top: 1px solid var(--gray-200); }
.mapping-row:first-child { border-top: none; }

.preview-table { width: 100%; border-collapse: collapse; margin-top: var(--space-3); font-size: 13px; }
.preview-table th, .preview-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--gray-200); }
.preview-table th { color: var(--gray-500); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: 0.03em; }

.review-card { margin-bottom: var(--space-4); }
.review-card-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: var(--space-3); }
.review-card-header .skip-toggle { margin-left: auto; padding: 0; }
.skip-card { padding: var(--space-3) var(--space-4); }
.field-row { display: block; font-size: 12px; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.03em; font-weight: 600; margin: 10px 0; }
.field-row input[type="text"], .field-row textarea { display: block; margin-top: 4px; font-weight: 400; text-transform: none; letter-spacing: normal; box-sizing: border-box; }
/* Keeps the Generate/Re-render button (and its live result) reachable at
   the bottom of the viewport while scrolling through the settings above
   it, instead of requiring a full scroll down to reach it. */
.sticky-action-bar {
  position: sticky;
  bottom: 0;
  z-index: 3;
  margin-top: var(--space-3);
  padding: 10px 0 4px;
  border-top: 1px solid var(--gray-200);
}
.slides-panel .sticky-action-bar { background: var(--gray-100); }
.card .sticky-action-bar { background: var(--color-surface); }

.font-scale-group { display: flex; flex-direction: column; gap: 4px; margin: 4px 0 12px; }
.font-scale-group .field-row { display: flex; align-items: center; gap: 8px; margin: 0; }
.font-scale-group .field-row input[type="range"] { flex: 1; }
.font-scale-group .field-row span { font-weight: 400; text-transform: none; letter-spacing: normal; min-width: 40px; text-align: right; }
.slides-wrap { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-3); }
.slide-fieldset { border: 1px solid var(--gray-200); border-radius: var(--radius-md); padding: 10px 14px 4px; }
.slide-fieldset legend { font-size: 12px; font-weight: 600; color: var(--gray-500); padding: 0 6px; }

.cal-nav { display: flex; gap: 16px; font-size: 13px; }
.cal-nav a { color: var(--color-brand); text-decoration: none; }
.cal-scroll-hint { display: none; }

.editor-panel form { display: flex; flex-direction: column; gap: var(--space-3); }
.editor-panel label { font-size: 13px; font-weight: 600; color: var(--gray-600); display: block; }
.editor-panel input, .editor-panel select { margin-top: 4px; }
.schedule-row { display: flex; gap: var(--space-3); }
.schedule-row label { flex: 1; }
.button-row { display: flex; gap: 10px; }
.button-row button { flex: 1; padding: 10px 0; border-radius: var(--radius-pill); font-size: 14px; font-weight: 600; cursor: pointer; border: none; }
.button-row .btn-secondary { border: 1px solid var(--color-brand); }

/* ── Utilities ──────────────────────────────────────────────────── */
.hidden { display: none !important; }
.mt-8  { margin-top: var(--space-2); }
.mt-16 { margin-top: var(--space-4); }
.mt-24 { margin-top: var(--space-6); }
.w-100 { width: 100px; }

/* ── Mobile nav (hamburger + off-canvas sidebar) ── */
.mobile-topbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 30;
}
.hamburger-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding: 0;
  flex-shrink: 0;
}
.hamburger-btn span { display: block; width: 20px; height: 2px; background: var(--gray-900); border-radius: 2px; }
.mobile-topbar-title { font-weight: 700; color: var(--color-brand); font-size: 15px; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 39; }

/* ── Settings tabs ──
   Client-side tabs over the same server-rendered <section class="card">
   groups — see pages/settings.php. No new routes; every existing form
   still posts/redirects exactly as before. */
.settings-tabs {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--gray-200);
  flex-wrap: wrap;
}
.settings-tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: var(--space-3) var(--space-2);
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  margin-bottom: -1px;
}
.settings-tab-btn:hover { color: var(--gray-900); }
.settings-tab-btn.active { color: var(--color-brand); border-bottom-color: var(--color-brand); }

/* ── Responsive breakpoints ── */
@media (max-width: 768px) {
  .mobile-topbar { display: flex; }

  .app { flex-direction: column; height: auto; min-height: 100vh; overflow: visible; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    max-width: 82vw;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 40;
    overflow-y: auto;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  body.sidebar-open { overflow: hidden; }

  .main { padding: var(--space-4); overflow-y: visible; }

  .post-layout { grid-template-columns: 1fr; }

  .page-header { flex-wrap: wrap; gap: 8px; }
  .page-header h1 { font-size: 19px; }

  .calendar-card { padding: var(--space-3); overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cal-weekdays, .cal-grid { min-width: 560px; }
  .cal-cell { min-height: 68px; padding: 6px; }
  .cal-legend { flex-wrap: wrap; gap: 10px 16px; }
  .cal-scroll-hint { display: block; margin-bottom: 8px; }

  .card { padding: var(--space-4); overflow-x: auto; }
  .post-card { padding: var(--space-4); }
  .preview-table { min-width: 600px; }

  .schedule-row { flex-direction: column; gap: 10px; }

  .emoji-picker, .mention-picker { max-width: calc(100vw - 64px); }

  .auth-card { padding: var(--space-6); }

  .mapping-select { min-width: 0; width: 100%; }
  .mapping-row { flex-direction: column; align-items: stretch; }
  .account-row { flex-direction: column; align-items: stretch; }
}

@media (max-width: 420px) {
  .toolbar { gap: 4px; padding: 6px 8px; }
  .tool-btn { padding: 4px 10px; font-size: 13px; }
  .button-row { flex-direction: column; }
  .cal-weekdays, .cal-grid { min-width: 480px; }
}

/* Design Template visual picker — a thumbnail grid replacing the old
   plain <select> so users see what each template looks like before
   generating. Same control across Content Studio / New Post / Calendar. */
.template-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 6px 0 14px;
}
.template-option {
  position: relative;
  width: 92px;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  padding: 3px;
  text-align: center;
}
.template-option input { position: absolute; opacity: 0; pointer-events: none; width: auto; }
.template-option img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 5px;
  display: block;
  border: 1px solid var(--gray-200);
}
.template-option span {
  display: block;
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 4px;
  line-height: 1.2;
}
.template-option.selected,
.template-option:has(input:checked) { border-color: var(--color-brand); }
.template-option.selected img,
.template-option:has(input:checked) img { border-color: var(--color-brand); }
.template-option:hover img { border-color: var(--color-brand-light); }

/* ── Post composer: 3-column New Post / Post Edit layout ──
   Deliberately separate from .post-layout/.slides-panel/.editor-panel
   (those stay untouched — pages/today.php shares them). Left column is
   settings/input, center is the post's written content, right is the
   generated image + publish actions (sticky). */
.post-composer {
  display: grid;
  grid-template-columns: minmax(280px, 320px) minmax(420px, 1fr) minmax(300px, 360px);
  gap: var(--space-6);
  align-items: start;
}
.post-card--composer { max-width: 1560px; margin-inline: auto; }
.post-col-input,
.post-col-caption,
.post-col-image { display: flex; flex-direction: column; gap: var(--space-5); }
.post-col-image { position: sticky; top: var(--space-6); }

.post-col-heading {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

@media (max-width: 1100px) {
  .post-composer { grid-template-columns: 1fr 1fr; }
  .post-col-image { grid-column: 1 / -1; position: static; }
}
@media (max-width: 768px) {
  .post-composer { grid-template-columns: 1fr; }
  .post-col-image { position: static; }
}

/* Modern styling for every text/select/textarea inside the composer,
   including controls that sit outside .stacked-form/.editor-panel today
   (format select, CTA panel) and so currently render unstyled. */
.post-composer input[type="text"],
.post-composer input[type="date"],
.post-composer input[type="time"],
.post-composer input[type="number"],
.post-composer select,
.post-composer textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  color: var(--gray-900);
  background: var(--color-surface);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.post-composer select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23697386' stroke-width='2'%3E%3Cpath d='M5 8l5 5 5-5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}
.post-composer textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.post-composer input[type="text"]:focus,
.post-composer input[type="date"]:focus,
.post-composer input[type="time"]:focus,
.post-composer input[type="number"]:focus,
.post-composer select:focus,
.post-composer textarea:focus {
  border-color: var(--color-brand);
  box-shadow: var(--focus-ring);
}
.post-composer label { font-size: 13px; font-weight: 600; color: var(--gray-700); display: block; margin-bottom: 6px; }

/* Regular (KB) vs Custom Prompt segmented toggle in the AI panel */
.prompt-mode-toggle {
  display: flex;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 3px;
  background: var(--gray-100);
}
.prompt-mode-toggle label {
  flex: 1;
  margin: 0;
  text-align: center;
  padding: 8px 10px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.prompt-mode-toggle input { position: absolute; opacity: 0; pointer-events: none; width: auto; }
.prompt-mode-toggle input:checked + label,
.prompt-mode-toggle label:has(input:checked) { background: var(--color-surface); color: var(--color-brand); box-shadow: var(--shadow-sm); }
.prompt-mode-hint { font-size: 12px; color: var(--gray-500); margin-top: -8px; }

/* ── Modern slider (input[type=range]) — used app-wide: font-scale
   sliders and background-tint sliders on New Post, Post Edit, and
   Calendar Batch all share this, no HTML changes needed. ── */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--gray-200);
  accent-color: var(--color-brand);
  cursor: pointer;
  outline: none;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--gray-200);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-brand);
  border: 3px solid var(--color-surface);
  box-shadow: var(--shadow-sm);
  margin-top: -5.5px;
  transition: transform 0.12s;
}
input[type="range"]::-webkit-slider-thumb:hover,
input[type="range"]::-webkit-slider-thumb:active { transform: scale(1.15); }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: var(--focus-ring); }
input[type="range"]::-moz-range-track {
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--gray-200);
}
input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-brand);
  border: 3px solid var(--color-surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s;
}
input[type="range"]::-moz-range-thumb:hover,
input[type="range"]::-moz-range-thumb:active { transform: scale(1.15); }
input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: var(--focus-ring); }

/* ── Public marketing site (Home/Pricing/About/Terms/Privacy) ───────
   Separate shell from the logged-in .app sidebar layout and the
   single-card .auth-card — a full-width header/footer site chrome. */
body.public { background: var(--gray-50); }

/* .btn-primary defaults to width:100% for its usual form-submit-button
   role — override back to auto wherever it's used as an inline pill
   link instead (header/hero CTAs). */
.public-actions .btn-primary,
.hero-actions .btn-primary,
.hero-actions .btn-secondary { width: auto; white-space: nowrap; }

.public-header {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-4) var(--space-7);
  background: var(--color-surface);
  border-bottom: 1px solid var(--gray-200);
}
.public-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  color: var(--gray-900);
}
.public-nav { display: flex; gap: var(--space-5); flex: 1; }
.public-nav a { color: var(--gray-600); text-decoration: none; font-size: 14px; font-weight: 500; }
.public-nav a:hover { color: var(--color-brand); }
.public-actions { display: flex; align-items: center; gap: var(--space-4); }

.public-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-7);
}

.public-footer {
  display: flex;
  gap: var(--space-8);
  padding: var(--space-7);
  border-top: 1px solid var(--gray-200);
  max-width: 1080px;
  margin: 0 auto;
}
.public-footer-col { display: flex; flex-direction: column; gap: var(--space-2); font-size: 13px; }
.public-footer-col strong { color: var(--gray-900); margin-bottom: var(--space-1); }
.public-footer-col a { color: var(--gray-500); text-decoration: none; }
.public-footer-col a:hover { color: var(--color-brand); }
.public-footer-copyright { margin-left: auto; align-self: flex-end; color: var(--gray-400); font-size: 12px; }

.hero { text-align: center; padding: var(--space-8) 0 var(--space-7); }
.hero h1 { font-size: 36px; font-weight: 700; line-height: 1.2; max-width: 760px; margin: 0 auto var(--space-4); }
.hero-subtitle { font-size: 17px; color: var(--gray-600); max-width: 600px; margin: 0 auto var(--space-6); line-height: 1.6; }
.hero-actions { display: flex; justify-content: center; gap: var(--space-3); }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-5);
  margin: var(--space-7) 0;
}
.feature-card { transition: box-shadow 0.15s; }
.feature-card:hover { box-shadow: var(--shadow-md); }
.feature-card h3 { font-size: 16px; font-weight: 700; margin-bottom: var(--space-2); }

.cta-band {
  text-align: center;
  background: var(--color-brand-tint);
  border-radius: var(--radius-lg);
  padding: var(--space-7);
  margin-top: var(--space-7);
}
.cta-band h2 { font-size: 22px; font-weight: 700; margin-bottom: var(--space-5); }

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-5);
  margin-top: var(--space-6);
}
.pricing-card { text-align: center; transition: box-shadow 0.15s; }
.pricing-card:hover { box-shadow: var(--shadow-md); }
.pricing-card h3 { font-size: 18px; font-weight: 700; margin-bottom: var(--space-4); }
.pricing-limits { list-style: none; margin-bottom: var(--space-5); color: var(--gray-600); font-size: 14px; }
.pricing-limits li { padding: var(--space-1) 0; }

@media (max-width: 768px) {
  .public-header { flex-wrap: wrap; padding: var(--space-3) var(--space-4); }
  .public-nav { order: 3; width: 100%; justify-content: center; }
  .public-main { padding: var(--space-6) var(--space-4); }
  .hero h1 { font-size: 26px; }
  .public-footer { flex-direction: column; gap: var(--space-4); }
  .public-footer-copyright { margin-left: 0; align-self: flex-start; }
}
