/* InstantAutos jobs dashboard
   Direction (shared with the website): straight-talking, practical, on its way.
   World: the London kerb. Signature: the UK number plate, the one bright thing on each screen.
   Chrome stays neutral; red is only the next action. */
:root {
  --navy: #1e2a44;
  --red: #d33a3a;
  --red-dark: #b62e2e;
  --plate: #f9d20f;
  --plate-edge: #e6be00;
  --plate-blue: #1c4fa3;

  --bg: #f4f5f7;
  --card: #ffffff;
  --raised: #eceef2;
  --text: #141a26;
  --text-2: #4b5263;
  --muted: #6b7180;
  --line: rgba(20, 26, 38, 0.08);
  --line-strong: rgba(20, 26, 38, 0.16);

  /* Status dots, toned to sit in the palette */
  --st-booked: #8a93a6;
  --st-en_route: #3b6fc4;
  --st-in_progress: #d9a400;
  --st-done: #2f8a57;
  --st-invoiced: #1e2a44;

  --display: "Bricolage Grotesque", "Instrument Sans", system-ui, sans-serif;
  --ui: "Instrument Sans", system-ui, -apple-system, sans-serif;
  --r-control: 10px;
  --r-card: 16px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --tabbar: 64px;
}

* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh;
  font: 16px/1.5 var(--ui); color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  display: grid; grid-template-columns: 1fr auto; align-content: start;
}
h1, h2 { margin: 0; font-weight: 500; }
h1 { font: 500 28px/1.15 var(--display); }
h2 { font-size: 16px; }
p { margin: 0; }
a { color: var(--red-dark); text-underline-offset: 3px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

/* Shell: phone = brand row on top + tab bar at the bottom; desktop = sidebar */
.side { display: contents; }
.brand { grid-column: 1; padding: 16px 16px 0; align-self: center; justify-self: start; }
.brand img { display: block; width: auto; height: 32px; mix-blend-mode: multiply; /* the logo is a JPG on white; this lets the page grey show through */ }
.user { grid-column: 2; display: flex; align-items: center; gap: 8px; padding: 16px 16px 0; margin: 0; }
.user-name { display: none; }
.user-out { display: none; }
.main { grid-column: 1 / -1; min-width: 0; padding: 16px 16px calc(var(--tabbar) + 32px + env(safe-area-inset-bottom)); }
.tabs {
  position: fixed; inset: auto 0 0 0; z-index: 10;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 12px; font-weight: 500; color: var(--muted); text-decoration: none;
  transition: color 150ms var(--ease);
}
.tabs a .i { width: 22px; height: 22px; }
.tabs a[aria-current="page"] { color: var(--text); }
.page-login { display: block; }
.page-login .main { padding-bottom: 32px; }

@media (min-width: 960px) {
  body { grid-template-columns: 248px minmax(0, 1fr); }
  .side {
    display: flex; flex-direction: column; gap: 24px;
    position: sticky; top: 0; height: 100vh; padding: 24px 16px;
    background: var(--card); border-right: 1px solid var(--line);
  }
  .brand { padding: 0 8px; }
  .brand img { height: 40px; }
  .tabs { position: static; display: flex; flex-direction: column; gap: 2px; height: auto; padding: 0; border: 0; }
  .tabs a { flex-direction: row; justify-content: flex-start; gap: 10px; height: 36px; padding: 0 8px; border-radius: 8px; font-size: 15px; color: var(--text-2); }
  .tabs a .i { width: 18px; height: 18px; color: var(--muted); }
  .tabs a:hover { background: var(--bg); }
  .tabs a[aria-current="page"] { background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
  .user { margin-top: auto; padding: 16px 8px 0; border-top: 1px solid var(--line); justify-content: space-between; }
  .user-name { display: block; font-size: 14px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .main { grid-column: 2; padding: 32px; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 16px; border-radius: var(--r-control); border: 1px solid transparent;
  font: 500 15px/1 var(--ui); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease), transform 120ms var(--ease);
}
.btn:active { transform: scale(0.98); }
.btn-lg { height: 52px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-secondary { background: var(--card); color: var(--text); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--raised); }
.btn-secondary .i { color: var(--muted); }
.link-btn { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 4px; background: none; border: 0; font: 500 14px/1 var(--ui); color: var(--text-2); cursor: pointer; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--raised); color: var(--text); }
.quiet { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); text-decoration: none; font-size: 14px; font-weight: 500; }
.quiet .i { width: 16px; height: 16px; color: var(--muted); }
.back { display: inline-flex; align-items: center; gap: 4px; height: 36px; margin-bottom: 8px; color: var(--text-2); text-decoration: none; font-size: 14px; font-weight: 500; }

/* The plate: signature */
.plate {
  display: inline-flex; align-items: stretch; flex: none; height: 40px; border-radius: 6px; overflow: hidden;
  background: linear-gradient(180deg, #fbdc3a 0%, var(--plate) 55%, #f2c900 100%);
  border: 1px solid var(--plate-edge);
  box-shadow: inset 0 0 0 2px rgba(20, 26, 38, 0.85), 0 1px 2px rgba(20, 26, 38, 0.18);
}
.plate-gb { display: flex; align-items: flex-end; justify-content: center; width: 20px; margin: 2px 0 2px 2px; padding-bottom: 4px; border-radius: 4px 0 0 4px; background: var(--plate-blue); color: #fff; font: 600 8px/1 var(--ui); }
.plate-reg { display: flex; align-items: center; padding: 0 12px; font: 700 24px/1 var(--display); font-variation-settings: "wdth" 75, "opsz" 96; letter-spacing: 0.05em; color: #121212; white-space: nowrap; }
.plate-xs { height: 24px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(20, 26, 38, 0.85); }
.plate-xs .plate-gb { width: 10px; margin: 1px 0 1px 1px; font-size: 0; }
.plate-xs .plate-reg { padding: 0 6px; font-size: 14px; }
.plate-sm { height: 28px; border-radius: 5px; }
.plate-sm .plate-gb { width: 14px; font-size: 0; }
.plate-sm .plate-reg { padding: 0 8px; font-size: 17px; }
.plate-lg { height: 56px; border-radius: 8px; box-shadow: inset 0 0 0 3px rgba(20, 26, 38, 0.85), 0 1px 2px rgba(20, 26, 38, 0.2), 0 8px 20px rgba(20, 26, 38, 0.12); }
.plate-lg .plate-gb { width: 28px; margin: 3px 0 3px 3px; padding-bottom: 6px; font-size: 11px; }
.plate-lg .plate-reg { padding: 0 16px; font-size: 34px; }
.plate-input { display: flex; height: 64px; border-radius: 8px; box-shadow: inset 0 0 0 3px rgba(20, 26, 38, 0.85), 0 1px 2px rgba(20, 26, 38, 0.2); }
.plate-input .plate-gb { width: 32px; margin: 3px 0 3px 3px; padding-bottom: 8px; font-size: 11px; }
.plate-input input {
  flex: 1; min-width: 0; border: 0; background: transparent; padding: 0 12px; text-align: center;
  font: 700 34px/1 var(--display); font-variation-settings: "wdth" 75, "opsz" 96; letter-spacing: 0.05em; text-transform: uppercase; color: #121212;
}
.plate-input input::placeholder { color: rgba(18, 18, 18, 0.3); }
.plate-input input:focus { outline: none; }
.plate-input:focus-within { box-shadow: inset 0 0 0 3px var(--navy), 0 0 0 3px rgba(30, 42, 68, 0.25); }

/* Page parts */
.page-head { display: grid; gap: 4px; margin-bottom: 16px; }
.page-head p { margin-top: 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 20px; margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.empty { padding: 12px 0; color: var(--muted); font-size: 14px; list-style: none; }
.flash { margin-bottom: 12px; padding: 12px 16px; border-radius: var(--r-control); background: var(--card); border: 1px solid var(--line-strong); font-size: 15px; }
.flash-error { border-color: rgba(211, 58, 58, 0.4); color: var(--red-dark); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot-booked { background: var(--st-booked); }
.dot-en_route { background: var(--st-en_route); }
.dot-in_progress { background: var(--st-in_progress); }
.dot-done { background: var(--st-done); }
.dot-invoiced { background: var(--st-invoiced); }
.count { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }

/* Board: swipe between columns on a phone, all five side by side on a big screen */
.status-bar { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px 4px; scrollbar-width: none; }
.status-chip { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap; }
.board {
  display: grid; grid-auto-flow: column; grid-auto-columns: 86%; gap: 12px; align-items: start;
  overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 0 16px 8px; scroll-padding: 0 16px;
}
.column { scroll-snap-align: start; display: grid; gap: 8px; padding: 12px; border-radius: var(--r-card); background: var(--raised); }
.column h2 { display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 4px; font-size: 15px; }
.column .empty { padding: 4px 4px 8px; }
.job-card {
  display: grid; gap: 4px; padding: 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line);
  color: var(--text); text-decoration: none; transition: border-color 150ms var(--ease);
}
.job-card:hover { border-color: var(--line-strong); }
.job-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.job-when { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.job-when.is-today { color: var(--text); font-weight: 500; }
.job-work { font-weight: 500; line-height: 1.35; }
.job-meta { font-size: 14px; color: var(--text-2); }
.job-mech { font-size: 13px; color: var(--muted); }
.job-mech.is-open { color: var(--red-dark); }
@media (min-width: 960px) {
  .status-bar { display: none; }
  .board { grid-auto-columns: 280px; margin: 0; padding: 0 0 8px; }
}
@media (min-width: 1400px) {
  .board { grid-auto-flow: row; grid-template-columns: repeat(5, minmax(0, 1fr)); overflow: visible; }
}

/* Job page */
.main > .back, .main > .job-head, .main > .card, .main > .actions, .main > .page-head, .main > .search, .main > .list, .main > details { max-width: 720px; }
.job-head { display: grid; gap: 16px; justify-items: start; margin-bottom: 20px; }
.job-head h1 { font-size: 26px; }
.job-head p { margin-top: 4px; }
.steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 0 0 16px; padding: 0; list-style: none; }
.step { display: grid; justify-items: start; gap: 8px; padding-top: 8px; border-top: 3px solid var(--raised); font-size: 12px; color: var(--muted); line-height: 1.25; }
.step .dot { opacity: 0.5; }
.step.is-current { border-top-color: var(--text); color: var(--text); font-weight: 500; }
.step.is-current .dot { opacity: 1; }
.status-actions { display: grid; gap: 4px; justify-items: center; }
.status-actions form { width: 100%; display: grid; justify-items: center; }
.actions { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; margin-bottom: 12px; }
.facts { display: grid; grid-template-columns: 96px 1fr; gap: 8px 12px; margin: 0; font-size: 15px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.notes { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--text-2); font-size: 15px; }
.parts { width: 100%; border-collapse: collapse; font-size: 15px; margin-bottom: 12px; }
.parts th { text-align: left; font-size: 13px; font-weight: 500; color: var(--muted); padding: 0 8px 8px 0; }
.parts td { padding: 8px 8px 8px 0; border-top: 1px solid var(--line); vertical-align: middle; }
.parts td:last-child, .parts th:last-child { width: 36px; padding-right: 0; }
.parts .num { text-align: right; }
.parts tfoot td { font-weight: 500; border-top-color: var(--line-strong); }
.add-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.add > summary { list-style: none; cursor: pointer; }
.add > summary::-webkit-details-marker { display: none; }
.add[open] > summary.btn { display: none; }
.add .form { margin-top: 4px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 0 0 12px; padding: 0; list-style: none; }
.photos li { position: relative; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--raised); }
.photos form { position: absolute; top: 4px; right: 4px; }
.icon-btn.on-photo { width: 32px; height: 32px; background: rgba(20, 26, 38, 0.6); color: #fff; }
.photo-form label { cursor: pointer; }

/* Forms */
.form { display: grid; gap: 16px; }
fieldset { display: grid; gap: 12px; margin: 0; padding: 0; border: 0; }
legend { padding: 0; margin-bottom: 12px; font: 500 18px/1.2 var(--display); }
.field { display: grid; gap: 6px; min-width: 0; }
.field-label { font-size: 14px; font-weight: 500; color: var(--text-2); }
.opt { font-weight: 400; color: var(--muted); }
.field > input:not([type="checkbox"]), .field > select, .field > textarea, .dev-login input {
  width: 100%; min-height: 48px; padding: 10px 12px; border-radius: var(--r-control);
  border: 1px solid var(--line-strong); background: var(--card); color: var(--text);
  font: 16px/1.4 var(--ui); /* 16px stops iOS zooming into the field */
}
.field textarea { resize: vertical; }
.field > input:focus, .field > select:focus, .field > textarea:focus, .dev-login input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(30, 42, 68, 0.15); }
.has-error > input, .has-error > select, .has-error > textarea { border-color: var(--red); }
.field-error { font-size: 14px; color: var(--red-dark); }
.row2, .row3 { display: grid; gap: 12px; }
.row3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 560px) { .row2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.reg-chosen { display: flex; align-items: center; gap: 16px; font-size: 15px; }
.reg-find .plate-input { width: 100%; }

/* Lists and search */
.search { position: relative; margin-bottom: 12px; }
.search .i { position: absolute; left: 14px; top: 15px; color: var(--muted); }
.search input { width: 100%; height: 48px; padding: 0 12px 0 42px; border-radius: var(--r-control); border: 1px solid var(--line-strong); background: var(--card); font: 16px var(--ui); color: var(--text); }
.search input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(30, 42, 68, 0.15); }
.list { margin: 0; padding: 0; list-style: none; }
.card.list { padding: 4px 20px; }
.list li + li { border-top: 1px solid var(--line); }
.list a { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 0; color: var(--text); text-decoration: none; }
.list-main { flex: 1; min-width: 0; display: grid; gap: 2px; font-weight: 500; }
.list-main .muted { font-weight: 400; font-size: 14px; }
.list-side { display: flex; gap: 4px; }

/* Sign-in */
.login { max-width: 400px; margin: 12vh auto 0; display: grid; gap: 16px; justify-items: start; }
.login h1 { margin-top: 16px; font-size: 32px; }
.login p { margin-bottom: 8px; }
.g-logo { width: 18px; height: 18px; }
.dev-login { width: 100%; display: grid; gap: 8px; margin-top: 24px; padding-top: 24px; border-top: 1px dashed var(--line-strong); font-size: 14px; color: var(--muted); }
.dev-login label { display: grid; gap: 6px; }

/* Stats: label, figure, what it compares to. Nothing else */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.stat { display: grid; gap: 4px; align-content: start; padding: 16px; border-radius: var(--r-card); background: var(--card); border: 1px solid var(--line); color: var(--text); text-decoration: none; }
a.stat:hover { border-color: var(--line-strong); }
.stat-label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.stat-value { font: 500 24px/1.15 var(--display); font-variant-numeric: tabular-nums; }
.stat-note { font-size: 13px; color: var(--muted); }
.is-loss { color: var(--red-dark); }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } .stat-value { font-size: 28px; } }

.home-grid { display: grid; gap: 0 12px; align-items: start; }
@media (min-width: 1100px) { .home-grid { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }
.list-time { flex: none; min-width: 52px; white-space: nowrap; font-size: 14px; font-weight: 500; color: var(--text-2); }
.list-main .dot { vertical-align: 1px; }
.list-amount { display: grid; justify-items: end; gap: 4px; }
.list li:not(:has(a)) { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 0; }
.list .empty { display: block; min-height: 0; }

/* Ranked list with thin bars */
.bars { margin: 0; padding: 0; list-style: none; display: grid; gap: 16px; }
.bars li { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; }
.bar-name { font-weight: 500; }
.bar-figs { font-size: 14px; text-align: right; }
.bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--raised); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 3px; background: var(--navy); }
.bars li:first-child .bar span { background: var(--red); }

/* Filters and tags */
.seg { display: flex; gap: 4px; padding: 4px; margin-bottom: 12px; border-radius: 12px; background: var(--raised); max-width: 720px; }
.seg a { flex: 1; display: grid; place-items: center; height: 36px; border-radius: 8px; color: var(--text-2); text-decoration: none; font-size: 14px; font-weight: 500; }
.seg a[aria-current="page"] { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(20, 26, 38, 0.08), inset 0 0 0 1px var(--line); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--raised); color: var(--text-2); font-size: 12px; font-weight: 500; white-space: nowrap; }
.tag-paid { background: rgba(47, 138, 87, 0.12); color: #246b44; }
.tag-overdue { background: rgba(211, 58, 58, 0.1); color: var(--red-dark); }

/* Sums: money read top to bottom, figures in one column */
.sums { display: grid; grid-template-columns: 1fr auto; gap: 8px 0; margin: 0 0 16px; font-size: 15px; font-variant-numeric: tabular-nums; }
.sums dt { color: var(--text-2); }
.sums dd { margin: 0; padding-left: 16px; text-align: right; }
.sums .sum-total { padding-top: 8px; border-top: 1px solid var(--line-strong); font-weight: 600; color: var(--text); }
.expenses { margin-bottom: 12px; }
.expenses .num { font-size: 15px; }

/* Invoice on screen */
.invoice-doc .inv-parties { display: grid; gap: 16px; margin-bottom: 16px; }
.invoice-doc .inv-parties p { margin-top: 4px; font-size: 15px; }
.invoice-doc > .muted { margin-bottom: 12px; }
@media (min-width: 560px) { .invoice-doc .inv-parties { grid-template-columns: 1fr 1fr; } }
.main > .stats, .main > .seg { max-width: none; }
.main > .seg { max-width: 720px; }
.part-link { color: var(--text); text-decoration: none; }
.part-link:hover { text-decoration: underline; }
.notice { border-color: rgba(30, 42, 68, 0.25); background: #f8f9fc; }
.notice p { font-size: 15px; color: var(--text-2); }
.notice strong { color: var(--text); font-weight: 600; }
.notice-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
