/* =========================================================================
 * WEBSITEPLAN1 WS-7 — v7 Design Tokens (2026-05-13)
 * Canonical scales for type, spacing, radius, shadow per PRODUCT_PLAN §5.12.
 * NEW code uses these tokens. Existing styles continue to work via the
 * preserved --bg/--text/--accent legacy names below.
 * ========================================================================= */
:root {
  /* Type scale (modular ~1.2 ratio, base 14px) */
  --fs-xs:   11px;
  --fs-sm:   12.5px;
  --fs-base: 14px;
  --fs-md:   16px;
  --fs-lg:   18px;
  --fs-xl:   22px;
  --fs-2xl:  28px;
  --fs-3xl:  34px;

  --lh-tight: 1.2;
  --lh-snug:  1.4;
  --lh-base:  1.55;
  --lh-loose: 1.7;

  --fw-regular: 400;
  --fw-medium:  500;
  --fw-semi:    600;
  --fw-bold:    700;

  /* Spacing scale (4px base grid) */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;

  /* Radius scale */
  --r-sm:   4px;
  --r-md:   8px;
  --r-lg:   12px;
  --r-xl:   16px;
  --r-pill: 9999px;

  /* Shadow elevation */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 6px 14px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12), 0 4px 8px rgba(15, 23, 42, 0.06);

  /* Focus ring — single canonical style for a11y */
  --focus-ring: 0 0 0 3px rgba(15, 76, 129, 0.35);

  /* Transition speeds */
  --tr-fast: 120ms ease;
  --tr-base: 180ms ease;
  --tr-slow: 280ms ease;

  /* Legacy color tokens (pervasive in existing styles — preserved) */
  --bg: #eef2f7;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --text: #132238;
  --heading: #1e3a5f;
  --muted: #63748a;
  --line: #d6dfeb;
  --accent: #0f4c81;
  --accent-soft: #dce9f7;
  --signal: #d1495b;
  --warning: #d97706;
  --success: #1f8a70;
  --bg-alt: #f1f5f9;
  --input-bg: #f9fbfe;
  --warning-soft: #fffbeb;
  --warning-text: #92400e;
  --warning-border: #fde68a;
  --accent-alt: #8b5cf6;
  --border: #d6dfeb;
  --surface-alt: #f0fdf4;
  --danger: #ef4444;
  --shadow: 0 20px 60px rgba(15, 38, 64, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

/* Skip to main content link (accessibility) */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 99999;
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0;
}

/* Focus-visible ring for keyboard accessibility */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Subtle page content entrance animation */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-shell,
.page-wrap {
  animation: fadeInUp 0.35s ease-out;
}

/* Utility: animate dynamically inserted content */
.animate-in {
  animation: fadeInUp 0.3s ease-out;
}

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

body {
  margin: 0;
  color: var(--text);
  font-family: "Segoe UI Variable", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(15, 76, 129, 0.16), transparent 30%),
    radial-gradient(circle at top right, rgba(209, 73, 91, 0.12), transparent 26%),
    linear-gradient(180deg, #f5f8fb, #e9eef5 55%, #edf2f8);
}

button,
input,
select {
  font: inherit;
}

.page-shell {
  max-width: 1680px;
  margin: 0 auto;
  padding: 28px 24px 36px;
  overflow-x: hidden;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  padding: 28px 30px;
  margin-bottom: 20px;
  border: 1px solid rgba(214, 223, 235, 0.95);
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(241, 246, 252, 0.92));
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 700;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.05;
}

.auth-badge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(15, 76, 129, 0.08);
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
}

.subtitle,
.disclaimer {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--muted);
}

.disclaimer {
  color: var(--signal, #8a3c42);
  font-weight: 600;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 260px;
}

.hero-actions > button {
  width: 100%;
}

.hero-hint {
  max-width: 260px;
  margin: 0;
}

.split-field {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(110px, 0.65fr);
  gap: 10px;
}

.primary-btn,
.secondary-btn,
.icon-btn {
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.primary-btn {
  padding: 14px 18px;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(135deg, #0f4c81, #1363a2);
  box-shadow: 0 12px 24px rgba(15, 76, 129, 0.2);
}

.secondary-btn,
.icon-btn {
  padding: 10px 14px;
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-soft);
}

button:hover {
  transform: translateY(-1px);
}

.primary-btn:hover {
  background: linear-gradient(135deg, #0d4070, #105490);
  box-shadow: 0 14px 28px rgba(15, 76, 129, 0.28);
}

.secondary-btn:hover,
.icon-btn:hover {
  background: var(--line);
  color: var(--text);
}

button:disabled {
  cursor: not-allowed;
  transform: none;
  opacity: 0.45;
  background: var(--line, #dde1e8);
  color: var(--muted, #94a3b8);
  box-shadow: none;
  pointer-events: none;
}

button:disabled::after {
  content: none;
}

.primary-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--accent);
}

.secondary-btn:focus-visible,
.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Noscript fallback banner */
.noscript-banner {
  background: #fff3cd;
  color: #856404;
  padding: 12px 20px;
  text-align: center;
  font-size: 14px;
}

.dark .noscript-banner {
  background: #4a3f00;
  color: #ffd54f;
}

.layout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}

.left-panel,
.right-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.panel-card,
.branch-card,
.pump-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.panel-card {
  padding: 20px;
  min-width: 0;
}

.branch-card,
.pump-card {
  padding: 18px;
}

.card-heading,
.branch-header,
.pump-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.pump-header {
  align-items: flex-end;
  flex-wrap: wrap;
}

.card-heading h2,
.branch-title {
  margin: 0;
  font-size: 1.05rem;
}
.card-heading-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.btn-icon-sm {
  padding: 4px 10px;
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface, #f1f5f9);
  color: var(--fg);
  cursor: pointer;
  transition: background 0.15s;
  font-weight: 500;
}
.btn-icon-sm:hover {
  background: var(--accent-soft, #dbeafe);
}
html.dark .btn-icon-sm {
  background: rgba(20, 28, 40, 0.5);
}
html.dark .btn-icon-sm:hover {
  background: rgba(59, 130, 246, 0.2);
}

.visually-hidden {
  display: none;
}

.field-grid {
  display: grid;
  gap: 14px;
}

.two-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three-up {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.four-up {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.compact-grid {
  gap: 12px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  position: relative;
}

label span {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
}

.label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.info-btn {
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(89, 137, 181, 0.22);
  background: rgba(172, 205, 236, 0.28);
  color: #4a7a9e;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.info-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  width: min(320px, 92vw);
  padding: 12px 14px;
  border: 1px solid rgba(15, 76, 129, 0.18);
  border-radius: 14px;
  background: var(--panel-strong, #ffffff);
  box-shadow: 0 18px 40px rgba(15, 38, 64, 0.12);
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.45;
}

input,
select {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--input-bg, #f9fbfe);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:hover,
select:hover {
  border-color: var(--muted);
}

input:focus,
select:focus {
  outline: 2px solid rgba(15, 76, 129, 0.35);
  border-color: var(--accent, #0f4c81);
  box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.08);
}

.check-wrap {
  justify-content: end;
}

.check-wrap input {
  width: 22px;
  height: 22px;
  padding: 0;
}

.inline-actions,
.legend-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.pump-toolbar {
  margin-bottom: 12px;
}

.pump-meta-grid {
  flex: 1 1 420px;
}

.pump-support-grid {
  margin-bottom: 12px;
  align-items: end;
}

.pump-support-note {
  display: flex;
  align-items: center;
  min-height: 100%;
  padding: 0 6px 8px 0;
}

.helper-text {
  color: var(--muted);
  font-size: 0.88rem;
}

.section-note,
.branch-note,
.fitting-note {
  margin: 0 0 12px;
}

.scenario-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.scenario-panel-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.scenario-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--input-bg, #f9fbfe);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.scenario-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(15, 76, 129, 0.08);
}

html.dark .scenario-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.scenario-card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 10px;
}

.scenario-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.scenario-toggle {
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.stack-list,
.results-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.branch-grid {
  margin-bottom: 12px;
}

.suggested-lock {
  background: var(--bg-alt, #edf2f8);
  color: var(--muted, #506174);
}

.fitting-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fitting-empty-state[hidden] {
  display: none;
}

.fitting-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--input-bg, #fbfdff);
}

.fitting-row-top,
.fitting-row-bottom {
  display: grid;
  gap: 12px;
}

.fitting-row-top {
  grid-template-columns: minmax(220px, 2fr) minmax(92px, 0.8fr) minmax(110px, 0.9fr) auto;
  align-items: end;
}

.fitting-row-bottom {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 12px;
  align-items: end;
}

.fitting-field {
  gap: 6px;
}

.fitting-field-wide {
  min-width: 0;
}

.fitting-k-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-alt, #f2f6fb);
}

.fitting-k-box span {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.fitting-k-box strong {
  margin-top: 2px;
  font-size: 1rem;
  color: var(--text);
}

.check-wrap-inline {
  justify-content: end;
}

.check-wrap-inline input {
  width: 22px;
  height: 22px;
  padding: 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
  background: var(--input-bg, #fbfdff);
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line, #e4ebf4);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--bg-alt, #f2f6fb);
}

.data-table td input,
.data-table td select {
  min-width: 72px;
}

.data-table tbody tr:hover td {
  background: rgba(15, 76, 129, 0.03);
}

.curve-table th:last-child,
.curve-table td:last-child {
  position: sticky;
  right: 0;
  background: var(--input-bg, #fbfdff);
}

.curve-table th:last-child {
  background: var(--bg-alt, #f2f6fb);
}

.center-cell {
  text-align: center;
}

.chart-card {
  padding-bottom: 10px;
}

.curve-tab-btn {
  position: fixed;
  right: 24px;
  bottom: 22px;
  z-index: 45;
  padding: 12px 16px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(135deg, #0f4c81, #1363a2);
  box-shadow: 0 16px 30px rgba(15, 76, 129, 0.24);
}

.curve-tab-btn.hidden {
  display: none;
}

.curve-drawer {
  position: fixed;
  /* Nearly fullscreen by default — user said the drawer was smaller
     than the window which was flattening the chart. Anchor to all
     four sides with small margins and let width/height fill.
     TOP is 78px (was 16px) so the drawer sits below the sticky
     site-nav (main-nav is sticky at top:0, z-index:1000, ~62px tall
     on desktop; drawer z-index is only 50 so it would be clipped
     by the nav if they overlapped — or worse, cover it). */
  right: 16px;
  bottom: 16px;
  top: 78px;
  left: 16px;
  z-index: 50;
  /* width/height implied by the four-side anchors above; keep the
     old sizing rules as fallbacks for browsers that parse bottom+top
     awkwardly in combination with fixed positioning. */
  width: auto;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 94px);
  display: flex;
  flex-direction: column;
  /* Safety net: scroll if the viewport is vertically tiny. */
  overflow: auto;
  padding: 14px 16px;
  border: 1px solid rgba(214, 223, 235, 0.95);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 30px 70px rgba(15, 38, 64, 0.2);
  backdrop-filter: blur(12px);
  transform: translateY(calc(100% + 32px));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

/* Chart scales with the drawer.
   - flex: 1 1 0 so it absorbs remaining space after header / toolbar /
     legend / export row take their natural sizes.
   - min-height: 200 keeps it readable on short viewports.
   - height: use a clamped calc so Plotly has a concrete pixel target
     (Plotly needs a fixed height; auto collapses to 0). Scales with
     viewport height, capped below the .chart-h560 original 560.
   - important beats the .chart-h560 { height: 560px } class on the
     same element. */
.curve-drawer #curve-chart {
  flex: 1 1 0;
  width: 100% !important;
  /* Chart absorbs all remaining drawer height. Reserved-chrome
     estimate ~170px for drawer-internal elements PLUS 78px for the
     site-nav clearance above the drawer → 248px total. No upper
     cap — bigger viewport = bigger chart. */
  height: calc(100vh - 248px) !important;
  min-height: 260px;
}

/* Header / toolbar / legend / buttons take their natural size and
   never shrink so the chart is the sole flex absorber. */
.curve-drawer-header,
.curve-drawer #chart-toolbar,
.curve-drawer #chart-legend,
.curve-drawer #chart-caption,
.curve-drawer #operating-point-summary,
.curve-drawer #curve-export-actions {
  flex: 0 0 auto;
}

.curve-drawer.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Maximized: full-bleed except STILL clearing the sticky site-nav at
   the top. Previously 0 on all sides hid the minimize button behind
   the header. */
.curve-drawer.maximized {
  right: 0;
  bottom: 0;
  top: 62px;
  left: 0;
  max-width: 100vw;
  max-height: calc(100vh - 62px);
  border-radius: 0;
}

.curve-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  /* Tightened 12px → 4px to reclaim vertical space for the chart. */
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.curve-drawer-header h2 {
  margin: 0;
  /* 1.2rem → 1.02rem — still reads as a header, shorter vertically. */
  font-size: 1.02rem;
  line-height: 1.25;
}

/* The eyebrow over the title adds ~16px; shrink + tighten so the
   whole title block is ~one line tall instead of two. */
.curve-drawer-header .eyebrow {
  margin: 0 0 1px;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
}

/* Helper text below the header ("Compute a scenario...") loses its
   default block-margin inside the drawer so it doesn't add a visible
   gap above the toolbar. */
.curve-drawer #chart-caption {
  margin: 0 0 4px;
  font-size: 0.78rem;
}

/* Slim the action buttons in the drawer header (PNG / Export Curves /
   Maximize / Minimize) — their default secondary-btn padding makes
   the whole header ~44px tall; trimmed to ~30px. */
.curve-drawer-header .inline-actions .toolbar-btn,
.curve-drawer-header .inline-actions .secondary-btn,
.curve-drawer-header .inline-actions .icon-only-btn {
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1.2;
}
.curve-drawer-header .inline-actions .icon-only-btn {
  padding: 4px 8px;
  min-width: 32px;
}

/* Operating-point summary sits between the chart and the export-
   actions row. Default helper-text has a comfortable margin; tighten
   so the chart has more breathing room above the footer. */
.curve-drawer #operating-point-summary {
  margin: 4px 0 0;
  font-size: 0.78rem;
  line-height: 1.35;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(540px, 100%);
  padding: 28px;
  border: 1px solid rgba(214, 223, 235, 0.95);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin: 0;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
}

.auth-form button {
  margin-top: 8px;
}

.pw-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--muted, #94a3b8);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

.pw-toggle:hover {
  color: var(--text, #334155);
  transform: translateY(-50%);
}

.auth-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.auth-message {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(209, 73, 91, 0.16);
  background: rgba(209, 73, 91, 0.08);
  color: var(--auth-error-text, #8a3c42);
  font-size: 0.92rem;
}

.auth-switch {
  margin-top: 16px;
}

.auth-switch a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-forgot-link {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  text-decoration: none;
  transition: color 0.15s;
}

.auth-forgot-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.auth-features {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(214, 223, 235, 0.7);
}

.auth-features-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 8px;
}

.auth-features-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
@media (max-width: 420px) {
  .auth-features-list { grid-template-columns: 1fr; }
}

.auth-features-list li {
  font-size: 12px;
  color: var(--muted, #475569);
  padding-left: 16px;
  position: relative;
}

.auth-features-list li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 700;
  font-size: 11px;
}

/* Auth dark mode */
html.dark .auth-card {
  background: rgba(30, 40, 60, 0.95);
  border-color: var(--line);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

html.dark .auth-card h1 {
  color: var(--text);
}

html.dark .auth-card .subtitle {
  color: var(--muted);
}

html.dark .auth-card .eyebrow {
  color: var(--accent);
}

html.dark .auth-message {
  background: rgba(209, 73, 91, 0.15);
  border-color: rgba(209, 73, 91, 0.25);
  color: #f5a0a8;
}

html.dark .auth-features {
  border-top-color: var(--line);
}

html.dark .auth-features-title {
  color: var(--muted);
}

html.dark .auth-features-list li {
  color: var(--muted);
}

html.dark .auth-tier-note {
  color: var(--muted);
}

#curve-chart {
  width: 100%;
  height: auto;
  min-height: 360px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(248, 251, 255, 0.98), rgba(240, 246, 252, 0.96)),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 76px,
      rgba(15, 76, 129, 0.04) 76px,
      rgba(15, 76, 129, 0.04) 77px
    );
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--bg-alt, #f2f6fb);
  color: var(--muted);
  font-size: 0.84rem;
}

.legend-line {
  display: inline-flex;
  align-items: center;
  width: 36px;
  height: 12px;
  flex: 0 0 36px;
}

.legend-line svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.legend-chip strong {
  display: block;
  color: var(--text);
  font-size: 0.83rem;
}

.legend-chip small {
  display: block;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.stat-tile,
.result-item {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--input-bg, #f9fbfe);
  animation: tileAppear 0.4s ease-out both;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.stat-tile:hover,
.result-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(15, 76, 129, 0.08);
}

html.dark .stat-tile:hover,
html.dark .result-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.stat-tile:nth-child(1) { animation-delay: 0s; }
.stat-tile:nth-child(2) { animation-delay: 0.05s; }
.stat-tile:nth-child(3) { animation-delay: 0.1s; }
.stat-tile:nth-child(4) { animation-delay: 0.15s; }
.stat-tile:nth-child(5) { animation-delay: 0.2s; }
.stat-tile:nth-child(6) { animation-delay: 0.25s; }
.stat-tile:nth-child(7) { animation-delay: 0.3s; }
.stat-tile:nth-child(8) { animation-delay: 0.35s; }
.stat-tile:nth-child(9) { animation-delay: 0.4s; }

@keyframes tileAppear {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.stat-tile strong,
.result-item strong {
  display: block;
  margin-top: 6px;
  font-size: 1.18rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.stat-tile .label,
.result-item .label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

html.dark .stat-tile,
html.dark .result-item {
  background: rgba(25, 32, 42, 0.6);
}

.summary-box {
  min-height: 240px;
  margin: 0;
  padding: 16px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--input-bg, #f7fafd);
  color: var(--text);
  font-family: "Cascadia Code", "Consolas", monospace;
}
.summary-box.summary-styled {
  white-space: normal;
  font-family: inherit;
  padding: 0;
  background: transparent;
  border: none;
  min-height: auto;
}
.sum-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.sum-section {
  background: var(--input-bg, #f7fafd);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}
.sum-heading {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--accent-soft, rgba(15,76,129,0.1));
}
.sum-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.sum-table tr { border-bottom: 1px solid var(--line-soft, rgba(0,0,0,0.04)); }
.sum-table tr:last-child { border-bottom: none; }
.sum-label { color: var(--muted); padding: 5px 8px 5px 0; white-space: nowrap; }
.sum-value { font-weight: 600; text-align: right; padding: 5px 0; }
.sum-branch-header td {
  padding: 8px 0 4px;
  color: var(--heading, var(--text));
  font-size: 0.8rem;
  border-bottom: none;
}
.sum-note { color: var(--muted); font-size: 0.82rem; font-style: italic; margin: 4px 0 0; }
html.dark .sum-section { background: rgba(30,40,55,0.5); }
html.dark .sum-branch-header td { color: var(--heading, #c8d1dc); }

.bottom-actions-card .inline-actions {
  justify-content: space-between;
}

@media (max-width: 1280px) {
  .hero {
    flex-direction: column;
  }

  /* Keep the action strip from stretching the full viewport width —
     it looks busy when it does. Cap to a readable row and right-align
     to match the original >1280px layout (title left, actions right). */
  .hero-actions {
    width: auto;
    max-width: 760px;
    flex-direction: row;
    flex-wrap: wrap;
    min-width: 0;
    align-self: flex-end;
    justify-content: flex-end;
    gap: 10px;
  }

  .hero-actions > button {
    width: auto;
  }

  .hero-actions-primary {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }

  .hero-actions-group {
    gap: 6px;
  }

  .hero-hint {
    max-width: none;
    flex: 1 1 100%;
    text-align: right;
  }
}

@media (max-width: 900px) {
  .two-up,
  .three-up,
  .four-up {
    grid-template-columns: 1fr;
  }

  .pump-header {
    align-items: stretch;
  }

  .page-shell {
    padding: 18px 14px 28px;
  }

  .fitting-row-top,
  .fitting-row-bottom {
    grid-template-columns: 1fr;
  }

  .curve-tab-btn,
  .curve-drawer {
    right: 12px;
    left: 12px;
    width: auto;
  }

  .curve-drawer.maximized {
    right: 12px;
    left: 12px;
    bottom: 12px;
    width: auto;
    max-height: calc(100vh - 24px);
  }

  .panel-card,
  .branch-card,
  .pump-card,
  .hero {
    border-radius: 18px;
  }

  .main-nav {
    flex-wrap: wrap;
  }

  .nav-tabs {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }

  .nav-user {
    order: 2;
  }
}

/* ============================================================
   NAVIGATION BAR
   ============================================================ */

.main-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 24px;
  background: linear-gradient(135deg, rgba(255,255,255,0.97), rgba(241,246,252,0.95));
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(12px);
}

.nav-brand a {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  transition: opacity 0.15s;
}

.nav-brand a:hover {
  opacity: 0.8;
}

.nav-brand a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  font-size: 13px;
}

.nav-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--accent);
}

.nav-tabs {
  display: flex;
  gap: 2px;
  flex: 1;
  justify-content: center;
}

.nav-tab {
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-tab:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-tab.active {
  background: var(--accent);
  color: white;
}

.nav-tab.nav-locked {
  opacity: 0.7;
  cursor: pointer;
}

.nav-badge {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  text-transform: uppercase;
}

.nav-tab.active .nav-badge {
  background: rgba(255,255,255,0.3);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.nav-user-email {
  color: var(--muted);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-tier-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
}

.tier-pro { background: #0f4c81; color: white; }
.tier-enterprise { background: #6b21a8; color: white; }
.tier-free { background: var(--line); color: var(--muted); }

.nav-logout-form { display: inline; }

.nav-logout-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.nav-logout-btn:hover {
  border-color: var(--signal);
  color: var(--signal);
}

/* ============================================================
   UPGRADE BANNER (on headloss calculator for free tier)
   ============================================================ */

.upgrade-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--accent-soft);
  font-size: 13px;
  color: var(--accent);
  margin-top: 10px;
}

.upgrade-link {
  font-weight: 600;
  color: var(--accent);
  text-decoration: underline;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.upgrade-link:hover {
  opacity: 0.75;
}

/* ============================================================
   ACCOUNT PAGE
   ============================================================ */

.compact-hero {
  padding: 20px 30px;
}

.account-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 0 0 40px;
}

.account-section h2 {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 700;
}

.subscription-status {
  margin-bottom: 16px;
}

.tier-display {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tier-label {
  font-size: 24px;
  font-weight: 800;
}

.tier-pro-label { color: var(--accent); }
.tier-free-label { color: var(--muted); }

.tier-status {
  font-size: 13px;
  color: var(--muted);
}

.usage-info {
  margin-top: 12px;
}

.usage-bar-container {
  height: 8px;
  border-radius: 4px;
  background: var(--line);
  overflow: hidden;
}

.usage-bar {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.usage-text {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.upgrade-cta {
  padding: 20px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-soft), rgba(15,76,129,0.08));
  margin-top: 12px;
}

.upgrade-cta h3 {
  margin: 0 0 12px;
  font-size: 18px;
  color: var(--accent);
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}

.feature-list li {
  padding: 4px 0;
  font-size: 13px;
  color: var(--text);
}

.feature-list li::before {
  content: "\2713 ";
  color: var(--success);
  font-weight: 700;
  margin-right: 6px;
}

.trial-note {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}

.highlight-pulse {
  animation: highlightPulse 0.6s ease-out 2;
}

@keyframes highlightPulse {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50% { box-shadow: 0 0 0 4px var(--accent-soft, rgba(15,76,129,0.2)); }
}

.enterprise-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* Enterprise contact form */
.enterprise-features {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
}
.enterprise-features li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.94rem;
}
.enterprise-features li:last-child {
  border-bottom: none;
}
.enterprise-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.enterprise-form label {
  display: block;
}
.enterprise-form label span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}
.enterprise-form input,
.enterprise-form select,
.enterprise-form textarea {
  width: 100%;
  font-family: inherit;
  resize: vertical;
}
.enterprise-form .primary-btn {
  width: 100%;
  margin-top: 6px;
}

.saved-calcs-list,
.quote-history {
  min-height: 60px;
}

.saved-calc-row,
.quote-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  gap: 12px;
  transition: background 0.15s;
}

.saved-calc-row:hover,
.quote-row:hover {
  background: var(--bg-alt, rgba(0, 0, 0, 0.02));
}
.saved-calc-row:last-child,
.quote-row:last-child {
  border-bottom: none;
}
.saved-calc-info,
.quote-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.saved-calc-date {
  font-size: 12px;
  color: var(--muted);
}
.saved-calc-actions {
  display: flex;
  gap: 6px;
}
.small-btn {
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
}
.small-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.danger-btn:hover {
  background: var(--signal);
  border-color: var(--signal);
}
.quote-status {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: capitalize;
  font-weight: 600;
}
.status-pending {
  background: #fff3cd;
  color: #856404;
}
.status-success {
  background: #d4edda;
  color: #155724;
}
.status-default {
  background: #e2e3e5;
  color: #383d41;
}

html.dark .status-pending { background: rgba(146, 64, 14, 0.3); color: #fcd34d; }
html.dark .status-success { background: rgba(22, 101, 52, 0.3); color: #86efac; }
html.dark .status-default { background: rgba(100, 120, 150, 0.2); color: #94a3b8; }

.empty-state {
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
}

@media (max-width: 900px) {
  .account-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .saved-calc-row,
  .quote-row {
    flex-wrap: wrap;
    gap: 8px;
  }
  .saved-calc-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ============================================================
   PUMP SELECTOR PAGE
   ============================================================ */

.pump-selector-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 20px;
  padding: 0 0 40px;
}

.pump-selector-grid.blurred,
.ww-layout.blurred,
.fa-layout.blurred,
.matching-layout.blurred,
.catalog-layout.blurred,
.chat-layout.blurred {
  filter: blur(4px);
  pointer-events: none;
  user-select: none;
}

.locked-overlay {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 40px 20px;
  margin: -20px 0 0;
}

.locked-content {
  background: var(--panel-strong);
  border: 2px solid var(--accent);
  border-radius: 16px;
  padding: 32px;
  max-width: 420px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}

.locked-content h2 {
  color: var(--accent);
  margin: 0 0 8px;
}

.locked-content p {
  margin: 0 0 16px;
  color: var(--muted);
}

.locked-features {
  text-align: left;
  max-width: 340px;
  margin: 0 auto 16px;
}

.locked-features ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.locked-features li {
  font-size: 13px;
  color: var(--muted);
  padding: 4px 0 4px 20px;
  position: relative;
}

.locked-features li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 700;
  font-size: 12px;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--accent);
}

/* Result cards */
.ps-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ps-result-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  transition: border-color 0.15s;
}

.ps-result-card:hover {
  border-color: var(--accent);
}

.ps-result-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.ps-rank {
  font-size: 14px;
  font-weight: 800;
  color: var(--accent);
  min-width: 28px;
}

.ps-result-title {
  flex: 1;
}

.ps-result-title h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.ps-category {
  font-size: 11px;
  color: var(--muted);
  text-transform: capitalize;
}

.ps-score {
  text-align: center;
  padding: 6px 12px;
  border-radius: 8px;
  min-width: 60px;
}

.ps-score-value {
  font-size: 22px;
  font-weight: 800;
}

.ps-score-label {
  font-size: 11px;
  color: var(--muted);
}

.score-high { background: rgba(31,138,112,0.12); color: var(--success); }
.score-high .ps-score-value { color: var(--success); }
.score-medium { background: rgba(15,76,129,0.1); color: var(--accent); }
.score-medium .ps-score-value { color: var(--accent); }
.score-low { background: rgba(209,73,91,0.1); color: var(--signal); }
.score-low .ps-score-value { color: var(--signal); }

.ps-score-bar {
  height: 6px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 3px;
  overflow: hidden;
  margin: 8px 0 10px;
}

.ps-score-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s ease-out;
}

.ps-score-fill.score-high { background: var(--success); }
.ps-score-fill.score-medium { background: var(--accent); }
.ps-score-fill.score-low { background: var(--signal); }

html.dark .ps-score-bar {
  background: rgba(100, 120, 150, 0.12);
}

.ps-reasoning {
  font-size: 13px;
  color: var(--text);
  margin: 0 0 8px;
  line-height: 1.5;
}

.ps-description {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 8px;
  font-style: italic;
}

.ps-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.ps-tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.ps-warnings {
  margin-top: 8px;
}

.ps-warning {
  font-size: 12px;
  color: var(--signal);
  padding: 4px 0;
  border-top: 1px solid rgba(209,73,91,0.15);
}

.ps-warning::before {
  content: "\26A0 ";
}

.ps-error {
  padding: 16px;
  background: rgba(209,73,91,0.08);
  border: 1px solid rgba(209,73,91,0.2);
  border-radius: 8px;
  color: var(--signal);
  font-size: 13px;
}

.ps-app-notes {
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
}

.ps-matching-cta {
  margin-top: 20px;
  padding: 20px;
  background: linear-gradient(135deg, rgba(15,76,129,0.06), rgba(31,138,112,0.06));
  border: 1px solid var(--accent);
  border-radius: 10px;
  text-align: center;
}
.ps-matching-cta h3 {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 16px;
}
.ps-matching-cta p {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
}
.ps-matching-cta .primary-btn {
  display: inline-block;
  text-decoration: none;
}

@media (max-width: 900px) {
  .pump-selector-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Catalog Page ===== */
.catalog-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px 40px;
}

.catalog-sidebar .panel-card {
  position: sticky;
  top: 80px;
}

.catalog-sidebar label {
  display: block;
  margin-bottom: 12px;
}

.catalog-sidebar label span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}

.catalog-sidebar input,
.catalog-sidebar select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
  background: var(--panel-strong);
}

.catalog-sidebar .secondary-btn {
  width: 100%;
  margin-top: 8px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.catalog-sidebar .secondary-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Manufacturers Grid */
.manufacturers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.mfr-card {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: box-shadow 0.2s, border-color 0.2s, opacity 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mfr-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.mfr-logo {
  max-width: 120px;
  max-height: 60px;
  margin-bottom: 12px;
  object-fit: contain;
}

.mfr-logo-placeholder {
  width: 60px;
  height: 60px;
  margin: 0 auto 12px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
}

.mfr-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.mfr-desc {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.mfr-type-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  margin-bottom: 8px;
}

.mfr-type-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--accent-soft, #e0ecf5);
  color: var(--accent, #0f4c81);
  white-space: nowrap;
}

.mfr-type-more {
  background: var(--line, #e2e8f0);
  color: var(--muted, #64748b);
}

.mfr-stats {
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--fg);
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px solid var(--line, #e2e8f0);
}

.mfr-stat-sep {
  color: var(--muted, #64748b);
}

.mfr-stats-empty {
  color: var(--muted, #64748b);
  font-weight: 500;
  font-style: italic;
}

.mfr-card-empty {
  opacity: 0.6;
}

.mfr-card-empty:hover {
  opacity: 0.85;
}

/* Breadcrumb */
.cat-breadcrumb {
  margin-bottom: 16px;
  font-size: 14px;
}

.cat-breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

.cat-breadcrumb a:hover {
  text-decoration: underline;
}

.cat-breadcrumb span {
  color: var(--muted);
  margin-left: 8px;
}

/* Family Cards */
.families-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.family-card {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 20px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.family-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.family-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.family-header h3 {
  margin: 0;
  font-size: 16px;
}

.family-header-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.family-mfr {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  display: block;
}

.family-model-count {
  font-size: 11px;
  background: var(--accent-soft, #e0ecf5);
  color: var(--accent, #0f4c81);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.verified-badge {
  font-size: 11px;
  background: #e6f6f0;
  color: var(--success);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

html.dark .verified-badge {
  background: rgba(22, 101, 52, 0.25);
}

.family-specs {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.spec-tag {
  font-size: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 10px;
  font-weight: 600;
  text-transform: capitalize;
}

.spec-range {
  font-size: 13px;
  color: var(--muted);
}

.family-desc {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

/* Model Cards */
.models-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.model-card {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 20px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.model-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.model-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  color: var(--accent);
}

.model-specs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.model-specs span {
  font-size: 13px;
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 6px;
  color: var(--text);
}

.model-desc {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
}

/* Model Detail */
.model-detail-header {
  margin-bottom: 20px;
}

.model-detail-header h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.model-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.model-meta span {
  font-size: 13px;
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 6px;
}

/* Curve plot container */
.curve-plot {
  width: 100%;
  min-height: 400px;
  border-radius: 8px;
  overflow: hidden;
}

.curve-controls {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

/* Spec links */
.spec-links a {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
}

.spec-links a:hover {
  text-decoration: underline;
}

/* Favorites */
.model-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.fav-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  border-radius: 6px;
  transition: color 0.2s, transform 0.15s;
  line-height: 0;
}

.fav-btn:hover {
  color: #e6a817;
  transform: scale(1.15);
}

.fav-btn.fav-active {
  color: #e6a817;
}

.fav-btn-detail {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}

.fav-btn-detail:hover {
  color: #e6a817;
  border-color: #e6a817;
}

.fav-btn-detail.fav-active {
  color: #e6a817;
  border-color: #e6a817;
  background: rgba(230, 168, 23, 0.08);
}

.model-detail-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.fav-toggle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  padding: 0;
  text-align: left;
}

.fav-toggle-btn:hover {
  color: var(--accent);
}

.fav-toggle-btn.active svg {
  fill: #e6a817;
  color: #e6a817;
}

.fav-count-badge {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.favorites-sidebar-card {
  margin-top: 12px;
}

.fav-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 13px;
}

.fav-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
}

.fav-item-info strong {
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fav-item-meta {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fav-item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.fav-view-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  font-weight: 600;
}

.fav-view-btn:hover {
  opacity: 0.85;
}

.fav-remove-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 12px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
}

.fav-remove-btn:hover {
  color: var(--signal);
  border-color: var(--signal);
}

/* Model actions */
.model-actions {
  margin-top: 20px;
  display: flex;
  gap: 12px;
}

@media (max-width: 900px) {
  .catalog-layout {
    grid-template-columns: 1fr;
  }
  .catalog-sidebar .panel-card {
    position: static;
  }
}

/* ===== Chat Page ===== */
.chat-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: calc(100vh - 56px);
  overflow: hidden;
}

.chat-sidebar {
  background: var(--panel-strong);
  border-right: 1px solid var(--line);
  padding: 16px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.chat-sessions-list {
  flex: 1;
  overflow-y: auto;
}

.chat-session-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  margin-bottom: 4px;
  transition: background 0.15s;
}

.chat-session-item:hover,
.chat-session-item.active {
  background: var(--accent-soft);
}

.chat-session-item .session-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-session-item .session-date {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}

.chat-session-item .session-delete {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.chat-session-item:hover .session-delete {
  opacity: 1;
}

.chat-session-item .session-delete:hover {
  color: var(--signal);
}

.chat-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-strong);
}

.chat-header h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.chat-welcome {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.chat-welcome h3 {
  font-size: 22px;
  color: var(--text);
  margin-bottom: 8px;
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 20px;
}

.chat-suggestion {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  max-width: 280px;
  text-align: left;
}

.chat-suggestion:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.chat-msg {
  margin-bottom: 16px;
  max-width: 800px;
}

.chat-msg-user {
  margin-left: auto;
}

.chat-msg-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}

.chat-msg-body {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.6;
}

.chat-msg-user .chat-msg-body {
  background: var(--accent-soft);
  border-color: transparent;
}

.chat-msg-body code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

.chat-msg-sources {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  font-style: italic;
}

.typing-indicator {
  color: var(--muted);
  font-style: italic;
}

.chat-input-area {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: var(--panel-strong);
}

.chat-input-wrapper {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-input-wrapper textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  max-height: 120px;
  background: var(--bg);
}

.chat-input-wrapper textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.chat-input-wrapper .primary-btn {
  flex-shrink: 0;
  padding: 10px 20px;
}

.chat-rate-info {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 768px) {
  .chat-layout {
    grid-template-columns: 1fr;
  }
  .chat-sidebar {
    display: none;
  }
}

/* ===== Matching Page ===== */
.matching-layout {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 24px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px 40px;
}

.scenario-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  background: var(--bg);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.scenario-block:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(15, 76, 129, 0.08);
}

html.dark .scenario-block:focus-within {
  box-shadow: 0 0 0 2px rgba(100, 160, 230, 0.12);
}

.scenario-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.scenario-header h3 {
  margin: 0;
  font-size: 14px;
}

.scenario-remove {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
}

.scenario-remove:hover {
  color: var(--signal);
}

/* Match result cards */
.match-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
  background: var(--panel-strong);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.match-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.match-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.match-card-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* Compare checkbox */
.match-compare-check { cursor: pointer; display: flex; align-items: center; }
.match-compare-check input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }

/* Compare table */
.compare-table th { background: var(--accent-soft); color: var(--accent); font-size: 13px; padding: 8px 12px; }
.compare-table td { font-size: 13px; padding: 6px 12px; }

/* Score bars */
.match-scores {
  margin-bottom: 20px;
}

.score-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
}

.score-bar > span:first-child {
  width: 120px;
  flex-shrink: 0;
  color: var(--muted);
}

.score-bar .bar {
  flex: 1;
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}

.score-bar .fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.score-bar > span:last-child {
  width: 50px;
  text-align: right;
  font-weight: 600;
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .matching-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .matching-layout {
    padding: 0 12px 28px;
    gap: 16px;
  }
}

/* ── Shared Page Layout Classes ── */
.page-wrap {
  max-width: 1680px;
  margin: 0 auto;
  padding: 28px 24px 36px;
}

.page-header {
  text-align: center;
  margin-bottom: 24px;
}

.page-header h1 {
  margin: 0 0 6px;
  font-size: 1.5rem;
  color: var(--text);
}

.page-subtitle {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.panel-title {
  margin: 0 0 16px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.field-label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
}

.field-input {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--input-bg, #f9fbfe);
  font: inherit;
}

.field-input:focus {
  outline: 2px solid rgba(15, 76, 129, 0.16);
  border-color: rgba(15, 76, 129, 0.4);
}

.field-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
}

.field-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  padding: 0;
}

/* ── Shared Button Classes (Bootstrap-style aliases) ── */
.btn {
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:disabled { cursor: not-allowed; transform: none; opacity: 0.55; }

.btn-primary {
  padding: 12px 18px;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(135deg, #0f4c81, #1363a2);
  box-shadow: 0 12px 24px rgba(15, 76, 129, 0.2);
}

.btn-secondary {
  padding: 10px 14px;
  color: var(--accent);
  background: var(--accent-soft);
}

.btn-danger {
  padding: 10px 14px;
  color: #fff;
  background: var(--signal);
}

.btn-danger:hover {
  background: var(--signal);
  filter: brightness(0.85);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
  border-radius: 8px;
}

/* ── Wetwell Sizing Module ── */
.ww-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 24px;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 24px 40px;
}

.ww-input-panel {
  /* Let the panel grow with its content. Previously it was
     position:sticky with max-height:calc(100vh - 100px) which made the
     white background look smaller than the form when the form was
     taller than the viewport. */
  align-self: start;
}

.ww-results-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.field-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 12px;
}

.field-group legend {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--accent);
  padding: 0 6px;
}

.full-width {
  width: 100%;
  margin-top: 8px;
}

.info-box {
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 0.82rem;
  line-height: 1.5;
  margin-top: 6px;
}

.ww-kv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
}

.ww-kv {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 0;
  border-bottom: 1px dotted var(--line);
}

.ww-kv-label {
  font-size: 0.82rem;
  color: var(--muted);
}

.ww-kv-value {
  font-weight: 600;
  font-size: 0.88rem;
}

.ww-warning {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 6px;
  padding: 10px 14px;
  margin-top: 10px;
  font-size: 0.85rem;
  color: #856404;
}

.ww-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-top: 8px;
}

.ww-table th,
.ww-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.ww-table th {
  background: var(--accent-soft);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ww-table tbody tr:hover td {
  background: rgba(15, 76, 129, 0.03);
}

.ww-row-alert td {
  color: var(--signal);
  font-weight: 500;
}

.ww-row-selected {
  background: var(--accent-soft);
  font-weight: 600;
}

.ww-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Pump Cycle Diagram */
.ww-cycle-info h4 {
  margin: 0 0 12px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--heading);
}

.ww-cycle-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ww-cycle-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  background: var(--panel, #f8fafc);
  border-radius: 8px;
  border-left: 3px solid transparent;
}

.ww-cycle-step:nth-child(1) { border-left-color: var(--accent, #0f4c81); }
.ww-cycle-step:nth-child(2) { border-left-color: #1f8a70; }
.ww-cycle-step:nth-child(3) { border-left-color: var(--success); }
.ww-cycle-step:nth-child(4) { border-left-color: var(--accent-alt, #7c3aed); }
.ww-step-secondary { border-left-color: var(--warning) !important; background: var(--warning-soft); }

.ww-step-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
}

.ww-step-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ww-step-text strong {
  font-size: 0.85rem;
  color: var(--heading);
}

.ww-step-text span {
  font-size: 0.78rem;
  color: var(--muted);
}

.ww-step-detail {
  font-size: 0.73rem !important;
  color: var(--accent) !important;
  font-weight: 500;
}

html.dark .ww-cycle-step {
  background: rgba(20, 28, 40, 0.4);
}

html.dark .ww-step-secondary {
  background: rgba(217, 119, 6, 0.08);
}

.ww-badge-success { background: #d4edda; color: #155724; }
.ww-badge-warning { background: #fff3cd; color: #856404; }
.ww-badge-danger  { background: #f8d7da; color: #721c24; }
.ww-badge-info    { background: var(--accent-soft); color: var(--accent); }

html.dark .ww-warning { background: rgba(146, 64, 14, 0.2); border-color: rgba(245, 158, 11, 0.4); color: #fcd34d; }
html.dark .ww-badge-success { background: rgba(22, 101, 52, 0.3); color: #86efac; }
html.dark .ww-badge-warning { background: rgba(146, 64, 14, 0.3); color: #fcd34d; }
html.dark .ww-badge-danger  { background: rgba(153, 27, 27, 0.3); color: #fca5a5; }
html.dark .ww-badge-info    { background: rgba(37, 99, 235, 0.2); color: #93c5fd; }
html.dark .ww-table th { background: rgba(20, 28, 40, 0.5); }
html.dark .ww-table td { border-color: rgba(100, 120, 150, 0.2); }
html.dark .ww-table tbody tr:hover td { background: rgba(100, 120, 150, 0.06); }
html.dark .ww-rec-card { border-color: rgba(100, 120, 150, 0.2); background: rgba(20, 28, 40, 0.3); }

.ww-rec-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.ww-rec-card h4 {
  margin: 0 0 6px;
  color: var(--accent);
}

.ww-rec-card p {
  margin: 4px 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.ww-pros-cons {
  font-size: 0.82rem;
  margin-top: 8px;
}

.ww-pro { color: var(--success); }
.ww-con { color: var(--signal); }

.ww-mfr-list {
  margin-top: 8px;
  font-size: 0.82rem;
}

.ww-mfr {
  font-weight: 500;
}

.ww-export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.ww-export-section h3 {
  font-size: 0.85rem;
  margin: 0 0 8px;
  color: var(--accent);
}

.ww-export-section button {
  display: block;
  width: 100%;
  margin-bottom: 6px;
}

.text-muted {
  color: var(--muted);
}

@media (max-width: 1000px) {
  .ww-layout {
    grid-template-columns: 1fr;
  }
  .ww-input-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 640px) {
  .ww-layout {
    padding: 0 12px 28px;
    gap: 16px;
  }
}

/* ── Flow Analysis Module ── */
.fa-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 24px;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 24px 40px;
}

.fa-input-panel {
  /* Same fix as .ww-input-panel — no sticky, no max-height, so the
     panel background fits the form content. */
  align-self: start;
}

.fa-results-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.fa-kv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
}

.fa-kv-grid dt {
  font-size: 0.82rem;
  color: var(--muted);
}

.fa-kv-grid dd {
  font-size: 0.88rem;
  font-weight: 600;
  margin: 0;
  text-align: right;
}

.fa-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-top: 10px;
}

.fa-table th {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 2px solid var(--line);
  font-weight: 600;
  white-space: nowrap;
}

.fa-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
  transition: background 0.15s;
}

.fa-table tbody tr:hover td {
  background: rgba(15, 76, 129, 0.03);
}

.fa-table tr.fa-recommended {
  background: var(--accent-soft);
  font-weight: 600;
}

.fa-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

.fa-badge-ok { background: #d4edda; color: #155724; }
.fa-badge-slow { background: #fff3cd; color: #856404; }
.fa-badge-fast { background: #f8d7da; color: #721c24; }

html.dark .fa-badge-ok   { background: rgba(22, 101, 52, 0.3); color: #86efac; }
html.dark .fa-badge-slow { background: rgba(146, 64, 14, 0.3); color: #fcd34d; }
html.dark .fa-badge-fast { background: rgba(153, 27, 27, 0.3); color: #fca5a5; }
html.dark .fa-table th   { background: rgba(20, 28, 40, 0.5); }
html.dark .fa-table td   { border-color: rgba(100, 120, 150, 0.2); }
html.dark .fa-table tbody tr:hover td { background: rgba(100, 120, 150, 0.06); }
html.dark .fa-formula    { background: rgba(20, 28, 40, 0.4); color: #93c5fd; }

.fa-formula {
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  background: var(--surface);
  padding: 8px 12px;
  border-radius: 6px;
  margin-top: 6px;
}

.fa-integration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.fa-integration-grid button {
  width: 100%;
}

.fa-dw-only { display: none; }
.fa-fire-fields { display: none; }

.fa-section-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.fa-section-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

@media (max-width: 1000px) {
  .fa-layout {
    grid-template-columns: 1fr;
  }
  .fa-input-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 640px) {
  .fa-layout {
    padding: 0 12px 28px;
    gap: 16px;
  }
  .fa-kv-grid {
    grid-template-columns: 1fr;
    gap: 4px 0;
  }
}

/* ============================================================
   BEP SUMMARY CARD (Catalog Detail)
   ============================================================ */

.curve-export-actions {
  display: flex;
  gap: 8px;
  /* Tightened 12/12 → 6/6 to claw back ~12px for the chart. */
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.curve-export-actions .secondary-btn {
  flex: 1;
  font-size: 12px;
  /* Slim the button vertical padding so the bottom row is shorter. */
  padding: 6px 10px;
}

.bep-summary-card {
  margin-top: 16px;
  padding: 16px 20px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(241,246,252,0.9));
  border: 1px solid var(--line);
}

.bep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 10px;
}

.bep-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bep-stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.bep-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.bep-note {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

/* ============================================================
   HAMBURGER MENU (Mobile < 640px)
   ============================================================ */

.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 32px;
  height: 32px;
  padding: 4px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}

.nav-hamburger:hover { background: var(--accent-soft); }

.nav-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.2s;
}

.nav-hamburger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 640px) {
  .nav-hamburger { display: flex; order: -1; }

  .main-nav {
    flex-wrap: wrap;
    position: relative;
  }

  .nav-tabs {
    display: none;
    flex-direction: column;
    width: 100%;
    order: 10;
    background: var(--panel-strong);
    border-top: 1px solid var(--line);
    padding: 8px 0;
    gap: 0;
  }

  .nav-tabs.open { display: flex; }

  .nav-tab {
    padding: 12px 20px;
    border-radius: 0;
    font-size: 14px;
    border-bottom: 1px solid rgba(214, 223, 235, 0.4);
  }

  .nav-tab:last-child { border-bottom: none; }

  .nav-user {
    order: 2;
    margin-left: auto;
  }

  .nav-brand { order: 0; }
  .nav-title { display: none; }

  /* Better mobile touch targets and spacing */
  .primary-btn,
  .secondary-btn {
    min-height: 44px;
    font-size: 14px;
  }

  .toolbar-btn,
  .export-btn {
    min-height: 40px;
    font-size: 13px;
  }

  .hero h1 {
    font-size: 1.3rem;
  }

  .hero .subtitle,
  .page-subtitle {
    font-size: 0.85rem;
  }

  .stat-tile {
    padding: 10px 12px;
  }

  .stat-tile .label {
    font-size: 11px;
  }

  .inline-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  .scenario-actions-row {
    flex-wrap: wrap;
    gap: 6px;
  }

  .scenario-card-top strong {
    font-size: 14px;
  }

  /* Stack catalog sidebar below search on mobile */
  .catalog-layout {
    grid-template-columns: 1fr !important;
  }

  .catalog-sidebar {
    order: -1;
  }

  .model-detail-title-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Better results panel on mobile */
  .results-toolbar {
    flex-wrap: wrap;
  }

  .curve-controls {
    flex-direction: column;
    gap: 8px;
  }

  /* Favorites panel */
  .fav-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .fav-item-actions {
    align-self: flex-end;
  }
}

/* Extra small screens */
@media (max-width: 400px) {
  .page-shell {
    padding: 12px 8px 20px;
  }

  .panel-card {
    padding: 14px 12px;
  }

  .field-grid {
    gap: 8px;
  }

  .nav-controls {
    gap: 2px;
  }

  .font-size-controls {
    display: none;
  }
}

/* ============================================================
   WELCOME TOUR TOOLTIPS
   ============================================================ */

.tour-highlight {
  position: relative;
  z-index: 10001;
  box-shadow: 0 0 0 4px var(--accent), 0 0 20px rgba(15, 76, 129, 0.3) !important;
  border-radius: 12px;
}

.tour-tooltip {
  position: fixed;
  z-index: 10002;
  width: 320px;
  max-width: calc(100vw - 32px);
  padding: 18px 22px;
  background: #ffffff;
  color: #1e293b;
  border: 2px solid var(--accent, #0f4c81);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(15, 76, 129, 0.1);
}

html.dark .tour-tooltip {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #4da3ff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(77, 163, 255, 0.2);
}

.tour-step-indicator {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.tour-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
}

html.dark .tour-title {
  color: #f1f5f9;
}

.tour-text {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.6;
  color: #475569;
}

html.dark .tour-text {
  color: #94a3b8;
}

.tour-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tour-skip {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
}

.tour-skip:hover { color: var(--signal); }

.tour-next {
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.tour-next:hover { background: #0d3d68; }

/* ============================================================
   KEYBOARD SHORTCUTS MODAL
   ============================================================ */

.shortcuts-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.shortcuts-modal {
  background: var(--panel-strong, #fff);
  border-radius: 16px;
  padding: 24px 28px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--line);
}

.shortcuts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.shortcuts-header h2 {
  margin: 0;
  font-size: 18px;
  color: var(--text);
}

.shortcuts-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.shortcuts-close:hover { color: var(--signal); }

.shortcuts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shortcut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(214, 223, 235, 0.3);
}

.shortcut-row:last-child { border-bottom: none; }

.shortcut-row kbd {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  min-width: 50px;
  text-align: center;
}

.shortcut-row span {
  font-size: 13px;
  color: var(--muted);
}

/* ============================================================
   NAV CONTROLS (Theme Toggle, Font Size)
   ============================================================ */

.nav-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.font-size-controls {
  display: flex;
  gap: 2px;
}

.nav-ctrl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.nav-ctrl-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

@media (max-width: 640px) {
  .nav-controls { order: 1; }
  .font-size-controls { display: none; }
}

/* ============================================================
   FLUID REGIME VISUALIZER METRIC CARDS
   ============================================================ */

.fr-metric-card {
  background: var(--panel-strong, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  color: var(--text, #1e293b);
  border-radius: 10px;
  padding: 14px 16px;
}

.fr-metric-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted, #64748b);
  margin-bottom: 4px;
}

.fr-metric-value {
  font-size: 1.25rem;
  font-weight: 700;
}

.fr-metric-value small {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted, #64748b);
}

/* Reynolds scale */
.fr-scale-title {
  color: var(--text, #1e293b);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.fr-scale-bar {
  background: var(--bg-alt, #e2e8f0);
}

.fr-scale-labels,
.fr-scale-apps {
  color: var(--muted, #94a3b8);
}

/* Equation display */
.fr-equation-text {
  color: var(--muted, #475569);
  text-align: center;
  font-family: serif;
  font-size: 15px;
  margin-top: 8px;
}

/* ============================================================
   VALVE SIZING (Cv) RESULT CARDS
   ============================================================ */

.cvs-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 10px;
}

.cvs-result-card {
  background: var(--panel-strong, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 16px;
}

.cvs-result-title {
  font-size: 12px;
  color: var(--muted, #64748b);
  margin-bottom: 4px;
}

.cvs-result-value {
  font-size: 24px;
  font-weight: 700;
}

.cvs-result-sub {
  font-size: 12px;
  color: var(--muted, #64748b);
  margin-top: 4px;
}

/* Cv reference table */
.cvs-table-wrap {
  background: var(--panel-strong, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 20px;
  overflow-x: auto;
}

.cvs-table-wrap table {
  width: 100%;
  border-collapse: collapse;
}

.cvs-th {
  text-align: right;
  padding: 8px;
  color: var(--muted, #64748b);
  border-bottom: 2px solid var(--border, #e2e8f0);
}

.cvs-th-active {
  font-weight: 700;
  color: #3b82f6;
}

.cvs-td {
  padding: 8px;
  color: var(--text, #1e293b);
  border-bottom: 1px solid var(--border, #e2e8f0);
}

.cvs-td-active {
  color: #3b82f6;
  font-weight: 700;
}

.cvs-row-highlight {
  background: var(--accent-soft, #dbeafe);
}

html.dark .cvs-row-highlight {
  background: rgba(59, 130, 246, 0.15);
}

/* ============================================================
   DARK MODE (user-controlled via html.dark class)
   ============================================================ */

html.dark {
  --bg: #0f1419;
  --panel: rgba(30, 37, 46, 0.95);
  --panel-strong: #1a2332;
  --text: #e1e8f0;
  --heading: #c8d6e5;
  --muted: #8b9bb4;
  --line: rgba(100, 120, 150, 0.25);
  --accent: #4da3ff;
  --accent-soft: rgba(77, 163, 255, 0.12);
  --signal: #f06070;
  --warning: #f59e0b;
  --success: #3dd9a4;
  --bg-alt: rgba(30, 40, 55, 0.5);
  --input-bg: rgba(15, 20, 30, 0.6);
  --warning-soft: rgba(245, 158, 11, 0.12);
  --warning-text: #fbbf24;
  --warning-border: rgba(245, 158, 11, 0.3);
  --accent-alt: #a78bfa;
  --border: rgba(100, 120, 150, 0.25);
  --surface-alt: rgba(22, 101, 52, 0.15);
  --danger: #f87171;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

html.dark body {
  background:
    radial-gradient(circle at top left, rgba(15, 76, 129, 0.25), transparent 30%),
    radial-gradient(circle at top right, rgba(140, 50, 70, 0.15), transparent 26%),
    linear-gradient(180deg, #0a0f16, #101820 55%, #0d1520);
}

html.dark .main-nav {
  background: linear-gradient(135deg, rgba(26, 35, 50, 0.98), rgba(15, 20, 30, 0.96));
  border-bottom-color: var(--line);
}

html.dark .hero,
html.dark .panel-card,
html.dark .branch-card,
html.dark .pump-card {
  background: linear-gradient(135deg, rgba(26, 35, 50, 0.9), rgba(20, 28, 40, 0.85));
  border-color: var(--line);
}

html.dark .field-input,
html.dark input[type="text"],
html.dark input[type="number"],
html.dark input[type="email"],
html.dark input[type="password"],
html.dark select,
html.dark textarea {
  background: rgba(15, 20, 30, 0.6);
  border-color: var(--line);
  color: var(--text);
}

html.dark .field-input:focus,
html.dark input:focus,
html.dark select:focus,
html.dark textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(77, 163, 255, 0.15);
}

html.dark .primary-btn {
  background: linear-gradient(135deg, #2d7dd2, #1a5fa0);
}

html.dark .primary-btn:hover {
  background: linear-gradient(135deg, #3a8be0, #2370b8);
}

html.dark .secondary-btn {
  background: rgba(77, 163, 255, 0.08);
  border-color: rgba(77, 163, 255, 0.3);
  color: var(--accent);
}

html.dark button:disabled {
  background: rgba(30, 41, 59, 0.6);
  color: rgba(148, 163, 184, 0.5);
  border-color: rgba(100, 116, 139, 0.2);
}

html.dark .nav-tab.active {
  background: var(--accent);
  color: #fff;
}

html.dark .info-btn {
  border-color: rgba(77, 163, 255, 0.25);
  background: rgba(77, 163, 255, 0.12);
  color: var(--accent);
}

html.dark .info-popover {
  background: var(--panel-strong);
  border-color: var(--line);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

html.dark .disclaimer {
  color: var(--signal);
}

html.dark .scenario-card {
  background: var(--input-bg);
  border-color: var(--line);
}

html.dark .fitting-card {
  background: var(--input-bg);
  border-color: var(--line);
}

html.dark .mfr-card,
html.dark .family-card,
html.dark .model-card {
  background: var(--panel);
  border-color: var(--line);
}

html.dark .mfr-card:hover,
html.dark .family-card:hover,
html.dark .model-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(77, 163, 255, 0.08);
}

html.dark .mfr-type-badge,
html.dark .family-model-count {
  background: rgba(77, 163, 255, 0.15);
  color: var(--accent, #4da3ff);
}

html.dark .mfr-type-more {
  background: var(--line);
  color: var(--muted);
}

html.dark .mfr-stats {
  border-top-color: var(--line);
}

html.dark .fav-item {
  background: var(--panel);
  border-color: var(--line);
}

html.dark .pricing-card {
  background: var(--panel);
  border-color: var(--line);
}

html.dark .pricing-card-featured {
  border-color: var(--accent);
  box-shadow: 0 4px 24px rgba(77, 163, 255, 0.1);
}

html.dark .fav-btn-detail {
  border-color: var(--line);
}

html.dark .fav-btn-detail.fav-active {
  background: rgba(230, 168, 23, 0.12);
}

html.dark .locked-overlay {
  background: rgba(15, 20, 30, 0.7);
}

html.dark .locked-content {
  background: var(--panel-strong);
  border-color: var(--line);
}

html.dark .bep-summary-card {
  background: linear-gradient(135deg, rgba(26, 35, 50, 0.95), rgba(20, 28, 40, 0.9));
  border-color: var(--line);
}

html.dark .upgrade-banner {
  background: rgba(77, 163, 255, 0.1);
}

html.dark .tier-free { background: rgba(100, 120, 150, 0.2); color: var(--muted); }

html.dark .chat-input textarea,
html.dark .chat-input-wrapper textarea {
  background: rgba(15, 20, 30, 0.6);
  color: var(--text);
  border-color: rgba(100, 120, 150, 0.3);
}

html.dark .chat-message.assistant {
  background: rgba(77, 163, 255, 0.06);
}

html.dark .chat-sidebar {
  background: rgba(15, 20, 30, 0.4);
  border-color: rgba(100, 120, 150, 0.2);
}

html.dark .chat-welcome {
  color: var(--text);
}

html.dark .chat-suggestion {
  background: rgba(30, 40, 55, 0.6);
  border-color: rgba(100, 120, 150, 0.3);
  color: var(--text);
}

html.dark .chat-suggestion:hover {
  border-color: var(--accent);
  background: rgba(77, 163, 255, 0.1);
}

html.dark .chat-sources {
  background: rgba(15, 20, 30, 0.5);
  border-color: rgba(100, 120, 150, 0.2);
}

html.dark .match-card {
  background: var(--panel);
}
html.dark .compare-table th {
  background: rgba(77, 163, 255, 0.12);
  color: var(--accent);
}

html.dark .nav-ctrl-btn {
  border-color: rgba(100, 120, 150, 0.3);
}

html.dark .loading-spinner {
  border-color: rgba(100, 120, 150, 0.3);
  border-top-color: var(--accent);
}

html.dark button.loading::before {
  border-color: rgba(100, 120, 150, 0.3);
  border-top-color: #fff;
}

html.dark .toast {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* Plotly dark mode overrides */
html.dark .js-plotly-plot .plotly .modebar-btn path { fill: var(--muted); }
html.dark .js-plotly-plot .plotly .modebar-btn:hover path { fill: var(--accent); }

/* ============================================================
   LOADING SPINNER & SKELETON STATES
   ============================================================ */

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

/* Skeleton loading states */
.skeleton-line,
.skeleton-block,
.skeleton-tile,
.skeleton-chart {
  background: linear-gradient(90deg, var(--line) 25%, var(--bg) 37%, var(--line) 63%);
  background-size: 800px 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 6px;
}

.skeleton-line {
  height: 14px;
  margin: 8px 0;
  width: 80%;
}

.skeleton-line:nth-child(2) { width: 65%; }
.skeleton-line:nth-child(3) { width: 50%; }

.skeleton-block {
  height: 48px;
  margin: 8px 0;
  width: 100%;
}

.skeleton-tile {
  height: 72px;
  min-width: 120px;
}

.skeleton-chart {
  height: 350px;
  width: 100%;
}

html.dark .skeleton-line,
html.dark .skeleton-block,
html.dark .skeleton-tile,
html.dark .skeleton-chart {
  background: linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.1) 37%, rgba(255,255,255,0.06) 63%);
  background-size: 800px 100%;
}

/* Real-time input validation */
input.input-invalid,
select.input-invalid {
  border-color: var(--signal) !important;
  box-shadow: 0 0 0 2px rgba(209, 73, 91, 0.15);
}

input.input-valid {
  border-color: var(--success) !important;
}

.field-error-msg {
  display: block;
  font-size: 12px;
  color: var(--signal);
  background: rgba(209, 73, 91, 0.08);
  border-left: 3px solid var(--signal);
  padding: 5px 8px;
  border-radius: 4px;
  margin-top: 4px;
  line-height: 1.4;
  font-weight: 500;
  animation: fadeInUp 0.15s ease;
}

.loading-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Skeleton placeholder cards */
.skeleton {
  background: linear-gradient(90deg, var(--line) 25%, transparent 50%, var(--line) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-text.short { width: 40%; }
.skeleton-text.medium { width: 65%; }
.skeleton-text.long { width: 90%; }

.skeleton-card {
  height: 120px;
  border-radius: 16px;
}

.skeleton-chart {
  height: 300px;
  border-radius: 12px;
}

html.dark .skeleton {
  background: linear-gradient(90deg, rgba(50, 60, 75, 0.6) 25%, rgba(70, 85, 105, 0.3) 50%, rgba(50, 60, 75, 0.6) 75%);
  background-size: 800px 100%;
}

/* ============================================================
   EXPORT TOOLBAR
   ============================================================ */

/* Results toolbar (copy, print) */
.results-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.toolbar-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.export-toolbar {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.export-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.export-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: none;
}

.export-btn svg {
  width: 14px;
  height: 14px;
}

html.dark .export-btn {
  background: rgba(30, 37, 46, 0.8);
  border-color: rgba(100, 120, 150, 0.3);
}

.loading-spinner.lg {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

.loading-center {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
}

/* Button loading state */
button.loading {
  position: relative;
  pointer-events: none;
  padding-left: 36px;
}

button.loading::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 12px;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Improved empty state */
.empty-state {
  text-align: center;
  padding: 32px 20px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.empty-state-icon {
  display: block;
  margin: 0 auto 12px;
  font-size: 2.4rem;
  opacity: 0.5;
}

/* Toast / notification for success feedback */
@keyframes slideInToast {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes slideOutToast {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(-100%); opacity: 0; }
}

.toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  animation: slideInToast 0.3s ease-out;
  pointer-events: none;
}

.toast.success {
  background: var(--success);
  color: #fff;
}

.toast.error {
  background: var(--signal);
  color: #fff;
}

.toast.info {
  background: var(--accent);
  color: #fff;
}

.toast.hiding {
  animation: slideOutToast 0.3s ease-in forwards;
}

/* ============================================================
   SUGGEST SIZE BUTTON
   ============================================================ */

.suggest-size-btn {
  padding: 1px 6px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: transparent;
  color: var(--accent);
  font-size: 0.65rem;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-left: auto;
  transition: background 0.15s, color 0.15s;
}

.suggest-size-btn:hover {
  background: var(--accent);
  color: #fff;
  transform: none;
}

html.dark .suggest-size-btn {
  border-color: var(--accent);
  color: var(--accent);
}

html.dark .suggest-size-btn:hover {
  background: var(--accent);
  color: #0f1419;
}

/* ============================================================
   SCENARIO COMPARISON TABLE
   ============================================================ */

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.comparison-table th,
.comparison-table td {
  padding: 8px 12px;
  text-align: right;
  border-bottom: 1px solid var(--line);
}

.comparison-table th {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.comparison-table td:first-child,
.comparison-table th:first-child {
  text-align: left;
  font-weight: 600;
  color: var(--text);
}

.comparison-table tbody tr:hover {
  background: rgba(15, 76, 129, 0.04);
}

.comparison-table tbody tr:last-child td {
  border-bottom: none;
}

html.dark .comparison-table th {
  background: rgba(77, 163, 255, 0.1);
}

html.dark .comparison-table tbody tr:hover {
  background: rgba(77, 163, 255, 0.05);
}

/* ============================================================
   UNIT CONVERTER WIDGET
   ============================================================ */

.unit-converter-panel {
  position: fixed;
  top: 60px;
  right: 20px;
  z-index: 9500;
  width: 320px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  padding: 16px;
  animation: fadeInUp 0.2s ease-out;
}

.uc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.uc-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.uc-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--muted);
  padding: 0 4px;
  line-height: 1;
}

.uc-close:hover {
  color: var(--signal);
  transform: none;
}

.uc-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.85rem;
  background: var(--bg);
  color: var(--text);
  margin-bottom: 10px;
}

.uc-input-row {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 8px;
  margin-bottom: 12px;
}

.uc-input {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--bg);
  color: var(--text);
}

.uc-input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.1);
}

.uc-input-row .uc-select {
  margin-bottom: 0;
}

.uc-results {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.uc-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.uc-result-row:last-child {
  border-bottom: none;
}

.uc-result-val {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.uc-result-unit {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
}

.uc-hint {
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
  padding: 8px 0;
  margin: 0;
}

html.dark .unit-converter-panel {
  background: rgba(20, 28, 40, 0.98);
  border-color: rgba(100, 120, 150, 0.25);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

html.dark .uc-select,
html.dark .uc-input {
  background: rgba(15, 20, 30, 0.5);
  border-color: rgba(100, 120, 150, 0.3);
  color: var(--text);
}

html.dark .uc-result-row {
  border-bottom-color: rgba(100, 120, 150, 0.1);
}

@media (max-width: 640px) {
  .unit-converter-panel {
    right: 8px;
    left: 8px;
    width: auto;
    top: 56px;
  }
}

/* ============================================================
   INPUT VALIDATION STYLES
   ============================================================ */

input:invalid:not(:placeholder-shown):not(:focus) {
  border-color: var(--signal) !important;
  box-shadow: 0 0 0 2px rgba(209, 73, 91, 0.15);
}

input:valid:not(:placeholder-shown):not([value=""]) {
  border-color: var(--success);
}

.field-error-msg {
  color: var(--signal);
  font-size: 0.75rem;
  margin-top: 2px;
  display: none;
}

input:invalid:not(:placeholder-shown):not(:focus) ~ .field-error-msg {
  display: block;
}

html.dark input:invalid:not(:placeholder-shown):not(:focus) {
  border-color: #f87171 !important;
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.2);
}

html.dark input:valid:not(:placeholder-shown):not([value=""]) {
  border-color: #34d399;
}

/* Quick-set buttons for rapid value selection */
.quick-set-row {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.quick-set-btn {
  flex: 1;
  padding: 3px 6px;
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid var(--line, #dde1e8);
  border-radius: 4px;
  background: var(--input-bg, #f9fbfe);
  color: var(--muted, #64748b);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  min-height: 0;
}

.quick-set-btn:hover {
  background: var(--accent-soft, rgba(15, 76, 129, 0.08));
  color: var(--accent, #0f4c81);
  border-color: var(--accent, #0f4c81);
  transform: none;
}

.quick-set-btn.active {
  background: var(--accent, #0f4c81);
  color: #fff;
  border-color: var(--accent, #0f4c81);
}

html.dark .quick-set-btn {
  background: rgba(15, 20, 30, 0.4);
  border-color: var(--line);
  color: var(--muted);
}

html.dark .quick-set-btn:hover {
  background: rgba(77, 163, 255, 0.15);
  color: var(--accent);
  border-color: var(--accent);
}

html.dark .quick-set-btn.active {
  background: var(--accent);
  color: #fff;
}

/* Velocity warning indicator */
.velocity-warn {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Iter-219 #242: 4-zone canonical scheme matches Velocity Gauge +
   Pipe-Size Comparison + 9 other surfaces. Was 3-zone (low/ok/high)
   with Sediment colored ORANGE — drifted from canonical Sediment
   blue. iter-217 #240 added the `.warn` JS class but the matching
   CSS rule was missing — Elevated velocities had unstyled markup. */
.velocity-warn.ok {
  /* Optimal — green */
  background: rgba(31, 138, 112, 0.1);
  color: var(--success);
}

.velocity-warn.high {
  /* Severe — red */
  background: rgba(209, 73, 91, 0.1);
  color: var(--signal);
}

.velocity-warn.warn {
  /* Elevated — amber, matches velocity-gauge Elevated #f59e0b */
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
}

.velocity-warn.low {
  /* Sediment — blue, matches canonical 4-zone (was orange — drift) */
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
}

/* ============================================================
   ENGINEERING HELP TOOLTIPS
   ============================================================ */

.info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  cursor: help;
  position: relative;
  vertical-align: middle;
  margin-left: 4px;
  flex-shrink: 0;
}

.info-tip::after {
  content: attr(data-tip);
  position: absolute;
  /* Position BELOW the icon: there's almost always more room downward
     and this avoids clipping by fieldset borders / card tops */
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 220px;
  max-width: 320px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.5;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 10000;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* Ensure ancestor form containers don't clip the tooltip */
.field-group,
.field-grid,
.field-label,
.panel-card {
  overflow: visible;
}

.info-tip:hover,
.info-tip:focus {
  background: rgba(15, 76, 129, 0.18);
  transform: scale(1.1);
}

.info-tip:hover::after,
.info-tip:focus::after,
.info-tip:focus-visible::after {
  opacity: 1;
  visibility: visible;
}

@media (max-width: 640px) {
  .info-tip::after {
    left: auto;
    right: 0;
    transform: none;
    min-width: 180px;
    max-width: 260px;
    font-size: 0.75rem;
  }
}

html.dark .info-tip {
  background: rgba(77, 163, 255, 0.2);
}

html.dark .info-tip:hover,
html.dark .info-tip:focus {
  background: rgba(77, 163, 255, 0.35);
}

html.dark .info-tip::after {
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

/* ============================================================
   SCROLL-TO-TOP BUTTON
   ============================================================ */

.scroll-top-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9000;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(15, 76, 129, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
}

.scroll-top-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-top-btn:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 20px rgba(15, 76, 129, 0.4);
}

html.dark .scroll-top-btn {
  background: var(--accent);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* ============================================================
   BREADCRUMB NAVIGATION
   ============================================================ */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb .sep {
  color: var(--line);
  user-select: none;
}

.breadcrumb .current {
  color: var(--text);
  font-weight: 600;
}

/* ============================================================
   COPY-TO-CLIPBOARD BUTTON
   ============================================================ */

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.copy-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: none;
}

.copy-btn.copied {
  color: var(--success);
  border-color: var(--success);
}

/* Phase 10 §10.1.2 — Request Engineering Help button accent.
   Subtle accent-color border so the engineering-help action stands
   out from copy/CSV/report siblings (it's a higher-impact action —
   sends a real request to a P.E.). The base .copy-btn / .secondary-btn
   layout still applies; this adds tint only. */
.rfe-btn {
  color: var(--accent);
  border-color: var(--accent);
}
.rfe-btn:hover {
  background: var(--accent-soft, rgba(15, 76, 129, 0.06));
  color: var(--accent);
  border-color: var(--accent);
}

/* Phase 10 §10.3.1 — Flow estimator wizard (Step 1 — project type).
   Stepper progress strip + 3-card radio grid + step-actions bar.
   Future steps (§10.3.2-§10.3.5) reuse the same .fe-step-panel +
   .fe-step-actions classes. */
.fe-stepper {
  list-style: none;
  display: flex;
  gap: 4px;
  padding: 0;
  margin: 0 0 18px;
  flex-wrap: wrap;
}
.fe-step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--bg-alt, #f1f5f9);
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 600;
}
.fe-step-active {
  background: var(--accent, #0f4c81);
  color: #fff;
}
.fe-step-pending { opacity: 0.55; }
.fe-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  font-size: 12px;
  font-weight: 700;
}
.fe-step-active .fe-step-num { background: rgba(255,255,255,0.25); }
.fe-step-pending .fe-step-num {
  background: var(--panel-strong, #fff);
  border: 1px solid var(--border, #dde1e8);
  color: var(--muted, #64748b);
}

.fe-step-panel { margin-bottom: 16px; }
.fe-step-stub  { opacity: 0.65; }

.fe-radio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  border: none;
  padding: 0;
  margin: 12px 0 4px;
}
.fe-radio-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border: 2px solid var(--border, #dde1e8);
  border-radius: 10px;
  cursor: pointer;
  background: var(--panel-strong, #fff);
  transition: border-color 0.15s, background 0.15s;
}
.fe-radio-card:hover {
  border-color: var(--accent, #0f4c81);
}
.fe-radio-card input[type="radio"] {
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
}
.fe-radio-card input[type="radio"]:checked ~ .fe-radio-card-body
  .fe-radio-card-title {
  color: var(--accent, #0f4c81);
}
.fe-radio-card:has(input:checked) {
  border-color: var(--accent, #0f4c81);
  background: var(--accent-soft, rgba(15, 76, 129, 0.06));
}
.fe-radio-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fe-radio-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text, #1e293b);
}
.fe-radio-card-desc {
  font-size: 12px;
  color: var(--muted, #64748b);
  line-height: 1.5;
}

.fe-step-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.fe-step-hint {
  font-size: 12px;
  color: var(--muted, #64748b);
}

/* Phase 10 §10.3.3 — Step 3 method-specific inputs form. */
.fe-method-inputs { display: block; }
.fe-method-inputs[hidden] { display: none; }

.fe-input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.fe-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}
.fe-field span {
  font-weight: 600;
  color: var(--text, #1e293b);
}
.fe-field em {
  color: #ef4444;
  font-style: normal;
  font-weight: 700;
}
.fe-field input,
.fe-field select {
  padding: 7px 10px;
  border: 1px solid var(--border, #dde1e8);
  border-radius: 6px;
  background: var(--input-bg, #fff);
  color: var(--text, #1e293b);
  font-size: 13px;
  font-family: inherit;
}
.fe-field input:focus,
.fe-field select:focus {
  outline: 2px solid var(--accent, #0f4c81);
  outline-offset: -1px;
}

.fe-subfieldset {
  border: 1px solid var(--border, #dde1e8);
  border-radius: 6px;
  padding: 10px 12px;
  margin: 10px 0;
}
.fe-subfieldset legend {
  font-size: 12px;
  font-weight: 700;
  padding: 0 6px;
  color: var(--text, #1e293b);
}
.fe-subfieldset summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--text, #1e293b);
}
.fe-radio-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 14px;
  font-size: 12px;
  cursor: pointer;
}
.fe-ii-detail {
  margin-top: 10px;
  padding-left: 0;
}

/* Land-use add-row table. */
.fe-land-use-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 8px;
}
.fe-land-use-table thead th {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border, #dde1e8);
  font-weight: 700;
}
.fe-land-use-table tbody td {
  padding: 4px 8px;
  vertical-align: middle;
}
.fe-land-use-table input,
.fe-land-use-table select {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--border, #dde1e8);
  border-radius: 5px;
  background: var(--input-bg, #fff);
  color: var(--text, #1e293b);
  font-size: 12px;
}
.fe-lu-remove {
  background: transparent;
  border: 1px solid var(--border, #dde1e8);
  color: var(--muted, #64748b);
  width: 26px;
  height: 26px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.fe-lu-remove:hover {
  border-color: #ef4444;
  color: #ef4444;
}

/* Phase 10 §10.3.4 — Step 4 Results card. Metric rows + pipe-size
   table with velocity-zone verdict coloring matching the calc-wide
   4-zone scheme (sediment / optimal / elevated / severe). */
.fe-results-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0 4px;
}
.fe-metric-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  align-items: baseline;
  gap: 14px;
  padding: 10px 14px;
  border: 1px solid var(--border, #dde1e8);
  border-radius: 8px;
  background: var(--panel-strong, #fff);
}
.fe-metric-row-emphasis {
  border-color: var(--accent, #0f4c81);
  background: var(--accent-soft, rgba(15, 76, 129, 0.06));
}
.fe-metric-label {
  font-size: 13px;
  color: var(--text, #1e293b);
  font-weight: 600;
}
.fe-metric-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text, #1e293b);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.fe-metric-row-emphasis .fe-metric-value {
  color: var(--accent, #0f4c81);
  font-size: 18px;
}
.fe-metric-note {
  font-size: 11px;
  color: var(--muted, #64748b);
}

.fe-pipe-size-block { margin-top: 14px; }
.fe-pipe-size-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.fe-pipe-size-table thead th {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border, #dde1e8);
  font-weight: 700;
}
.fe-pipe-size-table tbody td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border, #eef0f4);
  font-variant-numeric: tabular-nums;
}
.fe-pipe-recommended {
  background: var(--accent-soft, rgba(15, 76, 129, 0.06));
}
.fe-vel-low  { color: #2563eb; font-weight: 600; }
.fe-vel-ok   { color: var(--success, #10b981); font-weight: 600; }
.fe-vel-warn { color: #f59e0b; font-weight: 600; }
.fe-vel-high { color: #ef4444; font-weight: 600; }

/* Phase 10 §10.3.5 — CTA row (Send / Save / Download). Renders
   above the back-button action row + below the pipe-size table.
   Send is the primary action so it's distinguished by .fe-cta-primary
   class + placed first in DOM order. */
.fe-cta-row {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.fe-cta-primary {
  font-weight: 700;
}
.fe-cta-status-ok   { color: var(--success, #10b981); }
.fe-cta-status-warn { color: #f59e0b; }
.fe-cta-status-err  { color: #ef4444; }

/* Phase 10 §10.5 — Reference popovers for default values. Each (?)
   icon next to a defaulted input opens a popover showing the source +
   citation + an "Edit anyway" link that focuses the underlying input.
   Citations point to alembic 0034 seed sources (Ten States, Hunter,
   ASCE 37, etc.) so a user can audit any default before trusting it.
   Singleton: only one popover open at a time. */
.fe-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  padding: 0;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 50%;
  background: var(--surface-alt, #f1f5f9);
  color: var(--text-muted, #64748b);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  vertical-align: text-top;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.fe-help-btn:hover {
  background: var(--accent, #1e40af);
  color: #ffffff;
  border-color: var(--accent, #1e40af);
}
.fe-help-btn:focus {
  outline: 2px solid var(--accent, #1e40af);
  outline-offset: 2px;
}
.fe-help-btn[aria-expanded="true"] {
  background: var(--accent, #1e40af);
  color: #ffffff;
  border-color: var(--accent, #1e40af);
}

.fe-help-popover {
  width: 320px;
  max-width: calc(100vw - 24px);
  padding: 14px 16px 14px 18px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.18);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text, #0f172a);
  z-index: 1000;
  animation: fe-help-pop-in 160ms ease-out;
}
@keyframes fe-help-pop-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fe-help-popover-arrow {
  position: absolute;
  top: -7px;
  left: 14px;
  width: 12px;
  height: 12px;
  background: var(--surface, #ffffff);
  border-top: 1px solid var(--border, #cbd5e1);
  border-left: 1px solid var(--border, #cbd5e1);
  transform: rotate(45deg);
}
.fe-help-popover-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted, #64748b);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
}
.fe-help-popover-close:hover {
  background: var(--surface-alt, #f1f5f9);
  color: var(--text, #0f172a);
}
.fe-help-popover-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text, #0f172a);
  margin: 0 24px 8px 0;
}
.fe-help-popover-source {
  font-size: 12px;
  color: var(--text-muted, #64748b);
  margin-bottom: 8px;
}
.fe-help-popover-citation {
  font-size: 12.5px;
  color: var(--text, #0f172a);
  margin-bottom: 10px;
}
.fe-help-popover-citation strong { color: var(--accent, #1e40af); }
.fe-help-popover-citation em { font-style: italic; color: var(--text-muted, #64748b); }
.fe-help-popover-default {
  font-size: 12px;
  padding: 6px 10px;
  margin-bottom: 10px;
  background: var(--surface-alt, #f1f5f9);
  border-radius: 6px;
  color: var(--text, #0f172a);
}
.fe-help-popover-default code {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: var(--accent, #1e40af);
}
.fe-help-popover-edit {
  display: inline-block;
  font-size: 12.5px;
  color: var(--accent, #1e40af);
  font-weight: 600;
  text-decoration: none;
  padding: 4px 8px;
  margin-left: -8px;
  border-radius: 4px;
  transition: background 120ms ease;
}
.fe-help-popover-edit:hover {
  background: rgba(30, 64, 175, 0.10);
  text-decoration: underline;
}
:root.dark .fe-help-btn {
  background: rgba(100, 116, 139, 0.18);
  border-color: rgba(148, 163, 184, 0.4);
  color: #94a3b8;
}
:root.dark .fe-help-btn:hover,
:root.dark .fe-help-btn[aria-expanded="true"] {
  background: #60a5fa;
  border-color: #60a5fa;
  color: #0f172a;
}
:root.dark .fe-help-popover {
  background: #1e293b;
  border-color: rgba(148, 163, 184, 0.3);
  color: #e2e8f0;
}
:root.dark .fe-help-popover-arrow {
  background: #1e293b;
  border-color: rgba(148, 163, 184, 0.3);
}
:root.dark .fe-help-popover-default {
  background: rgba(15, 23, 42, 0.6);
  color: #e2e8f0;
}
:root.dark .fe-help-popover-citation strong,
:root.dark .fe-help-popover-default code,
:root.dark .fe-help-popover-edit { color: #93c5fd; }

/* Phase 10 §10.4.3 — "Flow estimate applied — review and Compute" banner
   shown when the calculator loads with `?prefill=…`. Injected by
   flow_estimator_prefill.js's showBanner(); inserted before the tablist
   so it's visible regardless of which tab the user is on. Green theme
   matches the calc's existing semantic palette (green = "valid / go"). */
.fe-prefill-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  margin: 12px 16px;
  background: rgba(16, 185, 129, 0.10);
  border: 1px solid rgba(16, 185, 129, 0.45);
  border-left: 4px solid #10b981;
  border-radius: 8px;
  color: var(--text, #0f172a);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  animation: fe-prefill-banner-in 320ms ease-out;
}
@keyframes fe-prefill-banner-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fe-prefill-banner-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #10b981;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}
.fe-prefill-banner-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.fe-prefill-banner-headline {
  font-size: 14px;
  font-weight: 600;
  color: #047857;
  letter-spacing: -0.005em;
}
.fe-prefill-banner-detail {
  font-size: 12.5px;
  color: var(--text-muted, #64748b);
}
.fe-prefill-banner-flow {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-weight: 600;
  color: var(--text, #0f172a);
}
.fe-prefill-banner-source {
  opacity: 0.75;
  font-style: italic;
}
.fe-prefill-banner-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: #047857;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
  flex-shrink: 0;
  padding: 0;
  transition: background 150ms ease;
}
.fe-prefill-banner-close:hover {
  background: rgba(16, 185, 129, 0.18);
}
.fe-prefill-banner-close:focus {
  outline: 2px solid #10b981;
  outline-offset: 2px;
}
:root.dark .fe-prefill-banner {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.55);
  color: var(--text, #e2e8f0);
}
:root.dark .fe-prefill-banner-headline { color: #6ee7b7; }
:root.dark .fe-prefill-banner-close    { color: #6ee7b7; }
:root.dark .fe-prefill-banner-flow     { color: var(--text, #e2e8f0); }
@media (max-width: 640px) {
  .fe-prefill-banner {
    flex-wrap: wrap;
    margin: 10px 12px;
    padding: 10px 12px;
    gap: 10px;
  }
  .fe-prefill-banner-headline { font-size: 13.5px; }
  .fe-prefill-banner-detail { font-size: 12px; }
}

/* Phase 10 §10.1.3 — Request Engineering Help modal (PRODUCT_PLAN §5.7).
   Backdrop + centered card. Uses the same panel-card visual language
   as the rest of the app via existing CSS variables. */
.rfe-modal[hidden] { display: none; }
.rfe-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.rfe-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}
.rfe-modal-card {
  position: relative;
  background: var(--panel-strong, #fff);
  color: var(--text, #1e293b);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
  max-width: 640px;
  width: 100%;
  padding: 24px 24px 20px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
.rfe-modal-card h2 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.3;
  padding-right: 28px;  /* leave room for × button */
}
.rfe-modal-lede {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted, #64748b);
  margin: 0 0 18px;
}
.rfe-modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted, #64748b);
  padding: 4px 10px;
  border-radius: 6px;
}
.rfe-modal-close:hover {
  background: var(--bg-alt, #f1f5f9);
  color: var(--text, #1e293b);
}
.rfe-form { display: flex; flex-direction: column; gap: 14px; }
.rfe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.rfe-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}
.rfe-field span {
  font-weight: 600;
  color: var(--text, #1e293b);
}
.rfe-field em {
  color: #ef4444;
  font-style: normal;
  font-weight: 700;
}
.rfe-field input,
.rfe-field select,
.rfe-field textarea {
  padding: 7px 10px;
  border: 1px solid var(--border, #dde1e8);
  border-radius: 6px;
  background: var(--input-bg, #fff);
  color: var(--text, #1e293b);
  font-size: 13px;
  font-family: inherit;
}
.rfe-field input:focus,
.rfe-field select:focus,
.rfe-field textarea:focus {
  outline: 2px solid var(--accent, #0f4c81);
  outline-offset: -1px;
}
.rfe-field-full { width: 100%; }
.rfe-snapshot-note {
  font-size: 12px;
  color: var(--muted, #64748b);
  background: var(--accent-soft, rgba(15, 76, 129, 0.06));
  padding: 8px 12px;
  border-radius: 6px;
  border-left: 3px solid var(--accent, #0f4c81);
}
.rfe-liability {
  font-size: 12px;
  color: var(--muted, #64748b);
  border: 1px solid var(--border, #dde1e8);
  border-radius: 6px;
  padding: 6px 10px;
}
.rfe-liability summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text, #1e293b);
}
.rfe-liability p {
  margin: 8px 0 4px;
  line-height: 1.5;
}
.rfe-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.rfe-form-status {
  font-size: 12px;
  color: var(--muted, #64748b);
  margin: 0;
  min-height: 16px;
}
body.rfe-modal-open { overflow: hidden; }
html.dark .rfe-modal-card {
  background: var(--panel-strong, #1e293b);
  color: var(--text, #e2e8f0);
}

/* ============================================================
   RESPONSIVE IMPROVEMENTS
   ============================================================ */

@media (max-width: 640px) {
  .hero {
    flex-direction: column;
    padding: 20px 16px;
    border-radius: 16px;
  }

  .hero-actions {
    min-width: unset;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .hero-actions > button {
    width: auto;
    flex: 1;
    min-width: 100px;
    padding: 10px 12px;
    font-size: 0.85rem;
  }

  .hero h1 {
    font-size: 1.6rem;
  }

  .page-shell {
    padding: 16px 12px 24px;
  }

  .panel-card,
  .branch-card,
  .pump-card {
    border-radius: 14px;
    padding: 16px !important;
  }

  .field-grid.two-up,
  .field-grid.three-up,
  .field-grid.four-up {
    grid-template-columns: 1fr !important;
  }

  .split-field {
    grid-template-columns: 1fr;
  }

  .scroll-top-btn {
    bottom: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
  }

  .breadcrumb {
    font-size: 0.8rem;
  }

  .bep-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .match-card-header {
    flex-direction: column;
    gap: 8px;
  }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */

@media print {
  body {
    background: white !important;
    color: #000 !important;
    font-size: 11pt !important;
  }

  /* Force light theme for print */
  html.dark {
    --bg: #fff !important;
    --panel: #fff !important;
    --text: #000 !important;
    --muted: #444 !important;
    --line: #ccc !important;
  }

  .main-nav,
  .nav-hamburger,
  .upgrade-banner,
  .locked-overlay,
  .primary-btn,
  .secondary-btn,
  .chat-input,
  .nav-logout-form,
  .scroll-top-btn,
  .curve-export-actions,
  .export-toolbar,
  .copy-btn,
  .nav-controls,
  .info-tip,
  .tour-tooltip,
  .toast {
    display: none !important;
  }

  .page-shell,
  .page-wrap {
    padding: 0 !important;
    max-width: 100% !important;
    animation: none !important;
  }

  .panel-card,
  .hero,
  .branch-card,
  .pump-card {
    break-inside: avoid;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    background: white !important;
    margin-bottom: 12pt !important;
  }

  .two-up,
  .three-up,
  .four-up {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .bep-summary-card {
    background: white !important;
    border: 1px solid #ccc !important;
  }

  .js-plotly-plot {
    break-inside: avoid;
  }

  /* Print header */
  .hero h1::after {
    content: " — headlosscalculator.com";
    font-size: 0.6em;
    color: #888;
    font-weight: 400;
  }

  /* Summary box readable in print */
  .summary-box {
    background: #f5f5f5 !important;
    border: 1px solid #ddd !important;
    color: #000 !important;
    font-size: 9pt !important;
  }

  /* Stat tiles */
  .stat-tile {
    border: 1px solid #ddd !important;
    background: #fafafa !important;
  }

  /* Page breaks */
  h2 {
    break-after: avoid;
  }

  section {
    break-inside: avoid;
  }

  /* Branch results print-safe */
  .branch-card {
    break-inside: avoid;
  }

  .branch-vel-badge {
    border-color: #333 !important;
    color: #333 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .branch-bar-seg {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .branch-bar-major { background: #666 !important; }
  .branch-bar-minor { background: #999 !important; }
  .branch-bar-static { background: #bbb !important; }
}

/* ---------- Quick Engineering Presets ---------- */
.presets-bar {
  margin-bottom: 16px;
}

.presets-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.presets-toggle-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.presets-toggle-btn.active {
  border-color: var(--accent);
  border-style: solid;
  color: var(--accent);
  background: var(--accent-soft);
}

.presets-toggle-btn .presets-chevron {
  transition: transform 0.2s;
}

.presets-toggle-btn.active .presets-chevron {
  transform: rotate(180deg);
}

.presets-panel {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  animation: fadeInUp 0.2s ease-out;
}

.presets-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.preset-group h3 {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.preset-btn {
  display: block;
  width: 100%;
  padding: 8px 12px;
  margin-bottom: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.preset-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateX(2px);
}

.preset-btn.preset-applied {
  border-color: var(--success);
  background: rgba(31, 138, 112, 0.1);
  color: var(--success);
}

/* Dark mode presets */
html.dark .presets-panel {
  background: rgba(20, 28, 40, 0.4);
  border-color: rgba(100, 120, 150, 0.2);
}

html.dark .preset-btn {
  background: rgba(30, 40, 55, 0.5);
  border-color: rgba(100, 120, 150, 0.2);
}

html.dark .preset-btn:hover {
  background: rgba(15, 76, 129, 0.2);
  border-color: var(--accent);
}

html.dark .presets-toggle-btn {
  border-color: rgba(100, 120, 150, 0.3);
}

html.dark .preset-group h3 {
  color: #64b5f6;
}

@media (max-width: 640px) {
  .presets-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Dashboard Card ---------- */
.dashboard-card {
  border-left: 3px solid var(--accent);
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dashboard-header h2 {
  margin: 0;
  font-size: 1rem;
}

.dashboard-collapse-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--muted);
  transition: transform 0.2s;
}

.dashboard-collapse-btn.collapsed .dashboard-chevron {
  transform: rotate(-90deg);
}

.dashboard-body {
  margin-top: 12px;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.dash-stat {
  text-align: center;
  padding: 10px 6px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--line);
}

.dash-stat-value {
  display: block;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

.dash-stat-label {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.dashboard-recent {
  font-size: 0.82rem;
  color: var(--muted);
}

.dash-recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.dash-recent-item:hover {
  background: var(--accent-soft);
}

.dash-recent-name {
  font-weight: 500;
  color: var(--text);
}

.dash-recent-meta {
  font-size: 0.75rem;
}

/* Dark mode dashboard */
html.dark .dashboard-card {
  border-left-color: #64b5f6;
}

html.dark .dash-stat {
  background: rgba(20, 28, 40, 0.4);
  border-color: rgba(100, 120, 150, 0.2);
}

html.dark .dash-stat-value {
  color: #64b5f6;
}

html.dark .dash-recent-item:hover {
  background: rgba(15, 76, 129, 0.2);
}

@media (max-width: 640px) {
  .dashboard-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Table Scroll Wrapper (narrow screens) ── */
.table-scroll-wrap {
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-scroll-wrap::after {
  content: "Scroll →";
  display: none;
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 0.7rem;
  color: var(--text-dim, #7f8c9b);
  background: rgba(255,255,255,0.85);
  padding: 2px 8px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 2;
}

html.dark .table-scroll-wrap::after {
  background: rgba(20,28,40,0.85);
  color: #8899aa;
}

@media (max-width: 768px) {
  .table-scroll-wrap.has-overflow::after {
    display: block;
  }
}

/* ── Responsive improvements for secondary pages ── */
@media (max-width: 640px) {
  .ww-kv-grid, .fa-kv-grid {
    grid-template-columns: 1fr;
  }
  .ww-rec-card, .fa-rec-card {
    padding: 0.75rem;
  }
  .ww-badge, .fa-badge, .ww-badge-success, .ww-badge-warning, .ww-badge-danger,
  .fa-badge-ok, .fa-badge-slow, .fa-badge-fast {
    font-size: 0.7rem;
    padding: 2px 6px;
  }
  .ww-section h3, .fa-section h3 {
    font-size: 1rem;
  }
}

/* ── Accessibility: pattern + label for color badges ── */
.ww-badge-success::before, .fa-badge-ok::before { content: "✓ "; }
.ww-badge-warning::before, .fa-badge-slow::before { content: "⚠ "; }
.ww-badge-danger::before, .fa-badge-fast::before { content: "✕ "; }

/* ── Print styles for secondary pages ── */
@media print {
  .ww-calculate-btn, .fa-calculate-btn, #ww-copy-results, #fa-copy-results,
  .fa-integration-section, .scroll-top-btn, .nav-container,
  .hamburger-btn, .theme-toggle, .font-controls {
    display: none !important;
  }
  .ww-section, .fa-section {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .table-scroll-wrap::after {
    display: none !important;
  }
}

/* ── Sensitivity Analysis Panel ── */
.sensitivity-panel {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  animation: fadeSlideUp 0.3s ease-out;
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.sensitivity-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.sensitivity-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
}

.sensitivity-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: #94a3b8;
  padding: 2px 6px;
  border-radius: 4px;
}

.sensitivity-close:hover {
  background: var(--line, #e2e8f0);
  color: var(--heading, #475569);
}

.sensitivity-results {
  margin-top: 0.75rem;
}

.sensitivity-results table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.sensitivity-results th {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 2px solid var(--line, #e2e8f0);
  font-weight: 600;
  color: var(--heading, #475569);
}

.sensitivity-results td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--bg-alt, #f1f5f9);
}

.sensitivity-results .sa-increase { color: var(--signal, #dc2626); }
.sensitivity-results .sa-decrease { color: var(--success, #16a34a); }
.sensitivity-results .sa-baseline { font-weight: 600; background: var(--accent-soft, #f0f9ff); }

html.dark .sensitivity-panel {
  background: rgba(20, 28, 40, 0.5);
  border-color: rgba(100, 120, 150, 0.2);
}

html.dark .sensitivity-header h3 { color: #c8d6e5; }
html.dark .sensitivity-close { color: #64748b; }
html.dark .sensitivity-close:hover { background: rgba(100, 120, 150, 0.2); color: #94a3b8; }
html.dark .sensitivity-results th { color: #8899aa; border-color: rgba(100, 120, 150, 0.2); }
html.dark .sensitivity-results td { border-color: rgba(100, 120, 150, 0.1); }
html.dark .sensitivity-results .sa-baseline { background: rgba(15, 76, 129, 0.15); }
html.dark .sensitivity-results .sa-increase { color: #ef4444; }
html.dark .sensitivity-results .sa-decrease { color: #22c55e; }

/* ============================================================
   KEYBOARD SHORTCUTS MODAL
   ============================================================ */
.shortcuts-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}

.shortcuts-modal {
  background: #ffffff;
  border-radius: 12px;
  padding: 24px 28px;
  width: 380px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  animation: slideUp 0.2s ease;
}

.shortcuts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.shortcuts-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--heading, #1e293b);
}

.shortcuts-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shortcut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
}

.shortcut-row kbd {
  background: var(--bg-alt, #f1f5f9);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 6px;
  padding: 4px 10px;
  font-family: "SF Mono", "Consolas", "Monaco", monospace;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--heading, #475569);
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.shortcut-row span {
  color: var(--muted, #64748b);
  font-size: 0.85rem;
}

/* Dark mode */
html.dark .shortcuts-modal {
  background: #1a2332;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

html.dark .shortcuts-header h3 { color: #c8d6e5; }

html.dark .shortcut-row kbd {
  background: rgba(100, 120, 150, 0.15);
  border-color: rgba(100, 120, 150, 0.25);
  color: #b0c4de;
}

html.dark .shortcut-row span { color: #8899aa; }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   COMPARE TABLE DARK MODE (matching page)
   ============================================================ */
html.dark .compare-table td {
  color: #b0c4de;
  border-color: rgba(100, 120, 150, 0.12);
}

/* ============================================================
   SHORTCUT HINT INLINE
   ============================================================ */
.shortcut-hint {
  font-size: 0.75rem;
  color: var(--muted);
  opacity: 0.7;
  white-space: nowrap;
}

.shortcut-hint kbd {
  background: var(--bg-alt, #f1f5f9);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: "SF Mono", "Consolas", monospace;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--heading, #475569);
}

html.dark .shortcut-hint kbd {
  background: rgba(100, 120, 150, 0.15);
  border-color: rgba(100, 120, 150, 0.25);
  color: #8899aa;
}

/* ============================================================
   CHART TOOLBAR
   ============================================================ */
.chart-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  /* Shrunk 6px 10px → 3px 8px to keep more height for the chart. */
  padding: 3px 8px;
  margin-bottom: 2px;
  background: var(--panel, #f8fafc);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 8px;
  font-size: 0.75rem;
  flex-wrap: wrap;
  animation: fadeIn 0.3s ease;
}

.chart-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
  color: var(--heading, #475569);
  font-weight: 500;
}

.chart-toggle input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}

.chart-tool-btn {
  background: none;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 0.75rem;
  color: var(--accent);
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}

.chart-tool-btn:hover {
  background: rgba(15, 76, 129, 0.06);
  border-color: var(--accent);
}

html.dark .chart-toolbar {
  background: rgba(20, 28, 40, 0.5);
  border-color: rgba(100, 120, 150, 0.2);
}

html.dark .chart-toggle { color: #8899aa; }

html.dark .chart-tool-btn {
  border-color: rgba(100, 120, 150, 0.25);
  color: var(--accent);
}

html.dark .chart-tool-btn:hover {
  background: rgba(77, 163, 255, 0.1);
}

.chart-tool-btn.copied,
.toolbar-btn.copied {
  color: var(--success);
  border-color: var(--success);
}

/* Energy settings popover */
.energy-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: var(--panel, #ffffff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  animation: fadeIn 0.15s ease;
}

.energy-popover-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.energy-popover-inner label {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--heading, #475569);
  font-weight: 500;
}

.energy-popover-inner input {
  padding: 3px 6px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 4px;
  font-size: 0.78rem;
  text-align: center;
}

html.dark .energy-popover {
  background: #1a2332;
  border-color: rgba(100, 120, 150, 0.25);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

html.dark .energy-popover-inner label { color: #8899aa; }
html.dark .energy-popover-inner input {
  background: rgba(100, 120, 150, 0.1);
  border-color: rgba(100, 120, 150, 0.25);
  color: #b0c4de;
}

/* Dashboard sparkline */
.dashboard-sparkline {
  margin: 8px 0 4px;
  border-radius: 6px;
  overflow: hidden;
}

/* Head loss breakdown responsive */
@media (max-width: 768px) {
  #headloss-breakdown-card > div:first-of-type {
    grid-template-columns: 1fr !important;
  }
}

/* Scenario notes textarea dark mode */
html.dark .scenario-notes-textarea {
  background: rgba(15, 20, 30, 0.5);
  color: var(--text);
  border-color: rgba(100, 120, 150, 0.3);
}
html.dark .scenario-card {
  background: rgba(20, 28, 40, 0.65);
}

/* Site footer */
.site-footer {
  margin-top: 60px;
  padding: 32px 24px 24px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
}

.footer-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-links a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.footer-links a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.footer-copy {
  margin: 4px 0 0;
  font-size: 12px;
  opacity: 0.7;
}

/* Scroll-to-top button */
.scroll-to-top {
  position: fixed;
  /* Sits above the .curve-tab-btn (bottom:22 + height ~45 = clear at 80).
     Previously bottom:28 caused this circular FAB to overlay the right
     edge of the "Open System and Pump Curves" button, clipping its
     text to "...Pump Cu..." in screenshots. */
  bottom: 80px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.25s, visibility 0.25s, transform 0.25s, background 0.15s;
  z-index: 9000;
}
.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.scroll-to-top:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.scroll-to-top svg { pointer-events: none; }
html.dark .scroll-to-top {
  background: rgba(30,40,55,0.9);
  border-color: rgba(100,120,150,0.3);
  color: var(--accent);
}
html.dark .scroll-to-top:hover {
  background: var(--accent);
  color: #fff;
}

/* View in Catalog link on match cards */
.match-catalog-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  margin-top: 6px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--accent-soft);
  transition: background 0.15s, color 0.15s;
}
.match-catalog-link:hover {
  background: var(--accent);
  color: #fff;
}
html.dark .match-catalog-link {
  background: rgba(15,76,129,0.2);
  color: #6db3f2;
}
html.dark .match-catalog-link:hover {
  background: var(--accent);
  color: #fff;
}

/* Matching save/load buttons row */
.match-actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* Pagination controls */
.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 8px 0;
}
.pagination-controls button {
  padding: 6px 14px;
  font-size: 13px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.pagination-controls button:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.pagination-controls button:disabled {
  opacity: 0.4;
  cursor: default;
}
.pagination-controls .page-info {
  font-size: 13px;
  color: var(--muted);
}
html.dark .pagination-controls button {
  background: rgba(30,40,55,0.6);
  border-color: rgba(100,120,150,0.3);
  color: var(--text);
}
html.dark .pagination-controls button:hover:not(:disabled) {
  background: rgba(15,76,129,0.3);
  border-color: var(--accent);
}

/* Active filter chips */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--accent-soft);
  border: 1px solid rgba(15,76,129,0.15);
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 16px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
}
.filter-chip .chip-close {
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: var(--muted);
  margin-left: 2px;
  border: none;
  background: none;
  padding: 0 2px;
}
.filter-chip .chip-close:hover {
  color: var(--signal);
}
html.dark .active-filters {
  background: rgba(15,76,129,0.15);
  border-color: rgba(100,120,150,0.2);
}
html.dark .filter-chip {
  background: rgba(30,40,55,0.7);
  border-color: rgba(100,120,150,0.3);
}

/* Enhanced empty states */
.empty-state-enhanced {
  text-align: center;
  padding: 40px 24px;
  color: var(--muted);
}
.empty-state-enhanced .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}
.empty-state-enhanced h3 {
  font-size: 18px;
  color: var(--text);
  margin-bottom: 8px;
  font-weight: 600;
}
.empty-state-enhanced p {
  font-size: 14px;
  line-height: 1.5;
  max-width: 400px;
  margin: 0 auto 16px;
}
.empty-state-enhanced .empty-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 320px;
  margin: 0 auto;
  text-align: left;
}
.empty-state-enhanced .empty-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
}
.empty-state-enhanced .step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
html.dark .empty-state-enhanced .step-num {
  background: rgba(15,76,129,0.25);
  color: #6db3f2;
}

/* Best-fit badges */
.best-fit-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.best-fit-badge.best-eff { background: #e6f6f0; color: #0d6e3f; }
.best-fit-badge.best-npsh { background: #e8f0fe; color: #1a56db; }
.best-fit-badge.best-overall { background: #fef3cd; color: #856404; }
.best-fit-badge.best-motor { background: #f0e6ff; color: #6b21a8; }
html.dark .best-fit-badge.best-eff { background: rgba(13,110,63,0.2); color: #34d399; }
html.dark .best-fit-badge.best-npsh { background: rgba(26,86,219,0.2); color: #6db3f2; }
html.dark .best-fit-badge.best-overall { background: rgba(212,160,23,0.2); color: #fbbf24; }
html.dark .best-fit-badge.best-motor { background: rgba(107,33,168,0.2); color: #c084fc; }

/* Matching results summary bar */
.match-summary-bar {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--accent-soft);
  border-radius: 8px;
  margin-bottom: 16px;
  border: 1px solid rgba(15,76,129,0.12);
}
.match-summary-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.match-summary-stat .stat-val {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}
.match-summary-stat .stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
html.dark .match-summary-bar {
  background: rgba(15,76,129,0.12);
  border-color: rgba(100,120,150,0.2);
}
html.dark .match-summary-stat .stat-val {
  color: #6db3f2;
}

/* Score breakdown tooltips */
.score-breakdown-tip {
  position: relative;
  cursor: help;
}
.score-breakdown-tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text, #132238);
  color: var(--panel-strong, #fff);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 100;
  max-width: 240px;
  text-align: center;
  line-height: 1.4;
}
.score-breakdown-tip:hover::after {
  opacity: 1;
}

/* Pump type capability bars (pump selector) */
.ps-capability-chart {
  margin-top: 20px;
  padding: 16px;
  background: var(--panel);
  border-radius: 8px;
  border: 1px solid var(--line);
}
.ps-capability-chart h3 {
  font-size: 14px;
  margin-bottom: 12px;
  color: var(--text);
}
.ps-cap-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.ps-cap-label {
  width: 140px;
  font-size: 12px;
  color: var(--text);
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ps-cap-bar-wrap {
  flex: 1;
  height: 18px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.ps-cap-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
  display: flex;
  align-items: center;
  padding-left: 6px;
}
.ps-cap-bar span {
  font-size: 10px;
  font-weight: 600;
  color: #fff;
}
.ps-cap-score {
  font-size: 12px;
  font-weight: 600;
  width: 32px;
  text-align: right;
  color: var(--muted);
}
html.dark .ps-capability-chart {
  background: rgba(30,40,55,0.5);
  border-color: rgba(100,120,150,0.2);
}
html.dark .ps-cap-bar-wrap {
  background: rgba(20,30,45,0.6);
}

/* Pump selector results copy/print toolbar */
.ps-results-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

/* Design checklist */
.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  border-left: 3px solid var(--line);
}
.check-item.check-pass {
  background: rgba(16,185,129,0.06);
  border-left-color: #10b981;
}
.check-item.check-warn {
  background: rgba(212,160,23,0.06);
  border-left-color: #d4a017;
}
.check-item.check-fail {
  background: rgba(239,68,68,0.06);
  border-left-color: #ef4444;
}
/* iter-36 fix #45: status="info" is a neutral characterization
   (e.g. "Static-dominant system"), NOT a failure. Distinct from
   pass/warn/fail with a calm blue tint and italic label so users
   read it as commentary, not an alarm. */
.check-item.check-info {
  background: rgba(59,130,246,0.06);
  border-left-color: #3b82f6;
}
.check-info .check-label { font-style: italic; }
.check-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.check-pass .check-icon { background: var(--success); color: #fff; }
.check-warn .check-icon { background: var(--warning); color: #fff; }
.check-fail .check-icon { background: var(--signal); color: #fff; }
.check-info .check-icon { background: #3b82f6; color: #fff; font-style: italic; font-family: serif; }
.check-label { flex: 1; }
.check-value { font-weight: 600; font-size: 12px; }
html.dark .check-item.check-pass { background: rgba(16,185,129,0.08); }
html.dark .check-item.check-warn { background: rgba(212,160,23,0.08); }
html.dark .check-item.check-fail { background: rgba(239,68,68,0.08); }
html.dark .check-item.check-info { background: rgba(59,130,246,0.10); }

/* ---------- Matching Auto-Fill Banner ---------- */
.match-autofill-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(15,76,129,0.08), rgba(59,130,246,0.06));
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--text);
  animation: slideDown 0.3s ease;
}
.autofill-banner-icon { font-size: 20px; flex-shrink: 0; }
.autofill-banner-text { flex: 1; line-height: 1.5; }
.autofill-dismiss {
  background: none; border: none; font-size: 18px; cursor: pointer;
  color: var(--muted); padding: 0 4px; opacity: 0.5;
}
.autofill-dismiss:hover { opacity: 1; }
html.dark .match-autofill-banner {
  background: linear-gradient(135deg, rgba(59,130,246,0.12), rgba(15,76,129,0.08));
  border-color: rgba(59,130,246,0.25);
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Pump Selector Action Grid ---------- */
.ps-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0;
}
.ps-action-btn {
  text-align: center !important;
  text-decoration: none !important;
  font-size: 13px !important;
  padding: 10px 8px !important;
  display: block;
}
.ps-rec-note {
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 0;
}
@media (max-width: 500px) {
  .ps-action-grid { grid-template-columns: 1fr; }
}

/* ---------- Smart Flow Design Guidance ---------- */
.flow-design-guidance {
  background: linear-gradient(135deg, rgba(15,76,129,0.06), rgba(59,130,246,0.04));
  border: 1px solid rgba(59,130,246,0.15);
  border-radius: 6px;
  padding: 6px 10px;
  margin: 4px 0 8px 0;
  font-size: 11px;
  color: var(--text);
  animation: fadeIn 0.2s ease;
}
.guidance-content {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.guidance-tip { white-space: nowrap; }
.guidance-sep { color: var(--muted); font-size: 8px; }
html.dark .flow-design-guidance {
  background: linear-gradient(135deg, rgba(59,130,246,0.08), rgba(15,76,129,0.05));
  border-color: rgba(59,130,246,0.2);
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- TDH Composition Bar ---------- */
.tdh-composition-bar {
  margin: 12px 0 4px 0;
  padding: 10px 14px;
  background: var(--panel);
  border-radius: 8px;
  border: 1px solid var(--line);
}
.tdh-bar-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tdh-bar-track {
  display: flex;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--line);
}
.tdh-bar-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  transition: width 0.4s ease;
}
.tdh-bar-segment span {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.tdh-static { background: #3b82f6; }
.tdh-major { background: #f59e0b; }
.tdh-minor { background: #8b5cf6; }
.tdh-bar-legend {
  display: flex;
  gap: 16px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.tdh-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}
.tdh-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
.tdh-legend-dot.tdh-static { background: #3b82f6; }
.tdh-legend-dot.tdh-major { background: #f59e0b; }
.tdh-legend-dot.tdh-minor { background: #8b5cf6; }
html.dark .tdh-composition-bar { background: rgba(20,28,40,0.5); border-color: rgba(100,120,150,0.2); }
html.dark .tdh-bar-track { background: rgba(255,255,255,0.08); }

/* ---------- Branch Live Preview ---------- */
.branch-live-preview {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 6px 12px;
  border-radius: 0 6px 6px 0;
  margin: 8px 0 4px 0;
  font-size: 12px;
  color: var(--text);
  transition: all 0.2s;
}
.branch-preview-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.preview-item { white-space: nowrap; }
.preview-sep { color: var(--muted); font-size: 10px; }
.preview-ok strong { color: var(--success); }
.preview-low strong { color: var(--warning); }
.preview-high strong { color: var(--signal); }
html.dark .branch-live-preview {
  background: rgba(15,76,129,0.15);
  border-left-color: #3b82f6;
}

/* ---------- Digitizer Validation Warnings ---------- */
.digi-validation-warnings {
  margin-top: 10px;
  border-radius: 8px;
  overflow: hidden;
}
.digi-validation-ok {
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.25);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  color: #16a34a;
  display: flex;
  align-items: center;
  gap: 8px;
}
.digi-val-title {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 6px 0;
  color: var(--text);
}
.digi-val-item {
  padding: 6px 10px;
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.digi-val-warn {
  background: rgba(217,119,6,0.08);
  border: 1px solid rgba(217,119,6,0.2);
  color: #92400e;
}
.digi-val-error {
  background: rgba(220,38,38,0.08);
  border: 1px solid rgba(220,38,38,0.2);
  color: #b91c1c;
}
.digi-val-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.digi-validation-ok .digi-val-icon { background: #10b981; color: #fff; }
.digi-val-warn .digi-val-icon { background: #d97706; color: #fff; }
.digi-val-error .digi-val-icon { background: #dc2626; color: #fff; }

html.dark .digi-validation-ok { background: rgba(16,185,129,0.12); color: #34d399; border-color: rgba(16,185,129,0.3); }
html.dark .digi-val-warn { background: rgba(217,119,6,0.12); color: #fbbf24; border-color: rgba(217,119,6,0.25); }
html.dark .digi-val-error { background: rgba(220,38,38,0.12); color: #f87171; border-color: rgba(220,38,38,0.25); }
html.dark .digi-val-title { color: #c8d6e5; }

/* ---------- R² Confidence Bar ---------- */
.r2-display {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}
.r2-value { font-weight: 700; font-size: 14px; }
.r2-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.r2-bar-wrap {
  position: relative;
  height: 8px;
  background: var(--line);
  border-radius: 4px;
  overflow: visible;
  margin-bottom: 8px;
}
.r2-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
  min-width: 2px;
}
.r2-markers { position: absolute; top: 0; left: 0; right: 0; height: 100%; }
.r2-marker {
  position: absolute;
  top: -3px;
  width: 1px;
  height: 14px;
  background: var(--muted);
  opacity: 0.4;
}
html.dark .r2-bar-wrap { background: rgba(255,255,255,0.1); }
html.dark .r2-marker { background: rgba(255,255,255,0.3); }

/* ---------- Interpolation Table ---------- */
.digi-interpolation {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.interp-title {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 6px 0;
  color: var(--text);
}
.interp-count { font-weight: 400; color: var(--muted); font-size: 11px; }
.interp-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}
.interp-table th {
  text-align: left;
  padding: 4px 8px;
  background: var(--accent-soft);
  font-weight: 600;
  font-size: 11px;
}
.interp-table td {
  padding: 3px 8px;
  border-bottom: 1px solid var(--line);
}
.interp-table tr:nth-child(even) td { background: rgba(0,0,0,0.02); }
html.dark .interp-title { color: #c8d6e5; }
html.dark .interp-table th { background: rgba(15,76,129,0.2); }
html.dark .interp-table td { border-bottom-color: rgba(255,255,255,0.06); }
html.dark .interp-table tr:nth-child(even) td { background: rgba(255,255,255,0.02); }

/* ---------- Branch Loss Visual Bars ---------- */
.branch-loss-visual {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.branch-visual-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.branch-bar-section { flex: 1; min-width: 0; }
.branch-bar-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 4px;
}
.branch-bar-track {
  display: flex;
  height: 22px;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(0,0,0,0.04);
}
.branch-bar-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  transition: width 0.4s ease;
  min-width: 2px;
}
.branch-bar-major { background: #f59e0b; }
.branch-bar-minor { background: #8b5cf6; }
.branch-bar-legend {
  display: flex;
  gap: 12px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text);
}
.branch-bar-legend span { display: flex; align-items: center; gap: 4px; }
.branch-bar-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}
.branch-vel-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px solid;
  border-radius: 10px;
  padding: 6px 10px;
  min-width: 56px;
  flex-shrink: 0;
  transition: border-color 0.3s, color 0.3s;
}
.branch-vel-icon { font-size: 12px; line-height: 1; }
.branch-vel-val { font-size: 16px; font-weight: 700; line-height: 1.2; }
.branch-vel-unit { font-size: 9px; text-transform: uppercase; opacity: 0.7; }
html.dark .branch-loss-visual { border-top-color: rgba(255,255,255,0.08); }
html.dark .branch-bar-track { background: rgba(255,255,255,0.06); }
html.dark .branch-bar-legend { color: #c8d6e5; }

/* ---------- Pipe Size Compare Table ---------- */
.pipe-size-compare {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-top: 12px;
}
.psc-header { margin-bottom: 8px; }
.psc-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: block;
}
.psc-subtitle {
  font-size: 11px;
  color: var(--muted);
}
.psc-table-wrap { overflow-x: auto; }
.psc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.psc-table th {
  text-align: left;
  padding: 6px 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
.psc-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.psc-table tr:hover td { background: rgba(59,130,246,0.04); }
.psc-current td {
  background: rgba(59,130,246,0.08) !important;
  font-weight: 600;
}
.psc-current td:first-child::after {
  content: " ◀ current";
  font-size: 9px;
  font-weight: 400;
  color: var(--accent, #2563eb);
  margin-left: 4px;
}
.psc-optimal td {
  background: rgba(16,185,129,0.06) !important;
}
.psc-optimal td:first-child::after {
  content: " ★ optimal";
  font-size: 9px;
  font-weight: 400;
  color: #059669;
  margin-left: 4px;
}
.psc-current.psc-optimal td:first-child::after {
  content: " ◀ current ★ optimal";
}
.psc-vel {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 11px;
}
/* Iter-218 #241: 4-zone velocity classification matches canonical
   scheme used by 9+ surfaces (gauge, branch, scorecard, etc.).
   Sediment: blue (was orange — drift). Elevated: amber (NEW tier). */
.psc-vel-ok   { background: rgba(16,185,129,0.12); color: var(--success); }   /* Optimal — green */
.psc-vel-low  { background: rgba(59,130,246,0.12); color: #2563eb; }          /* Sediment — blue */
.psc-vel-warn { background: rgba(245,158,11,0.12); color: #d97706; }          /* Elevated — amber */
.psc-vel-high { background: rgba(220,38,38,0.12); color: var(--signal); }     /* Severe — red */
html.dark .pipe-size-compare { background: rgba(20,28,40,0.5); border-color: rgba(100,120,150,0.2); }
html.dark .psc-vel-ok   { background: rgba(52,211,153,0.15); }
html.dark .psc-vel-low  { background: rgba(96,165,250,0.18); color: #93c5fd; }
html.dark .psc-vel-warn { background: rgba(251,191,36,0.18); color: #fbbf24; }
html.dark .psc-vel-high { background: rgba(240,96,112,0.15); }
html.dark .psc-table th { border-bottom-color: rgba(255,255,255,0.1); }
html.dark .psc-table td { border-bottom-color: rgba(255,255,255,0.06); }
html.dark .psc-table tr:hover td { background: rgba(59,130,246,0.08); }
html.dark .psc-current td { background: rgba(59,130,246,0.15) !important; }

/* ---------- Scenario Compare Chart ---------- */
.scenario-compare-chart-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-top: 10px;
}
.scenario-compare-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.scenario-compare-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.scenario-compare-close {
  font-size: 18px;
  padding: 0 4px;
}
html.dark .scenario-compare-chart-wrap {
  background: rgba(20,28,40,0.5);
  border-color: rgba(100,120,150,0.2);
}

/* ---------- Calc Auto-Fill Banner ---------- */
.calc-autofill-banner {
  background: linear-gradient(135deg, rgba(59,130,246,0.08), rgba(139,92,246,0.06));
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 8px;
  margin-bottom: 12px;
  animation: slideDown 0.3s ease;
}
.autofill-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
}
.autofill-icon { font-size: 16px; }
.autofill-text { flex: 1; font-size: 13px; color: var(--text); }
.autofill-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.autofill-close:hover { color: var(--text); }
html.dark .calc-autofill-banner {
  background: linear-gradient(135deg, rgba(59,130,246,0.12), rgba(139,92,246,0.08));
  border-color: rgba(59,130,246,0.25);
}

/* ---------- Flow Analysis Hero Card ---------- */
.fa-hero-card {
  background: linear-gradient(135deg, rgba(15,76,129,0.06), rgba(59,130,246,0.04));
  border: 1px solid rgba(15,76,129,0.15);
  border-radius: 10px;
  padding: 18px 20px;
}
.fa-hero-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent, #0f4c81);
  margin-bottom: 14px;
}
.fa-hero-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.fa-hero-metric {
  text-align: center;
  padding: 10px 6px;
  background: var(--bg, #fff);
  border-radius: 8px;
  border: 1px solid rgba(15,76,129,0.08);
  transition: transform 0.15s;
}
.fa-hero-metric:hover { transform: translateY(-1px); }
.fa-hero-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent, #0f4c81);
  line-height: 1.2;
}
.fa-hero-label {
  font-size: 10px;
  color: var(--muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}
.fa-vel-ok { color: var(--success); }
.fa-vel-warn { color: var(--warning); }
.fa-vel-low { color: var(--accent); }
.fa-vel-high { color: var(--signal); }

html.dark .fa-hero-card {
  background: linear-gradient(135deg, rgba(15,76,129,0.15), rgba(59,130,246,0.08));
  border-color: rgba(59,130,246,0.2);
}
html.dark .fa-hero-metric {
  background: rgba(20,28,40,0.6);
  border-color: rgba(100,120,150,0.15);
}
html.dark .fa-hero-value { color: #60a5fa; }
/* fa-vel-* colors now use CSS variables that auto-adapt to dark mode */

/* ---------- Water Hammer Assessment ---------- */
.fa-wh-header {
  margin-bottom: 12px;
}

/* ---------- Collapsible Tool Sections ---------- */
.tool-section {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel);
}

.tool-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  cursor: pointer;
  user-select: none;
  background: linear-gradient(135deg, var(--accent-soft), transparent);
  border-bottom: 1px solid transparent;
  transition: background 0.2s;
}

.tool-section-header:hover {
  background: var(--accent-soft);
}

.tool-section-header h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-section-header .section-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 10px;
}

.tool-section-header .section-chevron {
  transition: transform 0.3s ease;
  color: var(--muted);
  flex-shrink: 0;
}

.tool-section.collapsed .section-chevron {
  transform: rotate(-90deg);
}

.tool-section-body {
  padding: 0;
  transition: max-height 0.35s ease, opacity 0.25s ease;
  overflow: hidden;
}

.tool-section.collapsed .tool-section-body {
  max-height: 0 !important;
  opacity: 0;
  padding: 0;
}

.tool-section:not(.collapsed) .tool-section-body {
  opacity: 1;
  padding: 12px;
}

.tool-section:not(.collapsed) .tool-section-header {
  border-bottom: 1px solid var(--line);
}

.tool-section-body > .panel-card {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  box-shadow: none;
}

.tool-section-body > .panel-card:last-child {
  margin-bottom: 0;
}

html.dark .tool-section {
  border-color: rgba(255,255,255,0.1);
}

html.dark .tool-section-header {
  background: linear-gradient(135deg, rgba(59,130,246,0.1), transparent);
}

html.dark .tool-section-header:hover {
  background: rgba(59,130,246,0.15);
}

html.dark .tool-section-header h2 {
  color: #93c5fd;
}

html.dark .tool-section-header .section-count {
  background: rgba(255,255,255,0.08);
  color: #94a3b8;
}

html.dark .tool-section-body > .panel-card {
  border-color: rgba(255,255,255,0.08);
}

@media (max-width: 640px) {
  .fa-hero-grid { grid-template-columns: repeat(2, 1fr); }
  .match-summary-bar { flex-direction: column; gap: 8px; }
  .ps-cap-label { width: 100px; font-size: 11px; }
  .empty-state-enhanced { padding: 24px 16px; }
  .best-fit-badge { font-size: 9px; }
  .branch-preview-row { font-size: 11px; }
  .branch-visual-row { flex-direction: column; gap: 8px; }
  .branch-vel-badge { flex-direction: row; gap: 6px; padding: 4px 10px; }
  .tool-section-header { padding: 12px 14px; }
  .tool-section-header h2 { font-size: 13px; }
}

/* ============================================================
   SCENARIO COMPARISON HEATMAP
   ============================================================ */
.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 10px 14px;
  background: var(--accent-soft);
  border-radius: 10px;
  font-size: 0.8rem;
  color: var(--text);
}

.heatmap-legend-title {
  font-weight: 700;
  font-size: 0.82rem;
}

.heatmap-legend-scale {
  display: flex;
  align-items: center;
  gap: 6px;
}

.heatmap-legend-gradient {
  width: 120px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.heatmap-legend-label {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}

.heatmap-legend-note {
  font-size: 0.75rem;
  color: var(--muted);
  font-style: italic;
}

.heatmap-best-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.heatmap-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--panel);
}

.heatmap-badge-icon {
  font-size: 1rem;
}

.heatmap-badge-label {
  color: var(--muted);
  font-weight: 500;
}

.heatmap-badge-value {
  color: var(--accent);
}

html.dark .heatmap-legend {
  background: rgba(77, 163, 255, 0.08);
}

html.dark .heatmap-badge {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

html.dark .heatmap-badge-value {
  color: #7ab8ff;
}

@media (max-width: 640px) {
  .heatmap-legend {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* ============================================================
   COOKIE CONSENT BANNER
   ============================================================ */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  background: var(--panel-strong);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 24px rgba(15, 38, 64, 0.10);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  animation: cookieSlideUp 0.35s ease-out;
}

@keyframes cookieSlideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.cookie-banner-text {
  font-size: 0.88rem;
  color: var(--text);
  max-width: 680px;
  line-height: 1.5;
}

.cookie-banner-text a {
  color: var(--accent);
  text-decoration: underline;
  font-weight: 600;
}

.cookie-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.cookie-accept-btn {
  padding: 8px 20px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.cookie-accept-btn:hover {
  background: #0d3d68;
}

html.dark .cookie-accept-btn:hover {
  background: #1a6ab5;
}

.cookie-dismiss-btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 0.84rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.cookie-dismiss-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

html.dark .cookie-banner {
  background: #1a2332;
  border-color: rgba(255,255,255,0.08);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.3);
}

html.dark .cookie-dismiss-btn {
  border-color: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.6);
}

html.dark .cookie-dismiss-btn:hover {
  background: rgba(77,163,255,0.12);
  border-color: rgba(77,163,255,0.3);
  color: #7ab8ff;
}

@media (max-width: 640px) {
  .cookie-banner {
    flex-direction: column;
    text-align: center;
    padding: 14px 16px;
    gap: 12px;
  }
  .cookie-banner-actions {
    width: 100%;
    justify-content: center;
  }
}

/* ───────────────────────────────────────────────────────────────
   Utility & Component Classes (extracted from inline styles)
   ─────────────────────────────────────────────────────────────── */

/* Chart containers — full-width with standard height variants */
.chart-container       { width: 100%; }
.chart-h220            { width: 100%; height: 220px; }
.chart-h260            { width: 100%; height: 260px; }
.chart-h300            { width: 100%; height: 300px; }
.chart-h320            { width: 100%; height: 320px; }
.chart-h350            { width: 100%; height: 350px; }
.chart-h370            { width: 100%; height: 370px; }
.chart-h400            { width: 100%; min-height: 400px; }
.chart-h560            { width: 100%; height: 560px; }

/* Full-width button variant */
.full-width-btn        { width: 100%; }

/* Flex row with gap */
.flex-row              { display: flex; gap: 8px; }
.flex-row-wrap         { display: flex; gap: 8px; flex-wrap: wrap; }

/* Spacing utilities */
.mb-0                  { margin-bottom: 0; }
.mb-xs                 { margin-bottom: 4px; }
.mb-sm                 { margin-bottom: 8px; }
.mb-md                 { margin-bottom: 10px; }
.mb-lg                 { margin-bottom: 12px; }
.mb-xl                 { margin-bottom: 16px; }
.mt-sm                 { margin-top: 8px; }
.mt-md                 { margin-top: 10px; }
.mt-lg                 { margin-top: 12px; }
.mt-xl                 { margin-top: 16px; }
.mt-2xl                { margin-top: 20px; }

/* Text utilities */
.text-xs               { font-size: 0.75rem; }
.text-sm               { font-size: 0.8rem; }
.text-base             { font-size: 0.85rem; }
.text-muted            { color: var(--muted); }
.text-center           { text-align: center; }
.text-bold             { font-weight: 700; }
.text-semibold         { font-weight: 600; }
.fw-mono               { font-family: monospace; }
.no-decoration         { text-decoration: none; }

/* Headloss breakdown layout — side-by-side charts */
.headloss-breakdown-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 12px;
  align-items: start;
}

/* What-If Analysis card */
.whatif-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 12px;
}
.whatif-sliders {
  display: grid;
  gap: 12px;
}
.whatif-slider-label {
  display: block;
}
.whatif-slider-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}
.whatif-slider-val {
  font-weight: 700;
}
.whatif-slider-input {
  width: 100%;
}
.whatif-close-btn {
  font-size: 16px;
}

/* Design actions — 2-col button grid */
.design-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.design-action-link {
  text-align: center;
  text-decoration: none;
  font-size: 13px;
  padding: 12px 8px;
}

/* Design summary dashboard */
.dsd-grade {
  text-align: center;
  padding: 16px 0 8px;
}
.dsd-gauges {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 12px 0;
}

/* Hydraulic Quick Calculator (HQC) */
.hqc-mode-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.hqc-result-panel {
  padding: 12px;
  border-radius: 8px;
  background: var(--input-bg, #f8fafc);
  border: 1px solid var(--line, #e2e8f0);
  margin-bottom: 12px;
}
.hqc-result-value {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
}
.hqc-result-details {
  font-size: 0.82rem;
  color: var(--text-muted, #64748b);
  margin-top: 6px;
}
.hqc-ref-summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted, #64748b);
}
.hqc-ref-grid {
  font-size: 0.8rem;
  margin-top: 6px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

/* Pipe Material Guide */
.pmg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.pmg-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

/* Multi-scenario section */
.multi-scenario-section {
  max-width: 1200px;
  margin: 32px auto 0;
  padding: 0 24px 40px;
}
.ms-toggle {
  cursor: pointer;
}
.ms-arrow {
  font-size: 18px;
  color: var(--muted);
}
.ms-description {
  font-size: 13px;
  margin-bottom: 16px;
}
.ms-add-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}
.ms-field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
}
.ms-field-input {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.ms-add-btn {
  padding: 8px 16px;
}

/* Pipe network diagram */
.pipe-network-svg {
  width: 100%;
  min-height: 300px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

/* Chart tool buttons */
.chart-tool-btn-sm {
  font-size: 12px;
}
.chart-tool-btn-end {
  margin-left: auto;
  font-size: 12px;
}

/* Scenario comparison table overflow */
.scenario-comp-table {
  margin-top: 12px;
  overflow-x: auto;
}

/* Sensitivity / affinity panels */
.sensitivity-field-grid {
  margin-top: 12px;
}
.sensitivity-calc-btn {
  margin-top: 12px;
  width: 100%;
}

/* Import scenarios label */
.import-label {
  cursor: pointer;
  margin: 0;
}

/* Affinity law formulas */
.affinity-formulas {
  padding: 10px;
  border-radius: 6px;
  background: var(--card-alt, #f1f5f9);
  font-size: 12px;
  line-height: 1.6;
}

/* Report generator buttons */
.report-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

/* Template grid */
.tpl-grid {
  gap: 10px;
}

/* Dashboard sparkline */
.dashboard-sparkline {
  /* JS toggles display */
}

/* Responsive overrides for new component classes */
@media (max-width: 768px) {
  .headloss-breakdown-grid {
    grid-template-columns: 1fr;
  }
  .design-actions-grid {
    grid-template-columns: 1fr;
  }
  .ms-add-grid {
    grid-template-columns: 1fr 1fr;
  }
  .dsd-gauges {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .ms-add-grid {
    grid-template-columns: 1fr;
  }
  .dsd-gauges {
    grid-template-columns: 1fr;
  }
}

/* Flow Analysis page — panel title header row */
.fa-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.fa-panel-title {
  margin: 0;
}

/* Flow analysis hint text (used as description under headings) */
.fa-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 8px;
}
.fa-hint-compact {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 8px;
}

/* Flow analysis small action buttons */
.fa-action-btn-sm {
  font-size: 11px;
}

/* Flow analysis profile table wrapper */
.fa-table-scroll {
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: 10px;
}
.fa-table-full {
  width: 100%;
}

/* Compliance score badge */
.fa-compliance-score {
  font-size: 14px;
  font-weight: 700;
}

/* Flow analysis stats row */
.fa-gradient-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

/* Chart height variants for flow analysis */
.chart-h250            { width: 100%; height: 250px; }
.chart-h280            { width: 100%; height: 280px; }
.chart-h340            { width: 100%; height: 340px; }

/* Export actions row */
.fa-export-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.fa-export-btn {
  font-size: 12px;
}

/* ── Shared component classes (matching, catalog, etc.) ── */

/* Card heading variant with tighter gap */
.card-heading-sm {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* Subtitle hint — used under card headings */
.subtitle-hint {
  font-size: 13px;
  margin-bottom: 12px;
}
.subtitle-hint-lg {
  font-size: 13px;
  margin-bottom: 16px;
}

/* Small button text */
.btn-xs {
  font-size: 12px;
}

/* Flex with 6px gap */
.flex-row-6 {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Button vertical alignment in field grids */
.btn-align {
  margin-top: 1.4em;
}

/* Stats text below charts */
.stats-text {
  margin-top: 10px;
  font-size: 13px;
}
.stats-text-muted {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

/* Overflow utility */
.overflow-x-auto {
  overflow-x: auto;
}

/* Flex utilities */
.flex-1 { flex: 1; }

/* Chart height 360 */
.chart-h360 { width: 100%; height: 360px; }

/* Matching page — reliability inputs grid */
.reliability-inputs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

/* Matching page — selection matrix weight sliders */
.matrix-weight-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  margin-bottom: 14px;
}

/* Auto-fit info cards grid */
.info-cards-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.info-cards-grid-lg {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

/* Catalog — filter row with inline select */
.cat-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cat-filter-select {
  width: auto;
  padding: 4px 8px;
  font-size: 12px;
}

/* Catalog — favorites scroll panel */
.cat-favorites-scroll {
  max-height: 250px;
  overflow-y: auto;
}

/* Catalog — trim slider label */
.trim-slider-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.trim-slider-nowrap {
  white-space: nowrap;
}
.trim-slider-value {
  min-width: 40px;
  text-align: right;
  font-weight: 600;
}

/* ── Additional spacing utilities ── */
.mt-xs                 { margin-top: 6px; }
.mt-xxs                { margin-top: 4px; }

/* Chart height variants */
.chart-h240            { width: 100%; height: 240px; }

/* Hint text variants — muted description under headings */
.hint-muted-sm         { font-size: 12px; color: var(--muted); margin: 0 0 10px; }
.hint-muted-sm-lg      { font-size: 12px; color: var(--muted); margin: 0 0 12px; }
.hint-muted-inset      { font-size: 12px; color: var(--muted); margin: 4px 0 12px; }

/* Section sub-heading (h3 inside result cards) */
.result-subheading     { margin: 16px 0 8px; font-size: 14px; }

/* 3-column equal grid */
.grid-3col             { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid-3col-10          { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

/* Centered constrained container */
.center-max-560        { width: 100%; max-width: 560px; margin: 0 auto; }
.center-max-520        { width: 100%; max-width: 520px; margin: 0 auto; }

/* Wetwell what-if explorer layout */
.ww-whatif-header      { display: flex; justify-content: space-between; align-items: center; }
.ww-whatif-slider-wrap { display: block; }
.ww-whatif-slider-row  { display: flex; justify-content: space-between; font-size: 12px; }

/* Digitizer inline style replacements */
.digi-card-section     { padding: 16px; border: 1px solid var(--line, #dde1e8); border-radius: 10px; background: var(--panel-strong, #fff); }
.digi-card-header      { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.digi-card-header-10   { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.digi-heading-sm       { margin: 0; font-size: 14px; font-weight: 700; color: var(--text); }
.digi-save-png-btn     { font-size: 11px; padding: 4px 10px; }
.digi-export-btn-sm    { font-size: 11px; padding: 5px 10px; }
.digi-export-btn-xs    { font-size: 11px; padding: 4px 10px; }
.digi-meta-grid        { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin-bottom: 12px; font-size: 12px; }
.digi-meta-input       { width: 100%; padding: 5px 8px; border: 1px solid var(--line, #dde1e8); border-radius: 5px; font-size: 12px; }
.digi-points-row       { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.digi-points-input     { width: 60px; padding: 4px 6px; border: 1px solid var(--line, #dde1e8); border-radius: 5px; font-size: 12px; }
.digi-table-scroll     { max-height: 240px; overflow-y: auto; margin-bottom: 10px; }
.digi-preview-textarea { width: 100%; height: 120px; font-family: 'Courier New', monospace; font-size: 11px; border: 1px solid var(--line, #dde1e8); border-radius: 6px; padding: 8px; resize: vertical; background: var(--surface, #f8fafc); color: var(--text, #1e293b); box-sizing: border-box; }
.digi-shortcuts-details { margin-top: 8px; font-size: 12px; color: var(--muted); }
.digi-shortcuts-summary { cursor: pointer; user-select: none; }
.digi-shortcuts-list   { margin: 6px 0 0 16px; line-height: 1.8; }
.digi-import-label     { cursor: pointer; display: inline-block; text-align: center; }
.digi-overlay-list     { max-height: 160px; overflow-y: auto; }
.digi-point-list-scroll { max-height: 180px; overflow-y: auto; }

/* Pump selector refactor utilities */
.mt-14                 { margin-top: 14px; }
.gap-sm                { gap: 10px; }
.text-2xs              { font-size: 11px; }
.details-summary       { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); }
.label-btn-end         { display: flex; align-items: flex-end; gap: 6px; }
.btn-success           { background: var(--success); }
.btn-m0                { margin: 0; }

/* ── Dashboard shared (admin + manufacturer) ── */
.dash-main             { max-width: 1100px; margin: 0 auto; padding: 0 24px 40px; }
.dash-main-pad         { max-width: 1100px; margin: 0 auto; padding: 24px; }
.dash-stats-grid       { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.dash-stats-grid-lg    { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.dash-stat-card        { text-align: center; padding: 20px; }
.dash-stat-value       { font-size: 28px; font-weight: 700; color: var(--accent); }
.dash-stat-value-success { font-size: 28px; font-weight: 700; color: var(--success); }
.dash-stat-value-signal  { font-size: 28px; font-weight: 700; color: var(--signal); }
.dash-stat-label       { font-size: 13px; color: var(--muted); }
.dash-desc             { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.dash-field-label      { font-size: 12px; font-weight: 600; display: block; margin-bottom: 4px; }
.dash-form-row         { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.dash-flex-1           { flex: 1; min-width: 200px; }
.dash-w100             { width: 100px; }
.dash-input-full       { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 6px; }
.dash-btn-pad          { padding: 8px 20px; }
.dash-btn-pad-sm       { padding: 8px 16px; }
.dash-2col-grid        { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.fw-600                { font-weight: 600; }

/* ── Visibility utilities ── */
.js-hidden             { display: none; }
.placeholder-msg       { grid-column: 1 / -1; text-align: center; padding: 20px 0; color: var(--muted, #64748b); }

/* ── Text color utilities ── */
.text-danger           { color: var(--signal); }
.text-warning          { color: var(--warning); }
.text-success          { color: var(--success); }
.text-info             { color: var(--accent, #3b82f6); }
.text-accent-purple    { color: #8b5cf6; }
html.dark .text-accent-purple { color: #a78bfa; }
.th-action             { width: 40px; }

/* ── JS-generated button utilities ── */
.btn-calc              { padding: 8px 20px; background: var(--accent, #0f4c81); color: #fff; border: none; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 13px; }
.btn-calc:hover        { filter: brightness(1.1); }
.btn-calc-lg           { padding: 10px 28px; background: var(--accent, #0f4c81); color: #fff; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 15px; }
.btn-calc-lg:hover     { filter: brightness(1.1); }
.btn-calc-full         { width: 100%; padding: 6px; background: var(--accent, #0f4c81); color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 0.8rem; font-weight: 600; }
.btn-calc-full:hover   { filter: brightness(1.1); }

/* ── 404 / Error page ── */
.error-page            { text-align: center; padding: 60px 24px; }
.error-card            { max-width: 520px; margin: 0 auto; padding: 48px 32px; }
.error-icon            { font-size: 4rem; margin-bottom: 16px; opacity: 0.3; }
.error-heading         { font-size: 1.8rem; margin: 0 0 12px; }
.error-message         { color: var(--muted); font-size: 1rem; line-height: 1.6; margin: 0 0 28px; }
.error-actions         { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.error-help            { color: var(--muted); font-size: 0.82rem; margin-top: 24px; }

/* ── Enterprise page ── */
.enterprise-main       { max-width: 960px; margin: 0 auto; padding: 0 24px 60px; }
.enterprise-contact-desc { font-size: 14px; color: var(--muted); margin-bottom: 20px; }
.enterprise-footer     { text-align: center; margin-top: 20px; font-size: 13px; color: var(--muted); }
.ent-success-msg { color: var(--success); padding: 16px; background: var(--surface-alt, #f0fdf4); border: 1px solid var(--success); border-radius: 8px; text-align: center; font-weight: 600; }
.ent-error-msg { color: var(--signal); padding: 12px 16px; background: rgba(209,73,91,0.08); border: 1px solid var(--signal); border-radius: 8px; }
html.dark .ent-success-msg { background: rgba(31,138,112,0.12); }
html.dark .ent-error-msg { background: rgba(209,73,91,0.12); }

/* Pricing grid */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}

@media (max-width: 900px) {
  .pricing-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 540px) {
  .pricing-grid { grid-template-columns: 1fr; max-width: 400px; margin-left: auto; margin-right: auto; }
}

.pricing-card {
  background: var(--panel-strong, #fff);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.pricing-card:hover {
  box-shadow: var(--shadow);
}

.pricing-card-featured {
  border: 2px solid var(--accent, #0f4c81);
  box-shadow: 0 4px 24px rgba(15, 76, 129, 0.12);
}

.pricing-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent, #0f4c81);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 14px;
  border-radius: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.pricing-header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.pricing-header h3 {
  margin: 0 0 6px;
  font-size: 20px;
}

.pricing-amount {
  font-size: 36px;
  font-weight: 800;
  color: var(--fg);
  line-height: 1.1;
}

.pricing-amount span {
  font-size: 16px;
  font-weight: 500;
  color: var(--muted);
}

.pricing-period {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 0;
}

.pricing-features {
  list-style: none;
  padding: 0;
  margin: 0 0 auto;
  flex-grow: 1;
}

.pricing-features li {
  font-size: 13px;
  padding: 6px 0 6px 22px;
  position: relative;
  color: var(--fg);
  border-bottom: 1px solid var(--line);
}

.pricing-features li:last-child {
  border-bottom: none;
}

.pricing-features li.included::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--success, #10b981);
  font-weight: 700;
  font-size: 13px;
}

.pricing-features li.excluded {
  color: var(--muted);
}

.pricing-features li.excluded::before {
  content: "\2717";
  position: absolute;
  left: 0;
  color: var(--muted, #94a3b8);
  font-size: 12px;
}

.pricing-cta {
  display: block;
  text-align: center;
  margin-top: 20px;
  text-decoration: none;
}

/* ── Privacy page ── */
.privacy-main          { max-width: 760px; margin: 0 auto; padding: 0 24px 60px; }
.privacy-content       { line-height: 1.7; }
.privacy-updated       { font-size: 13px; color: var(--muted); margin-bottom: 24px; }

/* ── Auth page extras ── */
.auth-tier-note        { text-align: center; margin-top: 12px; font-size: 12px; color: #63748a; }

/* ── Chat page extras ── */
.chat-header-subtitle  { margin: 0; font-size: 13px; color: var(--muted); }
.chat-rate-info        { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

/* ── Common text utilities ── */
.text-sm               { font-size: 13px; }

/* ── JS-generated component classes (replace inline styles) ── */

/* Chart/section wrapper card used in matching, pump selector */
.result-card-wrap {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line, #dde1e8);
  border-radius: 10px;
  background: var(--surface, var(--panel-strong, #fff));
}

/* Flex header row: title left, controls right */
.flex-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Chart container with standard sizing */
.chart-wrap-full { width: 100%; margin-top: 8px; }
.chart-h200  { height: 200px; }
.chart-h240  { height: 240px; }
.chart-h260  { height: 260px; }
.chart-h280  { height: 280px; }
.chart-h300  { height: 300px; }
.chart-h320  { height: 320px; }
.chart-h340  { height: 340px; }
.chart-h380  { height: 380px; }
.chart-h400  { height: 400px; }
.chart-h420  { width: 100%; height: 420px; }
.chart-h450  { width: 100%; height: 450px; }
.chart-h460  { width: 100%; height: 460px; }

/* Margin-top utilities for JS-generated content */
.mt-2   { margin-top: 2px; }
.mt-4   { margin-top: 4px; }
.mt-6   { margin-top: 6px; }
.mt-8   { margin-top: 8px; }
.mt-10  { margin-top: 10px; }
.mt-12  { margin-top: 12px; }
.mt-14  { margin-top: 14px; }
.mt-16  { margin-top: 16px; }

/* Inline color badge / status dot */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

/* Section divider for results panels */
.result-divider {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

/* Muted hint text at bottom of results */
.hint-muted-xs {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}

/* Small action buttons for export/copy/send */
.btn-action-sm {
  margin: 0;
  font-size: 12px;
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-weight: 500;
}
.btn-action-sm:hover { opacity: 0.9; }

.btn-green  { background: #10b981; }
.btn-indigo { background: #6366f1; }
.btn-purple { background: #8b5cf6; }

html.dark .btn-green  { background: #34d399; color: #064e3b; }
html.dark .btn-indigo { background: #818cf8; color: #1e1b4b; }
html.dark .btn-purple { background: #a78bfa; color: #2e1065; }

/* Toast notification */
.arc-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: opacity 0.3s;
}
html.dark .arc-toast {
  background: #334155;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Component card for system curve builder */
.arc-comp-card {
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
  background: var(--panel-strong, #f9fafb);
}

/* Flex row with gap for component header */
.flex-row-gap-8 {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Remove button (icon, no chrome) */
.btn-remove-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--signal, #ef4444);
  font-size: 16px;
  padding: 2px 6px;
}

@media (max-width: 768px) {
  .dash-2col-grid      { grid-template-columns: 1fr; }
  .dash-form-row       { flex-direction: column; align-items: stretch; }
  .dash-flex-1         { min-width: 0; }
  .dash-w100           { width: 100%; }
}

/* ── Reusable chart & metric patterns ── */
.chart-wrap {
  width: 100%;
  min-height: 200px;
}
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.metric-card {
  padding: 10px;
  background: var(--bg-alt, #f8fafc);
  border-radius: 8px;
  border-left: 3px solid var(--accent, #0f4c81);
}
.metric-card-title {
  font-size: 10px;
  color: var(--muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 2px;
}
.metric-card-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text, #1e293b);
}
.metric-card-sub {
  font-size: 10px;
  color: var(--muted, #64748b);
  margin-top: 2px;
}
.stat-box {
  text-align: center;
  padding: 8px;
  background: var(--bg-offset, #f1f5f9);
  border-radius: 6px;
}
.stat-box-label {
  font-size: 11px;
  color: var(--muted);
}
.stat-box-value {
  font-weight: 600;
}
html.dark .stat-box {
  background: rgba(20, 28, 40, 0.4);
}
.mini-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}
.mini-table th,
.mini-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line, #e2e8f0);
  text-align: left;
}
.mini-table th {
  font-weight: 600;
  font-size: 11px;
  color: var(--muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.section-subtitle {
  font-size: 12px;
  color: var(--muted, #64748b);
  margin-bottom: 8px;
}
.scenario-notes-textarea {
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
  border: 1px solid var(--line, #dde1e8);
  border-radius: 6px;
  resize: vertical;
  font-family: inherit;
  background: var(--input-bg, #f9fbfe);
  color: var(--text, #1e293b);
}
@media (max-width: 640px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Curve Digitizer ── */
.digi-layout { display: grid; grid-template-columns: 300px 1fr; gap: 0; min-height: calc(100vh - 56px); }
.digi-sidebar { background: var(--surface, #f8f9fb); border-right: 1px solid var(--line, #dde1e8); padding: 20px; overflow-y: auto; }
.digi-main { padding: 20px; overflow: hidden; display: flex; flex-direction: column; }
.digi-plot { flex: 1; min-height: 400px; border: 1px solid var(--line, #dde1e8); border-radius: 8px; background: var(--panel-strong, #fff); }

.digi-step { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line, #dde1e8); }
.digi-step:last-child { border-bottom: none; }
.digi-step h3 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted, #63748a); margin: 0 0 10px; }
.digi-step label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.digi-step select, .digi-step input[type="text"], .digi-step input[type="number"] {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line, #dde1e8); border-radius: 6px; font-size: 13px; margin-bottom: 8px;
}
.digi-step .btn { display: inline-block; padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 600;
  cursor: pointer; border: none; margin-right: 6px; margin-bottom: 6px; }
/* btn-primary/secondary/danger and .btn:disabled are defined globally above */

.digi-status { padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 12px; }
.digi-status.info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.digi-status.success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.digi-status.warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

.cal-point { display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 0; }
.cal-dot { width: 10px; height: 10px; border-radius: 50%; }

.curve-list-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; margin-bottom: 4px; font-size: 13px; }
.curve-list-item:hover { background: var(--bg-alt, #e5e7eb); }
.curve-list-item.active { background: var(--accent-soft, #dbeafe); font-weight: 600; }
.curve-color { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }

.data-table { width: 100%; font-size: 12px; border-collapse: collapse; margin-top: 8px; }
.data-table th, .data-table td { padding: 4px 8px; border: 1px solid var(--line, #dde1e8); text-align: right; }
.data-table th { background: var(--surface, #f8f9fb); font-weight: 600; text-align: center; }

.digi-toolbar { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; flex-wrap: wrap; }
.point-count { font-size: 12px; color: var(--muted, #63748a); }

/* Step progress indicator */
.digi-progress { display: flex; gap: 0; margin-bottom: 20px; padding: 0; }
.digi-progress-step { flex: 1; text-align: center; padding: 8px 4px; font-size: 11px; font-weight: 600;
  color: var(--muted, #63748a); background: var(--bg, #eef2f7); border-bottom: 3px solid transparent; transition: all 0.2s; }
.digi-progress-step.active { color: var(--accent, #2563eb); border-bottom-color: var(--accent, #2563eb); background: rgba(37,99,235,0.08); }
.digi-progress-step.done { color: var(--success, #16a34a); border-bottom-color: var(--success, #16a34a); background: rgba(22,163,74,0.06); }
.digi-progress-step:first-child { border-radius: 6px 0 0 0; }
.digi-progress-step:last-child { border-radius: 0 6px 0 0; }

/* Drag and drop area */
.digi-dropzone { border: 2px dashed var(--line, #dde1e8); border-radius: 10px; padding: 24px; text-align: center;
  cursor: pointer; transition: border-color 0.2s, background 0.2s; margin-bottom: 8px; }
.digi-dropzone:hover, .digi-dropzone.drag-over { border-color: var(--accent, #2563eb); background: rgba(37,99,235,0.05); }
.digi-dropzone p { font-size: 13px; color: var(--muted, #63748a); margin: 8px 0 0; }
.digi-dropzone svg { opacity: 0.4; }

/* Zoom hint */
.digi-zoom-hint { font-size: 11px; color: var(--muted); text-align: center; margin-top: 6px; opacity: 0.7; }

@media (max-width: 900px) {
  .digi-layout { grid-template-columns: 1fr; }
  .digi-sidebar { border-right: none; border-bottom: 1px solid var(--line); }
}

/* Value input modal (replaces browser prompt) */
.digi-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 9000; display: flex; align-items: center; justify-content: center; }
.digi-modal { background: var(--surface, #fff); border-radius: 12px; padding: 24px; width: 320px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.digi-modal h4 { margin: 0 0 12px; font-size: 15px; font-weight: 700; }
.digi-modal input { width: 100%; padding: 10px 12px; border: 2px solid var(--accent, #2563eb); border-radius: 8px; font-size: 16px; outline: none; box-sizing: border-box; }
.digi-modal input:focus { border-color: #1d4ed8; box-shadow: 0 0 0 3px rgba(37,99,235,0.2); }
.digi-modal-actions { display: flex; gap: 8px; margin-top: 14px; justify-content: flex-end; }
.digi-modal-actions button { padding: 8px 18px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; }

/* Point list with delete buttons */
.digi-point-row { display: flex; align-items: center; gap: 4px; padding: 2px 4px; font-size: 11px; border-radius: 4px; }
.digi-point-row:hover { background: rgba(220,38,38,0.08); }
.digi-point-del { background: none; border: none; color: var(--muted, #63748a); cursor: pointer; font-size: 14px; padding: 0 4px; line-height: 1; opacity: 0.4; transition: opacity 0.15s, color 0.15s; }
.digi-point-del:hover { opacity: 1; color: var(--signal, #dc2626); }

/* Upload retry button */
.digi-retry-btn { margin-top: 8px; display: none; }

/* Curve statistics grid */
.digi-stats-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.digi-stat-card {
  flex: 1; min-width: 200px; background: var(--bg, #f8f9fb); border-radius: 8px; padding: 10px 14px;
  font-size: 12px;
}
.digi-stat-name { font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.digi-stat-row { display: flex; justify-content: space-between; padding: 2px 0; }
.digi-stat-row span { color: var(--muted, #63748a); }

/* Digitizer dark mode */
html.dark .digi-sidebar { background: var(--panel); }
html.dark .digi-plot { background: var(--panel); border-color: rgba(100,120,150,0.2); }
html.dark .digi-step select,
html.dark .digi-step input[type="text"],
html.dark .digi-step input[type="number"] {
  background: rgba(15, 20, 30, 0.5);
  color: var(--text);
  border-color: rgba(100,120,150,0.3);
}
html.dark .btn-secondary { background: rgba(50,60,80,0.6); color: var(--text); }
html.dark .btn-secondary:hover { background: rgba(70,85,105,0.6); }
html.dark .curve-list-item:hover { background: rgba(50,60,80,0.4); }
html.dark .curve-list-item.active { background: rgba(77,163,255,0.15); }
html.dark .data-table th { background: rgba(30,37,46,0.6); }
html.dark .data-table td { border-color: rgba(100,120,150,0.2); }
html.dark .data-table tr:hover td { background: rgba(100,120,150,0.06); }
html.dark .curve-table th:last-child { background: rgba(30,37,46,0.6); }
html.dark .curve-table td:last-child { background: var(--bg, #141c28); }
html.dark .digi-status.info { background: rgba(30,64,175,0.15); color: #93c5fd; border-color: rgba(59,130,246,0.3); }
html.dark .digi-status.success { background: rgba(22,101,52,0.15); color: #86efac; border-color: rgba(34,197,94,0.3); }
html.dark .digi-status.warn { background: rgba(146,64,14,0.15); color: #fcd34d; border-color: rgba(245,158,11,0.3); }
html.dark .digi-progress-step { background: rgba(20,28,40,0.4); }
html.dark .digi-progress-step.active { background: rgba(37,99,235,0.15); color: #93c5fd; }
html.dark .digi-progress-step.done { background: rgba(22,163,74,0.12); color: #86efac; }
html.dark .digi-dropzone { border-color: rgba(100,120,150,0.3); }
html.dark .digi-dropzone:hover, html.dark .digi-dropzone.drag-over { border-color: #93c5fd; background: rgba(37,99,235,0.1); }
html.dark .digi-modal { background: var(--panel, #1a2332); color: var(--text); }
html.dark .digi-modal input { background: rgba(15,20,30,0.6); color: var(--text); border-color: rgba(100,120,150,0.4); }
html.dark .digi-modal input:focus { border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(37,99,235,0.3); }
html.dark .digi-point-row:hover { background: rgba(220,38,38,0.12); }
html.dark .digi-stat-card { background: rgba(20,28,40,0.5); }
html.dark #dig-quality-card { background: var(--panel, #1a2332); border-color: rgba(100,120,150,0.2); }
html.dark #dig-quality-card .qa-metric-card { background: rgba(20,28,40,0.5); }
html.dark #dig-quality-card .qa-check-row { border-color: rgba(100,120,150,0.15); }
html.dark #dig-export-center-card { background: var(--panel, #1a2332); border-color: rgba(100,120,150,0.2); }
html.dark #dig-export-center-card input,
html.dark #dig-export-center-card textarea { background: rgba(15,20,30,0.5); color: var(--text); border-color: rgba(100,120,150,0.3); }
html.dark #dig-interpolation-card { background: var(--panel, #1a2332); border-color: rgba(100,120,150,0.2); }
html.dark #dig-interpolation-card select,
html.dark #dig-interpolation-card input[type="number"],
html.dark #dig-interpolation-card input[type="text"] { background: rgba(15,20,30,0.5); color: var(--text); border-color: rgba(100,120,150,0.3); }
html.dark #dig-interpolation-card .interp-output-table th { background: rgba(30,37,46,0.6); }
html.dark #dig-interpolation-card .interp-output-table td { border-color: rgba(100,120,150,0.2); }
html.dark .interp-warning-badge { background: rgba(146,64,14,0.2); color: #fcd34d; border-color: rgba(245,158,11,0.3); }
html.dark .interp-confidence-bar-inner { opacity: 0.85; }

/* Family generator dark mode */
html.dark #dig-family-gen-card { background: var(--panel, #1a2332); border-color: rgba(100,120,150,0.2); }
html.dark #dig-family-gen-card select,
html.dark #dig-family-gen-card input[type="number"],
html.dark #dig-family-gen-card input[type="text"] { background: rgba(15,20,30,0.5); color: var(--text); border-color: rgba(100,120,150,0.3); }
html.dark #dig-family-gen-card .data-table th { background: rgba(30,37,46,0.6); }
html.dark #dig-family-gen-card .data-table td { border-color: rgba(100,120,150,0.2); }
html.dark #dig-family-gen-card .fam-section { background: rgba(20,28,40,0.4); }
html.dark #dig-family-gen-card .fam-guide-card { background: rgba(20,28,40,0.5); }

/* ==========================================================================
   Pump Selector — Extracted inline styles (risk cards, info panels, etc.)
   ========================================================================== */

/* Risk / stat card with colored left border */
.ps-risk-card {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  border-left-width: 4px;
  border-left-style: solid;
}
.ps-risk-card-label {
  font-size: 11px;
  color: var(--muted);
}
.ps-risk-card-value {
  font-size: 20px;
  font-weight: 700;
}
.ps-risk-card-sub {
  font-size: 10px;
}

/* Dashboard stats grid (auto-fit columns) */
.ps-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

/* Info panel — recommendations, HI guidance, etc. */
.ps-info-panel {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface, #f8fafc);
  font-size: 12px;
  line-height: 1.6;
}
.ps-info-panel-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
html.dark .ps-info-panel {
  background: rgba(20, 28, 40, 0.4);
}

/* Recommendation list inside info panel */
.ps-info-panel ul {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.8;
}

/* Chart section wrapper (radar, Ns, range map) */
.ps-chart-section {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.ps-chart-section h3,
.ps-chart-section h4,
.ps-chart-title {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
}
.ps-chart-section p {
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 8px;
}
html.dark .ps-chart-section {
  border-color: rgba(100, 120, 150, 0.2);
}

/* Saved recommendations list */
.ps-saved-wrap {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.ps-saved-title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}
.ps-saved-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}
.ps-saved-item:last-child {
  border-bottom: none;
}
.ps-saved-date {
  color: var(--muted);
}
.ps-saved-top {
  font-weight: 600;
}
.ps-saved-delete {
  margin-left: auto;
  font-size: 14px;
  padding: 0 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  border-radius: 4px;
}
.ps-saved-delete:hover {
  color: var(--signal);
  background: rgba(209, 73, 91, 0.08);
}

/* NPSHa result value display */
.ps-npsha-result {
  text-align: center;
  padding: 12px 0 8px;
}
.ps-npsha-value {
  font-size: 28px;
  font-weight: 700;
}
.ps-npsha-status {
  font-size: 12px;
  color: var(--muted);
}

/* NPSHa breakdown list */
.ps-npsha-breakdown {
  font-size: 12px;
  line-height: 1.8;
  padding: 8px 12px;
  background: var(--surface, #f8fafc);
  border-radius: 8px;
  border: 1px solid var(--line);
}
.ps-npsha-breakdown .npsha-total {
  border-top: 1px solid var(--line);
  margin-top: 4px;
  padding-top: 4px;
  font-weight: 700;
}
html.dark .ps-npsha-breakdown {
  background: rgba(20, 28, 40, 0.4);
}

/* Reference tables in pump selector (altitude, vapor pressure) */
.ps-ref-table {
  width: 100%;
  border-collapse: collapse;
}
.ps-ref-table caption {
  font-weight: 600;
  margin-bottom: 4px;
}
.ps-ref-table th,
.ps-ref-table td {
  padding: 2px 4px;
}
.ps-ref-table th {
  text-align: left;
}
.ps-ref-table thead tr {
  border-bottom: 1px solid var(--line);
}
.ps-ref-table .text-right {
  text-align: right;
}

/* Cavitation dashboard target */
.ps-cav-dashboard {
  margin-top: 14px;
}
.ps-cav-chart {
  width: 100%;
  height: 340px;
  margin-bottom: 16px;
}

/* Nss reference table row highlighting */
.ps-nss-row-active {
  font-weight: 600;
}

/* ==========================================================================
   Duty Point Analysis — Gauge & Risk Grid
   ========================================================================== */

/* Gauge indicators row */
.duty-gauges-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.duty-gauge-cell {
  text-align: center;
}
.duty-gauge-cell .gauge-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 2px;
}

/* Risk assessment grid */
.duty-risk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

@media (max-width: 600px) {
  .duty-gauges-grid {
    grid-template-columns: 1fr;
  }
  .duty-risk-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ==========================================================================
   Catalog — Print Worksheet
   ========================================================================== */

.ws-printable {
  font-family: Arial, sans-serif;
  max-width: 750px;
  margin: 0 auto;
}
.ws-page-header {
  text-align: center;
  padding: 16px 0;
  border-bottom: 3px solid var(--ws-border, #ccc);
}
html.dark .ws-page-header { border-color: #444; }
.ws-title {
  margin: 0 0 4px;
  font-size: 20px;
  letter-spacing: 1px;
}
.ws-subtitle {
  font-size: 12px;
}
.ws-input-field {
  border: 1px solid var(--ws-border, #ccc);
  padding: 4px 8px;
  width: 250px;
  background: var(--panel-strong, #fff);
  color: inherit;
  border-radius: 4px;
}
html.dark .ws-input-field { border-color: #444; }
.ws-project-label {
  margin-top: 8px;
  font-size: 13px;
}
.ws-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 13px;
}
.ws-table td {
  border: 1px solid var(--ws-border, #ccc);
  padding: 6px;
  width: 25%;
}
html.dark .ws-table td { border-color: #444; }
.ws-table td.ws-label {
  font-weight: 600;
}
.ws-section-header td {
  background: var(--ws-header-bg, #f5f5f5);
  padding: 8px;
  font-weight: 700;
}
html.dark .ws-section-header td { background: #2a2a2a; }
.ws-notes-header {
  background: var(--ws-header-bg, #f5f5f5);
  padding: 8px;
  font-weight: 700;
  border: 1px solid var(--ws-border, #ccc);
  border-bottom: none;
  font-size: 13px;
}
html.dark .ws-notes-header { background: #2a2a2a; border-color: #444; }
.ws-textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--ws-border, #ccc);
  padding: 8px;
  font-size: 13px;
  font-family: Arial, sans-serif;
  background: var(--panel-strong, #fff);
  color: inherit;
  resize: vertical;
}
html.dark .ws-textarea { border-color: #444; }
.ws-button-row {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Catalog — Specification Sheet
   ========================================================================== */

.spec-box {
  border: 1px solid var(--line, #ddd);
  border-radius: 6px;
  padding: 8px 10px;
  text-align: center;
}
html.dark .spec-box { border-color: #444; }
.spec-box-label {
  font-size: 10px;
  text-transform: uppercase;
  opacity: 0.6;
  margin-bottom: 2px;
}
.spec-box-value {
  font-size: 15px;
  font-weight: 700;
}
.spec-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--line, #e0e0e0);
}
html.dark .spec-header { border-color: #444; }
.spec-avatar {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--bg-offset, #f0f0f0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--primary, #2563eb);
}
html.dark .spec-avatar { background: #333; }
.spec-model-number {
  font-size: 18px;
  font-weight: 700;
}
.spec-model-sub {
  font-size: 12px;
  opacity: 0.65;
}
.spec-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.spec-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  opacity: 0.5;
  margin: 4px 0 4px 2px;
}
.spec-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  margin-right: 6px;
  margin-bottom: 4px;
}
.spec-share-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.spec-share-input {
  flex: 1;
  font-size: 12px;
  padding: 6px 8px;
  border: 1px solid var(--line, #ccc);
  border-radius: 6px;
  background: var(--bg-offset, #fafafa);
}
html.dark .spec-share-input { border-color: #555; background: #1e1e1e; }

/* ==========================================================================
   Catalog — Cost Analysis Tiles
   ========================================================================== */

.cost-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.cost-tile {
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  border: 1px solid transparent;
}
.cost-tile-title {
  font-size: 11px;
  opacity: 0.7;
}
.cost-tile-value {
  font-size: 18px;
  font-weight: 700;
}
.cost-tile-sub {
  font-size: 12px;
  opacity: 0.7;
}

/* ==========================================================================
   Catalog — Mechanical Seal Selection
   ========================================================================== */

.seal-row-recommended {
  background: #e6f7ed;
}
html.dark .seal-row-recommended { background: #1a3a2a; }
.seal-cell-bold {
  font-weight: 600;
}
.seal-pv-box {
  margin-top: 12px;
  padding: 10px;
  border-radius: 6px;
  font-size: 13px;
  background: #eef4fb;
}
html.dark .seal-pv-box { background: #1a2a3a; }
.seal-h4 {
  margin: 12px 0 8px 0;
}

/* ==========================================================================
   Catalog — Bearing Life Assessment
   ========================================================================== */

.bl-description {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 14px;
}
.bl-input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.bl-field-label {
  font-size: 12px;
  font-weight: 600;
}
.bl-field-input {
  width: 100%;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  margin-top: 4px;
}
.bl-metric-card {
  padding: 12px;
  border-radius: 8px;
  background: var(--bg-offset, #f9fafb);
  border: 1px solid var(--border);
  text-align: center;
}
html.dark .bl-metric-card { background: rgba(0,0,0,0.3); }
.bl-metric-label {
  font-size: 11px;
  color: var(--muted);
}
.bl-metric-value {
  font-size: 20px;
  font-weight: 700;
}
.bl-metric-sub {
  font-size: 10px;
  color: var(--muted);
}
.bl-ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin-top: 8px;
}
.bl-ref-table th {
  padding: 6px;
  text-align: left;
  border-bottom: 2px solid var(--border);
}
.bl-ref-table th.text-center {
  text-align: center;
}
.bl-ref-table thead tr {
  background: var(--bg-offset, #f3f4f6);
}
html.dark .bl-ref-table thead tr { background: #1f2937; }
.bl-ref-table td {
  padding: 6px;
  border-bottom: 1px solid var(--border);
}
.bl-ref-table td.text-center {
  text-align: center;
}
.bl-ref-row-active {
  background: rgba(59,130,246,0.06);
}
html.dark .bl-ref-row-active { background: rgba(59,130,246,0.12); }
.bl-ref-row-active td {
  font-weight: 700;
}
.bl-ref-summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

/* ==========================================================================
   Catalog — Checklist Cards
   ========================================================================== */

.cl-card {
  border-color: var(--line, #dee2e6);
  background: var(--panel, #fff);
}
html.dark .cl-card { border-color: #444; background: #1e1e1e; }
.cl-card-header {
  cursor: pointer;
  background: var(--bg-offset, #f8f9fa);
}
html.dark .cl-card-header { background: #2a2a2a; }
.cl-item {
  background: transparent;
  border-color: var(--line, #dee2e6) !important;
}
html.dark .cl-item { border-color: #444 !important; }
.cl-item-checked {
  background: #f0fff0;
}
html.dark .cl-item-checked { background: #1a2e1a; }
.cl-item-text-done {
  text-decoration: line-through;
  opacity: 0.7;
}
.cl-notes-input {
  font-size: 0.8rem;
  background: var(--panel, #fff);
  color: var(--fg, #333);
  border-color: var(--line, #ccc);
}
html.dark .cl-notes-input { background: #2a2a2a; color: #ccc; border-color: #555; }

/* ==========================================================================
   Catalog — Overlay Chart Section
   ========================================================================== */

.overlay-best-match-row {
  background: #eff6ff;
}
html.dark .overlay-best-match-row { background: #1e3a5f; }
.overlay-color-swatch {
  display: inline-block;
  width: 16px;
  height: 4px;
  border-radius: 2px;
}
.overlay-remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
}

/* ── Overlay / Comparison Table ── */
.ov-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ov-table thead tr { border-bottom: 2px solid var(--border); }
.ov-table tbody tr { border-bottom: 1px solid var(--border); }
.ov-table th,
.ov-table td { padding: 6px 8px; }
.ov-table th { text-align: left; }
.ov-table .num { text-align: right; }
.ov-table-best-row { background: #eff6ff; }
html.dark .ov-table-best-row { background: #1e3a5f; }
.ov-color-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}
.ov-best-tag {
  font-size: 11px;
  font-weight: 600;
}
.ov-hint-text {
  font-size: 13px;
  color: var(--muted);
}

/* ── Overlay Pump Panel ── */
.ov-pump-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ov-pump-label {
  flex: 1;
  min-width: 0;
}

/* ── System Editor ── */
.ov-editor-section { margin-bottom: 8px; }
.ov-editor-hint {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.ov-editor-details {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
}
.ov-button-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.ov-chart-wrap {
  width: 100%;
  height: 420px;
}
.ov-scroll-wrap {
  margin-top: 12px;
  overflow-x: auto;
}

/* ── Operating Point Result ── */
.op-result-card {
  background: var(--accent-soft);
  padding: 12px 16px;
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}
.op-result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.op-error-text { color: var(--signal); }

/* ═══════════ Catalog / Overlay extracted classes ═══════════ */

/* --- Pump panel --- */
.ov-pump-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.ov-pump-title { font-weight: 600; font-size: 14px; }
.ov-empty-msg { font-size: 13px; color: var(--muted); margin: 0; }
.ov-pump-list { display: flex; flex-direction: column; gap: 4px; }
.ov-pump-item { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.ov-pump-item-label { flex: 1; }
.ov-remove-btn { background: none; border: none; cursor: pointer; font-size: 14px; color: var(--muted); }
.ov-remove-btn:hover { color: var(--signal); }
.ov-color-swatch { display: inline-block; width: 16px; height: 4px; border-radius: 2px; }

/* --- System curve editor --- */
.ov-sys-summary { cursor: pointer; font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.ov-sys-content { margin-top: 8px; }
.ov-sys-checkbox { margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.ov-sys-helper { font-size: 12px; color: var(--muted); margin: 4px 0 6px; }
.ov-field-gap-sm { margin-bottom: 4px; }
.ov-field-gap { margin-bottom: 8px; }

/* --- Legend (comparison chart) --- */
.ov-legend-wrap { display: flex; flex-wrap: wrap; gap: 4px 0; padding: 4px 0; }
.ov-legend-item { display: inline-flex; align-items: center; gap: 4px; margin-right: 14px; font-size: 13px; }
.ov-legend-swatch { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }

/* --- Catalog info grid --- */
.cat-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.cat-metric-label { font-size: 12px; opacity: 0.7; }
.cat-metric-value { font-size: 22px; font-weight: 700; margin: 4px 0; }
.cat-metric-sub { font-size: 11px; opacity: 0.6; }
.cat-metric-card { text-align: center; }

/* --- Favorites actions --- */
.cat-fav-actions { display: flex; gap: 6px; margin-top: 12px; }
.cat-fav-btn { flex: 1; }
.cat-fav-import-label { flex: 1; cursor: pointer; text-align: center; margin: 0; }

/* --- Filter chips clear-all --- */
.cat-clear-all-chips { font-size: 11px; color: var(--accent); margin-left: 4px; cursor: pointer; background: none; border: none; }
.cat-clear-all-chips:hover { text-decoration: underline; }

/* --- Operating point link --- */
.cat-op-link { text-decoration: none; display: inline-block; }
.cat-op-title { font-size: 15px; }

/* --- NPSH recommendation --- */
.cat-npsh-rec { margin-top: 8px; font-size: 12px; }
.cat-npsh-stats { margin-top: 8px; font-size: 13px; }

/* --- Analysis cards (vibration, noise, etc.) --- */
.cat-analysis-section { margin-bottom: 24px; }
.cat-analysis-heading { margin: 0 0 12px 0; color: var(--text); }
.cat-analysis-subheading { margin: 0 0 8px 0; color: var(--text); }
.cat-analysis-input {
  background: var(--input-bg);
  border-color: var(--border);
  color: var(--text);
}
.cat-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.cat-analysis-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}
.cat-card-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.cat-card-value { font-size: 22px; font-weight: 700; }
.cat-card-desc { font-size: 13px; color: var(--text); margin-top: 4px; }
.cat-card-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.cat-chart-slot { width: 100%; margin-bottom: 20px; }
.cat-chart-slot-340 { width: 100%; height: 340px; margin-bottom: 20px; }
.cat-form-btn-offset { margin-top: 1.4em; }

/* --- Vibration frequency table --- */
.cat-vib-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.cat-vib-table th,
.cat-vib-table td { padding: 8px; border: 1px solid var(--border); }
.cat-vib-table thead tr { background: var(--bg-alt); }
.cat-vib-table tbody tr { background: var(--panel-strong); }
.cat-vib-table .font-semibold { font-weight: 600; }

/* --- Badges --- */
.cat-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 13px;
  color: #fff;
}
.cat-badge-danger  { background: var(--signal, #dc2626); }
.cat-badge-warning { background: var(--warning, #f97316); }
.cat-badge-success { background: var(--success, #22c55e); }

/* --- Breakdown divider line --- */
.cat-breakdown-divider {
  border-top: 1px solid var(--border);
  padding-top: 4px;
  margin-top: 4px;
}

/* --- Troubleshooting decision tree --- */
.vib-ts-section {
  margin-bottom: 8px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.vib-ts-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 14px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}
.vib-ts-toggle:hover { background: var(--accent-soft); }
.vib-ts-arrow { transition: transform 0.2s; display: inline-block; }
.vib-ts-body { padding: 0 14px 14px 14px; }
.vib-ts-list { margin: 0; padding-left: 20px; list-style: disc; }
.vib-ts-list li { margin-bottom: 6px; font-size: 13px; color: var(--text); }

/* --- Viscosity correction --- */
.visc-input-pair { display: flex; gap: 4px; margin-top: 4px; }
.visc-input-pair input { flex: 1; }
.visc-unit-select { width: 70px; font-size: 12px; }
.visc-factor-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 600px) {
  .visc-factor-grid { grid-template-columns: 1fr; }
}

/* --- Data sheet form --- */
.ds-section-hdr {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 0;
  margin: 12px 0 8px;
  border-bottom: 2px solid var(--border);
}
.ds-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 2px;
  display: block;
}
.ds-input {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  background: var(--input-bg);
  color: inherit;
  box-sizing: border-box;
}
.ds-textarea { resize: vertical; }
.ds-sub-heading {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  opacity: 0.8;
}
.ds-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ds-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.ds-action-row { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
@media (max-width: 600px) {
  .ds-grid-2 { grid-template-columns: 1fr; }
  .ds-grid-3 { grid-template-columns: 1fr; }
}

/* Data sheet performance table */
.ds-perf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: center;
}
.ds-perf-table th,
.ds-perf-table td {
  padding: 6px;
  border: 1px solid var(--border);
}
.ds-perf-table thead tr { background: var(--bg-alt); }
.ds-perf-table .ds-design-row { background: var(--surface-alt); }
html.dark .ds-perf-table .ds-design-row { background: rgba(34, 197, 94, 0.1); }

/* --- Flow analysis tables --- */
.fa-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 4px;
}
.fa-data-table thead tr { background: var(--bg-alt); }
.fa-data-table tbody tr:nth-child(even) { background: var(--bg-alt); }
.fa-data-table th,
.fa-data-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
.fa-data-table th { text-align: left; }
.fa-data-table .num { text-align: right; }
.fa-data-table .center { text-align: center; }
.fa-data-table .muted-sm { font-size: 11px; color: var(--muted); }

/* Flow analysis stat cards */
.fa-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px;
  margin-top: 10px;
}
.fa-stat-card {
  padding: 6px 8px;
  background: var(--bg-alt);
  border-radius: 6px;
}
.fa-stat-label { font-size: 10px; font-weight: 700; }
.fa-stat-detail { font-size: 10px; color: var(--muted); }

/* Flow analysis helper text */
.fa-note {
  font-size: 10px;
  color: var(--muted);
  margin-top: 8px;
}

/* Flow analysis inline color dot */
.fa-color-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

/* Flow analysis risk header */
.fa-risk-header {
  padding-left: 12px;
  margin-bottom: 12px;
}
.fa-risk-level { font-size: 18px; font-weight: 700; }
.fa-risk-desc { font-size: 12px; color: var(--muted); margin: 4px 0 0; }

/* Flow analysis velocity profile layout */
.fa-vel-profile-layout {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.fa-vel-profile-chart { flex: 1; min-width: 260px; height: 280px; }
.fa-vel-profile-info { flex: 0 0 200px; font-size: 13px; }

/* Flow analysis check list */
.fa-check-list { display: flex; flex-direction: column; gap: 6px; }
.fa-check-item {
  padding: 6px 10px;
  border-left: 3px solid;
  border-radius: 4px;
  font-size: 12px;
}

/* --- Text helpers --- */
.text-default { color: var(--text); }

/* Side-by-side chart pairs on wide screens */
.chart-pair-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 0;
}
.chart-pair-grid > .panel-card {
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .chart-pair-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Metric tile (reusable stat card for app.js) --- */
.metric-tile {
  padding: 8px;
  background: var(--bg-alt, #f8fafc);
  border-radius: 8px;
  text-align: center;
}
.metric-tile-lg {
  padding: 10px;
  background: var(--bg-alt, #f8fafc);
  border-radius: 8px;
  text-align: center;
}
.metric-tile-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
}
.metric-tile-label-11 {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
}
.metric-tile-value {
  font-size: 18px;
  font-weight: 800;
}
.metric-tile-value-lg {
  font-size: 20px;
  font-weight: 800;
}
.metric-tile-sub {
  font-size: 10px;
  color: var(--muted);
}

/* --- Spec box (pump type card small tiles) --- */
.spec-box {
  text-align: center;
  padding: 6px;
  background: var(--panel-strong, #fff);
  border-radius: 6px;
}
.spec-box-label {
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
}

/* --- Grid utilities --- */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grid-3-gap6 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; font-size: 11px; }
.grid-3-gap10 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.grid-auto-140 { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-bottom: 10px; }
.grid-auto-180 { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; }

/* --- Detail table (key-value rows) --- */
.detail-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}
.detail-table td {
  padding: 3px 0;
}
.detail-table .dt-label {
  color: var(--muted);
}
.detail-table .dt-value {
  text-align: right;
  font-weight: 600;
}
.detail-table .dt-border-top {
  border-top: 1px solid var(--border, #dde1e8);
}

/* --- Engineering data table (pipe sizing, K-factors, comparisons) --- */
.eng-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 8px;
}
.eng-table-sm { font-size: 11px; }
.eng-table thead tr {
  border-bottom: 2px solid var(--border, #e2e8f0);
}
.eng-table tbody tr {
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.eng-table th {
  padding: 4px 6px;
  text-align: left;
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--muted);
}
.eng-table th.text-right { text-align: right; }
.eng-table th.text-center { text-align: center; }
.eng-table td {
  padding: 4px 6px;
}
.eng-table td.text-right { text-align: right; }
.eng-table td.text-center { text-align: center; }
.eng-table td.fw-600 { font-weight: 600; }

/* --- Footnote (chart/card footer text) --- */
.footnote {
  font-size: 10px;
  color: var(--muted);
  margin: 6px 0 0;
}
.footnote-sm { margin: 4px 0 0; }
.footnote-lg { margin: 8px 0 0; }

/* --- Recommendation box (water hammer, warnings) --- */
.rec-box {
  margin-top: 8px;
  padding: 8px;
  border-radius: 6px;
}
.rec-box-title {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 4px;
}
.rec-box ul {
  margin: 0;
  padding-left: 16px;
  font-size: 11px;
  color: var(--muted);
}

/* --- Additional grid utilities --- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid-auto-130 { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.grid-auto-150 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.grid-auto-180-10 { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }

/* --- Flex layout utilities --- */
.flex-wrap-gap { display: flex; flex-wrap: wrap; }
.flex-wrap-12 { display: flex; flex-wrap: wrap; gap: 12px; }
.flex-wrap-16 { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; }

/* --- Muted label (no uppercase) --- */
.label-muted { font-size: 10px; color: var(--muted); }
.label-muted-11 { font-size: 11px; color: var(--muted); }

/* --- Stat card (matching.js / wetwell_sizing.js) --- */
.stat-card {
  padding: 10px;
  border-radius: 8px;
  background: var(--panel-strong, #f9fafb);
  border: 1px solid var(--border, #e5e7eb);
}
.stat-card-center { text-align: center; }
.stat-card-12 {
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border, #e2e8f0);
  text-align: center;
}

/* --- Bordered data table (flow_analysis / matching tables with full borders) --- */
.bordered-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 8px;
}
.bordered-table th {
  padding: 6px 8px;
  font-weight: 600;
  font-size: 11px;
}
.bordered-table th.text-left { text-align: left; }
.bordered-table th.text-center { text-align: center; }
.bordered-table th.text-right { text-align: right; }
.bordered-table td {
  padding: 5px 8px;
}
.bordered-table td.text-center { text-align: center; }
.bordered-table td.text-right { text-align: right; }
.bordered-table td.fw-600 { font-weight: 600; }

/* --- Card container box (flow_analysis section cards) --- */
.card-box {
  border-radius: 8px;
  padding: 12px;
  border: 1px solid var(--border, #e2e8f0);
}

@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3col, .grid-3col-10 { grid-template-columns: repeat(2, 1fr); }
  .dash-2col-grid { gap: 16px; }
}

@media (max-width: 600px) {
  .spec-grid { grid-template-columns: repeat(2, 1fr); }
  .cost-tile-grid { grid-template-columns: 1fr; }
  .bl-input-grid { grid-template-columns: 1fr 1fr; }
  .op-result-grid { grid-template-columns: 1fr; }
  .grid-3, .grid-3-gap6, .grid-3-gap10 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-auto-130, .grid-auto-150 { grid-template-columns: repeat(2, 1fr); }
  .grid-3col, .grid-3col-10 { grid-template-columns: 1fr; }
  .dash-2col-grid { grid-template-columns: 1fr; gap: 16px; }
}

/* ============================================================
   MOBILE TOUCH & READABILITY ENHANCEMENTS
   ============================================================ */
@media (max-width: 640px) {
  /* Touch-friendly button sizing (min 44px touch target) */
  .secondary-btn,
  .icon-btn {
    min-height: 44px;
    padding: 12px 16px;
  }

  .primary-btn {
    min-height: 44px;
  }

  /* Prevent tiny text on mobile */
  .guidance-sep { font-size: 11px; }
  .eng-table-sm { font-size: 12px; }
  .footnote, .hint-muted-xs { font-size: 11px; }

  /* Wider tap targets for scenario cards */
  .scenario-card { padding: 14px; }

  /* Prevent horizontal scroll from wide tables */
  .table-scroll-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ── Real-time field hints (blur validation) ── */
.field-hint-msg {
  display: block;
  font-size: 11px;
  margin-top: 2px;
  line-height: 1.3;
  animation: fadeInUp 0.15s ease;
}

.field-hint-msg.hint-error {
  color: var(--signal);
}

.field-hint-msg.hint-warning {
  color: var(--warning, #d97706);
}

html.dark .field-hint-msg.hint-warning {
  color: #fbbf24;
}

/* ── Empty state guidance for results panels ── */
.results-empty-guide {
  text-align: center;
  padding: 32px 20px;
  color: var(--muted);
}

.results-empty-guide h4 {
  color: var(--heading);
  font-size: 0.95rem;
  margin: 0 0 12px;
  font-weight: 600;
}

.results-empty-guide .guide-steps {
  text-align: left;
  display: inline-block;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.82rem;
  line-height: 1.8;
}

.results-empty-guide .guide-steps li::before {
  content: attr(data-step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.7rem;
  margin-right: 8px;
}

.results-empty-guide .guide-hint {
  margin-top: 12px;
  font-size: 0.75rem;
  color: var(--muted);
  opacity: 0.8;
}

html.dark .results-empty-guide h4 {
  color: var(--heading);
}

html.dark .results-empty-guide .guide-steps li::before {
  background: rgba(100, 140, 200, 0.15);
  color: #93b5e0;
}

.results-empty-guide kbd {
  background: var(--bg-alt, #f1f5f9);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: "SF Mono", "Consolas", monospace;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--heading, #475569);
}

html.dark .results-empty-guide kbd {
  background: rgba(100, 120, 150, 0.15);
  border-color: rgba(100, 120, 150, 0.25);
  color: #8899aa;
}

/* Icon-only window control buttons (maximize/minimize on curve drawer) */
.icon-only-btn {
  min-width: 34px;
  width: 34px;
  height: 34px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  font-weight: 600;
}

/* Hide catalog breadcrumb navigation (per UX feedback) */
nav.breadcrumb,
.cat-breadcrumb,
.breadcrumb,
.your-path-nav,
#wf-breadcrumb { display: none !important; }

/* ============================================================
   Preview / Under Construction banner
   ============================================================ */
.hc-preview-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: linear-gradient(90deg, #fef3c7, #fde68a 40%, #fef3c7);
  color: #78350f;
  font-size: 13.5px;
  line-height: 1.45;
  border-bottom: 1px solid #f59e0b;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
  position: relative;
  z-index: 900;
}
.hc-preview-banner-icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}
.hc-preview-banner-text { flex: 1; }
.hc-preview-banner-text a {
  color: #1d4ed8;
  text-decoration: underline;
  font-weight: 600;
}
.hc-preview-banner-text a:hover { color: #1e40af; }
.hc-preview-banner-close {
  background: transparent;
  border: none;
  color: #78350f;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}
.hc-preview-banner-close:hover { opacity: 1; background: rgba(120, 53, 15, 0.08); }
html.dark .hc-preview-banner {
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.18), rgba(251, 191, 36, 0.28) 40%, rgba(251, 191, 36, 0.18));
  color: #fde68a;
  border-bottom-color: rgba(251, 191, 36, 0.4);
}
html.dark .hc-preview-banner-text a { color: #93c5fd; }
html.dark .hc-preview-banner-close { color: #fde68a; }
@media (max-width: 700px) {
  .hc-preview-banner { padding: 8px 12px; font-size: 12px; gap: 8px; }
}

/* ============================================================
   In-page tab bar (headloss calculator only)
   ============================================================ */
/* Hide sections belonging to inactive tabs. Uses !important so it
   overrides any layout rule but still lets inline `display:none`
   from the template keep empty result cards hidden inside active tabs. */
.hc-tab-hidden { display: none !important; }

/* Sub-section group headers within a tab (e.g., Summary / Diagram / Next Steps in Results) */
.hc-group-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0 8px;
  padding: 0 4px;
}
.hc-group-header::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line, rgba(100, 120, 150, 0.18));
}
.hc-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent, #0f4c81);
  background: var(--accent-soft, rgba(15, 76, 129, 0.08));
  padding: 4px 12px;
  border-radius: 999px;
}
html.dark .hc-group-label {
  color: #93c5fd;
  background: rgba(96, 165, 250, 0.15);
}
.hc-group-header:first-child {
  margin-top: 8px;
}

/* Compact hero when not on Inputs tab so results aren't buried below it */
body.hc-tab-results .hero,
body.hc-tab-charts .hero,
body.hc-tab-scenarios .hero {
  padding: 14px 24px !important;
  margin-bottom: 0 !important;
}
body.hc-tab-results .hero h1,
body.hc-tab-charts .hero h1,
body.hc-tab-scenarios .hero h1 {
  font-size: 1.4rem !important;
  margin: 0 !important;
  line-height: 1.2;
}
body.hc-tab-results .hero .hero-subtitle,
body.hc-tab-results .hero > p,
body.hc-tab-charts .hero .hero-subtitle,
body.hc-tab-charts .hero > p,
body.hc-tab-scenarios .hero .hero-subtitle,
body.hc-tab-scenarios .hero > p,
body.hc-tab-results .hero .hero-hint,
body.hc-tab-charts .hero .hero-hint,
body.hc-tab-scenarios .hero .hero-hint {
  display: none !important;
}
body.hc-tab-results .hero .hero-actions,
body.hc-tab-charts .hero .hero-actions,
body.hc-tab-scenarios .hero .hero-actions {
  margin-top: 0 !important;
}
body.hc-tab-results .hero .hero-actions-group,
body.hc-tab-charts .hero .hero-actions-group,
body.hc-tab-scenarios .hero .hero-actions-group {
  padding: 4px 8px;
  padding-top: 14px;
}
body.hc-tab-results .hero .hero-actions-group .secondary-btn,
body.hc-tab-charts .hero .hero-actions-group .secondary-btn,
body.hc-tab-scenarios .hero .hero-actions-group .secondary-btn {
  padding: 5px 8px;
  font-size: 12px;
}
body.hc-tab-results .hero .web-edition,
body.hc-tab-charts .hero .web-edition,
body.hc-tab-scenarios .hero .web-edition,
body.hc-tab-results .hero-eyebrow,
body.hc-tab-charts .hero-eyebrow,
body.hc-tab-scenarios .hero-eyebrow {
  display: none !important;
}

.hc-tab-bar {
  display: flex;
  gap: 4px;
  padding: 6px;
  background: var(--panel-strong, #ffffff);
  border: 1px solid var(--line, rgba(100, 120, 150, 0.15));
  border-radius: 14px;
  margin: 16px auto 24px;
  width: fit-content;
  max-width: calc(100% - 32px);
  position: sticky;
  top: 68px;
  z-index: 500;
  box-shadow: 0 4px 16px rgba(15, 76, 129, 0.06);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
}
html.dark .hc-tab-bar {
  background: rgba(30, 40, 55, 0.85);
  border-color: rgba(100, 120, 150, 0.25);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.hc-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: transparent;
  color: var(--muted, #64748b);
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}
.hc-tab-btn:hover {
  background: var(--bg-alt, rgba(248, 250, 252, 0.8));
  color: var(--text, #1e293b);
}
html.dark .hc-tab-btn:hover {
  background: rgba(59, 130, 246, 0.12);
  color: #e2e8f0;
}
.hc-tab-btn.active {
  background: var(--accent, #0f4c81);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(15, 76, 129, 0.25);
}
html.dark .hc-tab-btn.active {
  background: #4da3ff;
  color: #0a0f16;
  box-shadow: 0 2px 8px rgba(77, 163, 255, 0.35);
}
.hc-tab-btn:focus-visible {
  outline: 2px solid var(--accent, #0f4c81);
  outline-offset: 2px;
}
.hc-tab-icon {
  font-size: 16px;
  line-height: 1;
}
@media (max-width: 720px) {
  .hc-tab-bar { top: 56px; padding: 4px; gap: 2px; }
  .hc-tab-btn { padding: 8px 10px; font-size: 12px; }
  .hc-tab-label { display: none; }
  .hc-tab-icon { font-size: 20px; }
}

/* ============================================================
   Hero action buttons — grouped layout
   ============================================================ */
.hero-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}
.hero-actions-primary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hero-actions-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 8px 10px;
  background: var(--bg-alt, rgba(248, 250, 252, 0.5));
  border: 1px solid var(--line, rgba(100, 120, 150, 0.15));
  border-radius: 10px;
  position: relative;
  padding-top: 20px;
}
.hero-actions-group .secondary-btn {
  padding: 8px 10px;
  font-size: 13px;
  white-space: nowrap;
}
.hero-actions-label {
  position: absolute;
  top: -8px;
  left: 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted, #64748b);
  background: var(--panel-strong, #fff);
  padding: 0 6px;
}
html.dark .hero-actions-group {
  background: rgba(30, 40, 55, 0.4);
  border-color: rgba(100, 120, 150, 0.25);
}
html.dark .hero-actions-label {
  background: var(--panel-strong, #1a2332);
}
/* On narrow screens, let the group buttons stack */
@media (max-width: 500px) {
  .hero-actions-group { grid-template-columns: 1fr; }
}

/* ============================================================
   Collapsible panel cards
   ============================================================ */
.collapsible-card .collapsible-card-header {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 36px;
  position: relative;
  transition: opacity 0.15s ease;
}
.collapsible-card .collapsible-card-header:hover {
  opacity: 0.85;
}
.collapsible-card .collapsible-card-header h2,
.collapsible-card .collapsible-card-header h3 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
/* Chevron indicator on the right of the heading */
.collapsible-card .collapsible-card-header::after {
  content: "";
  position: absolute;
  right: 8px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--muted, #94a3b8);
  border-bottom: 2px solid var(--muted, #94a3b8);
  transform: translateY(-65%) rotate(45deg);
  transition: transform 0.25s ease;
  pointer-events: none;
}
.collapsible-card.card-collapsed .collapsible-card-header::after {
  transform: translateY(-25%) rotate(-45deg);
}
/* Hide everything in the card except the header(ish) when collapsed */
.collapsible-card.card-collapsed > *:not(.collapsible-card-header):not(h2):not(h3) {
  display: none !important;
}
.collapsible-card.card-collapsed {
  padding-bottom: 0;
}
.collapsible-card.card-collapsed .collapsible-card-header {
  margin-bottom: 0 !important;
}
/* Smooth fade-in when expanding */
.collapsible-card:not(.card-collapsed) > *:not(.collapsible-card-header):not(h2):not(h3) {
  animation: cardFadeIn 0.2s ease;
}
@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
/* Subtle accent color on header when expanded */
.collapsible-card:not(.card-collapsed) .collapsible-card-header h2,
.collapsible-card:not(.card-collapsed) .collapsible-card-header h3 {
  color: var(--accent, #0f4c81);
}
html.dark .collapsible-card:not(.card-collapsed) .collapsible-card-header h2,
html.dark .collapsible-card:not(.card-collapsed) .collapsible-card-header h3 {
  color: var(--accent, #4da3ff);
}

/* Clickable pump type cards in Pump Selector results */
.ps-result-card-clickable {
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.ps-result-card-clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(15, 76, 129, 0.12);
  border-color: var(--accent, #0f4c81);
}
.ps-result-card-clickable:focus-visible {
  outline: 2px solid var(--accent, #0f4c81);
  outline-offset: 2px;
}
.ps-result-action {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line, rgba(100,120,150,0.25));
  text-align: right;
}
.ps-find-matching-btn {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--accent, #0f4c81);
  color: white;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.12s ease;
}
.ps-find-matching-btn:hover {
  background: #0d3d68;
  text-decoration: none;
}
html.dark .ps-find-matching-btn {
  background: #4da3ff;
  color: #0a0f16;
}
html.dark .ps-find-matching-btn:hover {
  background: #66b3ff;
}

/* ===========================================================================
 * Sign-in modal (WEBSITEPLAN Phase 1.2). Used by web_app/static/signin_modal.js
 * to gate anonymous "core" interactions (Compute, Save, Open Drawer).
 * =========================================================================== */

.signin-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: hcSigninFadeIn 140ms ease-out;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
@keyframes hcSigninFadeIn { from { opacity: 0; } to { opacity: 1; } }

.signin-modal-card {
  position: relative;
  background: #ffffff;
  width: 100%;
  max-width: 440px;
  border-radius: 14px;
  padding: 28px 28px 22px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.25);
  animation: hcSigninSlideUp 180ms ease-out;
}
@keyframes hcSigninSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
html.dark .signin-modal-card { background: #0f172a; color: #e2e8f0; }

.signin-modal-close {
  position: absolute; top: 12px; right: 12px;
  background: transparent; border: 0;
  font-size: 22px; line-height: 1; cursor: pointer;
  color: #6b7a90; padding: 4px 10px; border-radius: 6px;
}
.signin-modal-close:hover { background: rgba(15,76,129,0.08); }
html.dark .signin-modal-close { color: #94a3b8; }
html.dark .signin-modal-close:hover { background: rgba(255,255,255,0.06); }

.signin-modal-title {
  margin: 0 0 4px 0; font-size: 19px;
  color: #0f4c81; font-weight: 700;
}
.signin-modal-subtitle {
  margin: 0 0 18px 0; font-size: 13.5px;
  color: #6b7a90; line-height: 1.45;
}
html.dark .signin-modal-subtitle { color: #94a3b8; }

.signin-modal-tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid #e5e9f0;
  margin-bottom: 16px;
}
html.dark .signin-modal-tabs { border-bottom-color: rgba(148,163,184,0.2); }

.signin-modal-tab {
  background: transparent; border: 0;
  border-bottom: 2px solid transparent;
  padding: 8px 12px;
  font-size: 13px; font-weight: 600;
  color: #6b7a90; cursor: pointer;
  margin-bottom: -1px;
}
.signin-modal-tab:hover { color: #0f4c81; }
.signin-modal-tab.is-active { color: #0f4c81; border-bottom-color: #0f4c81; }
html.dark .signin-modal-tab { color: #94a3b8; }
html.dark .signin-modal-tab.is-active { color: #93c5fd; border-bottom-color: #93c5fd; }

.signin-modal-pane { display: none; flex-direction: column; gap: 12px; }
.signin-modal-pane.is-active { display: flex; }

.signin-modal-label {
  display: flex; flex-direction: column;
  font-size: 12.5px; font-weight: 600;
  color: #132238; gap: 6px;
}
html.dark .signin-modal-label { color: #e2e8f0; }

.signin-modal-label input {
  border: 1px solid rgba(100,120,150,0.32);
  border-radius: 8px; padding: 9px 12px;
  font-size: 14px; font-family: inherit;
  outline: none;
}
.signin-modal-label input:focus {
  border-color: #0f4c81;
  box-shadow: 0 0 0 3px rgba(15,76,129,0.15);
}
html.dark .signin-modal-label input {
  background: #0a0f1a; color: #e2e8f0;
  border-color: rgba(148,163,184,0.25);
}

.signin-modal-hint { font-size: 11.5px; color: #94a3b8; font-weight: 500; }

.signin-modal-submit {
  margin-top: 6px; padding: 10px 16px;
  font-size: 14px; font-weight: 700;
}

.signin-modal-help {
  display: inline-block; margin-top: 4px;
  font-size: 12.5px; color: #6b7a90;
  text-align: center; text-decoration: none;
}
.signin-modal-help:hover { color: #0f4c81; text-decoration: underline; }

.signin-modal-footer {
  margin-top: 16px; padding-top: 12px;
  border-top: 1px solid #e5e9f0;
  text-align: center; font-size: 11.5px;
  color: #94a3b8; line-height: 1.45;
}
html.dark .signin-modal-footer { border-top-color: rgba(148,163,184,0.2); }

.signin-modal-footer a { color: #0f4c81; text-decoration: none; }
.signin-modal-footer a:hover { text-decoration: underline; }
html.dark .signin-modal-footer a { color: #93c5fd; }

/* =========================================================================
 * WEBSITEPLAN1 WS-2 — Marketplace hero strip (top of homepage `/`)
 * Sits above the calculator hero. Anonymous-only. Auto-dismisses via
 * sessionStorage so repeat visitors aren't pestered.
 * ========================================================================= */
.marketplace-hero {
  position: relative;
  margin: 0 0 24px;
  padding: 28px 32px 26px;
  background: linear-gradient(135deg, #0f4c81 0%, #144c7c 55%, #0d3c66 100%);
  color: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 32px rgba(15, 76, 129, 0.22);
  overflow: hidden;
}
.marketplace-hero::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 92% 110%, rgba(255,255,255,0.10) 0%, transparent 38%),
    radial-gradient(circle at 5%  -20%, rgba(255,255,255,0.08) 0%, transparent 32%);
  pointer-events: none;
}
.mh-inner { position: relative; display: flex; align-items: flex-start; gap: 18px; }
.mh-copy { flex: 1; max-width: 920px; }
.mh-title {
  margin: 0 0 8px;
  font-size: 26px; line-height: 1.18;
  letter-spacing: -0.012em; font-weight: 700;
}
.mh-sub {
  margin: 0 0 16px;
  font-size: 15px; line-height: 1.55;
  max-width: 720px; opacity: 0.94;
}
.mh-ctas { display: flex; flex-wrap: wrap; gap: 10px; }
.mh-cta {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px; border-radius: 8px;
  font-size: 14px; font-weight: 600;
  text-decoration: none; transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
  white-space: nowrap;
}
.mh-cta-primary {
  background: #fff; color: #0f4c81;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.mh-cta-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(0,0,0,0.16); }
.mh-cta-secondary {
  background: rgba(255,255,255,0.16);
  color: #fff; border: 1px solid rgba(255,255,255,0.32);
}
.mh-cta-secondary:hover { background: rgba(255,255,255,0.24); }
.mh-cta-tertiary {
  background: transparent; color: #ffd97a;
  border: 1px dashed rgba(255,217,122,0.55);
}
.mh-cta-tertiary:hover { background: rgba(255,217,122,0.10); color: #ffe599; }
.mh-dismiss {
  flex: 0 0 auto;
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.08); color: #fff;
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 8px;
  font-size: 18px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.mh-dismiss:hover { background: rgba(255,255,255,0.16); }
@media (max-width: 720px) {
  .marketplace-hero { padding: 22px 18px 20px; }
  .mh-title { font-size: 21px; }
  .mh-sub { font-size: 14px; }
  .mh-ctas { gap: 8px; }
  .mh-cta { font-size: 13px; padding: 9px 13px; }
  .mh-dismiss { width: 28px; height: 28px; }
}
html.dark .marketplace-hero {
  background: linear-gradient(135deg, #0c3a64 0%, #0a2f52 55%, #07223e 100%);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
}
html.dark .mh-cta-primary { background: #e6effa; color: #0a2f52; }

/* =========================================================================
 * WEBSITEPLAN1 WS-8 — Manufacturer signup CTA strip (bottom of /learn, /catalog)
 * ========================================================================= */
.mfr-cta-strip {
  margin: 32px 0 12px;
  padding: 18px 22px;
  border-radius: 12px;
  background: linear-gradient(120deg, rgba(15,76,129,0.05) 0%, rgba(15,76,129,0.10) 100%);
  border: 1px dashed rgba(15,76,129,0.30);
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.mfr-cta-strip-text { flex: 1; min-width: 220px; }
.mfr-cta-strip-title { margin: 0 0 4px; font-size: 16px; font-weight: 700; color: var(--text, #1c1917); }
.mfr-cta-strip-sub { margin: 0; font-size: 13px; color: var(--text-muted, #57534e); line-height: 1.5; }
.mfr-cta-strip-action {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; border-radius: 8px;
  background: #0f4c81; color: #fff;
  font-size: 14px; font-weight: 600;
  text-decoration: none;
  transition: background 0.12s, transform 0.12s;
}
.mfr-cta-strip-action:hover { background: #0a2f52; transform: translateY(-1px); }
html.dark .mfr-cta-strip {
  background: linear-gradient(120deg, rgba(147,197,253,0.05) 0%, rgba(147,197,253,0.10) 100%);
  border-color: rgba(147,197,253,0.30);
}
html.dark .mfr-cta-strip-title { color: #e2e8f0; }
html.dark .mfr-cta-strip-sub { color: #94a3b8; }
html.dark .mfr-cta-strip-action { background: #2563eb; }
html.dark .mfr-cta-strip-action:hover { background: #1d4ed8; }

/* =========================================================================
 * WEBSITEPLAN1 WS-3 — Soft signin toast (post-compute prompt)
 * ========================================================================= */
#hc-signin-toast {
  position: fixed;
  right: 18px; bottom: 18px;
  z-index: 9500;
  max-width: 360px;
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px 14px 14px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e9f0);
  border-left: 4px solid #0f4c81;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.08);
  opacity: 0; transform: translateY(16px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
#hc-signin-toast.hc-toast-visible { opacity: 1; transform: translateY(0); }
.hc-toast-icon { font-size: 22px; line-height: 1; padding-top: 1px; }
.hc-toast-body { flex: 1; min-width: 0; }
.hc-toast-title { display: block; font-size: 14px; font-weight: 700; margin-bottom: 4px; color: var(--text, #1c1917); }
.hc-toast-sub { margin: 0 0 10px; font-size: 12.5px; color: var(--text-muted, #57534e); line-height: 1.45; }
.hc-toast-actions { display: flex; gap: 8px; }
.hc-toast-btn-primary,
.hc-toast-btn-secondary {
  font-size: 12.5px; padding: 6px 12px;
  border-radius: 6px; cursor: pointer; font-weight: 600;
  border: 1px solid transparent; transition: background 0.12s;
}
.hc-toast-btn-primary { background: #0f4c81; color: #fff; }
.hc-toast-btn-primary:hover { background: #0a2f52; }
.hc-toast-btn-secondary {
  background: transparent; color: var(--text-muted, #57534e);
  border-color: var(--border, #e5e9f0);
}
.hc-toast-btn-secondary:hover { background: rgba(15,23,42,0.04); }
.hc-toast-close {
  flex: 0 0 auto;
  background: transparent; border: none; cursor: pointer;
  color: var(--text-muted, #94a3b8);
  font-size: 18px; line-height: 1; padding: 2px 6px;
  margin: -4px -4px 0 0;
}
.hc-toast-close:hover { color: var(--text, #1c1917); }
html.dark #hc-signin-toast {
  background: #1f2937;
  border-color: rgba(148,163,184,0.18);
  border-left-color: #2563eb;
}
html.dark .hc-toast-title { color: #e2e8f0; }
html.dark .hc-toast-sub { color: #94a3b8; }
html.dark .hc-toast-btn-primary { background: #2563eb; }
html.dark .hc-toast-btn-primary:hover { background: #1d4ed8; }
html.dark .hc-toast-btn-secondary { color: #94a3b8; border-color: rgba(148,163,184,0.22); }
html.dark .hc-toast-btn-secondary:hover { background: rgba(148,163,184,0.08); }
@media (max-width: 480px) {
  #hc-signin-toast { right: 10px; left: 10px; bottom: 12px; max-width: none; }
}

/* =========================================================================
 * WEBSITEPLAN1 WS-7 — global a11y + polish
 * Single canonical focus ring + smooth scroll + tabular-nums for numeric
 * input fields + reduced-motion respect.
 * ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
html { scroll-behavior: smooth; }
*:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 4px;
}
input[type=number],
.kpi-value,
.metric-value,
.num,
td.num {
  font-variant-numeric: tabular-nums;
}
