/* ============================================================
   Elkwood Investor — Cool-gray / slate theme (Phase 0 token swap)
   Thin override layer over investor.css. Re-points the existing
   semantic tokens to the brand-guideline palette ("cool grays with
   dark slate gray", Raleway) and neutralizes the few hardcoded warm
   chrome colors. investor.css is replaced outright in a later phase.
   ============================================================ */

@import url("/investor-static/investor.css");

:root {
  /* Ink → dark slate gray */
  --ink-navy: #434444;
  --ink-navy-light: #5a6163;
  --ink-charcoal: #434444;
  --ink-slate: #6f7476;
  --ink-muted: #868c8e;

  /* Surfaces → cool off-white / white */
  --surface-white: #ffffff;
  --surface-canvas: #f4f5f5;
  --surface-warm: #eef0f0;
  --surface-card: #ffffff;

  /* Accent → restrained slate (one accent); blue stays cool */
  --accent-pine: #434444;
  --accent-pine-light: #5a6163;
  --accent-gold: #6f7476;
  --accent-blue: #50616d;

  /* Borders → cool hairlines */
  --border-light: rgba(67, 68, 68, 0.12);
  --border-medium: rgba(67, 68, 68, 0.20);
  --border-strong: rgba(67, 68, 68, 0.32);

  /* Signals kept (functional alert colors), unchanged. */
}

/* Cool page background (overrides the warm hardcoded gradient). */
html,
body {
  background: linear-gradient(180deg, #fafbfb 0%, var(--surface-canvas) 52%, #e9ebeb 100%);
}

/* Quiet the dark-green brand header → light hairline chrome. */
.brand-header,
.investor-topbar {
  background: var(--surface-white);
  color: var(--ink-charcoal);
  border: 1px solid var(--border-light);
  box-shadow: none;
}

/* Primary buttons → slate pills (match the marketing shell). */
.btn-primary,
button.primary,
.primary-cta {
  border-radius: var(--radius-pill);
}

/* =====================================================================
   Design system (src/ui/) — additive component classes.
   Cool-gray / slate minimalist kit ported from the marketing shell.
   Uses the existing semantic tokens only (no hardcoded hex).
   ===================================================================== */

/* ---------- AppShell: fixed wordmark + hamburger + slide-in menu ---------- */
.app-shell {
  min-height: 100vh;
}

.app-shell-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px clamp(20px, 4vw, 40px);
}

.app-shell-header-right {
  display: inline-flex;
  align-items: center;
  gap: 18px;
}

.app-wordmark {
  display: inline-flex;
  align-items: center;
}

.app-wordmark img {
  height: clamp(20px, 2.4vw, 26px);
  width: auto;
}

.menu-toggle {
  position: relative;
  z-index: 40;
  display: grid;
  gap: 6px;
  width: 30px;
  padding: 6px 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.menu-bar {
  width: 30px;
  height: 2px;
  border-radius: var(--radius-pill);
  background: var(--ink-charcoal);
  transition: transform 260ms ease, opacity 200ms ease;
}

.app-shell.menu-open .menu-bar:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.app-shell.menu-open .menu-bar:nth-child(2) {
  opacity: 0;
}

.app-shell.menu-open .menu-bar:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

.site-menu {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--surface-canvas) 97%, transparent);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 280ms ease, visibility 280ms ease;
}

.app-shell.menu-open .site-menu {
  opacity: 1;
  visibility: visible;
}

.menu-list {
  display: grid;
  gap: 22px;
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: center;
}

.menu-list a {
  position: relative;
  color: var(--ink-charcoal);
  font-family: var(--font-sans);
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.menu-list a::after {
  content: "";
  position: absolute;
  left: 50%;
  right: 50%;
  bottom: -6px;
  height: 2px;
  background: var(--ink-charcoal);
  transition: left 220ms ease, right 220ms ease;
}

.menu-list a:hover::after {
  left: 0;
  right: 0;
}

.app-canvas {
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(88px, 11vh, 116px) clamp(24px, 6vw, 72px) 96px;
}

/* ---------- Button ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 26px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  cursor: pointer;
  transition: transform 180ms ease, background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
}

.btn-primary {
  background: var(--ink-charcoal);
  color: var(--surface-white);
}

.btn-primary:not(:disabled):hover {
  transform: translateY(-1px);
  background: var(--ink-navy-light);
}

.btn-secondary {
  background: var(--surface-white);
  border-color: var(--border-medium);
  color: var(--ink-charcoal);
}

.btn-secondary:not(:disabled):hover {
  transform: translateY(-1px);
  border-color: var(--ink-charcoal);
}

.btn-ghost {
  background: none;
  color: var(--ink-slate);
}

.btn-ghost:not(:disabled):hover {
  color: var(--ink-charcoal);
  background: var(--surface-warm);
}

.btn-danger {
  background: var(--signal-error);
  color: var(--surface-white);
}

.btn-danger:not(:disabled):hover {
  transform: translateY(-1px);
  filter: brightness(0.94);
}

/* ---------- Field + controls ---------- */
.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field-wide {
  grid-column: 1 / -1;
}

.field > label {
  color: var(--ink-charcoal);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.field .optional {
  color: var(--ink-slate);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.field-input {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--ink-charcoal);
  background: var(--surface-white);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius);
  padding: 8px 11px;
}

.field textarea.field-input {
  resize: vertical;
}

.field-input:focus {
  outline: none;
  border-color: var(--ink-charcoal);
}

.field-hint {
  margin: 0;
  color: var(--ink-slate);
  font-size: 0.8rem;
}

.field-error {
  margin: 0;
  color: var(--signal-error);
  font-size: 0.85rem;
}

/* ---------- MultiSelect (.ms) ---------- */
.ms {
  position: relative;
}

.ms-toggle {
  width: 100%;
  text-align: left;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--ink-slate);
  background: var(--surface-white);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius);
  padding: 8px 32px 8px 11px;
  cursor: pointer;
}

.ms-toggle.has-value {
  color: var(--ink-charcoal);
}

.ms-toggle::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--ink-slate);
  border-bottom: 2px solid var(--ink-slate);
  transform: translateY(-70%) rotate(45deg);
  transition: transform 180ms ease;
}

.ms.open .ms-toggle {
  border-color: var(--ink-charcoal);
}

.ms.open .ms-toggle::after {
  transform: translateY(-20%) rotate(225deg);
}

.ms-panel {
  display: none;
  position: absolute;
  z-index: 5;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 248px;
  overflow-y: auto;
  padding: 6px;
  background: var(--surface-white);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius);
  box-shadow: 0 16px 34px rgba(67, 68, 68, 0.12);
}

.ms.open .ms-panel {
  display: grid;
  gap: 2px;
}

.ms-panel label {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 9px;
  border-radius: 6px;
  color: var(--ink-charcoal);
  font-size: 0.88rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}

.ms-panel label:hover {
  background: var(--surface-canvas);
}

.ms-panel input {
  width: 16px;
  height: 16px;
  padding: 0;
  accent-color: var(--ink-charcoal);
}

/* ---------- StatCard ---------- */
.stat-card {
  display: grid;
  gap: 6px;
  padding: 20px 22px;
  background: var(--surface-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
}

.stat-label {
  color: var(--ink-slate);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stat-value {
  color: var(--ink-charcoal);
  font-size: clamp(1.7rem, 3vw, 2.1rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.stat-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--ink-slate);
}

.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

.stat-trend-up {
  color: var(--signal-success);
}

.stat-trend-down {
  color: var(--signal-error);
}

.stat-trend-flat {
  color: var(--ink-slate);
}

/* ---------- Card ---------- */
.ui-card {
  background: var(--surface-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.ui-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.ui-card-eyebrow {
  color: var(--ink-slate);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ui-card-title {
  color: var(--ink-charcoal);
  font-size: 1.2rem;
  font-weight: 600;
}

.ui-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* ---------- Tile (clickable card, mirrors marketing .opp-card) ---------- */
.ui-tile {
  display: grid;
  grid-template-rows: auto 1fr;
  width: 100%;
  text-align: left;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
}

.ui-tile-media {
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--ink-slate), var(--ink-charcoal));
  transition: transform 500ms ease;
}

.ui-tile:hover .ui-tile-media {
  transform: translateY(-2px) scale(1.015);
}

.ui-tile-status {
  position: absolute;
  top: 14px;
  left: 14px;
}

.ui-tile-body {
  display: grid;
  gap: 7px;
  padding: 20px 2px 0;
}

.ui-tile-title {
  color: var(--ink-charcoal);
  font-size: 1.2rem;
  font-weight: 600;
}

.ui-tile-subtitle {
  color: var(--ink-slate);
  font-size: 0.95rem;
}

.ui-tile-spec {
  color: var(--ink-charcoal);
  font-size: 0.95rem;
}

/* ---------- Status pill ---------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--surface-warm);
  color: var(--ink-charcoal);
}

.status-pill.status-neutral {
  background: var(--surface-warm);
  color: var(--ink-charcoal);
}

.status-pill.status-positive {
  background: color-mix(in srgb, var(--signal-success) 14%, var(--surface-white));
  color: var(--signal-success);
}

.status-pill.status-warning {
  background: color-mix(in srgb, var(--signal-warning) 16%, var(--surface-white));
  color: var(--signal-warning);
}

.status-pill.status-danger {
  background: color-mix(in srgb, var(--signal-error) 14%, var(--surface-white));
  color: var(--signal-error);
}

/* On the tile media (dark gradient), the neutral pill stays white-on-slate. */
.ui-tile-media .status-pill.status-neutral {
  background: color-mix(in srgb, var(--surface-white) 92%, transparent);
}

/* =====================================================================
   Public surface (src/public.tsx) — marketing-mirror layout primitives.
   Built on the design-system tokens only; no warm/hardcoded chrome.
   ===================================================================== */

.public-intro {
  max-width: 720px;
  margin-bottom: clamp(28px, 4vw, 44px);
}

.public-kicker {
  margin: 0 0 14px;
  color: var(--ink-slate);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.public-intro h1,
.public-detail-head h1,
.public-success h1 {
  margin: 0 0 16px;
  color: var(--ink-charcoal);
  font-family: var(--font-sans);
  font-size: clamp(2.1rem, 5vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.05;
}

.public-lead {
  margin: 0;
  color: var(--ink-slate);
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  line-height: 1.6;
}

.public-block {
  margin-bottom: clamp(36px, 5vw, 56px);
}

.public-block > h2 {
  margin: 0 0 6px;
  color: var(--ink-charcoal);
  font-family: var(--font-sans);
  font-size: clamp(1.4rem, 2.6vw, 1.8rem);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.public-block-lead {
  margin: 0 0 18px;
  color: var(--ink-slate);
  font-size: 0.98rem;
  line-height: 1.5;
}

/* ---------- Intake form ---------- */
.public-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px 16px;
  max-width: 920px;
}

.public-form-foot {
  grid-column: 1 / -1;
  margin-top: 4px;
}

/* Honeypot: removed from the visual + a11y tree, still in the form payload. */
.public-honeypot {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Opportunity tile grid ---------- */
.public-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: clamp(24px, 3vw, 40px);
}

/* ---------- Detail view ---------- */
.public-detail {
  display: grid;
  gap: 28px;
  max-width: 820px;
}

.public-detail-head {
  display: grid;
  gap: 12px;
  justify-items: start;
}

.public-spec {
  margin: 0;
  color: var(--ink-slate);
  font-size: 1rem;
}

.public-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

/* Opportunity photo gallery (hero spans full width). */
.public-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.public-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-lg);
  background: var(--surface-warm);
}

.public-photo-hero {
  grid-column: 1 / -1;
  aspect-ratio: 16 / 9;
}

/* Memo download + express interest sit side by side under the summary. */
.public-detail-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Image crop modal (staff photo upload). */
.image-crop-frame {
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--surface-warm);
}
.image-crop-canvas {
  display: block;
  max-width: 100%;
}
.image-crop-zoom {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--ink-muted);
}
.image-crop-zoom input[type="range"] {
  flex: 1;
}

.public-offerings {
  display: grid;
  gap: 1px;
  background: var(--border-light);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.public-offering-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 18px;
  background: var(--surface-white);
}

.public-offering-row strong {
  color: var(--ink-charcoal);
  font-weight: 600;
}

.public-offering-row span {
  color: var(--ink-slate);
  font-size: 0.9rem;
}

/* ---------- Success state ---------- */
.public-success {
  display: grid;
  gap: 18px;
  justify-items: start;
  max-width: 560px;
  padding-top: clamp(20px, 6vh, 64px);
}

.public-success p {
  margin: 0;
  color: var(--ink-slate);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* =====================================================================
   Portal surface (src/portal.tsx) — investor LP portal on the design system.
   Built on the cool-gray tokens only; no warm/hardcoded chrome.
   ===================================================================== */

.portal-canvas {
  display: grid;
  gap: clamp(20px, 3vw, 32px);
}

.portal-canvas-mobile {
  padding-bottom: 84px;
}

.portal-greeting {
  margin: 0;
  color: var(--ink-charcoal);
  font-family: var(--font-sans);
  font-size: clamp(1.6rem, 3.4vw, 2.2rem);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.portal-stack {
  display: grid;
  gap: clamp(18px, 2.6vw, 28px);
}

.portal-muted {
  margin: 0;
  color: var(--ink-slate);
  font-size: 0.95rem;
  line-height: 1.55;
}

.portal-summary-line {
  margin: 0;
  color: var(--ink-slate);
  font-size: clamp(1rem, 1.3vw, 1.1rem);
  line-height: 1.6;
}

.portal-subhead {
  margin-bottom: 12px;
  color: var(--ink-charcoal);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Tabs ---------- */
.portal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid var(--border-light);
}

.portal-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  color: var(--ink-slate);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease;
}

.portal-tab:hover {
  color: var(--ink-charcoal);
}

.portal-tab.active {
  color: var(--ink-charcoal);
  border-bottom-color: var(--ink-charcoal);
}

/* ---------- Mobile bottom tabs ---------- */
.portal-bottom-tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface-white);
  border-top: 1px solid var(--border-light);
}

.portal-bottom-tab {
  padding: 12px 4px;
  border: 0;
  background: none;
  color: var(--ink-slate);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.portal-bottom-tab.active {
  color: var(--ink-charcoal);
}

/* ---------- Chips ---------- */
.portal-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--surface-warm);
  color: var(--ink-charcoal);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.portal-chip-positive {
  background: color-mix(in srgb, var(--signal-success) 14%, var(--surface-white));
  color: var(--signal-success);
}

/* ---------- Stat row ---------- */
.portal-stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: clamp(12px, 1.6vw, 18px);
}

/* ---------- Program cards (overview) ---------- */
.portal-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: clamp(16px, 2vw, 24px);
}

.portal-program-card {
  display: grid;
  gap: 14px;
}

.portal-program-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.portal-program-name {
  color: var(--ink-charcoal);
  font-size: 1.15rem;
  font-weight: 600;
}

.portal-program-spec {
  color: var(--ink-slate);
  font-size: 0.92rem;
}

.portal-program-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 6px;
  border-top: 1px solid var(--border-light);
}

/* ---------- Mini facts (program room) ---------- */
.portal-mini-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-top: var(--space-4);
}

.portal-mini-facts > div {
  display: grid;
  gap: 3px;
}

.portal-mini-facts span {
  color: var(--ink-slate);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.portal-mini-facts strong {
  color: var(--ink-charcoal);
  font-size: 1.1rem;
  font-weight: 600;
}

/* ---------- Collapsible transaction detail ---------- */
.portal-detail {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--surface-canvas);
}

.portal-detail > summary {
  padding: 14px 18px;
  color: var(--ink-charcoal);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.portal-detail > summary::-webkit-details-marker {
  display: none;
}

.portal-detail > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 10px;
  color: var(--ink-slate);
  transition: transform 160ms ease;
}

.portal-detail[open] > summary::before {
  transform: rotate(90deg);
}

.portal-detail-body {
  display: grid;
  gap: 24px;
  padding: 4px 18px 20px;
}

/* ---------- Tables ---------- */
.portal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.portal-table th {
  text-align: left;
  padding: 8px 10px;
  color: var(--ink-slate);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-light);
}

.portal-table td {
  padding: 9px 10px;
  color: var(--ink-charcoal);
  border-bottom: 1px solid var(--border-light);
}

.portal-table tbody tr:last-child td {
  border-bottom: 0;
}

/* ---------- Wire instructions ---------- */
.portal-wire {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.portal-wire-item span {
  display: block;
  margin-bottom: 4px;
}

.portal-wire-item pre {
  margin: 0;
  padding: 12px 14px;
  background: var(--surface-white);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--ink-charcoal);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  white-space: pre-wrap;
}

/* ---------- Documents ---------- */
.portal-doc-list {
  display: grid;
  gap: 1px;
  background: var(--border-light);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.portal-doc-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface-white);
}

.portal-doc-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.portal-doc-meta strong {
  color: var(--ink-charcoal);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portal-doc-meta span {
  font-size: 0.82rem;
}

.portal-doc-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.portal-doc-actions a {
  text-decoration: none;
}

/* ---------- WaterfallBars (src/ui/WaterfallBars.tsx) ---------- */
.waterfall-bars {
  display: grid;
  gap: 14px;
}

.waterfall-bars-track {
  display: flex;
  width: 100%;
  height: 26px;
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: var(--surface-warm);
}

.waterfall-bars-segment {
  height: 100%;
  min-width: 2px;
  transition: width 320ms ease;
}

.waterfall-bars-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.waterfall-bars-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.85rem;
  color: var(--ink-slate);
}

.waterfall-bars-swatch {
  width: 11px;
  height: 11px;
  border-radius: 3px;
}

.waterfall-bars-legend-label {
  color: var(--ink-charcoal);
}

.waterfall-bars-legend-amount {
  color: var(--ink-slate);
}

/* ---------- Auth screen ----------
   Layout + type for the sign-in head live in the authored SIGN-IN block
   further down (left-aligned, no card). The old grid/centering rules that
   used to sit here were removed — their justify-items:center leaked onto the
   kicker/title and re-centered them even after display resolved to block. */
.portal-auth-card {
  width: 100%;
  max-width: 420px;
}

.portal-auth-form {
  display: grid;
  gap: 16px;
}

.portal-auth-lead {
  margin: 0;
  color: var(--ink-slate);
  font-size: 0.95rem;
  line-height: 1.55;
}

.portal-auth-submit {
  width: 100%;
}

.portal-auth-note {
  margin: 0;
  text-align: center;
  color: var(--ink-slate);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* =====================================================================
   Ops surface (src/ops.tsx) — staff console on the AppShell chrome.
   Reuses design-system tokens only; legacy panel/list classes from
   investor.css continue to style the workspace bodies.
   ===================================================================== */

/* Ops AppShell header reads as a hairline chrome bar, not transparent. */
.app-shell-ops .app-shell-header {
  background: var(--surface-white);
  border-bottom: 1px solid var(--border-light);
  padding-top: 16px;
  padding-bottom: 16px;
}

.app-shell-ops .app-canvas {
  max-width: 1180px;
  padding-top: clamp(84px, 10vh, 104px);
}

/* Signed-in identity shown in the header `right` slot. */
.ops-identity {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

/* Staff name = the menu trigger (no hamburger). Click → settings/refresh/sign out. */
.ops-identity-toggle {
  display: grid;
  gap: 2px;
  text-align: right;
  line-height: 1.2;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 2px 4px;
}

.ops-identity-toggle strong {
  font-size: var(--text-sm);
  color: var(--ink-charcoal);
}

.ops-identity-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: 168px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px;
  background: var(--surface-white);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.ops-identity-menu a,
.ops-identity-menu button {
  text-align: left;
  padding: 6px 10px;
  font-size: var(--text-sm);
  font-weight: 500;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm, 3px);
  color: var(--ink-charcoal);
  text-decoration: none;
}

.ops-identity-menu a:hover,
.ops-identity-menu button:hover,
.ops-identity-menu a:focus-visible,
.ops-identity-menu button:focus-visible {
  background: var(--surface-warm);
  outline: none;
}

.ops-identity-role {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-slate);
}

/* Single-column workspace: top tab bar + main below. */
.app-shell-ops .ops-layout {
  display: grid;
  gap: clamp(20px, 3vw, 32px);
  align-items: start;
}

/* Horizontal workspace tabs (replaces the old left rail). */
.ops-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: clamp(72px, 9vh, 92px);
  background: var(--surface-canvas);
  z-index: 5;
}

.ops-tab {
  padding: 12px 16px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--ink-slate);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  transition: color 160ms ease, border-color 160ms ease;
}

.ops-tab:hover {
  color: var(--ink-charcoal);
}

.ops-tab.active {
  color: var(--ink-charcoal);
  border-bottom-color: var(--ink-charcoal);
}

/* Primary workspace nav: four tabs left, a settings gear pinned right. */
.app-shell-ops .ops-tabs-primary {
  justify-content: space-between;
  flex-wrap: nowrap;
}

.app-shell-ops .ops-tabs-main {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
}

.app-shell-ops .ops-tab-gear {
  font-size: var(--text-base);
  line-height: 1;
  padding: 12px 14px;
}

.ops-main {
  min-width: 0;
}

/* Staff sign-in card centered in the canvas. */
.ops-login-card {
  max-width: 560px;
  margin: clamp(24px, 8vh, 72px) auto;
}

.ops-login-lead {
  color: var(--ink-slate);
  line-height: 1.55;
  margin: var(--space-3) 0;
}

.ops-login-state {
  margin-bottom: var(--space-4);
}

/* =====================================================================
   Compact density — tighten the airy spacing so the staff console reads
   dense and close (forms live in drawers; lists are rows). Scoped to
   .app-shell-ops so portal/public keep their generous spacing.
   ===================================================================== */
.app-shell-ops .stack {
  gap: var(--space-2);
}

.app-shell-ops .form-grid-compact {
  gap: var(--space-2) var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.app-shell-ops input,
.app-shell-ops textarea,
.app-shell-ops select {
  padding: 6px 10px;
}

.app-shell-ops textarea {
  min-height: 72px;
}

/* FormDrawer: scrolling body + pinned footer actions (rendered via SlideOver). */
.drawer-form {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.drawer-form-body {
  flex: 1;
}

.drawer-form-foot {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-light);
  background: var(--surface-white);
}

/* =====================================================================
   FLAT — the staff console reads like a spreadsheet, not a stack of cards.
   Strip every container's background/border/radius/shadow; lists become
   borderless hairline rows. Last in the ops cascade so it wins.
   ===================================================================== */
.app-shell-ops .ui-card {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

.app-shell-ops .section {
  margin-bottom: var(--space-5);
}

/* Lists/rows: borderless, hairline separators, dense. */
.app-shell-ops .list {
  display: block;
  gap: 0;
  border: 0;
  border-top: 1px solid var(--border-light);
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.app-shell-ops .list-item,
.app-shell-ops button.list-item.selectable {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border-light);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 7px 6px;
}

.app-shell-ops button.list-item.selectable {
  text-align: left;
}

.app-shell-ops button.list-item.selectable:hover,
.app-shell-ops button.list-item.selectable:focus-visible {
  background: var(--surface-warm);
}

.app-shell-ops button.list-item.selectable.active {
  background: var(--surface-warm);
  box-shadow: inset 2px 0 0 var(--ink-charcoal);
}

/* Dense tables — ONE cell metric for every ops table (lists, cap tables,
   line items). 10px is the deliberate horizontal gutter for table cells. */
.app-shell-ops .data-table th,
.app-shell-ops .data-table td {
  padding: var(--space-1) 10px;
  /* All table cells use the same type token so no column reads larger than another. */
  font-size: var(--text-sm);
}

/* Money/amount/percent columns: right-aligned, lining tabular numerals. */
.app-shell-ops .data-table th.cell-num,
.app-shell-ops .data-table td.cell-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Long unbroken values (user agents, source paths) truncate, never widen rows. */
.app-shell-ops .data-table td.cell-clip {
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Every row reads as ONE line — long values truncate with a hover tooltip,
   never wrap the row taller. Cells hosting expandable <details> (audit
   changes) keep flowing; the "+/−" menu column needs visible overflow. */
.app-shell-ops .data-table td:not(.col-setup):not(:has(details)) {
  max-width: 360px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Identity cells in flat list tables get a tighter cap. */
.app-shell-ops .data-table:not(.detail-table) tbody td.cell-name {
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Wide tables (the cap table) scroll inside their block, not the page. */
.app-shell-ops .table-scroll {
  overflow-x: auto;
}

/* =====================================================================
   Contacts — one thin Excel-style table. Search left, actions right,
   uniform row typography, per-row "Set up" menu, drill-in on row click.
   No section titles, no card panels, no tab buttons.
   ===================================================================== */
.app-shell-ops .ops-view {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Thin rows, one uniform type size — reads like a spreadsheet. */
.app-shell-ops .contacts-table td {
  font-size: var(--text-sm);
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.app-shell-ops .contacts-table .cell-name {
  font-weight: 600;
  color: var(--ink-charcoal);
}

.app-shell-ops .contacts-row.is-clickable {
  cursor: pointer;
}

.app-shell-ops .role-tag {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}

.app-shell-ops .role-tag.role-lead {
  color: var(--signal-warning);
}

/* Per-row action column tucked to the far right. */
.app-shell-ops .col-setup {
  width: 1%;
  text-align: right;
  white-space: nowrap;
  overflow: visible; /* the row td's overflow:hidden would clip the dropdown */
}

/* Contact drill-in: a back bar + dense vertical blocks (no tabs, no cards).
   The flex gap is the ONE vertical rhythm between sections — blocks must not
   add their own bottom margins/padding on top of it. */
.app-shell-ops .contact-detail {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Tiny text-link actions everywhere — no buttons in the detail or toolbars.
   Same size as the body text, just an interactive accent. */
.app-shell-ops .link-action {
  font-size: var(--text-sm);
  color: var(--accent-blue, #50616d);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.app-shell-ops .link-action:hover {
  text-decoration: underline;
}

/* One visible keyboard-focus ring for the console's small affordances. */
.app-shell-ops .link-action:focus-visible,
.app-shell-ops .menu-symbol:focus-visible,
.app-shell-ops .ops-tab:focus-visible,
.app-shell-ops .ops-identity-toggle:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Dense one-line header: breadcrumb + name, actions to the right. */
.app-shell-ops .contact-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-light);
}

.app-shell-ops .contact-head strong {
  font-size: var(--text-base);
  line-height: 1.3;
}

.app-shell-ops .crumb-sep {
  color: var(--ink-muted);
}

.app-shell-ops .contact-head-actions {
  margin-left: auto;
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
}

/* Basic info: one tight labelled row, left-aligned with the section content.
   No own padding — the .contact-detail gap carries the rhythm. */
.app-shell-ops .basic-info-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 2px var(--space-5);
  font-size: var(--text-sm);
}

.app-shell-ops .basic-info-fields span {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  color: var(--ink-charcoal);
  font-weight: 600; /* the value reads bold; the label stays light + muted */
}

.app-shell-ops .basic-info-fields label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  font-weight: 400;
}

.app-shell-ops .detail-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-1, 4px);
}

.app-shell-ops .detail-block-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  padding: 2px 0; /* matches .collapse-summary so heads line up across sections */
}

/* Stacked .detail-blocks share one --space-3 rhythm everywhere: .ops-view's gap
   already provides it; inside a .stack (gap --space-2) top up the difference. */
.app-shell-ops .stack > .detail-block + .detail-block {
  margin-top: var(--space-1, 4px);
}

.app-shell-ops .detail-block-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--ink-muted);
}

.app-shell-ops .detail-block-count {
  font-size: var(--text-xs);
  color: var(--ink-muted);
}

/* Collapsible sections — the label and the row content both start at the left
   edge (the caret sits AFTER the label, so nothing offsets the content).
   Top padding only: bottom spacing comes from the container gap, so an open
   <details> (rows showing) and a closed one are followed by the same rhythm. */
.app-shell-ops .collapse-block {
  border-top: 1px solid var(--border-light);
  padding: var(--space-1, 4px) 0 0;
}

.app-shell-ops .collapse-summary {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  cursor: pointer;
  list-style: none;
  padding: 2px 0;
}

.app-shell-ops .collapse-summary::-webkit-details-marker {
  display: none;
}

.app-shell-ops .collapse-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--ink-charcoal);
}

.app-shell-ops .collapse-label::after {
  content: "▾";
  font-size: 0.6rem;
  color: var(--ink-muted);
  margin-left: 5px;
}

.app-shell-ops details:not([open]) > .collapse-summary .collapse-label::after {
  content: "▸";
}

.app-shell-ops .collapse-count {
  font-size: var(--text-xs);
  color: var(--ink-muted);
}

.app-shell-ops .collapse-action {
  margin-left: auto;
  display: flex;
  gap: var(--space-3);
}

/* The section's rows sit slightly indented under their category label. */
.app-shell-ops .collapse-block .detail-table,
.app-shell-ops .collapse-block > .detail-block-empty {
  margin-top: var(--space-1, 4px);
  margin-left: var(--space-4);
}

.app-shell-ops .detail-table td {
  padding: 4px 10px 4px 0;
  font-size: var(--text-sm);
  line-height: 1.5;
}

/* Bold the names/anchors so the dense rows aren't monotone — the first column
   of every detail/cap table reads as the heading of its row. */
.app-shell-ops .detail-table .cell-name {
  font-weight: 600;
  color: var(--ink-charcoal);
}

.app-shell-ops .detail-block-empty {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  padding: 2px 0;
}

/* Entity co-members ("with Sarah Bernstein") — shared households read at a glance. */
.app-shell-ops .co-members {
  margin-left: var(--space-2);
  font-weight: 400;
  font-size: var(--text-xs);
  color: var(--ink-muted);
}

/* Bold the identity (first) column of every dense table so rows aren't monotone. */
.app-shell-ops .data-table tbody td:first-child {
  font-weight: 600;
  color: var(--ink-charcoal);
}

/* Cap table: the Class column is secondary — muted, same size as the rest of the
   grid (everything reads at the section-label size; weight + color carry rank). */
.app-shell-ops .data-table tbody td.cap-class {
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--ink-muted);
}

/* Fundraising phase dividers: Capital (committed) vs Interest (shown the deal).
   Section-label size — a divider is never larger than the data. */
.app-shell-ops .data-table tbody tr.captable-phase-head td {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  padding-top: var(--space-3);
  border-bottom: 1px solid var(--border-light);
}
/* The Interest divider reads quieter than Capital (was a no-op className). */
.app-shell-ops .data-table tbody tr.captable-phase-head.is-muted td {
  font-weight: 500;
  font-style: italic;
}

/* Portal popup: a row of text-link actions over the invites/sessions tables. */
.app-shell-ops .portal-actions {
  display: flex;
  gap: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-light);
}

/* Cap table: a single spreadsheet with a bold totals row on top + a "+ add" menu.
   The head doubles as the section header (label left, + add right via .collapse-action),
   so it matches every other section — but it isn't collapsible, so kill the caret/pointer. */
.app-shell-ops .captable-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  margin-bottom: var(--space-1, 4px);
  cursor: default;
}

.app-shell-ops .captable-head .collapse-label::after {
  content: none;
}

/* The cap + class tables are evenly-divided grids. table-layout:fixed makes the
   table fit its container — long names/entities TRUNCATE (per the operator: cut
   off is fine) instead of forcing a horizontal scrollbar. The WHOLE table reads
   at the section-label size (var(--text-xs)) — no header, name, total, or cell
   is larger than the section labels (Classes/Capital/Documents/Activity). */
.app-shell-ops .captable {
  table-layout: fixed;
  width: 100%;
}
/* Under fixed layout, clipping (not intrinsic width) handles overflow —
   headers included, or a nowrap th still widens the table past its box. */
.app-shell-ops .captable th,
.app-shell-ops .captable td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-shell-ops .captable th,
.app-shell-ops .captable td {
  font-size: var(--text-xs);
}
.app-shell-ops .captable thead th { white-space: nowrap; }
/* Class names sit at the same size as everything else — not heavier than a head. */
.app-shell-ops .class-name-cell strong {
  font-size: var(--text-xs);
  font-weight: 600;
}

/* ── Grid alignment system (every ops data table) ─────────────────────
   Text columns left, numbers right; a header matches its own column (no
   centering). The identity block — investor · entity · class — stays left; a
   token gap sets it off from the money columns. One rule set, all tables. */
.app-shell-ops .data-table td,
.app-shell-ops .data-table th { text-align: left; }
.app-shell-ops .data-table td.cell-num,
.app-shell-ops .data-table th.cell-num { text-align: right; }
/* Entity column: muted; the inner span truncates long trust names with an
   ellipsis (max-width on a td is ignored in auto table-layout, so cap the span). */
.app-shell-ops .cell-entity { color: var(--ink-muted); }
.app-shell-ops .cell-entity-text {
  display: inline-block;
  max-width: 22ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
/* Gap between the identity block (Entity is the 3rd col) and the money columns. */
.app-shell-ops .captable tbody td.cell-entity,
.app-shell-ops .captable thead th:nth-child(3) { padding-right: var(--space-6, 32px); }
/* Fixed-layout column proportions: identity block (Investor · Class · Entity)
   then evenly-split money columns. Type/Held-as taxonomy lives on Classes. */
.app-shell-ops .captable thead th:first-child { width: 16%; }
.app-shell-ops .captable thead th:nth-child(2) { width: 12%; }
.app-shell-ops .captable thead th:nth-child(3) { width: 15%; }

/* Sub-vehicle rows inside the Classes table: muted terms, chevron affordance. */
.app-shell-ops .class-child-terms { color: var(--ink-muted); }
.app-shell-ops .class-child-chevron { color: var(--ink-muted); }

/* The one-line waterfall summary in the deal header info row. */
.app-shell-ops .waterfall-line label { display: block; }
.app-shell-ops .waterfall-summary-text { color: var(--ink-charcoal); }
.app-shell-ops .waterfall-edit-link {
  border: none; background: none; cursor: pointer; padding: 0;
  margin-left: var(--space-2);
  color: var(--accent-blue);
  font-size: var(--text-xs);
}

/* ── Waterfall panel: plain-English tier lists per cash source ───────── */
.app-shell-ops .waterfall-render {
  display: grid;
  gap: var(--space-3);
}
.app-shell-ops .waterfall-source-label {
  margin: 0 0 var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
}
.app-shell-ops .waterfall-tiers {
  margin: 0;
  padding-left: var(--space-4);
  font-size: var(--text-xs);
  color: var(--ink-charcoal);
}
.app-shell-ops .waterfall-tiers li { padding: 2px 0; }
.app-shell-ops .waterfall-legacy-note,
.app-shell-ops .waterfall-template-hint {
  font-size: var(--text-xs);
  color: var(--ink-slate);
  margin: 0;
}
.app-shell-ops .waterfall-advanced-toggle { font-size: var(--text-xs); color: var(--ink-slate); }
.app-shell-ops .waterfall-json { font-family: var(--font-mono, monospace); font-size: var(--text-xs); }

/* Multi-class (grouped) builder — one card per class group + assignment rows. */
.app-shell-ops .waterfall-group-card {
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: var(--space-3);
  display: grid;
  gap: var(--space-2);
}
.app-shell-ops .waterfall-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}
.app-shell-ops .waterfall-group-id { max-width: 200px; font-family: var(--font-mono, monospace); }
.app-shell-ops .waterfall-group-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2) var(--space-3);
  align-items: center;
}
.app-shell-ops .waterfall-group-add { align-self: start; }
.app-shell-ops .waterfall-class-assign-list { display: grid; gap: var(--space-1); }
.app-shell-ops .waterfall-class-assign {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: var(--text-xs);
}
.app-shell-ops .waterfall-class-assign select { max-width: 200px; }
.app-shell-ops .waterfall-json-preview {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  background: var(--surface-canvas);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: var(--space-2);
}

/* Total lives at the FOOT of the table, so the rule sits on its top edge. */
.app-shell-ops .captable-total-row td {
  font-weight: 700;
  border-top: 2px solid var(--border-medium);
  background: var(--surface-warm);
}

/* Class table: the name cell. (The old class-GROUPING subheader rules —
   captable-class-head/-name/-terms/-flag/-empty, subtotal rows, the code chip —
   were removed when class became a COLUMN; nothing renders them.) */
.app-shell-ops .class-name-cell {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1, 6px);
  flex-wrap: wrap;
}
.app-shell-ops .class-row.is-retired {
  opacity: 0.6;
}

/* Class form: grouped sections, two-up grid, toggle row, promote-tier repeater. */
.app-shell-ops .class-form-section {
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-light);
}
.app-shell-ops .class-form-section:last-of-type {
  border-bottom: none;
}
.app-shell-ops .class-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2) var(--space-3);
}
.app-shell-ops .class-toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-2);
}
.app-shell-ops .promote-tiers {
  margin-top: var(--space-2);
}
.app-shell-ops .promote-tiers-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-1, 6px);
}
.app-shell-ops .promote-tier-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: var(--space-2);
  align-items: end;
  margin-bottom: var(--space-2);
}
.app-shell-ops .promote-tier-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--text-xs, 12px);
  color: var(--ink-muted);
}
.app-shell-ops .promote-tier-remove {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--ink-muted);
  font-size: var(--text-lg, 18px);
  padding: 0 6px;
}
.app-shell-ops .promote-tier-remove:hover {
  color: var(--ink-charcoal);
}
/* Waterfall-structure template editor: the class-definition rows are wider
   (name · type · held-as · pref · promote · flags) than a promote-tier row. */
.app-shell-ops .waterfall-classdef-row {
  grid-template-columns: 1.2fr 0.6fr 1fr 0.6fr 0.7fr 1fr auto;
}
.app-shell-ops .waterfall-classdef-flags .class-toggle-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  min-height: 30px;
}

@media (max-width: 640px) {
  .app-shell-ops .class-form-grid,
  .app-shell-ops .promote-tier-row {
    grid-template-columns: 1fr;
  }
}

/* MenuButton — a "+" / "−" symbol whose dropdown is portaled to <body>. */
.app-shell-ops .menu-button {
  display: inline-flex;
  align-items: center;
}

.app-shell-ops .menu-symbol {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: var(--text-base);
  line-height: 1;
  font-weight: 700;
  color: var(--accent-blue);
  padding: 0 5px;
}

.app-shell-ops .menu-symbol:hover {
  color: var(--ink-charcoal);
}

/* Portaled dropdown lives at <body> level — global classes, token fallbacks. */
.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
}

.menu-pop {
  z-index: 2001;
  min-width: 184px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px;
  background: var(--surface-white, #ffffff);
  border: 1px solid var(--border-medium, #d4d4d0);
  border-radius: var(--radius, 6px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  font-family: "Raleway", system-ui, sans-serif;
}

.menu-pop button {
  text-align: left;
  padding: 6px 10px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: var(--text-sm, 0.875rem);
  color: var(--ink-charcoal, #2c3037);
  border-radius: 4px;
  white-space: nowrap;
}

.menu-pop button:hover {
  background: var(--surface-warm, #f4f4f2);
}

.menu-pop button:disabled {
  opacity: 0.5;
  cursor: default;
}

.menu-pop button:focus-visible {
  background: var(--surface-warm, #f4f4f2);
  outline: none;
}

/* Search box: small, matches the opportunity form's text inputs (.field-input),
   not a full-width bar. The one toolbar idiom shared by every list tab. */
.app-shell-ops .contacts-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: nowrap;
}

.app-shell-ops .contacts-search {
  flex: 0 1 320px;
  min-width: 0;
  max-width: 320px;
  width: 100%;
  font-size: var(--text-sm);
  padding: 7px 11px;
}

/* Toolbar filter selects: standard field-select chrome at a compact auto
   width, with the same vertical metrics as the search input so the row
   stays flush. */
.app-shell-ops .contacts-toolbar .field-select {
  flex: 0 0 auto;
  width: auto;
  font-size: var(--text-sm);
  padding: 7px 9px;
}

.app-shell-ops .contacts-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
  flex: 0 0 auto;
}

/* Add Investor — centered popup that mirrors the opportunity form. The modal
   body owns the scrolling; the footer keeps actions right, destructive left. */
.app-shell-ops .add-investor-wide,
.app-shell-ops .add-investor-foot {
  grid-column: 1 / -1;
}

.app-shell-ops .add-investor-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.app-shell-ops .add-investor-foot .link-action {
  margin-right: auto;
}

/* Grouped secondary actions on a modal foot (archive / restore / delete /
   record-contribution buttons) sit left of cancel + save as one cluster. */
.app-shell-ops .add-investor-foot .modal-foot-aside {
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* =====================================================================
   Buttons — ONE size in the admin: small, square, dense. The Button
   component drops the marketing pill and matches the raw action buttons,
   so every button looks the same (a tool, not a CTA). Scoped to ops so
   the marketing/portal/public pills are untouched.
   ===================================================================== */
.app-shell-ops .btn,
.app-shell-ops button:not(.list-item):not(.ops-tab):not(.menu-toggle):not(.slide-over-close):not(.ms-toggle):not(.menu-symbol):not(.ops-identity-toggle) {
  padding: 6px 12px;
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius);
  letter-spacing: 0.01em;
  line-height: 1.4;
}

.app-shell-ops .btn-sm {
  padding: 4px 9px;
  font-size: var(--text-xs);
}

/* =====================================================================
   Finished states — compact pills, flat empty states, one focus story,
   and capital sub-view rhythm carried by the stack gap (no doubled
   margins). Scoped to the ops console.
   ===================================================================== */
.app-shell-ops .status-pill {
  padding: 2px 8px;
}

.app-shell-ops .empty-state {
  border: 0;
  background: transparent;
  padding: var(--space-4) 0;
  text-align: left;
}

.app-shell-ops .field-input:focus,
.app-shell-ops .ms-toggle:focus-visible {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(80, 97, 109, 0.16);
}

/* Long values in label/value rows (emails, source paths) wrap, never overflow. */
.app-shell-ops .basic-info-fields span {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 860px) {
  /* Tabs scroll horizontally on small screens; hamburger still mirrors them. */
  .ops-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .ops-tab {
    padding: 12px 12px;
  }
}

/* #####################################################################
   AUTHORED TYPE SYSTEM — ubiquitous across every investor surface
   (ops · portal · public). One hand-set voice, driven entirely by the
   --fs-* / --tracking-* / --weight-* tokens in investor.css. This block
   is last in the cascade so it owns the shared heading classes; the dense
   data tables are deliberately uniform and are NOT touched here.

   Two label tiers, on purpose:
     · KICKER  — the wide-tracked gesture above a headline (recedes, quiet)
     · TITLE   — the heading that leads (tight, weight 600, never 700/flat)
   Bold (700) is spent in exactly two places: an active nav tab and the one
   word that should carry a row. Everywhere else holds at 600 or lighter.
   ##################################################################### */

/* ---- KICKER: one recipe for every eyebrow/kicker, no accidental drift ---- */
.ui-card-eyebrow,
.public-kicker,
.portal-auth-kicker,
.app-shell-ops .eyebrow {
  display: block;
  margin: 0;
  padding: 0;
  background: none;          /* drop the old chip — a kicker is type, not a pill */
  border-radius: 0;
  color: var(--ink-slate);
  font-size: var(--fs-kicker);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-kicker);
  text-transform: uppercase;
}

/* Functional dense labels (stat captions, sub-heads) share the kicker size +
   weight but keep tight tracking so they read as labels, not gestures. */
.stat-label,
.portal-subhead {
  font-size: var(--fs-kicker);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

/* ---- TITLE: the heading that leads ---- */
.ui-card-title {
  font-size: var(--fs-title);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-title);
  color: var(--ink-charcoal);
}

/* ---- DISPLAY: page + sign-in headlines, drawn in tight ---- */
.public-intro h1,
.public-detail-head h1,
.public-success h1 {
  font-size: var(--fs-display-lg);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-display);
  line-height: 1.04;
}

.portal-greeting {
  font-size: var(--fs-display);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-display);
  line-height: 1.06;
}

/* =====================================================================
   SIGN-IN — no card. Authored type sits on the canvas, left-aligned to
   the content edge (titles are not centered). Same treatment, ops + portal.
   ===================================================================== */

/* Shared sign-in skeleton — a left column that breathes, box stripped. */
.app-shell-ops .ops-login-card,
.portal-auth-card.ui-card {
  max-width: 460px;
  margin: clamp(36px, 12vh, 120px) 0 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

/* Portal auth: undo the centered wrap + centered head — left-aligned column.
   Explicit flex-start beats the base `place-items: center` (a plain
   display:block leaves align-items:center behaving as a centering grid). */
.portal-auth-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  min-height: 0;
}
.portal-auth-card.ui-card {
  align-self: flex-start;
}
.portal-auth-head {
  display: block;
  text-align: left;
  margin-bottom: var(--space-5);
}
.portal-auth-lead,
.portal-auth-note {
  text-align: left;
}

/* The sign-in headline — the one takeaway. Off-scale, tight, semibold; a
   short measure forces the two-line wrap that gives it presence. */
.ops-login-card .ui-card-title,
.portal-auth-title {
  margin: var(--space-3) 0 0;
  max-width: 13ch;
  font-size: var(--fs-display);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-display);
  line-height: 1.05;
  color: var(--ink-charcoal);
}
.portal-auth-title {
  margin: var(--space-2) 0 0;
}

/* Sign-in lead: a real measure so the line never sprawls. */
.app-shell-ops .ops-login-lead,
.portal-auth-lead {
  max-width: 34ch;
  margin: var(--space-4) 0 var(--space-2);
  font-size: var(--fs-lead);
  line-height: 1.6;
}

.app-shell-ops .ops-login-state {
  font-size: 0.78rem;
  letter-spacing: 0.015em;
  color: var(--ink-muted);
}
.app-shell-ops .ops-login-card .toolbar {
  margin-top: var(--space-4);
}

/* Portal auth form: a contained column, not a stretched card. */
.portal-auth-form {
  max-width: 360px;
}

/* =====================================================================
   OPS chrome — section titles + tabs (token-driven)
   ===================================================================== */

/* The active workspace tab earns real weight — bold where it does work. */
.app-shell-ops .ops-tab {
  letter-spacing: 0.01em;
}
.app-shell-ops .ops-tab.active {
  font-weight: var(--weight-bold);
}

/* #####################################################################
   PORTAL — flat/dense pass (investor.elkwood.com)
   The LP portal now wears the same spreadsheet density as the staff
   console: no card chrome, hairline-separated rows, dense tables. Cards
   collapse to flat blocks; the at-a-glance numbers stay prominent (the
   flat pass strips chrome, not hierarchy). On phones the wide transaction
   tables fall back to a readable stacked layout (see the @media block) —
   investors never side-scroll eight columns. Mirrors the ops FLAT block;
   scoped to .app-shell-portal.
   ##################################################################### */

/* De-card: strip every container's box; a hairline separates, not a frame. */
.app-shell-portal .ui-card,
.app-shell-portal .stat-card {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

/* Denser vertical rhythm than the old generous portal — still breathes. */
.app-shell-portal .portal-canvas,
.app-shell-portal .portal-stack {
  gap: var(--space-5);
}

/* Card header → section label + title over a hairline, not a card lid. */
.app-shell-portal .ui-card-header {
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-light);
}

/* Overview numbers: a clean hairline-bounded strip, no tiles — but the
   figures keep their size (flat strips chrome, not hierarchy). */
.app-shell-portal .portal-stat-row {
  gap: var(--space-6);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border-medium);
  border-bottom: 1px solid var(--border-light);
}

/* Program list: hairline-separated rows, not a tile grid. */
.app-shell-portal .portal-tile-grid {
  display: block;
}
.app-shell-portal .portal-program-card {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-light);
}
.app-shell-portal .portal-tile-grid > .portal-program-card:first-child {
  border-top: 1px solid var(--border-light);
}
.app-shell-portal .portal-program-foot {
  border-top: 0;
  padding-top: var(--space-1);
}

/* Dense tables — one cell metric, matching the console. */
.app-shell-portal .portal-table th,
.app-shell-portal .portal-table td {
  padding: var(--space-1) 10px;
  font-size: var(--text-sm);
}
.app-shell-portal .portal-table tbody td:first-child {
  font-weight: var(--weight-semibold);
  color: var(--ink-charcoal);
}

/* Collapsible transaction detail → flat hairline, no rounded box. */
.app-shell-portal .portal-detail {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--border-light);
  border-radius: 0;
}

/* Document list keeps its hairline rows but loses the outer rounded frame. */
.app-shell-portal .portal-doc-list {
  border-radius: 0;
}

/* Buttons: drop the marketing pill — small, square, dense, like the console.
   (Tabs, the hamburger, and the modal close keep their own treatment.) */
.app-shell-portal .btn,
.app-shell-portal button:not(.menu-toggle):not(.portal-tab):not(.portal-bottom-tab):not(.slide-over-close) {
  padding: 6px 12px;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  border-radius: var(--radius);
  letter-spacing: 0.01em;
  line-height: 1.4;
}
.app-shell-portal .btn-sm {
  padding: 4px 9px;
  font-size: var(--text-xs);
}

/* ---- Mobile: keep the wide transaction tables readable. Each row stacks
   into label/value pairs (the cell's data-label is the label) instead of
   forcing an eight-column horizontal scroll on a phone. ---- */
@media (max-width: 640px) {
  .app-shell-portal .portal-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .app-shell-portal .portal-table,
  .app-shell-portal .portal-table tbody,
  .app-shell-portal .portal-table tr,
  .app-shell-portal .portal-table td {
    display: block;
    width: 100%;
  }
  .app-shell-portal .portal-table tr {
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border-light);
  }
  .app-shell-portal .portal-table td {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    padding: 3px 0;
    border: 0;
    text-align: right;
  }
  .app-shell-portal .portal-table td::before {
    content: attr(data-label);
    color: var(--ink-muted);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
    text-align: left;
  }
}

/* ── Staff "view as investor" impersonation banner (TASKLIST 7.5) ──────────
   Slim fixed bar above the portal chrome; the fixed app header and shell
   content shift down by its height while the impersonation session is live. */
.portal-impersonation-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--ink-charcoal, #2b2b2b);
  color: #fff;
  font-size: 13px;
  letter-spacing: 0.01em;
}

.portal-impersonation-banner a {
  color: #fff;
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
}

.impersonation-offset .app-shell-header {
  top: 36px;
}

.impersonation-offset .app-shell {
  padding-top: 36px;
}
