  /* Admin screen — tabs + audit log + moderation queue */
  .admin-tabs {
    display: flex; gap: 4px;
    margin: 8px 0 16px;
    border-bottom: 1px solid var(--border-2);
  }
  .admin-tab {
    padding: 8px 14px;
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
    transition: color 0.12s ease, border-color 0.12s ease;
  }
  .admin-tab:hover { color: var(--text); }
  .admin-tab.active {
    color: var(--text);
    border-bottom-color: rgba(110, 150, 135, 0.7);
  }

  .admin-pane[hidden] { display: none; }
  .admin-pane > .empty { padding: 24px; text-align: center; color: var(--muted); }

  .audit-log-meta {
    margin-bottom: 10px;
  }
  .audit-log {
    display: flex; flex-direction: column;
    gap: 6px;
  }
  .audit-row {
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--r-sm);
    display: flex; flex-direction: column;
    gap: 4px;
  }
  .audit-row-head {
    display: flex; justify-content: space-between; align-items: center;
    gap: 10px;
  }
  .audit-action {
    font-weight: 600;
    color: var(--text);
    font-size: 13px;
  }
  .audit-row-body {
    display: flex; align-items: center; gap: 6px;
    flex-wrap: wrap;
    font-size: 11px;
  }
  .audit-id {
    padding: 1px 5px;
    background: rgba(255,255,255,0.04);
    border-radius: 3px;
    font-size: 10.5px;
    color: #c9dcd0;
  }
  .audit-details {
    display: flex; flex-wrap: wrap; gap: 8px;
    padding-top: 4px;
    margin-top: 4px;
    border-top: 1px dashed rgba(70, 100, 88, 0.3);
  }
  .audit-detail {
    font-size: 11px;
    color: var(--muted);
  }
  .audit-detail .k {
    color: #93ada0;
  }
  .audit-detail .v {
    color: var(--text);
    margin-left: 2px;
  }
  .audit-actor {
    font-size: 12px;
    color: #b6dbef;
    font-weight: 500;
  }
  .audit-row-actions {
    display: flex; gap: 6px;
    margin-top: 6px;
  }
  .audit-row-actions .btn {
    padding: 4px 10px;
    font-size: 11px;
  }
  .audit-act-rollback {
    background: linear-gradient(180deg, rgba(180, 140, 70, 0.22), rgba(60, 45, 18, 0.5));
    border-color: rgba(180, 140, 70, 0.5);
    color: #e6cf9b;
  }
  .audit-act-rollback:hover {
    background: linear-gradient(180deg, rgba(180, 140, 70, 0.4), rgba(90, 70, 30, 0.7));
  }
  .audit-act-rollback:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  /* Editorial-collections pane — sub-tabs + curated tile grid */
  .col-pane-tabs {
    display: flex; gap: 4px;
    margin: 4px 0 8px;
    flex-wrap: wrap;
  }
  .col-pane-tab {
    padding: 5px 12px;
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: 999px;
    color: var(--muted);
    font-size: 12px;
    cursor: pointer;
    transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
  }
  .col-pane-tab:hover { color: var(--text); }
  .col-pane-tab.active {
    color: var(--text);
    border-color: rgba(110, 150, 135, 0.55);
    background: rgba(110, 150, 135, 0.12);
  }
  .col-pane-tab .small { margin-left: 4px; opacity: 0.8; }
  .col-pane-hint {
    margin-bottom: 12px;
  }

  /* Unified admin game panel (agp) — reused in tile-popover, game page,
     and admin collections pane (via popover). */
  .agp {
    display: flex; flex-direction: column;
    gap: 12px;
  }
  .agp-section {
    display: flex; flex-direction: column;
    gap: 6px;
  }
  .agp-label code {
    padding: 1px 5px;
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
    font-size: 11px;
  }
  .agp-buttons {
    display: flex; gap: 6px; flex-wrap: wrap;
  }
  .agp-buttons .btn { padding: 5px 12px; font-size: 12px; }
  .agp-collections {
    display: flex; gap: 12px; flex-wrap: wrap;
  }
  .agp-col {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    background: rgba(0,0,0,0.18);
    border: 1px solid var(--border-2);
    border-radius: 999px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text);
    user-select: none;
    transition: border-color 0.12s ease, background 0.12s ease;
  }
  .agp-col:hover { border-color: rgba(110, 150, 135, 0.5); }
  .agp-col input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
  }
  .agp-col input[type="checkbox"]:checked + span {
    color: #e6cf9b;
    font-weight: 500;
  }

  /* Phase G — admin_boost row inside .agp. Uses the same column layout as
     other agp sections; the actual <input type=number> gets a fixed width so
     it doesn't stretch in the (narrow) popover variant. */
  .admin-action-row.admin-boost-row {
    margin-top: 4px;
  }
  .admin-boost-label {
    display: flex; flex-direction: column;
    gap: 4px;
  }
  .admin-boost-input {
    width: 120px;
    padding: 6px 8px;
    background: rgba(0,0,0,0.22);
    border: 1px solid var(--border-2);
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
  }
  .admin-boost-input:focus {
    outline: none;
    border-color: rgba(110, 150, 135, 0.6);
  }
  .admin-boost-hint {
    font-size: 11px;
    color: var(--muted, #888);
  }

  /* =========================================================================
     STATS DASHBOARD — adm-stats / adm-kpi / adm-bar namespaces
     ========================================================================= */
  .adm-stats-dashboard {
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding: 4px 0 16px;
  }
  .adm-stats-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .adm-stats-h2 {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-2);
  }
  .adm-stats-note {
    margin-top: 2px;
    line-height: 1.5;
  }
  .adm-stats-updated {
    padding-top: 8px;
    border-top: 1px solid var(--border-2);
    text-align: right;
  }

  /* KPI grid */
  .adm-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px;
  }
  .adm-kpi-card {
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--r-md);
    padding: 12px 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: var(--shadow-card, none);
    transition: border-color 0.12s ease;
  }
  .adm-kpi-val {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
    letter-spacing: -0.02em;
  }
  .adm-kpi-label {
    font-size: 11px;
    color: var(--muted);
    line-height: 1.3;
  }
  /* Color modifiers */
  .adm-kpi--accent {
    border-color: rgba(110, 150, 135, 0.45);
    background: var(--accent-soft, rgba(110, 150, 135, 0.08));
  }
  .adm-kpi--accent .adm-kpi-val { color: var(--accent, #7ecfa8); }
  .adm-kpi--ok {
    border-color: rgba(80, 160, 100, 0.35);
    background: rgba(80, 160, 100, 0.06);
  }
  .adm-kpi--ok .adm-kpi-val { color: var(--ok, #72c48a); }
  .adm-kpi--warn {
    border-color: rgba(200, 160, 60, 0.35);
    background: rgba(200, 160, 60, 0.06);
  }
  .adm-kpi--warn .adm-kpi-val { color: var(--warn, #e6cf9b); }
  .adm-kpi--danger {
    border-color: rgba(200, 80, 80, 0.35);
    background: rgba(200, 80, 80, 0.06);
  }
  .adm-kpi--danger .adm-kpi-val { color: var(--danger, #e08080); }

  /* Bar chart rows */
  .adm-stats-bars {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 2px;
  }
  .adm-bar-row {
    display: grid;
    grid-template-columns: 140px 1fr auto;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }
  .adm-bar-label {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .adm-bar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 99px;
    height: 8px;
    overflow: hidden;
    min-width: 40px;
  }
  .adm-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, rgba(110, 150, 135, 0.5), rgba(110, 150, 135, 0.85));
    border-radius: 99px;
    transition: width 0.3s ease;
    min-width: 2px;
  }
  .adm-bar-val {
    font-size: 12px;
    color: var(--text);
    white-space: nowrap;
    text-align: right;
    display: flex;
    align-items: center;
    gap: 5px;
  }
  .adm-bar-net {
    font-size: 11px;
    font-weight: 600;
  }
  .adm-bar-net--pos { color: var(--ok, #72c48a); }
  .adm-bar-net--neg { color: var(--danger, #e08080); }

  /* Narrow screens — label column collapses */
  @media (max-width: 480px) {
    .adm-bar-row {
      grid-template-columns: 90px 1fr auto;
    }
    .adm-kpi-grid {
      grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    }
    .adm-kpi-val {
      font-size: 18px;
    }
    /* P2: bar-row label column → fractional on narrow */
    .adm-bar-row:not(.adm-bar-row--mini) {
      grid-template-columns: minmax(0, 25%) 1fr auto;
    }
    /* P2: ledger columns that mustn't wrap — hide secondary on ≤480px */
    .adm-ledger-row {
      grid-template-columns: auto 1fr auto;
    }
    .adm-ledger-bal {
      display: none;
    }
  }

  /* =========================================================================
     DELTA BADGES — ▲/▼ inline in KPI value
     ========================================================================= */
  .adm-delta {
    font-size: 12px;
    font-weight: 600;
    vertical-align: middle;
  }
  .adm-delta--up   { color: var(--ok, #72c48a); }
  .adm-delta--down { color: var(--danger, #e08080); }
  .adm-delta--zero { color: var(--muted, #888); }
  .adm-delta-prev {
    margin-top: 2px;
    font-size: 10px;
  }

  /* =========================================================================
     TOP LISTS — three-column ranked list grid
     ========================================================================= */
  .adm-top-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
  }
  .adm-top-col {
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--r-md);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .adm-top-col-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
  }
  .adm-top-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
  }
  .adm-top-row {
    display: grid;
    grid-template-columns: 18px 1fr auto;
    align-items: baseline;
    gap: 5px;
    font-size: 12px;
  }
  .adm-top-rank {
    color: var(--muted);
    font-size: 11px;
    text-align: right;
  }
  .adm-top-title {
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* Clickable game name (data-game-nav) — looks like a link, opens game page. */
  .adm-game-link {
    color: var(--accent-soft, #2a8669);
    cursor: pointer;
    text-decoration: none;
  }
  .adm-game-link:hover { text-decoration: underline; color: var(--text); }
  .adm-top-val {
    color: var(--accent, #7ecfa8);
    white-space: nowrap;
    font-weight: 600;
    font-size: 11px;
    text-align: right;
  }

  /* Star bars — amber tint */
  .adm-bar-label--stars {
    color: #e6cf9b;
    font-size: 11px;
    letter-spacing: 1px;
  }
  .adm-bar-fill--star {
    background: linear-gradient(90deg, rgba(200, 160, 60, 0.45), rgba(200, 160, 60, 0.85));
  }

  /* =========================================================================
     ECONOMY — signed/dual-color bars, daily-flow panels, wealth distribution
     ========================================================================= */
  /* Signed-bar fill variants (источники = green, стоки = red). Reused by
     daily-flow rows and the by_reason_signed source/sink bars. */
  .adm-bar-fill--emit {
    background: linear-gradient(90deg, rgba(80, 160, 100, 0.45), rgba(80, 160, 100, 0.85));
  }
  .adm-bar-fill--spend {
    background: linear-gradient(90deg, rgba(200, 80, 80, 0.45), rgba(200, 80, 80, 0.85));
  }

  .adm-econ-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    margin-top: 6px;
  }
  .adm-econ-panel {
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--r-md);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
  }
  .adm-econ-panels > .adm-econ-panel { margin-top: 0; }
  .adm-econ-panel-title {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
  }
  .adm-flow-legend { font-size: 10px; text-transform: none; letter-spacing: 0; }
  .adm-flow-leg-emit  { color: var(--ok, #72c48a); }
  .adm-flow-leg-spend { color: var(--danger, #e08080); }

  /* Daily-flow rows — two stacked thin tracks (emit/spend) + signed net. */
  .adm-flow-bars { gap: 4px; }
  .adm-flow-row {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }
  .adm-flow-day {
    font-size: 10px;
    color: var(--muted);
    white-space: nowrap;
  }
  .adm-flow-tracks {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 40px;
  }
  .adm-flow-tracks .adm-bar-track { height: 5px; }
  .adm-bar-row--mini {
    grid-template-columns: 44px 1fr auto;
  }
  .adm-bar-row--mini .adm-bar-track { height: 6px; }

  /* =========================================================================
     LEADERBOARD — compact scrollable infinite-scroll panel
     ========================================================================= */
  .adm-leaderboard {
    max-height: 360px;
    overflow-y: auto;
    border: 1px solid var(--border-2);
    border-radius: var(--r-sm);
    background: rgba(0, 0, 0, 0.12);
  }
  .adm-lb-rows {
    display: flex;
    flex-direction: column;
  }
  .adm-lb-row {
    display: grid;
    grid-template-columns: 34px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    border-bottom: 1px solid var(--border-2);
    cursor: pointer;
    transition: background 0.12s ease;
  }
  .adm-lb-row:last-child { border-bottom: 0; }
  .adm-lb-row:hover { background: rgba(110, 150, 135, 0.1); }
  .adm-lb-rank {
    font-size: 11px;
    color: var(--muted);
    text-align: right;
    font-variant-numeric: tabular-nums;
  }
  .adm-lb-name {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    font-size: 13px;
    color: var(--text);
  }
  .adm-lb-sub {
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .adm-lb-bal {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent, #7ecfa8);
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }
  .adm-lb-sentinel { height: 1px; }
  .adm-lb-foot {
    padding: 8px 12px;
    text-align: center;
  }

  /* =========================================================================
     GENERIC SCROLL FEED — shared by audit log, marketplace ledger, artifact
     ledger. Scrollable viewport; createScrollFeed appends pages on scroll.
     ========================================================================= */
  .adm-feed {
    max-height: 70vh;
    overflow-y: auto;
    border: 1px solid var(--border-2);
    border-radius: var(--r-sm);
    background: rgba(0, 0, 0, 0.12);
    position: relative;
  }
  .adm-feed table { margin: 0; }
  /* Keep table headers visible while scrolling the feed. */
  .adm-feed thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg-2, #1a1d24);
  }
  .adm-feed-sentinel { height: 1px; }
  .adm-feed-foot {
    padding: 8px 12px;
    text-align: center;
  }

  /* =========================================================================
     ACCOUNT-LEDGER MODAL — drill-down transaction history
     ========================================================================= */
  .adm-ledger-modal {
    width: min(560px, 92vw);
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .adm-ledger-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
  }
  .adm-ledger-head h2 {
    margin: 0;
    font-size: 16px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .adm-ledger-sub { line-height: 1.4; }
  .adm-ledger-list {
    display: flex;
    flex-direction: column;
    max-height: 52vh;
    overflow-y: auto;
    border: 1px solid var(--border-2);
    border-radius: var(--r-sm);
    background: rgba(0, 0, 0, 0.12);
  }
  .adm-ledger-row {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    border-bottom: 1px solid var(--border-2);
    font-size: 12px;
  }
  .adm-ledger-row:last-child { border-bottom: 0; }
  .adm-ledger-date { white-space: nowrap; }
  .adm-ledger-reason {
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .adm-ledger-delta {
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }
  .adm-ledger-delta--pos { color: var(--ok, #72c48a); }
  .adm-ledger-delta--neg { color: var(--danger, #e08080); }
  .adm-ledger-bal {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }
  .adm-ledger-foot {
    text-align: center;
    min-height: 20px;
  }

  /* =========================================================================
     AI PANE — adm-ai namespace. Reuses adm-stats-section / adm-kpi cards; this
     block only adds the form rows, the prices table, and inline message colors.
     ========================================================================= */
  .adm-ai-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .adm-ai-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
  }
  .adm-ai-label {
    min-width: 160px;
    font-size: 13px;
    color: var(--text);
  }
  .adm-ai-toggle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    color: var(--text);
  }
  .adm-ai-toggle-row input[type="checkbox"] {
    flex: 0 0 auto;
    margin: 0;
    width: auto;
    cursor: pointer;
  }
  .adm-ai-toggle-row .adm-ai-hint {
    margin-left: auto;
  }
  .adm-ai-hint {
    line-height: 1.3;
  }
  .adm-ai-wide { width: 280px; max-width: 100%; }
  .adm-ai-advanced > summary {
    cursor: pointer;
    padding: 4px 0;
  }
  .adm-ai-advanced[open] { margin-top: 2px; }

  /* Highlight a field the backend rejected. */
  .adm-ai-field-err {
    border-color: var(--danger, #e08080) !important;
    box-shadow: 0 0 0 2px rgba(224, 128, 128, 0.18);
  }

  /* Save / refresh inline messages. */
  .adm-ai-save-row { gap: 12px; }
  .adm-ai-save-msg { font-size: 12px; }
  .adm-ai-ok   { color: var(--ok, #72c48a); }
  .adm-ai-warn { color: var(--warn, #e6cf9b); }
  .adm-ai-err  { color: var(--danger, #e08080); }

  .adm-ai-danger {
    background: linear-gradient(180deg, rgba(180, 70, 70, 0.22), rgba(60, 18, 18, 0.5));
    border-color: rgba(180, 90, 90, 0.5);
    color: #f0b6b6;
  }
  .adm-ai-danger:hover {
    background: linear-gradient(180deg, rgba(180, 70, 70, 0.4), rgba(90, 30, 30, 0.7));
  }

  /* Model section: current-model display + «Выбрать модель» button. */
  .adm-ai-pick-btn { white-space: nowrap; }
  .adm-ai-cur-row { align-items: center; }
  .adm-ai-cur {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
    width: auto;
    max-width: 480px;
    min-width: 0;
    flex: 0 1 auto;
  }
  .adm-ai-cur-id {
    font-family: var(--mono, monospace);
    font-size: 13px;
    color: #c9dcd0;
    padding: 3px 8px;
    border: 1px solid var(--border-2);
    border-radius: var(--r-sm);
    background: rgba(0, 0, 0, 0.18);
    word-break: break-all;
    display: inline-block;
  }
  .adm-ai-cur:hover .adm-ai-cur-id { border-color: rgba(110, 150, 135, 0.6); }
  .adm-ai-cur-price { font-variant-numeric: tabular-nums; }

  /* =========================================================================
     MODEL PICKER MODAL — browse the full /models catalog AND select the
     current model. Large, scrollable, multi-column card grid.
     Reuses .modal-back / .modal from misc.css (like the ledger modal).
     ========================================================================= */
  /* `.modal.adm-ai-pick-modal` (specificity 0,2,0) so it BEATS responsive.css's
     `.modal { max-width: 480px }` (0,1,0, loaded last). Without the compound
     selector the modal stays clamped at 480px — exactly the "window didn't
     change" bug. responsive.css documents this: wide modals need a more
     specific selector. */
  .modal.adm-ai-pick-modal {
    width: 70vw;
    height: 70vh;
    max-width: 1500px;
    min-width: 320px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-sizing: border-box;
  }
  .adm-ai-pick-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
  }
  .adm-ai-pick-head h2 { margin: 0 0 2px; font-size: 16px; color: var(--text); }
  .adm-ai-pick-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
  }
  .adm-ai-pick-search { flex: 1; min-width: 240px; }
  .adm-ai-pick-refresh { white-space: nowrap; }
  .adm-ai-pick-refresh[disabled] { opacity: 0.6; cursor: default; }
  .adm-ai-pick-count { white-space: nowrap; }
  .adm-ai-pick-note {
    padding: 2px 0;
    color: var(--warn, #e6cf9b);
  }
  /* Scroll region holding the recent section + the main grid. It is the
     modal's flex:1 child now (the grid used to be); both scroll together so the
     «Ранее выбранные» strip stays pinned above the catalog. */
  .adm-ai-pick-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 2px;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .adm-ai-pick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    align-content: start;
  }
  .adm-ai-pick-grid > .empty {
    grid-column: 1 / -1;
    padding: 28px 12px;
    text-align: center;
    color: var(--muted);
    line-height: 1.5;
  }
  .adm-ai-pick-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
    padding: 12px;
    border: 1px solid var(--border-2);
    border-radius: var(--r-md, 8px);
    background: rgba(0, 0, 0, 0.18);
    cursor: pointer;
    font-family: inherit;
    color: var(--text);
    transition: border-color 0.12s ease, background 0.12s ease;
  }
  .adm-ai-pick-card:hover {
    border-color: rgba(110, 150, 135, 0.6);
    background: rgba(110, 150, 135, 0.1);
  }
  .adm-ai-pick-card--cur {
    border-color: rgba(110, 150, 135, 0.7);
    background: rgba(110, 150, 135, 0.12);
  }
  .adm-ai-pick-card-id {
    font-family: var(--mono, monospace);
    font-size: 12px;
    color: #c9dcd0;
    word-break: break-all;
  }
  .adm-ai-pick-cur-tag {
    font-family: var(--ui, sans-serif);
    font-size: 10px;
    color: #72c48a;
    border: 1px solid rgba(110, 150, 135, 0.5);
    border-radius: 999px;
    padding: 0 6px;
    white-space: nowrap;
  }
  .adm-ai-pick-card-name { word-break: break-word; }
  .adm-ai-pick-card-prices {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
  }
  .adm-ai-pick-price { display: flex; gap: 6px; align-items: baseline; }

  /* --- Filters / sort toolbar controls ----------------------------------- */
  .adm-ai-pick-pricecap,
  .adm-ai-pick-sortwrap {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
  }
  .adm-ai-pick-priceinp { width: 92px; }
  .adm-ai-pick-sort { min-width: 150px; }

  /* --- Category chips (segmented filter) --------------------------------- */
  .adm-ai-pick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .adm-ai-pick-chips:empty { display: none; }
  .adm-ai-pick-chip {
    font-family: inherit;
    font-size: 12px;
    color: var(--text);
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid var(--border-2);
    border-radius: 999px;
    padding: 4px 12px;
    cursor: pointer;
    transition: border-color 0.12s ease, background 0.12s ease;
  }
  .adm-ai-pick-chip:hover { border-color: rgba(110, 150, 135, 0.6); }
  .adm-ai-pick-chip--on {
    border-color: rgba(110, 150, 135, 0.8);
    background: rgba(110, 150, 135, 0.18);
    color: #c9dcd0;
  }

  /* --- «Ранее выбранные» section (pinned above the grid) ----------------- */
  .adm-ai-pick-recent-sec[hidden] { display: none; }
  .adm-ai-pick-recent-head {
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .adm-ai-pick-recent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    align-content: start;
  }

  /* Card wrapper — hosts the card + its «×» remove control for recent cards. */
  .adm-ai-pick-card-wrap { position: relative; display: flex; }
  .adm-ai-pick-card-wrap .adm-ai-pick-card { flex: 1; }
  .adm-ai-pick-rm {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    line-height: 18px;
    padding: 0;
    font-size: 15px;
    border-radius: 999px;
    border: 1px solid var(--border-2);
    background: rgba(0, 0, 0, 0.35);
    color: var(--muted);
    cursor: pointer;
    transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
  }
  .adm-ai-pick-rm:hover {
    color: #e88;
    border-color: rgba(220, 120, 120, 0.7);
    background: rgba(220, 120, 120, 0.14);
  }

  /* --- ⓘ per-card info control (top-right) ------------------------------- */
  /* Sits in the card wrapper (sibling of the select button), NOT inside it, so
     a click is its own event — onCardZoneClick stops it from selecting. The
     select button has top padding room; the icon overlays the top-right. */
  .adm-ai-pick-info {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    line-height: 20px;
    padding: 0;
    font-size: 13px;
    text-align: center;
    border-radius: 999px;
    border: 1px solid var(--border-2);
    background: rgba(0, 0, 0, 0.35);
    color: var(--muted);
    cursor: pointer;
    transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
  }
  .adm-ai-pick-info:hover {
    color: #c9dcd0;
    border-color: rgba(110, 150, 135, 0.7);
    background: rgba(110, 150, 135, 0.14);
  }
  /* On «Ранее выбранные» cards the «×» already owns the top-right corner, so
     shift the ⓘ left of it to avoid overlap. */
  .adm-ai-pick-card-wrap--recent .adm-ai-pick-info { right: 30px; }
  /* Keep the card id clear of the icon(s) overlaid top-right. */
  .adm-ai-pick-card { padding-right: 32px; }

  /* --- Model-info popover (floating panel anchored to the ⓘ icon) -------- */
  /* Lightweight; appended to <body>, NOT a modal-over-modal. Matches the app's
     surface look (border + shadow) and closes on outside-click / Esc. */
  .adm-ai-info-pop {
    position: fixed;
    z-index: 1200;
    width: 320px;
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    overflow-y: auto;
    box-sizing: border-box;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid var(--border-2);
    border-radius: var(--r-md, 8px);
    background: var(--surface, #1c2420);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
    color: var(--text);
  }
  .adm-ai-info-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
  }
  .adm-ai-info-id {
    font-family: var(--mono, monospace);
    font-size: 12px;
    color: #c9dcd0;
    word-break: break-all;
  }
  .adm-ai-info-close {
    flex: none;
    width: 22px;
    height: 22px;
    line-height: 18px;
    padding: 0;
    font-size: 15px;
    border-radius: 999px;
    border: 1px solid var(--border-2);
    background: rgba(0, 0, 0, 0.35);
    color: var(--muted);
    cursor: pointer;
  }
  .adm-ai-info-close:hover { color: var(--text); border-color: rgba(110, 150, 135, 0.6); }
  .adm-ai-info-sec { display: flex; flex-direction: column; gap: 4px; }
  .adm-ai-info-label { text-transform: uppercase; letter-spacing: 0.04em; }
  .adm-ai-info-desc { font-size: 13px; line-height: 1.45; word-break: break-word; }
  .adm-ai-info-specs {
    margin: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 3px 12px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
  }
  .adm-ai-info-specs dt { white-space: nowrap; }
  .adm-ai-info-specs dd { margin: 0; word-break: break-word; }
  .adm-ai-info-note { line-height: 1.4; }

  /* =========================================================================
     Phase 2.5c-4 — user-facing model curation. The «Модели для пользователей»
     section in the AI pane (.adm-ai-um-*) + the «доступно юзерам» card toggle
     in the picker modal (.adm-ai-pick-um*). Reuses the adm-ai surface look.
     ========================================================================= */
  .adm-ai-um-intro { line-height: 1.45; margin-bottom: 10px; max-width: 720px; }
  .adm-ai-um-list { display: flex; flex-direction: column; gap: 8px; }
  .adm-ai-um-empty { padding: 14px; }
  .adm-ai-um-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px 10px;
    border: 1px solid var(--border-2);
    border-radius: var(--r-md, 8px);
    background: rgba(0, 0, 0, 0.18);
  }
  .adm-ai-um-id {
    font-family: var(--mono, monospace);
    font-size: 12px;
    color: #c9dcd0;
    word-break: break-all;
    min-width: 180px;
    flex: 0 1 auto;
  }
  .adm-ai-um-label { flex: 1; min-width: 200px; }
  .adm-ai-um-est { white-space: nowrap; font-variant-numeric: tabular-nums; }
  .adm-ai-um-rm {
    width: 24px;
    height: 24px;
    line-height: 20px;
    padding: 0;
    font-size: 15px;
    border-radius: 999px;
    border: 1px solid var(--border-2);
    background: rgba(0, 0, 0, 0.35);
    color: var(--muted);
    cursor: pointer;
    transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
  }
  .adm-ai-um-rm:hover {
    color: #e88;
    border-color: rgba(220, 120, 120, 0.7);
    background: rgba(220, 120, 120, 0.14);
  }

  /* «доступно юзерам» toggle on a picker card. Sits at the bottom of the card
     wrapper, full width, below the select button. A real button → its own click
     (onCardZoneClick stops it from selecting the card). */
  .adm-ai-pick-um {
    margin-top: 6px;
    width: 100%;
    padding: 4px 8px;
    font-size: 11px;
    text-align: center;
    border-radius: var(--r-sm, 6px);
    border: 1px solid var(--border-2);
    background: rgba(0, 0, 0, 0.28);
    color: var(--muted);
    cursor: pointer;
    transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
  }
  .adm-ai-pick-um:hover {
    color: #c9dcd0;
    border-color: rgba(110, 150, 135, 0.7);
    background: rgba(110, 150, 135, 0.12);
  }
  .adm-ai-pick-um--on {
    color: #bfe6cd;
    border-color: rgba(110, 180, 135, 0.7);
    background: rgba(90, 170, 120, 0.18);
  }
  .adm-ai-pick-um--na {
    margin-top: 6px;
    text-align: center;
    cursor: default;
    opacity: 0.7;
  }
  /* The toggle is a third child of the (row-flex) card wrapper — wrap it onto
     its own full-width line beneath the select button (the ⓘ/× are absolutely
     positioned, so they don't participate in this flow). */
  .adm-ai-pick-card-wrap { flex-wrap: wrap; }
  .adm-ai-pick-um, .adm-ai-pick-um--na { flex-basis: 100%; }

  /* ===========================================================================
     MODULES PANE — adm-mod namespace. Moderator dashboard + «всё про модули».
     Reuses adm-stats-section / adm-kpi cards; adds the queue cards, status
     badges, AI-report blocks, spec <pre>, the overview table + filter chips.
     =========================================================================== */
  .adm-mod { gap: 28px; }

  /* Queue — review cards */
  .adm-mod-queue {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .adm-mod-card {
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--r-md);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .adm-mod-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
  }
  .adm-mod-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }
  .adm-mod-name {
    font-weight: 700;
    color: var(--text);
    font-size: 14px;
  }
  .adm-mod-ref {
    font-size: 12px;
    color: var(--muted);
    background: var(--bg-2, rgba(0,0,0,0.18));
    padding: 2px 8px;
    border-radius: var(--r-sm, 6px);
  }
  .adm-mod-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
  }

  /* Badges / chips */
  .adm-mod-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid transparent;
    white-space: nowrap;
  }
  .adm-mod-badge--ok    { color: var(--ok, #72c48a);     border-color: rgba(80,160,100,0.4);  background: rgba(80,160,100,0.10); }
  .adm-mod-badge--warn  { color: var(--warn, #e6cf9b);   border-color: rgba(200,160,60,0.4);  background: rgba(200,160,60,0.10); }
  .adm-mod-badge--err   { color: var(--danger, #e08080); border-color: rgba(200,80,80,0.4);   background: rgba(200,80,80,0.10); }
  .adm-mod-badge--muted { color: var(--muted);           border-color: var(--border-2);       background: var(--bg-2, rgba(0,0,0,0.12)); }
  .adm-mod-kind {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 2px 7px;
    border-radius: var(--r-sm, 6px);
    color: var(--muted);
    border: 1px solid var(--border-2);
  }
  .adm-mod-tags {
    display: inline-flex;
    gap: 5px;
    flex-wrap: wrap;
  }
  .adm-mod-tag {
    font-size: 10px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--bg-2, rgba(0,0,0,0.14));
    color: var(--muted);
  }

  /* AI report */
  .adm-mod-ai { margin: 0; }
  .adm-mod-ai > summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .adm-mod-ai > summary::-webkit-details-marker { display: none; }
  .adm-mod-verdict {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid transparent;
  }
  .adm-mod-verdict--ok   { color: var(--ok, #72c48a);     border-color: rgba(80,160,100,0.4);  background: rgba(80,160,100,0.10); }
  .adm-mod-verdict--warn { color: var(--warn, #e6cf9b);   border-color: rgba(200,160,60,0.4);  background: rgba(200,160,60,0.10); }
  .adm-mod-verdict--err  { color: var(--danger, #e08080); border-color: rgba(200,80,80,0.4);   background: rgba(200,80,80,0.10); }
  .adm-mod-ai-meta { margin: 6px 0 2px; }
  .adm-mod-ai-findings {
    margin: 4px 0 0;
    padding-left: 18px;
    font-size: 12px;
    color: var(--text);
    line-height: 1.5;
  }

  /* Spec preview */
  .adm-mod-spec { margin: 0; }
  .adm-mod-spec > summary { cursor: pointer; }
  .adm-mod-pre {
    margin: 6px 0 0;
    padding: 10px 12px;
    background: var(--bg-2, rgba(0,0,0,0.2));
    border: 1px solid var(--border-2);
    border-radius: var(--r-sm, 6px);
    font-size: 11px;
    line-height: 1.5;
    max-height: 280px;
    overflow: auto;
    white-space: pre;
  }

  /* Actions + inline reject form */
  .adm-mod-actions {
    display: flex;
    gap: 8px;
  }
  .adm-mod-reject-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 4px;
  }
  .adm-mod-reason { flex: 1 1 220px; min-width: 180px; }

  /* Overview filter chips */
  .adm-mod-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }
  .adm-mod-chip {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 999px;
    border: 1px solid var(--border-2);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.12s ease;
  }
  .adm-mod-chip:hover { color: var(--text); border-color: var(--border); }
  .adm-mod-chip.active {
    color: var(--accent, #7ecfa8);
    border-color: rgba(110,150,135,0.55);
    background: var(--accent-soft, rgba(110,150,135,0.1));
  }

  /* Overview table */
  .adm-mod-table-wrap { overflow-x: auto; }
  .adm-mod-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
  }
  .adm-mod-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-2);
    white-space: nowrap;
  }
  .adm-mod-table td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--border-2);
    vertical-align: top;
  }
  .adm-mod-td-ref code { font-size: 12px; color: var(--text); }
  .adm-mod-td-usage { font-weight: 700; color: var(--text); }

  /* Stats time-range switcher (top of the «Статистика» pane). */
  .adm-stats-range {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    margin: 0 0 16px; padding: 8px 10px;
    border: 1px solid var(--border-2); border-radius: var(--r-md, 10px);
    background: var(--surface, #1a1714);
  }
  .adm-range-label { margin-right: 4px; }
  .adm-range-btn {
    padding: 6px 12px; background: transparent; cursor: pointer;
    border: 1px solid var(--border-2); border-radius: 7px;
    color: var(--muted); font-size: 13px;
    transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
  }
  .adm-range-btn:hover { color: var(--text); }
  .adm-range-btn.active { color: var(--text); border-color: rgba(95,150,135,0.7); background: rgba(95,150,135,0.12); }
  .adm-range-custom { display: inline-flex; align-items: center; gap: 6px; margin-left: 4px; }
  .adm-range-input {
    width: 72px; padding: 6px 8px; background: var(--bg, #111);
    border: 1px solid var(--border-2); border-radius: 7px; color: var(--text); font-size: 13px; outline: none;
  }
  .adm-range-input:focus { border-color: rgba(95,150,135,0.6); }

  /* Per-panel scope badge: «за период» (follows the switcher) vs «за всё время». */
  .adm-scope {
    display: inline-block; margin-left: 8px; vertical-align: middle;
    padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  }
  .adm-scope--period { background: rgba(95,150,135,0.18); color: #8fd3b6; }
  .adm-scope--fixed  { background: rgba(255,255,255,0.06); color: var(--muted); }

  /* =========================================================================
     MOBILE ADAPTIVE — additive rules only; desktop layout unchanged.
     Breakpoints: 640px (main mobile), 480px (narrow), 380px (ultra-narrow).
     Touch / hover targets handled in (hover:none)/(pointer:coarse) blocks.
     ========================================================================= */

  /* ── P1: Model-picker modal — full-width on phone ── */
  @media (max-width: 480px) {
    .modal.adm-ai-pick-modal {
      width: 92vw;
      min-width: 0;
    }
    .adm-ai-pick-search {
      min-width: 0;
    }
    .adm-ai-pick-toolbar {
      flex-wrap: wrap;
    }
  }

  /* ── P1: Modules overview table — card layout on ≤600px ── */
  @media (max-width: 600px) {
    /* Hide secondary columns; keep Модуль + Статус + Использований */
    .adm-mod-table th:nth-child(2),
    .adm-mod-table td:nth-child(2),
    .adm-mod-table th:nth-child(3),
    .adm-mod-table td:nth-child(3),
    .adm-mod-table th:nth-child(5),
    .adm-mod-table td:nth-child(5),
    .adm-mod-table th:nth-child(7),
    .adm-mod-table td:nth-child(7) {
      display: none;
    }
  }

  /* ── P1: iOS zoom fix for admin-boost-input (font-size 13px overrides global) ── */
  @media (max-width: 640px) {
    .admin-boost-input {
      font-size: 16px;
    }
  }

  /* ── P2: Tap-target enlargement — audit/agp buttons, icon-controls ── */
  @media (max-width: 640px) {
    .audit-row-actions .btn,
    .agp-buttons .btn {
      min-height: 44px;
      min-width: 44px;
      padding: 10px 14px;
    }

    /* adm-ai-pick-rm / adm-ai-pick-info / adm-ai-um-rm / adm-ai-info-close:
       keep visual 22-24px icon; expand hit area via ::after */
    .adm-ai-pick-rm,
    .adm-ai-pick-info,
    .adm-ai-info-close,
    .adm-ai-um-rm {
      position: relative;
    }
    .adm-ai-pick-rm::after,
    .adm-ai-pick-info::after,
    .adm-ai-info-close::after,
    .adm-ai-um-rm::after {
      content: "";
      position: absolute;
      inset: -11px;
    }

    /* P2: adm-ai-label min-width collapse on mobile */
    .adm-ai-label {
      min-width: 0;
      width: 100%;
    }

    /* P2: adm-ai-um-id + adm-ai-um-label collapse on mobile */
    .adm-ai-um-id {
      min-width: 0;
    }
    .adm-ai-um-label {
      min-width: 0;
      flex: 1 1 100%;
    }
  }

  /* ── P2: hover effects only on pointer devices ── */
  @media (hover: hover) {
    .adm-ai-pick-card:hover {
      border-color: rgba(110, 150, 135, 0.6);
      background: rgba(110, 150, 135, 0.1);
    }
    .adm-ai-pick-rm:hover {
      color: #e88;
      border-color: rgba(220, 120, 120, 0.7);
      background: rgba(220, 120, 120, 0.14);
    }
    .adm-ai-pick-info:hover {
      color: #c9dcd0;
      border-color: rgba(110, 150, 135, 0.7);
      background: rgba(110, 150, 135, 0.14);
    }
    .adm-lb-row:hover {
      background: rgba(110, 150, 135, 0.1);
    }
    .adm-game-link:hover {
      text-decoration: underline;
      color: var(--text);
    }
    .adm-ai-um-rm:hover {
      color: #e88;
      border-color: rgba(220, 120, 120, 0.7);
      background: rgba(220, 120, 120, 0.14);
    }
    .adm-ai-info-close:hover {
      color: var(--text);
      border-color: rgba(110, 150, 135, 0.6);
    }
  }

  /* ── P2: ultra-narrow 380px — further collapse ── */
  @media (max-width: 380px) {
    .adm-ai-label {
      min-width: 0;
      width: 100%;
    }
    .adm-ai-um-id {
      min-width: 0;
      flex-basis: 100%;
    }
    .adm-ai-um-label {
      min-width: 0;
      flex-basis: 100%;
    }
  }
