/*
 * static/css/admin.css — the /opensesame dashboard: the page, the shell and the shared components (batch 4, plan R-106;
 * spec batch4.md §7; overhaul R-111; the shared system of R-120, spec dashboard-2.md §2). Loaded only by
 * static/admin/index.html, after tokens.css, icons.css, base.css and /brand/theme.css; each area's own layouts are
 * admin-people.css, admin-addresses.css, admin-inbox.css and admin-site.css (one per view lane). Every selector is
 * prefixed `.adm-` or scoped to `body.adm` (I7: no selector of another file is redefined) and every colour is a token
 * (both themes follow; the profile's theme.css can restyle the dashboard with the app). Dashboard-only sizes and the
 * dashboard's own amber are custom properties on body.adm.
 *
 * Look: "gold on graphite, ink on ivory". A left rail on the sidebar tone, the canvas with its paper grain, tonal
 * sections with a hairline, the serif display face for page titles only, Inter everywhere else, and gold for the one
 * thing that matters on a screen (the current section, the primary action, "on" switches, chart bars). Colour by
 * meaning (R-120 rule 5): red blocked or refused, amber (--adm-warn, never the gold) needs attention, gold Arjav Pro
 * access, green live.
 */

/* ============================================================
   PAGE AND BACKDROP (the app's chat photograph behind the signed-out field; signed in it fades out, so tables and
   numbers read on the plain canvas)
   ============================================================ */
body.adm {
    --adm-nav-w: 240px; --adm-bar-h: 60px; --adm-gutter: 40px;
    /* R-120 §2.1: one spacing scale, one row height (tables, lists, key / value and setting rows), two control heights */
    --adm-s1: 4px; --adm-s2: 8px; --adm-s3: 12px; --adm-s4: 16px; --adm-s5: 24px; --adm-s6: 32px;
    --adm-row: 48px; --adm-ctl: 36px; --adm-ctl-sm: 32px;
    /* the dashboard's amber for warnings, built from the theme's red and yellow so it follows both themes and stays
       apart from the gold and the red (tests/browser/app/test_r120_dashboard_core.py measures them side by side): mixed
       in oklch, the hue lies between the two (orange) at their own chroma; the container and its text are mixed in
       oklab, which keeps that hue (an sRGB mix of the pale theme tokens read as a tan beside the gold) */
    --adm-warn: color-mix(in oklch, var(--c-danger-fill) 65%, var(--c-warning));
    --adm-warn-container: color-mix(in oklab, var(--adm-warn) 32%, var(--c-warning-container));
    --adm-on-warn-container: color-mix(in oklab, var(--adm-warn) 55%, var(--c-on));
    display: block; height: auto; min-height: 100vh; min-height: 100dvh; overflow-x: hidden; overflow-y: auto;
}
.adm-backdrop {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background:
        linear-gradient(180deg,
            color-mix(in srgb, var(--c-bg) 66%, transparent),
            color-mix(in srgb, var(--c-bg) 82%, transparent) 54%,
            color-mix(in srgb, var(--c-bg) 95%, transparent) 100%),
        var(--adm-backdrop-image, none) center 44% / cover no-repeat,
        var(--c-bg);
    transition: opacity var(--dur-5) var(--ease-standard);
}
body.adm-signed-in .adm-backdrop { opacity: 0; }

/* ============================================================
   SIGNED OUT: one field, no text
   ============================================================ */
.adm-signin { position: fixed; inset: 0; z-index: 1; display: grid; place-items: center; padding: 16px; }
.adm-password {
    width: min(340px, 100%); height: 52px; padding: 0 22px;
    border-radius: var(--radius-pill); border: 1px solid var(--c-outline);
    background: color-mix(in srgb, var(--c-surface) 88%, transparent);
    color: var(--c-on); caret-color: var(--c-accent);
    font: 500 1.05rem var(--font-sans); letter-spacing: 0.16em; text-align: center;
    box-shadow: var(--elev-2);
    transition: border-color var(--dur-1) var(--ease-standard), box-shadow var(--dur-1) var(--ease-standard), opacity var(--dur-2) var(--ease-standard);
}
.adm-password:focus, .adm-password:focus-visible { outline: none; border-color: var(--c-accent); box-shadow: inset 0 0 0 1px var(--c-accent), var(--elev-2); }
.adm-password.adm-locked { opacity: 0.5; }
.adm-shake { animation: adm-shake 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@keyframes adm-shake {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(4px); }
    30%, 50%, 70% { transform: translateX(-7px); }
    40%, 60% { transform: translateX(7px); }
}

/* ============================================================
   SHELL: the top bar across, the left rail (a drawer with a header and a footer below 960 px), the view
   ============================================================ */
.adm-app { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; }
.adm-shell {
    display: grid; grid-template-columns: var(--adm-nav-w) minmax(0, 1fr); grid-template-rows: var(--adm-bar-h) auto;
    grid-template-areas: "bar bar" "nav main"; min-height: 100vh; min-height: 100dvh;
}
.adm-topbar {
    grid-area: bar; position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 16px; height: var(--adm-bar-h); padding-right: 16px;
    background: color-mix(in srgb, var(--c-bg) 88%, transparent);
    -webkit-backdrop-filter: blur(16px) saturate(1.2); backdrop-filter: blur(16px) saturate(1.2);
    box-shadow: 0 1px 0 var(--c-outline-variant);
}
.adm-brand {
    flex: none; align-self: stretch; width: var(--adm-nav-w); display: flex; align-items: center; gap: 10px; padding: 0 20px;
    background: var(--c-surface-low); color: var(--c-on); text-decoration: none; min-width: 0;
}
.adm-brand:focus-visible { outline-offset: -3px; }
.adm-brand-mark { flex: none; width: 12px; height: 12px; border-radius: 4px; background: var(--c-brand); }
.adm-brand-words { display: flex; flex-direction: column; min-width: 0; }
.adm-brand-name { font: var(--t-title-m); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-brand-name:empty { display: none; }
.adm-brand-sub { color: var(--c-on-3); font: var(--t-label-s); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.adm-topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; flex: none; }
.adm-nav-toggle {
    display: none; flex: none; align-items: center; justify-content: center; width: 40px; height: 40px; margin-left: 8px;
    padding: 0; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--c-on-2);
    font-size: 0; line-height: 0; cursor: pointer;
}
.adm-nav-toggle::before {
    content: ''; width: 20px; height: 20px; background: currentColor;
    -webkit-mask: var(--icon-list) center / contain no-repeat; mask: var(--icon-list) center / contain no-repeat;
}
.adm-nav-toggle:hover { background: var(--c-hover); color: var(--c-on); }

/* the global search: a combobox with its listbox under it */
.adm-search { position: relative; flex: 1 1 auto; min-width: 0; max-width: 520px; }
.adm-search-input { height: 38px; }
.adm-kbd {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none;
    display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 5px;
    box-shadow: inset 0 0 0 1px var(--c-outline); color: var(--c-on-3); font: var(--t-label-s);
    transition: opacity var(--dur-1) var(--ease-standard);
}
.adm-search-input:focus ~ .adm-kbd, .adm-search-input:not(:placeholder-shown) ~ .adm-kbd { opacity: 0; }
.adm-search-list {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0; min-width: min(360px, calc(100vw - 32px)); z-index: 30;
    max-height: min(420px, 70vh); overflow-y: auto; list-style: none; padding: 6px;
    background: var(--c-surface-raised); border-radius: var(--radius-md);
    box-shadow: inset 0 0 0 1px var(--c-outline-variant), var(--elev-2); animation: panel-in var(--dur-2) var(--ease-enter);
}
.adm-search-opt {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px;
    padding: 8px 12px; border-radius: var(--radius-sm); cursor: pointer;
}
.adm-search-opt[aria-selected="true"] { background: var(--c-accent-container); }
.adm-search-opt:hover { background: var(--c-hover); }
.adm-search-opt[aria-selected="true"]:hover { background: var(--c-accent-container); }
.adm-search-name { grid-column: 1; font: var(--t-label-l); color: var(--c-on); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-search-sub { grid-column: 1; font: var(--t-body-s); color: var(--c-on-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-search-opt > .adm-pill { grid-column: 2; grid-row: 1 / span 2; }
.adm-search-none { padding: 12px; color: var(--c-on-3); font: var(--t-body-m); }

/* the left rail: groups by purpose, the current section in gold; below 960 px a drawer with its own header and footer */
.adm-nav {
    grid-area: nav; position: sticky; top: var(--adm-bar-h); align-self: start; z-index: 10;
    display: flex; flex-direction: column;
    height: calc(100vh - var(--adm-bar-h)); height: calc(100dvh - var(--adm-bar-h)); overflow-y: auto;
    background: var(--c-surface-low);
}
.adm-nav-groups { flex: 1 0 auto; padding: 18px 12px 28px; }
.adm-nav-head, .adm-nav-foot { display: none; }
.adm-nav-group + .adm-nav-group { margin-top: 20px; }
.adm-nav-heading { padding: 0 12px 6px; }
.adm-nav-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.adm-nav-link {
    position: relative; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 12px;
    border-radius: var(--radius-sm); color: var(--c-on-2); text-decoration: none; font: var(--t-label-l);
    transition: background-color var(--dur-1) var(--ease-standard), color var(--dur-1) var(--ease-standard);
}
.adm-nav-link:hover { background: var(--c-hover); color: var(--c-on); }
.adm-nav-link[aria-current="page"] { background: var(--c-accent-container); color: var(--c-on-accent-container); font-weight: 600; }
.adm-nav-link[aria-current="page"]::before {
    content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--c-accent);
}
.adm-nav-link:focus-visible { outline-offset: -2px; }
.adm-nav-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-badge {
    flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill);
    background: var(--c-brand); color: var(--c-on-brand); font: var(--t-label-s);
    display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums;
}
.adm-nav-brand { min-width: 0; color: var(--c-on); font: var(--t-title-m); overflow-wrap: break-word; }
.adm-nav-close {
    display: inline-flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px; padding: 0;
    border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--c-on-2); font-size: 0; line-height: 0; cursor: pointer;
}
.adm-nav-close::before {
    content: ''; width: 20px; height: 20px; background: currentColor;
    -webkit-mask: var(--icon-x) center / contain no-repeat; mask: var(--icon-x) center / contain no-repeat;
}
.adm-nav-close:hover { background: var(--c-hover); color: var(--c-on); }
.adm-nav-scrim { display: none; }

.adm-main { grid-area: main; min-width: 0; padding: 28px var(--adm-gutter) 80px; outline: none; }
.adm-view { display: flex; flex-direction: column; gap: 20px; max-width: 1440px; }
/* loading: a short gold bar while a view's first answer is on its way (no text) */
.adm-view[aria-busy="true"]:empty { min-height: 40vh; }
.adm-view[aria-busy="true"]:empty::before {
    content: ''; display: block; width: 96px; height: 3px; border-radius: var(--radius-pill); background: var(--c-accent);
    animation: adm-load 0.9s var(--ease-standard) infinite alternate;
}
@keyframes adm-load {
    from { transform: translateX(0); opacity: 0.35; }
    to { transform: translateX(160px); opacity: 1; }
}

/* ============================================================
   PAGE HEADER, TEXT
   ============================================================ */
.adm-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.adm-head-main { min-width: 0; flex: 1 1 320px; }
.adm-head-titlerow { display: flex; align-items: center; gap: 10px; min-width: 0; }
.adm-title {
    display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; min-width: 0;
    font: 500 1.875rem / 1.15 var(--font-display); letter-spacing: -0.01em; color: var(--c-on);
}
.adm-title > .adm-pill { font-family: var(--font-sans); }
/* the heading takes the focus when a view opens (a starting point, no control): no ring, except in forced colours */
.adm-title:focus { outline: none; }
.adm-title-count { color: var(--c-on-3); font: 500 1rem / 1 var(--font-sans); font-variant-numeric: tabular-nums; }
/* A display name can be one long word (up to 80 characters): it wraps instead of widening the page. */
.adm-title-name { min-width: 0; overflow-wrap: anywhere; }
.adm-subtitle { margin-top: 6px; color: var(--c-on-3); font: var(--t-body-s); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.adm-subtitle:has(> .adm-count:only-child:empty) { display: none; }
.adm-back {
    display: inline-flex; align-items: center; margin-bottom: 8px; color: var(--c-on-2); font: var(--t-label-m); text-decoration: none;
}
.adm-back:hover { color: var(--c-on); }
.adm-head-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
/* "?": a short explanation the page needs once (rule 14), opened under the subtitle */
.adm-help-btn {
    flex: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0;
    border: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--c-outline); background: transparent;
    color: var(--c-on-2); font: 600 0.8125rem / 1 var(--font-sans); cursor: pointer;
}
.adm-help-btn:hover, .adm-help-btn[aria-expanded="true"] { background: var(--c-surface-high); color: var(--c-on); }
.adm-help-text {
    margin-top: 10px; max-width: 72ch; padding: 10px 14px; border-radius: var(--radius-md);
    background: var(--c-surface-high); color: var(--c-on-2); font: var(--t-body-s); overflow-wrap: break-word;
}
.adm-hint { color: var(--c-on-3); font: var(--t-body-s); line-height: 1.5; }
.adm-eyebrow { color: var(--c-on-3); font: var(--t-label-s); letter-spacing: 0.08em; text-transform: uppercase; }
.adm-muted, .adm-muted-cell { color: var(--c-on-3); }
.adm-strong { font-weight: 500; color: var(--c-on); display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.adm-strong-cell { font-weight: 600; }
.adm-error { color: var(--c-danger); font: var(--t-body-s); line-height: 1.5; }
.adm-empty { padding: 22px 20px; color: var(--c-on-3); font: var(--t-body-m); text-align: center; }
.adm-link { color: var(--c-accent-text); text-decoration: none; font-weight: 500; }
.adm-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.adm-app code { font: var(--t-mono); font-size: 0.8125rem; color: var(--c-on-2); overflow-wrap: anywhere; }
.adm-grow { flex: 1 1 auto; min-width: 0; }
.adm-pills { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.adm-error-state {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 16px 20px;
    border-radius: var(--radius-md); background: var(--c-danger-container);
}
.adm-error-state .adm-error { color: var(--c-on-danger-container); font: var(--t-body-m); }

/* a one-line state banner under a page header (banned, disabled, banned by the provider) */
.adm-callout {
    display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--radius-md);
    background: var(--c-surface-high); color: var(--c-on); box-shadow: inset 3px 0 0 var(--c-outline);
}
.adm-callout--danger { background: var(--c-danger-container); color: var(--c-on-danger-container); box-shadow: inset 3px 0 0 var(--c-danger); }
.adm-callout--warn { background: var(--adm-warn-container); color: var(--adm-on-warn-container); box-shadow: inset 3px 0 0 var(--adm-warn); }
.adm-callout--gold { background: var(--c-accent-container); color: var(--c-on-accent-container); box-shadow: inset 3px 0 0 var(--c-accent); }
.adm-callout-body { flex: 1 1 260px; min-width: 0; font: var(--t-body-m); overflow-wrap: break-word; }
.adm-callout-title { margin-right: 8px; font-weight: 600; }
.adm-callout-action { flex: none; display: flex; align-items: center; gap: 8px; }

/* values pasted exactly (an address, an id, a release): mono, one line, a copy button */
.adm-copy { display: inline-flex; align-items: center; gap: 2px; min-width: 0; max-width: 100%; vertical-align: middle; }
.adm-copy-text {
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: var(--c-on-2); font: var(--t-mono); font-size: 0.8125rem;
}
.adm-copy-btn {
    flex: none; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0;
    border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--c-on-3); font-size: 0; line-height: 0; cursor: pointer;
}
.adm-copy-btn::before {
    content: ''; width: 16px; height: 16px; background: currentColor;
    -webkit-mask: var(--icon-copy) center / contain no-repeat; mask: var(--icon-copy) center / contain no-repeat;
}
.adm-copy-btn:hover { background: var(--c-hover); color: var(--c-on); }
/* an address: always a link to its address page, never wrapped */
.adm-addr-link { color: var(--c-accent-text); font: 500 0.8125rem / 1.4 var(--font-mono); white-space: nowrap; text-decoration: none; }
.adm-addr-link:hover { text-decoration: underline; text-underline-offset: 3px; }
/* a one-word value too long for its box: an ellipsis with the full value as its title (rule 1) */
.adm-ellipsis-line { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* a cell's two lines; the grid lets the column shrink below the text's width (the text then wraps or ellipsizes) */
.adm-cell-lines { display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 1px; min-width: 0; overflow-wrap: break-word; }

/* ============================================================
   SECTIONS, STATS, KEY / VALUE ROWS
   ============================================================ */
.adm-section {
    min-width: 0; padding: 18px 20px; background: var(--c-surface); border-radius: var(--radius-lg);
    box-shadow: inset 0 0 0 1px var(--c-outline-variant), var(--elev-card);
    scroll-margin-top: calc(var(--adm-bar-h) + 16px);
}
/* clip (not hidden): it rounds the corners without becoming a scroll container, so a save bar inside stays sticky to
   the viewport (Limits) */
.adm-section--flush { padding: 0; overflow: clip; }
.adm-section--danger { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c-danger) 45%, var(--c-outline-variant)), var(--elev-card); }
.adm-section--wide { grid-column: 1 / -1; }
.adm-section-head { display: flex; align-items: center; gap: 10px; min-height: 28px; margin-bottom: 10px; flex-wrap: wrap; }
.adm-section--flush > .adm-section-head { padding: 14px 20px 0; }
.adm-section--empty > .adm-section-head { margin-bottom: 0; }
.adm-section--flush.adm-section--empty > .adm-section-head { padding-bottom: 14px; }
.adm-section-title { font: var(--t-title-m); color: var(--c-on); }
.adm-section-title:focus { outline: none; }
.adm-section--danger .adm-section-title { color: var(--c-danger); }
.adm-section-meta { display: inline-flex; align-items: center; gap: 8px; color: var(--c-on-3); font: var(--t-body-s); font-variant-numeric: tabular-nums; }
.adm-section-empty { color: var(--c-on-3); font: var(--t-body-s); }
.adm-section-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.adm-section-note { padding: 0 20px 12px; color: var(--c-on-3); font: var(--t-body-s); }
.adm-subhead { margin: 16px 0 4px; color: var(--c-on-2); font: var(--t-label-l); }

.adm-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.adm-stat {
    display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 14px 16px; text-align: left;
    background: var(--c-surface); border: 0; border-radius: var(--radius-lg); color: inherit; font: inherit;
    box-shadow: inset 0 0 0 1px var(--c-outline-variant), var(--elev-card);
    transition: background-color var(--dur-2) var(--ease-standard), box-shadow var(--dur-2) var(--ease-standard);
}
.adm-stat--link { cursor: pointer; }
.adm-stat--link:hover { background: var(--c-surface-high); }
.adm-stat--warn { box-shadow: inset 3px 0 0 var(--adm-warn), inset 0 0 0 1px var(--c-outline-variant), var(--elev-card); }
.adm-stat--gold { box-shadow: inset 3px 0 0 var(--c-accent), inset 0 0 0 1px var(--c-outline-variant), var(--elev-card); }
.adm-stat--danger { box-shadow: inset 3px 0 0 var(--c-danger), inset 0 0 0 1px var(--c-outline-variant), var(--elev-card); }
.adm-stat-label { color: var(--c-on-2); font: var(--t-label-m); }
.adm-stat-value { color: var(--c-on); font: 600 1.625rem / 1.2 var(--font-sans); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.adm-stat-sub { color: var(--c-on-3); font: var(--t-body-s); overflow-wrap: anywhere; }

.adm-kv {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    min-height: var(--adm-row); padding: 7px 0; border-bottom: 1px solid var(--c-outline-variant); font: var(--t-body-m);
}
.adm-kv:last-child { border-bottom: 0; }
.adm-kv-key { flex: 0 0 auto; color: var(--c-on-2); }
.adm-kv-value {
    min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap;
    color: var(--c-on); text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums;
}
.adm-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); column-gap: 24px; margin: 8px 0 4px; }
.adm-technical { margin-top: 8px; }
.adm-technical-toggle { width: fit-content; color: var(--c-accent-text); font: var(--t-label-m); cursor: pointer; }
.adm-technical-body { margin-top: 6px; }
.adm-meter { display: inline-block; flex: none; width: 96px; height: 6px; border-radius: var(--radius-pill); background: var(--c-surface-highest); overflow: hidden; }
.adm-meter-fill { display: block; height: 100%; background: var(--c-accent); border-radius: inherit; }
.adm-meter--high .adm-meter-fill { background: var(--adm-warn); }
.adm-meter--full .adm-meter-fill { background: var(--c-danger); }
.adm-used { display: inline-flex; align-items: center; gap: 10px; }

/* ============================================================
   CONTROLS
   ============================================================ */
.adm-btn {
    height: var(--adm-ctl); padding: 0 16px; border-radius: var(--radius-pill); border: 0;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
    font: var(--t-label-m); cursor: pointer;
    transition: background-color var(--dur-1) var(--ease-standard), color var(--dur-1) var(--ease-standard);
}
.adm-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.adm-btn--sm { height: var(--adm-ctl-sm); padding: 0 12px; }
.adm-btn--primary { background: var(--c-primary); color: var(--c-on-primary); box-shadow: inset 0 0 0 1px var(--c-primary-edge); }
.adm-btn--primary:hover:not(:disabled) { background: var(--c-primary-hover); }
.adm-btn--secondary { background: var(--c-surface-high); color: var(--c-on); }
.adm-btn--secondary:hover:not(:disabled) { background: var(--c-surface-highest); }
.adm-btn--ghost { padding: 0 12px; background: transparent; color: var(--c-accent-text); }
.adm-btn--ghost:hover:not(:disabled) { background: var(--c-hover); }
.adm-btn--danger { background: var(--c-danger-container); color: var(--c-on-danger-container); }
.adm-btn--danger:hover:not(:disabled) { background: color-mix(in srgb, var(--c-danger-container) 80%, var(--c-danger)); }
.adm-btn--danger-ghost { background: transparent; color: var(--c-danger); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c-danger) 50%, transparent); }
.adm-btn--danger-ghost:hover:not(:disabled) { background: var(--c-danger-container); }
.adm-btn--danger-fill { background: var(--c-danger-fill); color: var(--c-on-danger-fill); }
.adm-btn--danger-fill:hover:not(:disabled) { background: var(--c-danger-fill-hover); }
.adm-btn--link { height: auto; padding: 0; background: none; color: var(--c-accent-text); font-weight: 500; }
.adm-btn--link:hover:not(:disabled) { text-decoration: underline; text-underline-offset: 3px; }
.adm-signout { color: var(--c-on-2); }

.adm-input {
    width: 100%; min-width: 0; height: var(--adm-ctl); padding: 0 14px;
    border-radius: var(--radius-md); border: 1px solid var(--c-outline); background: var(--c-surface);
    color: var(--c-on); font: var(--t-body-m); font-variant-numeric: tabular-nums;
    transition: border-color var(--dur-1) var(--ease-standard), box-shadow var(--dur-1) var(--ease-standard);
}
.adm-input:focus { outline: none; border-color: var(--c-accent); box-shadow: inset 0 0 0 1px var(--c-accent); }
.adm-input:disabled { opacity: 0.5; }
.adm-input::placeholder { color: var(--c-on-3); }
/* search fields: pills with the magnifier */
.adm-input--search { border-radius: var(--radius-pill); padding-left: 40px; background: var(--c-surface) var(--search-i) no-repeat 14px center / 18px 18px; }
.adm-textarea { height: auto; padding: 10px 14px; line-height: 1.5; resize: vertical; }
.adm-select {
    height: var(--adm-ctl); max-width: 100%; padding: 0 40px 0 14px; border-radius: var(--radius-md); border: 1px solid var(--c-outline);
    background: var(--c-surface) var(--chev) no-repeat right 12px center / 18px 18px; color: var(--c-on);
    font: var(--t-body-m); -webkit-appearance: none; appearance: none;
}
.adm-select:focus { outline: none; border-color: var(--c-accent); box-shadow: inset 0 0 0 1px var(--c-accent); }
.adm-select:disabled { opacity: 0.5; }
.adm-select--sm { height: var(--adm-ctl-sm); padding-right: 34px; background-position: right 8px center; font: var(--t-label-m); }

.adm-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.adm-label { color: var(--c-on-2); font: var(--t-label-m); }

/* number fields (rule 2): a text input with its prefix and unit inside one box, digits right-aligned, a width from
   the largest value (--adm-num-ch, set by numberField), help and errors under it; an edited field is marked */
.adm-numfield { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; max-width: 100%; }
.adm-numbox {
    display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: var(--adm-ctl); padding: 0 12px;
    border-radius: var(--radius-md); border: 1px solid var(--c-outline); background: var(--c-surface); color: var(--c-on);
    transition: border-color var(--dur-1) var(--ease-standard), box-shadow var(--dur-1) var(--ease-standard);
}
.adm-numbox:focus-within { border-color: var(--c-accent); box-shadow: inset 0 0 0 1px var(--c-accent); }
.adm-numbox--error { border-color: var(--c-danger); }
.adm-numbox--text { display: flex; width: 100%; }
.adm-numfield[data-dirty="true"] .adm-numbox { border-color: var(--c-accent-text); background: color-mix(in srgb, var(--c-accent-container) 55%, var(--c-surface)); }
.adm-numbox-input {
    width: calc(var(--adm-num-ch, 6) * 1ch); min-width: 3ch; max-width: 100%; height: 100%; padding: 0;
    border: 0; background: transparent; color: inherit; font: var(--t-body-m); font-variant-numeric: tabular-nums; text-align: right;
}
.adm-numbox-input:focus { outline: none; }
.adm-numbox-input::placeholder { color: var(--c-on-3); }
.adm-numbox-input--text { flex: 1 1 auto; width: auto; text-align: left; }
.adm-numbox-affix { flex: none; color: var(--c-on-3); font: var(--t-body-m); white-space: nowrap; }

/* "Default (30) · Custom · No limit" */
.adm-choice { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
.adm-choice > legend { margin-bottom: 6px; padding: 0; }

/* setting rows: the label and one line on the left, the control on the right; stacked when the row is narrow */
.adm-setting { container: adm-setting / inline-size; border-bottom: 1px solid var(--c-outline-variant); }
.adm-setting:last-child { border-bottom: 0; }
/* the save bar draws its own line: the last setting row above it has none (no double line) */
.adm-setting:has(+ .adm-savebar) { border-bottom: 0; }
.adm-setting-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 24px; min-height: var(--adm-row); padding: 12px 0; }
.adm-setting-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.adm-setting-label { color: var(--c-on); font: var(--t-label-l); }
.adm-setting-desc { color: var(--c-on-3); font: var(--t-body-s); overflow-wrap: break-word; }
.adm-setting-control { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
.adm-setting-state { color: var(--c-on-2); font: var(--t-label-m); }
.adm-setting-control .adm-switch { min-height: 0; padding: 0; gap: 10px; border-bottom: 0; }
/* a number field lines up on the row's right edge, its help and default under it right-aligned too (Context and the
   site-wide throttles alike) */
.adm-setting-control .adm-numfield { align-items: flex-end; text-align: right; }
.adm-setting-control .adm-choice > legend {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;   /* the row's label says it */
}
@container adm-setting (max-width: 480px) {
    .adm-setting-grid { grid-template-columns: minmax(0, 1fr); }
    .adm-setting-control { justify-content: flex-start; }
    .adm-setting-control .adm-numfield { align-items: flex-start; text-align: left; }
}

/* one save model (rule 3): the panel's save bar, sticky to the viewport's bottom while the panel is edited */
.adm-form-panel { display: flex; flex-direction: column; min-width: 0; }
.adm-savebar {
    display: flex; align-items: center; justify-content: flex-end; gap: 8px 12px; flex-wrap: wrap;
    margin-top: 12px; padding: 12px 0 2px; border-top: 1px solid var(--c-outline-variant);
}
.adm-savebar[data-dirty="true"] {
    position: sticky; bottom: 12px; z-index: 5; padding: 10px 12px; border-top-color: transparent; border-radius: var(--radius-md);
    background: var(--c-surface-raised); box-shadow: inset 0 0 0 1px var(--c-outline-variant), var(--elev-2);
}
.adm-savebar-text { margin-right: auto; color: var(--c-on-2); font: var(--t-label-m); }
.adm-savebar-error { flex: 1 1 100%; }
.adm-savebar-actions { display: flex; align-items: center; gap: 8px; }

/* the filter bar under a page header; below 640 px the search plus "Filters (n)" */
.adm-filterbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.adm-filterbar > .adm-input--search { flex: 1 1 220px; max-width: 380px; width: auto; }
.adm-filterbar-more { display: contents; }
.adm-filterbar-open { display: none; }
.adm-filterbar-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.adm-chip {
    display: inline-flex; align-items: center; gap: 2px; max-width: 100%; height: 28px; padding: 0 2px 0 10px;
    border-radius: var(--radius-pill); background: var(--c-surface-high); color: var(--c-on); font: var(--t-label-m);
}
.adm-chip-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-chip-x {
    flex: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0;
    border: 0; border-radius: 50%; background: transparent; color: var(--c-on-2); font-size: 0; line-height: 0; cursor: pointer;
}
.adm-chip-x::before {
    content: ''; width: 14px; height: 14px; background: currentColor;
    -webkit-mask: var(--icon-x) center / contain no-repeat; mask: var(--icon-x) center / contain no-repeat;
}
.adm-chip-x:hover { background: var(--c-hover); color: var(--c-on); }

/* segmented buttons: the shared segmented control (brief §6.1), its pick filled (gold in dark, ink with gold words in
   light) so it reads at a glance (review: the old tint was barely visible) */
.adm-seg {
    display: inline-flex; gap: 2px; padding: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none;
    border-radius: var(--radius-pill); background: var(--c-surface-high);
}
.adm-seg::-webkit-scrollbar { display: none; }
.adm-seg-btn {
    flex: 0 0 auto; height: var(--adm-ctl-sm); padding: 0 14px; border: 0; border-radius: var(--radius-pill);
    background: transparent; color: var(--c-on-2); font: var(--t-label-m); cursor: pointer;
    transition: background-color var(--dur-2) var(--ease-standard), color var(--dur-2) var(--ease-standard);
}
.adm-seg-btn:hover { color: var(--c-on); background: var(--c-hover); }
.adm-seg-btn[aria-pressed="true"],
.adm-seg-btn[aria-pressed="true"]:hover { background: var(--c-primary); color: var(--c-on-primary-accent); font-weight: 600; }
.adm-seg-btn:focus-visible { outline-offset: -2px; }
/* the focus ring on the pick: the pick's own mark colour, inset 4 px, so it reads on the gold (dark) and the ink
   (light) fill alike (the plain ring would be gold on gold; review of phase 2) */
.adm-seg-btn[aria-pressed="true"]:focus-visible { outline-color: var(--c-on-primary-accent); outline-offset: -4px; }
.adm-seg-count { font-variant-numeric: tabular-nums; opacity: 0.8; }

/* switches (a checkbox with role="switch"): the shared 36 × 20 switch, the whole row is the label */
.adm-switch {
    position: relative; display: flex; align-items: center; justify-content: space-between; gap: 18px;
    min-height: var(--adm-row); padding: 12px 0; border-bottom: 1px solid var(--c-outline-variant); cursor: pointer;
}
.adm-switch:last-child { border-bottom: 0; }
.adm-switch-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.adm-switch-label { font: var(--t-label-l); color: var(--c-on); }
.adm-switch--state .adm-switch-label { min-width: 3.5em; color: var(--c-on-2); font: var(--t-label-m); text-align: right; }
.adm-switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.adm-switch-track {
    position: relative; flex: 0 0 auto; width: 36px; height: 20px; border-radius: var(--radius-pill);
    background: var(--c-surface-highest); box-shadow: inset 0 0 0 1px var(--c-outline);
    transition: background-color var(--dur-2) var(--ease-standard);
}
.adm-switch-knob {
    position: absolute; top: 4px; left: 4px; width: 12px; height: 12px; border-radius: 50%;
    background: var(--c-on-3); transition: transform var(--dur-2) var(--ease-standard), background-color var(--dur-2) var(--ease-standard);
}
.adm-switch-input:checked + .adm-switch-track { background: var(--c-accent); box-shadow: none; }
.adm-switch-input:checked + .adm-switch-track .adm-switch-knob { transform: translateX(16px); background: var(--c-bg); }
.adm-switch-input:focus-visible + .adm-switch-track { outline: 2px solid var(--c-focus); outline-offset: 2px; }

/* pills: states by meaning (12 px); tags: kinds, outlined and neutral */
.adm-pill {
    display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: var(--radius-pill);
    font: 600 0.75rem / 1.2 var(--font-sans); white-space: nowrap;
}
.adm-pill--gold { background: var(--c-accent-container); color: var(--c-on-accent-container); }
.adm-pill--warn { background: var(--adm-warn-container); color: var(--adm-on-warn-container); }
.adm-pill--danger { background: var(--c-danger-container); color: var(--c-on-danger-container); }
.adm-pill--muted { background: var(--c-surface-highest); color: var(--c-on-2); }
.adm-pill--ok { background: color-mix(in srgb, var(--c-success) 16%, var(--c-surface)); color: var(--c-success); }
.adm-tag {
    display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--radius-xs);
    box-shadow: inset 0 0 0 1px var(--c-outline); color: var(--c-on-2); font: 500 0.75rem / 1.2 var(--font-sans); white-space: nowrap;
}

/* ============================================================
   TABLES, LISTS, "SHOW MORE"
   ============================================================ */
/* positioned, so a hidden header label (position: absolute) scrolls and clips with its table (WebKit) */
.adm-table-wrap { position: relative; overflow-x: auto; max-width: 100%; }
.adm-table { width: 100%; border-collapse: collapse; font: var(--t-body-m); }
.adm-table th, .adm-table td {
    height: 48px; padding: 0 12px; text-align: left; white-space: nowrap; vertical-align: middle;
    border-top: 1px solid var(--c-outline-variant);
}
.adm-table th:first-child, .adm-table td:first-child { padding-left: 20px; }
.adm-table th:last-child, .adm-table td:last-child { padding-right: 16px; }
.adm-table thead th { height: 38px; border-top: 0; background: var(--c-surface-low); color: var(--c-on-3); font: var(--t-label-m); }
.adm-table tbody th { font-weight: 500; color: var(--c-on); }
.adm-table tbody tr:hover { background: var(--c-hover); }
.adm-table .adm-group-row th { height: 34px; padding-top: 10px; background: var(--c-surface); color: var(--c-on-2); font: var(--t-label-s); letter-spacing: 0.08em; text-transform: uppercase; }
.adm-table tbody .adm-group-row:hover { background: none; }
.adm-table .adm-num { text-align: right; font-variant-numeric: tabular-nums; }
.adm-row-link { cursor: pointer; }
.adm-sort { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.adm-sort:hover { color: var(--c-on); }
.adm-sort-mark { min-width: 8px; color: var(--c-accent); font-size: 0.6rem; }
.adm-cell-sub { color: var(--c-on-3); font: var(--t-body-s); }
.adm-cell-sub code { font-size: 0.75rem; }
.adm-table .adm-pills { flex-wrap: nowrap; }
.adm-user-link { display: inline-flex; flex-direction: column; gap: 1px; color: var(--c-on); text-decoration: none; vertical-align: middle; }
.adm-online { flex: none; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c-surface-highest); box-shadow: inset 0 0 0 1px var(--c-outline); }
.adm-online[data-on="true"] { background: var(--c-success); box-shadow: none; }
.adm-list { list-style: none; }
.adm-list-row { display: flex; align-items: center; gap: 12px; min-height: var(--adm-row); padding: 10px 0; border-bottom: 1px solid var(--c-outline-variant); font: var(--t-body-m); }
.adm-list-row:last-child { border-bottom: 0; }
.adm-list-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.adm-loadmore {
    display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 8px 16px;
    border-top: 1px solid var(--c-outline-variant); color: var(--c-on-3); font: var(--t-body-s); font-variant-numeric: tabular-nums;
}

/* R-120 §2.3: the responsive table. It fits its own box (container queries, not the viewport: half-width cards and
   inbox panes are narrow on a wide screen): priority 3 hides at ≤ 1100 px, priority 2 at ≤ 820 px, and at ≤ 640 px each
   row stacks. Title and status cells wrap; num and money cells stay on one line, right-aligned; no cell is sticky. */
.adm-table-wrap--fit { container: adm-table / inline-size; }
.adm-table--fit th, .adm-table--fit td { white-space: normal; overflow-wrap: break-word; }
.adm-table--fit .adm-c--num, .adm-table--fit .adm-c--money { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.adm-table--fit .adm-c--time { white-space: nowrap; }
.adm-table--fit .adm-c--actions { width: 1%; text-align: right; white-space: nowrap; }
.adm-table--fit .adm-c--wrap { min-width: 12ch; }
.adm-table--fit .adm-pills { flex-wrap: wrap; }
.adm-table--fit .adm-c--title a { color: var(--c-on); font-weight: 500; text-decoration: none; }
.adm-table--fit .adm-c--title a:hover, .adm-table--fit .adm-row-link:hover .adm-c--title a { color: var(--c-accent-text); }
.adm-table--fit .adm-c--title .adm-link, .adm-table--fit .adm-c--title .adm-addr-link { color: var(--c-accent-text); }
.adm-table--fit .adm-switch { min-height: 0; padding: 0; gap: 8px; border-bottom: 0; justify-content: flex-start; }
.adm-table .adm-sub-row { background: var(--c-surface-low); }
.adm-table .adm-sub-row > td:first-child { padding-left: 56px; }
.adm-disclose-cell { display: flex; align-items: center; min-width: 0; }
.adm-disclose-body { flex: 1 1 auto; min-width: 0; }
.adm-disclose {
    display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; margin: 0 6px 0 -6px; padding: 0;
    border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--c-on-2); font-size: 0; line-height: 0;
    vertical-align: middle; cursor: pointer;
}
.adm-disclose::before {
    content: ''; width: 16px; height: 16px; background: currentColor; transition: transform var(--dur-2) var(--ease-standard);
    -webkit-mask: var(--icon-chevron-right) center / contain no-repeat; mask: var(--icon-chevron-right) center / contain no-repeat;
}
.adm-disclose[aria-expanded="true"]::before { transform: rotate(90deg); }
.adm-disclose:hover { background: var(--c-hover); color: var(--c-on); }
@container adm-table (max-width: 1100px) {
    .adm-table--fit td[data-pri="3"], .adm-table--fit th[data-pri="3"] { display: none; }
}
@container adm-table (max-width: 820px) {
    .adm-table--fit td[data-pri="2"], .adm-table--fit th[data-pri="2"] { display: none; }
}
@container adm-table (max-width: 640px) {
    .adm-table--fit, .adm-table--fit tbody { display: block; width: 100%; }
    .adm-table--fit thead { display: none; }
    .adm-table--fit tbody tr {
        display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px;
        padding: 12px 16px; border-top: 1px solid var(--c-outline-variant);
    }
    .adm-table--fit tbody tr:first-child { border-top: 0; }
    .adm-table--fit td, .adm-table--fit th { display: block; grid-column: 1 / -1; order: 3; height: auto; padding: 0; border: 0; text-align: left; }
    .adm-table--fit .adm-c--title { grid-column: 1; grid-row: 1; order: 0; }
    .adm-table--fit .adm-c--actions { grid-column: 2; grid-row: 1; order: 0; width: auto; justify-self: end; }
    .adm-table--fit .adm-c--status { order: 1; }
    .adm-table--fit .adm-c--text, .adm-table--fit .adm-c--num, .adm-table--fit .adm-c--money, .adm-table--fit .adm-c--time {
        display: flex; align-items: baseline; justify-content: space-between; gap: 12px; text-align: right;
    }
    .adm-table--fit .adm-c--text::before, .adm-table--fit .adm-c--num::before, .adm-table--fit .adm-c--money::before,
    .adm-table--fit .adm-c--time::before {
        content: attr(data-label); flex: none; color: var(--c-on-3); font: var(--t-body-s); text-align: left;
    }
    .adm-table--fit td[data-label=""]::before { content: none; }
    .adm-table--fit td[data-pri="2"], .adm-table--fit td[data-pri="3"] { display: none; }
    /* an empty cell (no pill to show) takes no line of a stacked row */
    .adm-table--fit td:empty, .adm-table--fit td:has(> .adm-pills:empty:only-child) { display: none; }
    /* the row has the padding; no cell keeps the table's first / last column padding (the viewport rules included) */
    .adm-table--fit tbody td:first-child, .adm-table--fit tbody th:first-child { padding-left: 0; }
    .adm-table--fit tbody td:last-child, .adm-table--fit tbody th:last-child { padding-right: 0; }
    .adm-table--fit .adm-group-row { display: block; padding: 14px 16px 6px; }
    .adm-table--fit tbody .adm-group-row th { display: block; height: auto; padding: 0; background: none; }
    .adm-table--fit tbody .adm-sub-row { padding-left: 40px; }
    /* the row's padding is a sub-row's one indent: its first cell drops the wide table's 56 px */
    .adm-table--fit tbody .adm-sub-row > td:first-child { padding-left: 0; }
    .adm-table--fit .adm-switch { justify-content: flex-end; }
}

/* bars and the chart around them (one series in the accent; zero days a stub on a hairline baseline; two series
   stacked, with a two-item key: the standard model's in a quiet tone under the larger model's gold) */
.adm-bars { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-top: 8px; border-bottom: 1px solid var(--c-outline-variant); }
.adm-bar { flex: 1 1 0; min-width: 2px; border-radius: 3px 3px 0 0; background: var(--c-accent); transition: background-color var(--dur-1) var(--ease-standard); }
.adm-bar:hover { background: var(--c-accent-text); }
.adm-bar--zero { background: var(--c-surface-highest); }
.adm-bar--stack { display: flex; flex-direction: column-reverse; overflow: hidden; background: transparent; }
.adm-bar-seg { display: block; flex: none; width: 100%; }
.adm-bar-seg--1, .adm-key--1::before { background: color-mix(in srgb, var(--c-on-3) 70%, var(--c-surface)); }
.adm-bar-seg--2, .adm-key--2::before { background: var(--c-accent); }
.adm-chart { margin: 0; min-width: 0; }
.adm-chart-peak { display: block; margin-bottom: 2px; color: var(--c-on-3); font: var(--t-body-s); font-variant-numeric: tabular-nums; }
.adm-axis { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; color: var(--c-on-3); font: var(--t-body-s); }
.adm-axis-mark { white-space: nowrap; }
.adm-chart-key { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; color: var(--c-on-2); font: var(--t-body-s); }
.adm-key { display: inline-flex; align-items: center; gap: 6px; }
.adm-key::before { content: ''; flex: none; width: 10px; height: 10px; border-radius: 3px; }

/* ============================================================
   THE ACTIONS MENU (⋯) AND DIALOGS
   ============================================================ */
.adm-more {
    display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0;
    border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--c-on-2);
    font-size: 0; line-height: 0; cursor: pointer; vertical-align: middle;
    transition: background-color var(--dur-1) var(--ease-standard), color var(--dur-1) var(--ease-standard);
}
.adm-more::before {
    content: ''; width: 18px; height: 18px; background: currentColor;
    -webkit-mask: var(--icon-more) center / contain no-repeat; mask: var(--icon-more) center / contain no-repeat;
}
.adm-more:hover { background: var(--c-hover); color: var(--c-on); }
.adm-more[aria-expanded="true"] { background: var(--c-pressed); color: var(--c-on); }
.adm-menu {
    position: fixed; z-index: var(--z-dialog); min-width: 210px; max-width: calc(100vw - 16px); padding: 6px;
    display: flex; flex-direction: column; background: var(--c-surface-raised); border-radius: var(--radius-md);
    box-shadow: inset 0 0 0 1px var(--c-outline-variant), var(--elev-2); animation: panel-in var(--dur-2) var(--ease-enter);
}
.adm-menu-item {
    display: flex; align-items: center; width: 100%; height: 36px; padding: 0 12px; border: 0; border-radius: var(--radius-sm);
    background: transparent; color: var(--c-on); font: var(--t-label-l); text-align: left; white-space: nowrap; cursor: pointer;
}
.adm-menu-item:hover, .adm-menu-item:focus { background: var(--c-hover); }
.adm-menu-item:focus-visible { outline-offset: -2px; }
.adm-menu-item:disabled { opacity: 0.4; cursor: not-allowed; }
.adm-menu-item--danger { color: var(--c-danger); }
.adm-menu-item--danger:hover, .adm-menu-item--danger:focus { background: var(--c-danger-container); color: var(--c-on-danger-container); }
.adm-menu-sep { height: 1px; margin: 6px 4px; background: var(--c-outline-variant); }

.adm-dialog {
    width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: 0; overflow: auto;
    border: 0; border-radius: var(--radius-xl); background: var(--c-surface-raised); color: var(--c-on); box-shadow: var(--elev-3);
}
.adm-dialog[open] { animation: panel-in var(--dur-3) var(--ease-enter); }
.adm-dialog::backdrop { background: var(--c-scrim); }
.adm-dialog-body { display: flex; flex-direction: column; gap: 12px; padding: 24px; }
.adm-dialog-title { font: var(--t-title-l); color: var(--c-on); overflow-wrap: anywhere; }
.adm-dialog-text { color: var(--c-on-2); font: var(--t-body-m); }
.adm-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
/* while the confirmed action runs, its button shows a small spinner (the dialog is aria-busy) */
.adm-dialog[aria-busy="true"] .adm-dialog-actions .adm-btn[type="submit"] { opacity: 0.8; }
.adm-dialog[aria-busy="true"] .adm-dialog-actions .adm-btn[type="submit"]::after {
    content: ''; width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
    animation: adm-spin 0.8s linear infinite;
}
@keyframes adm-spin { to { transform: rotate(360deg); } }

/* ============================================================
   TOASTS (above everything, I1); a toast may offer one action (Undo)
   ============================================================ */
.adm-toasts {
    position: fixed; z-index: var(--z-system-notice); left: 50%; bottom: 24px; transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(480px, calc(100vw - 32px)); pointer-events: none;
}
.adm-toast {
    pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-radius: var(--radius-md); max-width: 100%;
    background: var(--c-surface-raised); color: var(--c-on);
    box-shadow: inset 0 0 0 1px var(--c-outline-variant), var(--elev-2); font: var(--t-body-m); animation: panel-in var(--dur-3) var(--ease-enter);
    transition: opacity var(--dur-4) var(--ease-standard), transform var(--dur-4) var(--ease-standard);
}
.adm-toast--error { background: var(--c-danger-container); color: var(--c-on-danger-container); }
.adm-toast--out { opacity: 0; transform: translateY(6px); }
.adm-toast-action { flex: none; margin-left: auto; }

/* ============================================================
   NARROW SCREENS: the rail becomes a drawer below 960 px (with a header and a footer); a phone's top bar is the menu
   button and the search; a phone stacks the stats and drops the brand words
   ============================================================ */
@media (max-width: 1500px) {
    body.adm { --adm-gutter: 28px; }
}
@media (max-width: 959px) {
    body.adm { --adm-gutter: 20px; }
    .adm-shell { grid-template-columns: minmax(0, 1fr); grid-template-areas: "bar" "main"; }
    .adm-topbar { gap: 8px; padding-right: 8px; }
    .adm-nav-toggle { display: inline-flex; }
    .adm-brand { width: auto; padding: 0 4px; background: none; }
    .adm-nav {
        position: fixed; top: 0; left: 0; bottom: 0; z-index: 40; width: min(300px, 86vw); height: auto;
        align-self: stretch;          /* an abspos grid child sizes by align-self: "start" would shrink it to its links */
        transform: translateX(-100%); visibility: hidden; box-shadow: var(--elev-3);
        transition: transform var(--dur-4) var(--ease-standard), visibility 0s linear var(--dur-4);
    }
    .adm-shell[data-nav="open"] .adm-nav { transform: none; visibility: visible; transition: transform var(--dur-4) var(--ease-enter); }
    .adm-nav-head {
        position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px;
        min-height: 56px; padding: 0 8px 0 20px; background: var(--c-surface-low); box-shadow: 0 1px 0 var(--c-outline-variant);
    }
    .adm-nav-groups { padding-top: 16px; }
    .adm-nav-foot {
        position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px;
        padding: 10px 12px; background: var(--c-surface-low); box-shadow: 0 -1px 0 var(--c-outline-variant);
    }
    .adm-nav-scrim {
        display: block; position: fixed; inset: 0; z-index: 35; background: var(--c-scrim); opacity: 0; pointer-events: none;
        transition: opacity var(--dur-3) var(--ease-standard);
    }
    .adm-shell[data-nav="open"] .adm-nav-scrim { opacity: 1; pointer-events: auto; }
    .adm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    body.adm { --adm-gutter: 16px; --adm-bar-h: 56px; }
    .adm-main { padding-top: 20px; }
    .adm-brand, .adm-kbd, .adm-topbar-actions { display: none; }
    .adm-search { max-width: none; margin-right: 0; }
    /* the results under the whole bar, inside the screen (left-anchored they ran past the edge: fix ux-3) */
    .adm-search-list { position: fixed; top: calc(var(--adm-bar-h) + 4px); left: 16px; right: 16px; min-width: 0; }
    /* a segmented control wraps, so every choice shows (the feedback filter's All: fix ux-5) */
    .adm-seg { flex-wrap: wrap; border-radius: var(--radius-lg); }
    .adm-signout { padding: 0 10px; }
    .adm-title { font-size: 1.5rem; }
    .adm-section { padding: 16px; }
    .adm-section--flush { padding: 0; }
    .adm-section--flush > .adm-section-head { padding: 14px 16px 0; }
    .adm-stat-value { font-size: 1.375rem; }
    .adm-kv { flex-wrap: wrap; }
    .adm-kv-value { text-align: left; justify-content: flex-start; }
    .adm-table th:first-child, .adm-table td:first-child { padding-left: 16px; }
    .adm-head-actions { justify-content: flex-start; }
    /* a header made with primary / menu keeps its title and its one action on one row (rule 9) when the title keeps
       12rem (a long action goes under it rather than break the title); with an aside (a lookup) the aside and the
       action share the next row */
    .adm-head--row { align-items: flex-start; }
    .adm-head--row > .adm-head-main { flex: 1 1 12rem; }
    .adm-head--row > .adm-head-actions { flex: none; flex-wrap: nowrap; }
    .adm-head--aside { flex-wrap: wrap; }
    .adm-head--aside > .adm-head-actions { flex: 1 1 100%; flex-wrap: nowrap; }
    .adm-head--aside > .adm-head-actions > :first-child { flex: 1 1 auto; min-width: 0; width: auto; }
    /* the filter bar: the search and "Filters (n)"; the rest is in its dialog */
    .adm-filterbar-more { display: none; }
    .adm-filterbar-open { display: inline-flex; }
    .adm-filterbar > .adm-input--search { flex: 1 1 55%; max-width: none; }
}
/* touch: every control at least 40 px, navigation links and menu items 44 px (rule 9) */
@media (pointer: coarse) {
    .adm-btn, .adm-btn--sm, .adm-seg-btn, .adm-input, .adm-select, .adm-select--sm, .adm-search-input, .adm-numbox,
    .adm-nav-toggle { min-height: 40px; }
    .adm-more, .adm-nav-close, .adm-help-btn, .adm-copy-btn, .adm-chip-x, .adm-disclose { min-width: 40px; min-height: 40px; }
    .adm-nav-link, .adm-menu-item { min-height: 44px; }
    .adm-chip { min-height: 40px; }
    .adm-table--fit .adm-switch, .adm-setting-control .adm-switch { min-height: 40px; }
}
@media (forced-colors: active) {
    .adm-seg { border: 1px solid ButtonText; }
    .adm-seg-btn[aria-pressed="true"],
    .adm-seg-btn[aria-pressed="true"]:hover { forced-color-adjust: none; background: Highlight; color: HighlightText; }
    .adm-seg-btn[aria-pressed="true"]:focus-visible { outline-color: HighlightText; }
    .adm-select:focus-visible { outline: 2px solid Highlight; outline-offset: 2px; }   /* its focus is a border tint */
    .adm-switch-track { border: 1px solid ButtonText; }
    .adm-switch-knob { forced-color-adjust: none; background: ButtonText; }
    .adm-switch-input:checked + .adm-switch-track { forced-color-adjust: none; background: Highlight; }
    .adm-switch-input:checked + .adm-switch-track .adm-switch-knob { background: HighlightText; }
    .adm-more::before { forced-color-adjust: none; background: ButtonText; }
    .adm-nav-close::before { forced-color-adjust: none; background: ButtonText; }
    .adm-copy-btn::before { forced-color-adjust: none; background: ButtonText; }
    .adm-chip-x::before { forced-color-adjust: none; background: ButtonText; }
    .adm-disclose::before { forced-color-adjust: none; background: ButtonText; }
    /* text fields mark focus with a border tint, which forced colours drop; charts, meters and the online dot are
       backgrounds, which they reset (fix ux-6) */
    .adm-input:focus-visible, .adm-password:focus-visible { outline: 2px solid Highlight; outline-offset: 2px; }
    .adm-numbox-input:focus-visible { outline: 2px solid Highlight; outline-offset: 2px; }
    .adm-bar, .adm-meter-fill, .adm-online[data-on="true"] { forced-color-adjust: none; background: CanvasText; }
    .adm-bar--zero { forced-color-adjust: none; background: GrayText; }
    .adm-bar-seg--1, .adm-key--1::before { forced-color-adjust: none; background: GrayText; }
    .adm-bar-seg--2, .adm-key--2::before { forced-color-adjust: none; background: CanvasText; }
    .adm-meter, .adm-online { border: 1px solid CanvasText; }
    .adm-nav-toggle::before { forced-color-adjust: none; background: ButtonText; }
    .adm-nav-link[aria-current="page"] { outline: 2px solid Highlight; outline-offset: -2px; }
    .adm-title:focus-visible { outline: 2px solid Highlight; outline-offset: 4px; }
    .adm-section-title:focus-visible { outline: 2px solid Highlight; outline-offset: 4px; }
    .adm-menu, .adm-dialog, .adm-search-list, .adm-section, .adm-stat, .adm-callout, .adm-tag, .adm-numbox { border: 1px solid CanvasText; }
    .adm-search-opt[aria-selected="true"] { outline: 2px solid Highlight; outline-offset: -2px; }
}
