:root {
  --ink: #181716;
  --ink-soft: #3f3c38;
  --muted: #706b65;
  --line: #dedad4;
  --line-strong: #c9c3bc;
  --canvas: #f5f3ef;
  --surface: #ffffff;
  --surface-soft: #efede9;
  --orange: #f36b21;
  --orange-dark: #d95512;
  --orange-soft: #fff2e8;
  --success: #24734a;
  --success-soft: #eaf5ee;
  --danger: #b63b32;
  --danger-soft: #fff0ee;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --page: 1180px;
  --focus: 0 0 0 3px rgba(243, 107, 33, 0.22);
  --modal-shadow: 0 28px 80px rgba(24, 23, 22, 0.24);
}

.share-rate-hidden [data-share-rate] {
  display: none !important;
}

.retention-rate-hidden [data-retention-rate] {
  display: none !important;
}

.settings-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 20px 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--orange);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: clip; }
body {
  margin: 0;
  min-width: 320px;
  overflow-x: clip;
  background: var(--canvas);
  color: var(--ink);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}
body.modal-open { overflow: hidden; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -80px;
  left: var(--space-4);
  z-index: 200;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: white;
  text-decoration: none;
  transition: top 160ms ease;
}
.skip-link:focus { top: var(--space-4); }

.page-shell {
  width: min(var(--page), calc(100% - 48px));
  margin-inline: auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}
.topbar__inner {
  position: relative;
  width: min(1600px, calc(100% - 64px));
  min-height: 70px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 28px;
}
.wordmark { display: inline-flex; align-items: center; }
.wordmark img { display: block; width: 142px; height: auto; }
.main-nav { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 22px; min-width: 0; }
.main-nav__links, .topbar-tools { display: flex; align-items: center; gap: var(--space-1); }
.main-nav__links { flex: 0 0 auto; }
.topbar-tools { min-width: 0; justify-content: flex-end; gap: 14px; }
.nav-group { display: inline-flex; align-items: center; gap: 3px; min-width: 0; }
.header-more { position: relative; }
.header-more > summary { list-style: none; gap: 8px; }
.header-more > summary::-webkit-details-marker { display: none; }
.header-more__chevron { flex-shrink: 0; transition: transform 150ms ease; }
.header-more[open] .header-more__chevron { transform: rotate(180deg); }
.header-more[open] > summary { background: var(--surface-soft); color: var(--ink); }
.header-more__panel { position: absolute; top: calc(100% + 10px); right: 0; width: 240px; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 36px rgba(24,23,22,.12); }
.header-more__panel .nav-action { width: 100%; justify-content: flex-start; }
@media (min-width: 1121px) { #mobile-logout-button { display: none; } }
@media (max-width: 1120px) {
  .nav-group { flex-wrap: wrap; }
  .header-more__panel { position: static; width: 100%; box-shadow: none; border: 0; padding: 4px 0; }
  .main-nav { max-height: calc(100dvh - 90px); overflow-y: auto; }
}
.nav-group__label { flex: 0 0 auto; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .02em; white-space: nowrap; }
.main-nav a, .nav-action {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.main-nav a:hover, .main-nav a.is-active, .nav-action:hover { background: var(--surface-soft); color: var(--ink); }
.nav-action--prominent { color: var(--orange-dark); }
.topbar__actions { display: flex; align-items: center; gap: var(--space-2); }
.menu-toggle {
  width: 44px;
  height: 44px;
  padding: 11px;
  display: none;
  place-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}
.menu-toggle span { display: block; width: 20px; height: 2px; background: var(--ink); border-radius: 2px; }
.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 120ms ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0); }
.button:focus-visible, .nav-action:focus-visible, .main-nav a:focus-visible, .menu-toggle:focus-visible,
input:focus-visible, summary:focus-visible, .modal-close:focus-visible { outline: none; box-shadow: var(--focus); }
.button--primary { background: var(--ink); color: white; }
.button--primary:hover:not(:disabled) { background: #000; }
.button--secondary { border-color: var(--line-strong); background: var(--surface); color: var(--ink); }
.button--secondary:hover:not(:disabled) { border-color: var(--ink-soft); }
.button--tertiary { min-height: 38px; padding-inline: 10px; border-color: transparent; background: transparent; color: var(--muted); font-size: 12px; }
.button--tertiary:hover:not(:disabled) { border-color: var(--line); background: var(--surface-soft); color: var(--ink); }
.button:disabled { opacity: 0.58; cursor: wait; }

.auth-user-pill {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 6px 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}
.auth-user-pill__name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}
.logout-btn {
  min-width: 44px;
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.nav-action--logout { color: var(--danger); }

.intro { padding: 64px 0 30px; }
.eyebrow, .step-label {
  display: block;
  margin-bottom: var(--space-2);
  color: var(--orange-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.intro h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.02;
  letter-spacing: -0.045em;
  font-weight: 780;
}
.intro p { max-width: 660px; margin: var(--space-4) 0 0; color: var(--muted); font-size: 17px; }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
}
.panel__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-5);
  padding: var(--space-5);
  border-bottom: 1px solid var(--line);
}
.panel__heading h2, .section-heading h2 { margin: 0; font-size: 19px; line-height: 1.2; letter-spacing: -0.02em; }
.panel__heading p, .section-heading p { margin: var(--space-1) 0 0; color: var(--muted); font-size: 13px; }

.lead-capture { margin-top: var(--space-3); }
.lead-panel { position: relative; }
.lead-panel::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--orange); }
.lead-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  padding: var(--space-5);
}
.lead-state-select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0 13px;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease;
  appearance: auto;
}
.lead-state-select:focus { outline: none; border-color: var(--orange); box-shadow: var(--focus); }

.field-item { display: flex; flex-direction: column; min-width: 0; }
.field-item__label { min-height: 21px; margin-bottom: 6px; font-size: 12px; font-weight: 700; }
.field-item__label .req { color: var(--danger); }
.field-item__label .opt { color: var(--muted); font-size: 11px; font-weight: 500; }
.field-item input, .form-group input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0 13px;
  color: var(--ink);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.field-item input:focus, .form-group input:focus { outline: none; border-color: var(--orange); box-shadow: var(--focus); }
.field-item input.is-invalid { border-color: var(--danger); background: var(--danger-soft); }
.lead-internal { margin: 0 var(--space-5) var(--space-5); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.lead-internal[hidden] { display: none; }
.lead-internal__heading { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin-bottom: var(--space-4); }
.lead-internal__heading strong { font-size: 13px; }
.lead-internal__heading span { color: var(--muted); font-size: 12px; }
.lead-tags { margin: 0 0 var(--space-4); padding: 0; border: 0; }
.lead-tags legend { margin-bottom: 8px; font-size: 12px; font-weight: 700; }
.lead-tags__options { display: flex; flex-wrap: wrap; gap: 8px; }
.lead-tags__options label { display: inline-flex; gap: 6px; align-items: center; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); cursor: pointer; font-size: 12px; }
.lead-tags__options label:has(input:checked) { border-color: var(--orange); background: var(--orange-soft); }
.lead-tags__options input { accent-color: var(--orange); }
.lead-internal textarea { width: 100%; min-height: 88px; padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); resize: vertical; font: inherit; }
.lead-internal textarea:focus { outline: none; border-color: var(--orange); box-shadow: var(--focus); }
.field-error { min-height: 16px; margin-top: var(--space-1); color: var(--danger); font-size: 11px; }
.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 0.82fr) minmax(500px, 1.18fr);
  gap: var(--space-5);
  align-items: stretch;
  padding-top: var(--space-5);
}
.assumptions { display: flex; flex-direction: column; }
.field-list { padding: 8px var(--space-5) 0; }
.field-row {
  min-height: 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.72fr);
  align-items: center;
  gap: var(--space-4);
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.field-row:last-child { border-bottom: 0; }
.field-row__copy { display: flex; flex-direction: column; gap: 1px; }
.field-row__copy strong { font-size: 13px; }
.field-row__copy small, .field-note { color: var(--muted); font-size: 11px; }
.field-note { grid-column: 2; margin-top: -7px; }
.input-shell {
  min-height: 40px;
  display: flex;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.input-shell:focus-within { border-color: var(--orange); box-shadow: var(--focus); }
.input-shell > span { display: inline-flex; align-items: center; padding: 0 10px; background: var(--surface-soft); color: var(--muted); font-size: 11px; white-space: nowrap; }
.input-shell input { width: 100%; min-width: 0; border: 0; outline: 0; padding: 0 10px; text-align: right; font-weight: 750; background: transparent; }
.input-shell input::-webkit-outer-spin-button, .input-shell input::-webkit-inner-spin-button { appearance: none; margin: 0; }
.input-shell--suffix > span { order: 2; }
.input-shell--fixed { background: var(--surface-soft); }
.input-shell--fixed input { color: var(--muted); cursor: not-allowed; }
.fixed-rule {
  margin: var(--space-4) var(--space-5) 0;
  padding: var(--space-3) 0;
  display: grid;
  grid-template-columns: 8px 1fr;
  gap: var(--space-3);
  color: var(--muted);
}
.fixed-rule > span { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: var(--ink); }
.fixed-rule strong { display: block; color: var(--ink); font-size: 12px; }
.fixed-rule small { display: block; margin-top: 1px; font-size: 11px; }
.form-status { min-height: 18px; margin: 0 var(--space-5) var(--space-4); color: var(--danger); font-size: 12px; }

.summary {
  display: flex;
  flex-direction: column;
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}
.summary .panel__heading { border-bottom-color: rgba(255, 255, 255, 0.14); }
.summary .step-label { color: #ff9b62; }
.summary .panel__heading p { color: #bdb7b0; }
.eligibility {
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #e8e4df;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.eligibility.is-limited { border-color: rgba(255, 175, 166, 0.35); color: #ffb0a7; }
.hero-result { padding: var(--space-6) var(--space-5) var(--space-5); }
.hero-result > span { display: block; color: #ff9b62; font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.hero-result > strong { display: block; margin-top: 5px; font-size: clamp(42px, 5vw, 64px); line-height: 1; letter-spacing: -0.045em; }
.hero-result p { margin: var(--space-3) 0 0; color: #d2cdc7; font-size: 14px; }
.metric-grid { margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid rgba(255, 255, 255, 0.14); }
.metric-grid div { padding: var(--space-4) var(--space-5); border-right: 1px solid rgba(255, 255, 255, 0.14); border-bottom: 1px solid rgba(255, 255, 255, 0.14); }
.metric-grid div:nth-child(2n) { border-right: 0; }
.metric-grid dt { color: #a9a39d; font-size: 11px; }
.metric-grid dd { margin: 3px 0 0; font-size: 20px; font-weight: 750; }
.per-client { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); padding: var(--space-4) var(--space-5) 0; }
.per-client div { padding: var(--space-3); border: 1px solid rgba(255, 255, 255, 0.13); border-radius: var(--radius-sm); }
.per-client span { display: block; color: #a9a39d; font-size: 11px; }
.per-client strong { display: block; margin-top: 3px; font-size: 14px; }
.proposal-action-box { margin-top: auto; padding: var(--space-5); }
.button--cta { width: 100%; min-height: 50px; background: var(--orange); color: white; font-size: 14px; }
.button--cta:hover:not(:disabled) { background: var(--orange-dark); }
.proposal-action-note { display: block; max-width: 520px; margin: 10px auto 0; color: #aaa49e; text-align: center; font-size: 11px; }

.details-shell { padding: var(--space-7) 0 72px; }
.simulation-details { border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); }
.simulation-details > summary {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  list-style: none;
  cursor: pointer;
}
.simulation-details > summary::-webkit-details-marker { display: none; }
.simulation-details > summary small { display: block; color: var(--orange-dark); font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.simulation-details > summary strong { display: block; margin-top: 3px; font-size: 22px; letter-spacing: -0.02em; }
.details-toggle-label { color: var(--muted); font-size: 13px; font-weight: 700; }
.simulation-details__content { padding: 0 0 var(--space-7); }
.insights { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-5); padding-top: var(--space-4); }
.chart-panel { min-height: 420px; }
.portfolio-panel { min-height: 0; }
.portfolio-panel .table-scroll--compact { max-height: none; overflow-x: visible; }
.portfolio-panel table { table-layout: fixed; }
.portfolio-panel th:first-child, .portfolio-panel td:first-child { width: 14%; }
.panel__heading--chart { flex-wrap: wrap; }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-3); color: var(--muted); font-size: 11px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend__line { width: 18px; height: 2px; border-radius: 2px; background: var(--orange); }
.legend__line--blue { background: var(--ink); }
.legend__line--navy { height: 0; border-top: 2px dashed var(--muted); background: transparent; }
.chart-wrap { position: relative; flex: 1; min-height: 330px; padding: var(--space-4); }
#projection-chart { display: block; width: 100%; height: 330px; }
.chart-tooltip { position: absolute; z-index: 4; min-width: 170px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--ink); color: white; font-size: 11px; pointer-events: none; box-shadow: var(--modal-shadow); }
.chart-tooltip strong, .chart-tooltip span { display: block; }
.chart-tooltip strong { margin-bottom: 3px; color: #ff9b62; }
.table-panel { margin-top: var(--space-3); }
.table-scroll { width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.table-scroll--compact, .table-scroll--projection { max-height: 460px; overflow-y: auto; }
.scroll-hint { display: none; margin: 0; padding: 10px var(--space-4); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; }
table { width: 100%; border-collapse: collapse; text-align: right; font-size: 12px; white-space: nowrap; }
thead { position: sticky; top: 0; z-index: 2; background: var(--surface-soft); }
th, td { padding: 11px 13px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
th:first-child, td:first-child { text-align: left; }
tbody tr.is-horizon { background: var(--orange-soft); }
tbody tr.is-after-horizon { color: var(--muted); }
.projection-section, .scenario-section { padding-top: var(--space-7); }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-3); }
.table-key { display: flex; gap: var(--space-3); color: var(--muted); font-size: 11px; }
.table-key span { display: inline-flex; align-items: center; gap: 6px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); }
.status-dot--no { background: var(--muted); }
.status-label { display: inline-flex; min-width: 36px; justify-content: center; padding: 3px 6px; border-radius: 4px; background: var(--surface-soft); color: var(--ink); font-size: 10px; font-weight: 800; }
.status-label--no { background: var(--orange-soft); color: var(--orange-dark); }
.calculation-section { padding-top: var(--space-7); }
.calculation-details { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.calculation-details summary { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: 0 var(--space-5); cursor: pointer; font-weight: 750; }
.calculation-details summary small { color: var(--muted); font-size: 12px; font-weight: 500; }
.calculation-details__content { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); padding: 0 var(--space-5) var(--space-5); }
.calculation-details__content h2 { margin: 0 0 6px; font-size: 14px; }
.calculation-details__content p { margin: 0 0 10px; color: var(--muted); font-size: 12px; }
.calculation-details__content code { display: block; padding: 10px; border-radius: var(--radius-sm); background: var(--surface-soft); color: var(--ink-soft); font-size: 11px; white-space: normal; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: var(--space-5);
  background: rgba(24, 23, 22, 0.64);
  backdrop-filter: blur(5px);
}
.modal-card {
  width: min(460px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--modal-shadow);
}
.modal-card--wide { width: min(720px, 100%); }
.modal-header { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: 0 var(--space-5); border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; font-size: 20px; letter-spacing: -0.02em; }
.modal-header-actions { display: flex; align-items: center; gap: var(--space-2); }
.modal-close { width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 25px; cursor: pointer; }
.modal-close:hover { background: var(--surface-soft); color: var(--ink); }
.modal-body { overflow-y: auto; padding: var(--space-5); }
.modal-intro { margin: 0 0 var(--space-5); color: var(--muted); font-size: 14px; }
.form-group { margin-bottom: var(--space-4); }
.form-group label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 700; }
.modal-error { margin-bottom: var(--space-4); padding: var(--space-3); border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-size: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--space-3); margin-top: var(--space-5); }
#proposal-review-step .modal-actions .button--cta { width: auto; }
.review-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.review-box { padding: var(--space-4) 0; }
.review-box + .review-box { padding-left: var(--space-5); border-left: 1px solid var(--line); }
.review-box h3, .review-summary-card h3 { margin: 0 0 var(--space-3); color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.review-box p { margin: 2px 0; font-size: 13px; }
.review-summary-card { margin-top: var(--space-5); padding: var(--space-4); border-left: 3px solid var(--orange); background: var(--orange-soft); }
.review-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); }
.review-metrics span { display: block; color: var(--muted); font-size: 10px; }
.review-metrics strong { display: block; margin-top: 3px; color: var(--ink); font-size: 17px; }
.review-disclaimer { margin-top: var(--space-4); color: var(--muted); font-size: 12px; }
.review-disclaimer strong { color: var(--ink); }
.state-box { min-height: 360px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-3); text-align: center; }
.state-box h3 { margin: 0; font-size: 21px; }
.state-box > p { max-width: 440px; margin: 0; color: var(--muted); font-size: 14px; }
.state-icon { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-soft); font-size: 26px; }
.state-box--success .state-icon { background: var(--success-soft); color: var(--success); }
.state-box--error .state-icon { background: var(--danger-soft); color: var(--danger); }
.state-details { margin-top: var(--space-2); padding: var(--space-3) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-sm); text-align: left; }
.state-details p { margin: 3px 0; font-size: 12px; }
.state-details code { font-family: Consolas, monospace; }
.spinner { width: 44px; height: 44px; border: 3px solid var(--line); border-top-color: var(--orange); border-radius: 50%; animation: spin 750ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* User management modal */
.add-user-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}
.user-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--surface-soft);
  color: var(--muted);
}
.user-role-badge--admin {
  background: var(--orange-soft);
  color: var(--orange-dark);
}
.user-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
}
.user-status-badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}
.user-status-badge--inactive::before { background: var(--muted); }
.user-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.password-btn,
.revoke-btn {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}
.password-btn { color: var(--ink); }
.password-btn:hover { background: var(--surface-soft); border-color: var(--ink); }
.revoke-btn { color: var(--danger); }
.revoke-btn:hover { background: var(--danger-soft); border-color: var(--danger); }
.revoke-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.button--compact { min-height: 36px; padding-inline: 12px; font-size: 12px; }

@media (max-width: 560px) {
  .add-user-grid { grid-template-columns: 1fr; }
}


.footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer .page-shell { min-height: 92px; display: flex; align-items: center; justify-content: space-between; gap: var(--space-5); }
.footer-logo { width: 125px; height: auto; }
.footer p { margin: 0; color: var(--muted); font-size: 12px; text-align: right; }

@media (max-width: 1060px) {
  .lead-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace { grid-template-columns: minmax(310px, 0.8fr) minmax(420px, 1.2fr); }
  .topbar__inner { gap: var(--space-4); }
  .main-nav { gap: 12px; }
  .topbar-tools { gap: 6px; }
  .nav-group { padding-left: 8px; }
  .main-nav a, .nav-action { padding-inline: 7px; font-size: 12px; }
  .auth-user-pill__name { max-width: 124px; }
}

@media (max-width: 1120px) {
  .page-shell, .topbar__inner { width: min(100% - 32px, var(--page)); }
  .topbar__inner { min-height: 64px; grid-template-columns: auto 1fr auto; }
  .wordmark img { width: 128px; }
  .menu-toggle { display: grid; }
  .main-nav {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(320px, calc(100vw - 32px));
    display: none;
    align-items: stretch;
    padding: var(--space-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--modal-shadow);
  }
  .main-nav.is-open { display: block; }
  .main-nav__links, .topbar-tools { display: grid; }
  .topbar-tools { margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--line); justify-content: stretch; }
  .nav-group { display: grid; padding-left: 0; }
  .header-more { width: 100%; }
  .header-more > summary { justify-content: space-between; }
  .header-more__panel { padding-left: 10px; }
  .main-nav a, .nav-action { width: 100%; justify-content: flex-start; min-height: 44px; }
  .topbar__actions { grid-column: 3; }
  .logout-btn { display: none; }
  .auth-user-pill { max-width: 150px; padding-left: 12px; }
  .auth-user-pill__name { max-width: 118px; }
  .workspace { grid-template-columns: 1fr; }
  .summary { min-height: 620px; }
  .insights { grid-template-columns: 1fr; }
  .calculation-details__content { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .page-shell, .topbar__inner { width: min(100% - 24px, var(--page)); }
  .topbar__inner { gap: var(--space-2); }
  .wordmark img { width: 116px; }
  .auth-user-pill { max-width: 112px; min-height: 44px; padding: 0 11px; }
  .auth-user-pill__name { max-width: 88px; font-size: 12px; }
  .button--secondary#login-button { min-width: 64px; padding-inline: 12px; }
  .intro { padding: 44px 0 22px; }
  .intro h1 { font-size: 39px; }
  .intro p { font-size: 15px; }
  .panel { border-radius: 12px; }
  .panel__heading { padding: 20px; }
  .lead-grid { grid-template-columns: 1fr; gap: var(--space-3); padding: 20px; }
  .lead-internal { margin-inline: 20px; }
  .workspace { gap: var(--space-4); padding-top: var(--space-4); }
  .field-list { padding-inline: 20px; }
  .field-row { grid-template-columns: 1fr; gap: 7px; padding: 13px 0; }
  .field-note { grid-column: 1; margin-top: -4px; }
  .input-shell { min-height: 44px; }
  .fixed-rule { margin-inline: 20px; }
  .form-status { margin-inline: 20px; }
  .summary { min-height: 0; }
  .summary .panel__heading { display: block; }
  .eligibility { display: inline-flex; margin-top: var(--space-3); }
  .hero-result { padding: 28px 20px 20px; }
  .hero-result > strong { font-size: 46px; }
  .metric-grid div { padding: 15px 20px; }
  .metric-grid dd { font-size: 17px; }
  .per-client { grid-template-columns: 1fr; padding-inline: 20px; }
  .proposal-action-box { padding: 20px; }
  .details-shell { padding: 36px 0 56px; }
  .simulation-details > summary { min-height: 88px; }
  .simulation-details > summary strong { font-size: 18px; }
  .details-toggle-label { font-size: 11px; }
  .panel__heading--chart { display: block; }
  .legend { margin-top: var(--space-3); }
  .chart-panel, .portfolio-panel { min-height: 0; }
  .portfolio-panel .table-scroll--compact { max-height: none; padding: 0 var(--space-4) var(--space-4); overflow: visible; }
  .portfolio-panel table { white-space: normal; }
  .portfolio-panel thead { display: none; }
  .portfolio-panel tbody { display: grid; gap: var(--space-3); }
  .portfolio-panel tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
  }
  .portfolio-panel tbody td {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    border: 0;
    text-align: left;
    white-space: normal;
  }
  .portfolio-panel tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  .portfolio-panel tbody td:first-child {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    background: var(--surface-soft);
  }
  .portfolio-panel tbody td:nth-child(2) { border-right: 1px solid var(--line); }
  .portfolio-panel tbody td:last-child {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
    background: var(--orange-soft);
  }
  .scroll-hint { display: block; }
  .section-heading { display: block; }
  .table-key { margin-top: var(--space-3); }
  .calculation-details summary { align-items: flex-start; flex-direction: column; justify-content: center; gap: 2px; }
  .footer .page-shell { min-height: 110px; flex-direction: column; justify-content: center; gap: var(--space-3); }
  .footer p { text-align: center; }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal-card, .modal-card--wide { width: 100%; max-height: calc(100dvh - 16px); border-radius: 18px 18px 0 0; }
  .modal-header { min-height: 64px; padding-inline: 20px 10px; }
  .modal-body { padding: 20px; }
  .review-grid { grid-template-columns: 1fr; }
  .review-box + .review-box { padding-left: 0; border-top: 1px solid var(--line); border-left: 0; }
  .review-metrics { grid-template-columns: repeat(2, 1fr); }
  .review-metrics strong { font-size: 16px; }
  #proposal-review-step .modal-actions {
    position: sticky;
    bottom: -20px;
    margin-inline: -20px;
    padding: var(--space-3) 20px 20px;
    border-top: 1px solid var(--line);
    background: var(--surface);
  }
  #proposal-review-step .modal-actions .button { flex: 1; padding-inline: 12px; }
  #proposal-review-step .modal-actions { flex-direction: column; }
  #proposal-review-step .modal-actions .button { width: 100%; }
  .state-box { min-height: 440px; }
  .state-box .modal-actions { width: 100%; flex-direction: column; }
  .state-box .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

@media print {
  body { background: white; color: black; font-size: 9px; }
  .skip-link, .main-nav, .topbar__actions, .menu-toggle, .form-status, .chart-tooltip, .footer,
  .modal-backdrop, .proposal-action-box, .details-toggle-label { display: none !important; }
  .topbar { position: static; border-color: #bbb; }
  .topbar__inner { min-height: 46px; }
  .intro { padding: 18px 0 12px; }
  .intro h1 { font-size: 24px; }
  .lead-capture, .workspace { break-inside: avoid; }
  .panel, .summary, .simulation-details, .calculation-details { border-color: #bbb; background: white; color: black; }
  .summary .panel__heading p, .hero-result p, .metric-grid dt, .per-client span { color: #444; }
  .summary .step-label, .hero-result > span { color: #b54812; }
  .metric-grid { border-color: #bbb; }
  .metric-grid div, .per-client div { border-color: #bbb; }
  .details-shell { padding-block: 20px; }
  .simulation-details__content { display: block !important; }
  .table-scroll, .table-scroll--compact, .table-scroll--projection { max-height: none; overflow: visible; }
  th, td { padding: 4px 5px; }
}

/* Lead management page */
.leads-page-body .page-shell, .leads-page-body .topbar__inner { width: min(1760px, calc(100% - 64px)); }
.leads-management { padding: 54px 0 72px; }
.leads-hero, .workspace-heading, .section-heading { display: flex; align-items: end; justify-content: space-between; gap: var(--space-5); }
.leads-hero { padding: 22px 0 36px; }
.leads-hero h1 { margin: 6px 0 8px; font-size: clamp(32px, 5vw, 54px); line-height: 1.02; letter-spacing: -0.055em; }
.leads-hero p { max-width: 580px; margin: 0; color: var(--muted); font-size: 16px; }
.leads-hero__actions { display: flex; gap: var(--space-2); flex-wrap: wrap; justify-content: end; }
.lead-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3); margin-bottom: 36px; }
.lead-kpi { min-height: 150px; display: flex; flex-direction: column; justify-content: space-between; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.lead-kpi--accent { border-color: #f5b995; background: var(--orange-soft); }
.lead-kpi__label, .lead-kpi small { color: var(--muted); font-size: 12px; }
.lead-kpi strong { color: var(--ink); font-size: clamp(26px, 4vw, 36px); line-height: 1; letter-spacing: -0.045em; }
.lead-kpi--accent strong { color: var(--orange-dark); font-size: clamp(20px, 3vw, 30px); }
.leads-dashboard, .leads-workspace { margin-top: 42px; }
.leads-workspace { min-width: 0; overflow: hidden; }
.kanban-board > .state-box--page, .kanban-board > .empty-state { grid-column: 1 / -1; }
.lead-history li > span { overflow-wrap: anywhere; min-width: 0; }
.section-heading, .workspace-heading { margin-bottom: 16px; }
.section-heading h2, .workspace-heading h2 { margin: 3px 0 0; font-size: 22px; letter-spacing: -0.035em; }
.section-heading__note { color: var(--muted); font-size: 12px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); gap: var(--space-3); }
.dashboard-card { min-height: 238px; padding: 22px; }
.dashboard-card__heading { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.dashboard-card__heading strong, .dashboard-card__heading span { display: block; }
.dashboard-card__heading strong { font-size: 14px; }
.dashboard-card__heading span:not(.dashboard-card__mark) { margin-top: 3px; color: var(--muted); font-size: 12px; }
.dashboard-card__mark { color: var(--orange); font-size: 12px; font-weight: 800; }
.funnel-distribution { display: grid; grid-template-columns: minmax(160px, 200px) minmax(0, 1fr); align-items: center; gap: clamp(20px, 3vw, 48px); }
.funnel-chart-wrap { display: grid; justify-items: center; gap: 12px; }
.funnel-chart { width: min(100%, 188px); aspect-ratio: 1; border-radius: 50%; background: var(--surface-soft); box-shadow: 0 0 0 1px var(--line); }
.funnel-chart__total { color: var(--muted); font-size: 12px; font-weight: 700; }
.status-breakdown { display: grid; gap: 14px; }
.status-breakdown__row { display: grid; gap: 5px; width: 100%; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.status-breakdown__row:hover .status-breakdown__label { color: var(--orange-dark); }
.status-breakdown__label { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.status-breakdown__label strong { color: var(--ink); }
.status-breakdown__track { height: 7px; overflow: hidden; border-radius: 999px; background: var(--surface-soft); }
.status-breakdown__fill { display: block; height: 100%; border-radius: inherit; min-width: 0; transition: width 220ms ease; }
.status-breakdown__fill--blue { background: #5488c7; } .status-breakdown__fill--orange { background: var(--orange); } .status-breakdown__fill--violet { background: #896bc6; } .status-breakdown__fill--green { background: var(--success); } .status-breakdown__fill--gray { background: #9a938b; }
.dashboard-insights { display: grid; gap: 0; }
.insight-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.insight-row:first-child { border-top: 0; padding-top: 0; }
.insight-row strong { max-width: 180px; overflow: hidden; color: var(--ink); font-size: 15px; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.insight-row--button { width: 100%; border-inline: 0; border-bottom: 0; background: transparent; color: var(--muted); text-align: left; cursor: pointer; }
.insight-row--button:hover { color: var(--orange-dark); }
.leads-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-3); padding: 12px; margin-bottom: 16px; }
.leads-toolbar { position: sticky; top: 12px; z-index: 4; }
.lead-bulk-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 10px 12px; margin-bottom: 12px; border-color: #f5b995; background: var(--orange-soft); }
.lead-bulk-actions strong { margin-right: auto; font-size: 12px; }
.lead-select { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.lead-select input { width: 16px; height: 16px; accent-color: var(--orange); }
.toolbar-search { min-width: 260px; display: flex; align-items: center; flex: 1; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--muted); }
.toolbar-search input { width: 100%; min-height: 42px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; }
.toolbar-filter { display: grid; gap: 2px; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.toolbar-filter select, .lead-status-select { min-height: 38px; padding: 0 28px 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font-size: 12px; }
.toolbar-count { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.toolbar-clear { align-self: end; }
.view-switcher { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-soft); }
.view-switcher__button { min-height: 34px; padding: 0 14px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; }
.view-switcher__button.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(24,23,22,.08); }
.kanban-board { display: grid; grid-template-columns: repeat(5, minmax(260px, 1fr)); gap: 16px; align-items: stretch; min-width: 0; overflow-x: auto; overflow-y: hidden; padding-bottom: 8px; overscroll-behavior-inline: contain; }
.kanban-column { height: clamp(560px, calc(100dvh - 128px), 900px); min-width: 0; display: flex; flex-direction: column; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(239,237,233,.55); transition: background-color 140ms ease, border-color 140ms ease; }
.kanban-column.is-drag-over { border-color: var(--orange); background: var(--orange-soft); }
.kanban-column__heading { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.kanban-column__heading > div { display: flex; align-items: center; gap: 7px; }
.kanban-column__heading h3 { margin: 0; font-size: 13px; letter-spacing: -.01em; }
.kanban-column__count { min-width: 24px; padding: 2px 6px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 11px; text-align: center; }
.kanban-column__body { display: flex; flex: 1 1 auto; flex-direction: column; gap: 10px; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 2px 3px 6px 1px; contain: layout paint; overscroll-behavior-y: contain; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.kanban-empty { display: grid; min-height: 94px; place-items: center; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); color: var(--muted); font-size: 11px; text-align: center; }
.lead-card { flex: 0 0 auto; min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: 0 3px 12px rgba(24,23,22,.04); cursor: pointer; }
.lead-card:active { cursor: grab; }
.lead-card.is-dragging { opacity: .45; }
.lead-card__top, .lead-card__footer, .lead-card__actions { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.lead-card__top time, .lead-card__footer { color: var(--muted); font-size: 10px; }
.lead-card h3 { margin: 11px 0 1px; overflow: hidden; font-size: 14px; letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap; }
.lead-open-button { max-width: 100%; overflow: hidden; padding: 0; border: 0; background: transparent; color: var(--ink); font: inherit; font-weight: 700; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.lead-open-button:hover { color: var(--orange-dark); text-decoration: underline; }
.lead-open-button:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; border-radius: 2px; }
.lead-card__company, .lead-card__contact { margin: 0; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.lead-card__contact { margin-top: 6px; color: var(--ink-soft); }
.lead-card__footer { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.lead-card__seller { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-card__tags { display: flex; flex-wrap: wrap; gap: 4px; min-height: 17px; margin-top: 9px; }
.lead-tag { padding: 2px 6px; border-radius: 999px; background: var(--surface-soft); color: var(--muted); font-size: 9px; }
.lead-card__actions { display: flex; flex-direction: column; align-items: stretch; gap: 7px; margin-top: 12px; }
.lead-card__potential { color: var(--orange-dark); font-size: 12px; font-weight: 800; }
.lead-card .lead-status-select { width: 100%; max-width: 100%; min-height: 30px; font-size: 10px; }
.status-pill { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: 999px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.status-pill--blue { background: #edf4ff; color: #376aab; } .status-pill--orange { background: var(--orange-soft); color: var(--orange-dark); } .status-pill--violet { background: #f1ecff; color: #674da1; } .status-pill--green { background: var(--success-soft); color: var(--success); } .status-pill--gray { background: var(--surface-soft); color: var(--muted); }
.status-dot { width: 8px; height: 8px; flex: 0 0 auto; display: inline-block; border-radius: 50%; background: var(--line-strong); }
.status-dot--blue { background: #5488c7; } .status-dot--orange { background: var(--orange); } .status-dot--violet { background: #896bc6; } .status-dot--green { background: var(--success); } .status-dot--gray { background: #9a938b; }
.lead-delete-link { align-self: flex-end; padding: 0; border: 0; background: transparent; color: var(--danger); font-size: 10px; cursor: pointer; }
.list-view { overflow: hidden; padding: 0; }
.list-view .table-scroll { max-height: clamp(560px, calc(100dvh - 128px), 900px); overflow: auto; overscroll-behavior: contain; }
.lead-pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; color: var(--muted); font-size: 12px; }
.lead-pagination .button { min-height: 34px; padding: 0 12px; }
.lead-pagination .button:disabled { cursor: not-allowed; opacity: .45; }
.leads-table { min-width: 920px; }
.leads-table th { text-align: left; }
.leads-table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); }
.leads-table td { vertical-align: middle; text-align: left; }
.leads-table td:first-child { min-width: 170px; }
.leads-table td strong, .leads-table td small { display: block; }
.leads-table td small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.leads-table .lead-status-select { margin-right: 6px; }
.page-feedback { margin: 0 0 14px; padding: 11px 14px; border-radius: var(--radius-sm); font-size: 12px; }
.page-feedback--success { background: var(--success-soft); color: var(--success); }
.page-feedback--error { background: var(--danger-soft); color: var(--danger); }
.page-feedback--info { background: var(--orange-soft); color: var(--orange-dark); }
.leads-loading .leads-toolbar, .leads-loading .lead-pagination { cursor: progress; }
.leads-loading .leads-toolbar select, .leads-loading .leads-toolbar input { opacity: .7; }
.empty-state, .state-box--page { min-height: 280px; display: grid; place-items: center; align-content: center; gap: 8px; padding: 36px; color: var(--muted); text-align: center; }
.empty-state strong, .state-box--page strong { color: var(--ink); font-size: 16px; }
.empty-state .button, .state-box--page .button { margin-top: 10px; }
.auth-loading { color: var(--muted); font-size: 12px; }
.lead-detail-card { width: min(760px, 100%); }
.lead-detail-card .modal-header { padding-block: 14px; }
.lead-detail-card .modal-header h2 { margin-top: 2px; }
.lead-detail-body { max-height: min(72dvh, 760px); }
.lead-detail-intro { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.detail-status-control { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.detail-status-control select { min-height: 30px; }
.lead-contact-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.modal-error { display: grid; gap: 10px; }
.lead-detail-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.lead-detail-section h3 { margin: 0 0 14px; font-size: 16px; letter-spacing: -.02em; }
.lead-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
.lead-detail-field { min-width: 0; display: grid; align-content: start; gap: 3px; }
.lead-detail-field span, .lead-detail-label { color: var(--muted); font-size: 11px; }
.lead-detail-field strong { overflow-wrap: anywhere; font-size: 13px; font-weight: 650; }
.lead-detail-label { margin-top: 14px; margin-bottom: 6px; }
.lead-detail-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.lead-detail-tags .lead-tag { padding: 4px 8px; font-size: 11px; }
.lead-detail-tag-options { display: flex; flex-wrap: wrap; gap: 8px; }
.lead-detail-tag-options label { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); cursor: pointer; font-size: 12px; }
.lead-detail-tag-options label:has(input:checked) { border-color: var(--orange); background: var(--orange-soft); color: var(--orange-dark); }
.lead-detail-tag-options input { accent-color: var(--orange); }
.lead-detail-empty { color: var(--muted); font-size: 12px; }
.lead-detail-notes { margin: 0; padding: 14px; border-radius: var(--radius-sm); background: var(--surface-soft); font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.lead-detail-highlight { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 18px; padding: 15px; border: 1px solid #f5b995; border-radius: var(--radius-sm); background: var(--orange-soft); font-size: 12px; }
.lead-detail-highlight strong { color: var(--orange-dark); font-size: 20px; }
.next-action-form { display: grid; grid-template-columns: minmax(0, 1fr) 145px auto; gap: 8px; }
.next-action-form input { min-width: 0; }
.detail-owner-control { display: flex; flex-wrap: wrap; gap: 8px; }
.detail-owner-control select { min-width: 220px; }
.lead-history li.is-complete { opacity: .6; }
.lead-history { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.lead-history li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.lead-history li small { color: var(--muted); font-size: 10px; }
.tag-management-card { width: min(560px, 100%); }
.tag-management-form { display: flex; gap: 8px; }
.tag-management-form input { flex: 1; min-width: 0; }
.tag-management-list { display: grid; gap: 8px; margin-top: 20px; }
.tag-management-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.tag-management-item .lead-tag { padding: 5px 9px; font-size: 12px; }

@media (max-width: 980px) {
  .leads-page-body .page-shell, .leads-page-body .topbar__inner { width: calc(100% - 32px); }
  .lead-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .kanban-board { grid-template-columns: repeat(5, minmax(250px, 1fr)); }
}

@media (max-width: 640px) {
  .tag-management-form { display: grid; }
  .leads-page-body .logout-btn { display: block; }
  .leads-page-body .auth-user-pill { gap: 4px; padding: 0 4px 0 8px; max-width: 145px; }
  .leads-page-body .auth-user-pill__name { max-width: 72px; }
  .detail-owner-control select { min-width: 0; width: 100%; }
  .detail-owner-control .button { width: 100%; }
  .lead-history li { grid-template-columns: minmax(0, 1fr) auto; }
  .leads-page-body .page-shell, .leads-page-body .topbar__inner { width: calc(100% - 24px); }
  .leads-management { padding-top: 28px; }
  .leads-hero, .workspace-heading, .section-heading { align-items: start; flex-direction: column; }
  .leads-hero { gap: 20px; padding-bottom: 28px; }
  .leads-hero__actions { width: 100%; justify-content: stretch; }
  .leads-hero__actions .button { flex: 1; padding-inline: 10px; }
  .lead-kpis { gap: 8px; margin-bottom: 28px; }
  .lead-kpi { min-height: 124px; padding: 14px; }
  .lead-kpi strong { font-size: 26px; }
  .leads-toolbar { align-items: stretch; flex-wrap: wrap; }
  .toolbar-search { min-width: 100%; }
  .toolbar-filter { flex: 1; }
  .toolbar-filter select { width: 100%; }
  .toolbar-count { width: 100%; margin-left: 0; }
  .toolbar-clear { flex: 1; }
  .view-switcher { width: 100%; }
  .view-switcher__button { flex: 1; }
  .kanban-board { grid-template-columns: repeat(5, minmax(270px, 1fr)); gap: 12px; margin-right: -12px; }
  .lead-detail-grid { grid-template-columns: 1fr; }
  .next-action-form { grid-template-columns: 1fr; }
  .dashboard-card { padding: 17px; }
  .funnel-distribution { grid-template-columns: 1fr; gap: 24px; }
}
