/*
 * MotoHubCY HQ. The one stylesheet of the UI. See specs/ui.md.
 * Mobile first (390 px). One media layer for the desktop layout from 1024 px (D32).
 * Sections: 1 tokens, 2 base, 3 layout, 4 components, 5 utilities, 6 desktop.
 * No inline styles. The tokens come from the MotoHubCY brand (D29) and the approved design boards.
 */

/* ---------------------------------------------------------------- 1. Tokens */

:root {
  color-scheme: dark;

  /* Brand colours (D29). */
  --ink: #0B0B0C;        /* ground */
  --carbon: #161514;     /* cards */
  --graphite: #2B2926;   /* lines, secondary buttons */
  --bone: #F4F2EE;       /* text */
  --steel: #9A958D;      /* secondary text, planned */
  --sand: #D9A441;       /* primary action, "is owed" */
  --coral: #EE8A6A;      /* "owes", errors, delete */

  /* Shades from the design boards. */
  --sand-hover: #E6B75C;
  --sand-wash: #2A2112;  /* banner and icon ground */
  --graphite-hover: #3A3733;
  --ash: #4A4540;        /* sold tag, tooltip line */
  --field: #1C1B19;      /* input ground, photo placeholder */
  --field-line: #6E6961; /* input line, faint icons */
  --row-hover: #1D1B18;
  --nav-text: #C9C4BB;
  --topbar-ground: rgba(11, 11, 12, .96);
  --scrim: rgba(0, 0, 0, .62);
  --shadow: 0 8px 24px rgba(0, 0, 0, .5);
  --fab-ground: rgba(11, 11, 12, .72);   /* buttons over a photo */
  --chip-ground: rgba(11, 11, 12, .8);   /* the photo count over a photo */
  --subtotal-ground: #1A1917;            /* group heads and subtotals of the cost table */
  --edit-ground: #1D1A14;                /* the edit rows of a cost (DBikeDetail board) */
  --stage-ground: #1F1E1C;               /* the stage of the viewer (Viewer board) */
  --error-ground: #3A1A17;               /* the thumbnail of a failed upload (ReceiptUpload board) */

  /* Avatars. */
  --avatar-1-bg: #3A2E14; --avatar-1-fg: #E8C27A;
  --avatar-2-bg: #2B2926; --avatar-2-fg: #F4F2EE;
  --avatar-3-bg: #1C2830; --avatar-3-fg: #A9CBE3;
  --avatar-0-bg: #1F1E1C;  /* the common money: steel text */

  /* Type. */
  --font-title: 'Big Shoulders', 'Arial Narrow', sans-serif;
  --font-label: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-body: 'Barlow', 'Helvetica Neue', sans-serif;

  /* Shape and size. */
  --radius: 2px;
  --touch: 44px;
  --gutter: 16px;
  --topbar-h: 56px;
  --tabbar-h: 56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --sidebar-w: 232px;
  --aside-w: 340px;
  --drawer-w: 520px;
}

/* ---------------------------------------------------------------- 2. Base */

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

/* The scroll bars follow the dark UI (D86): a thin bar with a graphite-grey thumb, here on the page and in every inner scroll area (the drawers, the table boxes). */
html { background: var(--ink); -webkit-text-size-adjust: 100%; scrollbar-color: var(--field-line) var(--ink); scrollbar-width: thin; }
* { scrollbar-width: thin; }
/* A modal dialog locks the page scroll behind its scrim (D86). The gutter stays, so the layout does not shift. */
html { scrollbar-gutter: stable; }
html:has(dialog[open]) { overflow: hidden; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }

h1, h2, h3 {
  font-family: var(--font-title);
  font-variation-settings: 'opsz' 72;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .01em;
  line-height: 1.08;
}

a { color: var(--sand); text-decoration: none; }
a:hover { color: var(--sand-hover); }

img, svg { display: block; }

button, input, select, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

ul { margin: 0; padding: 0; list-style: none; }

:focus-visible { outline: 2px solid var(--sand); outline-offset: 3px; }

::placeholder { color: var(--steel); opacity: 1; }

hr { border: 0; height: 1px; background: var(--graphite); margin: 0; }

[hidden] { display: none !important; }

/* ---------------------------------------------------------------- 3. Layout */

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: 12px 16px;
  background: var(--sand);
  color: var(--ink);
  font-weight: 600;
  border-radius: var(--radius);
}
.skip-link:focus { top: 8px; color: var(--ink); }

.shell { min-height: 100dvh; }

/* The top bar on a phone: logo and account. The page actions (search, add) sit in it with position: fixed. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-h);
  padding: 0 4px 0 var(--gutter);
  background: var(--topbar-ground);
  border-bottom: 1px solid var(--graphite);
}
.topbar__logo img { height: 18px; width: auto; }

/* On a phone, the side bar holds only the tab bar. The logo and the account are in the top bar. */
.sidebar__logo,
.sidebar__account { display: none; }

/* The main navigation: a tab bar on a phone, a list in the side bar from 1024 px. */
.mainnav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding-bottom: var(--safe-bottom);
  background: var(--topbar-ground);
  border-top: 1px solid var(--graphite);
}
.mainnav__list {
  display: flex;
  justify-content: space-around;
  height: var(--tabbar-h);
  align-items: center;
}
.mainnav__list > li { flex: 1 1 0; min-width: 0; max-width: 110px; }
.mainnav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  height: 48px;
  border-radius: var(--radius);
  color: var(--steel);
  font-size: 12px;
  font-weight: 500;
}
.mainnav__item .icon { width: 26px; height: 26px; }
.mainnav__item:hover { color: var(--bone); }
.mainnav__item[aria-current="page"] { color: var(--sand); }

.main {
  padding: var(--gutter) var(--gutter) calc(var(--tabbar-h) + var(--safe-bottom) + 32px);
  min-width: 0;
}
.main:focus { outline: none; }

/* A pushed screen below 1024 px (BikeDetail board): no top bar and no tab bar, so the page starts with its photo.
   From 1024 px, the side bar stays (section 6). The toasts and the session banner move to the free space. */
.shell--pushed .topbar,
.shell--pushed .mainnav { display: none; }
.shell--pushed .main { padding-bottom: calc(var(--safe-bottom) + 32px); }
.shell--pushed ~ .toasts { bottom: calc(var(--safe-bottom) + 12px); }
.shell--pushed .banner { top: calc(env(safe-area-inset-top, 0px) + 8px); }
/* "Add cost" is a sticky bar at the foot of the bike page on a phone (BikeDetail board).
   The two shadows give the ink ground of the bar and its top line. The main column and the toasts make space for it. */
.bike-add {
  position: fixed;
  left: var(--gutter);
  right: var(--gutter);
  bottom: calc(var(--safe-bottom) + 12px);
  z-index: 20;
  min-height: 52px;
  font-size: 17px;
  box-shadow: 0 0 0 16px var(--ink), 0 -1px 0 16px var(--graphite);
}
.shell--pushed .main:has(.bike-add) { padding-bottom: calc(var(--safe-bottom) + 112px); }
.shell--pushed:has(.bike-add) ~ .toasts { bottom: calc(var(--safe-bottom) + 92px); }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
}
.page-title { font-size: 34px; }
.page-title:empty { display: none; }

/* On a phone, the page actions sit in the top bar, left of the account button. */
.page-actions {
  position: fixed;
  top: 6px;
  right: 48px;
  z-index: 21;
  display: flex;
  align-items: center;
}

.page {
  display: grid;
  gap: var(--gutter);
  grid-template-columns: minmax(0, 1fr);
}
.page__main, .page__aside { min-width: 0; }
.page__aside:empty { display: none; }
.page__main > :first-child,
.page__aside > :first-child { margin-top: 0; }

/* ---------------------------------------------------------------- 4. Components */

/* Icons from static/img/icons.svg. */
.icon { width: 20px; height: 20px; flex-shrink: 0; }
.icon--sm { width: 16px; height: 16px; }
.icon--lg { width: 26px; height: 26px; }

/* Buttons. One primary button on each screen (D29). */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--touch);
  padding: 0 18px;
  border: 0;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
}
.btn--primary { background: var(--sand); color: var(--ink); }
.btn--primary:hover { background: var(--sand-hover); color: var(--ink); }
.btn--secondary { background: var(--graphite); color: var(--bone); }
.btn--secondary:hover { background: var(--graphite-hover); color: var(--bone); }
.btn--ghost { background: transparent; color: var(--sand); padding: 0 8px; }
.btn--ghost:hover { color: var(--sand-hover); }
.btn--danger { background: var(--coral); color: var(--ink); }
.btn--danger:hover { background: #F29E83; color: var(--ink); }
.btn--danger-ghost { background: transparent; color: var(--coral); box-shadow: inset 0 0 0 1px var(--graphite); }
.btn--danger-ghost:hover { background: var(--graphite); color: var(--coral); }
.btn--block { width: 100%; min-height: 50px; font-size: 17px; }
.btn--sm { padding: 0 14px; font-size: 15px; }
.btn:disabled { opacity: .5; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch);
  height: var(--touch);
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--bone);
}
.icon-btn:hover { background: var(--graphite); color: var(--bone); }

/* The search control. A button with an icon on a phone, a field-like box from 1024 px. */
.search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: var(--touch);
  height: var(--touch);
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--bone);
}
.search-btn .icon { width: 22px; height: 22px; }
.search-btn:disabled { color: var(--steel); }
.search-btn__label { display: none; }

/* The add action of a page. Use: <a class="btn btn--primary page-add">{% icon "plus" %}<span class="page-add__label">Add a bike</span></a>. */
.page-add { width: var(--touch); padding: 0; background: transparent; color: var(--sand); }
.page-add:hover { background: transparent; color: var(--sand-hover); }
.page-add .icon { width: 26px; height: 26px; }
.page-add__label {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* Avatars stay round (D29). */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--avatar-1-bg);
  color: var(--avatar-1-fg);
  font-size: 15px;
  font-weight: 700;
}
.avatar--sm { width: 32px; height: 32px; font-size: 13px; }
.avatar--lg { width: var(--touch); height: var(--touch); font-size: 17px; }
.avatar--2 { background: var(--avatar-2-bg); color: var(--avatar-2-fg); }
.avatar--3 { background: var(--avatar-3-bg); color: var(--avatar-3-fg); }
.avatar--xs { width: 22px; height: 22px; font-size: 10px; }
.avatar--common { background: var(--avatar-0-bg); color: var(--steel); border: 1px solid var(--graphite); }

/* Cards and section heads. */
.card { background: var(--carbon); border: 1px solid var(--graphite); border-radius: var(--radius); }

.label,
.section-head {
  font-family: var(--font-label);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--steel);
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--touch);
  margin: 24px 0 6px;
}
/* A section head can be a wrapper with an <h2> (the panels of the bike page). The h2 keeps the label style. */
.section-head > h2 { font: inherit; letter-spacing: inherit; font-variation-settings: normal; }
.section-head a { font-family: var(--font-body); font-size: 14px; letter-spacing: 0; text-transform: none; }
/* A link in a section head ("Edit shares", "Add transfer"). The head is 44 px high, so the link is a touch target. */
.section-head__tools { display: flex; align-items: center; gap: 12px; }
.section-head__link { display: inline-flex; align-items: center; min-height: var(--touch); padding: 0 4px; font-weight: 600; }

/* Form fields. Inputs are 16 px or more, so a phone does not zoom. */
.field { display: flex; flex-direction: column; gap: 4px; }
.field__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 20px; }
.field__label {
  font-family: var(--font-label);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--steel);
}
.field__optional { letter-spacing: .06em; text-transform: none; font-weight: 500; color: var(--field-line); }
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--field-line);
  border-radius: var(--radius);
  background: var(--field);
  color: var(--bone);
  font-size: 17px;
  color-scheme: dark;
}
.field textarea { min-height: 96px; padding: 10px 12px; resize: vertical; }
.field input:is([type="checkbox"], [type="radio"]) { width: auto; min-height: 0; accent-color: var(--sand); }
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible { outline-offset: 0; border-color: var(--sand); }
.field [aria-invalid="true"] { border-color: var(--coral); }
.field__help { font-size: 13px; color: var(--steel); }
.field__errors { display: flex; flex-direction: column; gap: 2px; color: var(--coral); font-size: 14px; }
.field__errors li { display: flex; align-items: center; gap: 6px; }

/* A group of fields in one card, with lines between them (Main board, CostForm board). */
.field-card { background: var(--carbon); border: 1px solid var(--graphite); border-radius: var(--radius); }
.field-card .field { gap: 2px; padding: 10px var(--gutter); border-top: 1px solid var(--graphite); }
.field-card .field:first-child { border-top: 0; }
.field-card .field input,
.field-card .field select {
  min-height: 0;
  padding: 4px 0;
  border: 0;
  background: transparent;
}
.field-card .field input:focus-visible,
.field-card .field select:focus-visible { outline: 2px solid var(--sand); outline-offset: 2px; }

/* The (i) button and the tooltip with the longer help text (D32). The native popover needs no script. */
.tip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch);
  height: var(--touch);
  margin: -12px -12px -12px 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--steel);
}
.tip-btn:hover { color: var(--bone); }
.tip {
  width: min(300px, calc(100vw - 2 * var(--gutter)));
  margin: auto;
  padding: 12px 14px;
  background: var(--graphite);
  border: 1px solid var(--ash);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--bone);
  font-size: 14px;
  line-height: 1.4;
}

/* Tables (desktop lists). Number columns align right. */
.table { width: 100%; border-collapse: collapse; }
.table th {
  padding: 10px var(--gutter);
  border-bottom: 1px solid var(--graphite);
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--steel);
  text-align: left;
  white-space: nowrap;
}
.table td { height: 52px; padding: 0 var(--gutter); border-top: 1px solid var(--graphite); vertical-align: middle; }
.table tbody tr:first-child td { border-top: 0; }
.table tbody tr:hover { background: var(--row-hover); }
.table .num { text-align: right; }

/* Status tags of a bike. Each status has a colour and a word (D29). */
.tag {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  height: 24px;
  padding: 0 8px;
  border-radius: var(--radius);
  font-family: var(--font-label);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.tag--purchased { background: var(--steel); color: var(--ink); }
/* `.tag--accent` marks an active listing on the analytics pages. */
.tag--in_repair, .tag--accent { background: var(--sand); color: var(--ink); }
.tag--listed { background: var(--bone); color: var(--ink); }
.tag--sold { background: var(--ash); color: var(--bone); }
/* An archived bike (D76): dashed, like a planned cost, because the bike is out of the numbers. */
.tag--archived { background: transparent; color: var(--nav-text); border: 1px dashed var(--steel); }
/* A commission sale (CommissionList board): neutral chips, because coral means "owes" and sand means "is owed" (D29). */
.tag--unsettled { background: transparent; color: var(--bone); border: 1px solid var(--steel); }
.tag--settled { background: var(--ash); color: var(--bone); }

/* The tag of a planned cost: dashed steel (D29). */
.tag-planned {
  display: inline-flex;
  align-items: center;
  padding: 0 5px;
  border: 1px dashed var(--steel);
  border-radius: var(--radius);
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--steel);
}

/* Money amounts. */
.amount {
  font-family: var(--font-label);
  font-weight: 600;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.amount--owed { color: var(--sand); }
.amount--owes { color: var(--coral); }
.amount--planned { color: var(--steel); }
.amount--quiet { color: var(--nav-text); }
.amount--lg { font-size: 20px; font-weight: 700; }

/* "X owes Y" rows. Put them in <ul class="card owes-list">. */
.owes-row { display: flex; align-items: center; gap: 10px; padding: 12px var(--gutter); border-top: 1px solid var(--graphite); }
.owes-row:first-child { border-top: 0; }
.owes-row__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.owes-row__who { font-weight: 600; }

/* The account menu. */
.account { display: flex; align-items: center; gap: 12px; padding-bottom: 8px; }
.account__name { font-weight: 600; }
.account__meta { font-size: 13px; color: var(--steel); }
.menu { margin-bottom: 8px; }
.menu li + li { border-top: 1px solid var(--graphite); }
.menu__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--bone);
  font-size: 17px;
  text-align: left;
}
.menu__item:hover { color: var(--sand-hover); }
.menu__item--danger,
.menu__item--danger:hover { color: var(--coral); }

/* Dialogs: native <dialog>. A bottom sheet on a phone, centred from 1024 px. */
.dialog {
  width: 100%;
  max-width: 100%;
  max-height: 90dvh;
  margin: auto 0 0;
  padding: 0;
  border: 0;
  border-top: 1px solid var(--graphite);
  border-radius: 0;
  background: var(--carbon);
  color: var(--bone);
}
.dialog::backdrop,
.drawer::backdrop { background: var(--scrim); }
.dialog__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: var(--gutter) var(--gutter) calc(var(--gutter) + var(--safe-bottom));
}
.dialog__title { font-size: 22px; }
.dialog__text { margin-bottom: 8px; color: var(--steel); font-size: 15px; }
.dialog__actions { display: flex; flex-direction: column; gap: 8px; }

/* Drawers: the forms. Full screen on a phone, a side drawer from 1024 px (D32). */
.drawer {
  width: 100%;
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--carbon);
  color: var(--bone);
}
.drawer[open] { display: flex; flex-direction: column; }
.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 4px 12px var(--gutter);
  border-bottom: 1px solid var(--graphite);
}
.drawer__title { font-size: 26px; }
.drawer__body { flex: 1; overflow-y: auto; padding: 20px var(--gutter); display: flex; flex-direction: column; gap: 20px; }
.drawer__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px var(--gutter) calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--graphite);
}
.drawer__foot:empty { display: none; }

/* Toasts. Two live regions: polite for success, assertive for errors. An error toast stays until dismissed.
   When a dialog is open, static/js/app.js moves #toasts into it, so the toasts are not inert. */
.toasts {
  position: fixed;
  left: var(--gutter);
  right: var(--gutter);
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
/* In an open bottom sheet on a phone, the toasts go to the top, so they do not cover the sheet. */
.dialog > .toasts { top: var(--gutter); bottom: auto; }
/* A drawer has no tab bar under it. */
.drawer > .toasts { bottom: calc(var(--safe-bottom) + 12px); }
.toasts__region { display: flex; flex-direction: column; gap: 8px; }
.toasts__region:empty { display: none; }
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--carbon);
  border: 1px solid var(--graphite);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  pointer-events: auto;
}
.toast .icon { width: 18px; height: 18px; color: var(--sand); }
.toast__text { flex: 1; }
.toast--error { border-color: var(--coral); font-size: 15px; }
.toast--error .icon { color: var(--coral); }
.toast .toast__close { margin: -12px -10px -12px 0; color: var(--steel); }
.toast .toast__close .icon { width: 16px; height: 16px; color: inherit; }

/* The banner for an expired session. It is in the page flow, at the top of the main column.
   It sticks under the top bar. When a dialog is open, static/js/app.js moves it to the top of the dialog. */
.banner {
  position: sticky;
  top: calc(var(--topbar-h) + 8px);
  z-index: 15;
  margin-bottom: var(--gutter);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: var(--sand-wash);
  border: 1px solid var(--sand);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.banner__text { flex: 1; padding: 12px 0; font-size: 15px; }
.banner__link { display: flex; align-items: center; min-height: var(--touch); font-weight: 600; }
.dialog > .banner,
.drawer > .banner { position: static; margin: var(--gutter) var(--gutter) 0; box-shadow: none; flex-shrink: 0; }

/* The note at the top of the page of an archived bike, with Restore (Archive board, D76). */
.archived-note {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: var(--gutter);
  padding: 8px 12px;
  background: var(--field);
  border: 1px dashed var(--steel);
  border-radius: var(--radius);
  color: var(--nav-text);
}
.archived-note > .icon { flex-shrink: 0; }
.archived-note__text { flex: 1; color: var(--bone); font-size: 15px; }

/* A form that holds one button, for example Restore (D76). It adds no box. */
.inline-form { display: contents; }

/* The link under the bike list to the archived bikes, and back (D76). */
.bike-list__more { display: flex; justify-content: center; margin-top: 8px; }
.bike-list__more:first-child { justify-content: flex-start; margin: 0 0 8px; }
.link-action { display: inline-flex; align-items: center; gap: 8px; min-height: var(--touch); padding: 0 4px; font-size: 15px; font-weight: 600; }

/* Empty states. */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 24px 28px;
  text-align: center;
}
.empty-state__icon { color: var(--field-line); }
.empty-state__icon .icon { width: 44px; height: 44px; --icon-stroke: 1.4; }
.empty-state__title { font-size: 22px; }
.empty-state__text { max-width: 260px; color: var(--steel); font-size: 15px; }
.empty-state .btn { margin-top: 4px; min-height: 48px; padding: 0 20px; }
/* An empty panel in a card (bike page). */
.card > .empty-state,
[data-attachments-region] > .empty-state { padding: 24px var(--gutter); }
/* A good state, for example "All settled" (States board): the icon in a sand circle. */
.empty-state--ok .empty-state__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--sand-wash);
  color: var(--sand);
}
.empty-state--ok .empty-state__icon .icon { width: 26px; height: 26px; --icon-stroke: 2.6; }

/* The filter chips of the bike list (BikeList board). The current chip has aria-current="page". */
.filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: var(--gutter); }
.filters__item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: var(--touch);
  padding: 0 4px;
  border: 1px solid var(--graphite);
  border-radius: var(--radius);
  background: var(--carbon);
  color: var(--bone);
  font-family: var(--font-label);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.filters__item:hover { color: var(--bone); background: var(--row-hover); }
.filters__item[aria-current="page"] { background: var(--sand); border-color: var(--sand); color: var(--ink); }
.filters__count { opacity: .7; }

/* The bike list. One <table class="table bike-table">. Below 1024 px, each row is a card (BikeList board).
   Card grid: the photo, the name (two rows), the status and the date on the right, then three equal stats. */
.bike-table { display: block; }
.bike-table thead { display: none; }
.bike-table tbody { display: flex; flex-direction: column; gap: 10px; }
.bike-row {
  position: relative;
  display: grid;
  grid-template-columns: 84px calc(100% / 3 - 84px) minmax(0, 1fr) minmax(0, 1fr);
  background: var(--carbon);
  border: 1px solid var(--graphite);
  border-radius: var(--radius);
}
.bike-row:has(.bike-row__link:focus-visible) { outline: 2px solid var(--sand); outline-offset: 2px; }
.bike-table td { display: block; height: auto; padding: 0; border-top: 0; min-width: 0; }
.bike-table .bike-row__photo { grid-column: 1; grid-row: 1 / 3; padding: 12px 0 12px 12px; }
.bike-row__img,
.bike-row__nophoto {
  width: 72px;
  height: 72px;
  border-radius: var(--radius);
  background: var(--field);
  object-fit: cover;
}
.bike-row__nophoto { display: flex; align-items: center; justify-content: center; color: var(--field-line); }
.bike-row__nophoto .icon { width: 34px; height: 34px; --icon-stroke: 1.5; }
/* The title row (BikeList board, .ttl): the name and the status tag share grid row 1. The name cell is a subgrid
   of columns 2 to 4. The name uses columns 2 and 3, the meta line uses columns 2 to 4, and the status cell is in column 4. */
.bike-table .bike-row__name {
  grid-column: 2 / -1;
  grid-row: 1 / 3;
  display: grid;
  grid-template-columns: subgrid;
  grid-template-rows: subgrid;
  align-content: center;
  padding: 12px;
}
.bike-row__link {
  display: block;
  overflow: hidden;
  color: var(--bone);
  font-family: var(--font-title);
  font-variation-settings: 'opsz' 72;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
  grid-column: 1 / 3;
  grid-row: 1;
  align-self: end;
}
.bike-row__link:hover { color: var(--bone); }
.bike-row__link:focus-visible { outline: none; }
/* The link covers the whole row, so a tap anywhere opens the bike. */
.bike-row__link::after { content: ""; position: absolute; inset: 0; }
.bike-row__meta {
  grid-column: 1 / -1;
  grid-row: 2;
  align-self: start;
  display: block;
  overflow: hidden;
  margin-top: 4px;
  color: var(--steel);
  font-family: var(--font-label);
  font-size: 14px;
  letter-spacing: .04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* The status tag ends the title row. It is above the stretched link. A tap on the tag still opens the bike. */
.bike-table .bike-row__status {
  position: relative;
  z-index: 1;
  grid-column: 4;
  grid-row: 1;
  align-self: end;
  justify-self: end;
  padding: 12px 12px 0 8px;
  pointer-events: none;
}
/* Below 1024 px, the date is in the meta line ("model · year · Added date"), as on the BikeList board. */
.bike-table .bike-row__added { display: none; }
.bike-table .bike-row__stat {
  grid-row: 3;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
  padding: 10px 12px;
  border-top: 1px solid var(--graphite);
  text-align: left;
}
.bike-table .bike-row__stat--cost { grid-column: 1 / 3; }
.bike-table .bike-row__stat + .bike-row__stat { border-left: 1px solid var(--graphite); }
.bike-row__stat .amount { font-size: 18px; }
.bike-row__k { font-family: var(--font-label); font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--steel); white-space: nowrap; }
.bike-row__sub,
.bike-table .bike-row__margin { display: none; }
/* The totals of the list (D89): the table footer. Below 1024 px, one card under the bike cards, with the grid of a bike card.
   The label and the note of the bikes with no price are above the three stats. */
.bike-table tfoot { display: block; margin-top: 10px; }
.bike-totals { background: var(--subtotal-ground); border-color: var(--ash); }
.bike-table .bike-totals__label {
  display: block;
  grid-column: 1 / -1;
  grid-row: 1;
  height: auto;
  padding: 12px 12px 10px;
  border: 0;
  font-family: var(--font-label);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .14em;
  text-align: left;
  text-transform: uppercase;
  color: var(--steel);
}
.bike-table .bike-totals .bike-row__stat { grid-row: 2; }
.bike-table .bike-totals .bike-row__stat:nth-of-type(2) { grid-column: 3; }
.bike-table .bike-totals .bike-row__stat:nth-of-type(3) { grid-column: 4; }
/* The note can wrap in the narrow stat of a phone. */
.bike-totals__note { font-size: 12px; line-height: 1.2; color: var(--steel); }

/* The sales list (CommissionList board). One <table class="table sale-table">. Below 1024 px, each row is a card: the title and the state,
   then three equal stats. The totals card above the table replaces the footer. */
.sale-table { display: block; }
.sale-table thead,
.sale-table tfoot { display: none; }
.sale-table tbody { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.sale-row {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: var(--carbon);
  border: 1px solid var(--graphite);
  border-radius: var(--radius);
}
.sale-row:has(.sale-row__link:focus-visible) { outline: 2px solid var(--sand); outline-offset: 2px; }
.sale-table td { display: block; height: auto; padding: 0; border-top: 0; min-width: 0; }
.sale-table .sale-row__date,
.sale-table .sale-row__holder,
.sale-table .sale-row__margin { display: none; }
.sale-table .sale-row__name { grid-column: 1 / 3; padding: 12px 0 12px 12px; }
.sale-row__link {
  display: block;
  overflow: hidden;
  color: var(--bone);
  font-family: var(--font-title);
  font-variation-settings: 'opsz' 72;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sale-row__link:hover { color: var(--bone); }
.sale-row__link:focus-visible { outline: none; }
/* The link covers the whole row, so a tap anywhere opens the sale. */
.sale-row__link::after { content: ""; position: absolute; inset: 0; }
.sale-row__meta { display: block; overflow: hidden; margin-top: 4px; color: var(--steel); font-family: var(--font-label); font-size: 14px; letter-spacing: .04em; text-overflow: ellipsis; white-space: nowrap; }
.sale-table .sale-row__state { grid-column: 3; display: flex; align-items: center; justify-content: flex-end; padding: 12px 12px 12px 8px; pointer-events: none; }
.sale-table .sale-row__stat { display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; padding: 10px 12px; border-top: 1px solid var(--graphite); text-align: left; }
.sale-table .sale-row__stat + .sale-row__stat { border-left: 1px solid var(--graphite); }
.sale-row__stat .amount { font-size: 18px; }
.sale-note { margin: 0; padding: 12px 14px; border-top: 1px solid var(--graphite); color: var(--steel); font-size: 14px; }
/* The cards under the table are for a desktop browser (DCommissionList board). */
.sale-summary { display: none; }

/* The split of the profit on the sale page (CommissionDetail board). */
.split-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px var(--gutter); border-top: 1px solid var(--graphite); }
.split-row:first-child { border-top: 0; }
.split-row__who { flex: 1; min-width: 0; }
.split-row__share { color: var(--steel); }
.split-row .amount { min-width: 84px; text-align: right; }
.split-row--total .amount { font-size: 16px; text-transform: none; }
.split-row--total { min-height: 48px; background: var(--subtotal-ground); font-family: var(--font-label); font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--steel); }

/* The bike page (BikeDetail board). The head: the photo, the title, the status, the meta line, and the actions.
   On a phone, the photo fills the width, and the back link and the actions are icon buttons over it. */
.bike-head { position: relative; display: flex; flex-direction: column; gap: 16px; margin-bottom: 16px; }
.bike-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 260px;
  margin: calc(-1 * var(--gutter)) calc(-1 * var(--gutter)) 0;
  overflow: hidden;
  background: var(--field);
  color: var(--field-line);
}
.bike-hero__img { width: 100%; height: 100%; object-fit: cover; }
.bike-hero__nophoto .icon { width: 64px; height: 64px; --icon-stroke: 1.2; }
.bike-hero__count {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--radius);
  background: var(--chip-ground);
  color: var(--bone);
  font-family: var(--font-label);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.crumbs { position: absolute; z-index: 1; top: calc(12px - var(--gutter) + env(safe-area-inset-top, 0px)); left: calc(12px - var(--gutter)); }
.crumbs__back,
.bike-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch);
  height: var(--touch);
  padding: 0;
  border-radius: var(--radius);
  background: var(--fab-ground);
  color: var(--bone);
}
.crumbs__back:hover,
.bike-action:hover { background: var(--graphite); color: var(--bone); }
.crumbs__back .icon { width: 22px; height: 22px; }
.bike-action .icon { width: 20px; height: 20px; }
.crumbs__label,
.bike-action__label {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.crumbs__current { display: none; }
.bike-head__actions { position: absolute; z-index: 1; top: calc(12px - var(--gutter) + env(safe-area-inset-top, 0px)); right: calc(12px - var(--gutter)); display: flex; gap: 8px; }
.bike-head__title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bike-head .page-title { font-size: 32px; line-height: 1.05; }
.bike-head__meta { margin-top: 6px; color: var(--steel); font-family: var(--font-label); font-size: 16px; letter-spacing: .04em; }
.bike-head__meta > span + span::before,
.transfer-row__meta > span + span::before { content: " · "; }
.bike-head__added { display: none; }

/* The totals: a grid of stats in a card. 3 columns on a phone, 5 from 1024 px. */
.kpis__list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
.kpi { min-width: 0; padding: 12px 14px; }
.kpi dd { margin: 0; }
.kpi .label { display: flex; align-items: center; gap: 2px; min-height: 20px; font-size: 11px; white-space: nowrap; }
.kpi .amount { font-size: 20px; }
.kpi:not(:nth-child(3n + 1)) { border-left: 1px solid var(--graphite); }
.kpi:nth-child(n + 4) { border-top: 1px solid var(--graphite); }
.kpi--profit { grid-column: span 2; }
.kpi--profit dd { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; }
.kpi__sub { color: var(--steel); font-size: 13px; }

/* The cost region: the filter and the cost table. A filter is a row of links in a .seg (aria-current). */
.bike-costs__head { flex-wrap: wrap; gap: 0 16px; }
.seg--links { flex-basis: 100%; margin-bottom: 6px; }
a.seg__item { color: var(--bone); }
a.seg__item:hover { background: var(--row-hover); color: var(--bone); }

/* The cost table. One <table> for both layouts. Below 1024 px, each group (tbody) is a card. */
.cost-table { display: block; }
.cost-table thead { display: none; }
.cost-table tbody { display: block; background: var(--carbon); border: 1px solid var(--graphite); border-radius: var(--radius); }
.cost-table tbody + tbody { margin-top: 12px; }
.cost-table tr { display: block; }
.cost-table td { display: block; height: auto; padding: 0; border-top: 0; }
.cost-table tbody tr:hover { background: none; }
.cost-group__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px var(--gutter) 8px; }
.cost-group__title { font-size: 18px; }
.cost-group__bar .amount { font-size: 18px; }
.cost-group__subtotals {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 10px var(--gutter);
  border-top: 1px solid var(--graphite);
  background: var(--subtotal-ground);
  color: var(--steel);
  font-family: var(--font-label);
  font-size: 14px;
  letter-spacing: .04em;
}
/* A cost row on a phone: the description over "[Planned] payer · category · date", the amount, and the receipts.
   The description cell has display: contents, so its title, its planned tag, and its subline go into the grid of the row.
   Columns: the planned tag, the payer, the subline, the amount, and the receipts. */
.cost-table .cost-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto 52px;
  align-items: center;
  min-height: 60px;
  padding-left: var(--gutter);
  border-top: 1px solid var(--graphite);
}
.cost-table .cost-row__desc { display: contents; }
.cost-row__title {
  grid-column: 1 / 4;
  grid-row: 1;
  align-self: end;
  overflow: hidden;
  padding: 10px 8px 0 0;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cost-row__desc > .tag-planned { grid-column: 1; grid-row: 2; align-self: start; margin: 3px 6px 10px 0; }
.cost-table .cost-row__payer { grid-column: 2; grid-row: 2; align-self: start; padding: 2px 0 10px; color: var(--steel); font-size: 13px; white-space: nowrap; }
.cost-row__meta { grid-column: 3; grid-row: 2; align-self: start; display: flex; flex-wrap: wrap; align-items: center; min-width: 0; padding: 2px 8px 10px 0; color: var(--steel); font-size: 13px; }
/* The payer comes before the subline, so each part of the subline starts with a dot. */
.cost-row__meta > span::before { content: "\00a0·\00a0"; }
.cost-row__category--desktop { display: none; }
.cost-table .cost-row__amount { grid-column: 4; grid-row: 1 / 3; padding: 0 8px; }
.cost-row__amount .amount { font-size: 18px; }
.cost-table .cost-row__receipts { grid-column: 5; grid-row: 1 / 3; align-self: stretch; display: flex; align-items: center; justify-content: center; border-left: 1px solid var(--graphite); }
/* The description is the edit link. It covers the row, so a tap anywhere on the row edits the cost (D32).
   The receipt links stay above it. */
.cost-table .cost-row { position: relative; }
a.cost-row__title { color: var(--bone); }
a.cost-row__title:hover { color: var(--bone); }
a.cost-row__title:focus-visible { outline: none; }
.cost-row__title::after { content: ""; position: absolute; inset: 0; }
.cost-row:has(.cost-row__title:focus-visible) { outline: 2px solid var(--sand); outline-offset: -2px; }
.cost-row__receipts .receipts__link { position: relative; z-index: 1; }
.cost-table .cost-row__edit,
.cost-table .cost-table__edit { display: none; }
/* While a row is in edit (D50): the other rows, the filter, and "Add cost" are inert and dim (DBikeDetail board). */
[data-lockable][inert],
.cost-table[data-editing] .cost-group__head,
.cost-table[data-editing] .cost-group__sub { opacity: .38; }
.who-tag { display: inline-flex; align-items: center; gap: 6px; }
.receipts { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; font-family: var(--font-label); font-size: 14px; font-weight: 600; }
.receipts__link { display: inline-flex; align-items: center; justify-content: center; gap: 2px; min-width: var(--touch); min-height: var(--touch); }
.receipts__none { color: var(--ash); }

/* The settlement panels: shares and balances, who owes whom, and the transfers. */
/* Each segment has the avatar tone of its partner (avatar_tone), so the bar agrees with the avatars. */
/* The width attribute gives the basis. flex-shrink takes the gaps from the segments, so the bar does not overflow. */
.share-bar { display: flex; gap: 2px; height: 8px; overflow: hidden; }
.share-bar__seg { flex: 0 1 auto; min-width: 0; height: 8px; background: var(--avatar-1-fg); }
.share-bar__seg.avatar--2 { background: var(--avatar-2-fg); }
.share-bar__seg.avatar--3 { background: var(--avatar-3-fg); }
.partner-row,
.transfer-row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px var(--gutter); border-top: 1px solid var(--graphite); }
.partner-row:first-child,
.transfer-row:first-child { border-top: 0; }
.partner-row__who,
.transfer-row__text { flex: 1; min-width: 0; }
.partner-row__value { display: flex; flex-direction: column; align-items: flex-end; }
.partner-row__value .amount { font-size: 18px; }
.partner-row__state { font-family: var(--font-label); font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--steel); }
.settle-status { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding: 12px var(--gutter); }
/* The debts and the transfers are on the settlement page on a phone (D60). From 1024 px, the right column shows them. */
.settlement-detail { display: none; }
.settle-status__icon { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex-shrink: 0; border-radius: var(--radius); background: var(--sand-wash); color: var(--sand); }
.settle-status__body { flex: 1; min-width: 0; }
/* The link card to the settlement page, on a phone (BikeDetail board). From 1024 px, the right column has the sections. */
.settle-status--link { min-height: var(--touch); color: inherit; }
.settle-status--link:hover { color: inherit; border-color: var(--ash); }
.settle-status__go { color: var(--steel); }
.settle-status__title { font-size: 20px; font-weight: 700; }
.settle-status__text,
.transfer-row__meta { display: block; color: var(--steel); font-size: 13px; }
.transfer-row { position: relative; gap: 10px; font-size: 15px; }
/* The transfer row is the edit link. CSS stretches the link over the row, so a tap anywhere on it opens the form (D59). */
.transfer-row__link { color: inherit; }
.transfer-row__link::after { content: ""; position: absolute; inset: 0; }
.transfer-row__link:hover { color: var(--sand); }
.transfer-row .amount { font-size: 17px; }

/* The general costs page (GeneralCosts board). The heading has a sub line. The totals have 3 values, then the "Not settled" link card. */
.page-head__text { min-width: 0; }
.page-sub { margin-top: 4px; color: var(--steel); font-size: 15px; }
.kpis + .settle-status,
.panel + .settle-status { margin-top: 12px; }
.cost-note { margin-top: 8px; padding: 0 var(--gutter); }
.partner-row__sub { display: block; color: var(--steel); font-size: 13px; font-weight: 400; }
/* The general cost row on a phone: the description over "[Planned] payer · date · participants".
   The columns are the planned tag, the payer, the date, the participants, the amount, and the receipts. */
.cost-table--general .cost-row { grid-template-columns: auto auto auto minmax(0, 1fr) auto 52px; }
.cost-table--general .cost-row__title { grid-column: 1 / 5; }
.cost-table--general .cost-row__meta { display: none; }
.cost-table--general .cost-row__date,
.cost-table--general .cost-row__shared { grid-row: 2; align-self: start; padding: 2px 0 10px; color: var(--steel); font-size: 13px; }
.cost-table--general .cost-row__date { grid-column: 3; }
.cost-table--general .cost-row__shared { grid-column: 4; min-width: 0; padding-right: 8px; }
.cost-table--general .cost-row__date::before,
.cost-table--general .cost-row__shared::before { content: "\00a0·\00a0"; }
.cost-table--general .cost-row__date--none { display: none; }
.cost-table--general .cost-row__amount { grid-column: 5; }
.cost-table--general .cost-row__receipts { grid-column: 6; }
/* The "Shared by" choice of the general cost form: one checkbox row for each partner. */
.participant-row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px var(--gutter); border-top: 1px solid var(--graphite); font-size: 17px; cursor: pointer; }
.participant-row:first-child { border-top: 0; }
.participant-row input { flex-shrink: 0; width: 22px; height: 22px; margin: 0; accent-color: var(--sand); }
.participant-row__name { flex: 1; }
.participant-row:has(input:focus-visible) { outline: 2px solid var(--sand); outline-offset: -2px; }

/* Forms: a column of sections. A section is a fieldset with a section head as the legend. */
.form { display: flex; flex-direction: column; gap: 20px; }
.form-section { min-width: 0; margin: 0; padding: 0; border: 0; }
.form-section > .section-head { width: 100%; min-height: 0; margin: 0 0 8px; padding: 0; }
.form-section__note { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.form-section__errors { margin-top: 8px; }
.form-errors {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--coral);
  border-radius: var(--radius);
  color: var(--coral);
  font-size: 15px;
}
.form-errors li { display: flex; align-items: center; gap: 6px; }
.form-errors__title { font-weight: 600; }
/* Two fields side by side in a field card (BikeForm board: model and year). */
.field-card__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--graphite); }
.field-card__row .field { border-top: 0; }
.field-card__row .field + .field { border-left: 1px solid var(--graphite); }
.field-card .field textarea { min-height: 0; padding: 4px 0; border: 0; background: transparent; }

/* A segmented choice of radio buttons (BikeForm board: the status). */
.seg {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 2px;
  padding: 2px;
  background: var(--carbon);
  border: 1px solid var(--graphite);
  border-radius: var(--radius);
}
.seg__item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch);
  border-radius: var(--radius);
  font-family: var(--font-label);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
}
.seg__item input,
.who input { position: absolute; opacity: 0; pointer-events: none; }
.seg__item:has(input:checked),
.seg__item[aria-current="page"],
.seg__item[aria-current="true"] { background: var(--graphite); box-shadow: inset 0 -2px 0 var(--sand); }
.seg__item:has(input:focus-visible) { outline: 2px solid var(--sand); outline-offset: 2px; }

/* The share rows of the bike form: the partner by name and a percent field (BikeForm board). */
.share-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-height: 56px; padding: 6px var(--gutter); border-top: 1px solid var(--graphite); }
.share-row:first-child { border-top: 0; }
.share-row__name { flex: 1; min-width: 0; font-size: 17px; }
.share-row__input { display: flex; align-items: center; gap: 6px; color: var(--steel); }
.share-row__input input {
  width: 76px;
  height: var(--touch);
  padding: 0 10px;
  border: 1px solid var(--field-line);
  border-radius: var(--radius);
  background: var(--field);
  color: var(--bone);
  font-family: var(--font-label);
  font-size: 18px;
  font-weight: 600;
  text-align: right;
}
.share-row__input input:focus-visible { outline-offset: 0; border-color: var(--sand); }
.share-row--invalid input { border-color: var(--coral); }
.share-row__errors { flex-basis: 100%; }
.share-total { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 var(--gutter); border-top: 1px solid var(--graphite); background: var(--row-hover); }
.share-total__value { font-family: var(--font-label); font-size: 18px; font-weight: 700; }
.share-total__value[data-ok] { color: var(--sand); }

/* The sale form (CommissionForm and DCommissionDrawer boards). The prices sit side by side in a field card, big and boxed on the card.
   The profit line sums them up. The split rows have a stepper at each side of the percent field and the part of the partner under the name. */
.sale-money .field-card__row .field input { font-family: var(--font-label); font-size: 24px; font-weight: 700; }
.sale-money__receiver { margin: 16px 0 8px; }
.sale-profit { padding: 14px var(--gutter); border: 1px solid var(--ash); border-radius: var(--radius); background: var(--row-hover); }
.sale-profit__head { display: flex; justify-content: space-between; align-items: baseline; }
.sale-profit__amount { font-family: var(--font-label); font-size: 30px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
.sale-profit__amount--owed { color: var(--sand); }
.sale-profit__sub { display: flex; justify-content: space-between; gap: 12px; min-height: 18px; color: var(--steel); font-size: 13px; }
.sale-profit__loss { display: flex; align-items: flex-start; gap: 8px; margin: 6px 0 0; color: var(--nav-text); font-size: 13px; }
.sale-profit__loss[hidden] { display: none; }
.sale-profit__loss .icon { flex-shrink: 0; margin-top: 1px; }
.sale-info { display: flex; gap: 10px; padding: 12px 14px; border: 1px solid var(--ash); border-radius: var(--radius); background: var(--carbon); font-size: 14px; color: var(--nav-text); }
.sale-info .icon { flex-shrink: 0; margin-top: 1px; color: var(--bone); }
.sale-info p { margin: 0; }
.sale-info__title { color: var(--bone); font-weight: 600; }
.share-row--split { gap: 8px; min-height: 72px; padding: 8px 12px; }
.share-row--split .share-row__name { display: flex; flex-direction: column; }
.share-row__part { font-family: var(--font-label); font-size: 15px; font-weight: 600; }
.share-row__part--owed { color: var(--sand); }
.share-row--split .share-row__errors { flex-basis: 100%; }
.share-row--split .share-row__input input { width: 64px; text-align: center; }
.share-step { flex-shrink: 0; width: var(--touch); height: var(--touch); padding: 0; border: 0; border-radius: 50%; background: var(--graphite); color: var(--bone); font-size: 22px; line-height: 1; cursor: pointer; }
.share-step:hover { background: var(--graphite-hover); }
.share-equal { margin-top: 10px; color: var(--sand); }

/* "Who received the money": one avatar button for each partner (MarkSold board). */
.who-list { display: flex; flex-wrap: wrap; justify-content: space-around; gap: 4px; padding: 12px 8px; background: var(--carbon); border: 1px solid var(--graphite); border-radius: var(--radius); }
.who { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 76px; min-height: var(--touch); padding: 6px 0; font-size: 14px; cursor: pointer; }
.who .avatar { width: 48px; height: 48px; font-size: 17px; }
.who:has(input:checked) { font-weight: 700; }
.who:has(input:checked) .avatar { outline: 3px solid var(--sand); outline-offset: 2px; }
.who:has(input:focus-visible) .avatar { box-shadow: 0 0 0 7px var(--ink), 0 0 0 9px var(--bone); }

/* A large money input with the € sign (partials/amount_field.html): the sold price and the cost amount
   (MarkSold and CostForm boards). */
.amount-input { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; }
.amount-input__box { display: flex; align-items: baseline; justify-content: center; gap: 4px; }
.amount-input__currency { color: var(--steel); font-size: 32px; font-weight: 600; }
.amount-input input {
  width: 220px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--field-line);
  background: transparent;
  color: var(--bone);
  font-family: var(--font-label);
  font-size: 52px;
  font-weight: 700;
  text-align: center;
}
.amount-input input::placeholder { color: var(--ash); }
.amount-input input:focus-visible { outline: 0; border-bottom-color: var(--sand); }
.amount-input.field--invalid input { border-bottom-color: var(--coral); }

/* The cost form (CostForm board): the amount, the currency part, and the status on a phone.
   From 1024 px, the amount and the status share a row (DCostDrawer board). */
.cost-top { display: flex; flex-direction: column; gap: 4px; }
.cost-top__status { min-width: 0; margin: 12px 0 0; padding: 0; border: 0; }
.fx { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.fx__toggle {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  padding: 0 8px;
  color: var(--sand);
  font-size: 14px;
  cursor: pointer;
  list-style: none;
}
.fx__toggle::-webkit-details-marker { display: none; }
.fx__toggle:hover { color: var(--sand-hover); }
.fx[open] { align-items: stretch; }
.fx[open] .fx__toggle { align-self: center; }
.fx__note { display: flex; align-items: center; gap: 6px; color: var(--steel); font-size: 13px; }
.fx__note:empty { display: none; }
.fx__note .icon { color: var(--coral); }

/* The category: a row of radio chips (CostForm board). */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  padding: 0 14px;
  border: 1px solid var(--field-line);
  border-radius: var(--radius);
  background: var(--carbon);
  font-size: 15px;
  white-space: nowrap;
  cursor: pointer;
}
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:checked) { background: var(--sand); border-color: var(--sand); color: var(--ink); font-weight: 600; }
.chip:has(input:focus-visible) { outline: 2px solid var(--sand); outline-offset: 2px; }

/* The payer: the users, the common pot, and "Not yet" in one row of avatar radios (D48). */
.who-list--payer { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); }
.who-list--payer .who { width: auto; text-align: center; }
.avatar--none { background: transparent; color: var(--steel); border: 1px dashed var(--field-line); }

/* Two fields in a field card: one under the other on a phone, side by side in a drawer (DCostDrawer board). */
.field-card__split { border-top: 1px solid var(--graphite); }

/* A row of stats in a card: a label over an amount. */
.stat-row { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; }
.stat + .stat { border-left: 1px solid var(--graphite); }
.stat .label { font-size: 11px; }

/* The page frame of a form (form_page.html): a phone, a direct URL, or no script. */
.form-page { display: flex; flex-direction: column; gap: 20px; max-width: 560px; }
.form-page__body { display: flex; flex-direction: column; gap: 20px; }
.form-page__foot { display: flex; flex-direction: column; gap: 8px; }
.form-page__foot .btn { width: 100%; min-height: 50px; font-size: 17px; }

/* The head of a full-screen form: Cancel, the title, and Save (BikeForm and MarkSold boards).
   It replaces the top bar and the tab bar (form_page.html). */
.form-head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(64px, auto) minmax(0, 1fr) minmax(64px, auto);
  align-items: center;
  gap: 8px;
  min-height: var(--topbar-h);
  padding: 0 8px;
  background: var(--topbar-ground);
  border-bottom: 1px solid var(--graphite);
}
.form-head__title { min-width: 0; text-align: center; }
.form-head__heading { overflow: hidden; font-size: 20px; text-overflow: ellipsis; white-space: nowrap; }
.form-head__title .drawer__subtitle { margin: 0; font-size: 12px; }
.form-head__action {
  display: flex;
  align-items: center;
  min-height: var(--touch);
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--sand);
  font-size: 17px;
}
.form-head__action--save { justify-self: end; font-weight: 600; }
.shell--form .main { padding-bottom: calc(var(--safe-bottom) + 32px); }
.shell--form .page-head { display: none; }

.drawer__subtitle { margin-top: 2px; color: var(--steel); font-size: 13px; }
/* A dialog with a form: head, body that scrolls, and foot, as in a drawer. */
.dialog--form[open] { display: flex; flex-direction: column; }

/* A row of buttons. */
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* The login page (Main and DLogin boards). */
.login {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 32px;
  min-height: 100dvh;
  padding: 24px;
  max-width: 448px;
  margin: 0 auto;
}
.login__brand { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.login__logo { width: 300px; max-width: 100%; height: auto; }
.login__rule { width: 100%; margin-top: 12px; }
.login__title { font-size: 30px; }
.login__form { display: flex; flex-direction: column; gap: 16px; }
.login__fields .field__label { font-weight: 500; }
.login__error { display: flex; align-items: center; gap: 6px; color: var(--coral); font-size: 14px; }
.login__note { text-align: center; font-size: 13px; color: var(--steel); }

/* Uploads (ReceiptUpload and BikeForm boards, D51). The uploader is partials/uploader.html. static/js/upload.js writes the rows. */
.uploader { display: flex; flex-direction: column; }
.uploader__actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px var(--gutter); }
.uploader__pick { flex: 1 1 140px; cursor: pointer; }
/* The input is a real, focusable file input. Its label is the button, so the label shows the focus. */
.uploader__input:focus-visible + .uploader__pick { outline: 2px solid var(--sand); outline-offset: 3px; }
.uploader__input:disabled + .uploader__pick { opacity: .5; cursor: not-allowed; }
/* Photos: dashed 76 px tiles (BikeForm board). */
.uploader--tiles .uploader__actions { flex-wrap: nowrap; }
.uploader--tiles .uploader__pick {
  flex: 0 0 76px;
  flex-direction: column;
  gap: 4px;
  width: 76px;
  height: 76px;
  padding: 0;
  border: 1px dashed var(--field-line);
  background: transparent;
  color: var(--sand);
  font-family: var(--font-label);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.uploader--tiles .uploader__pick:hover { background: var(--row-hover); }
.uploader--tiles .uploader__pick .icon { width: 22px; height: 22px; }
.uploader__list:empty { display: none; }
.uploader__notice { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 var(--gutter) 12px; color: var(--steel); font-size: 14px; }
.upload-row { display: flex; align-items: center; gap: 12px; padding: 12px var(--gutter); border-top: 1px solid var(--graphite); }
.upload-row__thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--field);
  color: var(--field-line);
}
.upload-row__thumb img { width: 100%; height: 100%; object-fit: cover; }
.upload-row__main { flex: 1; min-width: 0; }
.upload-row__name { overflow: hidden; font-size: 15px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.upload-row__meta { color: var(--steel); font-size: 13px; }
.upload-row__actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.upload-row--error .upload-row__thumb { background: var(--error-ground); color: var(--coral); }
.upload-row--error .upload-row__meta { color: var(--coral); }
.upload-row--done .upload-row__thumb { color: var(--sand); }
.upload-row__bar { display: block; width: 100%; height: 6px; margin-top: 6px; border: 0; border-radius: 3px; background: var(--graphite); appearance: none; overflow: hidden; }
.upload-row__bar::-webkit-progress-bar { background: var(--graphite); }
.upload-row__bar::-webkit-progress-value { background: var(--sand); }
.upload-row__bar::-moz-progress-bar { background: var(--sand); }

/* The saved files of an owner in a card: the photos of the bike form, the receipts of the cost form. */
.photo-strip { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px var(--gutter) 0; }
.photo-strip__item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--field);
  color: var(--field-line);
}
.photo-strip__item img { width: 100%; height: 100%; object-fit: cover; }
.photo-strip__cover,
.gallery__cover {
  position: absolute;
  left: 4px;
  bottom: 4px;
  padding: 1px 5px;
  border-radius: var(--radius);
  background: var(--chip-ground);
  color: var(--bone);
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.attach-row { display: flex; align-items: center; gap: 4px; padding: 0 4px 0 0; border-top: 1px solid var(--graphite); }
.attach-row:first-child { border-top: 0; }
.attach-row__main { display: flex; flex: 1; align-items: center; gap: 12px; min-width: 0; min-height: 68px; padding: 8px 0 8px var(--gutter); color: var(--bone); }
.attach-row__main:hover { color: var(--bone); }
.attach-row__thumb { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 52px; height: 52px; overflow: hidden; border-radius: var(--radius); background: var(--field); color: var(--field-line); }
.attach-row__thumb img { width: 100%; height: 100%; object-fit: cover; }
.attach-row__text { display: flex; flex-direction: column; min-width: 0; }
.attach-row__name { overflow: hidden; font-size: 15px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.attach-row__meta { overflow: hidden; color: var(--steel); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.attach-list + .uploader,
.empty-state + .uploader { border-top: 1px solid var(--graphite); }

/* The gallery and the viewer: a dialog from 1024 px, a page on a phone (Gallery and Viewer boards, D52, D53). */
.media-head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(var(--touch), auto) minmax(0, 1fr) minmax(var(--touch), auto);
  align-items: center;
  gap: 4px;
  min-height: var(--topbar-h);
  padding: env(safe-area-inset-top, 0px) 4px 0;
  background: var(--topbar-ground);
  border-bottom: 1px solid var(--graphite);
}
.media-head__title { min-width: 0; text-align: center; }
.media-head__heading { overflow: hidden; font-size: 20px; text-overflow: ellipsis; white-space: nowrap; }
.media-head__sub { overflow: hidden; color: var(--steel); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.media-head__actions { display: flex; align-items: center; justify-self: end; }
.media-head__add { font-size: 17px; }
.shell--media .main { padding: 0 0 calc(var(--safe-bottom) + 24px); }
.shell--media .page { gap: 0; }
.shell--media .page-head { display: none; }
.dialog--media { height: 100dvh; max-height: 100dvh; border: 0; }
.dialog--media[open] { display: flex; flex-direction: column; }
.media { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.media__body { display: flex; flex: 1; flex-direction: column; min-height: 0; overflow-y: auto; }

.gallery { display: flex; flex-direction: column; }
.gallery__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; }
.gallery__item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--field);
  color: var(--field-line);
}
.gallery__item img { width: 100%; height: 100%; object-fit: cover; }
.gallery__item:focus-visible { outline-offset: -3px; }
.gallery__nopreview { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px; font-size: 12px; text-align: center; }
.gallery__nopreview-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery__hint { padding: 12px var(--gutter) 0; color: var(--steel); font-size: 13px; }
.gallery > .card { margin: var(--gutter); }
.media__body > .uploader:not(:has(.uploader__list:not(:empty))):not(:has(.uploader__notice:not([hidden]))) { display: none; }
.media__body > .uploader { border-bottom: 1px solid var(--graphite); }

.viewer { display: flex; flex: 1; flex-direction: column; min-height: 0; padding-top: 12px; background: var(--ink); }
.shell--media .viewer { min-height: calc(100dvh - var(--topbar-h) - env(safe-area-inset-top, 0px)); }
.viewer__stage {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  margin: 0 var(--gutter);
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--stage-ground);
}
.viewer__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.viewer__file { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 24px; color: var(--steel); text-align: center; }
.viewer__file .icon { width: 40px; height: 40px; --icon-stroke: 1.2; }
.viewer__file-name { max-width: 100%; overflow-wrap: anywhere; color: var(--bone); font-size: 16px; font-weight: 500; }
.viewer__file-meta { margin-bottom: 8px; font-size: 13px; }
.viewer__nav {
  position: absolute;
  top: 50%;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch);
  height: var(--touch);
  margin-top: calc(var(--touch) / -2);
  border-radius: var(--radius);
  background: var(--fab-ground);
  color: var(--bone);
}
.viewer__nav:hover { background: var(--graphite); color: var(--bone); }
.viewer__nav--prev { left: 8px; }
.viewer__nav--next { right: 8px; }
.viewer__info { display: flex; flex-direction: column; gap: 6px; padding: 12px var(--gutter) 20px; }
.viewer__caption { display: flex; flex-direction: column; gap: 4px; }
.viewer__caption-label { font-size: 11px; }
.viewer__caption-input {
  height: var(--touch);
  padding: 0 12px;
  border: 1px solid var(--field-line);
  border-radius: var(--radius);
  background: var(--field);
  font-size: 16px;
}
.viewer__caption-input:focus-visible { outline: 0; border-color: var(--sand); }
.viewer__caption.field--invalid .viewer__caption-input { border-color: var(--coral); }
.viewer__meta { color: var(--steel); font-size: 13px; }

/* The photo of the bike head is a link to the gallery (D52). */
.bike-hero__link { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.bike-hero__link:focus-visible { outline-offset: -3px; }

/* The Overview page (Overview board, D71). Read only: the totals, the profit per partner, the debts, and the bike table. */
.overview-warnings { margin-bottom: 12px; }
.overview-warnings li { align-items: flex-start; }
.overview-warnings .icon { flex-shrink: 0; margin-top: 2px; }
.overview-warnings a { color: inherit; text-decoration: underline; }
.overview-totals { display: grid; gap: 8px; }
/* Four totals in two columns on a phone, in one row from 1024 px. */
.kpis__list--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpis__list--4 .kpi { border: 0; }
.kpis__list--4 .kpi:nth-child(even) { border-left: 1px solid var(--graphite); }
.kpis__list--4 .kpi:nth-child(n + 3) { border-top: 1px solid var(--graphite); }
.kpis__list--4 .amount { font-size: 22px; }
.kpi__note { display: block; margin-top: 2px; color: var(--steel); font-size: 12px; line-height: 1.35; }
.kpi__part { white-space: nowrap; }
.status-strip__list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; text-align: center; }
.status-strip__item { display: flex; flex-direction: column-reverse; min-width: 0; padding: 12px 4px; }
.status-strip__item + .status-strip__item { border-left: 1px solid var(--graphite); }
.status-strip__item dd { margin: 0; font-family: var(--font-label); font-size: 20px; font-weight: 600; letter-spacing: .02em; }
.status-strip__item .label { font-size: 11px; white-space: nowrap; }
.panel-note { margin-top: 8px; padding: 0 var(--gutter); color: var(--steel); font-size: 13px; }
.overview-totals + .panel-note { margin-bottom: -8px; }

/* The switch Made / Expected is a radio group. The checked radio hides the other profit column on a phone. :where() keeps the
   specificity low, so the desktop layer shows both columns again. */
.overview-switch { min-width: 0; margin: 0 0 10px; padding: 0; border: 0; }
@supports selector(:has(*)) {
  :where(.overview-partners:has(#profit-view-made:checked)) .profit-col--expected,
  :where(.overview-partners:has(#profit-view-expected:checked)) .profit-col--made,
  :where(.overview-pots:has(#pots-view-made:checked)) .profit-col--expected,
  :where(.overview-pots:has(#pots-view-expected:checked)) .profit-col--made { display: none; }
}
/* Without :has() the switch cannot work, so a phone shows both columns and no switch. */
@supports not selector(:has(*)) {
  .overview-switch { display: none; }
}
.th-desktop { display: none; }
.overview-paid-col { display: none; }
/* With commission sales a phone has five columns, so the avatar goes (the name stays) and the amounts and the padding are smaller. */
@media (max-width: 1023px) {
  .overview-table--sales .avatar { display: none; }
  .overview-table.overview-table--sales .amount,
  .overview-table.overview-table--sales .amount--sm { font-size: 14px; }
  .overview-table.overview-table--sales th,
  .overview-table.overview-table--sales td { padding-left: 6px; padding-right: 6px; }
  .overview-table.overview-table--sales tbody th,
  .overview-table.overview-table--sales tfoot th { padding-left: 12px; }
}

/* The pots (commission sales). The bar of the pots is a .share-bar on a graphite track: the own bikes are bone, the sales are sand.
   A phone has one bar with a legend. From 1024 px, each row has its own bar and the single bar is hidden. */
.pot-bar { background: var(--graphite); border-radius: 2px; gap: 0; }
.pot-bar__seg--bikes,
.pot-key--bikes { background: var(--bone); }
.pot-bar__seg--sales,
.pot-key--sales { background: var(--sand); }
.overview-pots__summary { margin: 10px var(--gutter) 0; }
.overview-pots__legend { display: flex; justify-content: space-between; gap: 12px; margin: 6px 0 0; color: var(--steel); font-size: 13px; }
.pot-key { display: inline-block; width: 10px; height: 10px; margin-right: 6px; }
.overview-pots__bar-col { display: none; }
.overview-pots__row-bar { display: flex; align-items: center; gap: 8px; }
.overview-pots__row-bar .share-bar { flex: 1; }
.overview-pots__percent { width: 36px; text-align: right; font-family: var(--font-label); font-weight: 600; color: var(--steel); }
.overview-pots__off { color: var(--steel); font-size: 13px; }

/* The tables of the Overview. A row head (th scope="row") has the body style, not the column head style. */
.overview-table .amount { font-size: 18px; }
.overview-table .amount--sm { font-size: 16px; }
.overview-table tbody th,
.overview-table tfoot th {
  height: 52px;
  padding: 0 var(--gutter);
  border-top: 1px solid var(--graphite);
  border-bottom: 0;
  font-family: var(--font-body);
  font-size: inherit;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  white-space: normal;
  color: var(--bone);
}
.overview-table td { padding-left: 8px; }
.overview-table tbody tr:first-child th { border-top: 0; }
.overview-table tfoot th,
.overview-table tfoot td { background: var(--subtotal-ground); border-top: 1px solid var(--graphite); }
.overview-table tfoot th { font-family: var(--font-label); font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--steel); }
.overview-who { display: flex; align-items: center; gap: 10px; }

/* The debts: one <details> for each line. The summary is the line. The body has the balances in each source. */
.debt + .debt { border-top: 1px solid var(--graphite); }
.debt__summary { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px var(--gutter); cursor: pointer; list-style: none; }
.debt__summary::-webkit-details-marker { display: none; }
.debt__summary:hover { background: var(--row-hover); }
.debt__summary:focus-visible { outline-offset: -2px; }
.debt__who { flex: 1; min-width: 0; font-weight: 600; }
.debt__summary .amount { font-size: 18px; }
.debt__chevron { display: flex; color: var(--steel); }
.debt__details[open] .debt__chevron .icon { transform: rotate(90deg); }
.debt__body { padding: 0 var(--gutter) 12px; }
.debt__note { margin: 0 0 4px; color: var(--steel); font-size: 13px; }
.debt-table { width: 100%; border-collapse: collapse; }
.debt-table th,
.debt-table td { padding: 11px 0; border-top: 1px solid var(--graphite); font-weight: 500; text-align: left; }
.debt-table thead th { padding: 8px 0; border-top: 0; font-family: var(--font-label); font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--steel); }
.debt-table .num { padding-left: 12px; text-align: right; }
.debt-table .amount { font-size: 16px; }
.debt-table a { color: var(--bone); }

/* The bike table. On a phone the state is a small label after the name, and the state column is hidden. */
.overview-bike-table { table-layout: fixed; }
.overview-bike-table .num { width: 58px; padding: 0 6px 0 0; }
.overview-bike-table .num:last-child { width: 74px; padding-right: 12px; }
.overview-bike-table th:first-child { padding-left: 12px; }
.overview-bike__link { display: inline-flex; align-items: center; min-height: var(--touch); line-height: 1.2; color: var(--bone); font-weight: 600; }
.overview-bike__link:hover { color: var(--sand); }
.overview-bike__state-col { display: none; }
.overview-bike__margin { font-family: var(--font-label); font-weight: 600; letter-spacing: .02em; color: var(--steel); }
.overview-state { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-label); font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--steel); }
.overview-state--invalid_shares { color: var(--coral); }
/* The name never truncates. The name and the small "· state" are one line when they fit (Overview board). If not, the state goes under the name. */
.overview-bike__cell { display: flex; flex-wrap: wrap; align-items: center; column-gap: 2px; }
.overview-state--inline { flex-shrink: 0; font-size: 10px; letter-spacing: .06em; white-space: nowrap; }
.overview-state--inline:not(.overview-state--invalid_shares) { margin-left: 4px; }
.overview-bike__personal { display: block; margin-top: -4px; padding-bottom: 6px; color: var(--steel); font-size: 12px; }
/* The filter row (D91). On a phone each control has its own line. From 1024 px it is one line. */
.overview-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.overview-filters .field { flex: 1 1 100%; min-width: 0; }
.overview-filters__actions { display: flex; align-items: center; gap: 8px; }
.overview-empty-action { display: flex; justify-content: center; padding-bottom: 24px; }

/* The Analytics pages (D83, D86). It reuses .card, .kpi, .chips and .chip, .seg, .field, .table, .btn, .form-errors, and the empty state.
   New blocks: .analytics (the layout), .analytics__toolbar, .filters-btn, .filter-sheet, .chart-card, .result-table with .result-row, .listing-cell, and .pager.
   The main column is a container. Its width, not the window, decides the cards or the table, the 2 or 5 stats, and the 1 or 2 charts,
   because the side bar takes a different share of the window. The filter sheet needs no container: it is a modal dialog. */
.analytics { display: block; }
.analytics__main { min-width: 0; container: analytics / inline-size; }
.analytics__chips { margin: 12px 0 16px; }
.analytics__results { transition: opacity .15s; }
.analytics.htmx-request .analytics__results { opacity: .55; }
.analytics__results > * + * { margin-top: 12px; }
/* The scroll margin keeps the top of the results below the top bar after a page change. */
.analytics__results { scroll-margin-top: calc(var(--topbar-h) + 8px); }

/* The toolbar (D86, D89): the search box grows, then the "Sold and removed" toggle (search page), then the Filters button with the count of the active filters.
   On a phone the search box is row 1, and the toggle and the button are row 2. */
.analytics__toolbar { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; }
.analytics__search { flex: 1 1 220px; min-width: 0; }
.analytics__removed { flex: none; }
.filters-btn { flex: none; padding: 0 14px; }
.filters-btn__badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--sand); color: var(--ink); font-size: 13px; font-weight: 700; }
.filters-btn__badge:empty { display: none; }

/* The chips of the active filters. A removable chip is a link. "Clear all" ends the row. */
.analytics__chips:not(:has(*)) { height: 12px; margin: 0; }
.chip--removable { gap: 6px; color: var(--bone); }
.chip--removable:hover { color: var(--bone); border-color: var(--sand); }
.chip--removable .icon { color: var(--steel); }
.chips__clear { min-height: var(--touch); }

/* The filter sheet (D86) is a .drawer: full screen on a phone. The fields keep their gap, and a field with a value has a sand rule. */
.filter-sheet__body { gap: 18px; }
.filter-sheet__body .field { min-width: 0; }
fieldset.field { min-width: 0; margin: 0; padding: 0; border: 0; }
fieldset.field > legend { padding: 0; }
.filter-range__pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.filter-sheet__body :is(input:not([type="checkbox"], [type="radio"]):not(:placeholder-shown), select:has(option:checked:not([value=""]))) { border-left: 3px solid var(--sand); }
.filter-sheet__foot { display: grid; grid-template-columns: 1fr 2fr; }

/* The charts. */
.analytics__charts { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.chart-card { min-width: 0; margin: 0; padding: 12px var(--gutter) var(--gutter); }
.chart-card__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; min-height: var(--touch); margin-bottom: 8px; }
.chart-card__toggle { width: 160px; }
.chart-card__legend { display: inline-flex; align-items: center; gap: 6px; }
.chart-card__legend i { width: 10px; height: 10px; border-radius: 1px; background: var(--sand); }
.chart-card__period { margin-bottom: 10px; }
.chart-card__period select { width: auto; }
.chart-card__box { position: relative; width: 100%; height: 200px; }
.chart-card__empty { display: grid; place-items: center; height: 200px; padding: 0 var(--gutter); border: 1px dashed var(--graphite); color: var(--steel); text-align: center; }
.chart-card .form-errors { margin-top: 8px; }

/* The summary: five stats in a card. Two columns in a narrow column (the last one is full width), five in a wide one. */
/* The selectors have two classes of the list, so the desktop rules of section 6 for .kpis__list and .kpi (the bike page) do not win.
   The container width alone decides the layout, at every window width. */
.kpis__list.kpis__list--stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpis__list.kpis__list--stats .kpi { padding: 12px 14px; border: 0; }
.kpis__list.kpis__list--stats .kpi:nth-child(even) { border-left: 1px solid var(--graphite); }
.kpis__list.kpis__list--stats .kpi:nth-child(n + 3) { border-top: 1px solid var(--graphite); }
.kpis__list.kpis__list--stats .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
.kpis__list.kpis__list--stats .kpi .label { white-space: normal; }
.kpis__list.kpis__list--stats .kpi .amount { font-size: 22px; }
.form-errors__lead { font-weight: 600; }

/* The head of the results: the count and the sort control. */
.results-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-top: 24px; }
.results-head__title { font-size: 24px; }
.results-head__sort { flex-direction: row; align-items: center; gap: 10px; }
.results-head__sort select { width: auto; }
.results-head + .result-box { margin-top: 8px; }

/* The results. One <table> for both layouts. A narrow column shows each row as a card (the cells of the table are hidden). */
.result-box { overflow: hidden; background: none; border: 0; }
.result-table { display: block; }
.result-table thead { display: none; }
.result-table tbody { display: grid; gap: 10px; }
.result-row {
  position: relative;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  grid-template-areas: "photo text text" "photo price change";
  gap: 6px 12px;
  padding: 10px;
  background: var(--carbon);
  border: 1px solid var(--graphite);
  border-radius: var(--radius);
}
.result-row:hover { border-color: var(--graphite-hover); }
.result-row:has(.listing-cell__title:focus-visible) { outline: 2px solid var(--sand); outline-offset: 2px; }
.result-table td { display: block; height: auto; padding: 0; border-top: 0; min-width: 0; }
.result-table .result-row__bike,
.listing-cell { display: contents; }
.result-table .result-row__year, .result-table .result-row__cc, .result-table .result-row__km, .result-table .result-row__district, .result-table .result-row__seller, .result-table .result-row__days, .result-table .result-row__seen { display: none; }
.result-table .result-row__price { grid-area: price; align-self: end; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; }
.result-row__price .amount { font-size: 20px; }
.result-table .result-row__change { grid-area: change; align-self: end; font-family: var(--font-label); font-size: 16px; font-weight: 600; letter-spacing: .02em; text-align: right; }
.result-row__was { color: var(--steel); font-size: 14px; text-decoration: line-through; }
.delta--down { color: var(--sand); }
.delta--up { color: var(--steel); }
.listing-cell__photo {
  grid-area: photo;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 76px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--field);
  color: var(--field-line);
}
.listing-cell__photo img { width: 100%; height: 100%; object-fit: cover; }
.listing-cell__photo .icon { width: 30px; height: 30px; }
.listing-cell__text { grid-area: text; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.listing-cell__brand { font-size: 11px; }
.listing-cell__title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--bone);
  font-weight: 600;
  line-height: 1.2;
}
a.listing-cell__title:hover { color: var(--bone); }
a.listing-cell__title:focus-visible { outline: none; }
/* The link covers the whole card, so a tap anywhere opens the listing. */
a.listing-cell__title::after { content: ""; position: absolute; inset: 0; }
.listing-cell__meta { overflow: hidden; color: var(--steel); font-family: var(--font-label); font-size: 14px; letter-spacing: .04em; text-overflow: ellipsis; white-space: nowrap; }

/* The pager: the paginator count is the summary count, so the pager needs no extra query. */
.pager { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin-top: 20px; }
.pager__of { text-align: center; white-space: nowrap; }
.pager [aria-disabled="true"] { opacity: .4; pointer-events: none; }

/* A wide column. */
@container analytics (min-width: 520px) {
  .kpis__list.kpis__list--stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .kpis__list.kpis__list--stats .kpi { padding: 12px; }
  .kpis__list.kpis__list--stats .kpi:nth-child(n + 2) { border-left: 1px solid var(--graphite); }
  .kpis__list.kpis__list--stats .kpi:nth-child(n + 3) { border-top: 0; }
  .kpis__list.kpis__list--stats .kpi:last-child:nth-child(odd) { grid-column: auto; }
  .kpis__list.kpis__list--stats .kpi .amount { font-size: 20px; }
  .chart-card__box,
  .chart-card__empty { height: 240px; }
}
@container analytics (min-width: 760px) {
  .analytics__charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-card__box,
  .chart-card__empty { height: 260px; }
  /* The cards become a table in a scroll box. */
  .result-box { overflow-x: auto; background: var(--carbon); border: 1px solid var(--graphite); }
  .result-table { display: table; }
  .result-table thead { display: table-header-group; }
  .result-table tbody { display: table-row-group; }
  .result-row { display: table-row; padding: 0; background: none; border: 0; }
  .result-table th { padding: 10px 6px; letter-spacing: .08em; }
  .result-table td,
  .result-table .result-row__bike,
  .result-table .result-row__year, .result-table .result-row__cc, .result-table .result-row__km, .result-table .result-row__district, .result-table .result-row__seller, .result-table .result-row__days, .result-table .result-row__seen,
  .result-table .result-row__price,
  .result-table .result-row__change { display: table-cell; height: 56px; padding: 6px; border-top: 1px solid var(--graphite); vertical-align: middle; white-space: nowrap; }
  .result-table th:first-child,
  .result-table td:first-child { padding-left: 12px; }
  .result-table th:last-child,
  .result-table td:last-child { padding-right: 12px; }
  .result-table tbody tr:first-child td { border-top: 0; }
  .result-row:hover { background: var(--row-hover); }
  .result-table td,
  .result-table td.num { font-size: 14px; }
  .result-table .result-row__bike { min-width: 190px; white-space: normal; }
  .listing-cell { display: flex; align-items: center; gap: 12px; }
  .listing-cell__photo { width: 64px; height: 48px; flex: none; }
  .listing-cell__photo .icon { width: 22px; height: 22px; }
  .listing-cell__meta { display: none; }
  .listing-cell__title { font-size: 15px; }
  .result-table .result-row__price { flex-wrap: nowrap; text-align: right; }
  .result-row__price .amount { font-size: 17px; }
  .result-row__was { display: block; font-size: 12px; }
  .result-table .result-row__change { text-align: right; font-size: 15px; }
  .result-table .result-row__district, .result-table .result-row__seller, .result-table .result-row__seen { color: var(--steel); }
  .pager { grid-template-columns: auto 1fr auto; }
  .pager .btn { padding: 0 24px; }
}

/* The page switch (Search / Price changes) is a .seg of two links. The direction switch of the price changes page is a .seg of radio buttons. */
.analytics-switch { width: 360px; max-width: 100%; margin-top: 12px; }
fieldset.analytics__direction { margin: 0 0 12px; }
fieldset.analytics__direction .seg { max-width: 360px; }
/* The tags over the photo of a listing. `.tag--accent` shares its rule with `.tag--in_repair`. */
.tag--plain { background: var(--chip-ground); color: var(--bone); }

/* The cards of the price changes page. The name is the link: CSS stretches it over the card, as in the result cards. */
.change-list { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.change-card { position: relative; display: grid; gap: 6px; align-content: start; padding: 14px var(--gutter); transition: border-color .15s; }
.change-card:hover { border-color: var(--graphite-hover); }
.change-card:has(.change-card__name:focus-visible) { outline: 2px solid var(--sand); outline-offset: 2px; }
.change-card__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; }
.change-card__name { color: var(--bone); font-family: var(--font-title); font-size: 20px; font-weight: 800; letter-spacing: .01em; line-height: 1.1; text-transform: uppercase; overflow-wrap: anywhere; }
.change-card__name:hover { color: var(--bone); }
.change-card__name:focus-visible { outline: none; }
.change-card__name::after { content: ""; position: absolute; inset: 0; }
.change-card__prices { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.change-card__prices .amount { font-size: 20px; }
.change-card__was { color: var(--steel); font-size: 15px; text-decoration: line-through; }
.change-card__arrow { color: var(--steel); }
.change-card__prices .delta--down,
.change-card__prices .delta--up { margin-left: auto; font-family: var(--font-label); font-size: 17px; font-weight: 600; letter-spacing: .02em; }
.change-card__meta { color: var(--steel); font-family: var(--font-label); font-size: 14px; letter-spacing: .04em; }

/* The listing page (D84). One column on a phone. The price history and the market card are in the right column from 1024 px. */
.listing { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.listing-back { padding: 0; }
.listing-photo { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 4 / 3; max-height: 480px; overflow: hidden; border-radius: var(--radius); background: var(--field); color: var(--field-line); }
.listing-photo__img { width: 100%; height: 100%; object-fit: contain; }
.listing-photo__none .icon { width: 64px; height: 64px; --icon-stroke: 1.2; }
.listing-photo__tags { position: absolute; left: 10px; top: 10px; display: flex; gap: 6px; }
.listing-thumbs { display: grid; gap: 8px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.listing-thumbs__item { display: block; aspect-ratio: 4 / 3; overflow: hidden; border: 2px solid transparent; border-radius: var(--radius); background: var(--field); }
.listing-thumbs__item:hover { border-color: var(--graphite-hover); }
.listing-thumbs__item[aria-current="true"] { border-color: var(--sand); }
.listing-thumbs__item img { width: 100%; height: 100%; object-fit: cover; }
.listing-head { display: grid; gap: 6px; margin-top: 4px; }
.listing-head__title { font-size: 32px; line-height: 1.04; overflow-wrap: anywhere; }
.listing-head__price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.listing-head__price .amount { font-size: 34px; line-height: 1; }
.listing-head__was { color: var(--steel); font-size: 20px; text-decoration: line-through; }
.listing-head__price .delta--down,
.listing-head__price .delta--up { font-family: var(--font-label); font-size: 20px; font-weight: 600; }
.listing-specs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; background: var(--carbon); border: 1px solid var(--graphite); border-radius: var(--radius); }
.listing-specs > div { min-width: 0; padding: 10px 12px; }
.listing-specs > div:not(:nth-child(3n + 1)) { border-left: 1px solid var(--graphite); }
.listing-specs > div:nth-child(n + 4) { border-top: 1px solid var(--graphite); }
.listing-specs dt { font-size: 11px; }
.listing-specs dd { margin: 2px 0 0; font-size: 16px; overflow-wrap: anywhere; }
.listing-note { font-size: 15px; }
.listing-note--quiet { color: var(--steel); font-size: 14px; }
.listing-actions { display: grid; gap: 10px; margin-top: 4px; }
.listing-description { padding: 14px var(--gutter) var(--gutter); }
.listing-description__text { margin-top: 8px; font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; }
/* A long text shows its first lines. The check box opens it with no script. */
.listing-description__text.is-long { max-height: 6em; overflow: hidden; mask-image: linear-gradient(to bottom, #000 70%, transparent); }
.listing-description__toggle:checked ~ .listing-description__text { max-height: none; mask-image: none; }
.listing-description__more { margin-top: 8px; width: 100%; }
.listing-description__close,
.listing-description__toggle:checked ~ .listing-description__more .listing-description__open { display: none; }
.listing-description__toggle:checked ~ .listing-description__more .listing-description__close { display: inline; }
.listing-description__toggle:focus-visible ~ .listing-description__more { outline: 2px solid var(--sand); outline-offset: 2px; }
.history-table { width: 100%; margin-top: 12px; border-collapse: collapse; }
.history-table td { padding: 10px 0; border-top: 1px solid var(--graphite); font-size: 16px; }
.history-table td + td { text-align: right; }
.history-table .delta--down,
.history-table .delta--up { margin-left: 8px; }
.history-table__first { margin-left: 8px; color: var(--steel); font-size: 14px; }
.market-card { margin-top: 12px; padding: 14px var(--gutter) var(--gutter); }
.market-card__sub { margin-top: 4px; font-size: 12px; }
.market-card__median { font-size: 28px; line-height: 1.1; }
/* The bar is an SVG. The percent attributes place the median and this price, so the page has no style attribute (D35, D84). */
.market-bar { width: calc(100% - 16px); height: 28px; margin: 12px 8px 4px; overflow: visible; }
.market-bar__track { fill: var(--graphite); }
.market-bar__median { stroke: var(--steel); stroke-width: 2; }
.market-bar__this { fill: var(--sand); stroke: var(--carbon); stroke-width: 3; }
.market-card__lone { margin-top: 8px; color: var(--steel); font-size: 15px; }
.market-card__scale { display: flex; justify-content: space-between; color: var(--steel); font-family: var(--font-label); font-size: 14px; letter-spacing: .04em; }

@container analytics (min-width: 560px) {
  .change-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container analytics (min-width: 900px) {
  .change-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 520px) {
  .listing-actions { display: flex; flex-wrap: wrap; }
}

/* ---------------------------------------------------------------- 5. Utilities */

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.muted { color: var(--steel); }
.stack { display: flex; flex-direction: column; gap: var(--gutter); }

/* The saving state (States board): while the request of a form runs, its main button shows a ring and takes no tap.
   HTMX puts .htmx-request on the form. The ring is still when the user asks for less motion. */
.drawer:has(form.htmx-request) .drawer__foot .btn--primary,
.dialog:has(form.htmx-request) .btn--danger,
.shell--form:has(form.htmx-request) .form-page__foot .btn,
.shell--form:has(form.htmx-request) .form-head__action--save { pointer-events: none; }
.drawer:has(form.htmx-request) .drawer__foot .btn--primary::before,
.dialog:has(form.htmx-request) .btn--danger::before,
.shell--form:has(form.htmx-request) .form-page__foot .btn--primary::before,
.shell--form:has(form.htmx-request) .form-page__foot .btn--danger::before {
  content: "";
  width: 16px;
  height: 16px;
  margin-right: 8px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
}

/* The filter sheet slides in from the right (D86). The browser animates the display and the top layer (allow-discrete). */
@media (prefers-reduced-motion: no-preference) and (min-width: 1024px) {
  .drawer--sheet { transition: transform .22s ease, display .22s allow-discrete, overlay .22s allow-discrete; transform: translateX(100%); }
  .drawer--sheet[open] { transform: none; }
  .drawer--sheet::backdrop { opacity: 0; transition: opacity .22s ease, display .22s allow-discrete, overlay .22s allow-discrete; }
  .drawer--sheet[open]::backdrop { opacity: 1; }
  @starting-style {
    .drawer--sheet[open] { transform: translateX(100%); }
    .drawer--sheet[open]::backdrop { opacity: 0; }
  }
}

@media (prefers-reduced-motion: no-preference) {
  .toast { animation: toast-in .18s ease-out; }
  @keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
  .drawer:has(form.htmx-request) .drawer__foot .btn--primary::before,
  .dialog:has(form.htmx-request) .btn--danger::before,
  .shell--form:has(form.htmx-request) .form-page__foot .btn--primary::before,
  .shell--form:has(form.htmx-request) .form-page__foot .btn--danger::before { animation: spin .8s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }
}

/* ---------------------------------------------------------------- 6. Desktop (D32) */

@media (min-width: 1024px) {
  body { font-size: 15px; line-height: 1.4; }

  .shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }

  /* The side bar replaces the top bar and the tab bar. */
  .topbar { display: none; }

  .sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: 100dvh;
    padding: 24px 12px;
    border-right: 1px solid var(--graphite);
  }
  .sidebar__logo { display: block; align-self: flex-start; margin: 0 12px 28px; }
  .sidebar__logo img { height: 20px; width: auto; }

  .mainnav { position: static; padding: 0; background: none; border: 0; }
  .mainnav__list > li { flex: none; max-width: none; }
  .mainnav__list { flex-direction: column; align-items: stretch; height: auto; gap: 4px; }
  .mainnav__item {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    width: auto;
    height: var(--touch);
    padding: 0 12px;
    color: var(--nav-text);
    font-size: 15px;
  }
  .mainnav__item .icon { width: 20px; height: 20px; }
  .mainnav__item:hover { background: var(--carbon); color: var(--bone); }
  .mainnav__item[aria-current="page"] { background: var(--carbon); color: var(--bone); box-shadow: inset 2px 0 0 var(--sand); }
  .mainnav__item[aria-current="page"] .icon { color: var(--sand); }

  .sidebar__account {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 52px;
    margin-top: auto;
    padding: 0 12px;
    border: 0;
    border-top: 1px solid var(--graphite);
    background: transparent;
    color: var(--bone);
    font-weight: 500;
    text-align: left;
  }
  .sidebar__account:hover { background: var(--carbon); }
  .sidebar__account .avatar { width: 28px; height: 28px; font-size: 12px; }

  .main { padding: 32px 40px 48px; }

  .page-head { margin-bottom: 24px; }
  .page-title { font-size: 40px; }

  .page-actions { position: static; gap: 12px; }

  .search-btn {
    justify-content: flex-start;
    width: 286px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--graphite);
    background: var(--carbon);
    color: var(--steel);
    font-size: 14px;
  }
  .search-btn .icon { width: 18px; height: 18px; }
  .search-btn__label { display: inline; }

  .page-add { width: auto; padding: 0 18px; background: var(--sand); color: var(--ink); font-size: 15px; }
  .page-add:hover { background: var(--sand-hover); color: var(--ink); }
  .page-add .icon { width: 18px; height: 18px; }
  .page-add__label { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }

  /* The right column: shares, balances, and who pays whom (D32). */
  .page:has(> .page__aside:not(:empty)) {
    grid-template-columns: minmax(0, 1fr) var(--aside-w);
    gap: 24px;
    align-items: start;
  }

  .btn { font-size: 15px; }
  .btn--block { min-height: 48px; font-size: 15px; }

  .field input,
  .field select { min-height: var(--touch); font-size: 15px; }
  .field__label { font-size: 11px; }

  .table td.num { font-size: 17px; }

  .dialog {
    width: 440px;
    margin: auto;
    border: 1px solid var(--graphite);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }
  .dialog__body { padding: 24px; }

  .drawer {
    width: var(--drawer-w);
    margin: 0 0 0 auto;
    border-left: 1px solid var(--graphite);
    box-shadow: -12px 0 32px rgba(0, 0, 0, .5);
  }
  .drawer__head { padding: 20px 16px 16px 28px; }
  .drawer__body { padding: 24px 28px; }
  .drawer__foot { padding: 16px 28px; }

  /* The Overview (DOverview board): the totals and the status counts are one card, the partners and the debts are the left column. */
  .overview-warnings { margin-bottom: 16px; }
  .overview-totals { grid-template-columns: minmax(0, 4fr) minmax(0, 1.3fr); gap: 0; }
  .overview-totals .kpis { border-right: 0; }
  .kpis__list--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpis__list--4 .kpi { padding: 16px 18px; }
  .kpis__list--4 .kpi:nth-child(n + 3) { border-top: 0; }
  .kpis__list--4 .kpi:nth-child(n + 2) { border-left: 1px solid var(--graphite); }
  .kpis__list--4 .amount { font-size: 32px; }
  .status-strip { display: flex; align-items: center; }
  .status-strip__list { flex: 1; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 4px; }
  .status-strip__item { padding: 0; }
  .status-strip__item + .status-strip__item { border-left: 0; }
  .status-strip__item .label { font-size: 10px; }
  .panel-note { padding: 0; }
  .overview-totals + .panel-note { margin-bottom: 0; }
  .overview-filters { flex-wrap: nowrap; }
  .overview-filters .field { flex: 1 1 0; }
  .overview-cols { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; align-items: start; }
  .overview-switch { display: none; }
  .overview-pots .profit-col { display: table-cell; }
  .overview-pots__bar-col { display: table-cell; width: 34%; }
  .overview-pots__summary { display: none; }
  .overview-paid-col { display: table-cell; }
  .overview-partners .section-head,
  .overview-pots .section-head { justify-content: flex-start; gap: 4px; }
  .overview-partners .profit-col { display: table-cell; }
  .th-phone { display: none; }
  .th-desktop { display: inline; }
  .overview-bike-table { table-layout: auto; }
  .overview-bike-table .num,
  .overview-bike-table .num:last-child { width: auto; padding: 0 var(--gutter); }
  .overview-bike-table th:first-child { padding-left: var(--gutter); }
  .overview-bike__state-col { display: table-cell; }
  .overview-state--inline { display: none; }

  /* The bike list as a table (DBikeList board). */
  .filters { display: inline-grid; grid-auto-flow: column; grid-template-columns: none; gap: 2px; padding: 2px; background: var(--carbon); border: 1px solid var(--graphite); border-radius: var(--radius); }
  .filters__item { min-height: 36px; padding: 0 16px; border: 0; background: transparent; font-size: 13px; }
  .filters__item:hover { background: var(--graphite); }
  .filters__item[aria-current="page"] { background: var(--graphite); color: var(--bone); box-shadow: inset 0 -2px 0 var(--sand); }
  .filters__count { margin-left: 2px; opacity: 1; color: var(--steel); }

  .bike-table { display: table; background: var(--carbon); border: 1px solid var(--graphite); }
  .bike-table thead { display: table-header-group; }
  .bike-table tbody { display: table-row-group; }
  .bike-row { display: table-row; background: none; border: 0; }
  .bike-table .bike-row > td {
    display: table-cell;
    height: 52px;
    padding: 8px var(--gutter);
    border: 0;
    border-top: 1px solid var(--graphite);
    text-align: left;
    vertical-align: middle;
  }
  .bike-table tbody .bike-row:first-child > td { border-top: 0; }
  .bike-table .bike-row > .num { text-align: right; }
  .bike-table .bike-row__stat + .bike-row__stat { border-left: 0; }
  .bike-table .bike-row > .bike-row__photo { width: 80px; padding-right: 0; }
  .bike-row__img,
  .bike-row__nophoto { width: 64px; height: 44px; }
  .bike-row__nophoto .icon { width: 22px; height: 22px; }
  .bike-row__link { font-family: var(--font-body); font-size: 16px; font-weight: 600; text-transform: none; }
  .bike-table .bike-row__status { position: static; pointer-events: auto; }
  .bike-row__added-inline { display: none; }
  .bike-row__meta { margin-top: 0; font-family: var(--font-body); font-size: 13px; letter-spacing: 0; }
  .bike-table .bike-row__added { color: var(--steel); white-space: nowrap; }
  .bike-row__k { display: none; }
  .bike-row__sub { display: block; font-family: var(--font-label); font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--steel); }
  .bike-row__stat .amount { font-size: 17px; }
  .bike-row__stat--profit .amount { font-size: 18px; }
  .bike-table .bike-row > .bike-row__margin { display: table-cell; color: var(--steel); }
  .bike-row:has(.bike-row__link:focus-visible) { outline-offset: -2px; }
  /* The totals row (D89) under the columns. */
  .bike-table tfoot { display: table-footer-group; }
  .bike-totals { display: table-row; }
  .bike-table .bike-totals > th,
  .bike-table .bike-totals > td { display: table-cell; height: 60px; background: var(--subtotal-ground); border-top: 1px solid var(--ash); vertical-align: middle; }
  .bike-table .bike-totals__label { padding: 0 var(--gutter); }
  .bike-totals__note { display: block; white-space: nowrap; }

  .sale-table { display: table; background: var(--carbon); border: 1px solid var(--graphite); }
  .sale-table thead { display: table-header-group; }
  .sale-table tbody { display: table-row-group; margin-top: 0; }
  .sale-table tfoot { display: table-footer-group; }
  .sale-row { display: table-row; background: none; border: 0; }
  .sale-table .sale-row > td,
  .sale-table .sale-row > th {
    display: table-cell;
    height: 52px;
    padding: 8px var(--gutter);
    border: 0;
    border-top: 1px solid var(--graphite);
    text-align: left;
    vertical-align: middle;
  }
  .sale-table tbody .sale-row:first-child > td { border-top: 0; }
  .sale-table .sale-row > .num { text-align: right; }
  .sale-table .sale-row > .sale-row__date,
  .sale-table .sale-row > .sale-row__holder { color: var(--steel); white-space: nowrap; }
  .sale-table .sale-row > .sale-row__margin { color: var(--steel); }
  .sale-table .sale-row__stat + .sale-row__stat { border-left: 0; }
  .sale-table .sale-row > .sale-row__state { pointer-events: auto; }
  .sale-row__link { font-family: var(--font-body); font-size: 16px; font-weight: 600; text-transform: none; }
  .sale-row:has(.sale-row__link:focus-visible) { outline-offset: -2px; }
  .sale-row__meta { display: none; }
  .sale-row__who { display: inline-flex; align-items: center; gap: 8px; color: var(--bone); }
  .sale-row__stat .amount { font-size: 17px; }
  .sale-totals > th,
  .sale-totals > td { background: var(--subtotal-ground); border-top: 1px solid var(--ash); }
  .sale-totals__label { font-family: var(--font-label); font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--steel); }
  .sale-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }

  /* The bike page (DBikeDetail board): a breadcrumb, then the photo, the title, and the actions in one row. */
  .bike-head {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr) auto;
    grid-template-areas: "crumbs crumbs crumbs" "hero text actions";
    align-items: center;
    gap: 16px 20px;
    margin-bottom: 24px;
  }
  .crumbs { position: static; grid-area: crumbs; display: flex; gap: 4px; font-size: 14px; }
  .crumbs__back { width: auto; height: auto; background: none; color: var(--sand); }
  .crumbs__back:hover { background: none; color: var(--sand-hover); }
  .crumbs__back .icon { display: none; }
  .crumbs__label,
  .bike-action__label { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
  .crumbs__current { display: inline; color: var(--steel); }
  .crumbs__current::before { content: "/ "; }
  .bike-hero { grid-area: hero; width: 160px; height: 104px; margin: 0; border-radius: var(--radius); }
  .bike-hero__nophoto .icon { width: 40px; height: 40px; --icon-stroke: 1.6; }
  .bike-hero__count { right: 6px; bottom: 6px; min-height: 0; padding: 2px 6px; font-size: 12px; }
  .bike-head__text { grid-area: text; }
  .bike-head__title { justify-content: flex-start; gap: 12px; }
  .bike-head .page-title { font-size: 40px; line-height: 1; }
  .bike-head__meta { margin-top: 4px; font-size: 17px; }
  .bike-head__added { display: inline; }
  .bike-head__actions { position: static; grid-area: actions; }
  .bike-action { width: auto; gap: 8px; padding: 0 18px; background: var(--graphite); font-weight: 600; }
  .bike-action:hover { background: var(--graphite-hover); }
  .bike-action .icon { width: 16px; height: 16px; }

  .kpis__list { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .kpi { padding: 16px 18px; }
  .kpi:nth-child(n) { border-top: 0; border-left: 1px solid var(--graphite); }
  .kpi:first-child { border-left: 0; }
  .kpi--profit { grid-column: auto; }
  .kpi--profit dd { display: block; }
  .kpi .amount { font-size: 26px; }
  .kpi__sub { display: block; margin-top: 2px; font-size: 12px; }

  .bike-costs__head { flex-wrap: nowrap; }
  .seg--links { display: inline-grid; flex-basis: auto; margin-bottom: 0; }
  .seg--links .seg__item { min-height: 36px; padding: 0 16px; font-size: 13px; }

  .cost-table { display: table; background: var(--carbon); border: 1px solid var(--graphite); }
  .cost-table thead { display: table-header-group; }
  .cost-table tbody { display: table-row-group; background: none; border: 0; }
  .cost-table tr,
  .cost-table .cost-row { display: table-row; }
  .cost-table td { display: table-cell; height: 52px; padding: 0 var(--gutter); border-top: 1px solid var(--graphite); }
  .cost-table tbody tr:hover { background: var(--row-hover); }
  .cost-table tbody tr:first-child td { border-top: 0; }
  .cost-table .cost-group__head td { height: 48px; background: var(--subtotal-ground); }
  .cost-group__bar { padding: 0; }
  .cost-group__bar .amount { font-size: 17px; }
  .cost-table .cost-group__sub td { height: 38px; }
  .cost-table .cost-group__head:hover,
  .cost-table .cost-group__sub:hover { background: none; }
  .cost-group__subtotals { justify-content: flex-end; padding: 0; border-top: 0; background: none; }
  .cost-table .cost-row__desc { display: table-cell; padding-top: 8px; padding-bottom: 8px; }
  .cost-row__title { display: block; padding: 0; white-space: normal; }
  .cost-table .cost-row { padding-left: 0; }
  .cost-row__desc > .tag-planned { margin: 0 6px 0 0; }
  .cost-row__meta { display: inline-flex; padding: 0; }
  .cost-row__meta > span::before { content: none; }
  .cost-row__meta > span + span::before { content: "\00a0·\00a0"; }
  .cost-row__category--desktop { display: inline; }
  .cost-table .cost-row__payer { padding: 0 var(--gutter); color: var(--bone); font-size: 15px; }
  .cost-table .cost-row__amount { padding: 0 var(--gutter); text-align: right; }
  .cost-row__amount .amount { font-size: 17px; }
  .cost-table .cost-row__receipts { display: table-cell; width: 64px; text-align: center; border-left: 0; }
  .table th.cost-table__receipts { text-align: center; }
  /* The general cost table (DGeneralCosts board): the participants and the date are columns. */
  .page-sub { margin-top: 2px; font-size: 16px; }
  .kpis__list--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cost-note { padding: 0; }
  .cost-table--general .cost-row__meta { display: inline-flex; }
  .cost-table--general .cost-row__date,
  .cost-table--general .cost-row__shared { padding: 0 var(--gutter); font-size: 15px; }
  .cost-table--general .cost-row__date::before,
  .cost-table--general .cost-row__shared::before { content: none; }
  .cost-table--general .cost-row__date--none { display: table-cell; }
  .receipts__link { min-width: 0; min-height: 36px; padding: 0 3px; }

  /* The edit link of a cost row: the pen column (DBikeDetail board). */
  .cost-table .cost-row__edit,
  .cost-table .cost-table__edit { display: table-cell; width: 44px; padding: 0 12px 0 0; color: var(--steel); }
  .cost-row:hover .cost-row__edit { color: var(--bone); }

  /* The edit rows of a cost (DBikeDetail board, D32, D50): sand lines above and below, boxed inputs. */
  .cost-table .cost-edit,
  .cost-table .cost-edit:hover { background: var(--edit-ground); }
  .cost-table .cost-edit td { height: auto; padding: 12px 8px 6px; vertical-align: top; }
  .cost-table .cost-edit td:first-child { padding-left: var(--gutter); }
  .cost-table .cost-edit td:last-child { padding-right: var(--gutter); }
  .cost-table .cost-edit:not(.cost-edit--foot) td { box-shadow: inset 0 1px 0 var(--sand); }
  .cost-table .cost-edit--foot td { padding: 6px var(--gutter) 10px; border-top: 0; box-shadow: inset 0 -1px 0 var(--sand); }
  .cost-edit .field input,
  .cost-edit .field select { min-height: 40px; padding: 0 10px; }
  .cost-edit__amount input { text-align: right; }
  .cost-edit__bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
  .cost-edit__meta { color: var(--steel); font-size: 13px; }
  .cost-edit__meta > span + span::before { content: " · "; }
  .cost-edit__bar .btn { min-height: 38px; }
  /* The receipts cell of the edit row: the links and the paperclip (DInlineReceipt board, D78). */
  .cost-edit__receipts { display: flex; flex-direction: column; gap: 4px; }
  .cost-edit__receipts-row { display: flex; align-items: center; gap: 8px; min-height: 40px; }
  .cost-edit__receipts .receipts { justify-content: flex-start; }
  .cost-edit__clip { width: 40px; min-height: 40px; padding: 0; color: var(--sand); }
  /* The upload rows of the bare uploader sit in the bar, before Cancel and Save. */
  .cost-edit__bar .uploader { flex: 1; min-width: 0; }

  /* The cost drawer (DCostDrawer board): the amount and the status in a row, boxed inputs, compact chips. */
  .drawer .cost-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "amount status" "fx fx"; align-items: end; gap: 12px; }
  .drawer .cost-top__amount { grid-area: amount; }
  .drawer .cost-top__status { grid-area: status; margin: 0; }
  .drawer .cost-top__status .seg__item { min-height: 46px; padding: 0 16px; }
  .drawer .fx { grid-area: fx; align-items: flex-start; margin-top: -6px; }
  .drawer .fx[open] { align-items: stretch; }
  .drawer .fx__toggle,
  .drawer .fx[open] .fx__toggle { align-self: flex-start; min-height: 32px; padding: 0; }
  .drawer .amount-input { align-items: stretch; padding: 0; }
  .drawer .amount-input__box { align-items: center; justify-content: flex-start; height: 52px; padding: 0 10px; border: 1px solid var(--field-line); border-radius: var(--radius); background: var(--field); }
  .drawer .amount-input__box:focus-within { border-color: var(--sand); }
  .drawer .amount-input__currency { font-size: 20px; }
  .drawer .amount-input input { width: 100%; border: 0; font-size: 26px; line-height: 1; text-align: left; }
  .drawer .amount-input.field--invalid .amount-input__box { border-color: var(--coral); }
  .drawer .chip { min-height: 40px; padding: 0 12px; border-color: var(--graphite); background: transparent; color: var(--nav-text); font-size: 14px; font-weight: 500; }
  .drawer .chip:has(input:checked) { background: var(--graphite); border-color: var(--graphite); box-shadow: inset 0 -2px 0 var(--sand); color: var(--bone); font-weight: 500; }
  .drawer .who-list--payer { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 8px; padding: 0; background: none; border: 0; }
  .drawer .who-list--payer .who { flex-direction: row; gap: 8px; min-height: 40px; padding: 0 12px; border: 1px solid var(--graphite); border-radius: var(--radius); color: var(--nav-text); font-size: 14px; font-weight: 500; }
  .drawer .who-list--payer .who .avatar { width: 22px; height: 22px; font-size: 10px; }
  .drawer .who-list--payer .who:has(input:checked) { background: var(--graphite); box-shadow: inset 0 -2px 0 var(--sand); color: var(--bone); }
  .drawer .who-list--payer .who:has(input:checked) .avatar { outline: 0; }
  .drawer .who-list--payer .who:has(input:focus-visible) { outline: 2px solid var(--sand); outline-offset: 2px; }
  .drawer .who-list--payer .who:has(input:focus-visible) .avatar { box-shadow: none; }
  .drawer .field-card__split { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 12px; border: 0; }
  .drawer .fx .field-card__row { gap: 12px; border: 0; }
  .drawer .fx .field-card__row .field + .field { border-left: 0; }
  .drawer .field-card .field select { min-height: var(--touch); padding: 0 10px; border: 1px solid var(--field-line); background: var(--field); font-size: 15px; }

  /* "Add cost" is a button in the head from 1024 px. */
  .bike-add { position: static; min-height: var(--touch); font-size: 15px; box-shadow: none; }
  .shell--pushed .main:has(.bike-add) { padding-bottom: 48px; }
  .shell--pushed:has(.bike-add) ~ .toasts { bottom: 24px; }

  /* The pushed shell keeps the side bar from 1024 px. */
  .shell--pushed .mainnav { display: block; }
  .shell--pushed ~ .toasts { bottom: 24px; }
  .shell--pushed .banner { top: 16px; }

  .bike-settlement > .panel:first-child > .section-head { margin-top: 0; }
  .share-bar,
  .share-bar__seg { height: 6px; }
  .partner-row__state { font-size: 10px; }
  .settle-status--link { display: none; }
  .settlement-detail { display: contents; }

  .form-page__foot { flex-direction: row; }
  .form-page__foot .btn { width: auto; min-height: var(--touch); font-size: 15px; }
  /* A full-screen form has no side bar: one column. */
  .shell--form { grid-template-columns: minmax(0, 1fr); }
  .share-row__input input { height: 40px; font-size: 17px; }
  .dialog--form { width: 520px; max-height: 90dvh; }

  /* The gallery and the viewer are large dialogs (Gallery and Viewer boards). */
  .dialog--media { width: min(960px, calc(100vw - 80px)); height: min(780px, 90dvh); max-height: 90dvh; border: 1px solid var(--graphite); }
  /* The gallery is as high as its grid. The viewer keeps the fixed height for its stage. */
  .dialog--media:has(.gallery) { height: fit-content; min-height: 360px; }
  .gallery__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 4px; }
  .media__body > .uploader { border-bottom: 0; }
  .viewer__stage { margin: 0 24px; }
  .viewer__info { padding: 16px 24px 24px; }
  .media-head { padding-top: 0; }
  .uploader--tiles .uploader__actions { padding: 12px 16px; }

  .toasts { left: auto; right: 24px; bottom: 24px; width: 360px; }
  .dialog > .toasts,
  .drawer > .toasts { top: auto; bottom: 24px; }

  .banner { top: 16px; }

  /* The login page: a card with boxed fields (DLogin board). */
  .login { max-width: 400px; padding: 0; gap: 28px; }
  .login__brand { gap: 16px; }
  .login__logo { width: 260px; }
  .login__rule { margin-top: 0; }
  .login__form { padding: 24px; background: var(--carbon); border: 1px solid var(--graphite); border-radius: var(--radius); }

  /* Boxed fields: the login card, and a field card in a drawer or a form dialog (DLogin and DCostDrawer boards). */
  .login__fields,
  .drawer .field-card,
  .dialog--form .field-card { display: flex; flex-direction: column; gap: 16px; background: none; border: 0; }
  .login__fields .field,
  .drawer .field-card .field,
  .dialog--form .field-card .field { padding: 0; border: 0; }
  .login__fields .field input,
  .drawer .field-card .field :is(input, textarea),
  .dialog--form .field-card .field input {
    min-height: var(--touch);
    padding: 0 10px;
    border: 1px solid var(--field-line);
    background: var(--field);
    font-size: 15px;
  }
  .drawer .field-card .field textarea { min-height: 72px; padding: 10px; }
  .login__fields .field input:focus-visible,
  .drawer .field-card .field :is(input, textarea):focus-visible,
  .dialog--form .field-card .field input:focus-visible { outline: 0; border-color: var(--sand); }
  .drawer .field-card__row { gap: 12px; border: 0; }
  .drawer .field-card__row .field + .field { border-left: 0; }

  /* The Analytics pages: the filter sheet slides in from the right, 400 px wide (D86). The toolbar and the chips need no desktop rule. */
  .drawer--sheet { --drawer-w: 400px; }
  .analytics__chips { margin: 12px 0; }
  .analytics__chips:not(:has(*)) { margin: 0; }
  .analytics__results { scroll-margin-top: 24px; }
  .filter-sheet__body { gap: 16px; }

  /* The listing page: the title is larger, and the thumbnails are smaller. */
  .listing-head__title { font-size: 44px; }
  .listing-thumbs { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
