/* Theme from projectlithium.co.nz (see vault/docs/website-theme.md):
   navy text, pink-red accent, Poppins headings, Source Sans body, 10px
   rounded buttons. The dark mode is built from the same navy and pink. */
:root {
  --bg: #f0f0f0;
  --surface: #ffffff;
  --text: #1c244b;
  --muted: #6d6d6d;
  --border: #e3e3e8;
  --accent: #e61a4b;
  --accent-soft: #fde8ee;
  /* Button fill: the website's accent in both modes, so white text stays readable. */
  --accent-button: #e61a4b;
  --accent-button-hover: #c9143f;
  --logo-grey: #333333;
  --error: #b42318;
  --error-soft: #fdecea;
  --warn: #9a5b00;
  --warn-soft: #fff4e0;
  --positive: #1f7a3d;
  --positive-soft: #e3f4e8;
  --radius: 10px;
  --font-body: "Source Sans 3", "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-heading: Poppins, "Source Sans 3", "Source Sans Pro", Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1329;
    --surface: #1a2142;
    --text: #eef0f7;
    --muted: #a3a8bd;
    --border: #2d3560;
    --accent: #ff5a7f;
    --accent-soft: #3b1c33;
    --logo-grey: #eef0f7;
    --error: #ff9b92;
    --error-soft: #3d1f24;
    --warn: #f3b35c;
    --warn-soft: #3a2c14;
    --positive: #6fcf8f;
    --positive-soft: #1c3325;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  padding: 20px 12px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.brand {
  display: block;
  padding: 0 12px 20px;
  text-decoration: none;
}

/* The website's wordmark: "Project" then a boxed "Li" and "thium" in the accent colour. */
.wordmark { font-family: var(--font-body); font-weight: 700; font-size: 1.375rem; line-height: 1.2; color: var(--logo-grey); white-space: nowrap; }
.wordmark .lithium { color: var(--accent); }
.wordmark .li-box { border: 2px solid var(--accent); padding: 0 4px; margin-right: 2px; }
.brand-sub { display: block; margin-top: 4px; color: var(--muted); font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.login-card .wordmark { font-size: 1.75rem; }

.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar a:not(.brand) {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
}

.sidebar a:not(.brand):hover { color: var(--text); }

.sidebar a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.content {
  flex: 1;
  padding: 32px 40px;
}

h1, h2, h3, legend { font-family: var(--font-heading); font-weight: 600; }

h1 { margin: 0 0 16px; font-size: 1.625rem; }

.placeholder { color: var(--muted); }

button {
  font: inherit;
  cursor: pointer;
}

.sidebar {
  display: flex;
  flex-direction: column;
}

.account {
  margin-top: auto;
  padding: 16px 12px 0;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
}

.account-email {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.account form { margin: 4px 0 0; }

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
}

.link-button:hover { text-decoration: underline; }

.muted { color: var(--muted); }

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 16px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.login-card h1 { margin-bottom: 4px; }

.login-card form {
  display: flex;
  flex-direction: column;
}

.login-card label {
  margin: 16px 0 6px;
  font-size: 0.875rem;
  font-weight: 600;
}

.login-card input {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.login-card input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.login-card button[type="submit"] {
  margin-top: 24px;
  padding: 11px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent-button);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 600;
}

.form-error {
  margin: 16px 0 0;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--error-soft);
  color: var(--error);
}

a { color: var(--accent); }

.button {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid var(--accent-button);
  border-radius: var(--radius);
  background: var(--accent-button);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.button:not(.secondary):not(:disabled):hover { background: var(--accent-button-hover); border-color: var(--accent-button-hover); }

.button.secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.search {
  display: flex;
  flex: 1;
  gap: 8px;
  align-items: center;
  max-width: 520px;
}

.search input,
.record-form input,
.record-form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.search input:focus,
.record-form input:focus,
.record-form textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.clear-search { font-size: 0.875rem; }

.result-count { margin: 0 0 8px; font-size: 0.875rem; }

.empty {
  padding: 32px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.data-table th,
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
}

.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--bg); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  vertical-align: 1px;
}

.pagination {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
}

.breadcrumb { margin: -8px 0 16px; font-size: 0.875rem; }
.breadcrumb a { text-decoration: none; }

.notice {
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--accent-soft);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.panel {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.panel.wide { grid-column: 1 / -1; }
.panel h2 { margin: 0 0 12px; font-size: 1rem; }
.panel h3 { margin: 16px 0 6px; font-size: 0.9375rem; }

.details {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px 12px;
  margin: 0;
}

.details dt { color: var(--muted); font-size: 0.875rem; }
.details dd { margin: 0; overflow-wrap: anywhere; }

.notes { margin: 0; white-space: pre-wrap; }

.record-form { max-width: 640px; }

.record-form fieldset {
  margin: 0 0 20px;
  padding: 16px 20px 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.record-form legend { padding: 0 6px; font-weight: 600; }

.hint { margin: 0 0 8px; font-size: 0.875rem; color: var(--muted); }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

.field { margin-bottom: 14px; }

.field label {
  display: block;
  margin-bottom: 5px;
  font-size: 0.875rem;
  font-weight: 600;
}

.optional { font-weight: 400; color: var(--muted); }

.field.has-error input,
.field.has-error textarea { border-color: var(--error); }

.field-error { margin: 5px 0 0; font-size: 0.8125rem; color: var(--error); }

.form-actions { display: flex; gap: 10px; }

.has-suggestions { position: relative; }

.address-suggestions {
  position: absolute;
  z-index: 10;
  left: 0;
  right: 0;
  margin: 4px 0 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.15);
}

.address-suggestions [role="option"] {
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
}

.address-suggestions [role="option"]:hover,
.address-suggestions [aria-selected="true"] {
  background: var(--accent-soft);
}

.search select,
.record-form select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.record-form select { width: 100%; }

.checkbox {
  display: flex;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
  font-size: 0.875rem;
}

.search:has(select) { max-width: 760px; flex-wrap: wrap; }
.search:has(select) input[type="search"] { flex: 1; min-width: 200px; width: auto; }

.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.875em; }

.badge.warn { background: var(--warn-soft); color: var(--warn); margin: 0 6px 0 0; }

.data-table tr.is-low td { background: var(--warn-soft); }
.data-table td.positive { color: var(--positive); }
.data-table td.negative { color: var(--error); }
.data-table td.wrap { white-space: normal; min-width: 160px; }

.table-wrap.flat { border: 0; border-radius: 0; background: none; }

.notice.warn { background: var(--warn-soft); color: var(--warn); }

.stat { margin: 0 0 12px; font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat.warn { color: var(--warn); }
.stat-unit { font-size: 1rem; font-weight: 400; color: var(--muted); }

.field-hint { margin: 5px 0 0; font-size: 0.8125rem; color: var(--muted); }

.panel .record-form input,
.panel .record-form select,
.panel .record-form textarea { background: var(--bg); }

.field-row.three { grid-template-columns: 1fr 1fr 2fr; }

.adjust-form { max-width: none; }

.button.small { padding: 5px 10px; font-size: 0.875rem; }

.link-button.danger { color: var(--error); }

.settings-panel { max-width: 640px; margin-bottom: 16px; }

.category-list { list-style: none; margin: 16px 0; padding: 0; }

.category-list li {
  display: grid;
  grid-template-columns: 1fr 64px 52px;
  gap: 12px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.inline-form { display: flex; gap: 8px; align-items: center; }

.inline-form input {
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.category-list .inline-form input { flex: 1; min-width: 0; }
.item-count { font-size: 0.875rem; text-align: right; }
.row-action { text-align: right; }
.add-category input { flex: 1; }

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.tabs a {
  padding: 8px 12px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
}

.tabs a[aria-current="page"] { border-bottom-color: var(--accent); color: var(--text); font-weight: 600; }

.badge.done { background: var(--positive-soft); color: var(--positive); }
/* Rush orders (to-do 39): the fixed pink filled-button colour, readable in both modes. */
.badge.rush { background: var(--accent-button); color: #fff; text-transform: uppercase; letter-spacing: 0.04em; }

.overdue { color: var(--warn); }

.title-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}
.title-actions form { margin: 0; }

.title-actions .badge { margin: 0; }
.title-actions .button { margin-left: auto; }

.lead { margin: 0 0 12px; font-size: 1.0625rem; font-weight: 600; }

.heading-note { font-size: 0.875rem; font-weight: 400; margin-left: 6px; }

.wide-form { max-width: 860px; }

.field-row.three-even { grid-template-columns: repeat(3, 1fr); }

.segmented { display: flex; gap: 16px; margin: 4px 0 14px; }
.segmented label { display: flex; gap: 6px; align-items: center; font-weight: 600; }

.rows-table { width: 100%; margin-bottom: 10px; border-collapse: collapse; }
.rows-table th { padding: 0 6px 6px 0; font-size: 0.8125rem; text-align: left; color: var(--muted); }
.rows-table td { padding: 0 6px 8px 0; }
.rows-table .qty { width: 90px; }
.rows-table .price { width: 130px; }
.rows-table .actions { width: 70px; text-align: right; }
.rows-table input, .rows-table select { width: 100%; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.stages { list-style: none; margin: 0; padding: 0; }

.stage {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.stage:last-child { border-bottom: 0; }
.stage-body { display: flex; flex-direction: column; gap: 2px; }
.stage-body .muted { font-size: 0.875rem; }

.stage-marker {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-radius: 50%;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--muted);
}

.attach-shipment-form { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-top: 12px; font-size: 0.9375rem; }
.attach-shipment { margin-top: 4px; font-size: 0.875rem; }
.attach-shipment summary { cursor: pointer; color: var(--accent); }
.attach-shipment form { display: flex; gap: 6px; margin-top: 6px; }
.attach-shipment input { width: 9em; }

.complete-through {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.9375rem;
}

.complete-through select {
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.stage.done .stage-marker { border-color: var(--positive); background: var(--positive); color: var(--surface); }
.stage.current .stage-marker { border-color: var(--accent); color: var(--accent); }
.stage.skipped { opacity: 0.55; }

.button:disabled { opacity: 0.45; cursor: not-allowed; }

.ready { white-space: nowrap; }
.ready.complete { color: var(--positive); }

.progress {
  display: block;
  width: 120px;
  height: 4px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--border);
}

.progress span { display: block; height: 100%; background: var(--positive); }

.data-table td.negative { color: var(--error); }
.data-table tfoot th, .data-table tfoot td { border-top: 1px solid var(--border); border-bottom: 0; }

.qty-input { width: 80px; }
.add-material { margin-top: 12px; flex-wrap: wrap; }
.add-material select {
  flex: 1;
  min-width: 220px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.stage-number { width: 20px; }

.notice.success { background: var(--positive-soft); color: var(--positive); }

code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.85em;
  overflow-wrap: anywhere;
}

.payment-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.payment-summary > div { display: flex; flex-direction: column; gap: 4px; }
.payment-summary .muted { font-size: 0.8125rem; }
.payment-summary strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.payment-summary .badge { align-self: flex-start; margin: 0; }

.positive-text { color: var(--positive); }
.warn-text { color: var(--warn); }

.badge.pay-paid { background: var(--positive-soft); color: var(--positive); }
.badge.pay-part-paid { background: var(--warn-soft); color: var(--warn); }
/* Red, so unpaid orders stand out (feature request #5). */
.badge.pay-unpaid { background: var(--error-soft); color: var(--error); }
.badge.pay-draft, .badge.pay-void { background: var(--border); color: var(--muted); }
.data-table .badge { margin-left: 0; }

.payment-list { list-style: none; margin: 0 0 12px; padding: 0; max-width: 320px; }
.payment-list li {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

.payment-links { margin: 0; font-size: 0.875rem; }

.title-actions .button { margin-left: 0; }
.title-actions .button:first-of-type { margin-left: auto; }

.category-list li.inactive input { color: var(--muted); }
.category-list li { grid-template-columns: 1fr 64px 80px; }

.tech-link { display: block; padding: 8px 10px; word-break: break-all; }

.settings-panel h3 { margin: 18px 0 8px; font-size: 0.9375rem; }
.settings-form { max-width: none; margin-bottom: 8px; }
.settings-form .field input { width: 100%; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 8px 0; }
.email-tools { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.email-tools .inline-form input { min-width: 220px; }

.checkbox-form { min-width: 0; }
/* A group of checkboxes inside a .field, e.g. Settings → Online sales statuses. */
.field .field-label { display: block; margin-bottom: 5px; font-size: 0.875rem; font-weight: 600; }
.checkbox-list { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.field .checkbox-list label, .field label.checkbox { display: flex; margin: 0; font-weight: 400; font-size: 0.9375rem; white-space: normal; }
.checkbox-form .checkbox { flex-direction: row; font-weight: 400; font-size: 0.9375rem; white-space: normal; }

.badge.email-sent { background: var(--positive-soft); color: var(--positive); }
.badge.email-logged { background: var(--accent-soft); color: var(--accent); }
.badge.email-skipped { background: var(--border); color: var(--muted); }
.badge.email-failed { background: var(--error-soft); color: var(--error); }

.template-links { margin: 0 0 12px; padding-left: 18px; }
.template-links li { margin: 6px 0; }

.template-card { max-width: 760px; margin-bottom: 20px; }
.template-head { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; }
.template-head h2 { margin: 0 0 4px; }
.template-head p { margin: 0; }
.email-subject { margin: 14px 0 8px; }
.email-preview {
  display: block;
  width: 100%;
  height: 620px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f0f0f0;
}
.email-preview.tall { height: 760px; }

.template-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.template-editor .record-form { max-width: none; margin: 0; }
.template-editor textarea { min-height: 300px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.875rem; }
.placeholder-list { grid-template-columns: auto 1fr; font-size: 0.8125rem; }
.text-version { margin-top: 12px; }
.text-version pre { white-space: pre-wrap; padding: 12px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); font-size: 0.8125rem; }

@media (max-width: 1000px) {
  .template-editor { grid-template-columns: 1fr; }
}

.time-list { list-style: none; margin: 0 0 12px; padding: 0; }
.time-list li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.time-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.time-main .muted { font-size: 0.8125rem; }
.time-duration { font-weight: 600; font-variant-numeric: tabular-nums; }
.time-duration.running { color: var(--positive); }

.stacked-form { display: flex; flex-direction: column; gap: 8px; min-width: 240px; }
.stacked-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8125rem; font-weight: 600; }
.stacked-form input, .stacked-form select {
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-weight: 400;
}
.stacked-form.inline-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; margin-top: 10px; }
.add-time summary { color: var(--accent); cursor: pointer; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}
.photo-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  background: var(--bg);
}
.photo-meta { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; font-size: 0.8125rem; }

.photo-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.note-form { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 12px; }
.note-form textarea {
  flex: 1; min-width: 0; resize: vertical;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text); font: inherit;
}
.note-form textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* The tech's diagnosis notes (Diagnostic orders, tech link). */
.diagnosis-form { display: flex; flex-direction: column; gap: 8px; }
.diagnosis-form label { font-weight: 600; }
.diagnosis-form p { margin: 0; }
.diagnosis-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.diagnosis-form textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.note-list { list-style: none; margin: 0; padding: 0; }
.note { padding: 10px 0; border-top: 1px solid var(--border); }
.note-meta { display: flex; gap: 12px; align-items: center; margin-top: 4px; font-size: 0.85rem; }
.tech-page .note-form { flex-direction: column; align-items: stretch; }
.used-item-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.used-item-form select { flex: 1 1 200px; min-width: 0; }
.used-item-form select, .used-item-form input {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.used-new { margin-bottom: 10px; }
.used-new summary { color: var(--accent); cursor: pointer; margin-bottom: 8px; }
.used-new .stacked-form { display: flex; flex-direction: column; gap: 10px; }
.used-new label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 0.9rem; }
.used-new-row { display: flex; gap: 12px; }
.to-approve { margin-bottom: 16px; }
.approve-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: flex-end; }
.photo-form input[name="caption"] {
  flex: 1;
  min-width: 160px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

/* Tech link pages (phone-first). */
.tech-page { background: var(--bg); }
.tech-header {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}
.tech-main { max-width: 640px; margin: 0 auto; padding: 16px; }
.tech-main h1 { margin: 8px 0 4px; }
.tech-sub { margin: 0 0 16px; }
.tech-who { display: flex; justify-content: space-between; align-items: center; font-size: 0.9375rem; }
.tech-panel { margin-bottom: 16px; }
.tech-panel .stages { margin-bottom: 12px; }
.button.big { width: 100%; padding: 14px; font-size: 1.0625rem; }
/* Fixed dark red so white text stays readable in both themes. */
.button.danger-button { background: #c62828; border-color: #c62828; }
.timer-display { margin: 0; font-size: 2.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.time-total { margin: 12px 0 0; }
.estimate-meter { margin-top: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
.estimate-figures { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; font-size: 1.05rem; }
.estimate-meter .progress { width: 100%; height: 8px; margin-top: 8px; border-radius: 4px; }
.estimate-meter.over [data-estimate-left] { color: var(--error); }
.estimate-meter.over .progress span { background: var(--error); }
.pick-list { display: flex; flex-direction: column; gap: 10px; }
.pick-button { padding: 16px; font-size: 1.125rem; }
.tech-material { grid-template-columns: 1fr; }
.tech-page .material-actions, .tech-material .inline-form { justify-content: flex-start; }

.material-list { list-style: none; margin: 0 0 8px; padding: 0; }

.material {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(150px, 1.2fr) auto;
  gap: 8px 16px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.material-item { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.material-stock { font-size: 0.8125rem; }
.material-stock .negative { color: var(--error); }
.material-actions { display: flex; gap: 12px; align-items: center; justify-content: flex-end; }
.material-ordered { display: block; margin-top: 4px; font-size: 0.8125rem; }

@media (max-width: 760px) {
  .material { grid-template-columns: 1fr; }
  .material-actions { justify-content: flex-start; }
}

.row-menu { position: relative; display: inline-block; }
.row-menu summary { color: var(--accent); cursor: pointer; list-style: none; }
.row-menu summary::-webkit-details-marker { display: none; }

.row-menu-panel {
  position: absolute;
  z-index: 5;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
  margin-top: 6px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.15);
  text-align: left;
}

.row-menu-panel label { font-size: 0.875rem; font-weight: 600; }
/* Inside a scrolling table the panel would be clipped, so it opens in place. */
.parts-ordered-menu { display: block; margin-top: 4px; font-size: 0.8125rem; }
.parts-ordered-menu .row-menu-panel { position: static; box-shadow: none; padding: 8px; }
.parts-ordered-menu .inline-form { flex-direction: column; align-items: stretch; gap: 6px; }
.parts-ordered-menu input { width: 9rem; }
.stage-names { padding: 0; }

/* Dashboard */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}
.stat-tile:hover { border-color: var(--accent); }
.stat-label { color: var(--muted); font-size: 0.875rem; }
.stat-value { font-family: var(--font-heading); font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-tile.alert { border-color: var(--warn); }
.stat-tile.alert .stat-value { color: var(--warn); }
/* The New from tile: the total links to the first feed with something new, and each feed has its own link. */
.stat-tile-link { display: flex; flex-direction: column; gap: 4px; color: inherit; text-decoration: none; }
.stat-breakdown { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 0.8125rem; }
.stat-breakdown a { color: var(--muted); text-decoration: none; white-space: nowrap; }
.stat-breakdown a:hover { color: var(--accent); }
.stat-breakdown a.has-new { color: var(--accent); font-weight: 600; }

/* Office page: the clock beside the office's tiles (2 × 2), stacked on smaller screens. */
.office-top { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: stretch; margin-bottom: 16px; }
@media (max-width: 1000px) { .office-top { grid-template-columns: minmax(0, 1fr); } }
.office-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 0; align-content: start; }
.clock-panel { margin: 0; }
.clock-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.clock-head h2 { margin: 0; }
.clock-status { display: flex; align-items: center; gap: 10px; font-family: var(--font-heading); font-size: 1.25rem; font-weight: 600; margin: 12px 0; }
.clock-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); flex: none; }
.clock-status.in .clock-dot { background: var(--positive); box-shadow: 0 0 0 4px var(--positive-soft); }
.clock-status.on-break .clock-dot { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.clock-status.out { color: var(--muted); }
.clock-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.clock-actions form { margin: 0; }
.clock-hours { display: flex; gap: 32px; margin: 0; }
.clock-hours dt { color: var(--muted); font-size: 0.875rem; }
.clock-hours dd { margin: 0; font-family: var(--font-heading); font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Two columns that stack independently, so panels of different heights
   never leave gaps: orders, parts and money on the left, a narrower side
   column for stages, timers, hours and stock. One column on smaller screens. */
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; gap: 16px; }
.dash-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 1000px) { .dashboard-grid { grid-template-columns: minmax(0, 1fr); } }
.dash-list { list-style: none; margin: 0; padding: 0; }
.dash-list li {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.dash-list li:last-child { border-bottom: 0; }
.dash-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.dash-main .muted { font-size: 0.875rem; }
.dash-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; white-space: nowrap; font-size: 0.875rem; }
.badge.plain { background: var(--border); color: var(--text); }
.dash-list .badge { white-space: nowrap; }
/* One line per row, for long lists like overdue & due soon. */
.dash-list.compact li { padding: 5px 0; }
.dash-list.compact .dash-main { flex: 1; flex-direction: row; align-items: baseline; column-gap: 10px; }
.dash-list.compact .dash-main > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-side.row { flex-direction: row; align-items: center; gap: 8px; }
.dash-list.scroll { max-height: 320px; overflow-y: auto; padding-right: 10px; }
.pickup-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0 0 16px; font-size: 0.875rem; }
.pickup-bar form { margin: 0; }
.pickup-status { display: inline-flex; align-items: center; gap: 6px; }

.stage-counts { list-style: none; margin: 0; padding: 0; }
.stage-counts li { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); }
.stage-counts li:last-child { border-bottom: 0; }
.stage-counts .count, .group-row .count, .board-col .count, .pipeline .count {
  min-width: 28px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  text-align: center;
}
.stage-counts .count.zero, .board-col .count.zero, .pipeline .count.zero { background: transparent; color: var(--muted); font-weight: 400; }

.big-figure { margin: 0 0 8px; font-family: var(--font-heading); font-size: 1.5rem; font-weight: 600; }
.big-figure .muted { font-family: var(--font-body); font-size: 0.9375rem; font-weight: 400; }
.negative-text { color: var(--error); }
.cell-sub { display: block; color: var(--muted); font-size: 0.8125rem; }

.tab-count {
  display: inline-block;
  min-width: 20px;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-button);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
}
.stat-tile.highlight { border-color: var(--accent); }
.stat-tile.highlight .stat-value { color: var(--accent); }

.feed-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; max-width: 760px; }
.feed-item { padding: 16px 20px; }
.feed-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.feed-head .badge { margin: 0 6px; }
.feed-total { font-family: var(--font-heading); font-size: 1.125rem; }
.feed-contact { margin: 8px 0; font-weight: 600; }
.feed-contact .badge { margin-left: 6px; font-weight: 600; }
.feed-email { font-weight: 400; font-size: 0.9375rem; }
.feed-lines { list-style: none; margin: 0 0 8px; padding: 0; font-size: 0.9375rem; }
.feed-lines li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border-bottom: 1px dashed var(--border); }
.feed-lines li:last-child { border-bottom: 0; }

.address-credit {
  padding: 6px 10px 2px;
  font-size: 0.75rem;
  color: var(--muted);
}

.record-form ~ .form-error,
.content > .form-error { margin: 0 0 16px; max-width: 640px; }

/* Shipping */
.record-form input[type="checkbox"], .record-form input[type="radio"] { width: auto; padding: 0; }
.record-form fieldset > .checkbox { margin: 4px 0 12px; font-size: 0.9375rem; }
.package-table .dim { width: 84px; }
.package-table .dg { width: 80px; }
.package-table .qty { width: 70px; }
.shipment-form ul.form-error { padding-left: 32px; }
.quote-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.quote {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}
.quote:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.quote-main { flex: 1; }
.quote-price { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 700px) {
  .package-table thead { display: none; }
  .package-table, .package-table tbody { display: block; }
  .package-table tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
  .package-table td, .package-table td.dim, .package-table td.qty, .package-table td.dg, .package-table td.actions { padding: 0; width: auto; min-width: 0; }
  .package-table input, .package-table select { min-width: 0; }
  .package-table td:first-child { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  .field-row, .field-row.three, .field-row.three-even { grid-template-columns: 1fr; }
  .search { max-width: none; }
  .account { margin-top: 12px; display: flex; align-items: center; gap: 12px; }
  .account form { margin: 0; }
  .layout { flex-direction: column; }
  .sidebar { width: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .brand { padding-bottom: 12px; }
  .sidebar ul { display: flex; flex-wrap: wrap; gap: 4px; }
  .content { padding: 24px 16px; }
}

/* Order type badge; the colours are settings (Settings → Order types). */
.badge.job-type { margin: 0 6px 0 0; font-weight: 600; }

/* Settings → Technician app */
.section-gap { margin-top: 24px; }
.row-actions { display: flex; gap: 12px; align-items: center; justify-content: flex-end; white-space: nowrap; }
.pairing-code { font-size: 1.25rem; letter-spacing: 0.08em; }

/* Time page */
.time-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.time-table td, .time-table th { vertical-align: top; }
.time-table .today { background: var(--accent-soft, rgba(230, 26, 75, 0.06)); }
.time-table .badge { margin: 0 0 0 4px; }
.time-row { flex-wrap: wrap; margin-top: 12px; }
.time-row label { display: flex; gap: 6px; align-items: center; font-size: 0.875rem; }
.time-row-actions { justify-content: flex-start; margin: 4px 0 0; }
.time-what { min-width: 140px; }
.table-scroll { overflow-x: auto; }

/* Suggested parts on the new-order form (public/js/material-suggestions.js). */
.material-suggestions {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
}
.material-suggestions .suggestions-title { margin: 0 0 0.25rem; font-size: 1rem; }
.suggestion-group h3 { margin: 0.75rem 0 0.25rem; font-size: 0.9rem; color: var(--muted); }
.suggestion-list { list-style: none; margin: 0; padding: 0; }
.suggestion-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0;
  border-top: 1px solid var(--border);
}
.suggestion-list li:first-child { border-top: 0; }
.suggestion-list .short { color: var(--warn); }

/* GoSweetSpot address check under address fields (public/js/address-autocomplete.js). */
.address-check { margin: 0.25rem 0 0.75rem; font-size: 0.9rem; }
.address-check.ok { color: var(--positive); }
.address-check.warn { color: var(--warn); }

/* Diag form data page (views/admin/orders/diag-data.ejs). */
.diag-record th { text-align: left; font-weight: 600; white-space: nowrap; vertical-align: top; }
.diag-json { overflow-x: auto; font-size: 0.85rem; background: var(--bg); padding: 0.75rem; border-radius: var(--radius); }
.diag-link-form { margin-top: 0.75rem; }

/* Logs on the Settings page, hidden behind a button (feature request #2). */
details.log > summary { list-style: none; display: inline-flex; cursor: pointer; }
details.log > summary::-webkit-details-marker { display: none; }
details.log[open] > summary { margin-bottom: 0.75rem; }

/* Settings → Technician app: a device's caller ID / Add orders switches. */
.device-permissions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 8px; }
.device-permissions .checkbox { margin: 0; }
/* The approved devices table wraps, so it fits the settings panel. */
.device-table td { white-space: normal; vertical-align: top; }
.device-table .cell-sub { overflow-wrap: anywhere; }
.settings-panel.wide { max-width: 900px; }
/* Settings → Timesheets: the fields in the technicians table (their form is the row's Save). */
.pay-table select, .pay-table input {
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  max-width: 100%;
}
.pay-table input[type="email"] { width: 100%; min-width: 160px; }
.pay-table .pay-rate { display: block; margin-top: 6px; }

/* CRM board (views/admin/crm/board.ejs): columns side by side, scrolling
   sideways; on a phone each column snaps into view when swiped. */
.content:has(.crm-board) { min-width: 0; }
.crm-board {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 12px;
  scroll-snap-type: x proximity;
}
.crm-column {
  flex: 0 0 272px;
  scroll-snap-align: start;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.crm-column-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2px 4px 10px; }
.crm-column-head h2 { margin: 0; font-size: 0.9375rem; }
.crm-count { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--bg); color: var(--muted); font-size: 0.75rem; font-weight: 600; text-align: center; }
.crm-cards { display: flex; flex-direction: column; gap: 8px; min-height: 48px; margin: 0; padding: 0; list-style: none; }
.crm-card {
  position: relative;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: grab;
}
.crm-card:hover { border-color: var(--muted); }
.crm-card:target { outline: 2px solid var(--accent); }
.crm-card { scroll-margin-top: 120px; }
.crm-card.archived { opacity: 0.55; }
.crm-card-ghost { opacity: 0.35; }
/* While a card is dragged, the right-hand part of every other card is a drop
   zone that merges the two (public/js/crm-board.js). */
.crm-dragging .crm-card:not(.crm-card-ghost)::after {
  content: 'Merge';
  position: absolute;
  inset: 4px 4px 4px auto;
  width: 40%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  pointer-events: none;
}
.crm-dragging .crm-card.crm-merge-target { border-color: var(--accent); }
.crm-dragging .crm-card.crm-merge-target::after {
  content: 'Drop to merge';
  border: 2px solid var(--accent);
  background: var(--surface);
  color: var(--accent);
  opacity: 0.95;
}
.crm-card-title { display: block; padding-right: 84px; color: var(--text); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.crm-card-title:hover { text-decoration: underline; }
.crm-unread { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--accent); vertical-align: 1px; }
.crm-card-line { margin: 4px 0 0; font-size: 0.8125rem; color: var(--muted); overflow-wrap: anywhere; }
.crm-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 0; }
.crm-tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--tag);
  background: color-mix(in srgb, var(--tag) 16%, transparent);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
}
.crm-tag-remove { padding: 0 0 0 4px; border: 0; background: none; color: var(--muted); font-size: 0.9375rem; line-height: 1; }
.crm-tag-remove:hover { color: var(--error); }
.crm-facts { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 6px 0 0; font-size: 0.75rem; color: var(--muted); }
.crm-facts .overdue { color: var(--error); font-weight: 600; }
.crm-facts .complete { color: var(--positive); }
.crm-card-actions { position: absolute; top: 8px; right: 10px; display: flex; align-items: baseline; gap: 10px; font-size: 0.75rem; }
.crm-card-actions .crm-done { margin: 0; }
.crm-card-actions .link-button { font-size: inherit; }
.crm-done { margin-top: 10px; }
.crm-done .hint { margin-left: 6px; }
.crm-move .row-menu-panel { min-width: 200px; }
.crm-archived-link { margin: 8px 4px 0; font-size: 0.8125rem; }
.crm-add { margin-top: 8px; }
.crm-add summary { padding: 4px; color: var(--muted); font-size: 0.875rem; cursor: pointer; list-style: none; }
.crm-add summary::-webkit-details-marker { display: none; }
.crm-add summary:hover { color: var(--text); }
.crm-add form { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.crm-add input { padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; }
.crm-add .button { align-self: flex-start; }
.crm-hint { margin-top: 8px; }
.search .checkbox { margin: 0; white-space: nowrap; }

/* CRM card page (views/admin/crm/card.ejs). */
.crm-card-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 16px; }
.crm-card-status .badge { margin: 0; }
.crm-inline { display: inline; margin: 0; }
.crm-reactivate { margin-top: 14px; }
.crm-order-list, .crm-customer-results, .crm-checklist, .crm-events { margin: 0; padding: 0; list-style: none; }
.crm-order-list li + li { margin-top: 4px; }
.crm-customer-results li { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.crm-order-results { margin: 0 0 10px; padding: 0; list-style: none; }
.crm-order-results li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 6px 0; }
.crm-order-results a.mono { white-space: nowrap; }
.crm-order-results .muted { flex-basis: 100%; padding-left: 52px; font-size: 0.9em; }
.crm-checklist { margin-bottom: 10px; }
.crm-checklist li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.crm-checklist li.done .crm-check-text { color: var(--muted); text-decoration: line-through; }
.crm-check-text { flex: 1; overflow-wrap: anywhere; }
.crm-check { padding: 0; border: 0; background: none; color: var(--text); font-size: 1.25rem; line-height: 1; }
.crm-note-form { max-width: none; }
.crm-note-form textarea { width: 100%; box-sizing: border-box; }
.crm-events { margin-top: 12px; }
.crm-event { padding: 8px 0; border-top: 1px solid var(--border); }
.crm-event p { margin: 0; }
.crm-event.note .notes { margin-top: 2px; }
.crm-event-meta { font-size: 0.8125rem; color: var(--muted); }
.crm-event-meta .crm-inline { margin-left: 8px; }
.crm-colour { width: 40px; height: 32px; padding: 0 2px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); }
.crm-columns-table td { white-space: normal; }

@media (max-width: 700px) {
  .crm-board { scroll-snap-type: x mandatory; }
  .crm-column { flex-basis: calc(100vw - 56px); }
}
.crm-stage { color: var(--text); font-weight: 600; }
.crm-stage::before { content: "● "; color: var(--accent); }
.crm-made-from-order {
  display: inline-block;
  padding: 0 6px;
  border: 1px dashed var(--muted, #6d6d6d);
  border-radius: 999px;
  color: var(--muted, #6d6d6d);
  font-size: 0.7rem;
  font-weight: 600;
  vertical-align: 1px;
}

/* CRM emails (phase 2) */
.crm-days { width: 6em; }
.crm-suggestion { margin-bottom: 16px; }
.crm-suggestion p { margin: 0 0 8px; }
.crm-suggestion .form-actions { margin: 0 0 8px; flex-wrap: wrap; }
.crm-mail { margin-bottom: 16px; }
.crm-messages { margin: 0; padding: 0; list-style: none; }
.crm-message { border-top: 1px solid var(--border); padding: 10px 0; }
.crm-message:first-child { border-top: 0; padding-top: 0; }
.crm-message.out { padding-left: 12px; border-left: 3px solid var(--accent); }
.crm-message > details > summary { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; cursor: pointer; list-style: none; }
.crm-message > details > summary::-webkit-details-marker { display: none; }
.crm-message-from { font-weight: 600; overflow-wrap: anywhere; }
.crm-message-when { font-size: 0.8125rem; }
.crm-message-snippet { flex-basis: 100%; font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-message details[open] .crm-message-snippet { display: none; }
.crm-message-meta { margin: 4px 0 8px; font-size: 0.8125rem; overflow-wrap: anywhere; }
.crm-message-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.9375rem; line-height: 1.5; }
.crm-quoted { margin-top: 8px; font-size: 0.875rem; }
.crm-drafts { margin: 16px 0; }
.crm-draft {
  border: 1px dashed var(--accent);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.crm-draft .muted { margin: 0 0 6px; font-size: 0.875rem; }
.crm-draft .button-row { margin-top: 8px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.crm-quoted summary { color: var(--muted); cursor: pointer; }
.crm-attachments { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 0; padding: 0; list-style: none; font-size: 0.875rem; }
.crm-original-actions { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 12px 0 8px; font-size: 0.875rem; }
.crm-original-frame { display: block; width: 100%; height: 70vh; min-height: 320px; border: 1px solid var(--border); border-radius: 6px; background: #fff; resize: vertical; }

/* CRM sending (phase 3) */
.crm-compose { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.crm-compose > summary { display: inline-flex; list-style: none; cursor: pointer; }
.crm-compose > summary::-webkit-details-marker { display: none; }
.crm-compose[open] > summary { margin-bottom: 12px; }
.crm-compose-form { max-width: none; }
.crm-compose-form textarea { width: 100%; box-sizing: border-box; }
.crm-draft-status { align-self: center; font-size: 0.875rem; }
.crm-attachment-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.crm-attachment-list li { display: flex; align-items: center; gap: 10px; }
.crm-attachment-list img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.crm-attachment-list span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.crm-signature { white-space: pre-wrap; }
.crm-photo-picker { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; }
.crm-photo-picker legend { padding: 0 4px; font-size: 0.875rem; }
.crm-photo-option { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 96px; font-size: 0.75rem; cursor: pointer; }
.crm-photo-option img { width: 96px; height: 72px; object-fit: cover; border-radius: 4px; }
.crm-template { margin: 8px 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; }
.crm-template > summary { cursor: pointer; }
.crm-template[open] > summary { margin-bottom: 8px; }

/* Photo popup (public/js/photo-popup.js) */
.photo-popup {
  width: min(96vw, 1100px);
  max-height: 94vh;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: var(--surface, #fff);
  color: var(--text);
  overflow: hidden;
}
.photo-popup::backdrop { background: rgb(0 0 0 / 0.7); }
.photo-popup-bar { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--border, #ddd); }
.photo-popup-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.photo-popup-count { white-space: nowrap; }
.photo-popup-close { font-size: 1.5rem; line-height: 1; background: none; border: 0; color: var(--text); cursor: pointer; padding: 0 4px; }
.photo-popup-stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 200px; background: #111; }
.photo-popup-stage img { display: block; max-width: 100%; max-height: calc(94vh - 52px); object-fit: contain; }
.photo-popup-status { position: absolute; color: #ddd; margin: 0; }
.photo-popup-prev, .photo-popup-next {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 1;
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: rgb(0 0 0 / 0.5); color: #fff; font-size: 1.75rem; line-height: 1; cursor: pointer;
}
.photo-popup-prev { left: 8px; }
.photo-popup-next { right: 8px; }

/* Settings → Server charts (src/routes/server-settings.js) */
.server-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.server-chart { margin: 0; }
.server-chart figcaption { font-weight: 600; margin-bottom: 4px; }
.server-chart svg { display: block; width: 100%; height: 120px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; }
.server-chart-line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.server-chart-limit { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }

/* Order page: Emails to customer (to-do 9) */
.email-log { list-style: none; margin: 0; padding: 0; }
.email-log > li { border-top: 1px solid var(--border); }
.email-log > li:first-child { border-top: 0; }
.email-log summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 10px 0; cursor: pointer; }
.email-log summary .muted { flex: 1 1 240px; font-size: 0.875rem; }
.badge.email-source { background: var(--border); color: var(--text); }
/* Each sender gets its own solid colour (white text, readable in light and
   dark mode), so they don't look like the pale status badges. */
.badge.email-source-app { background: #6D28D9; color: #fff; }
.badge.email-source-crm { background: #B45309; color: #fff; }
.badge.email-source-xero { background: #0E7490; color: #fff; }
.email-log-body { padding: 0 0 14px; }
.email-log-frame { width: 100%; height: 520px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }

/* Quote deposits (views/partials/_deposits.ejs, to-do 10) */
.deposit-list { list-style: none; margin: 0 0 12px; padding: 0; }
.deposit-list > li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; padding: 10px 0; border-top: 1px solid var(--border); }
.deposit-list > li:first-child { border-top: 0; }
.deposit-main { flex: 1 1 280px; }
.deposit-main p { margin: 4px 0 0; }
.deposit-actions { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.deposit-actions .small-input { width: 9em; padding: 4px 8px; }
.deposit-warn { background: var(--error-soft); border-radius: 10px; padding: 10px 12px !important; }
.crm-deposit { display: inline-block; margin-top: 4px; padding: 1px 8px; border-radius: 10px; font-size: 0.75rem; background: var(--accent-soft); color: var(--accent); }
.crm-deposit.warn { background: var(--error-soft); color: var(--error); }

/* Order page: "New stock item…" in the Materials panel (to-do 17). */
.new-stock-item { margin-top: 12px; }
.new-stock-item > summary { display: inline-flex; list-style: none; cursor: pointer; }
.new-stock-item > summary::-webkit-details-marker { display: none; }
.new-stock-item[open] > summary { margin-bottom: 12px; }
.new-stock-item .record-form { max-width: none; }
.new-stock-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 16px; }

/* Order page: courier quotes for a customer pickup (views/admin/orders/_customer-pickup.ejs). */
.pickup-quotes { border: 0; padding: 0; margin: 0 0 12px; }
.pickup-quotes legend { font-weight: 600; margin-bottom: 6px; }
.pickup-quotes label.checkbox { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; }
#customer-pickup .photo-grid figure { margin: 0; }
#customer-pickup .photo-grid figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 4px; }

/* Order page: each repair quote option on a diag order. */
.repair-quote { padding: 10px 0; border-bottom: 1px solid var(--border); margin-bottom: 10px; }

/* Liability releases (the customer's signature and the printed labels) */
.signature-image { display: block; max-width: 100%; height: 120px; padding: 6px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.release-labels { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.release-labels img { width: 260px; max-width: 100%; border: 1px solid var(--border); background: #fff; }

/* Orders list, In progress split by stage (to-do 33): sections or a board. */
.list-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; margin: 0 0 8px; }
.list-head .result-count { margin: 0; }
.view-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; font-size: 0.875rem; }
.view-toggle a { padding: 4px 14px; color: var(--muted); text-decoration: none; background: var(--surface); }
.view-toggle a + a { border-left: 1px solid var(--border); }
.view-toggle a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.data-table.grouped .group-row th { padding-top: 14px; background: var(--bg); color: var(--text); font-family: var(--font-heading); font-size: 0.9375rem; }
.data-table.grouped .group-row a { color: inherit; text-decoration: none; }
.data-table.grouped .group-row a:hover { color: var(--accent); }
.data-table.grouped .group-row .count { display: inline-block; margin-left: 6px; font-size: 0.8125rem; }
.data-table.grouped tbody tr.group-row:hover { background: var(--bg); }
.order-board { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 8px; }
.board-col { flex: 0 0 240px; display: flex; flex-direction: column; gap: 8px; padding: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.board-col.empty { flex-basis: 150px; }
.board-col h2 { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0 0 2px; font-size: 0.9375rem; }
.board-col .count { min-width: 28px; padding: 1px 8px; font-size: 0.8125rem; }
.board-card { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); text-decoration: none; font-size: 0.875rem; }
.board-card:hover { border-color: var(--accent); }
.board-card.overdue { border-left: 3px solid var(--warn); }
.board-card-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; color: var(--muted); font-size: 0.8125rem; }
.board-card-top .badge { margin: 0; }
.board-card-job { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.board-card-job .badge { margin: 0; }
.board-card-due { color: var(--muted); font-size: 0.8125rem; }
.board-card-due.overdue { color: var(--warn); font-weight: 600; }

/* Dashboard remake (2026-10-30): pipeline, Needs attention, collapsible panels, trends. */
.stat-sub { color: var(--muted); font-size: 0.8125rem; }
.pipeline { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin: 0 0 16px; }
.pipeline-stage {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: var(--radius); color: var(--text); text-decoration: none; font-size: 0.875rem;
}
.pipeline-stage:hover { border-color: var(--accent); }
.pipeline-stage.zero { border-left-color: var(--border); color: var(--muted); }
.pipeline-name { min-width: 0; line-height: 1.25; }
.pipeline .count { flex: none; min-width: 28px; padding: 1px 8px; }
#attention { border-top: 3px solid var(--accent); }
.all-clear { margin: 0; color: var(--positive); font-weight: 600; }
.attention-list { list-style: none; margin: 0; padding: 0; }
.attention-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.attention-list li:last-child { border-bottom: 0; }
.attention-list .badge { margin: 0; min-width: 9.5em; text-align: center; }
.attention-list .muted { font-size: 0.875rem; }
details.dash-panel > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 8px; }
details.dash-panel > summary::-webkit-details-marker { display: none; }
details.dash-panel > summary::before { content: '▸'; color: var(--muted); font-size: 0.875rem; transition: transform 0.15s; }
details.dash-panel[open] > summary::before { transform: rotate(90deg); }
details.dash-panel > summary h2 { flex: 1; }
details.dash-panel:not([open]) > summary h2 { margin-bottom: 0; }
.trend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 24px; }
.week-chart { margin: 0; min-width: 0; }
.week-chart figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin-bottom: 4px; font-size: 0.875rem; }
.week-chart-title { font-weight: 600; }
.chart-legend { display: inline-flex; gap: 12px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.week-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.week-chart .grid { stroke: var(--border); stroke-width: 1; }
.week-chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }
.week-chart .hit { fill: transparent; }
.week-chart .week:hover .hit { fill: var(--bg); }
.week-chart .c1 { fill: var(--chart-1); background: var(--chart-1); }
.week-chart .c2 { fill: var(--chart-2); background: var(--chart-2); }
.chart-table summary { cursor: pointer; color: var(--muted); font-size: 0.8125rem; }
:root { --chart-1: #3466d6; --chart-2: #d81b55; }
@media (prefers-color-scheme: dark) { :root { --chart-1: #5a86e8; --chart-2: #ec4f7d; } }
