/* ============================================================
   DEFTENG ENGINEERING — Design System
   Blue / Black / White  |  Glossy Gradient Interface
   ============================================================ */

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  /* Exact tokens ported from the Claude Design "Pole Shed Designer App UI
     Redesign" handoff (oklch, hue 258 for the neutral/blue ramp). --blue-*
     names are kept so every existing rule that references them repaints
     automatically; --blue-500 is now the mockup's literal accent color. */
  --bg:          oklch(15.5% 0.012 258);
  --surface-1:   oklch(18% 0.014 258);
  --surface-2:   oklch(19% 0.014 258);
  --surface-3:   oklch(22% 0.016 258);
  --border:      oklch(30% 0.02 258);
  --border-dim:  oklch(27% 0.018 258 / 0.6);
  --border-dim2: oklch(26% 0.016 258 / 0.6);

  --blue-900:    oklch(30% 0.14 258);
  --blue-800:    oklch(38% 0.16 258);
  --blue-700:    oklch(46% 0.18 258);
  --blue-600:    oklch(54% 0.19 258);
  --blue-500:    oklch(62% 0.19 258);
  --blue-400:    oklch(70% 0.16 258);
  --blue-300:    oklch(78% 0.13 258);
  --blue-200:    oklch(85% 0.10 258);

  --accent-label: oklch(60% 0.16 258);  /* uppercase card/section headings */
  --accent-cyan:  oklch(76% 0.15 200);  /* Vu / primary numeric highlight */
  --accent-warm:  oklch(65% 0.16 25);   /* destructive text links, e.g. "Remove Auto" */

  --text:        oklch(92% 0.006 258);
  --text-bright: oklch(97% 0.004 258);
  --text-muted:  oklch(66% 0.012 258);
  --text-muted-2: oklch(68% 0.012 258);
  --text-dim:    oklch(50% 0.015 258);
  --white:       #ffffff;

  --success:     #10b981;
  --warning:     #f59e0b;
  --danger:      #ef4444;

  /* Pass/fail status text — split from --success/--danger because these are
     tuned as *light* tints for readability on dark surfaces; light theme
     needs darker tints instead for readability on light surfaces. */
  --pass-text:   var(--pass-text);
  --fail-text:   var(--fail-text);

  /* Generic "lighten the surface a touch" overlay used for hover/active
     states on neutral surfaces (buttons, tabs, menus, scrollbars). Inverts
     between themes since dark theme lightens with white and light theme
     darkens with black. */
  --hover-tint:      rgba(255,255,255,0.06);
  --scrollbar-thumb: rgba(255,255,255,0.1);

  --radius:      8px;
  --radius-lg:   12px;
  --radius-pill: 99px;
  --transition:  150ms ease;

  --header-h:    64px;
  --sidebar-w:   220px;
  --font:        'Manrope', system-ui, sans-serif;
  --font-mono:   'IBM Plex Mono', ui-monospace, monospace;
}

/* ── Light theme ────────────────────────────────────────────────
   Toggled via [data-theme="light"] on <html> (see theme-init.js /
   setTheme() in app.js). Only the tokens that actually need to invert
   between themes are redefined here — everything else (blue-500..900
   accents, success/warning/danger, radii, spacing) stays identical so
   buttons, badges and brand colors read the same in both themes. */
[data-theme="light"] {
  --bg:          oklch(96% 0.006 258);
  --surface-1:   oklch(99% 0.004 258);
  --surface-2:   oklch(100% 0 0);
  --surface-3:   oklch(97% 0.006 258);
  --border:      oklch(85% 0.014 258);
  --border-dim:  oklch(89% 0.01 258 / 0.9);
  --border-dim2: oklch(90% 0.009 258 / 0.9);

  /* blue-200/300/400 are used as pale "bright text on dark surface" accents
     (active nav tab, badges, sidebar highlights) — on a light surface those
     same roles need a dark, saturated blue instead. blue-500..900 (used as
     saturated fills/shadows) read fine on white unchanged, so are untouched. */
  --blue-200:    oklch(34% 0.15 258);
  --blue-300:    oklch(42% 0.17 258);
  --blue-400:    oklch(48% 0.18 258);

  --accent-label: oklch(46% 0.16 258);

  --text:        oklch(28% 0.02 258);
  --text-bright: oklch(14% 0.016 258);
  --text-muted:  oklch(46% 0.022 258);
  --text-muted-2: oklch(43% 0.022 258);
  --text-dim:    oklch(58% 0.02 258);

  --pass-text:   #15803d;
  --fail-text:   #b91c1c;

  --hover-tint:      rgba(15,23,42,0.05);
  --scrollbar-thumb: rgba(15,23,42,0.16);
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: none; background: none; }
img, svg { display: block; }
ul, ol { list-style: none; }
table { border-collapse: collapse; }

/* ── Shared Components ──────────────────────────────────────── */

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: var(--radius);
  font-size: 0.85rem; font-weight: 600; letter-spacing: 0.01em;
  transition: all var(--transition); white-space: nowrap;
}
.btn-primary {
  background: var(--blue-500);
  color: var(--white);
  box-shadow: 0 4px 14px oklch(62% 0.19 258 / 0.35);
}
.btn-primary:hover { background: var(--blue-600); box-shadow: 0 4px 16px oklch(62% 0.19 258 / 0.45); }
.btn-outline {
  background: oklch(62% 0.19 258 / 0.14); color: var(--blue-300);
  border: 1px solid oklch(62% 0.19 258 / 0.5);
}
.btn-outline:hover { background: oklch(62% 0.19 258 / 0.22); border-color: var(--blue-500); }
.btn-white {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border);
}
.btn-white:hover { background: var(--surface-3); border-color: var(--text-muted); color: var(--text-bright); }
.btn-ghost  { background: transparent; color: var(--text-muted); }
.btn-ghost:hover  { color: var(--text); background: var(--hover-tint); }
.btn-danger { background: rgba(239,68,68,0.15); color: var(--fail-text); border: 1px solid rgba(239,68,68,0.4); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-full { width: 100%; justify-content: center; }

/* Inputs */
.input, input[type="text"], input[type="number"], input[type="email"],
input[type="password"], input[type="date"], select, textarea {
  width: 100%;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 12px;
  font: 500 0.85rem/1.3 var(--font);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}
.input:focus, input[type="text"]:focus, input[type="number"]:focus,
input[type="email"]:focus, input[type="password"]:focus,
input[type="date"]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px oklch(62% 0.19 258 / 0.2);
}
.input::placeholder, input::placeholder { color: var(--text-dim); }
select option { background: var(--surface-2); }
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  opacity: 0.7;
  cursor: pointer;
}

/* Radio / Checkbox */
input[type="radio"], input[type="checkbox"] {
  width: 14px; height: 14px;
  accent-color: var(--blue-500);
  cursor: pointer;
}

/* Card */
.card {
  background: var(--surface-2);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-lg);
  padding: 1rem;
}
.card-hd {
  display: flex; align-items: center; gap: 7px;
  padding-bottom: 0.6rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-dim);
  font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent-label); font-weight: 700;
}
.card-hd svg { width: 15px; height: 15px; flex-shrink: 0; }

/* Section header (card titles) — small uppercase caption, mockup-exact */
.section-hd {
  display: flex; align-items: center; gap: 7px;
  font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-label);
  margin-bottom: 0.75rem; font-weight: 700;
}
.section-hd svg { width: 14px; height: 14px; opacity: 0.85; }

/* Field group — label sits centred in the whitespace between it and the
   fields above/below (equal gap here and via the parent's stack gap). */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label, .field-lbl { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; }

/* Divider */
.divider { height: 1px; background: var(--border-dim); margin: 0.75rem 0; }

/* Badge */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 0; font-size: 0.7rem; font-weight: 600;
}
.badge-blue { background: rgba(29,78,216,0.2); color: var(--blue-300); border: 1px solid var(--blue-800); }

/* Alert */
.alert {
  padding: 8px 12px; border-radius: var(--radius);
  font-size: 0.82rem; display: flex; align-items: center; gap: 6px;
}
.alert-error { background: rgba(239,68,68,0.1); color: var(--fail-text); border: 1px solid rgba(239,68,68,0.3); }

/* Utility */
.hidden     { display: none !important; }
.flex       { display: flex; }
.flex-col   { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.gap-2      { gap: 0.5rem; }
.gap-3      { gap: 0.75rem; }
.mt-2       { margin-top: 0.5rem; }
.mt-3       { margin-top: 0.75rem; }
.mt-4       { margin-top: 1rem; }
.text-sm    { font-size: 0.8rem; }
.text-muted { color: var(--text-muted); }
.text-blue  { color: var(--blue-400); }
.fw-600     { font-weight: 600; }
.spinner {
  width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white; border-radius: 50%;
  animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Scrollbars — themed to match the dark UI ────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(29,78,216,0.55); }
::-webkit-scrollbar-corner { background: transparent; }
* { scrollbar-width: thin; scrollbar-color: var(--scrollbar-thumb) transparent; }

/* ── App Shell ──────────────────────────────────────────────── */
.app-shell { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ── Header ─────────────────────────────────────────────────── */
.app-header {
  height: var(--header-h); flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1rem;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-dim);
  z-index: 100;
}
.header-left  { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.header-center { flex: 1; display: flex; justify-content: center; }
.header-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* ── Auto-save status pill (between Report and Save) ── */
.autosave-status {
  font-size: 0.72rem; font-weight: 600; white-space: nowrap;
  color: var(--text-muted); opacity: 0; transition: opacity .2s ease, color .2s ease;
  display: inline-flex; align-items: center; gap: 5px; min-width: 0;
}
.autosave-status::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}
.autosave-status.is-visible { opacity: 1; }
.autosave-status.is-pending { color: var(--text-muted); }
.autosave-status.is-saving  { color: var(--blue-300); }
.autosave-status.is-saved   { color: var(--pass-text); }
.autosave-status.is-error   { color: var(--danger); }
.autosave-status.is-saving::before { animation: autosave-pulse 1s ease-in-out infinite; }
@keyframes autosave-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@media (max-width: 900px) { .autosave-status { display: none; } }

/* ── Menubar strip (below header, content area width, sidebar-offset) ── */
.app-menubar-strip {
  display: flex; flex-shrink: 0; align-items: stretch;
  height: 30px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-dim);
  z-index: 99;
}
/* Spacer that matches the sidebar width so menubar starts right after it */
.sidebar-spacer-mb {
  width: var(--sidebar-w); flex-shrink: 0;
  border-right: 1px solid var(--border-dim);
  transition: width 0.2s ease;
}
/* Spacer width toggled via JS on sidebar collapse */

/* Brand */
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(145deg, var(--blue-400), var(--blue-700));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px oklch(62% 0.19 258 / 0.35);
  font-family: var(--font-mono); font-size: 15px; font-weight: 800;
  color: white; line-height: 1.1; text-align: center; letter-spacing: 0.02em;
  flex-shrink: 0;
}
.brand-text { line-height: 1.15; }
.brand-name {
  font-family: var(--font); font-size: 1.05rem; font-weight: 800;
  color: var(--text-bright); letter-spacing: -0.01em;
}
.brand-sub { font-family: var(--font-mono); font-size: 0.64rem; font-weight: 600; color: var(--accent-label); letter-spacing: 0.14em; }
/* App-branding logo (replaces the DE mark + wordmark in the header) */
.brand-logo { height: 44px; width: auto; display: block; }

/* Announcement / notification banner — scheduled from the Admin Console,
   shown full-width below the header. Type sets the accent color. */
.app-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 24px; font-size: 0.82rem; font-weight: 600;
  background: oklch(62% 0.19 258 / 0.14); color: var(--blue-200);
  border-bottom: 1px solid oklch(62% 0.19 258 / 0.35);
  flex-shrink: 0;
}
.app-banner.type-celebration { background: oklch(72% 0.15 150 / 0.14); color: oklch(85% 0.12 150); border-bottom-color: oklch(72% 0.15 150 / 0.35); }
.app-banner.type-maintenance { background: oklch(75% 0.16 70 / 0.14); color: oklch(85% 0.13 70); border-bottom-color: oklch(75% 0.16 70 / 0.35); }
.app-banner-icon { flex-shrink: 0; display: flex; }
.app-banner-icon svg { width: 16px; height: 16px; }
.app-banner-text { flex: 1; }
.app-banner-close { flex-shrink: 0; background: none; border: none; color: inherit; font-size: 1.2rem; line-height: 1; cursor: pointer; opacity: 0.7; padding: 0 2px; }
.app-banner-close:hover { opacity: 1; }

/* Nav tabs */
.nav-tabs { display: flex; align-items: center; gap: 4px; }
.nav-tab {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--radius);
  font-size: 0.95rem; font-weight: 500; color: var(--text-muted);
  transition: all var(--transition); white-space: nowrap; position: relative;
}
.nav-tab svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav-tab:hover  { color: var(--text); background: var(--hover-tint); }
.nav-tab.active {
  color: var(--blue-300);
  background: oklch(62% 0.19 258 / 0.18);
  box-shadow: 0 -2px 0 var(--blue-500) inset;
}

/* User block */
.user-name { font-size: 0.78rem; font-weight: 600; color: var(--text-bright); }
.user-role { font-size: 0.65rem; color: var(--text-muted); }
.btn-logout {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: var(--radius);
  font-size: 0.75rem; font-weight: 500; color: var(--blue-400);
  border: 1px solid var(--border); background: transparent;
  transition: all var(--transition);
}
.btn-logout:hover { background: rgba(239,68,68,0.1); color: var(--fail-text); border-color: rgba(239,68,68,0.4); }
.btn-logout svg { width: 13px; height: 13px; }

/* ── App Body ────────────────────────────────────────────────── */
.app-body {
  flex: 1; display: flex; overflow: hidden; position: relative;
}

/* ── Footer ──────────────────────────────────────────────────── */
/* Lives at the bottom of the scrollable main content (not pinned), so it only
   comes into view once the user scrolls to the bottom. Negative margins break
   it out of the .app-main padding so it spans edge-to-edge along the bottom. */
.app-footer {
  flex-shrink: 0; margin: 2rem -1.25rem -1.25rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; padding: 8px 1rem;
  background: var(--surface-1);
  border-top: 1px solid var(--border-dim);
  font-size: 0.72rem; color: var(--text-muted); text-align: center; line-height: 1.4;
}
.app-footer-sub { color: var(--text-dim); letter-spacing: 0.04em; font-size: 0.68rem; }

/* ── Shed Design top toolbar (member-type cards) ───────────────── */
.shed-toolbar {
  display: flex; flex-wrap: wrap; align-items: stretch; gap: 12px;
  margin-bottom: 14px;
}
.shed-tool-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; flex: 1 1 140px; min-width: 140px;
  padding: 12px 12px; border-radius: var(--radius-lg);
  font-size: 0.82rem; font-weight: 600; text-align: center; line-height: 1.3;
  color: var(--text-muted); background: var(--surface-2);
  border: 1px solid var(--border); transition: all var(--transition);
}
.stb-icon {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0;
  background: oklch(62% 0.19 258 / 0.14); color: var(--blue-300);
  transition: all var(--transition);
}
.stb-icon svg { width: 18px; height: 18px; }
.shed-tool-btn:hover { color: var(--text); background: rgba(29,78,216,0.1); border-color: var(--blue-700); }
.shed-tool-btn.active {
  color: var(--blue-300); background: rgba(29,78,216,0.14);
  border-color: var(--blue-500);
}
.shed-tool-btn.active .stb-icon { background: var(--blue-500); color: var(--white); }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--surface-1);
  border-right: 1px solid var(--border-dim);
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  transition: width var(--transition);
}
.sidebar.collapsed { width: 0; overflow: hidden; }
.sidebar-hd {
  display: flex; align-items: center; gap: 8px;
  padding: 0.75rem 0.85rem 0.6rem;
  border-bottom: 1px solid var(--border-dim);
}
.sidebar-accent { width: 3px; height: 28px; background: linear-gradient(180deg, var(--blue-500), var(--blue-700)); border-radius: 0; flex-shrink: 0; }
.sidebar-title-wrap { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sidebar-eyebrow { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-dim); }
.sidebar-title { font-size: 0.92rem; font-weight: 700; color: var(--text-bright); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-menu { padding: 0.5rem 0.5rem; display: flex; flex-direction: column; gap: 6px; }
/* Button / tab styled sidebar items */
.sidebar-item {
  position: relative; display: flex; align-items: center; gap: 9px;
  padding: 10px 12px; border: 1px solid var(--border); background: var(--surface-1);
  border-radius: var(--radius); overflow: hidden;
  font-size: 0.78rem; font-weight: 500; color: var(--text-muted);
  cursor: pointer; transition: all var(--transition); white-space: nowrap;
}
.sidebar-item::before {                       /* left accent bar (tab indicator) */
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: transparent; transition: background var(--transition);
}
.sidebar-item:hover { color: var(--text); border-color: var(--blue-500); background: rgba(29,78,216,0.07); }
.sidebar-item:hover::before { background: var(--blue-500); }
.sidebar-item.active { color: var(--blue-200); border-color: var(--blue-500); background: rgba(29,78,216,0.16); font-weight: 600; }
.sidebar-item.active::before { background: var(--blue-400); }

/* Sidebar toggle btn (in header) */
.btn-sidebar-toggle {
  display: flex; align-items: center;
  padding: 5px 8px; border-radius: var(--radius);
  color: var(--text-muted); transition: all var(--transition);
  border: 1px solid transparent;
}
.btn-sidebar-toggle:hover { color: var(--text); border-color: var(--border); }
.btn-sidebar-toggle svg { width: 16px; height: 16px; }

/* ── Main Content ────────────────────────────────────────────── */
.app-main { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; display: flex; flex-direction: column; }

/* Tab panels */
.tab-panel { display: none; flex: 1; }
.tab-panel.active { display: flex; flex-direction: column; gap: 1rem; }

/* ── Project Data Panel — 3 columns (project meta | loads & geometry | site & wind summary) ── */
.project-layout { display: grid; grid-template-columns: minmax(248px, 278px) minmax(0, 1fr) minmax(206px, 236px); gap: 0.9rem; align-items: stretch; }
.pcol-left { display: flex; flex-direction: column; gap: 0.9rem; min-width: 0; }
.pcol-mid { display: flex; flex-direction: column; gap: 0.9rem; min-width: 0; }
.pcol-right { display: flex; flex-direction: column; gap: 0.9rem; min-width: 0; }
/* Snow / Wind / Design Loads — 3 equal-height cards */
.loads-row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.9rem; align-items: stretch; }
.loads-row3 > .card { height: 100%; }
/* Site Parameters — Eave & Pitch | Roof & Ground */
.site-params-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
/* Auto Design row at the foot of the Site & Wind Summary card */
.auto-design-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.7rem 0 0; margin-top: 0.3rem; border-top: 1px solid var(--border-dim); }
/* Big box: text on top, large animation below */
.illu-big .illu-inner { flex-direction: row-reverse; justify-content: space-between; align-items: center; gap: 1.5rem; padding: 1.5rem 2.4rem; text-align: left; width: 100%; }
.illu-big .illu-inner svg { width: auto; height: min(240px, 46vh); max-width: 50%; flex-shrink: 0; }
.illu-big .illu-tag { font-size: 1.75rem; }
.illu-big .illu-sub { font-size: 0.86rem; letter-spacing: 0.12em; }
@media (max-width: 900px) {
  .illu-big .illu-inner { flex-direction: column-reverse; text-align: center; }
  .illu-big .illu-inner svg { max-width: 165px; height: auto; }
}
/* Wind / Snow band pills (replaces vertical radio list) */
.load-options-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.load-options-row-2 { grid-template-columns: repeat(2, 1fr); }
.load-pill {
  position: relative; display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 0.74rem; font-weight: 600; color: var(--text-muted); line-height: 1.2;
  background: var(--surface-3); border: 1px solid var(--border); border-radius: 7px;
  padding: 8px 4px; cursor: pointer; transition: all var(--transition);
}
.load-pill:hover { color: var(--text); border-color: var(--border); }
.load-pill:has(input:checked) { background: oklch(62% 0.19 258 / 0.22); border-color: var(--blue-500); color: var(--blue-300); }
.load-pill input { position: absolute; opacity: 0; width: 0; height: 0; }
@media (max-width: 1400px) { .project-layout { grid-template-columns: minmax(260px, 300px) minmax(0, 1fr); } .pcol-right { grid-column: 1 / -1; } }
@media (max-width: 900px) { .loads-row3, .site-params-row2 { grid-template-columns: 1fr; } }

/* comfortable, breathable density across the Project Data panel — sized to
   fill a laptop viewport with no scroll, matching the Claude Design mockup.
   Cards stack their direct children (fields/sections) with a uniform gap that
   matches each field's own internal label→input gap, so a label sits with
   equal whitespace above (from the previous field) and below (to its input). */
#panel-project .card { padding: 10px 14px; display: flex; flex-direction: column; gap: 7px; }
#panel-project .panel-title { font-size: 0.74rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-label); margin-bottom: 0; }
#panel-project .section-hd { font-size: 0.74rem; margin-bottom: 0; }
#panel-project .form-grid-2, #panel-project .form-grid-3, #panel-project .form-grid-4 { gap: 0.5rem 0.6rem; }
#panel-project .field { gap: 6px; }
#panel-project .field input, #panel-project .field select { padding: 7px 10px; font-size: 0.85rem; }
#panel-project .field-lbl, #panel-project .field label { font-size: 0.76rem; }
#panel-project .readout { margin-top: 0; }
#panel-project .readout > div { padding: 4px 0; font-size: 0.82rem; }
#panel-project .dropzone { padding: 14px; }
#panel-project .dropzone svg { width: 20px; height: 20px; }

/* Shed Geometry card — 5-item action grid: 4 compact equal cells (2x2) plus
   one bigger "run" button spanning the 3rd column across both rows. */
.sg-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.sg-act-a { grid-column: 1; grid-row: 1; }
.sg-act-b { grid-column: 2; grid-row: 1; }
.sg-act-d { grid-column: 1; grid-row: 2; }
.sg-act-e { grid-column: 2; grid-row: 2; }
.sg-act-big { grid-column: 3; grid-row: 1 / span 2; }
.sg-actions-grid .field { align-items: center; text-align: center; justify-content: center; gap: 5px; }
.sg-actions-grid .field .field-lbl { font-size: 0.68rem; line-height: 1.2; }
.sg-actions-grid button {
  display: flex; align-items: center; justify-content: center; text-align: center;
  white-space: normal; line-height: 1.2; font-size: 0.74rem; padding: 8px 6px;
}
.sg-act-big { font-size: 0.8rem; font-weight: 700; }

/* Roof/Wall Build-up — internal vertical scroll */
.scroll-y { max-height: 210px; overflow-y: auto; padding-right: 4px; }

/* Short pole-shed banner */
.project-illu {
  position: relative; overflow: hidden; border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--blue-900) 0%, oklch(22% 0.05 258) 55%, var(--bg) 100%);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center; min-height: 185px;
}
.illu-grid {
  position: absolute; inset: -20%; opacity: 0.5;
  background-image:
    linear-gradient(rgba(99,160,255,0.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,160,255,0.10) 1px, transparent 1px);
  background-size: 30px 30px; transform: skewY(-4deg) scale(1.2);
  animation: heroPan 16s linear infinite;
}
.illu-glow {
  position: absolute; width: 320px; height: 320px; top: -80px; right: -90px;
  background: radial-gradient(ellipse, rgba(59,130,246,0.30) 0%, transparent 68%);
  animation: heroPulse 6.5s ease-in-out infinite;
}
.illu-inner { position: relative; z-index: 1; display: flex; align-items: center; gap: 2rem; padding: 1.1rem 1.8rem; }
.illu-inner svg { width: 170px; flex-shrink: 0; }
.illu-text-tag { }
.illu-tag { font-family: 'Archivo', sans-serif; font-size: 1.35rem; font-weight: 700; color: #fff; }
.illu-sub { margin-top: 5px; font-size: 0.66rem; letter-spacing: 0.14em; color: var(--blue-300); }
@media (max-width: 1280px) {
  .project-layout { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .illu-inner { flex-direction: column; gap: 0.8rem; text-align: center; }
}
/* Admin settings — toggle switch */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding: 0.4rem 0; }
/* B2 toggle cell — label beside the switch, right-aligned, aligned to the
   bottom so it lines up with the Design Scope select next to it. */
.b2-cell { flex-direction: row; align-items: flex-end; justify-content: flex-end; gap: 0.6rem; min-height: 100%; }
.b2-text { font-size: 0.92rem; font-weight: 600; color: var(--text); line-height: 1.6; }
.switch { position: relative; display: inline-block; flex-shrink: 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track { display: block; width: 42px; height: 24px; border-radius: var(--radius-pill); background: var(--surface-3); border: 1px solid var(--border); transition: background 0.15s; }
.switch-thumb { display: block; width: 18px; height: 18px; margin: 2px; border-radius: 50%; background: var(--text-muted); transition: transform 0.15s, background 0.15s; }
.switch input:checked + .switch-track { background: var(--blue-500); border-color: var(--blue-500); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); background: #fff; }

.panel-title { font-size: 1.05rem; font-weight: 700; color: var(--text-bright); margin-bottom: 0.85rem; }
.proj-fields { display: flex; flex-direction: column; gap: 0.65rem; }
.proj-fields-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; }

/* Loads grid */
.loads-grid { display: flex; flex-direction: column; gap: 0.55rem; }
.load-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
}
.load-row .field-lbl { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.load-row select { max-width: 220px; }
.load-row input[type="number"] { max-width: 100px; }

/* Wind / Snow options */
.load-options { display: flex; flex-direction: column; gap: 0.4rem; }
.load-option {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.82rem; color: var(--text-muted); cursor: pointer;
  padding: 3px 0; transition: color var(--transition);
}
.load-option:hover { color: var(--text); }
.load-option input:checked ~ * { color: var(--blue-300); }

/* News tabs (right column) */
.news-tabs-hd { display: flex; border-bottom: 1px solid var(--border-dim); gap: 2px; margin-bottom: 0.75rem; }
.news-tab {
  padding: 6px 12px; font-size: 0.78rem; color: var(--text-muted);
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: pointer; transition: all var(--transition);
  border: 1px solid transparent; border-bottom: none;
}
.news-tab:hover { color: var(--text); }
.news-tab.active {
  color: var(--blue-300); background: rgba(29,78,216,0.15);
  border-color: var(--border-dim); border-bottom-color: var(--surface-2);
}
.news-pane { display: none; }
.news-pane.active { display: block; }
.news-body { font-size: 0.82rem; color: var(--text-muted); line-height: 1.6; }
.news-body h4 { font-size: 0.88rem; color: var(--text-bright); margin-bottom: 0.4rem; }

/* Robot analysis grid inputs (4-col layout inside rafter-prop panels) */
.robot-inp {
  min-width: 0;
  width: 100%;
  padding: 3px 5px;
  font-size: 0.8rem;
  text-align: right;
  -moz-appearance: textfield;
}
.robot-inp::-webkit-outer-spin-button,
.robot-inp::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ── Shed Design Panel ───────────────────────────────────────── */
.shed-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 200px; border: 1px dashed var(--border); border-radius: var(--radius-lg);
  color: var(--text-dim); gap: 8px; font-size: 0.85rem;
}
.shed-empty svg { width: 40px; height: 40px; opacity: 0.3; }

/* ── Placeholder panels ──────────────────────────────────────── */
.panel-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 200px; gap: 0.75rem; color: var(--text-muted);
}
.panel-placeholder svg { width: 48px; height: 48px; opacity: 0.25; }
.panel-placeholder h3 { font-size: 1rem; color: var(--text-bright); }
.panel-placeholder p { font-size: 0.82rem; max-width: 360px; text-align: center; }

/* ── Member Design Panels ────────────────────────────────────── */
.member-layout {
  display: grid;
  grid-template-columns: minmax(300px, 340px) 1fr;
  gap: 1.25rem;
  align-items: start;
}
.member-inputs {
  background: linear-gradient(135deg, var(--surface-2) 0%, var(--surface-3) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  box-shadow: inset 0 1px 0 rgba(59,130,246,0.08);
  display: flex; flex-direction: column; gap: 7px;
}
/* Uniform field rhythm, matched to the Project Data tab's density — the
   individual templates still carry legacy inline margin-top values for
   their old layout; the flex gap above replaces that spacing. */
.member-inputs > * { margin-top: 0 !important; }
.member-inputs .field { gap: 6px; }
.member-inputs .field-lbl, .member-inputs .field label { font-size: 0.76rem; }
.member-inputs input, .member-inputs select { font-size: 0.85rem; padding: 7px 10px; }
.member-results { display: flex; flex-direction: column; gap: 0.85rem; }
.member-results-hd { display: flex; flex-direction: column; gap: 3px; }

/* Result columns grid */
.member-results-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem;
}
.result-col {
  background: var(--surface-2); border: 1px solid var(--border-dim);
  border-radius: var(--radius-lg); overflow: hidden;
}
.result-col-hd {
  padding: 0.55rem 0.5rem;
  background: linear-gradient(135deg, rgba(29,78,216,0.2) 0%, rgba(15,32,64,0.7) 100%);
  border-bottom: 1px solid var(--border-dim);
  font-size: 0.7rem; font-weight: 700; color: var(--blue-300);
  text-align: center; text-transform: uppercase; letter-spacing: 0.07em;
}
.result-section-hd {
  font-size: 0.72rem; font-weight: 700; color: var(--blue-300);
  text-transform: uppercase; letter-spacing: 0.07em;
  margin: 0.75rem 0 0.25rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid rgba(59,130,246,0.2);
}
.result-check {
  padding: 0.85rem 0.5rem;
  border-bottom: 1px solid var(--border-dim);
  display: flex; flex-direction: column; align-items: center; gap: 0.38rem;
  text-align: center;
}
.result-check:last-child { border-bottom: none; }
.result-check-name {
  font-size: 0.68rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.result-badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 11px; border-radius: 0;
  font-size: 0.73rem; font-weight: 700; letter-spacing: 0.05em;
}
.result-badge.pending { background: rgba(107,143,196,0.07); color: var(--text-dim); border: 1px solid var(--border-dim); }
.result-badge.pass    { background: rgba(16,185,129,0.12); color: var(--pass-text); border: 1px solid rgba(16,185,129,0.3); }
.result-badge.fail    { background: rgba(239,68,68,0.12); color: var(--fail-text); border: 1px solid rgba(239,68,68,0.35); }
.result-ratio { font-size: 0.88rem; font-weight: 700; color: var(--text-bright); font-variant-numeric: tabular-nums; }
.result-ratio.pending { color: var(--text-dim); font-weight: 400; font-size: 0.8rem; }
.result-note {
  padding: 0.6rem 0.9rem; border-radius: var(--radius);
  font-size: 0.78rem; color: var(--text-muted);
  background: rgba(29,78,216,0.07); border: 1px solid var(--border-dim);
}
.member-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 220px; border: 1px dashed var(--border); border-radius: var(--radius-lg);
  gap: 0.5rem; color: var(--text-dim); font-size: 0.85rem; text-align: center; padding: 1.5rem;
}
.member-placeholder svg { width: 38px; height: 38px; opacity: 0.25; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  /* Wrap the header so EVERY control stays reachable on small screens: brand +
     action buttons (New/Open/Report/Save/account) on the top row, and the nav
     tabs on their own full-width, horizontally-scrollable row underneath. */
  .app-header { height: auto; flex-wrap: wrap; row-gap: 8px; padding: 8px 10px; gap: 8px; }
  .header-left  { flex: 0 0 auto; order: 0; }
  .header-right { flex: 1 1 auto; order: 1; flex-wrap: wrap; justify-content: flex-end; gap: 6px; position: relative; }
  .header-right .btn-sm { padding: 7px 12px; }
  .header-center { order: 2; flex: 1 1 100%; justify-content: flex-start; overflow: hidden; }
  .nav-tabs { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 2px; padding-bottom: 2px; }
  .nav-tab { padding: 9px 13px; }            /* keep labels visible; the row scrolls */
  .nav-tab svg { width: 18px; height: 18px; }
  .user-menu { top: 100%; right: 0; }        /* dropdown sits below header-right */
  /* Sidebar overlay anchored to .app-body (already below the header), so it lines
     up no matter how tall the wrapped header becomes. */
  .sidebar { position: absolute; top: 0; bottom: 0; left: 0; z-index: 90; }
  .sidebar.collapsed { width: 0; }
  .member-layout { grid-template-columns: 1fr; }
  .member-results-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .member-results-grid { grid-template-columns: 1fr; }
  .app-main { padding: 0.75rem; }
  .app-footer { margin: 1.5rem -0.75rem -0.75rem; }
  .loads-grid { gap: 0.4rem; }
}

/* ── Theme toggle (header) ───────────────────────────────────── */
.theme-toggle-btn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; flex-shrink: 0;
  color: var(--text-muted); border: 1px solid transparent; border-radius: var(--radius);
  transition: all var(--transition);
}
.theme-toggle-btn:hover { border-color: var(--border); color: var(--text); background: var(--hover-tint); }
.theme-toggle-btn svg { width: 17px; height: 17px; }
.theme-icon-moon { display: none; }
[data-theme="light"] .theme-icon-sun  { display: none; }
[data-theme="light"] .theme-icon-moon { display: block; }

/* ── User menu (header) ──────────────────────────────────────── */
.user-menu-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 4px 8px; color: var(--text-muted);
  border: 1px solid transparent; transition: all var(--transition);
}
.user-menu-btn:hover { border-color: var(--border); color: var(--text); }
.user-menu {
  position: absolute; top: var(--header-h); right: 1rem; z-index: 200;
  background: var(--surface-2); border: 1px solid var(--border);
  min-width: 180px; box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.user-menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 10px 14px; font-size: 0.82rem; color: var(--text-muted);
  transition: all var(--transition);
}
.user-menu-item:hover { background: rgba(29,78,216,0.15); color: var(--blue-300); }
.user-menu-logout { border-top: 1px solid var(--border); }
.user-menu-logout:hover { background: rgba(239,68,68,0.12); color: var(--fail-text); }
.user-menu-logout svg { width: 14px; height: 14px; }
/* Full-name pill button */
.user-menu-btn .user-name { font-weight: 600; }

/* ── Profile / generic 2-col form grid ───────────────────────── */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem 0.7rem; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.6rem 0.7rem; }
.form-grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 0.6rem 0.7rem; }
@media (max-width: 900px) { .form-grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; } }

/* ── Read-out block (Vu/Vs, checkwind summary) ───────────────── */
.readout { display: flex; flex-direction: column; gap: 0; margin-top: 0.5rem; }
.readout > div {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 0; border-bottom: 1px solid var(--border-dim2);
  font-size: 0.78rem;
}
.readout > div:last-child { border-bottom: none; }
.readout span { color: var(--text-muted-2); font-weight: 500; }
.readout strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.readout strong[contenteditable] { outline: none; cursor: text; border-radius: 2px; }
.readout strong[contenteditable]:hover { background: var(--hover-tint); }
.readout strong[contenteditable]:focus { background: var(--hover-tint); box-shadow: 0 0 0 1px var(--border-dim); }

/* Pill-badge treatment for readout values whose color carries meaning —
   Wind Category (severity), Lee Zone (Yes/No), Design Life (informational),
   Risk Classification (informational). Not applied to every row. */
.rc-badge {
  font-family: var(--font); font-weight: 700; font-size: 0.72rem;
  padding: 4px 10px; border-radius: var(--radius-pill);
  background: oklch(62% 0.19 258 / 0.18); color: var(--blue-300);
  letter-spacing: 0.01em;
}
.rc-badge-warn    { background: oklch(75% 0.16 70 / 0.2); color: oklch(80% 0.15 70); }
.rc-badge-danger  { background: oklch(68% 0.19 25 / 0.2); color: oklch(76% 0.16 25); }
.rc-badge-success { background: oklch(72% 0.15 150 / 0.2); color: oklch(78% 0.14 150); }

/* ── Modern drag-and-drop file zone ──────────────────────────── */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  padding: 22px 18px; border: 1.5px dashed var(--border); border-radius: var(--radius-lg); background: var(--surface-1);
  color: var(--text-muted); transition: all var(--transition); text-align: center;
}
.dropzone:hover { border-color: var(--blue-500); color: var(--text); background: var(--surface-2); }
.dropzone.dragover { border-color: var(--blue-400); border-style: solid; background: rgba(29,78,216,0.14); color: var(--blue-300); }
.dropzone svg { width: 26px; height: 26px; flex-shrink: 0; color: var(--blue-400); }
.dz-text { display: flex; flex-direction: column; align-items: center; line-height: 1.4; }
.dz-text strong { font-size: 0.88rem; color: var(--text); font-weight: 600; }
.dz-text span { font-size: 0.76rem; color: var(--text-dim); margin-top: 2px; }

/* ── Pole-shed line illustration ─────────────────────────────── */
.ps-fill { fill: rgba(120,170,255,0.10); stroke: none; }
.ps-stroke {
  fill: none; stroke: var(--blue-400); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 520; animation: psDraw 6s ease-in-out infinite;
}
.ps-ground { stroke: var(--text-dim); stroke-width: 1.5; }
.ps-thin { stroke-width: 1.3; }
/* Loop: draw in while fading up, hold, then fade out (reset happens unseen). */
@keyframes psDraw {
  0%   { stroke-dashoffset: 520; opacity: 0; }
  15%  { opacity: 1; }
  45%  { stroke-dashoffset: 0; opacity: 1; }
  85%  { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}

/* Site information grid (from the Checkwind report) */
.readout-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
@media (max-width: 1100px) { .readout-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .readout-grid { grid-template-columns: 1fr; } }
.readout-grid > div {
  display: flex; flex-direction: column; gap: 2px;
  padding: 7px 10px; background: var(--surface-1); border: 1px solid var(--border-dim);
}
.readout-grid span { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); }
.readout-grid strong { font-size: 0.84rem; color: var(--text); font-variant-numeric: tabular-nums; }

/* ── Admin area ──────────────────────────────────────────────── */
.admin-subnav { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.admin-subtab {
  padding: 9px 16px; font-size: 0.82rem; font-weight: 600; color: var(--text-muted);
  border: 1px solid transparent; border-bottom: none; transition: all var(--transition);
}
.admin-subtab:hover { color: var(--text); }
.admin-subtab.active {
  color: var(--blue-300); background: rgba(29,78,216,0.15);
  border-color: var(--border); box-shadow: 0 2px 0 var(--surface-2);
}
.admin-pane { display: none; }
.admin-pane.active { display: flex; flex-direction: column; gap: 1rem; }
.admin-pane-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.85rem; }
.admin-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.admin-stat-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; }
.admin-stat-value { font-family: var(--font-mono); font-size: 1.6rem; font-weight: 700; color: var(--text-bright); }

/* ── Data tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.data-table th, .data-table td {
  padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border-dim);
  white-space: nowrap;
}
.data-table th {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--blue-300); font-weight: 700; background: var(--surface-1);
}
.data-table td { color: var(--text); font-variant-numeric: tabular-nums; }
.data-table tr:hover td { background: rgba(29,78,216,0.06); }
.data-table .row-actions { display: flex; gap: 4px; }
.tag {
  display: inline-block; padding: 2px 7px; font-size: 0.68rem; font-weight: 700;
  border: 1px solid var(--border);
}
.tag.on  { color: var(--pass-text); border-color: rgba(16,185,129,0.4); background: rgba(16,185,129,0.1); }
.tag.off { color: var(--fail-text); border-color: rgba(239,68,68,0.4); background: rgba(239,68,68,0.1); }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(2,8,20,0.72); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 1.25rem;
}
.modal {
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
}
.modal-hd {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
}
.modal-hd h3 { font-size: 1rem; font-weight: 700; color: var(--text-bright); }
.modal-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.modal-toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 12px 16px; background: var(--surface-1); border: 1px solid var(--border-dim);
  border-radius: var(--radius);
}
.modal-toggle-row span { font-size: 0.88rem; font-weight: 600; color: var(--text); }
.modal-close { font-size: 1.4rem; line-height: 1; color: var(--text-muted); padding: 0 4px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.85rem; }
.modal-body .form-grid-2 { gap: 0.85rem; }
.modal-ft {
  display: flex; justify-content: flex-end; gap: 0.6rem;
  padding: 0.9rem 1.25rem; border-top: 1px solid var(--border);
}
.modal .alert { margin-bottom: 0.25rem; }

/* ── Sidebar project tree ────────────────────────────────────── */
.sidebar-group {
  padding: 0.5rem 0.5rem 0.25rem; margin-top: 0.25rem;
  font-size: 0.64rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-dim);
}
.sidebar-item .dot {
  width: 7px; height: 7px; flex-shrink: 0; display: inline-block;
  background: var(--text-dim);
}
.sidebar-item .dot.pass { background: var(--pass-text); }
.sidebar-item .dot.fail { background: var(--fail-text); }
.sidebar-item .dot.review { background: var(--warning); }
/* "New Design" add-buttons: solid accent, distinct from designed members */
.sidebar-item.sidebar-add {
  color: var(--blue-300); font-weight: 600;
  border-color: var(--border); background: var(--surface-1);
}
.sidebar-item.sidebar-add::before { background: rgba(59,130,246,0.5); }
.sidebar-item.sidebar-add:hover { color: var(--blue-200); border-color: var(--blue-500); background: rgba(29,78,216,0.1); }
.sidebar-item.sidebar-add:hover::before { background: var(--blue-400); }

/* ── Open Project list ───────────────────────────────────────── */
.proj-list { display: flex; flex-direction: column; gap: 4px; }
.proj-list-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; text-align: left; width: 100%;
  background: var(--surface-1); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius);
  transition: all var(--transition);
}
.proj-list-item:hover { border-color: var(--blue-500); background: rgba(29,78,216,0.1); }
.proj-list-row { display: flex; align-items: stretch; gap: 4px; }
.proj-list-row .proj-list-item { flex: 1; min-width: 0; }
.proj-del, .proj-dup {
  display: flex; align-items: center; justify-content: center; width: 40px; flex-shrink: 0;
  background: var(--surface-1); border: 1px solid var(--border); color: var(--text-muted);
  border-radius: var(--radius);
  cursor: pointer; transition: all var(--transition);
}
.proj-del svg, .proj-dup svg { width: 16px; height: 16px; }
.proj-del:hover { border-color: var(--danger); background: rgba(239,68,68,0.12); color: var(--danger); }
.proj-dup:hover { border-color: var(--blue-500); background: rgba(29,78,216,0.12); color: var(--blue-400); }
.proj-del:disabled, .proj-dup:disabled { opacity: 0.5; cursor: default; }

/* Open Project search + list */
.proj-search {
  width: 100%; margin-bottom: 10px; padding: 9px 11px;
  background: var(--surface-1); border: 1px solid var(--border); color: var(--text);
  font-size: 0.85rem;
}
.proj-search:focus { outline: none; border-color: var(--blue-500); }
.proj-list { max-height: 50vh; overflow-y: auto; }
.proj-list-item { align-items: center; }
.pli-main { display: flex; flex-direction: column; gap: 1px; }
.pli-date { font-size: 0.72rem; color: var(--text-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Report choices */
.report-choices { display: flex; flex-direction: column; gap: 10px; }
.report-choice {
  display: flex; flex-direction: column; gap: 3px; text-align: left;
  padding: 14px 16px; background: var(--surface-1); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-lg);
  transition: all var(--transition);
}
.report-choice:hover { border-color: var(--blue-500); background: rgba(29,78,216,0.12); }
.report-choice strong { color: var(--text-bright); font-size: 0.9rem; }
.report-choice span { color: var(--text-muted); font-size: 0.76rem; }

/* Sidebar member rows (with delete) */
.member-item .mi-label { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.member-item .mi-name { display: flex; align-items: center; gap: 5px; overflow: hidden; }
.member-item .mi-name > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.member-item .mi-note { font-size: 0.66rem; font-weight: 400; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prop-chip { display: inline-flex; align-items: center; font-size: 0.58rem; font-weight: 700; letter-spacing: 0.04em; padding: 1px 5px; border-radius: 3px; flex-shrink: 0; white-space: nowrap; }
.prop-chip.pass { background: rgba(52,211,153,0.18); color: var(--pass-text); border: 1px solid rgba(52,211,153,0.35); }
.prop-chip.fail { background: rgba(252,165,165,0.18); color: var(--fail-text); border: 1px solid rgba(252,165,165,0.35); }
.member-item .mi-del {
  opacity: 0; color: var(--text-dim); font-size: 1.1rem; line-height: 1; padding: 0 3px;
  background: none; flex-shrink: 0;
}
.member-item:hover .mi-del { opacity: 1; }
.member-item .mi-del:hover { color: var(--fail-text); }

/* Drag-to-reorder handle + drop indicators */
.member-item { cursor: grab; }
.member-item .mi-drag {
  opacity: 0; flex-shrink: 0; color: var(--text-dim); font-size: 0.7rem; line-height: 1;
  letter-spacing: -2px; padding: 0 2px; cursor: grab;
}
.member-item:hover .mi-drag { opacity: 0.7; }
.member-item .mi-drag:hover { opacity: 1; color: var(--text); }
.member-item.dragging { opacity: 0.4; cursor: grabbing; }
.member-item.drag-over-before { box-shadow: inset 0 2px 0 var(--blue-400); }
.member-item.drag-over-after { box-shadow: inset 0 -2px 0 var(--blue-400); }

/* Collapsible soil section toggle */
.soil-toggle-hd {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none;
  margin-top: 1rem; padding: 0.35rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.78rem; font-weight: 700; color: var(--blue-300);
  letter-spacing: 0.01em;
}
.soil-toggle-hd svg { transition: transform 0.2s; flex-shrink: 0; }
.soil-toggle-hd.open svg { transform: rotate(180deg); }
.soil-toggle-body { display: none; padding-top: 0.5rem; }
.soil-toggle-body.open { display: block; }

/* Small hover-info icon — used instead of long inline explanatory notes */
.info-tip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 13px; height: 13px; margin-left: 4px; flex-shrink: 0;
  border-radius: 50%; cursor: help; vertical-align: middle;
  color: var(--text-dim); border: 1px solid currentColor;
  font-size: 0.62rem; font-style: normal; font-weight: 700; line-height: 1;
}
.info-tip:hover { color: var(--blue-300); }

/* ── Horizontal result rows (compact, fills width) ───────────── */
.rcheck {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-bottom: 1px solid var(--border-dim);
  font-size: 0.78rem;
}
.rcheck:last-child { border-bottom: none; }
.rc-name { flex: 1; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-vals { font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }
.rc-pct { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }
.rcheck.pass .rc-pct { color: var(--pass-text); }
.rcheck.fail .rc-pct { color: var(--fail-text); }
.rcheck .result-badge { flex: 0 0 auto; }
.rc-head { background: var(--surface-1); }
.rc-head .rc-name, .rc-head .rc-vals, .rc-head .rc-pct {
  color: var(--text-dim); font-weight: 700; font-size: 0.64rem;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.rc-badge-sp { width: 52px; flex: 0 0 auto; }

/* ── Compact result table (rafter-to-pole connection, etc.) ──── */
.conn-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; margin-top: 6px; }
.conn-table th {
  background: var(--surface-1); color: var(--text-dim);
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  text-align: left; padding: 6px 10px; white-space: nowrap;
}
.conn-table td { padding: 8px 10px; border-bottom: 1px solid var(--border-dim); font-variant-numeric: tabular-nums; }
.conn-table tr:last-child td { border-bottom: none; }
.conn-table td:first-child { color: var(--text-muted); }
.conn-table tr.pass td { background: rgba(16,185,129,0.06); }
.conn-table tr.fail td { background: rgba(239,68,68,0.08); }
.conn-table .cell-result { font-weight: 700; text-align: right; }
.conn-table tr.pass .cell-result { color: var(--pass-text); }
.conn-table tr.fail .cell-result { color: var(--fail-text); }
.conn-sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 5px; }

/* ── Soldier-stud spec card (size / length / shear at a glance) ─ */
.stud-card {
  margin-top: 10px; padding: 10px 12px; border-radius: var(--radius);
  background: rgba(29,78,216,0.06); border: 1px solid var(--border-dim);
}
.stud-card-hd { font-size: 0.72rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 8px; }
.stud-spec-row { display: flex; gap: 8px; }
.stud-spec {
  flex: 1; display: flex; flex-direction: column; gap: 2px;
  padding: 8px 10px; border-radius: var(--radius); background: var(--surface-1); border: 1px solid var(--border-dim);
  text-align: center;
}
.stud-spec-lbl { font-size: 0.62rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.03em; }
.stud-spec-val { font-size: 1rem; font-weight: 700; color: var(--text-bright); font-variant-numeric: tabular-nums; }

/* ── App Menubar ─────────────────────────────────────────────── */
.app-menubar { display: flex; align-items: stretch; gap: 0; }
.mb-item { position: relative; display: flex; align-items: stretch; }
.mb-trigger {
  background: none; border: none; cursor: pointer;
  padding: 0 13px; font-size: 0.78rem; font-weight: 500;
  color: var(--text-muted); border-radius: 0;
  transition: background var(--transition), color var(--transition);
  height: 100%; white-space: nowrap; display: flex; align-items: center;
}
.mb-trigger:hover, .mb-item.open .mb-trigger {
  background: var(--hover-tint); color: var(--text);
}
.mb-dropdown {
  display: none; position: absolute; top: 100%; left: 0; z-index: 300;
  background: var(--surface-2); border: 1px solid var(--border);
  min-width: 210px; box-shadow: 0 8px 28px rgba(0,0,0,0.55);
  border-radius: 0 0 6px 6px; padding: 4px 0; flex-direction: column;
}
.mb-item.open .mb-dropdown { display: flex; }
.mb-mi {
  display: flex; align-items: center; width: 100%; text-align: left; background: none; border: none;
  padding: 8px 16px; font-size: 0.82rem; color: var(--text-muted); cursor: pointer;
  transition: background var(--transition), color var(--transition); white-space: nowrap; gap: 8px;
}
.mb-mi:hover { background: var(--hover-tint); color: var(--text); }
.mb-mi.danger { color: var(--fail-text); }
.mb-mi.danger:hover { background: rgba(248,113,113,0.1); }
.mb-sep { height: 1px; background: var(--border); margin: 4px 0; }
.mb-check { width: 14px; text-align: center; opacity: 0; font-size: 0.85rem; color: var(--blue-400); }
.mb-toggle-item[data-on="true"] .mb-check { opacity: 1; }

/* ── Calculation Overlay ─────────────────────────────────────── */
.calc-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(3, 12, 30, 0.55);
  backdrop-filter: blur(6px) saturate(1.2);
  -webkit-backdrop-filter: blur(6px) saturate(1.2);
  transition: opacity 0.35s ease;
}
.calc-overlay.hidden { display: none; }
.calc-overlay.fade-out { opacity: 0; pointer-events: none; }

/* ── End Calculation Overlay ─────────────────────────────────── */

/* ── Super Admin Console mode (same app shell, served at /admin) ───────
   Hides the project-design chrome and shows only the Administration panel. */
body.console-mode .sidebar { display: none; }
body.console-mode .nav-tabs { display: none; }
body.console-mode .app-menubar-strip { display: none; }
body.console-mode #newProjectBtn,
body.console-mode #openProjectBtn,
body.console-mode #btn-open-ps1,
body.console-mode #reportBtn,
body.console-mode #saveProjectBtn { display: none; }
body.console-mode .app-header { border-bottom-color: oklch(75% 0.15 70 / 0.35); }
body.console-mode .console-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font: 700 0.7rem var(--font); letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 10px; border-radius: var(--radius-pill);
  background: oklch(75% 0.15 70 / 0.16); color: oklch(80% 0.13 70);
  border: 1px solid oklch(75% 0.15 70 / 0.35);
  margin-left: 10px;
}
