/* Partner portal skin.
 *
 * The tokens below are lifted verbatim from the theme the vendor already
 * ships on cloud.aleph.graphics (Nextcloud 32, primary #00679e, plain
 * background #036faa) so a partner moving between the two sees one house
 * style. Keep the values in sync with that theme rather than inventing new
 * ones; the assets beside this file come from the same source.
 */

/* Light and dark in one place.
 *
 * Every two-valued token is a `light-dark()` pair, so the palette is written
 * once and `color-scheme` alone decides which half is used. That is what lets
 * a user pin an appearance without the stylesheet growing a second copy of the
 * dark palette that would drift from the first: `data-theme` (rendered by
 * `web::page` from the user's stored preference) sets `color-scheme`, and
 * every token follows. No `data-theme` = "light dark" = follow the browser,
 * which is the default for a user who has chosen nothing and for the login
 * page, where nobody has yet.
 */
:root {
  color-scheme: light dark;

  --primary: light-dark(#00679e, #0091f2);
  --primary-hover: light-dark(#00507a, #17a2ff);
  --primary-text: light-dark(#ffffff, #000000);
  /* The brand blue of the top bar and the login background: one value in both
     schemes, because it is the brand rather than a surface. */
  --plain: #036faa;
  --plain-text: #ffffff;

  --bg: light-dark(#ededed, #171717);
  --surface: light-dark(#ffffff, #1f1f1f);
  --surface-blur: light-dark(rgba(255, 255, 255, 0.8), rgba(23, 23, 23, 0.85));
  --hover: light-dark(#f5f5f5, #292929);

  --text: light-dark(#222222, #ebebeb);
  --muted: light-dark(#6b6b6b, #999999);
  --border: light-dark(#ededed, #292929);
  --border-strong: light-dark(#dbdbdb, #3b3b3b);
  --border-input: #7d7d7d;
  --shadow: 0 0 10px light-dark(rgba(77, 77, 77, 0.5), #000000);

  --error-bg: light-dark(#ffe7e7, #552121);
  --error-text: light-dark(#8a0000, #ffcccc);
  --success-bg: light-dark(#d8f3da, #11321a);
  --success-text: light-dark(#005416, #d5f2dc);
  /* A state nobody chose: a demo that ran out. Grey, so it reads neither as
     in force (success) nor as a person's act (error). Text on background
     clears AA in both schemes: 7.44:1 light, 8.69:1 dark. */
  --neutral-bg: light-dark(#e6e6e6, #333333);
  --neutral-text: light-dark(#474747, #d6d6d6);

  /* The cap meter's unfilled track: a light/dark tint from the primary
     hue's own ramp, so track and fill read as one instrument. */
  --meter-track: light-dark(#d7e7f0, #10344a);

  --radius-small: 4px;
  --radius-element: 8px;
  --radius-container: 12px;
  --radius-container-large: 16px;
  --radius-pill: 100px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, Oxygen-Sans, Cantarell,
    Ubuntu, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

/* The pinned appearances, from /account. Setting `color-scheme` is the whole
   mechanism — it resolves every `light-dark()` above AND tells the browser to
   paint its own furniture (scrollbars, the native select popup, form control
   defaults) to match, which a palette of custom properties alone cannot. */
:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

/* Responsive type: the ROOT font scales gently with the viewport, and
   because every width in this sheet is rem — the 96rem frame
   included — the whole layout scales with it: a large display gets larger
   text AND a wider frame instead of small type in an ocean of margin.
   The clamp is REM-based on purpose: a px clamp would freeze out the
   browser/OS font-size preference, which must keep scaling the ramp.
   (~15px below ≈1550px viewports, capped at ~19px by ≈2550px.) */
html {
  font-size: clamp(0.9375rem, 0.55rem + 0.4vw, 1.1875rem);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

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

h1 {
  font-size: 1.4rem;
  margin: 0 0 1rem;
}

h2 {
  font-size: 1.05rem;
  margin: 2rem 0 0.6rem;
}

p {
  margin: 0 0 0.8rem;
}

/* Running prose gets a MEASURE, because the frame is no longer one (the
   96rem frame is sized for ten-column ledgers, and a paragraph that wraps
   across ~190 characters is unreadable at that width). Only long-form
   documents need it — a helper line under a field is one sentence and never
   wraps — so it is an opt-in wrapper, not a rule on `p`, which would also
   narrow the `.err`/`.ok` banners that are meant to span their container.
   `/handbook` is the surface; `ch` scales with the responsive root, so the
   measure holds at every viewport (~35 full-width glyphs in zh-Hans). */
.prose {
  max-width: 70ch;
}

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

.err {
  background: var(--error-bg);
  color: var(--error-text);
  border-radius: var(--radius-element);
  padding: 0.6rem 0.9rem;
}

/* The confirmation half of .err — same shape, the success tokens the palette
   already carried. Used by /account when a change lands. */
.ok {
  background: var(--success-bg);
  color: var(--success-text);
  border-radius: var(--radius-element);
  padding: 0.6rem 0.9rem;
}

/* ---- controls -------------------------------------------------------- */

/* Every text-like control, `number` included — it was missing until
   2026-08-17, so the composer's seat and update-window fields rendered as bare
   browser widgets beside styled ones, below the 44px target height and without
   the focus border the rest of the form gets. */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input:not([type]),
select {
  display: block;
  width: 100%;
  max-width: 24rem;
  height: 44px;
  padding: 0 12px;
  margin: 0.25rem 0 0.9rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--border-input);
  border-radius: var(--radius-element);
}

/* A focused control gets a RING, not just a recoloured border: colour alone
 * fails both "never colour as the sole distinction" and WCAG 2.4.7, and the
 * border tint is invisible to anyone who cannot separate the two blues. */
input:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

input:focus,
select:focus {
  border-color: var(--primary);
}

input[type="checkbox"] {
  width: auto;
  accent-color: var(--primary);
  margin-inline-end: 0.4rem;
}

label {
  display: block;
  margin-bottom: 0.2rem;
}

label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  margin: 0.6rem 0;
}

/* The other checkbox shape: a `<p>` holding a label FOLLOWED by its box
   (the bundle and distributor forms bind with `for=` rather than wrapping).
   Without this the block `label` above pushes the box onto its own line and
   leaves it orphaned under its text. */
p:has(> input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

p:has(> input[type="checkbox"]) > label {
  margin: 0;
}

/* The product picker: a `<details>` disclosure that opens like a dropdown and
   whose options are LINKS, so the choice applies on click. This surface ships
   no JavaScript, so a native `<select>` could only be applied by a button —
   see `web::product_menu`. The panel floats over the form rather than shoving
   it down, and scrolls once the catalog outgrows the box. */
.menu {
  position: relative;
  max-width: 24rem;
  margin-bottom: 0.9rem;
}

.menu > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  padding: 0 12px;
  background: var(--surface);
  border: 2px solid var(--border-input);
  border-radius: var(--radius-element);
  cursor: pointer;
  list-style: none;
}

/* The disclosure triangle is replaced by a chevron on the right, so the
   control reads as the dropdown it behaves like. */
.menu > summary::-webkit-details-marker {
  display: none;
}

.menu > summary::after {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  margin-inline-start: 0.6rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.menu[open] > summary::after {
  transform: translateY(2px) rotate(-135deg);
}

.menu > summary:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.menu-list {
  position: absolute;
  z-index: 5;
  inset-inline: 0;
  max-height: 17rem;
  overflow-y: auto;
  margin-top: 0.25rem;
  padding: 0.25rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-element);
  box-shadow: var(--shadow);
}

.menu-list a {
  display: block;
  padding: 0.45rem 0.7rem;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-small);
}

.menu-list a:hover {
  background: var(--hover);
}

/* The current option keeps a tick as well as its weight — never colour or
   boldness alone. */
.menu-list a.on {
  font-weight: 600;
}

.menu-list a.on::after {
  content: " ✓";
}

/* A label for something that is not a single control — a group of links or
   checkboxes — so it reads and spaces like the `<label>`s around it. */
.fieldlabel {
  margin: 0 0 0.25rem;
}

/* A named group of checkboxes: `<fieldset>`/`<legend>` is the accessible
   grouping, so it is worth having the box look deliberate. */
fieldset {
  max-width: 24rem;
  margin: 0.9rem 0;
  padding: 0.2rem 0.9rem 0.6rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-element);
}

legend {
  padding: 0 0.4rem;
  font-weight: 600;
}

/* `.btn` is the same control on an `<a>`. Semantics follow HTTP and the
   look follows intent: a GET stays a link (download it, edit it, open a
   confirmation step, Cancel one) but must not READ as a link when its job is
   to act on what is on screen — a bare underlined "Deactivate seat…" beside
   a filled button was not seen as an action at all. Navigation keeps the
   link look. The anchor needs the flex box and the box-sizing a `<button>`
   gets from the UA sheet; `.btn` (a class) also outranks the bare `a`
   colour, and the UA's `:visited` never beats an author rule. */
button,
.btn {
  height: 44px;
  padding: 0 1.2rem;
  font: inherit;
  font-weight: bold;
  color: var(--primary-text);
  background: var(--primary);
  border: 0;
  border-radius: var(--radius-element);
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  text-decoration: none;
  white-space: nowrap;
}

button:hover,
.btn:hover,
button:focus-visible,
.btn:focus-visible {
  background: var(--primary-hover);
}

/* One filled control per view; everything else that acts is SECONDARY — an
   outline in the text colour, so the primary keeps the eye. `:is()` takes
   its strongest argument's weight (a class), so this outranks the
   primary's `button:hover` and `.btn:hover` without an !important. */
:is(button, .btn).secondary {
  color: var(--text);
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--border-strong);
}

:is(button, .btn).secondary:hover,
:is(button, .btn).secondary:focus-visible {
  background: var(--hover);
}

/* The control that OPENS a destructive step ("Deactivate seat…",
   "Retire…"): an outline in the error tokens, never the filled
   `button.destructive` below — that look belongs to the affirmative on the
   confirmation page, and two red slabs would make opening the step look
   like doing it. Three classes outrank `button.destructive` either way. */
:is(button, .btn).secondary.destructive {
  color: var(--error-text);
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--error-text);
}

:is(button, .btn).secondary.destructive:hover,
:is(button, .btn).secondary.destructive:focus-visible {
  color: var(--error-text);
  background: var(--error-bg);
  box-shadow: inset 0 0 0 2px var(--error-text);
}

/* Inside a ledger row or the key's facts table: 32px, the house minimum
   (WCAG 2.5.8's floor is 24), so a button does not double a dense row's
   height. Forms and confirmation pages keep the full 44px. */
:is(button, .btn).compact {
  height: 32px;
  padding: 0 0.8rem;
  font-size: 0.88rem;
}

/* Dismiss and affirmative as one row — Cancel left, the verb right — at one
   baseline whatever mix of `<a class="btn">` and `<button>` it holds, and
   wrapping rather than overflowing on a phone. */
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

button.linklike {
  height: auto;
  padding: 0;
  font-weight: normal;
  color: inherit;
  background: none;
  text-decoration: underline;
}

button.linklike:hover,
button.linklike:focus-visible {
  background: none;
}

/* The destructive affirmative on a confirmation page ("Disable key"). The
   verb carries the meaning and the colour is the second signal, never the
   only one — so it is the error tokens the palette already carries, inverted
   to read as a button, and the hover swaps them back with an inset edge.
   The focus ring is the shared `button:focus-visible` outline, untouched. */
button.destructive {
  color: var(--error-bg);
  background: var(--error-text);
}

button.destructive:hover,
button.destructive:focus-visible {
  color: var(--error-text);
  background: var(--error-bg);
  box-shadow: inset 0 0 0 2px var(--error-text);
}

form.inline {
  display: inline;
}

/* Keyboard-first: the first Tab on any signed-in page jumps the brand bar and
 * the whole tab strip. Visible only while focused. */
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10;
  padding: 0.6rem 1rem;
  color: var(--text);
  background: var(--surface);
  border-radius: var(--radius-element);
  box-shadow: var(--shadow);
}

.skip:focus {
  left: 0.5rem;
  top: 0.5rem;
}

/* The skip target is focused programmatically; it must not draw a ring for it. */
main:focus {
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ---- signed-in frame ------------------------------------------------- */

/* The colophon is the page's tail margin, so it must sit at the tail: a
   column that fills the viewport keeps a short screen (an empty ledger, a
   confirmation page) from leaving the footer floating mid-page with the
   background below it. */
body.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.app > main {
  flex: 1;
  /* The frame is a COLUMN flexbox, and auto inline margins on a flex item
     switch stretch off — main would shrink-to-fit its content and a screen
     of narrow content (the dashboard's tiles and charts) would render in a
     sliver. Full width, then max-width caps and the auto margins center. */
  inline-size: 100%;
}

.topbar {
  background: var(--plain);
  color: var(--plain-text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

/* ONE frame width for every signed-in screen (2026-08-25): the width the
   ten-nowrap-column ledgers deserve before .tablewrap has to scroll, and
   the narrower screens keep their own caps (forms at 24rem) rather than a
   second frame. The WHOLE frame moves together — header, main and footer —
   so nothing reads orphaned; the page body still never scrolls sideways. */
.topbar .bar,
.topbar .tabs,
main,
.foot-inner,
.foot-bar-inner {
  max-width: 96rem;
  margin: 0 auto;
  padding-inline: 1rem;
}

.topbar .bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.6rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: inherit;
  font-weight: 600;
  text-decoration: none;
}

.brand img {
  width: 36px;
  height: 36px;
}

.session {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.9rem;
}

.topbar .tabs {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  padding-bottom: 0.4rem;
}

.tabs a {
  padding: 0.35rem 0.9rem;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-pill);
}

.tabs a:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* The top bar keeps the house blue in both themes, so what sits on it is
   pinned to the light palette rather than following the scheme. */
.tabs a.on {
  background: #ffffff;
  color: #00679e;
  font-weight: 600;
}

/* The bold-ghost: every tab and subtab reserves the width of its own BOLD
   label (an invisible zero-height copy, fed by data-label), so activating
   one — which bolds it — never widens it and never shifts its neighbours.
   Pure CSS; the label attribute is rendered server-side. */
.tabs a,
.subtabs a {
  text-align: center;
}

.tabs a::after,
.subtabs a::after {
  content: attr(data-label);
  display: block;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  font-weight: 600;
}

/* Sub-navigation WITHIN a screen — the mint modes. Links, not an APG
   tablist: this surface ships no JavaScript, so there is nothing to give a
   tablist its arrow keys and roving tabindex, and a link is the honest
   control anyway (the mode lands in the URL, so Back and a bookmark work).
   It sits on the page rather than on the brand bar, so unlike `.tabs` it
   follows the colour scheme. */
.subtabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
}

.subtabs a {
  padding: 0.35rem 0.9rem;
  color: inherit;
  text-decoration: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
}

.subtabs a:hover {
  background: var(--hover);
}

.subtabs a.on {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-text);
  font-weight: 600;
}

main {
  padding-block: 1.5rem;
}

main form {
  margin-bottom: 1rem;
}

main h1 + .key,
main p > .key {
  margin-bottom: 0.4rem;
}

.card {
  background: var(--surface);
  border-radius: var(--radius-container-large);
  padding: 1.4rem 1.6rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* The colophon — the sheet's tail margin: a brand block, the contact column
   and the social marks over a thin rule, then the copyright line. The blocks
   are `flex` rather than a fixed grid because each one is optional (an empty
   `[brand]` field drops it), and a three-column grid with one column filled
   reads as a mistake. The language switcher that used to live down here moved
   to /account, beside the appearance picker. */
.foot {
  border-top: 1px solid var(--border-strong);
  background: var(--surface);
  margin-top: 3rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.foot-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.5rem;
  padding-block: 2rem;
}

.foot-brand {
  flex: 2 1 18rem;
  text-align: center;
}

.foot-brand img {
  width: 60px;
  height: 60px;
  display: block;
  margin: 0 auto 0.8rem;
}

.foot-brand p {
  margin: 0 auto;
  max-width: 40ch;
  line-height: 1.6;
}

.foot-col {
  flex: 1 1 11rem;
}

.foot h2 {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  margin: 0 0 0.8rem;
  color: var(--muted);
}

.foot address {
  font-style: normal;
  line-height: 1.9;
}

.foot address a {
  color: var(--text);
  text-decoration: none;
}

.foot address a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.foot-social {
  list-style: none;
  display: flex;
  gap: 0.9rem;
  margin: 0;
  padding: 0;
}

.foot-social a {
  color: var(--muted);
  display: inline-flex;
  padding: 0.15rem;
  border-radius: var(--radius-small);
}

.foot-social a:hover {
  color: var(--primary);
}

.foot-social svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: currentColor;
}

.foot-bar {
  border-top: 1px solid var(--border);
}

.foot-bar-inner,
.guest-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  justify-content: space-between;
  padding-block: 0.9rem;
}

.foot-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
}

.foot .entity-name,
.guest-foot .entity-name {
  font-weight: bold;
}

/* Named for a screen reader, drawn for everyone else: the social glyphs are
   `aria-hidden`, so the network's name rides a hidden span rather than a
   title attribute nobody can focus. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---- data ------------------------------------------------------------ */

/* A wide ledger scrolls inside itself, never the page (the house rule —
   design-language.md): cells are nowrap by design, so without this the
   ten-column key ledger drags the whole page sideways and takes its row
   links with it. Every ledger already sits in this wrapper. */
.tablewrap {
  overflow-x: auto;
}

.tablewrap th,
.tablewrap td {
  white-space: nowrap;
}

/* ---- dashboard tiles, meter and charts ---- */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.8rem;
  margin-block: 1.2rem;
}

.tile {
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-container);
}

.tile-label {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* The hero number wears the font's default proportional figures — tabular
   digits look loose at display sizes and nothing here has to align. */
.tile-value {
  margin: 0.15rem 0 0;
  font-size: 2rem;
  font-weight: 600;
}

.tile-caption {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.meter {
  block-size: 0.5rem;
  margin-top: 0.65rem;
  overflow: hidden;
  background: var(--meter-track);
  border-radius: var(--radius-pill);
}

.meter-fill {
  display: block;
  block-size: 100%;
  background: var(--primary);
  border-radius: inherit;
}

.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 0 1.5rem;
}

.chart-card h2 {
  margin-bottom: 0.4rem;
}

.chart-card .subtabs {
  margin-bottom: 0.6rem;
}

/* The column chart: a LIST that IS the chart — vertical columns rising
   from one shared baseline, the sister dashboard's presentation without
   its canvas. Every class here is NAMESPACED (`.chart-cols`, `.col-*`):
   a component class must never be a bare generic word a frame class owns
   (`.bar` is the topbar's own container — that collision shipped once,
   and the theme test now pins its absence). */
.chart-cols {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 0.3rem 0 1.2rem;
  padding: 0;
  list-style: none;
  overflow-x: auto; /* a wide series scrolls inside itself, never the page */
}

.chart-col {
  display: flex;
  flex-direction: column;
  /* Equal shares of the card, shrinkable: a 12-bucket series always FITS
     the card instead of scrolling its most recent — most interesting —
     buckets out of the default view. Axis labels are terse to match. */
  flex: 1 1 0;
  min-inline-size: 0;
  /* The visual gap between columns. gap on the ul would break the shared
     baseline into dashes; padding keeps each plot's border continuous. */
  padding-inline: 0.2rem;
}

/* The fixed-height "canvas" a column's percentage height resolves against;
   its bottom border is the baseline, joining seamlessly across columns. */
.col-plot {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 0.25rem;
  block-size: 11rem;
  border-block-end: 1px solid var(--border);
}

.col-value {
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* The mark: thin, one hue, rounded at the data end — the TOP — and square
   at the baseline. It restates the number above it, nothing more; a zero
   bucket keeps a visible sliver rather than vanishing. */
.col-bar {
  inline-size: 100%;
  max-inline-size: 2.2rem;
  min-block-size: 2px;
  background: var(--primary);
  border-radius: 4px 4px 0 0;
}

.col-label {
  margin-block-start: 0.4rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  max-inline-size: 4.5rem;
  align-self: center;
  overflow-wrap: break-word;
}

/* ---- the ledger's filter strip ---- */

/* Filters stay visible above the ledger (the density rule). The GET form
   carries the typed fields; the menus beside it apply on click. */
.filter-form {
  display: flex;
  align-items: end;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.filter-form .field {
  display: block;
}

.filter-form label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
}

.filter-form input {
  margin: 0.25rem 0 0;
}

.filter-form button {
  height: 44px;
}

.filter-menus {
  display: flex;
  align-items: end;
  gap: 1.2rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}

.filter-menus .fieldlabel {
  font-size: 0.85rem;
  color: var(--muted);
}

.filter-clear {
  padding-block: 0.4rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.8rem 0 1.2rem;
  font-size: 0.92rem;
}

th {
  text-align: start;
  font-weight: 600;
  color: var(--muted);
}

th,
td {
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

tr:hover td {
  background: var(--hover);
}

.key,
.key-cell a {
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

/* The gap is tight because the row's actions are buttons now and carry
   their own edges; the 1rem it used to be was what kept two bare links from
   reading as one. */
.row-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.key {
  display: inline-block;
  padding: 0.6rem 1rem;
  font-size: 1.25rem;
  background: var(--hover);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-element);
}

.pill {
  display: inline-block;
  padding: 0.05rem 0.65rem;
  font-size: 0.82rem;
  border-radius: var(--radius-pill);
}

.pill.active {
  background: var(--success-bg);
  color: var(--success-text);
}

.pill.inactive {
  background: var(--error-bg);
  color: var(--error-text);
}

/* Red is "a person turned it off"; grey is "it ran out" — shown only when
   klm said the key has expired (`web::key_pill`). */
.pill.expired {
  background: var(--neutral-bg);
  color: var(--neutral-text);
}

/* ---- login ----------------------------------------------------------- */

body.guest {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem 1rem;
  color: var(--plain-text);
  background: var(--plain) url("/assets/background.webp") center / cover fixed
    no-repeat;
}

body.guest .logo {
  width: 128px;
  height: 128px;
}

body.guest h1 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.guest-box {
  width: 100%;
  max-width: 21rem;
  padding: 1.2rem;
  color: var(--text);
  background: var(--surface-blur);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-radius: var(--radius-container);
  box-shadow: var(--shadow);
}

.guest-box h2 {
  margin: 0 0 0.9rem;
  font-size: 1.05rem;
}

.guest-box input,
.guest-box select {
  max-width: none;
}

.guest-box button {
  width: 100%;
  margin-top: 0.4rem;
}

.guest-foot {
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--surface-blur);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-radius: var(--radius-container);
  box-shadow: var(--shadow);
}

.guest-foot a {
  color: inherit;
}
