/* Studio — Motion-clone UI in Editorial Workshop theme (DESIGN.md) */

/* ── Fonts ──────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700;9..144,800&family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap');

/* ── Design tokens (DESIGN.md) ──────────────────────────────── */
:root {
  /* Ink & Bone — structure */
  --ink-0: #0B0907;
  --ink-1: #12100E;
  --ink-2: #1C1915;
  --ink-3: #28241E;
  --ink-4: #362F27;
  --rule: #3A342B;
  --rule-strong: #4D453A;
  --bone-0: #FBF8F0;
  --bone-1: #EDE6D7;
  --bone-2: #C4BAA3;
  --bone-3: #8F8670;
  --bone-4: #645C4C;

  /* Brick — the only accent */
  --brick-0: #D45A52;
  --brick-1: #B8413A;
  --brick-2: #8F2D27;
  --brick-ink: #3A1510;
  --brick-wash: rgba(184, 65, 58, 0.10);
  --brick-rule: rgba(184, 65, 58, 0.32);

  /* Format typology */
  --format-static: #6B8EAD;
  --format-video: #C8872E;
  --format-creator: #A8555E;

  /* Semantic */
  --moss: #6B9460;
  --moss-wash: rgba(107, 148, 96, 0.14);
  --amber: #C8872E;
  --amber-wash: rgba(200, 135, 46, 0.14);
  --rust: #C85A3C;
  --rust-wash: rgba(200, 90, 60, 0.14);
  --slate: #7A8A9C;
  --slate-wash: rgba(122, 138, 156, 0.14);

  /* Spacing (4px base) */
  --s-2: 2px; --s-4: 4px; --s-6: 6px; --s-8: 8px;
  --s-12: 12px; --s-16: 16px; --s-20: 20px; --s-24: 24px;
  --s-32: 32px; --s-48: 48px; --s-64: 64px; --s-96: 96px;

  /* Radius */
  --r-sharp: 2px; --r-sm: 4px; --r-md: 6px; --r-lg: 10px; --r-pill: 999px;

  /* Layout */
  --rail-w: 44px;
  --sidebar-w: 240px;

  /* Typography */
  --ff-display: 'Fraunces', Georgia, serif;
  --ff-body: 'Geist', -apple-system, system-ui, sans-serif;
  --ff-mono: 'Geist Mono', 'SF Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
.hidden { display: none !important; }

body {
  font-family: var(--ff-body);
  font-size: 14px;
  line-height: 1.57;
  color: var(--bone-1);
  background: var(--ink-0);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ── App shell ─────────────────────────────────────────────── */
#studio-root {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* Edge rail (narrow icon strip) */
.s-rail {
  width: var(--rail-w);
  min-width: var(--rail-w);
  background: var(--ink-0);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--s-12) 0;
  gap: var(--s-4);
  z-index: 10;
}

.s-rail-logo {
  width: 28px; height: 28px;
  margin-bottom: var(--s-12);
  display: flex; align-items: center; justify-content: center;
  color: var(--brick-1);
  font-family: var(--ff-display);
  font-size: 18px;
  font-weight: 700;
}

.s-rail-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent;
  color: var(--bone-3);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}
.s-rail-btn:hover { background: var(--ink-3); color: var(--bone-1); }
.s-rail-btn.active { background: var(--brick-wash); color: var(--brick-1); }
.s-rail-btn svg { width: 18px; height: 18px; }

.s-rail-spacer { flex: 1; }

.s-rail-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--brick-1);
  color: var(--bone-0);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--ff-mono);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

/* Sidebar panel */
.s-sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--ink-1);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Brand switcher pill (top of sidebar) */
.s-brand-pill {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  padding: var(--s-12) var(--s-16);
  cursor: pointer;
  border-bottom: 1px solid var(--rule);
  transition: background 0.12s ease;
}
.s-brand-pill:hover { background: var(--ink-2); }

.s-brand-avatar {
  width: 24px; height: 24px;
  border-radius: var(--r-sm);
  background: var(--moss);
  color: var(--ink-0);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--ff-mono);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.s-brand-name {
  flex: 1;
  font-weight: 600;
  font-size: 13px;
  color: var(--bone-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.s-brand-chevron {
  color: var(--bone-3);
  font-size: 10px;
  flex-shrink: 0;
}

/* Brand dropdown */
.brand-dropdown {
  position: absolute;
  top: 54px;
  left: var(--rail-w);
  width: 280px;
  background: var(--ink-2);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  z-index: 50;
  overflow: hidden;
}

.brand-search {
  width: 100%;
  background: var(--ink-3);
  border: none;
  border-bottom: 1px solid var(--rule);
  color: var(--bone-1);
  font-family: var(--ff-body);
  font-size: 13px;
  padding: var(--s-12) var(--s-16);
  outline: none;
}
.brand-search::placeholder { color: var(--bone-4); }

.brand-list {
  max-height: 320px;
  overflow-y: auto;
  padding: var(--s-4) 0;
}

.brand-option {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  width: 100%;
  background: none;
  border: none;
  color: var(--bone-2);
  font-family: var(--ff-body);
  font-size: 13px;
  padding: var(--s-8) var(--s-12);
  cursor: pointer;
  text-align: left;
  transition: background 0.1s ease;
}
.brand-option:hover { background: var(--ink-3); color: var(--bone-1); }
.brand-option.active { color: var(--bone-0); font-weight: 500; }

.brand-avatar.small {
  width: 22px; height: 22px;
  font-size: 10px;
  border-radius: var(--r-sm);
  background: var(--moss);
  color: var(--ink-0);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--ff-mono);
  font-weight: 700;
  flex-shrink: 0;
}

.checkmark {
  margin-left: auto;
  color: var(--brick-1);
}

.brand-dropdown-footer {
  border-top: 1px solid var(--rule);
  padding: var(--s-4);
}

/* Sidebar nav items */
.s-nav {
  padding: var(--s-8) 0;
  flex: 1;
  overflow-y: auto;
}

.s-nav-item {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  padding: var(--s-6) var(--s-16);
  font-size: 13px;
  color: var(--bone-2);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.12s ease;
  text-decoration: none;
}
.s-nav-item:hover { background: var(--ink-2); color: var(--bone-1); }
.s-nav-item.active {
  background: var(--ink-2);
  color: var(--bone-0);
  border-left-color: var(--brick-1);
  font-weight: 500;
}

.s-nav-item .icon { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }

/* Collapsible submenu (used by the Reports group). The caret toggles
   expand/collapse without firing the parent navigation link. */
.s-nav-group {
  display: flex;
  flex-direction: column;
}
.s-nav-group .s-nav-item {
  position: relative;
  padding-right: 36px;  /* room for the caret */
}
.s-nav-caret {
  position: absolute;
  right: var(--s-8);
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  background: transparent;
  border: none;
  color: var(--bone-3);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
}
.s-nav-caret:hover {
  background: var(--ink-3);
  color: var(--bone-0);
}

.s-nav-submenu {
  display: flex;
  flex-direction: column;
  padding: 2px 0 var(--s-6);
}

.s-nav-subitem {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  padding: 4px var(--s-16) 4px 40px;   /* indent so children align under the icon */
  font-size: 12px;
  color: var(--bone-3);
  cursor: pointer;
  border-left: 3px solid transparent;
  text-decoration: none;
  transition: all 0.12s ease;
}
.s-nav-subitem:hover {
  color: var(--bone-1);
  background: var(--ink-2);
}
.s-nav-subitem.active {
  color: var(--bone-0);
  background: var(--ink-2);
  border-left-color: var(--brick-1);
  font-weight: 500;
}
.s-nav-subicon {
  font-size: 13px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}
.s-nav-sublabel {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.s-nav-submenu-empty {
  padding: 6px 16px 6px 40px;
  font-style: italic;
  font-size: 11px;
  color: var(--bone-4);
}

.s-nav-section {
  padding: var(--s-16) var(--s-16) var(--s-4);
  font-family: var(--ff-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bone-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.s-nav-section-actions {
  display: flex;
  gap: var(--s-4);
}
.s-nav-section-actions button {
  background: none; border: none; color: var(--bone-3); cursor: pointer;
  font-size: 13px; padding: 2px;
}
.s-nav-section-actions button:hover { color: var(--bone-1); }

/* Create report button */
.s-nav-create {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  padding: var(--s-8) var(--s-16);
  font-size: 13px;
  font-weight: 600;
  color: var(--brick-1);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.s-nav-create:hover { background: var(--brick-wash); }

/* Content area */
.s-content {
  flex: 1;
  background: var(--ink-1);
  overflow-y: auto;
  overflow-x: hidden;
}

.s-content-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--s-32);
}

/* ── Page header ───────────────────────────────────────────── */
.s-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-16) var(--s-32);
  border-bottom: 1px solid var(--rule);
  background: var(--ink-1);
  position: sticky;
  top: 0;
  z-index: 5;
}

.s-page-title {
  font-family: var(--ff-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--bone-1);
}

.s-page-actions {
  display: flex;
  align-items: center;
  gap: var(--s-8);
}

.s-freshness {
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--bone-3);
  display: flex;
  align-items: center;
  gap: var(--s-4);
}

/* ── Typography helpers ────────────────────────────────────── */
.t-display-2 {
  font-family: var(--ff-display);
  font-weight: 500;
  font-size: 40px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--bone-0);
}
.t-display-3 {
  font-family: var(--ff-display);
  font-weight: 500;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--bone-0);
}
.t-display-4 {
  font-family: var(--ff-display);
  font-weight: 500;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--bone-0);
}

.t-body-1 { font-size: 16px; line-height: 1.6; color: var(--bone-1); }
.t-body-2 { font-size: 14px; line-height: 1.57; color: var(--bone-1); }
.t-body-3 { font-size: 12px; line-height: 1.5; color: var(--bone-2); }

.t-label {
  font-family: var(--ff-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bone-3);
}

.t-data {
  font-family: var(--ff-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--bone-1);
}

.t-micro {
  font-family: var(--ff-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bone-4);
}

/* ── KPI cards ─────────────────────────────────────────────── */
.s-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--s-16);
  margin-bottom: var(--s-32);
}

.s-kpi-card {
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: var(--s-20);
}

.s-kpi-label {
  font-family: var(--ff-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bone-3);
  margin-bottom: var(--s-8);
}

.s-kpi-value {
  font-family: var(--ff-display);
  font-size: 32px;
  font-weight: 500;
  color: var(--bone-0);
  letter-spacing: -0.02em;
  display: flex;
  align-items: baseline;
  gap: var(--s-8);
}

.s-kpi-delta {
  font-family: var(--ff-mono);
  font-size: 12px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: var(--r-pill);
}
.s-kpi-delta.positive { color: var(--moss); background: var(--moss-wash); }
.s-kpi-delta.negative { color: var(--rust); background: var(--rust-wash); }
.s-kpi-delta.neutral { color: var(--bone-3); background: var(--ink-3); }

/* ── Creative cards ────────────────────────────────────────── */
.s-creative-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--s-16);
}

.s-creative-card {
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.s-creative-card:hover {
  border-color: var(--rule-strong);
  transform: translateY(-2px);
}

.s-creative-thumb {
  width: 100%;
  aspect-ratio: 1;
  background: var(--ink-3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.s-creative-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.s-creative-thumb .placeholder {
  color: var(--bone-4);
  font-size: 32px;
}

.s-creative-type-badge {
  position: absolute;
  top: var(--s-8);
  left: var(--s-8);
  font-family: var(--ff-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: rgba(11, 9, 7, 0.75);
  backdrop-filter: blur(4px);
}
.s-creative-type-badge.image { color: var(--format-static); }
.s-creative-type-badge.video { color: var(--format-video); }

.s-creative-info {
  padding: var(--s-12) var(--s-16);
}

.s-creative-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--bone-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: var(--s-4);
}

.s-creative-metrics {
  display: flex;
  gap: var(--s-12);
}

.s-creative-metric {
  font-family: var(--ff-mono);
  font-size: 12px;
  color: var(--bone-2);
}
.s-creative-metric strong {
  color: var(--bone-1);
  font-weight: 500;
}

/* ── Home (Motion-style) ───────────────────────────────────── */
.home-hero {
  text-align: center;
  padding: var(--s-48) 0 var(--s-32);
  border-bottom: 1px solid var(--rule);
  margin-bottom: var(--s-32);
}

.home-heading {
  font-family: var(--ff-display);
  font-size: 32px;
  font-weight: 500;
  color: var(--bone-0);
  margin-bottom: var(--s-24);
  letter-spacing: -0.02em;
}

.intent-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--s-8);
  margin-top: var(--s-20);
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.intent-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-8);
  font-family: var(--ff-body);
  font-size: 13px;
  color: var(--bone-2);
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
  padding: var(--s-8) var(--s-16);
  cursor: pointer;
  transition: all 0.12s ease;
}
.intent-chip:hover { border-color: var(--brick-1); color: var(--bone-0); }
.intent-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brick-1);
}

/* Glance section */
.glance-section { margin-bottom: var(--s-48); }
.glance-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--s-16);
}
.glance-range { display: flex; gap: var(--s-4); }
.range-pill {
  font-family: var(--ff-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--bone-3);
  background: none;
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.range-pill:hover { color: var(--bone-1); border-color: var(--bone-3); }
.range-pill.active { color: var(--bone-0); border-color: var(--brick-1); background: var(--brick-wash); }

.glance-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--s-16);
}

.glance-kpi-card {
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: var(--s-20) var(--s-24);
}

.kpi-label {
  font-family: var(--ff-body);
  font-size: 13px;
  font-weight: 400;
  color: var(--bone-3);
  margin-bottom: var(--s-12);
}

.kpi-row-flex {
  display: flex; align-items: baseline; gap: var(--s-12);
}

.kpi-big {
  font-family: var(--ff-display);
  font-size: 36px;
  font-weight: 500;
  color: var(--bone-0);
  letter-spacing: -0.02em;
  line-height: 1;
}

.kpi-delta {
  font-family: var(--ff-mono);
  font-size: 12px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: var(--r-pill);
}
.kpi-delta.positive { color: var(--moss); background: var(--moss-wash); }
.kpi-delta.negative { color: var(--rust); background: var(--rust-wash); }
.kpi-delta.neutral { color: var(--bone-3); background: var(--ink-3); }

/* Featured creative */
.featured-section { margin-bottom: var(--s-48); }
.featured-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--s-16);
}
.open-insights {
  font-size: 13px;
  color: var(--brick-1);
  text-decoration: none;
  font-weight: 500;
}
.open-insights:hover { text-decoration: underline; }

.featured-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: var(--s-32);
  align-items: start;
}

.featured-card {
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.featured-thumb {
  width: 100%;
  aspect-ratio: 4/5;
  background: var(--ink-3);
  display: flex;
  align-items: center; justify-content: center;
  position: relative;
}
.featured-thumb img {
  width: 100%; height: 100%; object-fit: cover;
}
.featured-thumb .placeholder {
  color: var(--bone-4);
  font-family: var(--ff-display);
  font-size: 48px;
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
}

.featured-meta { padding: var(--s-16); }
.featured-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--bone-0);
  margin-bottom: var(--s-4);
}
.featured-desc {
  font-size: 13px;
  color: var(--bone-3);
}

.thought-starters {
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: var(--s-24);
}
.thought-heading {
  font-family: var(--ff-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--bone-0);
  margin-bottom: var(--s-16);
  display: flex; align-items: center; gap: var(--s-8);
}
.ai-badge {
  font-family: var(--ff-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--brick-1);
  background: var(--brick-wash);
  padding: 2px 6px;
  border-radius: var(--r-sm);
}
.thought-list { list-style: none; padding: 0; }
.thought-item {
  padding: var(--s-12) 0;
  border-top: 1px solid var(--rule);
  font-size: 14px;
  color: var(--bone-1);
  cursor: pointer;
  transition: color 0.12s ease;
  display: flex; align-items: center; gap: var(--s-8);
}
.thought-item:first-child { border-top: none; }
.thought-item::before { content: "□"; color: var(--bone-4); font-size: 12px; }
.thought-item:hover { color: var(--brick-0); }

/* Recovery / login screen — shown when backend is unreachable */
.login-screen {
  width: 100%; height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: var(--s-32);
  text-align: center;
  background: var(--ink-0);
  color: var(--bone-1);
}
.login-title {
  font-family: var(--ff-display);
  font-size: 48px;
  font-weight: 500;
  color: var(--brick-1);
  margin-bottom: var(--s-16);
  letter-spacing: -0.02em;
}
.login-screen p { max-width: 480px; }
.login-link {
  display: inline-block;
  margin-top: var(--s-24);
  background: var(--brick-1);
  color: var(--bone-0);
  border: none;
  padding: var(--s-8) var(--s-20);
  border-radius: var(--r-md);
  font-family: var(--ff-body);
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}
.login-link:hover { background: var(--brick-0); }

/* KPI Sparkline */
.kpi-spark {
  margin-top: var(--s-12);
  height: 28px;
  overflow: hidden;
}
.sparkline { display: block; width: 100%; }

/* ── Trending carousel (home) ──────────────────────────────── */
.trending-section { margin-bottom: var(--s-48); }
.trending-tabs {
  display: flex;
  gap: var(--s-4);
  margin-bottom: var(--s-16);
}

.trending-carousel {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-16);
}

.trending-card {
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.trending-card:hover {
  border-color: var(--bone-3);
  transform: translateY(-2px);
}

.trending-card-head {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  padding: var(--s-12) var(--s-12) var(--s-8);
}

.trending-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--moss);
  color: var(--ink-0);
  font-family: var(--ff-mono);
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.trending-card-meta { min-width: 0; flex: 1; }
.trending-card-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--bone-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trending-card-sub {
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--bone-3);
}

.trending-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 4/5;
  background: var(--ink-3);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.trending-thumb img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 1;
}
.trending-thumb .placeholder {
  color: var(--bone-4);
  font-family: var(--ff-display);
  font-size: 48px;
  z-index: 0;
}

.trending-card-skel {
  aspect-ratio: 4/5;
  background: var(--ink-2);
  border-radius: var(--r-lg);
}

.trending-tags {
  padding: var(--s-8) var(--s-12) var(--s-12);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.trending-tag {
  font-family: var(--ff-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  color: var(--bone-2);
  background: var(--brick-wash);
  border: 1px solid var(--brick-rule);
  border-radius: var(--r-sm);
  padding: 2px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ── Format Stacks (home) ──────────────────────────────────── */
.formats-section { margin-bottom: var(--s-48); }
.formats-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--s-24);
  margin-top: var(--s-16);
}

.format-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}
.format-stack:hover .fs-card { border-color: var(--bone-3); }

.fs-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4/5;
  margin-bottom: var(--s-12);
}

.fs-card {
  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: -45%;
  margin-left: -36%;
  width: 72%;
  aspect-ratio: 4/5;
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  transition: border-color 0.15s ease, transform 0.2s ease;
}
.fs-card img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.fs-card-brand {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 4px 8px;
  font-family: var(--ff-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bone-1);
  background: linear-gradient(180deg, rgba(11,9,7,0) 0%, rgba(11,9,7,0.85) 100%);
}

.fs-label {
  font-family: var(--ff-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--bone-1);
  text-align: center;
}

.fs-sparse {
  font-family: var(--ff-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rust);
  margin-top: 2px;
}

.format-stack.sparse .fs-card { opacity: 0.6; }

/* ── AI Composer (used in home + chat) ─────────────────────── */
.s-composer-hero {
  text-align: center;
  padding: var(--s-48) var(--s-32) var(--s-32);
}

.s-composer-heading {
  font-family: var(--ff-display);
  font-size: 28px;
  font-weight: 500;
  color: var(--bone-0);
  margin-bottom: var(--s-24);
}

.s-composer-bar {
  max-width: 640px;
  margin: 0 auto var(--s-16);
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  padding: var(--s-4);
  transition: border-color 0.15s ease;
}
.s-composer-bar:focus-within { border-color: var(--brick-1); }

.s-composer-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--bone-1);
  font-family: var(--ff-body);
  font-size: 14px;
  padding: var(--s-8) var(--s-12);
  outline: none;
}
.s-composer-input::placeholder { color: var(--bone-4); }

.s-composer-send {
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  background: var(--brick-1);
  border: none;
  color: var(--bone-0);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s ease;
}
.s-composer-send:hover { background: var(--brick-0); }

.s-composer-chips {
  display: flex;
  justify-content: center;
  gap: var(--s-8);
  flex-wrap: wrap;
}

.s-chip {
  font-family: var(--ff-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--bone-2);
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
  padding: var(--s-6) var(--s-16);
  cursor: pointer;
  transition: all 0.12s ease;
}
.s-chip:hover { border-color: var(--bone-3); color: var(--bone-1); background: var(--ink-3); }
.s-chip.active { border-color: var(--brick-1); color: var(--brick-1); background: var(--brick-wash); }

.s-chip-row {
  display: flex;
  gap: var(--s-8);
  flex-wrap: wrap;
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.15; }
}

/* ── Section headers ───────────────────────────────────────── */
.s-section {
  margin-bottom: var(--s-32);
}

.s-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-16);
}

.s-section-title {
  font-family: var(--ff-display);
  font-size: 20px;
  font-weight: 500;
  color: var(--bone-0);
}

.s-section-subtitle {
  font-size: 13px;
  color: var(--bone-3);
  margin-top: var(--s-4);
}

.s-section-link {
  font-size: 13px;
  color: var(--brick-1);
  cursor: pointer;
  text-decoration: none;
}
.s-section-link:hover { text-decoration: underline; }

/* ── Horizontal scroll row ─────────────────────────────────── */
.s-scroll-row {
  display: flex;
  gap: var(--s-16);
  overflow-x: auto;
  padding-bottom: var(--s-8);
  scrollbar-width: thin;
  scrollbar-color: var(--ink-4) transparent;
}
.s-scroll-row::-webkit-scrollbar { height: 6px; }
.s-scroll-row::-webkit-scrollbar-thumb { background: var(--ink-4); border-radius: 3px; }

.s-scroll-card {
  min-width: 200px;
  max-width: 240px;
  flex-shrink: 0;
}

/* ── Tab bar ───────────────────────────────────────────────── */
.s-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  margin-bottom: var(--s-24);
}

.s-tab {
  font-family: var(--ff-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--bone-3);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
  padding: var(--s-6) var(--s-16);
  cursor: pointer;
  transition: all 0.12s ease;
  display: flex;
  align-items: center;
  gap: var(--s-6);
}
.s-tab:hover { border-color: var(--bone-3); color: var(--bone-1); }
.s-tab.active {
  background: var(--bone-0);
  color: var(--ink-0);
  border-color: var(--bone-0);
  font-weight: 600;
}

.s-tab-count {
  font-family: var(--ff-mono);
  font-size: 11px;
  font-weight: 600;
}

/* ── Data table ────────────────────────────────────────────── */
.s-table-wrap {
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  overflow: hidden;
}
/* Scrolling variant — used by Reports tables once a user adds enough
   columns that the natural table width exceeds the content pane. */
.s-table-wrap--scroll {
  overflow-x: auto;
  overflow-y: hidden;
}
.s-table-wrap--scroll::-webkit-scrollbar { height: 10px; }
.s-table-wrap--scroll::-webkit-scrollbar-track { background: var(--ink-3); }
.s-table-wrap--scroll::-webkit-scrollbar-thumb {
  background: var(--bone-4);
  border-radius: 4px;
}
.s-table-wrap--scroll::-webkit-scrollbar-thumb:hover { background: var(--bone-3); }

.s-table {
  width: 100%;
  border-collapse: collapse;
}

.s-table th {
  font-family: var(--ff-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bone-3);
  text-align: left;
  padding: var(--s-12) var(--s-16);
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  user-select: none;
}
.s-table th:hover { color: var(--bone-1); }
.s-table th.sorted { color: var(--brick-1); }

.s-table td {
  padding: var(--s-12) var(--s-16);
  border-bottom: 1px solid var(--rule);
  font-size: 13px;
  vertical-align: middle;
}

.s-table tr:last-child td { border-bottom: none; }
.s-table tr:hover td { background: var(--ink-3); }

.s-table-creative {
  display: flex;
  align-items: center;
  gap: var(--s-12);
}
.s-table-creative img, .s-table-thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--ink-3);
  flex-shrink: 0;
}

.s-table-rank {
  font-family: var(--ff-display);
  font-size: 24px;
  font-weight: 500;
  color: var(--bone-0);
  text-align: center;
  min-width: 40px;
}

.s-table-delta {
  font-family: var(--ff-mono);
  font-size: 11px;
  font-weight: 500;
}
.s-table-delta.up { color: var(--moss); }
.s-table-delta.down { color: var(--rust); }

/* ── Filter bar ────────────────────────────────────────────── */
.s-filters {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  margin-bottom: var(--s-24);
  flex-wrap: wrap;
}

.s-filter-pill {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  font-size: 13px;
  color: var(--bone-1);
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
  padding: var(--s-4) var(--s-12);
  cursor: pointer;
  transition: border-color 0.12s ease;
}
.s-filter-pill:hover { border-color: var(--bone-3); }

.s-filter-pill .remove {
  color: var(--bone-3);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.s-filter-pill .remove:hover { color: var(--rust); }

/* ── Buttons ───────────────────────────────────────────────── */
.s-btn {
  font-family: var(--ff-body);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r-md);
  padding: var(--s-6) var(--s-16);
  cursor: pointer;
  transition: all 0.12s ease;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: var(--s-6);
}
.s-btn-primary {
  background: var(--brick-1);
  color: var(--bone-0);
}
.s-btn-primary:hover { background: var(--brick-0); }
.s-btn-secondary {
  background: var(--ink-2);
  color: var(--bone-1);
  border-color: var(--rule);
}
.s-btn-secondary:hover { background: var(--ink-3); border-color: var(--rule-strong); }
.s-btn-ghost {
  background: transparent;
  color: var(--bone-2);
}
.s-btn-ghost:hover { color: var(--bone-1); background: var(--ink-3); }

/* ── Show more ─────────────────────────────────────────────── */
.s-show-more {
  display: flex;
  justify-content: center;
  padding: var(--s-16);
}

/* ── Format chips (horizontal scroll) ──────────────────────── */
.s-format-row {
  display: flex;
  gap: var(--s-12);
  overflow-x: auto;
  padding-bottom: var(--s-8);
}

.s-format-card {
  min-width: 120px;
  text-align: center;
  cursor: pointer;
  flex-shrink: 0;
}

.s-format-thumb {
  width: 120px;
  height: 80px;
  background: var(--ink-3);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  margin-bottom: var(--s-6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bone-4);
  font-size: 24px;
}

.s-format-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--bone-2);
}

/* ── Top spending creative widget ──────────────────────────── */
.s-hero-creative {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--s-24);
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: var(--s-24);
  margin-bottom: var(--s-32);
}

.s-hero-thumb {
  width: 280px;
  aspect-ratio: 4/5;
  background: var(--ink-3);
  border-radius: var(--r-md);
  overflow: hidden;
}
.s-hero-thumb img { width: 100%; height: 100%; object-fit: cover; }

.s-hero-info { display: flex; flex-direction: column; gap: var(--s-12); }

.s-hero-headline {
  font-family: var(--ff-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--bone-0);
  line-height: 1.3;
}

.s-thought-starters {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
  margin-top: var(--s-16);
}

.s-thought-starter {
  font-size: 13px;
  color: var(--bone-2);
  cursor: pointer;
  padding: var(--s-6) var(--s-12);
  border-radius: var(--r-md);
  transition: background 0.12s ease;
  display: flex;
  align-items: center;
  gap: var(--s-8);
}
.s-thought-starter:hover { background: var(--ink-3); color: var(--bone-1); }
.s-thought-starter .icon { font-size: 14px; }

/* ── Workspace switcher dropdown ───────────────────────────── */
.s-ws-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: 260px;
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 100;
  display: none;
  flex-direction: column;
  max-height: 400px;
}
.s-ws-dropdown.open { display: flex; }

.s-ws-search {
  padding: var(--s-8);
  border-bottom: 1px solid var(--rule);
}
.s-ws-search input {
  width: 100%;
  background: var(--ink-3);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  color: var(--bone-1);
  font-size: 13px;
  padding: var(--s-6) var(--s-12);
  outline: none;
}
.s-ws-search input::placeholder { color: var(--bone-4); }
.s-ws-search input:focus { border-color: var(--brick-1); }

.s-ws-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-4) 0;
}

.s-ws-item {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  padding: var(--s-6) var(--s-12);
  cursor: pointer;
  font-size: 13px;
  color: var(--bone-1);
}
.s-ws-item:hover { background: var(--ink-3); }
.s-ws-item.active { font-weight: 600; }
.s-ws-item .check { color: var(--moss); margin-left: auto; font-size: 14px; }

.s-ws-footer {
  border-top: 1px solid var(--rule);
  padding: var(--s-8);
}
.s-ws-footer-item {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  padding: var(--s-6) var(--s-8);
  font-size: 13px;
  color: var(--bone-2);
  cursor: pointer;
  border-radius: var(--r-sm);
}
.s-ws-footer-item:hover { background: var(--ink-3); color: var(--bone-1); }
.s-ws-footer-item .icon { font-size: 14px; }

/* ── Masonry grid (Discover) ───────────────────────────────── */
.s-masonry {
  columns: 4;
  column-gap: var(--s-16);
}
.s-masonry .s-creative-card {
  break-inside: avoid;
  margin-bottom: var(--s-16);
}
@media (max-width: 1200px) { .s-masonry { columns: 3; } }
@media (max-width: 900px) { .s-masonry { columns: 2; } }

/* ── Chat ──────────────────────────────────────────────────── */
.s-chat-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.s-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-24);
  display: flex;
  flex-direction: column;
  gap: var(--s-16);
}

.s-msg {
  max-width: 80%;
  padding: var(--s-12) var(--s-16);
  border-radius: var(--r-lg);
  font-size: 14px;
  line-height: 1.6;
}
.s-msg.user {
  align-self: flex-end;
  background: var(--ink-3);
  color: var(--bone-1);
}
.s-msg.assistant {
  align-self: flex-start;
  background: var(--ink-2);
  border: 1px solid var(--rule);
  color: var(--bone-1);
}

.s-chat-input-bar {
  padding: var(--s-16) var(--s-24);
  border-top: 1px solid var(--rule);
  background: var(--ink-1);
}

.s-chat-input-wrap {
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  display: flex;
  align-items: flex-end;
  padding: var(--s-4);
}
.s-chat-input-wrap:focus-within { border-color: var(--brick-1); }

.s-chat-textarea {
  flex: 1;
  background: none;
  border: none;
  color: var(--bone-1);
  font-family: var(--ff-body);
  font-size: 14px;
  padding: var(--s-8) var(--s-12);
  outline: none;
  resize: none;
  min-height: 20px;
  max-height: 120px;
}
.s-chat-textarea::placeholder { color: var(--bone-4); }

.s-chat-model-label {
  font-family: var(--ff-mono);
  font-size: 10px;
  color: var(--bone-4);
  padding: 0 var(--s-8) var(--s-6);
  align-self: flex-end;
}

/* ── Loading skeleton ──────────────────────────────────────── */
.s-skeleton {
  background: linear-gradient(90deg, var(--ink-3) 25%, var(--ink-4) 50%, var(--ink-3) 75%);
  background-size: 200% 100%;
  animation: s-shimmer 1.5s ease infinite;
  border-radius: var(--r-sm);
}
@keyframes s-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Empty state ───────────────────────────────────────────── */
.s-empty {
  text-align: center;
  padding: var(--s-64) var(--s-32);
}
.s-empty-title {
  font-family: var(--ff-display);
  font-size: 22px;
  font-style: italic;
  color: var(--bone-3);
  margin-bottom: var(--s-12);
}
.s-empty-text {
  font-size: 14px;
  color: var(--bone-4);
  max-width: 400px;
  margin: 0 auto;
}

/* ── Onboarding checklist ──────────────────────────────────── */
.s-onboard {
  max-width: 520px;
  margin: var(--s-48) auto;
}
.s-onboard-step {
  display: flex;
  align-items: center;
  gap: var(--s-12);
  padding: var(--s-16);
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  margin-bottom: var(--s-8);
  cursor: pointer;
  transition: border-color 0.12s ease;
}
.s-onboard-step:hover { border-color: var(--brick-1); }
.s-onboard-step.done { opacity: 0.5; }
.s-onboard-check {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid var(--rule);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: transparent;
  font-size: 14px;
}
.s-onboard-step.done .s-onboard-check {
  background: var(--moss);
  border-color: var(--moss);
  color: var(--ink-0);
}

/* ── Settings modal ────────────────────────────────────────── */
.s-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 9, 7, 0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.s-modal {
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  width: 720px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 16px 64px rgba(0,0,0,0.5);
}

.s-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-20) var(--s-24);
  border-bottom: 1px solid var(--rule);
}

.s-modal-title {
  font-family: var(--ff-display);
  font-size: 20px;
  font-weight: 500;
  color: var(--bone-0);
}

.s-modal-close {
  background: none; border: none; color: var(--bone-3);
  font-size: 20px; cursor: pointer;
}
.s-modal-close:hover { color: var(--bone-1); }

.s-modal-body { padding: var(--s-24); }

.s-modal-tabs {
  display: flex;
  gap: var(--s-4);
  padding: 0 var(--s-24);
  border-bottom: 1px solid var(--rule);
}
.s-modal-tab {
  padding: var(--s-8) var(--s-16);
  font-size: 13px;
  color: var(--bone-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.s-modal-tab:hover { color: var(--bone-1); }
.s-modal-tab.active { color: var(--bone-0); border-bottom-color: var(--brick-1); }

/* ── Connector cards (settings) ────────────────────────────── */
.s-connector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-16);
  background: var(--ink-1);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  margin-bottom: var(--s-8);
}

.s-connector-info { display: flex; align-items: center; gap: var(--s-12); }
.s-connector-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  background: var(--ink-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.s-connector-name { font-weight: 500; color: var(--bone-1); }
.s-connector-status {
  font-family: var(--ff-mono);
  font-size: 11px;
}
.s-connector-status.connected { color: var(--moss); }
.s-connector-status.disconnected { color: var(--bone-4); }

/* ── Chart container ───────────────────────────────────────── */
.s-chart-wrap {
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: var(--s-16);
  margin-bottom: var(--s-24);
}
.s-chart-canvas {
  width: 100%;
  height: 300px;
}

/* ── Scrollbar ─────────────────────────────────────────────── */
.s-content::-webkit-scrollbar { width: 8px; }
.s-content::-webkit-scrollbar-thumb { background: var(--ink-4); border-radius: 4px; }
.s-content::-webkit-scrollbar-track { background: transparent; }

/* ── Toast ─────────────────────────────────────────────────── */
.s-toast {
  position: fixed;
  bottom: var(--s-24);
  right: var(--s-24);
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: var(--s-12) var(--s-20);
  color: var(--bone-1);
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 300;
  animation: s-toast-in 0.2s ease;
}
.s-toast.error { border-color: var(--rust); }
@keyframes s-toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ── Settings (Motion-style) ───────────────────────────────── */
.settings-tabs { margin-bottom: var(--s-24); }

.settings-panel { min-height: 400px; }

.settings-card {
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: var(--s-24);
}

.settings-card-title {
  font-family: var(--ff-display);
  font-size: 20px;
  font-weight: 500;
  color: var(--bone-0);
  margin-bottom: var(--s-4);
  letter-spacing: -0.01em;
}

.settings-card-desc {
  font-size: 13px;
  color: var(--bone-3);
  margin-bottom: var(--s-16);
}

.connector-grid {
  display: flex;
  flex-direction: column;
  gap: var(--s-12);
  margin-top: var(--s-24);
}

.connector-tile {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: var(--s-16);
  align-items: center;
  background: var(--ink-1);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: var(--s-16) var(--s-20);
  transition: border-color 0.12s ease;
}
.connector-tile:hover { border-color: var(--bone-3); }
.connector-tile.connected { border-color: var(--moss); }

.connector-icon {
  width: 48px; height: 48px;
  border-radius: var(--r-md);
  background: var(--brick-1);
  color: var(--bone-0);
  font-family: var(--ff-display);
  font-size: 22px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.connector-tile.connected .connector-icon { background: var(--moss); color: var(--ink-0); }

.connector-body { min-width: 0; }

.connector-header {
  display: flex; align-items: center; gap: var(--s-12);
  margin-bottom: var(--s-4);
}

.connector-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--bone-0);
}

.connector-status {
  font-family: var(--ff-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--bone-4);
}
.connector-status.connected { color: var(--moss); }

.connector-desc {
  font-size: 12px;
  color: var(--bone-3);
  margin-bottom: var(--s-2);
}

.connector-detail {
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--bone-2);
}

/* ── Discover (Motion-style Inspo grid) ────────────────────── */
.discover-tabs { margin-bottom: var(--s-16); }

.discover-filters {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  margin-bottom: var(--s-24);
  flex-wrap: wrap;
}

.filter-label {
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bone-4);
  margin-right: var(--s-4);
}

.discover-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--s-16);
}

.discover-card {
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.15s ease;
}
.discover-card:hover {
  border-color: var(--bone-3);
  transform: translateY(-2px);
}

.discover-thumb {
  width: 100%;
  aspect-ratio: 1;
  background: var(--ink-3);
  position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.discover-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  position: absolute; inset: 0; z-index: 1;
}
.discover-thumb .placeholder {
  color: var(--bone-4);
  font-family: var(--ff-display);
  font-size: 32px;
  z-index: 0;
}

.discover-meta { padding: var(--s-12); }
.discover-brand {
  font-size: 13px;
  font-weight: 500;
  color: var(--bone-1);
  margin-bottom: 2px;
}
.discover-cta {
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bone-3);
}

/* Inline tag chips on a Discover card */
.discover-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: var(--s-6);
}
.discover-tag {
  font-family: var(--ff-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bone-3);
  background: var(--ink-3);
  padding: 2px 6px;
  border-radius: var(--r-pill);
}

/* ── Discover: Add-brand bar + brand chips + candidate picker ────── */
.disc-add-row {
  display: flex;
  gap: var(--s-8);
  margin-bottom: var(--s-16);
}
.disc-add-row .s-input {
  flex: 1;
}
.disc-add-row .btn-primary {
  white-space: nowrap;
}

.s-input {
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: var(--s-10) var(--s-14);
  font-family: var(--ff-body);
  font-size: 13px;
  color: var(--bone-1);
  outline: none;
  transition: border-color 0.12s ease;
}
.s-input:focus { border-color: var(--brick-1); }
.s-input::placeholder { color: var(--bone-4); }
.s-input.disc-err {
  border-color: var(--brick-1);
  background: color-mix(in oklab, var(--brick-1) 10%, var(--ink-2));
}
.s-input--inline {
  padding: var(--s-6) var(--s-12);
  font-size: 12px;
  width: 200px;
}

.disc-progress {
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  background: var(--ink-2);
  border: 1px solid var(--rule);
  color: var(--bone-2);
  padding: var(--s-6) var(--s-12);
  border-radius: var(--r-pill);
  max-width: 360px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.disc-progress.err {
  border-color: var(--brick-1);
  color: var(--brick-1);
}

.disc-brand-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-6);
  margin-bottom: var(--s-16);
}
.disc-brand-chips .s-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.disc-brand-count {
  font-family: var(--ff-mono);
  font-size: 10px;
  color: var(--bone-4);
  background: var(--ink-3);
  padding: 1px 6px;
  border-radius: var(--r-pill);
}
.disc-brand-chips .s-chip.active .disc-brand-count {
  background: var(--ink-0);
  color: var(--bone-0);
}
.disc-brand-queued {
  font-family: var(--ff-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brick-1);
  background: color-mix(in oklab, var(--brick-1) 16%, transparent);
  padding: 1px 6px;
  border-radius: var(--r-pill);
}

/* Candidate picker modal */
.disc-picker {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.disc-picker[hidden] { display: none; }
.disc-picker-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
}
.disc-picker-panel {
  position: relative;
  width: 520px;
  max-width: calc(100vw - 48px);
  max-height: 70vh;
  background: var(--ink-1);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}
.disc-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-16) var(--s-20);
  border-bottom: 1px solid var(--rule);
}
.disc-picker-head h3 {
  font-family: var(--ff-display);
  font-size: 16px;
  font-weight: 500;
  margin: 0;
  color: var(--bone-0);
}
.disc-picker-close {
  background: transparent;
  border: none;
  color: var(--bone-3);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}
.disc-picker-close:hover { color: var(--bone-0); }
.disc-picker-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-12) var(--s-20) var(--s-20);
}

.disc-cand {
  display: flex;
  align-items: center;
  gap: var(--s-12);
  padding: var(--s-12);
  border-radius: var(--r-md);
  border: 1px solid transparent;
}
.disc-cand:hover {
  border-color: var(--rule);
  background: var(--ink-2);
}
.disc-cand-pic {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--ink-3);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.disc-cand-pic img { width: 100%; height: 100%; object-fit: cover; }
.disc-cand-pic .placeholder {
  font-family: var(--ff-display);
  color: var(--bone-2);
  font-size: 16px;
}
.disc-cand-meta { flex: 1; min-width: 0; }
.disc-cand-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--bone-0);
  display: flex;
  align-items: center;
  gap: 6px;
}
.disc-cand-verified {
  font-size: 10px;
  color: #4a9dff;
  background: rgba(74, 157, 255, 0.18);
  padding: 1px 4px;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.disc-cand-sub {
  font-family: var(--ff-mono);
  font-size: 10px;
  color: var(--bone-4);
  margin-top: 2px;
  letter-spacing: 0.04em;
}
.disc-cand-add {
  padding: 6px 14px;
  font-size: 12px;
}

/* ── Discover: Motion-style filter toolbar ────────────────────────── */
.disc-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--s-24);
}

.disc-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-8);
  margin-bottom: var(--s-16);
  padding-bottom: var(--s-16);
  border-bottom: 1px solid var(--rule);
}
.disc-toolbar-left,
.disc-toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  flex-wrap: wrap;
}

.disc-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--ff-body);
  font-size: 12px;
  font-weight: 500;
  color: var(--bone-2);
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
}
.disc-tool-btn:hover {
  border-color: var(--bone-3);
  color: var(--bone-0);
}
.disc-tool-btn--icon {
  padding: 5px 8px;
}
.disc-icon {
  font-size: 11px;
  opacity: 0.85;
}
.disc-caret {
  font-size: 10px;
  opacity: 0.6;
  margin-left: 2px;
}

.disc-pill { position: relative; }
.disc-pill--set {
  color: var(--bone-0);
  border-color: var(--brick-1);
  background: color-mix(in oklab, var(--brick-1) 10%, var(--ink-2));
}
.disc-pill-value {
  font-family: var(--ff-mono);
  font-size: 10px;
  color: var(--bone-3);
  background: var(--ink-3);
  padding: 1px 6px;
  border-radius: var(--r-pill);
  margin-left: 4px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.disc-pill--set .disc-pill-value {
  background: var(--ink-0);
  color: var(--bone-0);
}
.disc-pill-x {
  position: relative;
  background: transparent;
  border: none;
  color: var(--bone-4);
  font-size: 14px;
  cursor: pointer;
  margin-left: -4px;
  padding: 0 4px;
  line-height: 1;
}
.disc-pill-x:hover { color: var(--brick-1); }

/* Popovers */
.disc-popover {
  position: fixed;
  z-index: 220;
  min-width: 240px;
  max-width: 360px;
  background: var(--ink-1);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
  overflow: hidden;
  max-height: 460px;
}

.disc-pop-list {
  max-height: 460px;
  overflow-y: auto;
  padding: 4px 0;
}
.disc-pop-list--checks {
  padding: 4px;
}

.disc-pop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 14px;
  background: transparent;
  border: none;
  text-align: left;
  font-family: var(--ff-body);
  font-size: 13px;
  color: var(--bone-1);
  cursor: pointer;
}
.disc-pop-row:hover { background: var(--ink-2); }
.disc-pop-row--custom { gap: 8px; padding: 12px 14px; flex-wrap: wrap; font-size: 12px; }
.disc-pop-row--disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.disc-pop-divider {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 4px 0;
}
.disc-pop-section {
  font-family: var(--ff-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--bone-4);
  padding: 10px 14px 4px;
}
.disc-pop-section--muted { opacity: 0.6; }

.disc-pop-search { padding: 8px 8px 4px; }
.disc-pop-search .s-input { width: 100%; padding: 6px 10px; font-size: 12px; }

.disc-pop-check {
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 4px;
}
.disc-pop-check:hover { background: var(--ink-2); }
.disc-pop-check input { margin-right: 8px; }
.disc-pop-label { flex: 1; font-size: 13px; }
.disc-pop-count {
  font-family: var(--ff-mono);
  font-size: 10px;
  color: var(--bone-4);
}

.disc-pop-range {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
}
.disc-pop-range label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--bone-2);
}
.disc-pop-range input[type="number"] {
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  color: var(--bone-0);
  padding: 4px 8px;
  width: 90px;
  font-family: var(--ff-mono);
  font-size: 12px;
}
.disc-pop-range button { padding: 6px 12px; font-size: 12px; }

/* Display toggles */
.disc-pop-toggle { cursor: default; }
.disc-toggle {
  width: 28px;
  height: 16px;
  background: var(--ink-3);
  border-radius: 8px;
  position: relative;
  cursor: pointer;
  transition: background 0.12s;
}
.disc-toggle.on { background: var(--brick-1); }
.disc-toggle-dot {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: var(--bone-0);
  border-radius: 50%;
  transition: left 0.12s;
}
.disc-toggle.on .disc-toggle-dot { left: 14px; }

/* Optional display-driven card fields */
.discover-impressions {
  font-family: var(--ff-mono);
  font-size: 10px;
  color: var(--bone-3);
  margin-top: 4px;
}
.discover-adcopy {
  font-size: 11px;
  line-height: 1.4;
  color: var(--bone-2);
  margin-top: 6px;
}
.discover-outlier-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-family: var(--ff-mono);
  font-size: 10px;
  color: var(--bone-0);
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 2px 6px;
  border-radius: var(--r-pill);
}

/* ── Chat markdown rendering ──────────────────────────────── */
.chat-content h3 {
  font-family: var(--ff-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--bone-0);
  margin: var(--s-16) 0 var(--s-8);
  letter-spacing: -0.01em;
}
.chat-content h4 {
  font-family: var(--ff-display);
  font-size: 15px;
  font-weight: 500;
  color: var(--bone-1);
  margin: var(--s-12) 0 var(--s-4);
}
.chat-content h5 {
  font-family: var(--ff-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bone-3);
  margin: var(--s-12) 0 var(--s-4);
}
.chat-content p { margin: var(--s-6) 0; }
.chat-content strong { color: var(--bone-0); font-weight: 600; }
.chat-content em { font-style: italic; color: var(--bone-1); }
.chat-content code {
  font-family: var(--ff-mono);
  font-size: 12px;
  color: var(--brick-0);
  background: var(--ink-3);
  padding: 1px 4px;
  border-radius: var(--r-sm);
}
.chat-content pre {
  background: var(--ink-3);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: var(--s-12);
  overflow-x: auto;
  margin: var(--s-8) 0;
}
.chat-content pre code {
  background: none;
  padding: 0;
  color: var(--bone-1);
}
.chat-content ul, .chat-content ol {
  margin: var(--s-6) 0 var(--s-6) var(--s-20);
  padding: 0;
}
.chat-content li { margin: var(--s-2) 0; }
.chat-content a {
  color: var(--brick-0);
  text-decoration: none;
  border-bottom: 1px dotted var(--brick-rule);
}
.chat-content a:hover { color: var(--brick-1); }
.chat-content hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: var(--s-16) 0;
}

/* Inline ad thumbnails embedded in assistant markdown */
.chat-inline-thumb-wrap {
  display: inline-block;
  margin: var(--s-8) var(--s-8) var(--s-8) 0;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--rule);
  background: var(--ink-3);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}
.chat-inline-thumb-wrap:hover {
  border-color: var(--brick-1);
  transform: translateY(-2px);
}
.chat-inline-thumb {
  display: block;
  max-width: 220px;
  width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
}

/* Tool chips above bubble */
.chat-content-wrap {
  flex: 1;
  min-width: 0;
}
.chat-tool-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--s-8);
  animation: chip-in 0.4s ease;
}
@keyframes chip-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--ff-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--bone-2);
  background: var(--ink-3);
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
  padding: 3px 8px;
  cursor: help;
  letter-spacing: 0.04em;
}
.chat-tool-chip:hover { color: var(--bone-0); border-color: var(--bone-3); }
.chat-tool-icon { font-size: 11px; }

/* Thinking phase animation in placeholder bubble */
.chat-thinking-phase {
  font-family: var(--ff-display);
  font-style: italic;
  color: var(--bone-3);
  transition: opacity 0.25s ease;
  display: inline-block;
}

/* ── Ad Detail Drawer ─────────────────────────────────────── */
.ad-drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(11, 9, 7, 0);
  z-index: 90;
  pointer-events: none;
  transition: background 0.22s cubic-bezier(.4,0,.2,1);
}
.ad-drawer-scrim.open {
  background: rgba(11, 9, 7, 0.55);
  pointer-events: auto;
}

.ad-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 480px;
  max-width: 100vw;
  background: var(--ink-1);
  border-left: 1px solid var(--rule-strong);
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.5);
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(.4,0,.2,1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ad-drawer.open { transform: translateX(0); }

.ad-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-12);
  padding: var(--s-20) var(--s-24);
  border-bottom: 1px solid var(--rule);
  background: var(--ink-1);
  flex-shrink: 0;
}
.ad-drawer-title-stack { min-width: 0; flex: 1; }
.ad-drawer-title {
  font-family: var(--ff-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--bone-0);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ad-drawer-subtitle {
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bone-4);
  margin-top: 4px;
}
.ad-drawer-close {
  background: none;
  border: none;
  color: var(--bone-3);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  margin-top: -2px;
  transition: color 0.12s ease;
}
.ad-drawer-close:hover { color: var(--bone-0); }

.ad-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-20) var(--s-24);
}

.ad-drawer-media {
  position: relative;
  width: 100%;
  background: var(--ink-3);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: var(--s-20);
  min-height: 200px;
  display: flex; align-items: center; justify-content: center;
}
.ad-drawer-media img,
.ad-drawer-media video {
  width: 100%;
  display: block;
  max-height: 480px;
  object-fit: contain;
  background: var(--ink-3);
}
.ad-drawer-media.empty .placeholder {
  color: var(--bone-4);
  font-family: var(--ff-display);
  font-size: 14px;
  padding: var(--s-32);
}
.ad-drawer-play {
  position: absolute;
  inset: 0;
  background: rgba(11, 9, 7, 0.25);
  border: none;
  color: var(--bone-0);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s ease;
}
.ad-drawer-play:hover { background: rgba(11, 9, 7, 0.45); }
.ad-drawer-play svg {
  background: var(--brick-1);
  border-radius: 50%;
  padding: 12px;
  width: 56px;
  height: 56px;
}

.ad-drawer-section { margin-bottom: var(--s-24); }
.ad-drawer-section-title {
  font-family: var(--ff-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bone-4);
  margin-bottom: var(--s-12);
  display: flex; align-items: center; gap: var(--s-6);
}

.ad-drawer-metric-group {
  margin-bottom: var(--s-16);
}
.ad-drawer-metric-group:last-child { margin-bottom: 0; }

.ad-drawer-metric-group-title {
  font-family: var(--ff-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bone-4);
  margin-bottom: var(--s-6);
}

.ad-drawer-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-8);
}

.ad-drawer-video {
  width: 100%;
  display: block;
  max-height: 480px;
  background: var(--ink-3);
  border-radius: var(--r-md);
}

/* Markdown tables (chat + brief) */
.md-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  margin: var(--s-12) 0;
  background: var(--ink-2);
}
.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.md-table th {
  font-family: var(--ff-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bone-3);
  text-align: left;
  padding: var(--s-8) var(--s-12);
  border-bottom: 1px solid var(--rule);
  background: var(--ink-3);
}
.md-table td {
  padding: var(--s-8) var(--s-12);
  border-bottom: 1px solid var(--rule);
  color: var(--bone-1);
  vertical-align: top;
}
.md-table tr:last-child td { border-bottom: none; }
.md-table tr:hover td { background: var(--ink-3); }
.ad-drawer-metric {
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: var(--s-8) var(--s-12);
}
.ad-drawer-metric-label {
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--bone-4);
  text-transform: uppercase;
  margin-bottom: 2px;
}
.ad-drawer-metric-value {
  font-family: var(--ff-display);
  font-size: 16px;
  font-weight: 500;
  color: var(--bone-0);
}

.ad-drawer-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ad-drawer-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--ff-body);
  font-size: 12px;
  color: var(--bone-1);
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 4px 10px;
}
.ad-drawer-chip .cl-label {
  font-family: var(--ff-mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bone-4);
}
.ad-drawer-tag {
  font-family: var(--ff-mono);
  font-size: 10px;
  color: var(--bone-2);
  background: var(--brick-wash);
  border: 1px solid var(--brick-rule);
  border-radius: var(--r-sm);
  padding: 3px 8px;
  letter-spacing: 0.04em;
}

.ad-drawer-copy-block { margin-bottom: var(--s-12); }
.ad-drawer-copy-label {
  font-family: var(--ff-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bone-4);
  margin-bottom: 4px;
}
.ad-drawer-copy-block p {
  font-size: 13px;
  color: var(--bone-1);
  line-height: 1.5;
}

.ad-drawer-brief {
  font-size: 13px;
  color: var(--bone-1);
  line-height: 1.55;
}
.ad-drawer-brief h3, .ad-drawer-brief h4, .ad-drawer-brief h5 {
  margin-top: var(--s-12);
  margin-bottom: var(--s-4);
}
.ad-drawer-brief h3 { font-family: var(--ff-display); font-size: 15px; color: var(--bone-0); }
.ad-drawer-brief h4 { font-family: var(--ff-display); font-size: 13px; color: var(--bone-1); }
.ad-drawer-brief strong { color: var(--bone-0); font-weight: 600; }
.ad-drawer-brief ul, .ad-drawer-brief ol { margin-left: var(--s-20); }

.ad-drawer-body-text {
  font-size: 13px;
  color: var(--bone-1);
  line-height: 1.5;
  margin-top: var(--s-12);
  padding: var(--s-12);
  background: var(--ink-2);
  border-radius: var(--r-sm);
}

.ad-drawer-foot {
  display: flex;
  gap: var(--s-8);
  padding: var(--s-16) var(--s-24);
  border-top: 1px solid var(--rule);
  background: var(--ink-1);
  flex-shrink: 0;
}
.ad-drawer-foot .btn-primary,
.ad-drawer-foot .btn-ghost { flex: 1; }

/* ── Drawer: Motion-style header + tabs + details/transcript ────── */

.ad-drawer-head--motion {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-12);
  padding: var(--s-12) var(--s-16) var(--s-12) var(--s-20);
  border-bottom: 1px solid var(--rule);
  background: var(--ink-1);
  flex-shrink: 0;
  min-height: 52px;
  box-sizing: border-box;
}
.ad-drawer-head-left {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  min-width: 0;
}
.ad-drawer-head-label {
  font-family: var(--ff-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--bone-0);
}
.ad-drawer-head-id {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--ff-mono);
  font-size: 12px;
  color: var(--bone-3);
  text-decoration: none;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  background: var(--ink-2);
  transition: all 0.12s ease;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ad-drawer-head-id:hover {
  background: var(--ink-3);
  color: var(--bone-1);
}
.ad-drawer-head-id-arrow {
  font-size: 10px;
  opacity: 0.7;
}
.ad-drawer-head-actions {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  flex-shrink: 0;
}
.ad-drawer-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--ink-2);
  color: var(--bone-1);
  border: 1px solid var(--rule);
  padding: 5px 11px;
  border-radius: var(--r-pill);
  font-family: var(--ff-body);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
  line-height: 1;
}
.ad-drawer-copy:hover {
  background: var(--ink-3);
  border-color: var(--bone-3);
  color: var(--bone-0);
}
.ad-drawer-copy svg { width: 11px; height: 11px; flex-shrink: 0; }

.ad-drawer-head--motion .ad-drawer-close {
  background: transparent;
  border: none;
  color: var(--bone-3);
  font-size: 22px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.12s ease;
}
.ad-drawer-head--motion .ad-drawer-close:hover {
  background: var(--ink-3);
  color: var(--bone-0);
}

/* Tabs */
.ad-drawer-tabs {
  display: flex;
  border-bottom: 1px solid var(--rule);
  background: var(--ink-1);
  padding: 0 var(--s-20);
  flex-shrink: 0;
}
.ad-drawer-tab {
  background: transparent;
  border: none;
  padding: var(--s-12) var(--s-16);
  font-family: var(--ff-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--bone-3);
  cursor: pointer;
  position: relative;
  transition: color 0.12s ease;
}
.ad-drawer-tab:hover { color: var(--bone-1); }
.ad-drawer-tab.active { color: var(--bone-0); }
.ad-drawer-tab.active::after {
  content: "";
  position: absolute;
  left: var(--s-16);
  right: var(--s-16);
  bottom: -1px;
  height: 2px;
  background: var(--brick-1);
  border-radius: 2px;
}

.ad-drawer-tab-body { padding-top: var(--s-12); }
.ad-drawer-tab-body[hidden] { display: none; }

/* Pill row */
.ad-drawer-pill-row {
  display: flex;
  gap: var(--s-8);
  padding: 0 var(--s-20) var(--s-16);
  flex-wrap: wrap;
}
.ad-drawer-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--ink-2);
  border: 1px solid var(--rule);
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-family: var(--ff-body);
  font-size: 11px;
  color: var(--bone-2);
  cursor: pointer;
  transition: all 0.12s ease;
}
.ad-drawer-pill:hover { border-color: var(--bone-3); color: var(--bone-0); }
.ad-drawer-pill.active {
  color: var(--brick-1);
  border-color: var(--brick-1);
  background: color-mix(in oklab, var(--brick-1) 10%, var(--ink-2));
}
.ad-drawer-pill--readonly { cursor: default; pointer-events: none; }
.ad-drawer-pill-icon { font-size: 11px; opacity: 0.85; }

/* Metadata table (Brand · Industry · Status …) */
.ad-drawer-meta-table {
  padding: 0 var(--s-20) var(--s-16);
  display: flex;
  flex-direction: column;
}
.ad-drawer-meta-row {
  display: flex;
  align-items: center;
  gap: var(--s-12);
  padding: var(--s-8) 0;
  border-bottom: 1px solid var(--rule);
}
.ad-drawer-meta-row:last-child { border-bottom: none; }
.ad-drawer-meta-label {
  flex-shrink: 0;
  width: 110px;
  font-family: var(--ff-body);
  font-size: 12px;
  color: var(--bone-3);
}
.ad-drawer-meta-value {
  flex: 1;
  min-width: 0;
  font-family: var(--ff-body);
  font-size: 12px;
  color: var(--bone-1);
  display: flex;
  align-items: center;
  gap: 4px;
}
.ad-drawer-meta-link {
  color: var(--bone-1);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ad-drawer-meta-link:hover { color: var(--brick-1); text-decoration: underline; }
.ad-drawer-meta-chip {
  background: var(--ink-2);
  border: 1px solid var(--rule);
  padding: 2px 8px;
  border-radius: var(--r-sm);
  font-size: 11px;
  color: var(--bone-2);
}

.ad-drawer-status {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
}
.ad-drawer-status--active  { background: #4ade80; box-shadow: 0 0 6px #4ade8055; }
.ad-drawer-status--paused  { background: #f5a623; }
.ad-drawer-status--unknown { background: var(--bone-4); }

/* "View on Meta" CTA — shown over the poster when a video ad has no
   locally-playable .mp4 (Meta's video API didn't surface a usable
   source URL through any of our 4 sync priority paths). Lets the
   user still watch the ad via the public Meta Ad Library. */
.ad-drawer-meta-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--bone-0);
  padding: 10px 18px;
  border-radius: var(--r-pill);
  font-family: var(--ff-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  backdrop-filter: blur(6px);
  transition: all 0.12s ease;
}
.ad-drawer-meta-play:hover {
  background: rgba(0, 0, 0, 0.85);
  border-color: rgba(255, 255, 255, 0.35);
}
.ad-drawer-meta-play-label {
  font-weight: 500;
}

.ad-drawer-platform-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  margin-right: 4px;
}

/* Thought starters (AI buttons) */
.ad-drawer-thought-starters {
  padding: var(--s-12) var(--s-20) var(--s-16);
  border-top: 1px solid var(--rule);
  margin-top: var(--s-8);
}
.ad-drawer-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--s-10);
}
.ad-drawer-ai-badge {
  font-family: var(--ff-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: color-mix(in oklab, var(--brick-1) 18%, transparent);
  color: var(--brick-1);
  padding: 2px 6px;
  border-radius: var(--r-pill);
}
.ad-drawer-thought-btn {
  display: flex;
  align-items: center;
  gap: var(--s-10);
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: var(--s-10) 0;
  font-family: var(--ff-body);
  font-size: 13px;
  color: var(--bone-1);
  cursor: pointer;
  transition: color 0.12s ease;
}
.ad-drawer-thought-btn:hover { color: var(--bone-0); }
.ad-drawer-thought-icon {
  font-size: 14px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.85;
}

/* Activity (real comments thread) */
.ad-drawer-activity {
  padding: var(--s-16) var(--s-20) var(--s-24);
  border-top: 1px solid var(--rule);
  margin-top: var(--s-8);
}
.ad-drawer-comments {
  display: flex;
  flex-direction: column;
  gap: var(--s-12);
  margin: var(--s-12) 0;
}
.ad-drawer-comments-loading,
.ad-drawer-comments-empty {
  padding: var(--s-10) 0;
  font-size: 12px;
  color: var(--bone-4);
  font-style: italic;
}
.ad-drawer-comment {
  display: flex;
  gap: var(--s-10);
  align-items: flex-start;
}
.ad-drawer-comment-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ink-3);
  color: var(--bone-1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ff-mono);
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}
.ad-drawer-comment-body { flex: 1; min-width: 0; }
.ad-drawer-comment-head {
  display: flex;
  align-items: baseline;
  gap: var(--s-8);
  margin-bottom: 2px;
}
.ad-drawer-comment-author {
  font-size: 12px;
  font-weight: 500;
  color: var(--bone-1);
}
.ad-drawer-comment-ts {
  font-family: var(--ff-mono);
  font-size: 10px;
  color: var(--bone-4);
}
.ad-drawer-comment-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--bone-1);
  white-space: pre-wrap;
  word-break: break-word;
}
.ad-drawer-activity-form {
  display: flex;
  align-items: flex-end;
  gap: var(--s-8);
  padding: var(--s-10) var(--s-12);
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  margin-top: var(--s-10);
  transition: border-color 0.12s ease;
}
.ad-drawer-activity-form:focus-within { border-color: var(--brick-1); }
.ad-drawer-activity-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--bone-1);
  font-family: var(--ff-body);
  font-size: 13px;
  resize: none;
  min-height: 18px;
  max-height: 120px;
  line-height: 1.5;
}
.ad-drawer-activity-textarea::placeholder { color: var(--bone-4); }
.ad-drawer-activity-send {
  background: var(--brick-1);
  border: none;
  color: var(--bone-0);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s ease;
}
.ad-drawer-activity-send:hover { background: #c84a44; }
.ad-drawer-activity-send:disabled { background: var(--ink-3); cursor: not-allowed; }

/* Transcript tab */
.ad-drawer-transcript {
  padding: 0 var(--s-20) var(--s-24);
}
.ad-drawer-transcript-actions {
  display: flex;
  justify-content: flex-start;
  padding-bottom: var(--s-12);
}
.ad-drawer-transcript-row {
  display: flex;
  align-items: flex-start;
  gap: var(--s-12);
  padding: var(--s-8) var(--s-8);
  border-bottom: 1px solid var(--rule);
  border-radius: var(--r-sm);
  transition: background 0.12s ease;
}
.ad-drawer-transcript-row:last-child { border-bottom: none; }
.ad-drawer-transcript-row.is-seekable {
  cursor: pointer;
}
.ad-drawer-transcript-row.is-seekable:hover {
  background: var(--ink-2);
}
.ad-drawer-transcript-row.is-seekable:hover .ad-drawer-transcript-time {
  color: var(--brick-1);
}
.ad-drawer-transcript-source {
  font-family: var(--ff-mono);
  font-size: 10px;
  color: var(--bone-4);
  align-self: center;
  margin-left: var(--s-12);
}
.ad-drawer-transcript-time {
  flex-shrink: 0;
  width: 48px;
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--bone-4);
  padding-top: 2px;
}
.ad-drawer-transcript-line {
  flex: 1;
  font-size: 13px;
  line-height: 1.5;
  color: var(--bone-1);
}
.ad-drawer-transcript-empty {
  padding: var(--s-32) var(--s-16);
  text-align: center;
}
.ad-drawer-transcript-empty-title {
  font-family: var(--ff-display);
  font-size: 15px;
  color: var(--bone-1);
  margin: 0 0 8px;
}
.ad-drawer-transcript-empty-sub {
  font-size: 12px;
  color: var(--bone-3);
  margin: 0 0 16px;
  line-height: 1.5;
}
.ad-drawer-transcript-block {
  text-align: left;
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: var(--s-12);
  font-size: 13px;
  line-height: 1.6;
  color: var(--bone-1);
}

@media (max-width: 720px) {
  .ad-drawer { width: 100%; }
}

/* ── Chat (Motion-style) ───────────────────────────────────── */
.chat-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 64px);
  max-width: 800px;
  margin: 0 auto;
}

.chat-stream {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-24) 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-16);
}

.chat-empty-hero {
  text-align: center;
  padding: var(--s-48) var(--s-16);
  margin: auto;
}

.chat-suggestions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-12);
  margin-top: var(--s-24);
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.chat-suggest {
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: var(--s-12) var(--s-16);
  font-size: 13px;
  color: var(--bone-1);
  text-align: left;
  cursor: pointer;
  transition: all 0.12s ease;
}
.chat-suggest:hover {
  border-color: var(--brick-1);
  background: var(--ink-3);
}

.chat-bubble {
  display: flex;
  gap: var(--s-12);
  align-items: flex-start;
  max-width: 90%;
}
.chat-bubble.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-avatar {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  background: var(--ink-3);
  color: var(--bone-1);
  font-family: var(--ff-mono);
  font-size: 11px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.chat-bubble.user .chat-avatar {
  background: var(--moss);
  color: var(--ink-0);
}
.chat-bubble.assistant .chat-avatar {
  background: var(--brick-1);
  color: var(--bone-0);
}

.chat-content {
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: var(--s-12) var(--s-16);
  font-size: 14px;
  color: var(--bone-1);
  line-height: 1.5;
}
.chat-bubble.user .chat-content {
  background: var(--brick-wash);
  border-color: var(--brick-rule);
  color: var(--bone-0);
}

.chat-content.streaming::after {
  content: "▌";
  margin-left: 4px;
  color: var(--brick-1);
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.chat-input-bar {
  border-top: 1px solid var(--rule);
  padding: var(--s-16) 0;
  background: var(--ink-1);
}

.chat-intent-strip {
  display: flex;
  gap: var(--s-8);
  margin-bottom: var(--s-12);
  overflow-x: auto;
  padding-bottom: var(--s-4);
}

.chat-intent-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-6);
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
  padding: var(--s-4) var(--s-12);
  font-size: 12px;
  color: var(--bone-2);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.12s ease;
}
.chat-intent-chip:hover { color: var(--bone-0); border-color: var(--brick-1); }
.chat-intent-icon { color: var(--brick-1); font-size: 14px; }

.chat-input-row {
  display: flex;
  gap: var(--s-8);
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: var(--s-4);
  align-items: center;
}
.chat-input-row:focus-within { border-color: var(--brick-1); }

/* ── Reports (Motion-style) ────────────────────────────────── */
.rep-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: var(--s-32);
  gap: var(--s-16);
}

.rep-new-btn {
  background: var(--brick-1);
  color: var(--bone-0);
  border: none;
  border-radius: var(--r-md);
  padding: var(--s-8) var(--s-16);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease;
  flex-shrink: 0;
}
.rep-new-btn:hover { background: var(--brick-0); }

.rep-grid {
  /* Legacy 2-column layout. The folder list moved into the global
     sidebar (see .s-nav-submenu), so we now use a single column. */
  display: block;
}

/* Full-width detail pane (no left rail). */
.rep-detail--full {
  width: 100%;
}

.rep-list {
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: var(--s-12);
}

.rep-list-section {
  font-family: var(--ff-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bone-4);
  padding: var(--s-8) var(--s-12) var(--s-4);
}

.rep-list-folder {
  font-size: 12px;
  color: var(--bone-2);
  padding: var(--s-6) var(--s-12);
  font-weight: 500;
}

.rep-list-item {
  display: flex; align-items: center; gap: var(--s-8);
  width: 100%;
  padding: var(--s-6) var(--s-12) var(--s-6) var(--s-24);
  font-size: 13px;
  color: var(--bone-2);
  background: none;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  text-align: left;
  transition: all 0.1s ease;
}
.rep-list-item:hover { background: var(--ink-3); color: var(--bone-1); }
.rep-list-item.active {
  background: var(--brick-wash);
  color: var(--bone-0);
}

.rep-template-icon {
  font-size: 12px;
  color: var(--bone-4);
  width: 14px;
  text-align: center;
}
.rep-list-item.active .rep-template-icon { color: var(--brick-1); }

.rep-detail {
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: var(--s-24);
  min-height: 500px;
}

.rep-detail-header {
  margin-bottom: var(--s-24);
  padding-bottom: var(--s-16);
  border-bottom: 1px solid var(--rule);
}

.rep-detail-title {
  font-family: var(--ff-display);
  font-size: 24px;
  font-weight: 500;
  color: var(--bone-0);
  letter-spacing: -0.01em;
}

.rep-detail-meta {
  font-size: 12px;
  color: var(--bone-3);
  margin-top: 4px;
}

.rep-chart-wrap {
  background: var(--ink-3);
  border-radius: var(--r-md);
  padding: var(--s-24) var(--s-20);
  margin-bottom: var(--s-24);
}

.rep-chart-svg {
  width: 100%;
  height: auto;
  display: block;
  font-family: var(--ff-body);
}

.rep-row-rank {
  font-family: var(--ff-mono);
  font-size: 11px;
  fill: var(--bone-4);
  font-weight: 500;
}

.rep-row-label {
  font-size: 13px;
  fill: var(--bone-1);
  font-weight: 500;
}

.rep-row-track {
  fill: var(--ink-1);
}

.rep-row-bar {
  transition: opacity 0.15s ease;
}
.rep-chart-svg .rep-row:hover .rep-row-bar { filter: brightness(1.1); }
.rep-chart-svg .rep-row:hover .rep-row-label { fill: var(--bone-0); }

.rep-row-value {
  font-family: var(--ff-mono);
  font-size: 12px;
  fill: var(--bone-1);
  font-weight: 500;
}

.rep-axis-tick {
  font-family: var(--ff-mono);
  font-size: 10px;
  fill: var(--bone-4);
  letter-spacing: 0.04em;
}

/* Vertical column chart (Motion-style) */
.rep-chart-card {
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: var(--s-20) var(--s-16) var(--s-12);
  margin: 0 0 var(--s-16);
}

.rep-col {
  cursor: pointer;
  transition: opacity 0.12s ease;
}
.rep-col-bar {
  transition: filter 0.15s ease;
}
.rep-col:hover .rep-col-bar { filter: brightness(1.15) drop-shadow(0 0 8px rgba(184, 65, 58, 0.4)); }
.rep-col:hover .rep-col-value { fill: var(--bone-0); opacity: 1; }

.rep-col-value {
  font-family: var(--ff-mono);
  font-size: 10px;
  font-weight: 500;
  fill: var(--bone-2);
  opacity: 0.6;
  transition: opacity 0.12s ease;
}

.rep-col-label {
  font-family: var(--ff-body);
  font-size: 10px;
  fill: var(--bone-3);
  letter-spacing: 0.02em;
}

/* Motion-style report header */
.rep-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-16);
  margin-bottom: var(--s-16);
  padding-bottom: var(--s-16);
  border-bottom: 1px solid var(--rule);
}

.rep-title-stack { min-width: 0; flex: 1; }

.rep-detail-title {
  font-family: var(--ff-display);
  font-size: 28px;
  font-weight: 500;
  color: var(--bone-0);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: var(--s-8);
  line-height: 1.1;
}
.rep-emoji {
  font-size: 24px;
  line-height: 1;
  filter: saturate(1);
}

.rep-detail-subtitle {
  font-size: 13px;
  color: var(--bone-3);
  margin-top: var(--s-4);
  max-width: 720px;
}

.rep-detail-actions {
  display: flex;
  gap: var(--s-8);
  flex-shrink: 0;
}

.rep-action-btn { font-size: 12px; padding: var(--s-6) var(--s-12); }
.rep-action-btn[disabled] { opacity: 0.4; cursor: not-allowed; }

/* Filter pill row */
.rep-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-8);
  margin-bottom: var(--s-20);
  align-items: center;
}

.rep-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--ff-body);
  font-size: 12px;
  color: var(--bone-1);
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
}
.rep-pill:hover { border-color: var(--bone-3); }
.rep-pill strong { color: var(--bone-0); font-weight: 600; margin-left: 2px; }
.rep-pill-icon { font-size: 12px; opacity: 0.8; }
.rep-pill-chev { font-size: 9px; color: var(--bone-4); margin-left: 2px; }

.rep-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--ff-body);
  font-size: 12px;
  color: var(--bone-1);
  background: var(--brick-wash);
  border: 1px solid var(--brick-rule);
  border-radius: var(--r-pill);
  padding: 6px 6px 6px 12px;
  cursor: pointer;
}
.rep-filter-chip strong { color: var(--bone-0); font-weight: 600; margin: 0 4px; }
.rep-chip-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  color: var(--bone-2);
  font-size: 13px;
  line-height: 1;
}
.rep-filter-chip:hover .rep-chip-x { color: var(--brick-0); background: rgba(255,255,255,0.12); }

.rep-add-filter {
  font-family: var(--ff-body);
  font-size: 12px;
  color: var(--bone-3);
  background: none;
  border: 1px dashed var(--rule);
  border-radius: var(--r-pill);
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.rep-add-filter:hover { color: var(--bone-1); border-color: var(--bone-3); }

/* Popover menus */
.rep-popover {
  position: fixed;
  z-index: 200;
  background: var(--ink-2);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-md);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  min-width: 200px;
  padding: 4px;
  max-height: 320px;
  overflow-y: auto;
}
.rep-popover-item {
  display: block;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  font-family: var(--ff-body);
  font-size: 13px;
  color: var(--bone-1);
  padding: var(--s-8) var(--s-12);
  cursor: pointer;
  border-radius: var(--r-sm);
}
.rep-popover-item:hover { background: var(--ink-3); }
.rep-popover-item.active { background: var(--brick-wash); color: var(--bone-0); }

/* Share + Export popovers (header buttons) */
.rep-share-popover, .rep-export-popover {
  min-width: 320px;
  padding: 0;
}
.rep-pop-head {
  padding: 10px 16px;
  font-family: var(--ff-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--bone-4);
  border-bottom: 1px solid var(--rule);
}
.rep-pop-body { padding: 10px; }
.rep-pop-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  color: var(--bone-1);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}
.rep-pop-row:hover { background: var(--ink-3); color: var(--bone-0); }
.rep-pop-icon { font-size: 14px; opacity: 0.85; width: 18px; text-align: center; }

/* Share popover internals */
.rep-share-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  gap: 12px;
  border-radius: var(--r-sm);
  background: var(--ink-3);
}
.rep-share-toggle-label {
  font-size: 12px;
  color: var(--bone-2);
  flex: 1;
}
.rep-share-url-row {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.rep-share-url {
  flex: 1;
  background: var(--ink-3);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--bone-1);
}
.rep-share-copy {
  padding: 6px 12px;
  font-size: 12px;
  white-space: nowrap;
}
.rep-share-open {
  display: block;
  margin-top: 10px;
  font-size: 12px;
  color: var(--brick-1);
  text-decoration: none;
  text-align: center;
}
.rep-share-open:hover { text-decoration: underline; }
.rep-share-hint {
  padding: 8px 0;
  text-align: center;
  font-size: 12px;
  color: var(--bone-4);
}
.rep-share-active {
  background: color-mix(in oklab, var(--brick-1) 70%, var(--ink-0)) !important;
}

/* NL section in Create modal */
.rep-nl-section {
  padding: var(--s-16);
  margin-bottom: var(--s-20);
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
}
.rep-nl-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--ff-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brick-1);
  margin-bottom: 8px;
}
.rep-nl-icon { font-size: 13px; }
.rep-nl-input {
  width: 100%;
  background: var(--ink-1);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-family: var(--ff-body);
  font-size: 13px;
  color: var(--bone-1);
  resize: vertical;
  min-height: 60px;
  outline: none;
  transition: border-color 0.12s ease;
}
.rep-nl-input:focus { border-color: var(--brick-1); }
.rep-nl-input::placeholder { color: var(--bone-4); }
.rep-nl-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  gap: 12px;
}
.rep-nl-hint {
  font-size: 11px;
  color: var(--bone-4);
  font-style: italic;
}
.rep-nl-status {
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--ink-3);
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--bone-2);
}
.rep-nl-status.err {
  background: color-mix(in oklab, var(--brick-1) 18%, var(--ink-3));
  color: var(--brick-1);
}
.rep-nl-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: var(--s-24) 0 var(--s-16);
  color: var(--bone-4);
  font-size: 11px;
  font-family: var(--ff-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.rep-nl-divider::before,
.rep-nl-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--rule);
}
.rep-nl-divider span {
  padding: 0 12px;
}

/* Explainer block on AI-generated reports */
.rep-explainer {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: color-mix(in oklab, var(--brick-1) 6%, var(--ink-2));
  border-left: 3px solid var(--brick-1);
  padding: 12px 16px;
  margin-bottom: var(--s-16);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.rep-explainer-icon { font-size: 14px; line-height: 1.4; }
.rep-explainer-body {
  font-size: 12px;
  color: var(--bone-2);
  font-style: italic;
  line-height: 1.5;
}

/* Report table toolbar (Columns button above the table) */
.rep-table-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--s-16);
  margin-bottom: var(--s-4);
}
.rep-cols-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
  padding: 5px 12px;
  font-family: var(--ff-body);
  font-size: 12px;
  color: var(--bone-2);
  cursor: pointer;
  transition: all 0.12s ease;
}
.rep-cols-btn:hover {
  border-color: var(--bone-3);
  color: var(--bone-0);
}
.rep-cols-icon { font-size: 12px; opacity: 0.8; }
.rep-cols-count {
  font-family: var(--ff-mono);
  font-size: 10px;
  background: var(--ink-3);
  color: var(--bone-2);
  padding: 1px 6px;
  border-radius: var(--r-pill);
  margin-left: 4px;
}

/* Columns popover — multi-section checkbox list */
.rep-cols-popover { min-width: 280px; max-height: 520px; }
.rep-cols-popover .rep-pop-body { max-height: 460px; overflow-y: auto; padding: 4px; }
.rep-cols-section { padding: 4px 4px 8px; }
.rep-cols-section-title {
  font-family: var(--ff-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--bone-4);
  padding: 8px 8px 4px;
}
.rep-cols-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--bone-1);
}
.rep-cols-check:hover { background: var(--ink-3); }
.rep-cols-check input[type="checkbox"] { margin: 0; }

/* Report table */
.rep-table th, .rep-table td { vertical-align: middle; }
.rep-tbl-rank {
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--bone-4);
  width: 30px;
  text-align: center;
}
.rep-tbl-thumb { width: 56px; padding-left: 4px !important; padding-right: 4px !important; }
.rep-tbl-thumb-wrap {
  width: 48px; height: 48px;
  border-radius: var(--r-sm);
  background: var(--ink-3);
  position: relative;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.rep-tbl-thumb-wrap img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  z-index: 1;
}
.rep-tbl-thumb-fallback {
  color: var(--bone-4);
  font-family: var(--ff-display);
  font-size: 18px;
  z-index: 0;
}
.rep-tbl-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--bone-1);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rep-table td:not(:first-child):not(.rep-tbl-thumb):not(.rep-tbl-name) {
  font-family: var(--ff-mono);
  font-size: 12px;
  color: var(--bone-1);
}

/* Create report modal — wide layout */
.modal-wide { max-width: 760px; }
.modal-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-sub {
  font-size: 13px;
  color: var(--bone-3);
  margin-bottom: var(--s-20);
}

.rep-template-section { margin-bottom: var(--s-24); }
.rep-template-section:last-child { margin-bottom: 0; }
.rep-template-section-title {
  font-family: var(--ff-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bone-4);
  margin-bottom: var(--s-8);
}

.rep-template-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-8);
}

.rep-template-card {
  display: flex;
  gap: var(--s-12);
  align-items: flex-start;
  padding: var(--s-12);
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  text-align: left;
  cursor: pointer;
  transition: all 0.12s ease;
}
.rep-template-card:hover {
  border-color: var(--brick-1);
  background: var(--ink-3);
}

.rep-template-card-icon {
  font-size: 22px;
  line-height: 1;
  width: 36px; height: 36px;
  background: var(--ink-3);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.rep-template-card-body { min-width: 0; flex: 1; }
.rep-template-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--bone-0);
  margin-bottom: 2px;
}
.rep-template-card-desc {
  font-size: 11px;
  color: var(--bone-3);
  line-height: 1.4;
}

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(11, 9, 7, 0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.modal-card {
  background: var(--ink-1);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: var(--s-24);
  width: 100%;
  max-width: 460px;
}

.modal-heading {
  font-family: var(--ff-display);
  font-size: 20px;
  font-weight: 500;
  color: var(--bone-0);
  margin-bottom: var(--s-16);
}

.field-label {
  display: block;
  font-family: var(--ff-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bone-3);
  margin-bottom: var(--s-6);
  margin-top: var(--s-16);
}

.s-input {
  width: 100%;
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  color: var(--bone-1);
  font-family: var(--ff-body);
  font-size: 13px;
  padding: var(--s-8) var(--s-12);
  outline: none;
  transition: border-color 0.12s ease;
}
.s-input:focus { border-color: var(--brick-1); }

.template-radios { display: flex; flex-direction: column; gap: var(--s-8); }
.template-radio {
  display: flex; align-items: flex-start; gap: var(--s-8);
  padding: var(--s-12);
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color 0.12s ease;
  font-size: 13px;
  color: var(--bone-1);
}
.template-radio:hover { border-color: var(--bone-3); }
.template-radio input { margin-top: 3px; accent-color: var(--brick-1); }
.template-radio small { color: var(--bone-3); font-size: 11px; }

.modal-actions {
  display: flex; justify-content: flex-end; gap: var(--s-8);
  margin-top: var(--s-24);
}

.btn-primary {
  background: var(--brick-1);
  color: var(--bone-0);
  border: none;
  border-radius: var(--r-md);
  padding: var(--s-8) var(--s-16);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.btn-primary:hover { background: var(--brick-0); }

.btn-ghost {
  background: none;
  color: var(--bone-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: var(--s-8) var(--s-16);
  font-size: 13px;
  cursor: pointer;
}
.btn-ghost:hover { color: var(--bone-0); border-color: var(--bone-3); }

/* ── Leaderboard (Motion-style) ────────────────────────────── */
.lb-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: var(--s-32);
}

.lb-title {
  font-family: var(--ff-display);
  font-size: 32px;
  font-weight: 500;
  color: var(--bone-0);
  letter-spacing: -0.02em;
  margin-bottom: var(--s-4);
}

.lb-subtitle {
  font-size: 14px;
  color: var(--bone-3);
}

.lb-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: var(--s-32);
  align-items: start;
}

.lb-shifts { min-width: 0; }
.lb-board { min-width: 0; }

/* Leaderboard tabs are constrained to the 360px shifts column. Smaller
   padding + smaller font so all 4 buckets fit on one line at 360px. */
.lb-shifts .s-tabs { row-gap: var(--s-6); }
.lb-shifts .s-tab {
  padding: 4px 10px;
  font-size: 12px;
}
.lb-shifts .s-tab-count {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: var(--r-pill);
  background: var(--ink-3);
}
.lb-shifts .s-tab.active .s-tab-count {
  background: var(--ink-0);
  color: var(--bone-0);
}

.lb-featured-slot { margin-top: var(--s-16); }

.lb-featured-card {
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.lb-featured-thumb {
  width: 100%;
  aspect-ratio: 4/5;
  background: var(--ink-3);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  overflow: hidden;
}
.lb-featured-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  position: absolute; inset: 0; z-index: 1;
}
.lb-featured-thumb .placeholder {
  color: var(--bone-4);
  font-family: var(--ff-display);
  font-size: 64px;
  z-index: 0;
}

.lb-featured-meta { padding: var(--s-16); }
.lb-featured-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--bone-0);
  margin-bottom: var(--s-12);
}

.lb-featured-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-8) 0;
  border-top: 1px solid var(--rule);
}
.lb-featured-row:first-of-type { border-top: none; }
.lb-featured-value {
  font-family: var(--ff-display);
  font-size: 20px;
  font-weight: 500;
  color: var(--bone-0);
}

.lb-featured-empty {
  padding: var(--s-32);
  background: var(--ink-2);
  border: 1px dashed var(--rule);
  border-radius: var(--r-lg);
  color: var(--bone-3);
  text-align: center;
  font-size: 13px;
}

.lb-row-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--bone-1);
  margin-bottom: 2px;
}
.lb-row-sub {
  font-size: 11px;
  color: var(--bone-3);
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .s-sidebar { width: 0; min-width: 0; overflow: hidden; }
  .s-sidebar.open { width: var(--sidebar-w); min-width: var(--sidebar-w); }
}
