/* Ward Desk — layout only. Every colour, radius, shadow and step is a token;
   nothing here re-declares a design decision.

   THE SHELL, in one paragraph. Two navigation columns and the content column all
   sit on ONE neutral plane (--sidebar): a 60px rail of category icons, a 232px
   panel of the destinations inside the chosen category, then the content. The
   tint is the page; the white is the object — so nothing in the content column
   is drawn with a rule. Every region is a CARD on the plane: --card surface, one
   hairline, 14px radius, the smallest shadow in the system. Cards are separated
   by the gutter, never by a divider, and a card's own inside is separated by
   space rather than by more lines.

   Card variants, four, and what each is for:
     .hd-band            the default card — a titled region of content
     .hd-band--flush     a card whose child bleeds to its edge (tables, filter
                         bars, bulk bars keep the card gutter on their own cells)
     .hd-band--tint      a recessed card: muted surface, no shadow, for work
                         nobody can act on yet and for supporting detail
     .hd-band--fill      a card that stretches to its row's height, so cards
                         side by side line their footers up
   Metric tiles are the one auto-fitting grid (§5.1); everything else is a column
   stack of cards.

   Density: comfortable, not tight — 28px nav rows, 24px page gutters, 20px card
   padding, 40px table rows, and a 16px gutter between every card.

   Active state, one signature product-wide: --sidebar-accent wash plus the
   foreground token and medium weight. The rail's active category takes the page
   colour and a hairline instead, so it reads as the selected tab of the panel
   beside it.

   Breakpoints, declared once for the whole shell: 1280 rail and panel · 1024 the
   panel leaves the grid and its destinations become a flyout from the rail icon,
   labels become tooltips · below 1024 both columns leave the layout and return as
   one off-canvas drawer, complete and labelled. Nothing is lost on the way down
   and the account menu never collapses into an overflow. */

.hd-shell{--gutter-page:var(--space-6);--card-pad:var(--space-5);--card-gap:var(--space-4);display:grid;height:100dvh;overflow:hidden;grid-template-columns:60px 232px minmax(0,1fr);grid-template-rows:minmax(0,1fr);background:var(--sidebar);color:var(--foreground)}
.hd-shell[data-mode=rail]{grid-template-columns:60px minmax(0,1fr)}
.hd-shell[data-mode=drawer]{grid-template-columns:minmax(0,1fr)}

/* ── The rail: categories, brand above them, account below ────────────────── */
.hd-rail{display:flex;min-height:0;flex-direction:column;align-items:center;gap:var(--space-1);border-inline-end:1px solid var(--sidebar-border);padding:var(--space-3) 0 var(--space-2)}
.hd-rail__brand{display:flex;width:32px;height:32px;flex:none;align-items:center;justify-content:center;overflow:hidden;border-radius:var(--radius-lg);background:var(--card);border:1px solid var(--border);margin-bottom:var(--space-3)}
.hd-rail__brand img{width:18px;height:18px}
.hd-rail__list{display:flex;min-height:0;flex:1;flex-direction:column;align-items:center;gap:var(--space-1);overflow-y:auto;overflow-x:hidden;width:100%;padding:0 var(--space-2)}
.hd-rail__foot{display:flex;flex-direction:column;align-items:center;gap:var(--space-1);width:100%;padding-top:var(--space-2)}
.hd-cat{position:relative;display:flex;width:44px;height:40px;align-items:center;justify-content:center;border:1px solid transparent;border-radius:var(--radius-lg);background:transparent;color:var(--sidebar-foreground);cursor:pointer;transition:background var(--duration-fast) var(--ease-out),color var(--duration-fast) var(--ease-out)}
.hd-cat:hover{background:var(--sidebar-accent);color:var(--sidebar-accent-foreground)}
.hd-cat[aria-selected=true],.hd-cat.is-on{border-color:var(--border);background:var(--card);color:var(--foreground);box-shadow:var(--shadow-xs)}
.hd-cat:focus-visible{outline:2px solid var(--ring);outline-offset:1px}
.hd-cat__dot{position:absolute;inset-inline-end:6px;top:6px;width:6px;height:6px;border-radius:var(--radius-full);background:var(--warning);box-shadow:0 0 0 2px var(--sidebar)}
.hd-cat[aria-selected=true] .hd-cat__dot,.hd-cat.is-on .hd-cat__dot{box-shadow:0 0 0 2px var(--card)}

/* ── The panel: the destinations inside the chosen category ────────────────── */
.hd-panel{display:flex;min-width:0;min-height:0;flex-direction:column;border-inline-end:1px solid var(--sidebar-border)}
.hd-panel__head{display:flex;min-width:0;flex-direction:column;gap:3px;padding:var(--space-4) var(--space-4) var(--space-3)}
.hd-panel__hospital{font-size:var(--text-xs);font-weight:var(--font-weight-medium);letter-spacing:.04em;text-transform:uppercase;color:var(--muted-foreground)}
.hd-panel__title{font-family:var(--font-heading);font-size:var(--text-lg);font-weight:var(--font-weight-semibold);line-height:1.2;letter-spacing:var(--tracking-tight)}
.hd-panel__note{font-size:var(--text-xs);color:var(--muted-foreground);text-wrap:pretty}
.hd-panel__nav{display:flex;min-height:0;flex:1;flex-direction:column;gap:2px;overflow-y:auto;padding:var(--space-2)}
.hd-link{position:relative;display:flex;width:100%;min-width:0;align-items:center;gap:var(--space-2);border:0;border-radius:var(--radius-md);background:transparent;padding:0 var(--space-2);height:32px;text-align:left;font:inherit;font-size:var(--text-sm);color:var(--sidebar-foreground);cursor:pointer;transition:background var(--duration-fast) var(--ease-out)}
.hd-link:hover{background:var(--sidebar-accent)}
.hd-link[aria-current=page]{background:var(--sidebar-accent);color:var(--sidebar-accent-foreground);font-weight:var(--font-weight-medium)}
.hd-link:focus-visible{outline:2px solid var(--ring);outline-offset:-2px}
.hd-link__label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hd-link__count{flex:none;border-radius:var(--radius-sm);background:var(--secondary);padding:0 6px;font-size:var(--text-2xs);font-weight:var(--font-weight-medium);font-variant-numeric:tabular-nums;color:var(--muted-foreground)}
.hd-link[aria-current=page] .hd-link__count{color:var(--foreground)}
.hd-flyout{display:flex;flex-direction:column;gap:2px;min-width:15rem;padding:var(--space-2)}
.hd-flyout__title{padding:0 var(--space-2) var(--space-1);font-size:var(--text-xs);color:var(--muted-foreground)}
.hd-account{display:flex;width:100%;min-width:0;align-items:center;gap:var(--space-2);border:0;border-radius:var(--radius-lg);background:transparent;padding:var(--space-1-5);text-align:left;font:inherit;color:inherit;cursor:pointer}
.hd-account:hover{background:var(--sidebar-accent)}
.hd-account--rail{width:44px;justify-content:center;padding:var(--space-1)}
.hd-account__text{display:flex;min-width:0;flex-direction:column}
.hd-account__name{font-size:var(--text-sm);font-weight:var(--font-weight-medium);line-height:1.2}
.hd-account__role{font-size:var(--text-xs);color:var(--muted-foreground);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hd-drawer-scrim{position:fixed;inset:0;z-index:55;background:rgb(0 0 0/32%)}
.hd-shell[data-mode=drawer] .hd-drawer{position:fixed;inset-block:0;inset-inline-start:0;z-index:60;display:grid;grid-template-columns:60px 240px;background:var(--sidebar);box-shadow:var(--shadow-lg)}

/* ── The content column: the only scroll owner, on the tint ──────────────── */
.hd-main{display:flex;min-width:0;flex-direction:column;overflow-y:auto;overflow-x:hidden;background:var(--sidebar);overscroll-behavior:contain;padding-bottom:var(--space-8)}
.hd-main>*{flex-shrink:0}
.hd-topbar{position:sticky;top:0;z-index:40;display:flex;height:56px;flex:none;align-items:center;gap:var(--space-2);background:color-mix(in srgb,var(--sidebar) 86%,transparent);backdrop-filter:blur(4px);padding-inline:var(--gutter-page);margin-bottom:var(--space-1)}
.hd-search{flex:1;max-width:24rem;min-width:0}
.hd-search input{cursor:pointer}
.hd-search-btn{display:none}
.hd-topbar__utility{margin-inline-start:auto;display:flex;align-items:center;gap:var(--space-1)}
.hd-utility{position:relative;display:inline-flex}
.hd-badge-dot{pointer-events:none;position:absolute;inset-inline-end:-2px;top:-2px;display:flex;height:16px;min-width:16px;align-items:center;justify-content:center;border-radius:var(--radius-full);background:var(--destructive);padding-inline:4px;font-size:10px;font-weight:var(--font-weight-medium);color:var(--color-white);box-shadow:0 0 0 2px var(--sidebar)}
.hd-notify{padding:var(--space-2)}
.hd-notify__head{display:flex;align-items:center;justify-content:space-between;gap:var(--space-2);padding:var(--space-1) var(--space-2) var(--space-2)}
.hd-notify__list{display:flex;flex-direction:column;gap:2px}
.hd-notify__item{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:2px var(--space-3);border:0;border-radius:var(--radius-lg);background:transparent;padding:var(--space-2);text-align:left;font:inherit;color:inherit;cursor:pointer}
.hd-notify__item:hover{background:var(--accent)}
.hd-notify__title{font-size:var(--text-sm);font-weight:var(--font-weight-medium)}
.hd-notify__body{grid-column:1;font-size:var(--text-xs);color:var(--muted-foreground);text-wrap:pretty}
.hd-notify__time{grid-row:1;grid-column:2;font-size:var(--text-xs);color:var(--muted-foreground)}

/* ── Page header: on the plane, no card, no rule ─────────────────────────── */
.hd-pagehead{display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:space-between;gap:var(--space-3) var(--space-4);padding:var(--space-2) var(--gutter-page) var(--space-5)}
.hd-pagehead>div:first-child{min-width:0}
.hd-pagehead .o-breadcrumb__list{flex-wrap:nowrap;min-width:0;overflow:hidden;white-space:nowrap}
.hd-pagehead .o-breadcrumb__page{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hd-pagetitle{margin:var(--space-1) 0 0;font-family:var(--font-heading);font-weight:var(--font-weight-semibold);font-size:var(--text-3xl);line-height:1.1;letter-spacing:var(--tracking-tight)}
.hd-pagesub{margin:var(--space-2) 0 0;font-size:var(--text-sm);color:var(--muted-foreground);text-wrap:pretty;max-width:60ch}
.hd-actions{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-2)}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.hd-alertwrap{margin:0 var(--gutter-page) var(--card-gap)}
.hd-band{margin:0 var(--gutter-page) var(--card-gap);border:1px solid var(--border);border-radius:var(--radius-xl);background:var(--card);box-shadow:var(--shadow-xs);padding:var(--card-pad)}
.hd-band--flush{padding-inline:0;overflow:hidden}
.hd-band--tint{background:var(--muted);border-color:transparent;box-shadow:none}
.hd-band--fill{display:flex;min-height:0;height:100%;flex-direction:column}
.hd-band--fill>.hd-rows,.hd-band--fill>.hd-notes{flex:1}
.hd-band__head{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:var(--space-2) var(--space-4);margin-bottom:var(--space-4)}
.hd-band--flush .hd-band__head{padding-inline:var(--card-pad)}
.hd-band__title{margin:0;font-family:var(--font-heading);font-size:var(--text-base);font-weight:var(--font-weight-semibold);letter-spacing:var(--tracking-tight)}
.hd-band__note{margin:var(--space-1) 0 0;font-size:var(--text-sm);color:var(--muted-foreground);text-wrap:pretty;max-width:70ch}
/* Column stacks, not an auto-fitting grid of cards (§5.1). */
.hd-cols{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:stretch;gap:var(--card-gap);margin:0 var(--gutter-page) var(--card-gap)}
.hd-cols>*{display:flex;min-width:0;flex-direction:column;gap:var(--card-gap)}
.hd-cols .hd-band{margin:0}
.hd-cols .hd-band--fill{flex:1}
.hd-cols--wide{grid-template-columns:minmax(0,1.6fr) minmax(0,1fr)}
@media(max-width:1180px){.hd-cols,.hd-cols--wide{grid-template-columns:minmax(0,1fr)}}

/* Metric tiles: the one auto-fitting grid in the product. */
.hd-figs{display:grid;grid-template-columns:repeat(auto-fit,minmax(14rem,1fr));gap:var(--card-gap);margin:0 var(--gutter-page) var(--card-gap)}
.hd-figs>*{display:flex;min-width:0;flex-direction:column;gap:var(--space-1);border:1px solid var(--border);border-radius:var(--radius-xl);background:var(--card);box-shadow:var(--shadow-xs);padding:var(--card-pad)}
.hd-fig__label{font-size:var(--text-sm);color:var(--muted-foreground)}
.hd-fig{font-family:var(--font-heading);font-weight:var(--font-weight-semibold);font-size:var(--text-3xl);line-height:1.1;letter-spacing:var(--tracking-tight);font-variant-numeric:tabular-nums}
.hd-fig__qualifier{font-size:var(--text-xs);color:var(--muted-foreground);text-wrap:pretty}

/* ── Tables and list furniture, inside a flush card ──────────────────────── */
/* The design system's Table renders inside its own .o-table-container, which is
   the element that scrolls. A nowrap table has to contribute its OWN intrinsic
   width to that container's scroll area: width:100% alone resolves against the
   container, min-content then pushes the box wider, and the excess is clipped
   with nothing to scroll — the action column simply cannot be reached. Do not
   put this back to width:100%. */
.hd-tablewrap{width:100%;min-width:0;overflow-x:auto}
.hd-tablewrap .o-table{width:max-content;min-width:100%}
.hd-tablewrap .o-table th,.hd-tablewrap .o-table td{white-space:nowrap}
.hd-tablewrap .o-table th:first-child,.hd-tablewrap .o-table td:first-child{padding-inline-start:var(--card-pad)}
.hd-tablewrap .o-table th:last-child,.hd-tablewrap .o-table td:last-child{padding-inline-end:var(--card-pad)}
.hd-tablefoot{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:var(--space-2);padding:var(--space-3) var(--card-pad) 0}
.hd-filters{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-2);padding:0 var(--card-pad) var(--space-4)}
.hd-filters__text{flex:1;min-width:12rem;max-width:20rem}
.hd-filters__select{display:block;width:11rem}
.hd-bulk{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-2) var(--space-3);border-radius:var(--radius-lg);background:var(--accent);padding:var(--space-2) var(--space-3);margin:0 var(--card-pad) var(--space-4)}
.hd-bulk__count{font-size:var(--text-sm);font-weight:var(--font-weight-medium)}
.hd-bulk__actions{margin-inline-start:auto;display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-2)}
.hd-muted{color:var(--muted-foreground)}
.hd-warn{color:var(--warning-foreground)}
.hd-danger{color:var(--destructive-foreground)}
.hd-num{font-variant-numeric:tabular-nums;text-align:right}
.hd-footnote{font-size:var(--text-xs);color:var(--muted-foreground);text-wrap:pretty}
.hd-sort{display:inline-flex;align-items:center;gap:4px;border:0;background:transparent;padding:0;font:inherit;color:inherit;cursor:pointer}
.hd-sort[data-on=true]{color:var(--foreground)}
.hd-person{display:flex;min-width:0;align-items:center;gap:var(--space-2)}
.hd-person__text{display:flex;min-width:0;flex-direction:column}
.hd-person__name{font-size:var(--text-sm);font-weight:var(--font-weight-medium);line-height:1.3}
.hd-person__meta{font-size:var(--text-xs);color:var(--muted-foreground);line-height:1.3}
.hd-linkbtn{border:0;background:transparent;padding:0;font:inherit;font-weight:var(--font-weight-medium);color:var(--foreground);text-decoration:underline;text-decoration-color:var(--input);text-underline-offset:2px;cursor:pointer}
.hd-linkbtn:hover{text-decoration-color:var(--foreground)}
.hd-chips{display:flex;flex-wrap:wrap;gap:var(--space-1-5)}
.hd-actions__row{display:inline-flex;align-items:center;gap:var(--space-1-5)}

/* ── Record furniture ────────────────────────────────────────────────────── */
.hd-record{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-4);margin:0 var(--gutter-page) var(--card-gap);border:1px solid var(--border);border-radius:var(--radius-xl);background:var(--card);box-shadow:var(--shadow-xs);padding:var(--space-5) var(--card-pad)}
.hd-record__id{display:flex;min-width:0;align-items:center;gap:var(--space-4)}
.hd-record__text{display:flex;min-width:0;flex-direction:column;gap:var(--space-1-5)}
.hd-record__name{font-family:var(--font-heading);font-size:var(--text-2xl);font-weight:var(--font-weight-semibold);line-height:1.15;letter-spacing:var(--tracking-tight)}
.hd-record__meta{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-1-5) var(--space-3);font-size:var(--text-sm);color:var(--muted-foreground)}
.hd-record__actions{margin-inline-start:auto;display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-2)}
/* Pairs breathe on their own grid; no rules between them. */
.hd-pairs{display:grid;grid-template-columns:repeat(auto-fit,minmax(12rem,1fr));gap:var(--space-4) var(--space-5)}
.hd-pair{display:flex;min-width:0;flex-direction:column;gap:3px}
.hd-pair__label{font-size:var(--text-xs);color:var(--muted-foreground)}
.hd-pair__value{font-size:var(--text-sm);text-wrap:pretty}
/* A list inside a card: separated by space, and by one hairline only where the
   rows are long enough to run together. */
.hd-rows{display:flex;flex-direction:column;gap:var(--space-2)}
.hd-row{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-2) var(--space-3);border:1px solid var(--border);border-radius:var(--radius-lg);background:var(--background);padding:var(--space-3)}
.hd-row--quiet{border-color:transparent;background:var(--muted)}
.hd-row__text{display:flex;min-width:0;flex:1;flex-direction:column;gap:3px}
.hd-row__title{font-size:var(--text-sm);font-weight:var(--font-weight-medium)}
.hd-row__note{font-size:var(--text-xs);color:var(--muted-foreground);text-wrap:pretty}
.hd-row__time{width:4.5rem;flex:none;font-variant-numeric:tabular-nums;font-weight:var(--font-weight-medium)}
.hd-bar{display:flex;width:100%;height:6px;overflow:hidden;border-radius:var(--radius-full);background:var(--muted)}
.hd-bar__fill{display:block;height:100%;background:var(--foreground)}
.hd-bar__fill--warn{background:var(--warning)}
.hd-bar__fill--soft{background:var(--muted-foreground);opacity:.5}
/* The ward board: a small card per ward. */
.hd-ward{display:grid;grid-template-columns:repeat(auto-fit,minmax(12rem,1fr));gap:var(--space-3)}
.hd-ward__cell{display:flex;min-width:0;flex-direction:column;gap:var(--space-2);border:1px solid var(--border);border-radius:var(--radius-lg);background:var(--background);padding:var(--space-3)}
.hd-ward__top{display:flex;align-items:baseline;justify-content:space-between;gap:var(--space-2)}
.hd-ward__name{font-size:var(--text-sm);font-weight:var(--font-weight-medium)}
.hd-ward__count{font-family:var(--font-heading);font-size:var(--text-xl);font-weight:var(--font-weight-semibold);font-variant-numeric:tabular-nums}
/* Bed grid: one pip per bed, so occupancy is a shape and not only a number. */
.hd-beds{display:flex;flex-wrap:wrap;gap:3px}
.hd-bed{width:14px;height:14px;border-radius:var(--radius-xs);background:var(--muted);border:1px solid var(--border)}
.hd-bed[data-state=occupied]{background:var(--foreground);border-color:var(--foreground)}
.hd-bed[data-state=held]{background:var(--warning);border-color:var(--warning)}

/* ── Notes and the feed ──────────────────────────────────────────────────── */
.hd-notes{display:flex;flex-direction:column;gap:var(--space-3)}
.hd-note{display:grid;grid-template-columns:32px minmax(0,1fr);gap:var(--space-1-5) var(--space-3);border:1px solid var(--border);border-radius:var(--radius-lg);background:var(--background);padding:var(--space-3)}
.hd-note--plain{border-color:transparent;background:transparent;padding-inline:0}
.hd-note__avatar{grid-row:1 / span 3}
.hd-note__head{display:flex;flex-wrap:wrap;align-items:baseline;gap:var(--space-2)}
.hd-note__author{font-size:var(--text-sm);font-weight:var(--font-weight-medium)}
.hd-note__role,.hd-note__time{font-size:var(--text-xs);color:var(--muted-foreground)}
.hd-note__body{margin:0;font-size:var(--text-sm);text-wrap:pretty}
.hd-note__body mark{border-radius:var(--radius-xs);background:var(--accent);padding:0 3px;color:var(--foreground);font-weight:var(--font-weight-medium)}
.hd-note__foot{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-1-5)}
.hd-noteitem{display:flex;flex-direction:column;align-items:flex-start;gap:var(--space-1-5)}
.hd-react{display:inline-flex;align-items:center;gap:4px;border:1px solid var(--border);border-radius:var(--radius-full);background:var(--card);padding:1px var(--space-2);font:inherit;font-size:var(--text-xs);color:var(--muted-foreground);cursor:pointer}
.hd-react.is-on{border-color:var(--input);background:var(--accent);color:var(--foreground)}
.hd-composer{display:flex;flex-direction:column;gap:var(--space-2);border-radius:var(--radius-lg);background:var(--muted);padding:var(--space-3)}
.hd-composer__foot{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:var(--space-2)}
.hd-feed{display:flex;flex-direction:column;gap:var(--space-1)}
.hd-feed__item{display:grid;grid-template-columns:32px minmax(0,1fr) auto;align-items:baseline;gap:var(--space-1) var(--space-3);border-radius:var(--radius-lg);padding:var(--space-2-5) var(--space-3)}
.hd-feed__item:hover{background:var(--accent)}
.hd-feed__avatar{grid-row:1 / span 2}
.hd-feed__line{font-size:var(--text-sm);text-wrap:pretty}
.hd-feed__note{grid-column:2;font-size:var(--text-xs);color:var(--muted-foreground);text-wrap:pretty}
.hd-feed__time{font-size:var(--text-xs);color:var(--muted-foreground);white-space:nowrap}

/* ── Forms ───────────────────────────────────────────────────────────────── */
.hd-fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(15rem,1fr));gap:var(--space-5)}
.hd-fields--one{grid-template-columns:minmax(0,1fr)}
.hd-fields__wide{grid-column:1/-1}
.hd-formbar{position:sticky;bottom:0;z-index:30;display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-2) var(--space-3);margin:0 var(--gutter-page);border:1px solid var(--border);border-radius:var(--radius-xl);background:color-mix(in srgb,var(--card) 92%,transparent);backdrop-filter:blur(6px);box-shadow:var(--shadow-sm);padding:var(--space-3) var(--card-pad)}
.hd-formbar__note{flex:1;min-width:12rem;font-size:var(--text-xs);color:var(--muted-foreground)}
.hd-matrix{width:100%;border-collapse:collapse;font-size:var(--text-sm)}
.hd-matrix th,.hd-matrix td{padding:var(--space-2-5) var(--space-3);text-align:left}
.hd-matrix thead th{font-weight:var(--font-weight-medium);color:var(--muted-foreground);font-size:var(--text-xs)}
.hd-matrix tbody tr{border-radius:var(--radius-lg)}
.hd-matrix tbody tr:nth-child(odd){background:var(--muted)}
.hd-matrix tbody td:first-child,.hd-matrix tbody th:first-child{border-start-start-radius:var(--radius-lg);border-end-start-radius:var(--radius-lg)}
.hd-matrix tbody td:last-child{border-start-end-radius:var(--radius-lg);border-end-end-radius:var(--radius-lg)}
.hd-photos{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-3)}
.hd-photo{display:flex;width:60px;height:60px;align-items:center;justify-content:center;border:1px solid var(--border);border-radius:var(--radius-full);background:var(--card);cursor:pointer}
.hd-photo[aria-pressed=true]{border-color:var(--foreground);box-shadow:var(--shadow-xs)}

/* ── Settings ────────────────────────────────────────────────────────────
   The within-destination level: a tab strip on the page, not a third nav
   column. It scrolls sideways rather than wrapping or hiding an item. */
.hd-tabs{display:flex;gap:var(--space-1);overflow-x:auto;padding:0 var(--gutter-page) var(--space-4);scrollbar-width:none}
.hd-tabs::-webkit-scrollbar{display:none}
.hd-tab{flex:none;border:1px solid transparent;border-radius:var(--radius-lg);background:transparent;padding:var(--space-1-5) var(--space-3);font:inherit;font-size:var(--text-sm);color:var(--muted-foreground);white-space:nowrap;cursor:pointer}
.hd-tab:hover{background:var(--accent);color:var(--foreground)}
.hd-tab[aria-current=page]{border-color:var(--border);background:var(--card);box-shadow:var(--shadow-xs);color:var(--foreground);font-weight:var(--font-weight-medium)}
.hd-tab:focus-visible{outline:2px solid var(--ring);outline-offset:1px}

/* The photograph upload control: a drop zone that is also a button and a real
   file input, plus the badge-system pictures as a fallback. */
.hd-upload{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-4)}
.hd-drop{display:flex;flex:1;min-width:15rem;flex-direction:column;align-items:center;gap:var(--space-2);border:1px dashed var(--input);border-radius:var(--radius-xl);background:var(--muted);padding:var(--space-5);text-align:center;cursor:pointer}
.hd-drop:hover{border-color:var(--foreground)}
.hd-drop[data-over=true]{border-color:var(--foreground);background:var(--accent)}
.hd-drop[data-invalid=true]{border-color:var(--destructive)}
.hd-drop:focus-within{outline:2px solid var(--ring);outline-offset:2px}
.hd-drop__title{font-size:var(--text-sm);font-weight:var(--font-weight-medium)}
.hd-drop input[type=file]{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.hd-preview{display:flex;flex-direction:column;align-items:center;gap:var(--space-2)}

/* ── Rota and reports ────────────────────────────────────────────────────── */
.hd-rota{display:grid;gap:var(--space-3)}
.hd-rota__day{display:grid;grid-template-columns:7rem repeat(3,minmax(0,1fr));gap:var(--space-2);align-items:stretch}
.hd-rota__label{display:flex;flex-direction:column;justify-content:center;gap:2px;font-size:var(--text-sm);font-weight:var(--font-weight-medium)}
.hd-rota__cell{display:flex;min-width:0;flex-direction:column;gap:var(--space-1-5);border:1px solid var(--border);border-radius:var(--radius-lg);background:var(--background);padding:var(--space-2-5)}
.hd-rota__cell[data-thin=true]{border-color:transparent;background:color-mix(in srgb,var(--warning) 8%,transparent)}
.hd-rota__shift{font-size:var(--text-2xs);letter-spacing:.04em;text-transform:uppercase;color:var(--muted-foreground)}
.hd-rota__head{display:grid;grid-template-columns:7rem repeat(3,minmax(0,1fr));gap:var(--space-2);font-size:var(--text-xs);color:var(--muted-foreground);padding-bottom:var(--space-1)}
.hd-stack{display:flex;flex-direction:column;gap:var(--card-gap)}
.hd-split{display:grid;grid-template-columns:repeat(auto-fit,minmax(11rem,1fr));gap:var(--space-3)}
.hd-tile{display:flex;flex-direction:column;gap:var(--space-1);border:1px solid var(--border);border-radius:var(--radius-lg);background:var(--background);padding:var(--space-3)}
.hd-tile--tint{border-color:transparent;background:var(--muted)}
.hd-tile__label{font-size:var(--text-xs);color:var(--muted-foreground)}
.hd-tile__value{font-family:var(--font-heading);font-size:var(--text-xl);font-weight:var(--font-weight-semibold);font-variant-numeric:tabular-nums}

/* ── Auth: its own shell, no navigation owner (AGENTS §7.1) ──────────────── */
.hd-auth{display:grid;min-height:100dvh;grid-template-columns:minmax(0,1fr) minmax(0,1.1fr);background:var(--background);color:var(--foreground)}
/* The text panel is a neutral plane carrying one piece of art: a hexagon grid
   drawn in black and faded out across the panel. The grid is two layers of one
   hexagon outline, offset by half a tile so they interlock into a honeycomb —
   geometry, not illustration — and it is masked rather than faded per line, so
   the density falls off in one direction and never fights the type. */
.hd-auth__brandside{position:relative;isolation:isolate;overflow:hidden;display:flex;min-width:0;flex-direction:column;justify-content:space-between;gap:var(--space-8);border-inline-end:1px solid var(--border);background:color-mix(in srgb,var(--foreground) 5%,var(--background));padding:var(--space-8)}
.hd-auth__art{position:absolute;inset:-2px;z-index:-1;pointer-events:none;opacity:.22;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='34.64' viewBox='0 0 40 34.64'%3E%3Cpath d='M10 0.5 H30 L39.5 17.32 L30 34.14 H10 L0.5 17.32 Z' fill='none' stroke='%23000' stroke-width='1'/%3E%3C/svg%3E"),url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='34.64' viewBox='0 0 40 34.64'%3E%3Cpath d='M10 0.5 H30 L39.5 17.32 L30 34.14 H10 L0.5 17.32 Z' fill='none' stroke='%23000' stroke-width='1'/%3E%3C/svg%3E");background-size:60px 34.64px,60px 34.64px;background-position:0 0,30px 17.32px;-webkit-mask-image:radial-gradient(135% 110% at 8% 0%,#000 0%,rgb(0 0 0/55%) 38%,transparent 76%);mask-image:radial-gradient(135% 110% at 8% 0%,#000 0%,rgb(0 0 0/55%) 38%,transparent 76%)}
.dark .hd-auth__brandside{background:color-mix(in srgb,var(--color-white) 4%,var(--background))}
/* On the dark plane the same grid is inverted rather than redrawn, so the two
   themes cannot drift apart. */
.dark .hd-auth__art{filter:invert(1);opacity:.16}
.hd-auth__mark{display:flex;align-items:center;gap:var(--space-2);font-family:var(--font-heading);font-size:var(--text-base);font-weight:var(--font-weight-semibold)}
.hd-auth__mark img{width:20px;height:20px}
.hd-auth__claim{font-family:var(--font-heading);font-size:var(--text-3xl);font-weight:var(--font-weight-semibold);line-height:1.15;letter-spacing:var(--tracking-tight);text-wrap:pretty;max-width:22rem}
.hd-auth__fine{font-size:var(--text-sm);color:var(--muted-foreground);text-wrap:pretty;max-width:26rem}
.hd-auth__formside{display:flex;min-width:0;align-items:center;justify-content:center;padding:var(--space-6)}
.hd-auth__form{display:flex;width:100%;max-width:26rem;flex-direction:column;gap:var(--space-5);border:1px solid var(--border);border-radius:var(--radius-xl);background:var(--card);box-shadow:var(--shadow-xs);padding:var(--space-8) var(--space-6)}
.hd-auth__title{margin:0;font-family:var(--font-heading);font-size:var(--text-2xl);font-weight:var(--font-weight-semibold);letter-spacing:var(--tracking-tight)}
.hd-auth__lede{margin:var(--space-2) 0 0;font-size:var(--text-sm);color:var(--muted-foreground);text-wrap:pretty}
.hd-auth__fields{display:flex;flex-direction:column;gap:var(--space-4)}
.hd-auth__row{display:flex;align-items:baseline;justify-content:space-between;gap:var(--space-2)}
.hd-auth__foot{margin:0;font-size:var(--text-sm);color:var(--muted-foreground);text-wrap:pretty}
.hd-checklist{display:flex;flex-direction:column;gap:var(--space-1);border-radius:var(--radius-lg);background:var(--muted);padding:var(--space-3)}
.hd-checklist__item{display:flex;align-items:center;gap:var(--space-2);font-size:var(--text-xs);color:var(--muted-foreground)}
.hd-checklist__item[data-met=true]{color:var(--success-foreground)}
@media(max-width:900px){.hd-auth{grid-template-columns:minmax(0,1fr)}.hd-auth__brandside{gap:var(--space-5);border-inline-end:0;border-bottom:1px solid var(--border);padding:var(--space-6)}.hd-auth__claim{font-size:var(--text-2xl)}}

/* ── Responsiveness: content follows, nothing is lost ────────────────────── */
@media(max-width:1024px){
  .hd-shell{--gutter-page:var(--space-4)}
  .hd-search{display:none}
  .hd-search-btn{display:inline-flex}
}
@media(max-width:767px){
  .hd-shell{--gutter-page:var(--space-3);--card-pad:var(--space-4)}
  .hd-pagetitle{font-size:var(--text-2xl)}
  .hd-fig{font-size:var(--text-2xl)}
  .hd-rota__day,.hd-rota__head{grid-template-columns:minmax(0,1fr)}
  .hd-shell[data-mode=drawer] .hd-drawer{grid-template-columns:56px minmax(0,220px)}
  .hd-cat,.hd-react{min-height:44px}
  .hd-link{height:44px}
  .hd-account{min-height:44px}
}
