/* Token source (design-system.md § 9): role names only; no literal design values elsewhere.
   Visual language (2026-10-21, D-019): near-black on white, light-grey fills, pill-shaped
   controls, one warm-yellow main action per screen, cards on a mobile-first grid. */

/* Manrope (SIL OFL 1.1), self-hosted: vendored by scripts/vendor-assets.mjs. */
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("/assets/fonts/manrope-greek.woff2") format("woff2-variations");
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("/assets/fonts/manrope-latin.woff2") format("woff2-variations");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
    U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --surface-primary: #ffffff;
  --surface-secondary: #f8f8f8;
  --surface-tertiary: #f1f1f1;
  --surface-overlay: #ffffff;
  --surface-inverse: #101010;
  --text-primary: #101010;
  --text-secondary: #6b6b6b;
  --text-on-action: #101010;
  --text-on-inverse: #ffffff;
  --text-on-destructive: #ffffff;
  --text-link: #0971c8;
  --border-subtle: #e8e8e8;
  --border-default: #bbbbbb;
  --border-strong: #8a8a8a;
  /* Light form fields (owner request 2026-10-22, like Skroutz); still 3:1 against white (WCAG 1.4.11). */
  --border-input: #949494;
  --border-focus: #0971c8;
  --action-primary: #ffb800;
  --action-primary-hover: #f0ab00;
  --action-secondary: #ffffff;
  --action-secondary-hover: #f1f1f1;
  --action-destructive: #b42318;
  --action-disabled: #d6d6d6;
  --feedback-success: #2a5d22;
  --feedback-warning: #8a5a00;
  --feedback-warning-surface: #fff4d6;
  --feedback-error: #b42318;
  --feedback-error-surface: #fdecea;
  --feedback-info: #0971c8;
  --status-scheduled: #0971c8;
  --status-in-progress: #8a5a00;
  --status-completed: #2a5d22;
  --status-cancelled: #6b6b6b;
  --plan-paid: #6639ba;

  --font-sans:
    "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  --font-size-display: 1.75rem;
  --font-size-title: 1.375rem;
  --font-size-heading: 1.125rem;
  --font-size-body: 1rem;
  --font-size-body-small: 0.875rem;
  --font-weight-body: 500;
  --font-weight-strong: 700;
  --font-weight-heavy: 800;
  --line-height-tight: 1.25;
  --line-height-body: 1.45;

  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  --target-min: 48px;
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --shadow-card: 0 2px 12px rgb(153 153 153 / 20%);
  --shadow-raised: 0 4px 20px rgb(0 0 0 / 12%);
  --focus-ring: 3px solid var(--border-focus);
  --duration-fast: 150ms;
  --duration-base: 250ms;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body {
  margin: 0;
  background: var(--surface-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-body);
  line-height: var(--line-height-body);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  line-height: var(--line-height-tight);
  font-weight: var(--font-weight-heavy);
}

h1,
h2,
p,
dl,
dd {
  margin: 0;
}

h1 {
  font-size: var(--font-size-title);
}

h2 {
  font-size: var(--font-size-heading);
}

a {
  color: var(--text-link);
  text-underline-offset: 2px;
}

:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

button svg,
.button-primary svg,
.button-secondary svg {
  width: 20px;
  height: 20px;
  flex: none;
}

/* Controls: every button is a pill; the yellow one is the screen's main action. */
button,
.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  justify-self: start;
  min-height: var(--target-min);
  padding: var(--space-xs) var(--space-lg);
  font: inherit;
  font-weight: var(--font-weight-strong);
  color: var(--text-primary);
  background: var(--action-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--duration-fast);
}

button:hover,
.button-secondary:hover {
  background: var(--action-secondary-hover);
}

.button-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  justify-self: start;
  min-height: var(--target-min);
  padding: var(--space-xs) var(--space-lg);
  font: inherit;
  font-weight: var(--font-weight-heavy);
  color: var(--text-on-action);
  background: var(--action-primary);
  border: 1px solid var(--action-primary);
  border-radius: var(--radius-pill);
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--duration-fast);
}

.button-primary:hover {
  background: var(--action-primary-hover);
}

.button-destructive {
  color: var(--text-on-destructive);
  background: var(--action-destructive);
  border-color: var(--action-destructive);
}

.button-destructive:hover {
  background: var(--action-destructive);
  filter: brightness(0.92);
}

/* The new-customer fields show only while "Add … as a new customer" is chosen (D-038). */
.owner-picker:not(:has(input[name="customerId"][value=""]:checked)) .new-customer-fields {
  display: none;
}

.new-customer-fields {
  display: grid;
  gap: var(--space-md);
  margin-top: var(--space-xs);
}

/* Under the sign-in code form: the plain way back to the email form. */
.auth-alternative {
  margin-top: var(--space-md);
  text-align: center;
  font-size: var(--font-size-body-small);
}

/* Outlined red: a destructive action inside a page, away from the filled main one (D-019, D-034). */
.button-danger {
  color: var(--action-destructive);
  border-color: var(--action-destructive);
}

/* Square icon button (pencil, camera): the label is for screen readers. */
.icon-button {
  min-width: var(--target-min);
  padding-inline: 0;
}

.button-secondary[aria-pressed="true"] {
  color: var(--text-on-inverse);
  background: var(--surface-inverse);
  border-color: var(--surface-inverse);
}

/* Layout rhythm: every page and section stacks its blocks with one gap scale, so spacing and
   alignment are the same on every screen (no ad-hoc margins). */
section,
.hero-card,
.empty-card,
.auth-card {
  display: grid;
  gap: var(--space-sm);
  align-content: start;
}

.eyebrow {
  color: var(--text-secondary);
  font-size: var(--font-size-body-small);
  font-weight: var(--font-weight-strong);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lead {
  font-size: var(--font-size-heading);
  font-weight: var(--font-weight-strong);
}

/* Page header: title (and subtitle) on the left, one quiet control on the right. */
.page-header {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-sm);
}

.page-header > div {
  display: grid;
  gap: var(--space-2xs);
}

.page-subtitle {
  color: var(--text-secondary);
  font-weight: var(--font-weight-strong);
}

/* Header card of a job, vehicle or customer: identity first, then meta, then actions. */
.hero-card {
  gap: var(--space-xs);
  padding: var(--space-md) var(--space-lg);
  background: var(--surface-secondary);
  border-radius: var(--radius-lg);
}

.hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.hero-title,
a.hero-title {
  color: var(--text-primary);
  font-size: var(--font-size-title);
  font-weight: var(--font-weight-heavy);
  text-decoration: none;
}

.hero-meta {
  color: var(--text-secondary);
}

.hero-meta a {
  color: var(--text-link);
  font-weight: var(--font-weight-strong);
}

.with-icon {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.with-icon svg {
  width: 18px;
  height: 18px;
}

/* Actions sit together in one wrapping row; on phones they share the width for easy thumbs. */
.action-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
}

.hero-card .action-bar {
  margin-top: var(--space-xs);
}

.empty-card {
  justify-items: center;
  padding: var(--space-2xl) var(--space-lg);
  text-align: center;
  background: var(--surface-secondary);
  border-radius: var(--radius-lg);
}

.empty-card > svg {
  width: 40px;
  height: 40px;
  color: var(--text-secondary);
}

.empty-card .button-primary {
  justify-self: center;
}

input,
select,
textarea {
  min-height: var(--target-min);
  padding: var(--space-xs) var(--space-md);
  font: inherit;
  color: var(--text-primary);
  background: var(--surface-primary);
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  transition: border-color 120ms ease;
}

/* A percentage width lets a long option (America/Argentina/ComodRivadavia) shrink with the
   form instead of widening the page (D-044). */
.field select {
  width: 100%;
}

input:hover,
select:hover,
textarea:hover,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--text-primary);
}

/* A lookup as you type: a spinner inside the field's end, as search boxes in other apps do. */
.lookup-field {
  position: relative;
  display: block;
}

.lookup-field input {
  width: 100%;
  padding-inline-end: calc(var(--space-md) + 16px + var(--space-xs));
}

/* The search bar and the Day View date stay filled, like a top bar; they turn white when in use. */
input[type="search"] {
  background: var(--surface-tertiary);
  border-color: var(--border-strong);
}

input[type="radio"],
input[type="checkbox"] {
  min-height: auto;
  width: 22px;
  height: 22px;
  accent-color: var(--surface-inverse);
}

input[type="search"] {
  border-radius: var(--radius-pill);
  padding-inline: var(--space-lg);
}

.lookup-field input[type="search"] {
  padding-inline-end: calc(var(--space-lg) + 16px + var(--space-sm));
}

/* A date field opens its calendar on any tap (app.js). */
input[type="date"] {
  cursor: pointer;
}

textarea {
  min-height: calc(var(--target-min) * 2);
  resize: vertical;
}

input[type="search"]:focus {
  background: var(--surface-primary);
}

/* Pages without the app navigation (landing, sign-in, share page): centred column. */
main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-lg);
  align-content: start;
  max-width: 72rem;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md) var(--space-2xl);
}

/* Brand mark: the tools tile and the word (sidebar, public header). */
.app-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--text-primary);
  font-size: var(--font-size-heading);
  font-weight: var(--font-weight-heavy);
  text-decoration: none;
}

.app-brand img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.language-switch {
  display: inline-flex;
  align-items: center;
  min-height: var(--target-min);
  padding: 0 var(--space-sm);
  color: var(--text-secondary);
  font-weight: var(--font-weight-strong);
  text-decoration: none;
  border-radius: var(--radius-pill);
}

.language-switch:hover {
  color: var(--text-primary);
  background: var(--surface-tertiary);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  max-width: 72rem;
  margin: 0 auto;
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
}

.skip-link {
  position: absolute;
  left: var(--space-xs);
  top: calc(-1 * var(--space-2xl));
  padding: var(--space-sm) var(--space-md);
  background: var(--surface-overlay);
  color: var(--text-link);
  z-index: 10;
}

.skip-link:focus {
  top: var(--space-xs);
}

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

/* biome-ignore-start lint/complexity/noImportantStyles: reduced motion must beat every component animation (WCAG 2.3.3) */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
  }
}
/* biome-ignore-end lint/complexity/noImportantStyles: reduced motion must beat every component animation (WCAG 2.3.3) */

.auth-card {
  width: 100%;
  max-width: 28rem;
  margin: var(--space-xl) auto 0;
  padding: var(--space-lg);
  background: var(--surface-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.auth-card form {
  display: grid;
  gap: var(--space-sm);
}

.auth-card button {
  justify-self: stretch;
  font-weight: var(--font-weight-heavy);
  background: var(--action-primary);
  border-color: var(--action-primary);
}

/* "Send a new code", "Sign in with a passkey", "Not now": quieter buttons under the main one. */
.auth-card form.auth-resend {
  margin-top: var(--space-md);
}

.auth-passkey {
  display: grid;
  gap: var(--space-sm);
}

.auth-or {
  margin: var(--space-md) 0 0;
  text-align: center;
  color: var(--text-secondary);
}

.auth-card button.button-secondary {
  font-weight: var(--font-weight-strong);
  background: var(--action-secondary);
  border-color: var(--border-default);
}

/* Sign-up: the region guessed from the visit, folded under one line (D-044). */
.region-details {
  display: grid;
  gap: var(--space-sm);
}

.region-details summary {
  color: var(--text-secondary);
  cursor: pointer;
}

.field-error {
  margin: 0;
  color: var(--feedback-error);
  font-weight: var(--font-weight-strong);
}

/* AppShell (design-system § 5, § 7): bottom tab bar on phones, side navigation from 1024 px. */
.app-navigation {
  position: fixed;
  inset: auto 0 0 0;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface-primary);
  border-top: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card);
  z-index: 5;
}

.app-navigation .app-brand {
  display: none;
}

.app-navigation ul {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0;
  padding: 0;
  list-style: none;
}

.app-navigation a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  min-height: var(--target-min);
  padding: var(--space-xs) var(--space-2xs);
  color: var(--text-secondary);
  /* Tab-bar label size (12 px), one line: "Νέα εργασία" fits a 320 px phone. */
  font-size: 0.75rem;
  font-weight: var(--font-weight-strong);
  text-decoration: none;
  white-space: nowrap;
  border-top: 3px solid transparent;
}

.app-navigation span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-navigation a[aria-current="page"] {
  color: var(--text-primary);
  border-top-color: var(--action-primary);
}

.app-navigation + main {
  max-width: none;
  margin: 0;
  padding: var(--space-md) var(--space-md)
    calc(var(--target-min) + var(--space-2xl) + env(safe-area-inset-bottom));
}

@media (min-width: 1024px) {
  .app-navigation {
    inset: 0 auto 0 0;
    width: 14rem;
    border-top: 0;
    border-right: 1px solid var(--border-subtle);
    box-shadow: none;
  }

  .app-navigation .app-brand {
    display: inline-flex;
    padding: var(--space-lg) var(--space-lg) var(--space-xs);
  }

  .app-navigation ul {
    grid-template-columns: 1fr;
    padding: var(--space-sm);
    gap: var(--space-2xs);
  }

  .app-navigation a {
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-md);
    border-top: 0;
    border-radius: var(--radius-pill);
    font-size: var(--font-size-body);
  }

  .app-navigation a[aria-current="page"] {
    background: var(--surface-tertiary);
  }

  .app-navigation + main {
    max-width: 80rem;
    margin-left: 14rem;
    padding: var(--space-xl) var(--space-2xl);
  }
}

/* Search (flow 02): pill field on top, live results as cards below. */
.search-form {
  display: grid;
  gap: var(--space-xs);
  max-width: 40rem;
}

.search-form input[type="search"] {
  min-height: 52px;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-heading);
}

.htmx-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  opacity: 0;
  color: var(--text-secondary);
  font-size: var(--font-size-body-small);
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
  transition: opacity var(--duration-fast) var(--duration-base);
}

.search-hint,
.empty-state {
  color: var(--text-secondary);
}

/* Cards: result, job and history rows share one look. Lists stay one column (D-032); the Day View grid widens. */
.result-list,
.job-list,
.history-list {
  display: grid;
  gap: var(--space-sm);
  margin: 0;
  padding: 0;
  list-style: none;
}

.result-list > li,
.job-row,
.history-entry {
  background: var(--surface-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.result-list > li {
  padding: var(--space-sm) var(--space-md);
}

.result-list > li:has(> :is(a, button):only-child) {
  padding: 0;
}

/* A row that chooses (the vehicle matches on New job) is a button, dressed as the link rows. */
.result-list > li > :where(button) {
  width: 100%;
  justify-self: stretch;
  justify-content: start;
  justify-items: start;
  text-align: start;
  background: none;
  border: 0;
  border-radius: 0;
  cursor: pointer;
}

/* The card's own link only; menus inside a card keep their own look. */
.result-list > li > :where(a, button) {
  display: grid;
  gap: var(--space-2xs);
  min-height: var(--target-min);
  padding: var(--space-sm) var(--space-md);
  color: var(--text-primary);
  font-weight: var(--font-weight-strong);
  text-decoration: none;
}

.result-list span {
  color: var(--text-secondary);
  font-size: var(--font-size-body-small);
  font-weight: var(--font-weight-body);
}

/* Lists are one column at every width (Material list pattern): one item per row reads in order.
   Only the Day View keeps a card grid, where order does not matter. */
@media (min-width: 734px) {
  .job-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Wider rows lay their facts side by side (plate · vehicle · owner), like a list view. */
  .result-list:not(.settings-list) > li > :where(a, button) {
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    align-items: center;
    column-gap: var(--space-md);
  }
}

@media (min-width: 1200px) {
  .job-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.plate {
  font-weight: var(--font-weight-heavy);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* The plate is the key to everything (flow 01): a big field that reads like a number plate. */
input[name="plate"] {
  min-height: 56px;
  font-size: var(--font-size-title);
  font-weight: var(--font-weight-heavy);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Forms (Input, Button, Banner in design-system § 5). */
.form-stack {
  display: grid;
  gap: var(--space-md);
  max-width: 40rem;
}

.field {
  display: grid;
  gap: var(--space-2xs);
}

.field label {
  font-weight: var(--font-weight-strong);
}

.field [aria-invalid="true"] {
  border-color: var(--feedback-error);
}

.banner {
  margin-block: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  background: var(--feedback-warning-surface);
  border: 1px solid var(--feedback-warning);
}

.banner p {
  margin: 0;
}

/* Beta (D-047): one quiet line above the day, with ✕ to hide it on this device. */
.beta-banner {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-block-end: var(--space-md);
  padding: var(--space-xs) var(--space-xs) var(--space-xs) var(--space-md);
  border-radius: var(--radius);
  background: var(--surface-secondary);
  border: 1px solid var(--border-subtle);
}

.beta-banner p {
  flex: 1;
  margin: 0;
}

.notes {
  white-space: pre-line;
}

/* Form sections are soft panels; the floated legend sits inside like a section title. */
fieldset {
  display: grid;
  gap: var(--space-md);
  min-width: 0;
  margin: 0;
  padding: var(--space-md);
  background: var(--surface-secondary);
  border: 0;
  border-radius: var(--radius-lg);
}

fieldset fieldset {
  background: var(--surface-primary);
  border: 1px solid var(--border-subtle);
}

legend {
  float: left;
  width: 100%;
  padding: 0;
  font-size: var(--font-size-heading);
  font-weight: var(--font-weight-heavy);
}

/* UpgradePrompt (design-system § 5): plan colour marks the paid offer, never an error. */
.upgrade-prompt {
  max-width: 40rem;
  padding: var(--space-md);
  border: 2px solid var(--plan-paid);
  border-radius: var(--radius-lg);
}

.upgrade-prompt {
  display: grid;
  gap: var(--space-xs);
}

.upgrade-prompt h2 {
  color: var(--plan-paid);
}

/* Day View (design-system § 5: JobRow, StatusPill, EmptyState). */
.job-row {
  display: grid;
  gap: var(--space-sm);
  align-content: space-between;
  padding: var(--space-md);
}

.job-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2xs) var(--space-sm);
}

.job-summary span {
  color: var(--text-secondary);
}

/* Inside cards links read as titles, like product names: dark, no underline. */
.job-summary a,
.share-jobs a {
  color: var(--text-primary);
  font-weight: var(--font-weight-strong);
  text-decoration: none;
}

.job-summary .plate {
  font-size: var(--font-size-heading);
  font-weight: var(--font-weight-heavy);
}

/* The whole Day View card opens the job; its buttons sit above the stretched link. */
.job-row {
  position: relative;
}

.card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

.job-row:has(.card-link:hover) {
  border-color: var(--border-strong);
}

.job-row:has(.card-link:focus-visible) {
  outline: 3px solid var(--border-focus);
  outline-offset: 2px;
}

.card-link:focus-visible {
  outline: 0;
}

.row-actions {
  position: relative;
  z-index: 1;
}

/* With a mouse the plate also opens the vehicle; a finger anywhere on the card opens the job. */
@media (hover: hover) and (pointer: fine) {
  .job-summary > .plate {
    position: relative;
    z-index: 1;
  }

  .job-summary > a.plate:hover {
    text-decoration: underline;
  }
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  justify-self: start;
  padding: var(--space-2xs) var(--space-sm);
  font-size: var(--font-size-body-small);
  font-weight: var(--font-weight-strong);
  background: var(--surface-tertiary);
  border-radius: var(--radius-pill);
}

.status-pill svg {
  width: 18px;
  height: 18px;
}

.status-scheduled {
  color: var(--status-scheduled);
}
.status-in_progress {
  color: var(--status-in-progress);
}
.status-completed {
  color: var(--status-completed);
}
.status-cancelled {
  color: var(--status-cancelled);
}

.job-summary > * {
  grid-column: 1 / -1;
}

.job-summary > .plate {
  grid-column: 1;
}

.job-summary > .status-pill {
  grid-row: 1;
  grid-column: 2;
  align-self: start;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Every card's main action (Start, Complete) fills the row the same way; camera and ⋯ stay square. */
.row-actions > :first-child {
  flex: 1 1 0;
  min-width: 0;
}

/* A completed card keeps only ⋯, at the end, so every card has the same shape. */
.row-actions-end {
  justify-content: flex-end;
}

.row-actions-end > :first-child {
  flex: 0 0 auto;
}

/* The app bar's ⋯ opens over the page like a card's. */
.row-actions > form > button {
  width: 100%;
}

/* State by position and a coloured edge, not the pill alone (D-034, Google Calendar's event edge). */
.job-row {
  border-left: 4px solid var(--border-default);
}
.job-row[data-job-status="scheduled"] {
  border-left-color: var(--status-scheduled);
}
.job-row[data-job-status="in_progress"] {
  border-left-color: var(--status-in-progress);
}
.job-row[data-job-status="completed"] {
  border-left-color: var(--status-completed);
}
.job-row[data-job-status="cancelled"] {
  border-left-color: var(--status-cancelled);
}

/* Square camera button beside the row's main action; the label is for screen readers. */
.row-camera {
  min-width: var(--target-min);
  padding-inline: 0;
}

.row-more {
  position: relative;
}

.row-more summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--target-min);
  min-height: var(--target-min);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  background: var(--action-secondary);
  cursor: pointer;
  list-style: none;
}

.row-more summary::-webkit-details-marker {
  display: none;
}

.row-more summary svg {
  width: 20px;
  height: 20px;
}

.row-more[open] summary {
  background: var(--surface-tertiary);
}

/* The menu: a card under the ⋯ button, one full-height row per action. */
.menu {
  position: absolute;
  top: calc(100% + var(--space-xs));
  left: 0;
  z-index: 6;
  display: grid;
  gap: var(--space-2xs);
  min-width: 16rem;
  padding: var(--space-xs);
  background: var(--surface-overlay);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-raised);
}

.menu ul {
  display: grid;
  gap: var(--space-2xs);
  margin: 0;
  padding: 0;
  list-style: none;
}

.menu-title {
  padding: var(--space-xs) var(--space-sm);
  color: var(--text-secondary);
  font-size: var(--font-size-body-small);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-item {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: var(--target-min);
  padding: 0 var(--space-sm);
  color: var(--text-primary);
  font-weight: var(--font-weight-strong);
  text-decoration: none;
  border-radius: var(--radius);
}

.menu .menu-item svg {
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
}

.menu-item:hover,
.menu-item:focus-visible {
  background: var(--surface-tertiary);
}

.menu .menu-item-danger,
.menu .menu-item-danger svg {
  color: var(--action-destructive);
}

/* .row-actions is a stacking context (z-index 1); lift the open one, or later cards, their plates
   (z-index 1 with a mouse) and the tab bar paint over the dropdown or sheet and take its clicks. */
.row-actions:has(.row-more[open]) {
  z-index: 30;
}

/* Phones: the menu becomes a bottom sheet over a dimmed page. */
@media (max-width: 733px) {
  :root:has(.row-more[open]) {
    overflow: hidden;
  }

  .row-more[open]::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 29;
    background: rgb(0 0 0 / 35%);
  }

  .menu {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 30;
    min-width: 0;
    padding: var(--space-md) var(--space-md) calc(var(--space-lg) + env(safe-area-inset-bottom));
    border: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    animation: sheet-up var(--duration-base) ease-out;
  }

  .menu-title {
    font-size: var(--font-size-body);
  }

  .menu::before {
    content: "";
    justify-self: center;
    width: 40px;
    height: 4px;
    margin-bottom: var(--space-xs);
    background: var(--border-default);
    border-radius: var(--radius-pill);
  }
}

@keyframes sheet-up {
  from {
    transform: translateY(100%);
  }
}

/* HistoryList + ShowMore (design-system § 5). */
.history-entry {
  display: grid;
  align-content: start;
  gap: var(--space-2xs);
  padding: var(--space-sm) var(--space-md);
}

.history-entry a {
  display: grid;
  align-content: start;
  gap: var(--space-2xs);
  color: var(--text-primary);
  font-weight: var(--font-weight-strong);
  text-decoration: none;
}

.history-entry span {
  color: var(--text-secondary);
  font-size: var(--font-size-body-small);
  font-weight: var(--font-weight-body);
}

/* The whole history row opens the job, as list rows do in mail and file apps; hover shows it with a mouse. */
.history-entry {
  position: relative;
}

.history-entry > a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

.history-entry:has(> a:focus-visible) {
  outline: 3px solid var(--border-focus);
  outline-offset: 2px;
}

.history-entry > a:focus-visible {
  outline: 0;
}

@media (hover: hover) and (pointer: fine) {
  .history-entry:has(> a:hover),
  .result-list:not(.settings-list) > li:has(> :is(a, button):hover) {
    border-color: var(--border-strong);
    background: var(--surface-secondary);
  }
}

/* Phones: status top right, like the Day View cards; km and price under the text. */
.history-entry {
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: var(--space-sm);
}

.history-entry > .status-pill {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
}

.history-entry > span:not(.status-pill) {
  grid-column: 1 / -1;
}

/* Wider screens: one row per job, date leading, what was done in the middle, km/price and status
   trailing (Material list item: leading, headline + supporting text, trailing). */
@media (min-width: 734px) {
  .history-entry {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: var(--space-lg);
  }

  .history-entry > a {
    grid-row: 1 / span 2;
    grid-template-columns: 8.5rem minmax(0, 1fr);
    column-gap: var(--space-md);
  }

  .history-entry > a > :first-child {
    grid-row: 1 / span 3;
  }

  .history-entry > a > :not(:first-child) {
    grid-column: 2;
  }

  .history-entry > span {
    justify-self: end;
    text-align: end;
  }

  .history-entry > span:not(.status-pill) {
    grid-column: 2;
  }
}

.history-more a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: var(--target-min);
  padding: 0 var(--space-lg);
  color: var(--text-primary);
  font-weight: var(--font-weight-strong);
  text-decoration: none;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
}

/* DateStepper and date chips (design-system § 5): pill chips, the chosen one dark. */
.date-stepper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}

.date-stepper > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--target-min);
  min-height: var(--target-min);
  padding: 0 var(--space-md);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  background: var(--action-secondary);
  color: var(--text-primary);
  font-weight: var(--font-weight-strong);
  text-decoration: none;
}

.date-stepper > a[aria-current="page"] {
  color: var(--text-on-inverse);
  background: var(--surface-inverse);
  border-color: var(--surface-inverse);
}

.date-stepper > a {
  height: var(--target-min);
  min-height: var(--target-min);
  padding-block: 0;
}

.date-stepper > a svg {
  width: 20px;
  height: 20px;
}

.date-stepper .date-pick {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* The calendar: an icon chip with the native date input laid invisibly over it, so a tap opens the
   system picker everywhere (D-035). Without scripts the input stays a visible field with Go. */
.date-pick-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--target-min);
  height: var(--target-min);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  background: var(--action-secondary);
}

.date-pick-button svg {
  width: 20px;
  height: 20px;
}

.date-pick-button:focus-within {
  outline: 3px solid var(--border-focus);
  outline-offset: 2px;
}

.js .date-pick-button input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

html:not(.js) .date-pick-button {
  width: auto;
  padding-inline-start: var(--space-sm);
  gap: var(--space-xs);
}

/* Fallback controls for browsers without scripts (Go, Save role). */
.js .no-js-only {
  display: none;
}

.date-stepper {
  margin-bottom: 0;
}

/* Choice chips (Material): the day of a job, the kind of a vehicle. One tap, state by fill. */
/* Full width in equal parts, like a segmented control; a part too long for its row wraps to the
   next whole row. The fill shows the choice, so the radio circle is hidden but still focusable (D-038). */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.chips > :is(label, a) {
  position: relative;
  display: inline-flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-height: var(--target-min);
  padding: 0 var(--space-sm);
  white-space: nowrap;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  font-weight: var(--font-weight-strong);
  cursor: pointer;
}

.chips label:has(input:checked),
.chips a[aria-current="page"] {
  color: var(--text-on-inverse);
  background: var(--surface-inverse);
  border-color: var(--surface-inverse);
}

.chips input:is([type="radio"], [type="checkbox"]) {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.chips label:has(input:focus-visible) {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

.chips legend {
  flex-basis: 100%;
  margin-bottom: var(--space-xs);
}

/* The calendar chip: the native date input lies invisibly over it, so one tap opens the system
   picker and the chip then shows the day (D-035, D-037). Without scripts the field shows under it. */
.js .date-chip-pick {
  position: relative;
}

.js .date-chip-pick input[type="date"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.js .date-chip-pick:focus-within {
  outline: 3px solid var(--border-focus);
  outline-offset: 2px;
}

.date-chip-pick svg {
  width: 20px;
  height: 20px;
}

/* The optional planned time sits in the Day panel, under the chips, as a plain field (D-050). */
.date-chips > .field {
  flex-basis: 100%;
  margin-top: var(--space-xs);
}

html:not(.js) .date-chips input[type="date"] {
  flex-basis: 100%;
  border-radius: var(--radius-pill);
}

html:not(.js) .date-chips:not(:has(input[value="pick"]:checked)) input[type="date"] {
  display: none;
}

/* Chips inside another form section (the kind of a new vehicle) sit flat, not as a second panel. */
fieldset fieldset.chips {
  padding: 0;
  background: none;
  border: 0;
}

/* Optional vehicle details fold away on New job (D-037). */
.vehicle-details > summary {
  min-height: var(--target-min);
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: var(--font-weight-strong);
}

.vehicle-details > summary svg {
  width: 20px;
  height: 20px;
  transition: transform 150ms;
}

.vehicle-details[open] > summary svg {
  transform: rotate(90deg);
}

.vehicle-details[open] > summary {
  margin-bottom: var(--space-sm);
}

/* Owner picker (flow 01: search existing or name + phone). */
.owner-option {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: var(--target-min);
  padding: 0 var(--space-md);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
}

.option-text {
  display: grid;
  padding-block: var(--space-xs);
}

.option-text > span {
  color: var(--text-secondary);
  font-size: var(--font-size-body-small);
}

.owner-option:has(input:checked) {
  border-color: var(--surface-inverse);
  box-shadow: inset 0 0 0 1px var(--surface-inverse);
}

.known-vehicle {
  display: grid;
  gap: var(--space-xs);
}

.known-vehicle,
.closeout-summary {
  padding: var(--space-md);
  background: var(--surface-secondary);
  border-radius: var(--radius);
}

.closeout-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
}

.closeout-summary > div {
  display: grid;
  gap: var(--space-2xs);
}

.closeout-wide {
  grid-column: 1 / -1;
}

.closeout-summary .price {
  font-size: var(--font-size-title);
  font-weight: var(--font-weight-heavy);
}

.closeout-summary dt {
  color: var(--text-secondary);
  font-size: var(--font-size-body-small);
}

.closeout-summary dd {
  font-weight: var(--font-weight-strong);
}

.danger-zone {
  display: block;
  padding: var(--space-xs) var(--space-md);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
}

.danger-zone[open] {
  display: grid;
  gap: var(--space-md);
  padding-bottom: var(--space-md);
  border-color: var(--action-destructive);
}

.danger-summary {
  color: var(--action-destructive);
  font-weight: var(--font-weight-strong);
  cursor: pointer;
  min-height: var(--target-min);
  display: flex;
  align-items: center;
}

/* Service book (vehicle page) and invite link: one self-contained card. */
.share-panel {
  display: grid;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--surface-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.share-panel h2 {
  margin: 0;
}

.share-panel input[readonly] {
  background: var(--surface-primary);
}

.share-shop {
  color: var(--text-secondary);
  font-weight: var(--font-weight-strong);
}

.share-jobs {
  display: grid;
  gap: var(--space-md);
  padding: 0;
  list-style: none;
}

.share-jobs > li {
  display: grid;
  gap: var(--space-xs);
  padding: var(--space-md);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.share-job-meta {
  color: var(--text-secondary);
  font-weight: var(--font-weight-strong);
}

.share-brand {
  margin-block-start: var(--space-2xl);
  font-size: var(--font-size-body-small);
}

.landing-hero {
  display: grid;
  gap: var(--space-md);
  justify-items: start;
  padding-block: var(--space-xl) var(--space-lg);
}

.landing-hero p {
  max-width: 40rem;
}

.landing-hero h1 {
  max-width: 22ch;
  font-size: var(--font-size-display);
}

.landing-features {
  display: grid;
  gap: var(--space-md);
  padding: 0;
  list-style: none;
}

.landing-features > li {
  display: grid;
  gap: var(--space-xs);
  align-content: start;
  padding: var(--space-lg);
  background: var(--surface-secondary);
  border-radius: var(--radius-lg);
}

/* Beta (D-047): a small yellow pill by the name, and one card on what "early version" means. */
.beta-badge {
  display: inline-block;
  padding: 0.1em 0.6em;
  border-radius: var(--radius-pill);
  background: var(--action-primary);
  color: var(--text-primary);
  font-size: var(--font-size-body-small);
  font-weight: var(--font-weight-heavy);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}

.landing-beta {
  display: grid;
  gap: var(--space-xs);
  margin-block-end: var(--space-lg);
  padding: var(--space-lg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.landing-beta h2,
.landing-beta p {
  margin: 0;
}

@media (min-width: 734px) {
  .landing-features {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Photos (flow 03). */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-xs);
  padding: 0;
  list-style: none;
}

.photo-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
}

.photo-panel {
  display: grid;
  gap: var(--space-sm);
}

.photo-tile {
  display: grid;
  gap: var(--space-2xs);
}

.photo-tile-uploading {
  align-content: center;
  min-height: 120px;
  padding: var(--space-xs);
  background: var(--surface-tertiary);
  border-radius: var(--radius);
}

.photo-tile progress {
  width: 100%;
  accent-color: var(--action-primary);
}

.photo-add,
.row-camera {
  cursor: pointer;
}

.photo-add:focus-within,
.row-camera:focus-within {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

.photo-retry {
  min-height: var(--target-min);
  padding-inline: var(--space-md);
  font-size: var(--font-size-body-small);
}

/* The bin sits on the photo's corner (Google Photos), a full tap target on a light disc. */
.photo-tile {
  position: relative;
}

.photo-delete {
  position: absolute;
  top: var(--space-xs);
  right: var(--space-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--target-min);
  height: var(--target-min);
  padding: 0;
  color: var(--action-destructive);
  background: var(--surface-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.photo-delete svg {
  width: 20px;
  height: 20px;
}

/* Settings and back-office. */
.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: var(--space-sm);
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.draft-notice {
  color: var(--text-secondary);
}

/* Phones: main actions are wide for easy thumbs (nfr-usability-touch). */
@media (max-width: 733px) {
  .action-bar > .button-primary,
  .action-bar > .button-secondary {
    flex: 1 1 auto;
  }

  .share-panel > button,
  .share-panel form > button {
    width: 100%;
  }

  .form-stack > .button-primary:last-child {
    justify-self: stretch;
  }

  .hero-card {
    padding: var(--space-md);
  }
}

/* Job page: its own rhythm, since the region is replaced by polling as one block. */
#job-details {
  display: grid;
  gap: var(--space-lg);
}

.detail-block {
  gap: var(--space-2xs);
}

.photo-grid:empty {
  display: none;
}

/* ---- App feel (2026-10-22): progress, loading, skeletons, transitions, toasts ---- */

/* While the next page loads, the current one stays readable but clearly waiting. */
.is-navigating main {
  opacity: 0.35;
  pointer-events: none;
  transition: opacity var(--duration-base);
}

/* A page on its way: a spinner badge, clear on a phone at arm's length. */
.is-navigating body::before,
.is-navigating body::after {
  content: "";
  position: fixed;
  top: calc(env(safe-area-inset-top) + var(--space-lg));
  left: 50%;
  z-index: 20;
  border-radius: 50%;
}

.is-navigating body::before {
  width: 44px;
  height: 44px;
  margin-left: -22px;
  background: var(--surface-overlay);
  box-shadow: var(--shadow-raised);
}

.is-navigating body::after {
  width: 22px;
  height: 22px;
  margin: 11px 0 0 -11px;
  border: 2.5px solid var(--text-primary);
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}

/* Button loading: the label stays (no layout jump), a spinner sits on top. */
.is-loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.is-loading > * {
  visibility: hidden;
}

.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 20px;
  height: 20px;
  margin: auto;
  border: 2.5px solid var(--text-primary);
  border-right-color: transparent;
  border-radius: var(--radius-pill);
  animation: spin 0.7s linear infinite;
}

.button-destructive.is-loading::after {
  border-color: var(--text-on-destructive);
  border-right-color: transparent;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--text-secondary);
  border-right-color: transparent;
  border-radius: var(--radius-pill);
  animation: spin 0.7s linear infinite;
}

.lookup-field .spinner {
  position: absolute;
  inset-inline-end: var(--space-md);
  top: 50%;
  margin-top: -8px;
  pointer-events: none;
}

/* Pressed feedback on every tappable control (taps register at once: no double-tap zoom delay,
   no grey flash; set on html because both reach every descendant). */
button:active,
.button-primary:active,
.button-secondary:active,
.result-list a:active {
  transform: scale(0.98);
}

/* Skeletons: grey shapes in place of content that is on its way. */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-tertiary) 25%,
    var(--surface-secondary) 50%,
    var(--surface-tertiary) 75%
  );
  background-size: 200% 100%;
  border-radius: var(--radius);
  animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton-title {
  width: 40%;
  height: 22px;
}

.skeleton-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-xs);
}

.skeleton-tile {
  aspect-ratio: 1;
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

/* Search results dim while a new search runs (the input points its indicator here). */
#search-results.htmx-request {
  opacity: 0.5;
  transition: opacity var(--duration-fast) var(--duration-fast);
}

/* Page changes cross-fade (View Transitions); the tab bar stays put. */
.app-navigation {
  view-transition-name: app-navigation;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: var(--duration-base);
}

/* Toasts sit above the tab bar on phones, bottom-right on laptops. */
.toasts {
  /* Top centre, where the eye already is, clear of the phone's tab bar and keyboard (D-029). */
  position: fixed;
  top: calc(env(safe-area-inset-top) + var(--space-md));
  left: 50%;
  z-index: 25;
  display: grid;
  gap: var(--space-xs);
  width: min(26rem, calc(100% - 2 * var(--space-md)));
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-sm) var(--space-sm) var(--space-sm);
  color: var(--text-primary);
  background: var(--surface-overlay);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-raised);
  pointer-events: auto;
  animation: toast-in var(--duration-base) cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.toast p {
  flex: 1;
  margin: 0;
  font-weight: var(--font-weight-strong);
}

.toast-icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  color: var(--text-on-inverse);
  background: var(--surface-inverse);
  border-radius: 50%;
  font-size: var(--font-size-body-small);
  font-weight: var(--font-weight-heavy);
}

.toast-success .toast-icon {
  background: var(--feedback-success);
}

.toast-error {
  border-color: var(--feedback-error);
}

.toast-error .toast-icon {
  background: var(--feedback-error);
}

.toast-action {
  flex: none;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 var(--space-md);
  color: var(--text-on-action);
  background: var(--action-primary);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-body-small);
  font-weight: var(--font-weight-heavy);
  text-decoration: none;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
  }
}

/* Laptops: centred over the content, not the sidebar. */
@media (min-width: 1024px) {
  .app-navigation ~ .toasts {
    left: calc(50% + 7rem);
  }
}

/* biome-ignore-start lint/complexity/noImportantStyles: reduced motion turns off shimmer, spinners slow, transitions (WCAG 2.3.3) */
@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none !important;
  }

  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}
/* biome-ignore-end lint/complexity/noImportantStyles: reduced motion turns off shimmer, spinners slow, transitions (WCAG 2.3.3) */

/* Confirmation card: what happens, to which job, and two clear choices (destructive first). */
.confirm-card {
  justify-items: center;
  gap: var(--space-md);
  width: 100%;
  max-width: 30rem;
  margin: var(--space-lg) auto 0;
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
  background: var(--surface-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.confirm-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-pill);
}

.confirm-card .confirm-icon svg {
  width: 28px;
  height: 28px;
}

.confirm-icon-danger {
  color: var(--action-destructive);
  background: var(--feedback-error-surface);
}

.job-subject {
  display: grid;
  gap: var(--space-2xs);
  justify-items: start;
  width: 100%;
  padding: var(--space-md);
  text-align: left;
  background: var(--surface-secondary);
  border-radius: var(--radius);
}

.confirm-actions {
  display: grid;
  gap: var(--space-sm);
  width: 100%;
}

.confirm-actions > .button-destructive,
.confirm-actions > .button-secondary {
  justify-self: stretch;
}

/* Narrow phones: nothing may be wider than the screen (no sideways scrolling). */
@media (max-width: 479px) {
  .site-header {
    flex-wrap: wrap;
    gap: var(--space-xs);
    padding-inline: var(--space-md);
  }

  .header-actions {
    gap: var(--space-2xs);
    margin-left: auto;
  }

  .header-actions .button-secondary {
    padding-inline: var(--space-md);
  }

  .language-switch {
    padding-inline: var(--space-xs);
  }

  /* The Turnstile widget is a fixed 300 px; the card gives up its frame so it fits. */
  .auth-card {
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
  }

  .page-header > div {
    min-width: 0;
  }
}

/* Smallest phones: the status goes under the details so a long plate never runs into it. */
@media (max-width: 359px) {
  .job-summary > .status-pill {
    grid-row: auto;
    grid-column: 1 / -1;
  }
}

@media (max-width: 339px) {
  .cf-turnstile {
    zoom: 0.94;
  }
}

/* Back to the previous page, above the page title (sub-pages only). */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  justify-self: start;
  min-height: var(--target-min);
  margin-block: calc(-1 * var(--space-xs));
  padding-right: var(--space-sm);
  color: var(--text-primary);
  font-weight: var(--font-weight-strong);
  text-decoration: none;
}

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

/* App bar of an item page: back button, then what kind of page this is ("‹ Vehicle"). */
.page-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  justify-self: start;
  margin-block: calc(-1 * var(--space-xs));
}

.back-icon {
  justify-content: center;
  min-width: var(--target-min);
  margin-left: calc(-1 * var(--space-sm));
  padding: 0;
}

.page-bar:has(.page-bar-actions) {
  justify-self: stretch;
}

.page-bar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-left: auto;
  position: relative;
}

/* The app bar's ⋯ opens over the page like a card's. */
.page-bar-actions:has(.row-more[open]) {
  z-index: 30;
}

.page-bar-title {
  font-size: var(--font-size-heading);
  font-weight: var(--font-weight-heavy);
}

/* Today's view: jobs of earlier days still open sit above today's own (owner decision 2026-10-22). */
#day-jobs {
  display: grid;
  gap: var(--space-lg);
}

.job-group {
  display: grid;
  gap: var(--space-sm);
}

/* Finished jobs fold away under a count (Google Tasks' "Completed (3)"); the summary is the heading. */
.job-group > summary {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: var(--target-min);
  cursor: pointer;
  list-style: none;
}

.job-group > summary::-webkit-details-marker {
  display: none;
}

.job-group > summary::before {
  content: "›";
  display: inline-block;
  width: 1em;
  color: var(--text-secondary);
  transition: transform var(--duration-fast);
}

.job-group[open] > summary::before {
  transform: rotate(90deg);
}

.job-group > summary > h2 {
  margin: 0;
}

.job-since {
  color: var(--text-secondary);
  font-size: var(--font-size-body-small);
}

/* The planned time on a Day View card (D-050). */
.job-time {
  font-variant-numeric: tabular-nums;
}

/* Phones: while the on-screen keyboard is up (app.js sets .keyboard-open) the tab bar steps aside,
   as in native apps, so the field and its form keep the room. */
@media (max-width: 1023px) {
  .keyboard-open .app-navigation {
    display: none;
  }
}

/* What a poll changed flashes soft yellow for 2 s (D-048); app.js removes the mark. */
.job-row,
#job-details {
  transition: background-color 600ms ease-out;
}

.job-row.just-changed,
#job-details.just-changed {
  background-color: var(--feedback-warning-surface);
}

.setting-row {
  display: grid;
  gap: var(--space-2xs);
}

/* A labelled on/off switch (Account → Automatic updates, D-048). */
.switch {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: var(--target-min);
  padding: 0 var(--space-2xs);
  color: var(--text-secondary);
  background: none;
  border: 0;
  font-size: var(--font-size-body-small);
  font-weight: var(--font-weight-strong);
  cursor: pointer;
}

.switch-track {
  position: relative;
  width: 36px;
  height: 22px;
  background: var(--border-default);
  border-radius: var(--radius-pill);
  transition: background var(--duration-fast);
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--surface-primary);
  border-radius: 50%;
  transition: transform var(--duration-fast);
}

.switch[aria-checked="true"] {
  color: var(--text-primary);
}

.switch[aria-checked="true"] .switch-track {
  background: var(--feedback-success);
}

.switch[aria-checked="true"] .switch-track::after {
  transform: translateX(14px);
}

/* Lists with an "add": the title on the left, one compact action on the right (Team, customer). */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.page-header:has(> .header-action) {
  align-items: center;
}

.header-action {
  flex: none;
  min-height: 40px;
  padding: 0 var(--space-md);
  font-size: var(--font-size-body-small);
}

/* People (Team): initials, name and email, role, then ⋯. */
.result-list > li.person {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Under .result-list span, which would grey the initials (WCAG 1.4.3). */
.account-card .avatar,
.people-list .avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  color: var(--text-on-action);
  background: var(--action-primary);
  border-radius: 50%;
  font-size: var(--font-size-body-small);
  font-weight: var(--font-weight-heavy);
}

.people-list .avatar-pending {
  color: var(--text-secondary);
  background: var(--surface-tertiary);
}

.account-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  padding: var(--space-md);
  background: var(--surface-secondary);
  border-radius: var(--radius-lg);
}

.account-card span:not(.avatar) {
  color: var(--text-secondary);
  font-size: var(--font-size-body-small);
}

.person-identity {
  display: grid;
  flex: 1;
  min-width: 0;
}

.person-identity {
  gap: var(--space-2xs);
}

.person-identity > strong,
.person-meta > span:last-child {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
  min-width: 0;
}

.result-list .role-chip {
  flex: none;
  padding: 0 var(--space-sm);
  color: var(--text-secondary);
  background: var(--surface-tertiary);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-body-small);
}

.result-list .role-owner {
  color: var(--text-primary);
  background: var(--feedback-warning-surface);
}

/* ⋯ at the end of a row: the dropdown opens leftwards (phones keep the full-width sheet). */
@media (min-width: 734px) {
  .menu-end .menu {
    left: auto;
    right: 0;
  }
}

.menu form {
  margin: 0;
}

button.menu-item {
  width: 100%;
  justify-content: flex-start;
  background: none;
  border: 0;
  font: inherit;
  font-weight: var(--font-weight-strong);
  cursor: pointer;
}

/* Settings-style pages (AppShell narrow) keep one readable column on laptops. */
.page-narrow {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-lg);
  align-content: start;
  width: 100%;
  max-width: 44rem;
}

.page-narrow .result-list {
  grid-template-columns: minmax(0, 1fr);
}

/* More: icon, label, chevron, like a phone's settings list. */
.settings-list a {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.result-list.settings-list svg {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
}

.result-list.settings-list svg:last-child {
  margin-left: auto;
}

.device-list > li {
  display: grid;
  gap: var(--space-2xs);
}

/* Error summary (app.js, GOV.UK pattern): a rejected form lists its problems at the top. */
.error-summary {
  display: grid;
  gap: var(--space-xs);
  padding: var(--space-md);
  background: var(--feedback-error-surface);
  border: 2px solid var(--feedback-error);
  border-radius: var(--radius);
  scroll-margin-top: var(--space-md);
}

.error-summary h2 {
  margin: 0;
  color: var(--feedback-error);
  font-size: var(--font-size-body);
}

.error-summary ul {
  display: grid;
  gap: var(--space-xs);
  margin: 0;
  padding-left: var(--space-lg);
}

.error-summary a {
  color: var(--feedback-error);
  font-weight: var(--font-weight-strong);
}

/* Browse lists (D-039, D-040): the list switch; the list's title with its create button and sort
   button; the Filters button and one chip per filter in a row that scrolls sideways (Skroutz). */
.browse {
  display: grid;
  gap: var(--space-sm);
}

.chips a {
  color: var(--text-primary);
  text-decoration: none;
}

.browse-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.browse-toolbar svg {
  width: 20px;
  height: 20px;
}

.browse-create {
  margin-inline-start: auto;
}

.facet-filters .count {
  display: inline-grid;
  place-items: center;
  min-width: 1.5em;
  padding-inline: 0.35em;
  font-size: var(--font-size-body-small);
  color: var(--text-on-inverse);
  background: var(--surface-inverse);
  border-radius: var(--radius-pill);
}

/* Filters in use, each with ✕ to remove it (Material input chips). */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin: 0;
  padding: 0;
  list-style: none;
}

.active-filters a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: var(--target-min);
  padding: 0 var(--space-sm) 0 var(--space-md);
  color: var(--text-on-inverse);
  background: var(--surface-inverse);
  border-radius: var(--radius-pill);
  text-decoration: none;
}

.active-filters svg {
  width: 18px;
  height: 18px;
}

/* Bottom sheet: a dialog pinned to the bottom over a dimmed page; it scrolls inside itself and
   never sideways, and the page behind does not scroll while it is open. */
.sheet {
  position: fixed;
  inset: auto 0 0;
  width: 100%;
  max-width: min(560px, 100%);
  max-height: 85dvh;
  margin: 0 auto;
  padding: 0;
  overflow: hidden auto;
  overscroll-behavior: contain;
  color: var(--text-primary);
  background: var(--surface-primary);
  border: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-raised);
}

.sheet::backdrop {
  background: rgb(0 0 0 / 40%);
}

html:has(.sheet[open]) {
  overflow: hidden;
}

.sheet-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-sm) var(--space-sm) var(--space-md);
  background: var(--surface-primary);
  border-bottom: 1px solid var(--border-subtle);
}

.sheet-header h2 {
  margin: 0;
  font-size: var(--font-size-heading);
}

.sheet-close {
  color: var(--text-primary);
  background: none;
  border: 0;
}

.sheet-options {
  margin: 0;
  padding: var(--space-xs) 0 var(--space-md);
  list-style: none;
}

.sheet-options a {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: var(--target-min);
  padding: var(--space-xs) var(--space-md);
  color: var(--text-primary);
  text-decoration: none;
}

/* A radio look for the option in use, as in a native picker sheet. */
.sheet-options a::before {
  content: "";
  flex: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
}

.sheet-options a[aria-current="true"]::before {
  border: 6px solid var(--surface-inverse);
}

.sheet-form {
  display: grid;
}

/* Filter options as rows, text first and the radio at the end (Skroutz, iOS settings). */
.sheet-choices {
  display: grid;
  gap: 0;
  padding: var(--space-md) var(--space-md) var(--space-xs);
  background: none;
  border-radius: 0;
}

.sheet-choices legend {
  float: none;
  margin-bottom: var(--space-xs);
  font-size: var(--font-size-body);
}

.sheet-choices label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  min-height: var(--target-min);
  cursor: pointer;
}

.sheet-choices input[type="radio"] {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--surface-inverse);
}

.sheet-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md) max(var(--space-sm), env(safe-area-inset-bottom));
  background: var(--surface-primary);
  border-top: 1px solid var(--border-subtle);
}

.sheet-footer .button-primary {
  flex: 1;
}

/* Photos: the "no photos" hint shows only while the grid is empty (uploads and deletes included). */
.photo-panel:has(.photo-grid > li) .photo-empty {
  display: none;
}

.photo-open {
  display: block;
  border-radius: var(--radius);
}

/* Photo viewer (D-042): full screen on black, one photo per screen width, whole photo visible. */
.photo-viewer {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  color: var(--text-on-inverse);
  background: var(--surface-inverse);
  border: 0;
}

.photo-viewer::backdrop {
  background: var(--surface-inverse);
}

html:has(.photo-viewer[open]) {
  overflow: hidden;
}

.viewer-strip {
  display: flex;
  height: 100%;
  overflow-x: auto;
  overscroll-behavior: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.viewer-slide {
  flex: 0 0 100%;
  min-width: 0;
  height: 100%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}

.viewer-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.viewer-bar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(var(--space-sm), env(safe-area-inset-top)) var(--space-sm) var(--space-sm)
    var(--space-md);
  background: linear-gradient(rgb(0 0 0 / 55%), transparent);
}

.viewer-close,
.viewer-step {
  display: inline-grid;
  place-items: center;
  width: var(--target-min);
  height: var(--target-min);
  padding: 0;
  color: var(--text-on-inverse);
  background: rgb(0 0 0 / 40%);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.viewer-step {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
}

.viewer-previous {
  left: var(--space-md);
}

.viewer-next {
  right: var(--space-md);
}

.viewer-step:disabled {
  visibility: hidden;
}

/* Touch screens swipe; the arrows are for a mouse. */
@media (hover: none) {
  .viewer-step {
    display: none;
  }
}

/* The shop (D-049). Laptops: under the brand, a menu like the ⋯ row menus; phones go through
   More → Shops, so no page heading carries it. */
.shop-badge {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 2rem;
  height: 2rem;
  color: var(--text-primary);
  background: var(--action-primary);
  border-radius: var(--radius);
  font-size: var(--font-size-body-small);
  font-weight: var(--font-weight-heavy);
}

.app-navigation .shop-menu {
  display: none;
}

@media (min-width: 1024px) {
  .app-navigation .shop-menu {
    display: block;
    margin: 0 var(--space-sm) var(--space-xs);
  }

  .shop-menu > summary {
    justify-content: flex-start;
    gap: var(--space-sm);
    width: 100%;
    padding: var(--space-2xs) var(--space-sm);
    background: none;
    border: 0;
    border-radius: var(--radius);
  }

  .shop-menu > summary:hover,
  .shop-menu[open] > summary {
    background: var(--surface-tertiary);
  }

  .shop-menu-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    color: var(--text-primary);
    font-weight: var(--font-weight-strong);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .shop-menu > summary > svg:last-child {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
  }

  .shop-menu .menu-item {
    max-width: 20rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .shop-menu .menu-item[aria-current] svg {
    color: var(--feedback-success);
  }

  /* `.app-navigation a` dresses the section links as tabs; the menu's links are menu items. */
  .app-navigation .shop-menu a.menu-item {
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--space-sm);
    padding: 0 var(--space-sm);
    color: var(--text-primary);
    font-size: var(--font-size-body);
    border-radius: var(--radius);
  }
}

/* Keeps names in line whether or not a tick sits before them. */
.menu-icon-space {
  flex: none;
  width: 20px;
}

/* A second group of menu actions under a thin rule. */
.menu .menu-group {
  padding-block-start: var(--space-2xs);
  border-block-start: 1px solid var(--border-subtle);
}

/* One grouped list of choices, the chosen one with a filled mark (More → Shops). */
.choice-list {
  margin: 0 0 var(--space-md);
  padding: 0;
  list-style: none;
  background: var(--surface-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.choice-list > li + li {
  border-block-start: 1px solid var(--border-subtle);
}

.choice-list form {
  margin: 0;
}

.choice-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  min-height: calc(var(--target-min) + var(--space-sm));
  padding: var(--space-xs) var(--space-md);
  color: var(--text-primary);
  font: inherit;
  text-align: start;
  background: none;
  border: 0;
  border-radius: 0;
}

button.choice-row {
  cursor: pointer;
}

button.choice-row:hover {
  background: var(--surface-secondary);
}

.choice-text {
  display: grid;
  flex: 1;
  min-width: 0;
}

.choice-text > strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.choice-text > span {
  color: var(--text-secondary);
  font-size: var(--font-size-body-small);
}

.choice-mark {
  flex: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-default);
  border-radius: 50%;
}

.choice-row[aria-current] .choice-mark {
  border: 6px solid var(--surface-inverse);
}

/* Week and Month (D-051). */
.view-switch {
  margin-bottom: var(--space-sm);
}

:is(.week-day, .month-day, .month-selected) .count {
  display: inline-grid;
  place-items: center;
  min-width: 1.5em;
  padding-inline: 0.35em;
  font-size: var(--font-size-body-small);
  color: var(--text-on-inverse);
  background: var(--surface-inverse);
  border-radius: var(--radius-pill);
}

.week-day {
  padding-block: var(--space-sm);
  border-bottom: 1px solid var(--border-subtle);
}

.period-day-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  margin: 0;
  font-size: var(--font-size-body);
}

.period-day-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--target-min);
  color: inherit;
}

.is-today .period-day-link::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-left: var(--space-xs);
  border-radius: 50%;
  background: var(--surface-inverse);
}

.week-day-empty {
  color: var(--text-secondary);
  font-weight: normal;
}

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

/* One line a job: time, plate, what is wrong, status. The symptom gives way on a narrow phone. */
.period-job {
  display: grid;
  grid-template-columns: 3.2em auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-sm);
  min-height: var(--target-min);
  color: inherit;
  text-decoration: none;
}

.period-jobs .job-time {
  color: var(--text-secondary);
}

.period-job-symptom {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--space-2xs);
  margin-bottom: var(--space-md);
}

.month-weekday {
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--font-size-body-small);
}

.month-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  min-height: 56px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: inherit;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}

.month-day.is-today {
  border-color: var(--border-strong);
  font-weight: var(--font-weight-heavy);
}

.month-day[aria-current="true"] {
  background: var(--surface-tertiary);
}

.month-selected .period-day-title {
  justify-content: space-between;
}
