:root {
  --navy: #3c64a6;
  --slate: #1b263b;
  --ink: #12202e;
  --muted: #5b6b7b;
  --line: #e4e9f0;
  --bg: #f5f7fb;
  --card: #ffffff;
  --brand: #f4b038;        /* accent gold: fills, borders, marks, focus */
  --brand-2: #ffcf3a;      /* lighter gold: brand mark on dark, gradient end */
  --accent: #e0a600;       /* deeper gold: gradients, icons */
  --brand-ink: #8a6a00;    /* readable gold for text on white (AA) */
  --on-accent: #1b1300;    /* text on gold buttons */
  --gold-tint: #fdf7e3;    /* subtle gold fill for highlighted rows/cards */
  --gold-hover: #fdf9ec;   /* dropzone hover fill */
  --safety: #d64545;
  --repair: #d98324;
  --maint: #3a7d44;
  /* Softer, layered elevation for a more premium feel */
  --shadow: 0 1px 2px rgba(13, 27, 42, 0.04), 0 14px 34px rgba(13, 27, 42, 0.07);
  --shadow-sm: 0 1px 2px rgba(13, 27, 42, 0.05), 0 3px 8px rgba(13, 27, 42, 0.05);
  --shadow-lg: 0 2px 4px rgba(13, 27, 42, 0.05), 0 24px 52px rgba(13, 27, 42, 0.13);
  --ring: 0 0 0 3px rgba(244, 176, 56, 0.25);
  --radius: 18px;
  --radius-sm: 12px;
}

/* ======================================================================
   UI refinement layer — quieter hairlines + softer, Apple-like elevation.
   Tokens only; every component that already uses them inherits the calmer
   look with no structural change.
   ====================================================================== */
:root {
  --bg: #f6f7f9;                 /* cooler, flatter canvas */
  --line: #e8ebf0;               /* softer hairline */
  --hairline: rgba(13, 27, 42, 0.07);
  --muted: #62707f;              /* slightly deeper for contrast */
  --shadow-xs: 0 1px 1px rgba(13, 27, 42, 0.03);
  --shadow-sm: 0 1px 2px rgba(13, 27, 42, 0.04), 0 2px 6px rgba(13, 27, 42, 0.035);
  --shadow: 0 1px 2px rgba(13, 27, 42, 0.035), 0 8px 24px rgba(13, 27, 42, 0.055);
  --shadow-lg: 0 2px 6px rgba(13, 27, 42, 0.05), 0 20px 44px rgba(13, 27, 42, 0.10);
  --radius: 16px;
  --radius-sm: 11px;
  --ring: 0 0 0 4px rgba(60, 100, 166, 0.14);
}

* { box-sizing: border-box; }

/* Author display rules (e.g. .dz-file{display:flex}) beat the UA [hidden] rule,
   so enforce hidden explicitly. */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
/* Subtle branded depth across the app — a soft gold glow + slate wash, kept
   very light so it reads clean, not busy. Fixed so it stays put on scroll. */
body {
  min-height: 100vh;
  background:
    radial-gradient(1100px 520px at 88% -140px, rgba(244, 176, 56, 0.06), transparent 60%),
    radial-gradient(900px 500px at -140px -80px, rgba(27, 38, 59, 0.05), transparent 55%),
    var(--bg);
  background-attachment: fixed;
}

.wrap {
  width: min(1120px, 92vw);
  margin: 0 auto;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* ---------- Top bar ---------- */
.topbar {
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  color: var(--ink);
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid rgba(13, 27, 42, 0.06);
  box-shadow: 0 1px 0 rgba(13, 27, 42, 0.03);
}
.topbar-inner { position: relative; }
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; }
.brand-logo { height: 34px; width: auto; display: block; }
.brand-mark { color: var(--brand-2); font-size: 1.4rem; }
.brand-text span { color: var(--brand-ink); }
.topbar-nav { display: flex; gap: 8px; }
.pill {
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.2;
  padding: 5px 11px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--slate);
  border: 1px solid var(--line);
}
.pill-muted { color: var(--muted); }
a.pill,
a.pill:visited,
button.pill {
  color: var(--slate);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
a.pill:hover,
button.pill:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}
a.pill:active,
button.pill:active {
  background: #d8e0ea;
}
a.pill.pill-muted,
a.pill.pill-muted:visited {
  color: var(--muted);
}

/* ---------- Views ---------- */
.view { display: none; }
.view.is-active { display: block; }

/* ---------- Hero / input ---------- */
.hero {
  display: grid;
  grid-template-columns: 1fr 460px;
  gap: 48px;
  padding: 64px 0 72px;
  align-items: start;
}
.hero-copy h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0 0 18px;
}
.grad {
  background: linear-gradient(90deg, var(--brand-ink) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lede { font-size: 1.08rem; color: var(--muted); max-width: 44ch; margin: 0 0 26px; }
.hero-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.hero-points li {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
  font-size: 0.95rem;
}
.hero-points b { color: var(--brand-ink); }

/* ---------- Card / form ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.card-title { margin: 0 0 18px; font-size: 1.22rem; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
/* Uniform section-heading treatment across every page: a small gold accent
   bar before the title so sections read as intentional, not bland. */
.card-title, .doc-section h3, .hist-title { position: relative; padding-left: 14px; }
.card-title::before, .doc-section h3::before, .hist-title::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 4px; height: 0.9em; border-radius: 2px; background: var(--brand);
}
/* Standalone dashboard section headings get a hairline divider under them. */
.dashboard > .card-title { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.field-label { display: block; font-weight: 600; font-size: 0.85rem; margin: 0 0 6px; color: var(--slate); }
.field-hint { margin: 6px 0 0; font-size: 0.78rem; color: var(--muted); }

input[type="text"],
input[type="email"],
input[type="tel"] {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  /* 16px keeps iOS Safari from auto-zooming when the field is focused. */
  font-size: 16px;
  font-family: inherit;
  background: #fbfcfe;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(244, 176, 56, 0.25);
  background: #fff;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 16px 0; }

/* ---------- Dropzone ---------- */
.dropzone {
  border: 2px dashed #c4d0dd;
  border-radius: var(--radius-sm);
  padding: 26px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: #fbfdff;
}
.dropzone:hover, .dropzone:focus, .dropzone.dragover {
  border-color: var(--brand);
  background: var(--gold-hover);
  outline: none;
}
.dz-icon { font-size: 1.8rem; color: var(--accent); }
.dz-title { margin: 8px 0 2px; font-weight: 600; }
.dz-sub { margin: 0; font-size: 0.83rem; color: var(--muted); }
.link { color: var(--brand-ink); font-weight: 600; text-decoration: underline; }
.dz-file { display: flex; align-items: center; gap: 12px; text-align: left; }
.dz-file-icon { font-size: 1.6rem; }
.dz-file-meta { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.dz-file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-file-size { font-size: 0.8rem; color: var(--muted); }
.dz-clear {
  border: none; background: #eef2f7; width: 28px; height: 28px; border-radius: 50%;
  cursor: pointer; color: var(--muted); font-size: 0.9rem;
}
.dz-clear:hover { background: #e2e8f0; color: var(--ink); }

/* ---------- Branding accordion ---------- */
.branding { margin: 4px 0 18px; }
.branding summary {
  cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--brand-ink);
  padding: 6px 0; list-style: none;
}
.branding summary::-webkit-details-marker { display: none; }
.branding summary::before { content: "＋ "; }
.branding[open] summary::before { content: "－ "; }

/* ---------- Buttons ---------- */
.btn {
  font-family: inherit; font-weight: 600; font-size: 0.95rem; letter-spacing: -0.01em;
  border-radius: var(--radius-sm); padding: 11px 22px; cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.08s ease, background 0.15s, box-shadow 0.18s, border-color 0.15s, color 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(100deg, var(--brand) 0%, var(--accent) 100%);
  color: var(--on-accent); box-shadow: 0 6px 18px rgba(224, 166, 0, 0.32);
}
.btn-primary:hover { box-shadow: 0 10px 26px rgba(224, 166, 0, 0.42); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; transform: none; }
.btn-block { width: 100%; }
.btn-secondary { background: #fff; border-color: var(--line); color: var(--slate); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { border-color: #d3b34d; color: var(--brand-ink); background: var(--gold-hover); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--ink); }

.form-error {
  margin: 12px 0 0; color: var(--safety); font-size: 0.88rem; font-weight: 500;
  background: #fdecec; border: 1px solid #f6c9c9; padding: 10px 12px; border-radius: var(--radius-sm);
}
.upload-legal { margin: 14px 0 0; font-size: 0.75rem; color: var(--muted); text-align: center; }

/* ---------- Processing ---------- */
.processing { text-align: center; padding: 90px 0; max-width: 520px; margin: 0 auto; }
.processing h2 { margin: 24px 0 4px; letter-spacing: -0.02em; }
.processing-file { color: var(--muted); font-size: 0.9rem; margin: 0 0 28px; }
.processing-note { color: var(--muted); font-size: 0.82rem; margin-top: 24px; }
.spinner {
  width: 52px; height: 52px; border-radius: 50%; margin: 0 auto;
  border: 4px solid #dbe6ee; border-top-color: var(--brand); animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.steps { list-style: none; padding: 0; margin: 0 auto; max-width: 340px; text-align: left; display: grid; gap: 14px; }
.steps li { display: flex; align-items: center; gap: 12px; color: var(--muted); font-weight: 500; transition: color 0.2s; }
.steps li .dot {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid #cdd8e2; flex: 0 0 auto; position: relative;
}
.steps li.active { color: var(--ink); }
.steps li.active .dot { border-color: var(--brand); }
.steps li.done { color: var(--ink); }
.steps li.done .dot { background: var(--brand); border-color: var(--brand); }
.steps li.done .dot::after {
  content: "✓"; color: var(--on-accent); font-size: 0.7rem; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Results ---------- */
.results { padding: 32px 0 64px; }
.results-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; gap: 12px; flex-wrap: wrap; }
.results-actions { display: flex; gap: 10px; }

.estimate-doc {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 36px;
}
.doc-head { display: flex; justify-content: space-between; gap: 24px; border-bottom: 2px solid var(--line); padding-bottom: 22px; margin-bottom: 26px; flex-wrap: wrap; }
.doc-brand { font-weight: 800; color: var(--brand-ink); font-size: 1.05rem; letter-spacing: -0.02em; }
.doc-title { margin: 4px 0 0; font-size: 1.5rem; letter-spacing: -0.02em; }
.doc-prepared { margin-top: 10px; font-size: 0.9rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.doc-prepared > span { color: var(--muted); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; width: 100%; }
.doc-prepared b { color: var(--ink); font-weight: 700; }
.doc-prepared .doc-email { color: var(--muted); }
.doc-meta { display: grid; gap: 6px; text-align: right; }
.doc-meta div { display: flex; gap: 10px; justify-content: flex-end; font-size: 0.9rem; }
.doc-meta span { color: var(--muted); }
.doc-meta b { color: var(--ink); }

.field-label .req { color: var(--safety); font-weight: 700; }

.pricing-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.pricing-meta-pill {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--gold-tint);
  border: 1px solid rgba(244, 176, 56, 0.35);
  color: var(--brand-ink);
}
.pricing-meta-pill--muted {
  background: #eef2f7;
  border-color: var(--line);
  color: var(--muted);
  font-weight: 500;
}

/* price cards */
.price-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
/* Typical + High cards (Low removed). */
.price-cards--pair { grid-template-columns: repeat(2, minmax(220px, 320px)); justify-content: center; }
/* Typical-only card (High removed). */
.price-cards--single { grid-template-columns: minmax(240px, 360px); justify-content: center; }
.price-card {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 20px; text-align: center;
  display: flex; flex-direction: column; gap: 4px; background: #fbfdff;
}
.price-card--typical {
  border-color: var(--brand); background: linear-gradient(180deg, var(--gold-tint) 0%, #ffffff 100%);
  box-shadow: 0 6px 18px rgba(244, 176, 56, 0.22); transform: scale(1.03);
}
.price-label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.price-card--typical .price-label { color: var(--brand-ink); }
.price-value { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; }
.price-note { font-size: 0.78rem; color: var(--muted); }

/* summary chips */
.summary-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.chip {
  font-size: 0.82rem; font-weight: 600; padding: 6px 12px; border-radius: 999px;
  background: #eef3f8; color: var(--slate); border: 1px solid var(--line);
}
.chip b { font-weight: 800; }
.chip--safety { background: #fdecec; color: var(--safety); border-color: #f6c9c9; }
.chip--repair { background: #fdf1e3; color: var(--repair); border-color: #f5dcbb; }
.chip--maint { background: #ecf6ee; color: var(--maint); border-color: #cfe6d4; }

.doc-section { margin-bottom: 30px; }
.doc-section + .doc-section { border-top: 1px solid var(--line); padding-top: 26px; }
/* priority plan (severity tiers) */
.tier-summary { color: var(--muted); font-size: 0.9rem; margin: 0 0 14px; }
.tier-list { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.tier-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.tier-row:last-child { border-bottom: 0; }
.tier-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--muted); }
.tier-row--safety .tier-dot { background: var(--safety); }
.tier-row--repair .tier-dot { background: var(--repair); }
.tier-row--maint .tier-dot { background: var(--maint); }
.tier-label { display: flex; flex-direction: column; font-weight: 600; color: var(--ink); }
.tier-note { font-size: 0.7rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.tier-row .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.tier-row .num.typ { color: var(--ink); font-weight: 700; }

/* retry a failed estimate (card action) */
.dash-card-retry { background: none; border: 0; color: var(--navy); font: inherit; font-size: 0.78rem; font-weight: 700; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.dash-card-retry:hover { background: #e7eefb; }
.dash-card-retry:disabled { color: var(--muted); cursor: default; background: none; }

/* engine health pill (admin overview) */
.health-row { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.health-label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.health-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 700; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line); background: #eef2f8; color: var(--slate); }
.health-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.health-pill--online { background: #e7f6ec; border-color: #b7e4c7; color: #1b6b3a; }
.health-pill--degraded { background: #fdf4e0; border-color: #f0dca8; color: var(--brand-ink); }
.health-pill--offline { background: #fdecec; border-color: #f6cccc; color: var(--safety); }

/* pipeline stage chip (on estimate cards) */
.stage-chip { font-weight: 700; }
.stage--sent { background: #eef2f8; color: var(--slate); }
.stage--viewed { background: #e7eefb; color: var(--navy); }
.stage--accepted { background: #e7f6ec; color: #1b6b3a; }
.stage--declined { background: #fdecec; color: var(--safety); }

/* public shared estimate page (shared.html) */
.shared-body { background: var(--bg); }
.shared-wrap { max-width: 860px; margin: 0 auto; padding: 24px 20px 60px; }
.shared-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.shared-brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.05rem; color: var(--ink); }
.shared-logo { width: 40px; height: 40px; border-radius: 10px; background: #fff center / contain no-repeat; border: 1px solid var(--line); box-shadow: var(--shadow-sm); flex: none; }
.shared-valid { color: var(--muted); font-size: 0.8rem; margin: 8px 0 0; }
.shared-actions { margin-top: 22px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px; }
.shared-actions-note { margin: 0 0 12px; font-weight: 700; color: var(--ink); }
.shared-actions-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.shared-actions-row input { flex: 1; min-width: 200px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; }
.shared-responded { margin-top: 22px; padding: 16px 18px; border-radius: var(--radius); font-weight: 600; }
.shared-responded--ok { background: #e7f6ec; color: #1b6b3a; border: 1px solid #b7e4c7; }
.shared-responded--changes { background: #fdf4e0; color: var(--brand-ink); border: 1px solid #f0dca8; }
.doc-section h3 { font-size: 1.1rem; letter-spacing: -0.01em; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.section-sub { color: var(--muted); font-size: 0.87rem; margin: -6px 0 12px; }
.count-badge { font-size: 0.75rem; background: var(--slate); color: #fff; border-radius: 999px; padding: 2px 9px; font-weight: 700; }

/* category table */
.cat-table { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.cat-row { display: grid; grid-template-columns: 2fr 0.6fr 1fr; gap: 8px; padding: 11px 16px; align-items: center; font-size: 0.9rem; }
.cat-row + .cat-row { border-top: 1px solid var(--line); }
.cat-row.head { background: #f6f9fc; font-weight: 700; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.cat-row .num { text-align: right; font-variant-numeric: tabular-nums; }
.cat-row .typ { font-weight: 700; }
.cat-row.total { background: var(--gold-tint); font-weight: 700; }

/* review list */
.review-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.review-list li {
  background: #fffdf5; border: 1px solid #f0e2b8; border-left: 3px solid var(--repair);
  border-radius: var(--radius-sm); padding: 10px 14px; font-size: 0.88rem;
}
.review-list b { display: block; }
.review-list span { color: var(--muted); font-size: 0.82rem; }

/* items */
.item-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.filter-pill {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--slate);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.filter-pill:hover {
  border-color: var(--brand);
  color: var(--brand-ink);
}
.filter-pill.is-active {
  background: var(--gold-tint);
  border-color: var(--brand);
  color: var(--brand-ink);
  box-shadow: 0 2px 8px rgba(244, 176, 56, 0.2);
}

.items { display: grid; gap: 10px; }
.item {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px;
  display: grid; grid-template-columns: 6px 1fr auto; gap: 14px; align-items: start;
}
.item-bar { width: 6px; border-radius: 3px; align-self: stretch; background: var(--muted); }
.item-bar--safety { background: var(--safety); }
.item-bar--repair { background: var(--repair); }
.item-bar--maintenance { background: var(--maint); }
.item-main { min-width: 0; }
.item-title { font-weight: 700; margin: 0 0 4px; }
.item-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.tag { font-size: 0.72rem; font-weight: 600; padding: 3px 8px; border-radius: 6px; background: #eef3f8; color: var(--slate); }
.tag--sev-safety { background: #fdecec; color: var(--safety); }
.tag--sev-repair { background: #fdf1e3; color: var(--repair); }
.tag--sev-maintenance { background: #ecf6ee; color: var(--maint); }
.tag--conf-low { background: #fdecec; color: var(--safety); }
.item-finding { font-size: 0.83rem; color: var(--muted); margin: 0; }
.item-note { font-size: 0.78rem; color: var(--repair); margin: 6px 0 0; }
.item-price { text-align: right; white-space: nowrap; }
.item-price .rng { font-weight: 800; font-size: 1rem; font-variant-numeric: tabular-nums; }
.item-price .typ { font-size: 0.78rem; color: var(--muted); }
/* Typical + High price (Low intentionally not displayed). */
.item-price .typ-only { font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums; color: var(--brand-ink); }
.item-price .high-line { font-size: 0.76rem; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 2px; }
.item-price .unpriced { color: var(--repair); font-weight: 700; font-size: 0.85rem; }

/* footer / disclaimer */
.doc-foot { border-top: 1px solid var(--line); padding-top: 18px; }
.disclaimer { font-size: 0.76rem; color: var(--muted); line-height: 1.55; margin: 0 0 8px; }
.doc-generated { font-size: 0.72rem; color: #9aa8b4; margin: 0; }

.sitefoot {
  padding: 28px 0 calc(28px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  border-top: 1px solid var(--line);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 32px; padding: 40px 0 48px; }
  .upload-card { order: -1; }
  .price-cards { grid-template-columns: 1fr; }
  .price-card--typical { transform: none; }
  .cat-row { grid-template-columns: 1.4fr 0.5fr 1fr; }
  .cat-row .low, .cat-row .high { display: none; }
  .item { grid-template-columns: 6px 1fr; }
  .item-price { text-align: left; grid-column: 2; }
}

/* Tablet / large phone: the decorative pills crowd the logo — drop them. */
@media (max-width: 720px) {
  .topbar-nav { display: none; }
  .topbar-inner { height: 56px; }
}

/* Phones */
@media (max-width: 600px) {
  .hero { padding: 28px 0 40px; }
  .hero-copy h1 { font-size: 1.85rem; }
  .lede { font-size: 1rem; }
  .card { padding: 18px; }
  .grid-2 { grid-template-columns: 1fr; gap: 14px; }
  .dropzone { padding: 22px 16px; }

  .results { padding: 20px 0 48px; }
  .results-head { flex-direction: column; align-items: stretch; }
  .results-actions { width: 100%; }
  .results-actions .btn { flex: 1; }

  .estimate-doc { padding: 20px 16px; }
  .doc-head { flex-direction: column; gap: 14px; }
  .doc-title { font-size: 1.3rem; }
  .doc-meta { text-align: left; }
  .doc-meta div { justify-content: flex-start; }

  .price-value { font-size: 1.7rem; }
  .cat-row { grid-template-columns: 1.5fr 0.5fr 1fr; padding: 10px 12px; font-size: 0.85rem; }

  .item-tags { gap: 5px; }
  .processing { padding: 60px 0; }
}

/* Small phones */
@media (max-width: 380px) {
  .brand { font-size: 1rem; }
  .hero-copy h1 { font-size: 1.6rem; }
  .price-value { font-size: 1.55rem; }
}

/* Coarse pointers: give tappable controls a comfortable minimum height. */
@media (pointer: coarse) {
  .btn { min-height: 46px; }
  .dz-clear { width: 34px; height: 34px; }
  .branding summary { padding: 10px 0; }
}

/* ---------- Auth (login / set-password) ---------- */
.auth-wrap {
  max-width: 440px;
  margin: 0 auto;
  padding: 56px 0 72px;
}
.auth-card { padding: 30px 28px; }
.auth-title { font-size: 1.55rem; letter-spacing: -0.02em; margin: 0 0 6px; }
.auth-sub { color: var(--muted); font-size: 0.95rem; margin: 0 0 22px; }

.auth-tabs {
  display: flex;
  gap: 4px;
  background: #eef2f7;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 22px;
}
.auth-tab {
  flex: 1;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 9px 12px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.auth-tab.is-active {
  background: #fff;
  color: var(--brand-ink);
  box-shadow: var(--shadow-sm);
}

.auth-panel .btn-block { margin-top: 18px; }

.form-note {
  margin: 12px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  background: #eef3f8;
  border: 1px solid var(--line);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}

.auth-sent { text-align: center; padding: 8px 0; }
.auth-sent-icon { font-size: 2.2rem; margin-bottom: 8px; }
.auth-sent-title { margin: 0 0 8px; font-size: 1.2rem; }
.auth-sent p { color: var(--muted); font-size: 0.92rem; margin: 0 0 18px; }

.auth-status { text-align: center; padding: 20px 0; }
.auth-status .spinner { margin-bottom: 16px; }
.auth-status p { color: var(--muted); }

.auth-legal {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  margin: 18px auto 0;
  max-width: 40ch;
}

input[type="password"] {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-family: inherit;
  background: #fbfcfe;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="password"]:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(244, 176, 56, 0.25);
  background: #fff;
}

/* ---------- Dashboard (estimate history) ---------- */
.dashboard { padding: 40px 0 64px; }
.dash-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.dash-title { font-size: 1.8rem; letter-spacing: -0.02em; margin: 0 0 6px; }
.dash-sub { color: var(--muted); font-size: 0.92rem; margin: 0; }

.dash-empty { text-align: center; padding: 48px 24px; }
.dash-empty h2 { margin: 8px 0 6px; }
.dash-empty p { color: var(--muted); margin: 0 0 20px; }

.dash-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 190px));
  justify-content: start;
  gap: 11px;
}
.dash-card { padding: 12px; display: flex; flex-direction: column; gap: 6px; border-radius: 14px; }
.dash-card--clickable { cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.dash-card--clickable:hover, .dash-card--clickable:focus-visible { border-color: var(--brand); box-shadow: 0 6px 20px rgba(0,0,0,0.08); transform: translateY(-2px); outline: none; }
.dash-card-open { margin-top: 1px; font-size: 0.78rem; font-weight: 700; color: var(--brand-ink); }
.dash-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 1px; }
.dash-card-del { background: none; border: 0; color: var(--safety); font: inherit; font-size: 0.76rem; font-weight: 700; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.dash-card-del:hover { background: #fbe6e6; }
.row-actions { text-align: right; }
.row-del { background: none; border: 0; color: var(--safety); font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer; padding: 4px 9px; border-radius: 7px; }
.row-del:hover { background: #fbe6e6; }
.dash-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.dash-card-title h3 { margin: 0 0 2px; font-size: 0.9rem; letter-spacing: -0.01em; }
.dash-card-title p { margin: 0; color: var(--muted); font-size: 0.76rem; }

.dash-status {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  background: #eef3f8;
  color: var(--slate);
  border: 1px solid var(--line);
}
.dash-status--done { background: #ecf6ee; color: var(--maint); border-color: #cfe6d4; }
.dash-status--failed { background: #fdecec; color: var(--safety); border-color: #f6c9c9; }
.dash-status--processing,
.dash-status--queued { background: #fdf1e3; color: var(--repair); border-color: #f5dcbb; }

.dash-card-totals { display: flex; gap: 20px; }
.dash-card-totals div { display: flex; flex-direction: column; }
.dash-card-totals span { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; }
.dash-card-totals b { font-size: 1rem; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.dash-card-totals--pending { color: var(--muted); font-size: 0.82rem; font-style: italic; }

.dash-card-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dash-chip {
  font-size: 0.7rem; font-weight: 600; padding: 3px 8px; border-radius: 999px;
  background: #eef3f8; color: var(--slate); border: 1px solid var(--line);
}
.dash-chip--warn { background: #fdf1e3; color: var(--repair); border-color: #f5dcbb; }

@media (max-width: 600px) {
  .auth-wrap { padding: 32px 0 48px; }
  .dashboard { padding: 28px 0 48px; }
  .dash-head { flex-direction: column; align-items: stretch; }
}

/* ---------- Print ---------- */
@media print {
  .topbar, .sitefoot, .no-print-hide, .results-head { display: none !important; }
  /* the fixed app shell must release its viewport clipping so the whole
     document prints, not just the first screen */
  .appside, .apptop { display: none !important; }
  .appshell { display: block; height: auto; overflow: visible; }
  .appmain, .appcontent { display: block; height: auto; overflow: visible; }
  body { background: #fff; }
  .results { padding: 0; }
  .estimate-doc { border: none; box-shadow: none; border-radius: 0; padding: 0; }
  .price-card--typical { box-shadow: none; transform: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .item, .cat-table, .price-card, .chip { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .item { break-inside: avoid; }
}

/* ======================================================================
   Admin console (admin.html)
   ====================================================================== */
.admin-badge {
  font-size: 0.6rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em;
  background: var(--navy); color: var(--brand-2); padding: 2px 7px; border-radius: 6px;
  vertical-align: middle; margin-left: 4px;
}
.admin { padding: 32px 0 64px; }

.admin-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin: 20px 0 24px; }
.admin-tab {
  appearance: none; background: none; border: none; cursor: pointer;
  font: inherit; font-weight: 600; color: var(--muted); padding: 10px 16px;
  border-bottom: 3px solid transparent; margin-bottom: -2px; border-radius: 8px 8px 0 0;
}
.admin-tab:hover { color: var(--ink); background: var(--bg); }
.admin-tab.is-active { color: var(--brand-ink); border-bottom-color: var(--brand); }

.admin-panel { display: none; }
.admin-panel.is-active { display: block; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 30px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 18px 20px; box-shadow: var(--shadow-sm); transition: box-shadow 0.18s, transform 0.18s; }
.stat-value { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 0.8rem; font-weight: 700; color: var(--slate); margin-top: 6px; }
.stat-sub { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }

.admin-cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; margin-bottom: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }

/* Chart */
.chart-wrap { width: 100%; overflow-x: auto; }
.chart-wrap svg { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; }
.legend-item { font-size: 0.75rem; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Rank list (top uploaders) */
.rank-list { display: grid; gap: 10px; }
.rank-row { display: grid; grid-template-columns: 1fr 80px auto; align-items: center; gap: 10px; }
.rank-email { font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-track { background: var(--bg); border-radius: 999px; height: 8px; overflow: hidden; }
.rank-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.rank-num { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 0.85rem; }

/* Status bars */
.status-bars { display: grid; gap: 12px; }
.status-row { display: grid; grid-template-columns: 100px 1fr 44px; align-items: center; gap: 12px; }
.status-name { font-size: 0.82rem; font-weight: 700; text-transform: capitalize; }
.status-name--done { color: var(--maint); }
.status-name--failed { color: var(--safety); }
.status-name--processing, .status-name--queued { color: var(--repair); }
.status-track { background: var(--bg); border-radius: 999px; height: 10px; overflow: hidden; }
.status-fill { display: block; height: 100%; border-radius: 999px; background: var(--slate); }
.status-fill--done { background: var(--maint); }
.status-fill--failed { background: var(--safety); }
.status-fill--processing, .status-fill--queued { background: var(--repair); }
.status-num { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 0.85rem; }

/* Toolbar + inputs */
.admin-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.admin-input {
  font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink); min-width: 200px;
}
.admin-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(244, 176, 56, 0.18); }
.admin-select { min-width: 160px; cursor: pointer; }
.admin-count { color: var(--muted); font-size: 0.85rem; margin-left: auto; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-sm); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.admin-table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 13px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfd; }
.admin-table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table th.num { text-align: right; }
.user-row { cursor: pointer; }
.user-row:hover { background: var(--gold-hover); }
.user-row:focus { outline: 2px solid var(--brand); outline-offset: -2px; }
.cell-user { display: flex; flex-direction: column; }
.cell-user b { font-weight: 700; }
.cell-user span { color: var(--muted); font-size: 0.8rem; }
.nowrap { white-space: nowrap; }
.dot-custom { color: var(--accent); font-weight: 900; }

/* Badges */
.badge { display: inline-block; font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: capitalize; }
.badge--ok { background: #e7f3ea; color: var(--maint); }
.badge--muted { background: #eef3f8; color: var(--muted); }
.badge--danger { background: #fbe6e6; color: var(--safety); }
.badge--done { background: #e7f3ea; color: var(--maint); }
.badge--failed { background: #fbe6e6; color: var(--safety); }
.badge--processing, .badge--queued { background: #fdf1e3; color: var(--repair); }

/* Events */
.ev-type { font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: #eef3f8; color: var(--slate); white-space: nowrap; }
.ev-type--login { background: #e7f3ea; color: var(--maint); }
.ev-type--upload { background: #fdf7e3; color: var(--brand-ink); }
.ev-type--upload_blocked, .ev-type--login_blocked { background: #fbe6e6; color: var(--safety); }
.ev-type--admin_action { background: var(--navy); color: var(--brand-2); }
.ev-detail { color: var(--slate); }
.ev-ref { color: var(--muted); font-size: 0.78rem; }
.ev-ip { color: var(--muted); font-size: 0.8rem; }
.admin-more { text-align: center; margin-top: 16px; }
.admin-warning { background: #fdf1e3; color: var(--repair); border: 1px solid #f5dcbb; border-radius: var(--radius-sm); padding: 10px 14px; font-size: 0.85rem; margin-bottom: 12px; }
.admin-empty { color: var(--muted); text-align: center; padding: 24px; font-size: 0.9rem; }

/* Drawer */
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer[hidden] { display: none; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(13, 27, 42, 0.4); backdrop-filter: blur(2px); }
.drawer-panel {
  position: absolute; top: 0; right: 0; height: 100%; width: min(480px, 100%);
  background: var(--card); box-shadow: -12px 0 40px rgba(13, 27, 42, 0.2);
  overflow-y: auto; animation: drawer-in 0.18s ease-out;
}
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); }
.drawer-head h2 { margin: 0; font-size: 1.15rem; letter-spacing: -0.02em; word-break: break-word; }
.drawer-body { padding: 22px; }
.drawer-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 22px; }
.drawer-meta > div { display: flex; flex-direction: column; gap: 2px; }
.drawer-meta span { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; }
.drawer-meta b { font-weight: 600; word-break: break-word; }
.drawer-actions h3, .drawer-estimates h3 { font-size: 0.95rem; margin: 0 0 12px; }
.action-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.action-limit { flex-direction: column; align-items: stretch; gap: 8px; }
.action-limit label { font-size: 0.82rem; font-weight: 600; display: flex; flex-direction: column; gap: 6px; }
.action-limit .admin-input { min-width: 0; width: 100%; }
.btn-danger { background: var(--safety); color: #fff; }
.btn-danger:hover { background: #b83636; }
.action-danger { border: 1px solid #f3c9c9; background: #fdf5f5; border-radius: var(--radius-sm); padding: 14px 16px; margin-top: 8px; display: grid; gap: 10px; }
.action-danger h4 { margin: 0; color: var(--safety); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
.action-danger label { font-size: 0.82rem; display: flex; flex-direction: column; gap: 6px; }
.action-danger .chk { flex-direction: row; align-items: center; gap: 8px; }
.action-danger .admin-input { min-width: 0; width: 100%; }
.drawer-estimates { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 20px; }
.mini-est { display: block; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; }
.mini-zip { color: var(--muted); font-size: 0.82rem; }
.mini-meta { display: flex; gap: 8px; align-items: center; margin-top: 4px; font-size: 0.8rem; color: var(--muted); }
.mini-err { color: var(--safety); font-size: 0.78rem; margin-top: 4px; }
.mini-est--link { text-decoration: none; color: inherit; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.mini-est--link:hover { border-color: var(--navy); box-shadow: var(--ring); }
.mini-open { margin-left: auto; color: var(--navy); font-weight: 600; }

/* ======================================================================
   Login page polish (clean slate UH theme)
   ====================================================================== */
/* Outbound CTA pill (Need insurance quote?) — gold-tinted to stand out */
.pill-cta { background: var(--gold-tint); color: var(--brand-ink); border-color: #efd98f; }
a.pill-cta:hover { background: var(--gold-hover); border-color: var(--brand); color: var(--brand-ink); }

/* Soft slate backdrop so the card floats */
body[data-page="login"] {
  background:
    radial-gradient(1000px 460px at 50% -12%, rgba(27, 38, 59, 0.13), transparent 72%),
    linear-gradient(180deg, #e8edf4 0%, var(--bg) 42%);
  min-height: 100vh;
}
body[data-page="login"] .auth-wrap { max-width: 428px; padding: 60px 0 72px; }

body[data-page="login"] .auth-card {
  padding: 34px 32px 30px;
  border-radius: 20px;
  border: 1px solid var(--line);
  box-shadow: 0 22px 55px rgba(13, 27, 42, 0.15);
  position: relative;
  overflow: hidden;
}
/* Thin gold accent along the top edge */
body[data-page="login"] .auth-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}

.auth-brand { display: flex; justify-content: center; margin-bottom: 14px; }
.auth-brand-logo { height: 84px; width: auto; display: block; }

body[data-page="login"] .auth-title {
  text-align: center;
  color: var(--navy);
  font-size: 1.6rem;
  font-weight: 800;
}
body[data-page="login"] .auth-sub { text-align: center; margin-bottom: 24px; }

/* Sleeker inputs (scoped so the uploader form is untouched) */
body[data-page="login"] input[type="email"],
body[data-page="login"] input[type="password"] {
  padding: 13px 14px;
  border-radius: 12px;
  border-color: #dbe3ec;
  background: #fff;
}
/* "Next" button — brand blue, gold while pressed */
body[data-page="login"] .btn-primary {
  background: #3c64a6;
  color: #fff;
  border-radius: 12px;
  padding: 13px;
  font-size: 0.98rem;
  box-shadow: 0 8px 22px rgba(60, 100, 166, 0.32);
}
body[data-page="login"] .btn-primary:hover {
  background: #345788;
  box-shadow: 0 10px 26px rgba(60, 100, 166, 0.42);
}
body[data-page="login"] .btn-primary:active {
  background: #f4b038;
  color: var(--on-accent);
  box-shadow: none;
}

@media (max-width: 560px) {
  body[data-page="login"] .brand-text { display: none; } /* keep the bulb, drop wordmark on small screens */
}

/* ======================================================================
   Header account menu (shared: uploader / dashboard / admin)
   ====================================================================== */
.topbar-nav--menu { position: relative; }
.usermenu { position: relative; }

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: #3c64a6; color: #fff;
  font-weight: 700; font-size: 0.8rem; letter-spacing: 0.02em;
  flex: none; user-select: none;
}
.avatar-lg { width: 42px; height: 42px; font-size: 0.95rem; }

.usermenu-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 1px solid transparent; cursor: pointer;
  padding: 3px 6px 3px 3px; border-radius: 999px; font: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.usermenu-btn:hover { background: var(--bg); border-color: var(--line); }
.usermenu-caret { color: var(--muted); font-size: 0.7rem; transition: transform 0.15s; }
.usermenu-btn.is-open .usermenu-caret { transform: rotate(180deg); }

.usermenu-panel {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 268px; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 18px 46px rgba(13, 27, 42, 0.18);
  overflow: hidden; z-index: 40;
  animation: um-in 0.14s ease-out;
}
@keyframes um-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.usermenu-head { display: flex; align-items: center; gap: 12px; padding: 16px; background: var(--gold-tint); border-bottom: 1px solid var(--line); }
.usermenu-id { min-width: 0; }
.usermenu-name { font-weight: 700; font-size: 0.92rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usermenu-email { font-size: 0.78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.usermenu-section { padding: 6px; }
.usermenu-section + .usermenu-section { border-top: 1px solid var(--line); }

.um-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; text-align: left; box-sizing: border-box;
  padding: 9px 12px; border-radius: 8px;
  font: inherit; font-size: 0.88rem; font-weight: 500; color: var(--slate);
  background: none; border: none; cursor: pointer; text-decoration: none;
}
.um-item:hover { background: var(--bg); color: var(--ink); }
.um-item.is-current { background: var(--gold-tint); color: var(--brand-ink); font-weight: 600; }
.um-ext { color: var(--muted); font-size: 0.85em; }
.um-signout { color: var(--safety); font-weight: 600; }
.um-signout:hover { background: #fbe6e6; color: var(--safety); }

/* Partner setup — logo file input */
body[data-page="partner-setup"] input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
}
body[data-page="partner-setup"] input[type="file"]:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(244, 176, 56, 0.18);
}

/* ---------- Partner estimate — editable line items + history ---------- */
.pitem { align-items: flex-start; }
.pitem-title {
  width: 100%; font-weight: 600; font-size: 0.95rem; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; font-family: inherit;
}
.pitem-title:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(244, 176, 56, 0.2); }
.pitem-tags { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.pitem-tags select { font: inherit; font-size: 0.8rem; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.pitem-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 128px; }
.pitem-price { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; }
.pitem-price span { color: var(--muted); }
.pitem-typ {
  width: 92px; text-align: right; font: inherit; font-weight: 700; font-size: 1rem;
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.pitem-typ:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(244, 176, 56, 0.2); }
.pitem-remove { background: none; border: none; color: var(--safety); font: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer; padding: 0; }
.pitem-remove:hover { text-decoration: underline; }
.pitem--removed { opacity: 0.5; }
.pitem--removed .pitem-title, .pitem--removed .item-finding { text-decoration: line-through; }

.hist-list { display: grid; gap: 8px; }
.hist-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 0.88rem; }
.hist-meta { color: var(--muted); font-size: 0.78rem; margin-top: 2px; }

/* Estimate page: doc + sticky right-rail version timeline */
.est-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.est-history {
  position: sticky; top: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 20px 18px;
  max-height: calc(100vh - 120px); overflow-y: auto;
}
.hist-title { font-size: 1rem; font-weight: 700; margin: 0 0 16px; }
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -20px; top: 3px;
  width: 11px; height: 11px; border-radius: 50%; background: #fff;
  border: 3px solid var(--muted); box-sizing: border-box;
}
.tl-item--current::before { border-color: var(--brand); }
.tl-ver { font-weight: 700; font-size: 0.88rem; display: flex; align-items: center; gap: 6px; }
.tl-badge { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; background: var(--gold-tint); color: var(--brand-ink); padding: 1px 6px; border-radius: 999px; }
.tl-summary { font-size: 0.82rem; color: var(--slate); margin-top: 2px; }
.tl-meta { font-size: 0.72rem; color: var(--muted); margin-top: 3px; }
.tl-view { margin-top: 6px; background: none; border: none; padding: 0; color: var(--brand-ink); font: inherit; font-size: 0.76rem; font-weight: 600; cursor: pointer; }
.tl-view:hover { text-decoration: underline; }

@media (max-width: 900px) {
  .est-layout { grid-template-columns: 1fr; }
  .est-history { position: static; max-height: none; }
}

/* ======================================================================
   Shared SaaS app shell (sidebar + top bar) — shell.js
   ====================================================================== */
.appshell { display: flex; height: 100vh; overflow: hidden; }
.appside {
  width: 250px; flex: none; height: 100vh; overflow-y: auto;
  background: linear-gradient(180deg, var(--navy), #2f4f85);
  color: #d3ddec; display: flex; flex-direction: column; padding: 18px 14px; gap: 6px;
}
.appbrand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 10px; }
.appmark { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; overflow: hidden; flex: none; background: #fff; padding: 4px; box-sizing: border-box; box-shadow: 0 1px 3px rgba(13, 27, 42, 0.25); }
.appmark svg { width: 19px; height: 19px; }
.appmark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.appword { font-weight: 800; letter-spacing: -0.02em; color: #fff; }
.appword span { color: var(--brand-2); }
.approle { font-size: 0.6rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; background: rgba(244, 176, 56, 0.18); color: var(--brand-2); padding: 2px 8px; border-radius: 6px; align-self: flex-start; margin: 0 0 4px 8px; }
.appnavlabel { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em; color: #a7b8d2; padding: 12px 12px 6px; }
.appnav { display: flex; flex-direction: column; gap: 3px; }
.appnavitem { display: flex; align-items: center; gap: 12px; padding: 10px 13px; border-radius: 11px; color: #d3ddec; font: inherit; font-size: 0.92rem; font-weight: 500; cursor: pointer; border: 1px solid transparent; background: none; text-align: left; text-decoration: none; transition: background 0.15s, color 0.15s; }
.appnavitem svg { width: 19px; height: 19px; flex: none; opacity: 0.9; }
.appnavitem:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.appnavitem.on { background: rgba(244, 176, 56, 0.15); color: #fff; border-color: rgba(244, 176, 56, 0.28); }
.appnavitem.on svg { color: var(--brand-2); opacity: 1; }

.appmain { flex: 1; min-width: 0; height: 100vh; display: flex; flex-direction: column; }
.apptop { position: sticky; top: 0; z-index: 20; height: 64px; display: flex; align-items: center; gap: 14px; padding: 0 24px; background: rgba(255, 255, 255, 0.85); -webkit-backdrop-filter: saturate(180%) blur(12px); backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--line); }
.apptitle { font-size: 1.12rem; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.apptop-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.appbell { position: relative; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; color: var(--muted); cursor: pointer; }
.appbell:hover { color: var(--slate); border-color: #d7dee8; }
.appbell svg { width: 18px; height: 18px; }
/* notification center */
.appnotify { position: relative; }
.appbell-badge { position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px; box-sizing: border-box; border-radius: 999px; background: var(--safety); color: #fff; font-size: 0.62rem; font-weight: 800; line-height: 17px; text-align: center; box-shadow: 0 0 0 2px #fff; }
.appnotify-menu { position: absolute; top: calc(100% + 8px); right: 0; width: 340px; max-width: 86vw; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; z-index: 45; }
.appnotify-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 0.9rem; color: var(--ink); }
.appnotify-clear { background: none; border: 0; color: var(--brand-ink); font: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer; padding: 0; }
.appnotify-clear:hover { text-decoration: underline; }
.appnotify-list { max-height: 380px; overflow-y: auto; }
.notif-empty { padding: 30px 16px; text-align: center; color: var(--muted); font-size: 0.88rem; }
.notif-item { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.notif-item:last-child { border-bottom: 0; }
.notif-item--unread { background: #f6f9ff; }
.notif-main { flex: 1; min-width: 0; }
.notif-item--link { text-decoration: none; color: inherit; cursor: pointer; }
.notif-item--link:hover { background: #eef2f8; }
.notif-go { align-self: center; color: var(--muted); font-size: 1.1rem; font-weight: 700; flex: none; }
.notif-mark { width: 8px; height: 8px; border-radius: 50%; background: transparent; margin-top: 5px; flex: none; }
.notif-item--unread .notif-mark { background: var(--brand); }
.notif-title { font-weight: 600; font-size: 0.9rem; color: var(--slate); }
.notif-sub { font-size: 0.82rem; color: var(--muted); margin-top: 1px; word-break: break-word; }
.notif-time { font-size: 0.72rem; color: var(--muted); margin-top: 3px; }

/* admin demo role switcher */
.appswitch { display: flex; align-items: center; gap: 2px; background: var(--panel-2, #eef1f7); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.appswitch-lbl { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 0 6px 0 4px; }
.appswitch-opt { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 0.8rem; font-weight: 600; padding: 5px 10px; border-radius: 7px; cursor: pointer; line-height: 1; }
.appswitch-opt:hover { color: var(--slate); }
.appswitch-opt.on { background: var(--navy); color: #fff; box-shadow: 0 1px 2px rgba(13, 27, 42, 0.12); }
/* subtle hint that the sidebar is showing a previewed role, not the real one */
.appshell.preview-role .appside { outline: 2px dashed rgba(244, 176, 56, 0.5); outline-offset: -6px; }
@media (max-width: 720px) { .appswitch-lbl { display: none; } }
.appacct { position: relative; }
.appacct-btn { display: flex; align-items: center; gap: 9px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; font: inherit; box-shadow: var(--shadow-sm); }
.appavatar { width: 30px; height: 30px; border-radius: 50%; background: #3c64a6; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 0.74rem; flex: none; overflow: hidden; }
.appavatar.has-logo { background: #fff; }
.appavatar img { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; display: block; }
.appacct-nm { font-size: 0.85rem; font-weight: 600; color: var(--slate); }
.appcv { color: var(--muted); display: flex; }
.appacct-menu { position: absolute; top: calc(100% + 8px); right: 0; width: 246px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; z-index: 40; }
.appacct-head { display: flex; align-items: center; gap: 11px; padding: 14px; background: var(--gold-tint); border-bottom: 1px solid var(--line); }
.appacct-head .appavatar { width: 34px; height: 34px; font-size: 0.82rem; }
.appacct-head .nm { font-weight: 700; font-size: 0.9rem; }
.appacct-head .co { font-size: 0.78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appacct-items { padding: 6px; }
.appacct-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px; font: inherit; font-size: 0.87rem; color: var(--slate); background: none; border: 0; cursor: pointer; text-decoration: none; transition: background 0.12s; }
.appacct-item:hover { background: #eef2f8; }
.appacct-item svg { width: 16px; height: 16px; color: var(--muted); }
.appacct-item.danger { color: var(--safety); font-weight: 600; }
.appacct-item.danger svg { color: var(--safety); }
.appacct-item.danger:hover { background: #fbe6e6; }

.appcontent { flex: 1; min-width: 0; overflow-y: auto; overflow-x: hidden; }
/* In-page tab bars are replaced by the sidebar nav inside the shell. */
.appcontent .admin-tabs { display: none; }
/* the shell hosts the page's <main>; normalize the page's centering wrap so
   content fills the content area with consistent padding */
.appcontent .wrap { width: auto; max-width: 1200px; margin: 0 auto; padding: 40px 40px 72px; }
.appcontent .dashboard, .appcontent .results, .appcontent .admin { padding-top: 40px; padding-bottom: 72px; }

/* partner profile page (profile.html) */
.pf-logo-row { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.pf-logo { position: relative; width: 84px; height: 84px; border-radius: 16px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer; overflow: hidden; flex: none; transition: border-color .15s, box-shadow .15s; }
.pf-logo:hover { border-color: var(--navy); box-shadow: var(--ring); }
.pf-logo img { width: 100%; height: 100%; object-fit: contain; }
.pf-logo-empty { color: var(--muted); font-size: 0.8rem; font-weight: 700; }
.pf-logo-edit { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(13, 27, 42, 0.74); color: #fff; font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; text-align: center; padding: 3px 0; opacity: 0; transition: opacity .15s; }
.pf-logo:hover .pf-logo-edit, .pf-logo:focus .pf-logo-edit { opacity: 1; }
.pf-logo-hint b { font-size: 0.95rem; }
.pf-actions { display: flex; gap: 10px; margin-top: 22px; }
/* soft-green success toast on the profile page ("Profile saved.") */
#pf-msg.form-note { background: #e7f6ec; border-color: #b7e4c7; color: #1b6b3a; }
/* analytics ranked-list secondary label (value / item count) */
.an-sub { color: var(--muted); font-weight: 600; font-size: 0.78rem; }

/* themed confirm modal (replaces browser confirm) */
.modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-scrim { position: absolute; inset: 0; background: rgba(13, 27, 42, 0.45); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.modal-card { position: relative; z-index: 1; width: 100%; max-width: 440px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 26px; animation: modal-in 0.14s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(6px) scale(0.99); } to { opacity: 1; transform: none; } }
.modal-title { margin: 0 0 8px; font-size: 1.2rem; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.modal-msg { margin: 0 0 16px; color: var(--muted); font-size: 0.92rem; line-height: 1.5; }
.modal-card #del-input { width: 100%; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.appmenu-btn { display: none; background: none; border: 0; color: var(--slate); cursor: pointer; padding: 4px; }
.appmenu-btn svg { width: 22px; height: 22px; }
.appscrim { display: none; }

@media (max-width: 860px) {
  .appside { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform 0.2s ease; z-index: 60; box-shadow: 0 0 40px rgba(13, 27, 42, 0.3); }
  .appshell.nav-open .appside { transform: none; }
  .appshell.nav-open .appscrim { display: block; position: fixed; inset: 0; background: rgba(13, 27, 42, 0.42); z-index: 50; }
  .appmenu-btn { display: block; }
  .appacct-nm { display: none; }
  .appcontent .wrap { padding: 20px 16px 40px; }
}

@media (max-width: 820px) {
  .admin-cols { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .admin { padding: 20px 0 48px; }
  .drawer-meta { grid-template-columns: 1fr; }
  .admin-count { width: 100%; margin-left: 0; }
}

/* ======================================================================
   Clean-slate polish (visual only) — refined type, calmer surfaces, crisper
   controls. Real-estate/estimation feel: quiet chrome, confident numbers.
   Keeps the Utility Helpers palette (navy #3c64a6 / gold #f4b038).
   ====================================================================== */

/* --- type: lighter weights, tighter tracking (Apple-like hierarchy) --- */
body { letter-spacing: -0.005em; }
h1, h2, h3, .dash-title, .card-title, .doc-title, .stat-value, .price-value {
  font-weight: 650;
  letter-spacing: -0.022em;
}
.dash-title { font-size: 1.72rem; }
.card-title { font-size: 1.06rem; font-weight: 650; }
.dash-sub { color: var(--muted); }
.field-label { font-weight: 550; font-size: 0.82rem; color: var(--slate); }

/* section accent: slimmer, softer — a mark, not a bar */
.card-title::before, .doc-section h3::before, .hist-title::before {
  width: 3px; height: 0.78em; border-radius: 999px; opacity: 0.9;
}
.dashboard > .card-title { border-bottom-color: var(--hairline); padding-bottom: 10px; }
.dash-head { border-bottom-color: var(--hairline); }

/* --- surfaces: hairline + whisper shadow; lift only when interactive --- */
.card, .stat-card, .tier-list, .cat-table, .table-wrap, .estimate-doc, .est-history {
  border-color: var(--hairline);
}
.card { box-shadow: var(--shadow-sm); }
.stat-card { box-shadow: var(--shadow-xs); background: #fff; }
.stat-card:hover { box-shadow: var(--shadow-sm); transform: none; }
.stat-value { font-size: 1.95rem; }
.stat-label { font-weight: 550; color: var(--muted); font-size: 0.8rem; }
.stat-sub { color: #8b98a6; }

.dash-card { box-shadow: var(--shadow-xs); }
.dash-card--clickable:hover, .dash-card--clickable:focus-visible {
  border-color: rgba(60, 100, 166, 0.35);
  box-shadow: 0 2px 6px rgba(13, 27, 42, 0.05), 0 12px 28px rgba(13, 27, 42, 0.08);
  transform: translateY(-1px);
}

/* --- buttons: solid, flat, confident (no gradient bounce) --- */
.btn { border-radius: 10px; font-weight: 600; font-size: 0.92rem; padding: 10px 18px; }
.btn:active { transform: none; opacity: 0.9; }
.btn-primary {
  background: var(--brand); color: var(--on-accent);
  box-shadow: 0 1px 2px rgba(146, 104, 0, 0.18);
}
.btn-primary:hover { background: #f0a827; box-shadow: 0 2px 8px rgba(146, 104, 0, 0.22); transform: none; }
.btn-secondary { background: #fff; border-color: #dfe4ec; color: var(--slate); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: #f7f9fc; border-color: #cfd7e3; color: var(--ink); }

/* --- inputs: white, soft, navy focus ring --- */
input[type="text"], input[type="email"], input[type="tel"], input[type="password"],
input[type="search"], input[type="number"], select, .admin-input {
  background: #fff; border-color: #dfe4ec; border-radius: 10px;
}
input[type="text"]:focus, input[type="email"]:focus, input[type="tel"]:focus,
input[type="password"]:focus, input[type="search"]:focus, input[type="number"]:focus,
select:focus, .admin-input:focus {
  border-color: var(--navy); box-shadow: var(--ring); background: #fff;
}
.dropzone { border-color: #d7dee8; border-radius: 14px; background: #fcfdfe; }
.dropzone:hover, .dropzone.dragover { border-color: var(--brand); background: var(--gold-hover); }

/* --- tables: airy, hairline rules, quiet header --- */
.admin-table { font-size: 0.885rem; }
.admin-table th {
  background: transparent; color: #8b98a6; font-weight: 650;
  font-size: 0.68rem; letter-spacing: 0.07em; padding: 12px 16px;
  border-bottom: 1px solid var(--hairline);
}
.admin-table td { border-bottom: 1px solid var(--hairline); padding: 15px 16px; }
.admin-table tbody tr { transition: background 0.12s; }
.admin-table tbody tr.user-row:hover { background: #f8fafc; }
.table-wrap { background: #fff; border-radius: 14px; box-shadow: var(--shadow-xs); }

/* --- badges & chips: softer, smaller caps --- */
.badge, .dash-chip, .chip, .pill {
  font-weight: 600; letter-spacing: 0.01em; border-radius: 8px;
}
.badge { padding: 3px 9px; font-size: 0.69rem; }
.chip { border-radius: 999px; }
.dash-chip { border-radius: 999px; background: #f2f5f9; color: var(--muted); }

/* --- app shell: flatter navy, quieter nav, crisper top bar --- */
.appside { background: linear-gradient(180deg, #3c64a6 0%, #35578f 100%); }
.appnavitem { border-radius: 9px; font-weight: 550; color: #cfdaea; }
.appnavitem:hover { background: rgba(255, 255, 255, 0.08); }
.appnavitem.on {
  background: rgba(255, 255, 255, 0.14); color: #fff;
  border-color: transparent; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.appnavlabel { color: #93a6c4; font-size: 0.62rem; }
.apptop {
  background: rgba(255, 255, 255, 0.78);
  border-bottom: 1px solid var(--hairline);
  box-shadow: none;
}
.apptitle { font-size: 1.05rem; font-weight: 650; }
.appbell, .appacct-btn { border-color: #e3e8ef; box-shadow: var(--shadow-xs); }
.appacct-btn:hover { background: #f8fafc; }

/* --- the estimate document: the product's centerpiece --- */
.estimate-doc { box-shadow: var(--shadow); border-radius: 18px; padding: 40px; }
.doc-head { border-bottom: 1px solid var(--hairline); }
.doc-brand { letter-spacing: -0.01em; font-weight: 700; }
.doc-title { font-size: 1.55rem; }
.doc-meta span { color: #8b98a6; font-size: 0.78rem; }
.doc-section h3 { font-size: 1.02rem; font-weight: 650; }
.doc-section + .doc-section { border-top-color: var(--hairline); }

/* headline figure: quiet frame, loud number */
.price-card--typical {
  background: linear-gradient(180deg, #fffdf6 0%, #fef9ec 100%);
  border-color: rgba(244, 176, 56, 0.42);
  box-shadow: 0 1px 2px rgba(146, 104, 0, 0.06), 0 10px 26px rgba(146, 104, 0, 0.07);
  transform: none;
}
.price-label { font-size: 0.7rem; letter-spacing: 0.09em; color: var(--brand-ink); font-weight: 700; }
.price-value { font-size: clamp(2rem, 4.5vw, 2.6rem); font-weight: 700; letter-spacing: -0.03em; }
.price-note { color: #9aa6b2; }

/* line items + category rows: cleaner rhythm */
.item { border-color: var(--hairline); border-radius: 12px; }
.cat-row { border-color: var(--hairline); }
.cat-row.head { background: transparent; color: #8b98a6; font-size: 0.68rem; letter-spacing: 0.07em; }
.cat-row.total { background: #fbfcfe; }
.tier-row { border-color: var(--hairline); }

/* version history rail */
.est-history { box-shadow: var(--shadow-sm); border-radius: 14px; }
.hist-title { font-size: 0.98rem; }

/* modal + drawer: match the softer elevation */
.modal-card { border-color: var(--hairline); border-radius: 18px; box-shadow: var(--shadow-lg); }
.drawer-panel { box-shadow: var(--shadow-lg); }

/* focus visibility for keyboard users, app-wide */
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }

/* ======================================================================
   GLASS / MODERN LAYER (visual only)
   Selective glass: frosted chrome + crisp content. Layered highlights,
   larger display type, roomier layout. Print falls back to solid.
   ====================================================================== */
:root {
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.86);
  --glass-edge: inset 0 1px 0 rgba(255, 255, 255, 0.75);
  --blur: saturate(180%) blur(20px);
}

/* ambient canvas — soft brand light, fixed so it never scrolls */
body {
  background:
    radial-gradient(1200px 620px at 84% -180px, rgba(244, 176, 56, 0.10), transparent 62%),
    radial-gradient(1000px 560px at -180px -120px, rgba(60, 100, 166, 0.12), transparent 58%),
    linear-gradient(180deg, #f7f8fb 0%, #f3f5f9 100%);
  background-attachment: fixed;
}

/* ---- display typography ---- */
.dash-title { font-size: clamp(1.75rem, 2.4vw, 2.15rem); font-weight: 680; letter-spacing: -0.03em; }
.dash-sub { font-size: 0.95rem; }
.apptitle { letter-spacing: -0.025em; }
.card-title { font-size: 1.1rem; }
.doc-title { font-size: clamp(1.5rem, 2.2vw, 1.85rem); letter-spacing: -0.03em; }
.stat-value { font-size: 2.05rem; letter-spacing: -0.035em; }
.stat-label { font-size: 0.78rem; letter-spacing: 0.01em; }

/* ---- frosted chrome: sidebar, top bar, menus, modals ---- */
.appside {
  background: linear-gradient(180deg, rgba(60, 100, 166, 0.96) 0%, rgba(47, 79, 133, 0.96) 100%);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-right: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.06);
}
.appnavitem.on {
  background: rgba(255, 255, 255, 0.17);
  box-shadow: var(--glass-edge), 0 1px 2px rgba(13, 27, 42, 0.10);
}
.apptop {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-bottom: 1px solid rgba(13, 27, 42, 0.06);
}
.appacct-menu, .appnotify-menu, .modal-card, .drawer-panel {
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: var(--glass-edge), var(--shadow-lg);
  border-color: rgba(13, 27, 42, 0.08);
}
.appbell, .appacct-btn, .appswitch {
  background: rgba(255, 255, 255, 0.7);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: var(--glass-edge), var(--shadow-xs);
}

/* ---- content surfaces: crisp, with a glass edge highlight ---- */
.card, .stat-card, .table-wrap, .estimate-doc, .est-history, .tier-list, .cat-table {
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.card, .stat-card, .table-wrap, .est-history { box-shadow: var(--glass-edge), var(--shadow-sm); }
.estimate-doc { box-shadow: var(--glass-edge), var(--shadow); }
.stat-card {
  position: relative; overflow: hidden; padding: 20px 22px;
  transition: box-shadow .18s ease, transform .18s ease;
}
/* subtle gold hairline across the top of each KPI tile */
.stat-card::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, rgba(244, 176, 56, 0), rgba(244, 176, 56, 0.55), rgba(244, 176, 56, 0));
}
.stat-card:hover { transform: translateY(-1px); box-shadow: var(--glass-edge), var(--shadow); }
.dash-card { background: rgba(255, 255, 255, 0.95); box-shadow: var(--glass-edge), var(--shadow-xs); }

/* roomier layout */
.appcontent .wrap { max-width: 1240px; padding: 44px 44px 80px; }
.stat-grid { gap: 18px; }
.dash-head { margin-bottom: 34px; padding-bottom: 22px; }

/* ---- charts ---- */
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.chart-card { padding: 22px 24px; }
.chart-card--wide { grid-column: 1 / -1; }
.chart-card .card-head { margin-bottom: 14px; align-items: baseline; }
.chart-title {
  margin: 0; font-size: 1rem; font-weight: 650; letter-spacing: -0.02em; color: var(--ink);
  position: relative; padding-left: 12px;
}
.chart-title::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 0.8em; border-radius: 999px; background: var(--brand);
}
.chart-note { font-size: 0.76rem; color: var(--muted); font-weight: 600; }
.chart-body { position: relative; min-height: 60px; }
.chart-empty { color: var(--muted); font-size: 0.86rem; text-align: center; padding: 26px 0; margin: 0; }
.c-svg { width: 100%; height: auto; display: block; overflow: visible; }
.c-grid { stroke: rgba(13, 27, 42, 0.07); stroke-width: 1; }
.c-axis { font-size: 10px; fill: #8b98a6; font-weight: 600; }

/* bars: grow up on load */
.c-bar {
  fill: var(--navy); opacity: 0.92; transform-box: fill-box; transform-origin: bottom;
  animation: c-grow .55s cubic-bezier(.2, .8, .2, 1) both; transition: opacity .15s, fill .15s; cursor: default;
}
.c-bar:hover { opacity: 1; fill: var(--accent); }
@keyframes c-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* donut */
.c-donut-wrap { display: grid; grid-template-columns: 170px 1fr; gap: 18px; align-items: center; }
.c-donut { max-width: 170px; }
.c-arc { transition: stroke-width .15s, opacity .15s; cursor: default; animation: c-fade .5s ease both; }
.c-arc:hover { stroke-width: 26; }
@keyframes c-fade { from { opacity: 0; } to { opacity: 1; } }
.c-donut-num { font-size: 26px; font-weight: 700; fill: var(--ink); letter-spacing: -0.03em; }
.c-donut-cap { font-size: 9.5px; font-weight: 700; fill: #8b98a6; text-transform: uppercase; letter-spacing: 0.09em; }
.c-legend { display: grid; gap: 9px; }
.c-legend-row { display: flex; align-items: center; gap: 9px; font-size: 0.85rem; }
.c-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.c-legend-label { color: var(--slate); flex: 1; }
.c-legend-val { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }

/* ranked bars */
.c-rank { margin-bottom: 14px; }
.c-rank:last-child { margin-bottom: 0; }
.c-rank-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 5px; }
.c-rank-label { font-size: 0.86rem; font-weight: 600; color: var(--slate); }
.c-rank-sub { font-size: 0.76rem; color: var(--muted); font-weight: 600; }
.c-rank-val { font-size: 0.86rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.c-rank-track { height: 8px; border-radius: 999px; background: rgba(13, 27, 42, 0.06); overflow: hidden; }
.c-rank-fill {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--navy), #5a83c4);
  transform-origin: left; animation: c-slide .6s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes c-slide { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* sparkline */
.c-spark-line { fill: none; stroke: var(--navy); stroke-width: 2; }
.c-spark-fill { fill: rgba(60, 100, 166, 0.10); stroke: none; }

/* chart tooltip */
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none;
  background: rgba(18, 32, 46, 0.94); color: #fff; font-size: 0.76rem; line-height: 1.35;
  padding: 7px 10px; border-radius: 9px; box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); white-space: nowrap;
}
.chart-tip b { font-weight: 700; }

@media (max-width: 1000px) {
  .chart-grid { grid-template-columns: 1fr; }
  .c-donut-wrap { grid-template-columns: 140px 1fr; }
}
@media (max-width: 860px) {
  .appcontent .wrap { padding: 24px 18px 60px; }
}

/* ---- print: no glass, no blur ---- */
@media print {
  body { background: #fff !important; }
  .card, .stat-card, .estimate-doc, .table-wrap, .tier-list, .cat-table {
    background: #fff !important;
    -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
    box-shadow: none !important;
  }
  .chart-tip { display: none !important; }
}

/* ======================================================================
   Account settings (profile.html) — stacked setting cards with icon headers
   and a live password-strength checklist.
   ====================================================================== */
.settings-col { display: grid; gap: 20px; max-width: 640px; }
.setting-card { padding: 26px 28px; }
.setting-head { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 22px; }
.setting-icon {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  display: grid; place-items: center;
  background: rgba(60, 100, 166, 0.09); color: var(--navy);
  box-shadow: inset 0 0 0 1px rgba(60, 100, 166, 0.10);
}
.setting-icon svg { width: 18px; height: 18px; }
.setting-title { margin: 0; font-size: 1.02rem; font-weight: 650; letter-spacing: -0.02em; color: var(--ink); }
.setting-sub { margin: 2px 0 0; font-size: 0.85rem; color: var(--muted); }
.setting-actions { display: flex; align-items: center; gap: 14px; margin-top: 22px; flex-wrap: wrap; }
.setting-link { font-size: 0.85rem; font-weight: 600; color: var(--navy); text-decoration: none; }
.setting-link:hover { text-decoration: underline; }
.setting-card .btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* password strength + rules */
.pw-meter {
  margin-top: 12px; padding: 14px 16px; border-radius: 12px;
  background: rgba(13, 27, 42, 0.025); border: 1px solid var(--hairline);
}
.pw-meter-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.pw-meter-label { font-size: 0.78rem; font-weight: 650; color: var(--slate); }
.pw-meter-verdict { font-size: 0.76rem; font-weight: 700; color: var(--muted); }
.pw-bars { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-bottom: 12px; }
.pw-bars span {
  height: 4px; border-radius: 999px; background: rgba(13, 27, 42, 0.10);
  transition: background 0.2s ease;
}
/* colour ramps with the score */
.pw-bars span.on { background: var(--safety); }
.pw-bars span.on.lvl-3 { background: var(--repair); }
.pw-bars span.on.lvl-4 { background: #6aa84f; }
.pw-bars span.on.lvl-5 { background: var(--maint); }
.pw-meter-verdict.lvl-1, .pw-meter-verdict.lvl-2 { color: var(--safety); }
.pw-meter-verdict.lvl-3 { color: var(--repair); }
.pw-meter-verdict.lvl-4 { color: #4d8a3a; }
.pw-meter-verdict.lvl-5 { color: var(--maint); }

.pw-rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.pw-rules li {
  display: flex; align-items: center; gap: 9px;
  font-size: 0.81rem; color: var(--muted); transition: color 0.15s ease;
}
.pw-rules li.ok { color: var(--maint); }
.pw-tick {
  width: 15px; height: 15px; border-radius: 50%; flex: none; position: relative;
  border: 1.5px solid rgba(13, 27, 42, 0.18); transition: background 0.15s, border-color 0.15s;
}
.pw-rules li.ok .pw-tick { background: var(--maint); border-color: var(--maint); }
.pw-rules li.ok .pw-tick::after {
  content: ""; position: absolute; left: 4.5px; top: 1.5px;
  width: 3.5px; height: 7px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}

@media (max-width: 600px) {
  .setting-card { padding: 20px 18px; }
  .settings-col { gap: 16px; }
}

/* ======================================================================
   Centered narrow views — form-first screens read better as a centered
   column than pinned to the left of the wide content rail.
   ====================================================================== */

/* Account settings: header + cards share one centered column */
.appcontent #pf-root { max-width: 640px; margin-left: auto; margin-right: auto; }
.settings-col { max-width: none; }

/* New estimate (choose customer + upload): back button, title and card
   all align inside one centered column */
.appcontent #pv-create,
.appcontent #pv-upload { max-width: 560px; margin-left: auto; margin-right: auto; }
.appcontent #pv-create .upload-card,
.appcontent #pv-upload .upload-card { max-width: none; }

/* Estimate-ready summary keeps the same centered rhythm */
.appcontent #pv-result { max-width: 720px; margin-left: auto; margin-right: auto; }
