/* Nexumlabs.ai — warm-neutral + teal, minimal */
:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --surface-2: #f4f1ec;
  --border: #e8e2d8;
  --border-strong: #d7cfc1;
  --ink: #1a1a17;
  --ink-2: #3a3732;
  --muted: #7a766e;
  --muted-2: #9e9a92;
  --accent: oklch(0.55 0.09 190);
  --accent-hover: oklch(0.48 0.10 190);
  --accent-soft: oklch(0.95 0.03 190);
  --accent-ink: oklch(0.35 0.08 190);
  --warn: oklch(0.62 0.14 45);
  --warn-soft: oklch(0.96 0.04 55);
  --danger: oklch(0.58 0.16 25);
  --danger-soft: oklch(0.96 0.03 25);
  --good: oklch(0.58 0.11 150);
  --good-soft: oklch(0.95 0.04 150);

  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(30, 25, 15, 0.04);
  --shadow-md: 0 4px 14px rgba(30, 25, 15, 0.06);
  --shadow-lg: 0 12px 40px rgba(30, 25, 15, 0.08);
}

[data-theme="dark"] {
  --bg: #16161a;
  --surface: #1d1d21;
  --surface-2: #242429;
  --border: #2b2b30;
  --border-strong: #3a3a40;
  --ink: #f2efe9;
  --ink-2: #d6d2cb;
  --muted: #8f8b83;
  --muted-2: #6b6862;
  --accent: oklch(0.72 0.10 190);
  --accent-hover: oklch(0.80 0.10 190);
  --accent-soft: oklch(0.28 0.05 190);
  --accent-ink: oklch(0.82 0.09 190);
  --warn-soft: oklch(0.32 0.06 55);
  --danger-soft: oklch(0.30 0.05 25);
  --good-soft: oklch(0.28 0.05 150);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
}

/* Font pairing tweak */
[data-fonts="editorial"] {
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Geist", ui-sans-serif, system-ui, sans-serif;
}
[data-fonts="grotesk"] {
  --serif: "Space Grotesk", ui-sans-serif, sans-serif;
  --sans: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
}
[data-fonts="humanist"] {
  --serif: "Fraunces", Georgia, serif;
  --sans: "IBM Plex Sans", ui-sans-serif, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}

button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }

/* ===== App shell ===== */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.28s cubic-bezier(.4,0,.2,1);
}
.app[data-sidebar="collapsed"] { grid-template-columns: 64px 1fr; }

/* ===== Sidebar ===== */
.sidebar {
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--bg);
  display: grid; place-items: center;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 500;
}
.brand-text { white-space: nowrap; }
[data-sidebar="collapsed"] .brand-text,
[data-sidebar="collapsed"] .nav-label,
[data-sidebar="collapsed"] .sidebar-section-label,
[data-sidebar="collapsed"] .history-list,
[data-sidebar="collapsed"] .savings-meter,
[data-sidebar="collapsed"] .user-meta,
[data-sidebar="collapsed"] .sidebar-divider-title,
[data-sidebar="collapsed"] .nav-shortcut { display: none; }
[data-sidebar="collapsed"] .sidebar { padding: 14px 8px; }
[data-sidebar="collapsed"] .nav-item { justify-content: center; padding: 8px; }
[data-sidebar="collapsed"] .user-row { justify-content: center; }
[data-sidebar="collapsed"] .new-btn .new-btn-label { display: none; }
[data-sidebar="collapsed"] .new-btn { justify-content: center; padding: 8px; }
[data-sidebar="collapsed"] .sidebar-head { justify-content: center; }

.icon-btn {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  transition: all 0.15s;
}
.icon-btn:hover { background: var(--surface); color: var(--ink); border-color: var(--border); }

.new-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin: 4px 0 10px;
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  border-radius: 8px;
  font-weight: 500;
  font-size: 13px;
  transition: all 0.15s;
  white-space: nowrap;
}
.new-btn .new-btn-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.new-btn:hover { background: var(--ink-2); }
.new-btn svg { flex-shrink: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 13px;
  background: transparent;
  border: 1px solid transparent;
  width: 100%;
  text-align: left;
  transition: all 0.12s;
  position: relative;
}
.nav-item:hover { background: var(--surface); color: var(--ink); }
.nav-item.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); border-color: var(--border); }
.nav-item svg { flex-shrink: 0; color: var(--muted); }
.nav-item.active svg { color: var(--accent-ink); }
.nav-label { flex: 1; white-space: nowrap; }
.nav-shortcut {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted-2);
  padding: 1px 5px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
}
.nav-badge {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--accent-ink);
  background: var(--accent-soft);
  padding: 1px 6px;
  border-radius: 4px;
}

.sidebar-divider-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 16px 10px 6px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.history-item {
  padding: 5px 10px;
  font-size: 12.5px;
  color: var(--muted);
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.12s;
}
.history-item:hover { background: var(--surface); color: var(--ink-2); }

.sidebar-foot { margin-top: auto; padding-top: 10px; }
.savings-meter {
  margin: 8px 4px 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
}
.savings-meter-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 4px;
}
.savings-meter-value {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.savings-meter-delta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--good);
  margin-top: 2px;
}
.savings-bar {
  height: 3px;
  background: var(--surface-2);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}
.savings-bar-fill {
  height: 100%;
  width: 62%;
  background: var(--accent);
  border-radius: 2px;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
}
.user-row:hover { background: var(--surface); }
.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, oklch(0.55 0.09 190), oklch(0.62 0.14 45));
  color: white;
  display: grid; place-items: center;
  font-size: 11.5px;
  font-weight: 600;
  flex-shrink: 0;
}
.user-meta { line-height: 1.2; overflow: hidden; }
.user-name { font-size: 12.5px; color: var(--ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-org { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== Main ===== */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid transparent;
  min-height: 56px;
}
.topbar-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.topbar-tab {
  padding: 6px 12px;
  font-size: 13px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  transition: all 0.12s;
}
.topbar-tab:hover { background: var(--surface-2); color: var(--ink); }
.topbar-tab.active { color: var(--ink); background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-sm); }

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--ink-2);
  transition: all 0.12s;
}
.pill-btn:hover { border-color: var(--border-strong); }

/* ===== Home / hero ===== */
.home {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 28px 60px;
  position: relative;
}
.wordmark {
  font-family: var(--serif);
  font-size: 68px;
  line-height: 1;
  letter-spacing: -0.035em;
  color: var(--ink);
  margin: 60px 0 8px;
  font-weight: 400;
}
.wordmark .dot { color: var(--accent); }
.tagline {
  color: var(--muted);
  font-size: 14.5px;
  margin: 0 0 36px;
  text-align: center;
  max-width: 520px;
}

.search-card {
  width: 100%;
  max-width: 680px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-card:focus-within {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
}
.search-input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 15.5px;
  padding: 18px 20px 10px;
  outline: none;
  font-family: var(--sans);
}
.search-input::placeholder { color: var(--muted); }
.search-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 10px;
}
.search-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 12px;
  color: var(--ink-2);
  transition: all 0.12s;
}
.chip:hover { background: var(--surface-2); }
.chip.active { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.chip svg { color: var(--muted); }
.chip.active svg { color: var(--accent-ink); }

.search-right { display: flex; align-items: center; gap: 8px; }
.model-select {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  font-size: 12px;
  color: var(--muted);
  border: none;
  background: transparent;
  border-radius: 6px;
}
.model-select:hover { background: var(--surface-2); color: var(--ink-2); }
.send-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  border: none;
  display: grid;
  place-items: center;
  transition: transform 0.12s, background 0.15s;
}
.send-btn:hover { transform: scale(1.04); }
.send-btn.ready { background: var(--accent); }

/* Suggestion panel */
.suggest {
  width: 100%;
  max-width: 680px;
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.suggest-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  font-size: 12.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.suggest-tabs { display: flex; gap: 4px; padding: 10px 10px 0; flex-wrap: wrap; }
.suggest-tab {
  padding: 6px 11px;
  font-size: 12.5px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.12s;
}
.suggest-tab:hover { background: var(--surface-2); color: var(--ink-2); }
.suggest-tab.active { background: var(--surface-2); color: var(--ink); border-color: var(--border); }
.suggest-tab svg { color: var(--muted); }
.suggest-tab.active svg { color: var(--accent-ink); }

.suggest-list { display: flex; flex-direction: column; }
.suggest-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  color: var(--ink-2);
  font-size: 13.5px;
  border-top: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
.suggest-item:first-child { border-top: none; }
.suggest-item:hover { background: var(--surface-2); }
.suggest-arrow { margin-left: auto; color: var(--muted-2); opacity: 0; transition: opacity 0.12s; }
.suggest-item:hover .suggest-arrow { opacity: 1; }
.suggest-kind {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 76px;
}

/* Home stats row */
.home-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 680px;
  margin-top: 24px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.stat-value {
  font-family: var(--mono);
  font-size: 18px;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.stat-delta { font-size: 11px; color: var(--good); margin-top: 2px; font-family: var(--mono); }
.stat-delta.neg { color: var(--danger); }

/* ===== Generic page header ===== */
.page {
  padding: 28px 40px 60px;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
}
@media (max-width: 720px) {
  .page { padding: 20px 20px 40px; }
}
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.page-title {
  font-family: var(--serif);
  font-size: 36px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  font-weight: 400;
}
.page-sub { color: var(--muted); font-size: 14px; margin: 0; }

.page-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.toolbar-search {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
}
.toolbar-search input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  color: var(--ink);
  font-size: 13px;
}
.seg {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}
.seg button {
  padding: 5px 10px;
  border: none;
  background: transparent;
  font-size: 12.5px;
  color: var(--muted);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.seg button.active { background: var(--surface-2); color: var(--ink); }

/* ===== Opportunity cards ===== */
.opp-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.opp-card {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  cursor: pointer;
}
@media (max-width: 900px) {
  .opp-card {
    grid-template-columns: 36px minmax(0, 1fr);
  }
  .opp-card .opp-right {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
    width: 100%;
  }
}
.opp-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.opp-logo {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink-2);
  flex-shrink: 0;
}
.opp-main { min-width: 0; }
.opp-row1 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
  row-gap: 6px;
}
.opp-vendor { font-size: 14.5px; font-weight: 500; color: var(--ink); }
.opp-category { font-size: 12px; color: var(--muted); }
.opp-row2 {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
  line-height: 1.45;
}
.opp-row3 { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.opp-row3 .dot-sep { color: var(--muted-2); }
.opp-meta-k { color: var(--muted-2); margin-right: 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.opp-meta-v { color: var(--ink-2); font-family: var(--mono); font-size: 12px; }

.opp-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.opp-savings {
  font-family: var(--mono);
  font-size: 18px;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.opp-savings-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  font-family: var(--sans);
  letter-spacing: 0.01em;
}
.badge.urgent { background: var(--danger-soft); color: var(--danger); }
.badge.soon { background: var(--warn-soft); color: var(--warn); }
.badge.scheduled { background: var(--accent-soft); color: var(--accent-ink); }
.badge.done { background: var(--good-soft); color: var(--good); }
.badge.neutral { background: var(--surface-2); color: var(--muted); }
.badge.action-renegotiate { background: var(--accent-soft); color: var(--accent-ink); }
.badge.action-cancel { background: var(--danger-soft); color: var(--danger); }
.badge.action-consolidate { background: var(--warn-soft); color: var(--warn); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Confidence pill */
.confidence {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.confidence-bar {
  width: 34px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.confidence-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}
[data-confidence="hidden"] .confidence { display: none; }

/* Card variants */
.opp-list.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}
.opp-list.grid .opp-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}
.opp-list.grid .opp-right { text-align: left; align-items: stretch; }
.opp-list.grid .grid-top { display: flex; align-items: center; gap: 12px; }
.opp-list.grid .grid-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--border); }

.opp-list.compact .opp-card { padding: 10px 14px; }
.opp-list.compact .opp-row2 { display: none; }
.opp-list.compact .opp-logo { width: 28px; height: 28px; font-size: 13px; }
.opp-list.compact { gap: 4px; }
.opp-list.compact .opp-card { border-radius: 8px; }

/* ===== Detail / negotiation plan ===== */
.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 1000px) {
  .detail-layout { grid-template-columns: minmax(0, 1fr); }
  .side-panel { position: static; }
}
.detail-main > section { margin-bottom: 24px; }
.section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 10px;
  font-weight: 500;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}
.rationale {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.45;
  color: var(--ink);
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}
.rationale .accent { color: var(--accent-ink); background: var(--accent-soft); padding: 0 4px; border-radius: 3px; }

.evidence-list { display: flex; flex-direction: column; gap: 10px; }
.evidence-item {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 13px;
}
.evidence-icon { color: var(--accent-ink); margin-top: 2px; }
.evidence-src { font-family: var(--mono); font-size: 11px; color: var(--muted); }

.plan-steps { display: flex; flex-direction: column; gap: 0; }
.plan-step {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.plan-step:last-child { border-bottom: none; }
.plan-num {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  display: grid; place-items: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  background: var(--surface);
}
.plan-step.done .plan-num { background: var(--accent); border-color: var(--accent); color: white; }
.plan-title { font-size: 13.5px; color: var(--ink); font-weight: 500; margin: 3px 0 3px; }
.plan-body { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

.email-draft {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-2);
  white-space: pre-wrap;
  line-height: 1.55;
}

/* Sidebar panel on detail */
.side-panel { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 20px; }
.kv { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv-k { color: var(--muted); }
.kv-v { font-family: var(--mono); color: var(--ink); }
.target-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 0;
}
.target-labels { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); font-family: var(--mono); gap: 12px; }
.target-labels span { white-space: nowrap; }
.target-bar {
  position: relative;
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}
.target-bar-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--good), var(--accent));
  border-radius: 3px;
}
.target-bar-tick {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 12px;
  background: var(--ink);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  width: 100%;
  transition: all 0.15s;
}
.btn-primary:hover { background: var(--ink-2); }
.btn-primary.accent { background: var(--accent); border-color: var(--accent); color: white; }
.btn-primary.accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.12s;
  white-space: nowrap;
}
.btn-secondary:hover { border-color: var(--border-strong); background: var(--surface-2); }

/* ===== Data sources / CSV upload ===== */
.sources-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.drop-zone {
  border: 1.5px dashed var(--border-strong);
  border-radius: 12px;
  padding: 26px 22px;
  background: var(--surface);
  transition: all 0.15s;
}
.drop-zone:hover { border-color: var(--accent); background: var(--accent-soft); }
.drop-title { font-size: 15px; color: var(--ink); font-weight: 500; margin: 10px 0 4px; }
.drop-hint { font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.drop-files {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.drop-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: var(--surface-2);
  border-radius: 7px;
  font-size: 12.5px;
}
.drop-file-name { color: var(--ink-2); flex: 1; }
.drop-file-meta { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* Execution modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 18, 14, 0.45);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  width: min(560px, 92vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: var(--shadow-lg);
  transform: translateY(6px);
  transition: transform 0.18s;
}
.modal-backdrop.open .modal { transform: translateY(0); }
.modal-title { font-family: var(--serif); font-size: 22px; margin: 0 0 8px; letter-spacing: -0.01em; }
.modal-sub { color: var(--muted); font-size: 13.5px; margin: 0 0 16px; }

.run-steps { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 18px; }
.run-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 13px;
}
.run-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--border-strong);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.run-step.done .run-dot { background: var(--good); }
.run-step.active .run-dot { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--accent-soft); }
  50% { box-shadow: 0 0 0 8px transparent; }
}
.run-step.pending { color: var(--muted); }
.run-time { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* ===== Tweaks panel ===== */
.tweaks-fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  display: grid; place-items: center;
  z-index: 70;
  transition: all 0.15s;
}
.tweaks-fab:hover { border-color: var(--border-strong); color: var(--ink); }

.tweaks {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 14px 14px 12px;
  z-index: 80;
  display: none;
}
.tweaks.open { display: block; }
.tweaks-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 10px; }
.tweak-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; font-size: 13px; }
.tweak-row label { color: var(--ink-2); }
.tweak-row select, .tweak-row .toggle {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--ink-2);
  font-family: inherit;
}
.toggle {
  position: relative;
  width: 34px; height: 20px;
  border-radius: 999px;
  cursor: pointer;
  padding: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.toggle::after {
  content: "";
  position: absolute;
  top: 1px; left: 1px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  transition: transform 0.15s;
}
.toggle[data-on="true"] { background: var(--accent); border-color: var(--accent); }
.toggle[data-on="true"]::after { transform: translateX(14px); background: white; border-color: transparent; }

/* Variations tab row (for main feed layouts) */
.variations {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 3px;
  width: fit-content;
}
.variations button {
  padding: 6px 12px;
  border: none;
  background: transparent;
  font-size: 12.5px;
  color: var(--muted);
  border-radius: 5px;
}
.variations button.active { background: var(--surface-2); color: var(--ink); }

/* Savings */
.savings-big {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
.savings-big .card { padding: 18px 22px; }
.savings-hero-value {
  font-family: var(--mono);
  font-size: 44px;
  letter-spacing: -0.025em;
  color: var(--ink);
  line-height: 1;
  margin: 8px 0 4px;
}
.savings-hero-label { color: var(--muted); font-size: 13px; }

.chart {
  height: 140px;
  margin-top: 12px;
  display: flex;
  align-items: flex-end;
  gap: 6px;
}
.chart-bar {
  flex: 1;
  background: var(--accent-soft);
  border-radius: 3px 3px 0 0;
  position: relative;
}
.chart-bar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: var(--h, 0);
  background: var(--accent);
  border-radius: 3px 3px 0 0;
}

.outcomes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.outcomes-table th {
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.outcomes-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--ink-2);
}
.outcomes-table tr:last-child td { border-bottom: none; }
.outcomes-table .num { font-family: var(--mono); text-align: right; }

/* Answer view (NL query result) */
.answer-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  max-width: 820px;
  margin: 0 auto;
}
.answer-query {
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  font-weight: 400;
}
.answer-meta { font-size: 12.5px; color: var(--muted); margin-bottom: 20px; }
.answer-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.answer-tab {
  padding: 8px 14px;
  font-size: 13px;
  background: transparent;
  border: none;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.answer-tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.answer-prose {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-2);
  margin-bottom: 24px;
}
.answer-prose p { margin: 0 0 14px; }
.answer-prose .cite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 10px;
  margin: 0 2px;
  vertical-align: super;
  line-height: 1;
}
.answer-key-findings {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.finding {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}
.finding-num {
  font-family: var(--mono);
  font-size: 24px;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.finding-label { font-size: 12px; color: var(--muted); line-height: 1.4; }

.related {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--border);
  margin-top: 24px;
  padding-top: 14px;
}
.related-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 8px; }
.related-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 4px;
  color: var(--ink-2);
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.related-item:hover { color: var(--ink); }
.related-item svg { color: var(--muted); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

/* Small helpers */
.row { display: flex; align-items: center; gap: 8px; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }

/* Page transition */
.screen { display: none; animation: fadeIn 0.24s ease-out; }
.screen.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Mobile menu button ===== */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 90;
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-2);
  box-shadow: var(--shadow-sm);
  place-items: center;
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.4);
  z-index: 95;
  opacity: 0;
  transition: opacity 0.2s;
}
.sidebar-backdrop.open { display: block; opacity: 1; }

/* ===== Responsive: tablet ≤1000px ===== */
@media (max-width: 1000px) {
  .home-stats { grid-template-columns: repeat(2, 1fr); }
  .answer-key-findings { grid-template-columns: repeat(2, 1fr); }
  .savings-big { grid-template-columns: 1fr 1fr; }
  .savings-big .card:first-child { grid-column: 1 / -1; }
  .sources-grid { grid-template-columns: 1fr; }
}

/* ===== Responsive: mobile ≤768px ===== */
@media (max-width: 768px) {
  .app,
  .app[data-sidebar="collapsed"] { grid-template-columns: 1fr; }

  .mobile-menu-btn { display: grid; }

  .sidebar {
    position: fixed;
    left: 0; top: 0;
    width: 280px;
    height: 100vh;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.26s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--shadow-lg);
  }
  .sidebar[data-mobile-open="true"] { transform: translateX(0); }

  .page { padding: 56px 16px 40px; max-width: 100%; }
  .home { padding: 56px 16px 40px; }
  .wordmark { font-size: 48px; margin: 20px 0 8px; }
  .tagline { font-size: 13.5px; margin-bottom: 24px; }

  .page-title { font-size: 26px; }
  .answer-query { font-size: 22px; }

  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .page-header > .row { width: 100%; flex-wrap: wrap; }

  .search-card { border-radius: 12px; }
  .search-input { font-size: 15px; padding: 14px 14px 8px; }
  .search-toolbar { flex-direction: column; align-items: stretch; gap: 8px; padding: 8px 10px 10px; }
  .search-chips { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
  .search-chips::-webkit-scrollbar { display: none; }
  .search-right { justify-content: flex-end; }

  .home-stats { grid-template-columns: repeat(2, 1fr); }
  .answer-key-findings { grid-template-columns: 1fr; }
  .savings-big { grid-template-columns: 1fr; }
  .savings-big .card:first-child { grid-column: auto; }
  .savings-hero-value { font-size: 36px; }

  .detail-layout { grid-template-columns: 1fr; gap: 16px; }
  .side-panel { position: static; }

  .opp-card { padding: 14px; gap: 12px; }
  .opp-list.grid { grid-template-columns: 1fr; }

  .variations { width: 100%; overflow-x: auto; }
  .page-toolbar { flex-direction: column; align-items: stretch; }
  .page-toolbar .seg { overflow-x: auto; width: 100%; }
  .seg button { white-space: nowrap; }

  .outcomes-table { font-size: 12px; }
  .outcomes-table th, .outcomes-table td { padding: 8px 10px; }
  .card > .outcomes-table { display: block; overflow-x: auto; }

  .drop-zone { padding: 20px 16px; }

  .answer-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .answer-tab { white-space: nowrap; }

  .suggest-tabs { overflow-x: auto; flex-wrap: nowrap; padding-right: 10px; }
  .suggest-tab { white-space: nowrap; flex-shrink: 0; }

  .modal { padding: 18px; border-radius: 12px; }
  .tweaks { right: 8px; bottom: 64px; width: calc(100vw - 16px); max-width: 300px; }
  .tweaks-fab { right: 12px; bottom: 12px; }
}

/* ===== Responsive: small phone ≤420px ===== */
@media (max-width: 420px) {
  .home-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat { padding: 10px 12px; }
  .wordmark { font-size: 40px; }
  .page-title { font-size: 22px; }
  .answer-query { font-size: 20px; }
  .page { padding: 56px 12px 32px; }
  .home { padding: 48px 12px 32px; }
  .outcomes-table th, .outcomes-table td { padding: 8px; font-size: 11.5px; }
}

/* ───── Landing container + CTAs ───── */
.lp-container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}
.lp-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
@media (max-width: 600px) {
  .lp-container { padding: 0 18px; }
}
@media (max-width: 420px) {
  .lp-container { padding: 0 14px; }
}

/* ───── Landing Nav ───── */
.lp-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}
.lp-nav.scrolled { border-color: var(--border); }
.lp-nav-inner {
  max-width: 1080px; margin: 0 auto;
  padding: 0 24px; height: 60px;
  display: flex; align-items: center; justify-content: space-between;
}
.lp-nav-logo {
  font-family: "Space Grotesk", sans-serif; font-size: 19px; font-weight: 500;
  color: var(--ink); text-decoration: none; letter-spacing: -0.02em;
  display: inline-flex; align-items: center; gap: 10px;
}
.lp-nav-logo .logo-mark {
  width: 26px; height: 26px; flex-shrink: 0; display: block;
}
.lp-nav-logo .dot { color: var(--accent-ink); font-weight: 600; }
.lp-nav-links {
  display: flex; align-items: center; gap: 8px;
}
.lp-nav-link {
  font-family: var(--sans); font-size: 13.5px; font-weight: 450;
  color: var(--muted); text-decoration: none; padding: 6px 12px;
  border-radius: 6px; transition: color 0.15s, background 0.15s;
}
.lp-nav-link:hover { color: var(--ink); background: var(--surface-2); }
.lp-nav-cta {
  font-family: var(--sans); font-size: 13px; font-weight: 550;
  background: var(--ink); color: var(--bg);
  border: 1px solid var(--ink); border-radius: 999px;
  padding: 7px 16px; text-decoration: none;
  transition: background 0.15s, transform 0.15s;
}
.lp-nav-cta:hover { background: var(--ink-2); transform: translateY(-1px); }

/* ───── Mobile hamburger ───── */
.lp-nav-toggle {
  display: none;
  flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 0;
  background: transparent; border: 1px solid var(--border);
  border-radius: 8px;
  width: 40px; height: 40px;
  cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.lp-nav-toggle:hover { background: var(--surface); border-color: var(--border-strong); }
.lp-nav-toggle .bar {
  display: block; width: 18px; height: 1.5px;
  background: var(--ink); border-radius: 2px;
  transform-origin: center;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.lp-nav.open .lp-nav-toggle .bar:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.lp-nav.open .lp-nav-toggle .bar:nth-child(2) { opacity: 0; }
.lp-nav.open .lp-nav-toggle .bar:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

@media (max-width: 720px) {
  .lp-nav-inner { padding: 0 18px; height: 56px; }
  .lp-nav-toggle { display: inline-flex; }
  .lp-nav-links {
    position: absolute; top: 56px; left: 0; right: 0;
    flex-direction: column; align-items: stretch;
    gap: 0; padding: 12px 18px 20px;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 12px 24px -12px rgba(0,0,0,0.08);
    transform: translateY(-8px); opacity: 0; pointer-events: none;
    transition: transform 0.18s ease, opacity 0.18s ease;
  }
  .lp-nav.open .lp-nav-links {
    transform: translateY(0); opacity: 1; pointer-events: auto;
  }
  .lp-nav-link {
    padding: 14px 4px; font-size: 16px;
    border-bottom: 1px solid var(--border); border-radius: 0;
    color: var(--ink);
  }
  .lp-nav-link:hover { background: transparent; }
  .lp-nav-cta {
    margin-top: 12px; padding: 12px 18px;
    font-size: 15px; justify-content: center;
  }
}

/* ───── Landing Footer ───── */
.lp-footer {
  border-top: 1px solid var(--border);
  padding: 22px 0;
}
.lp-footer-inner {
  max-width: 1080px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.lp-footer-copy {
  font-family: var(--mono); font-size: 12px; color: var(--muted);
}
.lp-footer-links {
  display: flex; gap: 20px;
}
.lp-footer-links a {
  font-family: var(--sans); font-size: 13px; color: var(--muted);
  text-decoration: none; transition: color 0.15s;
}
.lp-footer-links a:hover { color: var(--ink); }

@media (max-width: 600px) {
  .lp-nav-inner { padding: 0 16px; }
  .lp-footer-inner { flex-direction: column; align-items: flex-start; }
}

