/* haloc.css — the identity provider's design system.
 *
 * One stylesheet serves both surfaces: the server-rendered sign-in pages
 * (src/api/session_routes.cpp) and the admin console (ui/). They are built by
 * different toolchains and rendered by different processes, which is exactly
 * the condition under which two stylesheets drift apart and the same control
 * ends up looking like two controls. There is one file, and it is the source
 * for both.
 *
 * The palette is white, gray, royal blue and black. Blue is reserved: it marks
 * the one thing on a page that the user is there to do, and the focus ring. A
 * page with two blue buttons has one too many.
 *
 * Controls are outlined rather than filled — a 2px border, a 4px radius, and a
 * fill that arrives on hover. That is a deliberate choice for an identity
 * provider: a sign-in form should read as plain and mechanical, not as
 * marketing.
 */

/* ── Tokens ───────────────────────────────────────────────────────────────
   Referenced by name everywhere below. A deployment that wants its own
   branding overrides these on :root and touches nothing else. */
:root {
  --paper: #ffffff;
  --paper-sunk: #f6f7f9;      /* page background, table stripes, disabled fills */
  --ink: #10131a;             /* body text; near-black rather than #000, which
                                 vibrates against white at small sizes */
  /* Derived rather than fixed, so a tenant who sets text or muted gets the
     soft variants along with them instead of the shipped grays. */
  --ink-soft: color-mix(in srgb, var(--ink) 80%, var(--paper));  /* de-emphasized body text */

  --slate: #6b7280;           /* secondary text, icon strokes at rest */
  --slate-soft: color-mix(in srgb, var(--slate) 65%, var(--paper));  /* placeholder text */
  --slate-faint: #e4e7ec;     /* hairlines, table rules, input borders */

  /* Text boxes and dropdowns. Separate from the card border so a theme can
     outline cards and controls differently; both default to the hairline. */
  --input-border-color: var(--slate-faint);
  --input-border-width: 1px;
  /* The marks drawn inside a control: dropdown chevron, stepper arrows,
     Show/Hide and Clear. One token so they always agree. */
  --control-icon: var(--slate);
  /* On hover the mark takes the text color, and the fill behind it is a tint
     of that same color, so the two always belong together. */
  --control-hover: color-mix(in srgb, var(--ink) 8%, transparent);

  --royal: #2647c8;           /* the accent. Primary action, focus, active nav */
  --royal-deep: #1b348f;      /* hover/active of the above */
  --royal-soft: #eaeeff;      /* tinted fills behind selected rows and chips */
  --royal-ink: #ffffff;       /* what reads on a --royal fill: the filled
                                 button's label and its icon. Not --paper.
                                 They are the same color here and are not the
                                 same question, and a theme with a tinted card
                                 and a saturated accent needs to answer them
                                 separately. */

  /* Two tints over --paper-sunk, at the positions in the `body` rule below.
     Transparent by default, so the page is flat until a theme asks for them.
     Fully transparent black rather than the keyword `transparent`: the value
     is what a color input round-trips, and the keyword is not. */
  --gradient-start: #00000000;
  --gradient-end: #00000000;

  /* Secondaries, used only for status. Each is a hue the palette does not
     otherwise spend, so none of them can be mistaken for the accent. */
  --danger: #b42318;
  /* Derived from --danger rather than fixed, because --danger is the one a
     tenant can set. When it was a literal, branding moved the error notice's
     spine and its text to the tenant's red and left the fill behind them the
     shipped pink, so the one part of the bar with the most area on screen was
     the part that ignored the setting. Mixing against --paper keeps the tint
     following the surface as well, which matters on a dark theme where a fixed
     pale pink would be a bright block. */
  --danger-soft: color-mix(in srgb, var(--danger) 12%, var(--paper));
  --success: #17663c;
  --success-soft: color-mix(in srgb, var(--success) 10%, var(--paper));
  --warning: #8a5a00;
  --warning-soft: color-mix(in srgb, var(--warning) 10%, var(--paper));

  --radius: 4px;
  --radius-lg: 10px;
  --border: 2px;              /* the outline weight that defines the button */

  --shadow-sm: 0 1px 2px color-mix(in srgb, var(--ink) 6%, transparent);
  --shadow: 0 8px 24px color-mix(in srgb, var(--ink) 10%, transparent);
  /* Mixed from --royal rather than the literal rgba() this was, which pinned
     the focus ring to the shipped blue: a tenant who set a green accent got a
     green button with a blue halo around it on focus. */
  --focus: 0 0 0 3px color-mix(in srgb, var(--royal) 35%, transparent);

  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* One height for every control on a row — button, input, select — so a form
     row reads as a single band rather than as things of several sizes. */
  --control-h: 40px;
  --control-h-sm: 32px;

  /* Not `light dark`. The palette is defined in light terms and a browser
     forcing dark form controls into it produces black-on-black inputs. A dark
     theme is a matter of overriding the tokens above, not of asking the UA to
     improvise one. */
  color-scheme: light;
}

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

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  /* The flat page color, with two optional tints laid over it. Their positions
     are fixed here rather than exposed, because a position is layout and this
     feature is values: a theme supplies two colors and gets the composition the
     stylesheet composes. Both are transparent by default, so this renders
     exactly as the single `background: var(--paper-sunk)` it replaces until one
     of them is set. background-color, not a third layer in the shorthand, so
     the page still has a color to paint an overscroll with. */
  background-color: var(--paper-sunk);
  background-image:
    radial-gradient(circle at 85% 10%, var(--gradient-start), transparent 50%),
    radial-gradient(circle at 15% 90%, var(--gradient-end), transparent 55%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--royal); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--royal-deep); }

/* The icon sprite is inlined into the page so that <use> resolves without a
   second request. It defines symbols and draws nothing, but as an inline
   element it still generates a line box, which showed as a band of empty space
   above the page. It cannot hide itself with a style attribute, because the
   Content-Security-Policy has no 'unsafe-inline' in style-src. */
.haloc-sprite,
#haloc-sprite { display: none; }

/* One focus treatment for everything. :focus-visible rather than :focus, so a
   pointer user clicking a button does not get a ring they did not ask for. */
:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: var(--radius);
}

/* ── Icons ────────────────────────────────────────────────────────────────
   The sprite (assets/haloc-icons.svg) is drawn in the double-stroke style: 1.3
   stroke on a 24 grid, butt caps, miter joins, a 2.7 unit center-to-center gap
   between parallel strokes. Consequences for the CSS: the stroke is set on the
   symbol and must not be overridden per-size, or the parallel lines thicken
   until they merge; and the icons are stroke-only, so they take their color
   from `currentColor` like text does.

   Below about 18px the twin strokes stop resolving as two lines, so there is no
   size smaller than that here. */
.icon {
  width: 24px;
  height: 24px;
  flex: none;
  display: inline-block;
  vertical-align: -0.28em;
  color: inherit;
}
/* A small button is 32px tall, and a 24px mark inside it leaves no room to
   breathe, so the mark steps back down rather than the button growing. */
.btn--sm .icon { width: 20px; height: 20px; }
/* Inside tables the marks carry meaning on their own, so they stay full size. */
.table .btn--sm .icon, .badge .icon { width: 24px; height: 24px; }
.icon--lg { width: 28px; height: 28px; }
.icon--xl { width: 44px; height: 44px; }

/* The wordmark is not an icon: it has its own viewBox and its own aspect, so it
   gets its own class rather than a modifier on .icon. Both axes are set because
   a <use> of a symbol scales to the outer viewport and does not derive one
   dimension from the symbol's viewBox. The symbol is 82 by 32, and these are
   its own units doubled and halved rather than an arbitrary box: at 32 by 82
   every measurement in the drawing lands on a whole pixel, which is why the
   mark was moved up from 28 by 72. The 2.2-unit gap in the a that made it look
   soft at 28 is 2.2px here. */
.wordmark { display: block; height: 32px; width: 82px; flex: none; color: var(--royal); }
.wordmark--logo { width: auto; max-width: 160px; object-fit: contain; }
.wordmark--lg { height: 48px; width: 123px; }
/* A single letter on the wordmark's metrics but in its own 22-wide box, so the
   heights match a wordmark set beside it and only the width differs. */
.glyph { display: block; height: 32px; width: 22px; flex: none; color: var(--royal); }
.glyph--lg { height: 48px; width: 33px; }

/* ── Buttons ──────────────────────────────────────────────────────────────
   The outlined button is the default. It carries a 2px slate border at rest and
   fills with ink on hover — an inversion rather than a tint, so the hovered
   state is unmistakable at a glance and does not depend on distinguishing two
   similar grays. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: var(--control-h);
  padding: 0 0.9rem;
  border: var(--border) solid var(--slate);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: 600 0.92rem/1 var(--font-ui);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
/* A press moves the button 1px down. It is the cheapest possible confirmation
   that the click landed, and it costs no color. */
.btn:active { transform: translateY(1px); }

/* The one action the page exists for. Filled, so it is found without reading. */
.btn--primary {
  background: var(--royal);
  border-color: var(--royal);
  color: var(--royal-ink);
}
.btn--primary:hover {
  background: var(--royal-deep);
  border-color: var(--royal-deep);
  color: var(--royal-ink);
}

/* Destructive. Outlined at rest so it is not mistaken for the primary action,
   and only fills red once the pointer is on it and the intent is deliberate. */
.btn--danger { border-color: var(--danger); color: var(--danger); }
.btn--danger:hover { background: var(--danger); border-color: var(--danger); color: var(--paper); }

/* Borderless, for actions that sit inside a row that already has an outline of
   its own — a second box inside a box reads as a control that is not one. */
.btn--quiet { border-color: transparent; background: transparent; color: var(--slate); }
.btn--quiet:hover { background: var(--paper-sunk); border-color: var(--slate-faint); color: var(--ink); }

.btn--sm { min-height: var(--control-h-sm); padding: 0 0.6rem; font-size: 0.85rem; }
/* Square, for an icon with no label. The width matches the height exactly, so a
   row of them is a row of squares. */
.btn--icon { width: var(--control-h); padding: 0; }
.btn--sm.btn--icon { width: var(--control-h-sm); }
.btn--block { width: 100%; }

/* Off, two ways. `disabled` is the plain case. aria-disabled is the case that
   has something to say — a real disabled button takes no pointer events, so its
   tooltip could never appear, and the explanation is usually the whole point. */
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn:disabled:hover,
.btn[aria-disabled="true"]:hover {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--slate);
  transform: none;
}
.btn--primary:disabled:hover,
.btn--primary[aria-disabled="true"]:hover {
  background: var(--royal);
  border-color: var(--royal);
  color: var(--royal-ink);
}

/* ── Tooltip ──────────────────────────────────────────────────────────────
   The explanation the aria-disabled rule above exists to make room for: why a
   control is off, why a field will not take what was typed. Not for anything a
   reader must have — a tooltip does not survive touch, print, or a narrow
   window, so what only a tooltip says is what a good half of readers never get.
   Text they need is a .field__hint, in the page, always visible.

   Pure CSS on an attribute rather than a component, because both sides of this
   codebase have to be able to raise one: the console builds its DOM in
   TypeScript, the sign-in and setup pages are strings of HTML from C++, and an
   attribute is the only thing they can both write without sharing code.

   Deep royal rather than the near-black --ink, so the surface is the palette's
   and not a second dark grey competing with body text; over it --royal-ink,
   the same color the filled button's label uses, which at #ffffff on #1b348f
   clears AA several times over at this size. */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 0.4rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  /* Wide enough for a sentence, narrow enough that it does not become a
     paragraph nobody reads standing up. */
  width: max-content;
  max-width: 18rem;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius);
  background: var(--royal-deep);
  color: var(--royal-ink);
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.35;
  text-align: left;
  /* pre-line, so a tooltip carrying two readings (local, then UTC) can put
     each on its own line. */
  white-space: pre-line;
  /* Never the target of its own hover: a tooltip that can be pointed at can
     flicker on and off as the pointer crosses the seam between it and the
     control. */
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease-in;
}
/* :focus-visible and not :focus, so the tooltip does not flash on every mouse
   click of a control that happens to carry one. */
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  [data-tooltip]::after { transition: none; }
}

/* A scroller (.table-wrap) clips anything absolutely positioned inside it, so
   there the pseudo-element is dropped and installTooltips() in ui/dom.ts draws
   the same bubble as a fixed .tooltip-float on the body instead. */
.table-wrap [data-tooltip]::after { display: none; }
.tooltip-float {
  position: fixed;
  z-index: 1000;
  width: max-content;
  max-width: 18rem;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius);
  background: var(--royal-deep);
  color: var(--royal-ink);
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.35;
  text-align: left;
  white-space: pre-line;
  pointer-events: none;
}

/* ── Fields ───────────────────────────────────────────────────────────────
   Inputs carry a 1px border, not the button's 2px: they are surfaces to be
   filled rather than things to be pressed, and matching the button weight made
   every form look like a stack of buttons. */
.field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.9rem; }
.field__label { font-size: 0.85rem; font-weight: 600; color: var(--ink); }
.field__hint { font-size: 0.78rem; color: var(--slate); }

/* The label, and opposite it whatever that field needs to offer — at present
   only "Forgot your password?". Baseline alignment rather than centre so the
   two read as one line of text; the link is lighter than the label because the
   label names the box and the link is a way out of it.

   margin-inline-start rather than a float or text-align, so the pair swap ends
   in a right-to-left locale along with everything else on the page. */
.field__row { display: flex; align-items: baseline; gap: 0.75rem; }
.field__aside {
  margin-inline-start: auto;
  font-size: 0.78rem;
  font-weight: 400;
  white-space: nowrap;
}

/* A checkbox reads to the left of its caption, so this row is horizontal and
   the whole thing is one <label> — the caption is part of the hit target,
   which on a phone is most of the target there is. */
.field--inline {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
}
.checkbox {
  width: 16px;
  height: 16px;
  flex: none;
  accent-color: var(--royal);
  cursor: pointer;
}

.input,
.select {
  width: 100%;
  min-height: var(--control-h);
  padding: 0 0.65rem;
  border: var(--input-border-width) solid var(--input-border-color);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: 400 0.95rem var(--font-ui);
}
.input::placeholder { color: var(--slate-soft); }
.input:hover,
.select:hover { border-color: var(--slate); }
.input:focus-visible,
.select:focus-visible { border-color: var(--royal); box-shadow: var(--focus); }
.input:disabled,
.select:disabled { background: var(--paper-sunk); color: var(--slate); cursor: not-allowed; }

/* A select is a field, but it is also the only field whose value is chosen
   rather than typed, so it says so with a chevron. A pseudo-element cannot be
   placed on a replaced element and a background image cannot take the theme's
   color, so the mark is a real icon laid over the right edge: .select-wrap
   holds a native select, .icon-picker holds the console's own dropdown. It is
   an icon slot like any other, so a tenant can pick another mark; the default
   is i-chevron-down. Clicks pass through it to the control beneath. */
.select {
  appearance: none;
  padding-right: 2.2rem;
}
.select-wrap { position: relative; min-width: 0; }
.select__mark {
  position: absolute;
  top: 50%;
  right: 0.55rem;
  display: inline-flex;
  width: 18px;
  height: 18px;
  translate: 0 -50%;
  color: var(--control-icon);
  pointer-events: none;
}
.select__mark .icon { width: 18px; height: 18px; }
.select__mark img.icon { object-fit: contain; }
/* A fixed height rather than only a minimum: with appearance: none, browsers
   put a select's text at the top of any extra height instead of centring it. */
.select:not([multiple]):not([size]) { height: var(--control-h); padding-block: 0; }
/* The open list marks the current choice the same way in every app, rather
   than leaving it to whatever the browser's default popup does. */
.select option { font-weight: 400; background: var(--paper); color: var(--ink); }
.select option:checked { font-weight: 600; background: var(--royal-soft); color: var(--royal-deep); }

/* A field the operator has fixed in configuration — the realm on a client
   sign-in page. Shown, because the user is entitled to know which realm they
   are authenticating against, but flat and unfocusable: it is a statement of
   fact, not an input, and rendering it as a disabled <input> invited people to
   click at it and wonder why nothing happened. */
.field__fixed {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: var(--control-h);
  padding: 0 0.65rem;
  border: 1px dashed var(--slate-faint);
  border-radius: var(--radius);
  background: var(--paper-sunk);
  color: var(--slate);
  font-size: 0.95rem;
}
.field__fixed .icon { color: var(--slate-soft); }

/* ── Passwords ────────────────────────────────────────────────────────────
   A password box and its Show/Hide control.

   The button sits inside the box, over its right edge, rather than beside it.
   Beside it, the control strip was as wide as a word of running text and the
   field it belonged to was visibly shorter than every other field on the form,
   which made the password look like a different kind of question.

   The cost is the padding reserved on the right, which the browser's own
   password manager also wants for its offer. It is reserved rather than
   negotiated: a manager that puts its key over ours is a cosmetic collision,
   where a manager that pushes our button out of the box is a control the user
   cannot reach. */
.password { position: relative; display: block; }
/* Room for the wider of the two words plus the gap. Applied to the box rather
   than to a wrapper so that the text scrolls out from under the button rather
   than behind it. */
.password .input { width: 100%; padding-right: 5.6rem; }
/* Quiet: no fill and no border, because a bordered button inside a bordered
   box reads as two controls. Sized to the taller word so the label swapping
   between Show and Hide does not move anything.

   Centred by insets rather than by `translateY(-50%)`, because `.btn:active`
   presses a button down a pixel with a transform of its own -- and a transform
   replaces rather than composes, so clicking dropped this button half its own
   height down the field. */
.reveal {
  position: absolute;
  top: 0.25rem;
  right: 0.3rem;
  bottom: 0.25rem;
  min-width: 4.9rem;
  min-height: 0;
  padding: 0 0.4rem;
  gap: 0.3rem;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--control-icon);
  font-weight: 600;
}
/* The one-pixel press is given up rather than reimplemented. The button's
   effect is immediate and unmistakable -- the field beside it changes from
   dots to letters -- so it needs no second confirmation that it was clicked. */
.reveal:active { transform: none; }
.reveal:hover { background: var(--control-hover); color: var(--ink); }
.reveal:focus-visible { box-shadow: var(--focus); }
.reveal .icon { width: 16px; height: 16px; flex: 0 0 auto; }

/* A text box with a Clear control inside its right edge, drawn as .reveal.
   The browser's own clear mark on a search box is hidden so there is one. */
.clearable { position: relative; display: block; }
.clearable .input { width: 100%; padding-right: 5.6rem; }
.clearable .input::-webkit-search-cancel-button { display: none; }
.clearable .reveal[hidden] { display: none; }

/* The countdown before an idle sign-out, pinned above everything. */
.idle-warning {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 1000;
  display: flex; align-items: center; gap: 1rem; max-width: calc(100% - 2rem);
  padding: .75rem 1rem; background: var(--warning-soft); color: var(--ink);
  border: var(--border) solid var(--warning); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}

/* ── Toggles ──────────────────────────────────────────────────────────────
   A boolean drawn as a control-sized mark (a check when on, a cross when off)
   rather than the platform's tick box. The input is still the state: moved off
   screen rather than `display: none`, so it stays in the tab order and the
   accessibility tree, and the whole row is a <label>. */
.toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.8rem;
  font-size: 0.9rem;
  cursor: pointer;
}
.toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.toggle__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: var(--control-h);
  height: var(--control-h);
  border: 1px solid var(--slate-faint);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--slate);
  box-shadow: var(--shadow-sm);
}
/* Both icons are in the markup and CSS shows one, so no script runs on change. */
.toggle__mark .icon:first-child { display: none; }
.toggle input:checked + .toggle__mark {
  border-color: var(--royal);
  background: var(--royal-soft);
  color: var(--royal-deep);
}
.toggle input:checked + .toggle__mark .icon:first-child { display: block; }
.toggle input:checked + .toggle__mark .icon:last-child { display: none; }
.toggle input:focus-visible + .toggle__mark {
  border-color: var(--royal);
  box-shadow: var(--focus);
}
.toggle:hover .toggle__mark { border-color: var(--royal); }
.toggle__label { min-width: 0; }

/* ── Secrets ──────────────────────────────────────────────────────────────
   Values shown once (recovery codes, client secrets, recovery keys) that must
   be copied exactly: monospace, selectable in one click, wrapped anywhere. */
.secret {
  display: block;
  margin-top: 0.4rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--slate-faint);
  border-radius: var(--radius);
  background: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  user-select: all;
}
.secret--code { white-space: pre-wrap; }
.secret-actions { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }

/* ── Finding a person (vault and share) ───────────────────────────────────── */
.lookup__row { display: flex; gap: 0.5rem; }
.lookup__row > .input { flex: 1 1 auto; min-width: 0; }
.lookup__result:empty { display: none; }
.lookup__result { margin: 0 0 0.9rem; }
.person { display: grid; gap: 0.15rem; margin: 0 0 0.75rem; }
.person .muted { font-size: 0.85rem; }

/* The file picker's button drawn as ours rather than the platform's. */
.file-input { padding: 0; border: 0; background: none; box-shadow: none; height: auto; }
.file-input::file-selector-button,
.file-input::-webkit-file-upload-button {
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  margin-right: 0.75rem;
  padding: 0 0.9rem;
  height: var(--control-h-sm, 34px);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--slate-faint);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.file-input::file-selector-button:hover,
.file-input::-webkit-file-upload-button:hover {
  border-color: var(--royal);
  color: var(--royal-deep);
}

/* The rules a password has to satisfy, ticked live as it is typed.
   Stated up front rather than after a rejected submission: a rule you are told
   about only once you have broken it is a rule you meet by guessing, and the
   guessing is done in a field whose contents you cannot see. */
.rules { margin: 0.1rem 0 0.9rem; padding: 0; list-style: none; display: grid; gap: 0.3rem; }
.rules__intro { margin: 0 0 0.45rem; font-size: 0.78rem; color: var(--slate); }
.rules li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.85rem;
  color: var(--slate);
}
/* The same mark the password policy page uses for a boolean, at the size a
   line of text can carry. It is the same question in both places -- is this
   condition on or off -- and answering it with a tick box there and a
   typographic bullet here made them look like different kinds of fact.
   Both icons are in the markup and CSS shows one, so nothing scripts the
   swap: the state is already in the DOM as data-met. */
.rules__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 1.65rem;
  height: 1.65rem;
  border: 1px solid var(--slate-faint);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--slate-soft);
  box-shadow: var(--shadow-sm);
}
.rules__mark .icon { width: 1rem; height: 1rem; }
/* A checkable rule shows a cross from the moment it is on screen, and swaps to
   a tick when it is satisfied. An empty mark was tried first, on the reasoning
   that an untested rule has not failed -- but a column of empty boxes reads as
   a rendering fault rather than as a state, and it gave no starting picture to
   change from, so the ticks arrived without anything visibly having moved. The
   cross is not an accusation here because the list is a statement of what the
   password will need, not a report on one that was submitted; the colour is
   what keeps it that way. */
.rules__mark .icon { display: none; }
.rules li .rules__mark .icon:last-child { display: block; }
.rules li[data-met="yes"] .rules__mark .icon:last-child { display: none; }
.rules li[data-met="yes"] .rules__mark .icon:first-child { display: block; }
.rules li[data-met="yes"] {
  color: var(--ink);
}
.rules li[data-met="yes"] .rules__mark {
  border-color: var(--success);
  background: var(--success-soft);
  color: var(--success);
}
/* Unmet rules are never drawn in the danger color while typing. Everything is
   unmet at the first keystroke, and a form that opens covered in red has
   accused the user of a mistake they have not had the chance to make. Red is
   reserved for the notice shown after a submission is actually refused. */
.rules li:not([data-met="yes"]) .rules__mark { color: var(--slate); }

/* ── Notices ──────────────────────────────────────────────────────────────
   A line of consequence: why the last attempt failed, or that something
   worked. Tinted fill, a 3px spine in the status color, no border — it is a
   message, not a container. */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  margin: 0 0 1rem;
  border-left: 3px solid var(--slate);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--paper-sunk);
  font-size: 0.88rem;
}
.notice .icon { margin-top: 0.05em; }
.notice--error { border-left-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.notice--success { border-left-color: var(--success); background: var(--success-soft); color: var(--success); }
.notice--warning { border-left-color: var(--warning); background: var(--warning-soft); color: var(--warning); }
/* A notice that has to enumerate rather than assert: which saved values are not
   the ones being enforced. Set at the notice's own size, because a list inside
   a message is still the message and not a table under it. */
.notice p { margin: 0; }
.notice__list { margin: 0.35rem 0 0; padding-left: 1.1rem; display: grid; gap: 0.2rem; }

/* ── Card ─────────────────────────────────────────────────────────────────
   The generic panel: paper, a hairline, a large radius. No hover behavior,
   because a card is not a link. */
.card {
  background: var(--paper);
  border: var(--card-border-width, 1px) solid var(--card-border-color, var(--slate-faint));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem 1.4rem;
}

/* ── Sign-in ──────────────────────────────────────────────────────────────
   The page a user meets before anything else, so it is the whole viewport with
   one card centered in it and nothing else competing.

   `min-height: 100svh` rather than `100vh`: on a phone the dynamic browser
   chrome makes vh taller than what is actually on screen, which pushed the
   Sign in button under the address bar on exactly the page where the button
   matters most. */
.auth {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.auth__card {
  width: 100%;
  max-width: 24rem;
  background: var(--paper);
  border: var(--card-border-width, 1px) solid var(--card-border-color, var(--slate-faint));
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow, var(--shadow));
  padding: 1.75rem 1.6rem 1.5rem;
}
.auth__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  color: var(--royal);
}
.auth__brand-name {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.auth__title { margin: 0 0 0.2rem; font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; }
.auth__lede { margin: 0 0 1.25rem; font-size: 0.9rem; color: var(--slate); }
.auth__submit { margin-top: 1.15rem; }

/* Recovery codes: two to a row, and a code is never split across lines. A
   grid rather than CSS columns, because columns break inside a code when the
   card is narrow and fill down-then-across, which is not the order printed. */
.auth__codes {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 0.25rem 2.5rem;
  margin: 0.75rem 0;
  padding-left: 0;
  list-style: none;
  font-family: var(--font-mono, ui-monospace, monospace);
}
.auth__codes li { white-space: nowrap; }

/* The realm choice as tiles, used instead of the dropdown once a theme gives
   any realm an icon of its own (realm_icons), so each realm is recognisable at
   a glance. */
.realm-choice { border: 0; padding: 0; margin-inline: 0; min-width: 0; }
.realm-choice__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
  gap: 0.5rem;
}
.realm-choice__option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--slate-faint);
  border-radius: var(--radius);
  background: var(--paper);
  cursor: pointer;
  min-width: 0;
  position: relative;
}
.realm-choice__option span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.realm-choice__option input { position: absolute; opacity: 0; pointer-events: none; }
.realm-choice__option img.icon { width: 1.25em; height: 1.25em; object-fit: contain; }
.realm-choice__option:has(input:checked) {
  border-color: var(--royal);
  box-shadow: 0 0 0 1px var(--royal);
  background: color-mix(in srgb, var(--royal) 6%, var(--paper));
}
.realm-choice__option:has(input:focus-visible) { outline: 2px solid var(--royal); outline-offset: 2px; }

/* ── Application shell ────────────────────────────────────────────────────
   Shared by the admin console and the self-service /account page, so the two
   are one product: the bar across the top, panels, tables, hints. */
.appbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem;
  min-height: 56px;
  background: var(--paper);
  border-bottom: var(--card-border-width, 1px) solid var(--card-border-color, var(--slate-faint));
}
.appbar__brand { display: flex; align-items: center; gap: 0.5rem; color: var(--royal); }
.appbar__brand-name { font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.appbar__mark { display: flex; align-items: center; flex: 0 0 auto; }
/* A tenant's logo is whatever shape they uploaded, and an SVG among them may
   carry no intrinsic size at all. Sized from the height with the width bounded
   and the content fitted inside. */
.appbar__logo,
.appbar__mark .auth__logo {
  display: block;
  height: 28px;
  width: auto;
  max-width: 12rem;
  margin: 0;
  object-fit: contain;
  object-position: left center;
}
/* Pushes everything after it to the right edge. */
.appbar__spacer { flex: 1 1 auto; }
/* Who you are signed in as. */
.appbar__principal {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--slate);
  min-width: 0;
}
.appbar__principal strong { color: var(--ink); font-weight: 600; }

.content__title { margin: 0 0 1rem; font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }

/* Boxing a form separates "here is what exists" from "here is how to add
   one", which an unboxed column of inputs left the reader to infer. */
.panel {
  background: var(--paper);
  border: var(--card-border-width, 1px) solid var(--card-border-color, var(--slate-faint));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.1rem;
  margin: 1.25rem 0;
  max-width: 34rem;
}
.panel__title { margin: 0 0 0.85rem; font-size: 0.95rem; font-weight: 700; }
/* Whatever ends a panel (a paragraph, a pager, a notice, or a wrapper ending
   in one) adds no space of its own, so every panel's bottom gap is its
   padding alone. */
.panel > :last-child,
.panel > :last-child > :last-child { margin-bottom: 0; }
/* Panels that pack against each other rather than lining up in rows. */
.panel-columns {
  columns: 26rem;
  column-gap: 1.25rem;
}
.panel-columns > .panel {
  /* A panel split across a column break would put half a form at the foot of
     one column and half at the head of the next. */
  break-inside: avoid;
  margin: 0 0 1.25rem;
  max-width: none;
  width: 100%;
}

/* Explanatory text under a heading or a control. */
.hint {
  margin: 0.4rem 0 0.8rem;
  font-size: 0.8rem;
  color: var(--slate);
  max-width: 46rem;
}
/* The same prose standing under a page heading. */
.hint--lede { margin: -0.5rem 0 1.25rem; font-size: 0.875rem; }

/* A value that will not be shown a second time. */
.callout {
  margin: 0.75rem 0;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--royal);
  border-left-width: 3px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--royal) 6%, var(--paper));
}
.callout__title { margin: 0; font-size: 0.85rem; font-weight: 700; color: var(--ink); }
.callout__text { margin: 0.3rem 0 0.6rem; font-size: 0.8rem; color: var(--slate); }

/* Wrapped in a scroller, so a wide table scrolls rather than the page. */
.table-wrap {
  overflow-x: auto;
  background: var(--paper);
  border: var(--card-border-width, 1px) solid var(--card-border-color, var(--slate-faint));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.table th {
  background: var(--paper-sunk);
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--slate);
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--slate-faint);
  white-space: nowrap;
}
.table td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--slate-faint);
  vertical-align: middle;
}
.table tbody tr:last-child td,
.table > tbody > tr:has(+ tr.row-detail[hidden]:last-child) > td { border-bottom: 0; }
/* Sortable column headers. The header holds a button rather than the cell
   being clickable, so it is keyboard reachable and keeps the cell's padding.
   Only sortable headers get one. */
.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  /* Inherited, so a sorted header is the same type as an unsorted one. */
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  cursor: pointer;
}
.th-sort:hover { color: var(--ink); }
.th-sort:focus-visible { outline: 2px solid var(--royal); outline-offset: 2px; }
.th-sort--active { color: var(--ink); }
/* Present on every sortable header and inked only on the active one, so the
   header row does not reflow as the sort moves. */
.th-sort__arrow {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  opacity: 0;
  transition: transform 120ms ease, opacity 120ms ease;
}
.th-sort:hover .th-sort__arrow { opacity: 0.4; }
.th-sort--active .th-sort__arrow { opacity: 1; }
/* One symbol, turned: ascending is the descending mark rolled over. */
.icon--turn-down { transform: rotate(180deg); }
.icon--turn-right { transform: rotate(90deg); }
.icon--turn-left { transform: rotate(-90deg); }
.icon--mirror { transform: scaleX(-1); }
/* Row actions sit together and never wrap into a second line inside a cell. */
.row-actions { display: flex; justify-content: flex-end; gap: 0.35rem; flex-wrap: nowrap; }

/* A row whose detail sits on its own line beneath it. The two <tr>s are one
   record, so the rule between them is dropped. Child combinators keep these
   from leaking into a table nested inside the detail. */
.table > tbody > tr.row-has-detail > td { border-bottom: 0; }
.table > tbody > tr.row-detail > td { padding-top: 0; background: var(--paper); }
/* A table opened under a row is as far from the bottom as from the sides. */
.table > tbody > tr.row-detail > td:has(.table-frame) { padding-bottom: 0.75rem; }
/* A row that is itself the control for its detail. */
.table > tbody > tr.row-expandable { cursor: pointer; }
.table > tbody > tr.row-expandable:focus-visible { outline: 2px solid var(--royal); outline-offset: -2px; }
.table td:has(> .row-expander) { width: 1%; text-align: right; }
.row-expander { display: inline-flex; color: var(--slate); padding: 0.35rem; margin: -0.35rem; cursor: pointer; }
/* The click lands on the chevron, not on the drawing inside it. */
.row-expander * { pointer-events: none; }
.row-expander .icon { transition: transform 0.15s ease; }
.table > tbody > tr.row-has-detail .row-expander .icon { transform: rotate(180deg); }
/* Under its row the strip has the table's width, so it wraps rather than
   pushing the table sideways. */
.row-detail .row-actions { justify-content: flex-start; flex-wrap: wrap; padding-bottom: 0.35rem; }
/* Delete, last in the strip, stands apart at the far end. */
.row-detail .row-actions > .btn--danger:last-child:not(:first-child) { margin-left: auto; }
/* Stated outright: the narrow layout gives rows display: block, which would
   otherwise beat the hidden attribute on a collapsed detail row. */
.table tbody tr.row-detail[hidden],
.table tbody tr[hidden] { display: none; }
/* "4 months ago" reads as one value; the name beside it wraps instead. */
.table time { white-space: nowrap; }
/* Inline boxes sat on the text baseline, leaving more room below than above. */
.table td > .badges, .table td > .badge, .table td > .row-expander { vertical-align: middle; }

/* A table with an add row beneath it, framed as one. */
.table-frame {
  background: var(--paper);
  border: var(--card-border-width, 1px) solid var(--card-border-color, var(--slate-faint));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.table-frame > .table-wrap,
.table-frame > div > .table-wrap { border: 0; border-radius: 0; box-shadow: none; }
/* A panel or frame opened from something else (a row's members, an inline
   form), outlined in the accent so it reads as belonging to what opened it. */
.panel--accent,
.table-frame--accent,
.inline-form { border-color: var(--royal); }
.table-frame > div > .hint:only-child { margin: 0; padding: 0.75rem; }
/* A footer of the frame, not a control beneath it, so adding reads as
   appending to this list. The add control sits at the left and the pager at
   the right, each the same distance from the frame's edge. */
.uri-group__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  /* The same inset as a table cell, so the add button lines up with the
     rows' left edge and the pager with their right. */
  padding: 0.55rem 0.75rem;
  line-height: 1.2;
  border-top: 1px solid var(--slate-faint);
  background: var(--paper-sunk);
}
.uri-group__footer:first-child { border-top: 0; }
.uri-group__footer:has(.field) { flex-direction: column; align-items: stretch; gap: 0.4rem; }
.uri-group__footer:has(form) { background: var(--paper); padding: 0.75rem; }
.uri-group__footer > .pager-host { margin-left: auto; }
.uri-group__footer > .pager-host:empty { display: none; }
.uri-group__footer:has(.field) > .pager-host { align-self: flex-end; }
/* With the form open the pager belongs to the table, not the form: it takes a
   full-width strip at the bottom of the frame, right-aligned to the frame. */
.uri-group__footer:has(form) > .pager-host:not(:empty) {
  align-self: stretch;
  margin: 0.35rem -0.75rem -0.75rem;
  padding: 0.55rem 0.75rem;
  border-top: 1px solid var(--slate-faint);
  background: var(--paper-sunk);
}
.uri-group__footer .pager { margin: 0; }
/* A paged table with nothing to add: the pager alone is the footer. */
.table-frame > .pager,
.table-frame > div > .pager {
  margin: 0;
  padding: 0.55rem 0.75rem;
  line-height: 1.2;
  align-items: center;
  border-top: 1px solid var(--slate-faint);
  background: var(--paper-sunk);
}
.uri-group__footer .pager { align-items: center; }
/* Footer buttons carry the table's icon size, not the small-button one. */
.uri-group__footer .btn--sm .icon,
.table-frame > .pager .btn--sm .icon,
.table-frame > div > .pager .btn--sm .icon { width: 24px; height: 24px; }
/* A toggle whose label swaps (Show/Hide, Reveal/Hide): both words share one
   grid cell, so the button is as wide as the longer and never resizes. */
.swap { display: inline-grid; }
.swap > * { grid-area: 1 / 1; }
.swap > [aria-hidden="true"] { visibility: hidden; }
/* password-help.js: the slot its Show/Hide mark is swapped in. */
.reveal__mark { display: contents; }
/* filePicker(): our button in place of the browser's file control. */
.file-picker { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.file-picker__input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-picker__input:focus-visible + .btn { box-shadow: var(--focus); }
.file-picker__name { font-size: 0.85rem; color: var(--slate); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The form an "Add" footer opens under a table. Short fields sit side by side;
   anything that is not a field (hints, toggles, headings, buttons) takes a
   line of its own. */
.table-add {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
  gap: 0.5rem 1rem;
  max-width: 48rem;
}
.table-add > .field { margin-bottom: 0; min-width: 0; }
.table-add input,
.table-add select,
.table-add textarea { max-width: 100%; }
.table-add > .toggle,
.table-add > .hint { margin: 0; }
.table-add > .toggle,
.table-add > .hint { margin: 0; }
.table-add > :not(.field) { grid-column: 1 / -1; }
.table-add > .section-title { margin: 0.6rem 0 0; }
.table-add > :first-child.section-title { margin-top: 0; }
.uri-add__buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; flex: 0 0 auto; }
.uri-add__buttons > .pager-host { margin-left: auto; }
.uri-add__buttons > .pager-host:empty { display: none; }
.uri-add__buttons .pager { margin: 0; }
.uri-group__add { min-width: 0; }
.uri-group__add:not(:has(form)) { display: flex; flex-wrap: wrap; gap: 0.35rem; }

/* A narrow table becomes a stack of labelled records: the heading row is
   dropped and every cell states its own column from `data-label`. */
@media (max-width: 640px) {
  /* The records are one list: flush, divided by a rule, square-cornered. The
     wrapper (or the frame around it) carries the rounded outline. */
  .table-wrap { overflow: hidden; }
  .table,
  .table tbody,
  .table tr,
  .table td { display: block; }
  .table thead { display: none; }
  .table tbody tr {
    padding: 0.25rem 0.75rem;
    background: var(--paper);
    border-bottom: 1px solid var(--slate-faint);
  }
  .table tbody tr:last-child,
  .table tbody tr:has(+ tr.row-detail[hidden]:last-child) { border-bottom: 0; }
  .table td {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--slate-faint);
    min-width: 0;
  }
  .table tbody tr td:last-child { border-bottom: 0; }
  .table td::before {
    content: attr(data-label);
    flex: 0 0 clamp(4.5rem, 30%, 8rem);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--slate);
  }
  .table td:empty { display: none; }
  .table td[data-label=""]::before { content: none; }
  .table td:has(> .row-expander) { display: block; width: auto; text-align: center; padding: 0.15rem 0; }
  .table code { white-space: normal; overflow-wrap: anywhere; }
  /* Actions take the card's width as a grid of buttons, unlabelled. */
  .table td[data-label="Actions"] { display: block; padding-top: 0.55rem; }
  .table td[data-label="Actions"]::before { content: none; }
  .table td[data-label="Actions"] .row-actions,
  .table tbody tr.row-detail .row-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
    gap: 0.4rem;
  }
  .table td[data-label="Actions"] .row-actions .btn,
  .table tbody tr.row-detail .row-actions .btn { width: 100%; justify-content: center; white-space: normal; text-align: center; }
  /* Under a row, one button to a line; two to a line (a 2×3 grid) once the
     card is wide enough that no label has to wrap. */
  .table tbody tr.row-detail td { container-type: inline-size; }
  .table tbody tr.row-detail .row-actions { grid-template-columns: 1fr; }
  .table tbody tr.row-detail .row-actions > .btn--danger:last-child:not(:first-child) { margin-left: 0; }
  @container (min-width: 26rem) {
    .table tbody tr.row-detail .row-actions { grid-template-columns: repeat(2, 1fr); }
  }
  /* A detail row is the bottom of the record above it. */
  .table tbody tr.row-has-detail { border-bottom: 0; }
  .table tbody tr.row-detail td { display: block; border-bottom: 0; padding-top: 0.55rem; }
  .table tbody tr.row-detail td::before { content: none; }
  /* The footer under the records: the pager centred, then the Add button
     across the full width. The frame's colour change is the divider. */
  .uri-group__footer { flex-direction: column-reverse; align-items: stretch; border-top: 0; }
  .uri-group__footer > .pager-host { margin-left: 0; }
  .uri-group__footer .pager,
  .table-frame > .pager,
  .table-frame > div > .pager { justify-content: center; }
  .uri-group__add > .btn { width: 100%; justify-content: center; }
  .table-add { grid-template-columns: 1fr; }
  .uri-add__buttons > .pager-host { order: -1; flex: 1 0 100%; margin-left: 0; }
  .table-frame > .pager,
  .table-frame > div > .pager { border-top: 0; }
}

/* Status words in table cells. */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--paper-sunk);
  color: var(--slate);
}
.badge--good { background: var(--success-soft); color: var(--success); }
.badge--bad { background: var(--danger-soft); color: var(--danger); }
.badge--warn { background: var(--warning-soft); color: var(--warning); }

/* ── Number steppers ──────────────────────────────────────────────────────
   field() wraps every number box in these arrows, so they live here: a
   service without them showed the platform's spinner and ours side by side. */
.stepper { position: relative; display: block; }
.stepper .input { padding-right: 2.2rem; }
.stepper .input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
.stepper .input::-webkit-outer-spin-button,
.stepper .input::-webkit-inner-spin-button { appearance: none; margin: 0; }
.stepper__arrows {
  position: absolute;
  top: var(--input-border-width);
  right: var(--input-border-width);
  bottom: var(--input-border-width);
  display: flex;
  flex-direction: column;
  width: 1.9rem;
  border-left: var(--input-border-width) solid var(--input-border-color);
  border-radius: 0 var(--radius) var(--radius) 0;
  overflow: hidden;
}
.stepper__arrow {
  appearance: none;
  flex: 1 1 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: var(--paper-sunk);
  color: var(--control-icon);
  cursor: pointer;
}
.stepper__arrow + .stepper__arrow { border-top: var(--input-border-width) solid var(--input-border-color); }
.stepper__arrow:hover { background: var(--royal-soft); color: var(--royal-deep); }
.stepper__arrow .icon { width: 14px; height: 14px; }
.stepper__arrow--up .icon { transform: rotate(180deg); }
.stepper:focus-within .stepper__arrows { border-left-color: var(--royal); }

/* ── Dropdowns ────────────────────────────────────────────────────────────
   field() turns every single-choice select into this picker, so its styles
   live here: without them the list rendered as a bulleted list. */
.icon-picker { position: relative; min-width: 0; }
.icon-picker__button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-align: left;
  cursor: pointer;
}
.icon-picker__mark {
  flex: 0 0 24px;
  height: 24px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}
.icon-picker__mark img.icon { object-fit: contain; }
.icon-picker__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-picker__list {
  position: fixed;
  z-index: 1000;
  max-height: 18rem;
  overflow-y: auto;
  margin: 0;
  padding: 0.25rem;
  list-style: none;
  border: var(--input-border-width) solid var(--input-border-color);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.icon-picker__list[hidden] { display: none; }
.icon-picker__option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  font-size: 0.95rem;
}
.icon-picker__option:hover,
.icon-picker__option:focus { background: var(--paper-sunk); outline: none; }
.icon-picker__option[aria-selected="true"] { font-weight: 600; }

/* ── Pager ────────────────────────────────────────────────────────────────
   The footer under a paged table: the count sits directly left of the page
   buttons, and the pair sits at the right. */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.75rem;
  margin-bottom: 1rem;
}
.pager .hint { margin: 0; }
.pager__count { align-self: center; }
.pager__pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem;
}
.pager__pages .btn {
  min-width: var(--control-h-sm);
  padding: 0 0.4rem;
  font-variant-numeric: tabular-nums;
}
.pager__gap {
  padding: 0 0.15rem;
  color: var(--slate);
  user-select: none;
}
@media (max-width: 40rem) {
  .pager__pages .btn { width: auto; }
}

/* The self-service account page (/account): the console's shell without the
   navigation rail, its content centred. */
.account-page {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
}
.account-page .notice { margin-bottom: 1.25rem; }
.account-page .table-wrap { margin: 0.5rem 0 0.85rem; }
/* Inside a frame the frame is the edge: no strip above the headings or
   below the last row. */
.account-page .table-frame > .table-wrap,
.account-page .table-frame > div > .table-wrap { margin: 0; }
.account__toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.85rem; }
.account__dialog { max-width: 24rem; width: calc(100% - 2rem); }
.account__actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }
@media (max-width: 40rem) {
  .appbar { flex-wrap: wrap; padding: 0.5rem 1rem; }
  .account-page { padding: 1rem 0.75rem 2rem; }
  .account-page .appbar__principal span { display: none; }
}

/* A second way in, such as "Sign in with a passkey", under the form. Stacked
   rather than side by side, because translated labels do not fit half a card;
   the gap keeps it from reading as part of the primary button. */
.auth__alternative { margin-top: 0.85rem; }

/* The proof-of-work sentence, between the last field and the submit button.
   Its own margins are dropped: a bare <p> carries the browser's 1em top and
   bottom, which is a paragraph's worth of air on either side of one quiet
   line of hint text.

   The solver removes the paragraph once it has a solution, and marks the form.
   Without that mark the field above and the button below keep their own
   margins, which then meet and add up to twice the usual gap -- a hole exactly
   where a sentence used to be, which reads as something having gone missing
   rather than something having finished. */
.auth__work { margin: 0; }
.auth__form--solved .auth__submit { margin-top: 0.25rem; }

/* The "New here? Create an account" line. Quiet on purpose: it sits directly
   under the submit button, and anything that competes with the button would be
   offering a detour to people who do have an account and meant to press it. */
.auth__aside {
  margin: 0.85rem 0 0;
  text-align: center;
  font-size: 0.875rem;
}
/* Beneath the card: what the sign-in is for. The application the user is being
   returned to, and under it the hostname serving the form. The application
   leads because it is the name the user recognises — arriving here by redirect,
   the identity provider's hostname is often one they have never seen. The host
   still follows, in mono, as the technical fact rather than the answer. */
.auth__foot {
  margin: 1rem 0 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--slate);
}
.auth__host { font-family: var(--font-mono); color: var(--ink); }
/* A tenant's uploaded or linked mark, in place of the default shield. Bounded
   in both directions: the file is supplied by the tenant and an intrinsic size
   of 2000px would otherwise decide the layout of the sign-in page. */
.auth__logo {
  display: block;
  max-height: 40px;
  max-width: 180px;
  width: auto;
  height: auto;
}
/* A badge or group mark in the footer. Smaller than the logo and centred in the
   paragraph that carries it, and bounded for the same reason: the file is the
   tenant's, and its intrinsic size is not a layout decision. */
.auth__footer-image {
  display: inline-block;
  max-height: 28px;
  max-width: 140px;
  width: auto;
  height: auto;
}
/* The tenant's copyright or legal line, below the origin. Quieter than the
   origin, because it is the least important thing on the page. */
.auth__legal {
  margin: 0.35rem 0 0;
  text-align: center;
  font-size: 0.72rem;
  color: var(--slate-soft);
}
.auth__link { color: var(--slate); text-decoration: underline; }
.auth__link:hover { color: var(--royal); }

@media (max-width: 480px) {
  .auth { padding: 0; align-items: stretch; }
  .auth__card {
    max-width: none;
    min-height: 100svh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}

/* Touch targets. A 40px control is comfortable under a mouse and a coin-toss
   under a thumb, and these are the controls a user meets first. */
@media (max-width: 640px) {
  :root { --control-h: 46px; --control-h-sm: 38px; }
  /* The checkbox grows too. It does not scale with --control-h because a
     46px checkbox looks broken, but 16px under a thumb is a miss. */
  .checkbox { width: 20px; height: 20px; }
  .field--inline { min-height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
  .btn:active { transform: none; }
}
