/* Colours: the Cervo theme (ink, gold, warm off-white). Every colour is a token, so the dark theme only changes this block. */
:root {
  color-scheme: light;
  --ink: #0a0a0a;
  --muted: #6b7280;
  --line: #e4e4e2;
  --line-strong: #c9c9c5;
  --paper: #f8f8f6;
  --card: #ffffff;
  --card-alt: #f1f1ef;
  --raised: #ffffff;
  --accent: #0a0a0a;
  --accent-ink: #ffffff;
  --accent-text: #8a6a44;
  --accent-soft: #f3ebe1;
  --ok: #15803d;
  --ok-fill: #16a34a;
  --ok-soft: #dcfce7;
  --warn: #c2410c;
  --warn-fill: #ea580c;
  --warn-soft: #ffedd5;
  --bad: #b91c1c;
  --bad-soft: #fee2e2;
  --bad-faint: #fef2f2;
  --bad-line: #fecaca;
  --amber: #e8a93f;
  --amber-hover: #d69526;
  --amber-soft: #fef3c7;
  --amber-text: #92400e;
  --violet: #7c3aed;
  --violet-soft: #ede9fe;
  --violet-text: #6d28d9;
  --cyan: #0891b2;
  --cyan-soft: #cffafe;
  --cyan-text: #0e7490;
  --time: #4d7c0f;
  --note-bg: #ecfeff;
  --note-ink: #155e75;
  --side: #0a0a0a;
  --side-ink: #f5f5f4;
  --side-link: #d6d3d1;
  --side-muted: #a8a8a8;
  --side-hover: #1f1f1f;
  --tile: #2e2e2e;
  --tile-hover: #1f1f1f;
  --tile-quiet: #94a3b8;
  --chip: #f1f1ef;
  --scrim: rgba(10, 10, 10, 0.45);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-lift: 0 6px 20px rgba(15, 23, 42, 0.18);

  /* Shapes (Material 3 Expressive: generous, rounded corners) */
  --r-card: 20px;
  --r-tile: 24px;
  --r-field: 14px;
  --r-small: 10px;
  --tap: 48px;
  --nav-height: 80px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ink: #f5f5f4;
    --muted: #a8a8a8;
    --line: #2e2e2e;
    --line-strong: #3d3d3d;
    --paper: #0a0a0a;
    --card: #1a1a1a;
    --card-alt: #141414;
    --raised: #242424;
    --accent: #c9a47c;
    --accent-ink: #0a0a0a;
    --accent-text: #c9a47c;
    --accent-soft: #2b2218;
    --ok: #4ade80;
    --ok-fill: #16a34a;
    --ok-soft: #052e16;
    --warn: #fb923c;
    --warn-fill: #ea580c;
    --warn-soft: #431407;
    --bad: #f87171;
    --bad-soft: #450a0a;
    --bad-faint: #2a0f14;
    --bad-line: #7f1d1d;
    --amber: #d9962b;
    --amber-hover: #c2841f;
    --amber-soft: #422006;
    --amber-text: #fcd34d;
    --violet: #8b5cf6;
    --violet-soft: #2e1065;
    --violet-text: #c4b5fd;
    --cyan: #06b6d4;
    --cyan-soft: #083344;
    --cyan-text: #67e8f9;
    --time: #a3e635;
    --note-bg: #082f3a;
    --note-ink: #a5f3fc;
    --side: #000000;
    --side-ink: #f5f5f4;
    --side-link: #d6d3d1;
    --side-muted: #8a8a8a;
    --side-hover: #1a1a1a;
    --tile: #242424;
    --tile-hover: #2e2e2e;
    --tile-quiet: #334155;
    --chip: #242424;
    --scrim: rgba(0, 0, 0, 0.6);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-lift: 0 6px 20px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  font-family: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
body.signed-in {
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
  min-height: 100vh;
}
body.signed-out { min-height: 100vh; }
a { color: inherit; }
a, button, summary, label, select { touch-action: manipulation; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; }
.icon { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Side menu (desktop), drawer (phone) */
.side {
  background: var(--side);
  color: var(--side-ink);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 20px 14px;
}
body.signed-out .side,
body.signed-out .bar,
body.signed-out .bottom-nav,
body.signed-out .fab { display: none; }
.side-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 10px 18px;
  color: inherit;
  text-decoration: none;
}
.side-brand img { width: 40px; height: 40px; border-radius: 12px; }
.side-brand div { display: grid; gap: 2px; }
.side-brand strong { font-size: 1.05rem; }
.side-brand span { color: var(--side-muted); font-size: 0.85rem; }
#nav { display: grid; gap: 2px; align-content: start; }
.nav-label {
  margin: 14px 14px 4px;
  color: var(--side-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.nav-label:first-child { margin-top: 0; }
#nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  color: var(--side-link);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 999px;
  transition: background-color 0.15s ease, color 0.15s ease;
}
#nav a .icon { width: 20px; height: 20px; }
#nav a.active, #nav a:hover { background: var(--side-hover); color: #fff; }
#nav a.active { background: var(--accent); }
#nav .count {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  min-width: 1.4rem;
  padding: 2px 6px;
  text-align: center;
  font-size: 0.75rem;
}
.side-user {
  margin-top: auto;
  display: grid;
  gap: 2px;
  padding: 16px 14px 4px;
}
.side-user span { color: var(--side-muted); font-size: 0.85rem; }
.side-user button {
  display: none;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  min-height: var(--tap);
  padding: 0 16px;
  border: 1px solid var(--side-hover);
  border-radius: 999px;
  background: transparent;
  color: var(--side-link);
  cursor: pointer;
}

/* Top bar */
.workspace { min-width: 0; }
.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.bar h1 { margin: 0; flex: 1; min-width: 0; font-size: 1.25rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.icon-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.icon-button:hover { background: var(--card-alt); }
.icon-button .dot {
  position: absolute;
  top: 6px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--bad);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
main { width: 100%; max-width: 920px; margin: 0 auto; padding: 20px 24px 40px; }
main.wide { max-width: 1680px; }
h1 { font-size: 1.7rem; margin: 0 0 8px; }
h2 { font-size: 1.05rem; margin: 0 0 12px; }
.lede, .muted { color: var(--muted); }
.work-detail { display: block; font-size: 0.85rem; }
/* Materials: one line per material used, from a job or added by hand */
.material-list { list-style: none; margin: 0; padding: 0; display: grid; }
.material-line { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.material-line:last-child { border-bottom: 0; }
.material-text { display: grid; gap: 2px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.material-text .muted { font-size: 0.85rem; }
.material-earlier { border-top: 1px solid var(--line); padding: 10px 0; }
.material-earlier summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.brand-mark { margin: 0; font-weight: 700; color: var(--accent-text); letter-spacing: 0.01em; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 18px;
  margin: 12px 0;
}
.stack { display: grid; gap: 12px; }
.job-summary { display: grid; gap: 2px; }
.job-summary p { margin: 0; line-height: 1.35; }
.job-summary .actions, .job-summary form { margin-top: 10px; }
.job.job-summary { gap: 2px; }
.job.job-summary > a { display: grid; gap: 2px; text-decoration: none; color: inherit; }
#billing-details[hidden], #user-form[hidden], #partner-form[hidden], #referrer-form[hidden], #referrer-source[hidden], .referrer-fields[hidden], #split-pay[hidden], #split-note[hidden], #split-warn[hidden], #materials-note[hidden], #office-materials-note[hidden], #eta-field[hidden], #appointment-field[hidden], #expense-detail[hidden], #expense-search-note[hidden] { display: none; }
.split-warn { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--bad); font-weight: 700; }
.bang { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 999px; background: var(--bad); color: #fff; font-weight: 800; }
input.bad-amount { border-color: var(--bad); background: var(--bad-faint); }
.photos { display: flex; flex-wrap: wrap; gap: 16px; }
.photo { margin: 0; }
.photo img { border-radius: 12px; }
.photo figcaption { font-size: 0.85rem; margin-bottom: 4px; }

/* Forms */
label { display: grid; gap: 6px; font-size: 0.92rem; }
label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  min-height: 40px;
}
label:has(input[type="checkbox"]) input { width: 20px; height: 20px; padding: 0; accent-color: var(--accent); }
input, select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-field);
  background: var(--card);
  transition: border-color 0.15s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 96px; resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Buttons: pill shapes, 48px tall on a phone */
button.primary, a.primary, label.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: 999px;
  padding: 10px 20px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s ease, background-color 0.15s ease;
}
button.primary:hover, a.primary:hover, label.primary:hover { filter: brightness(1.08); }
button.primary:disabled { opacity: 0.6; cursor: progress; }
a.ghost, button.ghost, summary.ghost, label.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 10px 16px;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
a.ghost:hover, button.ghost:hover, summary.ghost:hover, label.ghost:hover { background: var(--card-alt); }
.bar button.menu-toggle { display: none; }
.picker { display: inline-grid; }
.picker summary { list-style: none; }
.picker summary::-webkit-details-marker { display: none; }
.picker[open] .menu { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.picker .menu a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  text-decoration: none;
  background: var(--card);
}
.banner {
  padding: 12px 16px;
  border-radius: var(--r-field);
  background: var(--bad-soft);
  color: var(--bad);
}
.ok { background: var(--ok-soft); color: var(--ok); }

/* Technician and manager home: big tiles */
.work-menu { display: grid; gap: 12px; max-width: 760px; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 6px;
  min-height: 120px;
  padding: 18px 14px;
  border-radius: var(--r-tile);
  background: var(--tile);
  color: #fff;
  text-align: center;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.02rem;
  transition: background-color 0.2s var(--ease), border-radius 0.2s var(--ease);
}
.tile .icon { width: 28px; height: 28px; opacity: 0.9; }
.tile strong { font-size: 1.35rem; }
.tile:hover { background: var(--tile-hover); }
.tile:active { border-radius: 16px; }
.tile-main { min-height: 160px; background: var(--tile-quiet); font-size: 1.2rem; border-radius: 28px; }
.tile-main .icon { width: 34px; height: 34px; }
.tile-main.has-jobs { background: var(--amber); color: #1f1300; }
.tile-main.has-jobs:hover { background: var(--amber-hover); }
.tile-main strong { font-size: 2.2rem; line-height: 1; }

/* Jobs */
.stage-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.stage-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--card);
  text-decoration: none;
  font-size: 0.92rem;
  transition: background-color 0.15s ease;
}
.stage-tabs a.active { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.stage-tabs .count {
  display: inline-block;
  min-width: 1.4em;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--ink);
  font-size: 0.8rem;
  text-align: center;
}
.stage-tabs a.active .count { background: var(--accent); color: #fff; }
.empty-state { padding: 40px 16px; text-align: center; color: var(--muted); }

.job-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; align-items: start; }
.job-card {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-left: 6px solid var(--line-strong);
  border-radius: var(--r-card);
  background: var(--card);
  box-shadow: var(--shadow);
}
.job-card-body { display: grid; gap: 3px; padding: 14px 16px 10px; color: inherit; text-decoration: none; }
.job-card-body p { margin: 0; line-height: 1.35; }
.job-card-top { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 0.85rem; }
.job-card-top strong { color: var(--ink); font-size: 1.05rem; }
.job-card-postcode { font-size: 1.6rem; font-weight: 800; letter-spacing: 0.01em; }
.job-card-time { color: var(--time); font-weight: 700; }
.job-card-detail { font-style: italic; }
.job-card-amount { font-weight: 700; }
.job-card .actions { padding: 0 16px 16px; }
.stage-note { margin-top: 6px !important; padding: 8px 12px; border-radius: var(--r-small); background: var(--card-alt); font-size: 0.9rem; }
.job-card.stage-unassigned, .job-card.stage-new { border-left-color: var(--amber); }
.job-card.stage-appointment { border-left-color: var(--accent); }
.job-card.stage-progress { border-left-color: var(--warn-fill); }
.job-card.stage-hold { border-left-color: var(--violet); }
.job-card.stage-pending_payment { border-left-color: var(--cyan); }
.job-card.stage-completed { border-left-color: var(--ok-fill); }
.job-card.stage-cancelled { border-left-color: var(--bad); }
button.primary.done { background: var(--ok-fill); }
button.ghost.danger { color: var(--bad); border-color: var(--bad-line); }

.week-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; align-items: start; }
.week-card { display: grid; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--card); overflow: hidden; }
.week-card > p, .week-card-row { margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--line); line-height: 1.5; }
.week-card-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.week-card-row p { margin: 0; }
.week-card-earnings { display: flex; justify-content: space-between; background: var(--ok-fill); color: #fff; border-bottom: 0 !important; font-size: 1.05rem; }

/* Maps stay light in both themes, so streets read the same */
.map-panel { display: grid; gap: 10px; }
#job-map, #dash-map { height: 320px; border: 1px solid var(--line); border-radius: var(--r-card); color-scheme: light; }
#dash-map { height: 180px; }
.leaflet-container { font: inherit; z-index: 0; }
.distances { display: grid; gap: 8px; }
button.distance {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: var(--tap);
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-field);
  padding: 10px 14px;
  cursor: pointer;
}
button.distance.chosen { border-color: var(--accent); }
.jobs { display: grid; gap: 10px; }
.week-pots { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.week-pots .card { margin: 0; }
.job {
  display: grid;
  gap: 8px;
  text-decoration: none;
  padding: 14px 16px;
  border-radius: var(--r-card);
  border: 1px solid var(--line);
  background: var(--card);
}
.job a { text-decoration: none; }
.job strong { font-size: 1.05rem; }
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--chip);
  font-size: 0.8rem;
}
.pill.stage-unassigned, .pill.stage-new { background: var(--amber-soft); color: var(--amber-text); }
.pill.stage-appointment { background: var(--accent-soft); color: var(--accent-text); }
.pill.stage-progress { background: var(--warn-soft); color: var(--warn); }
.pill.stage-hold { background: var(--violet-soft); color: var(--violet-text); }
.pill.stage-pending_payment { background: var(--cyan-soft); color: var(--cyan-text); }
.pill.stage-completed { background: var(--ok-soft); color: var(--ok); }
.pill.stage-cancelled { background: var(--bad-soft); color: var(--bad); }
.money { font-variant-numeric: tabular-nums; font-weight: 700; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.login { max-width: 420px; margin: 48px auto; }

/* Figures */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat {
  display: grid;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-top-width: 4px;
  border-radius: 16px;
  padding: 14px 16px;
}
.stat span { color: var(--muted); font-size: 0.85rem; }
.stat strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); font-size: 0.78rem; }
.bar-search { flex: 1; min-width: 180px; gap: 2px; font-size: 0.75rem; color: var(--muted); }
.bar:has(.bar-search) h1 { flex: 0 1 auto; }
.bar-search input { min-height: 40px; padding: 8px 14px; border-radius: 999px; }
.ops-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.6fr); gap: 14px; align-items: start; }
.ops-layout .card { margin: 0; }
.dash-side { display: grid; gap: 14px; }
.dash-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.dash-tabs button {
  min-height: 40px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}
.dash-tabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.table-wrap { overflow-x: auto; }
.partner-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.partner-line:last-child { border-bottom: 0; }
.partner-login {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}
.partner-login input { flex: 1 1 140px; width: auto; min-width: 0; }
.staff-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.staff-tools button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.staff-cards { display: grid; gap: 10px; margin-bottom: 22px; }
.staff-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}
.staff-card summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
}
.staff-card summary::-webkit-details-marker { display: none; }
.staff-card summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  flex: none;
}
.staff-card[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.staff-id { display: grid; gap: 2px; min-width: 0; }
.staff-id .muted { font-size: 0.85rem; }
.staff-status { margin-left: auto; color: var(--muted); font-size: 0.85rem; }
.staff-panel {
  display: grid;
  gap: 14px;
  margin: 0 18px 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.staff-password { display: flex; align-items: end; gap: 8px; }
.staff-password label { width: auto; flex: 1; }
.job-pin.leaflet-div-icon {
  background: #ea580c;
  border: 2px solid white;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.35);
}
.stat.blue { border-top-color: var(--accent); }
.stat.green { border-top-color: var(--ok-fill); }
.stat.orange { border-top-color: var(--warn-fill); }
.stat.purple { border-top-color: var(--violet); }
.stat.red { border-top-color: var(--bad); background: var(--bad-faint); }
.vat-pot { border-color: var(--bad-line); background: var(--bad-faint); }
.dash-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 14px; align-items: start; }
.dash-grid .card { margin: 0; }
.schedule-row, .peek {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: var(--tap);
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.peek { grid-template-columns: minmax(0, 1fr) auto auto; }
.schedule-row:last-child, .peek:last-child { border-bottom: 0; }

@media (max-width: 1100px) {
  .job-cards { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .dash-grid, .ops-layout { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .row, .week-pots, .job-cards, .week-cards { grid-template-columns: 1fr; }
  .schedule-row, .peek { grid-template-columns: 1fr; }
}

/* Invoices print on white paper whatever the theme */
.invoice {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 28px;
}
.invoice-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.invoice h2, .invoice h3 { margin: 0 0 6px; }
.invoice p { margin: 0 0 4px; }
.invoice-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-text);
  text-align: right;
}
.invoice-head > div:last-child { text-align: right; }
.invoice table { width: 100%; margin: 20px 0; }
.invoice-totals { margin-left: auto; width: min(280px, 100%); }
.invoice-totals p { display: flex; justify-content: space-between; gap: 16px; }
.invoice .due { font-size: 18px; margin-top: 8px; }
.invoice footer { margin-top: 28px; color: var(--muted); }
.invoice-next { display: flex; align-items: end; gap: 8px; margin-top: 8px; }
.invoice-next label { width: auto; }
.invoice-next input { width: 96px; }

@media print {
  :root {
    color-scheme: light;
    --ink: #0f172a; --muted: #475569; --line: #e2e8f0; --card: #ffffff; --card-alt: #f8fafc; --paper: #ffffff; --accent-text: #8a6a44;
  }
  .side, .bar, .bottom-nav, .fab, .scrim, .no-print { display: none !important; }
  body.signed-in { display: block !important; background: #fff; }
  main { max-width: none !important; padding: 0 !important; }
  .invoice { border: 0; border-radius: 0; }
}

/* Activity */
.activity-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.activity-filters label { display: grid; gap: 4px; min-width: 160px; }
.activity-filters .grow { flex: 1 1 260px; }
.activity-table td { font-size: 0.92rem; }
.activity-table td:first-child { white-space: nowrap; color: var(--muted); }
.activity-table .change { display: inline-block; margin: 1px 0; }
.history { display: grid; gap: 10px; margin: 0; padding-left: 20px; }
.history li { display: grid; gap: 2px; }
.phone-history { padding: 10px 12px; border-radius: var(--r-small); background: var(--card-alt); font-size: 0.92rem; }
.phone-history p { margin: 0 0 6px; }
.phone-history ul { display: grid; gap: 6px; margin: 0; padding-left: 18px; }
.phone-history a { font-weight: 600; }
.open-jobs { display: grid; gap: 8px; margin: 0; padding-left: 20px; }
.open-jobs li { display: grid; gap: 2px; }
.open-jobs a { min-height: 32px; display: inline-flex; align-items: center; }
.history-details { padding: 6px 10px; border-radius: var(--r-small); background: var(--card-alt); font-size: 0.9rem; }
@media (max-width: 700px) {
  .activity-table thead { display: none; }
  .activity-table, .activity-table tbody, .activity-table tr, .activity-table td { display: block; width: 100%; }
  .activity-table tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .activity-table td { border: 0; padding: 2px 0; }
  .activity-table td::before { content: attr(data-label) " · "; color: var(--muted); font-size: 0.8rem; }
}

/* One period bar for every money and report page */
.period-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 14px; }
.period-step { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.period-step a.ghost { min-width: 44px; padding: 6px 13px; font-size: 1.15rem; line-height: 1.1; }
.period-title { font-size: 1.15rem; }
.period-now { font-size: 0.9rem; color: var(--accent-text); }
.period-views { display: inline-flex; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--card); }
.period-views a { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border-left: 1px solid var(--line-strong); font-size: 0.9rem; text-decoration: none; }
.period-views a:first-child { border-left: 0; }
.period-views a.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.period-print { display: none; }
.week-status { margin: -6px 0 12px; color: var(--warn); font-size: 0.9rem; }
.week-status.ended { color: var(--ok); }
.note { padding: 12px 14px; border-radius: var(--r-field); background: var(--note-bg); color: var(--note-ink); font-size: 0.92rem; }
.section-title { margin: 18px 0 8px; color: var(--muted); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.section-title:first-child { margin-top: 0; }

a.stat { color: inherit; text-decoration: none; transition: box-shadow 0.15s ease, border-color 0.15s ease; }
a.stat:hover { box-shadow: var(--shadow-lift); }
.stat.alert { background: var(--warn-soft); }
.stats + .note, .stats + .card { margin-top: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th.num { text-align: right; }
tfoot th { border-top: 2px solid var(--line); border-bottom: 0; }

/* Small buttons and the WhatsApp copy button */
a.ghost.small, button.ghost.small, label.ghost.small, a.primary.small, button.primary.small { min-height: 40px; padding: 6px 14px; font-size: 0.88rem; }
button.ghost.wa { display: inline-flex; align-items: center; gap: 6px; }
.wa-icon { width: 18px; height: 18px; flex: none; }

/* Weekly pay */
.settle-head, .settle-row summary, .settle-total {
  display: grid;
  grid-template-columns: minmax(140px, 1.4fr) 56px minmax(90px, 0.8fr) minmax(90px, 0.8fr) minmax(190px, 1.3fr) 84px;
  gap: 10px;
  align-items: center;
  padding: 10px 8px;
}
.settle-short .settle-head, .settle-short .settle-row summary, .settle-short .settle-total {
  grid-template-columns: minmax(140px, 2fr) 56px minmax(190px, 1fr) 84px;
}
.settle-head { border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; }
.settle-row { border-bottom: 1px solid var(--line); }
.settle-row summary { min-height: var(--tap); cursor: pointer; list-style: none; border-radius: var(--r-small); }
.settle-row summary::-webkit-details-marker { display: none; }
.settle-row summary:hover { background: var(--card-alt); }
.settle-name { font-weight: 700; }
.settle-name::before { content: "▸"; margin-right: 6px; color: var(--muted); }
.settle-row[open] .settle-name::before { content: "▾"; }
.settle-row > .table-wrap { padding: 0 8px 12px 26px; }
.settle-due.pay { color: var(--ok); font-weight: 700; }
.settle-due.collect { color: var(--warn); font-weight: 700; }
.settle-total { font-weight: 700; }

/* Expenses */
.page-tools { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 12px; }
.grow { flex: 1 1 260px; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; align-items: start; }
.report-grid .card { margin: 0; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(70px, 1.6fr) auto 3.2em; gap: 10px; align-items: center; padding: 6px 0; }
.meter, .count-bar { display: block; overflow: hidden; height: 10px; border-radius: 999px; background: var(--chip); }
.meter i, .count-bar i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.count-bar { display: inline-block; width: 70px; margin-right: 6px; vertical-align: middle; }
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
details.manage summary { min-height: var(--tap); display: flex; align-items: center; cursor: pointer; font-weight: 700; }
details.manage[open] summary { margin-bottom: 12px; }

/* Profit statement */
.statement { max-width: 760px; }
.statement-line { display: flex; justify-content: space-between; gap: 12px; padding: 8px 6px; border-bottom: 1px dashed var(--line); }
.statement-line.zero { color: var(--muted); }
.statement-line:not(.head):not(.subtotal):not(.total) > span { padding-left: 18px; }
.statement-line.head, .statement-line.subtotal { border-bottom-style: solid; font-weight: 700; }
.statement-line.subtotal { background: var(--card-alt); }
.statement-line.total { margin-top: 4px; padding-top: 12px; border-top: 2px solid var(--ink); border-bottom: 0; font-size: 1.15rem; font-weight: 800; }
.statement > .muted { margin-top: 12px; }

/* Dashboard: needs attention */
.attention { display: grid; }
.attention-row { display: grid; grid-template-columns: 190px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.attention-main { display: grid; gap: 2px; color: inherit; text-decoration: none; }
.attention-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; }
.badge.late { background: var(--bad-soft); color: var(--bad); }
.badge.wait { background: var(--amber-soft); color: var(--amber-text); }
.badge.hold { background: var(--violet-soft); color: var(--violet-text); }
.badge.pending { background: var(--cyan-soft); color: var(--cyan-text); }
.job-card.is-late { border-color: var(--bad-line); border-left-color: var(--bad); }

/* Jobs: quick assign and search */
.quick-assign { display: flex; gap: 6px; padding: 0 16px 12px; }
.quick-assign select { min-width: 0; min-height: 40px; padding: 7px 12px; }
.attention .quick-assign { padding: 0; }
.jobs-search { margin-bottom: 12px; }
.jobs-search input { max-width: 620px; border-radius: 999px; padding-left: 18px; }
form.bar-search { flex: 1; min-width: 180px; max-width: 420px; }

@media print {
  .period-print { display: block; font-weight: 700; }
}
@media (max-width: 700px) {
  .period-bar { flex-direction: column; align-items: stretch; }
  .period-title { font-size: 0.98rem; }
  .period-step a.ghost { padding: 5px 10px; }
  .table-wrap td, .table-wrap th { white-space: nowrap; }
  /* Work for partners: the price, materials and percent wrap under the postcode, so Earnings stays on screen. */
  .table-wrap td .work-detail { white-space: normal; }
  .period-views { overflow-x: auto; }
  .settle-head { display: none; }
  .settle-row summary, .settle-total, .settle-short .settle-row summary, .settle-short .settle-total { grid-template-columns: 1fr auto; }
  .settle-name { grid-column: 1 / -1; }
  .settle-row > .table-wrap { padding-left: 8px; }
  .attention-row { grid-template-columns: 1fr; }
  .attention-actions { justify-content: flex-start; }
  .bar-row { grid-template-columns: 1fr auto auto; }
  .bar-row .meter { grid-column: 1 / -1; grid-row: 2; }
  form.bar-search { display: none; }
}
.stats-compact { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); }
.stats-compact .stat { padding: 12px 14px; }

/* Phone: bottom navigation bar, round "+" button, drawer for everything else */
.bottom-nav, .fab, .scrim { display: none; }
@media (max-width: 800px) {
  body.signed-in { grid-template-columns: 1fr; }
  body.signed-in main { padding: 16px 16px calc(var(--nav-height) + 96px + env(safe-area-inset-bottom)); }
  .bar { min-height: 56px; padding: 6px 8px 6px 16px; padding-top: max(6px, env(safe-area-inset-top)); }
  .bar h1 { font-size: 1.3rem; }
  .bar .desk-only { display: none; }
  .side {
    position: fixed;
    z-index: 30;
    inset: 0 auto 0 0;
    width: min(320px, 86vw);
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 0 28px 28px 0;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    transform: translateX(-105%);
    transition: transform 0.25s var(--ease);
    box-shadow: var(--shadow-lift);
  }
  body.nav-open .side { transform: translateX(0); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: var(--scrim); }
  .side-user button { display: inline-flex; }
  #nav a { min-height: var(--tap); }

  body.signed-in .bottom-nav {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    position: fixed;
    z-index: 20;
    inset: auto 0 0 0;
    height: calc(var(--nav-height) + env(safe-area-inset-bottom));
    padding: 12px 4px env(safe-area-inset-bottom);
    background: var(--raised);
    border-top: 1px solid var(--line);
  }
  .bottom-nav a, .bottom-nav button {
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 4px;
    min-width: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
  }
  .bottom-nav .pill-icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 64px;
    height: 32px;
    border-radius: 999px;
    transition: background-color 0.2s var(--ease);
  }
  .bottom-nav .active { color: var(--ink); }
  .bottom-nav .active .pill-icon { background: var(--accent-soft); color: var(--accent-text); }
  .bottom-nav .pill-icon .dot {
    position: absolute;
    top: -2px;
    left: 38px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--bad);
    color: #fff;
    font-size: 0.65rem;
    line-height: 16px;
    text-align: center;
  }

  body.signed-in .fab {
    display: inline-grid;
    place-items: center;
    position: fixed;
    z-index: 21;
    right: 16px;
    bottom: calc(var(--nav-height) + 16px + env(safe-area-inset-bottom));
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: var(--accent);
    color: #fff;
    box-shadow: var(--shadow-lift);
    transition: border-radius 0.2s var(--ease), filter 0.15s ease;
  }
  .fab:active { border-radius: 32px; }
  .fab .icon { width: 28px; height: 28px; }
  body.signed-in .fab[hidden] { display: none; }

  button.primary, a.primary, a.ghost, button.ghost, summary.ghost { min-height: var(--tap); }
  .tiles { gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* Sign in */
.login { padding: 28px 24px; }
.login-brand { display: flex; align-items: center; gap: 14px; }
.login-brand img { border-radius: 16px; }
.login-brand p { margin: 0; }
.login h1 { margin: 8px 0 0; }
.login button.primary { min-height: 52px; margin-top: 4px; font-size: 1.02rem; }
@media (max-width: 800px) {
  body.signed-out main { padding: 24px 16px; }
  .login { margin: 8vh auto 0; }
}

/* Phone: stage tabs scroll sideways in one row, like Android filter chips */
@media (max-width: 800px) {
  .stage-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 0 -16px 14px;
    padding: 2px 16px 4px;
    scrollbar-width: none;
    scroll-padding-inline: 16px;
  }
  .stage-tabs::-webkit-scrollbar { display: none; }
  .stage-tabs a { flex: none; white-space: nowrap; }
}

/* Google map: one map moved between pages; dots and pins drawn in CSS */
.google-map { width: 100%; height: 100%; border-radius: inherit; }
#dash-map { height: 240px; overflow: hidden; }
#job-map { overflow: hidden; }
.map-dot {
  width: 14px;
  height: 14px;
  border: 2px solid #8a6a44;
  border-radius: 50%;
  background: #c9a47c;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.4);
  transform: translateY(50%);
}
.map-pin {
  width: 16px;
  height: 16px;
  background: #ea580c;
  border: 2px solid #fff;
  border-radius: 50% 50% 50% 0;
  transform: translateY(-2px) rotate(-45deg);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.35);
}
.in-traffic { color: var(--ok); }
.in-traffic.late { color: var(--bad); }

/* Refunds */
tr.refund-row td { color: var(--bad); }
tr.refund-row a { color: var(--bad); }
.refund-preview { display: grid; gap: 0; padding: 4px 0; }
.refund-preview .statement-line.total { font-size: 1.02rem; }

/* Invoices to customers: the page looks like paper in both themes, as in the printed PDF */
.badge.paid { background: var(--ok-soft); color: var(--ok); }
.badge.partner { background: var(--cyan-soft); color: var(--cyan-text); }
.job-invoices { margin-top: 6px !important; }
.invoice-actions { margin-bottom: 14px; }
.invoice-list { padding: 6px 0; }
.invoice-row {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  min-height: 60px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  transition: background-color 0.15s ease;
}
.invoice-row:last-child { border-bottom: 0; }
.invoice-row:hover { background: var(--card-alt); }
.invoice-row-no { font-weight: 700; }
.invoice-row-who { display: grid; gap: 2px; min-width: 0; }
.invoice-row-who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invoice-row-who .muted { font-size: 0.85rem; }

/* Bank statements: one row a payment, opened to say what it is */
.file-button { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); cursor: pointer; }
.file-button input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.bank-counts { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.bank-suggested { margin-bottom: 14px; }
.bank-suggested .muted { margin: 6px 0 0; font-size: 0.85rem; }
.bank-list { padding: 6px 0; }
.bank-line { border-bottom: 1px solid var(--line); }
.bank-line:last-child { border-bottom: 0; }
.bank-line summary {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  min-height: 60px;
  padding: 10px 18px;
  cursor: pointer;
  list-style: none;
}
.bank-line summary::-webkit-details-marker { display: none; }
.bank-line summary:hover { background: var(--card-alt); }
.bank-day { font-size: 0.85rem; color: var(--muted); }
.bank-what { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.bank-what strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bank-what .muted { font-size: 0.85rem; }
.bank-amount { font-weight: 700; white-space: nowrap; }
.bank-amount.out { color: var(--bad); }
.bank-amount.in { color: var(--ok); }
.bank-panel { padding: 4px 18px 18px; }
.bank-panel [hidden] { display: none !important; }
.bank-panel h3 { margin: 4px 0 0; font-size: 1rem; }
.bank-panel form { padding: 12px; border: 1px solid var(--line); border-radius: var(--r-field); }
.bank-links { display: grid; gap: 8px; }
.bank-links button { justify-content: flex-start; text-align: left; white-space: normal; }
label.check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-weight: 500; }
label.check input { width: 22px; height: 22px; flex: none; }
.week-paid { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; padding: 4px 8px 10px 26px; }
@media (max-width: 600px) {
  .bank-line summary { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 14px; }
  .bank-day { grid-column: 1 / -1; }
  .bank-line summary .badge { grid-column: 2; justify-self: end; }
  .bank-panel { padding: 4px 14px 16px; }
}

.invoice-lines { display: grid; gap: 10px; }
.invoice-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px 140px 96px 48px;
  gap: 8px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-field);
  background: var(--card-alt);
}
.invoice-line-amount { align-self: center; padding-top: 22px; font-weight: 700; }
.invoice-line .icon-button .icon { transform: rotate(45deg); }
.invoice-sums { max-width: 420px; margin-left: auto; width: 100%; }
fieldset.paid-choice { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--r-field); }
fieldset.paid-choice legend { padding: 0 6px; font-size: 0.92rem; }
fieldset.paid-choice label { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: 999px; cursor: pointer; }
fieldset.paid-choice input { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); }
fieldset.paid-choice label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }

.cinvoice {
  position: relative;
  overflow: hidden;
  max-width: 820px;
  margin: 0 auto;
  padding: 44px 40px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #ffffff;
  color: #3a3a3a;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  line-height: 1.55;
  box-shadow: var(--shadow);
}
.cinvoice h1 { margin: 0 0 40px; color: #2b2b2b; font-size: 34px; font-weight: 800; }
.cinvoice h4 { margin: 0 0 4px; color: #2b2b2b; font-size: 12px; font-weight: 700; }
.cinvoice p { margin: 0 0 14px; }
.cinvoice-top { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; margin-bottom: 30px; }
.cinvoice-lines { width: 100%; margin: 10px 0 0; border-collapse: collapse; }
.cinvoice-lines th { padding: 10px 0; border-bottom: 1px solid #d9d9d9; color: #2b2b2b; font-size: 12px; font-weight: 700; }
.cinvoice-lines td { padding: 14px 0; border-bottom: 1px solid #ececec; color: #3a3a3a; }
.cinvoice-lines .num { padding-left: 14px; }
.cinvoice-totals { width: min(320px, 100%); margin: 0 0 0 auto; }
.cinvoice-totals p { display: flex; justify-content: space-between; gap: 16px; margin: 0; padding: 8px 0; border-bottom: 1px solid #ececec; }
.cinvoice-totals p.strong { color: #2b2b2b; font-weight: 700; }
.cinvoice-balance { margin-top: 14px; border: 1px solid #3d9e7e; }
.cinvoice-balance div:first-child { padding: 8px 10px; background: #3d9e7e; color: #ffffff; font-weight: 700; }
.cinvoice-balance div:last-child { padding: 8px 10px; color: #2b2b2b; font-weight: 700; text-align: right; }
.cinvoice-note { margin-top: 40px; }
.cinvoice-signature { margin-top: 26px; }
.cinvoice-signature img { display: block; width: 240px; max-width: 100%; height: auto; border-bottom: 1px solid #9ca3af; }
.cinvoice-signature p { margin-top: 6px; }
.cinvoice-void {
  position: absolute;
  inset: 40% 0 auto;
  color: rgba(185, 28, 28, 0.18);
  font-size: 120px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-align: center;
  transform: rotate(-18deg);
  pointer-events: none;
}

.sign-pad { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: var(--scrim); }
.sign-pad-inner { display: grid; gap: 12px; width: min(720px, 100%); padding: 20px; border-radius: var(--r-card); background: var(--card); box-shadow: var(--shadow-lift); }
.sign-pad-inner h2, .sign-pad-inner p { margin: 0; }
.sign-canvas { width: 100%; height: min(42vh, 260px); border: 2px dashed var(--line-strong); border-radius: var(--r-field); background: #ffffff; touch-action: none; cursor: crosshair; }

/* An odd tile at the end takes the full row */
.tiles > :last-child:nth-child(odd) { grid-column: 1 / -1; }

@media (max-width: 700px) {
  .invoice-row { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 14px; }
  .invoice-row-no { grid-column: 1; }
  .invoice-line { grid-template-columns: 1fr 1fr; }
  .invoice-line-what { grid-column: 1 / -1; }
  .invoice-line-amount { padding-top: 0; }
  .cinvoice { padding: 24px 18px; font-size: 12px; }
  .cinvoice h1 { margin-bottom: 24px; font-size: 26px; }
  .cinvoice-top { gap: 14px; }
  .cinvoice-void { font-size: 72px; }
}

@page { size: A4; margin: 12mm; }
@media print {
  .banner { display: none !important; }
  .cinvoice { max-width: none; padding: 0; border: 0; border-radius: 0; box-shadow: none; }
  .cinvoice-lines tr { break-inside: avoid; }
}
@media print {
  .cinvoice { font-size: 11px; line-height: 1.4; }
  .cinvoice h1 { margin-bottom: 22px; font-size: 28px; }
  .cinvoice p { margin-bottom: 9px; }
  .cinvoice-top { margin-bottom: 14px; }
  .cinvoice-lines th { padding: 7px 0; }
  .cinvoice-lines td { padding: 8px 0; }
  .cinvoice-totals p { padding: 5px 0; }
  .cinvoice-balance { margin-top: 10px; }
  .cinvoice-note { margin-top: 22px; }
  .cinvoice-signature { margin-top: 16px; }
  .cinvoice-note, .cinvoice-signature, .cinvoice-totals { break-inside: avoid; }
}

/* Invoice total that does not match the job amount */
.invoice-sums.off-target .statement-line.total, .invoice-sums .statement-line.off { color: var(--bad); }

input[readonly] { background: var(--card-alt); color: var(--muted); cursor: not-allowed; }

/* Accountant pack: quick periods above the dates */
.pack-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.pack-choices button { flex-direction: column; align-items: flex-start; min-height: 64px; white-space: normal; text-align: left; }
.pack-choices .muted { font-size: 0.82rem; font-weight: 400; }

/* Documents: two upload buttons, technician payments to tick */
.doc-uploads { display: flex; flex-wrap: wrap; gap: 10px; }
.doc-correct-box summary { display: inline-flex; list-style: none; cursor: pointer; }
.doc-correct-box summary::-webkit-details-marker { display: none; }
.doc-correct-box[open] summary { margin-bottom: 10px; }
.bank-panel .doc-correct-box form { margin-top: 0; }
#selfbill-form .selfbill-row { display: grid; width: auto; grid-template-columns: 28px minmax(0, 1fr) minmax(140px, 220px); gap: 10px; align-items: center; min-height: var(--tap); padding: 8px 0; border-bottom: 1px solid var(--line); font-weight: 400; }
#selfbill-form .selfbill-row input[type=checkbox] { width: 22px; height: 22px; }
@media (max-width: 600px) {
  #selfbill-form .selfbill-row { grid-template-columns: 28px minmax(0, 1fr); }
  #selfbill-form .selfbill-row select { grid-column: 2; }
}

/* Profit before the app: the bank month by month, five columns that fit a phone */
.bank-months td, .bank-months th { white-space: nowrap; }
@media (max-width: 600px) {
  .bank-months { font-size: 0.8rem; }
  .bank-months th, .bank-months td { padding: 8px 3px; }
  .bank-months .wide-only { display: none; }
}
