/*
 * sheet.css: the information panel, styled like a page from the cadastral extract:
 * hairline rows, tabular numbers, one dark rule where the data starts.
 *
 * Structure (see admin.html):
 *   .sheet
 *     .sheet__bar    brand + language
 *     .sheet__body   scrolls
 *       .plot-head, .facts, .block, .fine-print
 *     .sheet__foot   show/hide button
 */

.sheet {
  position: absolute;
  top: var(--edge);
  left: var(--edge);
  width: var(--sheet-width);
  max-width: calc(100% - 2 * var(--edge));
  max-height: calc(100% - 2 * var(--edge));
  display: flex;
  flex-direction: column;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: var(--radius-sheet);
  box-shadow: var(--shadow-sheet);
  overflow: hidden;
}

/* ------------------------------------------------------------------ Bar */

.sheet__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.brand__mark { flex: none; display: block; }
.brand__name {
  font-family: var(--font-display);
  font-weight: 650;
  font-size: var(--text-base);
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ Body */

.sheet__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-5) var(--space-4) var(--space-4);
  overscroll-behavior: contain;
}

.plot-head { margin-bottom: var(--space-4); }
.plot-head__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-title);
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
}
.plot-head__locality { margin-top: var(--space-1); font-size: var(--text-sm); color: var(--ink-muted); }

/* ------------------------------------------------------------------ Facts */

.facts { border-top: 2px solid var(--ink); }

.fact {
  display: grid;
  grid-template-columns: 8.25rem minmax(0, 1fr);
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--line);
}
.fact dt { font-size: var(--text-sm); color: var(--ink-muted); padding-top: 0.1em; }
.fact dd { font-weight: 550; font-variant-numeric: tabular-nums; }
.fact__note { display: block; margin-top: 2px; font-size: var(--text-sm); font-weight: 400; color: var(--ink-muted); }

/* The area is the headline fact: label above, big figure below. */
.fact--area { display: block; padding: var(--space-4) 0 var(--space-3); }
.fact--area dt { padding: 0; }
.fact__figure {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-figure);
  line-height: 1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}
.fact__unit {
  margin-left: 0.2em;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--text-lg);
  color: var(--ink-muted);
}

/* ------------------------------------------------------------------ Boundary block */

.block { margin-top: var(--space-5); }
.block__title {
  margin-bottom: var(--space-3);
  font-family: var(--font-display);
  font-weight: 650;
  font-size: var(--text-base);
  letter-spacing: -0.005em;
}

/* The plan sketch (drawn by src/sketch.js). Colours come from tokens.css. */
.sketch {
  display: block;
  width: 100%;
  height: auto;
  background: var(--sheet-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}
.sketch__shape       { fill: var(--parcel-fill); stroke: var(--parcel-stroke); stroke-width: 2.25; stroke-linejoin: round; }
.sketch__dot         { fill: var(--ink); }
.sketch__corner      { font: 700 12px var(--font-body); fill: var(--ink); }
.sketch__length      { font: 500 12px var(--font-body); fill: var(--ink-muted); font-variant-numeric: tabular-nums; }
.sketch__north       { stroke: var(--ink); stroke-width: 1.5; }
.sketch__arrowhead   { fill: var(--ink); }
.sketch__north-label { font: 700 11px var(--font-body); fill: var(--ink); }

/* Coordinates table, tucked away until asked for. */
.coords { margin-top: var(--space-3); font-size: var(--text-sm); }
.coords summary {
  cursor: pointer;
  padding: var(--space-1) 0;
  font-weight: 600;
  color: var(--ink);
}
.coords table { width: 100%; margin-top: var(--space-2); border-collapse: collapse; font-variant-numeric: tabular-nums; }
.coords th, .coords td { padding: 0.4rem 0; border-top: 1px solid var(--line); text-align: right; font-weight: 400; }
.coords thead th { color: var(--ink-muted); font-size: var(--text-xs); font-weight: 500; }
.coords tbody th, .coords thead th:first-child { text-align: left; font-weight: 600; }

/* "Numbers check out" line */
.verify {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: var(--ink-muted);
}
.verify__mark {
  flex: none;
  width: 0.55rem;
  height: 0.55rem;
  margin-top: 0.42em;
  border-radius: 50%;
  background: var(--ok);
}
.verify[data-state="mismatch"] { color: var(--warn); }
.verify[data-state="mismatch"] .verify__mark { background: var(--warn); }

.fine-print {
  margin-top: var(--space-5);
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
  font-size: var(--text-xs);
  line-height: 1.45;
  color: var(--ink-muted);
}

/* --------------------------------------------------------- Legend (portfolio clients/projects, project plots) */

.legend { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.legend__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--text-sm);
}
.legend__swatch {
  flex: none;
  width: 0.9rem;
  height: 0.9rem;
  padding: 0;
  border: 1px solid var(--swatch-edge);
  border-radius: 50%;
  background: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
/* Colour <input>s draw their own swatch inside; make it fill the circle we sized above. */
.legend__swatch::-webkit-color-swatch-wrapper { padding: 0; border-radius: 50%; }
.legend__swatch::-webkit-color-swatch { border: none; border-radius: 50%; }
.legend__swatch::-moz-color-swatch { border: none; border-radius: 50%; }

.legend__name {
  flex: 1 1 8rem;                /* shrinks (cut short with "...") before a row's actions go to a second line */
  min-width: 0;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.legend__name--link { cursor: pointer; }
.legend__title { display: block; overflow: hidden; text-overflow: ellipsis; } /* a row's name above its .legend__sub */
.legend__sub { display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; font-size: var(--text-xs); font-weight: 400; color: var(--ink-muted); }
.legend__sub:empty { display: none; }
.legend__meta { flex: 0 1 auto; min-width: 0; color: var(--ink-muted); }
.legend__count { flex: none; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
/* A row's actions ("Edit", "Delete", "Make member") are text buttons (controls.css); here only where they sit. */
.legend__edit, .legend__delete { flex: none; margin-left: var(--space-1); }
.group-actions__delete[data-confirming] { background: color-mix(in srgb, var(--warn) 12%, transparent); }

.group-new { width: 100%; margin-top: var(--space-3); }

/* A client row is an item holding the row itself and, when open, its plot list underneath. */
.legend__item { border-bottom: 1px solid var(--line); }
.legend__item > .legend__row { border-bottom: 0; }
.legend__name--button {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 550;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.legend__name--button::after { content: " ▾"; color: var(--ink-muted); font-size: var(--text-xs); }
.legend__name--button[aria-expanded="true"]::after { content: " ▴"; }
.legend__name--button:hover { color: var(--ink); background-color: var(--hover); box-shadow: 0 0 0 0.25em var(--hover); }
.legend__swatch--none { cursor: default; background: var(--client-color-none); }
.legend__row--none { margin: 0; }

/* The clients: "Intermediaries", then "Individual clients"; an intermediary opens to its own clients, indented. */
.legend__heading {
  margin: var(--space-3) 0 var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-muted);
}
.legend__empty { margin: 0; padding: var(--space-2) 0; }
.legend--nested { margin: 0 0 var(--space-2) 1.4rem; border-top: 0; }
.legend--nested .legend__item:last-child { border-bottom: 0; }

/* A client's eye: open = that client's plots are in colour on the map; shut = grey. */
.legend__eye {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius-control);
  background: none;
  color: var(--ink-muted);
  cursor: pointer;
}
.legend__eye:hover { color: var(--ink); }
.legend__eye:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.legend__eye[aria-pressed="true"] { color: var(--ink); }
.legend__eye svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.legend__eye-open, .legend__eye[aria-pressed="true"] .legend__eye-shut { display: none; }
.legend__eye[aria-pressed="true"] .legend__eye-open { display: block; }

/* "Corners of the land": a corner's name, then its coordinates (selectable, to copy into a maps app). */
.corners__name { flex: none; min-width: 1.6rem; font-weight: 700; }
.corners__coords { flex: 1 1 auto; min-width: 0; font-variant-numeric: tabular-nums; user-select: all; overflow-wrap: anywhere; }

/* An individual's intermediary, above its plot list (staff). */
.client-parent {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-2) 1.4rem;
  font-size: var(--text-xs);
  color: var(--ink-muted);
}
.client-parent select,
.client-parent input { max-width: none; flex: 1 1 auto; min-width: 0; }
/* "Its contract lets us reuse its plots' data", in a client card's details, under the intermediary. */
.client-reuse { margin: 0 0 var(--space-2); font-size: var(--text-xs); color: var(--ink-muted); }

/* A client found by the search box: its swatch (not a colour picker here) and its name, which opens it below. */
.legend__swatch--static { display: inline-block; cursor: default; }
.plot-list__name--button { padding: 0; border: 0; background: none; font: inherit; font-weight: 550; text-align: left; cursor: pointer; }

/* Search box above a plot list (group editor, owner's plot list). */
.plot-search { width: 100%; margin-bottom: var(--space-2); }
.plot-search--client { width: calc(100% - 1.4rem); margin: 0 0 var(--space-1) 1.4rem; }
.plot-search__none { margin-top: 0; padding-top: 0; border-top: 0; }

/* The plot list under an open client: tick a plot to move it here. */
.client-plots {
  margin: 0 0 var(--space-2) 1.4rem;
  padding: var(--space-1) var(--space-3);
  background: var(--sheet-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  max-height: 16rem;
  overflow-y: auto;
}
.client-plots__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  padding: var(--space-1) 0;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}
.client-plots__owner {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
  color: var(--ink-muted);
  font-size: var(--text-xs);
}

/* "Plots" on the "all plots" panel: every plot, its owner and "Delete". Scrolls when there are many. */
.plot-list {
  max-height: 20rem;
  overflow-y: auto;
  border-top: 1px solid var(--line);
  overscroll-behavior: contain;
}
.plot-list__row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}
.plot-list__name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.plot-list__area { flex: none; color: var(--ink-muted); font-size: var(--text-xs); }
.plot-list__who { flex: none; max-width: 8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-muted); font-size: var(--text-xs); }
.plot-list__owner { flex: none; max-width: 8.5rem; min-height: var(--field-height-sm); font-size: var(--text-xs); }
.client-plots__pick { display: flex; flex: none; align-items: center; cursor: pointer; }
/* The plot's name opens it (like the "Plots" list); the tick box beside it moves it to this owner. */
.client-plots__name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* "Add client": a text box and a button on one line. */
.add-row { display: flex; gap: var(--space-2); margin-top: var(--space-3); }
.add-row input { flex: 1 1 auto; min-width: 0; }
/* "Add client": what kind, and (an individual) under which intermediary. */
.add-row__select { flex: 1 1 8rem; min-width: 0; }

/* Staff-only box on a plot (set encumbrances). */
.manage {
  margin-top: var(--space-4);
  padding: var(--space-2) var(--space-3) var(--space-3);
  border: 1px dashed var(--line);
  border-radius: var(--radius-card);
  font-size: var(--text-sm);
}
.manage summary { cursor: pointer; font-weight: 600; color: var(--ink-muted); }
.manage .field:first-of-type { margin-top: var(--space-3); }
.manage .control { margin-top: var(--space-3); }
.encumbrance-kinds { margin: var(--space-3) 0 0; padding: 0; border: 0; }
.encumbrance-kinds legend { padding: 0; color: var(--ink-muted); }
.encumbrance-kinds[hidden] { display: none; }
.encumbrance-kind { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-top: var(--space-1); }
.encumbrance-kind label { display: flex; align-items: center; gap: var(--space-1); }
.encumbrance-kinds .encumbrance-kind input[type="number"] { width: 6em; }

/* Public presentation (present.html): one card per plot. */
.lot { scroll-margin-top: var(--space-3); border-radius: var(--radius-card); transition: box-shadow var(--duration) var(--ease); }
.lot.is-focused { box-shadow: 0 0 0 3px var(--flag); }
.lot__sketch { margin-top: var(--space-3); }
/* The drawing is a button: tapping it flies the map to the lot. */
.lot__show {
  display: block; width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit;
  cursor: pointer; border-radius: var(--radius-card); -webkit-tap-highlight-color: transparent;
  transition: transform var(--duration) var(--ease);
}
.lot__show:active { transform: scale(0.98); }
.lot__show:focus-visible { outline: 2px solid var(--flag); outline-offset: 2px; }

/* ------------------------------------------------------------------ Back button */

/* Pinned to the top of the panel: it stays there while the text scrolls under it. It spans the panel's width (the
   negative margins undo the panel's padding) so the text never shows beside it. */
.sheet__back {
  position: sticky;
  top: calc(-1 * var(--space-5)); /* sticks to the panel's very top edge, over its padding */
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.3em;
  width: calc(100% + 2 * var(--space-4));
  margin: calc(-1 * var(--space-5)) calc(-1 * var(--space-4)) var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--sheet);
  font-size: var(--text-sm);
  font-weight: 550;
  color: var(--ink-muted);
  cursor: pointer;
}
.sheet__back::before { content: "←"; }
.sheet__back:hover { color: var(--ink); }

/* ------------------------------------------------------------------ Form fields (group editor) */

.field { margin-top: var(--space-4); font-size: var(--text-sm); }
.field label { display: block; margin-bottom: var(--space-1); color: var(--ink-muted); }
/* Every text box and select looks the same on every page (controls.css); a form's fields fill its width. */
.field :is(input:not([type="checkbox"], [type="radio"], [type="color"]), select, textarea) { width: 100%; }
.field__hint { margin-top: var(--space-1); font-size: var(--text-xs); color: var(--ink-muted); }

/* The project editor's "On the presentation" ticks (admin.html #group-options), one per line. */
.options { border: 0; padding: 0; margin-inline: 0; }
.options legend { padding: 0; margin-bottom: var(--space-1); color: var(--ink-muted); }
.options .field--row { display: flex; color: var(--ink); margin: var(--space-1) 0; }

.field--row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}
.field--row input[type="color"] {
  width: 1.6rem;
  height: 1.6rem;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: none;
  cursor: pointer;
}
.field--row input[type="color"]:disabled { opacity: 0.35; cursor: not-allowed; }

/* ------------------------------------------------------------------ Group picker (checkboxes) */

.group-picker { display: flex; flex-direction: column; gap: var(--space-3); }
.group-picker__client {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}
.group-picker__client legend {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  padding: 0 var(--space-1);
  font-weight: 650;
  font-size: var(--text-sm);
}
/* "Select all" / "Deselect all" for one owner's plots, next to their name. */
/* .group-picker__all is a text button (controls.css). */
.group-picker__row {
  display: block;
  padding: var(--space-1) 0;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.group-picker__row input { margin-right: var(--space-2); }

.group-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-5); }
.group-actions__delete { margin-left: auto; color: var(--warn); }

/* ------------------------------------------------------------------ Claude's view (advice on a plot) */

.advice { font-size: var(--text-sm); }
.advice p + p, .advice__list, .advice__chips { margin-top: var(--space-2); }
.advice__message { padding: var(--space-3); background: var(--sheet-sunk); border-radius: var(--radius-card); color: var(--ink-muted); }
.advice[data-state="error"] .advice__message { color: var(--warn); }
.advice__message--warn { color: var(--warn); }
.advice__place { color: var(--ink-muted); }
.advice__subtitle {
  margin: var(--space-4) 0 0;
  font-family: var(--font-display);
  font-weight: 650;
  font-size: var(--text-sm);
}
.advice__list { margin-bottom: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.advice__list li { padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
.advice__list strong { display: block; font-weight: 600; }
.advice__list span { color: var(--ink-muted); }
.advice__list--plain li { color: var(--ink-muted); }

/* The suggested group is a raised card, so it reads as one thing shared by all of its plots. */
.advice__group {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4) var(--space-4);
  background: var(--sheet-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}
.advice__group .advice__subtitle { margin-top: 0; color: var(--ink-muted); font-weight: 500; }
.advice__group-name { margin-top: var(--space-1); font-family: var(--font-display); font-weight: 700; font-size: var(--text-lg); }
.advice__group .control { margin-top: var(--space-3); }
.advice__chips { display: flex; flex-wrap: wrap; gap: var(--space-1); padding: 0; list-style: none; }
.advice__chips li { padding: 2px var(--space-2); border: 1px solid var(--line); border-radius: var(--radius-pill); font-weight: 600; font-variant-numeric: tabular-nums; }
.advice__chips a { color: inherit; text-decoration: none; }
.advice__chips a:hover { background-color: var(--hover); box-shadow: 0 0 0 0.25em var(--hover); }
.advice__chips span:empty { display: none; }
.advice__idea { color: var(--ink-muted); }
.advice__confidence { margin-top: var(--space-3); font-size: var(--text-xs); color: var(--ink-muted); }
.advice__refresh { margin-top: var(--space-3); } /* a text button (controls.css) */
/* /account: "Send the link again" right after the line asking to confirm the address. */
.accepted .advice__refresh { margin: 0 0 0 var(--space-1); }
.advice .fine-print { margin-top: var(--space-3); }

/* ------------------------------------------------------------------ Foot */

.sheet__foot { border-top: 1px solid var(--line); }
.sheet__toggle {
  display: block;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 0;
  background: transparent;
  font-size: var(--text-sm);
  font-weight: 550;
  text-align: center;
  cursor: pointer;
  transition: background var(--duration) var(--ease);
}
.sheet__toggle:hover { background: var(--sheet-sunk); }

.is-sheet-collapsed .sheet__body { display: none; }

/* ------------------------------------------------------------------ Phones: panel sits under the map */

@media (max-width: 47.5rem) {
  .sheet {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
    max-width: none;
    max-height: 52dvh;
    border-width: 1px 0 0;
    border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .fact--area { padding-top: var(--space-3); }
  .fact__figure { font-size: calc(var(--text-figure) * 0.85); }
}

/* ------------------------------------------------------------------ Sign out (in the top bar) */

.sheet__bar-end { display: flex; align-items: center; gap: var(--space-2); }
/* "Sign out" is a text button (controls.css). */

/* ------------------------------------------------------------------ Upload extracts (?uploads=1) */

.dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6) var(--space-4);
  border: 2px dashed var(--line);
  border-radius: var(--radius-card);
  background: var(--sheet-raised);
  font-size: var(--text-sm);
  font-weight: 550;
  color: var(--ink-muted);
  text-align: center;
  cursor: pointer;
  transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease);
}
.dropzone:hover, .dropzone.is-over { border-color: var(--flag); color: var(--ink); }
.dropzone:focus-within { outline: 2px solid var(--ink); outline-offset: 1px; }

/* Files chosen but not sent yet, each with its owner. */
.staging { margin-top: var(--space-3); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--sheet-sunk); font-size: var(--text-sm); }
.staging__all { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-weight: 600; }
.staging__list { list-style: none; margin: var(--space-3) 0 0; padding: 0; }
.staging__row { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) 0; border-top: 1px solid var(--line); }
.staging__row .upload__name { flex: 1 1 auto; min-width: 0; }
.staging__row select { flex: none; max-width: 50%; }
/* A CAD drawing also asks for its commune, on a line of its own. */
.staging__row--drawing { flex-wrap: wrap; }
.staging__uat { display: flex; align-items: center; gap: var(--space-2); flex: 1 0 100%; color: var(--ink-muted); }
.staging__uat input { flex: 1 1 auto; min-width: 0; min-height: var(--field-height-sm); }
.staging .group-actions { margin-top: var(--space-3); }

.staging select, .upload__owner select { min-height: var(--field-height-sm); }

/* "Enter a plot by hand": the same form fields as elsewhere, a wide box for the pasted coordinates, and a line that
   says what they make as you type (data-state: ok | warn | bad). */
.entry { margin-top: var(--space-3); }
.entry > .field__hint:first-of-type { margin-top: var(--space-2); }
.entry input[type="text"], .entry select, .entry__corners { width: 100%; }
.entry input:user-invalid { border-color: var(--warn); }
.entry__corners { resize: vertical; font-variant-numeric: tabular-nums; white-space: pre; overflow-x: auto; }
.entry__trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }
.entry__trio label span { display: block; margin-bottom: var(--space-1); }
.entry__check { margin-top: var(--space-3); font-weight: 600; font-variant-numeric: tabular-nums; }
.entry__check:empty { display: none; }
.entry__check[data-state="ok"] { color: var(--ok); }
.entry__check[data-state="warn"] { color: var(--badge-wait-text); }
.entry__check[data-state="bad"] { color: var(--warn); }
.entry .advice__message { margin-top: var(--space-3); }
.entry .group-actions { margin-top: var(--space-3); }
.entry .group-actions .control { margin-top: 0; }
.entry[data-state="error"] .advice__message { color: var(--warn); }
@media (max-width: 22rem) {
  .entry__trio { grid-template-columns: 1fr; }
}

.add-row--wrap { flex-wrap: wrap; }
.add-row--wrap input { flex-basis: 100%; }

.upload-queue { list-style: none; margin: var(--space-3) 0 0; padding: 0; font-size: var(--text-sm); color: var(--ink-muted); }
.upload-queue li { padding: var(--space-1) 0; overflow-wrap: anywhere; }
.upload-queue li.is-ok { color: var(--ok); }
.upload-queue li.is-fail { color: var(--warn); }

/* The review list: one row per uploaded PDF. */
.block__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
.block__head .advice__refresh { margin-top: 0; }
.block__count { color: var(--ink-muted); font-weight: 500; }
/* A short explanation straight under a block's title (fine print normally closes a panel, with a rule above). */
.fine-print--lead { margin: 0 0 var(--space-2); padding-top: 0; border-top: 0; }
.upload-note { margin-top: var(--space-2); font-size: var(--text-xs); color: var(--ink-muted); }
.upload-note:empty, .uploads:empty { display: none; }
.uploads { list-style: none; margin: var(--space-2) 0 0; padding: 0; border-top: 1px solid var(--line); }
.upload { padding: var(--space-3) 0; border-bottom: 1px solid var(--line); font-size: var(--text-sm); }
.upload__main { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.upload__name { font-weight: 600; overflow-wrap: anywhere; }
.upload__meta { margin-top: var(--space-1); color: var(--ink-muted); }
.upload__owner { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-2); color: var(--ink-muted); }
.upload__owner select { flex: 1 1 auto; min-width: 0; }
.upload__owners { margin-top: var(--space-2); }
.upload__owners select { flex: 1 1 12rem; min-width: 0; }
.upload__share { flex: 0 1 7rem; min-width: 5rem; }
.upload__error { margin-top: var(--space-1); color: var(--warn); }
.upload__notes { margin: var(--space-1) 0 0; padding-left: 1.1em; color: var(--ink-muted); }
/* The owners an extract names, to confirm one by one (src/uploads.js renderFound). */
.upload__found { margin-top: var(--space-2); padding: var(--space-2); border: 1px solid var(--line); border-radius: var(--radius-card); }
.upload__found-title { font-weight: 600; }
.upload-groups { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); margin-bottom: var(--space-2); }
.upload__found--group { margin-top: 0; border-color: var(--flag-tint-line); background: var(--flag-tint); }
.upload__found-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); margin: var(--space-2) 0 0; padding: 0; list-style: none; }
.upload__found-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); }
.upload__found-name { font-weight: 600; overflow-wrap: anywhere; }
.upload__found-sharebox { display: flex; flex: 1 0 100%; align-items: center; gap: var(--space-2); color: var(--ink-muted); }
.upload__found-sharebox[hidden] { display: none; }
.upload__found-row .upload__found-sharebox input { flex: 1 1 auto; }
.client-plots__share { flex: 0 1 6rem; min-width: 4rem; min-height: var(--field-height-sm); padding: 0 var(--space-2); }
.upload__found-row select, .upload__found-row input { flex: 1 0 100%; min-width: 0; min-height: var(--field-height-sm); }
.upload__actions { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-top: var(--space-2); }
.upload__actions .control { min-height: var(--control-height-sm); padding: 0 var(--space-3); }

.badge {
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 700;
  background: var(--sheet-sunk);
  color: var(--ink-muted);
}
.badge[data-status="pending"], .badge[data-status="needs_review"], .badge[data-status="no_coordinates"] { background: var(--badge-wait-bg); color: var(--badge-wait-text); }
.badge[data-status="approved"] { background: var(--badge-ok-bg); color: var(--ok); }
.badge[data-status="infected"], .badge[data-status="unreadable"], .badge[data-status="rejected"] { background: var(--badge-bad-bg); color: var(--warn); }
.badge[data-status="duplicate"], .badge[data-status="unsupported"] { background: var(--badge-odd-bg); color: var(--badge-odd-text); }

/* "Approve all ready" on the upload review list. */
.upload-approve-all { width: 100%; margin-bottom: var(--space-2); }
.upload-approve-all:disabled { opacity: 0.5; cursor: not-allowed; }

/* "All · To review · No coordinates · ...": wraps onto a second line on a phone. */
.upload-filter { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-bottom: var(--space-3); }
.upload-filter .control { gap: 0.35em; min-height: 1.75rem; padding: 0 var(--space-2); font-size: var(--text-xs); }
.upload-filter__count { opacity: 0.7; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ Price estimate and urban certificates (staff)
   The plot page's #plot-pricing and #plot-permits, filled by src/pricing-panel.js. */

.pricing__figure { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2) var(--space-3); margin: var(--space-2) 0 0; }
.pricing__total {
  font-family: var(--font-display);
  font-size: var(--text-title);
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.pricing__per { color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.pricing__range { margin: var(--space-1) 0 0; font-size: var(--text-sm); color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.pricing__warnings { margin: var(--space-3) 0 0; padding: 0; list-style: none; font-size: var(--text-sm); }
.pricing__warnings li { padding: var(--space-2) var(--space-3); border-left: 3px solid var(--warn); background: var(--sheet-sunk); color: var(--ink); }
.pricing__warnings li + li { margin-top: var(--space-1); }

.pricing__facts { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); margin: var(--space-4) 0 0; font-size: var(--text-sm); }
.pricing__facts dt { color: var(--ink-muted); font-size: var(--text-xs); }
.pricing__facts dd { margin: 0; font-weight: 600; }
.pricing__reasoning { margin-top: var(--space-3); font-size: var(--text-sm); }
.pricing__effect { font-weight: 600; font-variant-numeric: tabular-nums; }
.pricing__adjustments strong { display: inline; }
.pricing__adjustments span { color: var(--ink-muted); }
.pricing__adjustments .pricing__effect { color: var(--ink); }

.pricing__nearby, .pricing__sources, .pricing__choices { margin: var(--space-2) 0 0; padding: 0; list-style: none; }
.pricing__nearby li, .pricing__sources li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 var(--space-3);
  padding: 0.4rem 0;
  border-top: 1px solid var(--line);
}
.pricing__nearby li > :last-child { text-align: right; color: var(--ink-muted); }
.pricing__sources li { flex-direction: column; }
.pricing__sources li span { color: var(--ink-muted); font-size: var(--text-xs); }
.pricing__sources a { color: var(--ink); overflow-wrap: anywhere; }

.pricing__together { margin: var(--space-4) 0 0; padding: var(--space-2) var(--space-3) var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-card); font-size: var(--text-sm); }
.pricing__together legend, .permits fieldset legend { padding: 0 var(--space-1); color: var(--ink-muted); }
.pricing__choices .field { margin-top: var(--space-2); }
.pricing__choices .legend__meta { margin-left: auto; }
.pricing .control:disabled { opacity: 0.45; cursor: not-allowed; }
.pricing .group-actions { margin-top: var(--space-3); }
.pricing .field textarea, .permits .field textarea, .permits .field input[type="date"], .permits .field input[type="number"] { width: 100%; }
.pricing[data-state="running"] [data-pricing-message] { color: var(--ink); }

.permits__list { margin: var(--space-2) 0 0; padding: 0; list-style: none; }
.permits__item {
  margin-top: var(--space-2);
  padding: var(--space-3);
  background: var(--sheet-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  font-size: var(--text-sm);
}
.permits__item p { margin: var(--space-1) 0 0; }
.permits__item p:empty { display: none; }
.permits__name { margin-top: 0 !important; font-weight: 600; }
.permits__relation { color: var(--ok); }
.permits__relation[data-state="assumed"] { color: var(--badge-wait-text); }
.permits__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-2); }
.permits__item .control { margin-top: var(--space-2); }

/* Two small fields side by side (dates, POT and CUT); one under the other on a narrow phone. */
.field--pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.field--pair label span, .permits__utilities label span { display: block; margin-bottom: var(--space-1); }
.permits__utilities { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2) var(--space-3); margin-left: 0; margin-right: 0; padding: var(--space-2) var(--space-3) var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-card); }
.permits__utilities legend { grid-column: 1 / -1; }
@media (max-width: 22rem) {
  .field--pair, .permits__utilities, .pricing__facts { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------------ A client's own page (account.html) and its requests */

/* "What you asked for" (account.html) and "Requests from clients" (admin.html): one row each, with its state. */
.request-row .fine-print { margin: var(--space-1) 0 0; white-space: pre-line; }
.request-row__status { flex: none; font-size: var(--text-xs); font-weight: 600; color: var(--ink-muted); }
.request-row__status[data-state="open"] { color: var(--flag-text); }
/* Privacy requests (/admin): one unanswered after 25 days stands out; its answer is due within a month. */
.privacy-row[data-state="late"] { box-shadow: inset 3px 0 0 var(--flag); padding-left: var(--space-3); }
.request-row__status[data-state="late"] { color: var(--flag-text); font-weight: 700; }
.request-row__status[data-state="answered"] { color: var(--ink-muted); }
.privacy-row__actions { display: flex; gap: var(--space-3); margin-top: var(--space-1); }
.request-plots { border: 0; padding: 0; margin-inline: 0; }
.request-plots legend { padding: 0; margin-bottom: var(--space-1); color: var(--ink-muted); }
.request-plots .client-plots { margin-left: 0; max-height: 20rem; }
.request-plots .client-plots__row { justify-content: flex-start; cursor: pointer; }
.request-plots__owner { margin: var(--space-2) 0 0; font-size: var(--text-xs); font-weight: 600; color: var(--ink-muted); }
.request-plots__owner:first-child { margin-top: var(--space-1); }
.request-sent { margin-top: var(--space-4); }

/* Staff: a client's sign-in, inside its row on /admin (src/ui.js renderClientAccess). */
.client-access { margin: var(--space-3) 0; padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-card); font-size: var(--text-sm); }
.client-access__state { margin: 0; color: var(--ink-muted); }
.client-access__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.client-access__link { width: 100%; margin-top: var(--space-2); padding: var(--space-2); border: 1px solid var(--line); border-radius: var(--radius-control);
  background: var(--sheet-raised); font: inherit; font-size: var(--text-xs); color: var(--ink); }
.client-access .client-parent { margin: var(--space-3) 0 0; }
.client-access .client-parent span { white-space: nowrap; }
/* Staff: a client's offer and what it signed (task 10, src/ui.js renderClientOffer), boxed like its sign-in. */
.client-offer { margin: var(--space-3) 0; padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-card); font-size: var(--text-sm); }
.client-offer .client-parent { margin: var(--space-2) 0 0; align-items: stretch; flex-direction: column; }
.client-offer .client-parent textarea,
.client-offer .client-parent input { width: 100%; font: inherit; }
.client-offer__email { display: flex; gap: var(--space-2); margin-top: var(--space-2); }
.client-offer__email input { flex: 1 1 auto; min-width: 0; }
.client-offer .legend { margin-top: var(--space-1); }
.client-offer .legend__row { flex-wrap: wrap; row-gap: 0; }
.client-offer .legend__row .legend__name { flex: 1 0 100%; white-space: normal; }

/* ------------------------------------------------------------------ Folded lists, chips, client cards (2026-10)
   A folded list (<details class="disclosure">): a row with its title, a count and a chevron; opened, its rows below.
   Used for an owner in the project editor, a client's plots, a project's plots and the plots waiting for coordinates. */
.disclosure { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--sheet-raised); }
.disclosure + .disclosure { margin-top: var(--space-2); }
.disclosure__summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 2.5rem;
  padding: var(--space-2) var(--space-3);
  list-style: none;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  border-radius: inherit;
}
.disclosure__summary::-webkit-details-marker { display: none; }
.disclosure__summary::after {             /* the chevron: points right when folded, down when open */
  content: "";
  flex: none;
  width: 0.45rem;
  height: 0.45rem;
  margin-left: var(--space-1);
  border-right: 1.6px solid var(--ink-muted);
  border-bottom: 1.6px solid var(--ink-muted);
  transform: rotate(-45deg);
  transition: transform var(--duration) var(--ease);
}
.disclosure[open] > .disclosure__summary::after { transform: rotate(45deg); }
.disclosure__summary:hover { background: var(--sheet-sunk); }
.disclosure__summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.disclosure__title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.disclosure__dot { flex: none; width: 0.7rem; height: 0.7rem; border-radius: 50%; }
.disclosure__count {
  flex: none;
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-pill);
  background: var(--sheet-sunk);
  color: var(--ink-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.disclosure__count:empty { display: none; }
.disclosure__count.is-picked { background: var(--ink); color: var(--sheet); }
.disclosure__body { padding: 0 var(--space-3) var(--space-3); }
.disclosure > .legend.disclosure__body { padding: 0 var(--space-3); border-top: 1px solid var(--line); }
.disclosure > .legend.disclosure__body > :last-child { border-bottom: 0; }
.block.disclosure { margin-top: var(--space-5); }
@media (prefers-reduced-motion: reduce) { .disclosure__summary::after { transition: none; } }

/* The project editor's owners: folded rows, opened to tick plots. */
.group-picker { gap: var(--space-2); }
.group-picker__client { padding: 0; }
.group-picker__client .disclosure__body { display: flex; flex-direction: column; }
.group-picker__all { align-self: flex-start; margin-bottom: var(--space-1); }
.group-picker__row { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) 0; }
.group-picker__row input { margin: 0; }

/* The editor's steps (plots, clients, presentation), each a block under its own title. */
.editor-step + .editor-step { padding-top: var(--space-4); border-top: 1px solid var(--line); }

/* A project's clients: chips (colour, name, "Intermediary · from the plots", a cross), then "Add a client…". */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-2); padding: 0; list-style: none; }
.chips:empty { display: none; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 100%;
  min-height: 2rem;
  padding: 0 var(--space-1) 0 var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--sheet-raised);
  font-size: var(--text-sm);
  font-weight: 550;
}
.chip__dot { flex: none; width: 0.6rem; height: 0.6rem; border-radius: 50%; }
.chip__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip__tag { flex: none; color: var(--ink-muted); font-size: var(--text-xs); font-weight: 500; }
.chip__remove {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink-muted);
  cursor: pointer;
}
.chip__remove:hover { background: var(--sheet-sunk); color: var(--ink); }
.chip__remove:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.chip__remove svg { width: 0.75rem; height: 0.75rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.chips--static { margin-top: var(--space-3); }
.chips--static .chip { padding-right: var(--space-3); }
.chips__add { max-width: 100%; padding: var(--space-2) var(--space-3); border: 1px dashed var(--line); border-radius: var(--radius-pill); background: none; font: inherit; font-size: var(--text-sm); color: var(--ink-muted); cursor: pointer; }
.chips__add:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }

/* The main page (/admin): its ways out in one row under the search. */
.home-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.home-actions .control { flex: 1 1 auto; text-align: center; text-decoration: none; }
.home-actions__count { color: var(--ink-muted); font-weight: 400; }
.home-actions__count:empty { display: none; }
.home-records { margin: var(--space-6) 0 var(--space-2); font-size: var(--text-xs); font-weight: 600; color: var(--ink-muted); }

/* Clients on the main page: one card (like an iOS Settings group), intermediaries, a fine line, individual clients;
   a row per client opening its page, an intermediary's own clients folded under it. */
.client-card {
  padding: var(--space-2) var(--space-3) var(--space-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--sheet-raised);
}
.client-card__head { display: flex; align-items: center; gap: var(--space-3); }
.client-card__head .block__title { flex: 1 1 auto; margin: 0; }
.client-card__head .advice__refresh { margin-top: 0; }
.client-card__hint { margin: var(--space-1) 0 0; }
.client-card__menu { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.client-card__menu .control { flex: 1 1 auto; }
.client-card__add { margin-top: var(--space-2); padding: var(--space-3); border-radius: var(--radius-card); background: var(--sheet-sunk); }
.client-card__add .client-card__heading { margin-top: 0; }
.client-card__group { margin-top: var(--space-2); }
.client-card__group + .client-card__group { border-top: 1px solid var(--line); } /* the fine line between the two kinds */
.client-card__heading { margin: var(--space-3) 0 var(--space-1); font-size: var(--text-xs); font-weight: 600; color: var(--ink-muted); }
[data-client-tree] { border-top: 0; }
[data-client-tree]:empty { display: none; }
[data-client-tree] > .client-row > .legend__row { padding-left: 0; padding-right: 0; }

/* Pages like a settings app (the main page's rows, a client's parts): a grouped list, one row per page, each with
   an icon, its name, a few words, a pink count of what waits on us, and a chevron. Hairlines start after the icon. */
.settings-group {
  margin-top: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--sheet-raised);
  overflow: hidden;
}
.settings-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 3.25rem;
  padding: var(--space-2) var(--space-6) var(--space-2) var(--space-3);
  color: var(--ink);
  text-decoration: none;
  transition: background var(--duration) var(--ease);
}
.settings-row[hidden] { display: none; }
.settings-row:hover { background: var(--sheet-sunk); }
.settings-row:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.settings-row + .settings-row::before,
.settings-row[hidden] + .settings-row::before { /* the hairline between rows, starting at the text like iOS */
  content: "";
  position: absolute;
  top: 0;
  left: calc(var(--space-3) + 1.9rem + var(--space-3));
  right: 0;
  border-top: 1px solid var(--line);
}
.settings-group > .settings-row:not([hidden]):first-of-type::before { display: none; }
.settings-row::after {                  /* the chevron: this row opens a page */
  content: "";
  position: absolute;
  right: var(--space-4);
  top: 50%;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid var(--ink-muted);
  border-top: 1.5px solid var(--ink-muted);
  transform: translateY(-50%) rotate(45deg);
}
.settings-row__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: var(--radius-control);
  background: var(--ink);
  color: var(--sheet);
}
.settings-row__icon svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.settings-row__text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.settings-row__title { font-size: var(--text-base); font-weight: 550; }
.settings-row__meta { font-size: var(--text-xs); color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-row__meta:empty { display: none; }
.settings-row__badge {
  flex: none;
  min-width: 1.4rem;
  padding: 1px var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--flag);
  color: var(--label-accent-text);
  font-size: var(--text-xs);
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.settings-row__badge:empty { display: none; }
.plot-head__link { margin: 0 0 0 var(--space-1); padding: 0; }

/* A round "+" next to a title: add a client, a project, a client under an intermediary. */
.add-button {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--fill);                /* a secondary button: the same soft tint (controls.css) */
  color: var(--ink);
  cursor: pointer;
  transition: background var(--duration) var(--ease), transform var(--duration) var(--ease);
}
.add-button:hover { background: var(--fill-hover); }
.add-button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.add-button svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.add-button[aria-expanded="true"] { transform: rotate(45deg); } /* "+" turns into "×" while its form is open */
.plot-head__row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }

/* An intermediary's count of clients: unfolds them under it. */
.client-row__fold {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 1.75rem;
  padding: 0 var(--space-2);
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--sheet-sunk);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
}
.client-row__fold::after {             /* the chevron: down when folded, up when open */
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform var(--duration) var(--ease);
}
.client-row__fold[aria-expanded="true"]::after { transform: translateY(1px) rotate(225deg); }
.client-row__fold:hover { background: var(--line); }

/* A list in its own card (the projects without a client). */
.legend--card { padding: 0 var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--sheet-raised); }
.legend--card > :last-child { border-bottom: 0; }
.legend--card:empty, .legend--card:not(:has(li)) { display: none; }
.client-row { border-bottom: 1px solid var(--line); }
.client-row:last-child { border-bottom: 0; }
.client-row > .legend__row { min-height: 3rem; padding: var(--space-2) var(--space-3); border-bottom: 0; }
.client-row__link { display: flex; flex-direction: column; gap: 1px; padding-right: var(--space-4); position: relative; }
.client-row__link:hover { text-decoration: none; }

.client-row__link::after {              /* the chevron: this row opens a page */
  content: "";
  position: absolute;
  right: var(--space-1);
  top: 50%;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid var(--ink-muted);
  border-top: 1.5px solid var(--ink-muted);
  transform: translateY(-50%) rotate(45deg);
}
.client-row__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-row__meta { font-size: var(--text-xs); font-weight: 400; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-row__children { list-style: none; margin: 0; padding: 0 0 var(--space-1) 1.6rem; }
.client-row__children .client-row { border-bottom: 0; border-top: 1px solid var(--line); }
.client-row__children .client-row > .legend__row { min-height: 2.5rem; padding-left: 0; }
.legend__heading { margin-top: var(--space-4); }
.client-add { margin-top: var(--space-3); }

/* One client's page (?client=<id>): its head, then a card per part. */
.client-head__name { display: flex; align-items: center; gap: var(--space-2); }
.client-head__swatch { width: 1.1rem; height: 1.1rem; }
.client-head__status { display: flex; flex-wrap: wrap; gap: var(--space-1); margin: var(--space-3) 0 0; padding: 0; list-style: none; }
.client-head__chip {
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--sheet-sunk);
  font-size: var(--text-xs);
  color: var(--ink);
}
.client-head__chip--warn { background: none; box-shadow: inset 0 0 0 1px var(--warn); color: var(--warn); }
.client-page .is-other-part { display: none; }
.client-page [data-child-add] { margin-bottom: var(--space-2); }
.client-page .client-section {
  margin: var(--space-3) 0 0;
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--sheet-raised);
}
.client-section__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-2); }
.client-section__head .client-section__title { margin: 0; }
.client-section__head .advice__refresh { margin-top: 0; }
.client-section__title { margin: 0 0 var(--space-2); font-family: var(--font-display); font-size: var(--text-base); font-weight: 650; letter-spacing: -0.005em; color: var(--ink); }
.client-section__title .block__count { font-weight: 400; color: var(--ink-muted); }
.client-page .legend--nested { margin: 0; border-top: 1px solid var(--line); }
.client-page .legend:empty, .client-page .client-plots:empty { display: none; }
.client-page .client-parent, .client-page .client-section > .legend__empty { margin-left: 0; }
.client-page .plot-search--client { width: 100%; margin: 0 0 var(--space-2); }
.client-page .client-plots { max-height: 24rem; }
.client-page .client-access { background: var(--sheet-raised); }
.client-page :is(.client-section__delete, .group-actions__delete).control { color: var(--warn); } /* a row's "Remove" stays a muted text button */
.client-section__delete { margin-top: var(--space-2); }
.client-page .client-plots { margin-left: 0; }
/* The details' "Edit" sits at the top right of its card; the summary takes the whole width. */
.client-page [data-client-details] { position: relative; }
.client-page [data-client-details] .locked-head { display: block; }
.client-page [data-client-details] .locked-head > .control { position: absolute; top: var(--space-2); right: var(--space-2); }
.client-page .locked-summary .fact { grid-template-columns: 9rem minmax(0, 1fr); }
.client-section--end { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); }
.client-page .client-section--end { border-style: dashed; background: none; }
.client-section--end .client-section__delete { margin: 0; }
/* A project's page: its presentation and editor right under its name and clients. */
.project-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-4); }
.corners__toggle { display: inline-block; margin-bottom: var(--space-2); }
/* A client's name never gets cut short by its counts: they go on a second line, under the name. */
[data-client-tree] .legend__item > .legend__row { flex-wrap: wrap; row-gap: 0; }
[data-client-tree] .legend__item > .legend__row > .legend__name { flex: 1 1 0; }
[data-client-tree] .legend__item > .legend__row > .legend__count { flex-basis: 100%; padding-left: calc(1.5rem + 0.9rem + 2 * var(--space-2)); font-size: var(--text-xs); }

/* "Add client": the contract's dates and the Terms version, each labelled, on their own lines. */
.add-row__contract { display: grid; gap: var(--space-2); flex-basis: 100%; margin: 0; padding: 0; border: 0; min-width: 0; }
.add-row__contract[hidden] { display: none; }
.add-row__field { display: grid; gap: var(--space-1); font-size: var(--text-xs); color: var(--ink-muted); }
.add-row__field[hidden] { display: none; }
/* A client card's contract: the fields line up with the name's; a missing contract is said in the warning colour. */
.client-contract .client-parent { margin-left: 0; }
.client-contract .client-parent span { flex: 0 0 9rem; }
.client-contract__problem { margin: 0 0 var(--space-2); font-size: var(--text-xs); color: var(--warn); }
.client-contract .control { margin: 0 var(--space-2) var(--space-2) 0; }

/* "Terrain and constraints": the line shown while the open data is looked up breathes gently. */
.layers__loading { margin: 0 0 var(--space-2); font-size: var(--text-sm); color: var(--ink-muted); animation: layers-wait 1.6s var(--ease) infinite; }
@keyframes layers-wait { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .layers__loading { animation: none; } }
/* Listings (task 11): the text staff check before approving, and an agency's waiting changes, kept as typed. */
.listing-review-text { white-space: pre-line; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ "Progress" (/admin?progress=1, src/progress-panel.js)
   A row (a project and the client paying for it) or a client card: its name and stage, who it waits on, its last
   note; opened, a small form and its history. The stage is a badge in the "Upload extracts" colours: waiting is
   amber, done green, dropped grey, in work and sent plain. */
.progress-only { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-3); font-size: var(--text-sm); }
.progress-item .legend__row { align-items: flex-start; }
.progress-item .legend__name--button { white-space: normal; text-align: left; }
.progress-item__stage {
  flex: none;
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--sheet-sunk);
  color: var(--ink);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}
.progress-item__stage[data-state="extracts"], .progress-item__stage[data-state="sent"],
.progress-item__stage[data-state="client-offer"] { background: var(--badge-wait-bg); color: var(--badge-wait-text); }
.progress-item__stage[data-state="done"], .progress-item__stage[data-state="client-signed"] { background: var(--badge-ok-bg); color: var(--ok); }
.progress-item__stage[data-state="dropped"], .progress-item__stage[data-state="client-ended"] { color: var(--ink-muted); }
.progress-item { padding-bottom: var(--space-2); }
.progress-item__line { margin: 0 0 var(--space-1); padding-top: 0; border-top: 0; overflow-wrap: anywhere; } /* not .fine-print's own rule above it */
.progress-item__line:empty { display: none; }
.progress-item__open { margin-top: var(--space-2); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-card); font-size: var(--text-sm); }
.progress-item__hint { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-2); color: var(--badge-wait-text); }
.progress-form .client-parent { margin: 0 0 var(--space-2); align-items: stretch; flex-direction: column; gap: var(--space-1); }
.progress-form .client-parent select,
.progress-form .client-parent input,
.progress-form .client-parent textarea { width: 100%; max-width: none; font: inherit; }
.progress-item__open .legend__heading { margin-top: var(--space-4); }
.progress-history { margin: 0; padding: 0; list-style: none; }
.progress-entry { display: grid; grid-template-columns: 1fr auto; gap: 0 var(--space-2); padding: var(--space-2) 0; border-top: 1px solid var(--line); }
.progress-entry__when { grid-column: 1; font-size: var(--text-xs); color: var(--ink-muted); }
.progress-entry__what { grid-column: 1; white-space: pre-line; overflow-wrap: anywhere; }
.progress-entry[data-kind="event"] .progress-entry__what { color: var(--ink-muted); }
.progress-entry .legend__delete { grid-column: 2; grid-row: 1 / span 2; align-self: start; }

/* Money, deliverables and to-dos (2026-11-01). The four tiles at the top: each a button that picks the list. */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.progress-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); margin: 0 0 var(--space-4); }
.progress-summary[hidden] { display: none; }
.progress-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0;
  padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-card);
  background: var(--sheet-raised); color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.progress-tile:hover { background: var(--sheet-sunk); }
.progress-tile[aria-pressed="true"] { border-color: var(--ink); }
.progress-tile:focus-visible, .progress-tab:focus-visible, .progress-owe__link:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.progress-tile__label { font-size: var(--text-xs); color: var(--ink-muted); }
.progress-tile__value { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600; font-variant-numeric: tabular-nums; }
.progress-tile__more { font-size: var(--text-xs); color: var(--ink-muted); }
.progress-tile__more--warn { color: var(--warn); font-weight: 600; }
.progress-tile__more:empty { display: none; }

/* "Who owes what": two short lists side by side, stacked on a phone. */
.progress-owe__lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: var(--space-3) var(--space-4); }
.progress-owe .legend__heading { margin-top: 0; }
.progress-owe__list { margin: 0; padding: 0; list-style: none; }
.progress-owe__list li { border-top: 1px solid var(--line); }
.progress-owe__link { display: flex; flex-direction: column; gap: 1px; padding: var(--space-2) 0; color: inherit; text-decoration: none; }
.progress-owe__link:hover { background-color: var(--hover); }
.progress-owe__name { font-size: var(--text-sm); font-weight: 600; overflow-wrap: anywhere; }
.progress-owe__list .fine-print { margin: 0; padding: var(--space-2) 0 0; border: 0; }

/* A row's deliverables bar and money line. */
.progress-item__meta { display: flex; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-1); }
.progress-item__meta[hidden] { display: none; }
.progress-bar { flex: 0 1 8rem; height: 6px; border-radius: var(--radius-pill); background: var(--sheet-sunk); overflow: hidden; }
.progress-bar__fill { display: block; height: 100%; background: var(--ok); }
.progress-item__meta .fine-print { margin: 0; padding: 0; border: 0; font-variant-numeric: tabular-nums; }
[data-progress-money][data-state="owed"], [data-section-meta][data-state="owed"], [data-list="projectProgress"] [data-state="owed"] { color: var(--warn); }
.progress-item__hint--warn { color: var(--warn); }

/* An open row's four parts: small tabs, then one part at a time. */
/* Deliverables | Money | To-dos | History: a segmented control (controls.css), the open part a white thumb. */
.progress-tabs { display: flex; gap: 2px; margin: 0 0 var(--space-3); padding: var(--inset-segmented); border-radius: var(--radius-pill); background: var(--fill); }
.progress-tab {
  flex: 1 1 0; min-width: 0; min-height: var(--control-height-sm); padding: 0 var(--space-2); border-radius: var(--radius-pill);
  color: var(--ink-muted); font-size: var(--text-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background-color var(--duration) var(--ease), color var(--duration) var(--ease);
}
.progress-tab:hover { color: var(--ink); }
.progress-tab[aria-selected="true"] { background: var(--thumb); color: var(--ink); box-shadow: var(--shadow-thumb); }
.progress-item__money-total { margin: 0 0 var(--space-3); font-weight: 600; }
.progress-item__money-total:empty { display: none; }

/* Lists of deliverables, payments and to-dos. */
.progress-list { margin: 0 0 var(--space-2); padding: 0; list-style: none; }
.progress-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 0 var(--space-2); padding: var(--space-2) 0; border-top: 1px solid var(--line); }
.progress-line__tick { display: flex; gap: var(--space-2); align-items: flex-start; grid-column: 1; overflow-wrap: anywhere; cursor: pointer; }
.progress-line__tick input { margin-top: 3px; flex: none; }
.progress-line:has(input:checked) [data-line-text] { color: var(--ink-muted); text-decoration: line-through; }
.progress-line__text { grid-column: 1; font-variant-numeric: tabular-nums; }
.progress-line__more { grid-column: 1; margin: 0; padding: 0; border: 0; }
.progress-line__more:empty { display: none; }
.progress-line[data-overdue="true"] .progress-line__more { color: var(--warn); }
.progress-line .advice__refresh, .progress-line [data-line-link] { grid-column: 1; justify-self: start; }
.progress-line .legend__delete { grid-column: 2; grid-row: 1 / span 3; }

/* The small forms (a deliverable, a price, a payment, a to-do): fields side by side, wrapping on a phone. */
.progress-inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-2); margin: 0 0 var(--space-2); }
.progress-inline label { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 7rem; font-size: var(--text-xs); color: var(--ink-muted); }
.progress-inline__grow { flex: 3 1 12rem !important; }
.progress-inline input, .progress-inline select { width: 100%; min-width: 0; min-height: var(--field-height-sm); }
.progress-inline .fine-print { margin: 0; padding: 0; border: 0; }
.progress-inline .control { flex: none; }

/* Task 13: a request's thread (/account's #sheet-thread, /admin's requests), oldest message first. Staff's messages sit
   on the sunk background, the client's on the sheet. */
.thread { list-style: none; margin: var(--space-3) 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); }
.thread__message { padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--sheet); }
.thread__message[data-state="staff"] { background: var(--sheet-sunk); }
.thread__who { margin: 0 0 var(--space-1); font-size: var(--text-sm); color: var(--ink-muted); }
.thread__body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.request-thread { margin-top: var(--space-2); }

/* Task 13 part G: a request's steps, a line down the left with a dot per step (filled once reached). */
.steps { list-style: none; margin: 0; padding: 0; }
.steps__step {
  position: relative; display: flex; justify-content: space-between; gap: var(--space-2);
  padding: 0 0 var(--space-3) var(--space-5); color: var(--ink-muted);
}
.steps__step::before {
  content: ''; position: absolute; left: 4px; top: 6px; width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid var(--line); background: var(--sheet); box-sizing: border-box;
}
.steps__step:not(:last-child)::after {
  content: ''; position: absolute; left: 8px; top: 18px; bottom: 2px; width: 2px; background: var(--line);
}
.steps__step[data-state="reached"] { color: var(--ink); }
.steps__step[data-state="reached"]::before { border-color: var(--flag); background: var(--flag); }
.steps__step[data-state="stopped"]::before { border-style: dashed; }
.steps__date { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Task 13 part I: the two-step key and the recovery codes, easy to copy. */
.two-step__key { font-family: var(--font-mono); overflow-wrap: anywhere; user-select: all; }
.two-step__codes { font-family: var(--font-mono); columns: 2; margin: var(--space-2) 0; user-select: all; }

/* A client's details read only until "Edit" (lockDetails in src/ui.js): the summary, its button at the top right. */
.locked-head { display: flex; align-items: flex-start; gap: var(--space-2); margin-bottom: var(--space-2); }
.locked-summary { flex: 1 1 auto; min-width: 0; border-top: 0; }
.locked-summary .fact { padding: var(--space-2) 0; }
.locked-summary[hidden] + .control { margin-left: auto; }

/* ------------------------------------------------------------------ Long lists: search, filters, scrolling (2026-11) */

/* A search box and filter chips above a list (uploads, clients). */
.list-tools { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); margin-bottom: var(--space-3); }
.list-tools .upload-filter { margin-bottom: 0; }
.list-tools .fine-print { margin: 0; }
[data-uploads-search] { margin-bottom: var(--space-2); }
/* The review list scrolls inside itself instead of making the panel endless; "Show more" adds rows. */
.uploads--scroll { max-height: 70vh; overflow-y: auto; overscroll-behavior: contain; }
.uploads__more { width: 100%; margin-top: var(--space-2); }
/* "Client of" in the new owner form takes the whole line. */
.add-row__field--wide { flex-basis: 100%; }
.add-row__field--wide select { width: 100%; }

/* An intermediary's clients on its page: one folded box each, its plots inside. */
.client-children { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); }
.client-children > .disclosure + .disclosure { margin-top: 0; }
/* Like a row of the Clients list: the name, its counts under it, then the plots' count and the chevron. */
.client-child .disclosure__title { display: flex; flex-direction: column; gap: 1px; }
.client-child .disclosure__title a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; }
.client-child .client-row__meta:empty { display: none; }
/* Its plots: plain rows in the fold (no second box inside the first). */
.client-child > .disclosure__body { padding: 0 var(--space-3) var(--space-2); border-top: 1px solid var(--line); }
.client-page .client-child .client-plots { margin: 0; padding: 0; border: 0; border-radius: 0; background: none; max-height: 20rem; }
.client-child .client-plots__row { padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
.client-child .client-plots__row:last-child { border-bottom: 0; }
.client-child [data-child-none] { margin: var(--space-2) 0 0; }
/* A list of folding rows (an intermediary's clients, the project editor's owners) is one card with a hairline between
   the rows, starting at the text like iOS's grouped lists and the main page's rows; not a card per row, which ran past
   the panel's edge with its scroll bar showing (2026-11-14, img 29). */
.client-children, .group-picker {
  display: block;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--sheet-raised);
  overflow: clip;
}
.client-children:empty, .group-picker:empty { display: none; }
:is(.client-children, .group-picker) > .disclosure { position: relative; margin: 0; border: 0; border-radius: 0; background: none; }
:is(.client-children, .group-picker) > .disclosure + .disclosure::before {
  content: "";
  position: absolute;
  top: 0;
  left: calc(var(--space-3) + 0.7rem + var(--space-2)); /* past the colour dot */
  right: 0;
  border-top: 1px solid var(--line);
}
:is(.client-children, .group-picker) > .disclosure > .disclosure__summary { border-radius: 0; }
/* A project's plots: the number (the link to the plot's page) never gives way to a long owner name. */
[data-list="projectPlots"] .legend__name { flex: none; }
[data-list="projectPlots"] .legend__meta { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }

/* The main page's folded queues (applications, requests, listings): rows off the box's edge, long text wraps, and a
   long queue scrolls inside its box. */
.disclosure > .legend:not(.disclosure__body) { margin: 0 var(--space-3) var(--space-3); max-height: 32rem; overflow-y: auto; overscroll-behavior: contain; }
.disclosure > .legend > .legend__item:last-child { border-bottom: 0; }
.request-row { padding: var(--space-2) 0; }
.request-row > .legend__row { flex-wrap: wrap; align-items: baseline; padding: 0; }
.request-row .legend__name { flex-basis: 12rem; white-space: normal; overflow-wrap: anywhere; line-height: 1.35; }
.request-row .fine-print { overflow-wrap: anywhere; line-height: 1.45; }
.request-row > .legend__edit { margin: var(--space-1) 0 0; padding: 0; }
.request-row .field, .request-row .client-access__actions { margin-top: var(--space-2); }
.client-section__head .client-section__title { margin-right: auto; }

/* ------------------------------------------------------------------ Back and the path (/admin, src/crumbs.js) */
/* Both pinned to the top of the panel together: Back, then "Home › Clients › … › here", each step a link up. */
.sheet__nav {
  position: sticky;
  top: calc(-1 * var(--space-5));
  z-index: 2;
  margin: calc(-1 * var(--space-5)) calc(-1 * var(--space-4)) var(--space-4);
  border-bottom: 1px solid var(--line);
  background: var(--sheet);
}
.sheet__nav:has(> .sheet__back[hidden]):has(> .crumbs[hidden]) { display: none; }
.sheet__nav > .sheet__back { position: static; width: 100%; margin: 0; border-bottom: 0; background: none; }
.sheet__nav > .sheet__back:not([hidden]) + .crumbs { padding-top: 0; margin-top: calc(-1 * var(--space-2)); }
.crumbs { padding: var(--space-3) var(--space-4); }
.crumbs[hidden] { display: none; }
/* A long path never runs off the panel: the steps between Home and where you are get shorter ("Carpați Im..."), the
   page you are on keeps its whole name as long as it fits (like a Finder window's path). */
.crumbs__list { display: flex; gap: var(--space-1); min-width: 0; margin: 0; padding: 0; list-style: none; font-size: var(--text-xs); white-space: nowrap; }
.crumbs__step { display: flex; flex: none; min-width: 0; overflow: hidden; }
.crumbs__step--long { flex: 0 1 auto; min-width: 3rem; } /* marked by src/main.js renderCrumbs */
.crumbs__step--long:last-child { flex-shrink: 0.25; min-width: 4rem; }
.crumbs__step + .crumbs__step::before { content: "›"; flex: none; margin-right: var(--space-1); color: var(--ink-muted); }
.crumbs__step > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.crumbs__step a { color: var(--ink-muted); }
.crumbs__step a:hover { color: var(--ink); background: none; box-shadow: none; } /* clipped by the step, so no wash: the colour says it */
.crumbs__step [aria-current] { color: var(--ink); font-weight: 600; }

/* "Ask about this plot" (src/questions-panel.js) */
.ask__form { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); margin-top: var(--space-2); }
.ask__form textarea { width: 100%; box-sizing: border-box; resize: vertical; font: inherit; }
.ask__list { list-style: none; margin: var(--space-3) 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); }
.ask__item { padding-top: var(--space-3); border-top: 1px solid var(--line); }
.ask__question { margin: 0; font-weight: 600; }
.ask__answer { margin: var(--space-1) 0 0; white-space: pre-line; }
.ask__item[data-state="running"] .ask__answer, .ask__item[data-state="failed"] .ask__answer { color: var(--ink-muted); }
.ask__caveats { margin: var(--space-2) 0 0; padding-left: 1.2em; color: var(--ink-muted); }
.ask__caveats:empty { display: none; }
.ask__sources { margin: var(--space-2) 0 0; padding-left: 1.6em; font-size: 0.92em; overflow-wrap: anywhere; }

/* A site report's sections and its indicative price (account.html #request-sections-box) */
.request-sections { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-1); }
.request-sections__price { margin: var(--space-2) 0 0; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ The Workspace (?workspace=1, src/workspace.js) */
.ws-mode { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); margin: var(--space-3) 0 var(--space-4); }
.ws-mode .segmented { width: 100%; }
.ws-mode .segmented .control { flex: 1; }

.ws-swatch { flex: none; width: 0.75rem; height: 0.75rem; border-radius: 50%; background: var(--client-color-none); box-shadow: inset 0 0 0 1px var(--swatch-edge); }

.ws-inspector__head { display: flex; align-items: center; gap: var(--space-2); }
.ws-inspector__head .block__title { flex: 1; margin: 0; }
.ws-inspector__close { width: 2rem; height: 2rem; border: 0; border-radius: 50%; background: var(--sheet-sunk); color: var(--ink); font-size: var(--text-lg); line-height: 1; cursor: pointer; }
.ws-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2) var(--space-3); margin: var(--space-3) 0; }
.ws-facts dt { color: var(--ink-muted); font-size: var(--text-xs); }
.ws-facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

.ws-explorer .segmented { width: 100%; margin-bottom: var(--space-2); }
.ws-explorer .segmented .control { flex: 1; }
.ws-list { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.ws-row { display: flex; align-items: center; gap: var(--space-2); border-radius: var(--radius-control); }
.ws-row:hover { background: var(--sheet-sunk); }
.ws-row[aria-current="true"] { background: var(--sheet-sunk); }
.ws-row__main { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2); border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.ws-row__text { min-width: 0; display: grid; }
.ws-row__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-row__meta { color: var(--ink-muted); font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-row__actions { display: flex; gap: var(--space-1); padding-right: var(--space-2); }
/* Manage: rows whose plots are (partly) selected. */
.ws-row[data-picked="all"] .ws-row__name::after { content: " ✓"; color: var(--flag); }
.ws-row[data-picked="some"] .ws-row__name::after { content: " ◐"; color: var(--flag); }

/* The selection's tray, on the map, between the panel and the map's buttons. */
.ws-tray {
  position: absolute;
  left: calc(var(--sheet-width) + 2 * var(--edge));
  right: calc(var(--edge) + 4rem);
  bottom: calc(var(--edge) + 1.5rem);
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  max-width: 52rem;
  margin: 0 auto;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-sheet);
  background: var(--sheet);
  box-shadow: var(--shadow-control);
}
.ws-tray[hidden] { display: none; }
.ws-tray__summary { display: grid; line-height: 1.25; white-space: nowrap; }
.ws-tray__summary span { color: var(--ink-muted); font-size: var(--text-sm); }
.ws-tray__actions, .ws-tray__form { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.ws-tray__actions { margin-left: auto; }
.ws-tray__form { flex-basis: 100%; }
.plot-owners { margin: var(--space-3) 0; }
/* A plot's own page (admin.html #plot-page): a line saying where it stands, then its two links. */
.plot-page { margin: var(--space-3) 0; }
.plot-page__note { margin: var(--space-1) 0 var(--space-2); color: var(--ink-muted); font-size: var(--text-sm); }
.plot-page__links { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin: 0; }
.plot-owners__list { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-1); margin: var(--space-2) 0 0; padding: 0; list-style: none; }
.plot-owners__row { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); align-items: baseline; font-size: var(--text-sm); }
.plot-owners__name { font-weight: 600; overflow-wrap: anywhere; }
.plot-owners__meta { color: var(--ink-muted); }
.ws-tray__field { display: flex; align-items: center; gap: var(--space-2); color: var(--ink-muted); font-size: var(--text-sm); }
.ws-tray__form [hidden] { display: none; }
.ws-tray__share { flex: 1 1 10rem; }
.ws-tray__form[hidden] { display: none; }
.ws-tray__form .field__input { flex: 1 1 12rem; min-width: 0; }
@media (max-width: 47.5rem) {
  .ws-tray { left: var(--edge); right: var(--edge); }
  .ws-tray__actions { margin-left: 0; }
}
@media (max-width: 47.5rem) {
  /* A phone's map is small: the tray is one row (its buttons scroll sideways). */
  .ws-tray { padding: var(--space-2) var(--space-3); gap: var(--space-2); flex-wrap: nowrap; }
  .ws-tray__summary span { display: none; }
  .ws-tray__actions { flex-wrap: nowrap; overflow-x: auto; min-width: 0; }
  .ws-tray__actions > * { flex: none; }
  .ws-tray:has(.ws-tray__form:not([hidden])) { flex-wrap: wrap; }
}

/* The realtor's listing form in three steps (account.html, usability check 2026-11-02): the steps share the width. */
.listing-steps { display: flex; width: 100%; margin-bottom: var(--space-4); }
.listing-steps .control { flex: 1 1 0; min-width: 0; white-space: normal; line-height: 1.2; }
.listing-step .facts { margin-top: var(--space-3); }

/* "Find its place from the drawing" (Upload extracts, src/uploads.js): the option under the drop zone, then the
   extract's plan drawing, the places found (one button each), the nudges and "Use these corners". */
.uploads__option { align-items: flex-start; margin: var(--space-3) 0; }
.uploads__option .field__hint { display: block; }
.sketch-find { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); }
.sketch-find__title { margin: 0; font-size: var(--text-lg); }
.sketch-find__drawing { width: 100%; max-height: 18rem; object-fit: contain; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--paper); }
.sketch-find__places, .sketch-find__nudge, .sketch-find__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.sketch-find__places [aria-pressed="true"] { border-style: solid; border-color: var(--flag); color: var(--ink); }
.sketch-find .control { margin-top: 0; }

/* A home or building's form (#sheet-property, PROPERTIES=on): its yes/no facts in two columns, an owner a row. */
.property-form .client-section__title { margin-top: var(--space-4); }
.property-ticks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-1) var(--space-3); margin: var(--space-2) 0; }
.property-owner { grid-template-columns: 1fr 6rem auto; align-items: end; }
.property-form .entry__check { color: var(--flag); }
@media (max-width: 520px) {
  .property-ticks { grid-template-columns: 1fr; }
}

/* An agent's own photo (2026-11-04, account.html "My public profile on listings", admin.html's check of it): round. */
.agent-face { display: flex; margin-bottom: var(--space-3); }
.agent-face__photo, .agent-face__initials { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; background: var(--agent-face); }
.agent-face__initials { display: grid; place-items: center; font-weight: 650; color: var(--ink-muted); }
.agent-face__photo[hidden], .agent-face__initials[hidden] { display: none; }
.agent-face__photo--small { width: 48px; height: 48px; flex: none; }

/* "Deliver" (#sheet-deliver, src/deliver-panel.js; 2026-11-27, from signed offers). Two tabs: To deliver (a card per
   client, its offers ticked, each showing the projects it is delivered as, then who gets it and Deliver) and Delivered
   (the deliveries as one grouped list, a hairline between them; each delivery's bill in a sunk box with its steps). */
.deliver__warn { color: var(--flag-text); }
.deliver__tabs { margin: 0 0 var(--space-3); }
#sheet-deliver span.fine-print { margin: 0; padding: 0; border: 0; } /* grey words inside a line: no hairline above them */
.deliver__text { width: 100%; box-sizing: border-box; font-family: var(--font-body); line-height: 1.45; resize: vertical; }
.deliver__totals { margin: var(--space-2) 0; font-weight: 600; font-variant-numeric: tabular-nums; }

/* To deliver: a card per client; inside, a box per offer (its items under its name, its projects once ticked). */
.deliver__clients { list-style: none; margin: var(--space-2) 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); }
.deliver__client { padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-card); }
.deliver__client-head { margin: 0 0 var(--space-2); display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-2); }
.deliver__offers { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); }
.deliver__offer { padding: var(--space-2) var(--space-3); background: var(--sheet-sunk); border-radius: calc(var(--radius-card) - var(--space-2)); }
.deliver__offer-pick { align-items: flex-start; }
.deliver__offer-items { display: block; margin-top: 2px; }
.deliver__offer-projects { margin: var(--space-2) 0 0; padding: 0 0 0 1.6rem; border: 0; min-width: 0; }
.deliver__offer-projects legend { padding: 0; margin: 0 0 var(--space-1); border: 0; }
.deliver__offer-projects ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-1); }
.deliver__stage { margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--line); }
.deliver__stage .fine-print { margin-top: 0; padding-top: 0; border: 0; }
.deliver__stage .client-parent:has(textarea) { align-items: stretch; flex-direction: column; gap: var(--space-1); }
.deliver__stage .client-parent textarea { max-width: none; width: 100%; }

/* Delivered. */
.deliver__sent { list-style: none; margin: var(--space-2) 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-card); }
.deliver__sent-card { padding: var(--space-3); }
.deliver__sent-card + .deliver__sent-card { border-top: 1px solid var(--line); }
.deliver__sent-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); min-width: 0; }
.deliver__sent-client { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deliver__sent-card .fine-print, .deliver__bill .fine-print { margin: 0; padding: 0; border: 0; } /* no hairline above the notes inside a card */
.deliver__sent-products { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: grid; gap: var(--space-1); }
.deliver__sent-title { font-weight: 600; }
.badge[data-state="paid"] { background: var(--badge-ok-bg); color: var(--ok); }
.badge[data-state="waiting"] { background: var(--badge-wait-bg); color: var(--badge-wait-text); }
.badge[data-state="ourTurn"] { background: var(--flag-tint); color: var(--flag-text); }
.badge[data-state="overdue"], .badge[data-state="unbilled"] { background: var(--badge-bad-bg); color: var(--warn); }
.deliver__bills { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); }
.deliver__bills:empty { display: none; }
.deliver__bill { padding: var(--space-2) var(--space-3); background: var(--sheet-sunk); border-radius: calc(var(--radius-card) - var(--space-2)); }
[data-deliver-unsent-block] .deliver__bill { background: none; border: 1px solid var(--line); border-radius: var(--radius-card); }
.deliver__bill-head { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-2); }
/* Its steps as a short timeline: done, a filled dot; next, a pink ring. */
.deliver__steps { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: grid; gap: var(--space-1); }
.deliver__step { position: relative; padding-left: 1.4rem; color: var(--ink-muted); }
.deliver__step::before { content: ''; position: absolute; left: 0.2rem; top: 0.4em; width: 0.65rem; height: 0.65rem; box-sizing: border-box;
  border: 2px solid var(--line); border-radius: 50%; }
.deliver__step--done { color: var(--ink); }
.deliver__step--done::before { background: var(--ink); border-color: var(--ink); }
.deliver__step--next { color: var(--ink); font-weight: 600; }
.deliver__step--next::before { border-color: var(--flag); }
.deliver__step--cancelled { color: var(--warn); }
.deliver__step--cancelled::before { background: var(--warn); border-color: var(--warn); }
.deliver__bill-next { margin: var(--space-2) 0 0; }
/* Our turn: what Rabobank's payment link asks for, a row each with Copy; then the link and Send. */
.deliver__rabo { margin-top: var(--space-2); }
.deliver__rabo-fields { margin: 0; display: grid; gap: var(--space-1); }
.deliver__rabo-fields > div { display: grid; grid-template-columns: minmax(0, 1fr); } /* the label above its value: the sheet is narrow */
.deliver__rabo-fields dt { color: var(--ink-muted); font-size: var(--text-sm); }
.deliver__rabo-fields dd { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-2); min-width: 0; overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums; }
.deliver__bill-url { margin-top: var(--space-2); display: grid; gap: var(--space-1); justify-items: start; }
.deliver__bill-url .client-parent { display: grid; gap: var(--space-1); width: 100%; margin: 0; }
.deliver__bill-actions { margin: var(--space-2) 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3); }
.deliver__bill-actions:not(:has(> :not([hidden]))) { display: none; }
[data-bill-link-sent] { margin-top: var(--space-1) !important; overflow-wrap: anywhere; }

/* "What's new" (admin.html #sheet-news, src/news-panel.js): an entry per merge or release, newest first. */
.news { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); list-style: none; margin: var(--space-3) 0 0; padding: 0; }
.news__entry { padding: var(--space-3) var(--space-4); border-radius: var(--radius-card); background: var(--sheet-raised, var(--paper)); font-size: var(--text-sm); line-height: 1.5; }
.news__title { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin: 0; font-family: var(--font-display); font-size: var(--text-base); }
.news__new { padding: 0.05rem 0.5rem; border-radius: var(--radius-pill); background: var(--flag-tint); color: var(--flag-text); font-family: var(--font-body); font-size: var(--text-xs); font-weight: 600; }
.news__date { margin: 2px 0 var(--space-2); color: var(--ink-muted); font-size: var(--text-xs); }
.news__entry p { margin: var(--space-1) 0 0; }
.news__entry ul { margin: var(--space-1) 0 0; padding-left: 1.1rem; }
.news__entry li + li { margin-top: 2px; }

/* "Prices" (?prices=1) and an offer's "From the price list" (2026-11-09, src/price-list-panel.js). */
.offer-price, .prices__group { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); margin: 0 0 var(--space-3); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-card); }
.prices__tiers { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.prices__tier { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: var(--space-2); }
.prices__tier label { display: inline-flex; align-items: center; gap: var(--space-1); font-size: var(--text-sm); white-space: nowrap; }
.prices__upto, .prices__eur { width: 4rem; flex: 0 0 auto; }

/* ------------------------------------------------------------------ A project's price estimates on /account (2026-11-09) */
.estimates { list-style: none; margin: 0; padding: 0; }
.estimates__row { padding: var(--space-2) 0; border-top: 1px solid var(--line); }
.estimates__row:first-child { border-top: 0; }
.estimates__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); }
.estimates__name { font-weight: 600; }
.estimates__price { flex: none; font-size: var(--text-lg); font-weight: 600; font-variant-numeric: tabular-nums; }
.estimates__meta { margin: var(--space-1) 0 0; font-size: var(--text-sm); color: var(--ink-muted); }
.estimates__meta:empty { display: none; }
.estimates__why { margin-top: var(--space-1); }
.estimates__text { margin: var(--space-1) 0 0; font-size: var(--text-sm); white-space: pre-line; }
.estimates__total { margin: var(--space-2) 0 0; padding-top: var(--space-2); border-top: 1px solid var(--line); font-weight: 600; }
/* A row with a second line under its name (a lot's owners and shares on /account). */
.legend__row--wrap { flex-wrap: wrap; }
.legend__row > .legend__sub { flex-basis: 100%; padding-left: calc(0.9rem + var(--space-2)); margin-top: calc(-1 * var(--space-1)); font-size: var(--text-sm); }

/* "Waiting for coordinates": the owner picker and its copy / download buttons on one line. */
.waiting-tools { align-items: center; }
.waiting-tools select.control { max-width: 100%; }
.waiting-tools .fine-print { margin: 0; }

/* A client's Offers (2026-11-18): one card per offer, newest first, its status as a chip (src/ui.js renderClientOffers),
   then the offer being written. Signed ones list the presentations they are delivered as. */
.offer-list { display: grid; gap: var(--space-2); margin: var(--space-2) 0 0; padding: 0; list-style: none; }
.offer-row { padding: var(--space-2) var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-control); }
.offer-row__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); }
.offer-row__title { font-weight: 600; color: var(--ink); }
.offer-row__line { margin: var(--space-1) 0 0; color: var(--ink-muted); font-size: var(--text-xs); }
.offer-row__line:empty { display: none; }
.offer-chip {
  flex: none;
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--sheet-sunk);
  font-size: var(--text-xs);
  color: var(--ink-muted);
}
.offer-chip[data-status="sent"], .offer-chip[data-status="draft"] { background: var(--flag-tint); color: var(--flag-text); }
.offer-chip[data-status="signed"] { background: none; box-shadow: inset 0 0 0 1px var(--ok); color: var(--ok); }
.offer-chip[data-status="linkExpired"], .offer-chip[data-status="declined"] { background: none; box-shadow: inset 0 0 0 1px var(--warn); color: var(--warn); }
.offer-row[data-status="withdrawn"], .offer-row[data-status="expired"], .offer-row[data-status="superseded"] { opacity: 0.7; }
.offer-row__projects { margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--line); }
.offer-row__project-list { margin: 0; padding: 0; list-style: none; }
.offer-row__project { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: 2px 0; }
.offer-row__waiting { color: var(--flag-text); font-size: var(--text-xs); }
.offer-attach { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-2); }
.offer-attach .plot-list__owner { flex: 1 1 100%; min-width: 0; max-width: none; }
.offer-row [data-action="offer-revise"] { margin-top: var(--space-2); }
.offer-form__title { margin: var(--space-4) 0 0; font-size: var(--text-sm); font-weight: 600; color: var(--ink); }
.offer-fill { margin-top: var(--space-2); }
/* The open offer's steps (2026-11-20): what state it is in, the question before editing a sent one, and sending it. */
.offer-form__state { margin: var(--space-1) 0 0; }
.offer-ask { margin-top: var(--space-2); padding: var(--space-3); border-radius: var(--radius-control); background: var(--sheet-sunk); }
.offer-ask__text { margin: 0; font-size: var(--text-sm); color: var(--ink); }
.offer-send { margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--line); }
.offer-send__title { margin: 0; font-size: var(--text-sm); font-weight: 600; color: var(--ink); }
.progress-line__offer { grid-column: 1 / -1; }

/* Automation (2026-11-20, branch auto-pipeline): an upload approved by itself or why it waits, a request's line, and the
   values read from an urban certificate's PDF, each with its sentence and a tick (src/uploads.js, src/pricing-panel.js). */
.upload__auto { color: var(--ink-muted); }
.request-row__pipeline:empty { display: none; }
.upload-auto { margin: var(--space-2) 0; }
.permit-proposals { margin: var(--space-2) 0 0; padding: 0; list-style: none; }
.permit-proposal { padding: var(--space-1) 0; }
.permit-proposal q { display: block; margin: 0 0 0 1.6em; color: var(--ink-muted); }
.permit-proposal .field__hint { margin-left: 1.6em; color: var(--flag-text); }
