/* Kino administration styles (prefix .adm-). Contract: docs/design/admin-contract.md.
   Theme tokens only (--bg, --surface, --fg, --muted, --line, --accent, --accent-fg, --accent-2, --font-*),
   so the four themes (palais, console, cabine, programme) dress it automatically.
   The status tones are mixed with --fg: lighter on dark themes, darker on Programme's paper.
   Use background-color, never the background shorthand, on focusable elements: Console draws its
   focus brackets with background-image. Loaded after the theme files, before player.css. */

/* ---------- Tones (derived from the theme) ---------- */

.adm, .adm-dialog, .adm-toasts, .adm-entry {
  --adm-good: color-mix(in srgb, #2f9e5b 62%, var(--fg));
  --adm-warn: color-mix(in srgb, #d08a12 66%, var(--fg));
  --adm-bad: color-mix(in srgb, #d23b2c 66%, var(--fg));
  --adm-panel: color-mix(in srgb, var(--surface) 72%, transparent);
  --adm-field-bg: color-mix(in srgb, var(--bg) 55%, var(--surface));
  --adm-radius: 10px;
  --adm-gap: 20px;
}

/* ---------- Shell ---------- */

.adm-page-head { margin-bottom: 28px; }
.adm-server-name { margin: 0 0 6px; }
.adm-layout { display: grid; grid-template-columns: minmax(200px, 240px) minmax(0, 1fr); gap: 40px; align-items: start; }

.adm-nav { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 22px; }
.adm-nav-heading {
  margin: 0 0 6px; padding: 0 12px; font-size: 11px; font-weight: 600; letter-spacing: .16em;
  text-transform: uppercase; color: var(--muted);
}
.adm-nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.adm-nav-link {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px;
  border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 15px;
  border: 1px solid transparent; transition: color .15s, background-color .15s, border-color .15s;
}
.adm-nav-link:hover { color: var(--fg); background-color: var(--adm-panel); }
.adm-nav-link[aria-current='page'] {
  color: var(--fg); background-color: color-mix(in srgb, var(--accent) 14%, transparent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent); box-shadow: inset 3px 0 0 var(--accent);
}
.adm-nav-icon { display: inline-flex; width: 20px; height: 20px; flex: none; color: inherit; }
.adm-nav-link[aria-current='page'] .adm-nav-icon { color: var(--accent); }
.adm-nav-icon svg { width: 20px; height: 20px; }

.adm-view { min-width: 0; display: flex; flex-direction: column; gap: var(--adm-gap); padding-bottom: 24px; }
.adm-view:focus { outline: none; }
.adm-section, .adm-libraries, .adm-users, .adm-form { display: flex; flex-direction: column; gap: var(--adm-gap); min-width: 0; }

/* ---------- Header, cards, text ---------- */

.adm-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; }
.adm-header-text { min-width: 0; max-width: 62ch; }
.adm-title { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: clamp(28px, 3vw, 38px); line-height: 1.1; text-shadow: var(--title-shadow); }
.adm-intro { margin: 8px 0 0; color: var(--muted); }
.adm-header-actions, .adm-actions, .adm-form-actions, .adm-users-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
}
.adm-form-actions { justify-content: flex-end; }

.adm-card {
  display: flex; flex-direction: column; gap: 16px; padding: 22px 24px; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--adm-radius); background-color: var(--adm-panel);
}
.adm-card-title, .adm-subtitle { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 23px; line-height: 1.2; }
.adm-card-intro { margin: -8px 0 0; color: var(--muted); font-size: 14px; max-width: 70ch; }
.adm-card-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.adm-card-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.adm-subtitle { font-size: 20px; margin-top: 8px; }

.adm-hint, .adm-muted { margin: 0; font-size: 13px; line-height: 1.45; color: var(--muted); }
.adm-mono, .adm-log, .adm-secret, .adm-card code, .adm-dialog code { font-family: var(--font-mono); font-size: .92em; }
.adm-link {
  display: inline-flex; align-items: center; min-height: 44px; color: var(--accent);
  text-decoration: underline; text-underline-offset: 3px;
}
.adm-link:hover { color: var(--fg); }
.adm-sr {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.adm-section progress, .adm-users progress { width: 100%; max-width: 220px; height: 6px; accent-color: var(--accent); }

/* Definition lists: facts (label | value), stats (big numbers), read-only values */
.adm-facts, .adm-lib-facts, .adm-readonly-list { display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); gap: 10px 24px; margin: 0; }
.adm-facts dt, .adm-lib-facts dt, .adm-readonly dt { color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: .04em; padding-top: 2px; }
.adm-facts dd, .adm-lib-facts dd, .adm-readonly dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.adm-readonly { display: contents; }
.adm-readonly dd { display: flex; flex-direction: column; gap: 4px; }
.adm-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: 0; }
.adm-stats > div { padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background-color: var(--adm-field-bg); }
.adm-stats dt { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.adm-stats dd { margin: 4px 0 0; font-family: var(--font-display); font-size: 34px; line-height: 1; color: var(--fg); }

/* Notes (inline warnings) */
.adm-note, .adm-users-note {
  margin: 0; padding: 12px 14px 12px 16px; border: 1px solid var(--line); border-left-width: 4px;
  border-radius: 6px; font-size: 14px; background-color: var(--adm-field-bg);
}
.adm-note-warn { border-left-color: var(--adm-warn); }
.adm-note-bad { border-left-color: var(--adm-bad); }
.adm-note-good { border-left-color: var(--adm-good); }
.adm-note-neutral, .adm-users-note { border-left-color: var(--accent); }

/* Collapsible advanced options */
.adm-advanced { border: 1px solid var(--line); border-radius: var(--adm-radius); background-color: var(--adm-field-bg); }
.adm-advanced > summary {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 16px; cursor: pointer;
  font-weight: 600; list-style: none; border-radius: var(--adm-radius);
}
.adm-advanced > summary::-webkit-details-marker { display: none; }
.adm-advanced > summary::before { content: '›'; display: inline-block; width: 1em; color: var(--accent); font-size: 20px; line-height: 1; transition: transform .2s; }
.adm-advanced[open] > summary::before { transform: rotate(90deg); }
.adm-advanced[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--adm-radius) var(--adm-radius) 0 0; }
.adm-advanced > :not(summary) { margin: 16px; }
.adm-advanced[open] { display: flex; flex-direction: column; }

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

.adm-field { display: flex; flex-direction: column; gap: 6px; max-width: 560px; }
.adm-label { font-size: 14px; font-weight: 600; letter-spacing: .02em; }
.adm-required { color: var(--accent); }
.adm-input {
  width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px;
  background-color: var(--adm-field-bg); color: var(--fg); font: inherit; font-size: 16px;
}
.adm-select { padding-right: 10px; cursor: pointer; }
.adm-input:hover { border-color: color-mix(in srgb, var(--fg) 40%, var(--line)); }
.adm-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.adm-input:invalid:not(:focus):not(:placeholder-shown) { border-color: var(--adm-bad); }
.adm-input[type='number'] { max-width: 220px; }

/* Switch: the real checkbox sits invisibly over the drawn track, so it stays clickable and focusable. */
.adm-toggle { max-width: 720px; }
.adm-toggle-label { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 48px; padding: 6px 0; cursor: pointer; }
.adm-toggle-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.adm-toggle-name { font-weight: 600; }
.adm-switch-input { position: absolute; right: 0; top: 50%; width: 52px; height: 30px; margin: -15px 0 0; opacity: 0; cursor: pointer; }
.adm-switch {
  position: relative; flex: none; width: 52px; height: 30px; border-radius: 999px;
  border: 1px solid var(--line); background-color: color-mix(in srgb, var(--fg) 14%, var(--bg)); transition: background-color .2s, border-color .2s;
}
.adm-switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background-color: var(--muted); transition: transform .2s var(--ease), background-color .2s;
}
.adm-switch-input:checked + .adm-switch { background-color: var(--accent); border-color: var(--accent); }
.adm-switch-input:checked + .adm-switch::after { transform: translateX(22px); background-color: var(--accent-fg); }
.adm-switch-input:focus-visible + .adm-switch { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent-2, var(--accent)); }
.adm-switch-input:disabled + .adm-switch, .adm-switch-input:disabled ~ * { opacity: .5; }
.adm-toggle + .adm-toggle { border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }

/* Fieldsets of the section files */
.adm-users-group, .adm-lib-fetchers {
  margin: 0; padding: 14px 18px 18px; border: 1px solid var(--line); border-radius: var(--adm-radius);
  display: flex; flex-direction: column; gap: 12px; min-width: 0;
}
.adm-users-group > legend, .adm-lib-fetchers > legend { padding: 0 8px; font-weight: 600; }
.adm-users-group[disabled] { opacity: .55; }

/* ---------- Buttons (on top of the theme's .btn) ---------- */

.adm-btn { min-height: 44px; padding: 0 18px; white-space: nowrap; }
.adm-btn svg { width: 18px; height: 18px; flex: none; }
.adm-btn--ghost { border-color: var(--line); color: var(--fg); }
.adm-btn--ghost:hover { border-color: var(--fg); }
.adm-btn--danger { border-color: color-mix(in srgb, var(--adm-bad) 70%, transparent); color: var(--adm-bad); }
.adm-btn--danger:hover { background-color: color-mix(in srgb, var(--adm-bad) 12%, transparent); }
.adm-btn--danger-solid { border-color: var(--adm-bad); background-color: var(--adm-bad); color: var(--bg); box-shadow: none; }
.adm-btn:disabled { opacity: .5; cursor: not-allowed; }
[data-kino-theme] .adm-btn--ghost, [data-kino-theme] .adm-btn--danger, [data-kino-theme] .adm-btn--danger-solid { box-shadow: none; }

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

.adm-table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.adm-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.adm-table th {
  padding: 10px 12px; text-align: left; vertical-align: bottom; border-bottom: 1px solid var(--line);
  font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); white-space: nowrap;
}
.adm-table td { padding: 12px; vertical-align: top; border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); overflow-wrap: anywhere; }
.adm-table tbody tr:last-child td { border-bottom: 0; }
.adm-table tbody tr:hover td { background-color: color-mix(in srgb, var(--fg) 4%, transparent); }
.adm-table td > .adm-hint { margin-top: 3px; }
.adm-table a:not(.btn) { color: var(--fg); text-underline-offset: 3px; }
.adm-col-action, .adm-col-actions { text-align: right; white-space: nowrap; width: 1%; }
td.adm-col-action, td.adm-col-actions { overflow-wrap: normal; }
td.adm-col-actions .adm-btn + .adm-btn, td.adm-col-action .adm-btn + .adm-btn { margin-left: 6px; }
.adm-table-empty { margin: 0; padding: 18px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; }

/* ---------- Badges, empty, loading, error ---------- */

.adm-badge {
  --tone: var(--muted);
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; max-width: 100%;
  border: 1px solid color-mix(in srgb, var(--tone) 50%, transparent); background-color: color-mix(in srgb, var(--tone) 14%, transparent);
  color: var(--tone); font-size: 12px; font-weight: 600; letter-spacing: .04em; line-height: 1.6; vertical-align: middle;
}
.adm-badge--good { --tone: var(--adm-good); }
.adm-badge--warn { --tone: var(--adm-warn); }
.adm-badge--bad { --tone: var(--adm-bad); }

.adm-empty { padding: 28px 20px; text-align: center; border: 1px dashed var(--line); border-radius: var(--adm-radius); }
.adm-empty-title { margin: 0; font-family: var(--font-display); font-size: 22px; }
.adm-empty-text { margin: 6px auto 0; max-width: 52ch; color: var(--muted); font-size: 14px; }

.adm-loading { display: flex; align-items: center; gap: 12px; min-height: 56px; color: var(--muted); }
.adm-spinner {
  width: 20px; height: 20px; flex: none; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent); animation: adm-spin .8s linear infinite;
}
@keyframes adm-spin { to { transform: rotate(360deg); } }

.adm-error {
  display: flex; gap: 14px; padding: 16px 18px; border: 1px solid color-mix(in srgb, var(--adm-bad) 55%, var(--line));
  border-radius: var(--adm-radius); background-color: color-mix(in srgb, var(--adm-bad) 8%, transparent);
}
.adm-error-icon { flex: none; width: 22px; height: 22px; color: var(--adm-bad); }
.adm-error-icon svg { width: 22px; height: 22px; }
.adm-error-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.adm-error-text p { margin: 0; }
.adm-error-title { font-weight: 600; }
.adm-error-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }

/* ---------- Tabs, pager ---------- */

.adm-tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.adm-tab {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; white-space: nowrap;
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.adm-tab:hover { color: var(--fg); }
.adm-tab[aria-current='page'], .adm-tab.is-active { color: var(--fg); border-bottom-color: var(--accent); }
.adm-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; width: 100%; }

/* ---------- Section-specific pieces ---------- */

.adm-log {
  margin: 0; padding: 14px 16px; max-height: 70vh; overflow: auto; white-space: pre;
  border: 1px solid var(--line); border-radius: 8px; background-color: color-mix(in srgb, var(--bg) 80%, #000);
  color: var(--fg); font-size: 12.5px; line-height: 1.55; tab-size: 4;
}
.adm-secret {
  display: inline-block; max-width: 100%; padding: 8px 12px; border: 1px dashed var(--accent); border-radius: 6px;
  background-color: var(--adm-field-bg); overflow-wrap: anywhere; user-select: all;
}

.adm-lib-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--adm-gap); }
.adm-lib { display: flex; min-width: 0; }
.adm-lib > .adm-card { flex: 1; }
.adm-lib-folders { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.adm-lib-folders li { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.adm-lib-folders code { min-width: 0; overflow-wrap: anywhere; }
.adm-lib-fetch-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.adm-lib-fetch-list li {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 4px 8px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); border-radius: 8px;
}
.adm-lib-fetch-list label { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.adm-lib-fetch-list input[type='checkbox'], .adm-users input[type='checkbox']:not(.adm-switch-input) { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }

.adm-users-who { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.adm-users-who > a { font-weight: 600; }
.adm-users-badges { display: inline-flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.adm-avatar {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex: none;
  border-radius: 50%; background-color: var(--accent); color: var(--accent-fg);
  font-family: var(--font-display); font-size: 18px; line-height: 1;
}
.adm-users-back { margin: 0; }
.adm-users-back a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); text-decoration: none; }
.adm-users-back a:hover { color: var(--fg); }
.adm-users-panel { display: flex; flex-direction: column; gap: var(--adm-gap); min-width: 0; }

/* ---------- Save bar ---------- */

.adm-savebar {
  position: sticky; bottom: 12px; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px 20px; padding: 12px 16px 12px 20px; margin-top: 8px;
  border: 1px solid var(--accent); border-radius: var(--adm-radius); background-color: var(--surface);
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .6); animation: adm-rise .2s var(--ease);
}
.adm-savebar[hidden] { display: none; }
.adm-savebar-text { margin: 0; font-weight: 600; }
.adm-savebar-actions { display: flex; flex-wrap: wrap; gap: 10px; }
@keyframes adm-rise { from { transform: translateY(12px); opacity: 0; } }

/* ---------- Toasts ---------- */

.adm-toasts {
  position: fixed; left: 50%; bottom: 96px; z-index: 70; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(520px, calc(100vw - 32px)); pointer-events: none;
}
.adm-toast {
  --tone: var(--accent);
  pointer-events: auto; cursor: pointer; width: 100%; padding: 14px 18px; border-radius: 8px;
  border: 1px solid var(--line); border-left: 4px solid var(--tone); background-color: var(--surface); color: var(--fg);
  font-family: var(--font-ui); font-size: 15px; box-shadow: 0 16px 40px -14px rgba(0, 0, 0, .65);
  animation: adm-rise .2s var(--ease); transition: opacity .25s, transform .25s;
}
.adm-toast--good { --tone: var(--adm-good); }
.adm-toast--warn { --tone: var(--adm-warn); }
.adm-toast--bad { --tone: var(--adm-bad); }
.adm-toast.is-leaving { opacity: 0; transform: translateY(8px); }

/* ---------- Dialogs ---------- */

.adm-dialog {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; overflow: auto;
  border: 1px solid var(--line); border-radius: 14px; background-color: var(--surface); color: var(--fg);
  font-family: var(--font-ui); box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .8);
}
.adm-dialog--wide { width: min(680px, calc(100vw - 32px)); }
.adm-dialog--danger { border-top: 4px solid var(--adm-bad); }
.adm-dialog::backdrop { background-color: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(4px); }
.adm-dialog[open] { animation: adm-rise .2s var(--ease); }
.adm-dialog-body { display: flex; flex-direction: column; gap: 16px; padding: 24px; margin: 0; }
.adm-dialog-title { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 26px; line-height: 1.15; }
.adm-dialog-text { margin: 0; line-height: 1.55; }
.adm-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 4px; }

.adm-picker-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.adm-picker-path { margin: 0; min-width: 0; flex: 1; overflow-wrap: anywhere; font-size: 14px; }
.adm-picker-list {
  list-style: none; margin: 0; padding: 4px; height: min(340px, 45vh); overflow-y: auto;
  border: 1px solid var(--line); border-radius: 8px; background-color: var(--adm-field-bg);
}
.adm-picker-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 12px;
  border: 0; border-radius: 6px; background-color: transparent; text-align: left; cursor: pointer; overflow-wrap: anywhere;
}
.adm-picker-item:hover, .adm-picker-item:focus-visible { background-color: color-mix(in srgb, var(--accent) 16%, transparent); }
.adm-picker-item svg { width: 20px; height: 20px; flex: none; color: var(--accent); }
.adm-picker-empty, .adm-picker-error { padding: 16px; color: var(--muted); }
.adm-picker-error p { margin: 0 0 10px; }
.adm-picker-manual { max-width: none; }
.adm-picker-go { display: flex; gap: 8px; }
.adm-picker-go .adm-input { flex: 1; min-width: 0; }

/* ---------- Entry card in Réglages ---------- */

.adm-entry {
  display: flex; align-items: center; gap: 16px; max-width: 760px; margin-top: 16px; padding: 16px 18px; min-height: 64px;
  border: 1px solid var(--line); border-radius: var(--adm-radius); background-color: var(--adm-panel);
  color: var(--fg); text-decoration: none;
}
.adm-entry:hover { border-color: var(--accent); }
.adm-entry > svg { width: 28px; height: 28px; flex: none; color: var(--accent); }
.adm-entry-text { display: flex; flex-direction: column; gap: 2px; }
.adm-entry-text strong { font-weight: 600; }

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .adm-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  /* The nav becomes one horizontal, scrollable chip bar. */
  .adm-nav {
    position: static; flex-direction: row; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 4px 16px 10px;
    scrollbar-width: thin; scroll-snap-type: x proximity;
  }
  .adm-nav-group, .adm-nav-list { display: contents; }
  .adm-nav-heading {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .adm-nav-link { flex: none; white-space: nowrap; border-color: var(--line); border-radius: 999px; padding: 6px 16px; scroll-snap-align: start; }
  .adm-nav-link[aria-current='page'] { box-shadow: none; background-color: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
  .adm-nav-link[aria-current='page'] .adm-nav-icon { color: inherit; }
  .adm-card { padding: 18px 16px; }
  .adm-lib-list { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .adm-facts, .adm-lib-facts, .adm-readonly-list { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .adm-facts dd, .adm-lib-facts dd, .adm-readonly dd { margin-bottom: 10px; }
  /* Tables become stacked cards, each cell labelled by its column. */
  .adm-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .adm-table, .adm-table tbody, .adm-table tr, .adm-table td { display: block; width: 100%; }
  .adm-table tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .adm-table tbody tr:last-child { border-bottom: 0; }
  .adm-table td { padding: 4px 0; border: 0; text-align: left; }
  .adm-table td[data-label]:not([data-label=''])::before {
    content: attr(data-label); display: block; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  }
  .adm-table td.adm-col-action, .adm-table td.adm-col-actions { display: block; width: 100%; text-align: left; white-space: normal; padding-top: 8px; }
  .adm-table td.adm-col-action::before, .adm-table td.adm-col-actions::before { display: none; }
  .adm-table tbody tr:hover td { background-color: transparent; }
  .adm-savebar { bottom: 8px; padding: 12px; }
  .adm-savebar-actions, .adm-dialog-actions { width: 100%; }
  .adm-savebar-actions .adm-btn, .adm-dialog-actions .adm-btn { flex: 1; justify-content: center; }
  .adm-dialog-body { padding: 20px 16px; }
  .adm-toasts { bottom: 88px; }
}

@media (prefers-reduced-motion: reduce) {
  .adm-spinner { animation: none; border-top-color: var(--accent); }
}
