:root {
  color-scheme: dark;
  --bg: #08070d;
  --panel: #111018;
  --panel-2: #1b1825;
  --border: rgba(255,255,255,0.08);
  --text: #f8fafc;
  --muted: #a1a1aa;
  --brand: #8b5cf6;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #fb7185;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: radial-gradient(circle at top right, rgba(139,92,246,0.2), transparent 36%), var(--bg); color: var(--text); font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
input, select { width: 100%; border: 1px solid var(--border); border-radius: 14px; background: var(--panel-2); color: var(--text); padding: 11px 13px; outline: none; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand); }
input:focus, select:focus { border-color: rgba(139,92,246,0.55); box-shadow: 0 0 0 3px rgba(139,92,246,0.15); }
.shell { min-height: 100vh; display: grid; grid-template-columns: 240px 1fr; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 240px; padding: 20px 14px; border-right: 1px solid var(--border); background: rgba(17,16,24,0.94); backdrop-filter: blur(18px); display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.brand { padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.brand h1 { margin: 0; font-size: 17px; letter-spacing: -0.02em; }
.brand p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.nav { display: grid; gap: 4px; }
.nav a { color: #d1d5db; text-decoration: none; border: 1px solid transparent; border-radius: 10px; padding: 9px 12px; font-weight: 600; font-size: 13px; transition: all 0.12s; }
.nav a:hover { background: rgba(255,255,255,0.05); border-color: var(--border); }
.nav a.active { color: var(--text); background: rgba(139,92,246,0.16); border-color: rgba(139,92,246,0.28); font-weight: 750; }
.nav-group-label { color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: 0.1em; text-transform: uppercase; padding: 12px 12px 4px; }
.side-footer { margin-top: auto; display: grid; gap: 10px; }
.main { min-width: 0; grid-column: 2; }
.topbar { position: sticky; top: 0; z-index: 4; padding: 16px 24px; border-bottom: 1px solid var(--border); background: rgba(8,7,13,0.82); backdrop-filter: blur(16px); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.topbar h2 { margin: 0; font-size: 20px; letter-spacing: -0.02em; }
.topbar p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.content { padding: 24px; display: grid; gap: 18px; }
.page-view { display: none; }
.page-view.active { display: grid; gap: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.card { border: 1px solid var(--border); border-radius: 16px; background: rgba(17,16,24,0.84); padding: 18px; box-shadow: 0 8px 40px rgba(0,0,0,0.15); }
.card h3 { margin: 0; font-size: 15px; }
.desc { margin-top: 7px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.stack { display: grid; gap: 13px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.field { display: grid; gap: 7px; }
.label { color: #ddd6fe; font-size: 12px; font-weight: 800; }
.btn { border: 1px solid var(--border); border-radius: 10px; background: rgba(255,255,255,0.05); color: var(--text); padding: 9px 14px; font-weight: 700; font-size: 13px; transition: all 0.12s; }
.btn:hover { background: rgba(255,255,255,0.09); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: rgba(139,92,246,0.5); }
.btn.danger { color: #fecaca; background: rgba(251,113,133,0.09); border-color: rgba(251,113,133,0.25); }
.badge { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 999px; padding: 7px 11px; font-size: 12px; font-weight: 850; }
.badge.ok { color: var(--ok); background: rgba(52,211,153,0.1); border-color: rgba(52,211,153,0.22); }
.badge.warn { color: var(--warn); background: rgba(251,191,36,0.1); border-color: rgba(251,191,36,0.22); }
.badge.err { color: var(--err); background: rgba(251,113,133,0.1); border-color: rgba(251,113,133,0.22); }
.badge.muted { color: #cbd5e1; background: rgba(255,255,255,0.04); }
.metric { font-size: 28px; font-weight: 900; margin-top: 10px; }
.metric-card { border: 1px solid var(--border); border-radius: 14px; background: rgba(255,255,255,0.035); padding: 14px; }
.mono { font-family: Consolas, "SFMono-Regular", Menlo, monospace; }
.notice { border: 1px solid var(--border); border-radius: 16px; padding: 13px 15px; color: var(--muted); background: rgba(255,255,255,0.035); font-size: 12px; line-height: 1.6; }
.notice.error { color: #fecaca; border-color: rgba(251,113,133,0.25); background: rgba(251,113,133,0.08); }
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 18px; }
table { width: 100%; min-width: 860px; border-collapse: collapse; }
th, td { padding: 12px; border-bottom: 1px solid rgba(255,255,255,0.06); text-align: left; vertical-align: top; font-size: 13px; }
th { color: #ddd6fe; background: rgba(255,255,255,0.03); text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; }
td { max-width: 420px; white-space: normal; word-break: break-word; line-height: 1.55; }
tr:last-child td { border-bottom: 0; }
.activation-page { gap: 18px; }
.activation-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.activation-control-grid, .activation-workspace { align-items: start; }
.activation-action-cell { align-self: end; }
.activation-action-cell .row { justify-content: flex-end; }
.activation-list { display: grid; gap: 14px; }
.activation-entry { border: 1px solid var(--border); border-radius: 20px; background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02)); padding: 16px; display: grid; gap: 14px; }
.activation-batch-card { background: linear-gradient(180deg, rgba(139,92,246,0.09), rgba(255,255,255,0.02)); }
.activation-code-card { background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02)); }
.activation-entry-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.activation-entry-title { font-size: 14px; font-weight: 900; letter-spacing: 0.02em; word-break: break-all; }
.activation-entry-subtitle { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.activation-badge-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.activation-scope-line { margin-top: 0; }
.activation-meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.activation-meta-item { border: 1px solid rgba(255,255,255,0.06); border-radius: 16px; background: rgba(9,8,14,0.42); padding: 12px; min-height: 76px; }
.activation-meta-item.wide { grid-column: span 2; }
.activation-meta-item span { display: block; margin-bottom: 6px; color: #c4b5fd; font-size: 11px; font-weight: 850; letter-spacing: 0.06em; text-transform: uppercase; }
.activation-meta-item strong { display: block; font-size: 13px; line-height: 1.6; color: var(--text); word-break: break-word; }
.activation-actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 2px; }
.activation-code-table { min-width: 1100px; }
.activation-code-table th, .activation-code-table td { padding: 10px 8px; font-size: 12px; white-space: nowrap; }
.activation-code-table td:first-child { white-space: normal; min-width: 160px; max-width: 220px; }
.activation-table-actions { display: flex; gap: 6px; flex-wrap: nowrap; }
.activation-table-actions .btn { padding: 4px 10px; font-size: 11px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.admin-inline-form { border: 1px solid rgba(255,255,255,0.06); border-radius: 18px; background: rgba(255,255,255,0.025); padding: 14px; }
.admin-inline-form input[disabled] { opacity: 0.8; cursor: not-allowed; }
.record-list { display: grid; gap: 12px; }
.record-card { border: 1px solid var(--border); border-radius: 18px; background: rgba(255,255,255,0.03); padding: 14px; }
.plain-record { margin: 0; display: grid; gap: 8px; }
.plain-record div { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 10px; border-top: 1px solid rgba(255,255,255,0.05); padding-top: 8px; }
.plain-record dt { color: #ddd6fe; font-size: 12px; font-weight: 850; }
.plain-record dd { margin: 0; color: var(--text); font-size: 13px; line-height: 1.55; word-break: break-word; }
.edit-dialog { width: min(820px, calc(100vw - 36px)); border: 1px solid var(--border); border-radius: 22px; padding: 20px; background: var(--panel); color: var(--text); box-shadow: 0 30px 100px rgba(0,0,0,0.48); }
.edit-dialog::backdrop { background: rgba(0,0,0,0.62); backdrop-filter: blur(4px); }
.toast-stack { position: fixed; top: 18px; right: 18px; z-index: 20; display: grid; gap: 10px; }
.toast { border: 1px solid var(--border); border-radius: 16px; padding: 12px 14px; background: rgba(17,16,24,0.96); min-width: 260px; box-shadow: 0 20px 50px rgba(0,0,0,0.32); }
.toast.success { color: #bbf7d0; border-color: rgba(52,211,153,0.24); }
.toast.error { color: #fecaca; border-color: rgba(251,113,133,0.24); }
.detail-tabs { display: flex; gap: 0; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: var(--panel-2); }
.detail-tabs button { flex: 1; border: none; border-radius: 0; background: transparent; color: var(--muted); padding: 11px 14px; font-size: 13px; font-weight: 750; cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.detail-tabs button:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.detail-tabs button.active { background: rgba(139,92,246,0.18); color: var(--text); box-shadow: inset 0 -2px 0 var(--brand); }
.detail-tab-content { display: none; }
.detail-tab-content.active { display: grid; gap: 16px; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.info-item { border: 1px solid rgba(255,255,255,0.06); border-radius: 14px; padding: 12px 14px; background: rgba(255,255,255,0.025); }
.info-item .info-label { color: #c4b5fd; font-size: 11px; font-weight: 850; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 5px; }
.info-item .info-value { font-size: 14px; color: var(--text); word-break: break-word; line-height: 1.5; }
.info-item .info-value.mono { font-family: Consolas, "SFMono-Regular", Menlo, monospace; font-size: 12px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.status-dot.active { background: var(--ok); }
.status-dot.disabled { background: var(--err); }
.status-dot.revoked { background: var(--muted); }
.section-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 8px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.section-header h4 { margin: 0; font-size: 15px; font-weight: 800; }
.log-list { display: grid; gap: 2px; max-height: 600px; overflow-y: auto; border: 1px solid var(--border); border-radius: 14px; padding: 8px; background: rgba(0,0,0,0.2); }
.log-entry { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; font-size: 12px; line-height: 1.4; flex-wrap: wrap; }
.log-entry:hover { background: rgba(255,255,255,0.04); }
.log-ts { color: var(--muted); font-size: 11px; min-width: 170px; flex-shrink: 0; }
.log-action { color: var(--text); font-weight: 600; }
.log-meta { color: var(--muted); font-size: 11px; background: rgba(255,255,255,0.04); border-radius: 4px; padding: 1px 6px; }
@media (max-width: 960px) { .shell, .grid-2, .grid-3, .metric-grid, .detail-grid, .activation-summary-grid, .activation-meta-grid { grid-template-columns: 1fr; } .sidebar { position: static; width: auto; border-right: 0; border-bottom: 1px solid var(--border); } .main { grid-column: auto; } .plain-record div { grid-template-columns: 1fr; } .activation-meta-item.wide { grid-column: auto; } .activation-entry-head { flex-direction: column; } .activation-badge-row, .activation-action-cell .row { justify-content: flex-start; } }
