/* ==========================================================================
   ARKHOS ADMIN — design system
   Dark petrol sidebar, limestone work area for long reading sessions, flare
   accent for the one thing to do next. Archivo for headings, IBM Plex Sans
   for text, IBM Plex Mono for labels and numbers. Fonts: ../../css/fonts.css.
   No inline styles anywhere (strict CSP): every visual lives in this file.
   ========================================================================== */

:root {
  /* Petrol grounds (sidebar, brand panel, code) */
  --petrol-950: #050f15;
  --petrol-900: #08161f;
  --petrol-850: #0b1d28;
  --petrol-800: #0f2533;
  --petrol-700: #163243;
  --petrol-600: #21465b;
  --fg: #e8eef1;
  --fg-2: #b6c4cc;
  --fg-mute: #8197a3;
  --line-dark: rgba(196, 222, 235, 0.12);
  --line-dark-strong: rgba(196, 222, 235, 0.22);

  /* Flare accent */
  --flare: #ff8b2b;
  --flare-hover: #ffa04f;
  --flare-on: #170a02;
  --flare-deep: #d9600f;
  --flare-ink: #b43e0b;
  --sheen: linear-gradient(100deg, #9a7bff 0%, #3fb7e2 28%, #5fe3b6 50%, #f4c16a 72%, #ff8b2b 100%);

  /* Limestone work area */
  --limestone: #e9eeec;
  --limestone-2: #dce4e1;
  --limestone-3: #cfd9d5;
  --paper: #fbfcfc;
  --paper-2: #f3f6f5;
  --ink: #0a1a22;
  --ink-2: #33495a;
  --ink-mute: #51687a;
  --line: rgba(10, 26, 34, 0.11);
  --line-strong: rgba(10, 26, 34, 0.22);
  --field-border: #9fb0b8;

  /* Semantics */
  --good: #45d08b;
  --good-ink: #0f6b40;
  --bad: #ff6464;
  --bad-ink: #a61b1b;
  --warn: #f4c16a;
  --warn-ink: #7a4f00;
  --info-ink: #1d4f73;

  /* Type */
  --font-display: "Archivo", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  /* Shape and space */
  --radius-sm: 7px;
  --radius: 8px;
  --radius-lg: 12px;
  --side-w: 264px;
  --pad: clamp(16px, 3vw, 40px);
  --content-max: 1240px;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  --shadow-sm: 0 1px 2px rgba(10, 26, 34, 0.04), 0 6px 18px -14px rgba(10, 26, 34, 0.22);
  --shadow-md: 0 2px 4px rgba(10, 26, 34, 0.05), 0 18px 36px -22px rgba(10, 26, 34, 0.35);
  --focus: 0 0 0 3px rgba(255, 139, 43, 0.35);
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: light; }
body { margin: 0; }
.adm-body {
  min-height: 100vh;
  background: var(--limestone);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p, figure, dl, dd, blockquote { margin: 0; }
ul, ol { margin: 0; padding-left: 1.25em; }
[hidden] { display: none !important; }
::selection { background: var(--flare); color: var(--flare-on); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--flare-ink); outline-offset: 2px; }
.adm-side :focus-visible, .auth__brand :focus-visible, .code:focus-visible { outline-color: var(--flare); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-stretch: 108%;
  font-weight: 650;
  letter-spacing: -0.012em;
  line-height: 1.2;
  color: var(--ink);
  text-wrap: balance;
}
h2 { font-size: 1.15rem; }
h3 { font-size: 1.02rem; }
p { text-wrap: pretty; }

.icon {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Utilities ---------- */
.muted { color: var(--ink-mute); }
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }
.small { font-size: 0.86rem; }
.num { font-variant-numeric: tabular-nums; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -64px; z-index: 200;
  padding: 10px 16px; border-radius: var(--radius);
  background: var(--flare); color: var(--flare-on); font-weight: 600; text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

/* ==========================================================================
   Shell: sidebar + main
   ========================================================================== */
.adm-shell {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
}

.adm-side {
  position: sticky; top: 0;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  overflow-y: auto; overscroll-behavior: contain;
  color: var(--fg);
  color-scheme: dark;
  background:
    repeating-linear-gradient(176deg, transparent 0 46px, rgba(196, 222, 235, 0.03) 46px 47px),
    radial-gradient(120% 60% at 0% 100%, rgba(255, 139, 43, 0.09), transparent 60%),
    var(--petrol-900);
  border-right: 1px solid var(--petrol-950);
}
.adm-side::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 3px;
  background: var(--sheen); opacity: 0.9;
}
.adm-side__bar {
  display: flex; align-items: center; gap: 10px;
  padding: 24px 20px 20px;
}
.adm-side__tag {
  margin-left: auto;
  padding: 3px 8px;
  border: 1px solid rgba(255, 139, 43, 0.45);
  border-radius: 999px;
  font-family: var(--font-mono); font-size: 0.62rem; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--flare);
}
.adm-side__panel { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* Logo */
.adm-logo { display: inline-flex; align-items: center; gap: 10px; color: var(--fg); text-decoration: none; flex: none; border-radius: 4px; }
.adm-logo__mark { width: 24px; height: 29px; flex: none; }
.adm-logo__strata { fill: none; stroke: var(--petrol-900); stroke-width: 1.6; }
.adm-logo__word { display: grid; line-height: 1; }
.adm-logo__name { font-family: var(--font-display); font-stretch: 125%; font-weight: 750; font-size: 1.02rem; letter-spacing: 0.16em; }
.adm-logo__sub { margin-top: 4px; font-family: var(--font-mono); font-size: 0.52rem; letter-spacing: 0.42em; color: var(--fg-mute); }
.adm-logo--lg .adm-logo__mark { width: 30px; height: 36px; }
.adm-logo--lg .adm-logo__name { font-size: 1.22rem; }
.adm-logo--lg .adm-logo__sub { font-size: 0.6rem; margin-top: 5px; }

/* Navigation */
.adm-nav { padding: 6px 12px 16px; }
.adm-nav__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.adm-nav__link {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 0 12px;
  border-radius: var(--radius);
  color: var(--fg-2); text-decoration: none;
  font-size: 0.94rem; font-weight: 500;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.adm-nav__link .icon { width: 20px; height: 20px; color: var(--fg-mute); transition: color 0.2s var(--ease); }
.adm-nav__link:hover { background: rgba(196, 222, 235, 0.06); color: var(--fg); }
.adm-nav__link:hover .icon { color: var(--fg-2); }
.adm-nav__link.is-active {
  background: linear-gradient(90deg, rgba(255, 139, 43, 0.17), rgba(255, 139, 43, 0.04));
  color: #fff;
}
.adm-nav__link.is-active::before {
  content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--flare);
}
.adm-nav__link.is-active .icon { color: var(--flare); }
.adm-nav__text { flex: 1; min-width: 0; }
.adm-nav__count {
  flex: none;
  min-width: 24px; height: 22px; padding: 0 7px;
  border-radius: 999px;
  background: var(--flare); color: var(--flare-on);
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500; line-height: 22px;
  text-align: center; font-variant-numeric: tabular-nums;
}

/* Sidebar footer */
.adm-side__foot {
  margin-top: auto;
  display: grid; gap: 10px;
  padding: 16px 12px 18px;
  border-top: 1px solid var(--line-dark);
}
.adm-user { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 4px 6px; }
.adm-user__avatar {
  flex: none; display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--petrol-600), var(--petrol-800));
  border: 1px solid var(--line-dark-strong);
  font-family: var(--font-display); font-stretch: 110%; font-size: 0.8rem; font-weight: 650; letter-spacing: 0.04em;
  color: var(--fg);
}
.adm-user__text { display: grid; min-width: 0; line-height: 1.3; }
.adm-user__name, .adm-user__email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-user__name { color: var(--fg); font-size: 0.9rem; font-weight: 500; }
.adm-user__email { color: var(--fg-mute); font-size: 0.78rem; }
.adm-side__actions { display: grid; gap: 2px; }
.adm-side__logout { margin: 0; }
.adm-side__link {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 40px; padding: 0 10px;
  border: 0; border-radius: var(--radius);
  background: none; color: var(--fg-2);
  font-size: 0.88rem; text-align: left; text-decoration: none;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.adm-side__link .icon { width: 18px; height: 18px; color: var(--fg-mute); }
.adm-side__link:hover { background: rgba(196, 222, 235, 0.06); color: var(--fg); }

/* Mobile menu button (shown by admin.js below 900px) */
.adm-menu {
  display: none;
  align-items: center; gap: 8px;
  min-height: 40px; padding: 0 14px;
  border: 1px solid var(--line-dark-strong); border-radius: var(--radius);
  background: rgba(196, 222, 235, 0.04); color: var(--fg);
  font-size: 0.88rem; font-weight: 500;
}
.adm-menu .icon { width: 18px; height: 18px; }
.adm-menu__close { display: none; }
.adm-menu[aria-expanded="true"] .adm-menu__open { display: none; }
.adm-menu[aria-expanded="true"] .adm-menu__close { display: block; }

/* Main column */
.adm-main { min-width: 0; display: flex; flex-direction: column; }
.adm-main:focus { outline: none; }
.adm-header {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 16px 24px;
  width: 100%; max-width: calc(var(--content-max) + 2 * var(--pad)); margin: 0 auto;
  padding: clamp(24px, 3.2vw, 40px) var(--pad) 0;
}
.adm-header h1 {
  font-size: clamp(1.55rem, 1.2rem + 1.1vw, 2.05rem);
  font-weight: 700; font-stretch: 112%;
  letter-spacing: -0.028em; line-height: 1.1;
  min-width: 0; max-width: 100%; overflow-wrap: anywhere; /* a long sender name or email must wrap, not run off a phone screen */
}
.adm-header__titles { display: grid; gap: 6px; min-width: 0; }
.adm-header__eyebrow {
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--flare-ink);
}
.adm-header__sub { color: var(--ink-mute); }
.adm-header__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.adm-content {
  width: 100%; max-width: calc(var(--content-max) + 2 * var(--pad)); margin: 0 auto;
  padding: 24px var(--pad) 64px;
}
.adm-content > * + * { margin-top: 20px; }
/* A page header printed further down a view (not first) sits inside the content padding. */
.adm-content > .adm-header { max-width: none; padding: 0; }
.adm-content a:not([class]) {
  color: var(--flare-ink);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
}
.adm-content a:not([class]):hover { color: var(--ink); }

/* Under 900px the sidebar becomes a top bar with a menu button */
@media (max-width: 899.98px) {
  .adm-shell { display: block; }
  .adm-side {
    position: sticky; top: 0; z-index: 60;
    height: auto; overflow: visible;
    border-right: 0; border-bottom: 1px solid var(--petrol-950);
  }
  .adm-side__bar { min-height: 60px; padding: 10px 16px; }
  .adm-side__tag { margin-left: 0; }
  .adm-menu:not([hidden]) { display: inline-flex; margin-left: auto; }

  /* Without JavaScript the menu stays visible as a scrolling row */
  .adm-nav { padding: 0 12px 10px; }
  .adm-nav__list { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
  .adm-nav__list::-webkit-scrollbar { display: none; }
  .adm-nav__link { white-space: nowrap; }
  .adm-nav__link.is-active::before { display: none; }
  .adm-side__foot { padding: 10px 12px 12px; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .adm-side__actions { display: flex; gap: 4px; }
  .adm-side__actions .adm-side__link { width: auto; }

  /* With JavaScript: a drop-down panel */
  .js-nav .adm-side__panel {
    display: none;
    position: absolute; left: 0; right: 0; top: 100%;
    max-height: calc(100vh - 60px); max-height: calc(100dvh - 60px);
    overflow-y: auto; overscroll-behavior: contain;
    background: var(--petrol-900);
    border-bottom: 1px solid var(--petrol-950);
    box-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.55);
  }
  .js-nav .adm-side.is-open .adm-side__panel { display: flex; }
  .js-nav .adm-nav { padding: 8px 12px 12px; }
  .js-nav .adm-nav__list { display: grid; overflow: visible; }
  .js-nav .adm-nav__link.is-active::before { display: block; }
  .js-nav .adm-side__foot { grid-template-columns: minmax(0, 1fr); }
  .js-nav .adm-side__actions { display: grid; }
  .js-nav .adm-side__actions .adm-side__link { width: 100%; }
}
@media (max-width: 479.98px) {
  .adm-side__tag { display: none; }
  .adm-side__foot .adm-user__email { display: none; }
}

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card__head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.card__title {
  margin: 0;
  font-family: var(--font-display); font-stretch: 108%;
  font-size: 1.02rem; font-weight: 650; letter-spacing: -0.01em;
}
.card__meta { color: var(--ink-mute); font-size: 0.86rem; }
.card__meta strong { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.card__link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--flare-ink); font-size: 0.88rem; font-weight: 500; text-decoration: none;
  border-radius: 4px;
}
.card__link .icon { width: 16px; height: 16px; transition: transform 0.25s var(--ease); }
.card__link:hover { color: var(--ink); }
.card__link:hover .icon { transform: translateX(3px); }
.card__body { padding: 20px; }
.card__body > * + * { margin-top: 14px; }
.card__foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--paper-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
/* Phones: the buttons at the foot of a form fill the width, one under the other */
@media (max-width: 639.98px) {
  .card__foot { justify-content: stretch; }
  .card__foot > .btn { flex: 1 1 100%; }
}
.card > .table-wrap { border: 0; border-radius: 0 0 var(--radius-lg) var(--radius-lg); box-shadow: none; background: transparent; }
.card > .card__head + .table-wrap { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card > .table-wrap:not(:last-child) { border-radius: 0; }
.card > .table-wrap:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.card > .table-wrap:only-child { border-radius: var(--radius-lg); }

/* ==========================================================================
   Stats
   ========================================================================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
  gap: 16px;
}
.stat {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 6px;
  min-width: 0;
  padding: 18px 20px 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  color: var(--ink); text-decoration: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}
a.stat:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat--hot::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--flare);
}
.stat__label {
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-mute);
}
.stat__value {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-stretch: 110%;
  font-size: clamp(1.8rem, 1.5rem + 0.9vw, 2.3rem); font-weight: 700; line-height: 1.05;
  letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
}
.stat__meta { color: var(--ink-mute); font-size: 0.85rem; line-height: 1.4; }
.stat__meta--up .stat__trend { color: var(--good-ink); }
.stat__meta--down .stat__trend { color: var(--ink-mute); }
.stat__trend { font-size: 0.7rem; margin-right: 2px; }

.status-dot {
  flex: none; width: 12px; height: 12px; border-radius: 50%;
  background: #9aa9b1; box-shadow: 0 0 0 4px rgba(154, 169, 177, 0.22);
}
.status-dot--on { background: #22b26b; box-shadow: 0 0 0 4px rgba(69, 208, 139, 0.25); }
.status-dot--off { background: #9aa9b1; }

/* ==========================================================================
   Dashboard
   ========================================================================== */
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.dash-grid__full { grid-column: 1 / -1; }
@media (max-width: 1099.98px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }

.kind-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.kind-list__link {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  color: var(--ink); text-decoration: none; font-size: 0.92rem; border-radius: 4px;
}
.kind-list__link:hover .kind-list__name { color: var(--flare-ink); text-decoration: underline; text-underline-offset: 3px; }
.kind-list__count { font-family: var(--font-mono); font-weight: 500; font-variant-numeric: tabular-nums; }
.kind-list__bar { width: 100%; height: 6px; margin-top: 7px; border-radius: 3px; overflow: hidden; }
.kind-list__track { fill: var(--limestone-2); }
.kind-list__fill { fill: var(--petrol-600); }
.kind-list__fill--enquiry { fill: #2f7cb0; }
.kind-list__fill--application { fill: #6a52c7; }
.kind-list__fill--talent { fill: #17907f; }
.kind-list__fill--newsletter { fill: #c98a12; }
.kind-list__fill--subscription { fill: #5a8f2c; }
.kind-list__fill--form { fill: #6b7f8b; }

/* Callouts (dashboard warnings) */
.callouts { display: grid; gap: 12px; }
.callout {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px 18px;
  border: 1px solid; border-radius: var(--radius-lg);
}
.callout__icon {
  flex: none; display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 10px;
}
.callout__icon .icon { width: 20px; height: 20px; }
.callout__body { min-width: 0; display: grid; gap: 4px; }
.callout__title { font-family: var(--font-body); font-size: 0.98rem; font-weight: 600; letter-spacing: 0; color: var(--ink); }
.callout p { color: var(--ink-2); font-size: 0.92rem; overflow-wrap: anywhere; }
.callout__steps { margin-top: 2px; }
.callout__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.callout--warn { background: #fff7e8; border-color: #efd6a3; }
.callout--warn .callout__icon { background: #fbe7bf; color: var(--warn-ink); }
.callout--info { background: #edf5f9; border-color: #c8dde9; }
.callout--info .callout__icon { background: #d6e8f2; color: var(--info-ink); }

/* Chart: inline SVG bars + HTML axis labels (stay crisp at any width) */
.chart { margin: 0; }
.chart__frame { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; }
.chart__y {
  position: relative; height: 220px; min-width: 1.6em;
  font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-mute); text-align: right;
}
.chart__tick { position: absolute; right: 0; transform: translateY(-50%); line-height: 1; font-variant-numeric: tabular-nums; }
.chart__tick--top { top: 0; }
.chart__tick--mid { top: 50%; }
.chart__tick--zero { top: 100%; }
.chart__plot { min-width: 0; }
.chart__svg { width: 100%; height: 220px; overflow: visible; }
.chart__grid { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 2 4; }
.chart__base { stroke: var(--ink-mute); stroke-width: 1; }
.chart__hit { fill: transparent; transition: fill 0.15s; }
.chart__bar { fill: var(--petrol-600); transition: fill 0.15s; }
.chart__day.is-today .chart__bar { fill: var(--flare); }
.chart__day:hover .chart__hit { fill: rgba(10, 26, 34, 0.05); }
.chart__day:hover .chart__bar { fill: var(--flare-deep); }
.chart__x {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  margin-top: 8px; height: 1.3em;
  font-family: var(--font-mono); font-size: 0.68rem; color: var(--ink-mute);
}
.chart__label { display: flex; justify-content: center; white-space: nowrap; }
.chart__label.is-first { justify-content: flex-start; }
.chart__label.is-last { justify-content: flex-end; color: var(--flare-ink); }
@media (max-width: 599.98px) {
  .chart__y { height: 170px; }
  .chart__svg { height: 170px; }
  .chart__label.is-minor { visibility: hidden; }
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  --btn-bg: #fff; --btn-fg: var(--ink); --btn-bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px;
  border: 1px solid var(--btn-bd); border-radius: var(--radius);
  background: var(--btn-bg); color: var(--btn-fg);
  font-family: var(--font-body); font-size: 0.92rem; font-weight: 500; line-height: 1.1;
  text-align: center; text-decoration: none; white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.btn .icon { width: 18px; height: 18px; }
.btn:hover { --btn-bd: var(--ink-mute); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--flare-ink); outline-offset: 2px; }
.btn--primary { --btn-bg: var(--flare); --btn-fg: var(--flare-on); --btn-bd: var(--flare); font-weight: 600; }
.btn--primary:hover { --btn-bg: var(--flare-hover); --btn-bd: var(--flare-hover); }
.btn--ghost { --btn-bg: transparent; }
.btn--ghost:hover { --btn-bg: rgba(10, 26, 34, 0.05); }
.btn--danger { --btn-bg: #fff; --btn-fg: var(--bad-ink); --btn-bd: #e2a3a3; }
.btn--danger:hover { --btn-bg: var(--bad-ink); --btn-fg: #fff; --btn-bd: var(--bad-ink); }
.btn--sm { min-height: 34px; padding: 0 12px; font-size: 0.85rem; border-radius: var(--radius-sm); gap: 6px; }
.btn--sm .icon { width: 16px; height: 16px; }
.btn--block { display: flex; width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn.is-busy { cursor: progress; opacity: 0.75; }
.btn.is-busy::after {
  content: ""; width: 14px; height: 14px; flex: none;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: adm-spin 0.8s linear infinite;
}
@keyframes adm-spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Forms
   ========================================================================== */
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field > label, .field__label { font-size: 0.9rem; font-weight: 500; color: var(--ink); }
.field__row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.field__row > label { font-size: 0.9rem; font-weight: 500; color: var(--ink); }
.field__link { font-size: 0.86rem; color: var(--flare-ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; border-radius: 3px; }
.field__link:hover { color: var(--ink); }

.field input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.field select,
.field textarea,
.toolbar input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.toolbar select {
  width: 100%; min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--field-border); border-radius: var(--radius);
  background: #fff; color: var(--ink);
  font-size: 1rem; line-height: 1.4;
  outline: 2px solid transparent; outline-offset: 1px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.field select, .toolbar select {
  appearance: none; -webkit-appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2333495a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}
.field input:hover, .field select:hover, .field textarea:hover,
.toolbar input:hover, .toolbar select:hover { border-color: var(--ink-mute); }
.field input:focus, .field select:focus, .field textarea:focus,
.toolbar input:focus, .toolbar select:focus {
  border-color: var(--flare-ink); box-shadow: var(--focus);
}
/* The :not() chain matches the base input rule's weight, so a field with an error really turns red. */
.field input[aria-invalid="true"]:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.field select[aria-invalid="true"], .field textarea[aria-invalid="true"] {
  border-color: #c43c3c; background: #fffafa;
}
.field input[aria-invalid="true"]:focus, .field textarea[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(196, 60, 60, 0.25); }
.field input:disabled, .field select:disabled, .field textarea:disabled { background: var(--paper-2); color: var(--ink-mute); cursor: not-allowed; }
.field input[readonly] { background: var(--paper-2); }
.field input[type="checkbox"], .field input[type="radio"] { width: 18px; height: 18px; accent-color: var(--flare-deep); margin: 0; }
.field__hint { font-size: 0.84rem; color: var(--ink-mute); line-height: 1.45; }
.field__error { font-size: 0.86rem; font-weight: 500; color: var(--bad-ink); line-height: 1.45; }
.field__error ul { margin: 0; padding-left: 1.1em; display: grid; gap: 2px; }
.field__error::before { content: "! "; font-weight: 700; }
.field__error:has(ul)::before { content: none; }

/* Password box with show/hide button */
.field__password { position: relative; }
.field .field__password input:not([type="checkbox"]) { padding-right: 76px; }
.field__reveal {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  min-width: 60px; min-height: 34px; padding: 0 10px;
  border: 0; border-radius: var(--radius-sm);
  background: var(--paper-2); color: var(--ink-2);
  font-size: 0.82rem; font-weight: 500;
}
.field__reveal:hover { background: var(--limestone-2); color: var(--ink); }

.field--inline { display: flex; align-items: center; gap: 8px; }
.field--inline > label { white-space: nowrap; font-size: 0.86rem; font-weight: 500; color: var(--ink-2); }
.field.field--inline input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.field.field--inline select { width: auto; min-width: 0; min-height: 40px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.form-grid > .field--full, .form-grid > .form-grid__full, .form-grid > .form-actions { grid-column: 1 / -1; }
@media (max-width: 639.98px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
form > .form-actions, .card__body > .form-actions { padding-top: 4px; }

/* Toggle switch: <label class="switch"><input type="checkbox" role="switch"><span class="switch__track"></span><span>Label</span></label> */
.switch {
  position: relative;
  display: inline-flex; align-items: center; gap: 12px;
  min-height: 44px;
  color: var(--ink); font-weight: 500;
  cursor: pointer;
}
.switch input {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 44px; height: 26px; margin: 0;
  opacity: 0; cursor: pointer;
}
.switch__track {
  position: relative; flex: none;
  width: 44px; height: 26px; border-radius: 999px;
  background: #aebcc3;
  transition: background-color 0.2s var(--ease);
}
.switch__track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(10, 26, 34, 0.35);
  transition: transform 0.2s var(--ease);
}
.switch input:checked + .switch__track { background: var(--flare-deep); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--flare-ink); outline-offset: 3px; }
.switch:hover .switch__track { background: #9aabb3; }
.switch:hover input:checked + .switch__track { background: #c4560d; }
.switch input:disabled + .switch__track { opacity: 0.5; }
.switch:has(input:disabled) { cursor: not-allowed; color: var(--ink-mute); }

/* Filters row */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px;
  padding: 12px;
  background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.toolbar > * { min-width: 0; }
.toolbar input[type="search"], .toolbar .field--grow { flex: 1 1 220px; }
.toolbar .field--grow input { width: 100%; }
.toolbar .field { margin: 0; }
.card .toolbar, .card__head .toolbar { padding: 0; border: 0; box-shadow: none; background: none; }
/* Message actions: opening the Delete confirmation must not push the other buttons down */
.toolbar--actions { align-items: flex-start; }
@media (max-width: 639.98px) {
  .toolbar > * { flex: 1 1 100%; }
  .toolbar .field--inline { flex-wrap: wrap; }
  .toolbar .field--inline > label { flex: 1 1 100%; }
  .toolbar .field.field--inline input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  .toolbar .field.field--inline select { width: 100%; flex: 1 1 100%; }
  .toolbar .btn { width: 100%; }
}

/* ==========================================================================
   Tables
   ========================================================================== */
.table-wrap {
  /* position: relative keeps screen-reader-only text inside the scroll box,
     so a wide table can't make the whole page scroll sideways */
  position: relative;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table caption { text-align: left; padding: 14px 16px 0; color: var(--ink-mute); font-size: 0.86rem; }
.table th {
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
  font-family: var(--font-mono); font-size: 0.68rem; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-mute);
  text-align: left; white-space: nowrap; vertical-align: bottom;
}
.table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2); vertical-align: top;
}
.table tbody th { font-family: var(--font-body); font-size: 0.92rem; text-transform: none; letter-spacing: 0; color: var(--ink); background: none; font-weight: 500; vertical-align: top; }
.table thead th:first-child, .table td:first-child { padding-left: 20px; }
.table thead th:last-child, .table td:last-child { padding-right: 20px; }
.table tbody tr:last-child > * { border-bottom: 0; }
.table tbody tr { transition: background-color 0.15s; }
.table tbody tr:hover { background: #f4f7f6; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table__primary { color: var(--ink); font-weight: 500; min-width: 220px; }
.adm-content .table a:not([class]), .table__primary a {
  color: var(--ink); text-decoration: none; border-radius: 3px;
}
.adm-content .table a:not([class]):hover, .table__primary a:hover {
  color: var(--flare-ink); text-decoration: underline; text-underline-offset: 3px;
}
.table__sub { display: block; margin-top: 2px; color: var(--ink-mute); font-size: 0.82rem; font-weight: 400; overflow-wrap: anywhere; }
.table__about { min-width: 220px; overflow-wrap: anywhere; }
.table tr.is-unread { background: #fffaf4; }
.table tr.is-unread:hover { background: #fff3e6; }
.table tr.is-unread .table__primary { font-weight: 650; }
.table tr.is-unread .table__primary > a::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px;
  border-radius: 50%; background: var(--flare); vertical-align: 1px;
}
.table td .confirm, .table td form { margin: 0; }
.table .table__actions { white-space: nowrap; text-align: right; }
/* Email addresses can be very long with no spaces: let them wrap instead of widening the table */
.table .mono, .toolbar .mono { overflow-wrap: anywhere; }

/* Phones, tablets and small laptops (below 1280px there isn't room for every
   column beside the sidebar): each row becomes a small card. The first line
   holds the main cell (.cell--lead) with the date or status on the right
   (.cell--aside); the other cells follow underneath, each with its column name
   from data-label. */
@media (max-width: 1279.98px) {
  .table--stack thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
  .table--stack, .table--stack tbody { display: block; width: 100%; }
  .table--stack tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start;
    gap: 6px 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
  }
  .table--stack tbody tr:last-child { border-bottom: 0; }
  .table.table--stack td,
  .table.table--stack td:first-child,
  .table.table--stack td:last-child {
    display: block; grid-column: 1 / -1; min-width: 0;
    padding: 0; border: 0;
  }
  .table.table--stack td.cell--lead { grid-column: 1; grid-row: 1; overflow-wrap: anywhere; }
  .table.table--stack td.cell--aside {
    grid-column: 2; grid-row: 1;
    text-align: right; font-size: 0.8rem; color: var(--ink-mute);
  }
  .table.table--stack td.cell--aside .table__sub { font-size: 0.76rem; }
  .table.table--stack td.cell--empty { display: none; }
  .table--stack td[data-label]::before {
    content: attr(data-label);
    display: inline-block; margin-right: 8px;
    font-family: var(--font-mono); font-size: 0.64rem; font-weight: 500;
    letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-mute);
  }
  .table--stack .table__primary, .table--stack .table__about { min-width: 0; }
  .table.table--stack .table__actions { text-align: left; white-space: normal; }
  .table--stack .confirm__panel { max-width: 100%; }
}

/* ==========================================================================
   Badges
   ========================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px 3px 8px;
  border-radius: 999px;
  background: #e6ecea; color: var(--ink-2);
  font-family: var(--font-body); font-size: 0.75rem; font-weight: 500; line-height: 1.35;
  letter-spacing: 0.01em; white-space: nowrap; vertical-align: middle;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.85; flex: none; }
.badge--new { background: #ffe8d4; color: #8f3209; }
.badge--read { background: #e4ebe8; color: #3d5363; }
.badge--archived { background: #e6e9ea; color: #5c6b74; }
.badge--archived::before { background: transparent; border: 1.5px solid currentColor; }
.badge--enquiry { background: #ddedf8; color: #1b4f75; }
.badge--application { background: #ebe6ff; color: #47369a; }
.badge--talent { background: #d8f2ed; color: #0d6156; }
.badge--newsletter { background: #fbefd2; color: #6e4b00; }
.badge--subscription { background: #e3f1d8; color: #3a6517; }
.badge--form { background: #e4eaed; color: #3f5260; }
.badge--sent { background: #dbf4e6; color: #0e6136; }
.badge--failed { background: #fde2e2; color: #9b1919; }

/* ==========================================================================
   Tabs
   ========================================================================== */
.tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--line-strong);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  min-height: 44px; padding: 0 14px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--ink-2); font-size: 0.92rem; font-weight: 500;
  text-decoration: none; white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--ink); border-bottom-color: var(--line-strong); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--flare); font-weight: 600; }
.tab:focus-visible { outline-offset: -2px; border-radius: 6px 6px 0 0; }
.tab__count, .tab > .count, .tab > small {
  min-width: 22px; padding: 1px 7px;
  border-radius: 999px;
  background: var(--limestone-2); color: var(--ink-2);
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500; text-align: center;
  font-variant-numeric: tabular-nums;
}
.tab.is-active .tab__count, .tab.is-active > .count, .tab.is-active > small { background: #ffe8d4; color: #8f3209; }
/* Small phones: tighter tabs so all four inbox tabs fit without sideways scrolling */
@media (max-width: 419.98px) {
  .tab { padding: 0 9px; gap: 6px; }
}

/* ==========================================================================
   Flash messages
   ========================================================================== */
.adm-flashes { display: grid; gap: 10px; }
.flash {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  border: 1px solid; border-radius: 10px;
  font-size: 0.92rem; line-height: 1.5;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.flash > .icon { width: 20px; height: 20px; margin-top: 1px; }
.flash > p, .flash > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.flash--success { background: #e6f6ee; border-color: #b3e0c7; color: #0d5634; }
.flash--error { background: #fdeded; border-color: #f0bfbf; color: #861b1b; }
.flash--info { background: #e8f1f7; border-color: #c3d9e8; color: var(--info-ink); }
.flash--warn { background: #fdf3df; border-color: #eed59f; color: var(--warn-ink); }
.flash.is-leaving { opacity: 0; transform: translateY(-4px); }
.flash__close {
  flex: none; display: grid; place-items: center;
  width: 28px; height: 28px; margin: -4px -6px -4px 0;
  border: 0; border-radius: 6px; background: transparent; color: inherit; opacity: 0.7;
}
.flash__close:hover { opacity: 1; background: rgba(10, 26, 34, 0.06); }
.flash__close .icon { width: 16px; height: 16px; }

/* ==========================================================================
   Empty states
   ========================================================================== */
.empty {
  display: grid; justify-items: center; gap: 8px;
  padding: 44px 20px;
  text-align: center;
}
.empty__icon {
  display: grid; place-items: center;
  width: 56px; height: 56px; margin-bottom: 6px;
  border-radius: 50%;
  background: var(--limestone); color: var(--ink-mute);
  box-shadow: inset 0 0 0 1px var(--line);
}
.empty__icon .icon { width: 26px; height: 26px; }
.empty > svg { width: 40px; height: 40px; color: var(--ink-mute); fill: none; stroke: currentColor; stroke-width: 1.5; }
.empty__title, .empty h2, .empty h3 {
  font-family: var(--font-display); font-stretch: 108%;
  font-size: 1.12rem; font-weight: 650; color: var(--ink);
}
.empty__text, .empty > p:not([class]) { max-width: 52ch; color: var(--ink-mute); }
.empty__code { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--flare-ink); }
.empty__steps { max-width: 60ch; margin: 4px 0 0; padding-left: 1.2em; display: grid; gap: 6px; text-align: left; color: var(--ink-2); font-size: 0.9rem; }
.empty .btn { margin-top: 10px; }
.empty--compact { padding: 12px 4px; }
.empty--compact .empty__icon { width: 44px; height: 44px; }
.empty--compact .empty__icon .icon { width: 22px; height: 22px; }

/* ==========================================================================
   Pagination
   ========================================================================== */
.pagination {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px;
  padding: 4px 0;
}
.pagination > a, .pagination > span {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 40px; height: 40px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--paper); color: var(--ink-2);
  font-size: 0.9rem; font-variant-numeric: tabular-nums; text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}
.pagination > a:hover { border-color: var(--ink-mute); color: var(--ink); }
.pagination > .is-current { background: var(--ink); border-color: var(--ink); color: var(--limestone); font-weight: 600; }
.pagination > .is-disabled { opacity: 0.45; }
.pagination > .pagination__gap { min-width: 20px; padding: 0; border: 0; background: none; }
.pagination .icon { width: 16px; height: 16px; }
@media (max-width: 479.98px) {
  .pagination__step > span:not(.sr-only) {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
}

/* ==========================================================================
   Record detail (dl)
   ========================================================================== */
.kv { display: grid; grid-template-columns: minmax(130px, 220px) minmax(0, 1fr); margin: 0; }
.kv > div { display: contents; }
.kv dt, .kv dd { margin: 0; padding: 12px 0; border-bottom: 1px solid var(--line); }
.kv dt { padding-right: 16px; color: var(--ink-mute); font-size: 0.86rem; font-weight: 500; }
.kv dd { color: var(--ink); overflow-wrap: anywhere; }
.kv > dt:last-of-type, .kv > dd:last-of-type, .kv > div:last-child > dt, .kv > div:last-child > dd { border-bottom: 0; }
@media (max-width: 639.98px) {
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv dt { padding-bottom: 2px; border-bottom: 0; }
  .kv dd { padding-top: 0; }
}

/* ==========================================================================
   Delete confirmation (no JavaScript confirm())
   ========================================================================== */
.confirm { display: inline-block; vertical-align: top; max-width: 100%; }
.confirm > summary { list-style: none; }
.confirm > summary::-webkit-details-marker { display: none; }
.confirm > summary::marker { content: ""; }
.confirm[open] > summary.btn--danger { --btn-bg: #fdecec; --btn-bd: var(--bad-ink); }
.confirm__panel {
  display: grid; gap: 10px;
  width: max-content; max-width: min(360px, calc(100vw - 48px));
  margin-top: 8px; padding: 14px;
  border: 1px solid #efc0c0; border-radius: 10px;
  background: #fff7f7;
  color: var(--ink-2); font-size: 0.9rem; line-height: 1.5;
  text-align: left; white-space: normal;
  box-shadow: var(--shadow-sm);
}
.confirm__panel p { margin: 0; }
.confirm__panel form { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.confirm__panel .btn--danger { --btn-bg: var(--bad-ink); --btn-fg: #fff; --btn-bd: var(--bad-ink); }
.confirm__panel .btn--danger:hover { --btn-bg: #861414; --btn-bd: #861414; }

/* ==========================================================================
   Misc blocks
   ========================================================================== */
.pill-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.pill-list > li {
  padding: 3px 10px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper-2); color: var(--ink-2);
  font-size: 0.82rem; line-height: 1.5;
}

.code {
  margin: 0; padding: 14px 16px;
  max-height: 420px; overflow: auto;
  border-radius: 10px;
  background: var(--petrol-900); color: #cfe0e8;
  font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.6;
  white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 4;
  color-scheme: dark;
}

.adm-debug { margin-top: 20px; }
.adm-debug > summary { cursor: pointer; color: var(--ink-mute); font-size: 0.86rem; margin-bottom: 8px; }

/* ==========================================================================
   Signed-out pages (sign in, reset, errors)
   ========================================================================== */
.adm-auth { background: var(--limestone); }
.auth {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.15fr);
  min-height: 100vh; min-height: 100dvh;
}
.auth__brand {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; gap: 48px;
  padding: clamp(28px, 4vw, 56px);
  color: var(--fg);
  color-scheme: dark;
  background:
    repeating-linear-gradient(176deg, transparent 0 46px, rgba(196, 222, 235, 0.035) 46px 47px),
    radial-gradient(70% 45% at 10% 105%, rgba(255, 139, 43, 0.26), transparent 70%),
    radial-gradient(60% 50% at 100% 0%, rgba(63, 183, 226, 0.12), transparent 70%),
    var(--petrol-900);
}
.auth__brand::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: var(--sheen); opacity: 0.85;
}
.auth__pitch { display: grid; gap: 16px; max-width: 30rem; }
.auth__eyebrow { font-family: var(--font-body); font-size: 0.95rem; font-weight: 500; color: rgba(232, 238, 241, 0.72); }
.auth__headline {
  font-family: var(--font-display); font-stretch: 112%;
  font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.5rem); font-weight: 700;
  letter-spacing: -0.03em; line-height: 1.08; color: var(--fg);
  text-wrap: balance;
}
.auth__facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; color: var(--fg-2); font-size: 0.92rem; }
.auth__facts li { display: flex; align-items: center; gap: 12px; }
.auth__facts .icon { width: 18px; height: 18px; color: var(--flare); }

.auth__main {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px;
}
.auth__main:focus { outline: none; }
.auth__card {
  width: 100%; max-width: 440px;
  display: grid; gap: 20px;
  padding: clamp(22px, 4vw, 36px);
  background: var(--paper);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 1px 2px rgba(10, 26, 34, 0.05), 0 30px 60px -32px rgba(10, 26, 34, 0.35);
}
.auth__head { display: grid; gap: 8px; }
.auth__head h1 {
  font-size: clamp(1.45rem, 1.25rem + 0.7vw, 1.75rem);
  font-weight: 700; font-stretch: 112%; letter-spacing: -0.025em; line-height: 1.12;
}
.auth__head p { color: var(--ink-2); }
.auth__head p.muted { color: var(--ink-mute); }
.auth__icon {
  display: grid; place-items: center;
  width: 44px; height: 44px; margin-bottom: 6px;
  border-radius: 12px;
  background: var(--petrol-900); color: var(--flare);
}
.auth__icon .icon { width: 22px; height: 22px; }
.auth__icon--good { background: #dbf4e6; color: var(--good-ink); }
.auth__icon--warn { background: #fbe7bf; color: var(--warn-ink); }
.auth__code { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--flare-ink); }
.auth__email { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.auth__form { display: grid; gap: 18px; }
.auth__form .btn--block { margin-top: 4px; min-height: 48px; font-size: 0.98rem; }
.auth__alt { text-align: center; font-size: 0.9rem; }
.auth__alt a { color: var(--flare-ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; border-radius: 3px; }
.auth__alt a:hover { color: var(--ink); }
.auth__note { padding: 14px 16px; border-radius: 10px; background: var(--paper-2); border: 1px solid var(--line); font-size: 0.9rem; }
.auth__note-title { font-weight: 600; color: var(--ink); }
.auth__list { margin: 6px 0 0; padding-left: 1.15em; display: grid; gap: 6px; color: var(--ink-2); font-size: 0.9rem; }
.auth__list a { color: var(--flare-ink); text-decoration: underline; text-underline-offset: 3px; }
.auth__list--plain { margin: 0; }
.auth__steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; counter-reset: step; }
.auth__steps li {
  position: relative; counter-increment: step;
  padding: 14px 16px 14px 52px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--paper-2);
  color: var(--ink-2); font-size: 0.9rem;
}
.auth__steps li::before {
  content: counter(step);
  position: absolute; left: 16px; top: 14px;
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--petrol-900); color: var(--flare);
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500;
}
.auth__steps strong { display: block; color: var(--ink); margin-bottom: 2px; }
.auth__foot { margin-top: 20px; font-size: 0.88rem; }
.auth__foot a {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink-mute); text-decoration: none; border-radius: 4px;
}
.auth__foot a:hover { color: var(--ink); }
.auth__foot .icon { width: 16px; height: 16px; }

@media (max-width: 899.98px) {
  .auth { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .auth__brand { flex-direction: row; align-items: center; gap: 16px; padding: 14px 16px; }
  .auth__brand::after { height: 2px; }
  .auth__pitch, .auth__facts { display: none; }
  .adm-logo--lg .adm-logo__mark { width: 24px; height: 29px; }
  .adm-logo--lg .adm-logo__name { font-size: 1.02rem; }
  .adm-logo--lg .adm-logo__sub { font-size: 0.52rem; margin-top: 4px; }
  .auth__main { justify-content: flex-start; padding: 28px 16px 40px; }
}
@media (max-width: 419.98px) {
  .auth__card { border-radius: 14px; }
  .auth__steps li { padding-left: 46px; }
  .auth__steps li::before { left: 12px; }
}

/* ==========================================================================
   Motion and contrast preferences
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  a.stat:hover { transform: none; }
}
@media (forced-colors: active) {
  .btn, .stat, .card, .flash, .callout, .badge, .tab.is-active, .pagination > .is-current { border: 1px solid CanvasText; }
  .switch__track { border: 1px solid CanvasText; }
  .chart__bar { fill: CanvasText; }
  .adm-nav__link.is-active { outline: 2px solid Highlight; }
}
@media print {
  .adm-side, .adm-header__actions, .skip-link, .pagination, .confirm { display: none !important; }
  .adm-shell { display: block; }
  .adm-body { background: #fff; }
  .card, .stat, .table-wrap { box-shadow: none; }
}

/* Four stat cards: 2 x 2 until there is room for one row of four, so a card never sits alone */
.stat-grid:has(> .stat:nth-child(4):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1200px) {
  .stat-grid:has(> .stat:nth-child(4):last-child) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .stat-grid:has(> .stat:nth-child(4):last-child) { grid-template-columns: minmax(0, 1fr); }
}
