/* Admin console rendered as an in-page tabbed modal. Reuses license-ui.css's
   .lic-backdrop / .lic-card shell (and .lic-banner) — only the wider card, tabs,
   and panel content styles live here. Themed via the host page's CSS variables. */

/* Flex column: a fixed bar on top, a scrolling body below. Only the body scrolls
   (overflow hidden on the card), so the scrollbar sits inside the body region —
   never alongside the tab bar or clipped by the card's rounded corners. */
.lic-card.admin-card {
    max-width: 860px;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.admin-bar {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px 0 24px;
    background: inherit;
    border-bottom: 1px solid var(--border, rgba(0,0,0,.1));
}
.admin-tabs { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.admin-tab {
    appearance: none; background: none; border: none; border-bottom: 2px solid transparent;
    color: var(--text-secondary, #6b7280); font: inherit; font-weight: 600; font-size: 13px;
    padding: 9px 13px; cursor: pointer; margin-bottom: -1px;
}
.admin-tab:hover { color: var(--text-primary, #1a1a1a); }
.admin-tab.active { color: var(--accent-purple, #b01ab2); border-bottom-color: var(--accent-purple, #b01ab2); }
.admin-close {
    cursor: pointer; border: none; background: transparent; font-size: 24px; line-height: 1;
    color: var(--text-secondary, #6b7280); padding: 0 4px 6px; align-self: center;
}
.admin-close:hover { color: var(--text-primary, #1a1a1a); }
.admin-body { padding: 18px 24px 24px; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.admin-panel { display: none; }
.admin-panel.active { display: block; }

.adm-section { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted, #8b8fa8); margin: 22px 0 10px; }
.adm-section:first-child { margin-top: 2px; }
.adm-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.adm-card { background: var(--bg-card, #fff); border: 1px solid var(--border, rgba(0,0,0,.1)); border-radius: 10px; padding: 14px 16px; }
/* Reserve a consistent value height so every card's label sits on the same line,
   even when the value is the small mono instance id. */
.adm-card .v { font-size: 22px; font-weight: 700; word-break: break-all; min-height: 27px; display: flex; align-items: center; }
.adm-card .v.mono { font-size: 12px; font-family: var(--font-mono, ui-monospace, monospace); white-space: nowrap; word-break: normal; }
.adm-card .k { font-size: 12px; font-weight: 600; color: var(--text-secondary, #6b7280); margin-top: 4px; }
.adm-card .s { font-size: 11px; color: var(--text-muted, #8b8fa8); margin-top: 2px; }

/* Grid-based "tables" that always fit the modal width (minmax(0,1fr) columns
   can't expand to content, so no horizontal scroll). */
.adm-gtable { display: grid; background: var(--bg-card, #fff); border: 1px solid var(--border, rgba(0,0,0,.1)); border-radius: 10px; overflow: hidden; }
.adm-gtable > div { display: flex; align-items: center; gap: 6px; padding: 8px 12px; font-size: 12.5px; border-bottom: 1px solid var(--border, rgba(0,0,0,.08)); min-width: 0; overflow-wrap: anywhere; }
.adm-gtable > .ph { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted, #8b8fa8); background: var(--bg-card-hover, rgba(0,0,0,.03)); font-weight: 600; }
.adm-gtable .mono { font-family: var(--font-mono, ui-monospace, monospace); font-size: 12px; word-break: break-all; }
/* by-protocol: 4 columns */
.adm-gtable.cols-proto { grid-template-columns: minmax(0,1.5fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1fr); }
.adm-gtable.cols-proto > div:nth-last-child(-n+4) { border-bottom: none; }
/* installed licenses: 6 columns (id, tenant, expires, source, status, actions) */
.adm-gtable.cols-lic { grid-template-columns: minmax(0,1.6fr) minmax(0,1.5fr) minmax(0,.9fr) minmax(0,.7fr) minmax(0,.8fr) minmax(0,1.3fr); }
.adm-gtable.cols-lic > div:nth-last-child(-n+6) { border-bottom: none; }
/* workers: 6 columns (worker, role, address, load, heartbeat, status) */
.adm-gtable.cols-work { grid-template-columns: minmax(0,2fr) minmax(0,.7fr) minmax(0,1.2fr) minmax(0,.7fr) minmax(0,1fr) minmax(0,1fr); }
.adm-gtable.cols-work > div:nth-last-child(-n+6) { border-bottom: none; }
.adm-gtable .acts { justify-content: flex-end; flex-wrap: wrap; }

.adm-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.adm-pill.ok { background: rgba(31,157,87,.14); color: #1f9d57; }
.adm-pill.warn { background: rgba(217,138,0,.16); color: #b87400; }
.adm-pill.off { background: rgba(0,0,0,.06); color: var(--text-muted, #8b8fa8); }
[data-theme="dark"] .adm-pill.off { background: rgba(255,255,255,.08); }
[data-theme="dark"] .adm-pill.warn { color: #f0b429; }

.adm-kv { display: grid; grid-template-columns: max-content 1fr; gap: 5px 18px; background: var(--bg-card, #fff); border: 1px solid var(--border, rgba(0,0,0,.1)); border-radius: 10px; padding: 14px 16px; }
.adm-kv dt { font-size: 12px; color: var(--text-secondary, #6b7280); font-weight: 600; }
.adm-kv dd { font-size: 12.5px; font-family: var(--font-mono, ui-monospace, monospace); word-break: break-all; }

.adm-proto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.adm-proto { background: var(--bg-card, #fff); border: 1px solid var(--border, rgba(0,0,0,.1)); border-radius: 10px; padding: 9px 11px; }
.adm-proto .pname { font-weight: 700; font-size: 12.5px; text-transform: uppercase; }
.adm-proto .modes { margin-top: 6px; display: flex; gap: 5px; flex-wrap: wrap; }

.adm-empty { color: var(--text-secondary, #6b7280); font-size: 13px; padding: 14px; background: var(--bg-card, #fff); border: 1px dashed var(--border, rgba(0,0,0,.15)); border-radius: 10px; }
.adm-hr { border: none; border-top: 1px solid var(--border, rgba(0,0,0,.1)); margin: 24px 0 2px; }
.adm-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--accent-purple, #b01ab2); color: #fff; }

.adm-inline textarea { width: 100%; min-height: 92px; resize: vertical; font-family: var(--font-mono, ui-monospace, monospace); font-size: 12px; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--border, rgba(0,0,0,.18)); background: var(--bg-card, #fff); color: inherit; box-sizing: border-box; }
.adm-row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 10px; }
.adm-btn { border: 1px solid transparent; border-radius: 8px; padding: 8px 15px; font-size: 13px; font-weight: 600; cursor: pointer; }
.adm-btn-primary { background: var(--accent-blue, #2f6fed); color: #fff; }
.adm-btn-ghost { background: transparent; border-color: var(--border, rgba(0,0,0,.18)); color: inherit; }
.adm-btn-danger { background: transparent; border-color: #d6336c; color: #c81e5b; }
[data-theme="dark"] .adm-btn-danger { color: #ff7ea2; }
.adm-btn:disabled { opacity: .5; cursor: not-allowed; }
.adm-err { color: #c81e5b; font-size: 13px; min-height: 16px; margin-top: 8px; }
[data-theme="dark"] .adm-err { color: #ff7ea2; }

/* ── Service tokens ─────────────────────────────────────────────────────────
   Uses the same tokens as the rest of the console so it inherits both themes. */
.adm-note { color: var(--text-secondary, #6b7280); font-size: 13px; line-height: 1.5; margin: 0 0 12px; }
.adm-input { flex: 1; border: 1px solid var(--border, rgba(0,0,0,.18)); border-radius: 8px; padding: 8px 11px; font-size: 13px; background: var(--bg-card, #fff); color: var(--text-primary, #111); }
.adm-input:focus { outline: 2px solid var(--accent-blue, #2f6fed); outline-offset: -1px; }
/* Left-aligned, unlike .adm-row's footer buttons: this row is a form, not an action bar. */
.adm-row:has(.adm-input) { justify-content: flex-start; }

.adm-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 12px; }
.adm-table th { text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted, #8b8fa8); padding: 6px 10px; border-bottom: 1px solid var(--border, rgba(0,0,0,.12)); }
.adm-table td { padding: 9px 10px; border-bottom: 1px solid var(--border, rgba(0,0,0,.07)); color: var(--text-primary, #111); }
.adm-table tr:last-child td { border-bottom: 0; }

/* A revoked token stays listed rather than vanishing, so the console shows that a
   credential was withdrawn instead of leaving its absence to be inferred. */
.adm-revoked td { color: var(--text-muted, #8b8fa8); }
.adm-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 6px; border-radius: 999px; background: var(--border, rgba(0,0,0,.08)); color: var(--text-muted, #8b8fa8); }

/* Shown once, and never again: only the hash is stored. Deliberately loud, because
   an operator who navigates away without copying it has to create another. */
.adm-new-token { margin-top: 12px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--accent-blue, #2f6fed); background: color-mix(in srgb, var(--accent-blue, #2f6fed) 8%, transparent); }
.adm-new-token-label { font-size: 12px; font-weight: 600; color: var(--accent-blue, #2f6fed); margin-bottom: 6px; }
.adm-new-token-value { display: block; word-break: break-all; font-size: 13px; color: var(--text-primary, #111); }
