/* Backward-compat aliases — tokens.css is the source of truth.
   These map the legacy variable names to the new semantic tokens so
   existing component rules keep working while the migration happens. */
:root {
  --bg:         var(--surface-0);
  --bg-1:       var(--surface-1);
  --bg-2:       var(--surface-2);
  --bg-3:       var(--surface-3);
  --border:     var(--border-default);
  --border-soft: var(--border-subtle);
  --text:       var(--text-1);
  --text-dim:   var(--text-2);
  --text-mute:  var(--text-3);
  --accent:     var(--color-accent);
  --accent-2:   var(--color-info);
  --blue:       var(--color-info);
  --green:      var(--color-success);
  --yellow:     var(--color-warning);
  --orange:     var(--color-warning);
  --red:        var(--color-danger);
  --danger:     var(--color-danger);
  --radius:     var(--radius-lg);
  /* legacy --radius-sm conflicts with token --radius-sm, so the old value maps to token md */
  --shadow:     var(--shadow-md);
  --font:       var(--font-sans);
  --mono:       var(--font-mono);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  /* Radial-gradient background removed per Vercel principle: hierarchy via
     contrast + typography, not decorative light. Flat surface-0 reads cleaner. */
  background: var(--surface-0);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  min-height: 100vh;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

button { font-family: inherit; cursor: pointer; }
input, select, textarea, button { font-family: inherit; font-size: 14px; }

/* ===== Topbar =====
   Bloomberg principle: no ambient decoration. Brand monogram shrunk to 32px.
   Single gradient kept only on the logo mark (brand identity carries meaning).
   Tab active state: 2px bottom underline in text-1 — reads as "you are here"
   rather than a colored chip. */
.topbar {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-default);
  background: rgba(10, 11, 13, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.brand { display: flex; align-items: center; gap: var(--space-3); }
.logo {
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  background: var(--color-accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: var(--weight-semibold);
  font-size: var(--text-md);
  color: var(--text-inverse);
  letter-spacing: -0.02em;
}
.brand-text h1 {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
  color: var(--text-1);
}
.brand-text p {
  margin: 2px 0 0;
  font-size: var(--text-xs);
  color: var(--text-3);
  font-weight: var(--weight-regular);
}

.tabs {
  display: flex;
  gap: var(--space-1);
  background: transparent;
  border: 0;
  padding: 0;
}
.tab {
  background: transparent;
  border: 0;
  color: var(--text-3);
  padding: var(--space-2) var(--space-3);
  border-radius: 0;
  font-weight: var(--weight-regular);
  font-size: var(--text-base);
  transition: color var(--motion-base) var(--ease-out),
              box-shadow var(--motion-base) var(--ease-out);
  box-shadow: inset 0 -2px 0 transparent;
}
.tab:hover { color: var(--text-2); }
.tab.active {
  background: transparent;
  color: var(--text-1);
  box-shadow: inset 0 -2px 0 var(--text-1);
  font-weight: var(--weight-semibold);
}

.topbar-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
#search {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  width: 280px;
  outline: none;
  transition: border-color var(--motion-base) var(--ease-out);
}
#search:focus { border-color: var(--accent); }
.search-count { font-size: 11px; color: var(--text-mute); font-family: var(--mono); min-width: 40px; }

/* ===== Buttons =====
   Single primary action (accent solid). All other buttons are ghost-style
   secondary — border-only, no filled background. Matches Linear principle. */
.btn {
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-2);
  padding: var(--space-2) var(--space-3);
  font-weight: var(--weight-regular);
  font-size: var(--text-base);
  transition: color var(--motion-base) var(--ease-out),
              border-color var(--motion-base) var(--ease-out),
              background var(--motion-base) var(--ease-out);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.btn:hover {
  color: var(--text-1);
  border-color: var(--border-strong);
}
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-primary {
  background: var(--color-accent);
  color: var(--text-inverse);
  border-color: var(--color-accent);
  font-weight: var(--weight-semibold);
}
.btn-primary:hover {
  filter: brightness(1.08);
  color: var(--text-inverse);
  border-color: var(--color-accent);
}
.btn-danger { color: var(--color-danger); border-color: var(--border-default); }
.btn-danger:hover {
  background: var(--bg-danger);
  border-color: var(--color-danger);
  color: var(--color-danger);
}

/* Focus states */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:focus-visible, .btn:focus-visible, .chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(110,231,183,0.15);
}

/* ===== Shell ===== */
.shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: calc(100vh - 74px);
}

/* ===== Sidebar =====
   Subordinated per guardrail: lighter border, smaller label, tighter chips.
   Filter sidebar is secondary to the main content, typography reflects that. */
.sidebar {
  border-right: 1px solid var(--border-subtle);
  padding: var(--space-5) var(--space-4);
  background: transparent;
  overflow-y: auto;
  max-height: calc(100vh - 74px);
  position: sticky;
  top: 74px;
}
.filter-group {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--space-4);
}
.filter-group h3 {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  font-weight: var(--weight-regular);
}
.link {
  background: none; border: none; color: var(--text-2);
  font-size: var(--text-xs); padding: 0;
  transition: color var(--motion-base) var(--ease-out);
}
.link:hover { text-decoration: underline; color: var(--text-1); }

.filter { margin-bottom: var(--space-5); }
.filter > label {
  display: block;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: var(--space-2);
  font-weight: var(--weight-regular);
}
.chipset { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.chip {
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-3);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  cursor: pointer;
  transition: color var(--motion-base) var(--ease-out),
              border-color var(--motion-base) var(--ease-out),
              background var(--motion-base) var(--ease-out);
  user-select: none;
}
.chip:hover { color: var(--text-2); border-color: var(--border-strong); }
.chip.active {
  background: var(--surface-3);
  border-color: var(--text-1);
  color: var(--text-1);
}

.range-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.range-row input, input[type="date"] {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  padding: 8px 10px;
  outline: none;
  width: 100%;
  font-family: var(--mono);
  font-size: 12px;
}
.range-row input:focus { border-color: var(--accent); }
.range-val { color: var(--text-mute); font-weight: 400; font-size: 10px; }

.filter-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
  color: var(--text-dim);
  font-size: 12px;
}
#result-count { color: var(--accent); font-weight: 600; font-family: var(--mono); }

/* ===== Content ===== */
.content { padding: 24px; min-width: 0; }
.view { display: none; animation: fadeIn var(--motion-slow) var(--ease-out); }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ===== KPIs ===== */
.kpis-primary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 12px;
}
.kpis-secondary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.kpi-lg .kpi-value {
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  margin-top: var(--space-2);
}
.kpi-sm { padding: var(--space-3) var(--space-4); }
.kpi-sm .kpi-value {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  margin-top: var(--space-1);
}
.kpi-sm .kpi-label { font-size: var(--text-xs); }
.kpi {
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  position: relative;
}
/* Decorative accent top-border removed per Bloomberg principle: color is
   semantic only. KPI cards that don't mark a state get no top-border.
   State-carrying KPIs (e.g. healthy/warning) would add .kpi--success etc.
   in a future commit. */
.kpi-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  font-weight: var(--weight-regular);
}
.kpi-value {
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  margin-top: var(--space-2);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--text-1);
}
.kpi-sub { font-size: var(--text-xs); color: var(--text-3); margin-top: var(--space-1); }

/* ===== Hero Banner =====
   Stripe principle: focal section gets breathing room (48px below via
   .hero margin-bottom). Decorative glow removed — flat surface + typography
   hierarchy does the work. Eyebrow downgraded from accent-colored caps to
   text-3 caption. Headline KPI becomes the single focal number. */
.hero {
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-7);
  position: relative;
}
.hero-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-6);
}
.hero-eyebrow {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-3);
  font-weight: var(--weight-regular);
  margin-bottom: var(--space-2);
}
.hero-title {
  font-size: var(--text-3xl);
  font-weight: var(--weight-semibold);
  color: var(--text-1);
  letter-spacing: -0.02em;
  margin: 0;
  line-height: var(--leading-tight);
}
.hero-sub {
  font-size: var(--text-base);
  color: var(--text-3);
  margin-top: var(--space-2);
}
.hero-badge {
  text-align: right;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}
.hero-badge-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  font-weight: var(--weight-regular);
}
.hero-badge-value {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--text-1);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.hero-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.hero-stat {
  padding: var(--space-4);
  text-align: center;
  border-right: 1px solid var(--border-subtle);
  background: var(--surface-2);
}
.hero-stat:last-child { border-right: none; }
.hero-stat-value {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--text-1);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.hero-stat-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-top: var(--space-2);
  font-weight: var(--weight-regular);
}

/* ===== Benchmark Table =====
   Retool principle: 40px rows + 6%-opacity separators beats zebra striping.
   Numbers mono + tabular-nums via .num utility from tokens.css.
   Total row gets top border in --border-strong; numbers stay regular weight
   (Bloomberg: color = state, weight = emphasis only on category label). */
.benchmark-card { margin-bottom: var(--space-5); }
.bench-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
}
.bench-table th {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  font-weight: var(--weight-regular);
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--border-default);
  background: var(--surface-1);
  white-space: nowrap;
  height: var(--table-row-height);
}
.bench-table th.num { text-align: right; }
.bench-table td {
  padding: 0 var(--space-4);
  height: var(--table-row-height);
  border-bottom: 1px solid var(--table-row-separator);
  white-space: nowrap;
  color: var(--text-2);
}
.bench-table td.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-md);
  font-weight: var(--weight-regular);
  color: var(--text-1);
}
.bench-table td.stage-name {
  font-weight: var(--weight-semibold);
  font-size: var(--text-md);
  color: var(--text-1);
}
.bench-table tbody tr {
  transition: background var(--motion-base) var(--ease-out);
}
.bench-table tbody tr:hover { background: var(--surface-2); }
.bench-table tfoot td {
  font-weight: var(--weight-regular);
  border-top: 1px solid var(--border-strong);
  color: var(--text-1);
  padding-top: var(--space-3);
}
.bench-table tfoot td.stage-name {
  font-weight: var(--weight-semibold);
}

/* Chart sections */
.chart-section { margin-bottom: 8px; }
.section-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  padding: 12px 0;
  cursor: pointer;
  width: 100%;
  font-family: var(--font);
}
.section-toggle:hover { color: var(--text); }
.section-title { flex: 1; text-align: left; }
.section-arrow { font-size: 14px; transition: transform var(--motion-base) var(--ease-out); }
.section-body { display: none; }
.chart-section.open .section-body { display: block; }
.chart-section.open .section-arrow { transform: rotate(0deg); }

/* Filter bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  margin-bottom: 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  flex-wrap: wrap;
}
.filter-bar-label { color: var(--text-mute); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; font-size: 10px; }
.filter-bar-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-bar-chip {
  background: rgba(110,231,183,0.12);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  cursor: pointer;
}
.filter-bar-chip:hover { background: rgba(110,231,183,0.25); }

/* ===== Cards ===== */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.card {
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}
.card-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: var(--space-4);
}
.card-head h3 {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--text-1);
}
.muted { color: var(--text-3); font-size: var(--text-xs); }

/* ===== Top list ===== */
.top-list {
  margin: 0; padding: 0;
  list-style: none;
  counter-reset: item;
}
.top-list li {
  counter-increment: item;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.top-list li:last-child { border-bottom: 0; }
.top-list li::before {
  content: counter(item);
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 11px;
}
.top-list .t-name { font-weight: 500; }
.top-list .t-val { font-family: var(--mono); color: var(--accent); font-size: 12px; }

/* ===== Tables (Comps / Availabilities / Pipeline) =====
   Unified table density: 40px row height, 6%-opacity row separator,
   sticky header, no zebra striping. Right-align all .num cells, mono font
   via tokens.css utility. */
.table-wrap { overflow-x: auto; margin: calc(var(--space-5) * -1); padding: 0; }
#comps-table,
#avail-table,
#pipeline-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
}
#comps-table th, #comps-table td,
#avail-table th, #avail-table td,
#pipeline-table th, #pipeline-table td {
  padding: 0 var(--space-3);
  height: var(--table-row-height);
  text-align: left;
  border-bottom: 1px solid var(--table-row-separator);
  white-space: nowrap;
  color: var(--text-2);
}
#comps-table th,
#avail-table th,
#pipeline-table th {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  font-weight: var(--weight-regular);
  cursor: pointer;
  user-select: none;
  background: var(--surface-1);
  position: sticky; top: 0;
  border-bottom: 1px solid var(--border-default);
  z-index: var(--z-sticky);
}
#comps-table th:hover,
#avail-table th:hover,
#pipeline-table th:hover { color: var(--text-1); }
#comps-table th.num, #comps-table td.num,
#avail-table th.num, #avail-table td.num,
#pipeline-table th.num, #pipeline-table td.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-1);
}
#comps-table th.sort-asc::after { content: ' ↑'; color: var(--text-1); }
#comps-table th.sort-desc::after { content: ' ↓'; color: var(--text-1); }
#comps-table tbody tr,
#avail-table tbody tr,
#pipeline-table tbody tr {
  transition: background var(--motion-base) var(--ease-out);
  cursor: pointer;
}
#comps-table tbody tr:hover,
#avail-table tbody tr:hover,
#pipeline-table tbody tr:hover { background: var(--surface-2); }
.t-tenant { font-weight: 600; }
.t-type {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}
.t-type[data-type="New Lease"] { background: rgba(96,165,250,0.15); color: var(--blue); }
.t-type[data-type="Renewal"], .t-type[data-type="Renewal + Expansion"] { background: rgba(110,231,183,0.15); color: var(--accent); }
.t-type[data-type="Expansion"], .t-type[data-type="Extension + Expansion"], .t-type[data-type="Extension/Expansion"] { background: rgba(251,191,36,0.15); color: var(--yellow); }
.t-type[data-type="Sublease"] { background: rgba(251,146,60,0.15); color: var(--orange); }

.row-actions { display: flex; gap: 4px; }
.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-mute);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
}
.icon-btn:hover { color: var(--text); background: var(--bg-3); border-color: var(--border); }
.icon-btn.del:hover { color: var(--red); border-color: rgba(239,68,68,0.3); }

/* ===== Map ===== */
.map-card { padding: 0; overflow: hidden; position: relative; }
#map { height: 720px; width: 100%; background: var(--bg-1); }
.leaflet-container { background: #0e1624; font-family: var(--font); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.leaflet-popup-content { margin: 12px 14px; font-size: 12px; line-height: 1.55; }
.leaflet-popup-content strong { color: var(--accent); }
.leaflet-control-attribution { background: rgba(10,12,18,0.7) !important; color: var(--text-mute) !important; }
.leaflet-control-attribution a { color: var(--text-dim) !important; }

.map-legend {
  position: absolute; right: 16px; top: 16px;
  background: rgba(15,19,32,0.92);
  border: 1px solid var(--border);
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 11px;
  z-index: 500;
  backdrop-filter: blur(4px);
}
.legend-title { color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.legend-scale { display: flex; gap: 3px; }
.legend-scale span { display: block; width: 24px; height: 10px; border-radius: 2px; }
.legend-labels { display: flex; justify-content: space-between; color: var(--text-mute); margin-top: 3px; font-size: 10px; }
.legend-note { color: var(--text-mute); margin-top: 8px; font-size: 10px; }

/* ===== Form ===== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px 20px;
}
.form-grid label {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  font-weight: 600;
  gap: 6px;
}
.form-grid input, .form-grid select, .form-grid textarea {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  font-family: var(--mono);
  font-size: 13px;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
  border-color: var(--accent);
}
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 12px; margin-top: 8px; }

/* Form fieldsets */
.form-fieldset {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px 18px;
  grid-column: 1 / -1;
}
.form-fieldset legend, .form-fieldset > summary {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 700;
  padding: 0 8px;
  cursor: default;
}
.form-fieldset > summary { cursor: pointer; padding: 0; margin-bottom: 12px; }
.form-fieldset > summary:hover { color: var(--text); }
details.form-fieldset { display: block; grid-column: 1 / -1; }
details.form-fieldset[open] .form-fieldset-inner {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px 18px;
  margin-top: 12px;
}
.form-fieldset-inner { display: none; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-3);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 100;
  animation: slideUp var(--motion-slow) var(--ease-out);
}
@keyframes slideUp { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #2d3757; }

/* ===== Detail Panel ===== */
.detail-panel {
  position: fixed;
  top: 74px;
  right: 0;
  width: 420px;
  max-width: 90vw;
  height: calc(100vh - 74px);
  background: var(--bg-1);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 32px rgba(0,0,0,0.4);
  z-index: 30;
  overflow-y: auto;
  animation: slideIn var(--motion-slow) var(--ease-out);
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: none; } }
.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-1);
  z-index: 1;
}
.detail-header h3 { font-size: 16px; color: var(--accent); }
.detail-body { padding: 20px 24px; }
.detail-section { margin-bottom: 24px; }
.detail-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-mute);
  font-weight: 700;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-soft);
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.detail-field {}
.detail-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  font-weight: 600;
  margin-bottom: 3px;
}
.detail-value {
  font-size: 14px;
  color: var(--text);
  font-family: var(--mono);
}
.detail-value.highlight {
  color: var(--accent);
  font-weight: 600;
}
.detail-full { grid-column: 1 / -1; }
.detail-full .detail-value {
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
}
.detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}

/* ===== Outreach ===== */
.outreach-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
}
.outreach-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.outreach-form label {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  font-weight: 600;
  gap: 6px;
}
.outreach-form input, .outreach-form select {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  font-family: var(--mono);
  font-size: 13px;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}
.outreach-form input:focus, .outreach-form select:focus { border-color: var(--accent); }
.outreach-preview {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.email-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.email-subject-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.email-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  font-weight: 600;
}
.email-subject-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.email-body {
  padding: 24px;
  flex: 1;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  min-height: 300px;
  white-space: pre-wrap;
}
.email-body .stat-line {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 13px;
}
.email-actions {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}
@media (max-width: 900px) {
  .outreach-grid { grid-template-columns: 1fr; }
}

/* ===== Investor Overlap ===== */
.inv-stats {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.7;
  display: none;
}
.inv-stats.visible { display: block; }
.inv-stats strong { color: var(--accent); font-family: var(--mono); }
.inv-results {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 600px;
  overflow-y: auto;
}
.inv-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-mute);
  font-weight: 700;
  padding: 12px 16px 8px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  z-index: 1;
}
.inv-deal {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  cursor: pointer;
  transition: background var(--motion-base) var(--ease-out);
}
.inv-deal:hover { background: rgba(110,231,183,0.04); }
.inv-deal:last-child { border-bottom: none; }
.inv-deal-tenant { font-weight: 600; }
.inv-deal-meta { color: var(--text-dim); font-size: 11px; }
.inv-deal-right { text-align: right; font-family: var(--mono); font-size: 12px; color: var(--text-dim); }
.inv-coinvestor {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}
.inv-coinvestor:last-child { border-bottom: none; }
.inv-coinvestor-name { font-weight: 500; }
.inv-coinvestor-count { font-family: var(--mono); color: var(--accent); font-size: 12px; }
.inv-coinvestor-bar {
  height: 4px;
  background: rgba(110,231,183,0.3);
  border-radius: 2px;
  margin-top: 4px;
  grid-column: 1 / -1;
}
.inv-coinvestor-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}

/* ===== Teaser Mode ===== */
body.teaser-mode .bench-table td.num,
body.teaser-mode .hero-stat-value,
body.teaser-mode .kpi-sm .kpi-value {
  color: transparent;
  text-shadow: 0 0 18px rgba(232,236,245,0.5);
  user-select: none;
}
body.teaser-mode .hero-stat:first-child .hero-stat-value,
body.teaser-mode .bench-table td:nth-child(2) {
  color: var(--text) !important;
  text-shadow: none !important;
  user-select: auto !important;
}
body.teaser-mode .bench-table td.stage-name {
  color: var(--text) !important;
  text-shadow: none !important;
}
body.teaser-mode .teaser-footer { display: block !important; }
body.teaser-mode .chart-section,
body.teaser-mode .kpis-secondary { display: none; }

/* Teaser Mode for new entity tables (commit 4).
   Blur cells marked .t-blur-me, keep .t-keep-visible readable.
   Header cells with .t-blur-me also blur so the column name blurs where we
   don't want to hint at what's behind the mask. */
body.teaser-mode #avail-table td.t-blur-me,
body.teaser-mode #avail-table th.t-blur-me,
body.teaser-mode #pipeline-table td.t-blur-me,
body.teaser-mode #pipeline-table th.t-blur-me {
  color: transparent;
  text-shadow: 0 0 18px rgba(232,236,245,0.5);
  user-select: none;
}
body.teaser-mode #avail-table td.t-keep-visible,
body.teaser-mode #pipeline-table td.t-keep-visible {
  color: var(--text) !important;
  text-shadow: none !important;
  user-select: auto !important;
}
body.teaser-mode #btn-teaser {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.teaser-footer {
  margin-top: 24px;
  padding: 24px 32px;
  background: linear-gradient(135deg, var(--bg-2) 0%, #0d1424 100%);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  text-align: center;
}
.teaser-footer-inner {
  display: inline-flex;
  align-items: center;
  gap: 16px;
}
.teaser-footer-icon { font-size: 28px; }
.teaser-footer-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.teaser-footer-contact {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  margin-top: 2px;
}

/* ===== Responsive ===== */
@media (max-width: 1200px) {
  .kpis-primary, .kpis-secondary { grid-template-columns: repeat(4, 1fr); }
  .topbar { flex-wrap: wrap; }
  #search { width: 220px; }
  .topbar-actions { flex-wrap: wrap; }
  .hero-stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; border-right: none; border-bottom: 1px solid var(--border); }
  .kpis-primary { grid-template-columns: repeat(2, 1fr); }
  .kpis-secondary { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-fieldset { grid-template-columns: 1fr 1fr; }
  details.form-fieldset[open] .form-fieldset-inner { grid-template-columns: 1fr 1fr; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .hero-stat { border-bottom: 1px solid var(--border); }
  .hero-title { font-size: 22px; }
}
