/* ==========================================================================
   Bid Farm (bid.farm) Design System — OKLCH Tokens, Quiet Chrome, Zero AI-Slop
   References: Attio, Clay, Ramp, Stripe Dashboard, Linear + ui-design skill
   ========================================================================== */

:root {
  /* Warm-tinted alabaster & stone neutral ramp (oklch) */
  --bg: oklch(0.986 0.004 75);
  --surface: oklch(1 0 0);
  --surface-subtle: oklch(0.968 0.005 75);
  --surface-hover: oklch(0.955 0.006 75);
  --border: oklch(0.902 0.007 75);
  --border-strong: oklch(0.835 0.009 75);

  /* Ink & accessible muted tones (>= 4.5:1 AA on white/alabaster) */
  --fg: oklch(0.185 0.010 75);
  --fg-secondary: oklch(0.37 0.010 75);
  --fg-muted: oklch(0.48 0.009 75);

  /* ONE accent hue: Editorial Burnt Copper / Terracotta */
  --accent: oklch(0.535 0.155 36);
  --accent-hover: oklch(0.475 0.155 36);
  --accent-fg: oklch(0.99 0.004 75);
  --accent-soft: oklch(0.955 0.024 36);
  --accent-border: oklch(0.84 0.065 36);

  /* Semantic colors (strictly for real status meaning) */
  --success: oklch(0.46 0.125 155);
  --success-soft: oklch(0.955 0.025 155);
  --destructive: oklch(0.51 0.17 24);
  --destructive-soft: oklch(0.96 0.025 24);

  /* Typography */
  --font-display: "Newsreader", Georgia, serif;
  --font-sans: "Instrument Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;

  /* Radius scale derived from one base token */
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;

  /* Two elevation levels only */
  --shadow-float:
    0 1px 2px oklch(0 0 0 / 0.05),
    0 6px 18px oklch(0 0 0 / 0.08),
    0 18px 36px oklch(0 0 0 / 0.06);

  /* Motion tokens */
  --ease-out: cubic-bezier(0.16, 1, 0.30, 1);
  --dur-fast: 130ms;
  --dur-base: 210ms;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.hidden { display: none !important; }

/* Icons — uniform 16px Lucide stroke */
.ic {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.btn-lg { padding: 11px 18px; font-size: 14.5px; }
.btn-full { width: 100%; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-outline {
  background: var(--surface);
  color: var(--fg);
  border-color: var(--border-strong);
}
.btn-outline:hover { background: var(--surface-hover); border-color: var(--fg-muted); }

.btn-ghost {
  background: transparent;
  color: var(--fg-secondary);
}
.btn-ghost:hover { background: var(--surface-hover); color: var(--fg); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--fg); }

.text-link {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}
.text-link:hover { text-decoration: underline; }

/* =========================================================
   LANDING PAGE
   ========================================================= */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  background: oklch(0.986 0.004 75 / 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--fg);
}
.brand-glyph {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: var(--fg);
  position: relative;
  display: inline-block;
}
.brand-glyph::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 2px solid var(--accent);
  border-radius: 2px;
}
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -0.015em; white-space: nowrap; }

.nav-links { display: flex; gap: 24px; }
.nav-links a {
  text-decoration: none;
  color: var(--fg-secondary);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
}
.nav-links a:hover { color: var(--fg); }
.nav-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
@media (max-width: 720px) { .nav-links { display: none; } }
@media (max-width: 520px) {
  .nav-inner { gap: 8px; }
  .nav-actions { gap: 6px; }
  .nav-actions .btn { padding: 6px 10px; font-size: 12.5px; }
  #navOpenSuiteBtn { display: none !important; }
}

/* Editorial Hero + Live Feeding Tape Counter */
.hero-band { padding: 52px 0 42px; }
.hero-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 44px;
}
.hero-inner { flex: 1 1 640px; min-width: 0; max-width: 710px; }
.hero-kicker {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.07em;
  color: var(--accent);
  margin-bottom: 16px;
}
.display-title {
  font-family: var(--font-display);
  font-size: clamp(34px, 4.4vw, 52px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--fg);
  margin-bottom: 20px;
}
.hero-lede {
  font-size: 16px;
  line-height: 1.6;
  color: var(--fg-secondary);
  max-width: 58ch;
  margin-bottom: 26px;
}
.hero-cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.hero-meta-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
}
.meta-sep { color: var(--border-strong); }

/* Feeding Tape Widget (faithful to B3 reference mockup) */
@keyframes tapeBreathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.28; } }
.tape-col {
  flex: 0 0 388px;
  max-width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.tape-shadow {
  filter: drop-shadow(0 8px 14px rgba(26, 25, 21, 0.12));
}
.tape-stage {
  position: relative;
  height: 238px;
  overflow: hidden;
  perspective: 900px;
  perspective-origin: 180px 100%;
}
.tape-strip {
  position: absolute;
  left: 20px;
  width: 320px;
  overflow: hidden;
  will-change: transform;
}
.tape-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 26px;
  box-sizing: border-box;
  padding: 0 15px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #3D3A34;
}
.tape-st { width: 18px; flex-shrink: 0; font-weight: 500; }
.tape-lbl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tape-amt { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.tape-slot {
  width: 372px;
  max-width: 100%;
  height: 2px;
  background: #1A1915;
}
.tape-odometer {
  margin-top: 20px;
  display: flex;
  align-items: baseline;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(34px, 3.6vw, 46px);
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.tape-ch { display: inline-block; text-align: center; }
.tape-caption {
  margin-top: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.09em;
  color: var(--fg-muted);
}
.tape-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  animation: tapeBreathe 2.8s ease-in-out infinite;
}
.tape-replay-btn {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-muted);
  cursor: pointer;
}
.tape-replay-btn:hover { color: var(--fg); border-color: var(--border-strong); }

@media (max-width: 1040px) {
  .hero-grid { flex-direction: column; align-items: flex-start; gap: 32px; }
  .tape-col { width: 100%; max-width: 388px; }
}
@media (max-width: 440px) {
  .tape-stage { height: 215px; }
  .tape-strip { left: 6px; width: 296px; }
  .tape-odometer { font-size: 32px; }
}

/* Section Rhythm */
section[id] { scroll-margin-top: 72px; }
.preview-band { padding: 24px 0 72px; }
.band-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.section-h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 6px;
}
.section-desc { font-size: 14.5px; color: var(--fg-secondary); max-width: 62ch; }

/* Database Table (Shared by Landing Preview & Workspace) */
.table-frame {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.table-scroll { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}
.data-table thead th {
  background: var(--surface-subtle);
  color: var(--fg-muted);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table thead th.sortable { cursor: pointer; user-select: none; }
.data-table thead th.sortable:hover { color: var(--fg); }
.data-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--fg);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr {
  transition: background-color var(--dur-fast) var(--ease-out);
}
.data-table tbody tr:hover { background: var(--surface-hover); }
.interactive-table tbody tr { cursor: pointer; }
.interactive-table tbody tr.selected-row { background: var(--accent-soft); }

.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.mono-cell { font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; color: var(--fg-secondary); white-space: nowrap; }
.proj-primary { font-weight: 500; color: var(--fg); display: block; }
.proj-sub { font-size: 12px; color: var(--fg-muted); display: block; margin-top: 2px; }

.stage-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-secondary);
  white-space: nowrap;
}
.stage-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--success);
}
.stage-dot.sub-bid::before { background: var(--accent); }

.trade-list-cell { display: flex; flex-wrap: wrap; gap: 4px; max-width: 210px; }
.trade-chip {
  font-size: 11.5px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--fg-secondary);
  white-space: nowrap;
}

.locked-cell {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.locked-blur { filter: blur(4px); opacity: 0.72; }

.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface-subtle);
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--fg-muted);
  flex-wrap: wrap;
}
.table-empty { text-align: center; padding: 48px 16px !important; color: var(--fg-muted); }

/* CRM Band */
.crm-band {
  padding: 64px 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.crm-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.95fr;
  gap: 48px;
  align-items: start;
}
@media (max-width: 860px) { .crm-grid { grid-template-columns: 1fr; gap: 32px; } }
.eyebrow-muted {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  margin-bottom: 8px;
}
.body-copy {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--fg-secondary);
  max-width: 58ch;
  margin-bottom: 24px;
}

.inline-crm-form {
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.form-title { font-size: 13.5px; font-weight: 600; margin-bottom: 12px; }
.crm-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
@media (max-width: 540px) { .crm-form-row { grid-template-columns: 1fr; } }
.crm-form-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.crm-form-row .field, .two-fields .field { margin-bottom: 0; }
.field label { font-size: 12px; font-weight: 500; color: var(--fg-secondary); }
.field input, .field select {
  font-family: var(--font-sans);
  font-size: 13.5px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--fg);
}
.field input::placeholder { color: var(--fg-muted); }

.schema-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-subtle);
  overflow: hidden;
}
.schema-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.mono-label { font-family: var(--font-mono); font-size: 12px; font-weight: 500; color: var(--fg-secondary); }
.schema-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--fg-muted);
}
.code-block {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  padding: 16px;
  color: var(--fg);
  overflow-x: auto;
}

/* Pricing Band */
.pricing-band {
  padding: 64px 0 80px;
  border-top: 1px solid var(--border);
}
.pricing-two {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  max-width: 840px;
}
@media (max-width: 720px) { .pricing-two { grid-template-columns: 1fr; } }
.plan-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.plan-featured { border-color: var(--accent-border); }
.plan-top { display: flex; justify-content: space-between; align-items: center; }
.plan-name { font-size: 15px; font-weight: 600; }
.plan-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 4px;
}
.plan-price { display: flex; align-items: baseline; gap: 6px; }
.mono-price { font-family: var(--font-mono); font-size: 34px; font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.plan-unit { font-size: 13px; color: var(--fg-muted); }
.plan-desc { font-size: 13.5px; color: var(--fg-secondary); }
.plan-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
  color: var(--fg-secondary);
  margin: 4px 0 12px;
  flex: 1;
}
.plan-features li::before { content: "— "; color: var(--fg-muted); }

.site-footer { border-top: 1px solid var(--border); padding: 20px 0; font-size: 12.5px; color: var(--fg-muted); }
.footer-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mono-muted { font-family: var(--font-mono); font-size: 12px; color: var(--fg-muted); }

/* =========================================================
   FULL DATABASE SUITE WORKSPACE
   ========================================================= */
.brand-logo-img {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.workspace-shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

.sidebar {
  height: 100vh;
  overflow-y: auto;
  background: var(--surface-subtle);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 16px;
}

.ws-main { min-width: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }

@media (max-width: 820px) {
  .workspace-shell {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 25;
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    height: auto;
    overflow-x: hidden;
    padding: 10px 14px;
    gap: 8px;
    border-right: none !important;
    border-bottom: 1px solid var(--border);
    background: oklch(0.986 0.004 75 / 0.96);
    backdrop-filter: blur(8px);
  }
  .sidebar-top {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0;
  }
  .side-nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-item {
    width: auto;
    white-space: nowrap;
    padding: 6px 10px;
    font-size: 12.5px;
    flex-shrink: 0;
  }
  .sidebar-bottom {
    flex-direction: row;
    overflow-x: auto;
    border-top: none;
    padding-top: 0;
    gap: 6px;
    scrollbar-width: none;
  }
  .sidebar-bottom::-webkit-scrollbar { display: none; }
  .side-subtle-btn {
    white-space: nowrap;
    padding: 5px 8px;
    font-size: 12px;
    flex-shrink: 0;
  }
  .ws-main { height: auto; overflow: visible; }
}
.sidebar-top { padding: 4px 8px; display: flex; flex-direction: column; gap: 8px; }
.ws-status {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--success);
  background: var(--success-soft);
  padding: 3px 8px;
  border-radius: 4px;
  width: fit-content;
}

.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--fg-secondary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.side-item:hover { background: var(--surface-hover); color: var(--fg); }
.side-item.active {
  background: var(--surface);
  color: var(--fg);
  box-shadow: 0 1px 2px oklch(0 0 0 / 0.05);
  border: 1px solid var(--border);
}
.side-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

.sidebar-bottom {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.side-subtle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--fg-muted);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}
.side-subtle-btn:hover { background: var(--surface-hover); color: var(--fg); }

@media (max-width: 820px) {
  .workspace-shell {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 25;
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    height: auto;
    overflow-x: hidden;
    padding: 10px 14px;
    gap: 8px;
    border-right: none !important;
    border-bottom: 1px solid var(--border);
    background: oklch(0.986 0.004 75 / 0.96);
    backdrop-filter: blur(8px);
  }
  .sidebar-top {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0;
  }
  .side-nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-item {
    width: auto;
    white-space: nowrap;
    padding: 6px 10px;
    font-size: 12.5px;
    flex-shrink: 0;
  }
  .sidebar-bottom {
    flex-direction: row;
    overflow-x: auto;
    border-top: none;
    padding-top: 0;
    gap: 6px;
    scrollbar-width: none;
  }
  .sidebar-bottom::-webkit-scrollbar { display: none; }
  .side-subtle-btn {
    white-space: nowrap;
    padding: 5px 8px;
    font-size: 12px;
    flex-shrink: 0;
  }
  .ws-main { height: auto; overflow: visible; }
}

.ws-main { min-width: 0; display: flex; flex-direction: column; }
.ws-pane { padding: 24px 28px; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 640px) {
  .ws-pane { padding: 16px; }
  .kv-grid { grid-template-columns: 1fr; }
  .kv-val { overflow-wrap: break-word; word-break: normal; }
  .schema-row { flex-direction: column; align-items: flex-start; gap: 2px; }
  .schema-row span { white-space: normal; }
}

.ws-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}
.ws-title { font-size: 20px; font-weight: 600; letter-spacing: -0.015em; }
.ws-sub { font-size: 13px; color: var(--fg-muted); margin-top: 2px; }
.ws-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Segment Control (Commercial vs High-Ticket Residential vs Forced-CapEx & Storm) */
.seg-bar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.seg-bar::-webkit-scrollbar { display: none; }
.seg-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--fg-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.seg-pill:hover { color: var(--fg); }
.seg-pill.active {
  background: var(--surface);
  color: var(--fg);
  box-shadow: 0 1px 2px oklch(0 0 0 / 0.06);
}
.seg-ct {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

/* Database Toolbar */
.db-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.search-box {
  position: relative;
  flex: 1;
  min-width: 220px;
}
.search-ic {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-muted);
  pointer-events: none;
}
.search-box input {
  width: 100%;
  padding: 7px 10px 7px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13px;
  background: var(--bg);
  color: var(--fg);
}
.db-toolbar select {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg);
}
.zip-radius-combo { display: inline-flex; align-items: center; }
.zip-radius-combo input {
  width: 72px;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12.5px;
  text-align: center;
  background: var(--bg);
  color: var(--fg);
}
.zip-radius-combo select { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.toggle-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg-secondary);
  cursor: pointer;
  padding: 4px 6px;
}

.db-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

/* Sub-pages */
.two-pane-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 860px) { .two-pane-grid { grid-template-columns: 1fr; } }
.surface-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.box-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.sub-box-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.box-desc { font-size: 13.5px; color: var(--fg-secondary); margin-bottom: 16px; }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.divider-sm { height: 1px; background: var(--border); margin: 18px 0; }

.field-map-list { display: flex; flex-direction: column; gap: 7px; font-family: var(--font-mono); font-size: 12px; }
.field-map-list > div { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.field-map-list > div span:first-child { color: var(--accent); font-weight: 500; }
.field-map-list > div span:last-child { color: var(--fg-muted); text-align: right; }

.rules-list { display: flex; flex-direction: column; gap: 8px; }
.rule-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.rule-title { font-size: 13.5px; font-weight: 600; }
.rule-meta { font-family: var(--font-mono); font-size: 11.5px; color: var(--fg-muted); margin-top: 2px; }
.empty-muted { font-size: 13px; color: var(--fg-muted); padding: 12px 0; }

/* Right-Hand Slide-Over Record Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: oklch(0.15 0.01 75 / 0.28);
  z-index: 60;
}
.record-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(460px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-float);
  z-index: 70;
  display: flex;
  flex-direction: column;
}
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.drawer-title { font-size: 17px; font-weight: 600; line-height: 1.3; margin-top: 3px; }
.drawer-body { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kv-item.full { grid-column: span 2; }
.kv-lbl { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--fg-muted); margin-bottom: 3px; }
.kv-val { font-size: 13.5px; font-weight: 500; color: var(--fg); word-break: break-word; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.scope-box {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 13px;
  color: var(--fg-secondary);
  line-height: 1.55;
}

/* Territory Empty State inside Workspace */
.territory-prompt {
  padding: 32px 24px;
  max-width: 520px;
  margin: 0 auto;
  text-align: left;
}
.territory-prompt h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.territory-prompt p { font-size: 13.5px; color: var(--fg-secondary); margin-bottom: 14px; }

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: oklch(0.15 0.01 75 / 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  padding: 16px;
}
.modal-dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  max-width: 490px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  padding: 22px;
}
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.modal-head h3 { font-size: 19px; font-weight: 600; letter-spacing: -0.015em; }
.modal-sub { font-size: 13.5px; color: var(--fg-secondary); margin-bottom: 16px; }
.modal-plan-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.mp-title { font-size: 14px; font-weight: 600; }
.mp-meta { font-size: 12px; color: var(--fg-muted); }
.mono-price-sm { font-family: var(--font-mono); font-size: 18px; font-weight: 500; color: var(--accent); }
.modal-form { display: flex; flex-direction: column; gap: 12px; }
.form-feedback { font-size: 12.5px; font-weight: 500; color: var(--success); }
.form-error {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--destructive);
  background: var(--destructive-soft);
  padding: 9px 11px;
  border-radius: var(--radius-sm);
}
/* Append contractor-first landing blocks, sample badge, pipeline selector, and mobile truck view */
.sources-strip {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--fg-muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.sources-label { font-weight: 600; color: var(--fg-secondary); }

.sample-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--success);
  background: var(--success-soft);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}
.sample-row { background: oklch(0.985 0.012 155 / 0.5); }

.workflow-box {
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-left: 1px solid var(--border);
  padding-left: 28px;
}
@media (max-width: 860px) {
  .workflow-box { border-left: none; padding-left: 0; border-top: 1px solid var(--border); padding-top: 24px; }
}
.wf-step { display: flex; gap: 14px; align-items: flex-start; }
.wf-num {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 7px;
  border-radius: 4px;
  flex-shrink: 0;
}
.wf-title { font-size: 14.5px; font-weight: 600; margin-bottom: 3px; }
.wf-desc { font-size: 13.5px; color: var(--fg-secondary); line-height: 1.55; }

.single-offer-wrap {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 44px;
  align-items: start;
}
@media (max-width: 820px) { .single-offer-wrap { grid-template-columns: 1fr; gap: 24px; } }
.guarantee-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--success);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-top: 12px;
}
.g-title { font-size: 13.5px; font-weight: 600; color: var(--fg); margin-bottom: 4px; }
.g-desc { font-size: 13px; color: var(--fg-secondary); line-height: 1.55; }

.footer-link, .footer-link-btn {
  color: var(--fg-secondary);
  text-decoration: none;
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
}
.footer-link:hover, .footer-link-btn:hover { color: var(--fg); text-decoration: underline; }
.footer-links { display: flex; gap: 10px; align-items: center; }

/* Pipeline select inside table & drawer */
.stage-select {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 7px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--fg);
}
.notes-area {
  width: 100%;
  min-height: 76px;
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 9px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg);
  resize: vertical;
}

/* Responsive Mobile Card View (Usable in a truck!) */
.mobile-only { display: none; }
@media (max-width: 768px) {
  .desktop-only { display: none; }
  .mobile-only { display: flex; flex-direction: column; gap: 10px; }
}
.m-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.m-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.m-card-title { font-size: 15px; font-weight: 600; color: var(--fg); }
.m-card-meta { font-size: 12.5px; color: var(--fg-muted); }
.m-card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* V2 Conversion: Friday Top-5 Digest Strip, Incumbent Comparison, 2-Tier Pricing & Plan Picker */
.digest-strip {
  margin-top: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.digest-title {
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg);
  margin-bottom: 3px;
}
.digest-sub {
  font-size: 13px;
  color: var(--fg-secondary);
  margin-bottom: 14px;
}
.digest-form {
  display: grid;
  grid-template-columns: 1.25fr 0.9fr 1fr auto;
  gap: 10px;
  align-items: end;
}
.digest-form .field { margin-bottom: 0; }
.digest-form .digest-btn { height: 37px; }
@media (max-width: 860px) {
  .digest-form { grid-template-columns: 1fr 1fr; }
  .digest-form .digest-btn { grid-column: span 2; width: 100%; }
}
@media (max-width: 540px) {
  .digest-form { grid-template-columns: 1fr; }
  .digest-form .digest-btn { grid-column: span 1; }
}

.compare-band {
  padding: 56px 0;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.compare-table thead th { font-size: 11px; }
.compare-table tbody td { padding: 12px 14px; }
.compare-muted { color: var(--fg-muted) !important; font-size: 12.5px; }
.compare-table tbody tr.compare-highlight {
  background: var(--accent-soft);
}
.compare-table tbody tr.compare-highlight:hover {
  background: var(--accent-soft);
}
.compare-table tbody tr.compare-highlight td {
  border-top: 1px solid var(--accent-border);
}
.compare-tag {
  display: inline-block;
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--accent-border);
  padding: 1px 6px;
  border-radius: 4px;
  vertical-align: middle;
}

.single-offer-wrap.pricing-split {
  grid-template-columns: 0.85fr 1.35fr;
  gap: 36px;
  align-items: start;
}
.pricing-split .pricing-two {
  max-width: none;
  gap: 16px;
}
@media (max-width: 980px) {
  .single-offer-wrap.pricing-split { grid-template-columns: 1fr; gap: 24px; }
}

.plan-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
@media (max-width: 460px) {
  .plan-picker { grid-template-columns: 1fr; }
}
.plan-opt {
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-subtle);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-family: var(--font-sans);
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.plan-opt:hover { border-color: var(--fg-muted); }
.plan-opt.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.plan-opt-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  width: 100%;
}
.plan-opt-name { font-size: 12.5px; font-weight: 600; color: var(--fg); }
.plan-opt-price { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; color: var(--accent); flex-shrink: 0; }
.plan-opt-sub { font-size: 11.5px; color: var(--fg-muted); line-height: 1.35; }
