/* ═══════════════════════════════════════════════════════════════
   AgencyOS — admin.css  (RBAC mission)
   Administration + Account pages, identity chip, workflow-lock banners.
   Built on style.css / capability-manager.css tokens; no new palette.
   ═══════════════════════════════════════════════════════════════ */

/* ── Identity chip (sidebar footer) ─────────────────────────────── */
.identity-chip { cursor: pointer; }
.identity-chip .rs-label { font-size: 10px; color: var(--text-muted); }
.rs-avatar.intern { background: rgba(139, 92, 246, 0.18); color: #b79bff; }
.rs-avatar.team-lead { background: rgba(245, 158, 11, 0.18); color: #f5c76a; }
.rs-avatar.team-member { background: rgba(16, 185, 129, 0.18); color: #6ee7b7; }
.rs-avatar.super-admin { background: rgba(0, 212, 255, 0.18); color: var(--cyan); }
.rs-dropdown .rs-dropdown-label { word-break: break-all; }

/* ── Settings → Your account ─────────────────────────────────────── */
.settings-identity-card { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--border-muted); border-radius: 8px; background: var(--bg-elevated); }
.settings-identity-avatar { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; background: rgba(0,212,255,0.14); color: var(--cyan); flex-shrink: 0; }
.settings-identity-main { flex: 1; min-width: 0; }
.settings-identity-name { font-weight: 600; font-size: 14px; }
.settings-identity-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Workflow lock UI ────────────────────────────────────────────── */
.tab-btn.tab-locked { opacity: 0.75; }
.workflow-lock-banner { display: flex; gap: 12px; align-items: flex-start; margin: 12px 16px 0; padding: 12px 14px; border-radius: 8px; border: 1px solid rgba(245,158,11,0.35); background: rgba(245,158,11,0.08); font-size: 13px; line-height: 1.45; }
.workflow-lock-banner .wlb-icon { font-size: 18px; line-height: 1; }
.workflow-lock-banner .wlb-sub { display: block; margin-top: 4px; font-size: 12px; color: var(--text-muted); }
.tab-panel.workflow-locked .wl-inert { opacity: 0.45 !important; cursor: not-allowed !important; }

/* ── Admin shell ─────────────────────────────────────────────────── */
.admin-root { --adm-gap: 14px; }
.adm-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.adm-toolbar .cm-search { flex: 1 1 240px; min-width: 200px; }
.adm-toolbar .cm-select { min-width: 140px; }
.adm-spacer { flex: 1; }
.adm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--adm-gap); }
.adm-card { border: 1px solid var(--border-muted); border-radius: 10px; background: var(--bg-elevated); padding: 14px 16px; }
.adm-card h3 { margin: 0 0 8px; font-size: 13px; font-weight: 600; letter-spacing: 0.02em; }
.adm-card .adm-kpi { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.adm-card .adm-kpi-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.adm-muted { color: var(--text-muted); font-size: 12px; }
.adm-note { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.adm-empty { padding: 28px; text-align: center; color: var(--text-muted); border: 1px dashed var(--border-muted); border-radius: 10px; font-size: 13px; }
.adm-error { padding: 12px 14px; border-radius: 8px; border: 1px solid rgba(239,68,68,0.35); background: rgba(239,68,68,0.08); color: #ff9c9c; font-size: 13px; margin-bottom: 12px; }
.adm-ok { padding: 10px 14px; border-radius: 8px; border: 1px solid rgba(16,185,129,0.35); background: rgba(16,185,129,0.08); color: #8ff0c4; font-size: 13px; margin-bottom: 12px; }

/* table */
.adm-table-wrap { overflow-x: auto; border: 1px solid var(--border-muted); border-radius: 10px; background: var(--bg-elevated); }
.adm-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
.adm-table th { text-align: left; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border-muted); white-space: nowrap; }
.adm-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.adm-table tr:last-child td { border-bottom: 0; }
.adm-table tr.is-clickable { cursor: pointer; }
.adm-table tr.is-clickable:hover td { background: var(--bg-hover); }
.adm-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.adm-user-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.adm-avatar { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 11px; font-weight: 700; flex-shrink: 0; background: rgba(0,212,255,0.14); color: var(--cyan); }
.adm-user-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-user-sub { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* pills */
.adm-pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; border: 1px solid var(--border-muted); background: var(--bg-overlay); color: var(--text-secondary); white-space: nowrap; }
.adm-pill.ok { border-color: rgba(16,185,129,0.4); color: #6ee7b7; }
.adm-pill.warn { border-color: rgba(245,158,11,0.4); color: #f5c76a; }
.adm-pill.danger { border-color: rgba(239,68,68,0.4); color: #ff9c9c; }
.adm-pill.info { border-color: rgba(0,212,255,0.4); color: var(--cyan); }
.adm-pill.muted { opacity: 0.7; }
.adm-pill.role-super-admin { border-color: rgba(0,212,255,0.4); color: var(--cyan); }
.adm-pill.role-team-lead { border-color: rgba(245,158,11,0.4); color: #f5c76a; }
.adm-pill.role-team-member { border-color: rgba(16,185,129,0.4); color: #6ee7b7; }
.adm-pill.role-intern { border-color: rgba(139,92,246,0.4); color: #b79bff; }

/* buttons */
.adm-btn { height: 30px; padding: 0 12px; border-radius: 7px; border: 1px solid var(--border-muted); background: var(--bg-elevated); color: var(--text-primary); font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.adm-btn:hover { border-color: var(--border-accent); }
.adm-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.adm-btn.primary { background: var(--cyan); color: #04121a; border-color: transparent; }
.adm-btn.danger { border-color: rgba(239,68,68,0.45); color: #ff9c9c; }
.adm-btn.ghost { background: transparent; }
.adm-btn.small { height: 26px; padding: 0 9px; font-size: 11px; }
.adm-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* forms */
.adm-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.adm-field { display: flex; flex-direction: column; gap: 6px; }
.adm-field > span { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.adm-field input, .adm-field select, .adm-field textarea { height: 34px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--border-muted); background: var(--bg-base); color: var(--text-primary); font-size: 13px; outline: none; }
.adm-field textarea { height: auto; padding: 8px 10px; min-height: 64px; resize: vertical; }
.adm-field input:focus, .adm-field select:focus, .adm-field textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,212,255,0.12); }
.adm-inline { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.adm-check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }

/* drawer */
.adm-drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 900; }
.adm-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(880px, 96vw); background: var(--bg-elevated); border-left: 1px solid var(--border-muted); box-shadow: -20px 0 60px rgba(0,0,0,0.45); z-index: 901; display: flex; flex-direction: column; }
.adm-drawer-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border-muted); }
.adm-drawer-title { font-size: 15px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-drawer-body { flex: 1; overflow: auto; padding: 16px 18px 24px; }
.adm-drawer-foot { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--border-muted); background: var(--bg-base); }
.adm-unsaved { font-size: 12px; color: #f5c76a; }
.adm-drawer-nav { position: sticky; top: 0; z-index: 2; display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 0 10px; background: var(--bg-elevated); border-bottom: 1px solid var(--border-subtle); margin-bottom: 12px; }
.adm-drawer-nav button { height: 24px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--border-muted); background: transparent; color: var(--text-secondary); font-size: 11px; cursor: pointer; }
.adm-drawer-nav button:hover { border-color: var(--border-accent); color: var(--text-primary); }

/* sections in editor */
.adm-section { border: 1px solid var(--border-subtle); border-radius: 10px; margin-bottom: 12px; overflow: hidden; }
.adm-section > summary { list-style: none; cursor: pointer; padding: 10px 14px; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 10px; background: var(--bg-base); }
.adm-section > summary::-webkit-details-marker { display: none; }
.adm-section > summary .adm-section-count { margin-left: auto; font-size: 11px; color: var(--text-muted); font-weight: 500; }
.adm-section-body { padding: 8px 14px 12px; }
.adm-perm-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--border-subtle); }
.adm-perm-row:last-child { border-bottom: 0; }
.adm-perm-label { font-size: 13px; font-weight: 600; }
.adm-perm-desc { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.adm-perm-key { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-muted); opacity: 0.8; margin-top: 3px; }
.adm-effective { font-size: 11px; white-space: nowrap; min-width: 118px; text-align: right; }

/* tri-state */
.adm-tri { display: inline-flex; border: 1px solid var(--border-muted); border-radius: 7px; overflow: hidden; }
.adm-tri button { height: 26px; padding: 0 9px; border: 0; background: transparent; color: var(--text-muted); font-size: 11px; font-weight: 600; cursor: pointer; border-right: 1px solid var(--border-muted); }
.adm-tri button:last-child { border-right: 0; }
.adm-tri button.on.inherit { background: var(--bg-hover); color: var(--text-primary); }
.adm-tri button.on.allow, .adm-tri button.on.unlock { background: rgba(16,185,129,0.18); color: #6ee7b7; }
.adm-tri button.on.deny, .adm-tri button.on.enforce { background: rgba(239,68,68,0.16); color: #ff9c9c; }
.adm-tri button:disabled { opacity: 0.45; cursor: not-allowed; }

/* audit / activity */
.adm-log-row td { font-size: 12.5px; }
.adm-mono { font-family: var(--font-mono); font-size: 11.5px; }
.adm-details { font-size: 11px; color: var(--text-muted); max-width: 420px; white-space: pre-wrap; word-break: break-word; }
.adm-sev-info { color: var(--text-secondary); }
.adm-sev-notice { color: var(--cyan); }
.adm-sev-warning { color: #f5c76a; }
.adm-sev-critical { color: #ff9c9c; }
.adm-bar { height: 8px; background: var(--bg-hover); border-radius: 999px; overflow: hidden; min-width: 120px; }
.adm-bar > i { display: block; height: 100%; background: var(--cyan); border-radius: 999px; }

/* modal (temp password / confirm) */
.adm-modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 950; display: grid; place-items: center; padding: 20px; }
.adm-modal { width: min(520px, 100%); background: var(--bg-elevated); border: 1px solid var(--border-muted); border-radius: 12px; padding: 18px 20px; box-shadow: 0 30px 80px rgba(0,0,0,0.5); }
.adm-modal h3 { margin: 0 0 8px; font-size: 15px; }
.adm-secret-once { font-family: var(--font-mono); font-size: 15px; letter-spacing: 0.04em; padding: 12px 14px; border-radius: 8px; background: var(--bg-base); border: 1px solid var(--border-muted); user-select: all; word-break: break-all; margin: 10px 0; }
.adm-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

.adm-two-col { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(320px, 2fr); gap: var(--adm-gap); align-items: start; }
@media (max-width: 900px) { .adm-two-col { grid-template-columns: 1fr; } .adm-perm-row { grid-template-columns: 1fr; } .adm-effective { text-align: left; } }

.adm-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border-muted); border-radius: 10px; overflow: hidden; }
.adm-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border-subtle); font-size: 13px; }
.adm-list li:last-child { border-bottom: 0; }
.adm-list li.is-clickable { cursor: pointer; }
.adm-list li.is-clickable:hover, .adm-list li.active { background: var(--bg-hover); }
.adm-list .grow { flex: 1; min-width: 0; }

.adm-health-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border-muted); border-radius: 10px; background: var(--bg-elevated); }
.adm-health-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: var(--text-muted); }
.adm-health-dot.ok { background: #10b981; }
.adm-health-dot.warn { background: #f59e0b; }
.adm-health-dot.missing, .adm-health-dot.critical { background: #ef4444; }

/* ── EngineOS Core (FINAL PRE-VEYRA CORRECTIVE) ─────────────────────── */
.eos-status .adm-health-item { align-items: flex-start; }
.eos-status-title { font-weight: 600; font-size: 13px; }
.eos-consumers ul { margin: 0; padding-left: 18px; font-size: 12px; line-height: 1.6; }
.eos-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 1100px) { .eos-layout { grid-template-columns: 1fr; } }
.eos-list { padding: 10px; max-height: 70vh; overflow: auto; }
.eos-list #eosFilter { width: 100%; box-sizing: border-box; margin-bottom: 10px; padding: 6px 8px; border-radius: 7px; border: 1px solid var(--border-muted, #262b33); background: var(--bg-base, #0f1115); color: inherit; }
.eos-group-title { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted, #95959c); margin: 10px 4px 4px; }
.eos-source { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; padding: 7px 8px; border-radius: 7px; border: 1px solid transparent; background: transparent; color: inherit; cursor: pointer; font: inherit; }
.eos-source:hover { background: var(--bg-elevated, #15181d); }
.eos-source.active { border-color: var(--accent, #00d4ff); background: rgba(0,212,255,.06); }
.eos-source-name { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; }
.eos-source-meta { font-size: 11px; color: var(--text-muted, #95959c); }
.eos-pane { padding: 14px; min-width: 0; }
.eos-editor-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 10px; }
.eos-editor-title { font-weight: 600; font-size: 14px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.eos-editor { width: 100%; box-sizing: border-box; min-height: 46vh; resize: vertical; padding: 12px; border-radius: 8px; border: 1px solid var(--border-muted, #262b33); background: var(--bg-base, #0f1115); color: inherit; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.5; tab-size: 2; }
.eos-editor:focus-visible { outline: 2px solid var(--accent, #00d4ff); outline-offset: 1px; }
.eos-note { margin-top: 10px; }
.eos-note input { width: 100%; box-sizing: border-box; }
.eos-validation { margin-top: 12px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border-muted, #262b33); }
.eos-validation.ok { border-color: rgba(63,185,80,.5); }
.eos-validation.bad { border-color: rgba(248,81,73,.6); }
.eos-validation-title { font-weight: 600; font-size: 12px; margin-bottom: 6px; }
.eos-issues { margin: 0 0 8px; padding-left: 18px; font-size: 12px; }
.eos-issue-error { color: var(--red, #f85149); }
.eos-issue-warn { color: var(--amber, #d29922); }
.eos-issue-info { color: var(--text-muted, #95959c); }
.eos-diff-summary { font-size: 12px; margin: 6px 0; }
.eos-add { color: var(--green, #3fb950); } .eos-del { color: var(--red, #f85149); }
.eos-diff { margin: 6px 0; padding: 8px 0; border-radius: 6px; background: var(--bg-base, #0f1115); border: 1px solid var(--border-muted, #262b33); overflow-x: auto; font-size: 12px; line-height: 1.45; }
.eos-diff-line { display: block; white-space: pre; padding: 0 8px; }
.eos-diff-add { background: rgba(63,185,80,.12); color: #7ee2a2; }
.eos-diff-del { background: rgba(248,81,73,.12); color: #ff9b94; }
.eos-diff-ctx { color: var(--text-muted, #95959c); }
.eos-ln { display: inline-block; width: 3.2em; text-align: right; margin-right: 8px; color: var(--text-muted, #95959c); opacity: .7; user-select: none; }
.eos-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.eos-history li { padding: 8px 10px; border-radius: 7px; border: 1px solid var(--border-muted, #262b33); font-size: 12px; }
.eos-history li.active { border-color: var(--accent, #00d4ff); }
.eos-version-view { margin-top: 12px; }
.eos-version-content { max-height: 40vh; overflow: auto; padding: 10px; border-radius: 6px; background: var(--bg-base, #0f1115); border: 1px solid var(--border-muted, #262b33); font-size: 12px; white-space: pre-wrap; }
