/* ==========================================================================
   Relay — Admin console
   "Premium instrument": layered surfaces, hairline rules, tabular metrics,
   exactly one accent. Dark-first; the light theme is derived from the same
   tokens so neither reads as an afterthought.
   ========================================================================== */

/* --- Local tokens -------------------------------------------------------- */
#panel-admin {
  --adm-r: 12px;
  --adm-r-sm: 9px;
  --adm-r-xs: 6px;
  --adm-gap: 16px;
  --adm-well: color-mix(in oklab, var(--fg) 3.5%, transparent);
  --adm-well-2: color-mix(in oklab, var(--fg) 2%, transparent);
  --adm-hair: color-mix(in oklab, var(--fg) 8%, transparent);
  --adm-track: color-mix(in oklab, var(--fg) 7%, transparent);
  --adm-shadow: 0 1px 2px color-mix(in oklab, #000 6%, transparent);
  --adm-shadow-lift: 0 8px 24px -12px color-mix(in oklab, #000 40%, transparent);
  color: var(--fg);
}

/* --- Page head ----------------------------------------------------------- */
/* `display: contents` lets the sub-nav stick for the whole panel instead of
   being trapped inside the (short) head block. */
#panel-admin > .adm-head { display: contents; }

.adm-head {
  margin: 6px 0 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.adm-head-main {
  margin: 6px 0 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.adm-head-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 640px;
  min-width: 0;
}

.adm-head-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.adm-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--up) 12%, transparent);
  border: 1px solid color-mix(in oklab, var(--up) 32%, transparent);
  color: var(--up);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.adm-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--up);
  animation: adm-pulse 2.2s infinite ease-in-out;
}

@keyframes adm-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.adm-role-badge {
  font-size: 0.66rem;
  font-weight: 700;
  font-family: "Geist Mono", monospace;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--adm-well);
  color: var(--muted);
  border: 1px solid var(--line);
}

.adm-title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.028em;
  color: var(--fg);
  line-height: 1.15;
}

.adm-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
  max-width: 60ch;
}

/* --- KPI chips ----------------------------------------------------------- */
.adm-head-kpis {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex-wrap: wrap;
}

.adm-kpi-chip {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 14px 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--adm-r-sm);
  min-width: 116px;
  box-shadow: var(--adm-shadow);
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.adm-kpi-chip:hover {
  border-color: color-mix(in oklab, var(--accent) 34%, var(--line));
  transform: translateY(-1px);
  box-shadow: var(--adm-shadow-lift);
}

.adm-kpi-val {
  font-size: 1.02rem;
  font-weight: 600;
  font-family: "Geist Mono", monospace;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.adm-kpi-lbl {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

.adm-sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 18%, transparent);
}

/* --- Sub-navigation ------------------------------------------------------ */
.adm-nav-pills {
  position: sticky;
  top: 60px;
  z-index: 20;
  margin: 18px 0 20px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 9999px;
  overflow-x: auto;
  max-width: 100%;
  box-shadow: var(--adm-shadow);
  scrollbar-width: none;
}

.adm-nav-pills::-webkit-scrollbar { display: none; }

.adm-nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 9999px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.81rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.adm-nav-pill svg {
  width: 15px;
  height: 15px;
  opacity: 0.7;
  transition: opacity 0.16s ease, color 0.16s ease;
}

.adm-nav-pill:hover {
  color: var(--fg);
  background: var(--adm-well);
}

.adm-nav-pill:hover svg {
  opacity: 1;
}

.adm-nav-pill:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.adm-nav-pill.active {
  background: var(--adm-well);
  color: var(--fg);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--line), 0 1px 3px color-mix(in oklab, #000 8%, transparent);
}

.adm-nav-pill.active svg {
  color: var(--accent);
  opacity: 1;
}

/* --- Panel grid & cards -------------------------------------------------- */
.adm-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--adm-gap);
  align-items: start;
}

.adm-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--adm-r);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--adm-shadow);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.adm-card:hover {
  border-color: color-mix(in oklab, var(--fg) 13%, var(--line));
}

.adm-card-wide {
  grid-column: 1 / -1;
}

.adm-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--adm-well-2);
}

.adm-card-ico {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: color-mix(in oklab, var(--accent) 11%, transparent);
  color: var(--accent);
  border: 1px solid color-mix(in oklab, var(--accent) 20%, transparent);
}

.adm-card-ico svg {
  width: 17px;
  height: 17px;
}

.adm-card-head-text {
  flex: 1;
  min-width: 0;
}

.adm-card-head h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--fg);
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.adm-card-head h3 .count {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  font-family: "Geist Mono", monospace;
  font-variant-numeric: tabular-nums;
}

.adm-card-desc {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
  max-width: 68ch;
}

.adm-card-body {
  padding: 15px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.adm-card-btn {
  padding: 4px 10px;
  min-height: 26px;
  font-size: var(--fs-xs, 0.75rem);
  flex: none;
  border-radius: var(--adm-r-xs);
  color: var(--muted);
  background: transparent;
  box-shadow: none;
}

.adm-card-btn:hover {
  color: var(--fg);
  border-color: var(--line-strong);
  background: var(--adm-well);
  box-shadow: none;
}

.adm-card-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  flex: none;
}

/* --- Danger card --------------------------------------------------------- */
.adm-card-danger {
  border-color: color-mix(in oklab, var(--down) 24%, var(--line));
  background: color-mix(in oklab, var(--down) 2.5%, var(--card));
}

.adm-card-danger .adm-card-ico {
  background: color-mix(in oklab, var(--down) 13%, transparent);
  color: var(--down);
  border-color: color-mix(in oklab, var(--down) 26%, transparent);
}

.adm-card-danger:hover {
  border-color: color-mix(in oklab, var(--down) 38%, var(--line));
}

/* --- Search -------------------------------------------------------------- */
.ch-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.ch-search-ico {
  position: absolute;
  left: 11px;
  display: grid;
  place-items: center;
  color: var(--muted);
  pointer-events: none;
}

.ch-search-ico svg {
  width: 15px;
  height: 15px;
}

.ch-search {
  width: 100%;
  padding: 8px 14px 8px 34px !important;
  font-size: 0.83rem !important;
  border-radius: var(--adm-r-sm) !important;
  border: 1px solid var(--line) !important;
  background: var(--adm-well) !important;
  color: var(--fg) !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.ch-search::placeholder { color: var(--muted); opacity: 0.85; }

.ch-search:focus {
  border-color: var(--accent) !important;
  background: var(--card) !important;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 16%, transparent) !important;
}

/* --- Switch (visibility / enable toggles) -------------------------------- */
/* One switch pattern for the whole admin tab: the control is interactive
   state, so it wears the accent — health keeps the semantic colours. */
#panel-admin .switch {
  width: 34px;
  height: 20px;
  background: var(--adm-track);
  border: 1px solid color-mix(in oklab, var(--fg) 14%, transparent);
  transition: background 0.16s cubic-bezier(0.2, 0.9, 0.25, 1), border-color 0.16s ease;
}

#panel-admin .switch::after {
  width: 14px;
  height: 14px;
  top: 2px;
  left: 2px;
  background: color-mix(in oklab, var(--fg) 55%, transparent);
  box-shadow: 0 1px 2px color-mix(in oklab, #000 35%, transparent);
  transition: left 0.16s cubic-bezier(0.2, 0.9, 0.25, 1), background 0.16s ease;
}

#panel-admin .switch.on {
  background: var(--accent);
  border-color: transparent;
}

#panel-admin .switch.on::after {
  left: 16px;
  background: #fff;
}

#panel-admin .switch:hover { border-color: color-mix(in oklab, var(--accent) 55%, transparent); }
#panel-admin .switch.on:hover { filter: brightness(1.08); }

/* --- Channel table ------------------------------------------------------- */
/* One row = one grid line so every column lines up down the list. */
#channel-list {
  border: 1px solid var(--line);
  border-radius: var(--adm-r-sm);
  overflow: hidden;
  background: var(--card);
}

/* An empty list is a single designed state, not a box inside a box. */
#channel-list:has(> .muted.empty) {
  border: 0;
  background: transparent;
}

.channel {
  display: grid;
  grid-template-columns:
    18px            /* select      */
    36px            /* visibility  */
    62px            /* state badge */
    10px            /* health dot  */
    52px            /* probe spark */
    minmax(150px, 1.4fr) /* channel id   */
    minmax(130px, 1.4fr) /* base url    */
    122px           /* key summary */
    110px           /* key strategy*/
    auto;           /* row actions */
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--adm-hair);
  background: transparent;
  transition: background 0.14s ease;
}

.channel:last-child { border-bottom: 0; }

.channel:hover {
  background: var(--adm-well-2);
  transform: none;
  border-color: transparent;
  box-shadow: none;
}

.channel.offrow {
  opacity: 1;
  background: color-mix(in oklab, var(--fg) 1.5%, transparent);
}

.channel.offrow .cid,
.channel.offrow .curl { opacity: 0.6; }

/* Explicit row + column placement keeps every row aligned even when a row
   has no key-strategy picker (2+ keys only). */
.channel .ch-select { grid-column: 1; grid-row: 1; }
.channel .switch { grid-column: 2; grid-row: 1; }
.channel .channel-status-badge { grid-column: 3; grid-row: 1; }
.channel .dot { grid-column: 4; grid-row: 1; }
.channel .ch-spark { grid-column: 5; grid-row: 1; }
.channel .cid { grid-column: 6; grid-row: 1; }
.channel .curl { grid-column: 7; grid-row: 1; }
.channel .ch-keys { grid-column: 8; grid-row: 1; }
.channel .kc-strategy { grid-column: 9; grid-row: 1; }
.channel .row-actions { grid-column: 10; grid-row: 1; }

.channel .ch-select {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
  flex: none;
  margin: 0;
}

.channel .switch {
  flex: none;
  margin: 0;
  justify-self: start;
}

.channel .dot {
  flex: none;
  justify-self: center;
}

.channel .ch-spark {
  display: inline-flex;
  flex: none;
  align-items: center;
  height: 18px;
  overflow: hidden;
}

.channel .ch-spark .spark {
  width: 52px;
  height: 18px;
}

.channel .cid {
  font-family: "Geist Mono", monospace;
  font-weight: 600;
  font-size: 0.81rem;
  color: var(--fg);
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: none;
  min-width: 0;
}

.channel-status-badge {
  font-size: 0.64rem;
  font-family: "Geist Mono", monospace;
  padding: 3px 7px;
  border-radius: 999px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex: none;
  justify-self: start;
  white-space: nowrap;
}

.channel-status-badge.on {
  background: color-mix(in oklab, var(--accent) 13%, transparent);
  color: color-mix(in oklab, var(--accent) 80%, var(--fg));
  border: 1px solid color-mix(in oklab, var(--accent) 32%, transparent);
}

.channel-status-badge.off {
  background: color-mix(in oklab, var(--muted) 13%, transparent);
  color: var(--muted);
  border: 1px solid color-mix(in oklab, var(--muted) 28%, transparent);
}

.channel .curl {
  font-family: "Geist Mono", monospace;
  font-size: 0.75rem;
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: none;
}

.channel .kc-strategy {
  font-size: 0.72rem;
  padding: 4px 8px;
  border-radius: var(--adm-r-xs);
  border: 1px solid var(--line);
  background: var(--adm-well);
  color: var(--fg);
  cursor: pointer;
  width: 100%;
  margin: 0;
  flex: none;
}

.channel .kc-strategy:hover { border-color: var(--accent); }

.channel .ch-keys {
  font-size: 0.72rem;
  color: var(--muted);
  font-family: "Geist Mono", monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.channel .ch-keys::before {
  content: "";
  width: 11px;
  height: 11px;
  flex: none;
  background: currentColor;
  opacity: 0.75;
  -webkit-mask: var(--adm-ico-key) no-repeat center / contain;
  mask: var(--adm-ico-key) no-repeat center / contain;
}

.channel[data-keys="0"] .ch-keys {
  color: var(--down);
}

.channel[data-keys="0"] .ch-keys::before { opacity: 1; }

.channel .row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  flex: none;
}

.channel .row-actions button {
  padding: 3px 7px;
  min-height: 25px;
  font-size: 0.71rem;
  border-radius: var(--adm-r-xs);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--muted);
}

.channel .row-actions button:hover {
  color: var(--fg);
  background: var(--adm-well);
  border-color: var(--line);
  box-shadow: none;
}

.channel .row-actions button.danger {
  border-color: transparent;
  color: var(--muted);
}

.channel .row-actions button.danger:hover {
  color: var(--down);
  border-color: color-mix(in oklab, var(--down) 45%, transparent);
  background: color-mix(in oklab, var(--down) 8%, transparent);
}

/* --- Bulk actions bar ---------------------------------------------------- */
.ch-bulk {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  margin: 0 0 10px;
  border: 1px solid color-mix(in oklab, var(--accent) 32%, var(--line));
  border-radius: var(--adm-r-sm);
  background: color-mix(in oklab, var(--accent) 9%, var(--card));
  animation: adm-fade-in 0.16s ease-out;
}

@keyframes adm-fade-in {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: none; }
}

.ch-bulk[hidden] { display: none; }

.ch-bulk-count {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--fg);
  margin-right: auto;
  font-family: "Geist Mono", monospace;
  font-variant-numeric: tabular-nums;
}

.ch-bulk button {
  padding: 3px 10px;
  min-height: 26px;
  font-size: 0.73rem;
  border-radius: var(--adm-r-xs);
  background: transparent;
  box-shadow: none;
  color: var(--fg-soft);
}

.ch-bulk button:hover { background: var(--adm-well); box-shadow: none; }

/* --- Add channel drawer -------------------------------------------------- */
.adm-add {
  border: 1px dashed color-mix(in oklab, var(--accent) 32%, var(--line));
  border-radius: var(--adm-r-sm);
  padding: 0;
  margin-top: 2px;
  background: color-mix(in oklab, var(--accent) 2.5%, transparent);
  overflow: hidden;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.adm-add:hover {
  border-color: color-mix(in oklab, var(--accent) 48%, var(--line));
}

.adm-add > summary {
  cursor: pointer;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 0.83rem;
  color: var(--accent);
  list-style: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s ease;
}

.adm-add > summary::-webkit-details-marker { display: none; }

.adm-add > summary:hover {
  background: color-mix(in oklab, var(--accent) 6%, transparent);
}

.adm-add[open] > summary {
  border-bottom: 1px solid var(--line);
  background: color-mix(in oklab, var(--accent) 4%, transparent);
}

.adm-add-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.adm-form-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.adm-form-row .lbl {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.adm-add-body input,
.adm-add-body select,
.adm-add-body textarea {
  padding: 8px 11px;
  margin: 0;
  border-radius: var(--adm-r-xs);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  font-size: 0.82rem;
  font-family: inherit;
}

.adm-add-body textarea {
  font-family: "Geist Mono", monospace;
  font-size: 0.78rem;
}

.adm-add-body input:focus,
.adm-add-body select:focus,
.adm-add-body textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 15%, transparent);
  outline: none;
}

/* Checkbox rows inside the admin forms read as one pattern: control first,
   label second, description third. */
.adm-add-body .pg-check,
.kc-controls .pg-check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.79rem;
  color: var(--fg-soft);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}

.adm-add-body .pg-check input[type="checkbox"],
.kc-controls .pg-check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
  flex: none;
}

.adm-primary-btn {
  padding: 7px 15px;
  border-radius: var(--adm-r-xs);
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 2px color-mix(in oklab, #000 18%, transparent);
}

.adm-primary-btn:hover {
  opacity: 1;
  filter: brightness(1.08);
  box-shadow: 0 4px 12px -4px color-mix(in oklab, var(--accent) 60%, transparent);
}

/* --- Key rotation & health ------------------------------------------------ */
.kc-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 13px;
  background: var(--adm-well);
  border: 1px solid var(--line);
  border-radius: var(--adm-r-sm);
  margin-bottom: 10px;
}

.kc-controls .pg-check { margin-right: auto; }

.kc-param {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.kc-param .lbl {
  font-size: 0.74rem;
  color: var(--muted);
  margin: 0;
  white-space: nowrap;
}

.kc-param input[type="number"] {
  width: 66px;
  padding: 4px 6px;
  margin: 0;
  border-radius: var(--adm-r-xs);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  font-family: "Geist Mono", monospace;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.kc-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.kc-actions button {
  padding: 4px 11px;
  min-height: 27px;
  font-size: 0.74rem;
  border-radius: var(--adm-r-xs);
}

.kc-strategies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 2px 0 12px;
}

.kc-strategy-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  padding: 4px 10px 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--adm-well);
}

.kc-strategy-row .cid {
  font-family: "Geist Mono", monospace;
  font-weight: 600;
  font-size: 0.76rem;
  color: var(--fg);
}

.kc-strategy-row .kc-strategy {
  width: auto;
  margin: 0;
  padding: 3px 7px;
  font-size: 0.72rem;
  background: var(--card);
}

.kc-downed {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 12px;
}

.kc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.kc-channel {
  border: 1px solid var(--line);
  border-radius: var(--adm-r-sm);
  padding: 10px 12px 11px;
  background: var(--adm-well-2);
  min-width: 0;
}

.kc-ch-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--adm-hair);
}

.kc-ch-head .cid {
  font-family: "Geist Mono", monospace;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kc-ch-head .muted {
  font-size: 0.7rem;
  color: var(--muted);
  font-family: "Geist Mono", monospace;
  white-space: nowrap;
}

.kc-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.kc-key {
  font-family: "Geist Mono", monospace;
  font-size: 0.71rem;
  padding: 3px 8px;
  border-radius: var(--adm-r-xs);
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--fg-soft);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.kc-key.down {
  border-color: color-mix(in oklab, var(--down) 48%, transparent);
  color: var(--down);
  background: color-mix(in oklab, var(--down) 9%, transparent);
}

.kc-badge {
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.kc-badge.down { font-weight: 700; }

.kc-share {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 2px;
  padding: 0 5px;
  border-radius: 99px;
  background: color-mix(in oklab, var(--accent) 16%, transparent);
  font-size: 9px;
  font-weight: 600;
  color: color-mix(in oklab, var(--accent) 78%, var(--fg));
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}

.kc-share::before {
  content: "";
  position: absolute;
  inset: 0;
  width: var(--kc-share, 0%);
  background: color-mix(in oklab, var(--accent) 28%, transparent);
}

.kc-share i {
  position: relative;
  font-style: normal;
}

.kc-served { margin-top: 14px; }

.kc-served summary {
  cursor: pointer;
  font-size: 0.77rem;
  color: var(--muted);
  list-style: none;
}

.kc-served summary::-webkit-details-marker { display: none; }

.kc-served summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 7px;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.kc-served[open] summary::before { transform: rotate(90deg); }

.kc-served .htable { margin-top: 8px; }

.kc-served-actions { display: flex; justify-content: flex-end; margin-top: 8px; }

.kc-ok { color: var(--up, #2f9e44); }
.kc-err { color: var(--down, #e5484d); font-weight: 600; }

/* --- Usage by account ---------------------------------------------------- */
.adm-usage {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-x: auto;
}

.adm-usage-head {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 0.66rem;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.adm-usage-head,
.adm-usage-row {
  display: grid;
  grid-template-columns:
    minmax(120px, 1.5fr)
    92px
    104px
    84px
    108px
    minmax(150px, 1.2fr);
  align-items: center;
  gap: 14px;
  padding: 9px 10px;
  font-size: 0.77rem;
  font-family: "Geist Mono", monospace;
  font-variant-numeric: tabular-nums;
  min-width: 640px;
}

.adm-usage-head {
  font-family: inherit;
  padding-top: 4px;
  padding-bottom: 8px;
}

.adm-usage-row {
  border-bottom: 1px solid var(--adm-hair);
  transition: background 0.14s ease;
}

.adm-usage-row:last-child { border-bottom: 0; }

.adm-usage-row:hover { background: var(--adm-well-2); }

.adm-usage-name {
  color: var(--fg);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.adm-usage-num {
  text-align: right;
  color: var(--fg);
}

.adm-usage-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.adm-usage-bar em {
  font-style: normal;
  color: var(--muted);
  font-size: 0.72rem;
  min-width: 40px;
  text-align: right;
}

.adm-bar {
  flex: 1;
  height: 6px;
  min-width: 40px;
  border-radius: 99px;
  background: var(--adm-track);
  overflow: hidden;
  display: block;
}

.adm-bar-fill {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
  transition: width 300ms ease;
}

.adm-bar.is-warn .adm-bar-fill { background: var(--unstable); }
.adm-bar.is-over .adm-bar-fill { background: var(--down); }

/* --- 7-day usage chart --------------------------------------------------- */
.adm-chart {
  position: relative;
  margin: 0 0 14px;
  padding: 26px 16px 14px 44px;
  background: var(--adm-well-2);
  border: 1px solid var(--line);
  border-radius: var(--adm-r-sm);
}

/* Y axis: peak at the top, zero at the baseline. */
.adm-chart::before {
  content: attr(data-max);
  position: absolute;
  top: 15px;
  left: 10px;
  font-family: "Geist Mono", monospace;
  font-size: 0.62rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.adm-chart::after {
  content: "0";
  position: absolute;
  bottom: 55px;
  left: 10px;
  font-family: "Geist Mono", monospace;
  font-size: 0.62rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.adm-chart-bars {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
  height: 132px;
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--adm-hair);
  background-image: linear-gradient(to top, var(--adm-hair) 1px, transparent 1px);
  background-size: 100% 25%;
  background-position: 0 100%;
}

.adm-chart-col {
  position: relative;
  height: 100%;
}

.adm-chart-bar {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 44px;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(
    180deg,
    color-mix(in oklab, var(--accent) 88%, #fff 12%) 0%,
    var(--accent) 55%,
    var(--accent) 100%
  );
  min-height: 4px;
  transition: height 300ms ease, filter 0.14s ease;
}

.adm-chart-col:hover .adm-chart-bar { filter: brightness(1.12); }

/* Hover tooltip — pure CSS, driven by the value written into the markup. */
.adm-chart-bar::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  border-radius: var(--adm-r-xs);
  background: var(--fg);
  color: var(--bg);
  font-family: "Geist Mono", monospace;
  font-size: 0.66rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
  box-shadow: 0 6px 18px -8px color-mix(in oklab, #000 60%, transparent);
}

.adm-chart-bar:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

.adm-chart-col:first-child .adm-chart-bar::after {
  left: 0;
  transform: none;
}

.adm-chart-col:first-child .adm-chart-bar:hover::after { transform: translateY(-2px); }

.adm-chart-col:last-child .adm-chart-bar::after {
  left: auto;
  right: 0;
  transform: none;
}

.adm-chart-col:last-child .adm-chart-bar:hover::after { transform: translateY(-2px); }

.adm-chart-day {
  position: absolute;
  top: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 0;
  line-height: 1.15;
  color: var(--muted);
  font-family: "Geist Mono", monospace;
  display: flex;
  flex-direction: column;
  gap: 1px;
  align-items: center;
  white-space: nowrap;
}

.adm-chart-day::before {
  content: attr(data-weekday);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.adm-chart-day::after {
  content: attr(data-daynum);
  font-size: 0.72rem;
  color: var(--fg-soft);
  font-variant-numeric: tabular-nums;
}

.adm-chart-note {
  font-size: 0.72rem;
  margin: 34px 0 0;
  color: var(--muted);
  font-family: "Geist Mono", monospace;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: 8px;
}

.adm-chart-note::before {
  content: "";
  width: 14px;
  height: 3px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), color-mix(in oklab, var(--accent) 40%, transparent));
  flex: none;
}

/* --- Audit log ----------------------------------------------------------- */
.adm-audit-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.adm-audit-filter {
  flex: 1;
  min-width: 150px;
  font-size: 0.78rem !important;
  padding: 6px 10px !important;
  margin: 0 !important;
  border-radius: var(--adm-r-xs) !important;
  border: 1px solid var(--line) !important;
  background: var(--adm-well) !important;
}

.adm-audit-controls select {
  width: auto;
  font-size: 0.75rem;
  padding: 5px 8px;
  margin: 0;
  border-radius: var(--adm-r-xs);
  border: 1px solid var(--line);
  background: var(--adm-well);
  color: var(--fg);
}

.adm-audit-count {
  font-size: 0.7rem;
  font-family: "Geist Mono", monospace;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.adm-audit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 340px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.adm-audit-item {
  display: grid;
  grid-template-columns: 62px auto auto minmax(0, 1fr);
  align-items: baseline;
  gap: 10px;
  padding: 7px 8px;
  font-size: 0.76rem;
  border-bottom: 1px solid var(--adm-hair);
  border-radius: var(--adm-r-xs);
  transition: background 0.14s ease;
}

.adm-audit-item:hover { background: var(--adm-well-2); }

.adm-audit-item:last-child { border-bottom: none; }

.adm-audit-when {
  color: var(--muted);
  font-size: 0.68rem;
  white-space: nowrap;
  font-family: "Geist Mono", monospace;
}

.adm-audit-actor {
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 99px;
  background: color-mix(in oklab, var(--accent) 13%, transparent);
  color: color-mix(in oklab, var(--accent) 78%, var(--fg));
  font-size: 0.68rem;
  white-space: nowrap;
}

.adm-audit-action {
  color: var(--fg);
  font-weight: 500;
  white-space: nowrap;
}

.adm-audit-detail {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
  color: var(--muted);
  font-family: "Geist Mono", monospace;
}

/* --- Health alerts ------------------------------------------------------- */
.adm-alerts {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.adm-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--adm-r-sm);
  border: 1px solid var(--line);
  background: var(--adm-well-2);
  font-size: 0.78rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.adm-alert.provider_down {
  border-color: color-mix(in oklab, var(--down) 42%, transparent);
  background: color-mix(in oklab, var(--down) 7%, transparent);
}

.adm-alert.provider_unstable {
  border-color: color-mix(in oklab, var(--unstable) 42%, transparent);
  background: color-mix(in oklab, var(--unstable) 7%, transparent);
}

.adm-alert.no_keys {
  border-style: dashed;
}

.adm-alert-id {
  font-weight: 600;
  font-family: "Geist Mono", monospace;
  flex: none;
}

.adm-alert-msg {
  color: var(--fg-soft, var(--muted));
  min-width: 0;
  flex: 1;
}

.adm-alert-jump {
  margin-left: auto;
  font-size: 0.72rem;
  flex: none;
  padding: 3px 9px;
  min-height: 25px;
  border-radius: var(--adm-r-xs);
  border: 1px solid var(--line);
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  text-decoration: none;
}

.adm-alert-jump:hover {
  color: var(--fg);
  border-color: var(--line-strong);
  background: var(--adm-well);
  box-shadow: none;
}

/* --- Latency trends ------------------------------------------------------ */
.adm-trend-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 2px 0;
}

.adm-trend-svg {
  width: 100%;
  height: 160px;
  overflow: visible;
}

.adm-trend-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 0.71rem;
  margin-top: 4px;
  font-family: "Geist Mono", monospace;
  color: var(--fg-soft);
}

.adm-trend-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.adm-trend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
}

/* --- API key management -------------------------------------------------- */
.adm-keys-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 2px 0;
}

.adm-keys-create {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.adm-key-input {
  padding: 8px 12px;
  margin: 0;
  border-radius: var(--adm-r-xs);
  border: 1px solid var(--line);
  background: var(--adm-well);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.8rem;
  flex: 1;
  min-width: 170px;
}

.adm-key-input:focus {
  border-color: var(--accent);
  background: var(--card);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 15%, transparent);
  outline: none;
}

.adm-key-btn {
  padding: 8px 14px;
  margin: 0;
  border-radius: var(--adm-r-xs);
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  font-size: 0.79rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 2px color-mix(in oklab, #000 18%, transparent);
}

.adm-key-btn:hover {
  opacity: 1;
  filter: brightness(1.08);
  box-shadow: 0 4px 12px -4px color-mix(in oklab, var(--accent) 60%, transparent);
}

.adm-newkey-alert {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  background: color-mix(in oklab, var(--up) 8%, transparent);
  border: 1px solid color-mix(in oklab, var(--up) 34%, transparent);
  border-radius: var(--adm-r-sm);
  font-size: 0.78rem;
}

.adm-newkey-alert strong { color: var(--up); font-weight: 600; }

.adm-newkey-val {
  font-family: "Geist Mono", monospace;
  font-size: 0.78rem;
  padding: 8px 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--adm-r-xs);
  word-break: break-all;
  user-select: all;
}

.adm-keys-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.adm-key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  background: var(--adm-well-2);
  border: 1px solid var(--line);
  border-radius: var(--adm-r-sm);
  font-size: 0.78rem;
  flex-wrap: wrap;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.adm-key-row:hover { border-color: color-mix(in oklab, var(--fg) 14%, var(--line)); }

.adm-key-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.adm-key-label {
  font-weight: 600;
  color: var(--fg);
}

.adm-key-date {
  font-size: 0.68rem;
  color: var(--muted);
}

.adm-key-code {
  font-family: "Geist Mono", monospace;
  font-size: 0.74rem;
  color: var(--fg-soft);
  padding: 3px 8px;
  border-radius: var(--adm-r-xs);
  background: var(--code-bg);
  border: 1px solid var(--line);
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.adm-key-code::before {
  content: "";
  width: 11px;
  height: 11px;
  flex: none;
  background: currentColor;
  opacity: 0.6;
  -webkit-mask: var(--adm-ico-key) no-repeat center / contain;
  mask: var(--adm-ico-key) no-repeat center / contain;
}

.adm-key-del {
  border: 1px solid transparent;
  background: transparent;
  color: var(--down);
  cursor: pointer;
  font-size: 0.73rem;
  padding: 3px 9px;
  min-height: 25px;
  border-radius: var(--adm-r-xs);
}

.adm-key-del:hover {
  text-decoration: none;
  border-color: color-mix(in oklab, var(--down) 45%, transparent);
  background: color-mix(in oklab, var(--down) 9%, transparent);
}

/* --- Failover simulator -------------------------------------------------- */
.adm-sim-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 2px 0;
}

.adm-sim-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.adm-sim-controls select {
  padding: 6px 10px;
  margin: 0;
  width: auto;
  flex: 1 1 150px;
  border-radius: var(--adm-r-xs);
  border: 1px solid var(--line);
  background: var(--adm-well);
  color: var(--fg);
  font-size: 0.77rem;
}

.adm-sim-btn {
  padding: 6px 13px;
  margin: 0;
  border-radius: var(--adm-r-xs);
  background: var(--adm-well);
  border: 1px solid var(--line);
  color: var(--fg);
  font-size: 0.77rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.adm-sim-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in oklab, var(--accent) 8%, transparent);
}

.adm-sim-result {
  padding: 12px 14px;
  background: var(--adm-well-2);
  border: 1px solid var(--line);
  border-radius: var(--adm-r-sm);
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.adm-sim-hops {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.adm-sim-hop {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border-radius: var(--adm-r-xs);
  font-size: 0.78rem;
  border: 1px solid transparent;
}

.adm-sim-hop.failed {
  background: color-mix(in oklab, var(--down) 9%, transparent);
  border-color: color-mix(in oklab, var(--down) 28%, transparent);
  color: var(--down);
}

.adm-sim-hop.success {
  background: color-mix(in oklab, var(--up) 9%, transparent);
  border-color: color-mix(in oklab, var(--up) 28%, transparent);
  color: var(--up);
}

/* --- Empty / loading / error states -------------------------------------- */
#panel-admin .muted.empty,
#panel-admin .adm-card-body > div > p.muted:last-child {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 28px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
  border: 1px dashed var(--line-strong);
  border-radius: var(--adm-r-sm);
  background: var(--adm-well-2);
}

#panel-admin .muted.empty::before,
#panel-admin .adm-card-body > div > p.muted:last-child::before {
  content: "";
  width: 26px;
  height: 26px;
  background: currentColor;
  opacity: 0.55;
  -webkit-mask: var(--adm-ico-empty) no-repeat center / contain;
  mask: var(--adm-ico-empty) no-repeat center / contain;
}

#panel-admin .muted.small {
  font-size: 0.78rem;
  color: var(--muted);
}

#panel-admin .adm-summary {
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* --- Inline icons -------------------------------------------------------- */
#panel-admin {
  --adm-ico-key: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='7.5' cy='15.5' r='4.5'/%3E%3Cpath d='m10.5 12.5 8.5-8.5M16 4l3 3M14 6l1.5 1.5M19 9l2-2'/%3E%3C/svg%3E");
  --adm-ico-empty: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 13h4l2 4h6l2-4h4'/%3E%3Cpath d='M5 5h14l2 8v6H3v-6z'/%3E%3C/svg%3E");
}

/* --- Channel editor modal ------------------------------------------------ */
#modal:has(.admin-form) .modal-card {
  width: min(640px, 100%);
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-form > .lbl {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 8px;
}

.admin-form > .lbl:first-of-type { margin-top: 2px; }

.admin-form input[type="text"],
.admin-form input:not([type]),
.admin-form select,
.admin-form textarea {
  padding: 8px 11px;
  margin: 0;
  border-radius: var(--adm-r-xs);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  font-size: 0.82rem;
  font-family: inherit;
}

.admin-form textarea {
  font-family: "Geist Mono", monospace;
  font-size: 0.78rem;
}

.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 15%, transparent);
  outline: none;
}

.admin-form > .muted {
  font-size: 0.76rem;
  color: var(--muted);
  margin: 0;
}

.admin-key-list {
  border: 1px solid var(--line);
  border-radius: var(--adm-r-sm);
  background: var(--adm-well-2);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px 6px 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--adm-r-xs);
  font-size: 0.78rem;
}

.admin-key-row code {
  font-family: "Geist Mono", monospace;
  font-size: 0.76rem;
  color: var(--fg-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-key-row button.ghost {
  padding: 2px 8px;
  min-height: 24px;
  font-size: 0.72rem;
  border-radius: var(--adm-r-xs);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--muted);
}

.admin-key-row button.ghost:hover {
  color: var(--down);
  border-color: color-mix(in oklab, var(--down) 40%, transparent);
  background: color-mix(in oklab, var(--down) 8%, transparent);
}

/* Checkbox rows inside the modal read like the rest of the admin switches. */
.admin-form > .lbl.pg-check {
  display: flex;
  align-items: center;
  gap: 9px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.79rem;
  font-weight: 500;
  color: var(--fg-soft);
  margin-top: 12px;
  cursor: pointer;
}

.admin-form > .lbl.pg-check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
  flex: none;
}

.admin-key-add-box {
  display: flex;
  gap: 8px;
  align-items: center;
}

.admin-key-add-box input { margin: 0; flex: 1; }

.admin-key-add-box button {
  padding: 6px 12px;
  min-height: 30px;
  font-size: 0.78rem;
  border-radius: var(--adm-r-xs);
  background: transparent;
  box-shadow: none;
}

.admin-form .row2 {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.admin-form .row2 button { min-width: 96px; }

/* --- Responsive adjustments ---------------------------------------------- */
@media (max-width: 1080px) {
  .adm-head-kpis { width: 100%; }
  .adm-kpi-chip { flex: 1; min-width: 86px; }
}

@media (max-width: 980px) {
  .adm-grid { grid-template-columns: 1fr; }

  .adm-head-main { flex-direction: column; align-items: stretch; }

  .adm-nav-pills { top: 56px; }

  /* Two-line rows: identity + actions on top, details underneath. */
  .channel {
    grid-template-columns: 18px 36px minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto;
    gap: 6px 12px;
    padding: 11px 12px;
  }
  .channel .ch-select { grid-column: 1; grid-row: 1; }
  .channel .switch { grid-column: 2; grid-row: 1; }
  .channel .cid { grid-column: 3; grid-row: 1; }
  .channel .row-actions { grid-column: 4; grid-row: 1; }
  .channel .channel-status-badge { grid-column: 1; grid-row: 2; }
  .channel .dot { grid-column: 2; grid-row: 2; justify-self: start; }
  .channel .curl { grid-column: 3 / -1; grid-row: 2; }
  .channel .ch-keys { grid-column: 1 / 4; grid-row: 3; }
  .channel .kc-strategy { grid-column: 4; grid-row: 3; }

  .adm-usage-head,
  .adm-usage-row {
    grid-template-columns: minmax(110px, 1.4fr) 80px 92px 76px 96px minmax(140px, 1.1fr);
    gap: 10px;
  }

  .adm-audit-item { grid-template-columns: 56px auto minmax(0, 1fr); }
  .adm-audit-detail { grid-column: 3; }
}

@media (max-width: 700px) {
  .adm-usage-head,
  .adm-usage-row {
    grid-template-columns: minmax(100px, 1.3fr) 76px 88px minmax(120px, 1fr);
    min-width: 0;
  }
  /* drop the two middle numeric columns (req 7d, all-time) on both the
     header and the rows so the grid stays aligned */
  .adm-usage-head span:nth-child(4),
  .adm-usage-head span:nth-child(5),
  .adm-usage-row .adm-usage-num:nth-of-type(4),
  .adm-usage-row .adm-usage-num:nth-of-type(5) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .adm-pulse-dot { animation: none; }
  .adm-bar-fill,
  .adm-chart-bar { transition: none; }
  .ch-bulk { animation: none; }
}
