/*
 * Tekla MCP Hub — app layer on top of tokens.css and components.css.
 * Semantic tokens only; no new colors, sizes or shadows.
 */

:root { --font-sans: "Inter", "Inter Fallback", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
/* biome-ignore lint/complexity/noImportantStyles: `hidden` must win over any component's display. */
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
/*
 * Lucide's stroke for every sprite icon ("i-") and status mark ("s-"), inherited through its <use>, instead of five
 * attributes on each symbol. A symbol's own attributes (the filled Active dot) still win.
 */
use[href^="#i-"],
use[href^="#s-"] { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.quiet { color: var(--color-text-tertiary); }
code { overflow-wrap: anywhere; }
.truncate { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sensitive svg, .who__sub svg { flex: none; }

/* ------------------------------------------------------------------ */
/* Motion                                                              */
/* ------------------------------------------------------------------ */
/* Only transform and opacity animate. The ported components also fade colours on hover; here those changes are
   instant, which keeps hover crisp and leaves motion for things that move. */
.btn { transition: transform var(--duration-fast) var(--ease-out); }
.input, .select, .textarea, .switch, .nav-item, .list__row { transition: none; }
.skeleton { background: var(--color-bg-muted); animation: skeleton-pulse 1.4s var(--ease-in-out) infinite; }
@keyframes skeleton-pulse { 50% { opacity: 0.5; } }
@keyframes region-in { from { opacity: 0.6; } }
@keyframes underline-in { from { opacity: 0; transform: scaleX(0.6); } }
.is-swapped { animation: region-in var(--duration-base) var(--ease-out); }
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}

/* Skip link: the first stop for keyboard users, out of sight until it's focused. */
.skip-link {
  position: fixed; top: var(--space-2); left: var(--space-2); z-index: var(--z-tooltip);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--color-primary); color: var(--color-primary-fg);
  font-weight: var(--weight-medium);
  transform: translateY(calc(-100% - var(--space-4)));
}
.skip-link:focus { transform: none; }
.skip-link:hover { color: var(--color-primary-fg); }
main:focus { outline: none; }

/* ================================================================== */
/* Component overrides                                                 */
/* Everything that adjusts the ported components.css, which stays      */
/* byte-identical to design/.                                          */
/* ================================================================== */

/* ------------------------------------------------------------------ */
/* Tabs as links (the URL carries the filter)                          */
/* ------------------------------------------------------------------ */
a.tab, a.tab:hover { text-decoration: none; }
.tab[aria-current="page"] { color: var(--color-text); }
.tab[aria-current="page"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--color-text); border-radius: 2px; animation: underline-in var(--duration-base) var(--ease-out); }

/* ------------------------------------------------------------------ */
/* Menus (popover) and filter chips                                    */
/* ------------------------------------------------------------------ */
.menu[popover] {
  position: fixed; inset: auto; margin: 0;
  z-index: var(--z-dropdown);
  color: var(--color-text);
  opacity: 1;
  transform: none;
  transition:
    opacity var(--duration-base) var(--ease-out),
    transform var(--duration-base) var(--ease-out),
    overlay var(--duration-base) allow-discrete,
    display var(--duration-base) allow-discrete;
}
.menu[popover]:not(:popover-open) { opacity: 0; transform: translateY(-4px); }
@starting-style {
  .menu[popover]:popover-open { opacity: 0; transform: translateY(-4px); }
}
.menu--up[popover]:not(:popover-open) { transform: translateY(4px); }
@starting-style {
  .menu--up[popover]:popover-open { transform: translateY(4px); }
}
.menu form { margin: 0; }
.menu__item {
  width: 100%;
  border: 0; background: none;
  font: inherit; font-size: var(--text-sm); text-align: left;
  text-decoration: none;
}
a.menu__item:hover { color: var(--color-text); text-decoration: none; }
.menu__item:focus-visible { outline-offset: -2px; }
.menu__item .source { width: 18px; height: 18px; }
.menu__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu__item .menu__check { color: var(--color-accent); }
.menu__item--danger, .menu__item--danger svg { color: var(--tone-danger-fg); }
.menu__item--danger:hover { background: var(--tone-danger-bg); }

.toolbar__chips { display: contents; }
.toolbar .search { flex: none; }
.search input::-webkit-search-cancel-button, .search input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
/* Rendered in the swapped filter state so its link keeps the other filters; shown whenever the field has text. */
.search .search__clear { display: none; position: absolute; inset: 0 var(--space-1-5) 0 auto; margin: auto 0; }
.search:has(.input:not(:placeholder-shown)) .search__clear { display: inline-flex; }
.search .search__clear svg { position: static; color: inherit; }
.menu--scroll[popover] { max-height: min(360px, 60vh); overflow-y: auto; }
.menu__label.mono { font-size: var(--text-xs); }
.toolbar__clear { height: var(--control-sm); }
.chip-clear { margin-left: calc(-1 * var(--space-1)); }

/* ------------------------------------------------------------------ */
/* Dialog (native <dialog>)                                            */
/* ------------------------------------------------------------------ */
dialog.dialog {
  padding: 0;
  color: var(--color-text);
  opacity: 1;
  transform: none;
  transition:
    opacity var(--duration-slow) var(--ease-out),
    transform var(--duration-slow) var(--ease-out),
    overlay var(--duration-slow) allow-discrete,
    display var(--duration-slow) allow-discrete;
}
dialog.dialog:not([open]) { opacity: 0; transform: scale(0.98); }
@starting-style {
  dialog.dialog[open] { opacity: 0; transform: scale(0.98); }
}
dialog.dialog::backdrop {
  background: var(--color-overlay);
  opacity: 1;
  transition:
    opacity var(--duration-slow) var(--ease-out),
    overlay var(--duration-slow) allow-discrete,
    display var(--duration-slow) allow-discrete;
}
dialog.dialog:not([open])::backdrop { opacity: 0; }
@starting-style {
  dialog.dialog[open]::backdrop { opacity: 0; }
}
.dialog form { margin: 0; }
.dialog--wide { width: min(640px, calc(100vw - var(--space-8))); }
.dialog__text { margin: 0; color: var(--color-text-secondary); line-height: var(--leading-normal); }

/* ------------------------------------------------------------------ */
/* Toast                                                               */
/* ------------------------------------------------------------------ */
.toast-host {
  position: fixed; left: 50%; bottom: var(--space-6); z-index: var(--z-toast);
  width: max-content; max-width: calc(100vw - var(--space-8));
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  opacity: 0;
  transform: translateY(8px);
  visibility: hidden;
  transition:
    opacity var(--duration-base) var(--ease-out),
    transform var(--duration-base) var(--ease-out),
    visibility 0s linear var(--duration-base);
}
.toast.is-on {
  opacity: 1;
  transform: none;
  visibility: visible;
  pointer-events: auto;
  transition: opacity var(--duration-base) var(--ease-out), transform var(--duration-base) var(--ease-out), visibility 0s;
}
@starting-style {
  .toast.is-on { opacity: 0; transform: translateY(8px); }
}

/* ------------------------------------------------------------------ */
/* Lists, rows and empty states                                        */
/* ------------------------------------------------------------------ */
.list__row .end form { margin: 0; }
.list > .empty { padding: var(--space-12) var(--space-6); }
.empty__title { margin: 0; color: var(--color-text); }
.empty__text { margin: 0; max-width: 44ch; }
.list__row:has(.menu:popover-open) { background: var(--color-bg-subtle); }
.list__row:has(.menu:popover-open) .btn--ghost { opacity: 1; }
.list:focus { outline: none; }
/* A row name is a flex box, and a flex box clips its text without the ellipsis. */
.who strong.truncate { display: block; }
.list__row .who code { font-size: var(--text-sm); }
.list__row .meta.right { padding-right: var(--space-2); }
.empty--compact { padding: var(--space-8) var(--space-6); }
/* A block (not flex) item, so a long meta line ends in an ellipsis rather than a clipped word. */
.who__sub > .sensitive { display: block; }
.who__sub > .sensitive svg { display: inline-block; margin-right: var(--space-1); vertical-align: -1px; }
/* The email gives way first, since it is also in the tooltip; the meta only truncates once the email is down to a few letters. */
.who__sub > :first-child { flex: 0 1000 auto; min-width: 6ch; overflow: hidden; text-overflow: ellipsis; }
/* At full width the meta keeps its size (sharing the shortfall would cost it a sub-pixel and an ellipsis); narrower,
   it shrinks too, once the email is down to a few letters. */
.who__sub > :not(:first-child) { flex: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1279px) {
  .who__sub > :not(:first-child) { flex: 0 1 auto; }
}
/* Row actions revealed on hover stay visible where there is no hover. */
@media (hover: none) {
  .list__row .btn--ghost { opacity: 1; }
}

/* ------------------------------------------------------------------ */
/* Buttons, switches, segmented controls and avatars                   */
/* ------------------------------------------------------------------ */
.btn--block { width: 100%; }
/* A switch that submits its own form: the same look as the checkbox switch. */
button.switch { border: 0; padding: 0; }
button.switch[aria-checked="true"] { background: var(--color-accent); }
button.switch[aria-checked="true"]::after { transform: translateX(14px); }
button.switch[aria-busy="true"] { cursor: progress; }
.switch:focus-visible { border-radius: var(--radius-full); }
/* The selected segment needs its edge in dark mode, where the raised surface is darker than the track. */
.segmented button[aria-pressed="true"] { box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--color-border); }
:root[data-theme="dark"] .segmented button[aria-pressed="true"] { background: var(--color-bg-emphasis); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .segmented button[aria-pressed="true"] { background: var(--color-bg-emphasis); }
}
.segmented button:focus-visible { outline-offset: 0; }
.segmented .segmented__sensitive[aria-pressed="true"] { color: var(--sensitive-fg); }
/* The segmented control as links: the range lives in the URL. */
.segmented--links a {
  display: inline-flex; align-items: center;
  height: var(--control-sm);
  padding: 0 var(--space-3);
  border-radius: 5px;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-decoration: none;
  white-space: nowrap;
}
.segmented--links a:hover { color: var(--color-text); text-decoration: none; }
.segmented--links a[aria-current="page"] { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--color-border); }
.segmented--links a:focus-visible { outline-offset: 0; }
.avatar--xl { --size: 48px; font-size: var(--text-md); }

/* ------------------------------------------------------------------ */
/* Stats                                                               */
/* ------------------------------------------------------------------ */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-3); margin-bottom: var(--space-6); }
.stat { display: grid; align-content: start; min-width: 0; }
.stat__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat__delta { line-height: var(--leading-snug); }
.stat__delta--warn { display: flex; align-items: center; gap: var(--space-1); color: var(--tone-warning-fg); font-weight: var(--weight-medium); }
.stat__delta--warn svg { width: 12px; height: 12px; flex: none; }
.stat--hero { grid-column: span 2; grid-row: span 2; align-content: space-between; padding: var(--space-5); }
.stat--hero .stat__label { color: var(--color-text); font-weight: var(--weight-medium); white-space: normal; }
/* A standalone number reads best in proportional figures. */
.stat--hero .stat__value { margin-top: var(--space-4); font-size: 48px; line-height: 1; font-variant-numeric: proportional-nums; }
.stat--hero .stat__delta { margin-top: var(--space-3); font-size: var(--text-sm); color: var(--color-text-secondary); max-width: 40ch; }

.status-card { display: grid; gap: var(--space-4); }

/* A state with its icon tile, a line or two about it and the action it needs (terms, the Microsoft connection). */
.status-block { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--space-3) var(--space-4); align-items: start; }
.status-block__icon { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: var(--radius-sm); background: var(--color-bg-muted); color: var(--color-text-secondary); }
.status-block__icon svg { width: var(--icon-md); height: var(--icon-md); }
.status-block__icon--ok { background: var(--tone-success-bg); color: var(--tone-success-fg); }
.status-block__icon--warn { background: var(--tone-warning-bg); color: var(--tone-warning-fg); }
.status-block__text { display: grid; gap: 2px; min-width: 0; line-height: var(--leading-normal); }
.status-block__text strong { font-weight: var(--weight-medium); overflow-wrap: anywhere; }
.status-block__text > span { font-size: var(--text-sm); color: var(--color-text-secondary); overflow-wrap: anywhere; }
.status-block__text > .status-block__hint { color: var(--color-text-tertiary); }
.status-block__meta { display: flex; flex-wrap: wrap; gap: 0 var(--space-4); font-size: var(--text-sm); color: var(--color-text-secondary); }
.status-block__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); align-self: center; }
.status-block__actions form { display: contents; }
@media (max-width: 640px) {
  .status-block { grid-template-columns: auto minmax(0, 1fr); }
  .status-block__actions { grid-column: 2; justify-content: flex-start; }
}

/* A development-only tool inside a card (the local stack adds it; production never renders it). */
.dev-tool { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); padding-top: var(--space-3); border-top: 1px dashed var(--color-border); }
.dev-tool__text { flex: 1; min-width: 12rem; font-size: var(--text-sm); color: var(--color-text-secondary); }

/* The shared confirm dialog: what a change applies to, and one line about its consequence. */
.dialog__items { display: flex; flex-wrap: wrap; gap: var(--space-1-5); margin: 0; padding: 0; list-style: none; }
.dialog__items li { display: inline-flex; align-items: center; gap: var(--space-1-5); padding: 2px var(--space-2); border-radius: var(--radius-sm); background: var(--color-bg-subtle); font-size: var(--text-xs); }
.dialog__items code { font-size: var(--text-xs); }
.dialog__items .sensitive svg { width: 12px; height: 12px; }
.dialog__note { display: flex; align-items: flex-start; gap: var(--space-2); margin: 0; font-size: var(--text-sm); color: var(--color-text-secondary); }
.dialog__note:not(.banner) > svg { width: var(--icon-sm); height: var(--icon-sm); flex: none; margin-top: 2px; color: var(--tone-success-fg); }
.dialog__note[hidden], .dialog__items[hidden] { display: none; }
/* ------------------------------------------------------------------ */
/* App shell                                                           */
/* ------------------------------------------------------------------ */
.sidebar__foot { display: grid; gap: var(--space-3); }
.sidebar__close { display: none; }
.me__name { font-weight: var(--weight-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .btn + .btn { margin-left: 0; }
.nav-item .nav-item__count + .pulse { margin-left: var(--space-2); }
.nav-item[aria-current="page"] .nav-item__count { color: var(--color-text-secondary); }
/* A source that's switched off stays readable; the missing fill says it's off. */
.source--off { color: var(--color-text-tertiary); }

.theme-icon--dark { display: none; }
:root[data-theme="dark"] .theme-icon--light { display: none; }
:root[data-theme="dark"] .theme-icon--dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon--light { display: none; }
  :root:not([data-theme="light"]) .theme-icon--dark { display: block; }
}

.scrim { display: none; }

/* The environment badge ("Development"): the full word, or its first letters where a phone's top bar is tight. */
.env-badge { flex-shrink: 0; }
.env-badge__short { display: none; }

/* Below 768px the sidebar becomes a drawer behind the menu button. */
@media (max-width: 768px) {
  .sidebar {
    display: flex;
    position: fixed; inset: 0 auto 0 0; z-index: var(--z-dialog);
    width: min(288px, 85vw); height: 100dvh;
    border-right: 0;
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform var(--duration-slow) var(--ease-out), visibility 0s linear var(--duration-slow);
  }
  .sidebar__close { display: inline-flex; }
  .topbar .env-badge__long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .topbar .env-badge__short { display: inline; }
  .attention { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; }
  .attention > svg { margin-top: 2px; }
  .attention .btn { grid-column: 2; justify-self: start; margin-left: 0; }
  .list--people .who__sub > :not(:first-child) { display: none; }
  .app.is-drawer-open .sidebar {
    transform: none;
    visibility: visible;
    transition: transform var(--duration-slow) var(--ease-out), visibility 0s;
  }
  .scrim {
    display: block;
    position: fixed; inset: 0; z-index: var(--z-overlay);
    background: var(--color-overlay);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--duration-slow) var(--ease-out), visibility 0s linear var(--duration-slow);
  }
  .app.is-drawer-open .scrim {
    opacity: 1;
    visibility: visible;
    transition: opacity var(--duration-slow) var(--ease-out), visibility 0s;
  }
}
/* ------------------------------------------------------------------ */
/* Card shell (signed-out pages and errors)                            */
/* ------------------------------------------------------------------ */
.card-shell {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: var(--space-8) var(--space-4);
  background: var(--color-bg-subtle);
}
.card-shell__inner { width: min(440px, 100%); display: grid; justify-items: center; gap: var(--space-6); }
.card-shell__inner--wide { width: min(560px, 100%); }
.card-shell__head { display: flex; align-items: center; gap: var(--space-3); }
.card-shell__card { width: 100%; box-shadow: var(--shadow-sm); }
.card-shell__card .empty { padding: var(--space-8) var(--space-6); }
.card-shell__foot { margin: 0; font-size: var(--text-xs); color: var(--color-text-tertiary); text-align: center; }
.card-shell__foot p { margin: 0; }

/* ------------------------------------------------------------------ */
/* Card pages: sign-in, consent, terms                                 */
/* ------------------------------------------------------------------ */
/* A fade only: moving the card would move every control in it while it settles. */
@media (prefers-reduced-motion: no-preference) {
  .card-shell__inner:not(.card-shell__inner--still) { transition: opacity var(--duration-slow) var(--ease-out); }
  @starting-style {
    .card-shell__inner:not(.card-shell__inner--still) { opacity: 0; }
  }
}

.card-shell__body { display: grid; gap: var(--space-5); margin: 0; padding: var(--space-8); }
.card-head { display: grid; gap: var(--space-2); }
.card-head__sub { margin: 0; color: var(--color-text-secondary); line-height: var(--leading-normal); }
.card-head__sub strong { color: var(--color-text); font-weight: var(--weight-medium); overflow-wrap: anywhere; }
.card-shell__body .banner { line-height: var(--leading-normal); }
.card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }

.google-g {
  display: grid; place-items: center;
  width: 22px; height: 22px; flex: none;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  box-shadow: var(--shadow-xs);
}
.google-g svg { width: 14px; height: 14px; }

/* A secondary section inside a card (the local dev login) */
.card-section { display: grid; gap: var(--space-3); padding: var(--space-6) var(--space-8) var(--space-8); border-top: 1px solid var(--color-border-subtle); }
.card-section__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.card-section__head .eyebrow { margin: 0; }
.card-section__hint { margin: 0; font-size: var(--text-sm); color: var(--color-text-secondary); }
.choice-list { display: grid; gap: var(--space-0-5); margin: 0 calc(-1 * var(--space-2)); padding: 0; list-style: none; }
.choice-list form { margin: 0; }
.choice {
  display: flex; align-items: center; gap: var(--space-3);
  width: 100%; padding: var(--space-2);
  border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--color-text);
  font: inherit; text-align: left; cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-out);
}
.choice:hover { background: var(--color-bg-subtle); }
.choice:active { transform: scale(0.99); }
.choice__text { flex: 1; min-width: 0; display: grid; line-height: var(--leading-snug); }
.choice__text strong { font-size: var(--text-sm); font-weight: var(--weight-medium); }
.choice__text > span { font-size: var(--text-xs); color: var(--color-text-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choice__end { display: flex; align-items: center; gap: var(--space-2); flex: none; }
.choice--muted .choice__text strong { color: var(--color-text-tertiary); }

/* Consent */
.oauth-account {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-bg-subtle);
}
.oauth-account__text { flex: 1; min-width: 0; display: grid; line-height: var(--leading-snug); }
.oauth-account__text strong { font-weight: var(--weight-medium); }
.oauth-account__text > span { font-size: var(--text-sm); color: var(--color-text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oauth-account .btn--link { flex: none; }
.can-list { display: grid; gap: var(--space-2); }
.can-list .eyebrow { margin: 0; }
.can-list ul { display: grid; gap: var(--space-2); margin: 0 0 var(--space-3); padding: 0; list-style: none; }
.can-list ul:last-child { margin-bottom: 0; }
.can-list li { display: flex; gap: var(--space-2); align-items: flex-start; line-height: var(--leading-normal); }
.can-list li svg { width: var(--icon-md); height: var(--icon-md); flex: none; margin-top: 3px; }
.can-list__yes { color: var(--tone-success-fg); }
.can-list__no { color: var(--color-text-tertiary); }
.can-list__more { display: block; color: var(--color-text-tertiary); font-size: var(--text-sm); }

.disclosure { font-size: var(--text-sm); color: var(--color-text-secondary); }
.disclosure summary {
  display: inline-flex; align-items: center; gap: var(--space-1-5);
  cursor: pointer; list-style: none;
  color: var(--color-text-secondary); font-weight: var(--weight-medium);
  border-radius: var(--radius-xs);
}
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary:hover { color: var(--color-text); }
.disclosure summary svg { width: var(--icon-sm); height: var(--icon-sm); transform: rotate(-90deg); transition: transform var(--duration-base) var(--ease-out); }
.disclosure[open] summary svg { transform: none; }
.disclosure__body {
  display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--space-2) var(--space-4);
  margin: var(--space-3) 0 0; padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md); background: var(--color-bg-subtle);
}
.disclosure[open] .disclosure__body { animation: fade-in var(--duration-base) var(--ease-out); }
@keyframes fade-in { from { opacity: 0; transform: translateY(-2px); } }
.disclosure__body dt { color: var(--color-text-tertiary); }
.disclosure__body dd { margin: 0; color: var(--color-text); min-width: 0; }
.disclosure__body strong { font-weight: var(--weight-medium); }
.disclosure__body ul { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--space-1); }
.disclosure__body code { font-size: var(--text-xs); color: var(--color-text-tertiary); }

/* Terms */
.terms { display: grid; gap: var(--space-5); }
.terms section { display: grid; gap: var(--space-1-5); }
.terms__heading { margin: 0; font-size: var(--text-md); font-weight: var(--weight-semibold); }
.terms p { margin: 0; color: var(--color-text-secondary); line-height: var(--leading-relaxed); }
.panel { padding: var(--space-4); border-radius: var(--radius-md); background: var(--color-bg-subtle); }
.check { display: flex; gap: var(--space-3); align-items: flex-start; line-height: var(--leading-normal); cursor: pointer; }
.check input { flex: none; width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--color-primary); cursor: pointer; }
.check input[aria-invalid="true"] { outline: 2px solid var(--tone-danger-solid); outline-offset: 2px; }
.panel .field__error { margin: 0 0 0 calc(16px + var(--space-3)); }

@media (max-width: 480px) {
  /* Centred while the card fits; a taller card grows the row, so it starts at the top and scrolls. */
  .card-shell { min-height: 100dvh; padding: var(--space-6) var(--space-3); }
  .card-shell__body { padding: var(--space-6) var(--space-5); }
  .card-section { padding: var(--space-5); }
}
/* ------------------------------------------------------------------ */
/* Your access                                                         */
/* ------------------------------------------------------------------ */
.section { display: grid; gap: var(--space-3); margin-top: var(--space-8); }
.section__head { display: grid; gap: var(--space-1); }
.section__sub { margin: 0; font-size: var(--text-sm); color: var(--color-text-secondary); }
.section .list + .list { margin-top: var(--space-1); }
/* The page head has no summary line on Your access, so the first section sits closer to the heading. */
.page-head + .section { margin-top: var(--space-2); }

.notice { display: flex; gap: var(--space-4); align-items: flex-start; padding: var(--space-5); }
.notice .empty__icon { margin: 0; flex: none; background: var(--tone-warning-bg); color: var(--user-pending-solid); }
.notice__body { display: grid; gap: var(--space-2); min-width: 0; }
.notice__text { margin: 0; color: var(--color-text-secondary); line-height: var(--leading-normal); }
.notice--disabled .empty__icon { background: var(--color-bg-muted); color: var(--user-disabled-solid); }
/* A link inside a sentence is underlined, so it doesn't rely on colour alone. */
.notice__text a, .empty__text a, .page-head__sub a, .section__sub a, .field__hint a, .dialog__text a { text-decoration: underline; text-underline-offset: 2px; }

.list--access { --list-cols: minmax(0, 1fr) auto; }
.access-source { min-height: 40px; }
.access-source > .access-source__name { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--color-text); font-weight: var(--weight-medium); }
.access-source > .num { text-align: right; padding-right: var(--space-2); }
.access-source__end { display: inline-flex; align-items: center; justify-content: flex-end; gap: var(--space-4); padding-right: var(--space-2); }
.access-source__end > .num { text-align: right; }
.access-guidance { display: grid; gap: var(--space-2); margin: 0 0 var(--space-1); padding: 0; list-style: none; }
.access-guidance > li { display: flex; gap: var(--space-2); align-items: flex-start; font-size: var(--text-sm); color: var(--color-text-secondary); line-height: var(--leading-normal); }
.access-guidance svg { flex: none; width: 16px; height: 16px; margin-top: 2px; color: var(--color-text-tertiary); }
.access-grid {
  display: grid; grid-template-columns: minmax(0, 1fr);
  margin: 0 0 -1px; padding: 0; list-style: none;
}
@media (min-width: 1080px) {
  .access-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .access-grid:has(> :only-child) { grid-template-columns: minmax(0, 1fr); }
  .access-item:nth-child(odd):not(:only-child) { border-right: 1px solid var(--color-border-subtle); }
}
.access-item {
  display: flex; align-items: center; gap: var(--space-4);
  min-height: 52px; padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
}
.access-item__text { flex: 1; min-width: 0; display: grid; }
.endpoint-title { font-weight: var(--weight-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.endpoint-tool { font-size: var(--text-xs); color: var(--color-text-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.access-meta { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-4); flex: none; white-space: nowrap; }
/* Follows the switch itself, so the row quietens the moment it's pressed; colours stay readable. */
.access-item:has(> .switch[aria-checked="false"]) .endpoint-title { color: var(--color-text-secondary); font-weight: var(--weight-regular); }
@media (max-width: 640px) {
  .access-item { flex-wrap: wrap; row-gap: var(--space-1); }
  .access-item__text { flex-basis: calc(100% - 48px); }
  .access-item > .switch { order: 2; }
  .access-item > .access-meta { order: 3; flex-basis: 100%; justify-content: flex-start; gap: var(--space-3); }
}
.meta--warn { color: var(--tone-warning-fg); font-weight: var(--weight-medium); }

.connect { display: grid; gap: var(--space-5); padding: var(--space-5); }
.copy-field {
  display: flex; align-items: center; gap: var(--space-3);
  min-width: 0; padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3);
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  background: var(--color-bg-subtle);
}
.copy-field code { flex: 1; min-width: 0; font-size: var(--text-sm); overflow-wrap: anywhere; }
.copy-field .btn { flex: none; }
.copy-field--code { padding-top: var(--space-1); padding-bottom: var(--space-1); }
.copy-field--code code { font-size: var(--text-xs); color: var(--color-text-secondary); }
/* Another way in, not a further step: set apart from the numbered steps. */
.connect__alt { display: grid; gap: var(--space-2); padding-top: var(--space-5); border-top: 1px solid var(--color-border-subtle); }
.connect__alt-text { margin: 0; font-weight: var(--weight-medium); color: var(--color-text); }
.connect__alt-hint { margin: 0; font-size: var(--text-sm); color: var(--color-text-tertiary); }
.connect__alt-hint code { font-size: var(--text-xs); color: var(--color-text-secondary); }
.connect-how { font-size: var(--text-base); }
/* Room for the focus ring, with the chevron still lined up with the content above. */
.connect-how > summary { min-height: 28px; padding: 0 var(--space-2) 0 var(--space-1); margin-left: calc(-1 * var(--space-1)); }
.disclosure__body--stack { display: block; padding: 0; background: none; }

.steps { display: grid; gap: var(--space-4); margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps > li { position: relative; padding-left: calc(24px + var(--space-3)); line-height: var(--leading-normal); color: var(--color-text-secondary); counter-increment: step; }
.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  display: grid; place-items: center;
  width: 24px; height: 24px;
  border-radius: var(--radius-full);
  background: var(--color-bg-muted);
  color: var(--color-text); font-size: var(--text-xs); font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
}
.steps > li strong { color: var(--color-text); font-weight: var(--weight-medium); }

.list--clients { --list-cols: minmax(0, 1fr) auto; }
.list--clients .meta.right { padding-right: var(--space-2); }
.row-icon { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: var(--radius-sm); background: var(--color-bg-muted); color: var(--color-text-secondary); }
.row-icon svg { width: var(--icon-md); height: var(--icon-md); }

@media (max-width: 768px) {
  .copy-field:not(.copy-field--code) { flex-wrap: wrap; }
  .copy-field:not(.copy-field--code) code { flex-basis: 100%; order: 2; }
  .copy-field:not(.copy-field--code) .btn { margin-left: auto; }
  .notice { flex-direction: column; gap: var(--space-3); }
}

/* ------------------------------------------------------------------ */
/* Guides: reading pages                                               */
/* ------------------------------------------------------------------ */
.guide { display: grid; grid-template-columns: minmax(0, var(--measure)); gap: var(--space-12); }
@media (min-width: 1200px) {
  .guide { grid-template-columns: minmax(0, var(--measure)) 200px; }
}
.guide__head { display: grid; gap: var(--space-2); margin-bottom: var(--space-8); }
.guide__audience { margin: 0; color: var(--color-text-secondary); }
.toc { display: none; }
@media (min-width: 1200px) {
  .toc { display: block; position: sticky; top: calc(var(--topbar-height) + var(--space-8)); align-self: start; max-height: calc(100vh - var(--topbar-height) - var(--space-16)); overflow-y: auto; }
}
.toc .eyebrow { margin: 0 0 var(--space-2); }
.toc ul { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--space-0-5); }
.toc a {
  display: block; padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-xs);
  font-size: var(--text-sm); line-height: var(--leading-snug);
  color: var(--color-text-secondary); text-decoration: none;
}
.toc a:hover { color: var(--color-text); background: var(--color-bg-subtle); }
.toc a[aria-current="true"] { color: var(--color-text); font-weight: var(--weight-medium); background: var(--color-bg-muted); }
.toc__item--3 a { padding-left: var(--space-5); font-size: var(--text-xs); }

.prose { font-size: var(--text-md); line-height: var(--leading-relaxed); color: var(--color-text); overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose h2 { margin: var(--space-10) 0 var(--space-3); font-size: var(--text-xl); font-weight: var(--weight-semibold); line-height: var(--leading-tight); letter-spacing: var(--tracking-tight); scroll-margin-top: calc(var(--topbar-height) + var(--space-6)); }
.prose h3 { margin: var(--space-8) 0 var(--space-2); font-size: var(--text-lg); font-weight: var(--weight-semibold); line-height: var(--leading-snug); scroll-margin-top: calc(var(--topbar-height) + var(--space-6)); }
.prose h4 { margin: var(--space-6) 0 var(--space-2); font-size: var(--text-md); font-weight: var(--weight-semibold); }
.prose p, .prose ul, .prose ol, .prose pre, .prose table, .prose blockquote { margin: 0 0 var(--space-4); }
.prose ul, .prose ol { padding-left: var(--space-6); }
.prose li + li { margin-top: var(--space-1); }
.prose a { color: var(--color-text-link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.prose a:hover { color: var(--color-text-link-hover); }
.prose strong { font-weight: var(--weight-semibold); }
.prose code { padding: 1px var(--space-1); border-radius: var(--radius-xs); background: var(--color-bg-muted); font-family: var(--font-mono); font-size: 0.875em; }
.prose pre { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--color-bg-subtle); border: 1px solid var(--color-border-subtle); overflow-x: auto; line-height: var(--leading-normal); }
.prose pre code { padding: 0; background: none; font-size: var(--text-sm); overflow-wrap: normal; white-space: pre; }
.prose table { display: block; width: max-content; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: var(--text-sm); line-height: var(--leading-normal); }
.prose th, .prose td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--color-border-subtle); text-align: left; vertical-align: top; }
.prose th { color: var(--color-text-tertiary); font-size: var(--text-xs); font-weight: var(--weight-medium); background: var(--color-bg-subtle); }
.prose blockquote { padding-left: var(--space-4); border-left: 2px solid var(--color-border); color: var(--color-text-secondary); }
.prose hr { height: 1px; margin: var(--space-8) 0; border: 0; background: var(--color-border); }
/* ------------------------------------------------------------------ */
/* Users page                                                          */
/* ------------------------------------------------------------------ */
.list--people { --list-cols: minmax(0, 1fr) 100px 172px 132px 56px 96px 84px; }
/* The label may use the column gap before it truncates, as in the mockup. */
.access { min-width: 0; margin-right: calc(-1 * var(--space-4)); }
.access__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.page-note { margin: var(--space-3) 0 0; }
.page-head__sub code { font-size: 0.9em; }
/* Business Central as the person, or both: a second line under the access, with whether it can work. */
.access--stack { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; }
.access__line { display: flex; align-items: center; gap: var(--space-3); min-width: 0; max-width: 100%; }
.access__bc { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: var(--text-xs); color: var(--color-text-tertiary); }
.access__bc.meta--warn { color: var(--tone-warning-fg); }
/* Phones hide the access column, so "both" moves next to the name. */
.bc-flag { display: none; }
@media (max-width: 768px) {
  .bc-flag { display: inline-flex; }
}
/* Phones drop the actions column, but a pending person can still be activated from the list. */
@media (max-width: 768px) {
  .list--people .list__row[data-status="pending"] { --list-cols: minmax(0, 1fr) auto auto; }
  .list--people .list__row[data-status="pending"] .end.hide-sm { display: flex; }
}

/* ------------------------------------------------------------------ */
/* Filtered lists: Users, Endpoints and the audit log                  */
/* ------------------------------------------------------------------ */
[data-region="list"] { transition: opacity var(--duration-base) var(--ease-out); }
[data-region="list"].is-loading { opacity: 0.6; }
[data-region="list"] { scroll-margin-top: calc(var(--topbar-height) + var(--space-4)); }

/* ------------------------------------------------------------------ */
/* Shared: section parts and compact forms                             */
/* ------------------------------------------------------------------ */
.section[id], .service-card[id] { scroll-margin-top: calc(var(--topbar-height) + var(--space-6)); }
.section__inner { display: grid; gap: var(--space-3); min-width: 0; }
.section__head--row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.section__titles { display: grid; gap: var(--space-1); min-width: 0; }
.section__aside { margin: 0; font-size: var(--text-sm); color: var(--color-text-secondary); }
.section__aside strong { color: var(--color-text); font-weight: var(--weight-medium); }
.section__note {
  display: flex; align-items: center; gap: var(--space-2);
  margin: 0; padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md); background: var(--color-bg-subtle);
  font-size: var(--text-sm); color: var(--color-text-secondary);
}
.section__note svg { width: var(--icon-md); height: var(--icon-md); flex: none; }
.section__note strong { color: var(--color-text); font-weight: var(--weight-medium); }
.section-pair { display: grid; gap: 0 var(--space-6); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1080px) {
  .section-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
.stack-form { display: grid; gap: var(--space-3); margin: 0; }
.field__row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
.count--warn { color: var(--tone-warning-fg); font-weight: var(--weight-medium); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--tone-danger-solid); }
.field__error { margin: 0; }

/* ------------------------------------------------------------------ */
/* Person page                                                         */
/* ------------------------------------------------------------------ */
.profile { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.profile__text { flex: 1; min-width: 0; display: grid; gap: var(--space-1-5); }
.profile__name { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.profile__name > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.profile__meta { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-1) var(--space-4); margin: 0; font-size: var(--text-sm); color: var(--color-text-secondary); }
.profile__email { color: var(--color-text); overflow-wrap: anywhere; }
.profile__actions { display: flex; align-items: center; gap: var(--space-2); }
.profile__actions form { margin: 0; }

.grant-sources { display: grid; gap: var(--space-2); margin: 0; }
.grant-source__head {
  display: flex; align-items: center; gap: var(--space-2);
  min-height: 44px; padding: var(--space-2) var(--space-4) var(--space-2) var(--space-3);
  background: var(--color-bg-subtle);
  cursor: pointer; list-style: none;
  font-size: var(--text-sm);
  border-radius: calc(var(--radius-md) - 1px);
}
.grant-source[open] .grant-source__head { border-radius: calc(var(--radius-md) - 1px) calc(var(--radius-md) - 1px) 0 0; }
.grant-source__head::-webkit-details-marker { display: none; }
.grant-source__head:hover { color: var(--color-text); }
.grant-source__head:focus-visible { outline-offset: -2px; }
.grant-source__chevron { width: var(--icon-sm); height: var(--icon-sm); flex: none; color: var(--color-text-tertiary); transform: rotate(-90deg); transition: transform var(--duration-base) var(--ease-out); }
.grant-source[open] .grant-source__chevron { transform: none; }
.grant-source__name { font-weight: var(--weight-medium); color: var(--color-text); }
.grant-source__count { margin-left: auto; font-size: var(--text-xs); color: var(--color-text-tertiary); white-space: nowrap; }
.grant-source__tools { display: flex; gap: var(--space-3); padding: var(--space-1) var(--space-4); border-top: 1px solid var(--color-border-subtle); }
.grant-source__tools .btn--link { height: 24px; padding: 0; font-size: var(--text-xs); }
.grant-source__warn { margin-left: auto; font-size: var(--text-xs); white-space: nowrap; }
.grant-source__warn + .grant-source__count { margin-left: var(--space-3); }
.grant-source__switched { margin-left: auto; font-size: var(--text-xs); color: var(--color-text-secondary); white-space: nowrap; }
.grant-source__warn + .grant-source__switched, .grant-source__switched + .grant-source__count { margin-left: var(--space-3); }
.grant-source__move { margin-left: auto; display: flex; align-items: center; min-width: 0; }
.grant-source__move .btn--link svg { width: var(--icon-sm); height: var(--icon-sm); }
.bc-move-off { display: flex; align-items: center; gap: var(--space-2); min-width: 0; font-size: var(--text-xs); }
.bc-move-off .quiet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Both Business Central sources at once: one calm sentence and the move that fixes it. */
.bc-banner { align-items: center; margin-bottom: var(--space-3); }
.bc-banner__text { flex: 1 1 0; min-width: 0; margin: 0; }
@media (max-width: 768px) {
  .bc-banner { flex-wrap: wrap; align-items: flex-start; }
  .bc-banner__text { flex-basis: calc(100% - var(--icon-md) - var(--space-3)); }
  .bc-banner .banner__actions { margin-left: calc(var(--icon-md) + var(--space-3)); }
  .grant-source__tools { flex-wrap: wrap; }
}
.grant-source[open] > :not(summary) { animation: fade-in var(--duration-base) var(--ease-out); }

.grant-row { --list-cols: 16px minmax(0, 1fr) auto; gap: var(--space-3); cursor: pointer; }
.grant-row__check { width: 16px; height: 16px; margin: 0; accent-color: var(--color-primary); cursor: pointer; }
.grant-row__text { display: grid; gap: 2px; min-width: 0; }
.grant-row__title { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.grant-row__title .endpoint-title { min-width: 0; }
.grant-row__title .sensitive { flex: none; }
.grant-row__sub { display: flex; align-items: baseline; gap: var(--space-3); min-width: 0; overflow: hidden; white-space: nowrap; font-size: var(--text-xs); color: var(--color-text-tertiary); }
.grant-row__sub > * { flex: none; }
.grant-row__sub code { font-size: var(--text-xs); }
.grant-row__note { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-xs); color: var(--color-text-secondary); }
.grant-row__end { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); padding-right: var(--space-2); }
.grant-row__change { font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--color-accent); animation: fade-in var(--duration-fast) var(--ease-out); }
.grant-row.is-changed { background: var(--color-bg-subtle); }
.grant-row--off .endpoint-title { color: var(--color-text-tertiary); }
.grant-fallback { display: flex; align-items: flex-end; flex-wrap: wrap; gap: var(--space-3); }

.token-prefix { font-size: var(--text-sm); }
.list--admin-tokens { --list-cols: minmax(0, 1fr) 64px 72px 88px 96px 76px 84px; }
.list--admin-clients { --list-cols: minmax(0, 1fr) 140px 150px; }
.list--admin-clients .who__sub code { font-size: var(--text-xs); color: var(--color-text-tertiary); overflow: hidden; text-overflow: ellipsis; }
.list--calls .call__row { --list-cols: 92px 52px minmax(0, 0.9fr) 116px 48px 52px minmax(0, 1.4fr) 20px; min-height: 44px; }
.list--calls .list__row--head.call__row { min-height: 36px; }
.call__tool { font-size: var(--text-sm); }
.call__args { font-size: var(--text-xs); color: var(--color-text-secondary); }
.call > summary { cursor: pointer; list-style: none; }
.call > summary::-webkit-details-marker { display: none; }
.call > summary:focus-visible { outline-offset: -2px; }
.call { border-top: 1px solid var(--color-border-subtle); }
.call > .call__row { border-top: 0; }
.call__more svg { width: var(--icon-sm); height: var(--icon-sm); color: var(--color-text-tertiary); transform: rotate(-90deg); transition: transform var(--duration-base) var(--ease-out); }
.call[open] .call__more svg { transform: none; }
.call[open] > summary { background: var(--color-bg-subtle); }
.call__body { display: grid; gap: var(--space-2); padding: var(--space-3) var(--space-4) var(--space-4); background: var(--color-bg-subtle); animation: fade-in var(--duration-base) var(--ease-out); }
.call__pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; padding: var(--space-3); max-height: 320px; overflow: auto; border-radius: var(--radius-sm); background: var(--color-surface); box-shadow: inset 0 0 0 1px var(--color-border-subtle); font-size: var(--text-xs); line-height: var(--leading-normal); }
.call__error { margin: 0; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--tone-danger-fg); overflow-wrap: anywhere; }
.list--calls .list__row .badge { white-space: nowrap; }

.terms-card { display: grid; gap: var(--space-4); }

/* The save bar sticks to the bottom of the window while access has unsaved changes. */
.savebar {
  position: sticky; bottom: var(--space-4); z-index: var(--z-sticky);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 280px) 152px auto; align-items: end; gap: var(--space-3) var(--space-4);
  margin-top: var(--space-8); padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--color-border);
  opacity: 1; transform: none;
  transition: opacity var(--duration-base) var(--ease-out), transform var(--duration-base) var(--ease-out);
}
@starting-style {
  .savebar { opacity: 0; transform: translateY(8px); }
}
.savebar__summary { display: grid; gap: 2px; align-self: center; min-width: 0; }
.savebar__summary strong { font-weight: var(--weight-medium); }
.savebar__hint { font-size: var(--text-xs); color: var(--color-text-secondary); }
.savebar .field { gap: var(--space-1); }
.savebar .field__label { font-size: var(--text-xs); }
.savebar__note, .savebar__expiry { position: relative; }
/* A field error takes the hint's place in the summary, next to the fields, so the bar keeps its height. */
.savebar__summary:has(.field__error:not([hidden])) .savebar__hint { display: none; }
.savebar__actions { display: flex; gap: var(--space-2); }
body.has-savebar .toast-host { bottom: calc(var(--space-6) + 88px); }

/* ------------------------------------------------------------------ */
/* Endpoints page                                                      */
/* ------------------------------------------------------------------ */
.services { display: grid; gap: var(--space-4); }
.service-card__head { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-4); }
.source--lg { width: 28px; height: 28px; font-size: 11px; border-radius: var(--radius-sm); }
.service-card__text { flex: 1; min-width: 0; display: grid; gap: var(--space-1); }
.service-card__name { display: flex; align-items: baseline; gap: var(--space-3); flex-wrap: wrap; font-size: var(--text-md); }
.service-card__name .meta { font-weight: var(--weight-regular); }
.service-card__desc { margin: 0; max-width: var(--measure); font-size: var(--text-sm); color: var(--color-text-secondary); line-height: var(--leading-normal); }
.service-card__end { display: flex; align-items: center; gap: var(--space-3); flex: none; padding-top: 2px; }
.service-card__end form { display: flex; margin: 0; }
.service-card__off { display: flex; align-items: center; gap: var(--space-2); margin: 0; padding: var(--space-2) var(--space-4); border-top: 1px solid var(--color-border-subtle); background: var(--color-bg-subtle); font-size: var(--text-sm); color: var(--color-text-secondary); }
.service-card__off svg { width: var(--icon-sm); height: var(--icon-sm); flex: none; }
.service-card--off .service-card__name { color: var(--color-text-secondary); }
.service-card__source { display: flex; align-items: flex-start; gap: var(--space-2); margin: 0; max-width: var(--measure); font-size: var(--text-xs); color: var(--color-text-tertiary); line-height: var(--leading-normal); }
.service-card__source svg { width: var(--icon-sm); height: var(--icon-sm); flex: none; margin-top: 2px; }
.service-card__source a { color: var(--color-text-secondary); text-decoration: underline; text-underline-offset: 2px; }
.service-card__source a:hover { color: var(--color-text); }

.endpoint-row { --list-cols: minmax(0, 1fr) minmax(0, 1fr) auto 84px auto; }
.endpoint-row__main { display: grid; gap: 2px; min-width: 0; }
.endpoint-row__tool { font-size: var(--text-sm); color: var(--color-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.endpoint-row__title { display: flex; align-items: center; gap: var(--space-2); min-width: 0; font-size: var(--text-xs); color: var(--color-text-secondary); white-space: nowrap; overflow: hidden; }
.endpoint-row__title .badge { height: 18px; font-size: 11px; }
.endpoint-row__meta { display: grid; gap: 2px; min-width: 0; font-size: var(--text-xs); color: var(--color-text-tertiary); }
.endpoint-row__meta .mono { font-size: var(--text-xs); }
.endpoint-row__limits { display: flex; gap: var(--space-3); white-space: nowrap; overflow: hidden; }
.endpoint-row__sensitivity { display: flex; margin: 0; }
.endpoint-row .segmented button { height: 24px; padding: 0 var(--space-2); font-size: var(--text-xs); }
.endpoint-row .segmented svg { width: 12px; height: 12px; }
.endpoint-row__grants { text-align: right; font-size: var(--text-sm); white-space: nowrap; }
.endpoint-row__end { align-items: center; gap: var(--space-2); }
.endpoint-row__end form { display: flex; margin: 0; }
.endpoint-row--off .endpoint-row__tool { color: var(--color-text-tertiary); }

.describe__text { min-height: 200px; font-size: var(--text-sm); line-height: var(--leading-normal); }
.describe__notes { display: grid; gap: var(--space-1); padding: var(--space-3); border-radius: var(--radius-md); background: var(--color-bg-subtle); }
.describe__notes .eyebrow { margin: 0; }
.describe__notes-text { margin: 0; font-size: var(--text-sm); color: var(--color-text-secondary); line-height: var(--leading-normal); }

@media (max-width: 1080px) {
  .list--admin-tokens { --list-cols: minmax(0, 1fr) 64px 88px 76px 84px; }
  .list--admin-tokens .hide-md, .list--calls .hide-md, .endpoint-row .hide-md { display: none; }
  .list--calls .call__row { --list-cols: 92px minmax(0, 1fr) 116px 48px 52px 20px; }
  .endpoint-row { --list-cols: minmax(0, 1fr) auto 84px auto; }
  .savebar { grid-template-columns: minmax(0, 1fr) minmax(160px, 240px) 152px; }
  .savebar__actions { grid-column: 1 / -1; justify-content: flex-end; }
}
@media (max-width: 768px) {
  .profile { align-items: flex-start; }
  .profile__actions { width: 100%; }
  .list--admin-tokens { --list-cols: minmax(0, 1fr) auto auto; }
  .list--admin-tokens .hide-sm, .list--admin-clients .hide-sm, .list--calls .hide-sm { display: none; }
  .list--admin-clients { --list-cols: minmax(0, 1fr) auto; }
  .list--calls .call__row { --list-cols: 72px minmax(0, 1fr) auto; }
  .grant-row__sub { flex-wrap: wrap; row-gap: 0; white-space: normal; }
  .savebar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); bottom: var(--space-2); gap: var(--space-2) var(--space-3); }
  .savebar__summary, .savebar__actions { grid-column: 1 / -1; }
  .savebar__actions { justify-content: stretch; }
  .savebar__actions .btn { flex: 1; }
  body.has-savebar .toast-host { bottom: calc(var(--space-6) + 180px); }
  .service-card__head { flex-wrap: wrap; }
  .service-card__end { width: 100%; justify-content: space-between; padding-left: calc(28px + var(--space-3)); }
  .endpoint-row { --list-cols: minmax(0, 1fr) auto; row-gap: var(--space-2); padding-right: var(--space-3); }
  .endpoint-row__main { grid-column: 1; }
  .endpoint-row__end { grid-column: 2; grid-row: 1; }
  .endpoint-row__sensitivity { grid-column: 1; grid-row: 2; justify-self: start; }
  .endpoint-row__grants { grid-column: 2; grid-row: 2; }
}
/* Endpoints inside a source are told apart by spacing and the hover tint, not by lines around every cell. */
.grant-grid { display: grid; grid-template-columns: minmax(0, 1fr); padding: var(--space-1) 0 var(--space-2); border-top: 1px solid var(--color-border-subtle); }
.grant-grid > .grant-row { border-top: 0; }
@media (min-width: 1200px) {
  .grant-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.service-card--off .endpoint-row .switch { opacity: 0.5; }
.endpoint-row { scroll-margin-top: calc(var(--topbar-height) + var(--space-4)); }
.endpoint-row:target { background: var(--color-accent-subtle); box-shadow: inset 2px 0 0 var(--color-accent); }

/* ------------------------------------------------------------------ */
/* Audit log                                                           */
/* ------------------------------------------------------------------ */
/* Names, tools and statuses get what they need; the arguments or error take the rest. */
.list--audit .call__row { --list-cols: 84px minmax(0, 116px) 44px minmax(0, 176px) 104px 48px 52px minmax(0, 1fr) 20px; }
.call__person { font-size: var(--text-sm); }
.call__facts { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); margin: 0; font-size: var(--text-xs); }
.call__facts > div { display: grid; gap: 2px; min-width: 0; }
.call__facts dt { color: var(--color-text-tertiary); }
.call__facts dd { margin: 0; color: var(--color-text); overflow-wrap: anywhere; }
.call__facts--wide { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); }
.call__facts--wide > div { grid-template-columns: 140px minmax(0, 1fr); gap: var(--space-3); }
.call__facts--wide dd { font-size: var(--text-sm); line-height: var(--leading-normal); }
.list--events .event__row { --list-cols: 92px minmax(0, 0.9fr) minmax(0, 3fr) 20px; min-height: 48px; }
.event__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-sm); color: var(--color-text-secondary); }
.event__text code { font-size: var(--text-xs); color: var(--color-text); }
.event__text .event__person { color: var(--color-text); font-weight: var(--weight-medium); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-top: var(--space-3); }
.pager__text { margin: 0; }
.pager__text .num { color: var(--color-text-secondary); font-weight: var(--weight-medium); }
.pager__buttons { display: flex; gap: var(--space-2); }
.pager .btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; box-shadow: none; }
@media (max-width: 1080px) {
  .list--audit .call__row { --list-cols: 92px minmax(0, 0.8fr) minmax(0, 1fr) 116px 48px 52px 20px; }
}
@media (max-width: 768px) {
  .list--audit .call__row { --list-cols: 84px minmax(0, 1fr) auto; row-gap: 2px; padding-right: var(--space-3); }
  .list--audit .call__row > .call__person { grid-column: 2; grid-row: 2; font-size: var(--text-xs); color: var(--color-text-tertiary); }
  .list--audit .call__row > .call__person a { color: inherit; }
  .list--audit .call__row > .call__tool { grid-column: 2; grid-row: 1; }
  .list--audit .call__row > :nth-child(1) { grid-row: 1 / span 2; }
  .list--audit .call__row > .call__status { grid-column: 3; grid-row: 1 / span 2; }
  .list--audit .list__row--head { display: none; }
  .list--events .event__row { --list-cols: 84px minmax(0, 1fr); row-gap: 2px; padding-right: var(--space-3); }
  .list--events .event__row > :nth-child(1) { grid-row: 1 / span 2; }
  .list--events .event__row > :nth-child(2) { grid-column: 2; grid-row: 2; font-size: var(--text-xs); }
  .list--events .event__row > .event__text { grid-column: 2; grid-row: 1; white-space: normal; }
  .list--events .event__row .hide-sm, .list--events .list__row--head { display: none; }
  .call__facts--wide > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .pager__text { font-size: var(--text-xs); }
}

/* ------------------------------------------------------------------ */
/* Health page                                                         */
/* ------------------------------------------------------------------ */
.health-summary { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-1) var(--space-2); }
.health-summary .pulse { flex: none; margin: 0 var(--space-1) 0 3px; }
.health-summary strong { color: var(--color-text); font-weight: var(--weight-medium); }
.health-summary--failing svg { width: var(--icon-md); height: var(--icon-md); flex: none; color: var(--health-failing-solid); }
.health-summary--failing strong { color: var(--health-failing-fg); }
.section--first { margin-top: 0; }
.btn__spin { transform-origin: center; }
@media (prefers-reduced-motion: no-preference) {
  .btn[aria-busy="true"] .btn__spin { animation: spin 800ms linear infinite; }
  [data-region="health"] { animation: fade-in var(--duration-base) var(--ease-out); }
}
@keyframes spin { to { transform: rotate(360deg); } }
.list--health { --list-cols: minmax(0, 1.1fr) 150px 84px minmax(0, 1.6fr) 84px; }
.health-state { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); white-space: nowrap; }
.health-state .pulse { margin-left: 3px; }
.health-state--failing { color: var(--health-failing-fg); font-weight: var(--weight-medium); }
.health-detail { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-sm); color: var(--color-text-secondary); }
.health-detail--failing { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--health-failing-fg); }
.health-row .num { font-size: var(--text-sm); }
/* Phones hide the latency and checked columns, so their values take the connector line (the name says which it is). */
.health-row__sm { display: none; }
.health-row__detail { display: none; grid-column: 1 / -1; margin: 0; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--health-failing-fg); overflow-wrap: anywhere; }

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3) var(--space-8); margin: 0; }
.facts > div { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--space-3); align-items: baseline; min-width: 0; }
.facts dt { font-size: var(--text-sm); color: var(--color-text-tertiary); }
.facts dd { margin: 0; min-width: 0; font-size: var(--text-sm); color: var(--color-text); overflow-wrap: anywhere; }
.facts .mono { font-size: var(--text-xs); }

.list--urls { --list-cols: 180px minmax(0, 1fr) auto; }
.list--urls .list__row { min-height: 44px; }
.list--urls code { font-size: var(--text-xs); color: var(--color-text); }
.url-label { font-size: var(--text-sm); color: var(--color-text-secondary); }

@media (max-width: 1080px) {
  .list--health { --list-cols: minmax(0, 1fr) 150px 84px minmax(0, 1.4fr); }
  .list--health .hide-md { display: none; }
  .facts { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 768px) {
  .list--health { --list-cols: minmax(0, 1fr) auto; }
  .list--health .list__row { padding-right: var(--space-4); }
  .list--health .hide-sm, .list--health .list__row--head { display: none; }
  .health-row__detail { display: block; }
  .health-row .health-row__sm { display: block; }
  .health-row .who__sub > :first-child { display: none; }
  .facts { gap: var(--space-2); }
  .facts > div { grid-template-columns: minmax(0, 1fr) auto; }
  .facts dd { text-align: right; }
  .list--urls { --list-cols: minmax(0, 1fr) auto; row-gap: 2px; }
  .list--urls .url-label { grid-column: 1; grid-row: 1; font-size: var(--text-xs); }
  .list--urls code { grid-column: 1; grid-row: 2; white-space: normal; overflow-wrap: anywhere; }
  .list--urls .btn { grid-column: 2; grid-row: 1 / span 2; }
}
/* ------------------------------------------------------------------ */
/* Request access                                                      */
/* ------------------------------------------------------------------ */
@keyframes reveal { from { opacity: 0; transform: translateY(4px); } }

.request-from {
  display: flex; align-items: flex-start; gap: var(--space-2);
  margin: var(--space-4) 0 0; font-size: var(--text-sm); color: var(--color-text-secondary); line-height: var(--leading-normal);
}
.request-from svg { flex: none; width: var(--icon-md); height: var(--icon-md); margin-top: 2px; color: var(--color-text-tertiary); }
.request-from code { font-size: var(--text-xs); color: var(--color-text); }

.request { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-6); margin-top: var(--space-2); align-items: start; }
@media (min-width: 1024px) {
  .request { grid-template-columns: minmax(0, 1fr) 320px; }
}
.request__main { min-width: 0; }
.request__toolbar { margin-top: 0; }
.request__toolbar .search { width: 240px; }
.request__list-error { margin: 0 0 var(--space-2); }
.request__sources { display: grid; gap: var(--space-3); }

.request-source__head { --list-cols: minmax(0, 1fr) auto; min-height: 40px; padding-left: var(--space-4); }
.request-source__head > .request-source__name {
  display: inline-flex; align-items: center; gap: var(--space-3); min-width: 0;
  font-size: var(--text-sm); color: var(--color-text); font-weight: var(--weight-medium); cursor: pointer;
}
.request-source__head input:disabled { cursor: default; }
.request-source__count { padding-right: var(--space-2); text-align: right; white-space: nowrap; }

.request-grid { margin: 0; padding: 0; list-style: none; }
.request-row { border-top: 1px solid var(--color-border-subtle); transition: background var(--duration-fast) var(--ease-out); }
.request-row:hover { background: var(--color-bg-subtle); }
.request-row.is-selected { background: var(--color-accent-subtle); }
/* The tinted row needs the stronger secondary text to keep the tool name readable. */
.request-row.is-selected .endpoint-tool { color: var(--color-text-secondary); }
.request-row__label {
  display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; gap: var(--space-3);
  min-height: 56px; padding: var(--space-2) var(--space-4); cursor: pointer;
}
.request-row--done .request-row__label { cursor: default; }
.request-row__text { display: grid; gap: 2px; min-width: 0; }
.request-row__title { display: flex; align-items: baseline; gap: var(--space-2); min-width: 0; }
.request-row__title .endpoint-title { flex: 0 1 auto; min-width: 0; }
.request-row__title .endpoint-tool { flex: 0 1000 auto; min-width: 4ch; }
.request-row__title .sensitive { flex: none; align-self: center; }
.request-row__summary { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-sm); color: var(--color-text-secondary); }
.request-row--done .endpoint-title { color: var(--color-text-secondary); font-weight: var(--weight-regular); }
.request-row--done .request-row__summary { color: var(--color-text-tertiary); }
.request-row__state { display: inline-flex; align-items: center; gap: var(--space-1-5); font-size: var(--text-xs); color: var(--color-text-tertiary); white-space: nowrap; }
.request-row__state svg { width: 14px; height: 14px; }
.request-row__state--pending { color: var(--user-pending-fg); font-weight: var(--weight-medium); }
.request-row__state--asking { color: var(--color-text-secondary); }
/* A row's countries: what they have, what ticking it asks for, and where it isn't published, apart by spacing. */
.request-row__meta { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-1) var(--space-3); min-width: 0; }
.request-row.is-complete .request-row__label { cursor: default; }
.request-row.is-complete .endpoint-title { color: var(--color-text-secondary); font-weight: var(--weight-regular); }

/* The countries a Business Central card asks for, first in the card. */
.country-bar { --list-cols: minmax(0, 1fr); padding: var(--space-3) var(--space-4); background: var(--color-surface); }
.list__row.country-bar:hover { background: var(--color-surface); }
.country-bar.is-invalid { box-shadow: inset 2px 0 0 var(--tone-danger-solid); }
.country-bar__set { display: grid; gap: var(--space-2); min-width: 0; margin: 0; padding: 0; border: 0; }
.country-bar__legend { float: left; width: 100%; margin: 0 0 var(--space-2); padding: 0; font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-text); }
.country-bar__legend + * { clear: both; }
.country-bar__choices { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.country-toggle {
  display: inline-flex; align-items: center; gap: var(--space-2); height: 32px; padding: 0 var(--space-3);
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-full); background: var(--color-surface);
  font-size: var(--text-sm); color: var(--color-text); cursor: pointer; user-select: none;
  transition: transform var(--duration-fast) var(--ease-out);
}
.country-toggle:hover { background: var(--color-bg-subtle); }
.country-toggle:active { transform: scale(0.97); }
.country-toggle:has(input:checked) { border-color: var(--color-accent); background: var(--color-accent-subtle); font-weight: var(--weight-medium); }
.country-toggle input { flex: none; width: 14px; height: 14px; margin: 0; accent-color: var(--color-accent); cursor: pointer; }
.country-held { display: inline-flex; align-items: center; gap: var(--space-1-5); height: 32px; padding: 0 var(--space-1) 0 0; font-size: var(--text-sm); color: var(--color-text-secondary); }
.country-held svg { width: 14px; height: 14px; color: var(--color-text-tertiary); }
.country-bar__hint { margin: 0; font-size: var(--text-xs); color: var(--color-text-secondary); }
.country-bar__error { margin: 0; }
.country-bar [autofocus] { scroll-margin: 40vh 0; }
@media (prefers-reduced-motion: reduce) {
  .country-toggle { transition: none; }
}
@media (max-width: 640px) {
  .request-row__label { grid-template-columns: 16px minmax(0, 1fr); row-gap: var(--space-1); }
  .request-row__state, .request-row__meta { grid-column: 2; }
  .request-row__meta { justify-content: flex-start; }
  .request-row__title { flex-wrap: wrap; row-gap: 0; }
  .request-row__summary { white-space: normal; }
}

.request__aside { display: grid; gap: var(--space-4); padding: var(--space-5); }
@media (min-width: 1024px) {
  .request__aside { position: sticky; top: calc(var(--topbar-height) + var(--space-6)); }
}
.request__aside-head { display: grid; gap: var(--space-1); }
.request__count { margin: 0; font-size: var(--text-sm); color: var(--color-text-secondary); font-variant-numeric: tabular-nums; }
/* The summary: what's ticked by source, each Business Central endpoint with the countries it asks for. */
.request__summary { display: grid; gap: var(--space-3); max-height: 320px; overflow-y: auto; }
.request-sum { display: grid; gap: var(--space-1-5); min-width: 0; }
.request-sum__head {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-1) var(--space-2); margin: 0;
  font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-text);
}
.request-sum__missing { font-size: var(--text-xs); font-weight: var(--weight-regular); color: var(--tone-danger-fg); }
.request-sum__items { display: grid; gap: var(--space-1); margin: 0; padding: 0; list-style: none; }
.request-sum__item { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 var(--space-3); min-width: 0; }
.request-sum__item code {
  display: inline-block; padding: 2px var(--space-1-5); border-radius: var(--radius-xs);
  background: var(--color-bg-muted); font-size: var(--text-xs); color: var(--color-text);
}
.request-sum__meta { font-size: var(--text-xs); color: var(--color-text-secondary); }
.request-sum__item.is-left-out code { color: var(--color-text-tertiary); text-decoration: line-through; }
.request-sum__item.is-left-out .request-sum__meta { color: var(--color-text-tertiary); }
.request__overlap {
  display: flex; gap: var(--space-2); align-items: flex-start; margin: 0;
  font-size: var(--text-sm); color: var(--color-text-secondary); line-height: var(--leading-normal);
  animation: reveal var(--duration-base) var(--ease-out);
}
.request__overlap svg { flex: none; width: var(--icon-md); height: var(--icon-md); margin-top: 2px; color: var(--color-text-tertiary); }
.request__aside .field__hint { margin: 0; line-height: var(--leading-normal); }
.request__counter { font-variant-numeric: tabular-nums; }
.request__send { display: grid; gap: var(--space-2); }
.request__send .btn { justify-self: stretch; justify-content: center; }
.request__note { margin: 0; font-size: var(--text-xs); color: var(--color-text-tertiary); text-align: center; }

/* On narrow screens the form comes after the list: a small bar keeps the count in sight and leads to it. */
.request__bar {
  position: sticky; bottom: var(--space-4); z-index: var(--z-sticky);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  border-radius: var(--radius-md); background: var(--color-surface);
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--color-border);
  font-size: var(--text-sm); font-weight: var(--weight-medium);
  animation: reveal var(--duration-base) var(--ease-out);
}
.request__bar[hidden] { display: none; }
@media (min-width: 1024px) {
  .request__bar { display: none; }
}

/* A person's requests: on Request access and, while they need attention, on Your access. */
.request-cards { display: grid; gap: var(--space-3); }
.request-card { display: grid; }
.request-card__head {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-1) var(--space-4);
  min-height: 44px; padding: var(--space-1-5) var(--space-2) var(--space-1-5) var(--space-4);
  background: var(--color-bg-subtle); border-bottom: 1px solid var(--color-border-subtle);
}
.request-card__when { font-size: var(--text-xs); color: var(--color-text-tertiary); }
.request-card__actions { margin-left: auto; }
.request-card__withdraw { display: contents; }
.request-card__reason { margin: 0; padding: var(--space-3) var(--space-4) var(--space-1); font-size: var(--text-sm); color: var(--color-text-secondary); line-height: var(--leading-normal); overflow-wrap: anywhere; }
.request-card__reply {
  margin: 0; padding: var(--space-3) var(--space-4); border-top: 1px solid var(--color-border-subtle);
  font-size: var(--text-sm); color: var(--color-text-secondary); line-height: var(--leading-normal); overflow-wrap: anywhere;
}
.request-card__reply strong { color: var(--color-text); font-weight: var(--weight-medium); }

.request-status { display: inline-flex; align-items: center; gap: var(--space-1-5); font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-text); white-space: nowrap; }
.request-status svg { width: var(--icon-md); height: var(--icon-md); flex: none; }
.request-status--open { color: var(--user-pending-fg); }
.request-status--approved svg, .request-status--partly svg { color: var(--tone-success-fg); }
.request-status--declined svg, .request-status--withdrawn svg { color: var(--color-text-tertiary); }
.request-status--withdrawn { color: var(--color-text-secondary); }

.request-items { margin: 0; padding: var(--space-1) 0 var(--space-2); list-style: none; }
.request-item { display: flex; align-items: center; gap: var(--space-4); min-height: 36px; padding: var(--space-1) var(--space-2) var(--space-1) var(--space-4); }
.request-item__text { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: var(--space-2); overflow: hidden; white-space: nowrap; }
.request-item__text code { font-size: var(--text-sm); color: var(--color-text); }
.request-item__text .sensitive { align-self: center; }
.request-item__title { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: var(--text-sm); color: var(--color-text-tertiary); }
.request-item__end { display: flex; align-items: center; gap: var(--space-2); flex: none; }
.request-item__state { display: inline-flex; align-items: center; gap: var(--space-1); font-size: var(--text-xs); color: var(--color-text-secondary); white-space: nowrap; }
.request-item__state svg { width: 14px; height: 14px; }
.request-item--pending .request-item__state { color: var(--user-pending-fg); }
.request-item--approved .request-item__state { color: var(--tone-success-fg); font-weight: var(--weight-medium); }
.request-item--declined .request-item__state { color: var(--color-text-secondary); }
.request-item--withdrawn .request-item__text code, .request-item--declined .request-item__text code { color: var(--color-text-secondary); }
.request-item--withdrawn .request-item__state { color: var(--color-text-tertiary); }
.request-item__withdraw { opacity: 0; transition: opacity var(--duration-fast) var(--ease-out); }
.request-item:hover .request-item__withdraw, .request-item__withdraw:focus-visible { opacity: 1; }
@media (hover: none) {
  .request-item__withdraw { opacity: 1; }
}
@media (max-width: 640px) {
  .request-item { flex-wrap: wrap; row-gap: 0; }
  .request-item__text { flex-basis: 100%; }
  .request-item__title { display: none; }
}

/* ------------------------------------------------------------------ */
/* Admin: Requests and the decision                                     */
/* ------------------------------------------------------------------ */
.list--requests { --list-cols: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1fr) 96px; }
.request-row-link { cursor: pointer; }
.request-row-link .who strong .state { font-size: var(--text-xs); font-weight: var(--weight-medium); }
.request-row-link__reason { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-sm); color: var(--color-text-secondary); }
.request-row-link__tools { display: flex; align-items: center; gap: var(--space-2); min-width: 0; overflow: hidden; white-space: nowrap; }
.request-row-link__tools code { display: inline-flex; align-items: center; gap: var(--space-1); font-size: var(--text-xs); color: var(--color-text); }
.request-row-link__tools svg { width: 12px; height: 12px; color: var(--sensitive-fg); }
.request-row-link__by { margin-left: var(--space-2); }
.list--requests .right.meta { padding-right: var(--space-2); }
@media (max-width: 768px) {
  .list--requests { --list-cols: minmax(0, 1fr) auto; }
  .list--requests .hide-sm { display: none; }
}

.decision { display: grid; gap: var(--space-5); padding: var(--space-5); }
.decision__head { display: grid; gap: var(--space-2); }
.decision__reason { display: grid; gap: var(--space-1); margin: 0; }
.decision__label { font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--color-text-tertiary); }
.decision__quote { max-width: var(--measure); color: var(--color-text); line-height: var(--leading-normal); overflow-wrap: anywhere; }
.decision__items { display: grid; gap: var(--space-2); margin: 0; padding: 0; border: 0; min-width: 0; }
.decision__legend { padding: 0; margin-bottom: var(--space-2); font-size: var(--text-sm); color: var(--color-text-secondary); }
.decision-row__verdict { display: none; font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--tone-danger-fg); }
.decision-row.is-declined .decision-row__verdict { display: inline; animation: reveal var(--duration-fast) var(--ease-out); }
.decision-row.is-declined .endpoint-title { color: var(--color-text-secondary); }
.decision-row--closed { cursor: default; }
.decision-row--closed .endpoint-title { font-weight: var(--weight-regular); }
.decision-row__icon { display: grid; place-items: center; width: 16px; height: 16px; color: var(--color-text-tertiary); }
.decision-row__icon svg { width: 14px; height: 14px; }
.decision-row--closed.request-item--approved .decision-row__icon { color: var(--tone-success-fg); }
.decision-row--closed .request-item__state { padding-right: var(--space-2); }
.decision__fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
@media (min-width: 900px) {
  .decision__fields { grid-template-columns: minmax(0, 1fr) 180px; }
  .decision__reply { grid-column: 1 / -1; }
}
.decision__fields .field__hint { margin: 0; line-height: var(--leading-normal); }
.decision__required { color: var(--color-text-secondary); animation: reveal var(--duration-base) var(--ease-out); }
.decision__foot { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: var(--space-3) var(--space-6); padding-top: var(--space-4); border-top: 1px solid var(--color-border-subtle); }
.decision__activate { flex: 1 1 320px; font-size: var(--text-sm); color: var(--color-text-secondary); }
.decision__activate strong { color: var(--color-text); font-weight: var(--weight-medium); }
.decision__activate[hidden] { display: none; }
.decision__reply-shown { margin: 0 calc(-1 * var(--space-5)) calc(-1 * var(--space-5)); padding: var(--space-3) var(--space-5); }
/* ------------------------------------------------------------------ */
/* Tables of SQL grants: the row control, the picker, Your access      */
/* ------------------------------------------------------------------ */

/* A bq_* row holds a button, so it isn't one big label: the label wraps the checkbox and text and lays out as before. */
.grant-row--tables { cursor: default; }
.grant-row__hit { display: contents; cursor: pointer; }
.grant-row__hit > * { cursor: pointer; }

/* The choice sits on its own line under the endpoint's text, where the grant's details are. */
.grant-row--tables { row-gap: 0; }
.grant-row--tables > .table-choice { grid-column: 2; grid-row: 2; justify-self: start; margin: 0 0 0 calc(-1 * var(--space-2)); }
.grant-row--tables > .grant-row__end { grid-column: 3; grid-row: 1 / span 2; }
/* A pending change and a badge stack instead of sitting side by side, so the endpoint's title keeps its width. */
.grant-row--tables > .grant-row__end:has(> :not([hidden]) + :not([hidden])) { flex-direction: column; align-items: flex-end; gap: var(--space-1); }
.table-choice { display: inline-flex; align-items: center; min-width: 0; max-width: 100%; }
.list__row .table-choice__button { opacity: 1; gap: var(--space-1-5); max-width: 100%; height: 26px; color: var(--color-text-secondary); font-weight: var(--weight-medium); }
.table-choice__button:hover { color: var(--color-text); }
.table-choice__button svg { width: 14px; height: 14px; flex: none; }
.table-choice__button .table-choice__chevron { color: var(--color-text-tertiary); }
.table-choice__button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The choice only matters while the endpoint is ticked. */
.grant-row--tables:not(:has(.grant-row__check:checked)) .table-choice { display: none; }

.tables-dialog__head { display: grid; gap: var(--space-1); }
.tables-dialog__sub { display: flex; flex-wrap: wrap; gap: 0 var(--space-3); margin: 0; font-size: var(--text-sm); color: var(--color-text-secondary); }
.tables-dialog__sub span:empty { display: none; }
.tables-dialog__body { gap: var(--space-3); }

.tables-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); margin: 0; padding: 0; border: 0; min-width: 0; }
.tables-choice__option {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-md);
  cursor: pointer;
}
.tables-choice__option:has(input:checked) { border-color: var(--color-accent); background: var(--color-accent-subtle); }
.tables-choice__option:has(input:disabled) { cursor: not-allowed; }
.tables-choice__option:has(input:disabled) strong { color: var(--color-text-tertiary); }
.tables-choice__option:has(input:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.tables-choice__option input:focus-visible { outline: none; }
.tables-choice__option input { flex: none; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--color-primary); cursor: inherit; }
.tables-choice__text { display: grid; gap: 2px; min-width: 0; }
.tables-choice__text strong { font-weight: var(--weight-medium); }
.tables-choice__hint { font-size: var(--text-xs); color: var(--color-text-secondary); line-height: var(--leading-normal); }

.tables-dialog__tools { display: flex; align-items: center; gap: var(--space-3); }
.tables-dialog__search { flex: 1; min-width: 0; }
.tables-dialog__search .input { width: 100%; padding-right: var(--space-3); }
.tables-dialog__count { flex: none; font-size: var(--text-xs); color: var(--color-text-tertiary); }

.tables-list { height: min(360px, 44vh); overflow: auto; overscroll-behavior: contain; }
.tables-row { --list-cols: 16px minmax(0, 1fr) auto; gap: var(--space-3); min-height: 48px; cursor: pointer; }
.tables-row[hidden] { display: none; }
.tables-row__text { display: grid; gap: 2px; min-width: 0; }
.tables-row__title { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.tables-row__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-sm); color: var(--color-text); }
.tables-row__title .sensitive { flex: none; }
.tables-row__sub { font-size: var(--text-xs); color: var(--color-text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tables-row__sub:empty { display: none; }
.tables-row[data-missing] .tables-row__sub { color: var(--tone-warning-fg); }
.tables-row__meta { display: grid; justify-items: end; gap: 2px; padding-right: var(--space-2); font-size: var(--text-xs); color: var(--color-text-secondary); white-space: nowrap; }
.tables-row__meta span:last-child { color: var(--color-text-tertiary); }
/* All tables: every row is in, so the list steps back until Only these is chosen. */
.tables-list .tables-row { transition: opacity var(--duration-base) var(--ease-out); }
.tables-list.is-all .tables-row { opacity: 0.6; cursor: default; }
.tables-list.is-all .grant-row__check { cursor: default; }
.tables-row--skeleton { cursor: default; }
.tables-row--skeleton:hover { background: none; }
.tables-row__sk-check { width: 16px; height: 16px; }
.tables-row__sk-name { width: 40%; height: 12px; }
.tables-row__sk-meta { width: 64px; height: 12px; }
.tables-list__state { padding: var(--space-8) var(--space-6); }
.tables-list__detail { margin: 0; max-width: 44ch; font-size: var(--text-sm); line-height: var(--leading-normal); overflow-wrap: anywhere; }

.tables-dialog__foot { align-items: center; }
.tables-dialog__selected { margin-right: auto; font-size: var(--text-sm); color: var(--color-text-secondary); }

@media (max-width: 640px) {
  .tables-choice { grid-template-columns: minmax(0, 1fr); }
  .grant-row--tables > .grant-row__end,
  .grant-row--tables > .grant-row__end:has(> :not([hidden]) + :not([hidden])) {
    grid-column: 2 / -1; grid-row: 3; flex-direction: row; justify-content: flex-start; align-items: center; padding-right: 0;
  }
  .tables-row { --list-cols: 16px minmax(0, 1fr); }
  .tables-row__meta { grid-column: 2; display: flex; justify-items: start; gap: var(--space-3); padding: 0; }
}

/* Your access: which tables of a dataset the person has. */
.access-tables { margin-top: var(--space-1); font-size: var(--text-xs); }
.access-tables summary { font-weight: var(--weight-regular); }
.access-tables__list { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); margin: var(--space-2) 0 var(--space-1); padding: 0; list-style: none; }
.access-tables[open] .access-tables__list { animation: fade-in var(--duration-base) var(--ease-out); }
.access-tables__list code { font-size: var(--text-xs); color: var(--color-text-secondary); }

.request-row__state--partial { color: var(--color-text-secondary); }

@media (prefers-reduced-motion: reduce) {
  .tables-list .tables-row, .access-tables[open] .access-tables__list { transition: none; animation: none; }
}
/* ------------------------------------------------------------------ */
/* Business Central countries: the grant chip, the dialog, Health      */
/* ------------------------------------------------------------------ */

/* The countries of a Business Central grant, as a small control in the row's meta line. It sits inside the row's
   label, so it's a role="button" span; js/company-picker.js opens the dialog without ticking the row. */
.cc {
  display: inline-flex; align-items: center; gap: var(--space-1); align-self: center;
  height: 18px; padding: 0 var(--space-1-5); border: 1px solid var(--color-border); border-radius: var(--radius-xs);
  font-family: var(--font-sans); font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--color-text-secondary);
  background: var(--color-bg); cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out);
}
.cc:hover { color: var(--color-text); border-color: var(--color-border-strong); }
.cc:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.cc svg { width: 12px; height: 12px; flex: none; color: var(--color-text-tertiary); }
/* The countries only matter while the endpoint is ticked. */
.grant-row:not(:has(.grant-row__check:checked)) .cc { display: none; }

.companies-dialog__body { gap: var(--space-3); }
.companies-list { display: grid; gap: var(--space-2); margin: 0; padding: 0; border: 0; min-width: 0; }
.companies-row {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-md); cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-out), background-color var(--duration-fast) var(--ease-out);
}
.companies-row:has(input:checked) { border-color: var(--color-accent); background: var(--color-accent-subtle); }
.companies-row:has(input:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.companies-row input { flex: none; margin: 2px 0 0; }
.companies-row input:focus-visible { outline: none; }
.companies-row--all { border-style: dashed; }
.companies-row--all:has(input:checked) { border-style: solid; }
/* The sandbox is apart from the countries: All countries leaves it out. */
.companies-row--sandbox { margin-top: var(--space-2); }
.companies-row__text { display: grid; gap: 2px; min-width: 0; }
.companies-row__text strong { font-weight: var(--weight-medium); }
.companies-row__title { display: flex; align-items: center; gap: var(--space-2); }
.companies-row__hint { font-size: var(--text-xs); color: var(--color-text-secondary); line-height: var(--leading-normal); }
.companies-row__note { font-size: var(--text-xs); color: var(--color-text-tertiary); line-height: var(--leading-normal); }
.companies-row__note:empty { display: none; }
.companies-row__note--unavailable { color: var(--tone-warning-fg); }
@media (prefers-reduced-motion: no-preference) {
  .companies-row__note:not(:empty) { animation: fade-in var(--duration-base) var(--ease-out); }
}
.companies-dialog__status { margin: 0; font-size: var(--text-xs); color: var(--color-text-secondary); }
.companies-dialog__status:empty { display: none; }
.companies-dialog__status .btn--link { vertical-align: baseline; }

/* Health: each company under its connector. */
.pulse--degraded { background: var(--tone-warning-solid); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone-warning-solid) 18%, transparent); }
.health-state--degraded { color: var(--tone-warning-fg); font-weight: var(--weight-medium); }
.health-summary--degraded svg { width: var(--icon-md); height: var(--icon-md); flex: none; color: var(--tone-warning-solid); }
.health-summary--degraded strong { color: var(--tone-warning-fg); }
.health-row--part { border-top-style: dashed; }
.health-part { padding-left: calc(24px + var(--space-3)); }
.list--health .health-row--action { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); border-top-style: dashed; white-space: normal; }
.list--health .health-row--action .meta { flex: 1 1 240px; min-width: 0; white-space: normal; margin: 0; padding-left: calc(24px + var(--space-3)); font-size: var(--text-xs); overflow-wrap: anywhere; }
.health-detail--warning { color: var(--tone-warning-fg); }
.health-row__detail--warning { font-family: var(--font-sans); color: var(--tone-warning-fg); }
.health-row--action code { font-size: var(--text-xs); }
@media (max-width: 768px) {
  .health-part, .list--health .health-row--action .meta { padding-left: var(--space-4); }
  .list--health .health-row--action { flex-wrap: wrap; }
}

/* People's pages: the countries a grant covers, and the countries of a request. */
.access-countries { font-size: var(--text-xs); color: var(--color-text-secondary); }

/* A call that read another company than Denmark names it next to the tool. */
.call__tool--company { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.call__tool--company code { min-width: 0; font-size: var(--text-sm); }
.call__tool--company .badge { flex: none; }

/* Usage: Business Central by company. Columns: company, calls, rows, people, refused, errors, p95. */
.list--usage-companies { --list-cols: minmax(0, 1.4fr) minmax(0, 1.3fr) 84px 64px 72px 64px 72px; }
@media (max-width: 1080px) {
  .list--usage-companies { --list-cols: minmax(0, 1.3fr) minmax(0, 1.2fr) 84px 72px 64px; }
}
@media (max-width: 768px) {
  .list--usage-companies { --list-cols: minmax(0, 1fr) minmax(96px, 0.8fr); }
}
.health-part__title { display: flex; align-items: center; gap: var(--space-2); }
.companies-dialog .tables-dialog__selected { white-space: nowrap; }
/* On a phone the primary button already names the countries. */
@media (max-width: 480px) {
  .companies-dialog .tables-dialog__selected { display: none; }
}
/* ------------------------------------------------------------------ */
/* Usage page                                                          */
/* ------------------------------------------------------------------ */
[data-region="usage"].is-loading { opacity: 0.6; transition: opacity var(--duration-base) var(--ease-out); }
.usage-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin: 0 0 var(--space-4); }
.usage-bar__note { margin: 0; }

.chart-card { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); padding: var(--space-5); margin-bottom: var(--space-4); }
.chart-card > .empty { padding: var(--space-8) var(--space-6); }
.chart-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-2) var(--space-6); flex-wrap: wrap; }
.chart-legend { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-1) var(--space-4); padding-top: 2px; font-size: var(--text-xs); color: var(--color-text-secondary); }
.chart-legend > span { display: inline-flex; align-items: center; gap: var(--space-1-5); white-space: nowrap; }
.chart-legend--ramp { gap: 2px; }
.chart-legend--ramp > span:first-child { margin-right: var(--space-1-5); }
.chart-legend--ramp > span:last-child { margin-left: var(--space-1-5); }
.chart-key { display: inline-block; flex: none; }
.chart-key--bar { width: 10px; height: 10px; border-radius: 2px; }
.chart-key--line { width: 14px; height: 2px; border-radius: 1px; }
.chart-key--cell { width: 12px; height: 12px; border-radius: 2px; }
.chart-key--highlight { background: var(--chart-highlight); }
.chart-key--neutral { background: var(--chart-neutral); }
.chart-key.chart__cell--1 { background: var(--chart-seq-1); }
.chart-key.chart__cell--2 { background: var(--chart-seq-2); }
.chart-key.chart__cell--3 { background: var(--chart-seq-3); }
.chart-key.chart__cell--4 { background: var(--chart-seq-4); }
.chart-key.chart__cell--5 { background: var(--chart-seq-5); }

.chart { position: relative; min-height: 220px; border-radius: var(--radius-sm); }
/* Until the script draws it, the chart's box holds its place as a quiet skeleton. */
.chart:empty { background: var(--color-bg-subtle); animation: skeleton-pulse 1.4s var(--ease-in-out) infinite; }
@media (prefers-reduced-motion: reduce) { .chart:empty { animation: none; } }
/* The drawn heights, reserved before the script runs: columns 240px, lines 220px, the heatmap 7 rows of up to 28px. */
.chart[data-chart="load"] { min-height: 240px; }
.chart--heat { min-height: 222px; }
@media (max-width: 768px) {
  .chart--heat { min-height: 138px; }
}
.chart:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 4px; }
.chart svg { display: block; overflow: visible; touch-action: pan-y; }
.chart text { font-size: 11px; font-variant-numeric: tabular-nums; }
.chart__tick { fill: var(--chart-label); }
.chart__end { fill: var(--color-text-secondary); font-weight: var(--weight-medium); }
.chart__grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart__axis { stroke: var(--chart-axis); stroke-width: 1; }
.chart__band { fill: var(--chart-band); }
.chart__slot { fill: var(--color-text); opacity: 0.05; }
.chart__col { transition: opacity var(--duration-fast) var(--ease-out); }
.chart__col--highlight { fill: var(--chart-highlight); }
.chart__col--neutral { fill: var(--chart-neutral); }
.has-active .chart__col:not(.is-active) { opacity: 0.55; }
/* The whole chart reads the pointer's position, so a line or dot drawn over a column never takes the hover from it. */
.chart__line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; }
.chart__line--neutral { stroke: var(--chart-neutral); }
.chart__line--highlight { stroke: var(--chart-highlight); }
.chart__dot { stroke: var(--color-surface); stroke-width: 2; pointer-events: none; }
.chart__dot--neutral { fill: var(--chart-neutral); }
.chart__dot--highlight { fill: var(--chart-highlight); }
.chart__cross { stroke: var(--chart-axis); stroke-width: 1; }
.chart__cell { transition: opacity var(--duration-fast) var(--ease-out); }
.chart__cell--0 { fill: var(--chart-seq-0); }
.chart__cell--1 { fill: var(--chart-seq-1); }
.chart__cell--2 { fill: var(--chart-seq-2); }
.chart__cell--3 { fill: var(--chart-seq-3); }
.chart__cell--4 { fill: var(--chart-seq-4); }
.chart__cell--5 { fill: var(--chart-seq-5); }
.chart__cell.is-active { stroke: var(--color-text); stroke-width: 1.5; }
.chart__outline { fill: none; stroke: var(--color-text); stroke-width: 1.5; pointer-events: none; }

/* The chart readout: ink, like every tooltip. Values lead, labels follow. */
.chart-tip {
  position: absolute; left: 0; top: 0; z-index: 5;
  display: grid; gap: 2px;
  min-width: 132px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  color: var(--color-primary-fg);
  box-shadow: var(--shadow-md);
  font-size: var(--text-xs);
  line-height: var(--leading-snug);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-out);
}
.chart-tip.is-on { opacity: 1; }
.chart-tip__title { font-weight: var(--weight-medium); }
.chart-tip__sub { margin-bottom: var(--space-1); color: color-mix(in srgb, var(--color-primary-fg) 70%, transparent); }
.chart-tip__row { display: flex; align-items: center; gap: var(--space-1-5); }
.chart-tip__row strong { font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.chart-tip__row span { color: color-mix(in srgb, var(--color-primary-fg) 70%, transparent); }

.chart-table summary { width: max-content; }
.table-wrap { max-height: 360px; margin-top: var(--space-3); overflow: auto; border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); color: var(--color-text); }
.table th, .table td { height: 36px; padding: 0 var(--space-3); border-top: 1px solid var(--color-border-subtle); text-align: left; white-space: nowrap; }
.table thead th { position: sticky; top: 0; z-index: 1; border-top: 0; background: var(--color-bg-subtle); color: var(--color-text-tertiary); font-size: var(--text-xs); font-weight: var(--weight-medium); }
.table tbody th { font-weight: var(--weight-regular); }
.table .num { text-align: right; }
.table--heat td.is-business { background: var(--chart-band); font-weight: var(--weight-medium); }

.list--usage .list__row { min-height: 48px; }
.list--usage-sources { --list-cols: minmax(0, 1.4fr) minmax(0, 1.3fr) 84px 64px 72px 72px 64px 96px; }
.list--usage-endpoints { --list-cols: minmax(0, 1.3fr) minmax(0, 1.4fr) 84px 64px 72px 64px; }
.list--usage-endpoints .list__row > .num { text-align: right; }
.list--usage-people { --list-cols: minmax(0, 1.3fr) minmax(0, 1.2fr) 72px 72px 72px 64px 96px; }
.list--usage-heavy { --list-cols: 96px minmax(0, 0.8fr) minmax(0, 2fr) 72px 64px; }
.list--usage-bc { --list-cols: minmax(0, 1.5fr) minmax(0, 1fr) 64px 64px 112px 112px 96px 72px; }
.list--usage-bc + .chart-card { margin-top: var(--space-4); }
.refusal-cell { display: inline-flex; justify-content: flex-end; align-items: baseline; gap: var(--space-2); }
.refusal-cell__share { min-width: 4ch; color: var(--color-text-tertiary); font-size: var(--text-xs); }
.bc-name--short { display: none; }
.list--usage .num { font-size: var(--text-sm); }
.list--usage .who .source { width: 24px; height: 24px; }
.list--usage .who strong { overflow: hidden; text-overflow: ellipsis; }
.num--bad { color: var(--tone-danger-fg); font-weight: var(--weight-medium); }
.bar-cell { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.bar-cell .num { flex: none; min-width: 48px; text-align: right; }
.meter { display: block; flex: 1; min-width: 24px; height: 6px; overflow: visible; border-radius: var(--radius-full); background: var(--color-bg-muted); }
.meter rect { fill: var(--chart-neutral); }
.endpoint-cell { display: grid; gap: 2px; min-width: 0; }
.endpoint-cell > code:first-child { font-size: var(--text-sm); color: var(--color-text); }
.endpoint-cell code.meta { font-size: 11px; }
.quiet-link { color: var(--color-text); }
.quiet-link:hover { color: var(--color-text); text-decoration: underline; text-decoration-color: var(--color-border-strong); }
.list-more > summary { cursor: pointer; list-style: none; }
.list-more > summary::-webkit-details-marker { display: none; }
.list-more > summary:focus-visible, .list-more > [tabindex="-1"]:focus-visible { outline-offset: -2px; }
.list-more[open] > summary { display: none; }
.list-more__label { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-text-secondary); }
.list-more__label svg { width: var(--icon-sm); height: var(--icon-sm); }
.list-more[open] > .list__row:nth-child(2) { border-top: 1px solid var(--color-border-subtle); }
.list-more[open] > .list__row { animation: fade-in var(--duration-base) var(--ease-out); }
/* A folded part until its rows arrive: skeleton bars where the name and the numbers will be. */
.part-loading .skeleton { display: block; height: 12px; }
.part-loading__name { width: 160px; max-width: 100%; }
.part-loading .part-loading__bar { width: 60%; height: 6px; }
.part-loading__cell { width: 48px; margin-left: auto; }
.part-loading__row:nth-of-type(2n) .part-loading__name, .part-loading tr:nth-child(2n) .part-loading__name { width: 120px; }

@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat--hero { grid-column: 1 / -1; grid-row: auto; }
  .list--usage .hide-md { display: none; }
  .list--usage-sources { --list-cols: minmax(0, 1.3fr) minmax(0, 1.2fr) 84px 72px 64px 96px; }
  .list--usage-endpoints { --list-cols: minmax(0, 1.3fr) minmax(0, 1.2fr) 84px 72px 64px; }
  .list--usage-people { --list-cols: minmax(0, 1.3fr) minmax(0, 1.2fr) 72px 96px; }
  .list--usage-bc { --list-cols: minmax(0, 1.4fr) minmax(0, 1fr) 64px 112px 112px 96px; }
}
@media (max-width: 768px) {
  .chart-card { padding: var(--space-4); }
  .list--usage .hide-sm { display: none; }
  .list--usage-sources, .list--usage-endpoints, .list--usage-people { --list-cols: minmax(0, 1fr) minmax(96px, 0.8fr); }
  .list--usage-heavy { --list-cols: 72px minmax(0, 1fr) auto; }
  .list--usage-heavy .list__row > :nth-child(2) { display: none; }
  .list--usage .list__row { padding-right: var(--space-3); }
  .list--usage-bc { --list-cols: minmax(0, 1fr) 52px 72px 72px; }
  .list--usage-bc .list__row--head > span { white-space: normal; line-height: 1.3; }
  .list--usage-bc .refusal-cell__share { display: none; }
  .list--usage-bc .bar-cell .meter { display: none; }
  .list--usage-bc .bc-name { display: none; }
  .list--usage-bc .bc-name--short { display: inline; }

}
@media (max-width: 480px) {
  .stats { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-2); }
  .stat--hero { grid-column: 1 / -1; }
  .stat { padding: var(--space-3); }
  .stat--hero { padding: var(--space-4); }
  .stat__value { font-size: var(--text-xl); }
  .stat--hero .stat__value { font-size: 40px; }
}

/* ------------------------------------------------------------------ */
/* Your usage                                                          */
/* ------------------------------------------------------------------ */
[data-region="your-usage"].is-loading { opacity: 0.6; transition: opacity var(--duration-base) var(--ease-out); }
.page-head__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.your-usage .page-head__sub { max-width: var(--measure); }
.your-usage__note { margin: var(--space-3) 0 0; }
.your-usage__empty > .empty { padding: var(--space-10) var(--space-6); }
.chart__line--thin { stroke-width: 1.75; }
/* A typical colleague: a quiet grey that stays readable over the columns in both themes. */
.chart__line--colleague { stroke: var(--color-text-secondary); }
.chart__dot--colleague { fill: var(--color-text-secondary); }
.chart-key--colleague { background: var(--color-text-secondary); }
.chart__line--halo { stroke: var(--color-surface); stroke-width: 5; }
.chart__dot--small { stroke-width: 1.5; }
.chart-table__note { margin: var(--space-2) 0 0; }
.meter--highlight rect { fill: var(--chart-highlight); }

.list--your-usage { --list-cols: minmax(0, 1.3fr) minmax(0, 1.2fr) minmax(0, 1fr) 144px 16px; }
.list--your-usage .list__row { min-height: 52px; color: var(--color-text); text-decoration: none; transition: background-color var(--duration-fast) var(--ease-out); }
.list--your-usage .who .source { width: 24px; height: 24px; }
.list--your-usage .num { font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.your-source__sub { display: none; }
.your-source__typical { font-size: var(--text-sm); color: var(--color-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.your-source__typical .num { color: var(--color-text); font-weight: var(--weight-medium); }
.your-source__trend { display: inline-flex; align-items: center; gap: var(--space-1-5); font-size: var(--text-xs); color: var(--color-text-tertiary); white-space: nowrap; }
.your-source__trend svg { width: var(--icon-sm); height: var(--icon-sm); flex: none; }
.your-source__mark { display: inline-flex; color: var(--color-accent); }
.your-source__mark svg { width: var(--icon-sm); height: var(--icon-sm); }
.list--your-usage .list__row.is-selected { background: var(--color-accent-subtle); }
.list--your-usage .list__row.is-selected .who strong { color: var(--color-text); }
.list--your-usage .list__row:focus-visible { outline-offset: -2px; }

.allowance { display: grid; gap: var(--space-3); padding: var(--space-5); margin-top: var(--space-8); }
.allowance__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); flex-wrap: wrap; }
.allowance__head .title-3 { display: inline-flex; align-items: center; gap: var(--space-3); margin: 0; }
.allowance__head .source { width: 24px; height: 24px; }
.allowance__value { margin: 0; font-size: var(--text-sm); color: var(--color-text-secondary); }
.allowance__value strong { color: var(--color-text); font-weight: var(--weight-medium); }
.allowance__full { margin-left: var(--space-2); color: var(--tone-warning-fg); font-weight: var(--weight-medium); }
.allowance__meter svg { display: block; width: 100%; height: 8px; border-radius: var(--radius-full); background: var(--color-bg-muted); }
.allowance__fill { fill: var(--chart-neutral); }
.allowance--full .allowance__fill { fill: var(--tone-warning-solid); }
.allowance__text { margin: 0; max-width: var(--measure); font-size: var(--text-sm); color: var(--color-text-secondary); line-height: var(--leading-normal); }

@media (max-width: 1080px) {
  .list--your-usage { --list-cols: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) 16px; }
  .list--your-usage .your-source__trend { display: none; }
}
@media (max-width: 768px) {
  .list--your-usage { --list-cols: minmax(0, 1.5fr) minmax(88px, 0.6fr) 16px; }
  .list--your-usage .list__row { gap: var(--space-3); }
  .list--your-usage .list__row { padding-right: var(--space-3); }
  .your-source__typical { display: none; }
  .your-source__sub { display: block; white-space: normal; }
  .allowance { padding: var(--space-4); }
}
/* On the selected row's tint, text takes the tint's own hue rather than grey. */
.list--your-usage .list__row.is-selected .your-source__typical,
.list--your-usage .list__row.is-selected .your-source__typical .num { color: var(--tone-info-text); }
.list--your-usage .list__row.is-selected .your-source__trend,
.list--your-usage .list__row.is-selected .your-source__sub { color: var(--tone-info-fg); }
/* ------------------------------------------------------------------ */
/* Command palette and keyboard shortcuts                              */
/* ------------------------------------------------------------------ */
.palette-trigger {
  height: var(--control-md);
  gap: var(--space-2);
  padding: 0 var(--space-2) 0 calc(var(--space-3) + var(--icon-md) + var(--space-2));
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  box-shadow: var(--shadow-inset);
  color: var(--color-text-tertiary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.topbar__end .palette-trigger { width: 288px; }
.palette-trigger:hover { border-color: var(--color-text-disabled); }
.palette-trigger__text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-trigger kbd { position: static; flex: none; }
.palette-trigger--compact { display: none; }
@media (max-width: 768px) {
  .palette-trigger--compact { display: inline-flex; }
}

dialog.palette {
  width: min(600px, calc(100vw - var(--space-8)));
  max-height: min(560px, calc(100dvh - 24vh));
  margin: 12vh auto auto;
  overflow: hidden;
  transition-duration: var(--duration-base);
}
dialog.palette[open] { display: flex; flex-direction: column; }
dialog.palette:not([open]) { transform: translateY(-4px); }
@starting-style {
  dialog.palette[open] { opacity: 0; transform: translateY(-4px); }
}
dialog.palette::backdrop { transition-duration: var(--duration-base); }
.palette__head {
  display: flex; align-items: center; gap: var(--space-2);
  flex: none;
  height: 52px;
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
}
.palette__head > svg { width: var(--icon-md); height: var(--icon-md); flex: none; color: var(--color-text-tertiary); }
.palette__input {
  flex: 1; min-width: 0; height: 100%;
  border: 0; background: none; outline: none;
  color: var(--color-text);
  font: inherit; font-size: var(--text-md);
}
.palette__input::placeholder { color: var(--color-text-tertiary); }
.palette__body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--space-1) var(--space-2) var(--space-2); }
.palette__group { display: grid; grid-template-columns: minmax(0, 1fr); }
.palette__item { min-width: 0; }
.palette__group-label { padding: var(--space-3) var(--space-2) var(--space-1); font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--color-text-tertiary); }
.palette__item { height: 36px; text-decoration: none; }
a.palette__item:hover { text-decoration: none; color: var(--color-text); }
.palette__item:hover { background: none; }
.palette__item[aria-selected="true"] { background: var(--color-bg-emphasis); }
.palette__item[aria-selected="true"] .palette__sub { color: var(--color-text-secondary); }
.palette__body:focus-visible { outline-offset: -2px; }
.palette__item > svg { flex: none; }
.palette__item .palette__status--active { color: var(--user-active-solid); }
.palette__item .palette__status--pending { color: var(--user-pending-solid); }
.palette__item .palette__status--disabled { color: var(--user-disabled-solid); }
.palette__text { display: flex; align-items: baseline; gap: var(--space-2); flex: 1; min-width: 0; }
.palette__label { flex: 0 1 auto; min-width: 0; max-width: 65%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette__item--mono .palette__label { font-family: var(--font-mono); font-size: 0.92em; }
.palette__sub { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-xs); color: var(--color-text-tertiary); }
.palette__hint { flex: none; font-size: var(--text-xs); color: var(--user-pending-fg); }
.palette__item:has(.palette__status--disabled) .palette__hint { color: var(--color-text-tertiary); }
.palette__skeleton { display: grid; padding-top: var(--space-2); }
.palette__skeleton-row { display: flex; align-items: center; gap: var(--space-2); height: 36px; padding: 0 var(--space-2); }
.palette__skeleton-icon { width: 16px; height: 16px; flex: none; }
.palette__skeleton-text { height: 10px; width: 40%; }
.palette__skeleton-row:nth-child(2n) .palette__skeleton-text { width: 56%; }
.palette__skeleton-row:nth-child(3n) .palette__skeleton-text { width: 32%; }
.palette__empty { display: grid; justify-items: center; gap: var(--space-2); padding: var(--space-10) var(--space-4); text-align: center; }
.palette__empty-title { margin: 0; font-weight: var(--weight-medium); color: var(--color-text); overflow-wrap: anywhere; }
.palette__empty-text { margin: 0; font-size: var(--text-sm); color: var(--color-text-secondary); }
.palette__empty .btn { margin-top: var(--space-2); }
.palette__foot {
  display: flex; align-items: center; gap: var(--space-4);
  flex: none;
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--color-border-subtle);
  background: var(--color-bg-subtle);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}
.palette__foot > span { display: inline-flex; align-items: center; gap: var(--space-1); }
.palette__foot kbd { height: 18px; min-width: 18px; justify-content: center; }
.palette__foot-end { margin-left: auto; }
@media (max-width: 768px) {
  dialog.palette { width: calc(100vw - var(--space-4)); margin-top: var(--space-2); max-height: calc(100dvh - var(--space-4)); }
  .palette__foot, .palette__head kbd { display: none; }
}

.shortcuts__list { display: grid; margin: 0; }
.shortcuts__group { display: grid; gap: var(--space-1); }
.shortcuts__heading { margin: 0; }
.shortcuts__row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: 36px; }
.shortcuts__label { font-size: var(--text-sm); color: var(--color-text); }
.shortcuts__keys { display: flex; align-items: center; gap: var(--space-1); margin: 0; flex: none; }
.shortcuts__keys kbd { min-width: 22px; justify-content: center; }
.shortcuts__then { font-size: var(--text-xs); color: var(--color-text-tertiary); padding: 0 var(--space-1); }

/* ------------------------------------------------------------------ */
/* Loading and load errors                                             */
/* ------------------------------------------------------------------ */
.load-error { display: grid; justify-items: center; gap: var(--space-2); padding: var(--space-12) var(--space-6); text-align: center; color: var(--color-text-secondary); }
.load-error .empty__title { font-weight: var(--weight-semibold); }
.load-error .btn { margin-top: var(--space-3); }
.load-error--compact { padding: var(--space-6) var(--space-4); }
/* On a raised surface (dialogs) the muted tile would disappear in dark mode. */
.dialog .empty__icon { background: var(--color-bg-emphasis); }
.describe__loading { display: grid; gap: var(--space-2); }
.describe__skeleton-label { width: 96px; height: 12px; }
.describe__skeleton-area { height: 214px; border-radius: var(--radius-sm); }
/* ------------------------------------------------------------------ */
/* Data source pages (/sources/…)                                      */
/* ------------------------------------------------------------------ */

/* Header: the source as a quiet way back, the title, then the facts in one wrapping row. */
.source-head { align-items: flex-start; }
.source-head__main { display: grid; gap: var(--space-2); min-width: 0; }
.source-head__eyebrow {
  display: inline-flex; align-items: center; gap: var(--space-2); justify-self: start;
  font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-text-secondary); text-decoration: none;
  border-radius: var(--radius-xs);
}
.source-head__eyebrow:hover { color: var(--color-text); text-decoration: none; }
.source-head .title-1 { overflow-wrap: anywhere; }
.source-head__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-5); min-height: 28px; }
.source-head__tool { display: inline-flex; align-items: center; gap: var(--space-1); min-width: 0; }
.source-head__tool code { font-size: var(--text-sm); color: var(--color-text-secondary); overflow-wrap: anywhere; }
.source-head__fact { display: inline-flex; align-items: center; gap: var(--space-1-5); }
.source-head__fact svg { width: var(--icon-sm); height: var(--icon-sm); flex: none; }

/* "Do I have it?": one row, the sentence first and the one action at the end. */
.source-access-section { margin-top: var(--space-6); }
.source-access { display: flex; align-items: center; gap: var(--space-4); min-height: 64px; padding: var(--space-3) var(--space-4); }
.source-access__text { flex: 1; min-width: 0; display: grid; gap: var(--space-0-5); }
.source-access__line { font-weight: var(--weight-medium); color: var(--color-text); }
.source-access__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-4); font-size: var(--text-sm); color: var(--color-text-secondary); }
.source-access__action { display: flex; align-items: center; flex: none; }
.source-access__action form { display: flex; }
.source-access--granted .row-icon { background: var(--tone-success-bg); color: var(--tone-success-fg); }
.source-access--requested .row-icon, .source-access--pending-granted .row-icon { background: var(--tone-info-bg); color: var(--tone-info-fg); }
@media (max-width: 640px) {
  .source-access { flex-wrap: wrap; align-items: flex-start; }
  .source-access__text { flex-basis: calc(100% - 28px - var(--space-4)); }
  .source-access__action { flex-basis: 100%; padding-left: calc(28px + var(--space-4)); }
  .source-access:has(.switch) { flex-wrap: nowrap; }
  .source-access:has(.switch) .source-access__action { flex-basis: auto; padding-left: 0; }
}

/* "What can I ask with it?" */
.source-purpose { display: grid; gap: var(--space-5); padding: var(--space-5); }
.source-purpose__summary { margin: 0; font-size: var(--text-md); line-height: var(--leading-relaxed); color: var(--color-text); max-width: var(--measure); }
.source-purpose__ask { display: grid; gap: var(--space-2); }
.source-purpose__ask .eyebrow { margin: 0; color: var(--color-text-tertiary); }
.source-questions { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.source-question {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-1-5) var(--space-1-5) var(--space-1-5) var(--space-3);
  border: 1px solid var(--color-border-subtle); border-radius: var(--radius-sm); background: var(--color-bg-subtle);
  line-height: var(--leading-normal);
}
.source-question > svg { width: var(--icon-md); height: var(--icon-md); flex: none; color: var(--color-text-tertiary); }
.source-question > span { flex: 1; min-width: 0; }
.source-question .btn { flex: none; }
.source-purpose__rules { display: flex; gap: var(--space-2); align-items: flex-start; margin: 0; font-size: var(--text-sm); line-height: var(--leading-normal); color: var(--color-text-secondary); }
.source-purpose__rules svg { width: var(--icon-md); height: var(--icon-md); flex: none; margin-top: 2px; color: var(--color-text-tertiary); }
.source-purpose__rules strong { color: var(--color-text); font-weight: var(--weight-medium); }

/* Columns: one table per group, so the default ones can be read without the long tail. */
.source-columns__filter { width: 240px; max-width: 100%; }
.source-columns-list { display: grid; }
.source-columns-list > .source-columns__group { margin: 0; padding: var(--space-2) var(--space-4); border-bottom: 1px solid var(--color-border-subtle); background: var(--color-bg-subtle); color: var(--color-text-tertiary); }
.source-columns { table-layout: fixed; }
.source-columns col.source-columns__name { width: 34%; }
.source-columns col.source-columns__type { width: 16%; }
.source-columns col.source-columns__mode { width: 12%; }
.source-columns th, .source-columns td { height: 40px; white-space: normal; vertical-align: middle; }
.source-columns tbody tr:first-child > * { border-top: 0; }
.source-columns thead th { border-bottom: 1px solid var(--color-border-subtle); }
.source-columns tbody th { font-weight: var(--weight-regular); }
.source-columns tbody tr:hover { background: var(--color-bg-subtle); }
.source-column__name { display: inline-flex; align-items: center; gap: var(--space-1); max-width: 100%; }
.source-column__name code { font-size: var(--text-sm); color: var(--color-text); overflow-wrap: anywhere; }
.source-column__name .btn:not(.source-column__toggle) { opacity: 0; transition: opacity var(--duration-fast) var(--ease-out); }
.source-columns tr:hover .source-column__name .btn, .source-column__name .btn:focus-visible { opacity: 1; }
.source-column__type, .source-column__mode { color: var(--color-text-secondary); }
.source-column__note { color: var(--color-text-secondary); }
.source-column__note > span + span { margin-left: var(--space-3); }
.source-columns__more { border-top: 1px solid var(--color-border-subtle); }
.source-columns__more > summary { display: flex; min-height: 40px; padding: 0 var(--space-4); }
.source-columns__more[open] > summary { border-bottom: 1px solid var(--color-border-subtle); }
.source-columns__more .source-columns thead { display: none; }
.source-columns-list > .source-columns__more .source-columns { animation: fade-in var(--duration-base) var(--ease-out); }
.source-columns-list > .empty { border-top: 1px solid var(--color-border-subtle); }
/* A record's fields sit under it, one step in per level. */
.source-column--depth-1 > th { padding-left: calc(var(--space-3) + var(--space-6)); }
.source-column--depth-2 > th { padding-left: calc(var(--space-3) + var(--space-6) * 2); }
.source-column--depth-3 > th, .source-column--depth-4 > th { padding-left: calc(var(--space-3) + var(--space-6) * 3); }
.source-column__toggle svg { transition: transform var(--duration-base) var(--ease-out); }
.source-column__toggle[aria-expanded="false"] svg { transform: rotate(-90deg); }
@media (max-width: 640px) {
  /* On a phone each column is a name over its type and note. */
  .source-columns, .source-columns tbody, .source-columns tr, .source-columns th, .source-columns td { display: block; width: auto; height: auto; }
  .source-columns colgroup, .source-columns thead { display: none; }
  .source-columns tr { padding: var(--space-2) var(--space-4); border-top: 1px solid var(--color-border-subtle); }
  .source-columns tbody tr:first-child { border-top: 0; }
  .source-columns th, .source-columns td { padding: 0; border: 0; }
  .source-columns td:empty { display: none; }
  .source-column__type, .source-column__mode { display: inline-block; margin-right: var(--space-3); font-size: var(--text-sm); }
  .source-column__note { font-size: var(--text-sm); }
  .source-column__name .btn:not(.source-column__toggle) { opacity: 1; }
  .source-column--depth-1 > th, .source-column--depth-2 > th, .source-column--depth-3 > th, .source-column--depth-4 > th { padding-left: 0; }
  .source-column--depth-1 { padding-left: calc(var(--space-4) + var(--space-4)); }
  .source-column--depth-2, .source-column--depth-3, .source-column--depth-4 { padding-left: calc(var(--space-4) + var(--space-8)); }
}

/* A dataset's tables. */
.list--source-tables { --list-cols: minmax(0, 1fr) 96px 84px 112px; }
.list--source-tables-grant { --list-cols: minmax(0, 1fr) 96px 84px 112px 140px; }
.source-tables { margin: 0; padding: 0; list-style: none; }
.source-tables > li + li > .list__row { border-top: 1px solid var(--color-border-subtle); }
.source-table-row { color: var(--color-text); text-decoration: none; }
.source-table-row__text { display: grid; gap: var(--space-0-5); min-width: 0; }
.source-table-row__name { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.source-table-row__name code { font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-table-row__sub { font-size: var(--text-sm); color: var(--color-text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-table-row__grant { display: inline-flex; align-items: center; gap: var(--space-1); font-size: var(--text-sm); color: var(--color-text-tertiary); }
.source-table-row__grant.is-in { color: var(--color-text); }
.source-table-row__grant svg { width: var(--icon-sm); height: var(--icon-sm); color: var(--tone-success-fg); }
.toolbar__end .segmented { flex: none; }
.toolbar__end { display: inline-flex; align-items: center; gap: var(--space-2); }
@media (max-width: 640px) {
  .list--source-tables, .list--source-tables-grant { --list-cols: minmax(0, 1fr) auto; }
  .list--source-tables .list__row > :nth-child(3), .list--source-tables .list__row > :nth-child(4) { display: none; }
  .list--source-tables .list__row > :nth-child(5) { grid-column: 1 / -1; }
  .list--source-tables .toolbar__end { width: 100%; }
}
.source-table-note { margin: var(--space-4) 0 0; max-width: var(--measure); color: var(--color-text-secondary); }

/* Tekla Data's metrics. */
.list--source-metrics { --list-cols: minmax(0, 1fr) minmax(0, 208px) 96px 104px; }
.source-metrics { margin: 0; padding: 0; list-style: none; }
.source-metrics > li + li { border-top: 1px solid var(--color-border-subtle); }
.source-metric__text { display: grid; gap: var(--space-0-5); min-width: 0; }
.source-metric__label { display: flex; align-items: center; gap: var(--space-2); font-weight: var(--weight-medium); color: var(--color-text); }
.source-metric__summary { font-size: var(--text-sm); color: var(--color-text-secondary); }
.source-metric__name { display: inline-flex; align-items: center; gap: var(--space-1); min-width: 0; }
.source-metric__name code { font-size: var(--text-sm); color: var(--color-text); overflow-wrap: anywhere; }
.source-metric__name .btn { opacity: 0; transition: opacity var(--duration-fast) var(--ease-out); }
.source-metric:hover .source-metric__name .btn, .source-metric__name .btn:focus-visible { opacity: 1; }
.source-metric__type { font-size: var(--text-sm); color: var(--color-text-secondary); }
@media (max-width: 640px) {
  .list--source-metrics { --list-cols: minmax(0, 1fr) auto auto; }
  .list--source-metrics .list__row--head { display: none; }
  .source-metric { row-gap: var(--space-1); padding-top: var(--space-3); padding-bottom: var(--space-3); }
  .source-metric__text { grid-column: 1 / -1; }
  .source-metric__name .btn { opacity: 1; }
}

/* What Claude can read in a code repository. */
.source-can { display: grid; margin: 0; padding: 0; list-style: none; }
.source-can > li { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4); line-height: var(--leading-normal); color: var(--color-text-secondary); }
.source-can > li + li { border-top: 1px solid var(--color-border-subtle); }
.source-can svg { width: var(--icon-md); height: var(--icon-md); flex: none; margin-top: 2px; color: var(--color-text-tertiary); }
.source-can strong { color: var(--color-text); font-weight: var(--weight-medium); }

/* Example rows: they scroll sideways inside their section, never the page, with the first column in place. */
.source-examples__companies { flex: none; }
.source-examples__body { display: grid; gap: var(--space-2); min-width: 0; }
.source-examples__body.is-loaded > * { animation: rows-in var(--duration-base) var(--ease-out); }
@keyframes rows-in { from { opacity: 0; } }
.source-examples__ask { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-4); }
.source-examples__ask p { flex: 1; margin: 0; color: var(--color-text-secondary); line-height: var(--leading-normal); }
.source-examples__ask .btn { flex: none; }
@media (max-width: 640px) {
  .source-examples__ask { flex-wrap: wrap; }
  .source-examples__ask p { flex-basis: calc(100% - 28px - var(--space-4)); }
}
.source-examples__caption { margin: 0; font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-text); }
.source-examples__scroll { max-height: none; margin-top: 0; background: var(--color-surface); }
.source-examples__scroll:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.source-examples__table th:first-child, .source-examples__table td:first-child {
  position: sticky; left: 0; z-index: 1;
  background: var(--color-surface); box-shadow: inset -1px 0 0 var(--color-border-subtle);
}
.source-examples__table thead th:first-child { z-index: 2; background: var(--color-bg-subtle); }
.source-examples__table thead th { font-family: var(--font-mono); font-weight: var(--weight-regular); }
.source-examples__table td { vertical-align: top; padding-top: var(--space-2); padding-bottom: var(--space-2); height: auto; }
.source-examples__table .cell--num { text-align: right; font-variant-numeric: tabular-nums; }
.source-examples__table .cell--empty { color: var(--color-text-tertiary); }
.source-examples__table .cell--bool { color: var(--color-text-secondary); }
.json-cell > summary {
  display: inline-flex; cursor: pointer; list-style: none;
  padding: 0 var(--space-1); border-radius: var(--radius-xs);
  font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-text-secondary); background: var(--color-bg-muted);
}
.json-cell > summary::-webkit-details-marker { display: none; }
.json-cell > summary:hover { color: var(--color-text); }
.json-cell > pre {
  margin: var(--space-2) 0 0; max-width: 480px; max-height: 240px; overflow: auto;
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm);
  background: var(--color-bg-subtle); border: 1px solid var(--color-border-subtle);
  font-family: var(--font-mono); font-size: var(--text-xs); line-height: var(--leading-normal); white-space: pre;
  animation: fade-in var(--duration-base) var(--ease-out);
}
.source-examples__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.source-examples__note { margin: 0; font-size: var(--text-sm); color: var(--color-text-tertiary); }
.source-examples__foot .btn { flex: none; }
.source-examples__skeleton .table-wrap { margin: 0; }
.source-examples__skeleton th { font-family: var(--font-mono); font-weight: var(--weight-regular); }
.source-examples__skeleton .skeleton { display: block; width: 72px; height: 12px; }
.source-examples__skeleton tr:nth-child(even) .skeleton { width: 56px; }

/* Titles elsewhere (Your access, the catalog) lead to the data source's page. */
a.endpoint-link { color: var(--color-text); text-decoration: none; }
a.endpoint-link:hover { color: var(--color-text); text-decoration: underline; text-underline-offset: 2px; }
.request-only { margin: 0 0 var(--space-3); font-size: var(--text-sm); color: var(--color-text-secondary); }
.request-only a { text-decoration: underline; text-underline-offset: 2px; }
@media (max-width: 640px) {
  /* On a phone the column that stays in place leaves room for the others. */
  .source-examples__table th:first-child, .source-examples__table td:first-child { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
}
/* Settings: one card per data source, one row per setting. Values are only ever shown for non-secret settings. */
.settings-banner { margin-bottom: var(--space-4); }
.settings-banner code { font-size: 0.92em; }
.settings-banner a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

.settings-card__state { display: flex; align-items: center; gap: var(--space-2); margin: 0; font-size: var(--text-sm); color: var(--color-text-secondary); }
.settings-card__state .pulse { flex: none; margin-left: 3px; }
.settings-card__actions { flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); }
.settings-card__notes { display: grid; gap: var(--space-1); padding: 0 var(--space-4) var(--space-3); }
.settings-card__notes .banner { margin-bottom: var(--space-1); }
.settings-card__notes .banner a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.settings-card__note { margin: 0; font-size: var(--text-sm); color: var(--color-text-secondary); line-height: var(--leading-normal); }
.settings-card__note code { font-size: 0.92em; }
.settings-card__note[data-note="missing"], .settings-card__note[data-note="incomplete"] { color: var(--tone-warning-fg); }

.setting-row {
  --list-cols: minmax(0, 1.3fr) 216px minmax(0, 1fr) 156px;
  align-items: start;
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
  padding-right: var(--space-4);
}
.setting-row__name { display: grid; gap: var(--space-1); min-width: 0; }
.setting-row__name code { display: inline-flex; align-items: center; gap: var(--space-1-5); font-size: var(--text-sm); font-weight: var(--weight-medium); overflow-wrap: anywhere; }
.setting-row__lock { width: 12px; height: 12px; flex: none; color: var(--color-text-tertiary); }
.setting-row__hint { font-size: var(--text-xs); color: var(--color-text-secondary); line-height: var(--leading-normal); }
.setting-row__origin, .setting-row__value { display: grid; gap: var(--space-1); min-width: 0; align-content: start; padding-top: 1px; }
.setting-row__note { font-size: var(--text-xs); color: var(--color-text-tertiary); line-height: var(--leading-normal); }
.setting-row__value .mono { font-size: var(--text-sm); }
.setting-row__actions { align-self: start; gap: var(--space-2); white-space: nowrap; }
/* Settings that only work together (one Planday portal's App Id and token), under the group's name. */
.setting-group .setting-group__title { grid-column: 1 / -1; margin: 0; }

/* Where a value comes from: ink for the admin, gray for the environment, quiet for nothing, warning when unreadable. */
.origin { display: inline-flex; align-items: flex-start; gap: var(--space-2); font-size: var(--text-sm); color: var(--color-text-secondary); }
.origin__dot { width: 7px; height: 7px; flex: none; margin-top: 7px; border-radius: 50%; background: var(--color-border-strong); }
.origin--admin { color: var(--color-text); font-weight: var(--weight-medium); }
.origin--admin .origin__dot { background: var(--color-text); }
.origin--environment .origin__dot { background: var(--color-text-tertiary); }
.origin--unset { color: var(--color-text-tertiary); }
.origin--unset .origin__dot { background: transparent; box-shadow: inset 0 0 0 1px var(--color-border-strong); }
.origin--unreadable { color: var(--tone-warning-fg); font-weight: var(--weight-medium); }
.origin--unreadable .origin__dot { background: var(--tone-warning-solid); }

.fingerprint { display: inline-flex; align-items: center; gap: var(--space-1-5); font-size: var(--text-xs); color: var(--color-text-secondary); }
.fingerprint svg { width: 14px; height: 14px; flex: none; color: var(--color-text-tertiary); }
.fingerprint .mono { font-size: var(--text-xs); letter-spacing: 0.02em; }
/* What a saved value answers for, from the last check (Planday: the portal a token belongs to). */
.setting-row__answers { display: inline-flex; align-items: center; gap: var(--space-1-5); min-width: 0; max-width: 100%; font-size: var(--text-xs); color: var(--color-text-secondary); }
.setting-row__answers svg { width: 14px; height: 14px; flex: none; color: var(--color-text-tertiary); }

.settings-dialog .field[hidden] { display: none; }
.settings-dialog__group { display: grid; gap: var(--space-4); min-width: 0; margin: 0; padding: 0; border: 0; }
.settings-dialog__group[hidden] { display: none; }
.settings-dialog__group:not([hidden]) ~ .settings-dialog__group { margin-top: var(--space-2); }
.settings-dialog__legend { padding: 0; margin-bottom: var(--space-3); font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--color-text-tertiary); }
.settings-dialog .field__label code { font-size: var(--text-sm); }
.settings-dialog__area { min-height: 120px; resize: vertical; }
.settings-dialog__failed .mono { display: block; margin-top: var(--space-1); font-size: var(--text-xs); overflow-wrap: anywhere; }

/* Health: how far each source has moved off the server environment. */
.list--settings-origins { --list-cols: minmax(0, 1fr) minmax(0, 1.6fr) auto; }
.list--settings-origins code { font-size: var(--text-xs); }
.settings-origin__names { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); min-width: 0; font-size: var(--text-sm); color: var(--color-text-secondary); }

@media (max-width: 900px) {
  .setting-row { --list-cols: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .setting-row__name { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .setting-row { --list-cols: minmax(0, 1fr) auto; gap: var(--space-2) var(--space-3); }
  .setting-row__origin { grid-column: 1; }
  .setting-row__value { grid-column: 1; }
  .setting-row .setting-row__actions { grid-column: 2; grid-row: 2 / span 2; align-self: start; }
  .settings-card .settings-card__actions { justify-content: flex-start; padding-left: 0; }
  .list--settings-origins { --list-cols: minmax(0, 1fr) auto; }
  .list--settings-origins .settings-origin__names { grid-column: 1 / -1; grid-row: 2; }
}
/* ------------------------------------------------------------------ */
/* Service accounts: the list, the keys and the key shown once          */
/* ------------------------------------------------------------------ */
.list--service-accounts { --list-cols: minmax(0, 1fr) 96px 160px 80px 148px 104px 96px; }
.list--service-accounts .who__sub .mono { font-size: var(--text-xs); }
.keys-cell { display: grid; gap: 2px; min-width: 0; font-size: var(--text-sm); line-height: var(--leading-tight); }
.keys-cell .meta { font-size: var(--text-xs); }

.list--keys { --list-cols: minmax(0, 1fr) 88px 168px 128px 104px 84px; }
.list--keys .keys-cell .meta:first-child { font-size: inherit; }
.list--keys .key-name { font-weight: var(--weight-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.key-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3) var(--space-4); margin-bottom: var(--space-3); }
.key-form__name { flex: 1 1 220px; min-width: 0; }
.key-form__days { margin: 0; padding: 0; border: 0; min-width: 0; }
.key-form__days legend { padding: 0; margin-bottom: var(--space-1-5); }

/* The segmented control as radios: the choice is posted with the form. */
.segmented--radios label { position: relative; display: inline-flex; }
.segmented--radios input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.segmented--radios span {
  display: inline-flex; align-items: center;
  height: var(--control-sm);
  padding: 0 var(--space-3);
  border-radius: 5px;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  transition: color var(--duration-fast) var(--ease-out);
}
.segmented--radios label:hover span { color: var(--color-text); }
.segmented--radios input:checked + span { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--color-border); }
.segmented--radios input:focus-visible + span { outline: 2px solid var(--color-focus-ring); outline-offset: 0; }
:root[data-theme="dark"] .segmented--radios input:checked + span { background: var(--color-bg-emphasis); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .segmented--radios input:checked + span { background: var(--color-bg-emphasis); }
}

.new-key__body { display: grid; gap: var(--space-1); min-width: 0; flex: 1; }
.new-key__body .banner__title { margin: 0; font-size: var(--text-sm); }
.new-key__value { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-2); min-width: 0; }
.new-key__value code {
  flex: 1; min-width: 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
  user-select: all;
}

/* Recent calls on an account's page: the key each call used, in the row. On a phone it goes under the tool. */
.list--calls.list--calls-keyed .call__row { --list-cols: 92px 52px 136px minmax(0, 1fr) 116px 48px 52px minmax(0, 1fr) 20px; }
.call__key { display: flex; min-width: 0; }
.call__key code { font-size: var(--text-xs); color: var(--color-text-secondary); }

.disclosure__body--text { display: block; }
.disclosure__body--text p { margin: 0; line-height: var(--leading-normal); }
.disclosure__body--text p + p { margin-top: var(--space-2); }

@media (max-width: 1080px) {
  .list--service-accounts { --list-cols: minmax(0, 1fr) 96px 148px 148px; }
  .list--service-accounts .hide-md, .list--keys .hide-md { display: none; }
  .list--keys { --list-cols: minmax(0, 1fr) 168px 104px 84px; }
  .list--calls.list--calls-keyed .call__row { --list-cols: 92px 136px minmax(0, 1fr) 116px 48px 52px 20px; }
}
@media (max-width: 768px) {
  .list--service-accounts { --list-cols: minmax(0, 1fr) auto; }
  .list--service-accounts .hide-sm, .list--keys .hide-sm { display: none; }
  .list--keys { --list-cols: minmax(0, 1fr) auto auto; }
  .new-key__value { flex-wrap: wrap; }
  .list--calls.list--calls-keyed .call__row { --list-cols: 72px minmax(0, 1fr) auto; row-gap: 2px; }
  .list--calls-keyed .call__row:not(.list__row--head) > :nth-child(1) { grid-row: 1 / span 2; }
  .list--calls-keyed .call__row:not(.list__row--head) > .call__tool { grid-column: 2; grid-row: 1; }
  .list--calls-keyed .call__row:not(.list__row--head) > .call__key { grid-column: 2; grid-row: 2; }
  .list--calls-keyed .call__row:not(.list__row--head) > .call__status { grid-column: 3; grid-row: 1 / span 2; }
}
/* ------------------------------------------------------------------ */
/* OAuth clients: the list, one client's redirect URIs and people      */
/* ------------------------------------------------------------------ */
.list--oauth-clients { --list-cols: minmax(0, 1fr) 96px minmax(0, 1fr) 64px 104px 96px 96px; }
.list--oauth-clients .who__sub code { font-size: var(--text-xs); color: var(--color-text-tertiary); overflow: hidden; text-overflow: ellipsis; }
.client-uris { display: grid; gap: 2px; min-width: 0; line-height: var(--leading-tight); }
.client-uris code { font-size: var(--text-xs); color: var(--color-text); }
.client-uris .meta { font-size: var(--text-xs); }

.row-icon--xl { width: 48px; height: 48px; border-radius: var(--radius-md); }
.row-icon--xl svg { width: var(--icon-lg); height: var(--icon-lg); }

.list--client-uris { --list-cols: minmax(0, 1fr) auto; }
.list--client-uris .list__row { min-height: 44px; }
.list--client-uris code { font-size: var(--text-xs); color: var(--color-text); overflow-wrap: anywhere; }
.list--client-people { --list-cols: minmax(0, 1fr) 96px 140px 160px; }

@media (max-width: 1080px) {
  .list--oauth-clients { --list-cols: minmax(0, 1fr) 96px minmax(0, 1fr) 96px; }
  .list--oauth-clients .hide-md { display: none; }
}
@media (max-width: 768px) {
  .list--oauth-clients { --list-cols: minmax(0, 1fr) auto; }
  .list--oauth-clients .hide-sm, .list--client-people .hide-sm { display: none; }
  .list--client-people { --list-cols: minmax(0, 1fr) auto; }
  .list--client-people .state { display: none; }
}
