/* MVE Project Hub
   Colors sampled from the Magic Valley Electric logo. Page titles are set as
   engraved panel nameplates, the one decorative element; everything else
   stays plain so the boards and tools do the talking. */

@font-face { font-family: "Barlow"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 400; font-style: italic; font-display: swap; src: url("../fonts/barlow-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/barlow-condensed-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/barlow-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/barlow-condensed-latin-700-normal.woff2") format("woff2"); }

:root {
  --ink: #01000E;          /* "ELECTRIC" lettering */
  --blue: #00529B;         /* "MAGIC" lettering, bolt shadow */
  --blue-dark: #003F78;
  --blue-tint: #E3EEF8;
  --sky: #018CD1;          /* "VALLEY" plate */
  --bolt: #37C1F2;         /* bolt highlight: focus rings only */
  --silver: #878A8F;       /* plate outline */
  --silver-light: #D9DBD8; /* "MAGIC" plate */

  --bg: #ECEEED;
  --surface: #FFFFFF;
  --surface-sunk: #F5F6F5;
  --line: #D3D6D4;
  --line-strong: #9A9EA3;
  --text: var(--ink);
  --muted: #50555B;

  --danger: #B42318; --danger-tint: #FDECEA;
  --warn: #7A4A00;   --warn-tint: #FFF2D6;
  --ok: #1D6631;     --ok-tint: #E5F3E8;

  --font-ui: "Barlow", "Segoe UI", system-ui, sans-serif;
  --font-display: "Barlow Condensed", "Barlow", "Arial Narrow", sans-serif;

  --r-control: 3px;
  --r-panel: 6px;
  --sidebar-w: 15.5rem;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 1rem/1.5 var(--font-ui);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--blue); text-underline-offset: .15em; }
a:hover { color: var(--blue-dark); }
h1, h2, h3 { margin: 0; line-height: 1.15; }
p { margin: 0 0 .75rem; }
p:last-child { margin-bottom: 0; }
:focus-visible { outline: 2px solid var(--bolt); outline-offset: 2px; }
::selection { background: #BEE7FB; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 1rem; top: -3rem; z-index: 100; padding: .5rem 1rem; background: var(--ink); color: #fff; border-radius: var(--r-control); }
.skip-link:focus { top: 1rem; color: #fff; }
.muted { color: var(--muted); }

/* --- Nameplate -------------------------------------------------------------- */
.plate {
  display: inline-flex;
  align-items: center;
  gap: .65em;
  margin: 0;
  padding: .28em .8em .3em;
  background: var(--ink);
  color: #F2F4F3;
  font: 600 1.4rem/1.1 var(--font-display);
  letter-spacing: .03em;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.plate::before, .plate::after {
  content: "";
  flex: none;
  width: .36em;
  height: .36em;
  border-radius: 50%;
  background:
    linear-gradient(135deg, transparent 43%, rgba(10, 12, 16, .85) 43% 57%, transparent 57%),
    radial-gradient(circle at 35% 30%, #D6DADE 0 15%, #80868D 55%, #3A3F45 100%);
}
.plate-lg { font-size: 2rem; letter-spacing: .07em; text-transform: uppercase; padding: .3em .85em; }

/* --- App shell -------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.brand { display: block; padding: 1.1rem 1.1rem .9rem; text-decoration: none; border-bottom: 1px solid var(--line); }
.brand img { display: block; width: 100%; max-width: 12.5rem; }
.brand-name { display: block; margin-top: .45rem; font: 600 1.1rem/1 var(--font-display); letter-spacing: .04em; color: var(--blue); }

.nav { padding: .6rem .6rem 1rem; }
.nav-group { margin: 1rem .6rem .25rem; font: 600 .95rem/1.2 var(--font-display); letter-spacing: .02em; color: var(--muted); }
.nav-link {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .36rem .6rem;
  border-radius: var(--r-control);
  color: var(--text);
  font-weight: 500;
  font-size: .95rem;
  text-decoration: none;
}
.nav-link:hover { background: var(--surface-sunk); color: var(--text); }
.nav-link.is-current { background: var(--blue-tint); color: var(--blue); box-shadow: inset 3px 0 0 var(--blue); }
.nav-soon { margin-left: auto; padding: 0 .4rem; font-size: .72rem; font-weight: 500; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; }
.sidebar-foot { margin: auto 0 0; padding: .75rem 1.2rem; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--line); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 2rem .9rem; }
.topbar-title { flex: 1; min-width: 0; }
.content { flex: 1; width: 100%; max-width: 76rem; padding: .5rem 2rem 3rem; }
.content:focus { outline: none; }

.nav-toggle { display: none; width: 2.5rem; height: 2.5rem; border: 1px solid var(--line-strong); border-radius: var(--r-control); background: var(--surface); cursor: pointer; }
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after { display: block; width: 1.1rem; height: 2px; margin: auto; background: var(--ink); position: relative; content: ""; }
.nav-toggle-bars::before { position: absolute; top: -6px; }
.nav-toggle-bars::after { position: absolute; top: 6px; }
.scrim { position: fixed; inset: 0; z-index: 39; background: rgba(1, 0, 14, .35); }

/* Account menu */
.account { position: relative; }
.account summary {
  display: flex; align-items: center; gap: .5rem;
  padding: .4rem .75rem;
  list-style: none; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-control);
  font-weight: 600;
}
.account summary::-webkit-details-marker { display: none; }
.account-dept { font-weight: 500; color: var(--muted); padding-left: .5rem; border-left: 1px solid var(--line); }
.account-menu {
  position: absolute; right: 0; top: calc(100% + .35rem); z-index: 30;
  min-width: 12rem; padding: .35rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel);
  box-shadow: 0 10px 28px rgba(1, 0, 14, .14);
}
.account-menu a, .account-menu button {
  display: block; width: 100%; padding: .45rem .65rem;
  text-align: left; font: inherit; font-weight: 500; color: var(--text); text-decoration: none;
  background: none; border: 0; border-radius: var(--r-control); cursor: pointer;
}
.account-menu a:hover, .account-menu button:hover { background: var(--surface-sunk); }
.account-menu form { margin: 0; }

/* --- Feedback --------------------------------------------------------------- */
.flashes { display: grid; gap: .5rem; padding: 0 2rem; margin-bottom: 1.25rem; max-width: 76rem; }
.flashes-inline { padding: 0; margin-bottom: 1rem; text-align: left; }
.flash, .form-error, .callout { margin: 0; padding: .65rem .9rem; border-radius: var(--r-control); border-left: 4px solid; }
.flash-success { background: var(--ok-tint); border-color: var(--ok); }
.flash-info, .callout { background: var(--blue-tint); border-color: var(--blue); }
.flash-error, .form-error { background: var(--danger-tint); border-color: var(--danger); }
.form-error { margin-bottom: .75rem; }
.callout { margin-bottom: 1rem; }

/* --- Panels ----------------------------------------------------------------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 1.25rem 1.5rem 1.5rem; }
.panel-narrow { max-width: 34rem; }
.panel-title { font: 600 1.3rem/1.2 var(--font-display); letter-spacing: .01em; margin-bottom: .75rem; }
.panel-danger { border-color: #E9B4AE; }
.lede { font-size: 1.15rem; }
.section-title { font: 600 1.5rem/1.2 var(--font-display); letter-spacing: .01em; margin: 2.25rem 0 1rem; }
.breadcrumb { margin-bottom: 1rem; font-weight: 500; }
.breadcrumb a::before { content: "‹ "; }
.stack { display: grid; gap: 1rem; align-content: start; }
.form-columns { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.5rem; align-items: start; }

/* --- Forms ------------------------------------------------------------------ */
.field { display: grid; gap: .3rem; }
.field-label { font-weight: 600; font-size: .92rem; }
.field-hint { display: block; font-size: .85rem; color: var(--muted); font-weight: 400; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%; min-height: 2.6rem; padding: .45rem .75rem;
  font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-control);
}
textarea { min-height: 6rem; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--bolt); outline-offset: 0; border-color: var(--sky); }
input:disabled, select:disabled { background: var(--surface-sunk); color: var(--muted); }
input[type="checkbox"] { width: 1.15rem; height: 1.15rem; accent-color: var(--blue); }
.check { display: flex; gap: .65rem; align-items: flex-start; font-weight: 600; }
.check input { margin-top: .2rem; }

.actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: .25rem; }
.actions-sticky { position: sticky; bottom: 0; padding: .9rem 0; background: linear-gradient(to top, var(--bg) 70%, transparent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 2.5rem; padding: .4rem 1.05rem;
  font: 600 .95rem/1.2 var(--font-ui); text-decoration: none; white-space: nowrap;
  border: 1px solid transparent; border-radius: var(--r-control); cursor: pointer;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); color: #fff; }
.btn-quiet { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn-quiet:hover { background: var(--surface-sunk); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #8F1C13; color: #fff; }
.btn-block { width: 100%; }

/* --- Tables ----------------------------------------------------------------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.toolbar-note { margin: 0 0 1rem; color: var(--muted); }
.toolbar .toolbar-note { margin: 0; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { padding: .6rem 1rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child > * { border-bottom: 0; }
.table thead th { font-size: .85rem; font-weight: 600; color: var(--muted); background: var(--surface-sunk); }
.table tbody th { font-weight: 600; }
.table tr.is-muted { color: var(--muted); }
.table-matrix td { text-align: center; }
.table-matrix thead th:not(:first-child) { text-align: center; }
.th-sub { display: block; font-weight: 400; font-size: .8rem; }
.row-group th { padding-top: 1rem; font: 600 1rem/1.2 var(--font-display); letter-spacing: .02em; color: var(--blue); background: var(--surface); }
.tag { display: inline-block; margin-left: .35rem; padding: 0 .4rem; font-size: .75rem; font-weight: 600; color: var(--blue); background: var(--blue-tint); border-radius: var(--r-control); }
.status { display: inline-flex; align-items: center; gap: .4rem; font-size: .9rem; }
.status::before { content: ""; width: .55rem; height: .55rem; border-radius: 50%; background: currentColor; }
.status-ok { color: var(--ok); }
.status-warn { color: var(--warn); }
.status-off { color: var(--muted); }

/* --- Home ------------------------------------------------------------------- */
.home-boards { display: grid; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); gap: 1rem; }
/* Board links are drawn like a whiteboard: aluminium frame and marker tray. */
.board-link {
  display: grid; grid-template-columns: 1fr auto; align-content: start; gap: .35rem 1rem;
  padding: 1.25rem 1.5rem 1.4rem;
  color: var(--text); text-decoration: none;
  background: var(--surface);
  border: 2px solid #C3C7CA;
  border-bottom: 8px solid #B9BDC1;
  border-radius: 4px;
}
.board-link:hover { color: var(--text); border-color: var(--sky); border-bottom-color: #9FB9CC; }
.board-link-name { font: 600 1.75rem/1.1 var(--font-display); letter-spacing: .01em; color: var(--blue); }
.board-link-dept { align-self: center; padding: .15rem .55rem; font-weight: 600; font-size: .85rem; color: var(--ink); background: var(--silver-light); border-radius: var(--r-control); }
.board-link-summary { grid-column: 1 / -1; color: var(--muted); }

.directory-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1.75rem 2.5rem; }
.directory-group h3 { padding-bottom: .4rem; margin-bottom: .25rem; font: 600 1.1rem/1.2 var(--font-display); letter-spacing: .02em; color: var(--muted); border-bottom: 1px solid var(--line-strong); }
.directory-group ul { margin: 0; padding: 0; list-style: none; }
.directory-group li { padding: .5rem 0; border-bottom: 1px solid var(--line); }
.directory-group a { font-weight: 600; text-decoration: none; }
.directory-group a:hover { text-decoration: underline; }
.directory-group li span { display: block; font-size: .9rem; color: var(--muted); }

/* --- Sign-in ---------------------------------------------------------------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; }
.auth-panel { width: min(25rem, 100%); padding: 2rem 2rem 1.75rem; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.auth-logo { display: block; width: 15rem; margin: 0 auto 1.25rem; }
.auth-panel .plate { margin-bottom: 1.75rem; }
.auth-panel form { text-align: left; }
.auth-help { margin-top: 1.25rem; font-size: .88rem; color: var(--muted); }
.error-code { font: 600 1rem var(--font-display); color: var(--muted); letter-spacing: .03em; }

/* --- Small screens ---------------------------------------------------------- */
@media (max-width: 60rem) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; width: min(var(--sidebar-w), 85vw); transform: translateX(-100%); transition: transform .2s ease; }
  .nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(1, 0, 14, .25); }
  .nav-toggle { display: grid; place-items: center; flex: none; }
  .topbar { padding: .9rem 1rem .75rem; gap: .75rem; }
  .content { padding: .5rem 1rem 2.5rem; }
  .flashes { padding: 0 1rem; }
  .plate { font-size: 1.15rem; }
  .account-dept { display: none; }
  .home-boards, .form-columns { grid-template-columns: 1fr; }
}
@media (max-width: 30rem) {
  .field-row { grid-template-columns: 1fr; }
  .plate::before, .plate::after { display: none; }
}
/* Animations follow each person's Preferences: on, off, or match the device. */
html[data-motion="off"] *, html[data-motion="off"] *::before, html[data-motion="off"] *::after { transition: none !important; animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  html[data-motion="system"] *, html[data-motion="system"] *::before, html[data-motion="system"] *::after { transition: none !important; animation: none !important; }
}

/* =============================================================================
   Whiteboards
   ========================================================================== */

/* Row colors: a tint for the row and a stronger stripe down its left edge. */
.color-white  { --tint: #FFFFFF; --stripe: transparent; }
.color-red    { --tint: #FCE9E7; --stripe: #D64535; }
.color-orange { --tint: #FDEEDD; --stripe: #E07B1F; }
.color-yellow { --tint: #FBF4CF; --stripe: #CFA713; }
.color-green  { --tint: #E3F2E5; --stripe: #3C9450; }
.color-blue   { --tint: #E2EFF9; --stripe: #018CD1; }
.color-purple { --tint: #EFE8F8; --stripe: #7C55B8; }
.color-gray   { --tint: #EEEFEF; --stripe: #878A8F; }
.note-yellow  { --note: #FFF0A3; }
.note-blue    { --note: #CDE6F8; }
.note-green   { --note: #D2EFD1; }
.note-pink    { --note: #F9D6E5; }

.content-wide { max-width: none; }
.title-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.title-chip { padding: .2rem .6rem; font-weight: 600; background: var(--silver-light); border-radius: var(--r-control); }

.board-layout.has-chat { display: grid; grid-template-columns: minmax(0, 1fr) 21rem; gap: 1.5rem; align-items: start; }
.board-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.board-toolbar-end { margin-left: auto; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.dept-switch { margin: 0; }
.dept-switch select { width: auto; min-height: 2.5rem; }
.sync-status { font-size: .9rem; color: var(--muted); }
.sync-status[data-kind="error"] { color: var(--danger); font-weight: 600; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 2rem 0 .75rem; }
.section-head .section-title { margin: 0; }
.empty { margin: 0; padding: 1.25rem; color: var(--muted); }

/* --- Rows ------------------------------------------------------------------ */
.rows { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; }
.rows-head, .row {
  display: grid;
  grid-template-columns: 2rem minmax(10rem, 1.25fr) minmax(8.5rem, .8fr) minmax(12rem, 2.3fr) auto;
  gap: .4rem;
  align-items: start;
  padding: .35rem .75rem .35rem .3rem;
}
.rows-head { font-size: .82rem; font-weight: 600; color: var(--muted); background: var(--surface-sunk); border-bottom: 1px solid var(--line); padding-top: .5rem; padding-bottom: .5rem; }
.rows-head span { padding-left: .55rem; }
.rows-list { margin: 0; padding: 0; list-style: none; }
.row { background: var(--tint); box-shadow: inset 5px 0 0 var(--stripe); border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row.is-dragging { position: relative; z-index: 2; box-shadow: inset 5px 0 0 var(--stripe), 0 8px 24px rgba(1, 0, 14, .18); }

.row-handle {
  width: 2rem; height: 2.3rem; display: grid; place-items: center;
  color: var(--line-strong); background: none; border: 0; border-radius: var(--r-control);
  cursor: grab; touch-action: none;
}
.row-handle svg { width: .6rem; fill: currentColor; }
.row-handle:hover { color: var(--ink); background: rgba(1, 0, 14, .05); }
.row.is-dragging .row-handle { cursor: grabbing; }

.cell {
  display: block; width: 100%; min-height: 2.3rem; margin: 0; padding: .4rem .55rem;
  font: inherit; line-height: 1.4; color: var(--text);
  background: transparent; border: 1px solid transparent; border-radius: var(--r-control);
  resize: none; overflow: hidden;
}
input.cell:not([type]) { min-height: 2.3rem; padding: .4rem .55rem; background: transparent; border-color: transparent; }
.cell:hover { border-color: var(--line); }
.cell:focus, input.cell:not([type]):focus { background: var(--surface); border-color: var(--sky); outline: 2px solid var(--bolt); outline-offset: 0; }
.cell::placeholder { color: #9A9EA3; }
.cell-title { font-weight: 600; }
.cell-notes { max-height: 9.6rem; overflow-y: auto; }
.cell-wrap-title { display: flex; align-items: center; gap: .25rem; }
.unread { flex: none; width: .6rem; height: .6rem; border-radius: 50%; background: #D64535; box-shadow: 0 0 0 2px var(--surface); }

/* Status: a colored tag with a caret; clicking opens the status menu. */
.st-queue     { --st-bg: #ECEDEC; --st-fg: #3F4349; --dot: #878A8F; }
.st-progress  { --st-bg: #DCEBF8; --st-fg: var(--blue); --dot: #018CD1; }
.st-attention { --st-bg: #FFEFC7; --st-fg: #7A4A00; --dot: #E0A100; }
.st-waiting   { --st-bg: #ECE4F8; --st-fg: #55348F; --dot: #7C55B8; }
.st-hold      { --st-bg: #FBE1DE; --st-fg: #A5281B; --dot: #D64535; }
.st-done      { --st-bg: #DCF0E0; --st-fg: #1D6631; --dot: #3C9450; }
.st-other     { --st-bg: rgba(1, 0, 14, .06); --st-fg: var(--text); --dot: #50555B; }
.status-pill {
  display: inline-flex; align-items: center; gap: .45rem; max-width: 100%;
  min-height: 2rem; margin-top: .15rem; padding: .25rem .7rem .25rem .8rem;
  font: 600 .9rem/1.2 var(--font-ui); text-align: left;
  color: var(--st-fg); background: var(--st-bg);
  border: 1px solid transparent; border-radius: 999px; cursor: pointer;
}
.status-pill::after { content: ""; flex: none; margin-top: .2rem; border: .28rem solid transparent; border-top-color: currentColor; opacity: .65; }
.status-pill:hover { border-color: rgba(1, 0, 14, .25); }
.status-pill.is-empty { color: var(--muted); font-weight: 500; background: transparent; border: 1px dashed var(--line-strong); }
.status-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.status-menu {
  position: absolute; z-index: 70; width: 16.5rem; padding: .35rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel);
  box-shadow: 0 12px 30px rgba(1, 0, 14, .18);
}
.status-option {
  display: flex; align-items: center; gap: .6rem; width: 100%; padding: .45rem .6rem;
  font: 500 .95rem var(--font-ui); color: var(--text); text-align: left;
  background: none; border: 0; border-radius: var(--r-control); cursor: pointer;
}
.status-option:hover, .status-option:focus-visible { background: var(--surface-sunk); }
.status-option[aria-checked="true"] { font-weight: 700; }
.status-option[aria-checked="true"]::after { content: "✓"; margin-left: auto; color: var(--blue); }
.status-dot { flex: none; width: .7rem; height: .7rem; border-radius: 50%; background: var(--dot); }
.status-custom { display: flex; gap: .4rem; margin: .35rem 0 0; padding: .5rem .25rem .25rem; border-top: 1px solid var(--line); }
.status-custom input { min-height: 2.25rem !important; }
.status-custom .btn { min-height: 2.25rem; }
.status-clear { display: block; margin: .3rem .35rem .25rem; }

/* Saved: a short green ring around whatever just saved. */
@keyframes saved-ring {
  0%, 55% { box-shadow: 0 0 0 2px rgba(47, 162, 74, .95); }
  100% { box-shadow: 0 0 0 2px rgba(47, 162, 74, 0); }
}
.is-saved { animation: saved-ring 1.5s ease-out; }
.swatches.is-saved { border-radius: 999px; }
html[data-motion="off"] .is-saved { box-shadow: 0 0 0 2px rgba(47, 162, 74, .95); }
@media (prefers-reduced-motion: reduce) { html[data-motion="system"] .is-saved { box-shadow: 0 0 0 2px rgba(47, 162, 74, .95); } }

.row-actions { display: flex; align-items: center; gap: .3rem; padding-top: .15rem; }
.row-open {
  min-height: 2rem; padding: .25rem .65rem;
  font: 600 .88rem/1 var(--font-ui); color: var(--text);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-control); cursor: pointer;
}
.row-open:hover { border-color: var(--blue); color: var(--blue); }
.row-count { font-weight: 500; color: var(--muted); }
.swatch {
  flex: none; width: 1.5rem; height: 1.5rem; padding: 0;
  background: var(--tint); border: 2px solid var(--stripe); border-radius: 50%; cursor: pointer;
}
.swatch.color-white, .row.color-white .row-swatch { border-color: var(--line-strong); }
.swatch[class*="note-"], .note-swatch { background: var(--note); border-color: rgba(1, 0, 14, .28); }
.swatch.is-selected { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--blue); }
.swatches { display: flex; flex-wrap: wrap; gap: .45rem; }
.icon-btn {
  flex: none; width: 2rem; height: 2rem; display: grid; place-items: center; padding: 0;
  font-size: 1.25rem; line-height: 1; color: var(--muted);
  background: none; border: 0; border-radius: var(--r-control); cursor: pointer;
}
.icon-btn svg { width: 1.15rem; height: 1.15rem; }
.icon-btn:hover { color: var(--danger); background: rgba(1, 0, 14, .06); }

.color-popover {
  position: absolute; z-index: 60; padding: .6rem; max-width: 13rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel);
  box-shadow: 0 10px 28px rgba(1, 0, 14, .16);
}

/* --- Sticky notes: drawn on a whiteboard with a frame and marker tray ------ */
.notes-board {
  position: relative; overflow: auto; min-height: 20rem;
  background-color: #FBFCFC;
  background-image: linear-gradient(#ECEFEE 1px, transparent 1px), linear-gradient(90deg, #ECEFEE 1px, transparent 1px);
  background-size: 24px 24px;
  border: 2px solid #C3C7CA; border-bottom: 8px solid #B9BDC1; border-radius: 4px;
}
.note {
  position: absolute; left: 0; top: 0;
  display: flex; flex-direction: column;
  min-width: 120px; min-height: 100px; overflow: hidden; resize: both;
  background: var(--note);
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(1, 0, 14, .14), 0 4px 12px rgba(1, 0, 14, .08);
}
.note.is-dragging { z-index: 5; box-shadow: 0 2px 4px rgba(1, 0, 14, .14), 0 14px 30px rgba(1, 0, 14, .2); }
.note-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: .25rem .3rem; background: rgba(1, 0, 14, .05); cursor: grab; touch-action: none;
}
.note.is-dragging .note-bar { cursor: grabbing; }
.note-bar .swatch { width: 1.15rem; height: 1.15rem; }
.note-bar .icon-btn { width: 1.6rem; height: 1.6rem; }
.note-text {
  flex: 1; width: 100%; min-height: 0 !important; margin: 0; padding: .45rem .65rem .75rem;
  font: inherit; line-height: 1.4; color: var(--ink);
  background: transparent; border: 0; border-radius: 0; resize: none;
}
.note-text:focus-visible { outline: 2px solid var(--bolt); outline-offset: -2px; }

/* --- Chat ------------------------------------------------------------------- */
.chat {
  position: sticky; top: 1rem;
  display: flex; flex-direction: column;
  height: min(calc(100vh - 2rem), 52rem);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel);
}
.chat-head { position: relative; display: flex; justify-content: space-between; align-items: center; padding: .8rem 1rem .2rem; }
.chat-head h2 { font: 600 1.35rem/1.2 var(--font-display); letter-spacing: .01em; }
.chat-settings summary { list-style: none; cursor: pointer; font-size: .88rem; font-weight: 600; color: var(--blue); padding: .2rem .4rem; border-radius: var(--r-control); }
.chat-settings summary::-webkit-details-marker { display: none; }
.chat-settings-menu {
  position: absolute; right: .75rem; top: 2.6rem; z-index: 20; width: 15rem;
  display: grid; gap: .6rem; padding: .85rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel);
  box-shadow: 0 10px 28px rgba(1, 0, 14, .14);
}
.online { display: flex; align-items: center; gap: .45rem; margin: 0; padding: 0 1rem .65rem; font-size: .85rem; color: var(--muted); border-bottom: 1px solid var(--line); }
.online-dot { flex: none; width: .5rem; height: .5rem; border-radius: 50%; background: #2FA24A; }
.chat-log { flex: 1; overflow-y: auto; margin: 0; padding: .5rem .75rem 1rem; list-style: none; }
.msg { position: relative; margin-top: .6rem; padding: .35rem .6rem; background: var(--surface-sunk); border-radius: var(--r-panel); }
.msg.is-mine { background: var(--blue-tint); }
.msg.is-continued { margin-top: .2rem; }
.msg.is-continued .msg-meta { display: none; }
.msg-meta { margin: 0; font-size: .8rem; color: var(--muted); }
.msg-author { font-weight: 600; color: var(--text); }
.msg-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-body textarea { min-height: 3.5rem; }
.msg-actions { position: absolute; top: .25rem; right: .3rem; display: none; gap: .2rem; }
.msg:hover .msg-actions:not([hidden]), .msg:focus-within .msg-actions:not([hidden]) { display: flex; }
.msg.is-editing .msg-actions { display: none !important; }
.msg-actions button { padding: .1rem .4rem; font: 600 .75rem var(--font-ui); color: var(--blue); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-control); cursor: pointer; }
.msg-actions [hidden] { display: none; }
@media (hover: none) { .msg-actions:not([hidden]) { position: static; display: flex; margin-top: .3rem; } }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: end; padding: .75rem; border-top: 1px solid var(--line); }
.chat-form textarea { min-height: 2.6rem; resize: none; }

/* --- Row details dialog ---------------------------------------------------- */
.dialog {
  width: min(58rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); padding: 0;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-panel);
  box-shadow: 0 24px 64px rgba(1, 0, 14, .32);
}
.dialog[open] { display: flex; flex-direction: column; }
.dialog::backdrop { background: rgba(1, 0, 14, .45); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 0; padding: .9rem 1.25rem; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font: 600 1.45rem/1.2 var(--font-display); letter-spacing: .01em; overflow-wrap: anywhere; }
.dialog-close { flex: none; width: 2.25rem; height: 2.25rem; font-size: 1.6rem; line-height: 1; color: var(--muted); background: none; border: 0; border-radius: var(--r-control); cursor: pointer; }
.dialog-close:hover { background: var(--surface-sunk); color: var(--text); }
.dialog-body { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1.75rem; padding: 1.25rem; overflow: auto; }
.dialog-fields { display: grid; gap: 1rem; align-content: start; }
.dialog-fields textarea { min-height: 10rem; }
.comments h3 { margin-bottom: .6rem; font: 600 1.2rem/1.2 var(--font-display); letter-spacing: .01em; }
.comment-list { display: grid; gap: .55rem; max-height: 22rem; overflow-y: auto; margin: 0 0 .9rem; padding: 0; list-style: none; }
.comment { padding: .5rem .7rem; background: var(--surface-sunk); border-radius: 4px; }
.comment-empty { color: var(--muted); }
.comment-meta { margin: 0 0 .1rem; font-size: .82rem; color: var(--muted); }
.comment-meta strong { color: var(--text); }
.comment-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.link-btn { padding: 0; font: inherit; font-size: .82rem; color: var(--blue); text-decoration: underline; background: none; border: 0; cursor: pointer; }
.dialog-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .85rem 1.25rem; background: var(--surface-sunk); border-top: 1px solid var(--line); }
.dialog-foot form { margin: 0; }

/* --- Archive page ---------------------------------------------------------- */
.count-muted { margin-left: .35rem; font: 500 1rem var(--font-ui); color: var(--muted); }
.color-mark { display: inline-block; width: .7rem; height: .7rem; margin-right: .55rem; vertical-align: .05em; background: var(--stripe); border: 1px solid var(--line-strong); border-radius: 2px; }
.color-mark.color-white { background: var(--surface); }
.archive-table .archive-notes { max-width: 32rem; font-size: .9rem; color: var(--muted); }
.archive-actions { display: flex; justify-content: flex-end; gap: .35rem; }
.archive-actions form, .archived-note form { margin: 0; }
.btn-text-danger { min-height: 2.5rem; padding: .4rem .7rem; font: 600 .95rem var(--font-ui); color: var(--danger); background: none; border: 0; border-radius: var(--r-control); cursor: pointer; }
.btn-text-danger:hover { background: var(--danger-tint); }
.archive-notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 1rem; margin: 0; padding: 0; list-style: none; }
.archived-note { display: flex; flex-direction: column; justify-content: space-between; gap: .75rem; padding: .9rem 1rem; background: var(--note); border-radius: 2px; box-shadow: 0 1px 2px rgba(1, 0, 14, .14); }
.archived-note p { white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 75rem) {
  .board-layout.has-chat { grid-template-columns: 1fr; }
  .chat { position: static; height: 30rem; margin-top: 2rem; }
}
@media (max-width: 48rem) {
  .rows-head { display: none; }
  .row { grid-template-columns: 2rem minmax(0, 1fr); grid-template-areas: "handle title" ". status" ". notes" ". actions"; padding: .6rem .75rem .6rem .3rem; }
  .row-handle { grid-area: handle; }
  .row > .cell-wrap-title { grid-area: title; }
  .row > .cell-wrap:nth-of-type(2) { grid-area: status; }
  .row > .cell-wrap:nth-of-type(3) { grid-area: notes; }
  .row-actions { grid-area: actions; justify-content: flex-start; }
  .notes-board { display: grid; gap: .75rem; padding: .75rem; min-height: auto !important; }
  .note { position: static; transform: none !important; width: auto !important; height: auto !important; resize: none; }
  .note-bar { cursor: default; }
  .note-text { min-height: 7rem !important; field-sizing: content; }
  .dialog-body { grid-template-columns: 1fr; }
  .board-toolbar-end { margin-left: 0; }
}
.notes-section { margin-top: .5rem; }

/* --- People editor: access checkboxes ---------------------------------------- */
.access { display: grid; gap: 1rem; }
.access-group { margin: 0; padding: 1rem 1.1rem 1.1rem; border: 1px solid var(--line); border-radius: var(--r-panel); }
.access-group legend { padding: 0 .35rem; font: 600 1.1rem/1.2 var(--font-display); letter-spacing: .01em; }
.access-group > .field-hint { margin-bottom: .6rem; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .45rem 1rem; }
.check-inline { display: flex; gap: .5rem; align-items: center; font-weight: 500; }
.check-group-name { margin: .85rem 0 .35rem; font-weight: 600; font-size: .9rem; color: var(--muted); }
.check-actions { margin: .85rem 0 0; display: flex; gap: 1rem; }
.field-inline { margin-top: .85rem; max-width: 20rem; }

/* =============================================================================
   Tools
   ========================================================================== */
.content-tool { max-width: 88rem; }
.tool-intro { max-width: 52rem; margin: 0 0 1.25rem; color: var(--muted); }
.tool-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(18rem, 24rem); gap: 1.5rem; align-items: start; }
.tool-layout-wide { grid-template-columns: minmax(0, 1fr); }
.tool-main { display: grid; gap: 1.25rem; min-width: 0; }
.tool-side { position: sticky; top: 1rem; display: grid; gap: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 1rem; align-items: start; }
.form-grid .span-2 { grid-column: span 2; }
.input-unit { position: relative; }
.input-unit input { padding-right: 3rem; }
.input-unit > span { position: absolute; right: .75rem; top: 50%; transform: translateY(-50%); font-size: .85rem; font-weight: 600; color: var(--muted); pointer-events: none; }

/* The headline result is set on a nameplate, like a panel's rating plate. */
.readout { padding: 1rem 1.25rem 1.1rem; color: #F2F4F3; background: var(--ink); border-radius: var(--r-panel); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1); }
.readout-label { margin: 0 0 .2rem; font: 600 .95rem/1.2 var(--font-display); letter-spacing: .04em; color: #B9BEC3; }
.readout-value { margin: 0; font: 700 2.4rem/1.05 var(--font-display); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.readout-value.is-pending { color: #8A9096; font-weight: 600; font-size: 1.6rem; }
.readout-note { margin: .5rem 0 0; font-size: .9rem; color: #C9CDD1; }

.result-list { display: grid; gap: .1rem; margin: 0; padding: 0; list-style: none; }
.result-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.result-list li:last-child { border-bottom: 0; }
.result-list .k { color: var(--muted); }
.result-list .v { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.warn-box { margin: 0; padding: .65rem .85rem; color: #6B3F00; background: var(--warn-tint); border-left: 4px solid #E0A100; border-radius: var(--r-control); }
.method { font-size: .92rem; color: var(--muted); }
.method h2 { margin-bottom: .5rem; font: 600 1.1rem/1.2 var(--font-display); color: var(--text); }
.method ul { margin: .4rem 0 0; padding-left: 1.1rem; }
.method li { margin-bottom: .3rem; }
.num { font-variant-numeric: tabular-nums; }
.table td.num, .table th.num { text-align: right; }
.table-tight th, .table-tight td { padding: .45rem .75rem; }
.empty-cell { padding: 1.5rem !important; text-align: center !important; color: var(--muted); }

@media (max-width: 64rem) {
  .tool-layout { grid-template-columns: 1fr; }
  .tool-side { position: static; }
}
.assumed { margin: 0; min-height: 2.6rem; display: flex; align-items: center; padding: 0 .75rem; font-weight: 600; background: var(--surface-sunk); border: 1px solid var(--line); border-radius: var(--r-control); }
td.strong { font-weight: 700; }
.converter { display: grid; gap: .75rem; }
.converter-bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem; }
.btn-group { display: flex; flex-wrap: wrap; gap: .4rem; }
.converter-editor { min-height: 28rem !important; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .95rem; line-height: 1.5; }
.converter-stats { display: flex; flex-wrap: wrap; gap: 1.25rem; margin: 0; font-size: .9rem; color: var(--muted); }
.converter-stats b { color: var(--text); font-variant-numeric: tabular-nums; }
.converter-note { color: var(--ok); font-weight: 600; }
.ref-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: 1.25rem; align-items: start; }
.ref-card { padding-bottom: 1rem; }
.ref-card .panel-title { margin-bottom: .1rem; }
.ref-sub { margin-bottom: .75rem; font-size: .9rem; }
.ref-table { border: 1px solid var(--line); border-radius: var(--r-control); }
.ref-table tbody tr:nth-child(even) { background: var(--surface-sunk); }
.ref-table td, .ref-table th { font-variant-numeric: tabular-nums; }
.ref-note { margin: .6rem 0 0; font-size: .85rem; color: var(--muted); }
.section-head-tight { margin: 0 0 .75rem; }
.section-head-tight .panel-title { margin: 0; }
.loads { display: grid; gap: .6rem; margin: 0; padding: 0; list-style: none; }
.load {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 5.5rem 7rem;
  grid-template-areas: "name name type type" "inputs inputs qty heat";
  gap: .75rem; align-items: end;
  padding: .85rem 3rem .85rem .85rem;
  background: var(--surface-sunk); border: 1px solid var(--line); border-radius: var(--r-control);
}
.load-name { grid-area: name; }
.load > label:nth-of-type(2) { grid-area: type; }
.load-inputs { grid-area: inputs; }
.load-qty { grid-area: qty; }
.load-watts { grid-area: heat; }
.load-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.load-inputs:has(> :only-child) { grid-template-columns: 1fr; }
.load-watts { margin: 0; display: grid; gap: .3rem; }
.load-watts output { min-height: 2.6rem; display: flex; align-items: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.load-remove { position: absolute; top: .5rem; right: .5rem; }
@media (max-width: 48rem) {
  .load { grid-template-columns: 1fr 1fr; grid-template-areas: "name name" "type type" "inputs inputs" "qty heat"; }
}
.segmented { display: inline-flex; margin: 0 0 1.25rem; padding: .25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span { display: block; padding: .5rem 1.1rem; font-weight: 600; color: var(--muted); border-radius: var(--r-control); }
.segmented input:checked + span { color: #fff; background: var(--blue); }
.segmented input:focus-visible + span { outline: 2px solid var(--bolt); outline-offset: 2px; }
.choice { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin: 1rem 0 0; padding: 0; border: 0; }
.choice legend { width: 100%; margin-bottom: .4rem; padding: 0; }
.form-grid-gap { margin-top: 1rem; }
.readout-secondary { background: #24282E; }
.readout.is-off { opacity: .55; }
.mfr-box p { margin-bottom: .35rem; }
.ref-jump { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; margin: 0 0 1.25rem; font-weight: 600; font-size: .92rem; }
.ref-stack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; align-items: start; }
@media (max-width: 60rem) { .ref-stack { grid-template-columns: minmax(0, 1fr); } }
.ref-card-wide { grid-column: 1 / -1; }
.ref-card { scroll-margin-top: 1rem; }
.table-scroll { overflow-x: auto; }
.ref-table th[scope="col"] { vertical-align: bottom; }
.readout-text { font-size: 1.6rem; line-height: 1.15; }
.page-error { margin-bottom: 1rem; }
.unit-alt { font-weight: 400; font-size: .85em; }
/* In-app confirmation dialog */
.dialog-confirm { width: min(28rem, calc(100vw - 2rem)); }
.dialog-confirm form { margin: 0; }
.confirm-body { padding: 1.25rem 1.4rem 1.1rem; }
.confirm-body h2 { margin-bottom: .5rem; font: 600 1.4rem/1.2 var(--font-display); letter-spacing: .01em; overflow-wrap: anywhere; }
.confirm-body p { margin: 0; color: var(--muted); }
.confirm-foot { justify-content: flex-end; gap: .6rem; }

/* Home: tool tiles */
.tool-group { margin-bottom: 1.6rem; }
.tool-group-name { margin: 0 0 .6rem; font: 600 1.1rem/1.2 var(--font-display); letter-spacing: .02em; color: var(--muted); }
.tool-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr)); gap: .85rem; margin: 0; padding: 0; list-style: none; }
.tool-tiles li { display: flex; }
.tool-tile {
  flex: 1; display: grid; grid-template-columns: 2.9rem minmax(0, 1fr); gap: .9rem; align-items: start;
  padding: 1rem 1.1rem; color: var(--text); text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.tool-tile:hover { color: var(--text); border-color: var(--sky); box-shadow: 0 8px 20px rgba(1, 0, 14, .08); transform: translateY(-2px); }
.tool-tile:active { transform: none; box-shadow: none; }
.tool-icon { width: 2.9rem; height: 2.9rem; display: grid; place-items: center; color: var(--blue); background: var(--blue-tint); border-radius: var(--r-panel); }
.tool-icon svg { width: 1.6rem; height: 1.6rem; }
.tool-tile:hover .tool-icon { color: #fff; background: var(--blue); }
.tool-tile-text { display: grid; gap: .2rem; min-width: 0; }
.tool-tile-name { font: 600 1.18rem/1.2 var(--font-display); letter-spacing: .01em; }
.tool-tile-soon { margin-top: .2rem; font-size: .78rem; font-weight: 600; color: var(--muted); }
.tool-tile-blurb { font-size: .9rem; line-height: 1.4; color: var(--muted); }
.tool-tile.is-soon .tool-icon { color: var(--muted); background: var(--surface-sunk); }
.tool-tile.is-soon .tool-tile-name { color: var(--muted); }

/* Group colors: the sidebar headings and the home tiles share them.
   --grp is dark enough for text on white; --grp-tint backs the icons. */
.grp-boards   { --grp: #00529B; --grp-tint: #E3EEF8; }
.grp-calc     { --grp: #B4510A; --grp-tint: #FDEBDC; }
.grp-ref      { --grp: #1D7536; --grp-tint: #E1F2E5; }
.grp-labels   { --grp: #6A3DAE; --grp-tint: #EEE7F9; }
.grp-drawings { --grp: #B42318; --grp-tint: #FCE6E3; }
.grp-text     { --grp: #0B6E79; --grp-tint: #DDF1F2; }
.nav-group[class*="grp-"] { color: var(--grp); }
.home-group { margin-bottom: 1.75rem; }
.home-group-name { margin: 0 0 .7rem; font: 600 1.35rem/1.2 var(--font-display); letter-spacing: .01em; color: var(--grp, var(--text)); }
.home-group .tool-icon, .home-group .tool-tile.is-soon .tool-icon { color: var(--grp); background: var(--grp-tint); }
.home-group .tool-tile:hover { border-color: var(--grp); }
.home-group .tool-tile:hover .tool-icon { color: #fff; background: var(--grp); }
.home-group .tool-tile.is-soon .tool-tile-name { color: var(--text); }
.home-group .tool-tile.is-soon { background: var(--surface-sunk); }

/* NEC calculator */
.title-optional { margin-left: .4rem; font: 500 .9rem var(--font-ui); color: var(--muted); }
.vd-out { margin-top: 1rem; }
.vd-line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; padding: .7rem .9rem; font-weight: 700; border-radius: var(--r-control); border-left: 4px solid; }
.vd-line[data-level="ok"] { background: var(--ok-tint); border-color: var(--ok); }
.vd-line[data-level="warn"] { background: var(--warn-tint); border-color: #E0A100; }
.vd-line[data-level="bad"] { background: var(--danger-tint); border-color: var(--danger); }
.vd-at { font-weight: 500; }
.vd-note { margin: .5rem 0 0; font-size: .88rem; color: var(--muted); }
.vd-controls { display: flex; gap: .5rem; margin-top: .75rem; }
.capacity { display: grid; gap: .6rem; padding: .85rem 1rem; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: var(--r-control); }
.capacity.is-warn { background: var(--warn-tint); border-left-color: #E0A100; }
.capacity p { margin: 0; }
.capacity .btn { justify-self: start; }
.steps summary { cursor: pointer; font-weight: 600; }
.steps ol { margin: .75rem 0 0; padding-left: 1.2rem; font-size: .9rem; color: var(--muted); }
.steps li { margin-bottom: .35rem; }
.capacity.is-info { border-left-color: var(--blue); }
.segmented-sm { margin: 0; } .segmented-sm span { padding: .4rem .9rem; font-size: .92rem; }

/* Motor circuit builder */
.mcb-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 1.5rem; align-items: start; }
.diagram-panel { position: sticky; top: 1rem; }
.diagram { min-height: 18rem; }
.diagram-empty { margin: 3rem 0; text-align: center; color: var(--muted); }
.findings { display: grid; gap: .5rem; }
.finding { margin: 0; padding: .6rem .85rem; border-left: 4px solid; border-radius: var(--r-control); }
.finding-error { background: var(--danger-tint); border-color: var(--danger); }
.finding-warn { background: var(--warn-tint); border-color: #E0A100; }
.finding-note { background: var(--blue-tint); border-color: var(--blue); }
.finding-ok { background: var(--ok-tint); border-color: var(--ok); font-weight: 600; }
.links { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-top: .75rem; font-weight: 600; }
.dia { display: block; width: 100%; height: auto; font-family: var(--font-ui); }
.dia-wire { stroke: var(--ink); stroke-width: 2.5; }
.dia-node { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.dia-sym { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; }
.dia-sym.is-error { stroke: var(--danger); }
.dia-sym.is-warn { stroke: #B4510A; }
.dia-label rect { fill: var(--surface-sunk); stroke: var(--line); }
.dia-label.is-error rect { fill: var(--danger-tint); stroke: var(--danger); }
.dia-label.is-warn rect { fill: var(--warn-tint); stroke: #E0A100; }
.dia-title { font-family: var(--font-display); font-size: 16px; font-weight: 600; fill: var(--ink); }
.dia-sub { font-size: 12px; fill: var(--muted); }
.dia-box { fill: var(--blue-tint); stroke: var(--blue); stroke-width: 2; }
.dia-box.is-error { fill: var(--danger-tint); stroke: var(--danger); }
.dia-box-text { font-family: var(--font-display); font-size: 17px; font-weight: 700; fill: var(--blue); }
.dia-tb { fill: var(--silver-light); stroke: var(--silver); stroke-width: 1.5; }
.dia-tb-text { font-size: 10px; font-weight: 700; fill: var(--ink); }
.dia-panel-edge { stroke: var(--silver); stroke-width: 1.5; stroke-dasharray: 4 3; }
.dia-edge-text { font-size: 11px; fill: var(--muted); }
.dia-motor { fill: var(--surface); stroke: var(--ink); stroke-width: 2.5; }
.dia-motor-text { font-family: var(--font-display); font-size: 24px; font-weight: 700; fill: var(--ink); }
.dia-source { font-size: 14px; font-weight: 600; fill: var(--ink); }
.dia-in { animation: dia-in .3s ease-out both; }
@keyframes dia-in { from { opacity: 0; transform: translateY(-6px); } }
@media (max-width: 64rem) { .mcb-layout { grid-template-columns: 1fr; } .diagram-panel { position: static; } }
.dia-tag-main { font-family: var(--font-display); font-size: 17px; font-weight: 700; fill: var(--ink); }
.dia-tag-sub { font-size: 11.5px; fill: var(--muted); }
.dia-tag.is-error .dia-tag-main, .dia-tag.is-error .dia-tag-sub { fill: var(--danger); }
.dia-tag.is-warn .dia-tag-main, .dia-tag.is-warn .dia-tag-sub { fill: #B4510A; }

/* Builder: build-on-click animation. Strokes are drawn on like a pen (pathLength=1),
   shapes fill in once outlined, text slides in, then a bolt-blue pulse runs down the circuit. */
.btn-build { justify-self: start; min-height: 2.9rem; padding: .5rem 1.6rem; font-size: 1.05rem; }
.stale-note { margin: -.25rem 0 .75rem; padding: .5rem .75rem; font-size: .9rem; background: var(--warn-tint); border-left: 4px solid #E0A100; border-radius: var(--r-control); }
.diagram.is-stale { opacity: .4; filter: grayscale(.6); transition: opacity .2s ease; }
.dia-oval { fill: none; stroke: var(--ink); stroke-width: 1.6; }
.dia-leader { fill: none; stroke: var(--ink); stroke-width: 1.3; }
.dia-oval.is-error, .dia-leader.is-error { stroke: var(--danger); }
.dia-oval.is-warn, .dia-leader.is-warn { stroke: #B4510A; }
.dia-call { font-family: var(--font-display); font-size: 15px; font-weight: 700; fill: var(--ink); letter-spacing: .01em; }
.dia-tag.is-error .dia-call { fill: var(--danger); }
.dia-tag.is-warn .dia-call { fill: #B4510A; }
.anim-draw {
  stroke-dasharray: 1; stroke-dashoffset: 1; fill-opacity: 0;
  animation: dia-pen var(--dur, .35s) ease-in-out var(--delay, 0s) forwards,
             dia-fill .25s ease-out calc(var(--delay, 0s) + var(--dur, .35s) * .7) forwards;
}
.anim-fade { opacity: 0; transform-box: fill-box; animation: dia-slide .3s ease-out var(--delay, 0s) forwards; }
.dia-pulse { stroke: var(--bolt); stroke-width: 5; stroke-linecap: round; fill: none; stroke-dasharray: .12 1; stroke-dashoffset: .12; opacity: 0;
  animation: dia-pulse 1s ease-in-out var(--delay, 0s) forwards; filter: drop-shadow(0 0 4px rgba(55, 193, 242, .8)); }
@keyframes dia-pen { to { stroke-dashoffset: 0; } }
@keyframes dia-fill { to { fill-opacity: 1; } }
@keyframes dia-slide { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
@keyframes dia-pulse { 0% { opacity: 0; stroke-dashoffset: .12; } 10% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; stroke-dashoffset: -1; } }
html[data-motion="off"] .anim-draw { stroke-dasharray: none !important; stroke-dashoffset: 0 !important; fill-opacity: 1 !important; }
html[data-motion="off"] .anim-fade { opacity: 1 !important; transform: none !important; }
html[data-motion="off"] .dia-pulse { display: none; }
@media (prefers-reduced-motion: reduce) {
  html[data-motion="system"] .anim-draw { stroke-dasharray: none !important; stroke-dashoffset: 0 !important; fill-opacity: 1 !important; }
  html[data-motion="system"] .anim-fade { opacity: 1 !important; transform: none !important; }
  html[data-motion="system"] .dia-pulse { display: none; }
}

.choice-stack { display: grid; gap: .5rem; margin: 0; }

/* Parts catalog */
.parts-add { display: grid; grid-template-columns: minmax(10rem, 1fr) minmax(9rem, .9fr) minmax(14rem, 2fr) auto; gap: .75rem; align-items: end; }
.parts-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin: 1.5rem 0 .75rem; }
.parts-search { flex: 1 1 22rem; max-width: 34rem; }
.parts-bar .btn { margin-left: auto; }
.parts-table td { padding: .2rem .4rem; }
.parts-table th { padding: 0; }
.sort { width: 100%; padding: .6rem 1rem; font: inherit; font-weight: 600; color: inherit; text-align: left; background: none; border: 0; cursor: pointer; }
.sort:hover { color: var(--blue); }
.sort[data-dir="asc"]::after { content: " ▲"; font-size: .7em; }
.sort[data-dir="desc"]::after { content: " ▼"; font-size: .7em; }
.col-cat { width: 17rem; } .col-mfr { width: 11rem; } .col-upd { width: 8.5rem; } .col-del { width: 3rem; }
.part-cell { overflow: hidden; word-break: break-word; }
.part-cat { font-weight: 600; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .92rem; }
.part-upd { padding-left: 1rem !important; font-size: .88rem; white-space: nowrap; }
.parts-table tr.is-new td { background: var(--ok-tint); transition: background 2s ease; }
@media (max-width: 48rem) { .parts-add { grid-template-columns: 1fr; } .col-upd, .part-upd { display: none; } }

@media print {
  .sidebar, .topbar, .flashes, .skip-link, .no-print, .scrim { display: none !important; }
  body, .main { background: #fff; }
  .shell { display: block; }
  .content { padding: 0; max-width: none; }
}
/* Toast notices */
.toasts { position: fixed; top: 1rem; right: 1rem; z-index: 200; display: grid; gap: .5rem; justify-items: end; pointer-events: none; }
.toast { margin: 0; padding: .7rem 1.1rem; font-weight: 600; color: #fff;
  border-radius: var(--r-panel); box-shadow: 0 10px 28px rgba(1, 0, 14, .22); animation: toast-in .25s ease-out; transition: opacity .3s ease; }
.toast-success { background: var(--ok); }
.toast-error { background: var(--danger); }
.toast.is-leaving { opacity: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
/* Full-width editor pages (drawing redlines) */
.content-editor { max-width: none; padding-bottom: 0; }

/* Strengths assessment (public pages and reports) */
.page-public { background: var(--bg); }
.pub-head { display: grid; justify-items: center; gap: .9rem; padding: 2rem 1rem 1.25rem; }
.pub-head img { width: 13rem; height: auto; }
.pub-main { width: min(52rem, 100%); margin: 0 auto; padding: 0 1rem 2rem; display: grid; gap: 1.1rem; }
.pub-foot { padding: 1.5rem 1rem 2.5rem; text-align: center; font-size: .85rem; }
.pub-foot a { color: var(--muted); }
.pub-intro .lede { margin-bottom: .4rem; }
.pub-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin: 0; }
.q { margin: 0; border: 1px solid var(--line); border-left: 4px solid var(--line); transition: border-color .2s ease; }
.q.is-done { border-left-color: var(--ok); }
.q-title { float: left; width: 100%; display: flex; gap: .65rem; align-items: baseline; padding: 0; margin: 0 0 .1rem; font: 600 1.2rem/1.3 var(--font-display); letter-spacing: .01em; }
.q-num { flex: none; display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; font: 700 1rem var(--font-display); color: #fff; background: var(--blue); border-radius: 50%; }
.q.is-done .q-num { background: var(--ok); }
.q-help { clear: both; margin: .2rem 0 .6rem 2.35rem; font-size: .85rem; }
.q-opt { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .65rem 0; border-top: 1px solid var(--line); }
.q-text { margin: 0; flex: 1; }
.q-ranks { flex: none; display: flex; gap: .35rem; }
.q-rank { position: relative; }
.q-rank input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.q-rank span { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; font-weight: 700; color: var(--muted); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-panel); transition: background .12s ease, color .12s ease; }
.q-rank input:hover + span { border-color: var(--blue); color: var(--blue); }
.q-rank input:checked + span { color: #fff; background: var(--blue); border-color: var(--blue); }
.q-rank input:focus-visible + span { outline: 2px solid var(--bolt); outline-offset: 2px; }
.pub-submit { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 1rem; }
.btn-big { min-height: 3rem; padding: .6rem 1.8rem; font-size: 1.05rem; }
@media (max-width: 36rem) { .q-opt { flex-direction: column; align-items: stretch; } .q-ranks { justify-content: flex-end; } }

.report-head { display: grid; gap: .3rem; }
.report-who { margin: 0; font-size: 1.2rem; }
.report-bars { display: grid; gap: .55rem; margin-top: .75rem; }
.bar { display: grid; grid-template-columns: 7rem minmax(0, 1fr) 4.5rem; align-items: center; gap: .75rem; }
.bar-name { font-weight: 600; }
.bar-track { height: .9rem; background: var(--surface-sunk); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; }
.bar-v .bar-fill { background: var(--blue); }
.bar-m .bar-fill { background: #3C9450; }
.bar-t .bar-fill { background: #B4510A; }
.bar-score { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar-w-7 { width: 33.3%; }
.bar-w-8 { width: 38.1%; }
.bar-w-9 { width: 42.9%; }
.bar-w-10 { width: 47.6%; }
.bar-w-11 { width: 52.4%; }
.bar-w-12 { width: 57.1%; }
.bar-w-13 { width: 61.9%; }
.bar-w-14 { width: 66.7%; }
.bar-w-15 { width: 71.4%; }
.bar-w-16 { width: 76.2%; }
.bar-w-17 { width: 81.0%; }
.bar-w-18 { width: 85.7%; }
.bar-w-19 { width: 90.5%; }
.bar-w-20 { width: 95.2%; }
.bar-w-21 { width: 100.0%; }
.report-arch { border-left: 5px solid var(--line-strong); }
.report-v { border-left-color: var(--blue); }
.report-m { border-left-color: #3C9450; }
.report-t { border-left-color: #B4510A; }
.report-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .6rem; margin-bottom: .6rem; font: 600 1.4rem/1.2 var(--font-display); letter-spacing: .01em; }
.report-score { font-weight: 500; color: var(--muted); }
.report-level { margin-left: auto; padding: .15rem .6rem; font: 600 .8rem var(--font-ui); border-radius: 999px; }
.level-high { color: #fff; background: var(--ink); }
.level-mid { background: var(--silver-light); }
.level-low { color: var(--danger); background: var(--danger-tint); }
.report-lead { font-size: 1.05rem; }
.report-dl { display: grid; gap: .6rem; margin: .9rem 0 0; }
.report-dl div { padding: .6rem .8rem; background: var(--surface-sunk); border-radius: var(--r-control); }
.report-dl dt { font-weight: 700; font-size: .85rem; }
.report-dl dd { margin: .15rem 0 0; }
.report-evidence { margin-top: 1rem; }
.report-evidence h4 { margin-bottom: .35rem; font: 600 1rem var(--font-display); color: var(--muted); }
.report-evidence ul { margin: 0; padding-left: 0; list-style: none; display: grid; gap: .35rem; }
.ev-tag { display: inline-block; margin-right: .4rem; padding: 0 .45rem; font-size: .75rem; font-weight: 700; border-radius: 3px; }
.ev-most { color: var(--ok); background: var(--ok-tint); }
.ev-least { color: var(--danger); background: var(--danger-tint); }
.report-answers summary { cursor: pointer; font-weight: 600; }
.ans-q { margin: 1rem 0 .3rem; }
.ans-list { margin: 0; padding-left: 0; list-style: none; display: grid; gap: .25rem; }
.ans-rank { display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; margin-right: .4rem; font-size: .8rem; font-weight: 700; color: #fff; background: var(--blue); border-radius: 50%; }
.link-row { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0; }
.link-row input { flex: 1 1 24rem; font-family: ui-monospace, Consolas, monospace; font-size: .88rem; }
.link-row input.is-off { text-decoration: line-through; color: var(--muted); }
.link-state { margin: .25rem 0 .75rem; }
@media print {
  .pub-head img { width: 10rem; } .pub-foot, .report-answers { display: none; }
  .report-arch, .report-head { break-inside: avoid; }
  .bar-fill, .level-high, .ev-tag, .q-num { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.pub-actions form { margin: 0; }
/* Assessment: deeper sections */
.bar { grid-template-columns: 7rem minmax(0, 1fr) 9.5rem; }
.bar-tier { margin-left: .4rem; padding: 0 .4rem; font-size: .72rem; font-weight: 600; border-radius: 3px; }
.bar-tier.tier-high { color: #fff; background: var(--ink); }
.bar-tier.tier-mid { background: var(--silver-light); }
.bar-tier.tier-low { color: var(--danger); background: var(--danger-tint); }
.report-sub { margin: .25rem 0 .35rem; font: 600 1.05rem var(--font-display); color: var(--muted); }
.report-working p { margin-bottom: .9rem; }
.report-friction { margin: 0; padding-left: 1.1rem; display: grid; gap: .45rem; }
.report-basis { margin-bottom: .4rem; font-size: .88rem; }
.report-context { padding: .9rem 1.1rem; border-left: 4px solid var(--silver); background: var(--surface); border-radius: var(--r-control); }
.report-context p { margin: 0 0 .35rem; }
@media print { .report-tension, .report-working, .report-context { break-inside: avoid; } }
@media (max-width: 36rem) { .bar { grid-template-columns: 5.5rem minmax(0, 1fr); } .bar-score { grid-column: 1 / -1; text-align: left; } }
/* Assessment: its own look (not Magic Valley Electric branded) */
.pub-head { gap: .35rem; padding: 2.4rem 1rem 1.6rem; text-align: center; }
.pub-mark { width: 4.5rem; height: 4.5rem; margin-bottom: .35rem; }
.pub-roles { display: flex; gap: .9rem; margin: 0; font: 600 .78rem var(--font-ui); letter-spacing: .14em; text-transform: uppercase; }
.role-v { color: #00529B; } .role-m { color: #2F7A41; } .role-t { color: #B4510A; }
.pub-title { margin: .1rem 0 0; font: 700 clamp(1.9rem, 4.5vw, 2.7rem)/1.1 var(--font-display); letter-spacing: .01em; color: var(--ink); }
.pub-sub { margin: .2rem 0 0; color: var(--muted); }
.pub-sub cite { font-style: italic; }
.btn-small { min-height: 2rem; padding: .25rem .7rem; font-size: .85rem; }
.results-link .link-row input { font-size: .82rem; }
@media print { .pub-head { padding-top: 0; } .pub-mark { width: 3rem; height: 3rem; } }
/* Assessment: at a glance */
.glance { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; }
.glance-card { padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--line-strong); border-radius: var(--r-panel); }
.glance-v { border-top-color: var(--blue); } .glance-m { border-top-color: #3C9450; } .glance-t { border-top-color: #B4510A; }
.glance-title { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; font: 600 1.12rem/1.2 var(--font-display); }
.glance-icon { flex: none; display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; font: 700 .85rem var(--font-ui); color: #fff; border-radius: 50%; }
.icon-ok { background: var(--ok); }
.icon-warn { background: #D08A00; }
.glance ul { margin: 0; padding-left: 1.05rem; display: grid; gap: .3rem; font-size: .95rem; }
@media (max-width: 48rem) { .glance { grid-template-columns: 1fr; } }
@media print { .glance-icon { -webkit-print-color-adjust: exact; print-color-adjust: exact; } .glance { break-inside: avoid; } }
/* Assessment: email notes */
.email-note { margin: 0; padding: .7rem .95rem; border-left: 4px solid; border-radius: var(--r-control); }
.email-ok { background: var(--ok-tint); border-color: var(--ok); }
.email-bad { background: var(--warn-tint); border-color: #E0A100; }
.mail-tag { margin-left: .3rem; padding: 0 .35rem; font-size: .72rem; font-weight: 600; border-radius: 3px; }
.mail-ok { color: var(--ok); background: var(--ok-tint); }
.mail-bad { color: var(--danger); background: var(--danger-tint); }
/* Assessment: translate button and the rewording animation */
.translate-btn { display: inline-flex; align-items: center; gap: .55rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); }
.translate-btn:hover { border-color: var(--blue); color: var(--blue); }
.translate-btn[aria-pressed="true"] { background: var(--blue-tint); border-color: var(--blue); }
.translate-dots { display: inline-flex; gap: 3px; }
.translate-dots i { width: 7px; height: 7px; border-radius: 50%; }
.translate-dots i:nth-child(1) { background: #00529B; } .translate-dots i:nth-child(2) { background: #3C9450; } .translate-dots i:nth-child(3) { background: #B4510A; }
.translate-btn.is-working .translate-dots i { animation: tx-dot .8s ease-in-out infinite; }
.translate-btn.is-working .translate-dots i:nth-child(2) { animation-delay: .12s; }
.translate-btn.is-working .translate-dots i:nth-child(3) { animation-delay: .24s; }
@keyframes tx-dot { 50% { transform: translateY(-4px); } }
.tx-out { animation: tx-out .22s ease-in forwards; }
.tx-in { animation: tx-in .42s ease-out; }
@keyframes tx-out { to { opacity: 0; filter: blur(6px); transform: translateY(-4px); } }
@keyframes tx-in { from { opacity: 0; filter: blur(6px); transform: translateY(4px); } }
/* new sections */
.week-list { margin: 0; padding-left: 1.3rem; display: grid; gap: .55rem; }
.week-list li::marker { font-weight: 700; color: var(--blue); }
.work-card { display: grid; gap: .9rem; border-top: 4px solid var(--blue); }
.work-dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; margin: 0; }
.work-dl div { padding: .7rem .85rem; background: var(--surface-sunk); border-radius: var(--r-control); }
.work-dl dt { font-weight: 700; font-size: .85rem; }
.work-dl dd { margin: .2rem 0 0; }
.work-card .btn { justify-self: start; }
.bar { grid-template-columns: 9rem minmax(0, 1fr) 9.5rem; }
@media (max-width: 40rem) { .work-dl { grid-template-columns: 1fr; } }

/* ================= BOM builder ================= */
.grp-estimating { --grp: #7A5A00; --grp-tint: #F6EDD3; }
.caps { text-transform: uppercase; }
.bom-new { display: grid; grid-template-columns: minmax(12rem, 1.4fr) minmax(10rem, 1fr) minmax(12rem, 1.2fr) auto; gap: .75rem; align-items: end; }
.bom-list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-top: 1.5rem; }
.bom-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .5rem 1rem; align-items: center; margin-bottom: 1rem; }
.bom-back { font-size: .9rem; }
.bom-titles { display: flex; gap: .6rem; align-items: center; min-width: 0; }
.bom-name { flex: 1 1 18rem; min-width: 0; font: 700 1.5rem/1.2 var(--font-display) !important; letter-spacing: .01em; border-color: transparent !important; background: transparent !important; padding-left: .3rem !important; }
.bom-name:hover, .bom-name:focus { border-color: var(--line-strong) !important; background: var(--surface) !important; }
.bom-job { flex: 0 1 12rem; }
.bom-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: flex-end; }
.bom-menu { position: relative; }
.bom-menu > summary { list-style: none; cursor: pointer; }
.bom-menu > summary::-webkit-details-marker { display: none; }
.bom-menu > summary::after { content: " ▾"; font-size: .8em; }
.bom-menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 16rem; display: grid; padding: .35rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); box-shadow: 0 12px 28px rgba(1, 0, 14, .16); }
.bom-menu-list a { display: block; padding: .5rem .65rem; color: var(--text); text-decoration: none; border-radius: var(--r-control); }
.bom-menu-list a:hover { background: var(--surface-sunk); }
.menu-note { margin: .35rem .65rem .2rem; font-size: .82rem; }
.bom-grid { display: grid; grid-template-columns: minmax(0, 1fr) 17.5rem; gap: 1.25rem; align-items: start; }
.bom-side { position: sticky; top: 1rem; display: grid; gap: .6rem; }
.addbox { position: relative; }
.addbox-input { width: 100%; min-height: 3.2rem !important; font-size: 1.15rem !important; padding: .6rem 1rem !important; border-width: 2px !important; border-color: var(--blue) !important; border-radius: var(--r-panel) !important; }
.addbox-hint { margin: .4rem 0 0; font-size: .82rem; }
.addbox-results { position: absolute; left: 0; right: 0; top: 3.4rem; z-index: 40; max-height: 26rem; overflow-y: auto; padding: .35rem; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-panel); box-shadow: 0 16px 36px rgba(1, 0, 14, .2); }
.res { display: grid; gap: .1rem; width: 100%; padding: .55rem .7rem; text-align: left; color: var(--text); background: none; border: 0; border-radius: var(--r-control); cursor: pointer; }
.res.is-active, .res:hover { background: var(--blue-tint); }
.res-top { display: flex; gap: .6rem; align-items: baseline; }
.res-top strong { font-family: ui-monospace, Consolas, monospace; font-size: .95rem; }
.res-cost { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.res-desc { font-size: .88rem; }
.res-uses { font-size: .75rem; color: var(--muted); }
.res-kicker { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--grp-estimating, #7A5A00); color: #7A5A00; }
.res-starter { border: 1px solid #E8D9A8; background: #FBF6E6; margin-bottom: .3rem; }
.res-starter.is-active, .res-starter:hover { background: #F6EDD3; }
.res-starter-line strong { font-family: ui-monospace, Consolas, monospace; }
.res-note { font-size: .82rem; color: #8A5300; }
.res-action { font-size: .78rem; font-weight: 600; color: var(--blue); }
.res-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: .45rem; margin-top: .35rem; }
.res-new .res-form { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, .8fr) auto; }
.res-form input { min-height: 2.2rem !important; padding: .3rem .5rem !important; font-size: .9rem; }
.res-empty { margin: .5rem .7rem; }
.companions { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-top: .75rem; padding: .6rem .75rem; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-panel); }
.companions-label { font-size: .85rem; font-weight: 600; }
.chip { display: inline-flex; gap: .25rem; align-items: baseline; padding: .3rem .65rem; font-size: .85rem; color: var(--text); background: var(--blue-tint); border: 1px solid transparent; border-radius: 999px; cursor: pointer; }
.chip:hover { border-color: var(--blue); }
.chip strong { font-family: ui-monospace, Consolas, monospace; font-size: .82rem; }
.chip span { color: var(--muted); }
.companions .icon-btn { margin-left: auto; }
.price-bar { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; margin-top: .75rem; padding: .5rem .8rem; font-size: .9rem; background: var(--warn-tint); border-left: 4px solid #E0A100; border-radius: var(--r-control); }
.bom-table-wrap { margin-top: .9rem; }
.bom-table { width: 100%; border-collapse: collapse; table-layout: fixed; background: var(--surface); }
.bom-table th { padding: .5rem .4rem; font-size: .78rem; text-align: left; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-sunk); border-bottom: 1px solid var(--line); }
.bom-table td { padding: .15rem .25rem; vertical-align: top; border-bottom: 1px solid var(--line); }
.bom-table .cell { width: 100%; min-height: 2rem !important; padding: .3rem .4rem !important; font-size: .9rem; background: transparent !important; border-color: transparent !important; }
.bom-table .cell:hover { border-color: var(--line) !important; }
.bom-table .cell:focus { background: var(--surface) !important; border-color: var(--blue) !important; }
.bom-table textarea.cell { resize: none; overflow: hidden; line-height: 1.35; }
.bom-table .cell-catalog { font-family: ui-monospace, Consolas, monospace; font-weight: 600; font-size: .85rem; }
.cell-qty, .cell-cost { text-align: right; font-variant-numeric: tabular-nums; }
.col-handle { width: 1.5rem; } .col-item { width: 2.2rem; padding-top: .55rem !important; text-align: center; color: var(--muted); font-size: .85rem; }
.col-qty { width: 4.2rem; position: relative; } .col-mfg { width: 8.6rem; } .col-cat { width: 10.5rem; } .col-vendor { width: 7.2rem; }
.col-cost { width: 6rem; position: relative; } .col-total { width: 6.4rem; padding-top: .55rem !important; font-weight: 600; font-variant-numeric: tabular-nums; }
.col-del { width: 2rem; }
.bom-table select.cell { font-size: .82rem; }
.unit { position: absolute; right: .55rem; bottom: .55rem; font-size: .7rem; color: var(--muted); pointer-events: none; }
.col-qty .cell-qty { padding-right: 1.3rem !important; }
.grip { display: inline-block; padding: .55rem .2rem; color: var(--muted); cursor: grab; user-select: none; }
.bom-table tr.is-dragging { opacity: .5; }
.bom-table tr.is-new td { background: var(--ok-tint); transition: background 1.5s ease; }
.needs-price .cell-cost { background: var(--warn-tint) !important; }
.price-age { position: absolute; left: .35rem; bottom: .15rem; font-size: .62rem; font-weight: 700; color: #8A5300; text-transform: uppercase; pointer-events: none; }
.totals-dl { display: grid; gap: .45rem; margin: 0; }
.totals-dl div { display: flex; justify-content: space-between; gap: .5rem; align-items: center; }
.totals-dl dt { font-size: .9rem; }
.totals-dl dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.totals-dl .rate { display: inline-flex; align-items: center; gap: .15rem; margin-left: .2rem; font-size: .8rem; color: var(--muted); }
.totals-dl .rate input { width: 3.6rem; min-height: 1.7rem !important; padding: .1rem .3rem !important; font-size: .82rem; text-align: right; }
.totals-final { padding-top: .5rem; border-top: 2px solid var(--ink); }
.totals-final dd { font-size: 1.2rem; }
.totals-note { margin: .4rem 0; font-size: .8rem; }
.btn-link { padding: 0; font: inherit; font-size: .88rem; color: var(--blue); background: none; border: 0; text-decoration: underline; cursor: pointer; }
.history-list { margin: 0; padding: .5rem 1.2rem 1.2rem; max-height: 60vh; overflow-y: auto; list-style: none; display: grid; gap: .5rem; }
.history-list li { display: grid; gap: .05rem; padding-bottom: .45rem; border-bottom: 1px solid var(--line); }
.history-list .muted { font-size: .8rem; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.2rem .5rem; }
.dialog-head h2 { margin: 0; font: 600 1.3rem var(--font-display); }
.snack { position: fixed; left: 50%; bottom: 1.2rem; z-index: 210; display: flex; gap: 1rem; align-items: center; padding: .65rem 1rem; color: #fff; background: var(--ink); border-radius: var(--r-panel); transform: translateX(-50%); box-shadow: 0 10px 28px rgba(1, 0, 14, .3); }
.snack button { font-weight: 700; color: var(--bolt); background: none; border: 0; cursor: pointer; }
.dwg-toolbar { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; margin-bottom: .5rem; }
.dwg-wrap { overflow-x: auto; padding: 1rem; background: #fff; border: 1px solid var(--line); border-radius: var(--r-panel); }
.dwg { border-collapse: collapse; table-layout: fixed; font-family: Calibri, Carlito, Arial, sans-serif; color: #000; }
.dwg th, .dwg td { position: relative; padding: 2px 5px; border: 1px solid #000; vertical-align: middle; text-align: center; overflow: hidden; }
.dwg td { white-space: nowrap; text-overflow: ellipsis; }
.dwg.is-wrapped td.dwg-description { white-space: normal; }
.dwg th { text-align: center; font-weight: 700; cursor: grab; user-select: none; }
.dwg .dwg-title { cursor: default; font-size: 1.45em; }
.dwg .dwg-internal { color: var(--muted); border-style: dashed; font-weight: 600; }
.dwg .dwg-internal::after { content: "not copied to the drawing"; display: block; font: 400 .7rem/1.2 var(--font-ui); letter-spacing: .02em; }
.chip-note { font-style: normal; font-size: .78em; color: var(--warn); margin-left: .25rem; }
.dwg-help { margin: .25rem 0 .75rem; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface, #fff); }
.dwg-help > summary { cursor: pointer; padding: .55rem .8rem; font-weight: 600; }
.dwg-help-body { padding: 0 1rem .8rem; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.dwg-help-body h3 { font-size: 1rem; margin: .4rem 0; }
.dwg-help-body ol { margin: 0; padding-left: 1.2rem; display: grid; gap: .3rem; }
.dwg-help-body code { font-size: .9em; }
.dwg .dwg-item, .dwg .dwg-qty { text-align: center; }
.dwg-resize { position: absolute; top: 0; right: -3px; width: 7px; height: 100%; cursor: col-resize; z-index: 2; }
.dwg-resize:hover { background: rgba(1, 140, 209, .35); }
@media (max-width: 70rem) { .bom-grid { grid-template-columns: 1fr; } .bom-side { position: static; } .bom-head { grid-template-columns: 1fr; } .bom-tools { justify-content: flex-start; } }
@media (max-width: 48rem) { .bom-new { grid-template-columns: 1fr; } .res-form, .res-new .res-form { grid-template-columns: 1fr 1fr; } }
.grip { touch-action: none; }

/* costs bar: pinned to the bottom of the screen while you work */
.bom-totals { position: sticky; bottom: 0; z-index: 20; display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; align-items: center; margin-top: 1rem; padding: .7rem 1rem;
  background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--ink); border-radius: var(--r-panel) var(--r-panel) 0 0; box-shadow: 0 -6px 18px rgba(1, 0, 14, .08); }
.tot { display: grid; gap: .05rem; }
.tot-k { display: inline-flex; align-items: center; gap: .25rem; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.tot-v { font-weight: 700; font-variant-numeric: tabular-nums; }
.tot-final .tot-v { font-size: 1.25rem; }
.tot-final { padding-left: 1.2rem; border-left: 2px solid var(--line); }
.tot .rate { display: inline-flex; align-items: center; gap: .15rem; text-transform: none; letter-spacing: 0; }
.tot .rate input { width: 3.4rem; min-height: 1.6rem !important; padding: .05rem .3rem !important; font-size: .82rem; text-align: right; }
.tot-rates { display: flex; flex-wrap: wrap; gap: .3rem .9rem; align-items: center; margin-left: auto; font-size: .82rem; }
.bom-table .cell-mfg { font-size: .82rem; }

.dwg-font-label { white-space: nowrap; }
.dwg-font-label select { width: auto; min-width: 4.5rem; }

/* AutoCAD connection page */
.cad-steps { margin: .5rem 0 0; padding-left: 1.3rem; display: grid; gap: .5rem; }
.cad-steps li { line-height: 1.5; }
.cad-keyform { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; margin-top: 1rem; }
.cad-keyform .field { min-width: 14rem; margin: 0; }
.dwg-cad { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; padding: .65rem .9rem; margin: .25rem 0 .75rem;
  background: var(--blue-tint); border-left: 4px solid var(--blue); border-radius: var(--r-control); }
.dwg-cad code { font-size: .95em; font-weight: 600; }
