/* NoMissedJobs desk — styles. No external deps.
   Light theme for reading in a truck in daylight. Every text/background
   pair meets WCAG AA. Yellow buttons carry charcoal text: #242A27 on #FFCB32 = 10.3:1. */
:root {
  /* Astra's "Office on the job" kit: charcoal on yellow/chalk, yellow/chalk
     on charcoal, never yellow text on light backgrounds. */
  --nmj-navy: #242A27;          /* charcoal */
  --nmj-navy-2: #2F3632;
  --nmj-navy-3: #3D4540;
  --nmj-orange: #FFCB32;        /* worksite yellow: primary actions */
  --nmj-orange-hover: #FFD65C;  /* charcoal text 11:1 */
  --nmj-orange-ink: #242A27;    /* accents/outlines on light backgrounds stay charcoal */
  --nmj-orange-tint: #FFF6D6;

  --bg: #F3F1E9;                /* chalk */
  --panel: #FFFFFF;
  --panel-2: #F8F7F2;
  --border: #DEDBD0;
  --field-border: #7D857F;      /* 3.8:1 on white: visible form controls */
  --fg: #242A27;
  --fg-dim: #646D66;            /* supporting grey: 5.6:1 on white, 4.8:1 on chalk */
  --muted: #646D66;
  --on-dark: #F3F1E9;
  --on-dark-dim: #C9CCC5;       /* 9:1 on charcoal */
  --link: #242A27;

  --ok: #166534;     --ok-bg: #DCFCE7;     --ok-line: #86EFAC;
  --warn: #92400E;   --warn-bg: #FEF3C7;   --warn-line: #FCD34D;
  --danger: #B91C1C; --danger-bg: #FEE2E2; --danger-line: #FCA5A5;
  --neutral: #3D4540; --neutral-bg: #ECEAE2;

  --radius: 12px;
  --radius-sm: 8px;
  --gap: 16px;
  --tap: 44px;
  --shadow: 0 1px 2px rgba(36, 42, 39, 0.06), 0 1px 3px rgba(36, 42, 39, 0.05);
  --sans: Helvetica, Arial, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--fg);
  font: 15px/1.5 var(--sans);
  overflow-wrap: break-word;
}
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--nmj-navy); }
code, pre { font-family: var(--mono); }
img, svg, audio, video { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; color: var(--fg); }
h1 { font-size: 26px; margin: 0; letter-spacing: -0.3px; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 18px 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--fg-dim); }
.hint { color: var(--fg-dim); font-size: 13px; margin-top: 4px; }
.hint.center, .center { text-align: center; }
.lead { font-size: 17px; font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* focus: always visible, AA against light and navy backgrounds */
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--nmj-orange-ink); outline-offset: 2px; border-radius: 4px; }
#topbar :focus-visible, .auth-page :focus-visible, .line-card :focus-visible { outline-color: var(--nmj-orange); }
main:focus { outline: none; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 2000;
  background: var(--nmj-orange); color: var(--nmj-navy); font-weight: 700;
  padding: 10px 14px; border-radius: var(--radius-sm); text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ------------------------------------------------------------------ */
/* brand                                                               */
/* ------------------------------------------------------------------ */
.wordmark { display: inline-flex; align-items: center; line-height: 0; }
.wordmark-full { height: 38px; width: auto; display: block; }   /* 186px wide: kit minimum is 180 */
.wordmark-symbol { display: none; height: 32px; width: 32px; border-radius: 6px; }

/* ------------------------------------------------------------------ */
/* top bar + nav                                                       */
/* ------------------------------------------------------------------ */
#topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--nmj-navy); color: var(--on-dark);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 8px rgba(36, 42, 39, 0.25);
}
.topbar-row {
  display: flex; align-items: center; gap: 16px;
  max-width: 1200px; margin: 0 auto; padding: 10px 24px;
}
.brand-link { display: inline-flex; align-items: center; min-height: var(--tap); border-radius: 6px; }
.who {
  color: var(--on-dark-dim); font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
  padding-left: 16px; border-left: 1px solid var(--nmj-navy-3);
}
.who:empty { display: none; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.nav-toggle {
  display: none; align-items: center; gap: 8px;
  min-height: var(--tap); padding: 0 14px; border-radius: var(--radius-sm);
  background: var(--nmj-navy-2); color: var(--on-dark); border: 1px solid var(--nmj-navy-3);
  font: inherit; font-weight: 700; cursor: pointer;
}
#nav {
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: thin;
  max-width: 1200px; margin: 0 auto; padding: 0 16px;
}
#nav a {
  flex: 0 0 auto; display: inline-flex; align-items: center; min-height: var(--tap);
  padding: 0 12px; color: var(--on-dark-dim); text-decoration: none; font-weight: 600; font-size: 14px;
  border-bottom: 3px solid transparent;
}
#nav a:hover { color: #FFFFFF; }
#nav a.active { color: #FFFFFF; border-bottom-color: var(--nmj-orange); }
#nav a.nav-cross { margin-left: auto; color: var(--on-dark-dim); font-weight: 500; }
#nav .nav-logout { display: none; }

/* ------------------------------------------------------------------ */
/* layout                                                              */
/* ------------------------------------------------------------------ */
main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 24px 24px 48px; }
#footer {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px;
  padding: 16px 24px; border-top: 1px solid var(--border); color: var(--fg-dim); font-size: 13px;
}
#footer a { color: var(--fg-dim); }

.page.narrow { max-width: 820px; }   /* settings forms read better at a comfortable width */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.page-head-text { flex: 1 1 280px; min-width: 0; }
.page-head-text p { margin: 4px 0 0; }
.back-link {
  display: inline-flex; align-items: center; min-height: 36px; margin-bottom: 4px;
  color: var(--fg-dim); font-weight: 600; text-decoration: none;
}
.back-link:hover { color: var(--fg); text-decoration: underline; }

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: var(--gap); box-shadow: var(--shadow); min-width: 0;
}
.card.flush { padding: 0; overflow: hidden; }
.card, .field, .banner, .line-card { scroll-margin-top: 84px; }
.card.loading { color: var(--fg-dim); }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.card-link { font-weight: 600; }
.grid { display: grid; gap: var(--gap); }
.grid > .card { margin-bottom: 0; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); margin-bottom: var(--gap); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions-row { margin-top: 14px; }
.flash { animation: flash 2.4s ease-out; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.45); } 100% { box-shadow: none; } }

/* ------------------------------------------------------------------ */
/* buttons                                                             */
/* ------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 16px;
  background: var(--nmj-orange); color: var(--nmj-navy);
  border: 1px solid var(--nmj-orange); border-radius: var(--radius-sm);
  font: inherit; font-weight: 700; line-height: 1.2; text-decoration: none; text-align: center;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--nmj-orange-hover); border-color: var(--nmj-orange-hover); color: var(--nmj-navy); }
.btn:disabled, .btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-ghost { background: var(--panel); color: var(--fg); border-color: var(--field-border); }
.btn-ghost:hover { background: var(--panel-2); color: var(--fg); border-color: var(--nmj-navy); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #FFFFFF; }
.btn-danger:hover { background: #991B1B; border-color: #991B1B; color: #FFFFFF; }
.btn-warn { background: #FBBF24; border-color: #FBBF24; color: var(--nmj-navy); }
.btn-on-dark { background: transparent; color: #FFFFFF; border-color: #C9CCC5; }
.btn-on-dark:hover { background: var(--nmj-navy-2); color: #FFFFFF; border-color: #FFFFFF; }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 13.5px; }
.btn-block { width: 100%; min-height: 48px; font-size: 16px; }
.link-btn {
  background: none; border: 0; padding: 8px 0; min-height: var(--tap);
  color: var(--link); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer;
}
.link-btn.on-dark { color: var(--on-dark-dim); }
.link-btn.on-dark:hover { color: #FFFFFF; }

/* ------------------------------------------------------------------ */
/* badges                                                              */
/* ------------------------------------------------------------------ */
.badges { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.badge {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; line-height: 1.5; white-space: nowrap; border: 1px solid transparent;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.badge.danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.badge.neutral { background: var(--neutral-bg); color: var(--neutral); border-color: var(--border); }

/* ------------------------------------------------------------------ */
/* forms                                                               */
/* ------------------------------------------------------------------ */
label { display: block; font-size: 14px; font-weight: 600; color: var(--fg); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px;
  background: #FFFFFF; color: var(--fg);
  border: 1px solid var(--field-border); border-radius: var(--radius-sm);
  font: inherit; font-size: 15px;
}
input::placeholder, textarea::placeholder { color: #64748B; }
input:focus, select:focus, textarea:focus { border-color: var(--nmj-orange-ink); box-shadow: 0 0 0 3px rgba(194, 65, 12, 0.18); outline: none; }
input:disabled, select:disabled, textarea:disabled { background: var(--panel-2); color: var(--fg-dim); }
input[type="checkbox"], input[type="radio"] {
  width: 20px; height: 20px; min-height: 0; margin: 0; padding: 0; flex: 0 0 auto;
  accent-color: var(--nmj-orange-ink); box-shadow: none;
}
input[type="color"] { padding: 4px; height: 42px; }
textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-size: 14px; font-weight: 600; padding: 0; margin-bottom: 6px; }
.field { margin-bottom: 16px; min-width: 0; }
.field-row { display: flex; flex-wrap: wrap; gap: 0 12px; }
.field-row > .field { flex: 1 1 200px; }
.field-error { color: var(--danger); font-size: 13.5px; font-weight: 600; margin-top: 6px; }
.has-error input:not([type="checkbox"]):not([type="radio"]), .has-error select, .has-error textarea { border-color: var(--danger); }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.form-alert {
  background: var(--danger-bg); color: #7F1D1D; border: 1px solid var(--danger-line);
  border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 16px; font-size: 14px;
}
.form-alert p { margin: 0 0 4px; font-weight: 700; }
.form-alert ul { margin: 4px 0 0; padding-left: 18px; }
.form-alert .link-btn { color: #7F1D1D; padding: 4px 0; min-height: 0; }

.check {
  display: inline-flex; align-items: center; gap: 10px; min-height: 40px;
  font-weight: 500; margin: 0; cursor: pointer;
}
.check-row { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-bottom: 12px; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 10px; min-height: 48px; margin: 0;
  padding: 10px 12px; border: 1px solid var(--field-border); border-radius: var(--radius-sm);
  background: #FFFFFF; font-weight: 600; cursor: pointer;
}
.choice:has(input:checked) { border-color: var(--nmj-orange-ink); background: var(--nmj-orange-tint); box-shadow: inset 0 0 0 1px var(--nmj-orange-ink); }
.has-error .choice { border-color: var(--danger); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 72px; }
.pw-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  min-height: 36px; min-width: 60px; padding: 0 10px;
  background: none; border: 0; border-radius: 6px; color: var(--link); font: inherit; font-weight: 700; cursor: pointer;
}
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 12px; }
.inline-form > .field { flex: 1 1 160px; }
.inline-form > .btn { margin-bottom: 16px; }
.inline-edit { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.inline-edit input { flex: 1 1 160px; min-height: 36px; }
details.advanced { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 14px; margin: 8px 0 16px; background: var(--panel-2); }
details.advanced[open] { padding-bottom: 4px; }
details > summary { cursor: pointer; font-weight: 600; min-height: var(--tap); display: flex; align-items: center; gap: 10px; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after {
  content: ""; flex: 0 0 auto; width: 8px; height: 8px; margin: 0 4px 3px auto;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg);
  transition: transform 0.15s ease;
}
details[open] > summary::after { transform: rotate(-135deg); margin-bottom: -3px; }
details.advanced > summary { color: var(--fg-dim); }

/* ------------------------------------------------------------------ */
/* tables (stack into cards on phones; overflow scrolls in the box)    */
/* ------------------------------------------------------------------ */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
th {
  background: var(--panel-2); color: var(--fg-dim); font-weight: 700; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.cell-primary { font-weight: 600; white-space: nowrap; }
td.cell-primary a { color: var(--fg); }
td.cell-primary a:hover { color: var(--link); }
td.cell-wrap { min-width: 180px; overflow-wrap: anywhere; }
table:not(.stack) td { white-space: nowrap; }            /* operator tables scroll sideways instead */
table:not(.stack) td.cell-wrap { white-space: normal; min-width: 220px; }
.cell-sub { display: block; color: var(--fg-dim); font-size: 13px; white-space: nowrap; }
td.actions { white-space: nowrap; }
td.actions .btn + .btn { margin-left: 6px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--nmj-orange-tint); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: middle; border: 1px solid rgba(11, 31, 51, 0.2); }
.msg-text { white-space: pre-wrap; }
.photo-link { display: inline-block; margin: 4px 10px 0 0; font-weight: 600; }
.card > .table-wrap:not(:first-child) { margin-top: 4px; }

/* ------------------------------------------------------------------ */
/* toasts                                                              */
/* ------------------------------------------------------------------ */
#toast-region {
  position: fixed; top: 14px; right: 14px; z-index: 1000;
  display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 28px));
}
.toast {
  padding: 12px 14px; border-radius: var(--radius-sm); cursor: pointer;
  background: var(--nmj-navy); color: #FFFFFF; font-size: 14px; font-weight: 500;
  border-left: 5px solid var(--on-dark-dim); box-shadow: 0 6px 20px rgba(11, 31, 51, 0.3);
}
.toast.error { border-left-color: #F87171; }
.toast.ok { border-left-color: #4ADE80; }

/* ------------------------------------------------------------------ */
/* shared bits                                                         */
/* ------------------------------------------------------------------ */
.empty-state { text-align: center; padding: 18px 8px; }
.empty-title { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.callout { padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); margin: 0 0 16px; }
.callout.warn { background: var(--nmj-orange-tint); border-color: #FDBA74; color: #7C2D12; }
.callout.warn .hint { color: #7C2D12; }
.callout.danger { background: var(--danger-bg); border-color: var(--danger-line); color: #7F1D1D; }
.callout strong { display: block; margin-bottom: 6px; }
.callout p:last-child { margin-bottom: 0; }
.banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  padding: 14px 16px; border-radius: var(--radius); margin-bottom: var(--gap); border: 1px solid;
}
.banner p { margin: 0; flex: 1 1 260px; }
.banner.warn { background: var(--warn-bg); border-color: var(--warn-line); color: #78350F; }
.banner.danger { background: var(--danger-bg); border-color: var(--danger-line); color: #7F1D1D; }
.item-list { list-style: none; margin: 0; padding: 0; }
.item-list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.item-list li:first-child { border-top: 0; padding-top: 0; }
.item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; text-decoration: none; color: var(--fg); min-height: var(--tap); justify-content: center; }
.item-main:hover .item-title { color: var(--link); text-decoration: underline; }
.item-title { font-weight: 700; }
.item-sub { color: var(--fg-dim); font-size: 14px; overflow-wrap: anywhere; }
.plain-list { margin: 0; padding-left: 18px; }
.plain-list li { margin-bottom: 8px; }
.steps-inline { padding-left: 20px; color: var(--fg-dim); }
.steps-inline li { margin-bottom: 4px; }
pre, .report {
  white-space: pre-wrap; overflow-wrap: anywhere; margin: 0;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; font-size: 13px; max-height: 420px; overflow: auto; color: var(--fg);
}
details.playbook { border-top: 1px solid var(--border); }
details.playbook pre { margin-bottom: 12px; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 14px 0 0; }
dl.kv dt { color: var(--fg-dim); font-weight: 600; }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
dl.kv.totals { max-width: 420px; }
dl.kv.totals dd { text-align: right; font-variant-numeric: tabular-nums; }
dl.kv .total { font-weight: 800; font-size: 17px; color: var(--fg); border-top: 1px solid var(--border); padding-top: 8px; }
.quote-out { margin-top: 12px; }

/* KPI tiles */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 12px; margin-bottom: var(--gap); }
.kpi-grid > .card { margin-bottom: 0; }
.kpi { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--fg); }
a.kpi:hover { border-color: var(--nmj-orange-ink); }
.kpi .num { font-size: 30px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi .label { color: var(--fg-dim); font-size: 13px; font-weight: 600; }
.kpi .sub { color: var(--fg-dim); font-size: 13px; }
.kpi.danger { border-color: var(--danger-line); background: var(--danger-bg); }
.kpi.danger .num { color: var(--danger); }

/* Your NoMissedJobs line */
.line-card {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px;
  background: var(--nmj-navy); color: #FFFFFF; border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: var(--gap);
}
.line-main { flex: 1 1 320px; min-width: 0; }
.line-title { margin: 0; font-size: 16px; font-weight: 600; color: var(--on-dark-dim); }
.line-number { display: inline-block; color: #FFFFFF; font-size: 26px; font-weight: 800; letter-spacing: 0.3px; text-decoration: none; white-space: nowrap; }
.line-number:hover { color: var(--nmj-orange); }
.line-hint { margin: 4px 0 0; color: var(--on-dark-dim); font-size: 14px; }
.line-pending { margin: 4px 0 0; color: #FFFFFF; font-size: 17px; font-weight: 700; }
.line-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.line-card.pending { border-left: 6px solid var(--nmj-orange); }

/* Seasonal contracts: phone-sized cards and a persistent next action. */
.contract-card { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px; margin-bottom: 10px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.contract-card h3 { margin: 0; font-size: 17px; }
.contract-card-main { flex: 1 1 220px; min-width: 0; }
.contract-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.contract-price, .contract-summary { margin: 6px 0 0; font-weight: 700; }
.chip-status { display: inline-flex; align-items: center; min-height: 28px; padding: 2px 10px; border-radius: 999px; background: var(--neutral-bg); font-size: 13px; font-weight: 700; }
.contract-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.contract-total { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; border-left: 5px solid var(--nmj-orange); }
.contract-total-value { font-size: 22px; }
.contract-upgrade { border-top: 4px solid var(--nmj-orange); }
.contract-upgrade .row { align-items: center; }
.contract-checklist ol { margin: 0; padding-left: 24px; }
.contract-add-row { margin: 0 0 12px; }
.chip-filter { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.chip-filter .btn { min-height: var(--tap); }
.chip-filter .selected { background: var(--nmj-orange-tint); border-color: var(--nmj-orange-ink); }
.contract-list { margin-bottom: 20px; }
.contract-default-editor { width: 100%; padding-top: 14px; border-top: 1px solid var(--border); }
.contract-import-preview { margin: 12px 0; max-height: 240px; overflow: auto; }
.contract-preview-list { list-style: none; padding: 0; margin: 0; }
.contract-preview-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.contract-preview-list .has-error { color: var(--danger); }
.next-bar { position: sticky; bottom: 10px; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 16px; padding: 12px; background: var(--nmj-navy); color: var(--on-dark); border-radius: var(--radius); box-shadow: 0 4px 18px rgba(36, 42, 39, .28); }
.next-bar strong { flex: 1 1 180px; }
.next-bar .btn { min-height: 44px; }
@media (max-width: 720px) { .contract-card { padding: 14px; } .contract-actions { width: 100%; } .contract-actions .btn { min-height: 44px; flex: 1 1 120px; } .next-bar { margin: 12px 16px; } }

/* Getting started */
.setup-card { border-top: 4px solid var(--nmj-orange); }
.progress { height: 8px; background: var(--neutral-bg); border-radius: 999px; overflow: hidden; margin-bottom: 14px; }
.progress > span { display: block; height: 100%; background: var(--nmj-orange); border-radius: 999px; }
.setup-list { list-style: none; margin: 0; padding: 0; }
.setup-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.setup-item:first-child { border-top: 0; padding-top: 4px; }
.setup-icon { flex: 0 0 24px; line-height: 0; margin-top: 1px; }
.setup-text { flex: 1; min-width: 0; }
.setup-title { margin: 0; font-weight: 700; }
.setup-desc { margin: 2px 0 0; color: var(--fg-dim); font-size: 14px; }
.setup-item.done { padding: 8px 0; }
.setup-item.done .setup-title { font-weight: 500; color: var(--fg-dim); }
.setup-item > .btn { flex: 0 0 auto; align-self: center; }

/* Receptionist on/off */
.mode-options { display: grid; gap: 8px; }
.mode-option {
  display: flex; align-items: flex-start; gap: 12px; margin: 0; padding: 12px;
  border: 1px solid var(--field-border); border-radius: var(--radius-sm); cursor: pointer; font-weight: 400;
}
.mode-option input { margin-top: 2px; }
.mode-option.selected { border-color: var(--nmj-orange-ink); background: var(--nmj-orange-tint); box-shadow: inset 0 0 0 1px var(--nmj-orange-ink); }
.mode-text { display: flex; flex-direction: column; font-size: 14px; color: var(--fg-dim); }
.mode-text strong { color: var(--fg); font-size: 15px; }
.mode-options:disabled .mode-option { opacity: 0.7; cursor: progress; }

/* Emergencies */
.emergency-card { border: 1px solid var(--danger-line); border-left: 6px solid var(--danger); }
.emergency-card h2 { color: var(--danger); display: flex; align-items: center; gap: 8px; }
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px; background: var(--danger); color: #FFFFFF; font-size: 14px; }

/* Service-area chips, grouped by label */
.area-groups { margin-bottom: 12px; }
.area-group { border-top: 1px solid var(--border); }
.area-group:last-child { border-bottom: 1px solid var(--border); }
.area-group > summary { color: var(--fg); }
.chip-list { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; padding: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 2px; padding-left: 12px;
  background: var(--neutral-bg); border: 1px solid var(--border); border-radius: 999px; font-weight: 600; font-size: 14px;
}
.chip-x {
  display: inline-flex; align-items: center; justify-content: center; min-width: 34px; min-height: 34px;
  background: none; border: 0; border-radius: 999px; color: var(--fg-dim); font-size: 20px; line-height: 1; cursor: pointer;
}
.chip-x:hover { color: var(--danger); background: var(--danger-bg); }

/* Hours */
.hours-list { margin-bottom: 8px; }
.hours-row {
  display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; align-items: center; gap: 4px 14px;
  padding: 8px 0; margin: 0; border-top: 1px solid var(--border);
}
.hours-row:first-child { border-top: 0; }
.hours-day { font-weight: 700; }
.hours-times { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hours-times input { flex: 1 1 0; min-width: 0; max-width: 170px; }
.hours-row .field-error { grid-column: 1 / -1; margin-top: 0; }

/* Services */
.svc-list { margin-bottom: 8px; }
.svc-row {
  display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr) minmax(0, 1.2fr) auto; gap: 0 12px; align-items: end;
  padding: 12px 12px 0; margin-bottom: 10px; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.svc-row .svc-remove { margin-bottom: 16px; }

/* Calls: transcript + recording */
.transcript { display: flex; flex-direction: column; gap: 10px; }
.transcript .turn { max-width: 88%; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--border); }
.transcript .turn.user { align-self: flex-start; background: #EFF6FF; border-color: #BFDBFE; border-bottom-left-radius: 4px; }
.transcript .turn.agent { align-self: flex-end; background: var(--nmj-orange-tint); border-color: #FFE08A; border-bottom-right-radius: 4px; }
.transcript .turn.note { align-self: center; background: var(--panel-2); font-size: 13px; }
.transcript .who { font-size: 12px; font-weight: 700; color: var(--fg-dim); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 2px; }
.transcript .said { white-space: pre-wrap; }
.audio-wrap { display: flex; flex-direction: column; gap: 4px; }
.audio-wrap audio { width: 100%; max-width: 480px; }
.audio-wrap.compact audio { width: 250px; max-width: 100%; height: 40px; }
details.call-log > summary { color: var(--fg-dim); }
details.call-log ol { margin: 8px 0 0; padding-left: 22px; font-size: 14px; }

/* Customer photos */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.photo {
  display: flex; align-items: center; justify-content: center; aspect-ratio: 1 / 1; overflow: hidden;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--panel-2);
}
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo.broken { padding: 8px; text-align: center; font-weight: 600; font-size: 13px; }

/* Calendar week */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.week-day { min-width: 0; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel-2); }
.week-day.today { border-color: var(--nmj-orange-ink); box-shadow: inset 0 0 0 1px var(--nmj-orange-ink); background: #FFFFFF; }
.week-day-name { margin: 0 0 8px; font-weight: 700; font-size: 14px; }
.week-empty { margin: 0; font-size: 13px; }
.week-jobs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.week-job {
  display: flex; flex-direction: column; padding: 6px 8px; min-height: var(--tap); justify-content: center;
  background: #FFFFFF; border: 1px solid var(--border); border-left: 4px solid var(--nmj-orange); border-radius: 6px;
  color: var(--fg); text-decoration: none; font-size: 13px;
}
.week-job:hover { border-color: var(--nmj-orange-ink); }
.week-job.emergency { border-left-color: var(--danger); }
.week-job-time { font-weight: 700; }
.week-job-what { color: var(--fg-dim); overflow-wrap: anywhere; }
@media (max-width: 1000px) {
  .week { grid-template-columns: 1fr; }
  .week-day { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px; align-items: start; }
  .week-day-name { margin: 0; padding-top: 2px; }
}

/* Calendar connected state */
.connected { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; background: #F0FDF4; border: 1px solid var(--ok-line); border-radius: var(--radius-sm); margin: 0 0 16px; }
.connected .ok-dot { width: 12px; height: 12px; margin-top: 5px; border-radius: 50%; background: #16A34A; flex: 0 0 12px; box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.15); }
.connected strong { display: block; color: var(--ok); }

/* ------------------------------------------------------------------ */
/* login / create account                                              */
/* ------------------------------------------------------------------ */
body.auth-page { background: var(--nmj-navy) radial-gradient(ellipse at 50% -10%, #3D4540 0%, var(--nmj-navy) 60%) no-repeat; }
.login { max-width: 480px; margin: 0 auto; padding: 16px 0 24px; }
.login-brand { text-align: center; margin-bottom: 20px; color: #FFFFFF; }
.login-brand .wordmark-full { height: 42px; }
.login-tagline { margin: 14px 0 4px; font-size: 20px; font-weight: 800; color: #FFFFFF; }
.login-sub { margin: 0; color: var(--on-dark-dim); font-size: 15px; }
.login-card { padding: 22px; border: 0; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35); }
.login-card h2 { font-size: 20px; }
.login-foot { text-align: center; margin: 12px 0 0; }
.terms-note { margin: 14px 0 0; }
.terms-note a { color: var(--fg); font-weight: 600; }
.code-note { margin: -4px 0 16px; color: var(--fg); }
.code-input {
  font-size: 26px; font-weight: 700; letter-spacing: 0.35em; text-align: center;
  font-variant-numeric: tabular-nums; font-family: var(--mono); padding-left: calc(12px + 0.35em);
}
.code-input::placeholder { letter-spacing: normal; }
.code-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 16px; margin-top: 8px; }
.link-btn[aria-disabled="true"] { color: var(--fg-dim); text-decoration: none; cursor: default; font-variant-numeric: tabular-nums; }

/* in-flight requests: a small spinner before the button label */
.btn.is-busy::before, .link-btn.is-busy::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%; flex: 0 0 auto;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}
.link-btn.is-busy { display: inline-flex; align-items: center; gap: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* first-run "Finish setting up" card on the overview */
.finish-card h2 { margin-bottom: 4px; }
.finish-card > .muted { margin-bottom: 16px; }

/* ------------------------------------------------------------------ */
/* tablets and down                                                    */
/* ------------------------------------------------------------------ */
@media (max-width: 900px) {
  .who { display: none; }
}

/* phones: menu button, 44px targets, stacked tables */
@media (max-width: 720px) {
  body { font-size: 16px; }
  main { padding: 16px 16px 40px; }
  h1 { font-size: 23px; }
  .topbar-row { padding: 6px 16px; gap: 10px; }
  #topbar .wordmark-full { display: none; }
  #topbar .wordmark-symbol { display: block; }
  #btn-logout { display: none; }
  .nav-toggle { display: inline-flex; }
  #nav { display: none; }
  #topbar.nav-open #nav {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
    padding: 4px 16px 16px; max-height: calc(100vh - 60px); overflow-y: auto;
  }
  #topbar.nav-open #nav a, #topbar.nav-open #nav .nav-logout {
    min-height: 48px; padding: 0 14px; border-radius: var(--radius-sm);
    background: var(--nmj-navy-2); border: 1px solid var(--nmj-navy-3); color: #FFFFFF;
  }
  #topbar.nav-open #nav a.active { border-color: var(--nmj-orange); box-shadow: inset 4px 0 0 var(--nmj-orange); }
  #topbar.nav-open #nav a.nav-cross { margin-left: 0; }
  #topbar.nav-open #nav .nav-logout {
    display: flex; align-items: center; justify-content: center; grid-column: 1 / -1;
    font: inherit; font-weight: 700; cursor: pointer; background: transparent; border-color: #C9CCC5;
  }

  /* every tap target at least 44px */
  .btn, .btn-sm { min-height: var(--tap); }
  .btn-sm { padding: 8px 14px; font-size: 15px; }
  input, select, textarea { min-height: var(--tap); font-size: 16px; } /* 16px stops iOS zoom */
  input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; min-height: 0; }
  .check { min-height: var(--tap); }
  .chip-x { min-width: var(--tap); min-height: var(--tap); }
  .back-link { min-height: var(--tap); }
  .pw-toggle { min-height: var(--tap); }
  .card { padding: 16px; }
  .card.flush { padding: 0; background: transparent; border: 0; box-shadow: none; overflow: visible; }

  .page-head { margin-bottom: 14px; }
  .line-card { padding: 16px; }
  .line-number { font-size: 24px; }
  .line-actions { width: 100%; }
  .line-actions .btn { flex: 1 1 140px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .kpi .num { font-size: 26px; }
  .setup-item { flex-wrap: wrap; }
  .setup-text { flex: 1 1 calc(100% - 36px); }
  .setup-item > .btn { margin-left: 36px; }
  .card-link, .photo-link { display: inline-flex; align-items: center; min-height: var(--tap); }
  .inline-form > .btn { width: 100%; }
  .form-actions .btn { flex: 1 1 auto; }
  .hours-row { grid-template-columns: 1fr auto; }
  .hours-times { grid-column: 1 / -1; grid-row: 2; }
  .hours-times input { max-width: none; }
  .svc-row { grid-template-columns: 1fr 1fr; }
  .svc-row > .field:first-child { grid-column: 1 / -1; }
  .svc-row .svc-remove { grid-column: 1 / -1; }
  dl.kv { grid-template-columns: 1fr; gap: 2px; }
  dl.kv dd { margin-bottom: 8px; }
  dl.kv.totals { grid-template-columns: 1fr auto; gap: 6px 16px; }
  dl.kv.totals dd { margin-bottom: 0; }
  .transcript .turn { max-width: 94%; }
  .login { padding-top: 8px; }
  .login-card { padding: 18px 16px; }
  .login-brand .wordmark-full { height: 38px; }
  #toast-region { left: 12px; right: 12px; top: 10px; max-width: none; }

  /* tables become a stack of cards */
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.stack tr {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 8px 14px; margin-bottom: 10px; box-shadow: var(--shadow);
  }
  table.stack td {
    display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 2px 10px; align-items: baseline;
    padding: 6px 0; border: 0; text-align: left; white-space: normal; min-width: 0;
  }
  table.stack td::before { content: attr(data-label); grid-column: 1; grid-row: 1; color: var(--fg-dim); font-size: 12.5px; font-weight: 700; }
  table.stack td > * { grid-column: 2; justify-self: start; max-width: 100%; }
  table.stack td.num { text-align: left; }
  table.stack td.cell-primary { display: block; font-size: 16px; padding: 6px 0 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
  table.stack td.cell-primary::before { content: none; }
  table.stack td.cell-primary a { display: inline-flex; align-items: center; min-height: var(--tap); }
  table.stack td.cell-wrap { min-width: 0; }
  table.stack td.actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 10px; }
  table.stack td.actions::before { content: none; }
  table.stack td.actions:empty { display: none; }
  table.stack td.actions .btn { flex: 1 1 120px; margin-left: 0; }
  table.stack td.cell-audio { grid-template-columns: 1fr; }
  table.stack td.cell-audio > * { grid-column: 1; justify-self: stretch; }
  table.stack td.cell-audio::before { content: none; }
  table.stack td.cell-audio:has(> .muted) { display: none; }
  table.stack .audio-wrap.compact audio { width: 100%; }
  table.stack tr.clickable:hover td { background: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .flash { animation: none; }
  .btn.is-busy::before, .link-btn.is-busy::before { animation-duration: 2.4s; }
}

/* On the job: what the tech did from their job link (job page, Timesheets) */
.assign-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 8px; }
.assign-row .field { flex: 1 1 220px; margin: 0; }
.assign-row .btn { min-height: var(--tap); }
.field-timeline { list-style: none; margin: 12px 0 0; padding: 0; border-top: 1px dashed var(--border); }
.field-timeline li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.field-timeline time { flex: 0 0 5.5rem; font-family: var(--mono); color: var(--fg-dim); font-size: 14px; }
.field-timeline span { flex: 1 1 14rem; }
.field-timeline a { font-weight: 600; }
.field-photo { margin: 0; }
.field-photo figcaption { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 4px; font-size: 14px; font-weight: 600; }
.check-row.stack { display: grid; gap: 8px; }
.ts-onsite { display: block; font-weight: 700; }
.ts-drive { display: block; color: var(--fg-dim); font-size: 13px; }

/* ------------------------------------------------------------------ */
/* Job Proof (spec 6.4): list chips, the job card, review queue, + Job */
/* Colours stay on the kit's tokens; every pair below is AA or better. */
/* ------------------------------------------------------------------ */
/* "Records" in the nav, with how many are waiting (charcoal on yellow, 10:1) */
.nav-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px;
  background: var(--nmj-orange); color: var(--nmj-navy); font-size: 12px; font-weight: 800; line-height: 1;
}
.badge.with-icon { gap: 5px; }
.badge-icon { display: inline-flex; line-height: 0; }
.badge-icon svg { width: 14px; height: 14px; }

/* shot-list strip: one pill per stage */
.shot-strip { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; padding: 0; }
.shot {
  display: inline-flex; flex-direction: column; min-width: 96px; padding: 6px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel-2); font-size: 13px;
}
.shot-label { font-weight: 700; }
.shot-state { color: var(--neutral); }
.shot.stored { background: var(--ok-bg); border-color: var(--ok-line); }
.shot.stored .shot-state { color: var(--ok); font-weight: 600; }
.shot.waiting { background: var(--neutral-bg); border-style: dashed; border-color: var(--field-border); }
.shot.missing { background: var(--warn-bg); border-color: var(--warn-line); }
.shot.missing .shot-state { color: var(--warn); font-weight: 700; }
.shot.optional .shot-state { color: var(--fg-dim); }

/* photo grid: placeholders, soft deletes, the customer-visible toggle */
.photo-grid.proof { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; align-items: start; }
.photo.placeholder {
  flex-direction: column; gap: 6px; padding: 10px; text-align: center;
  border-style: dashed; border-color: var(--field-border); background: var(--neutral-bg);
  color: var(--neutral); font-size: 13px; font-weight: 600;
}
.photo.placeholder .ph-icon { line-height: 0; }
.photo.placeholder .ph-icon svg { width: 28px; height: 28px; }
.field-photo.removed .photo img { opacity: 0.5; filter: grayscale(1); }
.field-photo figcaption { margin-top: 6px; }
.photo-stage { font-weight: 700; }
.photo-meta { display: block; color: var(--fg-dim); font-size: 12.5px; line-height: 1.35; margin-top: 2px; }
.photo-meta.removed-note { color: var(--danger); font-weight: 700; }
.vis-toggle {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; margin-top: 6px; padding: 4px 10px;
  border: 1px solid var(--ok-line); border-radius: 999px; background: var(--ok-bg); color: var(--ok);
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.vis-toggle[aria-pressed="false"] { background: var(--neutral-bg); border-color: var(--field-border); color: var(--neutral); }
.vis-toggle:disabled { opacity: 0.6; cursor: progress; }
.photo-remove { display: block; padding: 4px 0; min-height: 32px; font-size: 13px; color: var(--fg-dim); }
.photo-remove:hover { color: var(--danger); }
.occupant-line { font-weight: 600; margin: 8px 0 0; }

/* typed name + reason before anything destructive */
.confirm-box {
  margin-top: 8px; padding: 12px; border: 1px solid var(--danger-line); border-radius: var(--radius-sm);
  background: var(--danger-bg); color: #7F1D1D; font-size: 14px;
}
.confirm-box strong { display: block; margin-bottom: 4px; }
.confirm-box .hint { color: #7F1D1D; margin: 0 0 8px; }
.confirm-fields { display: grid; gap: 8px; margin-bottom: 8px; }
.confirm-box input { min-height: 40px; }
.confirm-box .field-error { margin: 0 0 8px; }

/* equipment at the site */
.equip-list { list-style: none; margin: 0 0 8px; padding: 0; }
.equip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 0; border-top: 1px solid var(--border); }
.equip:first-child { border-top: 0; }
.equip-main { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; }
.equip-tools { flex: 0 0 auto; }
.equip .confirm-box, .equip .equip-form { flex: 1 1 100%; }
.equip-form { padding-top: 4px; }
details.equip-add { margin-top: 4px; }
details.equip-add .equip-form { padding: 4px 0 8px; }

/* customer record */
.record { margin-top: 4px; }
.record-status { margin: 0 0 4px; font-size: 17px; }
.record-status.ok { color: var(--ok); }
.record-status.warn { color: var(--warn); }
.record-status.danger { color: var(--danger); }
.record-status.neutral { color: var(--neutral); }
.record-actions { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; margin-top: 12px; }
.record-actions .field { flex: 1 1 220px; margin: 0; }
.record-actions .row { flex: 0 0 auto; }
.record-sub { margin: 16px 0 4px; font-weight: 700; font-size: 14px; }
.notice-list { margin: 0; padding-left: 18px; color: var(--fg-dim); font-size: 14px; }
.notice-list li { margin-bottom: 4px; }
.hazard-box ul { margin: 6px 0 0; }
.hazard-box li { font-weight: 700; }

/* review queue: phone-width cards, one tap each */
.queue { list-style: none; margin: 0; padding: 0; max-width: 560px; }
.queue-item { display: flex; flex-direction: column; gap: 12px; }
.queue-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.queue-main .item-title { font-size: 17px; color: var(--fg); text-decoration: none; }
.queue-main .item-title:hover { text-decoration: underline; }
.queue-summary { font-style: italic; }
.queue-main .record-status { margin-top: 6px; font-size: 15px; font-weight: 700; }
.queue-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.queue-actions .btn { flex: 1 1 160px; min-height: 48px; font-size: 16px; }

/* + Job */
.quick-job { border-top: 4px solid var(--nmj-orange); }

@media (max-width: 720px) {
  .photo-grid.proof { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .vis-toggle { min-height: var(--tap); }
  .photo-remove { min-height: var(--tap); }
  .record-actions .row { width: 100%; }
  .record-actions .row .btn { flex: 1 1 140px; min-height: 48px; }
  .equip-tools { width: 100%; }
  .equip-tools .btn { flex: 1 1 120px; }
  .page-head > .btn { min-height: var(--tap); }
}

/* terms gate */
.terms-gate-open, .terms-gate-open body { overflow: hidden; }
.terms-gate {
  position: fixed; inset: 0; z-index: 900;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(36, 42, 39, 0.72); overflow-y: auto;
}
.terms-gate-dialog {
  width: 100%; max-width: 460px; margin: auto;
  background: var(--panel); color: var(--fg);
  border-top: 4px solid var(--nmj-orange); border-radius: var(--radius);
  padding: 24px; box-shadow: 0 12px 40px rgba(11, 31, 51, 0.35);
}
.terms-gate-dialog h2 { font-size: 21px; margin: 0 0 10px; }
.terms-gate-dialog p { margin: 0 0 12px; line-height: 1.5; }
.terms-gate-links a { font-weight: 700; }
.terms-gate-error { color: var(--danger); font-weight: 600; }
.terms-gate-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.terms-gate-actions .btn { flex: 1 1 160px; min-height: 48px; font-size: 16px; }
.terms-gate .btn[aria-disabled="true"] { opacity: 0.7; cursor: progress; }
@media (max-width: 720px) {
  .terms-gate { align-items: flex-end; padding: 0; }
  .terms-gate-dialog { max-width: none; margin: auto 0 0; border-radius: var(--radius) var(--radius) 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
}

/* ------------------------------------------------------------------ */
/* Invoices (Get paid v1): status lines, row actions, the editor,     */
/* payment settings and the small Mark paid / Copy link dialogs.      */
/* ------------------------------------------------------------------ */
.inv-status { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.inv-note { color: var(--fg-dim); font-size: 13px; line-height: 1.35; white-space: nowrap; }
td.actions .inv-actions { display: flex; flex-wrap: wrap; gap: 6px; min-width: 230px; max-width: 360px; white-space: normal; }
td.actions .inv-actions .btn + .btn { margin-left: 0; }
.inv-editor { border-top: 4px solid var(--nmj-orange); }
.inv-editor h2:focus { outline: none; }
.inv-editor h2:focus-visible { outline: 3px solid var(--nmj-orange-ink); }
.inv-editor .card-head { justify-content: flex-start; gap: 10px; }
.inv-editor h3 { margin-top: 4px; }
.inv-lines-set { margin-bottom: 8px; }
.inv-line {
  display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 0.8fr) minmax(0, 1.1fr) minmax(0, 1fr) auto;
  gap: 0 12px; align-items: start; padding: 12px 12px 0; margin-bottom: 10px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.inv-line .inv-remove { margin: 27px 0 16px; }   /* level with the inputs under their labels */
.inv-editor input[type="date"] { max-width: 240px; }
.inv-amount {
  display: flex; align-items: center; min-height: 42px; font-weight: 700;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
dl.kv.inv-totals { margin: 4px 0 18px; }
.inv-preview {
  margin: 4px 0 0; padding: 10px 12px; font-size: 14px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.inv-dialog {
  width: min(440px, calc(100vw - 32px)); padding: 0; border: 0;
  border-top: 4px solid var(--nmj-orange); border-radius: var(--radius);
  background: var(--panel); color: var(--fg); box-shadow: 0 12px 40px rgba(11, 31, 51, 0.35);
}
.inv-dialog::backdrop { background: rgba(36, 42, 39, 0.72); }
.inv-dialog-body { padding: 20px; }
.inv-dialog-body h2 { margin-bottom: 10px; }
.inv-dialog-body input[readonly] { background: var(--panel-2); font-family: var(--mono); font-size: 14px; }
.inv-dialog .field-error { margin: 0 0 8px; }

@media (max-width: 720px) {
  .inv-note { white-space: normal; }
  td.actions .inv-actions { width: 100%; min-width: 0; max-width: none; }
  table.stack td.actions .inv-actions .btn { flex: 1 1 130px; }
  .inv-line { grid-template-columns: 1fr 1fr; }
  .inv-line > .field:first-child { grid-column: 1 / -1; }
  .inv-line .inv-remove { grid-column: 1 / -1; margin-top: 0; }
  .inv-dialog { width: 100%; max-width: none; margin: auto 0 0; border-radius: var(--radius) var(--radius) 0 0; }
  .inv-dialog-body { padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
  .inv-dialog .form-actions .btn { min-height: 48px; }
}

/* ------------------------------------------------------------------ */
/* Quotes and "send as a picture" (docs/QUOTES_SPEC_v1.md): the       */
/* invoice classes above, plus a decline reason that wraps, the       */
/* invoice link under a quote, and checkboxes with a hint line.       */
/* ------------------------------------------------------------------ */
.inv-note.wrap { white-space: normal; max-width: 260px; }
a.inv-note { color: var(--link); font-weight: 600; text-decoration: underline; }
a.inv-note:hover { color: var(--nmj-navy); }
.check-with-hint { flex-direction: column; flex-wrap: nowrap; gap: 0; }
.check-with-hint .check-hint { margin: -4px 0 0 28px; }
.inv-dialog .check-with-hint { margin-top: 4px; }

/* ------------------------------------------------------------------ */
/* Seasonal contracts (docs/SEASONAL_CONTRACTS_SPEC_v1.md): the kind  */
/* chip in the Quotes list, the editor's season / plan / terms parts, */
/* the payment schedule, a signed contract's panel, and the customer  */
/* picker for a new contract.                                         */
/* ------------------------------------------------------------------ */
.doc-num { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.badge.kind-contract { background: var(--nmj-orange-tint); color: var(--nmj-navy); border-color: #D9A400; }
.badge.kind-quote { background: var(--panel); color: var(--neutral); border-color: var(--field-border); }
.quote-filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.quote-filter .btn + .btn { margin-left: 0; }
.seg-btn[aria-pressed="true"] { background: var(--nmj-navy); color: #FFFFFF; border-color: var(--nmj-navy); }
.seg-btn[aria-pressed="true"]:hover { background: var(--nmj-navy-2); color: #FFFFFF; }
.callout.ok { background: var(--ok-bg); border-color: var(--ok-line); color: #14532D; }
.callout.neutral { background: var(--neutral-bg); border-color: var(--border); color: var(--neutral); }
.contract-set { border-top: 1px solid var(--border); margin: 6px 0 4px; padding-top: 2px; }
.contract-set > h3 { font-size: 16px; }
.choice-grid.compact { grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); margin-bottom: 10px; }
.choice-group > .field-error { margin: 0 0 8px; }
.plan-choice { align-items: flex-start; }
.plan-choice input { margin-top: 2px; }
.choice-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.choice-desc { font-weight: 400; font-size: 13px; line-height: 1.35; color: var(--fg-dim); overflow-wrap: anywhere; }
.plan-preview { margin: 0 0 14px; }
.plan-preview .table-wrap, .contract-panel .table-wrap { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; max-width: 620px; }
table.plan-table th, table.plan-table td { padding: 8px 12px; white-space: normal; }
table.plan-table tfoot th, table.plan-table tfoot td {
  background: var(--panel-2); color: var(--fg); font-size: 14px; font-weight: 800; text-transform: none; letter-spacing: 0;
  border-top: 1px solid var(--border); border-bottom: 0;
}
table.plan-table .cell-sub { white-space: normal; }
.plan-flag {
  display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line);
}
.terms-box { background: var(--panel-2); }
.terms-box > summary { color: var(--fg); }
.terms-input { font-size: 14px; line-height: 1.5; min-height: 260px; }
.contract-terms {
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 420px; overflow-y: auto;
  margin: 0 0 12px; padding: 12px 14px; font-size: 14px; line-height: 1.55;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.contract-panel .callout strong { margin-bottom: 4px; }
.hash { font-size: 13.5px; background: var(--panel-2); padding: 1px 6px; border-radius: 4px; overflow-wrap: anywhere; }
dl.kv.fill-ins { margin: 0 0 12px; gap: 4px 16px; }
dl.kv.fill-ins code { font-size: 13.5px; }
.cust-pick { display: grid; gap: 6px; max-height: min(50vh, 360px); overflow-y: auto; padding: 2px; }
.cust-choice { align-items: flex-start; }
.cust-choice input { margin-top: 2px; }
.inv-dialog input[type="search"] { margin-bottom: 0; }
table.plan-table .due-sub { display: none; }
@media (max-width: 720px) {
  table.plan-table th, table.plan-table td { padding: 8px 10px; }
  table.plan-table .due-col { display: none; }
  table.plan-table .due-sub { display: block; }
  table.plan-table .due-sub .plan-flag { margin: 2px 0 0; }
  table.plan-table td:first-child { white-space: nowrap; }
  .quote-filter { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .quote-filter .btn-sm { padding: 8px 4px; font-size: 14px; white-space: nowrap; }
  .plan-preview .table-wrap, .contract-panel .table-wrap { max-width: none; }
}

/* ------------------------------------------------------------------ */
/* Admin Leads page (website follow-up requests): status buttons and  */
/* notes share the last cell; the visitor's message keeps its breaks. */
/* ------------------------------------------------------------------ */
td.actions .lead-actions { display: flex; flex-wrap: wrap; gap: 6px; min-width: 240px; max-width: 340px; white-space: normal; }
td.actions .lead-actions .btn + .btn { margin-left: 0; }
td.actions .lead-actions textarea { width: 100%; min-height: 64px; font-size: 14px; }
.lead-msg { white-space: pre-line; overflow-wrap: anywhere; }
.lead-due-late { color: var(--danger); font-weight: 600; }
@media (max-width: 720px) {
  td.actions .lead-actions { width: 100%; min-width: 0; max-width: none; }
}
