/* SmartRate — standalone.
   Matched to the ticketing system's "Price a repair" screen on purpose: it is the same job, and
   two different shapes for one task is how people stop trusting either. Self-contained — no fonts
   to fetch, no build step. */

:root {
  --bg: #0b0e14;
  --panel: #141a26;
  --panel-2: #0f141e;
  --line: #232c3d;
  --text: #e6e9f0;
  --dim: #97a1b6;
  --faint: #6b7589;
  --accent: #6b8afd;
  --green: #4cc38a;
  --amber: #f5a524;
  --red: #e5484d;
  /* Text on an accent-coloured button. */
  --on-accent: #0b0e14;
  --shade: rgba(5, 8, 14, .72);
}

/* Light mode (Settings → Appearance). Same parts, lighter paint: every colour on the site comes
   from these, so nothing needs its own light version. */
html[data-theme="light"] {
  --bg: #eef1f6;
  --panel: #ffffff;
  --panel-2: #f6f8fb;
  --line: #d9dee7;
  --text: #1a2130;
  --dim: #4a5568;
  --faint: #6f7a8d;
  --accent: #3b5bdb;
  --green: #1a8f57;
  --amber: #b26a00;
  --red: #cf3b40;
  --on-accent: #ffffff;
  --shade: rgba(20, 26, 38, .45);
  color-scheme: light;
}
html:not([data-theme="light"]) { color-scheme: dark; }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.wrap { max-width: 1020px; margin: 0 auto; padding: 0 20px; }
.grow { flex: 1; }

header {
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
  margin-bottom: 24px;
}
header .wrap { display: flex; align-items: baseline; gap: 14px; }
h1 { margin: 0; font-size: 19px; letter-spacing: .3px; }
.stats { color: var(--faint); font-size: 12.5px; }
.navlink {
  color: var(--dim); text-decoration: none; font-size: 13px;
  border: 1px solid var(--line); border-radius: 7px; padding: 6px 12px;
}
.navlink:hover { color: var(--text); border-color: var(--accent); }

/* ---- settings: sections down the left, the chosen one on the right ---- */
main.settings {
  display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 26px; align-items: start;
}
.set-side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 10px; }
/* Grid children may shrink below their contents — otherwise the scrolling row of sections on a
   phone stretches the whole page sideways instead of scrolling on its own. */
.set-side, .set-main { min-width: 0; }
.set-search {
  display: flex; align-items: center; gap: 8px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2);
}
.set-search:focus-within { border-color: var(--accent); }
.set-search svg { width: 15px; height: 15px; flex: none; fill: none; stroke: var(--faint); stroke-width: 2; stroke-linecap: round; }
.set-search input { border: 0; background: transparent; padding: 10px 0; font-size: 13.5px; }
.set-search input:focus { outline: none; }
.set-nav { display: flex; flex-direction: column; gap: 2px; }
.set-nav button {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 9px 12px; border: 0; border-radius: 9px; background: transparent;
  color: var(--dim); font: inherit; font-size: 13.5px; cursor: pointer;
}
.set-nav button svg {
  width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.set-nav button:hover { color: var(--text); background: var(--panel-2); }
.set-nav button.on {
  color: var(--text); font-weight: 600;
  background: color-mix(in srgb, var(--accent) 16%, var(--panel));
}
.set-nav button.on svg { color: var(--accent); }
.set-none { margin: 4px 12px; color: var(--faint); font-size: 12.5px; }
.set-title { margin: 2px 0 16px; font-size: 22px; font-weight: 700; letter-spacing: .1px; }
.set-main .panel { margin-bottom: 16px; }
.set-main .panel-head { padding: 18px 22px 2px; }
.set-main .panel-head h3 { margin: 0; font-size: 15px; font-weight: 650; }
.panel-sub { margin: 4px 0 0; color: var(--faint); font-size: 12.5px; }
.panel-sub:empty { display: none; }
@media (max-width: 640px) {
  /* Workers: each person becomes a small card — name on top, the rest as labelled rows, the
     buttons along the bottom — instead of five columns squeezed into a phone's width. */
  table.users thead { display: none; }
  table.users, table.users tbody { display: block; }
  table.users tr {
    display: flex; flex-direction: column; gap: 6px;
    padding: 12px 0; border-top: 1px solid var(--line);
  }
  table.users tr:first-child { border-top: 0; }
  table.users td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0; border: 0; }
  table.users td:nth-child(1) { font-size: 14.5px; font-weight: 600; }
  table.users td:nth-child(2)::before { content: 'Username'; }
  table.users td:nth-child(3)::before { content: 'Role'; }
  table.users td:nth-child(4)::before { content: 'Last log-in'; }
  table.users td::before { color: var(--faint); font-size: 12.5px; font-weight: 400; }
  table.users td:nth-child(5) .acts { justify-content: flex-start; padding-top: 4px; }
  table.users td:nth-child(5):empty, table.users td:nth-child(5):has(.acts:empty) { display: none; }

  /* Labour rates: one compact row per code — the code, its description with the book rate under
     it, and your rate box on the right — instead of four columns fighting for the width. */
  table:has(#ladder) thead { display: none; }
  table:has(#ladder), #ladder { display: block; }
  #ladder tr {
    display: grid; grid-template-columns: 40px minmax(0, 1fr) 92px; align-items: center; column-gap: 10px;
    grid-template-areas: "c d r" "c b r"; padding: 9px 0; border-top: 1px solid var(--line);
  }
  #ladder tr:first-child { border-top: 0; }
  #ladder td { padding: 0; border: 0; }
  #ladder td.c { grid-area: c; }
  #ladder td.d { grid-area: d; color: var(--text); font-size: 13px; }
  #ladder td.book { grid-area: b; text-align: left; font-size: 12px; }
  #ladder td.book::before { content: 'Book '; }
  #ladder td:nth-child(4) { grid-area: r; }
  #ladder input.rate { width: 100%; }
  #ladder td.band { display: none; }

  /* Pricing models: the model and its service call on top, the markup curve full width below. */
  table:has(#models) thead { display: none; }
  table:has(#models), #models { display: block; }
  #models tr {
    display: grid; grid-template-columns: 1fr auto; row-gap: 4px; column-gap: 12px;
    grid-template-areas: "m s" "b b" "cv cv"; padding: 11px 0; border-top: 1px solid var(--line);
  }
  #models tr:first-child { border-top: 0; }
  #models td { padding: 0; border: 0; width: auto; }
  #models td:nth-child(1) { grid-area: m; }
  #models td:nth-child(2) { grid-area: s; font-weight: 600; }
  #models td:nth-child(2)::after { content: ' service call'; color: var(--faint); font-weight: 400; font-size: 12px; }
  #models td:nth-child(3) { grid-area: b; text-align: left; color: var(--faint); font-size: 12px; }
  #models td:nth-child(3)::after { content: ' brand & appliance pairs'; }
  #models td:nth-child(4) { grid-area: cv; font-size: 12px; }
}

.read-field { display: flex; flex-direction: column; gap: 3px; }
.read-field span { font-size: 12px; color: var(--dim); font-weight: 600; }
.read-field b { font-size: 15px; font-weight: 600; }
.read-field small { color: var(--faint); font-size: 12px; }

@media (max-width: 860px) {
  /* Narrow: the sections become a row of chips that scrolls sideways, above the content. */
  main.settings { grid-template-columns: 1fr; gap: 12px; }
  .set-side { position: static; }
  /* Narrow: the sections wrap onto as many lines as they need — every one visible, nothing cut
     off at the edge, no scrollbar. */
  .set-nav { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .set-nav button { width: auto; flex: 1 1 auto; justify-content: center; border: 1px solid var(--line); white-space: nowrap; padding: 8px 10px; }
  .set-nav button.on { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
}

/* ---- the bar across the logged-in pages ---- */
header.appbar { padding: 10px 0; }
header.appbar .wrap { align-items: center; gap: 16px; min-height: 40px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand .mark {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 800; letter-spacing: .5px;
}
.brand .name { font-size: 18px; font-weight: 700; letter-spacing: .2px; }
header.appbar .stats { padding-left: 14px; border-left: 1px solid var(--line); }

/* The pages, as tabs: the one you're on is filled in. */
.tabs { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.tabs a {
  color: var(--dim); text-decoration: none; font-size: 13px; font-weight: 500;
  padding: 6px 12px; border-radius: 7px; white-space: nowrap;
}
.tabs a:hover { color: var(--text); background: var(--panel); }
.tabs a.on { color: var(--text); background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; }

/* Who is logged in: initials, name, and business · role underneath. */
.acct { display: flex; align-items: center; gap: 12px; padding-left: 16px; border-left: 1px solid var(--line); }
.who-chip { display: flex; align-items: center; gap: 9px; min-width: 0; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 22%, var(--panel-2)); color: var(--accent);
  font-size: 12px; font-weight: 700; letter-spacing: .3px;
}
.who-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.who-text b { color: var(--text); font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-text small { color: var(--faint); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-text .role { font-size: 11.5px; letter-spacing: 0; text-transform: none; }
.logout {
  background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 6px 11px;
  color: var(--dim); font: inherit; font-size: 12.5px; cursor: pointer; white-space: nowrap;
}
.logout:hover { color: var(--text); border-color: var(--accent); }

@media (max-width: 900px) {
  header.appbar .stats { display: none; }
}
@media (max-width: 640px) {
  /* Phone: name and account on the first line, the tabs across the full width below. */
  header.appbar .wrap { flex-wrap: wrap; gap: 10px 12px; }
  header.appbar .grow { display: none; }
  .brand { order: 1; }
  .acct { order: 2; margin-left: auto; border-left: 0; padding-left: 0; gap: 8px; }
  .tabs { order: 3; width: 100%; }
  .tabs a { flex: 1; text-align: center; padding: 7px 6px; }
  .who-text small { display: none; }
}

/* ---- the panel, shaped like the modal ---- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 20px;
  overflow: hidden;
}
.panel-head { padding: 18px 22px 0; }
.panel-head h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: .2px; }
.panel-body { padding: 14px 22px 20px; }
.panel-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 22px; border-top: 1px solid var(--line);
  background: var(--panel-2);
}

/* section rules, as in the modal */
.form-sep {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0 12px;
  font-size: 11px; letter-spacing: .9px; text-transform: uppercase;
  color: var(--faint); font-weight: 600;
}
.form-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.form-sep:first-child { margin-top: 4px; }

.form-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px 14px; margin-bottom: 4px;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.end { justify-content: flex-end; }
.field label { font-size: 12px; color: var(--dim); font-weight: 600; }
.field label i { font-style: normal; color: var(--faint); font-weight: 400; }

input, select {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 11px;
  font: inherit;
  width: 100%;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
input::placeholder { color: var(--faint); }

.btn {
  background: var(--accent); color: var(--on-accent); border: 1px solid transparent;
  border-radius: 8px; padding: 9px 14px; font: inherit; font-weight: 650; cursor: pointer;
  white-space: nowrap;
}
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: transparent; color: var(--dim); border-color: var(--line); font-weight: 500; }
.btn.ghost:hover { color: var(--text); border-color: var(--accent); }

.note { margin: 0 0 14px; color: var(--dim); font-size: 12.5px; max-width: 72ch; }
.sub-note { margin-top: 12px; color: var(--faint); font-size: 12px; }
.actions { display: flex; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.inline { font-size: 12.5px; color: var(--faint); }
.inline.good { color: var(--green); }
.inline.warn { color: var(--amber); }

/* ---- the book's answer ---- */
.state {
  padding: 11px 14px; border-radius: 8px; font-size: 13px;
  border: 1px solid var(--line); background: var(--panel-2);
  color: var(--dim); margin: 10px 0;
}
.state.ok {
  border-color: color-mix(in srgb, var(--green) 38%, transparent);
  background: color-mix(in srgb, var(--green) 8%, transparent);
  color: var(--text);
}
.state.warn {
  border-color: color-mix(in srgb, var(--amber) 38%, transparent);
  background: color-mix(in srgb, var(--amber) 8%, transparent);
  color: var(--text);
}
.state .sub { color: var(--dim); font-size: 12.5px; margin-top: 3px; }

.choices { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.choice {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 11px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--panel-2); color: var(--text); font: inherit; font-size: 12px;
  cursor: pointer; text-align: left;
}
.choice:hover { border-color: var(--accent); }
.choice.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.choice b { font-weight: 650; }
.choice span { color: var(--dim); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choice i { font-style: normal; color: var(--faint); }

/* ---- part number suggestions ----
   Panels clip their children for the rounded corners; the lookup panel lets this list hang below. */
.panel.lookup { overflow: visible; }
.suggest-host { position: relative; }
.suggest {
  position: absolute; top: 100%; left: 0; z-index: 20;
  width: max(100%, 400px); max-width: calc(100vw - 32px);
  margin: 4px 0 0; padding: 4px; list-style: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
}
.suggest li {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1px 12px; align-items: center;
  padding: 7px 9px; border-radius: 6px; cursor: pointer; font-size: 12.5px;
}
.suggest li.on, .suggest li:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.suggest b { grid-row: 1 / span 2; font-weight: 650; font-variant-numeric: tabular-nums; }
.suggest mark { background: none; color: var(--accent); }
.suggest span, .suggest i { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest i { grid-column: 2; font-style: normal; color: var(--faint); font-size: 11.5px; }

/* ---- the part from the distributor ---- */
/* A class that sets display beats the hidden attribute, which is how an empty bordered box
   appeared under the lookup error. Stated explicitly rather than relying on order. */
[hidden] { display: none !important; }

.part-card {
  margin: 12px 0; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2);
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.part-card .who { min-width: 0; }
.part-card .who b { display: block; font-size: 13.5px; }
.part-card .who span { color: var(--faint); font-size: 12px; }
.part-card .fig { display: flex; flex-direction: column; gap: 2px; text-align: right; }
.part-card .fig span { font-size: 10px; letter-spacing: .6px; text-transform: uppercase; color: var(--faint); }
.part-card .fig b { font-variant-numeric: tabular-nums; }
.part-card .in { color: var(--green); }
.part-card .out { color: var(--red); }

/* ---- the money ---- */
.quote {
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel-2); padding: 6px 16px 12px;
}
.line { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; }
.line + .line { border-top: 1px solid var(--line); }
.line.total { font-weight: 700; font-size: 16px; padding: 12px 0 8px; }
.line.sub { color: var(--faint); font-size: 12px; border-top: none; padding: 2px 0; }

/* ---- tables ---- */
table.ladder { width: 100%; border-collapse: collapse; }
.ladder th {
  text-align: left; font-size: 11px; letter-spacing: .5px; text-transform: uppercase;
  color: var(--faint); padding: 0 12px 8px 0; font-weight: 600;
}
.ladder td { padding: 6px 12px 6px 0; border-top: 1px solid var(--line); font-size: 13px; }
.ladder .c { font-weight: 650; width: 60px; }
.ladder .d { color: var(--dim); }
.ladder .d i { font-style: normal; color: var(--faint); }
.ladder .n, .ladder th.n { text-align: right; font-variant-numeric: tabular-nums; }
.ladder .book { color: var(--faint); }
.ladder input.rate { width: 96px; padding: 5px 9px; text-align: right; font-variant-numeric: tabular-nums; }
.ladder input.rate.changed { border-color: var(--accent); }
.ladder .band { display: flex; align-items: center; gap: 8px; min-width: 180px; }
.ladder .lo { font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.ladder .track { position: relative; flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.ladder .dot {
  position: absolute; top: 50%; width: 8px; height: 8px; border-radius: 50%;
  background: var(--green); transform: translate(-50%, -50%); box-shadow: 0 0 0 2px var(--panel);
}

/* ---- the compact quote page ---- */
.panel-body.tight { padding-top: 16px; padding-bottom: 14px; }
.panel-body.tight .form-grid + .form-grid { margin-top: 10px; }
.panel-body.tight .state { margin: 8px 0; }
.panel-body.tight #answer:empty { display: none; }
/* The quote list sits straight in its own panel, like the original's table card. */
.panel > .quote-list { border: 0; border-radius: 0; background: transparent; margin: 0; padding: 0 22px; }
.panel > .quote-list .quote-empty { padding: 18px 0; }

.quote-bottom { display: flex; align-items: flex-end; gap: 20px; margin-bottom: 24px; }
.qb-fields { flex: 1; display: grid; grid-template-columns: minmax(180px, 1fr) minmax(200px, 1.3fr) auto; gap: 12px 14px; align-items: end; }

/* The total: a panel like the rest of the site, tinted with the accent so it reads as the answer,
   with the price large and green as in the original. */
.total-card {
  min-width: 320px; padding: 14px 18px 14px 20px; border-radius: 12px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 20%, var(--panel)), var(--panel) 75%);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 6px 24px color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--text);
  display: flex; flex-direction: column; justify-content: center; gap: 10px;
}
/* Before there's a price, there's no card — just the Calculate button, like every other main
   button on the site. The card appears with the total. */
.total-card:not(.has-total) { background: none; border: 0; box-shadow: none; padding: 0; }
.total-card .btn { width: 100%; }
.total-card:not(.has-total) .btn { padding: 12px 22px; font-size: 15px; }
#totalReady {
  display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 16px; row-gap: 2px;
}
#totalReady[hidden] { display: none; }
.tc-label {
  grid-column: 1; font-size: 11px; font-weight: 700; letter-spacing: .9px; text-transform: uppercase; color: var(--dim);
}
/* The amount and the ☰ share a row; the ☰ spans the card's height on the right. */
.tc-row { display: contents; }
.tc-row b {
  grid-column: 1; font-size: 30px; line-height: 1.15; font-weight: 800; letter-spacing: .2px;
  color: var(--green); font-variant-numeric: tabular-nums;
}
.tc-note { grid-column: 1; font-size: 12px; color: var(--faint); }
.tc-note a { color: var(--accent); }
.total-card.stale .tc-row b { color: var(--faint); text-decoration: line-through; text-decoration-thickness: 2px; }
.total-card.stale .tc-note { color: var(--amber); }
/* ☰ — opens the job rate details. */
.tc-menu {
  grid-column: 2; grid-row: 1 / span 3;
  width: 42px; height: 42px; padding: 12px 11px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-2);
  display: flex; flex-direction: column; justify-content: space-between;
  transition: border-color .12s, background .12s;
}
.tc-menu span { display: block; height: 2px; border-radius: 1px; background: var(--text); }
.tc-menu:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--panel-2)); }
.tc-menu:hover span { background: var(--accent); }
.tc-menu:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 860px) {
  .quote-bottom { flex-direction: column; align-items: stretch; }
  .total-card { min-width: 0; }
}
@media (max-width: 640px) {
  .qb-fields { grid-template-columns: 1fr; }
  .panel > .quote-list { padding: 0 16px; }
}

/* ---- what each distributor said about the part ---- */
.part-card { flex-direction: column; align-items: stretch; gap: 0; padding: 0 14px; }
.offer { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 11px 0; }
.offer + .offer { border-top: 1px solid var(--line); }
.offer .vendor {
  min-width: 70px; font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--dim);
}
.offer .vendor i { font-style: normal; color: var(--amber); margin-left: 4px; }
.offer.on .vendor { color: var(--accent); }
.offer .why { color: var(--faint); font-size: 12.5px; }
.offer .using { font-size: 12px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.offer .use { padding: 5px 10px; font-size: 12px; }
.ql-tr small { display: block; color: var(--faint); font-size: 11px; }

/* ---- the quote: the parts added so far ---- */
.field.wide { grid-column: span 2; }
.quote-list {
  border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2);
  padding: 0 16px; margin-bottom: 14px;
}
.quote-empty { padding: 16px 0; color: var(--faint); font-size: 13px; }
.ql-th, .ql-tr {
  display: grid; align-items: center; gap: 12px;
  grid-template-columns: minmax(140px, 2.4fr) 1.3fr 1.1fr 70px 56px 124px;
}
.ql-th {
  padding: 11px 0 9px; border-bottom: 1px solid var(--line); white-space: nowrap;
  font-size: 11px; letter-spacing: .5px; text-transform: uppercase; color: var(--faint); font-weight: 600;
}
.ql-tr { padding: 9px 0; font-size: 13.5px; }
.ql-tr + .ql-tr { border-top: 1px solid var(--line); }
.ql-job { font-weight: 600; }
.ql-tr .in { color: var(--green); font-weight: 500; }
.ql-tr .out { color: var(--red); font-weight: 500; }
.ql-qty { width: 64px; padding: 5px 8px; text-align: right; }
.ql-act { display: flex; justify-content: flex-end; gap: 6px; }
.ql-act .btn { padding: 5px 10px; font-size: 12px; }
.ql-act .btn.icon { padding: 5px 7px; line-height: 0; }
.ql-act svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* A line opened for editing: the same boxes as adding one, set into the list. */
.ql-edit {
  margin: 8px 0; padding: 14px; border: 1px solid var(--accent); border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 6%, var(--panel-2));
}
.ql-tr + .ql-edit, .ql-edit + .ql-tr { border-top: 0; }
.ql-edit .actions { display: flex; gap: 8px; margin-top: 12px; }
.auto-tag {
  margin-left: 6px; font-size: 10px; letter-spacing: .6px; font-weight: 700; color: var(--green);
}

/* ---- history ---- */
.history-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.hist-row {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: left;
  padding: 12px 16px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel-2); color: var(--text); font: inherit; cursor: pointer;
}
.hist-row:hover { border-color: var(--accent); }
.hist-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hist-main b { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-main small, .hist-who small { color: var(--faint); font-size: 12px; }
.hist-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-who { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; }
.hist-total { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; min-width: 84px; text-align: right; }
.jr-note { margin-top: 14px; color: var(--faint); font-size: 12.5px; }
.jr-note a { color: var(--accent); }
.jr-note .warn { color: var(--amber); }
#jrActions { display: flex; gap: 10px; flex-wrap: wrap; }

@media (max-width: 860px) {
  .field.wide { grid-column: span 2; }
}
@media (max-width: 640px) {
  .field.wide { grid-column: auto; }
  /* The quote list becomes a card per part, each value named, like the details box. */
  .ql-th { display: none; }
  .ql-tr { display: block; padding: 6px 0; }
  .ql-tr span {
    display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 6px 0;
  }
  /* The name pushes everything else to the right, so a value and its note stay side by side. */
  .ql-tr span::before { content: attr(data-k); color: var(--faint); font-size: 12.5px; font-weight: 400; margin-right: auto; }
  .ql-tr span small { display: inline; }
  .ql-tr .ql-act::before { content: none; }
  .ql-tr .ql-act { justify-content: flex-end; }
  .hist-row { flex-wrap: wrap; gap: 6px 12px; }
  .hist-main { flex-basis: 100%; }
  .hist-who { flex-direction: row; gap: 8px; flex: 1; justify-content: flex-start; }
  .hist-total { min-width: 0; }
}

/* ---- job rate details ----
   Built from the same parts as the rest of the site — the panel, its head and foot, the dark
   inset box the quote sits in — so it reads as part of SmartRate rather than pasted on. */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: var(--shade);
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px; overflow-y: auto;
}
body.modal-open { overflow: hidden; }
.modal-box {
  --jr-text: var(--text); --jr-dim: var(--faint); --jr-line: var(--line);
  width: 100%; max-width: 800px; margin: auto;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
  overflow: hidden;
}
.modal-box h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: .2px; }
.modal-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 0 22px; }
.modal-x {
  width: 34px; height: 34px; flex: none; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--dim);
  font-size: 22px; line-height: 1; display: grid; place-items: center; padding: 0 0 2px;
}
.modal-x:hover { color: var(--text); border-color: var(--accent); }
#jrBody { padding: 4px 22px 20px; }
.jr-meta { color: var(--faint); font-size: 12.5px; margin: 2px 0 16px; }

/* The line, in the same dark inset box as the quote on the page. */
.jr-table {
  border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2);
  padding: 0 16px;
}
.jr-th, .jr-tr {
  display: grid; align-items: center; gap: 10px;
  grid-template-columns: minmax(120px, 2fr) .5fr 1.4fr 1.2fr 1.1fr 1.1fr 1fr;
}
.jr-th {
  padding: 11px 0 9px; border-bottom: 1px solid var(--line); white-space: nowrap;
  font-size: 11px; letter-spacing: .5px; text-transform: uppercase; color: var(--faint); font-weight: 600;
}
.jr-tr { padding: 12px 0; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.jr-tr + .jr-tr { border-top: 1px solid var(--line); }
.jr-th span:nth-child(n+2), .jr-tr span:nth-child(n+2) { text-align: right; }
.jr-th span:nth-child(5), .jr-tr span:nth-child(5) { text-align: center; }
.jr-job { font-weight: 650; }

/* The breakdown, shaped like the quote's own lines, ending on the same bold total. */
.jr-sum {
  margin: 14px 0 0 auto; max-width: 380px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2);
  padding: 4px 16px 8px;
}
.jr-row { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; font-size: 13.5px; }
.jr-row + .jr-row { border-top: 1px solid var(--line); }
.jr-row span { color: var(--dim); white-space: nowrap; }
.jr-row i { display: none; }
.jr-row b { font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.jr-row.jr-total { padding: 12px 0 6px; font-size: 16px; align-items: baseline; }
.jr-row.jr-total span { color: var(--text); font-weight: 700; }
.jr-row.jr-total b { font-weight: 800; font-size: 22px; color: var(--green); }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 22px; border-top: 1px solid var(--line); background: var(--panel-2);
}

@media (max-width: 640px) {
  /* The header wraps instead of pushing the page wider than the phone — which also cut the right
     edge off anything fixed to the screen, like this box. */
  header .wrap { flex-wrap: wrap; align-items: center; gap: 8px 12px; }
  header .stats { display: none; }

  /* "More than one repair": each choice full width — the code, the whole job name wrapping
     rather than cut off, and the brand and appliance on their own line beneath. */
  .choices { flex-direction: column; }
  .choice {
    display: grid; grid-template-columns: 40px 1fr; align-items: baseline; column-gap: 8px; row-gap: 2px;
    width: 100%; padding: 9px 11px;
  }
  .choice b { grid-row: 1 / span 2; }
  .choice span { max-width: none; white-space: normal; overflow: visible; color: var(--text); }
  .choice i { grid-column: 2; font-size: 11.5px; }
  .suggest { width: 100%; }

  /* The box: nearly the full screen, compact, built to be screenshotted and sent. */
  .modal { padding: 10px; align-items: flex-start; }
  .modal-top { padding: 12px 12px 0 16px; }
  #jrBody { padding: 2px 14px 14px; }
  .jr-meta { margin-bottom: 12px; color: var(--dim); }
  .jr-table { padding: 0 12px; }
  .jr-th { display: none; }

  /* Each part on two lines: the job and its line total, then the part number, quantity × price
     and code in small print. Labour is charged once, so it lives in the breakdown below. */
  .jr-tr { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 5px; row-gap: 3px; padding: 11px 0; }
  .jr-tr .jr-job { margin-right: 7px; }
  .jr-tr span { text-align: left !important; }
  .jr-tr .jr-job { order: 1; flex: 1 1 60%; min-width: 0; font-size: 14.5px; line-height: 1.3; }
  .jr-tr span:nth-child(7) { order: 2; flex: none; font-weight: 700; font-size: 14.5px; }
  .jr-tr span:nth-child(3), .jr-tr span:nth-child(2), .jr-tr span:nth-child(4), .jr-tr span:nth-child(5) {
    font-size: 12.5px; color: var(--dim);
  }
  .jr-tr span:nth-child(3) { order: 3; flex-basis: 100%; }
  .jr-tr span:nth-child(3)::before { content: '#'; }
  .jr-tr span:nth-child(2) { order: 4; }
  .jr-tr span:nth-child(2)::after { content: ' ×'; }
  .jr-tr span:nth-child(4) { order: 5; }
  .jr-tr span:nth-child(5) { order: 6; }
  .jr-tr span:nth-child(5)::before { content: '· '; }
  .jr-tr span:nth-child(6) { display: none; }

  .jr-sum { max-width: none; margin-top: 10px; padding: 2px 12px 6px; }
  .jr-row { padding: 7px 0; font-size: 14px; }
  .jr-row span { color: var(--dim); }
  .jr-row.jr-total { padding-top: 10px; }
  .jr-row.jr-total b { font-size: 24px; }
  .jr-note { margin-top: 10px; }
  .modal-foot { padding: 10px 14px; }
}

/* ---- a setting with an explanation under it ---- */
.set-option {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 12px 14px; margin-bottom: 6px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2);
  cursor: pointer; transition: border-color .12s;
}
.set-option:hover { border-color: var(--accent); }
.set-option.locked { cursor: default; }
.set-option.locked:hover { border-color: var(--line); }
.set-option input[type='checkbox'] {
  width: 16px; height: 16px; margin: 2px 0 0; padding: 0; flex: none; accent-color: var(--accent); cursor: pointer;
}
.set-option.locked input[type='checkbox'] { cursor: default; }
.set-option .so-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.set-option .so-text b { font-size: 13.5px; font-weight: 600; color: var(--text); }
.set-option .so-text small { font-size: 12px; line-height: 1.45; color: var(--faint); }
#optionNote { display: block; min-height: 18px; margin-bottom: 10px; }

/* ---- Marcone connection ---- */
.state.status { display: flex; align-items: center; gap: 10px; margin: 0 0 4px; color: var(--text); }
.state.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.state.status.ok .dot { background: var(--green); }
.state.status.warn .dot { background: var(--amber); }
details.keys { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
details.keys summary {
  cursor: pointer; color: var(--dim); font-size: 12px; font-weight: 600;
  letter-spacing: .6px; text-transform: uppercase;
}
details.keys summary:hover { color: var(--text); }
details.keys[open] summary { margin-bottom: 12px; }

/* ---- accounts ---- */
.auth-panel { max-width: 420px; margin: 40px auto; }
.auth-panel .panel-body { display: flex; flex-direction: column; gap: 14px; }
.auth-panel .note { margin: 0; }
.auth-panel .actions { margin-top: 4px; }
.auth-switch {
  padding: 14px 22px; border-top: 1px solid var(--line); background: var(--panel-2);
  color: var(--dim); font-size: 13px; text-align: center;
}
.auth-switch a { color: var(--accent); text-decoration: none; font-weight: 600; }
.auth-switch a:hover { text-decoration: underline; }
a.home-link { text-decoration: none; }
a.home-link:hover { color: var(--dim); }

.navlink.button { background: transparent; font: inherit; font-size: 13px; cursor: pointer; }

.role { font-size: 11px; letter-spacing: .5px; text-transform: uppercase; color: var(--faint); }
.role.admin { color: var(--accent); }
.users td { vertical-align: middle; }
.users .waiting { color: var(--amber); font-weight: 600; }
.users .off { color: var(--faint); text-decoration: line-through; }
.users .acts { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.users .acts .btn { padding: 5px 10px; font-size: 12px; }
.users .acts input { width: 150px; padding: 5px 9px; }
.users select { width: auto; padding: 5px 9px; }
.btn.danger:hover { color: var(--red); border-color: var(--red); }
.table-scroll { overflow-x: auto; }

/* ---- home page ---- */
.hero { padding: 36px 0 40px; max-width: 720px; }
.eyebrow {
  margin: 0 0 12px; font-size: 11.5px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--accent); font-weight: 650;
}
.hero h2 { margin: 0 0 16px; font-size: 38px; line-height: 1.15; letter-spacing: -.3px; font-weight: 700; }
.lede { margin: 0 0 26px; color: var(--dim); font-size: 16px; line-height: 1.6; max-width: 62ch; }
.hero-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
a.btn { text-decoration: none; display: inline-block; }
.btn.big { padding: 12px 22px; font-size: 15px; }

.steps { margin: 4px 0 0; padding: 0; list-style: none; counter-reset: step;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.steps li { counter-increment: step; display: flex; flex-direction: column; gap: 6px; }
.steps li::before {
  content: counter(step);
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent);
  font-weight: 700; font-size: 13px; margin-bottom: 4px;
}
.steps b { font-size: 14px; }
.steps span { color: var(--dim); font-size: 13px; }

.features { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 9px; color: var(--dim); font-size: 13px; }
.features b { color: var(--text); font-weight: 600; }

.cta .panel-body { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 20px 22px; }
.cta b { display: block; font-size: 15px; margin-bottom: 2px; }
.foot { color: var(--faint); font-size: 12px; padding-top: 4px; padding-bottom: 32px; }

@media (max-width: 860px) {
  .steps { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .hero h2 { font-size: 28px; }
  .steps { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .form-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .ladder .band { display: none; }
}
