:root {
  /* Forked from the landscaper engine, whose theme was green. The variable names are
     kept (sixty-odd rules reference them) but the values are a builder's steel blue
     with a safety-orange accent, so the two apps cannot be mistaken for each other
     when both are open. */
  --green: #2c5f8a;           /* primary — steel blue */
  --green-dark: #1e4361;
  --green-tint: #edf3f8;      /* hover/selected washes */
  --accent: #e6741d;          /* safety orange: highlights, the pitch value */
  --bg: #f3f5f7;
  --panel: #ffffff;
  --border: #dde3e9;
  --border-strong: #c3ccd5;   /* inputs, so fields read as editable */
  --text: #1c2229;
  --muted: #68737e;
  --red: #b23a48;
  --amber: #b7791f;
  --blue: #2c5f8a;
  --focus: #5b9bd5;

  --radius: 8px;
  --radius-lg: 12px;
  /* Two shadows only: resting cards, and things floating above them. */
  --shadow: 0 1px 2px rgba(16,24,16,.05), 0 1px 3px rgba(16,24,16,.06);
  --shadow-lg: 0 8px 28px rgba(16,24,16,.14);
}

* { box-sizing: border-box; }

/* The browser's own [hidden] rule is `display: none` at the lowest possible priority,
   so ANY author `display` defeats it silently — which is how a tile that was meant to
   be hidden showed up as an empty box instead. One line, and `hidden` means hidden
   everywhere in the app. */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.011em; }

button {
  font: inherit;
  font-weight: 500;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
  border-radius: var(--radius);
  padding: 7px 13px;
  cursor: pointer;
  transition: background .13s ease, border-color .13s ease, box-shadow .13s ease;
}
button:hover { background: var(--green-tint); border-color: var(--green); }
button:active { transform: translateY(0.5px); }
button.primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  box-shadow: 0 1px 2px rgba(27,94,32,.25);
}
button.primary:hover { background: var(--green-dark); border-color: var(--green-dark); }
/* Destructive actions stay quiet until you reach for them — they shouldn't be the
   loudest thing in a row of job cards. */
button.danger { color: var(--muted); border-color: var(--border); }
button.danger:hover { color: var(--red); border-color: var(--red); background: #fdf2f3; }
button:disabled { opacity: .45; cursor: not-allowed; }
button:disabled:hover { background: #fff; border-color: var(--border-strong); }

input, select, textarea {
  font: inherit;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 7px 9px;
  background: #fff;
  transition: border-color .13s ease, box-shadow .13s ease;
}
input:hover, select:hover, textarea:hover { border-color: #aab4aa; }
/* One visible focus treatment everywhere, keyboard included. */
input:focus, select:focus, textarea:focus,
button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(124,179,66,.28);
}
input::placeholder, textarea::placeholder { color: #9aa39a; }

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--green-dark);
  color: #fff;
  padding: 11px 20px;
  box-shadow: 0 1px 0 rgba(0,0,0,.10), 0 2px 10px rgba(16,24,16,.10);
  position: relative;
  z-index: 5;
}
.topbar h1 {
  font-size: 15.5px; margin: 0; font-weight: 650; letter-spacing: -0.01em;
}
.topbar h1 a { color: #fff; }
.topbar a { color: #cfdcea; text-decoration: none; }
.topbar .spacer { flex: 1; }
.topbar > span { color: #cfdcea; font-size: 13.5px; }
.topbar button {
  background: rgba(255,255,255,.06); color: #e8f2e8;
  border-color: rgba(255,255,255,.22);
}
.topbar button:hover { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.4); }
.topbar button:focus-visible { box-shadow: 0 0 0 3px rgba(255,255,255,.35); }

/* ---- login ---- */
.login-wrap {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px;
  width: 340px;
  text-align: center;
  box-shadow: 0 4px 18px rgba(0,0,0,0.06);
}
.login-card h1 {
  color: var(--green-dark); margin: 0 0 4px; font-size: 25px; letter-spacing: -0.02em;
}
.login-card input { width: 100%; margin: 10px 0 0; text-align: center; padding: 10px; }
.login-card button { width: 100%; margin-top: 18px; padding: 10px; font-size: 14.5px; }
.login-err { color: var(--red); min-height: 1.3em; margin: 10px 0 0; font-size: 13px; }

/* ---- jobs list ---- */
.container { max-width: 980px; margin: 28px auto 56px; padding: 0 20px; }
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--panel);
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.dropzone:hover { border-color: var(--green); background: var(--green-tint); }
.dropzone.drag {
  border-color: var(--green); background: var(--green-tint);
  box-shadow: 0 0 0 4px rgba(124,179,66,.18);
}
.dropzone strong { color: var(--text); font-size: 15px; }

.job-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 15px 18px;
  margin-top: 10px;
  box-shadow: var(--shadow);
  transition: border-color .13s ease, box-shadow .13s ease, transform .13s ease;
}
.job-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 2px 4px rgba(16,24,16,.06), 0 4px 12px rgba(16,24,16,.08);
}
.job-card .grow { flex: 1; min-width: 0; }
.job-card .name { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.job-card a.name { color: var(--text); text-decoration: none; }
.job-card a.name:hover { color: var(--green-dark); }
.job-card .meta {
  color: var(--muted); font-size: 12.5px; margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Where a renamed job came from. Quieter than the meta line below it — this is
   reassurance that the plan set is still identifiable, not a fact to read every time. */
.job-card .sheet-from { font-size: 12px; opacity: .8; margin-top: 1px; }

/* The job name in the workspace topbar is the rename control. It has to look
   pressable without becoming a button in a bar that already has three. */
#jobname.renamable { cursor: pointer; border-bottom: 1px dashed rgba(255,255,255,.45); }
#jobname.renamable:hover { border-bottom-color: #fff; }
#jobname.renamable:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 3px; }

/* The delete control only appears on hover, so a list of jobs reads as jobs
   rather than as a column of red buttons. Always visible on touch. */
.job-card .danger { opacity: 0; transition: opacity .13s ease; }
.job-card:hover .danger, .job-card .danger:focus-visible { opacity: 1; }
@media (hover: none) { .job-card .danger { opacity: 1; } }
.progressbar {
  height: 6px; border-radius: 3px; background: #e3e8e3; overflow: hidden; margin-top: 8px;
}
.progressbar > div { height: 100%; background: var(--green); transition: width .5s; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  background: #ecefec;
  color: var(--muted);
  border: 1px solid transparent;
  white-space: nowrap;
}
/* A dot carries the status at a glance, so it doesn't rely on colour alone. */
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: .75;
}
.badge.ready { background: #e6f2d9; color: #33691e; border-color: #cfe4bd; }
.badge.processing { background: #fdf3d7; color: #9a6410; border-color: #f0e0b0; }
.badge.error { background: #fbe6e8; color: var(--red); border-color: #f2ccd1; }
.badge.processing::before { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .3 } 50% { opacity: 1 } }
@media (prefers-reduced-motion: reduce) {
  .badge.processing::before { animation: none; }
}

/* ---- review workspace ---- */
/* Job page: viewport-locked column layout — the page itself never scrolls;
   the rail, viewer, and panel each scroll independently. */
body.job {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.job .topbar { flex: 0 0 auto; }

.workspace {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 430px;
  flex: 1;
  height: auto;
  overflow: hidden;
}
/* min-height:0 lets each column's own overflow scrolling engage; without it a
   grid child refuses to shrink below its content and the whole page scrolls. */
.workspace > * { min-height: 0; }
.viewer { min-height: 0; }
.panel-body { min-height: 0; }
@media (max-width: 1100px) {
  .workspace { grid-template-columns: 90px minmax(0, 1fr) 320px; }
}
@media (max-width: 760px) {
  .workspace {
    grid-template-columns: 70px minmax(0, 1fr);
    grid-template-rows: minmax(0, 55%) minmax(0, 45%);
  }
  .panel { grid-column: 1 / 3; border-top: 1px solid var(--border); }
}

.rail {
  overflow-y: auto;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 8px;
}
.rail .pagethumb {
  position: relative;
  margin-bottom: 10px;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: border-color .13s ease, box-shadow .13s ease;
}
.rail .pagethumb:hover { border-color: var(--border-strong); }
.rail .pagethumb.active {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(124,179,66,.22), var(--shadow);
}
.rail .pagethumb img { width: 100%; display: block; }
/* The class chip is a button, not a caption: it is the visible way into the sheet-class
   picker, which right-click alone left unreachable on a tablet. */
.rail .pagethumb .pageclass {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(27, 94, 32, 0.85); color: #fff;
  font-size: 10.5px; padding: 4px 5px; text-transform: capitalize;
  display: block; width: 100%; border: none; border-radius: 0;
  font-weight: 600; text-align: center; cursor: pointer;
}
.rail .pagethumb .pageclass:hover { background: var(--green-dark); }
/* No class yet — read as an invitation, not as a classification. */
.rail .pagethumb .pageclass.unset {
  background: rgba(0, 0, 0, 0.55); font-weight: 500; text-transform: none;
}
/* A finger needs more than a 2px-padded strip. Only on touch, so the mouse keeps the
   slim chip that leaves the thumbnail visible. */
@media (pointer: coarse) {
  .rail .pagethumb .pageclass { padding: 8px 5px; }
}
.rail .pagethumb .pageno {
  position: absolute; top: 2px; left: 4px;
  background: rgba(0,0,0,0.55); color: #fff;
  font-size: 10.5px; padding: 1px 5px; border-radius: 4px;
}

.viewer-col { display: flex; flex-direction: column; min-width: 0; }
.toolbar {
  display: flex; align-items: center; gap: 7px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  flex-wrap: wrap;
}
.toolbar button { padding: 6px 11px; font-size: 13.5px; }
.toolbar .sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 3px; }
.toolbar .readout {
  color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px;
}
/* A scale that disagrees with the printed one must not read like the rest of the
   toolbar's quiet grey status text — "Scale set (1 pt = 0.9090 ft)" is reassuring, and
   on Harmony C-10 that number makes every area 10.7x too big. Amber, never red: which
   of the two scales is right is a question for the builder, not a fault. */
.toolbar .readout.warn { color: var(--amber); font-weight: 600; }

/* The same question, at the moment a quantity is taken. Same palette as .est-warn so
   the two read as one kind of message. */
.scale-warn {
  background: #fdf6e3; border: 1px solid #e8d49a; color: #8a5d0c;
  border-radius: var(--radius); padding: 10px 12px; margin: 0 0 12px;
  font-size: 13px; line-height: 1.5; max-width: 58ch;
}
/* The armed tool should be unmistakable — you're about to click on a drawing. */
.toolbar button.tool-active {
  background: var(--green); color: #fff; border-color: var(--green-dark);
  box-shadow: 0 0 0 3px rgba(124,179,66,.22);
}
.toolbar button.tool-active:hover { background: var(--green-dark); }

/* Markup controls: the pen's colour, and what to do with the mark in hand. */
.markup-bar { display: flex; align-items: center; gap: 7px; }
.swatches { display: inline-flex; gap: 5px; }
.swatches .swatch {
  width: 22px; height: 22px; padding: 0; border-radius: 50%;
  border: 2px solid rgba(0,0,0,.18); cursor: pointer;
}
/* The chosen colour is ringed rather than merely bordered: these are six saturated
   circles side by side, and a 1px border difference between them is not a state
   anyone can read at a glance. */
.swatches .swatch.on {
  border-color: var(--text);
  box-shadow: 0 0 0 3px rgba(0,0,0,.16);
}
.swatches .swatch:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
/* Same reasoning as the toolbar buttons: a fingertip, on a truck, wearing gloves. */
@media (pointer: coarse) {
  .swatches .swatch { width: 30px; height: 30px; }
}

/* This toolbar is where a shape is armed and, now, finished. A 27px-tall button is a
   miss waiting to happen with a work glove on, so touch gets a taller target. */
@media (pointer: coarse) {
  .toolbar button { padding: 9px 12px; }
}
/* On a phone the sheet is the point: claw the space back from the chrome around it, and
   drop the separators rather than the tools. */
@media (max-width: 760px) {
  .toolbar { gap: 5px; padding: 6px 8px; }
  .toolbar button { padding: 8px 9px; font-size: 13px; }
  .toolbar .sep { display: none; }
}

/* Find a word in the sheet set. Sits in the toolbar with the other ways of getting
   around the drawing (zoom, fit, turn) rather than with the measuring tools — it moves
   the sheet, it doesn't change the takeoff. */
.sheetsearch { display: flex; align-items: center; gap: 4px; }
.sheetsearch input {
  width: 148px; max-width: 34vw;
  padding: 5px 9px; font-size: 13.5px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
}
.sheetsearch input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

/* The answer, above the sheet. Capped in height and scrolled inside itself: a common
   word on a 28-sheet permit set lists every sheet it is on, and a list that pushed the
   drawing off the screen would make finding something cost seeing it. */
.search-results {
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  max-height: 34vh; overflow-y: auto;
}
.sr-head {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 12px; font-size: 13px; color: var(--text);
}
/* Capped: the honest answer carries what could not be searched as well as what was, so
   it is a couple of sentences long, and a couple of sentences set across a 24-inch
   monitor is a line nobody finishes reading. */
.sr-msg { flex: 1; line-height: 1.45; max-width: 96ch; }
.sr-head button { padding: 2px 8px; font-size: 13px; color: var(--muted); }
.sr-list { display: flex; flex-direction: column; }
.sr-row {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 12px; border: 0; border-top: 1px solid var(--border);
  background: none; text-align: left; font-size: 13px; cursor: pointer;
}
.sr-row:hover { background: var(--green-tint); }
/* Which sheet's marks are on the drawing right now. Clicking this row again steps to
   its next hit, so it has to be obvious which row that would be. */
.sr-row.active { background: var(--green-tint); box-shadow: inset 3px 0 0 var(--green); }
.sr-where { flex: 1; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-count { color: var(--text); font-variant-numeric: tabular-nums; }

.viewer {
  position: relative;
  flex: 1;
  overflow: auto;
  background: #888;
}
.viewer .canvas-stack { position: relative; margin: 0 auto; }
.viewer canvas { display: block; }
/* touch-action:none hands viewer.js the raw gestures instead of letting the browser
   scroll and zoom underneath it — its pointer-event pan and pinch are what replace
   them, and they have to agree with the rotation transforms to land on the right point. */
#overlay { position: absolute; top: 0; left: 0; cursor: grab; touch-action: none; }

/* Sheet-set download state. Sits over the (empty) canvas while the file streams in. */
.pdfload {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 24px; text-align: center;
  background: var(--bg); color: var(--text);
}
.pdfload-msg { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.pdfload-track {
  width: min(320px, 100%); height: 8px; border-radius: 999px;
  background: var(--border); overflow: hidden;
}
.pdfload-bar {
  height: 100%; width: 0; background: var(--green);
  transition: width .18s linear;
}

.panel {
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.tabs { display: flex; border-bottom: 1px solid var(--border); background: #eef1ee; }
.tabs button {
  flex: 1; border: none; border-radius: 0; padding: 11px 8px;
  background: transparent; font-weight: 600; color: var(--muted);
  box-shadow: inset 0 -2px 0 transparent;
  transition: color .13s ease, background .13s ease, box-shadow .13s ease;
}
.tabs button:hover { background: rgba(255,255,255,.55); color: var(--text); }
.tabs button.active {
  background: var(--panel); color: var(--green-dark);
  box-shadow: inset 0 -2px 0 var(--green);
}
.tabs button:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.panel-body { flex: 1; overflow-y: auto; padding: 12px; }

.cat-header {
  font-weight: 700; text-transform: uppercase; font-size: 11px;
  color: var(--muted); margin: 18px 0 6px; letter-spacing: .06em;
  display: flex; align-items: center; gap: 9px;
}
/* A hairline trailing the label groups the rows beneath it without a heavy divider. */
.cat-header::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}
.cat-header:first-child { margin-top: 6px; }

/* Phases / work areas. The bar manages them; the header divides the list. */
.phase-bar {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  margin: 10px 0 2px; padding: 8px 9px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
}
.phase-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted);
}
.phase-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: #fff; border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 2px 4px 2px 11px; font-size: 12.5px;
}
.phase-chip small {
  background: var(--green-tint); color: var(--green-dark); border-radius: 999px;
  padding: 0 6px; font-size: 11px; font-weight: 600;
}
.phase-chip button { padding: 1px 5px; font-size: 11px; border-radius: 999px; line-height: 1.4; }
.phase-header {
  display: flex; align-items: baseline; gap: 8px;
  margin: 20px 0 2px; padding-bottom: 4px;
  font-size: 14px; font-weight: 700; color: var(--green-dark);
  border-bottom: 2px solid var(--green);
}
.phase-header small { font-weight: 500; font-size: 12px; color: var(--muted); }
.phase-pick { font-size: 11.5px; padding: 1px 4px; max-width: 160px; }

/* Assemblies — applied kits on a job, and the kit editor on the Prices page. */
.asm-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: #fff; border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 2px 4px 2px 11px; font-size: 12.5px;
}
.asm-chip .asm-qty {
  width: 62px; font-size: 12px; padding: 1px 4px; text-align: right;
}
.asm-chip small {
  background: var(--green-tint); color: var(--green-dark); border-radius: 999px;
  padding: 0 6px; font-size: 11px; font-weight: 600;
}
.asm-chip button { padding: 1px 5px; font-size: 11px; border-radius: 999px; line-height: 1.4; }

/* Preview of what a kit will add, shown before anything is written. */
.asm-preview { margin: 10px 0 4px; border-top: 1px solid var(--border); padding-top: 8px; }
.asm-preview:empty { display: none; }
.asm-preview div {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 13px; padding: 3px 0;
}
.asm-preview b { font-variant-numeric: tabular-nums; }

#dlg-asm { width: min(860px, 95vw); max-width: min(860px, 95vw); }
.asm-comp td { padding: 3px 4px; }
.asm-comp input, .asm-comp select { width: 100%; font-size: 12.5px; padding: 3px 5px; }
.asm-comp td:last-child { width: 32px; }

/* Review gate — findings held out of the takeoff until the builder decides. Amber, not red:
   these are questions, not errors. */
.review-queue {
  border: 1px solid var(--amber); border-radius: var(--radius);
  background: #fffbf0; padding: 10px 12px; margin: 12px 0 4px;
}
.rq-head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; margin-bottom: 8px; }
.rq-head b { color: #7a5200; font-size: 13.5px; }
.rq-head .muted { font-size: 12.5px; }
.rq-row {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 10px; margin-top: 6px; font-size: 13px;
}
.rq-row .grow { flex: 1; min-width: 0; }
.rq-row button { font-size: 12px; padding: 3px 9px; }
.rq-why { font-size: 12px; color: var(--muted); margin-top: 3px; }
/* A finding that knows which sheet it came from takes you there. The affordance is the
   whole row, so it has to look like one — a chip alone reads as the only target. */
.rq-jump { cursor: pointer; transition: border-color .13s ease, box-shadow .13s ease; }
.rq-jump:hover { border-color: var(--blue); box-shadow: var(--shadow); }
.rq-jump:hover .sheetlink { background: #dce8f2; border-color: var(--blue); }

/* Recovered-after-a-crash notice, above the sheet. */
.draft-banner {
  background: #fff8e1; border-bottom: 1px solid var(--amber); color: #7a5200;
  padding: 7px 12px; font-size: 13px; cursor: pointer;
}
.draft-banner:hover { background: #fff3cd; }

/* Something the workspace needs didn't arrive. Same slot as the draft banner, but it
   carries its own retry — the whole point is not having to reload the page. */
.error-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--panel); border-bottom: 2px solid var(--red);
  color: var(--red); font-weight: 600;
  padding: 7px 12px; font-size: 13px;
}
.error-banner button { font-size: 13px; padding: 5px 12px; color: var(--text); }

/* The same idea inside the panel, where the panel's own eight fetches failed. */
.panel-error {
  border: 1px solid var(--red); border-left-width: 3px; border-radius: var(--radius);
  background: var(--panel); padding: 11px 12px; margin-bottom: 10px;
}
.panel-error p { margin: 0 0 9px; color: var(--red); font-weight: 600; font-size: 13px; }
.item-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 11px;
  margin-bottom: 6px;
  background: #fff;
  transition: border-color .13s ease, box-shadow .13s ease;
}
.item-row:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.item-row.verified { border-left: 3px solid var(--green); }
.item-row.mismatch { border-left: 3px solid var(--amber); }
.item-row .toprow { display: flex; align-items: center; gap: 8px; }
.item-row .iname { font-weight: 600; flex: 1; min-width: 0; }
.item-row .iname small { color: var(--muted); font-weight: 400; }
.item-row input.qty { width: 72px; text-align: right; }
.item-row .unit { color: var(--muted); width: 30px; }
.item-row .subrow {
  display: flex; align-items: center; gap: 6px; margin-top: 6px;
  font-size: 12px; color: var(--muted); flex-wrap: wrap;
}
.item-row .warn { color: #8a5d0c; line-height: 1.45; }
/* Sheet references are chips, not links — a row can carry six of them and
   underlined text turns the panel into a wall of blue. Not scoped to .item-row: a
   review-queue finding wears the same chip, and it means the same thing there. */
.sheetlink {
  color: var(--blue); cursor: pointer; text-decoration: none;
  background: #eaf0f6; border: 1px solid #d3e0ec;
  padding: 1px 6px; border-radius: 5px; font-size: 11px; font-weight: 600;
  white-space: nowrap; transition: background .1s ease, border-color .1s ease;
}
.sheetlink:hover { background: #dce8f2; border-color: var(--blue); }
.conf {
  font-size: 10px; padding: 2px 7px; border-radius: 999px;
  font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
}
.conf.high { background: #e6f2d9; color: #33691e; }
.conf.medium { background: #fdf3d7; color: #9a6410; }
.conf.low { background: #fbe6e8; color: var(--red); }

/* ---- estimate tab ---- */
.est-settings {
  display: flex; gap: 16px; align-items: center; margin: 10px 0 2px;
  font-size: 13px; color: var(--muted);
}
.est-settings input { width: 64px; text-align: right; }

/* Estimate lines carry a name plus qty x price = total. In a 430px panel that's
   too much for one row — the name was wrapping and clipping — so the name takes
   its own line and the figures sit beneath it, right-aligned to the total. */
.item-row[data-line] .toprow { flex-wrap: wrap; row-gap: 8px; }
.item-row[data-line] .iname {
  flex: 1 0 100%; line-height: 1.35;
}
.item-row[data-line] .iname small { display: inline; }
.item-row[data-line] .linetotal { margin-left: auto; }
.item-row[data-line] input.qtyov { width: 76px; }
.item-row[data-line] input.price { width: 84px; }

/* Competing book prices on an unpriced line — clicking one sets it. */
.price-opts { gap: 5px; }
.price-opts .opt {
  padding: 2px 9px; font-size: 12px; font-weight: 600;
  border-color: var(--border-strong); font-variant-numeric: tabular-nums;
}
.price-opts .opt:hover { background: var(--green); color: #fff; border-color: var(--green); }

.item-row.unpriced { border-left: 3px solid var(--red); background: #fff8f8; }
.item-row.unpriced input.price { border-color: var(--red); background: #fdf0f1; }
.item-row.excluded { opacity: 0.55; }
.item-row.excluded .iname { text-decoration: line-through; }
.item-row input.price { width: 86px; text-align: right; }
.item-row input.qtyov { width: 70px; text-align: right; }
.item-row .linetotal {
  min-width: 84px; text-align: right; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.est-footer {
  margin-top: 18px; border-top: 2px solid var(--green-dark); padding-top: 12px;
}
.est-tot {
  display: flex; justify-content: space-between; padding: 4px 4px; font-size: 13.5px;
  color: var(--muted);
}
.est-tot b { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }
.est-tot.grand {
  border-top: 1px solid var(--border); margin-top: 6px; padding-top: 10px;
  font-size: 15px; color: var(--green-dark); font-weight: 600;
}
.est-tot.grand b { color: var(--green-dark); font-size: 19px; letter-spacing: -0.02em; }
.est-warn {
  background: #fdf6e3; border: 1px solid #e8d49a; color: #8a5d0c;
  border-radius: var(--radius); padding: 11px 13px; margin-bottom: 10px; font-size: 13px;
  line-height: 1.5;
}
.pl-supplier {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end;
  margin-top: 14px; padding: 12px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.pl-supplier label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; color: var(--muted); font-weight: 600;
}
.pl-supplier input { width: 110px; }
.pl-supplier label:first-child { flex: 1; min-width: 180px; }
.pl-supplier label:first-child input { width: 100%; }

/* Sourcing tab: the recommendation carries the weight, the list is supporting detail. */
.src-rec {
  background: var(--green-tint); border: 1px solid #cfe0cf;
  border-radius: var(--radius-lg); padding: 14px 16px; margin: 10px 0 4px;
}
.src-rec-head {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 700;
}
.src-rec-name { font-size: 16px; font-weight: 650; color: var(--green-dark); margin-top: 3px; }
.src-rec-total {
  font-size: 24px; font-weight: 700; color: var(--green-dark);
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin: 2px 0 3px;
}
.src-rec .muted { font-size: 12.5px; }

.pl-controls {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0 6px;
}
.pl-controls label { display: flex; align-items: center; gap: 5px; font-size: 13px; }
.pl-controls input { width: 76px; }
#pl-table { max-height: 420px; }

/* Legal pages: long-form prose, so widen the measure and open up the leading. */
.legal { max-width: 760px; margin: 0 auto; }
.legal h3 { margin: 22px 0 6px; font-size: 15.5px; color: var(--green-dark); }
.legal p, .legal li { line-height: 1.65; font-size: 14.5px; }
.legal ul { margin: 6px 0 6px 18px; }
.legal li { margin-bottom: 6px; }
.legal code { background: #f2f2f2; padding: 1px 4px; border-radius: 4px; font-size: 13px; }

.qbo-row {
  display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
}
.qbo-row label { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 150px;
  font-size: 12px; color: var(--muted); }
.qbo-row #qbo-msg { flex-basis: 100%; font-size: 12.5px; }

.note-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
}
.note-row.specific { border-left: 3px solid var(--red); }
.note-row.acked { opacity: 0.6; }
.note-row .impact { color: var(--red); font-size: 12.5px; margin-top: 3px; }
.note-row .subrow { display: flex; gap: 8px; margin-top: 5px; font-size: 12px; color: var(--muted); align-items: center; }

.summary-md { line-height: 1.5; }
.summary-md h2 { font-size: 15px; color: var(--green-dark); border-bottom: 1px solid var(--border); padding-bottom: 3px; }
.summary-md li { margin: 3px 0; }

.review-progress {
  padding: 8px 10px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted);
}
.review-progress .progressbar { flex: 1; margin: 0; }

.muted { color: var(--muted); }
.mt { margin-top: 12px; }

/* Links pick up the brand rather than browser blue, and only underline on intent. */
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-dark); text-decoration: underline; }
.muted a { color: inherit; }
.muted a:hover { color: var(--green-dark); }

.empty {
  text-align: center; padding: 48px 24px; color: var(--muted);
}
.empty-mark {
  font-size: 34px; line-height: 1; margin-bottom: 10px; opacity: .55;
}
.empty p { margin: 4px auto; max-width: 46ch; }
.empty b { color: var(--text); font-size: 15px; }

/* ---- narrow screens ----------------------------------------------------- */
/* The review workspace is desktop work (drawings + measuring), so it keeps its
   three columns; everything else reflows. */
@media (max-width: 720px) {
  .container { margin: 18px auto 40px; padding: 0 14px; }
  .card { padding: 16px; border-radius: var(--radius); }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-grid label.wide { grid-column: 1; }
  .dropzone { padding: 30px 16px; }
  .job-card { flex-wrap: wrap; gap: 10px; }
  .job-card .grow { flex-basis: 100%; }
  .usage-tiles .tile { min-width: 100px; padding: 12px 10px; }
  .usage-tiles .big { font-size: 20px; }
  .topbar { padding: 10px 14px; gap: 10px; }
  .topbar > span { display: none; }   /* page label; the heading already says it */
  /* Wide tables scroll inside their card instead of stretching the page. */
  .card > .pricetable { display: block; overflow-x: auto; white-space: nowrap; }
  /* Request title gets the full width; the status select drops beneath it rather
     than squeezing the title into a one-word-per-line column. */
  .req-row .toprow { flex-wrap: wrap; }
  .req-row .rtitle { flex: 1 0 100%; order: -1; }
  .req-row .rstatus { margin-left: auto; }
  .pl-controls { gap: 8px; }
  .pl-controls #pl-summary { flex-basis: 100%; }
}

/* ---- price book page ---- */
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 22px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.card h2 {
  margin: 0 0 4px; font-size: 16.5px; color: var(--green-dark); font-weight: 650;
}
.card h2 + .muted { margin-top: 0; margin-bottom: 14px; max-width: 68ch; }
.settings-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px;
}
.settings-grid label {
  display: flex; flex-direction: column; gap: 5px; font-size: 12.5px;
  color: var(--muted); font-weight: 500;
}
.settings-grid label.wide { grid-column: 1 / 3; }
.settings-grid textarea { resize: vertical; min-height: 62px; }

.pricetable { width: 100%; border-collapse: collapse; }
.pricetable th {
  text-align: left; font-size: 11px; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--border-strong); padding: 8px; letter-spacing: .05em;
  font-weight: 700; white-space: nowrap;
}
.pricetable td {
  border-bottom: 1px solid var(--border); padding: 9px 8px; font-size: 13.5px;
  vertical-align: middle;
}
.pricetable tbody tr { transition: background .1s ease; }
.pricetable tbody tr:hover { background: var(--green-tint); }
.pricetable tbody tr:last-child td { border-bottom: none; }
/* Money reads as a column, so figures line up digit-for-digit. */
.pricetable td[style*="right"], .pricetable th[style*="right"] {
  font-variant-numeric: tabular-nums;
}

.usage-tiles { display: flex; gap: 14px; flex-wrap: wrap; }
.usage-tiles .tile {
  flex: 1; min-width: 130px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 14px; display: flex; flex-direction: column;
  gap: 3px; font-size: 12px; color: var(--muted); text-align: center;
  text-transform: uppercase; letter-spacing: .04em; font-weight: 600;
}
.usage-tiles .big {
  font-size: 24px; font-weight: 700; color: var(--green-dark);
  letter-spacing: -0.02em; text-transform: none; font-variant-numeric: tabular-nums;
}

.lastseen { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.lastseen-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700;
  color: var(--muted); margin-bottom: 8px;
}
.lastseen-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.lastseen-row:last-child { border-bottom: none; }
.lastseen-row .ls-who {
  display: flex; align-items: center; gap: 7px; min-width: 0; flex-wrap: wrap;
}
.lastseen-row .ls-email {
  font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lastseen-row .ls-when {
  color: var(--text); text-align: right; white-space: nowrap; flex-shrink: 0;
}

/* A long email plus a chip plus a relative+absolute stamp is too much for one line
   under ~400px — stack "who" above "when" instead of squeezing both to illegible
   widths. This has to come AFTER the base .lastseen-row rule above: same
   specificity, so source order decides, and a media block placed earlier in the
   file (as the shared 720px block above does) would silently lose to it. */
@media (max-width: 480px) {
  .lastseen-row { flex-direction: column; align-items: flex-start; gap: 3px; }
  .lastseen-row .ls-when { text-align: left; }
  .lastseen-row .ls-who { max-width: 100%; }
  .lastseen-row .ls-email { max-width: 100%; }
}

/* ---- AI chat widget ---- */
#chat-fab {
  position: fixed; left: 18px; bottom: 18px; z-index: 60;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--green-dark); color: #fff; border: none;
  font-size: 22px; box-shadow: 0 4px 14px rgba(0,0,0,0.25); cursor: pointer;
}
#chat-fab:hover { background: var(--green); }
#chat-panel {
  position: fixed; left: 18px; bottom: 80px; z-index: 60;
  width: min(380px, calc(100vw - 36px)); height: min(520px, calc(100vh - 120px));
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 10px 34px rgba(0,0,0,0.22);
  display: flex; flex-direction: column; overflow: hidden;
}
#chat-panel[hidden] { display: none; }
.chat-head {
  display: flex; align-items: center; gap: 8px;
  background: var(--green-dark); color: #fff; padding: 10px 12px;
}
.chat-head .muted { color: #c8e6c9; }
.chat-head button { background: transparent; border: none; color: #c8e6c9; font-size: 14px; }
#chat-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { max-width: 85%; padding: 8px 11px; border-radius: 12px; font-size: 13.5px;
  line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.chat-msg.user { align-self: flex-end; background: var(--green); color: #fff;
  border-bottom-right-radius: 4px; }
.chat-msg.bot { align-self: flex-start; background: #eef1ee; border-bottom-left-radius: 4px; }
.chat-msg.typing { color: var(--muted); }
.chat-todo {
  align-self: flex-start; font-size: 12px; background: #dcedc8; color: var(--green-dark);
  border-radius: 8px; padding: 4px 9px;
}
#chat-form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--border); }
#chat-form input { flex: 1; }

/* ---- dev requests card ---- */
.req-row { border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; margin-bottom: 7px; }
.req-row.done, .req-row.dismissed { opacity: 0.55; }
.req-row .toprow { display: flex; gap: 8px; align-items: center; }
.req-row .rtitle { font-weight: 600; flex: 1; }
.req-row .rcopy { padding: 4px 9px; font-size: 12px; opacity: 0; transition: opacity .13s ease; }
.req-row:hover .rcopy, .req-row .rcopy:focus-visible { opacity: 1; }
@media (hover: none) { .req-row .rcopy { opacity: 1; } }
.req-row .subrow { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; }
/* pre-LINE, not pre-wrap: these strings carry no newlines, and pre-wrap makes WebKit
   paint the selection across the whole line box (and out to the page width) when a drag
   overshoots the text. pre-line still honours a real line break if one ever appears. */
.req-row .detail { font-size: 13px; margin-top: 5px; white-space: pre-line; }
.kindchip { font-size: 10.5px; padding: 1px 7px; border-radius: 8px; background: #e3e8e3; color: var(--muted); text-transform: uppercase; }

dialog {
  border: 1px solid var(--border); border-radius: 10px; padding: 18px;
  /* Item names run long; without a cap a <select> stretches the dialog across the
     whole screen. */
  min-width: 320px; max-width: min(620px, 92vw);
}
dialog::backdrop { background: rgba(0,0,0,0.3); }
dialog .row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
dialog .row label { width: 110px; }

/* Multi-measure: one drawn bed, several quantities. Each row is
   [tick + name] [value] [item], so the numbers line up down the middle. */
#dlg-measure { width: min(560px, 92vw); }
#multi-rows { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; background: var(--bg); }
.mm-row { display: grid; grid-template-columns: 152px 92px 1fr; gap: 8px; align-items: center; margin: 6px 0; }
.mm-row label { display: flex; align-items: center; gap: 6px; width: auto; font-size: 13px; }
.mm-row input[type="checkbox"] { margin: 0; }
.mm-row select { min-width: 0; width: 100%; }
.mm-name { display: flex; align-items: center; gap: 5px; }
.mm-val { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }
.mm-unit { font-size: 12px; color: var(--muted); }
#mm-depth { width: 46px; }

/* Sheet-class picker: one tap target per valid class, sized for a finger in a truck. */
#dlg-pageclass { width: min(420px, 92vw); }
.pc-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.pc-opt { text-transform: capitalize; min-height: 44px; flex: 1 1 30%; }
.pc-opt.active {
  background: var(--green); color: #fff; border-color: var(--green-dark);
}
.pc-opt.active:hover { background: var(--green-dark); }

/* ---- notices: what changed since you were last here ---- */
/* A fixed overlay rather than a <dialog>: showModal()
   puts it in the top layer, where the backdrop covers everything. Above the chat widget
   (60). */
.notice-root {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 18px;
  background: rgba(16, 24, 16, .45);
}
.notice-card {
  position: relative; width: min(540px, 100%);
  max-height: calc(100vh - 36px); overflow-y: auto;
  background: var(--panel); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 20px 22px 22px;
}
/* Focused so the keyboard lands inside the card, not so it wears a ring. */
.notice-card:focus { outline: none; }
.notice-x {
  position: absolute; top: 9px; right: 9px;
  border: none; background: transparent; color: var(--muted);
  font-size: 15px; line-height: 1; padding: 6px 9px;
}
.notice-x:hover { background: var(--green-tint); color: var(--text); }
.notice-ver {
  font-size: 11px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--green-dark);
}
.notice-title { font-size: 19px; margin: 3px 42px 9px 0; color: var(--green-dark); }
.notice-body { font-size: 13.5px; line-height: 1.58; }
.notice-body p { margin: 0 0 8px; }
.notice-body p:last-child { margin-bottom: 0; }

.notice-ask { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.notice-q { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
/* wrap, so a longer answer can drop to its own line instead of overflowing the card */
.notice-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.notice-btns button { flex: 1 1 auto; }

/* On a phone the three answers stop fitting side by side well before the card does, and
   a half-wrapped row reads as two different questions. */
@media (max-width: 480px) {
  .notice-btns { flex-direction: column; }
  .notice-card { padding: 18px 16px; }
  .notice-title { font-size: 17.5px; }
}

/* An unanswered question, parked on the corner of the chat bubble (#chat-fab: bottom
   left, 52px, z-index 60) because that is already where "ask about this app" lives.
   Quiet on purpose — a mark on the screen, not an interruption. */
.notice-badge {
  position: fixed; left: 54px; bottom: 54px; z-index: 61;
  min-width: 20px; height: 20px; padding: 0 5px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--panel); border-radius: 10px;
  background: var(--amber); color: var(--panel);
  font-size: 11px; font-weight: 700; line-height: 1;
  box-shadow: var(--shadow);
}
.notice-badge:hover { background: var(--green-dark); border-color: var(--panel); }

/* A QuickBooks total that disagrees with ours. The push succeeded, so this is a
   warning rather than an error — but it must not read as a plain success line. */
#qbo-msg.qbo-mismatch {
  color: var(--amber);
  font-weight: 600;
}

/* ── "still working" indicator ────────────────────────────────────────────────
   A stage is one model call, so the percentage legitimately parks on one number
   for minutes. That looked identical to a crash. Three independent liveness
   signals answer it: a ticking clock (the honest one — a hung page cannot fake
   it), the brand leaf dancing through a SEQUENCE of moves rather than one loop,
   and a sentence saying what the AI is doing right now. */
.wk {
  position: absolute; inset: 0; z-index: 3;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: var(--bg);
}
.wk-card {
  width: min(420px, 100%);
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 26px 24px 20px;
}
/* Fixed height so swapping between moves never nudges the text below it. */
.wk-stage-mark { position: relative; height: 76px; margin-bottom: 6px; }
.wk-leaf {
  position: absolute; left: 50%; top: 50%;
  font-size: 40px; line-height: 1;
  transform: translate(-50%, -50%);
  will-change: transform;
}
.wk-stage { margin: 0 0 12px; font-weight: 600; font-size: 15.5px; }
.wk-detail { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.wk-note { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.wk-clock {
  margin: 14px 0 0;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 12.5px; color: var(--muted);
  font-variant-numeric: tabular-nums;      /* so the seconds do not jitter the line */
}
.wk-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  animation: wk-beat 1s ease-in-out infinite;
}
.wk-retrying .wk-dot { background: var(--amber); }
.wk-retrying .wk-detail { color: var(--amber); }

/* The bar keeps the real percentage as its width, but carries a travelling sheen so a
   parked number still reads as a live process. */
.wk-track {
  height: 8px; border-radius: 999px; background: var(--border);
  overflow: hidden; margin: 0 auto; width: min(320px, 100%);
}
.wk-bar {
  position: relative; overflow: hidden;
  height: 100%; background: var(--green); transition: width .5s;
}
/* The sheen rides on its own layer rather than on the fill's background. Painted into
   the fill it lightened the bar's right-hand end as it passed, so a bar genuinely at
   38% read as roughly 10% — the one element on this panel that states a real number
   was the one you could not trust. Separate layer, lower alpha: the fill stays solid
   green and only gains a highlight. */
.wk-bar::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg,
    rgba(255,255,255,0) 20%, rgba(255,255,255,.34) 50%, rgba(255,255,255,0) 80%);
  background-size: 200% 100%;
  animation: wk-sheen 1.6s linear infinite;
}

/* Two leaves drifting past behind the mark — slow and low-contrast, so they read as
   ambient motion rather than a second thing to watch. */
.wk-drift {
  position: absolute; top: 50%; left: 50%;
  font-size: 15px; opacity: .35;
  animation: wk-drift 7s linear infinite;
}
.wk-drift-2 { font-size: 11px; animation-duration: 9.5s; animation-delay: -4s; opacity: .25; }

/* The dance. One class per move; working.js swaps it every few seconds. */
.wk-hop     { animation: wk-hop 1s ease-in-out infinite; }
.wk-sway    { animation: wk-sway 1.8s ease-in-out infinite; }
.wk-spin    { animation: wk-spin 1.4s ease-in-out infinite; }
.wk-shuffle { animation: wk-shuffle 1.5s ease-in-out infinite; }
.wk-tumble  { animation: wk-tumble 2.2s ease-in-out infinite; }
.wk-wiggle  { animation: wk-wiggle .5s ease-in-out infinite; }
.wk-pulse   { animation: wk-pulse 1.6s ease-in-out infinite; }

/* Every move composes with the centring translate, or the leaf jumps to the corner the
   moment an animation takes over `transform`. */
@keyframes wk-hop {
  0%, 100% { transform: translate(-50%, -50%) scale(1, 1); }
  30%      { transform: translate(-50%, -132%) scale(.92, 1.1); }
  55%      { transform: translate(-50%, -50%) scale(1.12, .88); }
  75%      { transform: translate(-50%, -78%) scale(1, 1); }
}
@keyframes wk-sway {
  0%, 100% { transform: translate(-50%, -50%) rotate(-17deg); }
  50%      { transform: translate(-50%, -50%) rotate(17deg); }
}
@keyframes wk-spin {
  0%       { transform: translate(-50%, -50%) rotate(0deg); }
  70%,100% { transform: translate(-50%, -50%) rotate(360deg); }
}
@keyframes wk-shuffle {
  0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
  25%      { transform: translate(-124%, -50%) rotate(-14deg); }
  75%      { transform: translate(24%, -50%) rotate(14deg); }
}
@keyframes wk-tumble {
  0%       { transform: translate(-124%, -50%) rotate(0deg); }
  50%      { transform: translate(-50%, -122%) rotate(180deg); }
  100%     { transform: translate(24%, -50%) rotate(360deg); }
}
@keyframes wk-wiggle {
  0%, 100% { transform: translate(-50%, -50%) rotate(-9deg); }
  50%      { transform: translate(-50%, -50%) rotate(9deg); }
}
@keyframes wk-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50%      { transform: translate(-50%, -50%) scale(1.28); }
}
@keyframes wk-beat {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .35; transform: scale(.75); }
}
@keyframes wk-sheen { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes wk-drift {
  0%   { transform: translate(-260%, 40%) rotate(0deg); opacity: 0; }
  15%  { opacity: .35; }
  85%  { opacity: .35; }
  100% { transform: translate(180%, -150%) rotate(220deg); opacity: 0; }
}

/* The dancing leaf in a jobs-list row: same mark, no card. */
.wk-inline {
  position: static; display: inline-block; transform: none;
  font-size: 15px; margin-right: 5px; vertical-align: -1px;
}
.wk-inline.wk-hop { animation: wk-hop-inline 1s ease-in-out infinite; }
@keyframes wk-hop-inline {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  30%      { transform: translateY(-5px) scale(.92, 1.1); }
  55%      { transform: translateY(0) scale(1.12, .88); }
}

/* Motion is the decoration here; the clock and the words carry the meaning, so the
   reduced-motion path keeps those and drops the choreography entirely. */
@media (prefers-reduced-motion: reduce) {
  .wk-leaf, .wk-dot, .wk-inline {
    animation: wk-breathe 2.4s ease-in-out infinite !important;
  }
  /* The sheen moved onto its own layer, so silencing .wk-bar alone left it travelling. */
  .wk-bar::after { animation: none !important; background: none !important; }
  .wk-leaf { transform: translate(-50%, -50%); }
  .wk-drift { display: none; }
  @keyframes wk-breathe { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
}

/* The second read. Deliberately quiet when the two agree — agreement is the expected
   case and does not deserve a banner — and amber, never red, when they differ: a
   disagreement is a question for the builder, not a fault. */
.second-read {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  padding: 9px 12px; margin-top: 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); font-size: 13px;
}
.second-read.ok   { border-color: var(--green); background: var(--green-tint); }
.second-read.warn { border-color: var(--amber); background: #fdf6e7; }
.second-read.err  { border-color: var(--red); }
.second-read b { font-size: 13.5px; }
.second-read .muted { flex-basis: 100%; }

/* The drawing's count when it contradicts the schedule. The row already carries an amber
   left border; this makes the number that disagrees the thing the eye lands on. */
.item-row .subrow .differs { color: var(--amber); font-weight: 600; }


/* ---- construction: key facts strip ---------------------------------------- */
/* The answer above the list. The plans were uploaded to learn the roof pitch, so it is
   set large, in the accent colour, before any row. */
.keyfacts {
  margin: 12px 0 10px; padding: 12px 14px;
  background: var(--green-tint); border: 1px solid #d3e0ec; border-radius: var(--radius-lg);
}
.kf-main { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.kf-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.kf-value { font-size: 30px; font-weight: 700; color: var(--accent); letter-spacing: -0.02em; line-height: 1; }
.kf-value.muted { color: var(--muted); font-size: 20px; }
.kf-sub { color: var(--muted); font-size: 12.5px; }
.kf-areas { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.kf-chip {
  background: #fff; border: 1px solid var(--border); border-radius: 999px;
  padding: 3px 10px; font-size: 12.5px; font-variant-numeric: tabular-nums;
}
.kf-chip small { color: var(--muted); margin-left: 4px; }
.item-row .ispec { color: var(--accent); font-weight: 700; }

/* ---- admin page ------------------------------------------------------------- */
.container.admin .card { margin-bottom: 18px; }
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 6px 0 10px; }
.stat {
  background: var(--green-tint); border: 1px solid #d3e0ec; border-radius: var(--radius);
  padding: 10px 14px; min-width: 150px;
}
.stat b { display: block; font-size: 22px; color: var(--green-dark); letter-spacing: -0.02em; }
.stat small { color: var(--muted); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 4px 0 10px; }
.admin-table th { text-align: left; font-weight: 600; color: var(--muted); padding: 5px 6px; border-bottom: 1px solid var(--border); }
.admin-table td { padding: 5px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.card h3 { font-size: 13.5px; margin: 14px 0 4px; color: var(--green-dark); }
.card textarea { font: inherit; width: 100%; border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 7px 9px; }
.req-status { font-size: 12.5px; padding: 3px 6px; }
