/* =============================================================
   Sapvio — Main Stylesheet · "Amber v2" design direction
   Baltic amber accent. Warm espresso ink. Warm-cream paper.
   All three WCAG AA failures from Inkwell are fixed here.
   ============================================================= */

/* ---------- Fonts — self-hosted via fonts.css --------------- */
@import url('/static/css/fonts.css');

/* ---------- Foundation tokens ------------------------------- */
:root {
  /* Warm-stone scale */
  --stone-50:  #fcf6ea;   /* warm cream page */
  --stone-100: #f3ecdb;
  --stone-200: #e6dcc4;   /* default border */
  --stone-300: #cbbf9c;   /* strong border */
  --stone-400: #a39a83;   /* muted on dark surfaces — audit-safe */
  --stone-500: #6f6552;   /* muted on light */
  --stone-600: #4d4334;   /* secondary text */
  --stone-700: #3a2e1f;
  --stone-800: #1f1810;   /* text on amber */
  --stone-900: #2a2014;   /* warm espresso ink */

  /* Baltic amber accent */
  --signal-50:  #fdf3d8;  /* badge background */
  --signal-100: #fce8b6;
  --signal-200: #f6c86a;  /* mid step */
  --signal-300: #ebb040;  /* mid step */
  --signal-400: #e09a18;  /* PRIMARY accent — the wink */
  --signal-500: #c27d10;  /* hover */
  --signal-600: #8a5a00;  /* deep ochre — usable as foreground text */

  /* Semantic state colors — all pass WCAG AA */
  --green-500: #10b981;
  --green-600: #059669;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --red-500:   #ef4444;
  --red-600:   #dc2626;

  /* Brand avatar palette (stays — purple is amber's complement) */
  --brand-plum:    #4B2582;
  --brand-forest:  #2f5a4a;
  --brand-rust:    #a64a2a;
  --brand-ocean:   #1f4a7a;
  --brand-walnut:  #5a3a2a;
  --brand-charcoal:#2a2a32;

  /* Foreground */
  --fg-1:           var(--stone-900);
  --fg-2:           var(--stone-600);
  --fg-3:           var(--stone-500);
  --fg-inverse:     var(--stone-50);
  --fg-on-dark:        #ede4cc;   /* body text on espresso sidebar/footer */
  --fg-on-dark-strong: #fcf6ea;  /* headings on dark */
  --muted-on-dark:     #b8a989;  /* muted mono on dark — replaces stone-500 (was AA fail) */

  /* Backgrounds */
  --bg-page:     var(--stone-50);
  --bg-surface:  #ffffff;
  --bg-surface-2:var(--stone-100);
  --bg-sidebar:  var(--stone-900);
  --bg-overlay:  rgba(42, 32, 20, 0.55);

  /* Borders */
  --border:        var(--stone-200);
  --border-light:  var(--stone-100);
  --border-strong: var(--stone-300);
  --border-focus:  var(--signal-400);

  /* Accent */
  --accent:       var(--signal-400);
  --accent-hover: var(--signal-500);
  --accent-press: var(--signal-600);
  --accent-soft:  var(--signal-50);
  --accent-soft-2:var(--signal-100);
  --accent-on:    var(--stone-900);  /* ink on amber — 6.9:1 AAA */

  /* Dark pill */
  --pill-dark:       var(--stone-900);
  --pill-dark-hover: var(--stone-700);
  --pill-dark-on:    var(--stone-50);

  /* State surfaces — deepened to pass AA (audit fixes) */
  --ok-fg:   #047857;     /* was #059669 — now 5.12:1 on white */
  --ok-bg:   #ecfdf5;
  --ok-bd:   #a7f3d0;
  --warn-fg: #b45309;     /* was #d97706 — now 4.73:1 on white */
  --warn-bg: #fffbeb;
  --warn-bd: #fde68a;
  --err-fg:  #b91c1c;     /* was #dc2626 — now 5.91:1 on white */
  --err-bg:  #fef2f2;
  --err-bd:  #fecaca;

  /* Typography */
  --font:       'Satoshi', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono:  ui-monospace, 'SF Mono', Menlo, Consolas, 'Cascadia Code', monospace;
  --font-serif: 'Satoshi', system-ui, sans-serif;

  /* Type scale */
  --fs-2xs: 0.69rem;
  --fs-xs:  0.75rem;
  --fs-sm:  0.82rem;
  --fs-base:0.9375rem;
  --fs-md:  1rem;
  --fs-lg:  1.125rem;
  --fs-xl:  1.375rem;
  --fs-2xl: 1.75rem;

  /* Weights */
  --fw-regular: 400;
  --fw-medium:  500;
  --fw-bold:    700;
  --fw-black:   900;

  /* Radii */
  --r-xs:  3px;
  --r-sm:  6px;
  --r:     8px;
  --r-md:  10px;
  --r-lg:  12px;
  --r-xl:  16px;
  --r-2xl: 20px;
  --r-pill:999px;
  /* Numeric aliases used by calendar / modal components */
  --r-1:   var(--r-sm);   /* 6px — inputs, small buttons */
  --r-2:   var(--r-xl);   /* 16px — cards, modals */

  /* Shadows (warm espresso tint) */
  --shadow-xs: 0 1px 2px rgba(42,32,20,0.04);
  --shadow-sm: 0 1px 2px rgba(42,32,20,0.05), 0 1px 3px rgba(42,32,20,0.04);
  --shadow-md: 0 4px 8px rgba(42,32,20,0.06), 0 2px 4px rgba(42,32,20,0.04);
  --shadow-lg: 0 12px 24px rgba(42,32,20,0.08), 0 4px 8px rgba(42,32,20,0.05);
  --shadow-xl: 0 28px 56px rgba(42,32,20,0.18), 0 12px 24px rgba(42,32,20,0.08);
  --shadow-amber: 0 4px 14px rgba(224,154,24,0.35);

  /* Motion */
  --t-fast: 120ms;
  --t-base: 180ms;
  --t-slow: 320ms;
  --ease:     cubic-bezier(.4,0,.2,1);
  --ease-out: cubic-bezier(.16,.84,.34,1);

  /* Back-compat aliases used in old templates */
  --sb-bg:     var(--stone-900);
  --sb-text:   var(--fg-on-dark);
  --sb-muted:  var(--muted-on-dark);
  --sb-hover:  rgba(252,246,234,0.06);
  --sb-border: rgba(252,246,234,0.08);
  --sb-width:  248px;
  --page-bg:   var(--stone-50);
  --surface:   #ffffff;
  --text:      var(--stone-900);
  --text-2:    var(--stone-600);
  --text-3:    var(--stone-500);
  --shadow-sm-compat: var(--shadow-sm);
  --shadow-md-compat: var(--shadow-md);
  --accent-light: var(--signal-50);
  --accent-dark:  var(--signal-600);
  --grad: var(--brand-plum); /* flat — no gradient */
  --ok:   var(--green-600);
  --warn: var(--amber-600);
  --err:  var(--red-600);

  /* Font aliases — match design system naming */
  --font-sans:    var(--font);
  --font-display: var(--font);
  --font-serif:   'Satoshi', system-ui, sans-serif;

  /* Letter spacing */
  --ls-display: -0.035em;
  --ls-heading: -0.015em;
  --ls-body:    -0.005em;
  --ls-eyebrow: 0.09em;
  --ls-tab:     0.04em;

  /* Line heights */
  --lh-tight:   1.05;
  --lh-snug:    1.25;
  --lh-normal:  1.55;
  --lh-relaxed: 1.7;

  /* Extended type scale */
  --fs-3xl: 2.5rem;   /* 40px — marketing hero */
  --fs-4xl: 3.5rem;   /* 56px — big display */

  /* Spacing (8pt scale + 4pt half-steps) */
  --sp-0:  0;
  --sp-1:  0.25rem;
  --sp-2:  0.5rem;
  --sp-3:  0.75rem;
  --sp-4:  1rem;
  --sp-5:  1.25rem;
  --sp-6:  1.5rem;
  --sp-8:  2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-16: 4rem;

  /* Shape language — consistent across every radius-bearing element */
  --avatar-radius: 50%;   /* 50% = circle; override to 30% for square avatars */
  --glyph-radius:  22%;   /* logo mark tile */
  --ui-radius:     8px;   /* global fallback for cards + buttons */

  /* Modal scrim */
  --bg-overlay: rgba(21, 21, 26, 0.55);

  /* Signal shadow — for elevated accent elements */
  --shadow-signal: 0 4px 14px rgba(245, 208, 32, 0.45);
}

/* ---------- Base reset -------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--fg-1);
  font-size: var(--fs-base);
  line-height: 1.55;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--fg-1); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--accent); transition: color var(--t-fast) var(--ease); }
a:hover { color: var(--accent-press); text-decoration-color: var(--accent-press); }

h1, h2, h3 { margin: 0; }

::selection { background: var(--signal-200); color: var(--stone-900); }

/* ---------- Brand glyph — signal-yellow dot-in-tile mark --- */
/* Apply width/height inline; corners + dot scale relatively.  */
.brand-glyph {
  background: var(--accent);
  border-radius: var(--glyph-radius);
  position: relative;
  flex-shrink: 0;
  display: inline-block;
}
.brand-glyph::after {
  content: '';
  position: absolute;
  width: 22%; height: 22%;
  background: var(--accent-on);
  border-radius: 50%;
  right: 17%; bottom: 17%;
}

/* ---------- App shell --------------------------------------- */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.app-sidebar {
  width: var(--sb-width);
  min-width: var(--sb-width);
  background: var(--bg-sidebar);
  color: var(--stone-300);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-top {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: rgba(252,246,234,0.12) transparent;
}
.sidebar-top::-webkit-scrollbar { width: 6px; }
.sidebar-top::-webkit-scrollbar-thumb { background: rgba(252,246,234,0.12); border-radius: 3px; }

/* Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  padding: 4px 6px;
  margin-bottom: 18px;
  text-decoration: none;
}
.sidebar-logo:hover { text-decoration: none; }
.sidebar-logo img { height: 28px; width: auto; }

/* Legacy text logo fallback */
.sidebar-logo-mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 900;
  color: var(--accent-on);
  flex-shrink: 0;
  margin-right: 8px;
}
.sidebar-logo-text {
  font-weight: 900;
  font-size: 15px;
  color: var(--stone-50);
  letter-spacing: -0.03em;
}

/* Nav items */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 12px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--stone-300);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: background var(--t-fast), color var(--t-fast);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: var(--font);
}
.sidebar-nav-item:hover { background: rgba(252,246,234,0.06); color: var(--stone-50); text-decoration: none; }
.sidebar-nav-item--active {
  background: var(--accent);
  color: var(--accent-on);
  font-weight: 700;
}
.sidebar-nav-item--active:hover { background: var(--accent-hover); color: var(--accent-on); }

.sidebar-nav-icon {
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; opacity: 0.85;
}
.sidebar-nav-icon svg { width: 16px; height: 16px; }
.sidebar-nav-item--active .sidebar-nav-icon { opacity: 1; }

/* New brand button */
.sidebar-new-brand-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--accent-on);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.005em;
  transition: background var(--t-fast);
  box-shadow: 0 1px 0 var(--signal-600) inset;
}
.sidebar-new-brand-btn:hover { background: var(--accent-hover); color: var(--accent-on); text-decoration: none; }

/* Section labels */
.sidebar-section-title {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--stone-400);
  font-weight: 700;
  padding: 0 10px;
  margin: 14px 0 6px;
}

/* Recent brands */
.sidebar-recent,
.sidebar-history {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-recent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  color: var(--stone-300);
  text-decoration: none;
  font-size: 13px;
  letter-spacing: -0.005em;
  transition: background var(--t-fast), color var(--t-fast);
}
.sidebar-recent-item:hover { background: rgba(252,246,234,0.06); color: var(--stone-50); text-decoration: none; }
.sidebar-recent-item > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }

.sidebar-recent-initial {
  width: 22px; height: 22px;
  border-radius: 5px;
  background: var(--brand-plum);
  color: var(--stone-50);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
  flex-shrink: 0;
}

.sidebar-recent-empty,
.sidebar-history-empty {
  font-size: 12px;
  color: var(--stone-400);
  padding: 4px 10px;
  opacity: 0.7;
}

/* History */
.sidebar-history-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 10px;
  text-decoration: none;
}
.sidebar-history-item--link {
  border-radius: var(--r-sm);
  transition: background var(--t-fast);
  cursor: pointer;
}
.sidebar-history-item--link:hover {
  background: rgba(252,246,234,0.07);
  text-decoration: none;
}

.sidebar-history-dot {
  flex-shrink: 0;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 7px;
  font-size: 0; /* hide ● char */
}
.sidebar-history-dot--err { background: #f87171; }

.sidebar-history-detail {
  display: flex; flex-direction: column;
  gap: 1px; min-width: 0; line-height: 1.3;
}
.sidebar-history-label { color: var(--stone-200); font-size: 12.5px; font-weight: 600; }
.sidebar-history-site {
  color: var(--stone-400); font-size: 11px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--font-mono);
}
.sidebar-history-time { color: var(--stone-400); font-size: 10.5px; opacity: 0.75; }

/* Sidebar bottom */
.sidebar-bottom {
  border-top: 1px solid rgba(252,246,234,0.08);
  padding: 12px 12px 14px;
}

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.sidebar-user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--stone-700);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--stone-200);
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 12.5px; font-weight: 700;
  color: var(--stone-50); letter-spacing: -0.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-user-email {
  font-size: 10.5px; color: var(--stone-400);
  font-family: var(--font-mono);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-unverified-dot {
  color: var(--amber-500); font-size: 8px;
  vertical-align: middle; margin-left: 2px;
}

.sidebar-bottom-row {
  display: flex; align-items: center; gap: 8px;
}
.sidebar-settings-link {
  flex: 1; border: 1px solid rgba(252,246,234,0.14);
  background: transparent; color: var(--stone-300);
  font-size: 12px; padding: 6px 10px;
  border-radius: var(--r-sm); cursor: pointer;
  font-family: var(--font); font-weight: 500;
  text-decoration: none; text-align: center;
  transition: background var(--t-fast), color var(--t-fast);
  display: block;
}
.sidebar-settings-link:hover { background: rgba(252,246,234,0.06); color: var(--stone-50); text-decoration: none; }

.sidebar-logout-btn {
  flex: 1; border: 1px solid rgba(252,246,234,0.14);
  background: transparent; color: var(--stone-300);
  font-size: 12px; padding: 6px 10px;
  border-radius: var(--r-sm); cursor: pointer;
  font-family: var(--font); font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast);
}
.sidebar-logout-btn:hover { background: rgba(248,113,113,0.12); color: #fca5a5; border-color: rgba(248,113,113,0.3); }

/* J5: UI language selector */
.sidebar-lang-row {
  padding: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-lang-label {
  font-size: 10.5px;
  color: var(--stone-400);
  white-space: nowrap;
  flex-shrink: 0;
}
.sidebar-lang-select {
  flex: 1;
  font-size: 11.5px;
  padding: 4px 8px;
  border: 1px solid rgba(252,246,234,0.14);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--stone-300);
  cursor: pointer;
  font-family: var(--font);
  appearance: none;
  -webkit-appearance: none;
}
.sidebar-lang-select:hover { border-color: rgba(250,250,247,0.25); color: var(--stone-50); }
.sidebar-lang-select option { background: var(--stone-800); color: var(--stone-50); }

/* Sidebar footer links */
.sidebar-footer-links {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 0 4px;
  flex-wrap: wrap;
}
.sidebar-footer-links a {
  font-size: 10.5px;
  color: var(--muted-on-dark);
  text-decoration: none;
  transition: color 0.12s;
}
.sidebar-footer-links a:hover { color: var(--fg-on-dark); }
.sidebar-footer-links span { color: var(--muted-on-dark); font-size: 10px; }

/* Sveiks italic welcome wink — amber serif, dark sliver only */
.sveiks-line {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 12.5px;
  color: var(--signal-400);
  letter-spacing: -0.005em;
  padding: 8px 0 4px;
  opacity: 0.85;
}

/* Version current badge */
.version-current-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(245, 208, 32, 0.15);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 4px;
  vertical-align: 1px;
}

/* Calendar tab panel */
.cal-tab-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.cal-tab-header h2 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.cal-tab-desc { font-size: 13px; color: var(--fg-2); margin: 0; }
.cal-tab-open-btn { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.cal-tab-status { font-size: 13px; color: var(--fg-3); }

.cal-tab-empty {
  text-align: center;
  padding: 40px 24px;
  color: var(--fg-3);
}
.cal-tab-empty-icon { margin-bottom: 12px; }
.cal-tab-empty p { font-size: 14px; margin-bottom: 4px; }
.cal-tab-empty-sub { font-size: 12.5px; color: var(--fg-3); }

.cal-tab-list { display: flex; flex-direction: column; gap: 8px; }
.cal-tab-post-row {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-surface);
}
.cal-tab-post-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.cal-tab-post-type { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fg-2); }
.cal-tab-post-date { font-size: 11px; color: var(--fg-3); margin-left: auto; }
.cal-tab-post-text { font-size: 13px; color: var(--fg-1); line-height: 1.5; }

/* Auth links (unauthenticated) */
.sidebar-auth-links { display: flex; flex-direction: column; gap: 6px; }
.sidebar-auth-link {
  display: block; padding: 8px 12px;
  border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500;
  color: var(--stone-300); text-decoration: none; text-align: center;
  border: 1px solid rgba(252,246,234,0.14);
  transition: background var(--t-fast), color var(--t-fast);
}
.sidebar-auth-link:hover { background: rgba(252,246,234,0.06); color: var(--stone-50); text-decoration: none; }
.sidebar-auth-link--primary {
  background: var(--accent); border-color: var(--accent);
  color: var(--accent-on); font-weight: 700;
  box-shadow: 0 1px 0 var(--signal-600) inset;
}
.sidebar-auth-link--primary:hover { background: var(--accent-hover); color: var(--accent-on); }

/* ============================================================
   MAIN AREA
   ============================================================ */

.app-main {
  flex: 1;
  display: flex; flex-direction: column;
  min-width: 0; overflow: hidden;
}

.app-header {
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
  z-index: 20;
}

.app-header-left {
  display: flex; align-items: center; gap: 8px;
  min-width: 0; font-size: var(--fs-sm); color: var(--fg-2);
}
.app-header-back {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-sm); color: var(--fg-2);
  text-decoration: none; transition: color var(--t-fast);
}
.app-header-back:hover { color: var(--fg-1); text-decoration: none; }

.app-breadcrumb {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-sm); color: var(--fg-3);
}
.app-breadcrumb a {
  color: var(--fg-2); text-decoration: none; transition: color var(--t-fast);
}
.app-breadcrumb a:hover { color: var(--fg-1); }
.app-breadcrumb-sep { color: var(--fg-3); user-select: none; }
.app-breadcrumb-current { color: var(--fg-1); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }


.app-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ============================================================
   VERIFY BANNER
   ============================================================ */

.verify-banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  background: var(--warn-bg);
  border-bottom: 1px solid var(--warn-bd);
  padding: 9px 28px;
  font-size: var(--fs-sm);
  color: var(--warn-fg);
  flex-shrink: 0;
}
.verify-banner-btn {
  border: none;
  background: var(--amber-500); color: #fff;
  border-radius: var(--r-sm);
  padding: 5px 12px;
  font-size: var(--fs-xs); font-weight: 700;
  font-family: var(--font); cursor: pointer;
  white-space: nowrap;
  transition: background var(--t-fast);
}
.verify-banner-btn:hover { background: var(--amber-600); }

/* ============================================================
   SHARED COMPONENTS
   ============================================================ */

/* Cards */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.card:last-child { margin-bottom: 0; }

/* Typography inside cards */
.card h2 {
  font-size: 15px; font-weight: 900;
  letter-spacing: -0.02em; margin: 0 0 14px;
  color: var(--fg-1);
}
.card h3 {
  font-size: var(--fs-xs); font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--fg-3); margin: 14px 0 4px;
}
.card h3:first-child { margin-top: 0; }
h2 { font-size: 15px; font-weight: 900; letter-spacing: -0.02em; color: var(--fg-1); margin: 0 0 12px; }
h3 { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--fg-3); margin: 12px 0 4px; }
h3:first-child { margin-top: 0; }

dt {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--fg-3); margin-top: 14px;
}
dt:first-child { margin-top: 0; }
dd { margin: 4px 0 0; font-size: 14px; color: var(--fg-1); line-height: 1.55; }

/* Buttons */
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center; justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--r);
  font-size: 13.5px; font-weight: 700;
  font-family: var(--font);
  letter-spacing: -0.01em;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
}

/* Primary = signal yellow */
.btn-primary {
  background: var(--accent);
  color: var(--accent-on);
  box-shadow: 0 1px 0 var(--signal-600) inset;
}
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-on); text-decoration: none; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

/* Secondary = ink dark */
.btn-secondary {
  background: var(--pill-dark);
  color: var(--pill-dark-on);
}
.btn-secondary:hover { background: var(--pill-dark-hover); color: var(--pill-dark-on); text-decoration: none; }

/* Text link button — no chrome, looks like an inline link */
.btn-link {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font);
  font-size: inherit;
  font-weight: 500;
  color: var(--signal-600);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  line-height: inherit;
}
.btn-link:hover { color: var(--accent-press); }

/* Pills / tags */
.pill {
  display: inline-block;
  padding: 3px 10px; border-radius: var(--r-pill);
  background: var(--bg-surface); color: var(--fg-1);
  border: 1px solid var(--border);
  font-size: 12px; font-weight: 500;
  margin-right: 4px; margin-bottom: 4px;
}

/* ============================================================
   BRANDS DASHBOARD
   ============================================================ */

.brands-page {
  padding: 32px 40px 48px;
  max-width: 920px;
}

.brands-page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}

.brands-page-title {
  margin: 0;
  font-size: 28px; font-weight: 900;
  letter-spacing: -0.035em; color: var(--fg-1);
}

.brands-list {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.brand-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  text-decoration: none; color: inherit;
  cursor: pointer;
  background: transparent;
  border-left: none; border-right: none; border-top: none;
  width: 100%; text-align: left;
  font-family: var(--font);
  transition: background var(--t-fast);
}
.brand-row:last-child { border-bottom: none; }
.brand-row:hover { background: var(--bg-page); text-decoration: none; color: inherit; }

.brand-row-initial {
  width: 38px; height: 38px;
  border-radius: 9px;
  background: var(--brand-plum);
  color: var(--stone-50);
  display: flex; align-items: center; justify-content: center;
  font-size: 14.5px; font-weight: 700;
  flex-shrink: 0;
}

.brand-row-info { flex: 1; min-width: 0; }

.brand-row-name {
  font-weight: 700; font-size: 14.5px; color: var(--fg-1);
  letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.brand-row-domain {
  font-size: 12px; color: var(--fg-3); margin-top: 1px;
  font-family: var(--font-mono);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.brand-row-meta {
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
  white-space: nowrap;
}
.brand-row-time { font-size: 12.5px; color: var(--fg-2); }
.brand-row-event-label {
  font-size: 10.5px; color: var(--fg-3);
  text-transform: uppercase; letter-spacing: 0.07em; font-weight: 700;
}

.brands-empty {
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  padding: 56px 24px;
  color: var(--fg-2);
}
.brands-empty-glyph { width: 48px; height: 48px; margin: 0 auto 16px; }
.brands-empty-icon { font-size: 2rem; margin-bottom: 12px; }
.brands-empty p { margin: 0 0 16px; font-size: 14px; color: var(--fg-2); }

/* ============================================================
   BRAND DETAIL PAGE
   ============================================================ */

#brand-detail { display: flex; flex-direction: column; min-height: 100%; }

/* Brand header */
.brand-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 24px;
  padding: 28px 40px 22px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.brand-header-main {
  display: flex; align-items: flex-start; gap: 18px; min-width: 0;
}

.brand-logo-circle {
  width: 56px; height: 56px;
  border-radius: 12px;
  background: var(--brand-plum);
  color: var(--stone-50);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700;
  flex-shrink: 0;
}

.brand-title {
  font-size: 28px; font-weight: 900;
  letter-spacing: -0.035em; line-height: 1.1;
  margin: 0 0 4px; color: var(--fg-1);
}

.brand-subtitle {
  font-size: 13.5px; color: var(--fg-2);
  margin: 0 0 4px; line-height: 1.5;
}

.brand-domain {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--fg-3); margin: 0;
  font-family: var(--font-mono);
}

.brand-header-actions {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0; padding-top: 2px;
}

/* Tab bar */
.brand-tabs {
  display: flex;
  padding: 0 32px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex-shrink: 0;
  position: sticky; top: 0;
  z-index: 10;
}
.brand-tabs::-webkit-scrollbar { display: none; }

.brand-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 14px 14px;
  background: transparent; border: none;
  color: var(--fg-3);
  font-size: 13.5px; font-weight: 600;
  font-family: var(--font);
  letter-spacing: -0.01em;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color var(--t-fast);
}
.brand-tab:hover { color: var(--fg-1); }
.brand-tab--active {
  color: var(--fg-1);
  border-bottom-color: var(--accent);
  font-weight: 700;
}

.tab-badge {
  display: inline-flex; align-items: center;
  padding: 1px 7px; border-radius: var(--r-pill);
  background: var(--stone-100); color: var(--fg-3);
  font-size: 10.5px; font-weight: 700;
}
.brand-tab--active .tab-badge { background: var(--accent-soft); color: var(--accent-press); }

/* Tab panels */
.brand-tab-panel {
  padding: 28px 40px 48px;
  flex: 1;
}

/* Brand DNA layout — profile full-width, side cards below as a row */
.brand-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}

.brand-main-column {
  display: flex; flex-direction: column; min-width: 0;
}

.brand-side-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.brand-side-column .card { margin-bottom: 0; }

/* Activity / versions */
#brand-activity-list, #versions-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 10px;
}
#brand-activity-list li {
  display: flex; gap: 10px;
  font-size: 13px; color: var(--fg-1); line-height: 1.4;
}
#brand-activity-list .activity-dot {
  flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); margin-top: 5px;
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.activity-time { font-size: 11px; color: var(--fg-3); font-family: var(--font-mono); }

/* Activity items */
.activity-item {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; padding: 7px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}
.activity-item:last-child { border-bottom: none; }
.activity-item--err .activity-label { color: var(--red-500); }
.activity-label { color: var(--fg-1); font-weight: 500; flex: 1; }
.activity-time { font-size: 11.5px; color: var(--fg-3); white-space: nowrap; font-family: var(--font-mono); }

/* Version items */
.version-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 9px 0;
  border-bottom: 1px solid var(--border-light);
}
.version-item:last-child { border-bottom: none; }
.version-info { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.version-badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em;
  background: var(--accent-soft); color: var(--accent-press);
  border-radius: var(--r-sm); padding: 2px 7px; white-space: nowrap;
}
.version-meta { font-size: 12.5px; color: var(--fg-2); font-family: var(--font-mono); }
.version-restore-btn {
  border: 1px solid var(--border); background: var(--bg-surface);
  color: var(--fg-2); font-size: 11.5px; padding: 4px 12px;
  border-radius: var(--r-sm); cursor: pointer;
  font-family: var(--font); font-weight: 600;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
  white-space: nowrap;
}
.version-restore-btn:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-on); }
.version-restore-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.version-restore-btn--err { background: var(--red-600); border-color: var(--red-600); color: #fff; }

/* Wide panel — visuals, calendar: cap at 1240px so content never stretches absurdly */
.content-panel-wide { max-width: 1240px; }

/* ============================================================
   META ADS TAB
   ============================================================ */

.meta-ads-panel { max-width: 900px; }

.meta-section-title {
  font-size: var(--fs-xs); font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--fg-3);
  margin: 24px 0 12px;
  display: flex; align-items: center; gap: 8px;
}

.meta-hint {
  font-size: 10.5px; font-weight: 500; text-transform: none;
  letter-spacing: 0.03em; color: var(--fg-3);
  background: var(--stone-100);
  padding: 2px 8px; border-radius: var(--r-pill);
}

.meta-cards-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px; margin-bottom: 4px;
}
.meta-cards-row--2 { grid-template-columns: repeat(2, 1fr); }
.meta-cards-row--1 { grid-template-columns: 1fr; }

.meta-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t-fast);
}
.meta-card--loading { border-color: var(--accent); opacity: 0.7; }

.meta-card-label {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--fg-3);
}

.meta-card-text {
  font-size: 14px; color: var(--fg-1);
  line-height: 1.55; flex: 1; min-height: 40px;
}

@keyframes metaFlash {
  0%   { background: var(--accent-soft); }
  100% { background: transparent; }
}
.meta-text--flash { animation: metaFlash 0.5s ease-out; border-radius: var(--r-sm); }

.meta-card-actions { display: flex; gap: 8px; }

.meta-copy-btn,
.meta-regen-btn,
.google-copy-btn,
.google-regen-btn,
.instagram-copy-btn,
.instagram-regen-btn,
.seo-copy-btn,
.seo-regen-btn {
  padding: 5px 11px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  font-family: var(--font);
  font-size: var(--fs-xs); font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
  background: var(--bg-surface);
  color: var(--fg-2);
}
.meta-copy-btn:hover, .google-copy-btn:hover, .instagram-copy-btn:hover, .seo-copy-btn:hover { background: var(--bg-page); color: var(--fg-1); }
.meta-regen-btn:hover, .google-regen-btn:hover, .instagram-regen-btn:hover, .seo-regen-btn:hover {
  background: var(--accent-soft); color: var(--accent-press);
  border-color: var(--accent-soft-2);
}
.meta-copy-btn:disabled, .google-copy-btn:disabled, .instagram-copy-btn:disabled, .seo-copy-btn:disabled,
.meta-regen-btn:disabled, .google-regen-btn:disabled, .instagram-regen-btn:disabled, .seo-regen-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.meta-error {
  background: var(--err-bg);
  border: 1px solid #fecaca;
  color: var(--err-fg);
  border-radius: var(--r);
  padding: 12px 16px;
  font-size: var(--fs-sm);
  margin-bottom: 16px;
}

/* Meta/Google/Instagram/SEO — redesigned header as empty-state panel */
.meta-ads-panel {
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  max-width: 900px;
}

.meta-ads-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.meta-ads-title {
  font-size: 15px; font-weight: 700; margin: 0 0 3px; color: var(--fg-1);
}

.meta-ads-desc { font-size: 13px; color: var(--fg-2); margin: 0; }

#meta-content, #google-content, #instagram-content, #seo-content {
  padding: 20px 24px;
}

.meta-first-run {
  padding: 24px;
  font-size: 13.5px;
  color: var(--fg-3);
  border-top: 1px solid var(--border);
}
.meta-first-run p { margin: 0; }
.meta-first-run strong { color: var(--fg-2); }

.voice-match-note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--fg-3);
  padding: 8px 4px 0;
  border-top: 1px solid var(--stone-100);
  margin-top: 16px;
}
.voice-match-note::before { content: "✓"; color: var(--signal-500); font-weight: 700; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1024px) {
  .brand-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .app-shell { flex-direction: column; height: auto; overflow: auto; }
  .app-sidebar { width: 100%; min-width: unset; height: auto; }
  .app-main { height: auto; }
  .app-content { overflow: visible; }

  .brands-page { padding: 20px; }

  .brand-header {
    flex-direction: column;
    padding: 20px;
  }
  .brand-tab-panel { padding: 20px; }
  .brand-tabs { padding: 0 16px; }

  .meta-cards-row,
  .meta-cards-row--2 { grid-template-columns: 1fr; }
  .meta-ads-header { flex-direction: column; }
}

/* =============================================================
   G4 — Feedback bar (shared across all content tabs)
   ============================================================= */
.g4-feedback-bar {
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-2);
  border-radius: var(--r);
  padding: 10px 12px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.g4-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.g4-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 4px 12px;
  font-size: 12px;
  color: var(--fg-2);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

.g4-chip:hover {
  background: var(--accent);
  color: var(--accent-on);
  border-color: var(--accent);
}

.g4-input-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.g4-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 5px 10px;
  font-size: 13px;
  outline: none;
  background: var(--bg-surface);
  font-family: var(--font);
  color: var(--fg-1);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.g4-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.g4-go {
  background: var(--stone-900);
  color: var(--stone-50);
  border: none;
  border-radius: var(--r-sm);
  padding: 5px 14px;
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t-fast);
}

.g4-go:hover { background: var(--stone-800); }

.g4-skip {
  font-size: 12px;
  color: var(--fg-3);
  cursor: pointer;
  text-decoration: underline;
  white-space: nowrap;
}

/* ── G5: star button ──────────────────────────────────────────────────────── */

.g5-star-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: var(--stone-500);
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s, transform 0.1s;
}

.g5-star-btn:hover {
  color: var(--signal-400);
  transform: scale(1.15);
}

.g5-star-btn--active {
  color: var(--signal-400);
}

.g5-star-btn--active::before {
  content: "★";
}

.g5-star-btn--active {
  font-size: 0;
}

.g5-star-btn--active::before {
  font-size: 16px;
}

/* ── G5: voice library ────────────────────────────────────────────────────── */

.voice-library-hint {
  font-size: 12.5px;
  color: var(--fg-2);
  margin: -4px 0 12px;
}

.vlib-item {
  position: relative;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 8px 32px 8px 10px;
  margin-bottom: 8px;
  background: var(--stone-50);
}

.vlib-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--fg-3);
  margin-bottom: 3px;
}

.vlib-text {
  font-size: 12.5px;
  color: var(--fg-1);
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.vlib-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  color: var(--stone-600);
  line-height: 1;
  padding: 2px 4px;
  border-radius: 3px;
}

.vlib-remove:hover {
  color: var(--red-600);
  background: rgba(239, 68, 68, 0.08);
}

.g4-skip:hover { color: var(--fg-2); }

/* ── G6: Language selector ─────────────────────────────────────────────────── */
.lang-selector {
  position: relative;
  display: inline-flex;
}

.lang-selector-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--fg-1);
  cursor: pointer;
  white-space: nowrap;
}

.lang-selector-btn:hover {
  background: var(--stone-100);
  border-color: var(--border-strong);
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 200;
  min-width: 150px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  padding: 4px;
  display: none;
  flex-direction: column;
}

.lang-dropdown:not([hidden]) {
  display: flex;
}

.lang-option {
  display: block;
  width: 100%;
  padding: 7px 12px;
  text-align: left;
  background: none;
  border: none;
  border-radius: 5px;
  font-size: 13px;
  color: var(--fg-1);
  cursor: pointer;
}

.lang-option:hover {
  background: var(--bg-surface-2);
}

.lang-option--active {
  color: var(--accent-press);
  font-weight: 700;
}

/* G6: content language bar (inline, below tab bar) */
.content-lang-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-4);
  font-size: 12px;
  color: var(--fg-3);
}

.clb-label { white-space: nowrap; }

/* Conditional "generate" part — hidden by default via hidden attr */
.clb-generate-wrap {
  display: none;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.clb-generate-wrap:not([hidden]) { display: flex; }

.clb-sep { color: var(--fg-3); opacity: 0.6; }
.clb-hint { font-size: 11.5px; color: var(--fg-2); white-space: nowrap; }

.clb-generate-btn {
  padding: 3px 10px;
  background: var(--accent);
  border: none;
  border-radius: var(--r-sm);
  color: var(--accent-on);
  font-size: 11.5px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t-fast);
}
.clb-generate-btn:hover { background: var(--accent-hover); }
.clb-generate-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.clb-dismiss-btn {
  background: none;
  border: none;
  color: var(--fg-3);
  cursor: pointer;
  font-size: 13px;
  padding: 0 2px;
  line-height: 1;
}
.clb-dismiss-btn:hover { color: var(--fg-1); }

/* ========== H1: Logo picker ========== */

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
}

.sidebar-recent-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: 4px;
}

.logo-picker-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.logo-current-wrap {
  margin-bottom: 2px;
}

.logo-current-img {
  display: block;
  max-width: 100%;
  max-height: 64px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  background: var(--stone-50);
  border: 1px solid var(--stone-200);
  padding: 6px;
}

.logo-picker-hint {
  font-size: 13px;
  color: var(--fg-2);
  margin-bottom: 12px;
}

.logo-picker-status {
  font-size: 13px;
  color: var(--fg-3);
}

.logo-picker-status--err { color: var(--red-600); }

#logo-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.logo-candidate-btn {
  width: 72px;
  height: 72px;
  border: 2px solid var(--stone-200);
  border-radius: 10px;
  background: var(--stone-50);
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.logo-candidate-btn:hover {
  border-color: var(--signal-400);
}

.logo-candidate-btn--selected {
  border-color: var(--signal-500);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal-400) 30%, transparent);
}

.logo-candidate-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

/* ========== H2: Brand colors ========== */

.brand-header {
  transition: background 0.4s ease;
}

.brand-header[style*="--brand-primary"] {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--brand-primary) 12%, var(--bg-surface)) 0%,
    var(--bg-surface) 60%
  );
}

.brand-color-swatches {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  align-items: center;
}

.brand-color-swatch {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,0.12);
  cursor: default;
  flex-shrink: 0;
}

/* ── Brand palette card (Overview sidebar) ─────────────── */
.palette-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.palette-swatch-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.palette-swatch {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.08);
  cursor: pointer;
  transition: transform 0.1s;
  flex-shrink: 0;
}
.palette-swatch:hover { transform: scale(1.06); }
.palette-swatch-hex {
  font-size: 10px;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.palette-empty {
  font-size: 13px;
  color: var(--fg-3);
}

/* ========== Phase I1 + P2.6: Posting Calendar ========== */

/* Two-column inline layout */
.cal-two-col {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .cal-two-col {
    grid-template-columns: 1fr;
  }
}

.cal-col-left {
  min-width: 0;
}

.cal-col-right {
  min-width: 0;
}

.cal-upcoming-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
}

/* Notes */
.cal-notes-section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--stone-100);
}

.cal-note-input-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.cal-note-input {
  flex: 1;
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-1);
  background: var(--bg-surface);
  color: var(--fg-1);
  font-family: inherit;
}

.cal-note-input:focus {
  outline: 2px solid var(--signal-400);
  outline-offset: 1px;
  border-color: transparent;
}

.cal-note-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 5px 0;
  border-bottom: 1px solid var(--stone-50);
  font-size: 13px;
}

.cal-note-item:last-child {
  border-bottom: none;
}

.cal-note-text {
  flex: 1;
  color: var(--fg-1);
  line-height: 1.4;
}

.cal-note-del-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--fg-3);
  font-size: 11px;
  padding: 2px 4px;
  border-radius: var(--r-1);
  line-height: 1;
}

.cal-note-del-btn:hover {
  background: var(--stone-100);
  color: var(--fg-1);
}

/* Note dot on calendar day — inline in dot-row */
.calendar-day-note-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--signal-400);
  flex-shrink: 0;
}

.calendar-day-cell {
  position: relative;
}

/* Calendar modal (kept for reference, not used in inline mode) */
.calendar-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
}

.calendar-modal:not([hidden]) {
  display: flex;
}

.calendar-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

dialog#calendar-modal {
  border: none;
  background: transparent;
  padding: 0;
  max-width: min(960px, 96vw);
  width: 100%;
  max-height: 90vh;
  overflow: visible;
  border-radius: var(--r-2);
}
dialog#calendar-modal::backdrop {
  background: rgba(42, 32, 20, 0.45);
  backdrop-filter: blur(2px);
}

.calendar-modal-dialog {
  position: relative;
  background: var(--bg-surface);
  border-radius: var(--r-2);
  border: 1px solid var(--border);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: var(--sp-5);
}

.calendar-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}

.calendar-modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--fg-1);
  margin: 0 0 3px;
}

.calendar-modal-desc {
  font-size: 0.82rem;
  color: var(--fg-2);
  margin: 0;
}

.calendar-modal-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r-1);
  padding: 5px;
  cursor: pointer;
  color: var(--fg-3);
  line-height: 1;
}

.calendar-modal-close:hover {
  background: var(--stone-100);
  color: var(--fg-1);
}

/* Last posted banner */
.calendar-last-posted-banner {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-last-posted-banner--good {
  background: rgba(5, 150, 105, 0.06);
  color: var(--green-600);
  border: 1px solid rgba(5, 150, 105, 0.25);
}

.calendar-last-posted-banner--ok {
  background: var(--accent-soft);
  color: var(--accent-press);
  border: 1px solid var(--accent-soft-2);
}

.calendar-last-posted-banner--gentle {
  background: var(--warn-bg);
  color: var(--warn-fg);
  border: 1px solid var(--warn-bd);
}

.calendar-last-posted-banner--nudge {
  background: var(--accent-soft);
  color: var(--accent-press);
  border: 1px solid var(--accent-soft-2);
  font-weight: 600;
}

/* Navigation */
.calendar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.calendar-month-label {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.025em;
  min-width: 130px;
  text-align: center;
  color: var(--fg-1);
}

/* Arrow nav buttons — square dark pills */
#calendar-prev-btn,
#calendar-next-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: var(--r-sm);
  flex-shrink: 0;
}

/* Today button — wide pill */
#calendar-today-btn {
  border-radius: var(--r-pill);
  padding: 7px 14px;
  font-size: 12.5px;
}

.btn-sm {
  font-size: 0.78rem;
  padding: 4px 12px;
  min-height: 30px;
}

/* Calendar grid */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 16px;
}

.calendar-day-header {
  text-align: center;
  font-size: 10px;
  font-weight: 800;
  color: var(--fg-3);
  padding: 6px 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.calendar-day-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 1px solid var(--border-light);
  border-radius: var(--r-sm);
  background: var(--bg-surface);
  padding: 7px 9px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background var(--t-fast);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg-1);
  min-height: 40px;
}

.calendar-day-cell:hover {
  background: var(--bg-surface-2);
}

.calendar-day-cell--empty {
  background: transparent;
  border-color: transparent;
  cursor: default;
  color: transparent;
}

.calendar-day-cell--empty:hover {
  background: transparent;
}

.calendar-day-cell--weekend {
  color: var(--fg-3);
}

.calendar-day-cell--today {
  border: 2px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent-press);
  font-weight: 800;
}

.calendar-day-cell--today:hover {
  background: var(--signal-100);
}

.calendar-day-cell--selected {
  background: var(--accent-soft);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.calendar-day-cell--selected:hover {
  background: var(--accent-soft-2);
}

.calendar-day-cell--has-posts {
  font-weight: 700;
}

.calendar-day-number {
  line-height: 1;
}

/* Dots row at bottom of cell */
.calendar-dot-row {
  margin-top: auto;
  display: flex;
  gap: 3px;
  align-items: center;
}

.calendar-day-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* Day detail panel */
.calendar-day-detail {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.calendar-day-detail-title {
  font-size: 0.92rem;
  font-weight: 600;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.calendar-post-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.calendar-post-item:last-child {
  border-bottom: none;
}

.calendar-post-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.calendar-post-type {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.calendar-post-time {
  font-size: 0.72rem;
  color: var(--fg-3);
}

.calendar-post-text {
  font-size: 0.82rem;
  color: var(--fg-2);
  line-height: 1.4;
  margin-bottom: 6px;
}

.calendar-post-actions {
  display: flex;
  gap: 6px;
}

.calendar-unpost-btn {
  font-size: 0.72rem;
  padding: 2px 10px;
  border-radius: 6px;
  border: 1px solid var(--red-500);
  color: var(--red-600);
  background: transparent;
  cursor: pointer;
  transition: background 0.1s;
}

.calendar-unpost-btn:hover {
  background: var(--err-bg);
}

/* Empty / loading states */
.calendar-loading,
.calendar-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--fg-3);
  font-size: 0.85rem;
}

.calendar-empty-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

/* ========== Phase I3: Inactivity nudge banner ========== */

.i3-nudge-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--accent-soft-2);
  font-size: 0.85rem;
  color: var(--accent-press);
  flex-shrink: 0;
}

.i3-nudge-text {
  flex: 1;
  font-weight: 500;
}

.i3-nudge-dismiss {
  background: none;
  border: none;
  font-size: 14px;
  color: var(--accent-press);
  cursor: pointer;
  opacity: 0.6;
  padding: 2px 4px;
  line-height: 1;
}

.i3-nudge-dismiss:hover {
  opacity: 1;
}

/* ========== Phase I4: "Open in Instagram" deep link buttons ========== */

.i4-deep-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--fg-1);
  cursor: pointer;
  transition: background 0.1s;
}

.i4-deep-link-btn:hover {
  background: var(--stone-100);
}

.i4-posted-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--green-500);
  background: rgba(5, 150, 105, 0.06);
  color: var(--green-600);
  cursor: pointer;
  transition: background 0.1s;
}

.i4-posted-btn:hover {
  background: rgba(5, 150, 105, 0.12);
}

.i4-posted-btn--active {
  background: rgba(5, 150, 105, 0.12);
  border-color: var(--green-600);
  font-weight: 500;
}

/* ── O3: Collaborator first-visit welcome card ─────────────── */
.collab-welcome-card {
  margin: var(--sp-4) 0;
  background: var(--bg-surface);
  border: 1px solid var(--stone-200);
  border-left: 3px solid var(--stone-400);
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-6);
}
.collab-welcome-inner { max-width: 560px; }
.collab-welcome-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 6px;
}
.collab-welcome-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--stone-900);
  margin: 0 0 6px;
  line-height: 1.4;
}
.collab-welcome-body {
  font-size: 14px;
  color: var(--fg-2);
  line-height: 1.6;
  margin: 0 0 14px;
}
.collab-welcome-dismiss {
  font-size: 13px;
  font-weight: 600;
  color: var(--stone-600);
  background: var(--bg-muted);
  border: 1px solid var(--stone-200);
  border-radius: 6px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.12s;
}
.collab-welcome-dismiss:hover { background: var(--stone-100); }

/* ── J3: First-brand welcome card ─────────────────────────── */
.first-brand-welcome {
  margin: var(--sp-4) 0;
  background: var(--signal-50);
  border: 1px solid var(--signal-100);
  border-left: 3px solid var(--signal-400);
  border-radius: var(--r-lg);
  padding: var(--sp-6) var(--sp-8);
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.25s ease, margin 0.35s ease, padding 0.35s ease;
}
.first-brand-welcome.fbw-dismissing {
  max-height: 0 !important;
  opacity: 0;
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
}
.fbw-step { display: none; }
.fbw-step--active { display: block; }

.fbw-dots {
  display: flex; gap: 6px; align-items: center; margin-bottom: var(--sp-4);
}
.fbw-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--signal-100);
  transition: background 0.2s;
}
.fbw-dot--active { background: var(--signal-400); }

.fbw-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--signal-600);
  margin-bottom: var(--sp-1);
}
.fbw-title {
  font-size: 18px; font-weight: 900; letter-spacing: -0.02em;
  color: var(--stone-900); margin-bottom: var(--sp-2);
  line-height: 1.2;
}
.fbw-body {
  font-size: 14px; color: var(--stone-600); line-height: 1.6;
  margin-bottom: var(--sp-4);
}
.fbw-highlight {
  font-size: 14px; color: var(--stone-700);
  background: var(--bg-surface); border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--stone-200);
  margin-bottom: var(--sp-4);
  line-height: 1.65;
}
.fbw-kit-items {
  display: flex; gap: var(--sp-2); flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}
.fbw-kit-item {
  background: var(--bg-surface); border: 1px solid var(--stone-200);
  border-radius: var(--r-md); padding: 5px 12px;
  font-size: 12.5px; font-weight: 600; color: var(--stone-700);
}
.fbw-actions {
  display: flex; gap: var(--sp-3); align-items: center;
}
.fbw-btn-ghost {
  background: none; border: none; font-family: var(--font-sans);
  font-size: 13px; color: var(--stone-600); cursor: pointer; padding: 0;
  transition: color 0.12s;
}
.fbw-btn-ghost:hover { color: var(--stone-900); }
.fbw-btn-primary {
  background: var(--signal-400); color: var(--stone-900);
  border: none; border-radius: var(--r-md); padding: 8px 16px;
  font-family: var(--font-sans); font-size: 13px; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 0 var(--signal-600) inset;
  transition: background 0.12s;
}
.fbw-btn-primary:hover { background: var(--signal-500); }

/* ── Phase K — Instagram posting + scheduling ─────────────────────────────── */

/* W3.3: demo brand banner */
.demo-brand-banner {
  display: flex; align-items: center; gap: 10px;
  background: #f0f9ff; border: 1px solid #bae6fd;
  color: #0c4a6e; border-radius: var(--r-md);
  padding: 10px 14px; font-size: 13px; margin-bottom: var(--sp-4);
}
.demo-brand-banner-cta {
  margin-left: auto; color: #0369a1; font-weight: 700;
  text-decoration: none; white-space: nowrap;
}
.demo-brand-banner-cta:hover { text-decoration: underline; }

/* K3: failed scheduled posts banner */
.sched-fail-banner {
  display: flex; align-items: center; gap: 8px;
  background: #fff7ed; border: 1px solid #fed7aa;
  color: #9a3412; border-radius: var(--r-md);
  padding: 8px 12px; font-size: 12.5px; margin-bottom: var(--sp-4);
}
.sched-fail-banner a { color: #9a3412; font-weight: 600; margin-left: 4px; }
.sched-fail-banner a:hover { text-decoration: underline; }
.sched-fail-dismiss {
  margin-left: auto; background: none; border: none;
  cursor: pointer; color: #9a3412; font-size: 13px; line-height: 1; padding: 0 2px;
}

/* K2: Post to Instagram button (secondary, sits alongside other card actions) */
.ig-post-btn {
  font-size: 11px; font-weight: 600; padding: 4px 10px;
  border: 1px solid var(--stone-300); border-radius: var(--r-sm);
  background: var(--bg-surface); color: var(--fg-1); cursor: pointer;
  font-family: var(--font-sans); transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.ig-post-btn:hover { background: var(--stone-100); border-color: var(--stone-400); }

/* K2: Post panel (inline below caption card) */
.ig-post-panel {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 14px 16px;
  margin-top: 8px; margin-bottom: 8px;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.ig-post-panel--success {
  background: #f0fdf4; border-color: #bbf7d0; color: #166534;
  flex-direction: row; align-items: center; gap: 10px;
  box-shadow: 0 0 0 2px #bbf7d0;
}
.ig-post-panel--success a { color: #166534; font-weight: 600; margin-left: 6px; }
.ig-success-icon { font-size: 18px; }

.ig-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; color: var(--fg-2);
}
.ig-panel-header strong { color: var(--fg-1); }
.ig-panel-close {
  background: none; border: none; cursor: pointer;
  color: var(--fg-3); font-size: 13px; padding: 0 2px; line-height: 1;
}
.ig-panel-close:hover { color: var(--fg-1); }

.ig-panel-preview {
  font-size: 12px; color: var(--fg-2); background: var(--stone-50);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 8px 10px; line-height: 1.5;
}

/* Image picker */
.ig-image-picker { display: flex; flex-direction: column; gap: 6px; }
.ig-panel-label { font-size: 11px; color: var(--fg-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.ig-image-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.ig-image-thumb {
  width: 56px; height: 56px; border-radius: var(--r-sm);
  border: 2px solid var(--stone-200); background-size: cover; background-position: center;
  cursor: pointer; transition: border-color 0.12s;
  flex-shrink: 0;
}
.ig-image-thumb:hover { border-color: var(--stone-400); }
.ig-image-thumb--selected { border-color: var(--signal-400); box-shadow: 0 0 0 1px var(--signal-400); }

.ig-panel-no-image { font-size: 12px; color: var(--fg-3); font-style: italic; }

/* Schedule toggle */
.ig-schedule-toggle {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--fg-2); cursor: pointer;
}
.ig-schedule-toggle input[type="checkbox"] { cursor: pointer; }
.ig-datetime-input {
  font-family: var(--font-sans); font-size: 12.5px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 5px 8px; background: var(--bg-surface); color: var(--fg-1);
  width: 100%;
}
.ig-datetime-input:focus { outline: 2px solid var(--signal-400); outline-offset: 1px; }

/* Panel action row */
.ig-panel-actions { display: flex; gap: 8px; align-items: center; }
.ig-panel-cancel {
  background: none; border: 1px solid var(--stone-200);
  border-radius: var(--r-sm); padding: 5px 12px;
  font-size: 12px; color: var(--fg-2); cursor: pointer;
  font-family: var(--font-sans);
}
.ig-panel-cancel:hover { border-color: var(--stone-300); color: var(--fg-1); }
.ig-panel-confirm {
  background: var(--stone-900); color: #fff;
  border: none; border-radius: var(--r-sm); padding: 6px 14px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  font-family: var(--font-sans); transition: background 0.12s;
}
.ig-panel-confirm:hover { background: var(--stone-700); }
.ig-panel-confirm:disabled { opacity: 0.5; cursor: default; }
.ig-panel-error { font-size: 12px; color: #b91c1c; background: #fef2f2; border-radius: var(--r-sm); padding: 6px 8px; }

/* K3: Calendar tab sections */
.cal-section-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--fg-3);
  padding: 10px 0 6px; margin-top: 6px;
}
.cal-tab-post-row--scheduled { border-left: 3px solid var(--stone-400); padding-left: 10px; }
.cal-tab-post-row--failed { border-left: 3px solid #ef4444; padding-left: 10px; }
.cal-sched-status { font-size: 11px; font-weight: 600; color: var(--fg-2); }
.cal-sched-status--failed { color: #b91c1c; }
.cal-sched-actions { display: flex; gap: 6px; margin-top: 4px; }
.cal-sched-cancel-btn {
  font-size: 11px; padding: 3px 8px; border-radius: var(--r-sm);
  border: 1px solid #fecaca; background: #fff; color: #b91c1c; cursor: pointer;
  font-family: var(--font-sans);
}
.cal-sched-cancel-btn:hover { background: #fef2f2; }
.cal-sched-retry-btn {
  font-size: 11px; padding: 3px 8px; border-radius: var(--r-sm);
  border: 1px solid var(--stone-200); background: #fff; color: var(--fg-2);
  cursor: pointer; font-family: var(--font-sans); text-decoration: none;
}
.cal-sched-retry-btn:hover { border-color: var(--stone-400); color: var(--fg-1); }

/* L2: upgrade banner on brands page */
.upgrade-banner {
  display: flex; align-items: center; gap: 12px;
  background: var(--signal-50); border: 1px solid var(--signal-100);
  border-radius: var(--r-md); padding: 12px 16px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.upgrade-banner-icon { font-size: 18px; flex-shrink: 0; }
.upgrade-banner-body { flex: 1; font-size: 13.5px; color: var(--stone-700); }
.upgrade-banner-body strong { color: var(--stone-900); }
.upgrade-banner-cta {
  font-size: 13px; font-weight: 700; letter-spacing: -0.01em;
  background: var(--signal-400); color: var(--stone-900);
  padding: 7px 16px; border-radius: var(--r-sm); text-decoration: none;
  box-shadow: 0 1px 0 var(--signal-600) inset; white-space: nowrap;
  transition: background 0.12s;
}
.upgrade-banner-cta:hover { background: var(--signal-500); }

/* M1: Inline profile field editor */
.profile-edit-hint {
  font-size: 12px; font-weight: 400; color: var(--stone-500); letter-spacing: 0; margin-left: 2px;
}
.profile-dl {
  display: grid;
  grid-template-columns: 120px 1fr;
  column-gap: 12px;
  row-gap: 7px;
  align-items: start;
  margin: 0;
}
.profile-dl dt {
  display: flex; align-items: flex-start; gap: 4px; flex-wrap: wrap;
  margin: 0; padding-top: 3px;
  font-size: 12px; font-weight: 600; color: var(--stone-500);
  line-height: 1.4;
}
.profile-dl dd { margin: 0; }
.profile-editable {
  display: block; min-height: 1.4em;
  border-radius: var(--r-sm); padding: 2px 5px; margin: -2px -5px;
  cursor: text; transition: background 0.12s, outline 0.12s;
  outline: 2px solid transparent; white-space: pre-wrap; word-break: break-word;
}
.profile-editable:hover { background: var(--stone-100); }
.profile-editable:focus {
  background: var(--bg-surface); outline: 2px solid var(--signal-400); outline-offset: 0;
}
.profile-editable--list:not(:focus) { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.profile-editable--list:focus { display: block; }
.profile-placeholder { color: var(--stone-500); }
.field-edited-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--stone-400); background: var(--stone-100);
  padding: 1px 5px; border-radius: var(--r-sm);
}
.profile-save-indicator {
  font-size: 11px; font-weight: 600; margin-left: auto;
  opacity: 0; transition: opacity 0.2s; pointer-events: none;
}
.profile-save-indicator--visible { opacity: 1; }
.profile-save-indicator--ok { color: #16a34a; }
.profile-save-indicator--err { color: #dc2626; }
.pill--taboo { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.btn-destructive {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 7px 14px; border-radius: var(--r-sm); border: 1px solid #fecaca;
  background: #fff; color: #b91c1c; font-size: 13px; font-weight: 500;
  font-family: var(--font-sans); cursor: pointer; transition: background 0.12s;
}
.btn-destructive:hover { background: #fef2f2; }

/* M3: Taboo word warning banner */
.taboo-warning {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #fffbeb; border: 1px solid #fde68a;
  border-radius: var(--r-sm); padding: 10px 14px;
  margin-bottom: 14px; font-size: 13px; color: var(--stone-700);
}
.taboo-warning-msg { flex: 1; }
.taboo-warning-msg strong { color: #92400e; }
.taboo-warning-actions { display: flex; gap: 6px; flex-shrink: 0; }
.taboo-regen-btn {
  font-size: 12px; font-weight: 600; padding: 3px 10px;
  border-radius: var(--r-sm); border: 1px solid #fbbf24;
  background: #fef3c7; color: #92400e; cursor: pointer;
  font-family: var(--font-sans); transition: background 0.12s;
}
.taboo-regen-btn:hover { background: #fde68a; }
.taboo-dismiss-btn {
  font-size: 14px; font-weight: 700; padding: 2px 7px;
  border-radius: var(--r-sm); border: none; background: transparent;
  color: #a16207; cursor: pointer; line-height: 1;
}
.taboo-dismiss-btn:hover { background: #fde68a; }

/* ── Phase N: Reels tab (N1) ──────────────────────────────────────────────── */

.reels-shot-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.reel-shot-card {
  border: 1px solid var(--stone-200);
  border-radius: var(--r-md);
  padding: 16px;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reel-shot-num {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--fg-3);
}

.reel-shot-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reel-shot-row {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 8px;
  align-items: start;
  font-size: 13px;
}

.reel-shot-label {
  color: var(--fg-3);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.reel-shot-value {
  color: var(--fg-1);
  line-height: 1.4;
}

.reel-shot-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Phase N: Shot of the day (N2) ───────────────────────────────────────── */

.shot-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.shot-card-header h2 {
  margin: 0;
}

.shot-idea {
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg-1);
  margin: 0 0 8px;
}

.shot-light,
.shot-hook {
  font-size: 12px;
  color: var(--fg-3);
  margin: 0 0 6px;
  display: flex;
  align-items: flex-start;
  gap: 5px;
}

.shot-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.shot-empty {
  font-size: 13px;
  color: var(--fg-3);
  margin: 4px 0 0;
}

.btn-sm {
  font-size: 12px;
  padding: 4px 10px;
}

/* ── Phase O: Collaborators card ─────────────────────────────────────────── */

.collab-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--stone-100);
  font-size: 13px;
}
.collab-row:last-child { border-bottom: none; }
.collab-email { flex: 1; color: var(--fg-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.collab-badge {
  font-size: 11px; font-weight: 700; padding: 2px 7px;
  border-radius: 999px; background: var(--stone-100); color: var(--fg-3);
  flex-shrink: 0;
}
.collab-badge--owner { background: var(--stone-900); color: #fff; }
.collab-badge--pending { background: var(--signal-50, #fefae0); color: var(--signal-600, #c79c00); }
.collab-remove-btn {
  background: none; border: none; cursor: pointer; color: var(--fg-3);
  font-size: 12px; padding: 2px 5px; border-radius: 4px; flex-shrink: 0;
}
.collab-remove-btn:hover { background: var(--stone-100); color: var(--fg-1); }

/* O2: Activity actor */
.activity-actor {
  font-size: 11px; font-weight: 700; color: var(--fg-3);
  margin-right: 2px;
}

/* ── Accessibility utility ──────────────────────────────── */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Content Wizard ─────────────────────────────────────── */
.wizard-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(860px, 96vw);
  max-height: 92vh;
  border: none;
  border-radius: 16px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.28);
  background: #fff;
}
.wizard-dialog::backdrop {
  background: rgba(0,0,0,0.48);
  backdrop-filter: blur(3px);
}
.wizard-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 92vh;
}
.wizard-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--stone-200);
  flex-shrink: 0;
}
.wizard-step-title {
  flex: 1;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--stone-900);
  margin: 0;
}
.wizard-steps-indicator {
  display: flex;
  gap: 7px;
  align-items: center;
}
.wizard-step-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--stone-200);
  transition: background 0.2s, transform 0.2s;
}
.wizard-step-dot.active  { background: var(--signal-400); transform: scale(1.25); }
.wizard-step-dot.done    { background: var(--stone-400); }
.wizard-close-btn {
  width: 28px; height: 28px;
  border: none; background: none; cursor: pointer;
  color: var(--stone-600); font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  transition: background 0.12s, color 0.12s;
  font-family: inherit;
  flex-shrink: 0;
}
.wizard-close-btn:hover { background: var(--stone-100); color: var(--stone-700); }

.wizard-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 20px;
}
.wizard-step-lead {
  font-size: 13px;
  color: var(--fg-2);
  margin: 0 0 16px;
}
.wizard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--stone-200);
  flex-shrink: 0;
}
.wizard-footer-extra {
  display: flex;
  gap: 8px;
}

/* ── Step 1: Angles ─────── */
.wizard-angles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.wizard-angle-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 18px 12px;
  border: 2px solid var(--stone-200);
  border-radius: 12px;
  background: var(--bg-surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  font-family: var(--font);
  text-align: center;
}
.wizard-angle-btn:hover {
  border-color: var(--signal-300);
  background: var(--signal-50);
}
.wizard-angle-btn.selected {
  border-color: var(--signal-400);
  background: var(--signal-50);
  box-shadow: 0 0 0 3px var(--signal-100);
}
.wizard-angle-icon { font-size: 26px; line-height: 1; }
.wizard-angle-label { font-size: 12px; font-weight: 700; color: var(--stone-800); letter-spacing: -0.01em; }

/* ── Step 2: Copy variations ─ */
.wizard-copy-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 0;
  color: var(--stone-500);
  font-size: 13px;
}
.wizard-spinner {
  width: 30px; height: 30px;
  border: 3px solid var(--stone-200);
  border-top-color: var(--signal-400);
  border-radius: 50%;
  animation: wiz-spin 0.75s linear infinite;
}
@keyframes wiz-spin { to { transform: rotate(360deg); } }

.wizard-copy-error {
  font-size: 13px;
  color: var(--red-600);
  background: color-mix(in srgb, var(--red-600) 6%, var(--bg-surface));
  border: 1px solid color-mix(in srgb, var(--red-600) 22%, var(--bg-surface));
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.wizard-variations {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* Ensure [hidden] wins over flex display on wizard elements */
.wizard-copy-loading[hidden],
.wizard-variations[hidden],
.wizard-canvas-wrap[hidden],
.wizard-footer-extra[hidden] { display: none !important; }

.wizard-variation {
  display: flex;
  gap: 12px;
  border: 2px solid var(--stone-200);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--bg-surface);
  outline: none;
}
.wizard-variation:hover  { border-color: var(--signal-300); background: var(--signal-50); }
.wizard-variation.selected {
  border-color: var(--signal-400);
  background: var(--signal-50);
  box-shadow: 0 0 0 3px var(--signal-100);
}
.wizard-variation-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--stone-100);
  color: var(--stone-500);
  font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 2px;
}
.wizard-variation.selected .wizard-variation-num {
  background: var(--signal-400);
  color: var(--stone-900);
}
.wizard-variation-body { flex: 1; }
.wizard-variation-headline  { font-size: 15px; font-weight: 800; color: var(--stone-900); margin-bottom: 3px; letter-spacing: -0.01em; }
.wizard-variation-supporting { font-size: 13px; color: var(--stone-600); margin-bottom: 8px; line-height: 1.5; }
.wizard-variation-cta {
  display: inline-block;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--signal-700, #a07200);
  background: var(--signal-50);
  border: 1px solid var(--signal-100);
  padding: 2px 9px; border-radius: 999px;
}

/* ── Step 3: Visual ─────── */
.wizard-no-images {
  font-size: 13px; color: var(--fg-3);
  grid-column: 1 / -1; margin: 0;
}
.wizard-img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}
.wizard-img-item {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--stone-200);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: var(--stone-100);
}
.wizard-img-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wizard-img-item:hover  { border-color: var(--signal-300); }
.wizard-img-item.selected { border-color: var(--signal-400); box-shadow: 0 0 0 3px var(--signal-100); }

.wizard-img-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-style: dashed;
  border-color: var(--stone-300);
  background: var(--bg-surface);
}
.wizard-upload-plus  { font-size: 20px; color: var(--stone-500); line-height: 1; }
.wizard-upload-label { font-size: 11px; font-weight: 600; color: var(--stone-500); }

.wizard-canvas-wrap {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--stone-200);
  background: var(--stone-100);
}
.wizard-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
}
.wizard-canvas-hint {
  font-size: 12px;
  color: var(--fg-3);
  margin-top: 8px;
  text-align: center;
}

/* ── Step 3: copy editor ─── */
.wizard-copy-editor {
  background: var(--stone-50);
  border: 1px solid var(--stone-200);
  border-radius: 10px;
  padding: 10px 12px;
}
.wizard-copy-editor-lead {
  font-size: 12px;
  color: var(--fg-3);
  margin: 0 0 8px;
}
.wizard-copy-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wizard-copy-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wizard-copy-field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.wizard-copy-field-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--stone-500);
}
.wizard-copy-field-sizes {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}
.wizard-copy-field-sizes .wizard-size-btn {
  padding: 2px 7px;
  font-size: 10px;
}
.wizard-copy-input {
  width: 100%;
  padding: 7px 10px;
  font-size: 13px;
  font-family: var(--font);
  border: 1px solid var(--stone-300);
  border-radius: 7px;
  background: var(--bg-surface);
  color: var(--stone-900);
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.wizard-copy-input:focus {
  border-color: var(--signal-400);
  box-shadow: 0 0 0 3px var(--signal-50);
}
.wizard-copy-input--short { max-width: 200px; }

.wizard-caption-textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 13px;
  font-family: var(--font);
  border: 1px solid var(--stone-200);
  border-radius: 8px;
  background: var(--stone-50);
  color: var(--stone-700);
  line-height: 1.6;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
}

/* ── Step 3: split layout ──────────────────── */
.wizard-step--split {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  min-height: 0;
}
.wizard-ctrl {
  flex: 0 0 260px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.wizard-prev {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 0;
  min-width: 0;
}

.wizard-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--stone-500);
  margin: 0 0 4px;
}

/* Size picker */
.wizard-size-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.wizard-size-btn {
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font);
  border: 1.5px solid var(--stone-200);
  border-radius: 6px;
  background: var(--bg-surface);
  cursor: pointer;
  color: var(--stone-600);
  transition: border-color 0.12s, background 0.12s, color 0.12s;
  white-space: nowrap;
}
.wizard-size-btn:hover { border-color: var(--signal-300); }
.wizard-size-btn.selected {
  border-color: var(--signal-400);
  background: var(--signal-50);
  color: var(--stone-900);
  box-shadow: 0 0 0 3px var(--signal-100);
}

/* Compact image grid inside left panel */
.wizard-ctrl .wizard-img-grid {
  grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  gap: 5px;
  margin-bottom: 0;
}

/* Retry button */
.wizard-retry-btn {
  font-size: 12px;
  display: block;
  margin-top: 20px;
}

/* Variations list — give cards a proper gap */
.wizard-variations {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
