/* ============================================================================
   miintel.css — MIIntel global design system
   ============================================================================

   WHY THIS FILE EXISTS (read before editing)

   This project is a no-build, 15-page static site where every page carries its
   own inline <style> block (see CLAUDE.md, "No build step"). Until now the only
   shared stylesheet was theme.css, whose remit is deliberately narrow: native
   form-control chrome only.

   Applying the "New Design" visual language page-by-page failed because there
   was no shared layer — a sitewide look cannot be maintained across 15
   independent inline stylesheets. This file is that shared layer.

   HOW IT RETHEMES PAGES IT DOES NOT CONTROL
   -----------------------------------------
   13 of the 15 pages declare the SAME design-token vocabulary inline
   (--bg, --panel, --border, --text, --muted, --faint, --cyan, --violet,
   --good, --grad, --ease). Their component rules all *reference* those tokens.

   This file is linked BEFORE each page's inline <style>, so on equal
   specificity the page would win. It therefore declares tokens on `html:root`
   (specificity 0,0,1,1) which outranks the pages' `:root` (0,0,1,0)
   regardless of source order. Redefining the shared token names here
   re-skins all 13 pages at once, without touching their inline CSS.

   Structural rules below use a `body ` prefix for the same reason — one extra
   element in the selector is enough to win, while staying low enough that a
   page can still deliberately override with a more specific rule of its own.

   TWO TOKEN SHAPES THAT MUST NOT CHANGE
   -------------------------------------
   - `--ease` is a DURATION + TIMING FUNCTION pair ("0.4s cubic-bezier(...)"),
     consumed as `transition: transform var(--ease)`. Redefining it as a bare
     cubic-bezier() silently drops the duration and kills every transition on
     every page. New timing functions get their own --mi-ease-* tokens.
   - `--grad` is a full linear-gradient() value, used with background-clip:text.

   briefing.html and dashboard.html do not use the token vocabulary (they hardcode
   colours) and are handled separately.

   Loaded with a ?v= cache-bust query — bump it in every page when this changes.
   ========================================================================= */


/* ============================================================================
   1. TOKENS
   ========================================================================= */

html:root {
  /* -- Surfaces ------------------------------------------------------- */
  --bg: #06060f;
  --bg-deep: #04040a;
  --panel: rgba(255, 255, 255, 0.042);
  --panel-strong: rgba(255, 255, 255, 0.072);
  --panel-raised: rgba(255, 255, 255, 0.095);
  --border: rgba(255, 255, 255, 0.085);
  --border-strong: rgba(255, 255, 255, 0.14);

  /* -- Type ----------------------------------------------------------- */
  --text: #f0f3fb;
  --muted: #97a3c6;
  --faint: #64708f;

  /* -- Accents (New Design palette) ------------------------------------ */
  --cyan: #3ef0ff;          /* electric cyan — the "electricity" accent */
  --violet: #7c5cff;
  --good: #2bcf8b;
  --mi-magenta: #ff4fd8;
  --mi-teal: #3de0d0;
  --mi-lime: #b8ff3e;
  --mi-amber: #fbbf24;
  --mi-rose: #ff4f6d;
  --mi-blue: #4f74e8;

  /* Bright variants, for glows and lit states */
  --mi-cyan-bright: #8af7ff;
  --mi-violet-bright: #a893ff;
  --mi-good-bright: #69e9b3;

  /* Translucent accent washes — used for hover fills and rings */
  --mi-cyan-08: rgba(62, 240, 255, 0.08);
  --mi-cyan-16: rgba(62, 240, 255, 0.16);
  --mi-cyan-28: rgba(62, 240, 255, 0.28);
  --mi-cyan-48: rgba(62, 240, 255, 0.48);
  --mi-violet-10: rgba(124, 92, 255, 0.10);
  --mi-violet-22: rgba(124, 92, 255, 0.22);
  --mi-violet-40: rgba(124, 92, 255, 0.40);

  --grad: linear-gradient(120deg, #3ef0ff 0%, #7c5cff 55%, #ff4fd8 100%);
  --mi-grad-soft: linear-gradient(135deg, rgba(62, 240, 255, 0.16), rgba(124, 92, 255, 0.18));
  --mi-grad-rim: linear-gradient(135deg, rgba(255, 255, 255, 0.10), transparent 32%, transparent 66%, rgba(255, 255, 255, 0.035));

  /* -- Motion ---------------------------------------------------------- */
  /* NOTE: --ease keeps its duration+timing shape. Do not change. */
  --ease: 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  --mi-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --mi-ease-premium: cubic-bezier(0.16, 1, 0.3, 1);
  --mi-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --mi-dur-fast: 180ms;
  --mi-dur: 340ms;
  --mi-dur-slow: 620ms;

  /* -- Spacing scale (4px base) ---------------------------------------- */
  --mi-s1: 4px;
  --mi-s2: 8px;
  --mi-s3: 12px;
  --mi-s4: 16px;
  --mi-s5: 22px;
  --mi-s6: 30px;
  --mi-s7: 40px;
  --mi-s8: 56px;
  --mi-s9: 72px;

  /* Page rhythm */
  --mi-gutter: clamp(16px, 4vw, 40px);
  --mi-shell-top: var(--mi-s5);
  --mi-shell-bottom: var(--mi-s9);
  --mi-shell-tail: 24px;        /* §9: the space under a .shell's last card, above the footer */
  --mi-section-gap: var(--mi-s6);

  /* -- Radii ----------------------------------------------------------- */
  --mi-r-sm: 10px;
  --mi-r-md: 14px;
  --mi-r-lg: 18px;
  --mi-r-xl: 24px;
  --mi-r-pill: 999px;

  /* -- Elevation ------------------------------------------------------- */
  --mi-shadow-sm: 0 4px 14px -6px rgba(0, 0, 0, 0.6);
  --mi-shadow-md: 0 14px 34px -18px rgba(0, 0, 0, 0.75);
  --mi-shadow-lg: 0 28px 70px -30px rgba(0, 0, 0, 0.85);
  --mi-glow-cyan: 0 0 26px rgba(62, 240, 255, 0.22);
  --mi-glow-violet: 0 0 30px rgba(124, 92, 255, 0.24);
}


/* ============================================================================
   2. AMBIENT BACKDROP
   A fixed circuit grid + drifting accent glows behind every page. Pages own
   `body { background: ... }`; these are separate fixed layers at z-index -1 so
   they never fight the page's own gradient stack, and `.shell { z-index: 1 }`
   (already present on every page) keeps content above them.
   No page in this project defines body::before/body::after — verified.
   ========================================================================= */

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.05;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.34) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.28) 1px, transparent 1px);
  background-size: 52px 52px;
  -webkit-mask-image: radial-gradient(ellipse 78% 62% at 50% 32%, #000, transparent 74%);
          mask-image: radial-gradient(ellipse 78% 62% at 50% 32%, #000, transparent 74%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(620px 340px at 12% -6%, rgba(62, 240, 255, 0.10), transparent 62%),
    radial-gradient(680px 380px at 92% 8%, rgba(124, 92, 255, 0.13), transparent 62%),
    radial-gradient(520px 320px at 78% 96%, rgba(255, 79, 216, 0.07), transparent 60%);
  animation: miAmbientDrift 26s ease-in-out infinite alternate;
}

@keyframes miAmbientDrift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(0, -26px, 0) scale(1.06); }
}


/* ============================================================================
   3. BASE RHYTHM
   Normalises the page-level spacing scale that drifted across the 15 inline
   stylesheets (shell padding, header margin, hero margin, footer margin).
   The `body ` prefix supplies the specificity needed to beat each page's own
   rule. Per-page max-width is intentionally left alone here.
   ========================================================================= */

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body .shell {
  padding-top: var(--mi-shell-top);
  padding-right: var(--mi-gutter);
  padding-bottom: var(--mi-shell-bottom);
  padding-left: var(--mi-gutter);
}

body .shell > header,
body header.glass {
  margin-bottom: var(--mi-s7);
  padding: var(--mi-s4) var(--mi-s5);
  border-radius: var(--mi-r-lg);
}

body .hero {
  margin-bottom: var(--mi-section-gap);
}

body .hero h1 {
  margin: var(--mi-s3) 0 var(--mi-s2);
  line-height: 1.15;
}

body .hero p {
  line-height: 1.65;
}

/* The footer used to be declared here, as a divider plus its space above.
   It now lives in §21 (APP FOOTER) along with its type, colour, alignment and
   the bottom clearance for the fixed Search/Chat pills — one definition of the
   whole component rather than half of it here and the other half copied into
   five page stylesheets. Nothing declares a footer in this section any more;
   §21 is the only place. */

/* Consistent vertical rhythm between stacked top-level sections. */
body .shell > section + section,
body .shell > .card + .card,
body .shell > .panel + .panel {
  margin-top: var(--mi-section-gap);
}


/* ============================================================================
   4. GLASS SURFACES
   Upgrades the existing `.glass` utility with the layered rim treatment from
   the New Design packs: a soft inner top highlight plus a gradient hairline
   border drawn with the mask-composite trick (so the rim reads as lit glass
   rather than a flat 1px line).
   ========================================================================= */

/* The gradient rim below is an absolutely-positioned ::after, so .glass needs
   a positioning context — but declaring `position: relative` at `body .glass`
   (0,0,1,1) OUTRANKED page rules like `.notif-panel { position: absolute }`
   (0,0,1,0) and dropped those panels into normal flow, where they stretched
   to full width and wrecked the layout around them.

   :where() zeroes this declaration's specificity so ANY explicit position on
   the element wins, while elements that declare none still get `relative`.
   Positioning is the one property here that must never be imposed — keep new
   layout-affecting declarations out of the plain `body .glass` block below. */
:where(body .glass) { position: relative; }

body .glass {
  background-color: var(--panel);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 26%);
  border: 1px solid var(--border);
  -webkit-backdrop-filter: blur(22px) saturate(1.15);
          backdrop-filter: blur(22px) saturate(1.15);
  box-shadow:
    var(--mi-shadow-md),
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 -1px 0 rgba(0, 0, 0, 0.32);
}

/* Gradient rim, drawn as a ::after overlay. It must never become a
   backdrop-filter carrier — see CLAUDE.md's containing-block trap, where an
   ancestor with backdrop-filter captured position:fixed descendants. */
body .glass::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  border: 1px solid transparent;
  border-radius: inherit;
  background: var(--mi-grad-rim) border-box;
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
}

/* Brand mark — gradient chip shared by every page header. */
body .brand-mark {
  background: var(--grad);
  color: #05060f;
  border-radius: var(--mi-r-md);
  box-shadow: 0 0 24px rgba(124, 92, 255, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

body .brand-text b {
  letter-spacing: -0.2px;
}

body .brand-text span {
  color: var(--faint);
  letter-spacing: 0.22em;
}


/* ============================================================================
   5. BUTTONS
   One button language across all pages. The electricity layer (Phase 2)
   attaches its canvas to these same elements, so the padding/radius/isolation
   set here is what the bolt path is measured against.
   ========================================================================= */

body .btn,
body button.btn,
body a.btn {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--mi-s2);
  padding: 10px 18px;
  border-radius: var(--mi-r-md);
  border: 1px solid var(--border);
  background-color: var(--panel-strong);
  background-image: linear-gradient(145deg, rgba(255, 255, 255, 0.05), transparent 62%);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  overflow: visible;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform var(--mi-dur) var(--mi-ease-out),
    border-color var(--mi-dur) ease,
    background-color var(--mi-dur) ease,
    box-shadow var(--mi-dur) ease,
    color var(--mi-dur) ease;
}

/* Icon-only buttons stay square.
   DO NOT reintroduce a `:has(> i:only-child)` heuristic here. `:only-child`
   counts ELEMENT children only, so a perfectly ordinary
   `<a class="btn"><i class="fa-…"></i> Admin Portal</a>` matched it — the
   label is a text node and does not disqualify the icon. Every icon+text
   button in the app therefore got `aspect-ratio: 1` and rendered as a giant
   square (the header's "Admin Portal" measured 125x125, "Log out" 92x92).
   There is no CSS selector that can see a text node, so this is an explicit
   opt-in list plus a `data-icon-only` hook for new ones. */
body .btn.icon-only,
body .btn[data-icon-only],
body .btn.notif-bell {
  padding: 10px;
  min-width: 0;
  aspect-ratio: 1;
}

/* .notif-close is NOT in the list above on purpose. It already declares its
   own 26x26 grid-centred box; adding 10px of padding on top of that left the
   glyph 6px of content box inside a border-box square, which pushed it off
   centre and hard against the panel edge. It only needs to not be squashed. */
body .notif-close {
  padding: 0;
  flex-shrink: 0;
  place-items: center;
}

/* The header row holds the title on one side and the actions on the other;
   keeping the actions from stretching is what stops the close button drifting
   to the panel's edge. */
body .notif-panel-head { align-items: center; }
body .notif-head-actions { align-items: center; flex-shrink: 0; }

/* Hover was inconsistent across pages (rose on some, cyan on others).
   One electric-cyan language everywhere. */
body .btn:hover:not(:disabled),
body button.btn:hover:not(:disabled),
body a.btn:hover {
  transform: translateY(-2px);
  border-color: var(--mi-cyan-48);
  background-color: var(--mi-cyan-08);
  color: var(--mi-cyan-bright);
  box-shadow: var(--mi-glow-cyan), 0 10px 26px -14px rgba(0, 0, 0, 0.9);
}

body .btn:active:not(:disabled),
body button.btn:active:not(:disabled) {
  transform: translateY(0) scale(0.985);
}

body .btn:disabled,
body button.btn:disabled,
body .btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Destructive intent keeps its own colour. */
body .btn.danger:hover:not(:disabled),
body .btn[data-variant="danger"]:hover:not(:disabled),
body .pa-del:hover {
  border-color: rgba(255, 79, 109, 0.55);
  background-color: rgba(255, 79, 109, 0.12);
  color: #ffb3c0;
  box-shadow: 0 0 26px rgba(255, 79, 109, 0.22);
}

/* Primary / call-to-action. */
body .btn.primary,
body .btn[data-variant="primary"] {
  border-color: transparent;
  background-image: var(--grad);
  color: #05060f;
  font-weight: 700;
  box-shadow: 0 10px 30px -14px rgba(124, 92, 255, 0.9);
}

body .btn.primary:hover:not(:disabled),
body .btn[data-variant="primary"]:hover:not(:disabled) {
  color: #05060f;
  background-color: transparent;
  filter: brightness(1.08) saturate(1.1);
  box-shadow: 0 0 34px rgba(124, 92, 255, 0.42), 0 14px 34px -16px rgba(0, 0, 0, 0.9);
}

/* Small inline action buttons that exist on the admin pages. */
body .pa-edit,
body .pa-del {
  border-radius: var(--mi-r-sm);
  border: 1px solid var(--border);
  background-color: var(--panel-strong);
  color: var(--text);
  transition:
    border-color var(--mi-dur) ease,
    background-color var(--mi-dur) ease,
    color var(--mi-dur) ease;
}

body .pa-edit:hover {
  border-color: var(--mi-cyan-48);
  color: var(--mi-cyan-bright);
  background-color: var(--mi-cyan-08);
}


/* ============================================================================
   6. DEPTH-OF-FIELD FOCUS GROUPS  ("Tile Hover Blur")
   From the interactive-focus-cards pack: hovering one item in a group pushes
   its siblings out of focus. Applied to the real card grids across the portal
   rather than to one page's tiles.

   Opt in on any new container with data-mi-focus.
   Pointer-gated: :has() + blur on a touch device would leave siblings stuck
   blurred after a tap, since there is no hover-out event.
   ========================================================================= */

@media (hover: hover) and (pointer: fine) {
  body .grid:has(> *:hover) > *:not(:hover),
  body .pubs-grid:has(> *:hover) > *:not(:hover),
  body .stat-grid:has(> *:hover) > *:not(:hover),
  body .gold-grid:has(> *:hover) > *:not(:hover),
  body .controls-grid:has(> *:hover) > *:not(:hover),
  body .tiles:has(> *:hover) > *:not(:hover),
  body [data-mi-focus]:has(> *:hover) > *:not(:hover) {
    filter: blur(5px) brightness(0.66);
    opacity: 0.7;
    transform: scale(0.975);
    transition:
      filter var(--mi-dur-slow) var(--mi-ease-out),
      opacity var(--mi-dur-slow) ease,
      transform var(--mi-dur-slow) var(--mi-ease-out);
  }

  /* The hovered item lifts toward the viewer. */
  body .grid > *:hover,
  body .pubs-grid > *:hover,
  body .stat-grid > *:hover,
  body .gold-grid > *:hover,
  body .controls-grid > *:hover,
  body .tiles > *:hover,
  body [data-mi-focus] > *:hover {
    z-index: 5;
    transition:
      transform var(--mi-dur-slow) var(--mi-ease-out),
      box-shadow var(--mi-dur-slow) ease;
  }

  /* Never blur a group that contains focus — keyboard and form use must stay
     readable, and a blurred field with a live caret is unusable. */
  body .grid:has(> *:focus-within) > *,
  body .pubs-grid:has(> *:focus-within) > *,
  body .stat-grid:has(> *:focus-within) > *,
  body .gold-grid:has(> *:focus-within) > *,
  body .controls-grid:has(> *:focus-within) > *,
  body .tiles:has(> *:focus-within) > *,
  body [data-mi-focus]:has(> *:focus-within) > * {
    filter: none;
    opacity: 1;
    transform: none;
  }
}


/* ============================================================================
   7. FORM CONTROLS
   theme.css owns native <select> chrome. This section covers the author-styled
   side: text inputs, textareas, and focus rings.
   ========================================================================= */

body input[type="text"],
body input[type="email"],
body input[type="password"],
body input[type="search"],
body input[type="number"],
body input[type="url"],
body input[type="date"],
body input[type="datetime-local"],
body textarea {
  font-family: inherit;
  color: var(--text);
  transition:
    border-color var(--mi-dur) ease,
    box-shadow var(--mi-dur) ease,
    background-color var(--mi-dur) ease;
}

body input::placeholder,
body textarea::placeholder {
  color: var(--faint);
  opacity: 1;
}

body input:focus-visible,
body textarea:focus-visible,
body select:focus-visible {
  outline: none;
  border-color: var(--mi-cyan-48);
  box-shadow: 0 0 0 3px var(--mi-cyan-16), 0 0 22px rgba(62, 240, 255, 0.14);
}

/* Keyboard focus ring for everything else. */
body a:focus-visible,
body button:focus-visible,
body [tabindex]:focus-visible {
  outline: 2px solid var(--mi-cyan-48);
  outline-offset: 3px;
  border-radius: var(--mi-r-sm);
}


/* ============================================================================
   8. CHROME — scrollbars, selection, misc
   ========================================================================= */

/* Scrollbars are CHROME, not decoration.
   These were a saturated cyan-to-violet gradient. On any inner scroll
   container (the user roster, the module list) that painted a bright lavender
   bar along the edge — reported, reasonably, as "a weird out-of-place light
   purple line" cutting across the UI. A scrollbar should read as a neutral
   affordance and only gain colour on interaction. */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }

*::-webkit-scrollbar-thumb {
  border-radius: var(--mi-r-pill);
  background-color: rgba(255, 255, 255, 0.16);
  border: 3px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background-color: rgba(124, 92, 255, 0.5);
  background-clip: padding-box;
}

*::-webkit-scrollbar-corner { background: transparent; }

::selection {
  background: rgba(124, 92, 255, 0.38);
  color: #fff;
}

/* Safety net. CLAUDE.md requires this on every page that toggles [hidden];
   declaring it globally means a page that forgets it can no longer produce the
   full-screen-overlay bug. Pages that already declare it still win by order —
   same result. */
[hidden] { display: none !important; }

hr {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: var(--mi-s6) 0;
}


/* ============================================================================
   9. REDUCED MOTION
   ========================================================================= */

@media (prefers-reduced-motion: reduce) {
  body::after { animation: none; }

  body .grid:has(> *:hover) > *:not(:hover),
  body .pubs-grid:has(> *:hover) > *:not(:hover),
  body .stat-grid:has(> *:hover) > *:not(:hover),
  body .gold-grid:has(> *:hover) > *:not(:hover),
  body .controls-grid:has(> *:hover) > *:not(:hover),
  body .tiles:has(> *:hover) > *:not(:hover),
  body [data-mi-focus]:has(> *:hover) > *:not(:hover) {
    filter: brightness(0.72);
    transform: none;
  }

  body .btn:hover:not(:disabled) { transform: none; }
}


/* ============================================================================
   10. OTP DIGIT SLOTS  (globalized in Phase 3)
   ============================================================================
   The circuit/digit-slot scene from the New Design otp-verification pack.

   This lived inline in portal.html, which meant only that page could render
   it — login.html's two-factor challenge, the one place an OTP is typed most
   often, fell back to a plain text input. Moving it here makes the scene
   available to every page; the markup contract is unchanged, so security.js
   drives it identically wherever it appears.

   Structure expected by security.js:
     .verification-form > .otp-scene > .otp-real-input
                                     > .circuit-plane > .wire.wire--N
                                                      > .collapse-core
                                                      > .otp-node > .node-trace
                                                                  > .node-face
   The real <input> stays authoritative and transparently overlays the slot
   row, so paste, autofill and select-all keep working natively.
   ========================================================================= */

/* ── OTP digit-slot input (New Design integration) — real #mfaCodeInput
   stays authoritative and fully overlays the slot row (transparent, real
   caret hidden) so paste/autofill/select-all keep working exactly as
   before; the spans are a pure visual mirror, kept in sync by
   security.js's syncOtpSlots(). ── */
/* ── OTP circuit choreography (New Design integration) — exact port of
   the "otp-verification" Code Candy pack: form hexagon -> draw wires ->
   orbit -> collapse, adapted from its 4-node square to 6 nodes/hexagon.
   Colors ported directly from the reference's own default palette. ── */
html:root {
  --otp-purple: #4f74e8; --otp-purple-bright: #7f9bf3;
  --otp-cyan: #3de0d0; --otp-cyan-bright: #7af5e8;
  --otp-green: #2bcf8b; --otp-green-bright: #69e9b3;
  --slot-size: 50px;
}
.otp-scene { position: relative; width: 100%; height: 240px; overflow: visible; perspective: 760px; perspective-origin: 50% 47%; }
.otp-real-input { position: absolute; inset: 0; z-index: 20; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; background: transparent; color: transparent; caret-color: transparent; font-size: 1.3rem; }
.otp-real-input:focus { outline: none; }

.circuit-plane { position: absolute; inset: 0; z-index: 2; transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) translateZ(0); transform-style: preserve-3d; }

.otp-node { position: absolute; top: 50%; left: 50%; z-index: 4; width: var(--slot-size); height: var(--slot-size); opacity: 0; transform: translate(-50%, -50%); transform-style: preserve-3d; }
.is-ready .otp-node { opacity: 1; transition: opacity 280ms ease; }

.node-trace { position: absolute; inset: 0; z-index: 6; width: 100%; height: 100%; overflow: visible; pointer-events: none; opacity: 0; filter: drop-shadow(0 0 4px rgba(61, 224, 208, 0.3)); transform: translateZ(1px); }
.node-trace-path { fill: none; stroke: var(--otp-cyan-bright); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 100; stroke-dashoffset: 100; vector-effect: non-scaling-stroke; }
/* A FILLED slot rests as its lit face border alone.
   Leaving the trace fully drawn at opacity 1 put a 2.4px stroke about 1px
   inside a 1px border — two concentric outlines plus two glows on a 50px slot,
   which reads as a thick, doubled ring. The reference can afford it on 78px
   slots; at our size it is roughly 1.6x heavier and looks like an artifact.
   The trace now draws on entry (is-flash-fast) and while verifying
   (is-tracing), then fades out — so it reads as motion, not chrome. */
.otp-node.has-value .node-trace { opacity: 0; transition: opacity 420ms ease; }
.otp-node.has-value .node-trace-path { stroke: var(--otp-cyan-bright); stroke-dashoffset: 0; }
/* transition:none so the trace SNAPS visible when its animation starts. A
   transition is only wanted on the way OUT — CSS applies the after-change
   style's transition, so removing the class picks up has-value's 420ms fade
   while adding it is instant. Without this the stroke fades in over 420ms on
   top of its own draw, which reads as mushy rather than crisp. */
.otp-node.is-flash .node-trace, .otp-node.is-flash-fast .node-trace { opacity: 1; transition: none; }
.otp-node.has-value.is-flash .node-trace-path, .otp-node.is-flash .node-trace-path { stroke: var(--otp-cyan-bright); animation: otpTraceDraw 2s cubic-bezier(0.33, 0, 0.2, 1) both; }
.otp-node.has-value.is-flash-fast .node-trace-path, .otp-node.is-flash-fast .node-trace-path { stroke: var(--otp-cyan-bright); animation: otpTraceDraw 900ms cubic-bezier(0.33, 0, 0.2, 1) both; }
.otp-node.is-tracing .node-trace { opacity: 1; transition: none; filter: drop-shadow(0 0 5px rgba(127, 155, 243, 0.5)); }
.otp-node.is-tracing .node-trace-path { stroke: var(--otp-purple-bright); stroke-dasharray: 100; animation: otpTraceDraw 2.2s cubic-bezier(0.33, 0, 0.2, 1) both; }
.otp-node.is-routing .node-trace, .otp-node.is-locking .node-trace { opacity: 0; filter: none; }
.otp-node.is-error .node-trace { opacity: 1; transition: none; filter: drop-shadow(0 0 6px rgba(255, 120, 120, 0.4)); }
.otp-node.is-error .node-trace-path { stroke: #ff8f8f; stroke-dashoffset: 0; animation: none; }

.node-face { position: relative; display: grid; width: 100%; height: 100%; place-items: center; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.085); border-radius: 14px; color: var(--text); background-color: #12151a; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.04); transform: translateZ(0); transform-style: preserve-3d; transition: border-color 460ms ease, border-radius 640ms cubic-bezier(0.16, 1, 0.3, 1), color 460ms ease, background-color 520ms ease, box-shadow 520ms ease; }
/* NO `0 0 0 Npx` ring shadows on .node-face, in any state.
   The face already has a 1px border and the perimeter trace strokes just
   inside it; a spread-ring shadow adds a THIRD concentric outline, which reads
   as an extra box overlapping the slot. Glow only — no spread. */
.otp-node.has-value .node-face { border-color: rgba(122, 245, 232, 0.6); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22), 0 0 12px rgba(61, 224, 208, 0.14); }
.otp-node.has-value .digit { color: #eef9ff; text-shadow: 0 0 10px rgba(122, 245, 232, 0.4); }
.otp-node.is-error .node-face { border-color: rgba(255, 120, 120, 0.72); background-color: #1a1214; box-shadow: 0 0 16px rgba(255, 100, 100, 0.3), 0 8px 22px rgba(0, 0, 0, 0.24); }
.otp-node.is-error .digit { color: #ffd0ce; }
.node-sheen { position: absolute; inset: 0; pointer-events: none; opacity: 0.18; background: linear-gradient(120deg, transparent 24%, rgba(127, 155, 243, 0.11) 48%, transparent 68%); transform: translateX(-72%); }
.otp-node.is-routing .node-sheen { animation: otpNodeSignal 840ms cubic-bezier(0.16, 1, 0.3, 1) infinite; }

.digit { position: relative; z-index: 2; font-size: 1.05rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; transform: translateZ(10px); transform-style: preserve-3d; }
.custom-caret { position: absolute; top: 50%; left: 50%; z-index: 3; width: 2px; height: 20px; border-radius: 99px; opacity: 0; background: var(--otp-purple-bright); transform: translate(-50%, -50%) scaleY(0.86); }
.verification-form.is-input-focused .otp-node.is-active .custom-caret, .verification-form.is-primed .otp-node.is-active .custom-caret { opacity: 1; animation: otpCaretBlink 1.06s steps(1, end) infinite; }
.verification-form.is-input-focused .otp-node.is-active .node-face, .verification-form.is-primed .otp-node.is-active .node-face { border-color: #6f8ff0; background-color: #151922; box-shadow: 0 0 16px rgba(79, 116, 232, 0.35), 0 8px 22px rgba(0, 0, 0, 0.24); }

.wire { position: absolute; top: 50%; left: 50%; z-index: 1; width: 0; height: 2.5px; border-radius: 999px; opacity: 0; pointer-events: none; background: linear-gradient(90deg, #3de0d0, #5f7fe8 42%, #a8baff 78%, #7af5e8); box-shadow: 0 0 6px rgba(61, 224, 208, 0.45), 0 0 14px rgba(79, 116, 232, 0.35); transform-origin: 0 50%; }
.wire span { position: absolute; top: 50%; left: 0; width: 34%; height: 5px; border-radius: 99px; opacity: 0; background: linear-gradient(90deg, transparent, #f0fffc 40%, #dce4ff 70%, transparent); box-shadow: 0 0 10px rgba(122, 245, 232, 0.85), 0 0 18px rgba(127, 155, 243, 0.55); transform: translate3d(0%, -50%, 0) scaleX(0.3); }
.wire.is-live span { opacity: 0.78; animation: otpWireSignal 920ms cubic-bezier(0.4, 0, 0.2, 1) infinite; }
.wire--1.is-live span { animation-delay: -150ms; } .wire--2.is-live span { animation-delay: -300ms; }
.wire--3.is-live span { animation-delay: -450ms; } .wire--4.is-live span { animation-delay: -600ms; } .wire--5.is-live span { animation-delay: -750ms; }

.collapse-core { position: absolute; top: 50%; left: 50%; z-index: 3; width: 30px; height: 30px; border-radius: 11px; opacity: 0; pointer-events: none; background: radial-gradient(circle, #d8ffeb 0, var(--otp-green-bright) 18%, rgba(43, 207, 139, 0.32) 45%, transparent 72%); box-shadow: 0 0 36px rgba(43, 207, 139, 0.4), 0 0 48px rgba(43, 207, 139, 0.35); transform: translate(-50%, -50%) scale(0) rotate(0deg); }

@keyframes otpCaretBlink { 0%, 47% { opacity: 1; transform: translate(-50%, -50%) scaleY(1); } 48%, 100% { opacity: 0; transform: translate(-50%, -50%) scaleY(0.72); } }
@keyframes otpTraceDraw { 0% { stroke-dashoffset: 100; opacity: 0.35; } 55% { opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 1; } }
@keyframes otpWireSignal { 0% { transform: translate3d(0%, -50%, 0) scaleX(0.3); opacity: 0; } 16% { opacity: 0.8; } 72% { opacity: 0.65; } 100% { transform: translate3d(233%, -50%, 0) scaleX(1); opacity: 0; } }
@keyframes otpNodeSignal { 0% { transform: translateX(-75%); } 55%, 100% { transform: translateX(78%); } }
@media (max-width: 420px) { html:root { --slot-size: 44px; } .otp-scene { height: 220px; } }
@media (prefers-reduced-motion: reduce) {
  .custom-caret, .node-trace-path, .wire span, .node-sheen { animation: none !important; }
}

/* -- Generic slot row (miintel-otp.js) -------------------------------------
   The enrolment scene in security.js positions its nodes absolutely for the
   wire choreography. A plain OTP field has no choreography, so its slots lay
   out as a simple flex row and override only the positioning. */
.mi-otp-form { width: 100%; }
.mi-otp-scene {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 2vw, 10px);
  height: auto;
  padding: 4px 0;
  perspective: none;
}
.mi-otp-scene .circuit-plane {
  position: static;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 2vw, 10px);
  width: 100%;
}
.mi-otp-scene .otp-node {
  position: relative;
  top: auto;
  left: auto;
  opacity: 1;
  transform: none;
}
/* A field longer than six characters (login.html's 10-character recovery
   code) folds into two equal rows at full slot size — it reads as 5 + 5.
   miintel-otp.js sets --mi-otp-cols to half the length. minmax(0, ...) lets a
   column narrow on a small phone instead of pushing the row out of the card,
   the same give the six-slot flex row has. */
.mi-otp-scene.is-two-row .circuit-plane {
  display: grid;
  grid-template-columns: repeat(var(--mi-otp-cols), minmax(0, var(--slot-size)));
  justify-content: center;
}
.mi-otp-scene.is-two-row .otp-node { width: 100%; }
.mi-otp-scene .otp-real-input {
  position: absolute;
  inset: 0;
  z-index: 20;
  width: 100%;
  height: 100%;
  /* A visible caret would sit alongside the drawn one. */
  color: transparent;
  caret-color: transparent;
  background: transparent;
  border: 0;
  text-align: center;
  letter-spacing: 2em;
}
.mi-otp-scene.is-error .node-face { border-color: rgba(255, 120, 120, 0.72); }

/* The real <input> is transparent and stretched across the slots, but two
   browser paints ignore its `color: transparent`:
     - the selection highlight (a paste, Ctrl+A, a double-click), because
       section 8's sitewide `::selection` sets `color: #fff`;
     - autofill (a password manager filling the TOTP code), which the browser
       paints in its own text colour.
   Either draws the input's OWN text on top of the row. That text is centred
   with `letter-spacing: 2em`, a ~54px pitch against the slots' 60px, so the
   ghost digits drift right of their slots and the last one lands past the
   sixth — reported 2026-09-14 on login.html's authenticator-code screen as
   "misaligned, cramped, the 6th box pushed outside the padding". The slots
   are the only thing allowed to paint here. Unprefixed `.otp-real-input` so
   portal.html's enrolment scene is covered too. One selector per rule: an
   unrecognised pseudo-class in a list drops the whole rule (CLAUDE.md). */
.otp-real-input { -webkit-text-fill-color: transparent; }
.otp-real-input::selection { background-color: transparent; color: transparent; -webkit-text-fill-color: transparent; }
/* The browser's autofill background is UA `!important` and cannot be
   overridden; a transition that never finishes keeps it from ever showing. */
.otp-real-input:-webkit-autofill { -webkit-text-fill-color: transparent; transition: background-color 600000s 0s, color 600000s 0s; }
.otp-real-input:autofill { -webkit-text-fill-color: transparent; transition: background-color 600000s 0s, color 600000s 0s; }


/* ============================================================================
   11. SITEWIDE SPACING & ALIGNMENT AUDIT  (Phase 5)
   ============================================================================
   Fixes for rhythm and alignment drift that accumulated across 15 independently
   written inline stylesheets. Each rule below addresses a class of problem
   found across multiple pages, not a one-off.

   Shell widths were also normalised at the page level from five ad-hoc values
   (1000 / 1100 / 1180 / 1240 / 1280px) down to a two-step scale:
     1040px  single-column form and list pages
     1280px  grid and dense-table pages
   ========================================================================= */

/* -- 1. Card / panel interior padding -------------------------------------
   Panels were padded anywhere from 12px to 24px depending on the page. One
   interior rhythm, applied where a page hasn't deliberately set its own. */
:where(body .card, body .panel, body .panel-card, body .control-card,
       body .health-panel, body .audit-panel, body .gold-card) {
  padding: var(--mi-s5);
  border-radius: var(--mi-r-lg);
}

/* -- 2. Section headings --------------------------------------------------
   `margin: 34px 0 16px` on some pages, `28px 0 14px` on others, and a few
   with no top margin at all — which made the first section crowd the hero. */
body .section-title {
  margin: var(--mi-s7) 0 var(--mi-s4);
  scroll-margin-top: var(--mi-s7);
}
body .section-title:first-of-type { margin-top: var(--mi-s6); }
body .section-note { margin: calc(var(--mi-s3) * -1) 0 var(--mi-s4); line-height: 1.55; }

/* -- 2b. Card grids size to their own content ----------------------------
   A CSS grid stretches every item in a row to the tallest one. In System
   Health that meant "Idle Timeout Policy" and "Require MFA" — two short
   cards — inherited the height of "Security Policy", which carries three
   fields and a long warning, leaving them mostly empty space. Each card now
   takes its natural height. */
/* stat/gold grids keep content-height cards. .controls-grid is deliberately
   NOT listed: System Health opts into equal-height rows in its own stylesheet
   (align-items: stretch + height: 100%), which is the look that page wants now
   that its longest card's copy has been condensed. */
body .stat-grid,
body .gold-grid {
  align-items: start;
}

/* The description inside a control card carries `flex-grow: 1`. While the grid
   stretched every card to the tallest, that growth was absorbed by the
   description — which is what opened the large hollow gap between the copy and
   the controls in the short cards. Natural height instead. */
body .control-card .control-desc { flex-grow: 0; }

/* Give the policy cards a consistent minimum so a very short one (a lone
   toggle) doesn't look stunted next to its neighbours, without forcing the
   tall ones to stretch anything. */
body .controls-grid > .control-card { min-height: 168px; }

/* -- 3. Grid gutters ------------------------------------------------------
   Card grids used 10px–24px gaps with no pattern. */
:where(body .grid, body .pubs-grid, body .stat-grid, body .gold-grid,
       body .controls-grid, body .tiles) {
  gap: var(--mi-s4);
}

/* -- 4. Stacked list rhythm ----------------------------------------------- */
:where(body .pub-admin-list, body .notif-list, body .audit-list) { gap: var(--mi-s2); }

/* -- 5. Vertical alignment in flex rows -----------------------------------
   Rows mixing an icon, a text block and a button rendered with the icon
   baseline-aligned to the first line instead of centred on the row. */
body .user-zone,
body .user-chip,
body .brand,
body .pw-alert,
body .section-title { align-items: center; }

/* Icons in headings/alerts sat 1–2px high against their text. */
body .section-title i,
body .pw-alert i { line-height: 1; flex-shrink: 0; }

/* -- 6. Form field rhythm -------------------------------------------------
   Both rules are :where()-scoped. At full weight they overrode page-owned form
   layout: every <label> got a bottom margin — including labels inside flex
   `.field-head` rows and labels wrapping a checkbox — which pushed those rows
   out of alignment. They now only fill in where a page specifies nothing. */
:where(body .field + .field) { margin-top: var(--mi-s4); }
:where(body .field > label, body .field-head > label) {
  display: inline-block;
  margin-bottom: var(--mi-s2);
  line-height: 1.4;
}
/* A label that wraps its own control is a row, not a heading. */
:where(body label:has(input, select, textarea)) {
  display: inline-flex;
  align-items: center;
  gap: var(--mi-s2);
  margin-bottom: 0;
}

/* -- 5b. List row title/subtitle rhythm -----------------------------------
   4px between a row title and its description read as cramped wherever the
   pattern is used (Module Access rows most visibly). */
body .pub-admin-row .pat { margin-bottom: 7px; }
body .pub-admin-row .pad { line-height: 1.55; }

/* -- 5b2. Panel-card caption spacing --------------------------------------
   `.pub-sub` carries `margin: -8px 0 18px` so a caption tucks under a heading
   that has its own bottom margin. Under `.panel-card-head` (margin-bottom 6px)
   the two cancel out to MINUS 2px — the description sits 2px on top of its own
   title. Every "Designations & Access" panel reads cramped for this reason. */
body .panel-card-head + .pub-sub,
body .panel-card-title + .pub-sub {
  margin-top: var(--mi-s2);
  line-height: 1.6;
}

/* Titles get a little air of their own so the pairing reads as a unit. */
body .panel-card-head { margin-bottom: var(--mi-s2); }
body .panel-card-title { line-height: 1.35; }

/* -- 5c. Boxed notes ------------------------------------------------------
   `.pub-sub` carries `margin: -8px 0 18px` so a plain caption tucks up under
   its heading. When the same class is used for a BOXED note (border +
   background), that negative margin drags the box up into the heading above
   it — the "How inherited access works" panel overlapped its own title by 2px.
   A bordered/filled .pub-sub is a box, not a caption, so it gets normal flow. */
body .pub-sub[style*="border"] {
  margin-top: var(--mi-s2);
  margin-bottom: var(--mi-s4);
  padding: var(--mi-s3) var(--mi-s4);
  line-height: 1.6;
}

/* -- 6b. Dividers ---------------------------------------------------------
   One divider look, and one that is actually visible against the surfaces. */
body hr,
body .divider,
body .sep {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
  margin: var(--mi-s6) 0;
}

/* -- 7. Long-content overflow --------------------------------------------
   Emails, storage paths and publication titles overflowed their containers
   on narrow viewports rather than wrapping, pushing the page sideways. */
body .user-chip span,
body .pub-admin-row .pat,
body .notif-title { min-width: 0; overflow-wrap: anywhere; }

/* Tables are the one thing that must scroll rather than wrap. */
body .table-wrap,
body .audit-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* -- 8. Trailing-element margin collapse ----------------------------------
   A card's last child kept its bottom margin, making padding look uneven. */
body .card > :last-child,
body .panel > :last-child,
body .panel-card > :last-child,
body .control-card > :last-child { margin-bottom: 0; }

/* -- 9. Floating-widget clearance -----------------------------------------
   The chat and search pills sit bottom-left over page content. They used to
   be cleared here, with 150px under every .shell. Since the sitewide footer
   (miintel-appbar.css) the FOOTER is that clearance: 48px of margin, 20px of
   padding, a line of text and 40px more, ~127px against the pills' 132px
   reach. Both together left 198px of nothing between the last card and the
   footer rule on every admin page (measured 2026-10-01). So the shell keeps
   only a short tail of its own, the value the Main Portal already used. */
body .shell { padding-bottom: var(--mi-shell-tail); }
/* ...and the last block's own bottom margin would add to it, page by page
   (16px under System Health's last note, 34px under the PIP manager's last
   section), so the tail is the only space there is. */
body .shell > :last-child,
body .shell > :last-child > :last-child { margin-bottom: 0; }

/* -- 10. Decorative overflow guard ----------------------------------------
   Ambient orbs and glows are `position: fixed` with negative offsets, and a
   fixed element is positioned against the viewport — so `overflow-x: hidden`
   on <body> (which several pages already set) does NOT clip them. They were
   adding real horizontal scroll: dashboard.html scrolled 140px sideways
   purely because of a decorative gold orb at `right: -140px`.

   Clipped at the root, where fixed descendants actually are clipped. `clip`
   rather than `hidden` on purpose: `hidden` makes the root a scroll container,
   which silently breaks `position: sticky` and scroll anchoring inside it.
   `hidden` is listed first only as a fallback for engines without `clip`. */
html {
  overflow-x: hidden;
  overflow-x: clip;
}

/* -- 11. Responsive ------------------------------------------------------- */
@media (max-width: 720px) {
  html:root { --mi-section-gap: var(--mi-s5); }
  body .shell > header,
  body header.glass { padding: var(--mi-s3) var(--mi-s4); }
  :where(body .card, body .panel, body .panel-card, body .control-card,
         body .health-panel, body .audit-panel) { padding: var(--mi-s4); }
  body .section-title { margin-top: var(--mi-s6); }
}


/* ============================================================================
   12. ALERTS + OTP MOTION  (ported from the otp-verification pack)
   ============================================================================
   The alert surface was a flat tinted rectangle. This gives it the pack's
   layered treatment — a tinted field, a coloured accent edge, an icon well and
   a slow sheen — plus the rotating conic "energy rim" (cardRimSpin in the
   reference) that the OTP card uses while it is working.
   ========================================================================= */

body .pw-alert,
body .alert {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  align-items: flex-start;
  gap: var(--mi-s3);
  padding: var(--mi-s3) var(--mi-s4);
  border-radius: var(--mi-r-md);
  line-height: 1.5;
  animation: miAlertIn 380ms var(--mi-ease-out);
}

/* Accent edge — colour comes from the state class below. */
body .pw-alert::before,
body .alert::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--mi-alert-accent, var(--muted));
}

/* Slow diagonal sheen, straight from the pack's notificationSheen. */
body .pw-alert::after,
body .alert::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.06) 46%, transparent 68%);
  transform: rotate(20deg) translateX(-180%);
  animation: miAlertSheen 4.2s ease-in-out 600ms infinite;
}

body .pw-alert i,
body .alert i { margin-top: 1px; font-size: 0.95rem; }

body .pw-alert.error,   body .alert.alert-error   { --mi-alert-accent: var(--mi-rose); }
body .pw-alert.success, body .alert.alert-success { --mi-alert-accent: var(--good); }
body .pw-alert.info,    body .alert.alert-info    { --mi-alert-accent: var(--cyan); }

@keyframes miAlertIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.99); }
  to   { opacity: 1; transform: none; }
}
@keyframes miAlertSheen {
  0%, 62%   { transform: rotate(20deg) translateX(-180%); }
  82%, 100% { transform: rotate(20deg) translateX(560%); }
}

/* -- Energy rim: REMOVED ---------------------------------------------------
   A rotating conic ring used to overlay the whole OTP row at z-index 21. It
   painted over the slots (z-index 4) and their perimeter traces (z-index 6),
   so verifying showed one bright streak circling the row instead of the six
   slot traces — and the reference never renders such a rim anyway
   (`cardRimSpin` is declared there and applied to nothing). Do not add an
   overlay above z-index 6 across this row; it will hide the trace.
   -------------------------------------------------------------------------- */

/* -- OTP slot error state -------------------------------------------------
   A rejected code should be visible on the slots themselves, not only in the
   alert above them. */
/* Error state: the per-slot BORDER carries it, nothing else.
   The 3px `box-shadow` ring this used to add was the "double border" — slots
   sit 10px apart, so two adjacent 3px rings filled 6px of every gap and the
   six separate outlines read as one continuous rectangle enclosing the whole
   row, exactly as if a parent wrapper had been outlined. Keep any glow here
   well inside half the inter-slot gap, or it will merge again. */
/* NOTE the selector list: MIOtp.setError() sets `is-error` on the scene AND on
   every .otp-node, so section 10's `.otp-node.is-error .node-face` (same
   specificity, earlier in this file) also matches. Both are listed here so the
   ring is removed whichever one the cascade lands on. */
.mi-otp-scene.is-error .node-face,
.mi-otp-scene .otp-node.is-error .node-face,
.otp-node.is-error .node-face {
  border-color: rgba(255, 120, 120, 0.85);
  background-color: #1a1214;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.24);
}

/* Belt and braces: nothing in the OTP subtree may draw a box of its own.
   The real <input> is stretched across the whole slot row, so a stray border
   or focus ring on it renders as a full-width box around all six slots. */
.mi-otp-scene .otp-real-input,
.mi-otp-scene .otp-real-input:focus,
.mi-otp-scene .otp-real-input:focus-visible,
.mi-otp-scene .otp-real-input:invalid,
body .input-wrap:has(.mi-otp-form),
body .mi-otp-form,
body .mi-otp-scene {
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
  background-color: transparent !important;
}
.mi-otp-scene.is-error .digit { color: #ffd0ce; }
.mi-otp-scene.is-error { animation: miOtpShake 420ms cubic-bezier(0.36, 0.07, 0.19, 0.97); }

@keyframes miOtpShake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

@media (prefers-reduced-motion: reduce) {
  body .pw-alert, body .alert,
  body .pw-alert::after, body .alert::after,
  .mi-otp-scene.is-error { animation: none !important; }
}


/* ============================================================================
   13. LOADING / VERIFYING MOTION
   ============================================================================
   A smooth conic ring rather than the 2px border-top trick, which visibly
   steps at small sizes. Pairs with the OTP scene's rotating energy rim so a
   code submission reads as one continuous "working" state.
   ========================================================================= */

/* EVERY spinner class in the app, not just `.spinner`.
   The change-password modal uses `.pw-spinner` and the profile form uses it
   too, so a rule written only for `.spinner` styled the login page and left
   the portal modal on the old stepped border-top spinner — which read as "the
   animation never runs". Add any new spinner class here. */
body .spinner,
body .pw-spinner,
body .mi-spinner {
  width: 16px;
  height: 16px;
  border: 0 !important;                       /* replaces the border-top spinner */
  border-radius: 50%;
  flex-shrink: 0;
  background: conic-gradient(from 0deg, transparent 0deg, currentColor 300deg, currentColor 360deg);
  /* Masked to a ring so the gradient reads as a stroke, not a filled disc. */
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
  animation: miSpin 0.7s linear infinite;
}

@keyframes miSpin { to { transform: rotate(360deg); } }

/* The whole button dims slightly and stops responding to hover while working,
   so the spinner is clearly the active element. */
body .btn.is-verifying {
  cursor: progress;
  opacity: 0.9;
}

/* Disabled buttons are dimmed to 0.55 elsewhere; while verifying, the button
   must stay legible enough for the sweep and spinner to be visible. */
body .btn.is-verifying:disabled,
body .btn.is-verifying[disabled] {
  opacity: 0.92;
}
body .btn.is-verifying:hover { transform: none; }

/* A slow sweep across the button reinforces that something is in flight. */
body .btn.is-verifying::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.14) 50%, transparent 70%);
  background-size: 220% 100%;
  animation: miVerifySweep 1.25s ease-in-out infinite;
}

@keyframes miVerifySweep {
  from { background-position: 180% 0; }
  to   { background-position: -80% 0; }
}

@media (prefers-reduced-motion: reduce) {
  body .spinner,
  body .pw-spinner,
  body .mi-spinner,
  body .btn.is-verifying::after { animation: none !important; }
}

/* ============================================================================
   §15  DROPZONE  (Dropzone reference integration)
   ============================================================================

   Upgrades the existing `label.pub-dropzone` on admin-publications.html and
   admin-media-manage.html. Enhanced by miintel-dropzone.js; the markup and the
   pages' own file-handling wiring are untouched, so with JS off (or the script
   absent) the zone still renders and still works as a plain <label for>.

   Page rules are `.pub-dropzone` (0,0,1,0) in an inline <style> parsed AFTER
   this file, so everything here carries the `body ` prefix (0,0,1,1) to win —
   the same convention the rest of this file uses.

   THE PICTURE IS THE PROGRESS BAR
   -------------------------------
   The reference's signature move: instead of a bar next to a thumbnail, the
   thumbnail itself uncovers as the bytes land. Two stacked copies of the same
   image — a dim greyscale "ghost" underneath, the full-colour "live" one on
   top clipped to var(--p). `--p` must be a REGISTERED custom property or it
   cannot be transitioned: an unregistered one is a raw token, so it would jump
   0 -> 1 with no interpolation.
   ========================================================================= */

@property --p {
  syntax: '<number>';
  inherits: true;
  initial-value: 0;
}

/* -- the zone itself ------------------------------------------------------ */
/* position/overflow are needed for the liquid fill layer below. */
body .pub-dropzone {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

/* The liquid fill — clip-path sweeping up from the bottom edge. Transitioning
   clip-path (not height) means the wash never reflows the zone's contents. */
body .pub-dropzone::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.20), rgba(139, 92, 246, 0.16));
  clip-path: inset(100% 0 0 0);
  transition: clip-path 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
body .pub-dropzone.drag::before,
body .pub-dropzone.is-dragging::before {
  clip-path: inset(0 0 0 0);
}

/* The icon lifts and brightens while a file is over the zone. */
body .pub-dropzone i {
  transition: transform var(--ease), color var(--ease);
}
body .pub-dropzone.drag i,
body .pub-dropzone.is-dragging i {
  transform: translateY(-4px) scale(1.12);
}

/* -- the chosen-file card ------------------------------------------------- */
body .mi-dz-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--panel-strong);
  /* --p is transitioned HERE, on the element the script writes it to; the
     thumb below just reads the inherited value. Animating the registered
     property itself (rather than the dependent clip-path) is the whole reason
     it is registered -- see the @property note at the top of this section. */
  transition: border-color var(--ease), background var(--ease), --p 0.35s linear;
}
body .mi-dz-card.is-error {
  border-color: rgba(251, 113, 133, 0.45);
  background: rgba(251, 113, 133, 0.10);
}
body .mi-dz-card.is-done {
  border-color: rgba(52, 211, 153, 0.38);
}

/* thumb: ghost + live, stacked in one grid cell */
body .mi-dz-thumb {
  position: relative;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  display: grid;
  place-items: center;
}
body .mi-dz-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* the dark, not-yet-arrived one */
body .mi-dz-thumb img.ghost { filter: grayscale(1) brightness(0.32); }
/* ...and the real one, uncovered exactly as far as the bytes have got.
   No transition on this rule: --p is what animates (on the card above), and
   the clip simply follows it. Transitioning both would cross-fade the clip
   over its own tween. */
body .mi-dz-thumb img.live {
  clip-path: inset(calc((1 - var(--p)) * 100%) 0 0 0);
}
/* non-image files get an icon that fills with colour on the same --p */
body .mi-dz-thumb .mi-dz-glyph {
  font-size: 1.05rem;
  color: var(--faint);
  transition: color var(--ease);
}
body .mi-dz-card.is-done .mi-dz-glyph { color: var(--good); }
body .mi-dz-card.is-error .mi-dz-glyph { color: #fb7185; }

body .mi-dz-meta { min-width: 0; flex: 1; }
body .mi-dz-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body .mi-dz-sub {
  font-size: 0.7rem;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 2px;
}
body .mi-dz-card.is-error .mi-dz-sub { color: #fb7185; }
body .mi-dz-card.is-done .mi-dz-sub { color: var(--good); }

body .mi-dz-remove {
  flex: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.75rem;
  transition: color var(--ease), border-color var(--ease), background var(--ease);
}
body .mi-dz-remove:hover {
  color: #fb7185;
  border-color: rgba(251, 113, 133, 0.45);
  background: rgba(251, 113, 133, 0.10);
}
body .mi-dz-remove:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  body .pub-dropzone::before,
  body .mi-dz-card { transition: none !important; }
  body .pub-dropzone.drag i,
  body .pub-dropzone.is-dragging i { transform: none; }
}

/* ============================================================================
   §16  AUTH VIEW WIPE  (Flow reference integration)
   ============================================================================

   login.html swaps six <section data-view> panes (sign in, sign up, activation
   code, forgot, reset, 2FA challenge) through showView(), which just toggles
   `hidden`. This wipes each pane's rows in on arrival instead of having them
   pop, which is the Flow reference's signature move.

   NO JS CHANGES. A CSS animation runs whenever its element starts matching the
   selector, and `:not([hidden])` starts matching the moment showView() clears
   the attribute — so switching views replays the wipe, every time, for free.

   The clip insets are NEGATIVE on the three settled edges (-10% rather than 0)
   so the animation never crops a row's own focus ring, glow or box-shadow: the
   clip rectangle stays outside the painted area except on the edge actually
   doing the wiping. Only the bottom edge travels, 100% -> -10%.

   Rows also carry a small translate so the wipe reads as the row arriving
   rather than a mask sliding over a stationary row. It uses `translate:` (the
   individual property) NOT `transform:`, for the same reason fx.js does — so
   it can never overwrite a transform the page or another script set. See the
   fx.js safety contract.
   ========================================================================= */

body [data-view]:not([hidden]) > form > * {
  animation: miAuthWipe 0.62s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Stagger. Eight is past the longest pane (sign-up: 4 fields + button + two
   links); anything beyond simply lands on the last step rather than trailing
   further and further behind. */
body [data-view]:not([hidden]) > form > *:nth-child(1) { animation-delay: 0.02s; }
body [data-view]:not([hidden]) > form > *:nth-child(2) { animation-delay: 0.07s; }
body [data-view]:not([hidden]) > form > *:nth-child(3) { animation-delay: 0.12s; }
body [data-view]:not([hidden]) > form > *:nth-child(4) { animation-delay: 0.17s; }
body [data-view]:not([hidden]) > form > *:nth-child(5) { animation-delay: 0.22s; }
body [data-view]:not([hidden]) > form > *:nth-child(6) { animation-delay: 0.27s; }
body [data-view]:not([hidden]) > form > *:nth-child(7) { animation-delay: 0.31s; }
body [data-view]:not([hidden]) > form > *:nth-child(n + 8) { animation-delay: 0.35s; }

@keyframes miAuthWipe {
  from {
    clip-path: inset(-10% -10% 100% -10%);
    translate: 0 10px;
    opacity: 0;
  }
  to {
    clip-path: inset(-10% -10% -10% -10%);
    translate: 0 0;
    opacity: 1;
  }
}

/* The wipe must never be the reason a field cannot be reached. `both` holds
   the from-state during the delay, so if animations are off the row would sit
   clipped and invisible forever — hence an explicit reset rather than just
   `animation: none`. */
@media (prefers-reduced-motion: reduce) {
  body [data-view]:not([hidden]) > form > * {
    animation: none !important;
    clip-path: none;
    translate: none;
    opacity: 1;
  }
}

/* ── Session avatar in the header user chip ─────────────────────────────────
   guard.js populates every [data-session-avatar] <img> sitewide with a signed
   URL for the user's uploaded photo, and hides the sibling icon marked
   [data-session-avatar-fallback]. Only portal.html and dashboard.html carried
   that markup, so on every admin page the uploaded photo simply never appeared
   — the mechanism was there, the hooks were not. The chip markup is identical
   across those pages, so ONE rule here covers all of them rather than twelve
   near-copies in twelve inline stylesheets. */
body .mi-chip-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;      /* never letterbox or stretch a portrait */
  flex-shrink: 0;
  display: block;
  border: 1px solid var(--border);
}

/* ============================================================================
   §18  CLOSE CONTROLS  (one dismiss gesture, everywhere)
   ============================================================================

   ONE definition of what a close button does under the pointer, for every
   close control in the app.

   The gesture already existed and was liked: kpi-dashboard.html's
   `#branchProfileModal .bpx-close` — a soft disc that turns red and rotates a
   quarter turn on hover, then presses in on click, on a spring curve that
   makes the quarter turn read as a flick rather than a slide. It had been
   copied once already, into cluster-kpi.css's .mi-modal-close, where its own
   comment calls it "the sitewide standard". It was not: eleven other close
   controls across the app each had their own idea, ranging from a colour
   change to nothing at all.

   So it is promoted here rather than copied a third time. Same reasoning as
   §17 — a gesture maintained as N hand-kept copies is a gesture that has
   already drifted, it just has not been noticed yet.

   WHAT THIS RULE DOES AND DOES NOT SET
   It sets the MOTION and the hover COLOUR only. It deliberately does not set
   size, radius, background or position: those are per-surface (a 26px square
   in the notification tray, a 36px disc on a light report panel, a 34px
   rounded square in the IQ arena) and each page's own rule stays in charge of
   them. Only the resting look is left alone; the hover state is unified.

   `body ` prefix on every selector, per this file's convention: each page
   declares its own `.modal-close` / `.mi-chat-close` at (0,0,1,0) or its hover
   at (0,0,2,0), and several of those live in <style> blocks parsed AFTER this
   file — including the ones chat.js, command-palette.js and iq-arena.js inject
   at runtime. The extra element bumps this to (0,0,2,1)/(0,0,3,0) so source
   order stops deciding.

   `.bpx-close` is in the list for the cluster scorecard's benefit, but note
   that on kpi-dashboard.html the original is scoped `#branchProfileModal
   .bpx-close` (1,0,2,0) and keeps winning — which is fine, because that IS
   this gesture. Nothing needs to beat it.

   ONE SELECTOR PER RULE for the transform reset at the bottom, for the reason
   both KPI dashboards paid for once: in a plain comma-separated list a single
   selector the engine does not recognise invalidates the ENTIRE rule, every
   declaration for every selector in it. These are all plain class selectors so
   the risk is nil today, but the list is the thing that grows.

   [data-mi-close] is the hook for anything new: put it on a close control and
   it joins in without editing this list. */

body .modal-close,
body .mi-modal-close,
body .iq-modal-close,
body .bpx-close,
body .notif-close,
body .mi-chat-close,
body .mi-cmdk-close,
body .mi-iq-close,
body .mi-iq-toast-close,
body [data-mi-close] {
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              background 0.25s ease,
              color 0.25s ease,
              border-color 0.25s ease;
}

/* The quarter turn plus the red. :focus-visible gets it too — a keyboard user
   dismissing a dialog should see the same affordance a pointer user does.

   The red is stated as a literal rather than a token on purpose: this file is
   loaded by the dark portal AND by the three light report surfaces, and
   #ef4444 on rgba(239,68,68,.10) is legible on both. A token would have to be
   defined on every page, and the pages that repoint the palette (briefing.html's
   gold, the KPI navy) would each shift it somewhere different — which is
   exactly the drift this section exists to end.

   background is `background-color`, not the `background` shorthand: several of
   these controls carry a background-IMAGE or a gradient from their own page's
   rule, and the shorthand would wipe it. */
body .modal-close:hover,
body .modal-close:focus-visible,
body .mi-modal-close:hover,
body .mi-modal-close:focus-visible,
body .iq-modal-close:hover,
body .iq-modal-close:focus-visible,
body .bpx-close:hover,
body .bpx-close:focus-visible,
body .notif-close:hover,
body .notif-close:focus-visible,
body .mi-chat-close:hover,
body .mi-chat-close:focus-visible,
body .mi-cmdk-close:hover,
body .mi-cmdk-close:focus-visible,
body .mi-iq-close:hover,
body .mi-iq-close:focus-visible,
body .mi-iq-toast-close:hover,
body .mi-iq-toast-close:focus-visible,
body [data-mi-close]:hover,
body [data-mi-close]:focus-visible {
  transform: rotate(90deg);
  color: #ef4444;
  background-color: rgba(239, 68, 68, 0.10);
  border-color: rgba(239, 68, 68, 0.28);
}

/* The press. Holds the rotation so the button does not unwind under the
   finger, and shortens the duration so the response feels immediate. */
body .modal-close:active,
body .mi-modal-close:active,
body .iq-modal-close:active,
body .bpx-close:active,
body .notif-close:active,
body .mi-chat-close:active,
body .mi-cmdk-close:active,
body .mi-iq-close:active,
body .mi-iq-toast-close:active,
body [data-mi-close]:active {
  transform: rotate(90deg) scale(0.9);
  transition-duration: 0.1s;
}

/* Several of these controls hold their glyph in an <i> or an inline <svg> that
   carries its own colour. Inheriting the red is what makes the whole control
   turn, rather than a red ring around a grey cross. `stroke` is for the inline
   SVGs drawn with stroke="currentColor" as a PRESENTATION attribute — CSS
   beats a presentation attribute, and without this line those glyphs would
   keep their original stroke while the box around them reddened. */
body .modal-close:hover i,
body .modal-close:hover svg,
body .mi-modal-close:hover i,
body .mi-modal-close:hover svg,
body .iq-modal-close:hover i,
body .iq-modal-close:hover svg,
body .bpx-close:hover i,
body .bpx-close:hover svg,
body .notif-close:hover i,
body .notif-close:hover svg,
body .mi-chat-close:hover i,
body .mi-chat-close:hover svg,
body .mi-cmdk-close:hover i,
body .mi-cmdk-close:hover svg,
body .mi-iq-close:hover i,
body .mi-iq-close:hover svg,
body .mi-iq-toast-close:hover i,
body .mi-iq-toast-close:hover svg,
body [data-mi-close]:hover i,
body [data-mi-close]:hover svg {
  color: inherit;
  stroke: currentColor;
}

/* No rotation for a reader who has asked for less motion. The colour change
   stays — it is the part that carries the meaning. One selector per rule, per
   the note above. */
@media (prefers-reduced-motion: reduce) {
  body .modal-close { transition: background 0.25s ease, color 0.25s ease; }
  body .mi-modal-close { transition: background 0.25s ease, color 0.25s ease; }
  body .iq-modal-close { transition: background 0.25s ease, color 0.25s ease; }
  body .bpx-close { transition: background 0.25s ease, color 0.25s ease; }
  body .notif-close { transition: background 0.25s ease, color 0.25s ease; }
  body .mi-chat-close { transition: background 0.25s ease, color 0.25s ease; }
  body .mi-cmdk-close { transition: background 0.25s ease, color 0.25s ease; }
  body .mi-iq-close { transition: background 0.25s ease, color 0.25s ease; }
  body .mi-iq-toast-close { transition: background 0.25s ease, color 0.25s ease; }
  body [data-mi-close] { transition: background 0.25s ease, color 0.25s ease; }

  body .modal-close:hover { transform: none; }
  body .mi-modal-close:hover { transform: none; }
  body .iq-modal-close:hover { transform: none; }
  body .bpx-close:hover { transform: none; }
  body .notif-close:hover { transform: none; }
  body .mi-chat-close:hover { transform: none; }
  body .mi-cmdk-close:hover { transform: none; }
  body .mi-iq-close:hover { transform: none; }
  body .mi-iq-toast-close:hover { transform: none; }
  body [data-mi-close]:hover { transform: none; }

  body .modal-close:active { transform: none; }
  body .mi-modal-close:active { transform: none; }
  body .iq-modal-close:active { transform: none; }
  body .bpx-close:active { transform: none; }
  body .notif-close:active { transform: none; }
  body .mi-chat-close:active { transform: none; }
  body .mi-cmdk-close:active { transform: none; }
  body .mi-iq-close:active { transform: none; }
  body .mi-iq-toast-close:active { transform: none; }
  body [data-mi-close]:active { transform: none; }
}


/* ============================================================================
   §17  NAVIGATION TRANSITION OVERLAY  (page handover)
   ============================================================================

   ONE definition of the full-screen loading state that covers a page handover.
   It lives here rather than in each page's inline block because the whole
   point of it is that the overlay the ORIGIN page raises and the overlay the
   DESTINATION page boots behind are pixel-identical — otherwise the reader
   counts two loading screens across one navigation.

   That was a real, reported bug on Morning Briefing -> Gold Dashboard. Both
   pages already showed "a gold ring on a dark radial ground", but from two
   hand-maintained copies that had drifted: 54px ring vs 52px, 22px gap vs
   20px, a #06060f outer ground vs #04081f, a #97a3c6 label vs #8fa3c8, and
   two different captions ("Opening Full Dashboard" then "Loading Dashboard").
   Every one of those redraws at the boundary, and the caption change alone is
   enough to read as a second screen. Same failure the 15-inline-stylesheets
   attempt produced elsewhere in this project: a sitewide look is not
   maintainable as N copies.

   Colours are HARDCODED, deliberately, and must stay that way. dashboard.html
   is a light surface that repoints --bg/--text/--muted on html:root, so a
   token-driven overlay would come out white on exactly one side of the
   handover and destroy the continuity this section exists to provide.

   Four properties, each one a bug this codebase has already paid for once:

   - The resting state is VISIBLE and only the EXIT is animated. An overlay
     that animates in from opacity:0 is invisible-but-covering forever in a tab
     that is not compositing — see #kpiBoot and .mi-head::after.
   - Nothing waits on a frame. The ring's spin is decorative; no value on the
     page is produced by an animation or a rAF callback.
   - `visibility` rides along with the opacity so a faded-out overlay stops
     hit-testing even in the window before miintel-nav.js removes it. An
     invisible full-screen element still swallows every click.
   - z-index 100059: above every page surface and the entire widget ladder
     (modals 100005, notifications 100010, select panels 100050), and
     deliberately ONE BELOW guard.js's idle lock at 100060, which stays
     topmost exactly as the sitewide scale specifies.
   ========================================================================= */

.mi-navload {
  position: fixed;
  inset: 0;
  z-index: 100059;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: radial-gradient(circle at 50% 42%, #0a1030, #04081f 72%);
  opacity: 1;
  visibility: visible;
}

/* Exit only. CSS applies the after-change style's transition, so ADDING this
   class fades the overlay out while raising the overlay (removing it, or
   creating the element) is instant — which is what makes the origin page's
   overlay appear on the same tick as the click. */
.mi-navload.is-hiding {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.mi-navload-ring {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid rgba(232, 197, 90, 0.16);
  border-top-color: #e8b820;
  border-right-color: #f5d97a;
  box-shadow: 0 0 34px rgba(232, 184, 32, 0.35);
  animation: miNavSpin 0.9s linear infinite;
}

.mi-navload-text {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #8fa3c8;
  text-align: center;
  padding: 0 24px;
}

/* Secondary progress line. EMPTY at rest, and that matters: the caption above
   it must not change across a handover (a caption that changes is on its own
   enough to read as a second loading screen), so live progress goes here
   instead of overwriting it. A page with nothing to report simply never writes
   to it and the row collapses to nothing.

   min-height reserves the row so the ring and caption do not jump down the
   moment the first status arrives. */
.mi-navload-status {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #6b7ba8;
  text-align: center;
  padding: 0 24px;
  min-height: 1.1em;
  margin-top: -8px;   /* pull under the caption, inside the flex gap */
}

@keyframes miNavSpin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .mi-navload-ring { animation: none; }
  .mi-navload.is-hiding { transition: none; }
}


/* ============================================================================
   §19  DOWNLOAD / EXPORT CONTROLS  (one liquid-fill gesture, everywhere)
   ============================================================================

   Every "Download" / "Export" control in MIIntel is the same button: a liquid
   rises through it while the file is being produced, and the arrow becomes a
   checkmark when it lands. Upgraded by miintel-download.js — read that file
   for the state machine and the progress contract.

   WHY THIS IS ONE DEFINITION AND NOT FIVE
   ---------------------------------------
   The same argument as §17 (the handover overlay) and §18 (the close gesture):
   N hand-kept copies of a gesture have already drifted, it just has not been
   noticed yet. Before this section the five download controls in the app
   agreed on nothing — audit.html swapped its label to "Exporting…" (and, by
   assigning textContent, permanently ATE its own <i> icon on the first click),
   admin-iq.js said "Preparing…", health.js and security.js said nothing at
   all and gave no sign the click had registered.

   THE `body ` PREFIX, AS EVERYWHERE ELSE IN THIS FILE
   ---------------------------------------------------
   §3 declares `body .btn:hover:not(:disabled)` at (0,0,3,1) and
   `body .btn[aria-disabled="true"]` at (0,0,2,1). The rules below that have to
   beat those match their specificity exactly and win on source order, being
   later in this same file. Do not "simplify" the `body ` off them.

   WHY REAL ELEMENTS AND NOT ::before / ::after
   --------------------------------------------
   Both pseudo-elements on .btn are already spoken for: §13 uses ::after for
   the .is-verifying sweep, and several pages declare their own ::before sheen
   (dashboard.html's header actions, cluster-kpi.css's .mi-btn). The liquid
   also needs an <svg> for the wave, which a pseudo-element cannot hold. So
   miintel-download.js injects real children.

   It injects them into its own wrapper and styles ONLY the elements it
   created — never a blanket `.mi-dl > *` rule. miintel-fx.js carries the note
   explaining why: an earlier version of that file forced position/z-index onto
   every child of every .btn and silently re-positioned children that were
   absolutely positioned or relied on static flow (the "duplicated/overlapping
   text" glitch). Style what you created, nothing else.
   ========================================================================= */

/* The fill level, 0 → 1. REGISTERED so it can be transitioned: an unregistered
   custom property is a raw token, so the liquid would JUMP from empty to full
   instead of rising. §15 registers --p for the dropzone thumb; this is a
   separate name on purpose, because both can be on screen at once and one
   shared name would make one component drive the other.

   Where @property is unsupported the declaration is ignored, the property
   stays unregistered, and the liquid steps rather than rises. Every state
   still resolves correctly — the fill is decoration, per the note below. */
@property --mi-dl-p {
  syntax: '<number>';
  inherits: true;
  initial-value: 0;
}

/* --mi-dl-dur is written by the script so one ramp can be slow (the 1.5s
   minimum fill) and a progress step can be quick, without two competing
   transition declarations fighting over the same property.

   THE THREE-SELECTOR LIST IS NOT TIDINESS — COUNT THE ELEMENTS.
   §3 declares this component's base as a LIST:

       body .btn, body button.btn, body a.btn { overflow: visible; transition: … }

   and a <button> matches the SECOND of those at (0,0,1,2) — two element
   selectors, not one. A lone `body .mi-dl` is (0,0,1,1) and loses to it
   outright, source order be damned. Written that way this block silently lost
   BOTH of its declarations on every real button: overflow stayed `visible`, so
   the 200%-wide wave painted straight out of the button and across the page
   (verified in-browser — the waves ran over the neighbouring controls), and
   the `--mi-dl-p` transition was dropped, so the liquid JUMPED to its level
   instead of rising, which is the entire component.

   Mirroring §3's own shape ties the count at (0,0,1,2) and source order —
   later in this same file — settles it. Any future rule here that has to beat
   the base .btn block needs the same treatment; the hover block further down
   is the other one. */
body .mi-dl,
body button.mi-dl,
body a.mi-dl {
  --mi-dl-dur: 240ms;
  --mi-dl-p: 0;
  /* Clips the liquid to the button's own rounded rect. Safe next to
     .btn.primary's permanent outer halo: an outer box-shadow is painted
     outside the border box and overflow does not clip it. */
  overflow: hidden;
  transition:
    transform var(--mi-dur) var(--mi-ease-out),
    border-color var(--mi-dur) ease,
    background-color var(--mi-dur) ease,
    box-shadow var(--mi-dur) ease,
    color var(--mi-dur) ease,
    --mi-dl-p var(--mi-dl-dur) linear;
}

/* -- the liquid ----------------------------------------------------------- */
/* height IS the true fill value, assigned synchronously by the script. The
   transition above is the only thing that makes it rise; in a tab that is not
   compositing it simply arrives at the right height with no frames painted,
   which is the whole requirement for an animated indicator in this codebase. */
body .mi-dl .mi-dl-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--mi-dl-p) * 100%);
  z-index: 0;
  pointer-events: none;
  background-image: linear-gradient(180deg, var(--cyan) 0%, var(--violet) 100%);
  /* HIDDEN AT REST, and this is not belt-and-braces — an empty glass is not an
     invisible one. The wave sits at `bottom: 100%` of this layer, i.e. ON its
     surface; at --mi-dl-p: 0 the layer has zero height, so its surface is the
     button's bottom edge and the 9px wave renders UPWARD into the button. An
     idle "Download CSV" button was therefore sitting there with a cyan tide
     line across the bottom of it (seen in a screenshot, not reasoned about).
     Opacity is the gate rather than `height`, because the height IS the value.

     Deliberately NOT transitioned: a transition never advances in a tab that
     is not compositing, so a faded-in liquid would be invisible exactly where
     this codebase's rule says an indicator must still read correctly. The
     level rises; the liquid's presence is instant. */
  opacity: 0;
}
body .mi-dl.is-busy .mi-dl-fill { opacity: 0.5; }

/* The surface. Sits exactly on top of the liquid body (bottom: 100%) and is
   twice as wide as the button, so translating it by half its own width is
   seamless — the path's wave repeats every 100 of its 200 viewBox units. */
body .mi-dl .mi-dl-wave {
  position: absolute;
  bottom: 100%;
  left: 0;
  width: 200%;
  height: 9px;
  display: block;
  fill: var(--cyan);
}
body .mi-dl .mi-dl-wave-back {
  opacity: 0.55;
  height: 11px;
}

/* Motion only while the file is actually being produced. Two layers at
   different speeds and opposite directions is what reads as liquid rather
   than as one shape sliding past. */
body .mi-dl.is-busy .mi-dl-wave {
  animation: miDlWave 1.9s linear infinite;
}
body .mi-dl.is-busy .mi-dl-wave-back {
  animation: miDlWave 2.9s linear infinite reverse;
}

@keyframes miDlWave {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* Success recolours the liquid rather than adding a second signal to read. */
body .mi-dl.is-done .mi-dl-fill {
  opacity: 0.42;
  background-image: linear-gradient(180deg, var(--good) 0%, var(--good) 100%);
}
body .mi-dl.is-done .mi-dl-wave { fill: var(--good); }

/* A failure DRAINS the glass — the run sets --mi-dl-p back to 0, so what stays
   visible here is the wave alone, sitting on the surface of an empty layer: a
   thin red line along the bottom of the button. That residue is kept
   deliberately (idle hides its fill outright, above) because the border tint
   is subtle on its own, and a drained red tide reads as "this came back with
   nothing" at a glance. It is 9px because the wave is 9px. */
body .mi-dl.is-error .mi-dl-fill {
  opacity: 0.34;
  background-image: linear-gradient(180deg, #fb7185 0%, #f43f5e 100%);
}
body .mi-dl.is-error .mi-dl-wave { fill: #fb7185; }

/* -- the label and icon --------------------------------------------------- */
/* The one place a z-index is needed: the label must sit above the liquid.
   Scoped to the element the script created, never to the button's children. */
body .mi-dl .mi-dl-body {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: var(--mi-s2);
  min-width: 0;
}

body .mi-dl .mi-dl-ico {
  position: relative;
  flex: none;
  width: 14px;
  height: 14px;
  display: block;
}
body .mi-dl .mi-dl-ico svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  /* The stroke sits on the viewBox edge, and an <svg> clips at its own
     viewport — the same shave the KPI filter-button icons carry a note about. */
  overflow: visible;
}

/* The swap is by `display`, NOT by a transition on opacity. A transition that
   never advances returns its from-value forever, so a checkmark faded in by
   transition would be invisible in any tab that is not compositing — the
   documented rule that an indicator must show its true value with zero frames
   painted. display is not interpolatable, so it is correct instantly; the pop
   below is decoration layered on an already-correct state. */
/* THE `.mi-dl-ico` IN THESE THREE SELECTORS IS LOAD-BEARING, NOT DECORATION.
   The rule above it — `body .mi-dl .mi-dl-ico svg` — is (0,0,3,1), and it sets
   `display: block` on BOTH icons. Written as `body .mi-dl .mi-dl-check` this
   rule is (0,0,2,1) and loses to it, so the checkmark rendered stacked on top
   of the arrow in the idle state (verified in-browser: computed display was
   `block` before any click). Adding the intermediate class ties the count at
   3 and source order does the rest, these being later in the same file. */
body .mi-dl .mi-dl-ico .mi-dl-check { display: none; }
body .mi-dl.is-done .mi-dl-ico .mi-dl-arrow { display: none; }
body .mi-dl.is-done .mi-dl-ico .mi-dl-check {
  display: block;
  animation: miDlPop 420ms var(--mi-ease-out);
}

@keyframes miDlPop {
  0%   { transform: scale(0.4); opacity: 0; }
  60%  { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* A gentle nudge on the arrow while the file is being produced. No fill-mode,
   so with zero frames painted the arrow simply rests in its normal place. */
body .mi-dl.is-busy .mi-dl-arrow {
  animation: miDlNudge 1.15s ease-in-out infinite;
}
@keyframes miDlNudge {
  0%, 100% { transform: translateY(-1px); }
  50%      { transform: translateY(2px); }
}

/* -- states --------------------------------------------------------------- */
/* Busy uses aria-disabled, not disabled, and these two rules are why it can.
   A DISABLED button drops focus in Chrome the moment it is disabled, so the
   label change that follows is announced to nobody; aria-disabled keeps focus
   and the accessible-name change is read out. §3 dims aria-disabled to 0.55
   for genuinely unavailable controls — a button that is working is not that,
   so the component restores its own opacity. */
body .mi-dl[aria-disabled="true"] {
  opacity: 1;
  cursor: progress;
}
body .mi-dl.is-done[aria-disabled="true"],
body .mi-dl.is-error[aria-disabled="true"] {
  cursor: default;
}

/* Hover is suppressed once the gesture is under way: the lift and the cyan
   wash fight the liquid, and the control is not accepting a click anyway.

   The `button` variants are load-bearing for the same reason as the base block
   above — §3's hover rule is `body button.btn:hover:not(:disabled)` at
   (0,0,3,2), and `:not(:disabled)` contributes its argument's specificity, so
   the plain `body .mi-dl.is-busy:hover` form at (0,0,3,1) loses on every real
   <button>. With the element selector added the count ties at (0,0,3,2) and
   source order decides. */
body .mi-dl.is-busy:hover,
body .mi-dl.is-done:hover,
body .mi-dl.is-error:hover,
body button.mi-dl.is-busy:hover,
body button.mi-dl.is-done:hover,
body button.mi-dl.is-error:hover,
body a.mi-dl.is-busy:hover,
body a.mi-dl.is-done:hover,
body a.mi-dl.is-error:hover {
  transform: none;
  background-color: var(--panel-strong);
  border-color: var(--border);
  box-shadow: none;
  color: var(--text);
}

body .mi-dl.is-done { border-color: rgba(43, 207, 139, 0.42); }
body .mi-dl.is-error { border-color: rgba(251, 113, 133, 0.45); }

@media (prefers-reduced-motion: reduce) {
  /* The liquid still reaches its true level — only the travel is removed, so
     the control keeps saying the same thing with no motion at all. */
  body .mi-dl { transition: none !important; }
  body .mi-dl .mi-dl-wave,
  body .mi-dl.is-busy .mi-dl-wave,
  body .mi-dl.is-busy .mi-dl-wave-back,
  body .mi-dl.is-busy .mi-dl-arrow,
  body .mi-dl.is-done .mi-dl-check { animation: none !important; }
}


/* ============================================================================
   §20  APP BAR  —  THE ONE PAGE HEADER  (opt-in: <body class="mi-sticky-head">)
   ============================================================================

   Every MIIntel page wears the same top bar and the same top-bar BEHAVIOUR.
   This section owns the behaviour and the geometry; §3 owns its padding and
   radius; the page's own surface (dark `.glass`, light `.mi-head`) owns only
   the paint. One definition, so the bar cannot drift page by page — the same
   argument as §17 (the handover overlay), §18 (the close gesture) and §19
   (the download gesture), each of which this project has already paid for
   once as N hand-maintained copies.

   AUTO-HIDE / REVEAL  (2026-09-26, replacing the permanently-pinned bar)
   ---------------------------------------------------------------------
   The bar was made permanently sticky on 2026-09-25. On a dense report page
   that spends ~80px of every screen on chrome a reader never looks at while
   scrolling. So it now RETREATS on the way down and RETURNS the moment the
   reader asks for it:

     * scrolling DOWN past the bar's own height   ->  hides
     * scrolling UP                               ->  reveals
     * pointer within --mi-appbar-edge of the top ->  reveals
     * back at the top of the document            ->  reveals
     * keyboard focus enters the bar              ->  reveals (:focus-within)
     * a notification panel / overlay open        ->  reveals and STAYS

   miintel-chrome.js drives it by toggling TWO classes on <html> —
   `mi-head-hidden` (the bar has retreated) and `mi-head-peek` (the pointer is
   at the top edge). Everything else is here.

   SIX THINGS ARE LOAD-BEARING
   ---------------------------
   * The resting state is REVEALED, and only the retreat is animated. A tab
     that is not compositing runs no transitions and fires no scroll or
     pointer events at all, so it shows the bar — which is the correct way to
     fail. An auto-hiding bar built the other way round (hidden at rest,
     revealed by an animation) is permanently invisible there. Same rule as
     §17's overlay, #kpiBoot and .mi-head::after.
   * It moves with `transform`, never `top`, `display` or `height`.
     `position: sticky` keeps the bar's flow space whatever the transform
     does, so nothing below it shifts by a pixel as it comes and goes — and a
     transform is composited, so the retreat costs no layout and no paint.
   * The retreat distance is COMPUTED, not guessed. `-100%` alone leaves the
     bar peeking whenever `top` is non-zero, and `top` here is the guard
     banner's height plus the gap — a runtime value no constant can know. The
     calc subtracts its own height, its own top offset, and 28px of slack for
     the glass rim and its shadow.
   * overflow-x: CLIP on <body>, not hidden. Every page sets
     `body { overflow-x: hidden }` in its own inline block, which makes <body>
     a scroll container — and a sticky descendant then resolves against <body>
     (which never scrolls) instead of the viewport, so it silently never
     sticks. `hidden` first as the fallback for engines without `clip`.
     `html body.x` is (0,0,1,2), so it beats the page's own `body` rule
     whatever the source order.
   * z-index 99995 is a rung on the sitewide ladder: above content and the
     floating widget triggers (9998/9999), below the IQ toast (99996), the
     chat panel (99997), guard's banners (99998/9) and every overlay above
     those. `position: sticky` always creates a stacking context, so anything
     INSIDE the bar — portal.html's notification panel (100010) — competes at
     the bar's rung. While that panel is open notifications.js sets
     `mi-notif-open` on <html> and the bar moves up to the panel's own rung,
     exactly as before.
   * PHONES ARE INCLUDED NOW, and the old exclusion is what this replaces. At
     <= 620px the bar stacks into a ~150px column, and pinning that spent a
     quarter of a phone screen on chrome — which is precisely why it was
     excluded before. Auto-hide removes the objection rather than working
     around it: the bar is only on screen when the reader scrolls up for it.
     There is no pointer on a phone, so SCROLL-UP is the reveal that matters
     there, and it is why scroll-up reveal is not optional decoration.
   ========================================================================= */

:root {
  /* Gap between the viewport top (or the guard banner) and the stuck bar. */
  --mi-appbar-gap: 12px;
  /* How close to the top edge the pointer must come to call the bar back.
     36px is a comfortable throw for a fast mouse without the bar answering
     every pass across the first line of content. */
  --mi-appbar-edge: 36px;
  /* Duration + curve as a PAIR, matching the --ease contract's shape. The
     curve decelerates hard, so the bar drops in and settles rather than
     sliding to a stop. */
  --mi-appbar-ease: 340ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* `mi-sticky-head` is kept as the opt-in class name so the fourteen pages
   already carrying it need no markup change. `[data-mi-appbar]` is the hook
   for a top bar that is neither `.glass` nor `.mi-head`. */
html body.mi-sticky-head { overflow-x: hidden; overflow-x: clip; }

body.mi-sticky-head > header.glass,
body.mi-sticky-head > header.mi-head,
body.mi-sticky-head .shell > header.glass,
body.mi-sticky-head .mi-shell > header.mi-head,
body.mi-sticky-head [data-mi-appbar] {
  position: sticky;
  top: calc(var(--mi-banner-h, 0px) + var(--mi-appbar-gap));
  z-index: 99995;
  transition: transform var(--mi-appbar-ease);
}

html.mi-head-hidden body.mi-sticky-head > header.glass,
html.mi-head-hidden body.mi-sticky-head > header.mi-head,
html.mi-head-hidden body.mi-sticky-head .shell > header.glass,
html.mi-head-hidden body.mi-sticky-head .mi-shell > header.mi-head,
html.mi-head-hidden body.mi-sticky-head [data-mi-appbar] {
  transform: translate3d(0, calc(-100% - var(--mi-banner-h, 0px) - var(--mi-appbar-gap) - 28px), 0);
}

/* Four force-reveals, each written at a HIGHER specificity than the retreat
   above so it wins without !important:

     :focus-within    a keyboard reader has tabbed into the bar. Retreating
                      out from under someone's focus is how a bar becomes
                      unreachable without a mouse.
     mi-head-peek     miintel-chrome.js, while the pointer is at the top edge.
     mi-notif-open    notifications.js, while its panel is open.
     mi-overlay-open  the sitewide "a full-screen overlay is up" signal
                      (portal.js's side menu sets it).

   The notification panel lives INSIDE the bar, so without its entry it would
   ride the retreat up off the screen along with it. */
html.mi-head-hidden body.mi-sticky-head > header.glass:focus-within,
html.mi-head-hidden body.mi-sticky-head > header.mi-head:focus-within,
html.mi-head-hidden body.mi-sticky-head .shell > header.glass:focus-within,
html.mi-head-hidden body.mi-sticky-head .mi-shell > header.mi-head:focus-within,
html.mi-head-hidden body.mi-sticky-head [data-mi-appbar]:focus-within,
html.mi-head-peek.mi-head-hidden body.mi-sticky-head > header.glass,
html.mi-head-peek.mi-head-hidden body.mi-sticky-head > header.mi-head,
html.mi-head-peek.mi-head-hidden body.mi-sticky-head .shell > header.glass,
html.mi-head-peek.mi-head-hidden body.mi-sticky-head .mi-shell > header.mi-head,
html.mi-head-peek.mi-head-hidden body.mi-sticky-head [data-mi-appbar],
html.mi-notif-open.mi-head-hidden body.mi-sticky-head > header.glass,
html.mi-notif-open.mi-head-hidden body.mi-sticky-head .shell > header.glass,
html.mi-notif-open.mi-head-hidden body.mi-sticky-head [data-mi-appbar],
html.mi-overlay-open.mi-head-hidden body.mi-sticky-head > header.glass,
html.mi-overlay-open.mi-head-hidden body.mi-sticky-head > header.mi-head,
html.mi-overlay-open.mi-head-hidden body.mi-sticky-head .shell > header.glass,
html.mi-overlay-open.mi-head-hidden body.mi-sticky-head .mi-shell > header.mi-head,
html.mi-overlay-open.mi-head-hidden body.mi-sticky-head [data-mi-appbar] {
  transform: none;
}

html.mi-notif-open body.mi-sticky-head > header.glass,
html.mi-notif-open body.mi-sticky-head .shell > header.glass,
html.mi-notif-open body.mi-sticky-head [data-mi-appbar] { z-index: 100010; }

/* Reduced motion: the bar still gets out of the way — that is layout, not
   decoration — but it does so without travelling. */
@media (prefers-reduced-motion: reduce) {
  body.mi-sticky-head > header.glass,
  body.mi-sticky-head > header.mi-head,
  body.mi-sticky-head .shell > header.glass,
  body.mi-sticky-head .mi-shell > header.mi-head,
  body.mi-sticky-head [data-mi-appbar] { transition: none; }
}

@media print {
  body.mi-sticky-head > header.glass,
  body.mi-sticky-head > header.mi-head,
  body.mi-sticky-head .shell > header.glass,
  body.mi-sticky-head .mi-shell > header.mi-head,
  body.mi-sticky-head [data-mi-appbar] {
    position: static;
    transform: none;
    transition: none;
  }
}


/* ============================================================================
   §21  APP FOOTER  —  ONE FOOTER, EVERYWHERE
   ============================================================================

   One definition of the page footer: a hairline divider, generous space above
   it, and one line of small uppercase type reading
   `MI Business Strategy · <what this page is>`.

   It replaces five variants that had each drifted on their own: a bare
   `<footer>` on the portal and every admin tool, a `.mi-foot` copied into
   mi-report-chrome.css, cluster-kpi.css and both KPI scorecards' inline
   blocks, an inline `style=` on the Field Operations and PIP manager pages,
   and `.rm-foot` on the field-completion page. The divider colour, the type
   size, the tracking and the space above it disagreed across all five.

   `body .mi-foot` is (0,0,1,1) and `body footer` is (0,0,0,2). Both clear a
   page's own `* { margin: 0; padding: 0 }` reset and a bare `footer {}` rule,
   which is exactly what this needs: a page's inline <style> is parsed AFTER
   this file, so specificity — not source order — has to decide. This was
   `:where(body footer)` once, specificity ZERO, and the reset beat it: the
   border-top applied and the padding-top did not, so the footer text sat
   directly on its own divider line.

   Colour comes from TOKENS (--faint, --border), never literals, which is what
   lets one rule read correctly on the dark portal and on the four light
   report surfaces — each of those redeclares the same token names with light
   values, so the footer follows with nothing to keep in step.

   PADDING-BOTTOM IS LOAD-BEARING. The Search and Chat pills are fixed at the
   bottom-left of every page (24px / 88px, with the IQ pill at 152px), and
   without clearance the footer's one line sits underneath them.

   The footer is CHROME, not content, so it is not printed. */

/* MOVED (2026-09-27): the footer's rules now live in miintel-appbar.css,
   beside the header, as literal colours rather than tokens — the light pages
   re-pointed --faint/--border and the footer came out a different grey on
   every surface. Kept as a pointer so nobody re-adds a second copy here. */

/* ════════════════════════════════════════════════════════════════════════════
   §22  PERSON CHIP  —  a photo beside a name in any list (miintel-avatars.js)
   ════════════════════════════════════════════════════════════════════════════
   Initials at rest; the photo fades over them only once it has decoded
   (`.has-img`, set on the img's load event), so a failure never shows a
   broken-image glyph. The <img> is absolutely positioned inside a relative
   box, never a flex/grid item sized from its intrinsic ratio — a portrait
   would otherwise lay out taller than the chip and crop off-centre (the
   Timeline author chip paid for that first). Literal colours, so it reads on
   the light report pages as well as the dark ones. */
body .mi-av {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: var(--mi-av-size, 26px);
  height: var(--mi-av-size, 26px);
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff;
  font-size: calc(var(--mi-av-size, 26px) * 0.4);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  vertical-align: middle;
  user-select: none;
}
body .mi-av > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
}
body .mi-av.has-img > img { opacity: 1; }
body .mi-av.has-img > .mi-av-txt { visibility: hidden; }
