:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", Tahoma, Arial, sans-serif;
  --bg: #090811;
  --panel: #151223;
  --panel-2: #1d1730;
  --line: #33294b;
  --text: #f7f4ff;
  --muted: #b9afd0;
  --purple: #9147ff;
  --green: #31d18b;
  --red: #ff6577;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at 80% 0, #261541 0, var(--bg) 42%); color: var(--text); min-height: 100vh; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 28px clamp(20px, 5vw, 72px); border-bottom: 1px solid var(--line); background: rgba(9,8,17,.82); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(24px, 4vw, 38px); }
h2 { margin-bottom: 14px; }
.topbar p { margin-bottom: 0; color: var(--muted); }
main { width: min(1400px, calc(100% - 32px)); margin: 24px auto 60px; }
.card { background: rgba(21,18,35,.94); border: 1px solid var(--line); border-radius: 18px; padding: 22px; margin-bottom: 18px; box-shadow: 0 16px 50px rgba(0,0,0,.2); }
.hidden { display: none !important; }
.eyebrow { display: block; color: #bc8cff; font-size: 12px; letter-spacing: .14em; font-weight: 800; margin-bottom: 8px; }
.muted { color: var(--muted); }
.notice, .warning, .preview, .selected { border-radius: 12px; padding: 14px 16px; margin-bottom: 18px; border: 1px solid var(--line); background: var(--panel-2); }
.notice.ok { border-color: #1b8657; color: #8bffc9; }
.notice.error, .warning { border-color: #9b3145; color: #ffafba; }
.section-head, .actions, .inline-form { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.section-head h2 { margin-bottom: 0; }
.pill { background: #2b2044; color: #d8bdff; border: 1px solid #604292; border-radius: 999px; padding: 6px 12px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 14px; }
.grow { flex: 1; }
input, select, textarea { width: 100%; background: #0c0a14; color: var(--text); border: 1px solid #423557; border-radius: 10px; padding: 11px 12px; font: inherit; }
textarea { min-height: 130px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #6f35bd; border-color: #a76dff; }
.button { border: 1px solid #a865ff; border-radius: 10px; padding: 11px 18px; background: var(--purple); color: white; cursor: pointer; font-weight: 800; white-space: nowrap; }
.button.secondary { background: transparent; border-color: #56466e; }
.button.danger { background: #7a2232; border-color: #c94a62; }
.button.small { padding: 8px 12px; font-size: 13px; }
.button:disabled { opacity: .42; cursor: not-allowed; }
.workspace-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-top: 16px; }
.workspace-option { text-align: right; background: #0e0c18; color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 14px; cursor: pointer; }
.workspace-option:hover, .workspace-option.active { border-color: #9a5cf2; background: #211537; }
.workspace-option strong, .workspace-option span { display: block; }
.workspace-option span { color: var(--muted); margin-top: 5px; font-size: 13px; }
.selected { border-color: #7651a9; margin: 16px 0 0; }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.checkbox { display: flex; align-items: center; gap: 9px; }
.checkbox input { width: auto; }
.table-wrap { overflow-x: auto; margin-top: 14px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 11px 10px; text-align: right; border-bottom: 1px solid #2b243d; }
th { color: #cabee0; font-size: 13px; }
.preview { margin-top: 16px; line-height: 1.8; }
.preview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.preview-grid div { background: #0e0c18; padding: 10px; border-radius: 9px; }
.history-list { display: grid; gap: 10px; }
.history-item { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #0e0c18; }
.history-item p { margin: 4px 0 0; color: var(--muted); }
.status-good { color: var(--green); }
.status-bad { color: var(--red); }
.auth-card { width: min(680px, 100%); margin-inline: auto; }
.link-button { display: inline-block; text-decoration: none; }
.admin-nav { position: sticky; top: 0; z-index: 5; display: flex; gap: 8px; overflow-x: auto; padding: 10px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(9,8,17,.94); backdrop-filter: blur(14px); }
.admin-nav button { border: 1px solid transparent; border-radius: 10px; padding: 10px 13px; color: var(--muted); background: transparent; cursor: pointer; white-space: nowrap; font-weight: 700; }
.admin-nav button:hover, .admin-nav button.active { color: var(--text); background: #2a1b44; border-color: #7045a8; }
.nav-count { display: inline-grid; min-width: 22px; height: 22px; place-items: center; margin-inline-start: 4px; border-radius: 999px; background: #9147ff; color: white; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: 12px; }
.stats-grid article { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #0e0c18; }
.stats-grid strong, .stats-grid span { display: block; }
.stats-grid strong { font-size: 30px; color: #d8bdff; margin-bottom: 6px; }
.policy-summary { padding: 16px; border-radius: 12px; border: 1px solid #4f3a70; background: #0e0c18; color: #d9cbea; line-height: 1.8; }
.filter-grid { display: grid; grid-template-columns: minmax(220px,2fr) repeat(3,minmax(145px,1fr)) auto; align-items: end; gap: 10px; margin-bottom: 18px; }
.stack-list { display: grid; gap: 12px; }
.management-card { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #0e0c18; }
.management-card small { display: block; margin-top: 5px; }
.meta-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 13px 0; }
.meta-grid span { padding: 7px 10px; border-radius: 999px; background: #1c1728; color: var(--muted); font-size: 13px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.status { display: inline-flex; align-items: center; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.status.good { color: #8bffc9; border-color: #1b8657; }
.status.bad { color: #ffafba; border-color: #9b3145; }
.status.warn { color: #ffd48a; border-color: #9b6b31; }
.feature-panel { display: grid; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.feature-row { display: grid; grid-template-columns: minmax(140px,1fr) auto auto auto auto; align-items: center; gap: 8px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 18px; }
.health-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(240px,1fr)); gap: 12px; }
.health-grid article { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #0e0c18; overflow: auto; }
.health-grid pre, .json-view { margin: 10px 0 0; direction: ltr; text-align: left; white-space: pre-wrap; word-break: break-word; color: #c7b8dc; }
.audit-list { display: grid; gap: 8px; }
.audit-row { padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #0e0c18; color: var(--muted); }
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.72); }
.modal-card { width: min(960px,100%); max-height: 88vh; overflow: auto; padding: 22px; border: 1px solid #684794; border-radius: 18px; background: var(--panel); box-shadow: 0 24px 90px rgba(0,0,0,.5); }
@media (max-width: 850px) {
  .topbar, .section-head, .inline-form, .actions, .history-item { align-items: stretch; flex-direction: column; }
  .two-columns, .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .filter-grid, .feature-row { grid-template-columns: 1fr; }
}
