/* ═══════════════════════════════════════════════════════════
   Triad Advising — Shared Styles
   Brand CSS variables, typography, layout, and UI components
   shared across all product pages (Rate CRM, Service CRM,
   Parts Exchange).
   ═══════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #fefaf6;
  --surface: #ffffff;
  --sidebar-bg: #2e251c;
  --sidebar-hover: #3a3530;
  --sidebar-active: #463313;  /* warmer orange-brown active fill */
  --topbar-bg: #1a1610;
  --amber: #d4872e;
  --amber-light: #fdf3e7;
  --sage: #6b8f6e;
  --charcoal: #1a1610;
  --text: #2c2a26;
  --text-secondary: #78716c;
  --border: #e7e5e4;
  --stone-50: #f5f5f4;
  --stone-200: #e7e5e4;
  --stone-400: #78716c;
  --stone-600: #57534e;
  --earth: #44372b;
  --golden: #e8a54e;
  --danger: #c0392b;
  --danger-light: #fdecea;
  --success: #27ae60;
  --success-light: #eafaf1;
  --info: #2980b9;
  --info-light: #ebf5fb;
  --accent-blue: #2980b9;
  --accent-green: #27ae60;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  /* ── Semantic UI tokens ──
     Shared components (dialogs, etc.) reference THESE, never raw palette tokens,
     so a component matches whatever theme a page loads. dt-theme.css redefines
     the SAME names to the DealersThink neon palette (light + dark). New shared
     UI must build on --ds-* / --surface-2, not --amber/--radius directly.
     Contract: docs/brand/DESIGN_SYSTEM.md. */
  --surface-2: var(--stone-50);
  --ds-radius: 12px;
  --ds-accent: var(--amber);
  --ds-accent-soft: var(--amber-light);
  --ds-on-accent: #ffffff;
  --ds-danger: var(--danger);
  --ds-danger-soft: var(--danger-light);
}

body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; overflow: hidden; }
h1, h2, h3, .heading { font-family: 'Playfair Display', serif; }

/* ── Login Screen ── */
.login-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--bg);
}
.login-card {
  background: var(--surface); border-radius: var(--radius); padding: 2.5rem;
  box-shadow: var(--shadow-md); width: 100%; max-width: 400px; text-align: center;
}
.login-logo { display: flex; align-items: center; justify-content: center; gap: .6rem; margin-bottom: 1.5rem; }
.login-logo svg { width: 40px; height: 40px; }
.login-logo span { font-family: 'Inter', sans-serif; font-size: 1.1rem; font-weight: 700; color: var(--charcoal); text-transform: uppercase; letter-spacing: 0.12em; }
.login-card h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: .5rem; }
.login-card p { font-size: .85rem; color: var(--text-secondary); margin-bottom: 1.5rem; }
.login-field { width: 100%; padding: .75rem 1rem; border: 1.5px solid var(--border); border-radius: 8px; font-size: .95rem; font-family: inherit; transition: border-color .2s; }
.login-field:focus { outline: none; border-color: var(--amber); }
.login-btn {
  width: 100%; padding: .75rem; margin-top: 1rem; border: none; border-radius: 8px;
  background: var(--amber); color: white; font-size: .95rem; font-weight: 600;
  font-family: inherit; cursor: pointer; transition: background .2s;
}
.login-btn:hover { background: #b8741f; }
.login-error { color: var(--danger); font-size: .85rem; margin-top: .75rem; display: none; }

/* ── App Shell ── */
.app { display: none; height: 100vh; flex-direction: column; }
.app.active { display: flex; }
.login-screen.hidden { display: none; }

/* ── Top Bar ── */
.topbar {
  height: 48px; background: var(--topbar-bg); display: flex; align-items: center;
  padding: 0 16px; gap: 16px; flex-shrink: 0; z-index: 100;
}
.topbar-logo { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.topbar-logo svg { width: 28px; height: 28px; }
.topbar-logo span { font-family: 'Inter', sans-serif; font-size: .8rem; font-weight: 700; color: white; text-transform: uppercase; letter-spacing: 0.12em; white-space: nowrap; }
.topbar-search {
  flex: 1; max-width: 480px; margin: 0 auto;
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px; padding: 0 12px; height: 32px;
}
.topbar-search svg { width: 14px; height: 14px; color: rgba(255,255,255,0.4); flex-shrink: 0; }
.topbar-search input { border: none; background: none; outline: none; color: white; font-size: .8rem; font-family: inherit; flex: 1; }
.topbar-search input::placeholder { color: rgba(255,255,255,0.35); }
.topbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.topbar-icon { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 6px; cursor: pointer; transition: background .15s; }
.topbar-icon:hover { background: rgba(255,255,255,0.1); }
.topbar-icon svg { width: 18px; height: 18px; color: rgba(255,255,255,0.6); }
.topbar-avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--amber);
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; color: white; cursor: pointer;
}

/* ── Three Panel Layout ── */
.three-panel { display: flex; flex: 1; overflow: hidden; }

/* ── Left Sidebar ── */
.sidebar {
  width: 208px; height: calc(100vh - 48px); background: var(--sidebar-bg); display: flex; flex-direction: column;
  flex-shrink: 0; overflow: hidden; color: white;
}
.sidebar-switcher {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06); cursor: pointer;
}
.sidebar-switcher .sw-icon {
  width: 22px; height: 22px; border-radius: 5px; background: var(--amber);
  display: flex; align-items: center; justify-content: center; font-size: .6rem; font-weight: 700; color: white;
}
.sidebar-switcher .sw-label { font-size: .82rem; font-weight: 600; flex: 1; }
.sidebar-switcher .sw-chevron { color: rgba(255,255,255,0.35); font-size: .7rem; }
.sidebar-nav { flex: 1; min-height: 0; padding: 8px 0; display: flex; flex-direction: column; gap: 1px; overflow-y: auto; }
.nav-section-label {
  font-family: 'Inter', sans-serif;
  font-size: .65rem; text-transform: uppercase; letter-spacing: .08em;
  color: rgba(255,255,255,0.3); padding: 12px 10px 4px; user-select: none;
  display: flex; align-items: center; justify-content: space-between; cursor: pointer;
  flex-shrink: 0;
}
.nav-section-label:hover { color: rgba(255,255,255,0.5); }
.nav-section-label .section-toggle {
  font-size: .8rem; font-weight: 300; transition: transform .2s ease; display: inline-block;
  color: rgba(255,255,255,0.25); line-height: 1;
}
.nav-section-label:hover .section-toggle { color: rgba(255,255,255,0.45); }
.nav-section-label .section-toggle { transform: rotate(45deg); }
.nav-section-label.collapsed .section-toggle { transform: rotate(0deg); }
.nav-section-group { overflow: hidden; transition: max-height .25s ease, opacity .2s ease; max-height: 500px; opacity: 1; flex-shrink: 0; }
.nav-section-group.collapsed { max-height: 0; opacity: 0; }
.nav-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px;
  margin: 0 8px;  /* floating pill — equal inset on both sides */
  cursor: pointer; font-size: .82rem; font-weight: 500; color: rgba(255,255,255,0.6);
  transition: all .12s; user-select: none; flex-shrink: 0;
}
.nav-item:hover { background: var(--sidebar-hover); color: rgba(255,255,255,0.9); }
.nav-item.active { background: var(--sidebar-active); color: var(--amber); }
.nav-item svg { width: 16px; height: 16px; opacity: .55; flex-shrink: 0; }
.nav-item.active svg { opacity: 1; stroke: var(--amber); }
.nav-badge { margin-left: auto; background: var(--amber); color: #fff; font-size: .6rem; font-weight: 700; padding: 1px 6px; border-radius: 10px; min-width: 18px; text-align: center; }
.nav-badge-red { background: var(--danger); }
.nav-sub { padding-left: 18px; }
.nav-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.nav-dot.amber { background: var(--amber); }
.nav-dot.sage { background: var(--sage); }
/* Legacy: kept for any pages still using the old bottom Products list. */
.sidebar-products { border-top: 1px solid rgba(255,255,255,0.06); padding: 8px 8px; margin-top: auto; flex-shrink: 0; }
.nav-product { font-size: .78rem; }
.nav-product.active { color: var(--amber); }
.nav-product-soon { opacity: .45; cursor: default; pointer-events: none; }
.nav-soon-badge { margin-left: auto; font-size: .55rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.5); padding: 1px 5px; border-radius: 4px; }

/* ── Product Dropdown (replaces the bottom Products section) ── */
.sidebar-switcher .sw-chevron { transition: transform .15s ease; display: inline-block; }
.sidebar-switcher.open .sw-chevron { transform: rotate(180deg); }
.product-dropdown {
  display: none;
  margin: -2px 10px 6px 10px;
  padding: 4px;
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  flex-shrink: 0;
}
.product-dropdown.open { display: block; }
.product-option {
  display: flex;
  align-items: stretch;
  border-radius: 6px;
  transition: background .12s;
}
.product-option + .product-option { margin-top: 1px; }
.product-option:hover { background: rgba(255,255,255,0.06); }
.product-option:hover .product-option-newtab { opacity: 1; }
.product-option.active { background: rgba(224,123,26,0.18); }
.product-option-link {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: .78rem;
  font-weight: 500;
  border-radius: 6px 0 0 6px;
  min-width: 0;
}
.product-option-link:hover { color: #fff; }
.product-option.active .product-option-link { color: var(--amber); }
.product-option-icon { width: 14px; height: 14px; opacity: .8; flex-shrink: 0; }
.product-option.active .product-option-icon { opacity: 1; stroke: var(--amber); }
.product-option-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-option-check { width: 13px; height: 13px; color: var(--amber); flex-shrink: 0; stroke: var(--amber); }
.product-option-newtab {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  color: rgba(255,255,255,0.45);
  opacity: .35;
  text-decoration: none;
  border-radius: 0 6px 6px 0;
  transition: opacity .12s, color .12s, background .12s;
  flex-shrink: 0;
}
.product-option-newtab svg { width: 13px; height: 13px; }
.product-option-newtab:hover { opacity: 1; color: var(--amber); background: rgba(255,255,255,0.08); }
.product-option-newtab:focus-visible { opacity: 1; outline: 1px solid var(--amber); outline-offset: -2px; }
.product-dropdown-hint {
  font-size: .58rem;
  color: rgba(255,255,255,0.4);
  padding: 6px 8px 2px;
  line-height: 1.4;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: 4px;
}

.sidebar-admin { border-top: 1px solid rgba(255,255,255,0.06); padding: 8px 0; flex-shrink: 0; }

/* ── List Panel (Middle) ── */
.list-panel {
  width: 280px; background: var(--bg); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0; overflow: hidden;
}
.list-header {
  padding: 16px 14px 12px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.list-header-left h2 { font-family: 'Playfair Display', serif; font-size: 1rem; font-weight: 600; }
.list-header-left .list-count { font-family: 'Inter', sans-serif; font-size: .7rem; color: var(--text-secondary); margin-top: 2px; }
.list-header-actions { display: flex; gap: 6px; }
.list-search { padding: 0 14px 10px; flex-shrink: 0; }
.list-search input {
  width: 100%; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px;
  font-size: .8rem; font-family: inherit; background: white;
}
.list-search input:focus { outline: none; border-color: var(--amber); }
.list-body { flex: 1; overflow-y: auto; }
.list-item {
  padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer;
  transition: background .1s; border-left: 3px solid transparent;
}
.list-item:hover { background: var(--stone-50); }
.list-item.selected { background: var(--amber-light); border-left-color: var(--amber); }
.list-item-title { font-size: .85rem; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.list-item-sub { font-size: .73rem; color: var(--text-secondary); margin-top: 2px; }
.phase-pill {
  font-size: .6rem; font-weight: 700; padding: 1px 6px; border-radius: 10px;
  color: white; flex-shrink: 0;
}
.phase-pill-1 { background: var(--amber); }
.phase-pill-2 { background: var(--info); }
.phase-pill-3 { background: var(--sage); }
.phase-pill-4 { background: var(--success); }

/* ── Detail Panel (Right) ── */
.detail-panel {
  flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg);
}
.detail-header {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; flex-shrink: 0; background: var(--bg);
}
.detail-header-icon {
  width: 36px; height: 36px; border-radius: 8px; background: var(--amber-light);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.detail-header-icon svg { width: 18px; height: 18px; color: var(--amber); }
.detail-header-info { flex: 1; }
.detail-header-info h2 { font-family: 'Playfair Display', serif; font-size: 1.1rem; font-weight: 600; }
.detail-header-info .detail-subtitle { font-family: 'Inter', sans-serif; font-size: .75rem; color: var(--text-secondary); }
.detail-header-actions { display: flex; gap: 6px; flex-shrink: 0; }
.detail-content-wrap { display: flex; flex: 1; overflow: hidden; }
.detail-main { flex: 1; overflow-y: auto; padding: 20px; }
.detail-props {
  width: 200px; background: white; border-left: 1px solid var(--border);
  overflow-y: auto; padding: 16px; flex-shrink: 0;
}
.prop-group { margin-bottom: 14px; }
.prop-label { font-size: .65rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); margin-bottom: 3px; }
.prop-value { font-size: .82rem; font-weight: 500; }
.prop-avatar { display: flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 500; }
.prop-avatar-circle { width: 22px; height: 22px; border-radius: 50%; background: var(--sage); color: white; display: flex; align-items: center; justify-content: center; font-size: .6rem; font-weight: 700; }

/* ── Cards ── */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin-bottom: 1.25rem; }
.stat-card { padding: 1rem; text-align: center; }
.stat-card .stat-label { font-family: 'Inter', sans-serif; font-size: .65rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); margin-bottom: .3rem; }
.stat-card .stat-value { font-size: 1.4rem; font-weight: 700; }
.stat-card .stat-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; margin: 0 auto .6rem; }
.stat-card .stat-icon svg { width: 18px; height: 18px; }
.stat-card .stat-icon.amber { background: rgba(212,135,46,0.1); color: var(--amber); }
.stat-card .stat-icon.sage { background: rgba(107,143,110,0.1); color: var(--sage); }
.stat-card .stat-icon.info { background: rgba(41,128,185,0.1); color: var(--info); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .85rem; border: none; border-radius: 6px; font-size: .8rem; font-weight: 600; font-family: inherit; cursor: pointer; transition: all .12s; text-decoration: none; }
/* Primary uses a themeable accent token so Dealers Think-neon pages (console, bdc)
   get their accent automatically. Falls back to amber → no change to classic pages. */
.btn-primary { background: var(--btn-accent, var(--amber)); color: var(--btn-accent-ink, white); }
.btn-primary:hover { background: var(--btn-accent-hover, #b8741f); }
.btn-secondary { background: var(--stone-50); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--btn-accent, var(--amber)); }
.btn-danger { background: var(--danger-light); color: var(--danger); }
.btn-danger:hover { background: #f5c6c0; }
/* Pink "pop" accent — a high-visibility action (e.g. Escalate to engineering) that
   reads on both light and dark surfaces where .btn-secondary washes out. */
.btn-pop { background: var(--pop, #ff2e9a); color: #fff; }
.btn-pop:hover { filter: brightness(1.06); }
/* Large: a button on a screen someone is READING ALOUD from while on a call
   (the CSI follow-up board) — it has to be hittable without looking down.
   Added 2026-08-30 for the CSI call screen; available to every product. */
.btn-lg { padding: .75rem 1.15rem; font-size: .95rem; font-weight: 800; border-radius: 11px; justify-content: center; }
.btn-lg svg { width: 17px; height: 17px; }
.btn-sm { padding: .3rem .6rem; font-size: .75rem; }
.btn-xs { padding: .2rem .45rem; font-size: .7rem; }
/* transparent / low-emphasis action (e.g. Cancel, inline links) */
.btn-ghost { background: none; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--stone-50); color: var(--text); }
/* Dashed outline for an action ADJACENT to the main flow rather than part of it
   — "the call never happened", "skip this one". Distinct from .btn-secondary,
   which is a quieter version of a main action, not a different KIND of one, and
   from .btn-ghost, which carries no border and reads as a caption next to a
   label. Dashed already means "not part of the conversation" in this product:
   internal-note bubbles use the same treatment. Added 2026-09-05 for the CSI
   call screen's no-contact row; available to every product.
   The border goes solid on hover, so the affordance is unambiguous on contact. */
.btn-quiet { background: none; color: var(--quiet-ink, var(--text-secondary)); border: 1.5px dashed var(--quiet-accent, var(--border)); }
.btn-quiet:hover { border-style: solid; color: var(--quiet-ink, var(--text)); background: var(--quiet-wash, var(--stone-50)); }

/* square icon-only button — pair with an inline <svg> */
.btn-icon { padding: .4rem; border-radius: 6px; background: none; color: var(--text-secondary); }
.btn-icon:hover { background: var(--stone-50); color: var(--btn-accent, var(--amber)); }
.btn-icon svg { width: 16px; height: 16px; }
.btn svg { width: 14px; height: 14px; }
.btn-icon { width: 28px; height: 28px; padding: 0; display: flex; align-items: center; justify-content: center; border-radius: 6px; background: var(--stone-50); border: 1px solid var(--border); cursor: pointer; }
.btn-icon:hover { border-color: var(--amber); }
.btn-icon svg { width: 14px; height: 14px; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .75rem; font-size: .8rem; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--text-secondary); font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; background: var(--stone-50); }
tr:hover td { background: rgba(212,135,46,0.03); }
.badge { display: inline-block; padding: .12rem .5rem; border-radius: 20px; font-size: .7rem; font-weight: 600; }
.badge-active { background: var(--success-light); color: var(--success); }
.badge-draft { background: var(--info-light); color: var(--info); }
.badge-expired { background: var(--danger-light); color: var(--danger); }

/* ── Modal ── */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 200;
  align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-md); width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-family: 'Playfair Display', serif; font-size: 1rem; font-weight: 600; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-secondary); padding: .25rem; font-size: 1.2rem; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 1.25rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: .5rem; padding: .75rem 1.25rem; border-top: 1px solid var(--border); }

/* ── Confirm / Notice dialog ──
   Drives confirmDialog() / noticeDialog() / promptDialog() in common.js — the
   in-app replacement for native confirm()/alert()/prompt(). Reuses .modal-overlay
   for the backdrop + centering; the card below is a compact layout so a
   destructive choice reads unmistakably. Buttons are always verb-labeled (never a
   bare OK/Cancel) — the OS dialog's "Cancel means abort" inversion is exactly the
   footgun this removes. Spec: docs/bdc/mockups/confirm-dialog-mockup.html. */
.dtc { background: var(--surface); border-radius: var(--ds-radius, 12px); box-shadow: var(--shadow-md); width: 100%; max-width: 420px; overflow: hidden; animation: dtcPop .16s ease;
  /* re-point the shared .btn accent to the semantic accent so the primary
     button matches the page's theme (amber on classic, neon on DT). */
  --btn-accent: var(--ds-accent); --btn-accent-ink: var(--ds-on-accent); --btn-accent-hover: var(--ds-accent); }
@keyframes dtcPop { from { transform: scale(.97); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.dtc-head { display: flex; align-items: flex-start; gap: .7rem; padding: 1.15rem 1.25rem 0; }
.dtc-icon { flex: 0 0 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.dtc-icon svg { width: 19px; height: 19px; }
.dtc-icon.danger { background: var(--ds-danger-soft); color: var(--ds-danger); }
.dtc-icon.neutral { background: var(--ds-accent-soft); color: var(--ds-accent); }
.dtc-title { font-family: 'Inter', sans-serif; font-weight: 700; font-size: 1rem; padding-top: .3rem; color: var(--ink, var(--text)); line-height: 1.35; }
.dtc-body { padding: .55rem 1.25rem .1rem; padding-left: calc(1.25rem + 34px + .7rem); font-size: .85rem; color: var(--ink-soft, var(--text-secondary)); line-height: 1.55; }
.dtc-detail { margin-top: .6rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: .55rem .75rem; font-size: .82rem; color: var(--ink, var(--text)); line-height: 1.5; }
.dtc-detail span { color: var(--ink-soft, var(--text-secondary)); }
.dtc-input { width: 100%; margin-top: .55rem; padding: .55rem .75rem; border: 1.5px solid var(--border); border-radius: 6px; font-family: inherit; font-size: .85rem; background: var(--surface); color: var(--ink, var(--text)); }
.dtc-input:focus { outline: none; border-color: var(--ds-accent); }
.dtc-foot { display: flex; justify-content: flex-end; gap: .5rem; padding: 1.1rem 1.25rem 1.15rem; }
/* Scoped button theming so the shared classes match on DT pages too (they lean on
   classic-only tokens like --stone-50 / --danger-light that DT doesn't remap). */
.dtc-foot .btn-secondary { background: var(--surface-2); color: var(--ink, var(--text)); border-color: var(--border); }
.dtc-foot .btn-danger { background: var(--ds-danger-soft); color: var(--ds-danger); }
.dtc-foot .btn-danger:hover { background: var(--ds-danger-soft); filter: brightness(.96); }
@media (max-width: 480px) {
  .dtc-body { padding-left: 1.25rem; }
  .dtc-foot { flex-direction: column-reverse; }
  .dtc-foot .btn { width: 100%; justify-content: center; }
}

/* ── Form ── */
.form-group { margin-bottom: .85rem; }
.form-group label { display: block; font-size: .75rem; font-weight: 600; color: var(--text-secondary); margin-bottom: .3rem; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: .55rem .75rem; border: 1.5px solid var(--border); border-radius: 6px;
  font-size: .85rem; font-family: inherit; transition: border-color .2s; background: white;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--amber); }
.form-group textarea { min-height: 80px; resize: vertical; }
/* Branded select chevron (replaces native OS dropdown chrome) — design-system
   wide, so every form dropdown is on-brand. */
.form-group select {
  -webkit-appearance: none; appearance: none; padding-right: 2rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8a8a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .65rem center; background-size: 12px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-secondary); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 1rem; opacity: .3; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: .3rem; }
.empty-state p { font-size: .85rem; margin-bottom: 1rem; }

/* ── Sections ── */
.section { display: none; }
.section.active { display: flex; flex-direction: column; }

/* ── Search Bar ── */
.search-bar { display: flex; align-items: center; gap: .5rem; background: var(--stone-50); border: 1px solid var(--border); border-radius: 6px; padding: .4rem .7rem; flex: 1; max-width: 280px; }
.search-bar input { border: none; background: none; outline: none; font-size: .8rem; font-family: inherit; flex: 1; }
.search-bar svg { width: 14px; height: 14px; color: var(--text-secondary); }

/* ── Toast ── */
.toast { position: fixed; bottom: 2rem; right: 2rem; background: var(--charcoal); color: white; padding: .65rem 1.15rem; border-radius: 8px; font-size: .8rem; font-weight: 500; box-shadow: var(--shadow-md); transform: translateY(100px); opacity: 0; transition: all .3s; z-index: 9995; }
/* Pages with no topbar get the floating "? Help" pill in the same corner
   (z-index 9990) — lift the toast above it so a confirmation is never hidden. */
body:has(#dtHelpFab) .toast { bottom: 4.75rem; }
.toast.show { transform: translateY(0); opacity: 1; }

/* ── Notes ── */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .75rem; }
.note-card { cursor: pointer; transition: box-shadow .15s; padding: 1rem; }
.note-card:hover { box-shadow: var(--shadow-md); }
.note-card .note-title { font-weight: 600; font-size: .85rem; margin-bottom: .3rem; }
.note-card .note-preview { font-size: .8rem; color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.note-card .note-meta { font-size: .7rem; color: var(--text-secondary); margin-top: .6rem; padding-top: .4rem; border-top: 1px solid var(--border); }

/* ── Documents ── */
.doc-list-item { display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; border-bottom: 1px solid var(--border); }
.doc-list-item:last-child { border-bottom: none; }
.doc-icon { width: 36px; height: 36px; border-radius: 6px; background: var(--stone-50); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.doc-icon svg { width: 18px; height: 18px; color: var(--amber); }
.doc-info { flex: 1; }
.doc-info .doc-name { font-size: .82rem; font-weight: 600; }
.doc-info .doc-detail { font-size: .7rem; color: var(--text-secondary); margin-top: .1rem; }
.doc-actions { display: flex; gap: .3rem; }

/* ── Loading ── */
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Simulation Banner ── */
.sim-banner {
  display: none; position: fixed; top: 48px; left: 0; right: 0; z-index: 150;
  background: linear-gradient(135deg, #6c5ce7, #a29bfe); color: white;
  padding: .45rem 1rem; font-size: .8rem; font-weight: 600;
  align-items: center; justify-content: space-between; gap: .75rem;
  box-shadow: 0 2px 8px rgba(108,92,231,0.3);
}
.sim-banner.active { display: flex; }
.sim-banner .sim-info { display: flex; align-items: center; gap: .5rem; }
.sim-banner .sim-info svg { width: 16px; height: 16px; }
.sim-banner .sim-exit { background: rgba(255,255,255,0.2); color: white; border: 1px solid rgba(255,255,255,0.4); border-radius: 6px; padding: .25rem .65rem; font-size: .75rem; font-weight: 600; cursor: pointer; font-family: inherit; transition: background .15s; }
.sim-banner .sim-exit:hover { background: rgba(255,255,255,0.35); }

/* ── Phase progress bar ── */
.phase-bar { display: flex; gap: 0; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); margin-bottom: 1rem; }
.phase-bar-seg { flex: 1; padding: .4rem .2rem; text-align: center; font-size: .65rem; font-weight: 600; border-right: 1px solid var(--border); }
.phase-bar-seg:last-child { border-right: none; }
.phase-bar-seg .phase-num { display: block; font-size: .55rem; opacity: .7; }

/* ── Data Table alt ── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { text-align: left; padding: .5rem .6rem; font-size: .8rem; border-bottom: 1px solid var(--border); }
.data-table th { font-weight: 600; color: var(--text-secondary); font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; background: var(--stone-50); }

/* ── Page header inside detail ── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.page-header h1 { font-family: 'Playfair Display', serif; font-size: 1.3rem; font-weight: 600; }
.page-header .subtitle { font-family: 'Inter', sans-serif; font-size: .8rem; color: var(--text-secondary); margin-top: .1rem; }

/* ── Detail empty ── */
.detail-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--text-secondary); text-align: center; padding: 2rem; }
.detail-empty svg { width: 64px; height: 64px; opacity: .15; margin-bottom: 1rem; }
.detail-empty h3 { font-family: 'Playfair Display', serif; font-size: 1.1rem; color: var(--text); margin-bottom: .3rem; }
.detail-empty p { font-size: .85rem; }

/* ── FAQ ── */
.faq-item { border: 1.5px solid var(--border); border-radius: 8px; overflow: hidden; }
.faq-header { display: flex; align-items: center; gap: 8px; padding: 10px 14px; cursor: pointer; font-size: .82rem; font-weight: 600; transition: background .1s; }
.faq-header:hover { background: var(--stone-50); }
.faq-chevron { margin-left: auto; transition: transform .2s; font-size: .7rem; color: var(--text-secondary); }
.faq-body { display: none; padding: 0 14px 12px; font-size: .8rem; color: var(--text-secondary); line-height: 1.6; border-top: 1px solid var(--border); padding-top: 10px; margin: 0 14px; }
.faq-item.open .faq-body { display: block; }
.faq-item.open .faq-chevron { transform: rotate(180deg); }

/* ── Collapsible sidebar: icon rail + hover-peek + pin (CLAUDE.md §5) ──
   Single control: pinned = expanded (default), unpinned = icon rail that
   hover/focus expands. State persists per user (localStorage navPinned). */
/* One consistent home on every product page: docked at the right edge of the
   Settings nav row (common.js adds .in-row). Pages without a Settings item
   keep the floating top-right fallback. The collapsed rail hides the pin —
   hover/focus-peek reveals it again so it stays reachable. */
.nav-pin { position: absolute; top: 10px; right: 8px; z-index: 5; display: flex; align-items: center; }
.nav-pin.in-row { position: static; margin-left: auto; z-index: auto; }
.nav-pin button { border: none; background: none; cursor: pointer; color: rgba(255,255,255,0.5); padding: 5px; border-radius: 6px; display: flex; }
.nav-pin.in-row button { padding: 2px; }
.nav-pin button:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-pin button.pinned { color: var(--amber); }
.nav-pin svg { width: 16px; height: 16px; }

.sidebar { transition: width .16s ease; position: relative; }
.app.nav-rail .sidebar { width: 56px; }
.app.nav-rail .sidebar-switcher .sw-label, .app.nav-rail .sidebar-switcher .sw-chevron,
.app.nav-rail .nav-item span, .app.nav-rail .nav-section-label, .app.nav-rail .nav-badge { display: none; }
/* Hide any trailing/secondary icon in a collapsed nav-item (e.g. the "open in
   new tab" indicator on Dealers/Members) — keep only the leading icon. */
.app.nav-rail .nav-item svg:not(:first-of-type) { display: none; }
.app.nav-rail .sidebar-switcher { justify-content: center; padding: 10px; }
.app.nav-rail .nav-item { justify-content: center; padding: 8px; }
.app.nav-rail .nav-pin { display: none; }
/* Hide the product dropdown only while the rail is collapsed (it'd be clipped at
   56px). When the rail is hover/focus-expanded, the switcher works normally. */
.app.nav-rail .product-dropdown { display: none; }
.app.nav-rail .sidebar:hover .product-dropdown.open,
.app.nav-rail .sidebar:focus-within .product-dropdown.open { display: block; }
/* hover / keyboard-focus peek (in-flow expand) */
.app.nav-rail .sidebar:hover, .app.nav-rail .sidebar:focus-within { width: 208px; }
.app.nav-rail .sidebar:hover .sidebar-switcher, .app.nav-rail .sidebar:focus-within .sidebar-switcher { justify-content: flex-start; padding: 12px 14px; }
.app.nav-rail .sidebar:hover .nav-item, .app.nav-rail .sidebar:focus-within .nav-item { justify-content: flex-start; }
.app.nav-rail .sidebar:hover .nav-pin, .app.nav-rail .sidebar:focus-within .nav-pin { display: flex; }
.app.nav-rail .sidebar:hover .sidebar-switcher .sw-label, .app.nav-rail .sidebar:focus-within .sidebar-switcher .sw-label,
.app.nav-rail .sidebar:hover .sidebar-switcher .sw-chevron, .app.nav-rail .sidebar:focus-within .sidebar-switcher .sw-chevron,
.app.nav-rail .sidebar:hover .nav-item span, .app.nav-rail .sidebar:focus-within .nav-item span,
.app.nav-rail .sidebar:hover .nav-section-label, .app.nav-rail .sidebar:focus-within .nav-section-label,
.app.nav-rail .sidebar:hover .nav-badge, .app.nav-rail .sidebar:focus-within .nav-badge,
.app.nav-rail .sidebar:hover .nav-item svg:not(:first-of-type), .app.nav-rail .sidebar:focus-within .nav-item svg:not(:first-of-type) { display: revert; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { width: 48px; }
  .sidebar-switcher .sw-label, .sidebar-switcher .sw-chevron, .nav-item span, .nav-section-label { display: none; }
  .nav-section-group.collapsed { max-height: 500px; opacity: 1; }
  .sidebar-switcher { justify-content: center; padding: 10px; }
  .nav-item { justify-content: center; padding: 8px; }
  .nav-badge { display: none; }
  .product-dropdown { display: none !important; } /* dropdown unusable at icon-strip width */
  .list-panel { width: 200px; }
  .detail-props { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════
   Custom dropdown (.cdd) — themeable replacement for native
   <select> option popups (which are OS-drawn and un-themeable).
   Canonical, single source of truth. Enhanced by dtSelectEnhance
   in common.js, and also used directly (console Members filters).
   Colors use cross-token fallbacks so the same block works on
   console (--ink/--surface-2/--neon-ink/--neon-rgb) and Rate CRM
   (--text/--accent-green/--success) pages alike.
   ═══════════════════════════════════════════════════════════ */
.cdd { position: relative; display: inline-block; vertical-align: middle; max-width: 100%; }
.cdd.cdd-block { display: block; width: 100%; }

.cdd-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 1px solid var(--border, #e2e6e0); border-radius: 10px; padding: 9px 13px;
  background: var(--surface, #fff); color: var(--ink, var(--text, #0b0f0c));
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  text-align: left; line-height: 1.2; white-space: nowrap; overflow: hidden;
}
.cdd.cdd-block .cdd-btn { width: 100%; }
.cdd-btn > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cdd-btn svg { flex: none; color: var(--ink-faint, var(--text-secondary, #8a948c)); opacity: .8; }
.cdd-btn:disabled, .cdd-btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }

.cdd-menu {
  position: absolute; top: calc(100% + 5px); left: 0; min-width: 100%;
  background: var(--surface, #fff); border: 1px solid var(--border, #e2e6e0);
  border-radius: 11px; box-shadow: 0 12px 34px rgba(0,0,0,.16); padding: 5px;
  z-index: 60; display: none; max-height: 280px; overflow: auto;
}
.cdd.open .cdd-menu { display: block; }
/* Flip upward when there isn't room below. */
.cdd.cdd-up .cdd-menu { top: auto; bottom: calc(100% + 5px); }

.cdd-opt {
  padding: 9px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap; color: var(--ink, var(--text, #0b0f0c));
}
.cdd-opt:hover { background: var(--surface-2, rgba(0,0,0,.05)); }
.cdd-opt.sel {
  background: var(--surface-2, rgba(0,0,0,.05)); font-weight: 700;
  color: var(--neon-ink, var(--accent-green, var(--success, #1f7a36)));
}
.cdd-opt.dis { opacity: .45; pointer-events: none; }
