/* WaterWorks Hub
   Layout: fixed left rail (navigation) + top search bar + one working column. Product data reads like a
   submittal sheet: condensed headings, mono part numbers and sizes, ruled spec tables. */
:root {
  --bg: #eef2f5;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --ink: #142230;
  --muted: #586776;
  --line: #d6dee5;
  --accent: #1d5fb8;          /* C900 blue */
  --accent-soft: #e3ecf8;
  --accent-ink: #ffffff;
  --rail: #12304f;
  --rail-ink: #dce7f3;
  --rail-muted: #8fa7c0;
  --rail-hover: #1b4066;
  --ok: #1d7a4c;  --ok-soft: #e1f2e9;
  --warn: #9a6200; --warn-soft: #fbf0d9;
  --bad: #b0281f;  --bad-soft: #fbe5e3;
  --ref: #5b4bb0;  --ref-soft: #ebe8f8;
  --shadow: 0 1px 2px rgba(20, 34, 48, .06), 0 6px 20px rgba(20, 34, 48, .06);

  --f-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --f-body: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --r: 6px;
  --gutter: clamp(16px, 3vw, 32px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d151d; --surface: #141f2a; --surface-2: #192633; --ink: #e3ebf2; --muted: #95a6b6; --line: #263544;
    --accent: #5f9cf0; --accent-soft: #1a2d45; --accent-ink: #08131f;
    --rail: #0a1825; --rail-ink: #d5e1ee; --rail-muted: #7f97ae; --rail-hover: #13283c;
    --ok: #5cc48f; --ok-soft: #12291e; --warn: #e2b04f; --warn-soft: #2c2312; --bad: #f08379; --bad-soft: #321716; --ref: #a99cf0; --ref-soft: #211d38;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d151d; --surface: #141f2a; --surface-2: #192633; --ink: #e3ebf2; --muted: #95a6b6; --line: #263544;
  --accent: #5f9cf0; --accent-soft: #1a2d45; --accent-ink: #08131f;
  --rail: #0a1825; --rail-ink: #d5e1ee; --rail-muted: #7f97ae; --rail-hover: #13283c;
  --ok: #5cc48f; --ok-soft: #12291e; --warn: #e2b04f; --warn-soft: #2c2312; --bad: #f08379; --bad-soft: #321716; --ref: #a99cf0; --ref-soft: #211d38;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--f-body); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 600; letter-spacing: .01em; line-height: 1.1; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(30px, 4vw, 40px); }
h2 { font-size: 24px; }
h3 { font-size: 19px; }
p { margin: 0; }
.mono { font-family: var(--f-mono); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* Shell */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100%; }
.rail { background: var(--rail); color: var(--rail-ink); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 12px; gap: 18px; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; color: var(--rail-ink); padding: 0 6px; }
.brand:hover { text-decoration: none; }
.brand img { border-radius: 9px; }
.brand strong { display: block; font-family: var(--f-display); font-size: 21px; font-weight: 700; letter-spacing: .02em; line-height: 1; }
.brand small { color: var(--rail-muted); font-size: 11.5px; }
#nav { display: flex; flex-direction: column; gap: 14px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group__label { font-family: var(--f-display); text-transform: uppercase; letter-spacing: .12em; font-size: 12px; color: var(--rail-muted); padding: 0 10px 4px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r); color: var(--rail-ink); font-size: 14.5px; }
.nav-link svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.nav-link:hover { background: var(--rail-hover); text-decoration: none; }
.nav-link[aria-current="page"] { background: var(--rail-hover); box-shadow: inset 3px 0 0 var(--accent); }
.nav-link .count { margin-left: auto; font: 600 11.5px var(--f-mono); background: var(--rail-hover); padding: 1px 7px; border-radius: 10px; color: var(--rail-ink); }
.nav-link[aria-current="page"] .count { background: var(--rail); }
.rail__foot { margin-top: auto; font-size: 12px; color: var(--rail-muted); padding: 0 10px; display: flex; flex-direction: column; gap: 6px; }
.rail__foot strong { color: var(--rail-ink); font-weight: 500; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px var(--gutter); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topsearch { flex: 1; display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 0 12px; max-width: 760px; }
.topsearch:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.topsearch svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; flex: none; }
.topsearch input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 10px 0; outline: none; font-size: 15px; }
.topsearch kbd, kbd { font: 500 11px var(--f-mono); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 1px 6px; color: var(--muted); }
.topbar__actions { display: flex; gap: 6px; margin-left: auto; }
.icon-btn { position: relative; display: grid; place-items: center; width: 38px; height: 38px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.icon-btn:hover { border-color: var(--accent); }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.badge-dot { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font: 600 11px/18px var(--f-mono); }
.menu-btn { display: none; }
.scrim { position: fixed; inset: 0; background: rgba(5, 12, 20, .45); z-index: 29; }

.notif-panel { position: absolute; right: var(--gutter); top: calc(100% + 6px); width: min(380px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 10px; max-height: 70vh; overflow-y: auto; }
.notif-panel header { display: flex; justify-content: space-between; align-items: center; }
.notif { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: var(--r); background: var(--surface-2); font-size: 14px; cursor: pointer; border: 0; text-align: left; }
.notif.unread { box-shadow: inset 3px 0 0 var(--accent); }
.notif time { font-size: 12px; color: var(--muted); }

.page { padding: 28px var(--gutter) 64px; display: flex; flex-direction: column; gap: 28px; outline: none; max-width: 1240px; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: end; justify-content: space-between; }
.page-head > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; max-width: 70ch; }
.eyebrow { font-family: var(--f-display); text-transform: uppercase; letter-spacing: .14em; font-size: 13px; color: var(--accent); font-weight: 600; }
.lede { color: var(--muted); font-size: 16px; max-width: 68ch; }

/* Building blocks */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel--flush { padding: 0; overflow: hidden; }
.panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.grid--2 { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); align-items: start; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 10px; min-width: 0; }

.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: var(--r); cursor: pointer; font-size: 14px; font-weight: 500; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { filter: brightness(1.08); }
.btn--ok { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.btn--quiet { border-color: transparent; background: transparent; color: var(--accent); padding-inline: 8px; }
.btn--danger { color: var(--bad); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }

.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 11px; font-size: 13.5px; cursor: pointer; color: var(--ink); }
.chip:hover { border-color: var(--accent); text-decoration: none; }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chip .mono { font-size: 12.5px; }

.status { display: inline-flex; align-items: center; gap: 5px; font: 600 11.5px var(--f-mono); text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status--verified, .status--high, .status--ready, .status--collected { color: var(--ok); background: var(--ok-soft); }
.status--sample, .status--medium, .status--needs-fix { color: var(--warn); background: var(--warn-soft); }
.status--low, .status--reject, .status--none, .status--not-collected { color: var(--bad); background: var(--bad-soft); }
.status--reference, .status--ai { color: var(--ref); background: var(--ref-soft); }
.status--catalog { color: var(--accent); background: var(--accent-soft); }

/* Size stamp: the size reads like the raised lettering cast on a fitting */
.stamp { display: inline-grid; place-items: center; min-width: 52px; padding: 4px 8px; border: 2px solid var(--ink); border-radius: 4px; font: 700 17px/1 var(--f-mono); letter-spacing: -.02em; color: var(--ink); background: var(--surface); white-space: nowrap; }
.stamp small { font-size: 11px; font-weight: 500; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label, .label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.input, select.input, textarea.input { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 9px 11px; width: 100%; min-width: 0; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: vertical; min-height: 90px; }

/* Hero search on the dashboard */
.hero { background: var(--rail); color: var(--rail-ink); border-radius: calc(var(--r) * 2); padding: clamp(22px, 4vw, 40px); display: flex; flex-direction: column; gap: 18px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -60px; bottom: -80px; width: 320px; height: 320px; border-radius: 50%; border: 34px solid rgba(95, 156, 240, .12); pointer-events: none; }
.hero h1 { color: #fff; font-size: clamp(32px, 5vw, 48px); max-width: 18ch; }
.hero p { color: var(--rail-muted); max-width: 60ch; font-size: 16px; }
.hero-search { display: flex; gap: 8px; background: #fff; border-radius: var(--r); padding: 6px; max-width: 760px; position: relative; z-index: 1; }
.hero-search input { flex: 1; min-width: 0; border: 0; outline: none; padding: 10px 12px; font: 500 18px var(--f-mono); color: #142230; background: transparent; }
.hero-search .btn--primary { background: #1d5fb8; border-color: #1d5fb8; color: #fff; }
.hero .chip { background: transparent; color: var(--rail-ink); border-color: rgba(220, 231, 243, .3); }
.hero .chip:hover { border-color: var(--rail-ink); }
.hero .row { position: relative; z-index: 1; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font: 600 28px/1.1 var(--f-display); font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
a.stat:hover { border-color: var(--accent); text-decoration: none; }
a.stat { color: inherit; }

/* Results */
.result-group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.result-group__head { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
.result-group__head h3 { flex: 1; min-width: 0; }
.result-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--ink); }
.result-row:first-of-type { border-top: 0; }
.result-row:hover { background: var(--surface-2); text-decoration: none; }
.result-row__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.result-row__main strong { font-weight: 600; }
.result-row__meta { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.art { width: 56px; height: 56px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; color: var(--accent); flex: none; }
.art svg { width: 70%; height: 70%; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.art.art--lg { width: 100%; height: auto; aspect-ratio: 4 / 3; max-width: 100%; }
.art.art--lg svg { width: 55%; height: 55%; stroke-width: 1.6; }
.art img { width: 100%; height: 100%; object-fit: contain; }

.understood { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); }
.understood .tag { font: 600 13px var(--f-mono); color: var(--ink); background: var(--surface); border: 1px solid var(--line); padding: 2px 8px; border-radius: 4px; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--warn-soft); color: var(--ink); font-size: 14px; border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.notice--info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.notice--bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.notice b { font-weight: 600; }
.empty { padding: 28px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 10px; align-items: center; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.filters .field { width: auto; min-width: 150px; }

/* Product page */
.product-top { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 24px; align-items: start; }
.product-title { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.product-title .mfr { font-family: var(--f-display); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-size: 15px; font-weight: 600; }
.idline { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 14px; }
.idline span { display: inline-flex; gap: 6px; }
.idline b { font: 600 14px var(--f-mono); }

.spec { width: 100%; border-collapse: collapse; font-size: 14px; }
.spec th, .spec td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.spec th { width: 38%; color: var(--muted); font-weight: 500; }
.spec td { font-family: var(--f-mono); font-size: 13.5px; overflow-wrap: anywhere; }
.spec tr:last-child th, .spec tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font: 600 12px var(--f-display); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }

.score { display: inline-flex; align-items: center; gap: 8px; font: 600 13px var(--f-mono); white-space: nowrap; }
.score__bar { width: 54px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.score__bar i { display: block; height: 100%; background: var(--ok); }
.diff { color: var(--warn); font-size: 13px; }
.match { color: var(--muted); font-size: 13px; }

.mini-list { display: flex; flex-direction: column; }
.mini { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); color: var(--ink); font-size: 14px; }
.mini:first-child { border-top: 0; }
.mini:hover { text-decoration: none; color: var(--accent); }
.mini .art { width: 36px; height: 36px; }
.mini span { min-width: 0; }

/* Brain */
.chat { display: flex; flex-direction: column; gap: 18px; }
.msg { display: flex; flex-direction: column; gap: 10px; max-width: 860px; }
.msg--user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); padding: 10px 14px; border-radius: 12px 12px 2px 12px; max-width: min(620px, 90%); }
.msg--bot { background: var(--surface); border: 1px solid var(--line); border-radius: 2px 12px 12px 12px; padding: 16px; }
.msg--bot .confidence { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }
.glossary { border-left: 3px solid var(--ref); padding: 4px 0 4px 12px; display: flex; flex-direction: column; gap: 4px; }
.glossary b { font-family: var(--f-display); font-size: 17px; font-weight: 600; }
.ai-text { display: flex; flex-direction: column; gap: 10px; line-height: 1.55; }
.ai-text p { margin: 0; }
.ai-list { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 4px; }
.ai-text .cite { display: inline-block; font: 600 12px var(--f-mono); padding: 1px 7px; border-radius: 4px; background: var(--accent-soft); white-space: nowrap; vertical-align: 1px; }
.thinking { margin: 0; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .thinking { animation: none; } }
.composer { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(to top, var(--bg) 70%, transparent); }
.composer input { flex: 1; min-width: 0; }

/* Import / review */
.drop { border: 2px dashed var(--line); border-radius: var(--r); padding: 28px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; background: var(--surface-2); cursor: pointer; }
.drop.is-over, .drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.drop svg { width: 34px; height: 34px; fill: none; stroke: var(--accent); stroke-width: 1.7; }
.progress { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.issues { margin: 0; padding-left: 18px; font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
.issues .bad { color: var(--bad); }
.issues .warn { color: var(--warn); }
.raw { font: 12px/1.45 var(--f-mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; color: var(--muted); overflow-wrap: anywhere; max-height: 7.5em; overflow-y: auto; }
.review-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; }
.review-card .edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); gap: 10px; }
.review-card .edit .field--wide { grid-column: 1 / -1; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tab { border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab .mono { font-size: 12px; margin-left: 4px; }

.city-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); align-items: center; color: var(--ink); }
.city-row:hover { background: var(--surface-2); text-decoration: none; }
.list-plain { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { font: 500 12.5px var(--f-mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 2px 8px; }

.phase { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.phase:first-child { border-top: 0; }
.phase__n { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--line); font: 600 14px var(--f-mono); }
.phase--done .phase__n { border-color: var(--ok); color: var(--ok); }
.phase--now .phase__n { border-color: var(--accent); color: var(--accent); }

.toasts { position: fixed; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 50; max-width: calc(100vw - 36px); }
.toast { background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: var(--r); box-shadow: var(--shadow); font-size: 14px; max-width: 380px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; z-index: 30; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-105%); transition: transform .2s; padding-top: calc(18px + env(safe-area-inset-top, 0px)); }
  .rail.is-open { transform: none; }
  .menu-btn { display: grid; }
  .topsearch kbd { display: none; }
  .product-top, .review-card { grid-template-columns: minmax(0, 1fr); }
  .product-top .art.art--lg { max-width: 220px; }
}
@media (max-width: 520px) {
  .result-row { grid-template-columns: 44px minmax(0, 1fr); }
  .result-row > :last-child { grid-column: 2; }
  .art { width: 44px; height: 44px; }
  .hero-search input { font-size: 16px; }
  .page { padding-top: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Quote Builder and accounts ------------------------------------------------------------------ */
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
.form-grid .span-2 { grid-column: 1 / -1; }
.input--sm { padding: 5px 8px; font-size: 13.5px; }
.btn--sm { padding: 5px 10px; font-size: 13px; }
.icon-btn--sm { display: inline-grid; width: 28px; height: 28px; font-size: 13px; color: var(--ink); }
.icon-btn[disabled] { opacity: .35; cursor: default; }
.rail__who { color: inherit; line-height: 1.45; }
.rail__who:hover { text-decoration: none; color: var(--rail-ink); }
.add-results { display: flex; flex-direction: column; max-height: 360px; overflow-y: auto; }
.add-results:empty { display: none; }
.add-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 68px auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.add-row:first-child { border-top: 0; }
.add-row .art { width: 40px; height: 40px; }
.quote-lines td { vertical-align: middle; }
.quote-lines td:nth-child(2) { width: 84px; }
.quote-lines td:nth-child(3) { width: 74px; }
.quote-lines [data-f="cost"], .quote-lines [data-f="price"] { width: 100px; }
.quote-lines [data-f="margin"] { width: 74px; }
.quote-item { min-width: 260px; display: flex; flex-direction: column; gap: 5px; }
.quote-item a strong { color: var(--ink); }
.quote-item select { max-width: 420px; color: var(--muted); }
.inline-size { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.inline-size input { width: 80px; }
.line-flags { display: flex; flex-wrap: wrap; gap: 4px; }
.flag { font-size: 12px; padding: 1px 7px; border-radius: 4px; }
.flag--warn { color: var(--warn); background: var(--warn-soft); }
.flag--bad { color: var(--bad); background: var(--bad-soft); }
.totals-table th { width: 55%; }
.totals-table .grand th, .totals-table .grand td { font-weight: 600; font-size: 16px; color: var(--ink); border-top: 2px solid var(--ink); }
.add-to-quote { padding-top: 2px; }
@media (max-width: 520px) {
  .add-row { grid-template-columns: minmax(0, 1fr) 64px auto; }
  .add-row .art { display: none; }
}

/* Printed quote: hidden on screen, the only thing on paper. */
.quote-print { display: none; }
@media print {
  @page { margin: 14mm; }
  body { background: #fff; color: #000; }
  .rail, .topbar, .scrim, .toasts, .no-print, .notif-panel { display: none !important; }
  .shell, .main, .page { display: block; padding: 0; margin: 0; max-width: none; }
  .quote-print { display: block; font: 11pt/1.4 var(--f-body, "IBM Plex Sans", sans-serif); color: #000; }
  .qp-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #000; padding-bottom: 10px; margin-bottom: 14px; }
  .qp-head h1 { font: 700 22pt/1.1 "Barlow Condensed", sans-serif; margin: 0 0 4px; }
  .qp-meta { text-align: right; }
  .qp-meta h2 { font: 700 16pt/1 "Barlow Condensed", sans-serif; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 6px; }
  .qp-to { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
  .qp-to .label { display: block; font-size: 8.5pt; text-transform: uppercase; letter-spacing: .08em; color: #555; }
  .qp-lines { width: 100%; border-collapse: collapse; font-size: 10pt; }
  .qp-lines th { text-align: left; border-bottom: 1.5px solid #000; padding: 5px 6px; font-size: 8.5pt; text-transform: uppercase; letter-spacing: .06em; }
  .qp-lines td { border-bottom: 1px solid #ccc; padding: 5px 6px; vertical-align: top; }
  .qp-lines td:nth-last-child(-n+2), .qp-lines th:nth-last-child(-n+2) { text-align: right; white-space: nowrap; }
  .qp-lines tr { break-inside: avoid; }
  .qp-totals { margin: 10px 0 14px auto; border-collapse: collapse; min-width: 240px; }
  .qp-totals th { text-align: left; padding: 3px 10px 3px 0; font-weight: 500; }
  .qp-totals td { text-align: right; padding: 3px 0; }
  .qp-totals .grand th, .qp-totals .grand td { border-top: 2px solid #000; font-weight: 700; padding-top: 6px; }
}
.page-head > .page-actions { flex-direction: row; flex-wrap: wrap; align-items: center; max-width: none; }
.quote-lines [data-f="unit"] { width: 66px; }
.rail__links { line-height: 1.6; }
.rail__links a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.rail__links a:hover { color: var(--rail-ink); }
.report { display: flex; justify-content: space-between; gap: 16px; padding: 14px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.report:first-child { border-top: 0; }
.legal { max-width: 78ch; line-height: 1.6; }
.legal h3 { margin-top: 6px; }
.legal .list-plain li { margin-bottom: 8px; }
@media print { .qp-fine { margin-top: 18px; color: #444; font-size: 8.5pt; } }
.thread-row { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--ink); }
.thread-row:first-child { border-top: 0; }
.thread-row:hover { background: var(--surface-2); text-decoration: none; }
.thread-row__who, .thread-row__main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.thread-row__preview { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-row.is-unread { box-shadow: inset 3px 0 0 var(--accent); }
.thread-row.is-unread .thread-row__preview { color: var(--ink); font-weight: 500; }
.messages { display: flex; flex-direction: column; gap: 12px; }
.msg-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; max-width: 920px; }
.msg-card--mine { margin-left: auto; border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.msg-card__text { white-space: pre-wrap; margin: 0; }
.attach { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.attach__head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
.table--compact td, .table--compact th { padding: 6px 10px; }
.file-drop { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 14px; border: 1px dashed var(--line); border-radius: var(--r); background: var(--surface); }
.file-drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.file-drop.is-busy { opacity: .6; pointer-events: none; }
.file-drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.file-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.file-list li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.file-list__name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.check-list { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow-y: auto; padding: 4px 0; }
fieldset.field { border: 0; padding: 0; margin: 0; }
@media (max-width: 700px) {
  .thread-row { grid-template-columns: minmax(0, 1fr) auto; }
  .thread-row__who { grid-column: 1 / -1; }
}

/* Plans and billing */
.plans { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.plan { border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); min-width: 0; }
.plan.is-current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.plan__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.plan__head h3 { margin: 0; font-family: var(--f-display); font-size: 22px; font-weight: 600; }
.plan__price { margin: 0; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.plan__price b { font-family: var(--f-display); font-size: 30px; font-weight: 700; line-height: 1; }
.plan__price span { color: var(--muted); font-size: 13px; }
.plan__price--login b { font-size: 20px; }
.plan__list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.plan__logins { margin: 0; font: 600 12.5px var(--f-mono); text-transform: uppercase; letter-spacing: .04em; color: var(--accent); }
.plan.is-too-small { opacity: .6; }
.plan__example { margin: auto 0 0; padding-top: 8px; border-top: 1px solid var(--line); }
#newCo .plan { cursor: pointer; }
.plan__pick { display: flex; gap: 8px; align-items: center; font-weight: 600; cursor: pointer; }
.billing-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
