/*
 * Habitat One suite layout, identity v1.3.7 (SD-0142; 1.3 and 1.3.1 accepted by Ilse 2026-11-12, 1.3.5 and 1.3.6 on 2026-11-13, 1.3.6.1 on 2026-11-14, 1.3.7 on 2026-11-17).
 * One stylesheet for the frame and the common parts of every product page:
 * the left bar, the right-hand product band, the organisation switch, the page, tables,
 * forms, buttons, panels, statuses, empty states, the action page and the phone.
 * It uses only the identity's named colours, spacing and font (tokens/colours.css,
 * tokens/fonts.css, tokens/product-lockups.css, loaded before it). It invents no colour.
 * The written rules are VISUAL-IDENTITY.md section 8, "Page layout".
 *
 * Products copy this file unchanged. Never edit a product's copy: propose the change here.
 */

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

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

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

body {
  margin: 0;
  font-family: var(--h1-font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--h1-text);
  background: var(--h1-surface);
  overflow-wrap: break-word;
}

h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 700; }
p { margin: 0; }
a { color: var(--h1-text); }
img { max-width: 100%; }

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

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

.h1-skip-link {
  position: absolute; left: var(--h1-space-16); top: -100px; z-index: 30;
  background: var(--h1-white); padding: var(--h1-space-12) var(--h1-space-16);
  border-radius: var(--h1-radius-control);
}
.h1-skip-link:focus { top: var(--h1-space-16); }

/* ---------- The frame: left bar + page ---------- */

.h1-app {
  --h1-nav-width: 280px;
  --h1-rail-width: 80px;
  --h1-page-gutter: clamp(16px, 3vw, 48px);
  display: grid;
  grid-template-columns: var(--h1-nav-width) minmax(0, 1fr) var(--h1-rail-width);
  min-height: 100vh;
}

/* The left bar. Sticky, so it stays while the page scrolls; scrolls itself if it is long. */
.h1-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--h1-space-16);
  padding: var(--h1-space-16);
  background: var(--h1-white);
  border-right: 1px solid var(--h1-divider);
}

.h1-nav-brand {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--h1-space-12) var(--h1-space-8) var(--h1-space-8);
}
/* 40px high is 158px wide: above the identity's 140px minimum, like the live site. */
.h1-nav-brand img { height: 40px; width: auto; display: block; }

/* Which product you are in, and the switch to another. A <details> needs no script. */
.h1-switcher { position: relative; }
.h1-switcher > summary {
  list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: var(--h1-space-8);
  min-height: 52px; padding: var(--h1-space-8) var(--h1-space-12);
  border: 1px solid var(--h1-control-border);
  border-radius: var(--h1-radius-control);
  cursor: pointer;
}
.h1-switcher > summary::-webkit-details-marker { display: none; }
.h1-switcher > summary::after {
  content: ""; width: 8px; height: 8px; flex: none; margin-right: 4px;
  border-right: 2px solid var(--h1-text); border-bottom: 2px solid var(--h1-text);
  transform: rotate(45deg) translateY(-3px);
}
.h1-switcher[open] > summary::after { transform: rotate(-135deg) translateY(-1px); }
.h1-nav { --h1-lockup-height: 32px; }
.h1-switcher-list {
  list-style: none; margin: var(--h1-space-4) 0 0; padding: var(--h1-space-8);
  position: absolute; left: 0; right: 0; z-index: 20;
  background: var(--h1-white);
  border: 1px solid var(--h1-control-border);
  border-radius: var(--h1-radius-control);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--h1-blue) 12%, transparent);
}
.h1-switcher-list a {
  display: flex; align-items: center; min-height: 44px; padding: 0 var(--h1-space-8);
  border-radius: var(--h1-radius-control);
}
.h1-switcher-list a:hover { background: var(--h1-surface-subtle); }
.h1-switcher-list [aria-current="true"] { background: var(--h1-surface-subtle); }
/* 1.3.1: a product not live yet, greyed in the switch as in the band, says "Coming soon" when clicked. */
.h1-switcher-list button {
  font: inherit; display: flex; align-items: center; gap: var(--h1-space-8); width: 100%;
  min-height: 44px; padding: 0 var(--h1-space-8); border: 0; border-radius: var(--h1-radius-control);
  background: none; cursor: pointer; text-align: left; font-size: 12px; color: var(--h1-text-muted);
}
.h1-switcher-list button img { opacity: 0.4; filter: grayscale(1); }

/* The menu. Top items, then a sub-menu under the open one. */
.h1-menu, .h1-submenu { list-style: none; margin: 0; padding: 0; }
.h1-menu { display: flex; flex-direction: column; gap: 2px; }

.h1-menu a {
  display: flex; align-items: center; gap: var(--h1-space-12);
  min-height: 40px; padding: var(--h1-space-8) var(--h1-space-12);
  border-radius: var(--h1-radius-control);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.3;
}
.h1-menu a:hover { background: var(--h1-surface); }
.h1-menu a[aria-current="page"] { background: var(--h1-action); color: var(--h1-action-text); font-weight: 700; }
.h1-menu a[aria-current="page"]:not(:has(.h1-menu-count))::after { content: ""; width: 6px; height: 6px; margin-left: auto; background: var(--h1-accent); flex: none; }
.h1-menu-open > a { font-weight: 700; }
.h1-menu svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; }

.h1-menu-count {
  margin-left: auto; min-width: 24px; padding: 0 var(--h1-space-8);
  border-radius: 12px; text-align: center;
  font-size: 12px; font-weight: 700; line-height: 22px;
  background: var(--h1-accent); color: var(--h1-blue);
}

.h1-submenu {
  margin: 2px 0 var(--h1-space-8) 21px;
  padding-left: var(--h1-space-12);
  border-left: 1px solid var(--h1-divider);
  display: flex; flex-direction: column; gap: 2px;
}
.h1-submenu-title {
  padding: var(--h1-space-8) var(--h1-space-8) var(--h1-space-4);
  font-size: 12px; font-weight: 700; color: var(--h1-text-muted);
}
.h1-submenu a { min-height: 36px; font-size: 13px; padding: var(--h1-space-8) var(--h1-space-8); }

.h1-menu-label {
  padding: var(--h1-space-16) var(--h1-space-12) var(--h1-space-4);
  font-size: 12px; font-weight: 700; color: var(--h1-text-muted);
}

/* 1.3.6.1 (Ilse): an item with an open sub-menu gets a small chevron on its right (added by h1-layout.js);
   it folds the sub-menu away and opens it again. No product draws it. */
.h1-menu li.h1-has-sub { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 2px; }
.h1-menu li.h1-has-sub > .h1-submenu { grid-column: 1 / -1; }
.h1-sub-toggle {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 32px; height: 32px; padding: 0; border: 0; border-radius: var(--h1-radius-control);
  background: none; color: var(--h1-text); cursor: pointer;
}
.h1-sub-toggle:hover { background: var(--h1-surface); }
.h1-sub-toggle::before {
  content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px); transition: transform 0.15s ease;
}
.h1-sub-closed > .h1-sub-toggle::before { transform: rotate(-45deg) translate(-1px, -1px); }
.h1-sub-closed > .h1-submenu { display: none; }
@media (prefers-reduced-motion: reduce) { .h1-sub-toggle::before { transition: none; } }
/* Touch screens (principle 4, 1.3.6.1): a 44px hit area round the arrow; the arrow is drawn the same. */
@media (max-width: 959px), (pointer: coarse) {
  .h1-sub-toggle { position: relative; }
  .h1-sub-toggle::after { content: ""; position: absolute; inset: -6px; }
}

.h1-nav-foot {
  margin-top: auto;
  padding-top: var(--h1-space-16);
  border-top: 1px solid var(--h1-divider);
  display: flex; flex-direction: column; gap: var(--h1-space-8);
}
.h1-account {
  display: flex; align-items: center; justify-content: space-between; gap: var(--h1-space-8);
  padding: 0 var(--h1-space-4) 0 var(--h1-space-12);
  font-size: 13px; font-weight: 700;
  min-width: 0;
}
.h1-account span { min-width: 0; overflow-wrap: anywhere; }

/* ---------- The right-hand product band ---------- */

/* A narrow band down the right edge: every product's mark, one click to jump. */
.h1-rail {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; gap: var(--h1-space-4);
  padding: var(--h1-space-16) 0;
  background: var(--h1-surface-subtle);
  border-left: 1px solid var(--h1-divider);
}
.h1-rail a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: 68px; padding: var(--h1-space-4) 0 var(--h1-space-8);
  border-radius: var(--h1-radius-control);
  font-size: 11px; font-weight: 700; line-height: 1.2; text-decoration: none;
}
.h1-rail a:hover { background: var(--h1-white); }
.h1-rail a[aria-current="true"] { background: var(--h1-white); box-shadow: inset 0 -3px 0 var(--h1-accent); }
.h1-rail img { width: 48px; height: 48px; display: block; }
/* A product not live yet: greyed, says "Coming soon" when clicked. */
.h1-rail button {
  font: inherit; display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: 68px; padding: var(--h1-space-4) 0 var(--h1-space-8);
  border: 0; border-radius: var(--h1-radius-control); background: none; cursor: pointer;
  font-size: 11px; font-weight: 700; line-height: 1.2; color: var(--h1-text-muted);
}
.h1-rail button img { opacity: 0.4; filter: grayscale(1); }
.h1-rail-soon { font-size: 10px; font-weight: 500; }
.h1-toast {
  position: fixed; right: calc(var(--h1-rail-width) + var(--h1-space-16)); bottom: var(--h1-space-24); z-index: 30;
  max-width: min(360px, calc(100vw - 32px));
  padding: var(--h1-space-12) var(--h1-space-16); border-radius: var(--h1-radius-panel);
  background: var(--h1-action); color: var(--h1-action-text); font-size: 14px;
}

/* ---------- Which organisation you are working in ---------- */

/* Several organisations: a switch, with "All organisations" first.
   One organisation: just its name, no switch. */
.h1-context { display: flex; flex-direction: column; gap: var(--h1-space-4); padding: 0 var(--h1-space-4); }
.h1-context-label { font-size: 12px; font-weight: 700; color: var(--h1-text-muted); padding-left: var(--h1-space-8); }
.h1-context-name { padding: var(--h1-space-4) var(--h1-space-8); font-size: 14px; font-weight: 700; }
.h1-context details { position: relative; }
.h1-context summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: var(--h1-space-8);
  min-height: 44px; padding: var(--h1-space-8) var(--h1-space-12);
  border-radius: var(--h1-radius-control); background: var(--h1-surface-subtle);
  font-size: 14px; font-weight: 700;
}
.h1-context summary::-webkit-details-marker { display: none; }
.h1-context summary::after {
  content: ""; width: 7px; height: 7px; flex: none; margin-right: 4px;
  border-right: 2px solid var(--h1-text); border-bottom: 2px solid var(--h1-text);
  transform: rotate(45deg) translateY(-3px);
}
.h1-context ul {
  list-style: none; margin: var(--h1-space-4) 0 0; padding: var(--h1-space-8);
  position: absolute; left: 0; right: 0; z-index: 20;
  background: var(--h1-white); border: 1px solid var(--h1-control-border);
  border-radius: var(--h1-radius-control);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--h1-blue) 12%, transparent);
}
.h1-context ul a { display: flex; align-items: center; justify-content: space-between; gap: var(--h1-space-8); min-height: 40px; padding: 0 var(--h1-space-8); border-radius: var(--h1-radius-control); font-size: 14px; text-decoration: none; }
.h1-context ul a:hover, .h1-context ul [aria-current="true"] { background: var(--h1-surface-subtle); }
.h1-context ul li + li.h1-context-all-after { border-top: 1px solid var(--h1-divider); margin-top: var(--h1-space-4); padding-top: var(--h1-space-4); }

/* The organisation an item belongs to, when you see several at once. */
.h1-org-tag { display: inline-block; padding: 1px var(--h1-space-8); border-radius: 10px; background: var(--h1-surface-subtle); color: var(--h1-text); font-size: 12px; font-weight: 700; }

/* ---------- The page ---------- */

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

/* The thin line above every page: where you are, and the phone's menu button. */
.h1-pagebar {
  display: flex; align-items: center; gap: var(--h1-space-12);
  min-height: 60px;
  padding: var(--h1-space-8) var(--h1-page-gutter);
  border-bottom: 1px solid var(--h1-divider);
  background: var(--h1-surface);
}
.h1-trail { display: flex; flex-wrap: wrap; gap: var(--h1-space-4) var(--h1-space-8); margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--h1-text-muted); }
.h1-trail li + li::before { content: "›"; margin-right: var(--h1-space-8); }
.h1-trail a { color: var(--h1-text-muted); }
.h1-trail [aria-current="page"] { color: var(--h1-text); font-weight: 700; }

.h1-nav-toggle { display: none; }

/* The page's content. Starts beside the bar, never centred in the window.
   On very wide screens it stops at 1600px, so tables don't stretch past reading. */
.h1-page {
  width: 100%;
  max-width: 1600px;
  padding: var(--h1-space-32) var(--h1-page-gutter) var(--h1-space-96);
  display: flex; flex-direction: column; gap: var(--h1-space-24);
}

.h1-page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: var(--h1-space-16) var(--h1-space-24);
  padding: var(--h1-space-32);
  border-radius: var(--h1-radius-panel);
  background: var(--h1-surface-subtle);
}
.h1-page-head > div { flex: 1 1 420px; min-width: 0; max-width: 72ch; }
.h1-kicker { font-size: 12px; font-weight: 700; color: var(--h1-text-muted); margin-bottom: var(--h1-space-4); }
.h1-page-head h1 { font-size: clamp(28px, 2.2vw, 36px); font-weight: 500; letter-spacing: -0.03em; }
.h1-page-head h1::after { content: ""; display: inline-block; width: 0.2em; height: 0.2em; margin-left: 0.12em; background: var(--h1-accent); }
.h1-lead { margin-top: var(--h1-space-8); color: var(--h1-text-muted); max-width: 72ch; }

/* Prose stays readable however wide the window. */
.h1-prose { max-width: 72ch; }
.h1-prose > * + * { margin-top: var(--h1-space-12); }

/* ---------- Panels and groups ---------- */

.h1-panel {
  background: var(--h1-surface-raised);
  border: 1px solid var(--h1-divider);
  border-radius: var(--h1-radius-panel);
  padding: var(--h1-space-24);
  min-width: 0;
}
.h1-panel-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: var(--h1-space-8) var(--h1-space-16);
  margin-bottom: var(--h1-space-16);
}
.h1-panel-head h2 { font-size: 18px; }
.h1-panel-head h2 .h1-status { vertical-align: middle; margin-left: var(--h1-space-8); }
/* A section's own action sits in its heading row, on the right; on a phone it drops under the heading. */
.h1-panel-head > .h1-button, .h1-panel-head > .h1-buttons { margin-left: auto; }
.h1-panel-head p { color: var(--h1-text-muted); font-size: 14px; flex-basis: 100%; }

/* Cards in a row that wrap as the width changes; never squeezed below 260px. */
.h1-cards {
  display: grid; gap: var(--h1-space-16);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  list-style: none; margin: 0; padding: 0;
}
.h1-card {
  background: var(--h1-surface-raised);
  border: 1px solid var(--h1-divider);
  border-radius: var(--h1-radius-panel);
  padding: var(--h1-space-16) var(--h1-space-24);
  display: flex; flex-direction: column; gap: var(--h1-space-4);
  min-width: 0;
}
.h1-card-label { font-size: 13px; color: var(--h1-text-muted); }
.h1-card-value { font-size: 36px; font-weight: 500; line-height: 1.15; font-variant-numeric: tabular-nums; }
/* 1.3.6.1 (bug fix, found by Ben in Bioma): an amount never breaks inside itself ("R 208,812." / "50");
   it gets smaller with its box instead, from 36px down to 18px. A text value still wraps between words. */
.h1-card { container-type: inline-size; }
.h1-card-value { overflow-wrap: normal; font-size: clamp(18px, 13cqi, 36px); }
.h1-card--feature { background: var(--h1-pale-blue); border-color: var(--h1-pale-blue); border-radius: var(--h1-radius-feature); }
.h1-card--feature .h1-card-label { color: var(--h1-text); }
/* 1.3.6 (Ilse): the page's finding (e.g. a possible saving) in the highlighted box, with a fern edge.
   Its words always say where the figure stands ("Worked out, not yet confirmed"). */
.h1-card--fern { box-shadow: inset 6px 0 0 var(--h1-fern); padding-left: calc(var(--h1-space-24) + 6px); }
.h1-card--fern p { margin-top: var(--h1-space-4); }

/* Two columns that become one when there's no room. */
.h1-split { display: grid; gap: var(--h1-space-24); grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); align-items: start; }

/* Label and value pairs on a detail page. */
.h1-facts { display: grid; grid-template-columns: minmax(140px, max-content) minmax(0, 1fr); gap: var(--h1-space-8) var(--h1-space-24); margin: 0; }
.h1-facts dt { color: var(--h1-text-muted); font-size: 14px; }
.h1-facts dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }

/* ---------- Inside a panel (1.3.1, from the Roots pilot) ---------- */

/* The things in a panel sit 12px apart; the first after the heading needs none. */
.h1-panel > * + * { margin-top: var(--h1-space-12); }
.h1-panel > .h1-panel-head + * { margin-top: 0; }

/* A count beside a section heading ("Needs you 12"): coral with blue text, like the menu's (principle 10). */
.h1-count {
  display: inline-block; min-width: 24px; padding: 0 var(--h1-space-8); margin-left: var(--h1-space-8);
  border-radius: 12px; text-align: center; vertical-align: middle;
  font-size: 12px; font-weight: 700; line-height: 22px;
  background: var(--h1-accent); color: var(--h1-blue);
}

/* A record's rows inside a panel (a meter under its supply point), one under another with a line between. */
.h1-row { padding: var(--h1-space-12) 0; border-top: 1px solid var(--h1-divider); }
.h1-row:first-child { border-top: 0; padding-top: 0; }
.h1-row > * + * { margin-top: var(--h1-space-4); }

/* A short list in words (what is missing, the accounts on a supply). For label and value pairs, use .h1-facts. */
.h1-list { margin: 0; padding-left: var(--h1-space-24); }
.h1-list li + li { margin-top: var(--h1-space-4); }

/* Earlier rows, folded away under "Earlier ...", opened by a click. */
.h1-earlier summary { cursor: pointer; font-weight: 700; font-size: 14px; }
.h1-earlier[open] summary { margin-bottom: var(--h1-space-8); }

/* A record's history: one change a panel; the value before it, struck through and muted. */
.h1-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--h1-space-12); }
.h1-before { text-decoration: line-through; color: var(--h1-text-muted); }

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

/* Every table sits in this box: if it is wider than the page, it scrolls here, not the page. */
.h1-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.h1-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.h1-table th {
  text-align: left; vertical-align: bottom;
  padding: var(--h1-space-8) var(--h1-space-12);
  background: var(--h1-surface-subtle);
  font-size: 12px; font-weight: 700; color: var(--h1-text-muted);
  border-bottom: 1px solid var(--h1-divider);
}
.h1-table td {
  padding: var(--h1-space-12);
  /* Every cell in a row sits on the same middle line: statuses and buttons line up with the text. */
  vertical-align: middle;
  border-bottom: 1px solid var(--h1-divider);
  /* 1.3.7 (bug fix, SD-0173): break-word, not anywhere. "anywhere" let a tight table break a short word
     ("Oudtshoor" / "n" in Roots' Sites); break-word gives each column at least its longest word and breaks
     only a word too long for any column. The box scrolls instead. */
  overflow-wrap: break-word;
  min-width: 8ch;
}
.h1-table tbody tr:last-child td { border-bottom: 0; }
.h1-table tbody tr:hover td { background: var(--h1-surface); }

/* Numbers line up on the right and keep their digits together. */
.h1-table .h1-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; overflow-wrap: normal; }
/* Short codes and dates don't break mid-word. */
.h1-table .h1-nowrap { white-space: nowrap; overflow-wrap: normal; }
.h1-table .h1-actions { text-align: right; white-space: nowrap; }
.h1-table td strong { display: block; }
.h1-table .h1-sub { display: block; font-size: 13px; color: var(--h1-text-muted); }

/* ---------- Column widths each person can change (1.3.7, SD-0173, Ilse 2026-11-17) ----------
   A list opts in: <table class="h1-table h1-table--resize" data-h1-table="<product>-<list>">; h1-layout.js does the rest. */
.h1-table-wrap { position: relative; }
/* Above the table: "scrolls sideways" note on the left, "Reset widths" on the right; only when needed. */
.h1-table-tools { display: flex; align-items: center; gap: var(--h1-space-12); flex-wrap: wrap; }
.h1-table-tools:empty { display: none; }
.h1-table-tools .h1-button { min-height: 44px; margin-left: auto; font-size: 14px; }
.h1-table-scrolls { font-size: 13px; color: var(--h1-text-muted); margin: 0; }
/* Once someone sets a width, the table keeps their widths exactly. */
.h1-table--sized { table-layout: fixed; }
.h1-table--sized th, .h1-table--sized td { min-width: 0; }
.h1-table--sized th.h1-num, .h1-table--measuring th.h1-num { white-space: normal; }
/* A text column narrowed past its contents: one line a row, ending in "…"; the whole text in the tooltip.
   Numbers are never cut: a cut-off amount reads as a different amount. */
.h1-col-clipped { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h1-col-clipped * { white-space: nowrap; }
.h1-col-clipped > strong, .h1-col-clipped > .h1-sub, .h1-col-clipped > div, .h1-col-clipped li { overflow: hidden; text-overflow: ellipsis; }
.h1-col-clipped .h1-th-label { display: block; overflow: hidden; text-overflow: ellipsis; }
.h1-table--measuring { table-layout: auto !important; }
.h1-table--measuring td, .h1-table--measuring th { overflow-wrap: normal !important; }
/* The edge: a 1px line at the right of each heading (Ilse: "a little thinner"); blue when grabbed. */
.h1-table--resize th { position: relative; }
.h1-col-edge {
  position: absolute; top: 0; bottom: 0; right: -8px; width: 16px; z-index: 2;
  cursor: col-resize; touch-action: none; user-select: none;
  display: flex; justify-content: center; align-items: stretch;
}
.h1-table--resize th:last-child .h1-col-edge { right: 0; width: 12px; justify-content: flex-end; }
.h1-col-edge::before { content: ""; width: 1px; background: var(--h1-divider); transition: background-color .12s; }
.h1-table--resize th:hover .h1-col-edge::before { background: var(--h1-control-border); }
.h1-table--resize th .h1-col-edge:hover::before,
.h1-table--resize th .h1-col-edge:focus-visible::before,
.h1-table--resize th .h1-col-edge.is-dragging::before { background: var(--h1-action); width: 2px; }
.h1-col-edge:focus-visible { outline: 3px solid var(--h1-focus-ring); outline-offset: -3px; }
/* While dragging: one blue line down the whole table. */
.h1-col-guide { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--h1-action); pointer-events: none; z-index: 3; }
.h1-table-resizing, .h1-table-resizing * { cursor: col-resize !important; user-select: none; }
/* Touch screens: a 44px edge to catch with a finger. */
@media (pointer: coarse) {
  .h1-col-edge { right: -22px; width: 44px; }
  .h1-table--resize th:last-child .h1-col-edge { right: 0; width: 28px; }
}
/* Phone: stacked tables are cards; no edges, no set widths, nothing cut. */
@media (max-width: 599px) {
  .h1-table--stack .h1-col-edge { display: none; }
  .h1-table--stack.h1-table--sized { table-layout: auto; width: 100% !important; }
  .h1-table--stack .h1-col-clipped, .h1-table--stack .h1-col-clipped * { white-space: normal; overflow: visible; }
}
@media (prefers-reduced-motion: reduce) { .h1-col-edge::before { transition: none; } }

/* ---------- Filters above a list ---------- */

.h1-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--h1-space-12); }
.h1-filters .h1-field { flex: 1 1 200px; max-width: 320px; }

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

.h1-form { display: flex; flex-direction: column; gap: var(--h1-space-24); max-width: 640px; }
.h1-field { display: flex; flex-direction: column; gap: var(--h1-space-4); min-width: 0; }
.h1-field label, .h1-legend { font-size: 14px; font-weight: 700; }
.h1-hint { font-size: 13px; color: var(--h1-text-muted); }
.h1-input, .h1-select, .h1-textarea {
  font: inherit; font-size: 15px; color: var(--h1-text);
  width: 100%; min-height: 44px;
  padding: var(--h1-space-8) var(--h1-space-12);
  background: var(--h1-white);
  border: 1px solid var(--h1-control-border);
  border-radius: var(--h1-radius-control);
}
.h1-textarea { min-height: 120px; resize: vertical; }
.h1-field-error .h1-input, .h1-field-error .h1-select { border: 2px solid var(--h1-danger-text); }
.h1-error-text { font-size: 13px; font-weight: 700; color: var(--h1-danger-text); }

.h1-choices { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--h1-space-8); }
.h1-choice { display: flex; align-items: flex-start; gap: var(--h1-space-12); min-height: 44px; padding: var(--h1-space-8) 0; }
.h1-choice input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--h1-action); }

.h1-form-actions { display: flex; flex-wrap: wrap; gap: var(--h1-space-12); padding-top: var(--h1-space-8); }

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

.h1-button {
  font: inherit; font-size: 14px; font-weight: 700; line-height: 1.2;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--h1-space-8);
  min-height: 44px; padding: var(--h1-space-8) var(--h1-space-24);
  border-radius: var(--h1-radius-control);
  border: 1px solid var(--h1-action);
  background: var(--h1-action); color: var(--h1-action-text);
  text-decoration: none; text-align: center;
  cursor: pointer;
}
.h1-button--secondary { background: var(--h1-white); color: var(--h1-action); border-color: var(--h1-control-border); }
.h1-button--quiet { background: transparent; color: var(--h1-action); border-color: transparent; padding-inline: var(--h1-space-8); text-decoration: underline; text-underline-offset: 3px; }
.h1-button--danger { background: var(--h1-white); color: var(--h1-danger-text); border-color: var(--h1-danger-text); }
.h1-button--small { min-height: 36px; font-size: 13px; padding: var(--h1-space-4) var(--h1-space-12); }
.h1-buttons { display: flex; flex-wrap: wrap; gap: var(--h1-space-8); }

/* ---------- Statuses and notices ---------- */

.h1-status {
  display: inline-flex; align-items: center; gap: var(--h1-space-4);
  padding: 2px var(--h1-space-8); border-radius: 12px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
  background: var(--h1-surface-subtle); color: var(--h1-text);
}
.h1-status--ok { background: var(--h1-success-surface); color: var(--h1-success-text); }
.h1-status--ok::before { content: "✓"; }
.h1-status--warn { background: var(--h1-white); color: var(--h1-warning-text); box-shadow: inset 0 0 0 1px var(--h1-warning-text); }
.h1-status--error { background: var(--h1-white); color: var(--h1-danger-text); box-shadow: inset 0 0 0 1px var(--h1-danger-text); }

.h1-notice {
  display: flex; gap: var(--h1-space-12); align-items: flex-start;
  padding: var(--h1-space-16); border-radius: var(--h1-radius-control);
  background: var(--h1-surface-subtle); font-size: 14px;
}
.h1-notice--ok { background: var(--h1-success-surface); color: var(--h1-success-text); }
.h1-notice--error { background: var(--h1-white); color: var(--h1-danger-text); border: 1px solid var(--h1-danger-text); }
/* 1.3.5 (Ilse, 13 Nov; proposed by Ben for Bioma): something a person should look at, not an error. Never coral. */
.h1-notice--warn { background: var(--h1-white); color: var(--h1-warning-text); border: 1px solid var(--h1-warning-text); }

/* ---------- Empty states ---------- */

.h1-empty {
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--h1-space-8);
  padding: var(--h1-space-24); border: 1px dashed var(--h1-control-border);
  border-radius: var(--h1-radius-panel); background: var(--h1-surface);
}
.h1-empty p { color: var(--h1-text-muted); max-width: 60ch; }
.h1-empty strong { color: var(--h1-text); }
/* The product's own mark, at the identity's recommended size. */
.h1-empty-mark { width: 64px; height: 64px; display: block; }

/* ---------- The action page: what needs you (SD-0087) ---------- */

.h1-inbox { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.h1-inbox li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--h1-space-4) var(--h1-space-16);
  align-items: center;
  padding: var(--h1-space-16) 0; border-bottom: 1px solid var(--h1-divider);
}
.h1-inbox li:last-child { border-bottom: 0; }
.h1-inbox-what { font-weight: 700; }
.h1-inbox-why { grid-column: 1; font-size: 14px; color: var(--h1-text-muted); }
.h1-inbox-from { font-size: 12px; font-weight: 700; color: var(--h1-text-muted); }
.h1-inbox .h1-button { grid-column: 2; grid-row: 1 / span 3; }

/* ---------- Hide the menu (1.3.6, Ilse) ---------- */
/* From 960px up, « beside the logo folds the left bar to a 72px strip: the product's mark, then one icon
   per menu item (its name shows on hover), coral counts kept; » opens it again. Below 960px "☰ Menu" does this. */
.h1-nav-collapse {
  display: none; align-items: center; justify-content: center; flex: none;
  width: 32px; height: 32px; padding: 0; cursor: pointer;
  font: inherit; font-size: 16px; line-height: 1; color: var(--h1-text);
  background: var(--h1-white); border: 1px solid var(--h1-control-border); border-radius: var(--h1-radius-control);
}
.h1-nav-collapse:hover { background: var(--h1-surface-subtle); }
.h1-nav-brand .h1-nav-mark { display: none; width: 40px; height: 40px; }
@media (min-width: 960px) {
  .h1-nav-collapse { display: inline-flex; }
  .h1-app.h1-nav-collapsed { --h1-nav-width: 72px; }
  .h1-nav-collapsed .h1-nav { padding: var(--h1-space-16) var(--h1-space-8); align-items: center; }
  .h1-nav-collapsed .h1-nav-brand { flex-direction: column; gap: var(--h1-space-12); padding: var(--h1-space-8) 0; }
  .h1-nav-collapsed .h1-nav-brand img:not(.h1-nav-mark),
  .h1-nav-collapsed .h1-switcher,
  .h1-nav-collapsed .h1-context,
  .h1-nav-collapsed .h1-menu-label,
  .h1-nav-collapsed .h1-submenu,
  .h1-nav-collapsed .h1-account,
  .h1-nav-collapsed .h1-sub-toggle { display: none; }
  .h1-nav-collapsed .h1-menu li.h1-has-sub { display: block; } /* 1.3.6.1: no fold arrow in the strip; its sub-menus are hidden there */
  .h1-nav-collapsed .h1-nav-brand .h1-nav-mark { display: block; }
  .h1-nav-collapsed .h1-menu a { position: relative; width: 48px; justify-content: center; padding: var(--h1-space-8); font-size: 0; }
  .h1-nav-collapsed .h1-menu a svg { width: 20px; height: 20px; }
  .h1-nav-collapsed .h1-menu a[aria-current="page"]::after { display: none; }
  .h1-nav-collapsed .h1-menu-count { position: absolute; top: 0; right: -4px; min-width: 18px; padding: 0 4px; font-size: 11px; line-height: 18px; }
  .h1-nav-collapsed .h1-nav-foot { align-items: center; }
}

/* ---------- Phone and narrow windows ---------- */

/* Below 960px the left bar folds away behind a Menu button and slides in over the page. */
@media (max-width: 959px) {
  .h1-app { grid-template-columns: minmax(0, 1fr); }
  .h1-rail { display: none; }
  .h1-nav {
    position: fixed; inset: 0 auto 0 0; z-index: 25;
    width: min(320px, 86vw);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: none;
  }
  .h1-nav-open .h1-nav { transform: none; box-shadow: 0 0 0 100vmax color-mix(in srgb, var(--h1-night) 45%, transparent); }
  .h1-nav-toggle {
    display: inline-flex; align-items: center; gap: var(--h1-space-8);
    font: inherit; font-size: 14px; font-weight: 700; color: var(--h1-text);
    min-height: 44px; padding: 0 var(--h1-space-12);
    background: var(--h1-white); border: 1px solid var(--h1-control-border);
    border-radius: var(--h1-radius-control); cursor: pointer;
    white-space: nowrap; flex: none;
  }
  .h1-nav-close { display: inline-flex; }
  .h1-pagebar { --h1-page-gutter: 16px; position: sticky; top: 0; z-index: 10; }
}
@media (min-width: 960px) { .h1-nav-close { display: none; } }

@media (max-width: 599px) {
  body { font-size: 15px; }
  .h1-panel { padding: var(--h1-space-16); }
  .h1-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--h1-space-8); }
  .h1-card { padding: var(--h1-space-12) var(--h1-space-16); }
  .h1-card-value { font-size: clamp(16px, 13cqi, 28px); }
  .h1-page-head { padding: var(--h1-space-24) var(--h1-space-16); }
  .h1-page-head > .h1-button, .h1-page-head > .h1-buttons { width: 100%; }
  .h1-panel-head > .h1-button { margin-left: 0; width: 100%; }
  .h1-page-head > .h1-button { justify-content: center; }
  .h1-facts { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .h1-facts dd { margin-bottom: var(--h1-space-12); }
  .h1-inbox li { grid-template-columns: minmax(0, 1fr); }
  .h1-inbox .h1-button { grid-column: 1; grid-row: auto; justify-self: start; margin-top: var(--h1-space-8); }

  /* Tables marked "stack" become one card per row on a phone; each cell shows its column name. */
  .h1-table--stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .h1-table--stack, .h1-table--stack tbody, .h1-table--stack tr, .h1-table--stack td { display: block; width: 100%; }
  .h1-table--stack tr { padding: var(--h1-space-12) 0; border-bottom: 1px solid var(--h1-divider); }
  .h1-table--stack tbody tr:last-child { border-bottom: 0; }
  .h1-table--stack td { border: 0; padding: 2px 0; text-align: left; white-space: normal; }
  .h1-table--stack td[data-label]::before { content: attr(data-label); color: var(--h1-text-muted); font-size: 13px; }
  .h1-table--stack td.h1-num { text-align: left; }
  .h1-table--stack td.h1-actions { padding-top: var(--h1-space-8); text-align: left; }
  .h1-table--stack td[data-label]::before { display: block; }
}

@media (max-width: 959px) { .h1-toast { right: var(--h1-space-16); } }

@media (prefers-reduced-motion: reduce) { .h1-nav { transition: none; } }
