:root {
  color-scheme: dark;
  --bg: #07110e;
  --panel: #0d1a16;
  --panel-2: #12231d;
  --line: #203a31;
  --text: #eef8f3;
  --muted: #91a99f;
  --green: #4ee3a1;
  --green-dark: #113f2f;
  --red: #ff7d86;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.35);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 85% 0%, #123c2d 0, transparent 30%), var(--bg); color: var(--text); }
button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(430px, 100%); padding: 42px; border: 1px solid var(--line); border-radius: 24px; background: rgba(13, 26, 22, 0.94); box-shadow: var(--shadow); }
.brand-mark { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 16px; background: var(--green); color: #052117; font-size: 25px; font-weight: 900; margin-bottom: 26px; }
.brand-mark.small { width: 34px; height: 34px; border-radius: 10px; margin: 0; font-size: 16px; }
.eyebrow, .nav-label { margin: 0 0 8px; color: var(--green); text-transform: uppercase; letter-spacing: .14em; font-size: 11px; font-weight: 800; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(28px, 4vw, 40px); letter-spacing: -.04em; }
h2 { margin-bottom: 6px; font-size: 19px; }
.muted, .panel-heading p { color: var(--muted); }
.stack { display: grid; gap: 18px; margin-top: 30px; }
label { display: grid; gap: 8px; color: #cde1d8; font-size: 13px; font-weight: 650; }
input { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; outline: none; background: #08140f; color: var(--text); }
input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(78, 227, 161, .12); }
.primary, .secondary, .ghost, .danger { border: 0; border-radius: 10px; padding: 11px 16px; font-weight: 800; }
.primary { background: var(--green); color: #052117; }
.primary:hover { filter: brightness(1.08); }
.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.ghost { padding: 7px 10px; background: transparent; color: var(--muted); }
.danger { padding: 7px 10px; color: var(--red); background: rgba(255, 125, 134, .1); }
button:disabled { opacity: .42; cursor: not-allowed; }
.error { margin: 0; padding: 10px 12px; color: #ffd2d5; background: rgba(180, 36, 50, .2); border: 1px solid rgba(255, 125, 134, .35); border-radius: 9px; font-size: 13px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 18px; background: rgba(8, 20, 15, .95); border-right: 1px solid var(--line); }
.brand-row { display: flex; align-items: center; gap: 12px; padding: 0 8px 30px; }
.nav-label { padding: 0 10px; color: var(--muted); }
#database-list { display: grid; gap: 4px; overflow: auto; }
.db-button { width: 100%; padding: 10px 12px; text-align: left; border: 0; border-radius: 9px; background: transparent; color: #bad0c6; }
.db-button:hover, .db-button.active { background: var(--green-dark); color: var(--green); }
.sidebar-footer { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 18px 8px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.content { padding: 38px clamp(24px, 5vw, 70px) 70px; overflow: hidden; }
.topbar, .panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 30px 0 20px; }
.stat, .panel { border: 1px solid var(--line); background: rgba(13, 26, 22, .82); box-shadow: 0 14px 44px rgba(0,0,0,.14); }
.stat { padding: 22px; border-radius: 16px; }
.stat span { display: block; margin-bottom: 10px; color: var(--muted); font-size: 12px; }
.stat strong { font-size: 24px; }
.stat .healthy { color: var(--green); font-size: 15px; }
.panel { min-height: 350px; border-radius: 18px; overflow: hidden; }
.cluster-panel { min-height: 0; margin-bottom: 20px; }
.panel-heading { padding: 22px 24px; border-bottom: 1px solid var(--line); }
.panel-heading p { margin: 0; font-size: 13px; }
.empty-state { display: grid; min-height: 250px; place-items: center; color: var(--muted); }
.empty-state.compact { min-height: 120px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 16px 20px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.actions { text-align: right; white-space: nowrap; }
.role-pill { display: inline-block; margin: 2px 4px 2px 0; padding: 5px 8px; border-radius: 999px; background: var(--green-dark); color: #9af0ca; font-size: 11px; }
.scale-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.notice { margin: 18px 24px; padding: 12px 14px; border: 1px solid #665624; border-radius: 10px; color: #f1d675; background: rgba(105, 83, 20, .18); }
.operation { margin: 18px 24px 24px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #08140f; }
.operation-title { display: flex; justify-content: space-between; gap: 12px; }
.operation ol { max-height: 220px; overflow: auto; margin-bottom: 0; padding-left: 24px; color: var(--muted); font-size: 12px; }
.operation li { padding: 4px; }
.state-healthy { color: var(--green); }
.state-unhealthy, .operation-error { color: var(--red); }
.health-summary, .inventory-summary { padding: 14px 24px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 750; }
.inventory-summary { color: var(--muted); }
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: rgba(78, 227, 161, .05); }
.index-details { margin: 18px 24px 24px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #08140f; }
.index-row { padding-top: 9px; color: var(--muted); font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.audit-panel { margin-top: 20px; }
dialog { width: min(560px, calc(100% - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(1, 8, 5, .75); backdrop-filter: blur(4px); }
.dialog-form { padding: 26px; display: grid; gap: 18px; }
.dialog-form header, .dialog-form footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-form footer { justify-content: flex-end; padding-top: 8px; }
.icon-button { border: 0; background: transparent; color: var(--muted); font-size: 28px; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
legend { padding: 0 6px; color: var(--muted); font-size: 12px; }
.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.role-grid label { display: flex; align-items: center; gap: 8px; }
.role-grid input { width: auto; accent-color: var(--green); }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 360px; padding: 13px 16px; border-radius: 10px; background: var(--green); color: #052117; font-weight: 800; box-shadow: var(--shadow); }
@media (max-width: 800px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  #database-list { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 160px; }
  .sidebar-footer { margin-top: 18px; }
  .stats-grid { grid-template-columns: 1fr; }
  .topbar, .panel-heading { align-items: flex-start; }
}
