/* ==========================================================================
   REC ADM
   Shell theme, components, and layout primitives.
   ========================================================================== */

/* ── 1. Color & type ────────────────────────────────────────────────────
   Status tones mix toward text so they stay legible on light and dark. */
:root {
  --adm-theme: light;
  --adm-bg: transparent;
  --adm-surface: rgba(17, 24, 39, 0.035);
  --adm-surface-2: color-mix(in srgb, var(--adm-text) 6%, var(--adm-surface));
  --adm-text: #111827;
  --adm-muted: #6b7280;
  --adm-subtle: color-mix(in srgb, var(--adm-muted) 82%, var(--adm-surface));
  --adm-accent: #2563eb;
  --adm-accent-2: color-mix(in srgb, #d29a2c 84%, var(--adm-text));
  --adm-on-accent: #ffffff;
  --adm-border: rgba(17, 24, 39, 0.12);
  --adm-border-strong: color-mix(in srgb, var(--adm-text) 20%, transparent);
  --adm-ok: color-mix(in srgb, #1f9d6b 80%, var(--adm-text));
  --adm-warn: color-mix(in srgb, #c7860f 82%, var(--adm-text));
  --adm-risk: color-mix(in srgb, #d5483f 84%, var(--adm-text));
  --adm-info: color-mix(in srgb, #3a86c8 82%, var(--adm-text));
  --adm-series-1: var(--adm-info);
  --adm-series-2: var(--adm-accent);
  --adm-series-3: var(--adm-accent-2);
  --adm-series-4: var(--adm-muted);
  --adm-series-5: var(--adm-ok);
  --adm-series-6: var(--adm-risk);
  --adm-shadow-1: 0 1px 2px color-mix(in srgb, var(--adm-text) 6%, transparent);
  --adm-shadow-2: 0 1px 2px color-mix(in srgb, var(--adm-text) 5%, transparent),
    0 8px 24px color-mix(in srgb, var(--adm-text) 8%, transparent);
  --adm-radius: 0.75rem;
  --adm-radius-sm: 6px;
  --adm-radius-lg: 14px;
  --adm-font: Inter, "PingFang SC", "Noto Sans SC", -apple-system, system-ui, sans-serif;
  --adm-font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --adm-page: #ffffff;
  --adm-chrome: rgba(17, 24, 39, 0.02);
  color-scheme: light;
}

:root[data-theme='dark'] {
  --adm-theme: dark;
  --adm-surface: rgba(255, 255, 255, 0.05);
  --adm-surface-2: color-mix(in srgb, var(--adm-text) 6%, var(--adm-surface));
  --adm-text: #f3f4f6;
  --adm-muted: #9aa6bd;
  --adm-subtle: color-mix(in srgb, var(--adm-muted) 82%, var(--adm-surface));
  --adm-accent: #6ea8fe;
  --adm-accent-2: color-mix(in srgb, #d29a2c 84%, var(--adm-text));
  --adm-on-accent: #111827;
  --adm-border: rgba(255, 255, 255, 0.12);
  --adm-border-strong: color-mix(in srgb, var(--adm-text) 17%, transparent);
  --adm-shadow-1: 0 1px 0 color-mix(in srgb, var(--adm-text) 4%, transparent) inset,
    0 1px 2px rgba(0, 0, 0, 0.35);
  --adm-shadow-2: 0 1px 0 color-mix(in srgb, var(--adm-text) 5%, transparent) inset,
    0 8px 24px rgba(0, 0, 0, 0.45);
  --adm-page: #0d0f13;
  --adm-chrome: rgba(255, 255, 255, 0.02);
  color-scheme: dark;
}

/* Admin-derived tokens in the shell's idiom: rules and washes are the text
   color at low alpha, never a separate gray. */
:root {
  --adm-rule: color-mix(in srgb, var(--adm-text) 9%, transparent);
  --adm-rule-soft: color-mix(in srgb, var(--adm-text) 6%, transparent);
  --adm-wash: color-mix(in srgb, var(--adm-text) 4%, transparent);
  --adm-line: color-mix(in srgb, var(--adm-text) 30%, transparent);
  --adm-accent-wash: color-mix(in srgb, var(--adm-accent) 10%, transparent);
  --adm-accent-line: color-mix(in srgb, var(--adm-accent) 45%, transparent);
  --adm-rail: 232px;
  --adm-control: 32px;
  --adm-motion: 120ms ease;
  --adm-z: 60;

  /* Legacy aliases kept for older template hooks. */
  --bg-canvas: var(--adm-page);
  --bg-sidebar: var(--adm-chrome);
  --bg-surface: var(--adm-surface);
  --bg-surface-hover: var(--adm-surface-2);
  --bg-input: var(--adm-surface);
  --border-subtle: var(--adm-rule);
  --border-default: var(--adm-border);
  --border-strong: var(--adm-border-strong);
  --border-focus: var(--adm-accent);
  --text-main: var(--adm-text);
  --text-secondary: var(--adm-muted);
  --text-muted: var(--adm-subtle);
  --text-dim: var(--adm-subtle);
  --accent: var(--adm-accent);
  --accent-hover: var(--adm-accent);
  --accent-subtle: var(--adm-accent-wash);
  --color-online: var(--adm-ok);
  --color-offline: var(--adm-muted);
  --color-coruna: var(--adm-info);
  --color-darksword: var(--adm-accent-2);
  --color-warning: var(--adm-warn);
  --color-danger: var(--adm-risk);
  --color-purple: var(--adm-accent-2);
  --radius-xs: 5px;
  --radius-sm: var(--adm-radius-sm);
  --radius-md: 10px;
  --radius-lg: var(--adm-radius-lg);
  --radius-full: 999px;
}

/* ── 2. Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--adm-page);
  color: var(--adm-text);
  font-family: var(--adm-font);
  font-size: 14px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; line-height: 1.3; text-wrap: balance; }
h1 { font-size: 1.6em; letter-spacing: -0.02em; line-height: 1.22; }
h2 { font-size: 1.16em; letter-spacing: -0.006em; }
h3 { font-size: 1em; }
h4 {
  font-size: 0.76em;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--adm-muted);
}
p { margin: 0 0 0.85em; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }
strong, b { font-weight: 650; }
hr { height: 0; margin: 2em 0; border: 0; border-top: 1px solid var(--adm-rule); }

a { color: var(--adm-accent); text-decoration: none; text-underline-offset: 0.18em; }
a:hover { text-decoration: underline; text-decoration-thickness: 1px; }

code, pre, .mono, kbd, samp {
  font-family: var(--adm-font-mono);
}
code {
  font-size: 0.875em;
  padding: 1.5px 6px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--adm-text) 8%, transparent);
  color: var(--adm-text);
  border: 1px solid color-mix(in srgb, var(--adm-text) 9%, transparent);
  font-weight: 450;
}
pre code { background: transparent; border: 0; padding: 0; border-radius: 0; font-size: inherit; }

ul, ol { margin: 0 0 0.95em; padding-left: 1.35em; }
li { margin: 0.28em 0; }
li::marker { color: var(--adm-muted); }

blockquote {
  margin: 1.1em 0;
  padding: 0.1em 0 0.1em 1em;
  border-left: 2px solid var(--adm-border);
  color: var(--adm-muted);
}

.muted { color: var(--adm-muted); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.spread { justify-content: space-between; }
.ml { margin-left: auto; }
.nowrap { white-space: nowrap; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--adm-text) 22%, transparent);
  background-clip: content-box;
  border: 1px solid transparent;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--adm-text) 38%, transparent); }

/* Tone contract (component shell). */
:where([data-tone='ok']) { --adm-tone: var(--adm-ok); }
:where([data-tone='warn']) { --adm-tone: var(--adm-warn); }
:where([data-tone='risk']) { --adm-tone: var(--adm-risk); }
:where([data-tone='info']) { --adm-tone: var(--adm-info); }
:where([data-tone='accent']) { --adm-tone: var(--adm-accent); }

/* ── 3. Shell ─────────────────────────────────────────────────────────── */
.app, .layout {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 44px minmax(0, 1fr);
  grid-template-columns: var(--adm-rail) minmax(0, 1fr);
  grid-template-areas: 'tb tb' 'side stage';
  background: var(--adm-page);
}

.tb, .top-bar {
  grid-area: tb;
  position: sticky;
  top: 0;
  z-index: var(--adm-z);
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 14px 0 16px;
  border-bottom: 1px solid var(--adm-border);
  background: var(--adm-page);
}
.tb-crumb, .top-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tb-crumb h1, .top-bar h1 {
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tb-right, .top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.side {
  grid-area: side;
  position: sticky;
  top: 44px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 44px);
  padding: 12px 10px 10px;
  background: var(--adm-chrome);
  border-right: 1px solid var(--adm-border);
}
.stage, .main { grid-area: stage; min-width: 0; display: flex; flex-direction: column; }
.content-body { flex: 1; padding: 20px 24px 40px; }

/* Brand */
.brand-wrapper { display: flex; align-items: center; gap: 8px; padding: 0 6px 14px; }
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--adm-text);
}
.brand-icon {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: var(--adm-accent);
  color: var(--adm-on-accent);
  box-shadow: var(--adm-shadow-1);
}
.brand-icon svg { display: block; }
.brand span { color: var(--adm-muted); font-weight: 500; }
.brand-tag {
  margin-left: auto;
  padding: 0 7px;
  border: 1px solid var(--adm-border);
  border-radius: 999px;
  background: var(--adm-surface);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--adm-muted);
}

/* Nav — a toned rail marks the active route, the shell's selection idiom. */
.nav-scroll { flex: 1; overflow-y: auto; padding: 0 2px; margin: 0 -2px; }
.nav-section-title {
  margin: 14px 0 5px;
  padding: 0 8px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--adm-muted);
}
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  height: 31px;
  padding: 0 9px;
  border-radius: 8px;
  color: var(--adm-muted);
  font-size: 0.84rem;
  font-weight: 500;
  transition: background var(--adm-motion), color var(--adm-motion);
}
.nav a svg { width: 15px; height: 15px; stroke-width: 1.7; flex: none; }
.nav a:hover { background: var(--adm-wash); color: var(--adm-text); text-decoration: none; }
.nav a.on {
  color: var(--adm-text);
  font-weight: 600;
  background:
    linear-gradient(var(--adm-accent), var(--adm-accent)) 0 0 / 2.5px 100% no-repeat,
    var(--adm-accent-wash);
}
.nav a.on svg { color: var(--adm-accent); }

.side-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding: 9px 7px 2px;
  border-top: 1px solid var(--adm-rule);
  font-size: 0.72rem;
  color: var(--adm-muted);
}
.side-status-indicator { display: inline-flex; align-items: center; gap: 6px; }
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--adm-ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--adm-ok) 18%, transparent);
}

/* Titleband controls */
.mobile-menu-btn, .tb-btn, .user-logout, .icon-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--adm-muted);
  cursor: pointer;
  transition: background var(--adm-motion), color var(--adm-motion);
}
.mobile-menu-btn:hover, .tb-btn:hover, .user-logout:hover, .icon-btn:hover {
  background: var(--adm-wash);
  color: var(--adm-text);
}
.mobile-menu-btn { display: none; }

.user-profile { display: flex; align-items: center; gap: 8px; }
.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--adm-accent) 16%, transparent);
  color: var(--adm-accent);
  font-size: 0.7rem;
  font-weight: 650;
}
.user-name { font-size: 0.82rem; color: var(--adm-muted); font-weight: 500; }

.btn-mnemonic-reveal {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 9px;
  border: 1px solid var(--adm-border);
  border-radius: 8px;
  background: var(--adm-surface);
  color: var(--adm-muted);
  font-size: 0.8rem;
  cursor: pointer;
}
.btn-mnemonic-reveal:hover { border-color: var(--adm-border-strong); color: var(--adm-text); }
.btn-mnemonic-reveal.revealed {
  border-color: color-mix(in srgb, var(--adm-warn) 40%, var(--adm-border));
  background: color-mix(in srgb, var(--adm-warn) 10%, transparent);
  color: var(--adm-warn);
}

/* ── 4. Controls ──────────────────────────────────────────────────────── */
button, input, select, textarea { font: inherit; }

.btn, a.btn, input[type='submit'],
button:where(:not(.copy-btn):not(.mobile-menu-btn):not(.tb-btn):not(.icon-btn):not(.user-logout):not(.seg button):not(.btn-mnemonic-reveal):not(.tab-btn):not(.swal2-styled)) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: var(--adm-control);
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: var(--adm-radius-sm);
  background: var(--adm-accent);
  color: var(--adm-on-accent);
  font-size: 0.83rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--adm-motion), border-color var(--adm-motion), color var(--adm-motion);
}
.btn:hover, a.btn:hover, input[type='submit']:hover,
button:where(:not(.copy-btn):not(.mobile-menu-btn):not(.tb-btn):not(.icon-btn):not(.user-logout):not(.seg button):not(.btn-mnemonic-reveal):not(.tab-btn):not(.swal2-styled)):hover {
  background: color-mix(in srgb, var(--adm-accent) 86%, var(--adm-text));
  text-decoration: none;
}
.btn.ghost, a.btn.ghost, button.btn.ghost {
  background: var(--adm-surface);
  border-color: var(--adm-border);
  color: var(--adm-text);
}
.btn.ghost:hover, a.btn.ghost:hover, button.btn.ghost:hover { background: var(--adm-surface-2); border-color: var(--adm-border-strong); }
.btn.danger, button.danger, button.btn.danger {
  background: color-mix(in srgb, var(--adm-risk) 8%, transparent);
  border-color: color-mix(in srgb, var(--adm-risk) 32%, var(--adm-border));
  color: var(--adm-risk);
}
.btn.danger:hover, button.danger:hover, button.btn.danger:hover {
  background: color-mix(in srgb, var(--adm-risk) 15%, transparent);
  border-color: color-mix(in srgb, var(--adm-risk) 50%, var(--adm-border));
}
.btn.sm, a.btn.sm, button.btn.sm { height: 28px; padding: 0 10px; font-size: 0.79rem; white-space: nowrap; }
/* Action cluster in a table's last cell. */
.actions { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
/* A centered count with an optional badge beneath it. */
.cell-stack { display: inline-flex; flex-direction: column; align-items: center; gap: 3px; }
/* Two lines in one cell, left aligned. */
.cell-stack-start { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 3px; }
/* Compact per-row asset counts: value over label. */
.cell-metrics { display: inline-flex; align-items: flex-end; gap: 14px; }
.cell-metrics > span { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.25; }
.cell-metrics > span > b { font-size: 0.86rem; font-weight: 650; }
.cell-metrics > span > small {
  color: var(--adm-muted);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.cell-metrics > span.has-secret > b { color: var(--adm-ok); }
/* Truncated identifier: the full value stays in title and on the copy button. */
code.uuid { font-size: 0.78rem; letter-spacing: 0.01em; }

input[type='text'], input[type='password'], input[type='search'], input[type='number'], select, textarea {
  height: var(--adm-control);
  padding: 0 11px;
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius-sm);
  background: var(--adm-surface);
  color: var(--adm-text);
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--adm-motion), box-shadow var(--adm-motion);
}
textarea { height: auto; min-height: 84px; padding: 9px 11px; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus {
  border-color: var(--adm-accent-line);
  box-shadow: 0 0 0 3px var(--adm-accent-wash);
}
::placeholder { color: var(--adm-subtle); }

.seg {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--adm-border);
  border-radius: 8px;
  background: var(--adm-surface);
}
.seg button {
  height: 24px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--adm-muted);
  font-size: 0.78rem;
  font-weight: 550;
  cursor: pointer;
}
.seg button.on {
  background: var(--adm-page);
  color: var(--adm-text);
  box-shadow: var(--adm-shadow-1);
}

/* ── 5. Surfaces ──────────────────────────────────────────────────────── */
.card, .filter-card, .adm-card {
  margin-bottom: 12px;
  padding: 16px 18px;
  border: 1px solid var(--adm-border);
  border-radius: 12px;
  background: var(--adm-surface);
  box-shadow: var(--adm-shadow-1);
}
.filter-card { padding: 11px 13px; }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 14px;
  font-size: 0.92rem;
  font-weight: 650;
  letter-spacing: -0.006em;
}
.card-title svg { color: var(--adm-accent); flex: none; }
.card-subtitle { margin: -8px 0 14px; font-size: 0.83rem; color: var(--adm-muted); }

/* Page head — the hero idiom at application scale. */
.page-head {
  margin: 0 0 20px;
  padding: 18px 20px;
  border: 1px solid color-mix(in srgb, var(--adm-accent) 20%, transparent);
  border-radius: var(--adm-radius-lg);
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--adm-accent) 15%, transparent),
    color-mix(in srgb, var(--adm-accent-2) 6%, transparent) 62%,
    transparent);
}
.page-head h1 { font-size: 1.4rem; }
.page-head .adm-meta {
  margin: 0 0 0.5em;
  color: var(--adm-accent);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.page-head .adm-lede { margin: 0.5em 0 0; max-width: 60em; font-size: 0.94rem; color: var(--adm-muted); }

/* ── 6. Data views ────────────────────────────────────────────────────── */
.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}
table, .table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  line-height: 1.5;
}
.table { margin: 0; }
/* Data cells stay on one line; the wrapper scrolls instead of squeezing a
   column into a wrapped stack. */
.table th, .table td { white-space: nowrap; }
.table td .cell-sub, .table td.wrap { white-space: normal; }
th, td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--adm-rule);
  text-align: left;
  vertical-align: middle;
  overflow-wrap: break-word;
}
th {
  border-bottom-color: var(--adm-border);
  color: var(--adm-muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  background: transparent;
}
th:first-child, td:first-child { padding-left: 18px; }
th:last-child, td:last-child { padding-right: 18px; }
tbody tr:last-child > td { border-bottom: 0; }
tbody tr { transition: background var(--adm-motion); }
tbody tr:hover > td { background: var(--adm-wash); }

/* Table footer holding pagination under the last row. */
.table-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--adm-rule);
}
.table-foot:has(.pager:empty) { display: none; }
.card.is-flush tbody tr:last-child > td { border-bottom: 0; }
.table-foot > .pager { padding-top: 0; }

/* Small stacked cell text (a value with a secondary line under it). */
.cell-sub { font-size: 0.79rem; color: var(--adm-muted); }
.num { font-variant-numeric: tabular-nums; font-weight: 600; }
.center { text-align: center; }
.right { text-align: right; }

/* Search field with a leading icon. */
.field-icon { position: relative; display: block; min-width: 0; }
.field-icon > input { width: 100%; padding-left: 32px; }
.field-icon > svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--adm-subtle);
  pointer-events: none;
}
.filter-card .row > select { min-width: 0; }

/* Status: a dot plus a word, tinted toward the text color. */
.badge, .ui-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--adm-muted);
  font-size: 0.8rem;
  font-weight: 550;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.ui-status-badge .ui-status-dot { width: 6px; height: 6px; background: currentColor; }
.badge.on, .badge.done, .ui-status-badge.tone-success { color: var(--adm-ok); }
.badge.off { color: var(--adm-muted); }
.badge.pending, .ui-status-badge.tone-warning { color: var(--adm-warn); }
.badge.likely, .badge.sent { color: var(--adm-accent); }
.badge.coruna { color: var(--adm-info); }
.badge.darksword { color: var(--adm-accent-2); }
.badge.risk, .ui-status-badge.tone-danger { color: var(--adm-risk); }

/* Card that is nothing but a table: no inner padding, footer carries the rest. */
.card.is-flush { padding: 0; overflow: hidden; }
/* Head strip inside a flush card. */
.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--adm-rule);
}
.card-head > .card-title { margin: 0; }

/* Two-pane work surface: a narrow form beside a wide list. */
.split {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.split > .card { margin-bottom: 0; }
@media (max-width: 1080px) { .split { grid-template-columns: minmax(0, 1fr); } }
/* Command desk: the two panes share the width more evenly. */
.split-wide { grid-template-columns: minmax(320px, 1fr) minmax(340px, 1.2fr); }
@media (max-width: 1180px) { .split-wide { grid-template-columns: minmax(0, 1fr); } }

/* Labelled field with breathing room between stacked controls. */
.field-block { margin-bottom: 14px; }
.field-block > .kv-label { display: block; margin-bottom: 6px; }

/* Group Administrator row in the channel list. */
tr.is-self > td { background: var(--adm-accent-wash); }
/* One wallet paired with its credential block inside a framework section. */
.wallet-pair {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--adm-rule);
  border-radius: 10px;
  background: var(--adm-wash);
}
.wallet-pair > :last-child { margin-bottom: 0; }
.tg-col { min-width: 250px; }
.tg-inline-form input[type='password'],
.tg-inline-form input[type='text'] { height: 28px; width: 132px; font-size: 0.78rem; }
.tg-inline-form input[name='tg_chat_id'] { width: 104px; }
.promo-url { display: inline-block; max-width: 210px; }
.promo-url-wide { display: inline-block; max-width: 420px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
/* Single-purpose card that should not stretch across a wide stage. */
.card.narrow { max-width: 440px; }

/* Tone chip for metadata. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--adm-tone, var(--adm-muted)) 14%, transparent);
  color: color-mix(in srgb, var(--adm-tone, var(--adm-muted)) 88%, var(--adm-text));
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.7;
  white-space: nowrap;
}

/* Callout (report) — also the error / success surface. */
.adm-callout, .err-alert, .notice-ok {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0 0 14px;
  padding: 11px 14px;
  border: 1px solid color-mix(in srgb, var(--adm-tone, var(--adm-muted)) 26%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--adm-tone, var(--adm-muted)) 7%, transparent);
  color: color-mix(in srgb, var(--adm-tone, var(--adm-muted)) 88%, var(--adm-text));
  font-size: 0.86rem;
}
.adm-callout svg, .err-alert svg, .notice-ok svg { flex: none; margin-top: 1px; }
.err-alert { --adm-tone: var(--adm-risk); }
.notice-ok { --adm-tone: var(--adm-ok); }

/* Stats grid (report) */
.adm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr));
  gap: 12px;
  margin: 0 0 16px;
}
.adm-card, .adm-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  margin: 0;
  padding: 13px 15px;
  border: 1px solid var(--adm-border);
  border-radius: 12px;
  background: var(--adm-surface);
  box-shadow: var(--adm-shadow-1);
}
.adm-stat > span, .adm-stat > small {
  color: var(--adm-muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.adm-stat > strong, .adm-stat > b {
  font-size: 1.6em;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.2;
}
.adm-stat[data-tone] > strong, .adm-stat[data-tone] > b { color: var(--adm-tone); }

/* Key/value list (report) */
.adm-kv, .kv-grid {
  display: grid;
  grid-template-columns: minmax(5.5em, max-content) minmax(0, 1fr);
  gap: 9px 20px;
  margin: 0;
}
.adm-kv > dt, .kv-label {
  color: var(--adm-muted);
  font-size: 0.79rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.7;
}
.adm-kv > dd, .kv-val { min-width: 0; margin: 0; font-size: 0.86rem; }

/* Tabs — a segmented control, not an underline bar. */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 16px;
  padding: 3px;
  border: 1px solid var(--adm-border);
  border-radius: 10px;
  background: var(--adm-surface);
}
.tabs a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  border-radius: 7px;
  color: var(--adm-muted);
  font-size: 0.82rem;
  font-weight: 550;
  transition: background var(--adm-motion), color var(--adm-motion);
}
.tabs a:hover { background: var(--adm-wash); color: var(--adm-text); text-decoration: none; }
.tabs a.on {
  background: var(--adm-page);
  color: var(--adm-text);
  box-shadow: var(--adm-shadow-1);
}
.tab-count {
  padding: 0 6px;
  border-radius: 999px;
  background: var(--adm-wash);
  color: var(--adm-muted);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.7;
}
.tabs a.on .tab-count { background: color-mix(in srgb, var(--adm-accent) 14%, transparent); color: var(--adm-accent); }

/* Pagination — covers the app's own markup and both Bootstrap shapes
   ThinkPHP's paginator can emit. */
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.table-foot > .pager { padding-top: 0; }
.pager > a, .pager > span,
.pager ul, .pager ol { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin: 0; padding: 0; list-style: none; }
.pager li { margin: 0; list-style: none; }
.pager a, .pager span, .pager li > a, .pager li > span, .pager .page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid var(--adm-border);
  border-radius: 7px;
  background: var(--adm-surface);
  color: var(--adm-muted);
  font-size: 0.79rem;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}
.pager a:hover { border-color: var(--adm-border-strong); color: var(--adm-text); text-decoration: none; }
.pager .active > span, .pager .active > a, .pager > span.current,
.pager li.active, .pager li.active > span, .pager li.active > a, .pager .page-item.active .page-link {
  border-color: transparent;
  background: var(--adm-accent);
  color: var(--adm-on-accent);
  font-weight: 600;
}
.pager .disabled > a, .pager .disabled > span, .pager .page-item.disabled .page-link {
  opacity: 0.4;
  pointer-events: none;
}

/* ── 7. Secrets, media, notes ─────────────────────────────────────────── */
.copy-wrap { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.copy-btn {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--adm-subtle);
  cursor: pointer;
  transition: background var(--adm-motion), color var(--adm-motion);
}
.copy-btn svg { width: 13px; height: 13px; }
.copy-btn:hover { background: var(--adm-wash); color: var(--adm-text); }

.secret-box {
  margin: 9px 0;
  padding: 11px 13px;
  border: 1px solid var(--adm-border);
  border-radius: 10px;
  background: var(--adm-wash);
}
.secret-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  color: var(--adm-muted);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
/* Label for one credential kind inside a secret box. */
.secret-tag {
  color: var(--adm-accent-2);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.secret-content {
  font-family: var(--adm-font-mono);
  font-size: 0.82rem;
  line-height: 1.62;
  color: var(--adm-text);
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.wallet-fold { margin: 9px 0; }
.wallet-fold > summary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 0;
  color: var(--adm-text);
  font-size: 0.86rem;
  font-weight: 550;
  cursor: pointer;
}
.wallet-fold > summary::marker { color: var(--adm-muted); }

.photo-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 13px;
}
.photo-item {
  overflow: hidden;
  border: 1px solid var(--adm-border);
  border-radius: 12px;
  background: var(--adm-surface);
  box-shadow: var(--adm-shadow-1);
  transition: border-color var(--adm-motion), box-shadow var(--adm-motion);
}
.photo-item:hover { border-color: var(--adm-border-strong); box-shadow: var(--adm-shadow-2); }
.photo-thumb { position: relative; display: block; aspect-ratio: 1; background: var(--adm-wash); }
.photo-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-scan-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  padding: 2px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--adm-page) 82%, transparent);
  backdrop-filter: blur(8px);
  font-size: 0.72rem;
}
.photo-meta { display: flex; flex-direction: column; gap: 5px; padding: 10px 11px 11px; font-size: 0.78rem; }

.note-list-tg { display: flex; flex-direction: column; gap: 7px; }
.note-row-tg {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 2fr) auto;
  gap: 14px;
  align-items: center;
  padding: 11px 13px;
  border: 1px solid var(--adm-border);
  border-radius: 10px;
  background: var(--adm-surface);
}
.note-row-main { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-row-meta { display: flex; align-items: center; gap: 9px; justify-content: flex-end; }
@media (max-width: 900px) {
  .note-row-tg { grid-template-columns: 1fr; }
  .note-row-meta { justify-content: flex-start; }
}

/* Monospace islands keep a sunken well instead of a flat tint. */
.json-block, .swal-json, .promo-iframe-snippet {
  display: block;
  overflow: auto;
  padding: 12px 14px;
  border: 1px solid var(--adm-rule);
  border-radius: 8px;
  background: var(--adm-wash);
  color: var(--adm-text);
  font-family: var(--adm-font-mono);
  font-size: 0.8rem;
  line-height: 1.62;
  tab-size: 2;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.promo-iframe-snippet { font-size: 0.74rem; }
.money { color: var(--adm-info); font-weight: 650; }
.apps-all { display: none; }
.apps-all.show { display: block; }

/* ── 8. shell components (ported as-is) ─────────────────────────────────── */
.adm-hero { margin: 0 0 1.7em; }
.adm-steps, .adm-checklist { margin: 1.3em 0; padding: 0; list-style: none; }
.adm-steps { counter-reset: adm-step; }
.adm-steps > li {
  position: relative;
  min-height: 26px;
  margin: 0;
  padding: 2px 0 1.25em 40px;
  counter-increment: adm-step;
}
.adm-steps > li:last-child { padding-bottom: 0; }
.adm-steps > li::before {
  content: counter(adm-step);
  position: absolute;
  top: 0;
  left: 0;
  width: 26px;
  height: 26px;
  border: 1.5px solid var(--adm-line);
  border-radius: 50%;
  background: var(--adm-surface);
  color: var(--adm-muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 23px;
  text-align: center;
}
.adm-steps > li:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 31px;
  bottom: 5px;
  left: 12.25px;
  width: 1.5px;
  border-radius: 1px;
  background: var(--adm-rule);
}
.adm-steps > li[data-state='done']:not(:last-child)::after {
  background: color-mix(in srgb, var(--adm-ok) 45%, transparent);
}
.adm-steps > li[data-state='done']::before {
  content: '✓';
  border-color: color-mix(in srgb, var(--adm-ok) 55%, transparent);
  background: color-mix(in srgb, var(--adm-ok) 15%, var(--adm-surface));
  color: var(--adm-ok);
}
.adm-steps > li[data-state='blocked']::before {
  content: '!';
  border-color: color-mix(in srgb, var(--adm-risk) 55%, transparent);
  background: color-mix(in srgb, var(--adm-risk) 15%, var(--adm-surface));
  color: var(--adm-risk);
}
.adm-steps > li[data-state='current']::before {
  border-color: var(--adm-accent);
  color: var(--adm-accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--adm-accent) 16%, transparent);
}
.adm-steps > li:not([data-state]) { color: var(--adm-muted); }
.adm-steps > li small { display: block; margin-top: 0.1em; color: var(--adm-muted); font-size: 0.86em; font-weight: 400; }

.adm-checklist > li { position: relative; margin: 0; padding: 0.32em 0 0.32em 28px; }
.adm-checklist > li::before {
  content: '';
  position: absolute;
  top: 0.5em;
  left: 0;
  width: 17px;
  height: 17px;
  border: 1.5px solid var(--adm-line);
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
}
.adm-checklist > li[data-state='done']::before {
  content: '✓';
  border-color: color-mix(in srgb, var(--adm-ok) 55%, transparent);
  background: color-mix(in srgb, var(--adm-ok) 15%, var(--adm-surface));
  color: var(--adm-ok);
}
.adm-checklist > li[data-state='blocked']::before {
  content: '✕';
  border-color: color-mix(in srgb, var(--adm-risk) 55%, transparent);
  background: color-mix(in srgb, var(--adm-risk) 15%, var(--adm-surface));
  color: var(--adm-risk);
}
.adm-checklist > li[data-state='current']::before {
  content: '•';
  border-color: color-mix(in srgb, var(--adm-accent) 55%, transparent);
  background: color-mix(in srgb, var(--adm-accent) 15%, var(--adm-surface));
  color: var(--adm-accent);
}
.adm-checklist > li[data-state='done'] { color: var(--adm-muted); }

.adm-progress {
  --adm-progress: var(--adm-accent);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 12px;
  align-items: baseline;
  margin: 0.95em 0;
  font-size: 0.93em;
}
.adm-progress[data-tone] { --adm-progress: var(--adm-tone); }
.adm-progress > b, .adm-progress > strong, .adm-progress > output { font-weight: 650; }
.adm-progress > progress {
  grid-column: 1 / -1;
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--adm-text) 8%, transparent);
  appearance: none;
  -webkit-appearance: none;
}
.adm-progress > progress::-webkit-progress-bar { border-radius: 999px; background: transparent; }
.adm-progress > progress::-webkit-progress-value { border-radius: 999px; background: var(--adm-progress); }
.adm-progress > progress::-moz-progress-bar { border-radius: 999px; background: var(--adm-progress); }

.adm-compare {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(13rem, 100%), 1fr));
  gap: 12px;
  align-items: stretch;
  margin: 1.3em 0;
}
.adm-compare > * {
  min-width: 0;
  margin: 0;
  padding: 1em 1.15em;
  border: 1px solid var(--adm-border);
  border-radius: 12px;
  background: var(--adm-surface);
}
.adm-compare > [data-pick] {
  border-color: color-mix(in srgb, var(--adm-accent) 55%, transparent);
  background: color-mix(in srgb, var(--adm-accent) 5%, var(--adm-surface));
  box-shadow: inset 0 3px 0 var(--adm-accent), var(--adm-shadow-2);
}
.adm-compare > * > h2, .adm-compare > * > h3, .adm-compare > * > h4 { margin: 0 0 0.45em; font-size: 1.04em; }

.adm-matrix {
  width: 100%;
  margin: 1.3em 0;
  border-collapse: separate;
  border-spacing: 3px;
  font-size: 0.92em;
}
.adm-matrix th, .adm-matrix td {
  padding: 0.5em 0.65em;
  border: 0;
  border-radius: 6px;
  text-align: center;
  vertical-align: middle;
  background: none;
  font-size: inherit;
  letter-spacing: 0;
}
.adm-matrix thead th { color: var(--adm-muted); font-size: 0.88em; white-space: nowrap; }
.adm-matrix tbody th { width: 1%; padding-left: 0; color: var(--adm-text); text-align: left; white-space: nowrap; }
.adm-matrix td { background: color-mix(in srgb, var(--adm-text) 4%, transparent); }
.adm-matrix td[data-tone] {
  background: color-mix(in srgb, var(--adm-tone) 17%, transparent);
  color: color-mix(in srgb, var(--adm-tone) 72%, var(--adm-text));
  font-weight: 600;
}

[data-trend]::before { margin-right: 0.28em; font-size: 0.82em; }
[data-trend='up']::before { content: '▲'; }
[data-trend='down']::before { content: '▼'; }
[data-trend='flat']::before { content: '—'; }
[data-trend][data-tone] { color: var(--adm-tone); }

/* ── 9. shell diagrams (ported as-is) ───────────────────────────────────── */
.adm-flow, .adm-timeline, .adm-tree, .adm-tree ul { margin: 0; padding: 0; list-style: none; }
.adm-flow, .adm-timeline, .adm-tree { margin: 1.3em 0; --adm-diagram-line: var(--adm-line); --adm-diagram-rule: var(--adm-rule); }

.adm-flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 12px 36px; }
.adm-flow > li, .adm-lanes td > p, .adm-lanes td > div {
  margin: 0;
  padding: 0.62em 0.9em;
  border: 1px solid var(--adm-border);
  border-radius: 10px;
  background: var(--adm-surface);
  box-shadow: var(--adm-shadow-1);
  overflow-wrap: break-word;
}
.adm-flow > li[data-tone], .adm-lanes td > p[data-tone] {
  border-color: color-mix(in srgb, var(--adm-tone) 38%, var(--adm-border));
  background:
    linear-gradient(var(--adm-tone), var(--adm-tone)) 0 0 / 3px 100% no-repeat,
    color-mix(in srgb, var(--adm-tone) 8%, var(--adm-surface));
}
.adm-flow > li { position: relative; display: flex; flex: 1 1 7.5rem; flex-direction: column; justify-content: center; min-width: 0; }
.adm-flow > li[data-kind='decision'] {
  align-items: center;
  border-style: dashed;
  border-color: var(--adm-line);
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  padding-inline: 1.2em;
  text-align: center;
}
.adm-flow > li + li::before {
  content: '';
  position: absolute;
  top: 50%;
  left: -29px;
  width: 21px;
  border-top: 1.5px solid var(--adm-line);
  transform: translateY(-50%);
}
.adm-flow > li + li::after {
  content: '';
  position: absolute;
  top: 50%;
  left: -15px;
  width: 6px;
  height: 6px;
  border-top: 1.5px solid var(--adm-line);
  border-right: 1.5px solid var(--adm-line);
  transform: translateY(-50%) rotate(45deg);
}
.adm-flow[data-dir='down'] { flex-direction: column; flex-wrap: nowrap; gap: 30px; }
.adm-flow[data-dir='down'] > li { flex: 0 0 auto; }
.adm-flow[data-dir='down'] > li + li::before {
  top: -25px; left: 50%; width: 0; height: 19px; border-top: 0;
  border-left: 1.5px solid var(--adm-line); transform: translateX(-50%);
}
.adm-flow[data-dir='down'] > li + li::after { top: -13px; left: 50%; transform: translateX(-50%) rotate(135deg); }
.adm-flow > li small, .adm-timeline > li small {
  display: block;
  margin-top: 0.15em;
  color: var(--adm-muted);
  font-size: 0.84em;
  font-weight: 400;
}

.adm-lanes {
  width: 100%;
  margin: 1.3em 0;
  border: 1px solid var(--adm-border);
  border-radius: 12px;
  border-collapse: separate;
  border-spacing: 0;
  counter-reset: adm-phase;
  font-size: 0.93em;
}
.adm-lanes th, .adm-lanes td {
  padding: 0.7em 0.75em;
  border: 0;
  border-bottom: 1px solid var(--adm-rule);
  border-left: 1px dashed var(--adm-rule);
  text-align: left;
  vertical-align: middle;
  white-space: normal;
  overflow-wrap: break-word;
}
.adm-lanes tr > :first-child { border-left: 0; padding-left: 1em; }
.adm-lanes tr > :nth-child(2) { border-left-style: solid; }
.adm-lanes tbody tr:last-child > * { border-bottom: 0; }
.adm-lanes thead th {
  padding-block: 0.6em;
  background: var(--adm-wash);
  color: var(--adm-muted);
  font-size: 0.86em;
  font-weight: 600;
  white-space: nowrap;
}
.adm-lanes thead th:not(:first-child)::before {
  content: counter(adm-phase);
  counter-increment: adm-phase;
  display: inline-block;
  min-width: 1.55em;
  margin-right: 0.5em;
  border-radius: 999px;
  background: color-mix(in srgb, var(--adm-text) 9%, transparent);
  color: var(--adm-text);
  font-size: 0.92em;
  text-align: center;
}
.adm-lanes tbody th {
  width: 1%;
  background: var(--adm-wash);
  color: var(--adm-text);
  font-size: 1em;
  font-weight: 650;
  white-space: nowrap;
}
.adm-lanes thead tr:first-child > :first-child { border-top-left-radius: 11px; }
.adm-lanes thead tr:first-child > :last-child { border-top-right-radius: 11px; }
.adm-lanes tbody tr:last-child > :first-child { border-bottom-left-radius: 11px; }
.adm-lanes td > p, .adm-lanes td > div { min-width: 4.5em; padding: 0.45em 0.75em; border-radius: 8px; }

.adm-timeline > li { position: relative; margin: 0; padding: 0 0 1.25em 1.9em; }
.adm-timeline > li:last-child { padding-bottom: 0; }
.adm-timeline > li::before {
  content: '';
  position: absolute;
  top: 0.42em;
  left: 3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--adm-tone, var(--adm-muted));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--adm-tone, var(--adm-muted)) 18%, transparent);
}
.adm-timeline > li:not(:last-child)::after {
  content: '';
  position: absolute;
  top: calc(0.42em + 17px);
  bottom: calc(-0.42em + 8px);
  left: 7px;
  width: 1.5px;
  border-radius: 1px;
  background: var(--adm-rule);
}
.adm-timeline time {
  display: block;
  margin-bottom: 0.1em;
  color: var(--adm-muted);
  font-size: 0.82em;
  letter-spacing: 0.02em;
}

.adm-tree > li { font-weight: 650; }
.adm-tree ul { margin-left: 0.45em; padding-left: 1.25em; font-weight: 400; }
.adm-tree li { position: relative; margin: 0; padding: 0.22em 0; }
.adm-tree ul > li::before {
  content: '';
  position: absolute;
  top: 0;
  left: -1.25em;
  width: 0.9em;
  height: 0.98em;
  border-bottom: 1px solid var(--adm-line);
  border-left: 1px solid var(--adm-line);
  border-bottom-left-radius: 5px;
}
.adm-tree ul > li:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -1.25em;
  border-left: 1px solid var(--adm-line);
}

/* ── 10. Empty state ──────────────────────────────────────────────────── */
.empty-state, .is-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 auto;
  padding: 44px 24px;
  text-align: center;
  color: var(--adm-muted);
}
.empty-state-visual-inner {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 15px;
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius-lg);
  background: var(--adm-surface);
  color: var(--adm-subtle);
  box-shadow: var(--adm-shadow-1);
}
.empty-state-title { margin: 0 0 6px; color: var(--adm-text); font-size: 0.98rem; font-weight: 650; }
.empty-state-copy { max-width: 34em; margin: 0; font-size: 0.84rem; }

/* ── 11. Login ────────────────────────────────────────────────────────── */
.login-wrap {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--adm-page);
}
.login-box {
  width: 100%;
  max-width: 372px;
  padding: 28px 26px 24px;
  border: 1px solid color-mix(in srgb, var(--adm-accent) 20%, transparent);
  border-radius: var(--adm-radius-lg);
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--adm-accent) 12%, transparent),
    color-mix(in srgb, var(--adm-accent-2) 5%, transparent) 60%,
    var(--adm-surface));
  box-shadow: var(--adm-shadow-2);
}
.login-header { margin-bottom: 22px; text-align: center; }
.logo-badge {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin: 0 auto 13px;
  border-radius: var(--adm-radius-lg);
  background: var(--adm-accent);
  color: var(--adm-on-accent);
  box-shadow: var(--adm-shadow-1);
}
.login-box h1 { margin: 0 0 4px; font-size: 1.28rem; }
.login-box > .login-header p { margin: 0; color: var(--adm-muted); font-size: 0.82rem; }
.login-field { margin-bottom: 13px; }
.login-field label {
  display: block;
  margin-bottom: 6px;
  color: var(--adm-muted);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.login-field input { width: 100%; }
.login-box button[type='submit'] { width: 100%; margin-top: 7px; }

/* ── 12. Overlays ─────────────────────────────────────────────────────── */
#adm-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 15px;
  border: 1px solid var(--adm-border);
  border-radius: 10px;
  background: var(--adm-surface-2);
  color: var(--adm-text);
  box-shadow: var(--adm-shadow-2);
  font-size: 0.86rem;
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}
#adm-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.swal2-popup {
  border: 1px solid var(--adm-border) !important;
  border-radius: 12px !important;
  background: var(--adm-surface-2) !important;
  color: var(--adm-text) !important;
  box-shadow: var(--adm-shadow-2) !important;
  font-family: var(--adm-font) !important;
}
.swal2-title { color: var(--adm-text) !important; font-size: 1.1rem !important; }
.swal2-html-container { color: var(--adm-muted) !important; }
.swal2-input, .swal2-textarea, .swal2-select {
  background: var(--adm-surface) !important;
  color: var(--adm-text) !important;
  border: 1px solid var(--adm-border) !important;
  border-radius: var(--adm-radius-sm) !important;
}
.swal2-confirm {
  background: var(--adm-accent) !important;
  color: var(--adm-on-accent) !important;
  border-radius: var(--adm-radius-sm) !important;
}
.adm-swal-danger .swal2-confirm {
  background: var(--adm-risk) !important;
  color: var(--adm-on-accent) !important;
}
.swal2-cancel {
  background: var(--adm-surface) !important;
  color: var(--adm-text) !important;
  border: 1px solid var(--adm-border) !important;
  border-radius: var(--adm-radius-sm) !important;
}
.swal-json .jk { color: var(--adm-info); }
.swal-json .js { color: var(--adm-ok); }
.swal-json .jn { color: var(--adm-warn); }
.swal-json .jl { color: var(--adm-series-4); }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 45;
  background: color-mix(in srgb, var(--adm-page) 55%, transparent);
  backdrop-filter: blur(2px);
}
.sidebar-backdrop.show { display: block; }

/* ── 13. Responsive ───────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .app, .layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'tb' 'stage'; }
  .side {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50;
    width: min(276px, 86vw);
    height: 100vh;
    background: var(--adm-page);
    transform: translateX(-102%);
    transition: transform 200ms ease;
  }
  .side.open { transform: none; box-shadow: var(--adm-shadow-2); }
  .mobile-menu-btn { display: grid; }
  .user-name { display: none; }
  .content-body { padding: 16px 14px 32px; }
  .page-head { padding: 15px 16px; }
  .adm-flow { gap: 12px 34px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
