/* ════════════════════════════════════════════════════════════════
   fRank Admin
   Re-implements the jl-engines admin_dashboard gem class contract in the
   Front Yard Fantasy brand: charcoal bars, cream paper, 2px keylines and
   hard offset shadows.

   Authority: docs/design/app-redesign/admin-portal-claim-invites.dc.html.
   Every engine page (resources, analytics, consensus, games) inherits the
   look through the generic classes below; nothing here is page-specific
   except the "Claim invites" block near the end.
   ════════════════════════════════════════════════════════════════ */

:root {
  --admin-sidebar-w: 268px;
  --admin-topbar-h: 66px;
  --admin-radius: 10px;
  --admin-radius-lg: 18px;
}

/* ── Admin tokens ───────────────────────────────────────────────
   The --a-* surface/ink/line values are the mockup's THEMES maps, verbatim.
   The ones below the divider are additions the mockup does not carry, each
   there because the mockup's own pairing measures under WCAG AA:

   --a-muted     small muted text. --a-ink60 is 3.60:1 on --a-alt in light;
                 this is 5.20:1. Dark's --a-ink60 already passes (4.89:1).
   --a-link      text links. Pink-deep #c82478 is 4.28:1 on --a-alt; this is
                 4.94:1. Dark needs a lighter pink than the fill (4.39 → 5.50).
   --a-onaccent  text on the pink fill. The mockup's cream is 2.64:1 and plain
                 charcoal #30202d is 4.44:1 -- a hair under 4.5 -- so this is
                 charcoal taken two steps darker (5.21:1).
   --a-edge      the 2px keyline. Charcoal in light, as drawn. In dark a
                 charcoal line on a charcoal page is no line at all, so
                 controls and cards take the mockup's own --a-line2 instead.

   The bars (--a-bar and the --a-nav* family) are charcoal in BOTH themes. */
.admin-body {
  --a-page: #fbf1e6;
  --a-alt: #f5e5d5;
  --a-card: #fdfaf6;
  --a-ink: #30202d;
  --a-ink80: #5a4855;
  --a-ink60: #84737f;
  --a-ink30: #c3b9c0;
  --a-line: #e0d4cb;
  --a-line2: #cbbdb2;
  --a-sh: rgba(48, 32, 45, 0.22);
  /* effects.css --texture-paper, copied: that file is a design reference,
     not a stylesheet the app serves. Light theme only. */
  --a-tex: repeating-linear-gradient(0deg, rgba(48, 32, 45, 0.038) 0 1px, transparent 1px 3px), repeating-linear-gradient(90deg, rgba(48, 32, 45, 0.028) 0 1px, transparent 1px 4px);

  --a-muted: #6b5a66;
  --a-link: #b81f6d;
  --a-accent: #f046a0;
  --a-onaccent: #1f131c;
  --a-edge: #30202d;

  --a-bar: #30202d;
  --a-onbar: #fadcc2;
  --a-navink60: rgba(250, 220, 194, 0.7);
  --a-navline: rgba(250, 220, 194, 0.16);
  --a-navhover: rgba(250, 220, 194, 0.1);

  --a-yellow: #faca16;
  --a-blue: #5197d2;
  --a-green: #1f7031;
  --a-orange: #ff7142;
  --a-charcoal: #30202d;
  --a-cream: #fadcc2;

  --a-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --a-fast: 120ms;
}
html[data-theme="dark"] .admin-body {
  --a-page: #251925;
  --a-alt: #31212e;
  --a-card: #2c1e2a;
  --a-ink: #fadcc2;
  --a-ink80: rgba(250, 220, 194, 0.82);
  --a-ink60: rgba(250, 220, 194, 0.58);
  --a-ink30: rgba(250, 220, 194, 0.3);
  --a-line: rgba(250, 220, 194, 0.14);
  --a-line2: rgba(250, 220, 194, 0.26);
  --a-sh: rgba(0, 0, 0, 0.5);
  --a-tex: none;

  --a-muted: rgba(250, 220, 194, 0.58);
  --a-link: #f56bb3;
  --a-edge: rgba(250, 220, 194, 0.26);
}

*, *::before, *::after { box-sizing: border-box; }
.admin-body {
  margin: 0;
  font-family: var(--font);
  font-weight: 500;
  background: var(--a-page);
  color: var(--a-ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.admin-body a { color: var(--a-link); text-decoration: none; }
.admin-body a:hover { color: var(--a-ink); }
.admin-body :focus-visible { outline: 2px solid var(--a-ink); outline-offset: 2px; }
.admin-body .topbar :focus-visible,
.admin-body .sidebar :focus-visible { outline-color: var(--a-onbar); }

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  background: var(--a-bar);
  color: var(--a-onbar);
  border-bottom: 3px solid var(--a-charcoal);
  height: var(--admin-topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 16px; min-width: 0; }
/* Drawer trigger. Only exists below the sidebar breakpoint — above it the
   sidebar is always on screen and a toggle would be a dead control. */
.topbar-burger {
  display: none;
  background: none; border: none; padding: 8px; margin-left: -8px;
  border-radius: 999px; cursor: pointer;
  color: var(--a-onbar);
  align-items: center; justify-content: center;
}
.topbar-burger:hover { background: var(--a-navhover); }
.admin-body .topbar-brand {
  display: flex; align-items: center; gap: 12px;
  color: var(--a-onbar);
  flex-shrink: 0;
}
.admin-body .topbar-brand:hover { color: var(--a-onbar); }
.topbar-brand img { display: block; }
.topbar-wordmark {
  font-family: var(--font-headline);
  font-weight: 500; font-size: 27px; line-height: 1;
  letter-spacing: -0.005em;
}
.topbar-sep { width: 2px; height: 24px; background: var(--a-navline); flex-shrink: 0; }
/* The oval "ADMIN" device. */
.topbar-title {
  font-family: var(--font-display);
  font-size: 11px; font-weight: 700; color: var(--a-onbar);
  text-transform: uppercase; letter-spacing: 0.16em; line-height: 1.2;
  border: 2px solid var(--a-onbar);
  border-radius: 50% / 50%;
  padding: 5px 16px;
  white-space: nowrap;
}
.topbar-right { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.admin-body .topbar-link {
  font-family: var(--font-display);
  font-size: 11px; font-weight: 700; color: var(--a-onbar);
  text-transform: uppercase; letter-spacing: 0.12em;
  border-bottom: 2px solid var(--a-accent);
  padding-bottom: 2px;
  white-space: nowrap;
  transition: color var(--a-fast) var(--a-ease);
}
.admin-body .topbar-link:hover { color: var(--a-yellow); }
.topbar-link-short { display: none; }
/* Charcoal initial on the pink disc, not the mockup's cream: see
   --a-onaccent. */
.topbar-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: var(--a-accent);
  border: 2px solid var(--a-onbar);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700; font-size: 15px; line-height: 1;
  color: var(--a-onaccent);
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: var(--admin-topbar-h); left: 0; bottom: 0;
  width: var(--admin-sidebar-w);
  background: var(--a-bar);
  color: var(--a-onbar);
  padding: 22px 18px 16px;
  overflow-y: auto; z-index: 90;
  display: flex; flex-direction: column;
  scrollbar-color: rgba(250, 220, 194, 0.3) transparent;
}
/* Scrim behind the drawer. Inert above the breakpoint. */
.sidebar-backdrop {
  display: none;
  position: fixed; inset: var(--admin-topbar-h) 0 0 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 89;
  opacity: 0; transition: opacity 0.2s ease;
}
.sidebar-backdrop.is-visible { opacity: 1; }

.sidebar-section { margin: 0; }
/* The 2px rule between groups belongs to the gap, not to either group. */
.sidebar-section + .sidebar-section {
  margin-top: 18px; padding-top: 18px;
  border-top: 2px solid var(--a-navline);
}
.sidebar-label {
  font-family: var(--font-display);
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--a-yellow);
  padding: 0 8px 8px;
}
.sidebar-nav {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 4px;
}
.sidebar-nav li { margin: 0; }
.admin-body .sidebar-nav a,
.admin-body .sidebar-link {
  display: flex; align-items: center; gap: 10px;
  /* 5/10 + the 2px transparent border = the mockup's 7/12 box; the border is
     there so the active patch's keyline does not shift the row. */
  padding: 5px 10px; border-radius: 999px;
  border: 2px solid transparent;
  font-family: var(--font);
  font-size: 14.5px; font-weight: 500; line-height: 1.35;
  color: var(--a-onbar);
  transition: background var(--a-fast) var(--a-ease);
}
.admin-body .sidebar-nav a:hover,
.admin-body .sidebar-link:hover { background: var(--a-navhover); color: var(--a-onbar); }
/* Where you are: the pink patch. Charcoal label, not the mockup's cream --
   see --a-onaccent. */
.admin-body .sidebar-nav a.active,
.admin-body .sidebar-link.active {
  font-family: var(--font-display);
  font-size: 12.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--a-accent); color: var(--a-onaccent);
  border-color: var(--a-charcoal);
  padding: 6px 12px;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4);
}
.sidebar-badge {
  margin-left: auto;
  font-family: var(--font-display);
  font-size: 11px; font-weight: 700;
  color: inherit;
}
.sidebar-foot {
  margin-top: auto; padding: 16px 8px 0;
  font-size: 11.5px; color: var(--a-navink60);
}
.sidebar-section + .sidebar-foot { padding-top: 34px; }

/* ── Main content ───────────────────────────────────────────── */
.layout-main {
  margin-left: var(--admin-sidebar-w);
  margin-top: var(--admin-topbar-h);
  min-height: calc(100vh - var(--admin-topbar-h));
  background-color: var(--a-page);
  background-image: var(--a-tex);
}
.content {
  max-width: 1260px;
  margin: 0 auto;
  padding: 34px 40px 80px;
}

/* ── Page header ────────────────────────────────────────────── */
.page-header { margin-bottom: 26px; }
/* Clash caps line above the headline. Optional -- engine pages that only
   emit an h1 still read correctly without one. */
.page-eyebrow {
  display: block;
  font-family: var(--font-display);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--a-muted);
  margin-bottom: 8px;
}
.page-header h1 {
  font-family: var(--font-headline);
  font-size: 46px; font-weight: 500; line-height: 0.98;
  letter-spacing: -0.005em;
  color: var(--a-ink);
  margin: 0 0 10px;
}
.page-header p {
  color: var(--a-ink80); font-size: 15.5px; line-height: 1.5;
  margin: 0; max-width: 64ch; text-wrap: pretty;
}
/* Title on the left, action on the right — wrapping instead of crushing the
   title once there isn't room for both on one line. */
.page-header.is-split {
  display: flex; flex-wrap: wrap;
  align-items: flex-end; justify-content: space-between;
  gap: 16px 28px;
}

/* ── Breadcrumbs ────────────────────────────────────────────── */
.breadcrumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font-family: var(--font-display);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--a-muted);
  margin-bottom: 18px;
}
.admin-body .breadcrumbs a { color: var(--a-muted); }
.admin-body .breadcrumbs a:hover { color: var(--a-ink); }
.breadcrumbs .sep { opacity: 0.5; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background-color: var(--a-card);
  background-image: var(--a-tex);
  border: 2px solid var(--a-edge);
  border-radius: var(--admin-radius-lg);
  box-shadow: 4px 5px 0 var(--a-sh);
  overflow: hidden;
}
/* The charcoal bar. Views drop app-token colours into card headers inline
   (var(--text-muted) and friends), and those are tuned for paper -- so the
   shared tokens are re-pointed at bar-safe values for everything inside. */
.card-header {
  --text: #fadcc2;
  --text-muted: rgba(250, 220, 194, 0.78);
  --text-dim: rgba(250, 220, 194, 0.7);
  --text-rgb: 250 220 194;
  --text-muted-rgb: 222 196 176;
  --text-dim-rgb: 205 181 164;
  --border: rgba(250, 220, 194, 0.26);
  padding: 14px 24px;
  background: var(--a-bar);
  color: var(--a-onbar);
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
}
.card-header h2 {
  font-family: var(--font-display);
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--a-onbar);
  margin: 0;
}
/* The yellow aside at the right end of a bar. */
.card-header-note {
  font-family: var(--font-display);
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--a-yellow);
  white-space: nowrap;
}
.card-body { padding: 22px 24px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-grid .full-width { grid-column: 1 / -1; }

/* ── Stats grid ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}
.stat-card {
  background-color: var(--a-card);
  background-image: var(--a-tex);
  border: 2px solid var(--a-edge);
  border-radius: var(--admin-radius-lg);
  box-shadow: 4px 5px 0 var(--a-sh);
  padding: 18px 20px;
}
.stat-card .stat-label {
  font-family: var(--font-display);
  font-size: 10px; font-weight: 700; color: var(--a-muted);
  text-transform: uppercase; letter-spacing: 0.16em;
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.stat-card .stat-label svg { opacity: 0.7; }
.stat-card .stat-value {
  font-family: var(--font-headline);
  font-size: 40px; font-weight: 500; line-height: 1;
  letter-spacing: -0.005em;
  color: var(--a-ink);
}
.stat-card .stat-value.is-accent { color: var(--a-link); }
.stat-card .stat-value.is-success { color: var(--green); }
.stat-card .stat-value.is-warn    { color: var(--orange); }
.stat-card .stat-value.is-info    { color: var(--blue); }
.stat-card .stat-value.is-muted   { color: var(--a-muted); }
.stat-card .stat-value.is-danger  { color: var(--red); }
.stat-card .stat-sub {
  font-size: 12.5px; color: var(--a-muted); margin-top: 8px;
}

/* ── Engine grid (config index) ─────────────────────────────── */
.engine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}
.admin-body .engine-card {
  background-color: var(--a-card);
  background-image: var(--a-tex);
  border: 2px solid var(--a-edge);
  border-radius: var(--admin-radius-lg);
  box-shadow: 4px 5px 0 var(--a-sh);
  padding: 20px;
  transition: transform var(--a-fast) var(--a-ease), box-shadow var(--a-fast) var(--a-ease);
  display: flex; flex-direction: column; gap: 12px;
  text-decoration: none; color: inherit;
}
.admin-body a.engine-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 7px 0 var(--a-sh);
  color: inherit;
}
.engine-card-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.engine-icon {
  width: 38px; height: 38px; border-radius: 50%;
  border: 2px solid var(--a-edge);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.engine-name { font-weight: 600; font-size: 16px; line-height: 1.2; color: var(--a-ink); }
.engine-desc { font-size: 13.5px; color: var(--a-ink80); line-height: 1.5; }
.engine-meta {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: auto;
}
.engine-mount {
  font-family: var(--mono);
  font-size: 12px; color: var(--a-ink80);
  background: var(--a-alt);
  padding: 2px 8px; border-radius: 6px;
}

/* ── Category headers ───────────────────────────────────────── */
.category-header {
  font-family: var(--font-display);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--a-muted);
  margin: 34px 0 14px;
  display: flex; align-items: center; gap: 12px;
}
.category-header:first-child { margin-top: 0; }
.category-line { flex: 1; height: 2px; background: var(--a-line2); }

/* ── Badges ─────────────────────────────────────────────────── */
/* Outlined pills on a solid brand field. Each pairing below is AA on its own
   fill, which is why they are literal: a patch reads the same on paper and
   on the charcoal bar, in either theme. */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-display);
  font-size: 10.5px; font-weight: 700; line-height: 1.3;
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 3px 11px; border-radius: 999px;
  white-space: nowrap;
  border: 2px solid var(--a-charcoal);
}
.badge-green  { background: var(--a-green);  color: var(--a-cream); }
.badge-red    { background: #c82478;         color: #fff; }
.badge-yellow { background: var(--a-yellow); color: var(--a-charcoal); }
.badge-blue   { background: var(--a-blue);   color: var(--a-charcoal); }
.badge-purple { background: #7d47c2;         color: #fff; }
.badge-orange { background: var(--a-orange); color: var(--a-charcoal); }
.badge-muted  { background: var(--a-alt);    color: var(--a-ink80); border-color: var(--a-ink30); }
.card-header .badge { border-color: var(--a-cream); }
.card-header .badge-muted { background: transparent; color: var(--a-cream); }

.status-dot {
  width: 7px; height: 7px; border-radius: 50%; display: inline-block;
}
.status-dot.on   { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.off  { background: var(--red); opacity: 0.6; }
.status-dot.warn { background: var(--yellow); }
.badge .status-dot.on { background: currentColor; box-shadow: none; }

/* ── Config table (gem partials) ────────────────────────────── */
.config-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.config-table th {
  text-align: left; padding: 12px 16px;
  background: var(--a-alt);
  font-family: var(--font-display);
  font-weight: 700; color: var(--a-muted);
  border-bottom: 2px solid var(--a-edge);
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.16em;
}
.config-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--a-line);
  vertical-align: top;
}
.config-table tr:last-child td { border-bottom: none; }
.config-table tr:hover td { background: var(--a-alt); }
.config-table .attr-name  { font-family: var(--mono); font-size: 12px; color: var(--a-link); }
.config-table .attr-value { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.config-table .attr-type  { font-size: 11px; color: var(--a-muted); }

/* ── Route + env lists ──────────────────────────────────────── */
.route-list, .env-list { list-style: none; padding: 0; margin: 0; }
.route-list li, .env-list li {
  display: flex; gap: 10px; padding: 9px 0;
  border-bottom: 1px solid var(--a-line);
  font-size: 13px;
}
.route-list li:last-child, .env-list li:last-child { border-bottom: none; }
.route-list li { align-items: baseline; }
.env-list li   { align-items: center; }
.route-verb {
  font-family: var(--mono);
  font-size: 10px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px;
  min-width: 52px; text-align: center; flex-shrink: 0;
}
.route-verb.get          { background: var(--blue-bg);   color: var(--blue); }
.route-verb.post         { background: var(--green-bg);  color: var(--green); }
.route-verb.put,
.route-verb.patch        { background: var(--yellow-bg); color: var(--yellow); }
.route-verb.delete       { background: var(--red-bg);    color: var(--red); }
.route-path { font-family: var(--mono); font-size: 12px; color: var(--a-ink); }
.route-desc { color: var(--a-muted); font-size: 12px; margin-left: auto; }
.env-name   { font-family: var(--mono); font-size: 12px; color: var(--a-ink); }

/* ── Provider grid + demo + dependencies ────────────────────── */
.provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.provider-card {
  background: var(--a-alt);
  border: 2px solid var(--a-ink30);
  border-radius: var(--admin-radius); padding: 14px; text-align: center;
}
.provider-card .name   { font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.provider-card .status { font-size: 11px; }
.demo-section {
  background: var(--a-alt);
  border: 2px solid var(--a-ink30);
  border-radius: var(--admin-radius);
  padding: 18px; margin-top: 14px;
}
.demo-section h3 {
  font-size: 14.5px; font-weight: 600; margin: 0 0 12px;
  display: flex; align-items: center; gap: 8px;
}
.dep-chain { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.dep-arrow { color: var(--a-muted); font-size: 11px; }

/* ── Code blocks ────────────────────────────────────────────── */
pre, .query-box {
  background: var(--a-alt);
  border: 1px solid var(--a-line2);
  border-radius: var(--admin-radius);
  padding: 14px;
  font-family: var(--mono);
  font-size: 12px; line-height: 1.6;
  overflow-x: auto;
  color: var(--a-ink80);
  margin: 0;
}
pre .comment, .query-box .comment { color: var(--a-muted); font-style: italic; }
pre .key,     .query-box .key     { color: var(--a-link); }
pre .str,     .query-box .str     { color: var(--green); }
pre .num,     .query-box .num     { color: var(--orange); }
.query-box { white-space: pre; }

/* ── Librarian filters ──────────────────────────────────────── */
.librarian-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filter-chip {
  background: transparent;
  border: 2px solid var(--a-ink30);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px; font-family: var(--mono);
  color: var(--a-ink80);
}
.filter-chip.active {
  border-color: var(--a-edge);
  color: var(--a-onbar);
  background: var(--a-bar);
}

/* ── Modal ──────────────────────────────────────────────────── */
.louie-modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(48, 32, 45, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
html[data-theme="dark"] .louie-modal-backdrop { background: rgba(0,0,0,0.65); }
.louie-modal-backdrop.hidden { display: none; }
.louie-modal-content {
  background-color: var(--a-card);
  background-image: var(--a-tex);
  color: var(--a-ink);
  border: 2px solid var(--a-edge);
  border-radius: var(--admin-radius-lg);
  max-width: 560px; width: 100%;
  max-height: 80vh; overflow-y: auto;
  padding: 24px;
  box-shadow: 6px 7px 0 rgba(0, 0, 0, 0.35);
}

/* ── Flash toasts ───────────────────────────────────────────── */
/* A ticket stub: paper, keyline, hard shadow, and a coloured tear-off edge
   carrying the status. Ink on paper rather than tinted text on a tint, so
   the message reads at full contrast in both themes. */
.louie-flash {
  padding: 12px 16px;
  border-radius: var(--admin-radius);
  font-size: 13.5px; line-height: 1.45;
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
  min-width: 280px; max-width: 520px;
  background: var(--a-card);
  color: var(--a-ink);
  border: 2px solid var(--a-edge);
  border-left-width: 10px;
  box-shadow: 3px 4px 0 var(--a-sh);
  animation: admin-flash-in 0.25s ease-out;
}
.louie-flash.notice { border-left-color: var(--a-green); }
.louie-flash.alert  { border-left-color: var(--a-accent); }
.louie-flash .dismiss-btn {
  margin-left: auto; background: none; border: none; color: inherit;
  cursor: pointer; opacity: 0.7; font-size: 18px; line-height: 1; padding: 0 4px;
}
.louie-flash .dismiss-btn:hover { opacity: 1; }
@keyframes admin-flash-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ── Show fields (resource detail) ──────────────────────────── */
.show-fields { display: grid; grid-template-columns: 1fr; gap: 0; }
.show-field {
  display: flex; padding: 13px 0;
  border-bottom: 1px solid var(--a-line);
}
.show-field:last-child { border-bottom: none; }
.show-field dt {
  width: 200px; flex-shrink: 0;
  font-family: var(--font-display);
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--a-muted);
  padding-top: 3px;
}
.show-field dd { flex: 1; font-size: 14.5px; color: var(--a-ink); margin: 0; }

/* ── Custom action button success state ─────────────────────── */
[data-custom-action].action-done {
  background: var(--a-green);
  color: var(--a-cream);
  border-color: var(--a-charcoal);
}

/* ════════════════════════════════════════════════════════════
   Host additions (used by analytics + consensus polish)
   ════════════════════════════════════════════════════════════ */

/* ── Pill nav + tab nav ─────────────────────────────────────── */
/* One device for both: outlined pills, the current one filled charcoal.
   (.tab-nav used to be underline tabs; the brand has no underline tab.) */
.pill-nav, .tab-nav { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tab-nav { margin-bottom: 22px; }
.admin-body .pill-nav a,
.admin-body .tab-nav a {
  font-family: var(--font-display);
  font-size: 11px; font-weight: 700; line-height: 1.3;
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 7px 15px;
  border-radius: 999px;
  border: 2px solid var(--a-ink30);
  color: var(--a-muted);
  white-space: nowrap;
  transition: transform var(--a-fast) var(--a-ease), color var(--a-fast) var(--a-ease), border-color var(--a-fast) var(--a-ease);
}
.admin-body .pill-nav a:hover,
.admin-body .tab-nav a:hover {
  color: var(--a-ink); border-color: var(--a-edge);
  transform: translate(-1px, -1px);
}
.admin-body .pill-nav a.active,
.admin-body .tab-nav a.active {
  background: var(--a-bar); color: var(--a-onbar); border-color: var(--a-edge);
  transform: none;
}
/* Dark only: the mockup keeps the charcoal fill here too, but charcoal on a
   charcoal page leaves "which one am I on" resting on a hairline, so the
   current pill inverts to cream. */
html[data-theme="dark"] .admin-body .pill-nav a.active,
html[data-theme="dark"] .admin-body .tab-nav a.active {
  background: var(--a-cream); color: var(--a-charcoal); border-color: var(--a-cream);
}
/* Count rides inside the pill so the operator can see how much sits behind
   a tab they are not on -- the whole point of splitting a list up. */
.tab-nav .tab-count {
  display: inline-block; margin-left: 6px;
  font-variant-numeric: tabular-nums;
}

/* ── Data table (analytics + consensus tables) ──────────────── */
/* Wide tables scroll sideways rather than reflow. Without an edge cue a
   clipped table just reads as truncated data, so paint a shadow at whichever
   edge still has content past it: the `local` cover layers scroll away with
   the content and reveal the `scroll` shadow layers pinned to the box.
   `.overflow-x-auto` is the wrapper the louie DataTableComponent emits — we
   can't add a class to it from here, but inside .admin-body it's only ever
   a data table.

   A cover has to match whatever its scroller sits on or it reads as a stripe
   down the edge instead of vanishing. Every table now sits on card stock:
   one inside a .card borrows the card's, and one straight on the page is
   given its own keyline + shadow below so it IS the card. */
.data-table-wrap,
.consensus-matrix,
.admin-body .overflow-x-auto { --scroll-cover: var(--a-card); }
.consensus-matrix { --scroll-cover: var(--a-page); }

.data-table-wrap,
.consensus-matrix,
.admin-body .overflow-x-auto {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  background:
    linear-gradient(to right, var(--scroll-cover) 40%, transparent) left center local,
    linear-gradient(to left,  var(--scroll-cover) 40%, transparent) right center local,
    linear-gradient(to right, rgba(0, 0, 0, 0.16), transparent) left center scroll,
    linear-gradient(to left,  rgba(0, 0, 0, 0.16), transparent) right center scroll;
  background-repeat: no-repeat;
  background-size: 32px 100%, 32px 100%, 14px 100%, 14px 100%;
}
.data-table-wrap {
  background-color: var(--a-card);
  border: 2px solid var(--a-edge);
  border-radius: var(--admin-radius-lg);
  box-shadow: 4px 5px 0 var(--a-sh);
}
.card .data-table-wrap {
  border: none; border-radius: 0; box-shadow: none;
}
/* A table in a padded card body runs edge to edge, so its column-head band
   meets the card's keyline instead of floating inside a margin. */
.card-body > .data-table-wrap { margin: -22px -24px; }
.card-body > .data-table-wrap:not(:first-child) { margin-top: 16px; }
.card-body > .data-table-wrap:not(:last-child) { margin-bottom: 16px; }

.data-table {
  width: 100%; border-collapse: collapse; font-size: 13.5px;
}
.data-table thead th {
  text-align: left; padding: 13px 16px;
  background: var(--a-alt);
  font-family: var(--font-display);
  font-weight: 700; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--a-muted);
  border-bottom: 2px solid var(--a-edge);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--a-line);
  transition: background var(--a-fast) var(--a-ease);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--a-alt); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .muted { color: var(--a-muted); }
.data-table .accent { color: var(--a-link); font-weight: 600; }
.data-table .success { color: var(--green); }
.data-table .warn { color: var(--orange); }
.data-table tr.status-ok   { border-left: 4px solid var(--green); }
.data-table tr.status-warn { border-left: 4px solid var(--orange); }
.data-table tr.status-err  { border-left: 4px solid var(--red); }
.data-table tr.status-mute { border-left: 4px solid var(--a-ink30); }

/* The louie DataTableComponent (every engine resource index) ships Tailwind
   utilities, not the classes above, and its markup is the gem's. These
   selectors dress that exact markup in the same card + bar + column-head
   treatment; they out-rank the utilities on specificity, never !important,
   except where the gem itself writes an inline style. */
.admin-body .bg-surface.border.border-border.rounded-lg.overflow-hidden {
  background-color: var(--a-card);
  background-image: var(--a-tex);
  border: 2px solid var(--a-edge);
  border-radius: var(--admin-radius-lg);
  box-shadow: 4px 5px 0 var(--a-sh);
}
.admin-body .bg-surface.border.rounded-lg.overflow-hidden > .px-5.py-4.border-b {
  background: var(--a-bar);
  border-bottom: none;
  padding: 14px 24px;
}
.admin-body .bg-surface.border.rounded-lg.overflow-hidden > .px-5.py-4.border-b h2 {
  font-family: var(--font-display);
  font-size: 12px; font-weight: 700; letter-spacing: 0.14em;
  color: var(--a-onbar);
}
.admin-body .bg-surface.border.rounded-lg.overflow-hidden > .px-5.py-4.border-b .text-text-dim {
  font-family: var(--font-display);
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--a-yellow);
}
/* The gem's "New" link sets background + colour inline. */
.admin-body .bg-surface.border.rounded-lg.overflow-hidden > .px-5.py-4.border-b a.bg-accent {
  font-family: var(--font-display);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  background: var(--a-accent) !important;
  color: var(--a-onaccent) !important;
  border: 2px solid var(--a-charcoal);
  border-radius: 999px;
  padding: 5px 14px;
}
.admin-body .overflow-x-auto table thead th {
  background: var(--a-alt);
  font-family: var(--font-display);
  font-weight: 700; font-size: 10px; letter-spacing: 0.16em;
  color: var(--a-muted);
  border-bottom: 2px solid var(--a-edge);
  padding-top: 13px; padding-bottom: 13px;
  white-space: nowrap;
}
.admin-body .overflow-x-auto table thead th a { color: var(--a-muted); }
.admin-body .overflow-x-auto table thead th a.text-accent,
.admin-body .overflow-x-auto table thead th a:hover { color: var(--a-ink); }
.admin-body .overflow-x-auto table tbody td { border-bottom-color: var(--a-line); }
.admin-body .overflow-x-auto table tbody tr:hover { background: var(--a-alt); }

/* ── Action buttons ─────────────────────────────────────────── */
/* Outlined pill; lifts onto a hard shadow on hover and presses back down.
   `.admin-body` in the selector is load-bearing: `.admin-body a` sets link
   colour at (0,1,1) and used to beat a bare `.btn` on an anchor. */
.admin-body .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 18px;
  font-family: var(--font-display);
  font-size: 11.5px; font-weight: 700; line-height: 1.3;
  text-transform: uppercase; letter-spacing: 0.1em;
  white-space: nowrap;
  border-radius: 999px;
  border: 2px solid var(--a-ink30);
  background: transparent;
  color: var(--a-ink80);
  cursor: pointer;
  transition: transform var(--a-fast) var(--a-ease), box-shadow var(--a-fast) var(--a-ease), border-color var(--a-fast) var(--a-ease), color var(--a-fast) var(--a-ease);
}
.admin-body .btn:hover {
  color: var(--a-ink); border-color: var(--a-edge);
  transform: translate(-2px, -2px);
  box-shadow: 3px 3px 0 var(--a-sh);
}
.admin-body .btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--a-sh); }
.admin-body .btn:disabled,
.admin-body .btn[disabled] { opacity: 0.6; cursor: default; transform: none; box-shadow: none; }
/* Primary: the pink pill. Label is --a-onaccent, not the mockup's cream. */
.admin-body .btn-accent {
  background: var(--a-accent); color: var(--a-onaccent);
  border-color: var(--a-charcoal);
  box-shadow: 3px 3px 0 var(--a-sh);
}
.admin-body .btn-accent:hover {
  color: var(--a-onaccent); border-color: var(--a-charcoal);
  box-shadow: 5px 5px 0 var(--a-sh);
}
.admin-body .btn-accent:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--a-sh); }
.admin-body .btn-success {
  background: var(--a-green); color: var(--a-cream);
  border-color: var(--a-charcoal);
}
.admin-body .btn-success:hover { color: var(--a-cream); border-color: var(--a-charcoal); }
/* Destructive, kept quiet: same outline as its neighbours, pink-deep label. */
.admin-body .btn-danger { color: var(--a-link); }
.admin-body .btn-danger:hover { color: var(--a-link); border-color: var(--a-link); }
.admin-body .btn-link {
  font-family: var(--font-display);
  background: none; border: none; border-bottom: 2px solid var(--a-accent);
  border-radius: 0;
  color: var(--a-link); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  cursor: pointer; padding: 0 0 2px;
}
.admin-body .btn-link:hover { color: var(--a-ink); transform: none; box-shadow: none; }
.admin-body .btn-sm  { padding: 6px 14px; font-size: 10.5px; }
.admin-body .btn-md  { padding: 7px 16px; font-size: 11px; }
.admin-body .btn-lg  { padding: 13px 26px; font-size: 12.5px; }
/* On the charcoal bar the outline and label go cream. */
.admin-body .card-header .btn:not(.btn-accent):not(.btn-success) {
  color: var(--a-onbar); border-color: rgba(250, 220, 194, 0.45);
}
.admin-body .card-header .btn:not(.btn-accent):not(.btn-success):hover { border-color: var(--a-onbar); }

/* Card status borders (consensus source cards etc.) */
.card.status-ok   { border-left: 8px solid var(--green); }
.card.status-warn { border-left: 8px solid var(--orange); }
.card.status-err  { border-left: 8px solid var(--red); }
.card.status-mute { border-left: 8px solid var(--a-ink30); }

/* ── Inline note (decision-gate callout etc) ────────────────── */
.admin-note {
  margin-top: 16px; padding: 14px 18px;
  background: var(--a-alt);
  border: 1px solid var(--a-line2);
  border-radius: var(--admin-radius);
  font-size: 13px; color: var(--a-ink80);
  line-height: 1.55;
}

/* ── Empty state ────────────────────────────────────────────── */
.admin-empty {
  color: var(--a-ink80); font-size: 14.5px;
  padding: 26px 28px;
  border: 2px dashed var(--a-ink30);
  border-radius: var(--admin-radius-lg);
}
.card .admin-empty { border: none; border-radius: 0; padding: 16px 0; }

/* ── Form fields ────────────────────────────────────────────── */
/* fyf_theme's .auth-field kit styles only text/email/password inputs
   (components.css:227-233). Admin forms also use select, textarea and
   datetime-local, so the whole kit is restated here once, in admin ink. */
.admin-body .auth-field label {
  font-family: var(--font-display);
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--a-muted);
  margin-bottom: 7px;
}
.admin-body .auth-field input[type="email"],
.admin-body .auth-field input[type="password"],
.admin-body .auth-field input[type="text"],
.admin-body .auth-field input[type="datetime-local"],
.admin-body .auth-field select,
.admin-body .auth-field textarea {
  width: 100%; padding: 11px 14px;
  border-radius: var(--admin-radius);
  font-size: 14.5px; font-family: var(--font); font-weight: 500;
  background: var(--a-page); color: var(--a-ink);
  border: 2px solid var(--a-ink30);
  transition: border-color var(--a-fast) var(--a-ease), box-shadow var(--a-fast) var(--a-ease);
}
.admin-body .auth-field input:focus,
.admin-body .auth-field select:focus,
.admin-body .auth-field textarea:focus {
  outline: none; border-color: var(--a-edge);
  box-shadow: 3px 3px 0 var(--a-sh);
}
.admin-body .auth-field input::placeholder,
.admin-body .auth-field textarea::placeholder { color: var(--a-muted); opacity: 0.85; }
.admin-body .auth-field .hint {
  font-size: 12.5px; line-height: 1.45; color: var(--a-muted); margin-top: 6px;
}

/* ── Position group (consensus unmatched players) ──────────── */
.position-group { margin-bottom: 14px; }
.position-group-summary {
  cursor: pointer; padding: 12px 18px;
  background: var(--a-card);
  border: 2px solid var(--a-edge);
  border-radius: var(--admin-radius-lg);
  font-size: 14.5px; font-weight: 600; color: var(--a-ink);
  display: flex; align-items: center; gap: 8px;
  list-style: none;
}
.position-group-summary::-webkit-details-marker { display: none; }
.position-group[open] .position-group-summary {
  border-bottom-left-radius: 0; border-bottom-right-radius: 0;
}
.position-group-body {
  margin-top: 0;
  border-top-left-radius: 0; border-top-right-radius: 0;
  border-top: none;
  overflow: visible;
}

/* Row layout used inside grouped lists (e.g. position groups, log lists) */
.row-divided {
  padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--a-line);
}
.row-divided.last { border-bottom: none; }
.row-rank { font-size: 12px; color: var(--a-muted); font-family: var(--mono); min-width: 28px; }
.row-name { font-weight: 600; font-size: 14.5px; color: var(--a-ink); }
.row-team { font-size: 12.5px; color: var(--a-muted); }
.row-meta { font-size: 11.5px; color: var(--a-muted); margin-top: 2px; margin-left: 38px; }

/* ── Match-search popup (consensus matching UI) ─────────────── */
.match-details { position: relative; }
.match-popup {
  margin-top: 8px; padding: 12px;
  background: var(--a-card);
  border: 2px solid var(--a-edge);
  border-radius: var(--admin-radius);
  box-shadow: 4px 5px 0 var(--a-sh);
  min-width: 280px;
  position: absolute; z-index: 10; right: 0;
}
.match-popup-input {
  width: 100%; padding: 7px 10px; font-size: 13.5px;
  border: 2px solid var(--a-ink30); border-radius: var(--admin-radius);
  background: var(--a-page); color: var(--a-ink);
  margin-bottom: 8px;
}
.match-popup-results { max-height: 200px; overflow-y: auto; }
.match-popup-empty { font-size: 12.5px; color: var(--a-muted); padding: 8px; }
.match-popup-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0; border-bottom: 1px solid var(--a-line); margin: 0;
}
.match-popup-row:last-child { border-bottom: none; }
.match-popup-row .name   { font-size: 13.5px; color: var(--a-ink); font-weight: 600; }
.match-popup-row .meta   { color: var(--a-muted); font-size: 11.5px; font-weight: 400; }
.match-popup-row .link-btn {
  padding: 3px 12px; background: var(--a-accent); color: var(--a-onaccent);
  font-family: var(--font-display);
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  border-radius: 999px;
  border: 2px solid var(--a-charcoal); cursor: pointer;
}
.match-summary {
  font-family: var(--font-display);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--a-link);
  cursor: pointer; list-style: none;
}
.match-summary::-webkit-details-marker { display: none; }


/* ── Theme toggle (lives on the charcoal bar) ───────────────── */
/* .topbar in the selector out-ranks design_tokens.css's
   html[data-theme="dark"] .theme-toggle, which paints an app-surface chip. */
.admin-body .topbar .theme-toggle {
  width: 38px; height: 38px;
  background: transparent;
  color: var(--a-onbar);
  border: 2px solid rgba(250, 220, 194, 0.45);
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background var(--a-fast) var(--a-ease), border-color var(--a-fast) var(--a-ease);
}
.admin-body .topbar .theme-toggle:hover {
  background: var(--a-navhover); color: var(--a-onbar); border-color: var(--a-onbar);
}
.theme-toggle .theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .theme-icon-sun  { display: none; }
html[data-theme="dark"] .theme-toggle .theme-icon-moon { display: inline-block; }

/* ── Responsive ─────────────────────────────────────────────── */
/* Tablet and below: the sidebar becomes a drawer. It used to be
   display:none here, which left every admin page under 900px with no
   navigation at all. */
@media (max-width: 900px) {
  .topbar-burger { display: inline-flex; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    will-change: transform;
  }
  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.28);
  }

  /* Present but click-through until opened, so the invisible scrim never
     eats taps on the page behind it. */
  .sidebar-backdrop { display: block; pointer-events: none; }
  .sidebar-backdrop.is-visible { pointer-events: auto; }

  .admin-body.drawer-open { overflow: hidden; }

  .admin-body .sidebar-nav a,
  .admin-body .sidebar-link { min-height: 44px; padding-top: 10px; padding-bottom: 10px; }

  .topbar { padding: 0 18px; }
  .layout-main { margin-left: 0; }
  .content { padding: 26px 20px 56px; }
  .page-header h1 { font-size: 38px; }
  .engine-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .provider-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .admin-body .btn-sm { min-height: 36px; padding: 8px 14px; }

  /* A row of pills scrolls rather than stacking three deep above the
     content. Scrollbar hidden — the cut-off pill is the cue. The padding
     keeps the hover lift and focus ring inside the scroller's clip. */
  .tab-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px;
    margin-left: -4px; margin-right: -4px;
  }
  .tab-nav::-webkit-scrollbar { display: none; }
  .tab-nav a { white-space: nowrap; flex-shrink: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar, .sidebar-backdrop { transition: none; }
  .admin-body .btn, .admin-body .engine-card,
  .admin-body .pill-nav a, .admin-body .tab-nav a { transition: none; }
  .admin-body .btn:hover, .admin-body a.engine-card:hover,
  .admin-body .pill-nav a:hover, .admin-body .tab-nav a:hover { transform: none; }
}

/* Phone: reclaim the topbar, and stop two-column pairs from splitting a
   narrow screen into two useless halves. */
@media (max-width: 560px) {
  :root { --admin-topbar-h: 58px; }
  .topbar { padding: 0 12px; gap: 10px; }
  .topbar-left { gap: 10px; }
  .topbar-right { gap: 12px; }
  .topbar-sep, .topbar-title { display: none; }
  .topbar-link-full { display: none; }
  .topbar-link-short { display: inline; }
  .topbar-brand img { height: 32px !important; }
  .topbar-wordmark { font-size: 23px; }
  .topbar-avatar,
  .admin-body .topbar .theme-toggle { width: 34px; height: 34px; }

  .page-header h1 { font-size: 32px; }
  .page-header p { font-size: 14.5px; }

  .card-header { padding: 12px 16px; flex-wrap: wrap; }
  .card-body { padding: 16px; }
  .card-body > .data-table-wrap { margin: -16px; }
  .card-body > .data-table-wrap:not(:first-child) { margin-top: 12px; }
  .card-body > .data-table-wrap:not(:last-child) { margin-bottom: 12px; }

  .show-field { flex-direction: column; gap: 4px; }
  .show-field dt { width: auto; }

  .louie-flash { min-width: 0; max-width: calc(100vw - 40px); }
}

@media (max-width: 480px) {
  .content { padding: 20px 14px 48px; }
  .stats-grid { grid-template-columns: 1fr; }
}

/* ── Consensus matrix ───────────────────────────────────────── */
.matrix-legend {
  display: flex; gap: 18px; align-items: center;
  margin-bottom: 12px; font-size: 12.5px; color: var(--a-muted);
}
.matrix-legend .lg-item { display: flex; align-items: center; gap: 6px; }
.matrix-legend .lg-dot {
  width: 10px; height: 10px; border-radius: 3px;
  background: var(--a-alt); border-left: 3px solid var(--a-ink30);
}
.matrix-legend .lg-dot.status-ok   { border-left-color: var(--green); }
.matrix-legend .lg-dot.status-warn { border-left-color: var(--orange); }
.matrix-legend .lg-dot.status-mute { border-left-color: var(--a-ink30); }

.consensus-matrix { overflow-x: auto; }
.matrix-table {
  border-collapse: separate; border-spacing: 6px;
  width: 100%; table-layout: fixed;
}
.matrix-table th {
  font-family: var(--font-display);
  font-size: 10px; font-weight: 700; color: var(--a-muted);
  text-transform: uppercase; letter-spacing: 0.14em; padding: 6px 8px;
}
.matrix-table .league-head {
  text-align: center; color: var(--a-ink);
  border-bottom: 2px solid var(--a-edge);
}
.matrix-table .scoring-head { text-align: center; }
.matrix-table .row-head { text-align: left; color: var(--a-ink); white-space: nowrap; }
.matrix-table .corner { text-align: left; }

.matrix-cell {
  position: relative;
  background: var(--a-card);
  border: 2px solid var(--a-ink30);
  border-left: 6px solid var(--a-ink30);
  border-radius: var(--admin-radius);
  padding: 8px 10px; min-width: 96px; vertical-align: top;
}
.matrix-cell.status-ok   { border-left-color: var(--green); }
.matrix-cell.status-warn { border-left-color: var(--orange); }
.matrix-cell.status-mute { border-left-color: var(--a-ink30); }

.matrix-cell .cell-rate {
  font-family: var(--font-headline);
  font-size: 22px; font-weight: 500; line-height: 1.1; color: var(--a-ink);
}
.matrix-cell .cell-meta { font-size: 11px; color: var(--a-muted); font-family: var(--mono); margin-top: 2px; }
.matrix-cell .cell-empty { font-size: 18px; color: var(--a-muted); }

.matrix-cell .cell-actions {
  position: absolute; inset: 0;
  display: flex; gap: 10px; align-items: center; justify-content: center;
  background: var(--a-alt); border-radius: calc(var(--admin-radius) - 2px);
  opacity: 0; transition: opacity 0.12s;
}
.matrix-cell:hover .cell-actions,
.matrix-cell:focus-within .cell-actions { opacity: 1; }
.matrix-cell .cell-actions form { margin: 0; }

/* Overlay actions render as proper pill buttons: Run (filled), View (outlined). */
.admin-body .matrix-cell .cell-actions button.btn-link,
.admin-body .matrix-cell .cell-actions a.btn-link {
  padding: 5px 14px; border-radius: 999px;
  font-size: 10.5px; line-height: 1.4; cursor: pointer;
  border: 2px solid var(--a-ink30);
}
.admin-body .matrix-cell .cell-actions button.btn-link {
  background: var(--a-accent); color: var(--a-onaccent); border-color: var(--a-charcoal);
}
.admin-body .matrix-cell .cell-actions button.btn-link:hover { color: var(--a-onaccent); }
.admin-body .matrix-cell .cell-actions a.btn-link {
  background: var(--a-card); color: var(--a-ink80);
}
.admin-body .matrix-cell .cell-actions a.btn-link:hover {
  color: var(--a-ink); border-color: var(--a-edge);
}

/* ════════════════════════════════════════════════════════════
   Claim invites (admin/contest_claims)
   ════════════════════════════════════════════════════════════ */

/* Contest picker + status filter on one line, as drawn. */
.claim-toolbar {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 12px 14px;
  margin-bottom: 20px;
}
.claim-toolbar .tab-nav { margin-bottom: 0; }
.claim-contest-picker { display: flex; align-items: center; gap: 14px; margin: 0; }
.claim-toolbar-label {
  font-family: var(--font-display);
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--a-muted);
}
.claim-toolbar-sep { width: 2px; height: 20px; background: var(--a-line2); }
/* A native select wearing the mockup's pill: the chevron is drawn as two
   gradient strokes so it takes --a-muted in either theme, where an inline
   SVG data-URI could only ever be one fixed colour. */
.claim-contest-picker select {
  appearance: none; -webkit-appearance: none;
  max-width: 100%;
  padding: 9px 40px 9px 18px;
  border-radius: 999px;
  font-size: 14.5px; font-family: var(--font); font-weight: 500; line-height: 1.3;
  color: var(--a-ink);
  background-color: var(--a-card);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--a-muted) 50%),
    linear-gradient(135deg, var(--a-muted) 50%, transparent 50%);
  background-position: calc(100% - 21px) 55%, calc(100% - 15px) 55%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  border: 2px solid var(--a-edge);
  box-shadow: 3px 3px 0 var(--a-sh);
  cursor: pointer;
  transition: transform var(--a-fast) var(--a-ease);
}
.claim-contest-picker select:hover { transform: translate(-1px, -1px); }

.claim-card .card-header { padding: 16px 32px; }
.claim-card .data-table thead th,
.claim-card .data-table tbody td { padding-left: 12px; padding-right: 12px; }
.claim-card .data-table thead th { padding-top: 14px; padding-bottom: 14px; }
.claim-card .data-table tbody td { padding-top: 18px; padding-bottom: 18px; vertical-align: middle; }
.claim-card .data-table th:first-child,
.claim-card .data-table td:first-child { padding-left: 32px; }
.claim-card .data-table th:last-child,
.claim-card .data-table td:last-child { padding-right: 32px; }
/* Creator takes every spare pixel so the status/link/action columns pack
   against the right edge as one group, instead of the copy control and the
   row actions sitting on opposite sides of a wide empty gutter. */
.claim-table th:first-child, .claim-table td:first-child { width: 100%; }
.claim-table th:not(:first-child), .claim-table td:not(:first-child) { white-space: nowrap; }

.claim-creator { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.claim-avatar {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--a-edge);
  background: var(--a-alt);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700; font-size: 12.5px; line-height: 1;
  color: var(--a-ink);
}
/* Names wrap; they are never ellipsised (the mockup clips them). */
.claim-name { display: block; font-weight: 600; font-size: 15.5px; line-height: 1.2; color: var(--a-ink); }
.claim-meta { display: block; font-size: 12.5px; line-height: 1.3; color: var(--a-muted); margin-top: 2px; }
.claim-board {
  font-family: var(--font-display);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--a-muted);
}
.claim-board .badge { margin-left: 6px; }
.claim-status { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.claim-table td small { font-size: 12.5px; color: var(--a-muted); }
.claim-table .badge { padding: 4px 12px; }
/* "Copy link": a text control underlined in pink, not another pill -- the
   pills in this row are the actions that change something. */
.claim-copy {
  font-family: var(--font-display);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--a-link);
  background: none; border: none; border-bottom: 2px solid var(--a-accent);
  padding: 0 0 2px; cursor: pointer;
  transition: color var(--a-fast) var(--a-ease);
}
.claim-copy:hover { color: var(--a-ink); }
.claim-actions { display: inline-flex; gap: 8px; justify-content: flex-end; align-items: center; }
.claim-actions form { margin: 0; }

/* The taped note. Cream stock, grid-paper rule and tape are the same in
   both themes -- it is a piece of paper stuck to the page, and paper does
   not invert -- so its colours are literal rather than --a-* tokens. */
.claim-note {
  position: relative; display: inline-block;
  margin: 44px 0 12px 10px;
  max-width: 760px;
  transform: rotate(-1.2deg);
  background-color: #fdeee2;
  background-image:
    repeating-linear-gradient(0deg, rgba(81, 151, 210, 0.24) 0 1px, transparent 1px 11px),
    repeating-linear-gradient(90deg, rgba(81, 151, 210, 0.24) 0 1px, transparent 1px 11px);
  border: 1px solid #cbbdb2;
  padding: 20px 26px;
  box-shadow: 3px 4px 0 var(--a-sh);
}
.claim-note::before,
.claim-note::after { content: ""; position: absolute; }
.claim-note::before {
  top: -11px; left: 38px; width: 96px; height: 22px;
  background: linear-gradient(180deg, rgba(240, 70, 160, 0.92), rgba(200, 36, 120, 0.8));
  transform: rotate(-2.5deg);
}
.claim-note::after {
  bottom: -11px; right: 44px; width: 82px; height: 20px;
  background: linear-gradient(180deg, rgba(255, 113, 66, 0.9), rgba(224, 80, 31, 0.78));
  transform: rotate(1.8deg);
}
.claim-note-label {
  display: block;
  font-family: var(--font-display);
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.18em;
  color: #c82478;
  margin-bottom: 7px;
}
.claim-note p {
  font-size: 15px; line-height: 1.5; color: #30202d;
  margin: 0; text-wrap: pretty;
}
.claim-note p + p { margin-top: 8px; }

.claim-form-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 8px 32px; align-items: start;
}
.claim-form-actions { margin-top: 18px; }
.admin-body .claim-form .auth-field textarea.claim-csv {
  font-family: var(--mono); font-size: 12px; min-height: 320px;
}

@media (max-width: 700px) {
  .claim-toolbar-sep { display: none; }
  .claim-card .card-header { padding: 12px 16px; }
  .claim-card .data-table th:first-child,
  .claim-card .data-table td:first-child { padding-left: 16px; }
  .claim-card .data-table th:last-child,
  .claim-card .data-table td:last-child { padding-right: 16px; }
  .claim-card .data-table tbody td { padding-top: 14px; padding-bottom: 14px; }
  .claim-creator { min-width: 170px; }
  .claim-note { margin: 34px 4px 12px; padding: 18px 20px; transform: rotate(-0.8deg); }
  .claim-form-grid { grid-template-columns: 1fr; }
}
