/* Bre-zy Cleaning Co. — phone-first stylesheet.
 *
 * Hand-written rather than Tailwind: plan §2 says "pick one, avoid a Node
 * toolchain in prod", and a purge-less Tailwind build would ship megabytes to
 * a phone on mobile data. If a richer design system is wanted later, add
 * django-tailwind as a *build-time* step and replace this file.
 *
 * Tap targets are 44px minimum throughout — this is used standing in a doorway.
 *
 * Palette is taken from the logo: forest green ink, gold flourishes, cream.
 * The green is the accent — 7.9:1 on the light surface, so it carries text
 * and controls as drawn. The gold (--gold-bright) is decorative only: 2.9:1
 * on white, exactly as the old logo's gold was. In the dark theme the green
 * is lifted along its own hue to 4.7:1 rather than swapped for something
 * else, so the brand survives the theme. Every text/ground pair below is at
 * or above 4.5:1 in both themes; the numbers were measured, not eyeballed.
 */

:root {
  color-scheme: light dark;
  --bg: #f4f1ec;
  --surface: #fdfcfa;
  --surface-2: #eeeae2;
  --border: #ded7cb;
  --text: #1f1d1b;
  --muted: #6b635a;
  --accent: #405637;          /* brand green: 7.86:1 on --surface; white on it 8.06:1 */
  --accent-text: #ffffff;
  --gold-bright: #ba8d3c;     /* the logo's gold — rules and flourishes only */
  --danger: #8f2622;
  --danger-bg: #fbeae8;
  --warn: #6f4e07;
  --warn-bg: #fbf2da;
  --ok: #1f6045;
  --ok-bg: #e6f1eb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(31, 29, 27, 0.07), 0 4px 14px rgba(31, 29, 27, 0.05);

  /* ── Rhythm. Theme-independent: never redefined in the dark block below,
   * because a value that is not a colour has no business there. The scale
   * covers every size this file had already been using by hand, to within
   * a twentieth of a rem; a literal that stays a literal has a reason. ── */
  --space-1: 0.25rem;   /* hairline: inside a pill, between a pill and its word */
  --space-2: 0.5rem;    /* between things that belong together */
  --space-3: 0.75rem;   /* inside a control */
  --space-4: 1rem;      /* the page gutter; between blocks */
  --space-5: 1.5rem;    /* between sections on a wide page */
  --space-6: 2rem;
  --space-7: 3rem;      /* the page's bottom */
  --tap: 44px;          /* the doorway rule, line 8 */

  --text-2xs: 0.7rem;   /* pills, calendar column heads */
  --text-xs: 0.8rem;    /* table heads, reveal labels, the nav bar */
  --text-sm: 0.875rem;  /* footnote, row meta, crumb, label, compact button */
  --text-md: 1rem;      /* body, fields, buttons */
  --text-lg: 1.15rem;   /* card h2, pagehead h2 */
  --text-xl: 1.4rem;    /* page h1 */
  --text-2xl: 1.9rem;   /* stat value, timer face */
  --leading: 1.5;
  --leading-tight: 1.1;
  --radius-sm: 8px;     /* controls; --radius stays for cards, rows and tiles */
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #100f13;
    --surface: #16151a;
    --surface-2: #201e25;
    --border: #322f39;
    --text: #efeae2;
    --muted: #a79d90;
    --accent: #6c915d;        /* the green lifted: 5.06:1 on --surface, 4.59:1 on
                               --surface-2 — the pair the reveal's Hide now sits on;
                               #688c59 measured 4.31:1 there and failed the rule above */
    --accent-text: #16151a;
    --gold-bright: #ba8d3c;   /* 6.02:1 on the dark surface as drawn */
    --danger: #ffa79f;
    --danger-bg: #3a1e1c;
    --warn: #f0c765;
    --warn-bg: #352c16;
    --ok: #74d0ab;
    --ok-bg: #143024;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }

.wrap {
  max-width: 34rem;
  margin: 0 auto;
  padding: var(--space-4) var(--space-4) var(--space-7);
}

/* Pages that are lists, tables, calendars or the dashboard take the screen on
 * anything bigger than a phone; see the comment in base.html for why that is
 * opt-in rather than the default. Below 48rem this rule does nothing at all,
 * so the phone layout is untouched — which is the layout that matters most.
 *
 * 90rem rather than `none`: a table row 1900px wide is not easier to read
 * than one 1400px wide, it is just longer to track across. */
@media (min-width: 48rem) {
  .wrap--wide { max-width: 90rem; padding-inline: 1.5rem; }
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-1) var(--space-4);   /* the links inside are 44px tall now */
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
/* Name, Help, Sign out. The name is dropped on a phone so the two links keep
 * their 44px; it comes back once there is room. */
.who { display: flex; align-items: center; gap: var(--space-1); color: var(--muted); font-size: var(--text-sm); }
.who__name { display: none; }
.who__link { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--space-2); text-decoration: none; }
/* Sign-out is a POST (a state change), so it is a form, not a link. The
 * button keeps the link's look; only the reset is new. */
.who__form { display: inline-flex; margin: 0; }
button.who__link { background: none; border: 0; font: inherit; color: var(--accent); cursor: pointer; }
@media (min-width: 30rem) { .who__name { display: inline-flex; align-items: center; min-height: var(--tap); padding-inline: var(--space-2); } }

/* Brand lockup. The logo image is used when one has been installed; the
 * wordmark below is the fallback and is what the emails and PDFs echo. */
.brand { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.brand__link { display: block; line-height: 0; }
.brand__link { padding: 7px; margin: -7px; }   /* 30px mark, 44px to tap, no new height */
/* The typeset fallback, linked. Not .brand__link: its line-height: 0 is for an
 * image, and would collapse text to nothing. */
.brand__home { display: block; min-width: 0; color: inherit; text-decoration: none; }
/* The compact mark is a wide strip of script, not a square icon — height is
 * what makes it legible, and 30px is where this face stops being readable. */
.brand img { display: block; height: 30px; width: auto; max-width: 62vw; }

.wordmark { margin: 0; min-width: 0; }
.wordmark__name {
  display: block;
  font-family: "Didot", "Bodoni MT", "Playfair Display", Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
  font-weight: 600;
  font-style: italic;
  letter-spacing: 0.01em;
  line-height: 1.1;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wordmark__sub {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

/* The sign-in pages give the brand room, the way the logo is drawn to be seen. */
.brand--hero {
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.5rem 0 1.5rem;
  text-align: center;
}
.brand--hero img { height: auto; max-height: 150px; max-width: min(21rem, 82vw); }
.brand--hero .wordmark__name { font-size: 1.9rem; white-space: normal; }
.brand--hero .wordmark__sub { font-size: 0.65rem; }
.brand--hero .wordmark::after {
  content: "";
  display: block;
  width: 70%;
  max-width: 14rem;
  height: 1px;
  margin: 0.7rem auto 0;
  background: var(--gold-bright);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: var(--space-4);
}
.card > h2 { margin-top: 0; font-size: var(--text-lg); }
.card > p:last-child { margin-bottom: 0; }

.lede { color: var(--muted); margin-top: -0.25rem; }

label { display: block; font-weight: 600; margin: 0.9rem 0 var(--space-1); font-size: var(--text-sm); }

.field,
input[type="text"], input[type="password"], input[type="email"], input[type="number"] {
  width: 100%;
  min-height: var(--tap);
  padding: 0.6rem 0.7rem;
  font-size: var(--text-md);
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.field:focus-visible, input:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.field--code {
  font: 600 1.5rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.4em;
  text-align: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: var(--tap);
  width: 100%;
  margin-top: 1.1rem;
  padding: 0.6rem var(--space-4);
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
}
.btn--quiet {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border);
}
.btn--link {
  width: auto; min-height: 0; margin: 0; padding: 0;
  background: none; border: none; color: var(--accent);
  font-weight: 500; text-decoration: underline;
}

.alt { margin-top: 1rem; font-size: 0.9rem; text-align: center; }
.alt a { display: inline-flex; align-items: center; min-height: var(--tap); padding-inline: var(--space-1); }

.msg { border-radius: var(--radius-sm); padding: 0.7rem 0.9rem; margin-bottom: var(--space-3); font-size: 0.95rem; }
.msg--error, .msg--danger { background: var(--danger-bg); color: var(--danger); }
.msg--warning { background: var(--warn-bg); color: var(--warn); }
.msg--success, .msg--info { background: var(--ok-bg); color: var(--ok); }

.errorlist {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  color: var(--danger);
  font-size: 0.9rem;
}

.qr {
  display: block;
  width: min(15rem, 70vw);
  margin: 1rem auto;
  padding: 0.75rem;
  background: #fff;   /* a QR must be dark-on-light to scan in either theme */
  border-radius: 8px;
}
.qr svg { display: block; width: 100%; height: auto; }

.secret {
  display: block;
  padding: 0.6rem;
  font: 0.95rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
  text-align: center;
  background: var(--surface-2);
  border-radius: 8px;
}

.codes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin: 1rem 0;
  padding: 0;
  list-style: none;
}
.codes li {
  padding: 0.5rem;
  font: 1rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.tiles { display: grid; gap: var(--space-3); }
.tile {
  display: block;
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
}
.tile strong { display: block; font-size: var(--text-md); }
.tile span { color: var(--muted); font-size: var(--text-sm); }
/* A tile that explains why it cannot be used, rather than vanishing. */
.tile--off { background: transparent; color: var(--muted); border-style: dashed; }

.footnote { color: var(--muted); font-size: var(--text-sm); }
/* "See all" under a short list: a whole-width tap target, not a bare link. */
.more { display: flex; align-items: center; min-height: var(--tap); font-weight: 600; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.centred { text-align: center; }

@media print {
  .no-print { display: none !important; }
  body { background: #fff; color: #000; }
}

/* ── Phase 1: clients, properties and the reveal ──────────────────────────── */

.pagehead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin: 1.25rem 0 var(--space-2);
}
.pagehead h1, .pagehead h2, .pagehead h3 { margin: 0; }
.pagehead h1 { font-size: var(--text-xl); }
.pagehead h2 { font-size: var(--text-lg); }
.pagehead h3 { font-size: var(--text-md); }

/* A second button size: "Add client" beside a heading should not be the
 * full-width slab that a form's submit is. Still 44px tall to tap. */
.btn--compact { width: auto; margin-top: 0; padding: var(--space-2) 0.85rem; font-size: var(--text-sm); }

.crumb { margin: 0 0 var(--space-1); font-size: var(--text-sm); }
/* 44px to tap, with no new height: the padding is pulled back in. */
.crumb a { display: inline-block; padding-block: 0.75rem; margin-block: -0.75rem; text-decoration: none; }

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

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

/* Filters */
.filters { margin-bottom: 1rem; }
.filters__row { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.filters__row .field { flex: 1 1 0; min-width: 0; }
select.field { appearance: none; background-image: none; }
/* A labelled select in a filter row (the Paid tab's sort). */
.filters__label { flex: 1 1 0; min-width: 0; margin: 0; }
.filters__label .field { margin-top: var(--space-1); }
.filters--sort .btn { min-height: var(--tap); margin-top: 0.5rem; }
.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0 0;
  font-weight: 500;
  font-size: 0.95rem;
}
.check { min-height: var(--tap); }   /* the whole row is the label, so the whole row taps */
.check input { flex: none; width: 24px; height: 24px; margin: 0; accent-color: var(--accent); }

/* Rows — the list shapes used by clients and by the access log. */
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--space-2);
}
.row__link,
.row > .row__name {
  display: block;
  min-height: var(--tap);
  padding: var(--space-3) 0.9rem;
  color: var(--text);
  text-decoration: none;
}
.row__link { padding-bottom: var(--space-2); }
.row__name { display: block; font-weight: 600; }
.row__meta {
  display: block;
  padding: 0 0.9rem var(--space-3);
  color: var(--muted);
  font-size: var(--text-sm);
  /* A request note quoted back can run to the 2,000-char cap (P-09) with no
   * break in it; one unbroken word is as wide as the word. NEB-430 review. */
  overflow-wrap: break-word;
}
.row__link .row__meta { padding: 0.15rem 0 0; }
.row--empty { padding: var(--space-4) 0.9rem; color: var(--muted); }
.row--refused { border-left: 3px solid var(--danger); }
.rows--log .row { margin-bottom: 0.4rem; }

.pill {
  display: inline-block;
  margin-left: var(--space-1);
  padding: 0.1rem 0.45rem;
  font-size: var(--text-2xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 0.1em;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.pill--paused { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.pill--former { color: var(--danger); background: var(--danger-bg); border-color: transparent; }

/* Tabs. Most of them are Phase 2–5 and are deliberately inert: the shape of
 * the record is worth showing before the screens exist. */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: var(--space-4) 0;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}
.tab {
  padding: 0.4rem 0.7rem;
  font-size: var(--text-sm);
  border-radius: 999px;
  text-decoration: none;
  color: var(--accent);
}
.tab--current { color: var(--accent-text); background: var(--accent); font-weight: 600; }

/* Definition lists of small facts. */
.facts { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 0.9rem; margin: 0.5rem 0; }
.facts dt { color: var(--muted); font-size: 0.85rem; }
.facts dd { margin: 0; }

.address { margin: 0.25rem 0 0.5rem; font-size: 1rem; }
.notes { white-space: pre-line; }
.card--property .pagehead { margin-top: 0; }
.card--inactive { opacity: 0.7; }

/* ── Reveal ───────────────────────────────────────────────────────────────
 * Every state of one encrypted field occupies the same slot, so the swap does
 * not make the card jump under a thumb. */
.reveals { display: grid; gap: 0.5rem; margin-top: 0.75rem; }
.reveal { min-height: 44px; }
.btn--reveal { width: 100%; margin-top: 0; }

.reveal--shown, .reveal--refused, .reveal--reauth {
  padding: 0.6rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.reveal--shown { border-color: var(--accent); }
.reveal__label {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.reveal__timer { font-weight: 400; letter-spacing: 0; text-transform: none; }
.reveal__value {
  display: block;
  font: 600 1.4rem/1.35 ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-word;
  white-space: pre-wrap;
  color: var(--text);
}
/* The one tap with a code on screen: a full-width 44px button, like Reveal. */
.reveal__hide {
  width: 100%; min-height: var(--tap); margin-top: 0.5rem; padding: 0 var(--space-4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  text-decoration: none;
}
.reveal--shown .msg, .reveal--refused .msg, .reveal--reauth .msg { margin-bottom: 0.4rem; }
.reveal--reauth .btn { margin-top: 0.25rem; }

/* A revealed code has no business on paper. */
@media print { .reveal__value { display: none; } }

/* ── Phase 2: the schedule ────────────────────────────────────────────────── */

.daynav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0 1rem;
}
.daynav .btn { flex: 1 1 auto; }

.dayhead {
  margin: 1.25rem 0 0.4rem;
  font-size: 1rem;
  color: var(--muted);
  font-weight: 600;
}
.dayhead a { color: inherit; text-decoration: none; }
.dayhead a:hover { color: var(--accent); }

.row--closed .row__name { text-decoration: line-through; color: var(--muted); }
/* A finished job is not an error: neutral pill, and no row-wide opacity (it took the text under 4.5:1). */
.row--closed .pill--former { color: var(--muted); background: var(--surface-2); border-color: var(--border); }

.plain { list-style: none; margin: 0.5rem 0; padding: 0; }
.plain li { padding: 0.2rem 0; }

/* The month grid. It scrolls sideways on a phone rather than reflowing: a
 * calendar that reflows into a list is the week view with extra steps. */
.calendar-scroll { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.calendar {
  width: 100%;
  min-width: 34rem;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.8rem;
}
.calendar th {
  padding: 0.4rem 0.2rem;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.calendar td {
  height: 5rem;
  padding: 0.25rem;
  vertical-align: top;
  border: 1px solid var(--border);
  background: var(--surface);
  position: relative;
}
/* Dimmed rather than blank: an empty cell would read as "nothing scheduled",
 * which for a day in the next month would be a lie. */
.cal--outside { background: var(--bg); }
.cal--outside .cal__date { font-weight: 400; }
.cal--today { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal__date {
  display: block;
  min-height: 1.5rem;
  margin-bottom: 0.2rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}
.cal--today .cal__date { color: var(--accent); }
/* The date is a link to the day; stretched, so the whole cell is the target. The
 * visit pills sit above it and keep their own taps. */
.cal__date::after { content: ""; position: absolute; inset: 0; }
.cal__count { display: none; }
.cal__visit {
  position: relative;
  z-index: 1;
  display: block;
  min-height: 1.5rem;
  margin-bottom: 0.15rem;
  padding: 0.2rem 0.3rem;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.72rem;
  text-decoration: none;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.cal__visit--closed { color: var(--muted); text-decoration: line-through; }

/* ── Phase 3: timers and the hours review ────────────────────────────────── */

/* The timer face. Big, because it is read at arm's length in someone else's
 * hallway, and because it is the one number on the page that is changing. */
.timer-face { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; margin: 0.2rem 0 0.6rem; }
.timer-elapsed { font-size: 1.9rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pill--live { color: var(--ok); background: var(--ok-bg); border-color: transparent; }

/* Start and Finished side by side: two taps that must not be confused with
 * each other, so they are the same size and never move between renders. */
.timer-buttons { display: flex; gap: 0.6rem; }
.timer-buttons .btn { margin-top: 0.6rem; }

.entries { list-style: none; margin: 0.9rem 0 0; padding: 0.7rem 0 0; border-top: 1px solid var(--border); }
.entry { display: grid; grid-template-columns: 1fr auto; gap: 0 0.7rem; padding: 0.35rem 0; }
.entry__when { font-variant-numeric: tabular-nums; }
.entry__length { font-weight: 600; font-variant-numeric: tabular-nums; }
.entry .row__meta { grid-column: 1 / -1; padding: 0; }

.card--danger { border-color: var(--danger); }
.card--danger > h2 { color: var(--danger); }

/* One hours row: the visit above, the decision below. Stacked rather than
 * side by side because the number field wants a thumb, not a cursor. */
.hours-action {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  padding: 0.6rem 0.9rem 0.9rem;
  border-top: 1px solid var(--border);
}
.hours-action label { margin: 0; }
.hours-action .btn { width: auto; margin-top: 0; margin-left: auto; }
.hours-action .row__meta { padding: 0; }
/* `input.` and not just `.field--hours`: the base rule above matches
 * `input[type="number"]`, which is specificity (0,1,1) and beats a bare class
 * (0,1,0) — so `width: 100%` had always been winning and this box has never
 * actually been 5.5rem. It was merely less obvious in a 34rem column than in
 * a wide one. A field for "2.25" does not want the width of the page. */
input.field--hours {
  width: 5.5rem;
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.hours-unit { color: var(--muted); }
.hours-settled { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── Phase 4: invoices ───────────────────────────────────────────────────── */

/* The on-screen copy of an invoice. Same shape as the PDF so the two can be
 * compared at a glance, but using the app's own type rather than print's. */
.lines { width: 100%; border-collapse: collapse; margin-top: 0.4rem; }
.lines th { text-align: left; font-size: 0.78rem; text-transform: uppercase;
            letter-spacing: 0.05em; color: var(--muted); font-weight: 600;
            padding-bottom: 0.4rem; border-bottom: 1px solid var(--border); }
.lines td { padding: 0.5rem 0.4rem 0.5rem 0; border-bottom: 1px solid var(--surface-2);
            vertical-align: top; }
.lines .num { text-align: right; white-space: nowrap;
              font-variant-numeric: tabular-nums; }
.lines tfoot td { border-bottom: none; padding-top: 0.5rem; }
.lines tfoot .label { color: var(--muted); }
.lines tfoot .total td { padding-top: 0.7rem; border-top: 1px solid var(--text);
                         font-size: 1.05rem; font-weight: 700; }
.lines .btn--link { font-size: 0.85rem; color: var(--danger); }

/* A row that carries its own buttons — "Draft it", "Send a reminder". */
.row__actions { display: flex; flex-wrap: wrap; gap: 0.5rem;
                padding: 0 0.9rem 0.8rem; }
.row__actions .btn { width: auto; margin-top: 0; }

.pill--ok { color: var(--ok); background: var(--ok-bg); border-color: transparent; }

/* The client's account: payments in, statement out (2026-10-20). */
.balance { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.balance strong { font-size: 1.3rem; }
.row__actions--flush { padding: 0 0 0.4rem; }
.payments li { padding: 0.45rem 0; border-bottom: 1px solid var(--surface-2); }
.payments li:last-child { border-bottom: none; }
.payments del { color: var(--muted); }
details.reverse { margin-top: 0.25rem; }
details.reverse summary { cursor: pointer; font-size: var(--text-sm); color: var(--danger); }

/* ── Phase 6: the owner dashboard ─────────────────────────────────────────── */

/* Counts that link. One column on a phone, two once there is room for two.
 * No three-column rule: `.wrap` caps the page at 34rem however wide the
 * screen is, so a third column would only make the numbers smaller — and a
 * number you have to lean in to read is not a glance. */
.stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin: 1rem 0;
}
@media (min-width: 30rem) { .stats { grid-template-columns: repeat(2, 1fr); } }
/* Only inside a wide page — in a 34rem column a third column would shrink the
 * numbers below the point of a glance, which is what the note above says. */
@media (min-width: 62rem) {
  .wrap--wide .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  /* Two charts beside each other rather than one enormous one. */
  /* `minmax(0, 1fr)` and not `1fr`: a grid item defaults to `min-width: auto`,
   * so it refuses to shrink below its content and the column silently grows
   * past the page instead — a horizontal scrollbar and a second column half
   * off the screen. Applies to every grid on this page. */
  .wrap--wide .chartpair {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
  }
  .wrap--wide .chartpair > .card { margin-bottom: 0; }
  /* Tiles are navigation, and a full-width bar per destination reads as a
   * list of instructions rather than a set of choices. */
  .wrap--wide .tiles { grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
  .wrap--wide .tiles > .tile { min-width: 0; }

  /* The portal's lists are one column of rows in a page that is now wide, so
   * the rows get a readable cap and the page does not become a field of very
   * long, very short lines. */
  .wrap--wide .portal-cols {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
  }
  .wrap--wide .portal-cols > .card { margin-bottom: 0; }

  /* A filter bar laid out for a phone becomes a stack of 1100px-wide boxes on
   * a desktop. Same controls, one row, each no wider than it needs to be. */
  .wrap--wide .filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
  }
  .wrap--wide .filters > .field { flex: 0 1 22rem; }
  .wrap--wide .filters__row { margin-top: 0; flex: 0 1 26rem; }
  .wrap--wide .filters .check { margin: 0; white-space: nowrap; }
  .wrap--wide .filters .btn { width: auto; margin-top: 0; }
  .wrap--wide .filters--sort { align-items: flex-end; }
  .wrap--wide .filters--sort .filters__row { flex: 0 1 30rem; }

  /* Giving a page the screen must not give everything *on* it the screen.
   * `.btn` and `.field` are `width: 100%` because that is right on a phone;
   * inherited by a 1200px card it produces a 1200px-wide "Email it" button
   * and a 1200px-wide box for an e-transfer reference. A control should be as
   * wide as what goes in it. */
  .wrap--wide .btn { width: auto; min-width: 11rem; }
  .wrap--wide .field { max-width: 26rem; }
  .wrap--wide textarea.field { max-width: 44rem; }

  /* Four short columns stretched across the page put the description at one
   * edge and the amount at the other, and reading a line means tracking a
   * thousand pixels of whitespace. */
  .wrap--wide .lines { max-width: 46rem; }

  /* `flex: 1 1 auto` shares a phone's width between three buttons; on a
   * desktop it shares 1400px between them, and "This week" becomes a 400px
   * slab. They only ever needed to be as wide as their words. */
  .wrap--wide .daynav .btn { flex: 0 0 auto; min-width: 9rem; }

  /* The week, as a week. Seven stacked full-width strips is a phone layout
   * being asked to do a desk's job — one column per day is what somebody
   * looking at a whole week actually wants to see. */
  .wrap--wide .weekgrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 0.75rem 1rem;
    align-items: start;
  }
  .wrap--wide .weekgrid__day { min-width: 0; }
  .wrap--wide .weekgrid .dayhead { margin-top: 0; font-size: 0.9rem; }

  /* A suggestion reads as a headline with the saving pinned to the right of
   * it, once there is a right to pin it to. The buttons stop stretching for
   * the same reason every other control on a wide page does. */
  .wrap--wide .proposals > .proposal { max-width: 52rem; }
  .wrap--wide .proposal__buttons .btn { min-width: 8rem; }
  .wrap--wide .proposal__call .field { max-width: 30rem; }
}

/* Exactly seven columns once they fit. `auto-fit` alone lands on six at this
 * width and wraps Sunday onto a line of its own, which stops looking like a
 * week — the one thing this view is for. */
@media (min-width: 78rem) {
  .wrap--wide .weekgrid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
}

.stat {
  display: block;
  padding: 0.9rem var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  min-height: var(--tap);
}
.stat:hover, .stat:focus-visible { border-color: var(--accent); }
.stat-value { display: block; font-size: var(--text-2xl); line-height: var(--leading-tight); font-weight: 600; }
.stat strong { display: block; font-size: 0.95rem; }
.stat-detail { display: block; color: var(--muted); font-size: var(--text-sm); }

/* Tone marks the edge, never the text: colour is the second signal here, and
 * the number and its caption say the same thing without it. */
.stat--warn { border-left-color: var(--warn); }
.stat--bad  { border-left-color: var(--danger); }

.card--running { border-left: 4px solid var(--ok); }
.card--running .footnote { margin-left: 0.4rem; }

/* Charts are SVG, not divs with an inline `style="height: …%"`. The CSP is
 * `style-src 'self'` with no 'unsafe-inline', so a style attribute is refused
 * by the browser and every bar draws flat — silently, since the page is still
 * a 200 with the right numbers in it. A geometry attribute on a <rect> is not
 * CSS and is not covered by style-src. Colour comes from here, so the chart
 * follows the palette in both themes. */
/* `height: auto` so the viewBox scales uniformly — the chart has text in
 * it, and a fixed height would stretch the glyphs at every width but one. */
/* Capped so a wide page does not turn a twelve-bar chart into a mural. The
 * cap is on WIDTH, not height: the chart carries text, and fixing its height
 * while the width still stretches is what squashes the glyphs. */
.chart {
  display: block;
  width: 100%;
  max-width: 34rem;
  height: auto;
  margin: 0.75rem 0 0.25rem;
}
.chart-track { fill: var(--surface-2); }
.chart-fill  { fill: var(--accent); }
.chart-label { fill: var(--muted); font-size: 7px; }

/* Hours by cleaner: horizontal, because names are long and there are few. */
.barlist li {
  display: grid;
  grid-template-columns: minmax(4.5rem, auto) 1fr auto;
  align-items: center;
  gap: 0.6rem;
  margin: 0.4rem 0;
}
.barlist-chart { display: block; width: 100%; height: 0.8rem; }
.barlist-value { font-variant-numeric: tabular-nums; font-size: 0.9rem; }

/* The access log's filter bar wraps rather than scrolls. A modifier, not a
 * redefinition of `.filters` — that class is already worn by the client,
 * hours and invoice filter bars, and quietly turning them all into flex rows
 * would be a change to three pages this phase never meant to touch. */
.filters--log { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.filters--log .field { flex: 1 1 8rem; min-width: 0; }
.filters--log .btn { width: auto; }
.filters--log__date {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  flex: 1 1 10rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.filters--log__date .field { flex: 1 1 auto; }

/* ── The auto-scheduler ─────────────────────────────────────────────────────
 * A suggestion is a paragraph of numbers with buttons under it, and on a
 * phone that is exactly what it should look like: one column, in reading
 * order. Everything that arranges those parts side by side lives in the
 * media query below, because a phone has no side. */
.proposal__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1rem; }
.proposal__title { margin: 0; flex: 1 1 12rem; }
.proposal__saving { margin: 0; white-space: nowrap; }
.proposal__minutes { font-size: 1.4rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.proposal__move { margin: 0.5rem 0 0.2rem; font-size: 1.05rem; }
.proposal__arrow { color: var(--muted); margin: 0 0.35rem; }
.proposal__reasons { margin: 0.5rem 0 0; display: flex; flex-wrap: wrap; gap: 0.3rem; }
/* The sentence under a row arrives after the page does. Reserving a line for
 * it keeps the buttons from jumping half a centimetre under the reader's
 * thumb the moment it lands. */
.proposal__prose { margin: 0.6rem 0 0; min-height: 1.4em; color: var(--muted); }
.proposal__stops { margin: 0.5rem 0 0; padding-left: 1.2rem; }
.proposal__stops li { margin: 0.25rem 0; }
.proposal__stop-when { font-variant-numeric: tabular-nums; margin-right: 0.4rem; }
.proposal__buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.proposal__call { margin-top: 0.75rem; padding-top: 0.6rem; border-top: 1px solid var(--border); }
.proposal__phone { margin: 0 0 0.4rem; }
.findrun { margin: 0.75rem 0 1rem; }
.findrun__state { margin: 0 0 0.5rem; }
/* The map section of the property form. A fieldset, because the browser's own
 * grouping is what tells a screen reader that the radios and the two boxes are
 * one question. */
.geobox { border: 1px solid var(--border); border-radius: 8px; padding: 0.8rem 1rem; margin: 1rem 0; }
.geobox legend { padding: 0 0.4rem; color: var(--muted); font-size: 0.9rem; }
.geobox__status { margin: 0 0 0.4rem; }
.geobox ul { list-style: none; margin: 0.2rem 0 0.6rem; padding: 0; }
.geobox li { margin: 0.2rem 0; }

/* ── Skip link ──────────────────────────────────────────────────────────────
 * Off-screen until it has focus, then a real button in the corner. The same
 * geometry trick as .visually-hidden, undone on :focus rather than never. */
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  padding: 0.6rem 1rem; min-height: 44px; display: inline-flex; align-items: center;
  background: var(--surface); color: var(--accent);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.skip:focus { left: 1rem; top: 1rem; }
main:focus { outline: none; }   /* the skip link lands here; the ring belongs on controls, not the page */

/* ── Working now ────────────────────────────────────────────────────────────
 * The signed-in person's own running timer, under the masthead on every page.
 * A strip, not a card: it is a reminder, and it must not push the day down. */
.working-now {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem;
  min-height: 44px; padding: 0.4rem 1rem;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  color: var(--text); text-decoration: none; font-size: 0.9rem;
}

/* ── Timer confirm ──────────────────────────────────────────────────────────
 * The question sits above the buttons on purpose: a second tap at the spot
 * where Finished was lands on text, not on "Yes, finished". */
.timer-confirm { margin: 0.8rem 0 0; }

/* ── Field groups ───────────────────────────────────────────────────────────
 * The settings screen's sections: the same look as the property form's map
 * fieldset, so a grouped form reads the same everywhere. */
.fieldgroup { border: 1px solid var(--border); border-radius: 8px; padding: 0.8rem 1rem; margin: 1rem 0; }
.fieldgroup legend { padding: 0 0.4rem; color: var(--muted); font-size: 0.9rem; }
.fieldgroup > .lede { margin-top: 0; }

/* ── Checklist ──────────────────────────────────────────────────────────────
 * What has to be true before a switch goes on. The pill says yes, not yet, or
 * note; the words say why; colour is never the only signal. */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist__item { display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 0.6rem; align-items: baseline; padding: 0.5rem 0; border-top: 1px solid var(--border); }
.checklist__item:first-child { border-top: 0; }
.checklist__item .footnote { grid-column: 2; margin: 0; }

/* ── Persistent navigation ──────────────────────────────────────────────────
 * The owner's four places, on a bar the thumb can reach. Only the owner has
 * enough destinations to need one; a cleaner has one screen and a client has
 * one page, and both get there through the brand link. Phone first: fixed to
 * the bottom; from 48rem a strip under the masthead. */
.navbar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);   /* viewport-fit=cover, base.html */
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.navbar__item {
  flex: 1 1 0;
  min-width: 0;
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: -1px;                     /* sits on the bar's own rule */
  padding: var(--space-2) var(--space-1);
  border-top: 2px solid transparent;    /* the rule the current item lights */
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-decoration: none;
}
/* Colour, weight and the rule all change: the gold is a flourish, never the
 * only signal, which is the condition the header puts on it. */
.navbar__item[aria-current="page"] { color: var(--accent); border-top-color: var(--gold-bright); }
/* Room for the bar. It precedes <main> in the DOM, so a sibling combinator
 * reaches it — no class on <body>. */
.navbar ~ .wrap { padding-bottom: calc(var(--space-7) + var(--tap) + env(safe-area-inset-bottom)); }

@media (min-width: 48rem) {
  .navbar {
    position: static;
    justify-content: flex-start;
    gap: var(--space-1);
    padding: 0 var(--space-4);
    border-top: 0;
    border-bottom: 1px solid var(--border);
  }
  .navbar__item {
    flex: 0 0 auto;
    margin: 0 0 -1px;
    padding: var(--space-3);
    border-top: 0;
    border-bottom: 2px solid transparent;
    font-size: var(--text-sm);
  }
  .navbar__item[aria-current="page"] { border-bottom-color: var(--gold-bright); }
  .navbar ~ .wrap { padding-bottom: var(--space-7); }
}
@media print { .navbar, .who { display: none !important; } }

/* ── Tips ───────────────────────────────────────────────────────────────────
 * A small (i) with one sentence behind it. The sentence is a native popover:
 * `popovertarget` opens it, a second press or Escape closes it, a tap
 * elsewhere closes it, and none of that is script.
 *
 * Hover, with no script, is done by overriding the browser's own rule that a
 * closed popover is display:none — author rules beat user-agent rules on
 * origin, whatever the specificity. While the pointer is on the (i) the
 * sentence is drawn in place under it, not in the top layer; it is still
 * "closed", so the next tap opens it properly. Only pointers that can hover
 * get that rule: a phone's sticky :hover would fight the toggle.
 *
 * For the same reason, `display` is NEVER set on .tip__body outside those two
 * guarded states. An unconditional display:block would beat the user-agent's
 * display:none and leave every closed tip permanently visible. A browser that
 * has never heard of popover renders the span inline anyway, which is the
 * right thing for it to do.
 *
 * The (i) is drawn at 20px and hit at 44px: the button is the full tap size
 * and pulls its neighbours back in with a negative margin. */
.tip { position: relative; display: inline-flex; align-items: center; vertical-align: middle; margin-inline: var(--space-1); }
.tip__button {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: var(--tap); min-height: var(--tap);
  margin: calc((var(--tap) - 1.25rem) / -2);
  padding: 0; border: 0; background: none; border-radius: 999px;
  color: var(--muted); cursor: pointer;
}
.tip__glyph {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.25rem; height: 1.25rem;
  border: 1px solid currentColor; border-radius: 999px;
  font: italic 700 0.8rem/1 "Didot", "Bodoni MT", "Playfair Display", Georgia, serif;
}
.tip__button:hover .tip__glyph { color: var(--accent); }
/* The ring is the 20px thing you see; the outline goes round it, not the 44px box. */
.tip__button:focus-visible { outline: none; }
.tip__button:focus-visible .tip__glyph { outline: 2px solid var(--accent); outline-offset: 2px; color: var(--accent); }
/* The type of the sentence, wherever it is drawn. Resets what a pill or a
 * stat would otherwise hand down. No `display` here — see above. */
.tip__body {
  max-width: 24rem;
  color: var(--text);
  font-size: var(--text-sm); font-weight: 400; line-height: var(--leading);
  letter-spacing: 0; text-transform: none; text-align: start;
}

@supports selector(:popover-open) {
  /* Hovered, still closed: drawn in place under the (i). `:not(:popover-open)`
   * is load-bearing: a mouse that clicks the (i) is still over it, and if
   * this rule also matched the open state it would outrank the open rule
   * below on specificity — and `top: 100%` on a top-layer element resolves
   * against the viewport, which put the open card below the fold. */
  @media (hover: hover) {
    .tip:hover > .tip__body:not(:popover-open) {
      display: block;
      position: absolute; z-index: 2; top: 100%; inset-inline-start: 0;
      width: max-content; max-width: min(22rem, 80vw);
      margin: var(--space-1) 0 0; padding: var(--space-2) var(--space-3);
      background: var(--surface);
      border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow);
    }
  }
  /* Open: the top layer. Phone first — a sheet along the bottom, where the
   * thumb is. */
  .tip__body:popover-open {
    position: fixed; inset: auto 0 0 0; margin: 0;
    width: auto; max-width: none;
    padding: var(--space-4) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom));
    background: var(--surface);
    border: 1px solid var(--border); border-bottom: 0;
    border-radius: var(--radius) var(--radius) 0 0; box-shadow: var(--shadow);
    font-size: var(--text-md);
  }
  .tip__body::backdrop { background: rgba(31, 29, 27, 0.15); }

  /* A desk: a card, bottom-centre, where a toast would go. */
  @media (min-width: 48rem) {
    .tip__body:popover-open {
      inset: auto 0 var(--space-4) 0; margin: 0 auto;
      width: max-content; max-width: 24rem;
      padding: var(--space-3) var(--space-4);
      border-bottom: 1px solid var(--border); border-radius: var(--radius-sm);
      font-size: var(--text-sm);
    }
    .tip__body::backdrop { background: transparent; }
  }
}

/* Anchored under the (i) that opened it, where the browser can. The anchor
 * is the popover's own invoker — the only anchor a CSP with no inline styles
 * can give a repeated component. Nothing above depends on this tier. */
@supports (position-area: block-end) {
  @media (min-width: 48rem) {
    .tip__body:popover-open {
      inset: auto; margin: var(--space-1) 0 0;
      position-area: block-end span-inline-end;
      position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;
    }
  }
}
@media (prefers-reduced-motion: reduce) {
  [popover], .tip__body { transition: none; animation: none; }
}

/* A label and its (i) on one line. The margin the bare label carried moves
 * up here; a label outside this row keeps its own. */
.labelrow { display: flex; align-items: center; gap: var(--space-1); margin: 0.9rem 0 var(--space-1); }
.labelrow > label { margin: 0; }

/* ── Empty states ───────────────────────────────────────────────────────────
 * What would fill this list, and the one thing to do about it. The sentence
 * first, then the button and the help link on one line. */
.empty { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.empty__text { flex: 1 1 100%; margin: 0; }
.empty .btn { margin-top: 0; }
.empty__help { font-size: var(--text-sm); }

/* The tile's link covers the number and the caption; the (i), when there is
 * one, sits beside the detail line outside it. */
.stat__link { display: block; min-height: var(--tap); color: inherit; text-decoration: none; }
.stat__link:hover .stat-value, .stat__link:focus-visible .stat-value { color: var(--accent); }

/* A page whose heading sits inside its card — the help pages, the settings
 * screen, the account page, the 404 — reads at the pagehead's size, not the
 * browser's default h1. */
.card > h1 { margin-top: 0; font-size: var(--text-xl); }

/* Inside the strip, the meta is one phrase on the line, not a row's block. */
.working-now .row__meta { display: inline; padding: 0; }

/* ── Guided tours ───────────────────────────────────────────────────────────
   A tour step is prose with a mock of the region under discussion, built from
   the classes above so it looks like the thing it describes. The mock is not
   interactive: nothing in it is focusable, and the pointer passes over it.
   `.mock__focus` is the gold ring round the part being talked about, and the
   `:target` rule draws the same ring on the real page when "Show me there"
   lands on it — pure CSS, no state. */
.card--offer { border-left: 4px solid var(--gold-bright); }
/* Visits a schedule change left behind, with the button to cancel them (TODO #32). */
.card--stray { border-left: 4px solid var(--warn); }
.offer__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.offer__actions form { margin: 0; }
.walk__progress { margin: 0 0 var(--space-2); }
.walk__nav {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--space-3); margin-top: var(--space-5);
}
.walk__nav form { margin: 0; }
.mock { pointer-events: none; user-select: none; margin: var(--space-4) 0; }
.mock .card { margin: 0; box-shadow: none; background: var(--surface-2); }
.mock .card + .card { margin-top: var(--space-3); }
.mock__focus { outline: 3px solid var(--gold-bright); outline-offset: 3px; border-radius: var(--radius-sm); }
.card:target, .row:target, .rows:target, .stats:target {
  outline: 3px solid var(--gold-bright); outline-offset: 3px;
}

/* ── The client FAQ ─────────────────────────────────────────────────────────
   Question and answer as a definition list: the question in the row's weight,
   the answer under it, no indent — the wrap is 34rem and an indent would
   spend a tenth of a phone on nothing. */
.faq { margin: 0 0 var(--space-4); }
.faq dt { font-weight: 600; margin-top: var(--space-3); }
.faq dd { margin: var(--space-1) 0 0; }

/* ── The logo field ─────────────────────────────────────────────────────────
   A picture of the logo that is there, the checkbox that removes it, and one
   file control to replace it — see core/templates/core/widgets/logo.html. The
   preview sits on the muted surface so a logo with a transparent background
   still reads as a thing in a box. */
.logo-input { display: grid; gap: var(--space-2); justify-items: start; }
.logo-input__preview {
  max-height: 3.5rem; max-width: 14rem;
  padding: var(--space-2) var(--space-3);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.logo-input .check { margin-top: 0; }
.field--file { padding: 0.45rem 0.7rem; font-size: var(--text-sm); cursor: pointer; }
.field--file::file-selector-button {
  min-height: calc(var(--tap) - 0.9rem); margin-right: var(--space-3);
  padding: 0 var(--space-3); font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer;
}

/* ── NEB-369: portal forms and a11y (UI-P-11, UI-P-15) ──────────────────────
   The two tiles on the portal home sat flush against the next card. A phone
   number or e-mail is a link, with a 44px box so a thumb can hit it. */
.tiles--spaced { margin-bottom: var(--space-3); }
.contact-link {
  display: flex; width: fit-content; align-items: center;
  min-height: var(--tap);
}

/* ── NEB-368: the schedule on a phone (UI audit S-01, S-03, S-12, S-19) ───── */

/* Week: the day heading is the way into a day, so it is a 44px target. */
.dayhead a {
  display: inline-flex; align-items: center;
  min-height: var(--tap); margin-block: calc((1.5rem - var(--tap)) / 2);
}
.empty__help { display: inline-flex; align-items: center; min-height: var(--tap); padding-inline: var(--space-1); }

/* Month: seven columns of 46px cannot hold a client's name, so under 48rem a
 * day is a number and a count, and the whole cell opens that day. The names
 * come back at 48rem. */
@media (max-width: 47.99rem) {
  .calendar { min-width: 0; }
  .calendar td { height: 3.75rem; padding: 0; }
  .calendar .cal__visit { display: none; }
  .cal__date {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.1rem;
    min-height: 3.75rem; margin: 0; font-size: var(--text-md);
  }
  .cal__count {
    display: inline-block; min-width: 1.4rem; padding: 0 0.3rem;
    font-size: var(--text-xs); font-weight: 700; line-height: 1.3rem; text-align: center;
    color: var(--accent-text); background: var(--accent); border-radius: 999px;
  }
}

/* ── NEB-370: staff forms and focus (UI audit S-04, S-06, S-12, S-23) ──────── */

/* S-04: the fixed bottom bar must not cover the control you just tabbed to.
 * Same breakpoint as the bar itself (48rem, see .navbar). */
@media (max-width: 47.99rem) {
  html { scroll-padding-bottom: calc(var(--tap) + env(safe-area-inset-bottom) + var(--space-4)); }
}

/* S-23: while a once-only form is on its way, its button says so. */
button:disabled { opacity: 0.6; cursor: progress; }

/* S-12: "Reverse" is a <summary>, so it is a control and gets a control's height. */
details.reverse summary {
  display: flex; align-items: center; min-height: var(--tap);
}

/* S-06: the draft invoice's remove button was a 15px underlined word. It is
 * the only destructive control in the table, so it gets a full 44px box. */
.lines .btn--link {
  display: inline-flex; align-items: center; justify-content: center;
  width: auto; min-height: var(--tap); padding-inline: var(--space-2);
}
.lines td form { margin: 0; }
/* The same for the lone destructive link under a card's buttons (Discard this draft). */
.card > form > .btn--link { min-height: var(--tap); padding-block: var(--space-2); }

/* S-06: under 40rem each line is a card — what, then hours / rate / amount
 * under their own labels, then a full-width Remove — instead of a four-column
 * table that ran past its card at 360px. The markup keeps its table roles. */
@media (max-width: 39.99rem) {
  .lines, .lines tbody, .lines tfoot, .lines tr, .lines td { display: block; }
  .lines thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
  }
  .lines tbody tr {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-1) var(--space-3);
    padding: var(--space-3) 0; border-bottom: 1px solid var(--surface-2);
  }
  .lines tbody td { padding: 0; border: 0; }
  .lines .lines__what { grid-column: 1 / -1; overflow-wrap: anywhere; }
  .lines tbody .num { text-align: left; }
  .lines tbody td[data-label]::before {
    content: attr(data-label); display: block;
    font-size: var(--text-xs); font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--muted);
  }
  .lines .lines__remove { grid-column: 1 / -1; margin-top: var(--space-2); }
  .lines .lines__remove .btn--link {
    display: flex; width: 100%; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: var(--radius-sm); text-decoration: none;
  }
  .lines tfoot tr { display: flex; justify-content: space-between; gap: var(--space-3); }
  .lines tfoot td { padding-inline: 0; }
  .lines tfoot td[colspan] { flex: 1; }
  .lines tfoot td:empty { display: none; }
  .lines tfoot .total { border-top: 1px solid var(--text); }
  .lines tfoot .total td { border-top: 0; }
}

/* ── NEB-371: minor sweep (UI audit S-13, S-16; Board: invoice tabs and sort) ── */

/* S-13: a tab is a 44px target, not a 34px pill. The pill look stays: the
 * extra height is padding-free (min-height), so the text sits centred in it. */
.tab { display: inline-flex; align-items: center; min-height: var(--tap); padding-block: 0; }

/* The Paid tab's two selects: the second one's labels ("Newest / Z–A first")
 * are short enough for half a phone, but under 30rem they stack anyway, so
 * the text of a long option is never the thing that decides. */
@media (max-width: 29.99rem) {
  .filters--sort .filters__row { flex-direction: column; gap: var(--space-2); }
}

/* S-16: what htmx would inject as an inline <style> (blocked by the CSP and
 * logged on every page); includeIndicatorStyles is off in base.html. */
.htmx-indicator { opacity: 0; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; transition: opacity 200ms ease-in; }

/* ── NEB-371 part 2: minor sweep (UI audit UI-P-10, UI-P-12, UI-P-13, S-17, S-20) ── */

/* UI-P-13: the smallest text was 11.2px (pills, status chips). 12.5px. */
:root { --text-2xs: 0.78rem; }

/* UI-P-12: a part-paid invoice that is late shows both pills, side by side. */
.pills { display: inline-flex; gap: var(--space-1); }
/* Wrap the header rather than squeeze the number (INV-2026-0002 broke at its hyphen). */
.pagehead:has(> .pills) { flex-wrap: wrap; }
.pagehead:has(> .pills) h1 { white-space: nowrap; }

/* S-20: the visit's address is a map link; the whole line is the 44px target. */
.address__link {
  display: inline-flex; align-items: center; min-height: var(--tap);
  color: var(--text);
}

/* S-17: the billed-by-month labels were 7 viewBox units, about 8px on a 360px
 * phone. 9.5 units is about 11px there; the amounts sit on two alternating
 * rows in the SVG so neighbours do not overlap. From 48rem the chart is
 * capped at 34rem wide, where 7 units already reads at 15px. */
@media (max-width: 47.99rem) {
  .chart-label { font-size: 9.5px; }
  /* The outer bars' amounts are wider than the bar: let them spill into the card's padding. */
  .chart { overflow: visible; }
}
