/*
 * bike.tools' one stylesheet: tokens, base, components, then page layouts.
 * No framework. Shops recolour it through /t/:slug/theme.css, which only sets
 * --accent and --accent-text; everything else derives from those.
 */

:root {
  --font: Inter, 'Segoe UI Variable', 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', sans-serif;
  --mono: ui-monospace, 'Cascadia Code', SFMono-Regular, Consolas, monospace;

  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --text: #15181d;
  --muted: #5d6470;
  --faint: #8a919c;
  --border: #e1e4e9;
  --border-strong: #c9ced6;

  --accent: #1f6f4a;
  --accent-text: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 11%, var(--surface));
  --accent-line: color-mix(in srgb, var(--accent) 35%, var(--surface));
  --accent-strong: color-mix(in srgb, var(--accent) 82%, #000);

  --ok: #1a7f4b;
  --ok-soft: #e4f4ea;
  --info: #2563c9;
  --info-soft: #e5eefc;
  --warn: #9a6200;
  --warn-soft: #fdf2d8;
  --danger: #c0352b;
  --danger-soft: #fce8e6;

  --side-bg: #15181d;
  --side-text: #c9ced6;
  --side-muted: #8a919c;
  --side-hover: #22262d;
  --side-active: #2b3038;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgb(16 24 40 / 6%);
  --shadow: 0 1px 3px rgb(16 24 40 / 8%), 0 1px 2px rgb(16 24 40 / 4%);
  --shadow-lg: 0 12px 32px rgb(16 24 40 / 14%), 0 2px 6px rgb(16 24 40 / 6%);
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1114;
    --surface: #181b20;
    --surface-2: #1d2026;
    --text: #e9ebee;
    --muted: #a2a8b2;
    --faint: #7a818c;
    --border: #2b2f36;
    --border-strong: #3a3f48;
    --accent-soft: color-mix(in srgb, var(--accent) 22%, var(--surface));
    --accent-line: color-mix(in srgb, var(--accent) 50%, var(--surface));
    --accent-strong: color-mix(in srgb, var(--accent) 70%, #fff);
    --ok: #4cc386;
    --ok-soft: #173326;
    --info: #79a6f2;
    --info-soft: #1a2740;
    --warn: #e5b04a;
    --warn-soft: #362a12;
    --danger: #f2837a;
    --danger-soft: #3b1d1b;
    --side-bg: #0b0d10;
    --side-hover: #171a1f;
    --side-active: #1f232a;
    --shadow-sm: none;
    --shadow: 0 0 0 1px rgb(255 255 255 / 2%);
    --shadow-lg: 0 16px 40px rgb(0 0 0 / 50%);
    color-scheme: dark;
  }
}

/* ---------------------------------------------------------------- Base */

[hidden] {
  display: none !important;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
}

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

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 1.55rem;
  font-weight: 700;
}

h2 {
  font-size: 1.1rem;
  font-weight: 650;
}

h3 {
  font-size: 0.98rem;
  font-weight: 650;
}

p {
  margin: 0 0 1em;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

img {
  max-width: 100%;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  vertical-align: -3px;
}

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 16px;
}

.narrow {
  max-width: 640px;
}

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

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

.small {
  font-size: 0.86rem;
}

.tiny {
  font-size: 0.78rem;
}

.mt {
  margin-top: 16px;
}

.mt-lg {
  margin-top: 28px;
}

.mb-0 {
  margin-bottom: 0;
}

.row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.row.tight {
  gap: 6px;
}

.stack {
  display: grid;
  gap: 12px;
}

.spread {
  justify-content: space-between;
}

.grow {
  flex: 1;
  min-width: 200px;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.nowrap {
  white-space: nowrap;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

code,
.code,
kbd {
  font-family: var(--mono);
  font-size: 0.84rem;
}

.code {
  display: block;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow-x: auto;
  white-space: pre;
}

/* A link to copy: it wraps rather than scrolls. */
.code.url {
  white-space: normal;
  overflow-wrap: anywhere;
}

kbd {
  display: inline-block;
  padding: 0 5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--surface);
}

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

a:focus-visible {
  border-radius: 3px;
}

/* ---------------------------------------------------------------- Buttons */

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 15px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.button:hover,
button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

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

.button.secondary:hover,
button.secondary:hover {
  background: var(--surface-2);
  border-color: var(--faint);
}

.button.ghost,
button.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  box-shadow: none;
}

.button.ghost:hover,
button.ghost:hover {
  background: color-mix(in srgb, var(--text) 6%, transparent);
  color: var(--text);
}

button.danger,
.button.danger {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--danger) 45%, var(--surface));
  color: var(--danger);
}

button.danger:hover,
.button.danger:hover {
  background: var(--danger-soft);
}

.button.small,
button.small {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 0.86rem;
  border-radius: 7px;
}

.button.icon-only,
button.icon-only {
  padding: 0;
  width: 38px;
}

button.small.icon-only {
  width: 30px;
}

button:disabled,
.button[aria-disabled='true'] {
  opacity: 0.55;
  cursor: not-allowed;
}

button.link {
  display: inline;
  min-height: 0;
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent-strong);
  font-weight: 500;
  text-decoration: underline;
  box-shadow: none;
}

button.link:hover {
  background: none;
}

.inline-form {
  display: inline;
}

.button-group {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------- Forms */

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

.field {
  margin-bottom: 16px;
}

.hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.84rem;
}

input:not([type]),
input[type='text'],
input[type='email'],
input[type='tel'],
input[type='password'],
input[type='number'],
input[type='date'],
input[type='time'],
input[type='search'],
input[type='url'],
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  box-shadow: var(--shadow-sm);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}

input[type='color'] {
  width: 48px;
  height: 40px;
  padding: 2px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

input[type='file'] {
  max-width: 100%;
  font: inherit;
}

input[type='checkbox'],
input[type='radio'] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

select.auto-width {
  width: auto;
}

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 400;
  margin-bottom: 8px;
}

.check input {
  margin-top: 3px;
  flex: none;
}

/* The shop's consent under a setting that needs it (status page lines). */
.check.consent,
.consent-given {
  margin: -2px 0 10px 26px;
  font-size: 0.875rem;
}

fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 16px;
  min-width: 0;
}

legend {
  font-weight: 650;
  margin-bottom: 8px;
  padding: 0;
}

.two-col {
  display: grid;
  gap: 0 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 4px;
}

/* ---------------------------------------------------------------- Surfaces */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.card > :last-child {
  margin-bottom: 0;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.card-head h2,
.card-head h3 {
  margin: 0;
}

.card.flush {
  padding: 0;
  overflow: hidden;
}

.card.flush > .card-head {
  padding: 16px 20px 0;
}

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

.grid.cols-2 {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.stat {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
  color: inherit;
}

.stat-card .stat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 500;
}

.stat-card .stat-label .icon {
  color: var(--accent);
}

a.stat-card:hover {
  border-color: var(--accent-line);
}

.notice {
  padding: 12px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  background: var(--ok-soft);
  border: 1px solid color-mix(in srgb, var(--ok) 20%, transparent);
}

.notice > :last-child {
  margin-bottom: 0;
}

/* With an icon, the icon sits beside the text. */
.notice:has(> .icon) {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.notice.error {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 25%, transparent);
}

.notice.warn {
  background: var(--warn-soft);
  border-color: color-mix(in srgb, var(--warn) 25%, transparent);
}

.notice.info {
  background: var(--info-soft);
  border-color: color-mix(in srgb, var(--info) 22%, transparent);
}

.empty {
  text-align: center;
  padding: 36px 16px;
  color: var(--muted);
}

.empty .icon {
  width: 32px;
  height: 32px;
  color: var(--faint);
  margin-bottom: 8px;
}

.empty strong {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
}

/* ---------------------------------------------------------------- Tables */

.table-wrap {
  /* Contains sr-only (absolute) header text, which would otherwise widen the page. */
  position: relative;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}

th,
td {
  text-align: left;
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface-2);
}

tbody tr:hover td {
  background: color-mix(in srgb, var(--accent) 3%, transparent);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.card.flush table th:first-child,
.card.flush table td:first-child {
  padding-left: 20px;
}

.card.flush table th:last-child,
.card.flush table td:last-child {
  padding-right: 20px;
}

/* ---------------------------------------------------------------- Badges */

/* A Lightspeed workorder status in the shop's colour. theme.css sets --st
   (and --st-text, for a solid fill) per status as .st-<id>. */
.status-chip {
  --st: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 2px 10px 2px 8px;
  border: 1px solid color-mix(in srgb, var(--st) 45%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--st) 14%, var(--surface));
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-chip::before {
  content: '';
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--st);
}

.status-chip.small {
  padding: 0 8px 0 6px;
  font-size: 0.72rem;
}

.status-refresh {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 12px;
}

.status-color {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

.status-color input[type='color'] {
  width: 44px;
  height: 32px;
  padding: 2px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.6;
  background: var(--ok-soft);
  color: var(--ok);
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge.plain::before {
  display: none;
}

.badge.failed,
.badge.reauth_required,
.badge.danger,
.badge.cancelled,
.badge.void {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.pending,
.badge.warn,
.badge.requested,
.badge.waiting {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge.info,
.badge.in_progress,
.badge.checked_in {
  background: var(--info-soft);
  color: var(--info);
}

.badge.neutral,
.badge.closed,
.badge.complete {
  background: color-mix(in srgb, var(--text) 7%, transparent);
  color: var(--muted);
}

.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.count.neutral {
  background: color-mix(in srgb, var(--text) 9%, transparent);
  color: var(--muted);
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
}

.avatar.small {
  width: 28px;
  height: 28px;
  font-size: 0.72rem;
}

/* ---------------------------------------------------------------- Lists */

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

.plain-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.plain-list li:last-child {
  border-bottom: 0;
}

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

.list-rows > li > a,
.list-rows > li > .list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
}

.list-rows > li:last-child > a,
.list-rows > li:last-child > .list-row {
  border-bottom: 0;
}

/* A row with its own button (Receive) beside the link: the row's line moves to the item. */
.list-rows > li.has-action {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.list-rows > li.has-action:last-child {
  border-bottom: 0;
}

.list-rows > li.has-action > a {
  flex: 1;
  min-width: 0;
  border-bottom: 0;
}

.list-rows > li.has-action > .receive-form {
  margin: 0;
  padding-right: 20px;
}

.receive-form {
  margin: 0;
}

.list-rows > li > a:hover {
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}

.list-rows .list-main {
  flex: 1;
  min-width: 0;
}

.list-rows .list-main strong {
  display: block;
}

dl.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 32px;
  margin: 0 0 12px;
}

.facts dt {
  color: var(--muted);
  font-size: 0.82rem;
}

.facts dd {
  margin: 0;
  font-weight: 500;
}

dl.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 0;
}

dl.kv dt {
  color: var(--muted);
  font-size: 0.86rem;
}

dl.kv dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- Tabs & segmented filters */

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

.tabs a {
  padding: 9px 12px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 550;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}

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

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--text) 6%, transparent);
  flex-wrap: wrap;
}

.segmented a {
  padding: 4px 10px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 550;
  text-decoration: none;
}

.segmented a[aria-current='page'] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

details summary {
  cursor: pointer;
  color: var(--accent-strong);
  font-weight: 550;
}

/* ---------------------------------------------------------------- Public pages (booking, status, rider) */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--text);
  text-decoration: none;
}

.brand img {
  max-height: 36px;
  width: auto;
  border-radius: 6px;
}

/* The bike.tools mark (public/favicon.svg), already a rounded square. */
.brand img.brand-logo {
  width: 30px;
  height: 30px;
  border-radius: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
}

.brand-mark .icon {
  width: 18px;
  height: 18px;
}

.brand > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60vw;
}

.nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}

.nav a,
.nav button.link {
  padding: 6px 10px;
  border-radius: 7px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.93rem;
  font-weight: 500;
}

.nav a[aria-current='page'],
.nav a:hover {
  background: var(--accent-soft);
  color: var(--text);
}

main {
  padding: 28px 0 56px;
}

.embed main {
  padding: 12px 0;
}

.embed {
  background: transparent;
}

.site-footer {
  color: var(--faint);
  font-size: 0.82rem;
  padding: 24px 0 32px;
}

.site-footer a {
  color: inherit;
}

.page-intro {
  margin-bottom: 20px;
}

.page-intro h1 {
  margin-bottom: 4px;
}

.page-intro p {
  color: var(--muted);
  margin: 0;
}

/* Booking flow */

.options {
  display: grid;
  gap: 8px;
}

.option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 13px 15px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font-weight: 400;
  cursor: pointer;
}

.option:hover {
  border-color: var(--accent-line);
}

.option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.option input {
  margin-top: 3px;
}

.option .meta {
  margin-left: auto;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.calendar .dow {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--faint);
}

.calendar button {
  min-height: 42px;
  padding: 8px 0;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 550;
  box-shadow: none;
}

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

.calendar button:disabled {
  color: var(--faint);
  opacity: 0.5;
  cursor: not-allowed;
  background: transparent;
}

.calendar button[aria-pressed='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.calendar button.suggested {
  border-style: dashed;
  border-color: var(--accent);
}

.bike-results {
  list-style: none;
  margin: 4px 0 0;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.bike-results:empty {
  display: none;
}

.bike-results button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 450;
  box-shadow: none;
  white-space: normal;
}

.bike-results button:hover {
  background: var(--accent-soft);
}

.selected-bike {
  margin-top: 8px;
}

/* Status page */

.status-hero {
  display: grid;
  gap: 6px;
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.status-hero h1 {
  margin: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: start;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
  font-size: 0.92rem;
}

.status-pill.cancelled {
  background: var(--danger);
}

.status-pill.ready {
  background: var(--ok);
}

.tracker {
  display: grid;
  grid-template-columns: repeat(var(--steps, 5), 1fr);
  list-style: none;
  margin: 18px 0 4px;
  padding: 0;
  counter-reset: step;
}

.tracker.steps-4 {
  --steps: 4;
}

.tracker li {
  position: relative;
  padding-top: 28px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--faint);
  font-weight: 550;
}

.tracker li::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  z-index: 1;
}

.tracker li::after {
  content: '';
  position: absolute;
  top: 12px;
  left: -50%;
  width: 100%;
  height: 2px;
  background: var(--border-strong);
}

.tracker li:first-child::after {
  display: none;
}

.tracker li.done,
.tracker li.current {
  color: var(--text);
}

.tracker li.done::before {
  background: var(--accent);
  border-color: var(--accent);
}

.tracker li.done::after,
.tracker li.current::after {
  background: var(--accent);
}

.tracker li.current::before {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 22%, transparent);
}

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

.timeline li {
  padding: 6px 0 14px 20px;
  border-left: 2px solid var(--border);
  position: relative;
}

.timeline li:last-child {
  padding-bottom: 0;
}

.timeline li::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 11px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--surface);
}

.receipt-note {
  white-space: pre-line;
  padding: 10px 12px;
  border-left: 3px solid var(--accent-line);
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.workorder-lines .line-kind {
  min-width: 3.5em;
  text-align: center;
}

.estimate-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 1.15rem;
}

.approval {
  border-color: color-mix(in srgb, var(--warn) 45%, var(--border));
  box-shadow: inset 4px 0 0 var(--warn);
}

.approval.approved {
  border-color: var(--border);
  box-shadow: inset 4px 0 0 var(--ok);
}

.approval-amount {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 4px 0 8px;
}

.approval-amount strong {
  font-size: 1.6rem;
  letter-spacing: -0.01em;
}

.approval-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.approval-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.approval-head h2 {
  margin: 0 0 2px;
}

.approval-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ok-soft);
  color: var(--ok);
}

.photo-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
}

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

.sign-in {
  margin-top: 8vh;
}

.staff-link {
  margin-top: 32px;
  text-align: center;
}

.shop-services + .shop-services {
  margin-top: 24px;
}

.copy-link {
  display: flex;
  gap: 8px;
  align-items: center;
}

.copy-link .copy-input {
  flex: 1;
  min-width: 14em;
  font-family: var(--mono);
  font-size: 0.8rem;
}

.link-cell {
  min-width: 20em;
}

.domain {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.bars li {
  display: grid;
  grid-template-columns: 3em 1fr 3em;
  gap: 8px;
  align-items: center;
}

.bars meter {
  width: 100%;
  height: 12px;
}

.bays {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.bay.busy {
  border-color: var(--accent);
  box-shadow:
    inset 0 3px 0 var(--accent),
    var(--shadow);
}

.bay .bay-name {
  font-weight: 700;
  border-color: transparent;
  padding-left: 0;
  background: transparent;
  box-shadow: none;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.ready-line {
  margin: 8px 0 0;
}

.check-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.check-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.check-list .icon {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  color: var(--accent);
}

.shop-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  font-size: 0.92rem;
}

.shop-note .icon {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  color: var(--accent-strong);
}

.shop-note p {
  margin: 0;
}

/* Login / auth cards */

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

.auth-card {
  width: 100%;
  max-width: 400px;
}

.auth-card .brand {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.auth-card .card {
  padding: 28px;
}

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

.auth-foot {
  margin-top: 16px;
  text-align: center;
  color: var(--faint);
  font-size: 0.82rem;
}

button.block,
.button.block {
  display: flex;
  justify-content: center;
  width: 100%;
}

.shop-list {
  margin: 0 -28px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.shop-list > li > a {
  padding-inline: 28px;
}

.shop-list .icon {
  color: var(--faint);
}

/* ---------------------------------------------------------------- Admin app shell */

.app {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

/* The sidebar fits the window rather than scrolling: links and group labels
   shrink from their full size (flex-basis) to a compact one (min-height) as
   the window gets shorter, and short windows drop the group labels. Only a
   window too short for even that (under about 550px) scrolls. */
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: var(--side-bg);
  color: var(--side-text);
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

.sidebar-brand .brand-mark {
  width: 32px;
  height: 32px;
}

.sidebar-brand img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 8px;
}

.sidebar-brand span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-nav {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  padding: 2px 10px 8px;
}

.side-group {
  display: flex;
  flex: 0 1 34px;
  align-items: flex-end;
  min-height: 20px;
  margin: 0 10px;
  padding-bottom: 5px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--side-muted);
}

.side-link {
  display: flex;
  flex: 0 1 38px;
  align-items: center;
  gap: 11px;
  min-height: 28px;
  padding: 0 10px;
  margin: 1px 0;
  border-radius: 8px;
  color: var(--side-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.93rem;
}

.side-link:hover {
  background: var(--side-hover);
  color: #fff;
}

.side-link[aria-current='page'] {
  background: var(--side-active);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--accent);
}

.side-link .icon {
  color: var(--side-muted);
}

.side-link[aria-current='page'] .icon,
.side-link:hover .icon {
  color: #fff;
}

.side-link .count {
  margin-left: auto;
}

.side-foot {
  flex: none;
  padding: 10px 10px 12px;
  border-top: 1px solid rgb(255 255 255 / 6%);
}

.side-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 0 2px 10px;
  font-size: 0.85rem;
  min-width: 0;
}

.side-user .avatar {
  background: var(--side-active);
  color: #fff;
}

.side-user div {
  flex: 1;
  min-width: 0;
}

.side-user div strong,
.side-user div span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-user strong {
  color: #fff;
  font-weight: 600;
}

.side-user div span {
  color: var(--side-muted);
  font-size: 0.78rem;
}

.side-foot form {
  display: block;
}

.side-icon {
  width: 34px;
  min-height: 34px;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--side-muted);
}

.side-icon:hover {
  background: var(--side-hover);
  color: #fff;
}

@media (max-height: 620px) {
  .side-group {
    display: none;
  }

  .sidebar-brand {
    padding-block: 10px 6px;
  }
}

.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 10px 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  font-size: 1.2rem;
  margin: 0;
  flex: 1;
  min-width: 0;
}

.topbar form.row {
  flex-wrap: nowrap;
}

.topbar form input,
.topbar form select {
  width: auto;
  min-height: 36px;
  padding: 5px 10px;
}

@media (max-width: 760px) {
  .topbar:has(form.row) {
    flex-wrap: wrap;
  }

  .topbar form.row {
    order: 3;
    width: 100%;
  }

  .topbar form.row input,
  .topbar form.row select {
    flex: 1;
    min-width: 0;
  }
}

.topbar .crumbs {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
}

.topbar .crumbs a {
  color: inherit;
  text-decoration: none;
}

.topbar .crumbs a:hover {
  text-decoration: underline;
}

.page {
  padding: 24px 28px 48px;
  max-width: 1240px;
  width: 100%;
}

.page.wide {
  max-width: none;
}

.page.full {
  padding: 0;
  max-width: none;
  flex: 1;
  min-height: 0;
}

.app-footer {
  padding: 0 28px 24px;
  color: var(--faint);
  font-size: 0.8rem;
}

.nav-toggle,
.menu-button,
.scrim {
  display: none;
}

.app > .sidebar {
  grid-column: 1;
  grid-row: 1;
}

.app > .app-main {
  grid-column: 2;
  grid-row: 1;
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }

  .app > .app-main {
    grid-column: 1;
  }

  /* Visually hidden but focusable, so keyboard users can open the menu. */
  .nav-toggle {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 272px;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }

  .nav-toggle:checked ~ .sidebar {
    transform: none;
  }

  .nav-toggle:checked ~ .scrim {
    display: block;
  }

  .scrim {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgb(0 0 0 / 40%);
  }

  .menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin: 0 0 0 -8px;
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
  }

  .menu-button:hover {
    background: color-mix(in srgb, var(--text) 6%, transparent);
  }

  .nav-toggle:focus-visible ~ .app-main .menu-button {
    box-shadow: var(--ring);
  }

  .topbar {
    padding: 10px 16px;
  }

  .page {
    padding: 18px 16px 40px;
  }

  .app-footer {
    padding: 0 16px 20px;
  }
}

/* ---------------------------------------------------------------- Workorders */

.sort-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: none;
}

.sort-link:hover {
  color: var(--accent-strong);
}

.sort-arrow {
  font-size: 0.7em;
  color: var(--accent);
}

.wo-table td {
  vertical-align: middle;
}

.wo-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
}

.wo-actions form {
  margin: 0;
}

/* ---------------------------------------------------------------- Dashboard */

.dash-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  margin-bottom: 20px;
}

.dash-grid > .card {
  margin: 0;
}

@media (max-width: 1000px) {
  .dash-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.list-rows .list-end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.talkers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  padding: 0 20px 12px;
  border-bottom: 1px solid var(--border);
}

.talker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
}

.avatar.tiny {
  width: 20px;
  height: 20px;
  font-size: 0.62rem;
}

.preview-stats {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 16px;
}

.preview-stats > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.preview-more {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.report-preview .bars li {
  padding: 2px 0;
  border: 0;
}

.preview-more h3 {
  margin: 0 0 6px;
  color: var(--muted);
}

.health {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.health .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent);
}

.health .dot.bad {
  background: var(--danger);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 20%, transparent);
}

.health .dot.warn {
  background: var(--warn);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn) 20%, transparent);
}

.stats {
  margin-bottom: 20px;
}

.stat-card.attention {
  border-color: var(--accent-line);
  background: linear-gradient(180deg, var(--accent-soft), var(--surface) 70%);
}

.connect-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-color: var(--accent-line);
}

.connect-card h2 {
  margin-bottom: 4px;
}

.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------------------------------------------------------------- Messaging: threads and bubbles */

.thread {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg {
  align-self: flex-start;
  max-width: min(78%, 560px);
  padding: 9px 13px;
  border-radius: 16px 16px 16px 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.msg p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg .msg-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 3px;
  font-size: 0.72rem;
  color: var(--faint);
}

.msg.mine {
  align-self: flex-end;
  border-radius: 16px 16px 5px 16px;
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-text);
}

.msg.mine .msg-meta {
  color: color-mix(in srgb, var(--accent-text) 75%, transparent);
  justify-content: flex-end;
}

.msg .msg-meta .channel-chip {
  color: inherit;
}

.msg.mine.failed {
  background: var(--danger-soft);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
}

.msg.mine.failed .msg-meta {
  color: var(--danger);
}

.msg.internal {
  align-self: flex-end;
  background: var(--warn-soft);
  border: 1px dashed color-mix(in srgb, var(--warn) 45%, transparent);
  color: var(--text);
  border-radius: 12px;
}

.msg.internal .msg-meta {
  color: var(--warn);
}

.msg.note {
  align-self: center;
  max-width: 100%;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 2px 8px;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.msg.note .msg-meta {
  justify-content: center;
}

.msg .attachment {
  display: block;
  margin: 4px 0;
  max-width: 260px;
  border-radius: 10px;
  overflow: hidden;
}

.msg .attachment img {
  display: block;
  width: 100%;
}

.day-divider {
  align-self: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 0;
}

.channel-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

.channel-chip .icon {
  width: 13px;
  height: 13px;
}

.composer {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.composer:focus-within {
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.composer textarea {
  border: 0;
  box-shadow: none;
  min-height: 72px;
  max-height: 40vh;
  resize: none;
  padding: 12px 14px 6px;
  border-radius: 0;
}

.composer textarea:focus {
  box-shadow: none;
}

.composer.internal {
  background: var(--warn-soft);
}

.composer.internal textarea {
  background: transparent;
}

.composer-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 8px 10px;
  flex-wrap: wrap;
}

.composer-bar select {
  width: auto;
  min-height: 30px;
  padding: 3px 28px 3px 8px;
  font-size: 0.84rem;
  box-shadow: none;
}

.composer .composer-bar select {
  width: auto;
  flex: 0 1 auto;
  max-width: 240px;
}

.composer-bar .spacer {
  flex: 1;
}

.saved-replies {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 5;
}

.saved-replies button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  box-shadow: none;
  color: var(--text);
  border-radius: var(--radius-sm);
  font-weight: 400;
  white-space: normal;
  min-height: 0;
  padding: 7px 10px;
}

.saved-replies button strong {
  display: block;
  font-size: 0.86rem;
}

.saved-replies button span {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-replies button[aria-selected='true'],
.saved-replies button:hover {
  background: var(--accent-soft);
}

.composer-wrap {
  position: relative;
}

/* ---------------------------------------------------------------- Inbox (three panes) */

.inbox-app {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr) 300px;
  height: calc(100vh - 61px);
  height: calc(100dvh - 61px);
  min-height: 480px;
  background: var(--surface);
}

.inbox-list {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  min-height: 0;
}

.inbox-tools {
  display: grid;
  gap: 10px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border);
}

.inbox-tools .search {
  position: relative;
}

.inbox-tools .search .icon {
  position: absolute;
  left: 10px;
  top: 11px;
  color: var(--faint);
}

.inbox-tools .search input {
  padding-left: 34px;
  min-height: 38px;
}

.conv-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  flex: 1;
}

.conv-item {
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  position: relative;
}

.conv-item:hover {
  background: var(--surface-2);
}

.conv-item[aria-current='page'] {
  background: var(--accent-soft);
}

.conv-item .conv-body {
  flex: 1;
  min-width: 0;
}

.conv-item .conv-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.conv-item .conv-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-item .conv-time {
  font-size: 0.74rem;
  color: var(--faint);
  white-space: nowrap;
}

.conv-item .conv-preview {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.conv-item .conv-preview .conv-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.conv-item.unread .conv-name,
.conv-item.unread .conv-preview .conv-text {
  color: var(--text);
  font-weight: 650;
}

.conv-item .unread-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.conv-tags {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.thread-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg);
}

.thread-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.thread-head .who {
  flex: 1;
  min-width: 160px;
}

.thread-head .who strong {
  display: block;
  font-size: 1.02rem;
}

.thread-head .who span {
  font-size: 0.82rem;
  color: var(--muted);
}

.thread-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
  overscroll-behavior: contain;
}

.thread-compose {
  padding: 10px 18px 16px;
  background: var(--bg);
}

.context-pane {
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 18px;
  background: var(--surface);
}

.context-pane h3 {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 18px 0 8px;
}

.context-pane h3:first-child {
  margin-top: 0;
}

.mini-card {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  color: inherit;
  text-decoration: none;
  font-size: 0.88rem;
}

a.mini-card:hover {
  border-color: var(--accent-line);
  background: var(--surface-2);
}

.mini-card .row {
  gap: 6px;
}

.inbox-empty {
  display: grid;
  place-items: center;
  height: 100%;
  text-align: center;
  color: var(--muted);
  padding: 24px;
}

.back-link {
  display: none;
}

@media (max-width: 1200px) {
  .inbox-app {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .context-pane {
    display: none;
  }
}

@media (max-width: 760px) {
  .inbox-app {
    grid-template-columns: minmax(0, 1fr);
    height: calc(100dvh - 61px);
  }

  .inbox-app.has-thread .inbox-list {
    display: none;
  }

  .inbox-app:not(.has-thread) .thread-pane {
    display: none;
  }

  .back-link {
    display: inline-flex;
  }

  .thread-scroll {
    padding: 14px;
  }

  .thread-compose {
    padding: 8px 10px 10px;
    position: sticky;
    bottom: 0;
  }

  .msg {
    max-width: 88%;
  }
}

.view-tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -4px;
}

.view-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
}

.view-tabs a:hover {
  background: var(--surface-2);
  color: var(--text);
}

.view-tabs a[aria-current='page'] {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.view-tabs .count {
  min-width: 18px;
  height: 18px;
  font-size: 0.7rem;
}

.inbox-filters {
  display: flex;
  gap: 6px;
}

.inbox-filters select {
  min-height: 32px;
  padding-block: 4px;
  font-size: 0.84rem;
}

.thread-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.thread-actions select {
  width: auto;
  max-width: 170px;
  min-height: 32px;
  padding-block: 4px;
  font-size: 0.84rem;
}

.thread-notice {
  margin: 10px 18px 0;
}

details.menu {
  position: relative;
}

details.menu > summary {
  list-style: none;
}

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

.menu-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  display: grid;
  gap: 2px;
  min-width: 190px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

details.menu.up .menu-pop {
  top: auto;
  bottom: calc(100% + 6px);
  left: 0;
  right: auto;
}

.menu-pop button.ghost {
  justify-content: flex-start;
  width: 100%;
}

.saved-menu .menu-pop {
  width: min(420px, 80vw);
  max-height: 320px;
  overflow-y: auto;
}

.saved-menu .menu-pop a {
  display: block;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
}

.saved-menu .menu-pop a:hover,
.saved-menu .menu-pop a:focus-visible {
  background: var(--accent-soft);
}

.saved-menu .menu-pop a strong {
  display: block;
  font-size: 0.86rem;
}

.saved-menu .menu-pop a span {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-pick {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.file-pick input[type='file'] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.composer-subject input {
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  font-size: 0.88rem;
}

.file-chosen {
  padding: 4px 14px;
  color: var(--muted);
}

.channel-note {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-icon {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.empty-icon .icon {
  width: 24px;
  height: 24px;
}

.row.between {
  justify-content: space-between;
}

.mt-xs {
  margin-top: 6px;
}

.ok-text {
  color: var(--ok);
}

.status-pill.small {
  padding: 2px 9px;
  font-size: 0.72rem;
  gap: 4px;
}

.status-pill.waiting_parts,
.status-pill.awaiting_approval {
  background: var(--warn);
  color: #fff;
}

.status-pill.complete {
  background: var(--muted);
}

.context-pane .mini-card .row {
  margin-top: 4px;
}

.context-pane .mini-card .icon {
  width: 14px;
  height: 14px;
}

@media (max-width: 760px) {
  .hide-sm {
    display: none;
  }

  .thread-head {
    padding: 10px 12px;
    gap: 8px;
  }

  .thread-actions {
    width: 100%;
  }

  .channel-note {
    display: none;
  }
}

/* ---------------------------------------------------------------- Chat pages (status page chat, website widget) */

.chat-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.chat-card .card-head {
  padding: 16px 20px 0;
}

.chat-card .thread-scroll {
  max-height: 420px;
  min-height: 140px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.chat-card .thread-compose {
  background: var(--surface);
}

.widget-page {
  background: var(--surface);
  margin: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.widget {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.widget-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: var(--accent);
  color: var(--accent-text);
}

.widget-head img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--surface);
}

.widget-head .brand-mark {
  width: 40px;
  height: 40px;
  background: color-mix(in srgb, var(--accent-text) 18%, transparent);
  color: var(--accent-text);
}

.widget-head strong {
  display: block;
  font-size: 1.02rem;
}

.widget-head span {
  font-size: 0.82rem;
  opacity: 0.85;
}

.widget-head .online {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.widget-head .online::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6ee7a8;
}

.widget-head .online.away::before {
  background: #fbbf5a;
}

.widget .thread-scroll {
  flex: 1;
  padding: 16px;
}

.widget .thread-compose {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.widget-intro {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.widget-foot {
  text-align: center;
  font-size: 0.72rem;
  color: var(--faint);
  padding: 0 0 8px;
}

.widget-foot a {
  color: inherit;
}

/* ---------------------------------------------------------------- Quick Book */

.qb {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 20px;
  align-items: start;
}

.qb-chat {
  display: flex;
  flex-direction: column;
  min-height: 520px;
}

.qb-chat .thread-scroll {
  flex: 1;
  max-height: 60vh;
}

.qb-draft dl.kv {
  margin-bottom: 12px;
}

.qb-compose {
  margin-top: 12px;
}

.qb-examples {
  margin-top: 14px;
}

.qb-examples .chips {
  flex-direction: column;
  align-items: stretch;
}

.qb-pending p::after {
  content: '';
  display: inline-block;
  width: 1.2em;
  text-align: left;
  animation: qb-dots 1.2s steps(4) infinite;
}

@keyframes qb-dots {
  0% {
    content: '';
  }
  25% {
    content: '.';
  }
  50% {
    content: '..';
  }
  75% {
    content: '...';
  }
}

.qb-draft .option .grow {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.qb-services {
  display: grid;
  gap: 6px;
}

.qb-services .check {
  display: flex;
  gap: 10px;
  align-items: center;
}

.qb-services .num {
  margin-left: auto;
}

.qb-draft .estimate-total {
  margin: 10px 0 0;
  text-align: right;
}

.qb-done .card-head h2 .icon {
  color: var(--ok);
}

.qb-glossary input,
.qb-glossary select {
  width: 100%;
}

/* Quick Book's "Every workorder": the services in columns as wide as fit. */
.qb-always {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 4px 16px;
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 550;
  min-height: 0;
  box-shadow: none;
  text-decoration: none;
  cursor: pointer;
}

.chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

.chip.example {
  font-weight: 450;
  text-align: left;
  white-space: normal;
}

@media (max-width: 900px) {
  .qb {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------------------------------------------------------------- Settings */

/* ---------------------------------------------------------------- Messaging settings */

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 500;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch > span {
  position: relative;
  flex: none;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--border-strong);
  transition: background 0.15s;
}

.switch > span::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s;
}

.switch input:checked + span {
  background: var(--accent);
}

.switch input:checked + span::after {
  transform: translateX(16px);
}

.switch input:focus-visible + span {
  box-shadow: var(--ring);
}

.switch input:disabled + span {
  opacity: 0.55;
}

.automation-list {
  display: grid;
  gap: 12px;
}

.automation-list > button {
  justify-self: start;
}

.automation {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.automation.on {
  background: var(--surface);
  border-color: var(--accent-line);
}

.automation-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.automation .hint {
  margin: 4px 0 8px;
}

.days-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.days-field input {
  width: 64px;
  min-height: 30px;
  padding: 3px 8px;
}

.placeholder-help summary {
  font-weight: 600;
}

.placeholder-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 6px 16px;
  margin: 12px 0 0;
}

.placeholder-list div {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.placeholder-list dt code {
  font-size: 0.8rem;
}

.placeholder-list dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Template boxes (public/js/template-editor.js): the textarea's text is
   transparent and drawn by the backdrop behind it, placeholders marked. */
.tpl-field {
  position: relative;
  border-radius: 8px;
  background: var(--surface);
}

.tpl-backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
  padding: 8px 12px;
  border: 1px solid transparent;
  color: var(--text);
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  pointer-events: none;
}

.tpl-field textarea {
  position: relative;
  display: block;
  overflow: hidden;
  min-height: 64px;
  background: transparent;
  color: transparent;
  caret-color: var(--text);
  resize: none;
}

.tpl-field textarea::placeholder {
  color: var(--faint);
}

.tpl-field textarea::selection {
  background: color-mix(in srgb, var(--info) 28%, transparent);
  color: transparent;
}

.tpl-field:has(textarea:disabled) {
  background: var(--surface-2);
}

.tpl-ph {
  border-radius: 4px;
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent-line);
  color: var(--accent);
}

.tpl-ph.bad {
  background: var(--danger-soft);
  box-shadow: 0 0 0 1px var(--danger);
  color: var(--danger);
}

.tpl-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.tpl-chip {
  min-height: 24px;
  padding: 1px 7px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
  box-shadow: none;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
}

.tpl-chip:hover {
  background: var(--accent);
  color: var(--accent-text);
}

.tpl-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: baseline;
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.85rem;
  white-space: pre-wrap;
}

.tpl-preview strong {
  color: var(--text);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tpl-preview span:not(.tpl-count) {
  flex: 1 1 240px;
  color: var(--text);
}

.tpl-count {
  color: var(--faint);
  font-size: 0.75rem;
}

.reply-list details > summary {
  display: flex;
  padding: 10px 0;
  color: inherit;
}

.reply-list details[open] {
  padding-bottom: 12px;
}

.danger-text {
  color: var(--danger);
}

.mb {
  margin-bottom: 14px;
}

.settings-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.settings-nav {
  position: sticky;
  top: 80px;
  display: grid;
  gap: 2px;
}

.settings-nav a {
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
}

.settings-nav a:hover,
.settings-nav a[aria-current='page'] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.swatch {
  position: relative;
  display: block;
  margin: 0;
  cursor: pointer;
}

.swatch input {
  position: absolute;
  opacity: 0;
}

.swatch span {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border-strong);
}

.swatch input:checked + span {
  box-shadow: 0 0 0 2px var(--text);
}

.swatch input:focus-visible + span {
  box-shadow: var(--ring);
}

.preview-frame {
  display: block;
  width: 100%;
  height: 520px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

/* Preset colours (services/branding.js PRESET_COLORS, in order). */
.swatch .c0 {
  background: #1f6f4a;
}

.swatch .c1 {
  background: #2563c9;
}

.swatch .c2 {
  background: #0e7490;
}

.swatch .c3 {
  background: #7c3aed;
}

.swatch .c4 {
  background: #c2410c;
}

.swatch .c5 {
  background: #be123c;
}

.swatch .c6 {
  background: #15181d;
}

.swatch.custom span:not(.sr-only) {
  display: grid;
  place-items: center;
  background: conic-gradient(#e11d48, #f59e0b, #16a34a, #2563eb, #7c3aed, #e11d48);
  color: #fff;
}

.swatch.custom .icon {
  width: 16px;
  height: 16px;
}

.color-pick input {
  width: 44px;
  height: 34px;
  padding: 2px;
  border-radius: 8px;
  cursor: pointer;
}

fieldset.field {
  border: 0;
  padding: 0;
  margin: 0 0 16px;
}

fieldset.field legend {
  font-weight: 600;
  margin-bottom: 8px;
  padding: 0;
}

.logo-row {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.brand-mark.large {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  flex: none;
}

.brand-mark.large .icon {
  width: 36px;
  height: 36px;
}

@media (max-width: 900px) {
  .settings-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .settings-nav {
    position: static;
    display: flex;
    overflow-x: auto;
  }
}

.thread-status {
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 0.86rem;
}

.thread .msg a {
  color: inherit;
  text-decoration: underline;
}

/* ---------------------------------------------------------------- Website chat (/w/:slug) */

.chat-page {
  background: var(--bg);
}

/* In the shop's site the frame is see-through around the bubble. Matching the
   parent's colour scheme keeps browsers from painting an opaque backdrop. */
html:has(body.chat-embed) {
  color-scheme: normal;
}

body.chat-embed {
  background: transparent;
  overflow: hidden;
}

.chat-root {
  --chat-h: 100dvh;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  height: var(--chat-h);
  max-width: 560px;
  margin: 0 auto;
  background: var(--surface);
  border-inline: 1px solid var(--border);
}

.is-embed .chat-panel {
  position: fixed;
  inset: 0;
  height: auto;
  max-width: none;
  border: 0;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--accent);
  color: var(--accent-text);
}

.chat-head .brand-mark {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent-text) 16%, transparent);
}

.chat-title {
  display: grid;
  min-width: 0;
  flex: 1;
  line-height: 1.25;
}

.chat-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-presence {
  font-size: 0.78rem;
  opacity: 0.85;
}

.chat-presence::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent-text) 45%, transparent);
  vertical-align: 1px;
}

.chat-presence.is-open::before {
  background: #4ade80;
}

.chat-head button.chat-close {
  color: inherit;
}

.chat-head button.chat-close:hover {
  background: color-mix(in srgb, var(--accent-text) 14%, transparent);
  color: inherit;
}

.chat-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px;
  background: var(--surface-2);
  scrollbar-width: thin;
}

.chat-scroll .msg {
  max-width: 85%;
}

.chat-scroll .msg a {
  color: inherit;
  text-decoration: underline;
}

.chat-offline {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 0 0 12px;
  padding: 9px 12px;
  border-radius: var(--radius);
  background: var(--warn-soft);
  color: var(--text);
  font-size: 0.86rem;
}

.chat-offline .icon {
  flex: none;
  margin-top: 2px;
  color: var(--warn);
}

.chat-error {
  margin: 12px 0 0;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.86rem;
}

.chat-textme {
  margin-top: 14px;
  font-size: 0.86rem;
}

.chat-textme summary {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--accent-strong);
  font-weight: 600;
  cursor: pointer;
}

.chat-textme-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.chat-textme-form input {
  flex: 1;
  min-width: 0;
}

.chat-textme-form .hint {
  flex-basis: 100%;
  margin: 0;
}

.chat-hint {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 0;
  color: var(--muted);
}

.chat-compose {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.chat-compose textarea {
  flex: 1;
  min-height: 42px;
  max-height: 140px;
  resize: none;
  border-radius: 21px;
  padding: 10px 14px;
}

.chat-compose button {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.chat-start {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.chat-start .field {
  margin: 0;
}

.chat-start-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.chat-start .check {
  font-size: 0.84rem;
}

.chat-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 14px 8px;
  background: var(--surface);
  color: var(--faint);
  font-size: 0.72rem;
}

.chat-foot span:only-child {
  margin-left: auto;
}

.chat-foot a {
  color: var(--muted);
}

/* The bubble (closed). It sits in the frame's corner; the frame is just big enough for it. */
.chat-dock {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  width: max-content;
  max-width: 320px;
}

.pos-left .chat-dock {
  right: auto;
  left: 16px;
  align-items: flex-start;
}

.chat-launcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 20px 0 16px;
  border-radius: 26px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  text-decoration: none;
  box-shadow:
    0 6px 20px rgb(16 24 40 / 22%),
    0 1px 3px rgb(16 24 40 / 12%);
}

.chat-launcher:hover {
  background: var(--accent-strong);
}

.chat-launcher:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, #fff);
  outline-offset: 2px;
}

.chat-launcher .icon {
  width: 22px;
  height: 22px;
}

.chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--danger);
  color: #fff;
  font-size: 0.72rem;
  line-height: 20px;
  text-align: center;
}

button.chat-peek {
  display: grid;
  gap: 2px;
  justify-items: start;
  max-width: 300px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 14px 14px 4px 14px;
  background: var(--surface);
  color: var(--text);
  font-weight: 400;
  text-align: left;
  white-space: normal;
  box-shadow: 0 6px 20px rgb(16 24 40 / 16%);
}

button.chat-peek:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.chat-peek-who {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--muted);
}

/* The frame is only as wide as the bubble, so the host page says when it's a phone. */
.is-phone .chat-launcher-label {
  display: none;
}

.is-phone .chat-launcher {
  width: 56px;
  min-height: 56px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
}

@media (max-width: 560px) {
  .chat-panel {
    border: 0;
  }
}

/* ---------------------------------------------------------------- Lightspeed extension */

.steps {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  display: grid;
  gap: 12px;
}

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 1.75rem 1fr;
  gap: 12px;
  align-items: baseline;
}

.steps li::before {
  content: counter(step);
  display: inline-grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
  font-size: 0.8125rem;
}

.steps li.done::before {
  content: '✓';
  background: var(--ok);
  color: #fff;
}

.getting-started {
  border-color: var(--accent-line);
}

/* ---------------------------------------------------------------- The demo shop */

.demo-banner {
  padding: 10px 24px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 500;
}

.demo-banner a {
  color: inherit;
  font-weight: 600;
}

td.actions {
  text-align: right;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- Motion */

@media (prefers-reduced-motion: no-preference) {
  .option,
  .calendar button,
  .side-link,
  .conv-item,
  .button,
  button {
    transition:
      background-color 0.12s,
      border-color 0.12s,
      color 0.12s,
      box-shadow 0.12s;
  }

  .msg.fresh {
    animation: rise 0.18s ease-out;
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(4px);
    }
  }
}

/* ---------------------------------------------------------------- Employees and schedule */

.role-picks fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  margin: 0;
}

.role-picks .check,
.role-row .check {
  margin-bottom: 0;
}

.role-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.role-row input[name='name'] {
  width: auto;
  flex: 1 1 180px;
}

.role-actions {
  white-space: nowrap;
}

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

.schedule-grid th,
.schedule-grid td {
  min-width: 96px;
  font-size: 0.86rem;
}

.schedule-grid tbody th {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
}

.schedule-grid .is-today {
  background: var(--accent-soft);
}

.schedule-grid .is-off {
  background: var(--surface-2);
}

.schedule-grid .shift {
  display: block;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.schedule-grid .shift-off {
  color: var(--muted);
  font-weight: 600;
}

.schedule-grid .load {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.schedule-grid .load.some {
  color: var(--ok);
}

.schedule-grid .load.over {
  color: var(--danger);
}

.schedule-grid tfoot th,
.schedule-grid tfoot td {
  border-top: 1px solid var(--border-strong);
  border-bottom: 0;
}

.hours {
  margin-bottom: 20px;
}

.hours-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 4px 0;
}

.hours-row .check {
  width: 130px;
  margin: 0;
}

.hours-row input[type='time'] {
  width: auto;
}

.hours-shifts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
}

.hours-shift {
  display: inline-flex;
  align-items: center;
  gap: 6px 10px;
}

.days-off li,
.team li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.team li {
  padding: 10px 0;
}

.role-row input[type='email'] {
  width: auto;
  flex: 1 1 220px;
}

/* ---------------------------------------------------------------- Search and shortcuts */

.search-open {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 4px 6px 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.search-open:hover {
  border-color: var(--accent-line);
  color: var(--text);
}

.search-open kbd {
  margin-left: 10px;
  color: var(--faint);
}

@media (max-width: 640px) {
  .search-open span,
  .search-open kbd {
    display: none;
  }

  .search-open {
    padding: 4px 8px;
  }
}

.kbd-dialog {
  width: min(640px, calc(100vw - 32px));
  max-width: none;
  max-height: none;
  margin: min(12vh, 96px) auto auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

.kbd-dialog::backdrop {
  background: rgb(16 24 40 / 28%);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--faint);
}

.search-field input {
  min-height: 48px;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  font-size: 1.05rem;
}

.search-field input:focus {
  box-shadow: none;
}

/* At least a few rows tall, growing with the results up to half the window. */
.search-list {
  min-height: 216px;
  max-height: 50vh;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  list-style: none;
}

.search-list a,
.search-results a {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}

.search-list [aria-selected='true'] a {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.search-crumbs {
  color: var(--muted);
  font-size: 0.8rem;
}

.search-empty {
  padding: 18px 12px;
  color: var(--muted);
}

.search-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 0.78rem;
}

.search-foot kbd {
  margin-right: 3px;
  font-size: 0.72rem;
}

@media (max-width: 640px) {
  .kbd-dialog {
    width: calc(100vw - 16px);
    margin-top: 8px;
  }

  /* On a phone the results can use the whole screen. */
  .search-list {
    max-height: calc(100dvh - 130px);
  }

  .search-foot {
    display: none;
  }
}

.help-dialog {
  width: min(440px, calc(100vw - 32px));
}

.help-dialog .kbd-dialog-inner {
  padding: 20px 22px;
}

.help-dialog h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.shortcut-list {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
}

.shortcut-list div {
  display: grid;
  grid-template-columns: 130px 1fr;
  align-items: baseline;
  gap: 12px;
}

.shortcut-list dt {
  display: flex;
  gap: 4px;
}

.shortcut-list dd {
  margin: 0;
  color: var(--muted);
}

.search-page .row {
  flex-wrap: nowrap;
}

.search-results {
  margin: 0;
  padding: 6px;
  list-style: none;
}

.search-results a:hover {
  background: var(--surface-2);
}

h2[id],
.card[id],
section[id] {
  scroll-margin-top: 76px;
}

/* Services: the Lightspeed items a service adds, and the search that finds them. */
.item-search {
  margin: 12px 0 8px;
}

.item-search input[type='search'] {
  flex: 1 1 260px;
  min-width: 0;
}

.item-results {
  border: 0;
  padding: 0;
  margin: 0 0 16px;
}

.item-table td {
  vertical-align: middle;
}

.item-table .check-col {
  width: 2.5rem;
}

.item-table input.qty {
  width: 4.5rem;
}

.service-card h3 {
  margin: 16px 0 8px;
}

.item-table .item-name {
  display: block;
  margin: 0;
  font-weight: 500;
}

.item-table .item-sku {
  display: block;
}

/* Receive under a workorder's status, on Workorders. */
.wo-table .receive-form {
  margin-top: 6px;
}

/* ---------------------------------------------------------------- Help (/help): the guide, sections down the left */

.help-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}

.help-nav {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 2px;
}

.help-nav > a {
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
}

.help-nav > a:hover,
.help-nav > a[aria-current='page'] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* The current section's headings, under its link. */
.help-topics {
  list-style: none;
  margin: 2px 0 8px 12px;
  padding: 0 0 0 8px;
  border-left: 2px solid var(--accent-line);
  display: grid;
  gap: 1px;
}

.help-topics a {
  display: block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.86rem;
  color: var(--muted);
  text-decoration: none;
}

.help-topics a:hover {
  color: var(--text);
  background: var(--surface);
}

.help-article {
  max-width: 72ch;
  min-width: 0;
}

.help-kicker {
  margin: 0 0 2px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

.help-article h2 {
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 1.2rem;
}

.help-article h3 {
  margin-top: 24px;
}

.help-article ol,
.help-article ul {
  padding-left: 1.3em;
  margin: 0 0 1em;
}

.help-article li {
  margin-bottom: 6px;
}

.help-article li > ul,
.help-article li > ol {
  margin-top: 6px;
}

.help-article dl {
  margin: 0 0 1em;
}

.help-article dt {
  font-weight: 600;
  margin-top: 12px;
}

.help-article dd {
  margin: 2px 0 0;
}

.help-article .notice {
  margin: 16px 0;
}

.help-article .code {
  margin: 8px 0 16px;
}

/* Section cards on the first page. */
.help-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin: 16px 0 8px;
}

.help-cards a {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}

.help-cards a:hover {
  border-color: var(--accent-line);
  box-shadow: var(--shadow);
}

.help-cards strong {
  display: block;
  margin-bottom: 4px;
  color: var(--accent-strong);
}

.help-cards span {
  color: var(--muted);
  font-size: 0.88rem;
}

/* Previous and next section. */
.help-foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
}

.help-foot a {
  text-decoration: none;
  font-weight: 500;
}

.help-foot .next {
  margin-left: auto;
}

@media (max-width: 900px) {
  .help-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .help-nav {
    position: static;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .help-nav > a {
    white-space: nowrap;
  }

  /* The row scrolls, so the current section goes first, where it can be seen. */
  .help-nav > a[aria-current='page'] {
    order: -1;
  }

  .help-topics {
    display: none;
  }
}

/* Platform admin (/platform) and support access inside a shop's admin */
.wrap.wide {
  max-width: 1280px;
}

.support-banner {
  padding: 10px 24px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.9rem;
  font-weight: 500;
}

.support-banner a {
  color: inherit;
}

.platform-table td.wrap-text {
  white-space: normal;
  max-width: 360px;
}

.platform-table .small-cell {
  font-size: 0.82rem;
  color: var(--muted);
}

.feature-switches {
  display: grid;
  gap: 8px;
}

.feature-switches form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.feature-switches .check {
  margin: 0;
  flex: 1;
}

/* The landing page and pricing (views/landing.njk, views/_pricing.njk). */
.landing-hero {
  padding: 24px 0 8px;
}

.landing-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.15;
  margin: 6px 0 12px;
}

.landing-hero .lede {
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.05rem;
  margin-bottom: 20px;
}

.price-table {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 16px 0 8px;
}

.price-card {
  display: flex;
  flex-direction: column;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.price-card h3 {
  margin: 0 0 2px;
  color: var(--accent-strong);
}

.price-card .price {
  margin: 0 0 10px;
  font-size: 1.6rem;
  font-weight: 700;
}

.price-card .price span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 400;
}

.price-base {
  margin: 0 0 6px;
  font-size: 0.9rem;
  font-weight: 600;
}

.price-features {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.price-features li + li {
  margin-top: 6px;
}

.price-extra {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.free-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px 20px;
  padding: 0;
  list-style: none;
}

.free-list strong {
  display: block;
}

.free-list span {
  color: var(--muted);
  font-size: 0.88rem;
}

/* Settings → Lightspeed extension: one row per module, grouped. */
.module-group legend {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.module-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.module-row label {
  margin: 0;
}

.module-row .hint {
  display: block;
}

.module-row.unavailable label {
  color: var(--muted);
}

/* ---------------------------------------------------------------- Workorder ticket */
/* The ticket (views/admin/ticket.njk): phone first (mechanics open it from the
   shop tag's QR), then a plain black-on-white page when printed. */
.ticket {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 12px 32px;
}

.ticket-head {
  margin-bottom: 16px;
}

.ticket-shop {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.85rem;
}

.ticket-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.ticket-title h1 {
  margin: 0;
  font-size: 1.5rem;
}

.ticket-who {
  margin: 6px 0 12px;
  font-size: 1.05rem;
}

.ticket-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ticket h2 {
  margin: 0 0 10px;
  font-size: 1.15rem;
}

.ticket h3 {
  margin: 18px 0 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ticket-bike-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
}

.ticket-bike-head h2 {
  margin-bottom: 2px;
}

.ticket-bike-head .icon {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
}

.ticket-bike-facts {
  margin: 0;
  font-size: 0.85rem;
}

.ticket-torque {
  width: 100%;
}

.ticket-torque td {
  vertical-align: top;
}

.ticket-frame {
  font-size: 0.95rem;
}

.ticket-frame dt {
  color: var(--muted);
}

.ticket-error {
  color: var(--danger);
  font-weight: 500;
}

.ticket-credit {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.ticket-candidates {
  display: grid;
  gap: 8px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}

.ticket-candidates li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

.ticket-candidates form {
  margin: 0;
}

.ticket-lines {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ticket-lines li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.ticket-lines li:first-child {
  border-top: 0;
}

.ticket-line-text {
  flex: 1;
  min-width: 12em;
}

.ticket-lines li.done .ticket-line-text {
  color: var(--muted);
}

.ticket-qr {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

.ticket-qr-code {
  flex: none;
  width: 132px;
  height: 132px;
}

.ticket-qr-code svg {
  display: block;
  width: 100%;
  height: 100%;
}

.ticket-qr-url {
  margin: 0;
  overflow-wrap: anywhere;
}

.ticket-photo-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ticket-photo-strip img {
  display: block;
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.ticket-foot {
  margin-top: 8px;
  color: var(--faint);
  font-size: 0.75rem;
  text-align: center;
}

@media (min-width: 640px) {
  .ticket {
    padding: 28px 20px 40px;
  }

  .ticket-title h1 {
    font-size: 1.75rem;
  }
}

@media print {
  @page {
    margin: 12mm;
  }

  body.ticket-page {
    background: #fff;
    color: #000;
  }

  .ticket .no-print {
    display: none !important;
  }

  .ticket {
    max-width: none;
    padding: 0;
  }

  .ticket .card {
    border: 0;
    box-shadow: none;
    padding: 0;
    margin-bottom: 14px;
    break-inside: avoid;
  }

  .ticket a {
    color: inherit;
    text-decoration: none;
  }

  .ticket .status-chip {
    background: none;
  }

  .ticket-qr-code {
    width: 30mm;
    height: 30mm;
  }

  .ticket .muted,
  .ticket h3,
  .ticket-credit,
  .ticket-foot {
    color: #333;
  }
}

/* ---- Workorder photos (the phone bridge): the ticket's Add photos, status pages and the phone pages ---- */

.ticket-add-photos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 12px;
}

.photo-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.photo-strip img {
  display: block;
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.workorder-photos-title {
  margin: 16px 0 8px;
  font-size: 1rem;
}

.phone-page main {
  padding-top: 12px;
}

.phone-card h1 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
  font-size: 1.4rem;
}

.phone-kicker {
  margin: 0 0 12px;
  color: var(--muted);
}

.phone-expiry.phone-expired {
  color: var(--danger);
}

.phone-count {
  margin: 12px 0;
  font-weight: 600;
}

.phone-big {
  width: 100%;
  min-height: 52px;
  justify-content: center;
  font-size: 1.05rem;
}

.phone-photo-form input[type='file'] {
  width: 100%;
  min-height: 44px;
}

.phone-photos {
  margin-top: 16px;
}

.phone-photos img {
  width: 30vw;
  max-width: 120px;
  height: auto;
  aspect-ratio: 1;
}

.phone-camera {
  margin-bottom: 12px;
}

.phone-video {
  display: block;
  width: 100%;
  max-height: 50vh;
  object-fit: cover;
  border-radius: var(--radius);
  background: #000;
}

/* The picture: the live camera, or a frozen frame or photo, with a box drawn around each code (phone.js). */
.phone-view {
  position: relative;
  display: grid;
  overflow: hidden;
  border-radius: var(--radius);
  background: #000;
}

.phone-view > video,
.phone-view > canvas {
  grid-area: 1 / 1;
}

.phone-still {
  display: block;
  width: 100%;
  max-height: 50vh;
  object-fit: cover;
}

.phone-view.is-photo .phone-still {
  object-fit: contain;
}

/* Where to hold the code, while the camera is reading. */
.phone-view.is-live::after {
  position: absolute;
  inset: 14% 10%;
  border: 2px solid rgb(255 255 255 / 55%);
  border-radius: 12px;
  content: '';
  pointer-events: none;
}

.phone-boxes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.phone-box {
  fill: none;
  stroke-width: 4px;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.phone-box.good {
  fill: rgb(34 197 94 / 16%);
  stroke: #22c55e;
}

.phone-box.bad {
  stroke: #f59e0b;
}

/* Blue and slate show on a white label and on a dark background alike. */
.phone-box.done {
  stroke: #2563eb;
  stroke-dasharray: 8 6;
}

.phone-box.dim {
  stroke: rgb(100 116 139 / 85%);
}

.phone-box-badge {
  fill: #22c55e;
  stroke: #fff;
  stroke-width: 2px;
  vector-effect: non-scaling-stroke;
}

.phone-box-number {
  fill: #fff;
  font-family: var(--font);
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
}

/* "Sent 012345678905" over the frozen picture. */
.phone-stamp {
  position: absolute;
  bottom: 12px;
  left: 50%;
  max-width: calc(100% - 24px);
  margin: 0;
  overflow: hidden;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgb(0 0 0 / 72%);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: translateX(-50%);
}

.phone-stamp.ok {
  background: var(--ok);
}

.phone-stamp.error {
  background: var(--danger);
}

.phone-camera > .hint {
  margin: 8px 0 0;
}

.phone-camera-actions {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.phone-camera-actions .button {
  width: 100%;
  justify-content: center;
}

/* "Read a photo of the code": a label that looks like a button, with its file input hidden inside. */
.phone-file-button {
  position: relative;
  cursor: pointer;
}

.phone-file-button:focus-within {
  box-shadow: var(--ring);
}

.phone-choices {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.phone-choices:empty {
  display: none;
}

.phone-choice {
  width: 100%;
  justify-content: flex-start;
  gap: 10px;
}

.phone-choice .hint {
  margin-left: auto;
}

/* A long web link in a choice wraps rather than pushing the kind off the button. */
.phone-choice strong {
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: left;
}

.phone-anyway {
  width: 100%;
  justify-content: center;
}

/* The code's number on the picture. */
.phone-choice-number {
  display: inline-grid;
  flex: none;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: #22c55e;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
}

.phone-sent {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  color: var(--ok);
}

.phone-done {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.phone-done .button {
  width: 100%;
  justify-content: center;
}

/* The privacy and terms pages: a readable column. */
.legal {
  max-width: 46rem;
}

.legal h2 {
  font-size: 1.1rem;
  margin: 28px 0 8px;
}

.legal li {
  margin-bottom: 6px;
}
