:root {
  --bg: #0b1020; --panel: #121933; --panel2: #18213f; --line: #253056;
  --text: #e6e9f5; --muted: #8b93b3; --accent: #d4a017; --accent2: #b88a0e;
  --crit: #ff4d6d; --high: #ff8a3d; --med: #f5c542; --low: #4fc3a1; --info: #7f8bb3;
  --ok: #3ccf91;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
.hidden { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #0b1020; font-weight: 600; }
button.primary:hover { background: var(--accent2); }
button.danger { background: transparent; border-color: var(--crit); color: var(--crit); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
input, select { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; }
input:focus, select:focus { outline: none; border-color: var(--accent); }
code, pre { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; }
pre { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 10px; white-space: pre-wrap; word-break: break-all; }
.muted { color: var(--muted); }
.err { color: var(--crit); min-height: 1.2em; }

.brand { font-weight: 700; letter-spacing: .3px; display: flex; align-items: center; gap: 8px; }
.brand.big { font-size: 22px; margin-bottom: 8px; }
.logo { width: 28px; height: 28px; }
.brand.big .logo { width: 44px; height: 44px; }
.brand { color: var(--accent); letter-spacing: 2px; text-transform: uppercase; }

.login { min-height: 100vh; display: grid; place-items: center; }
.login-card { width: 340px; display: flex; flex-direction: column; gap: 12px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; }

header { display: flex; align-items: center; gap: 24px; padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
nav { display: flex; gap: 4px; flex: 1; }
nav button { background: transparent; border-color: transparent; color: var(--muted); }
nav button.active { color: var(--text); background: var(--panel2); border-color: var(--line); }
.who { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; padding: 16px 24px 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.stat .n { font-size: 26px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.stat.alert .n { color: var(--crit); }

main { padding: 16px 24px 40px; }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 200px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 20px; margin-bottom: 16px; }
.card h3 { margin: 0 0 6px; }
.card h4 { margin: 14px 0 6px; color: var(--muted); font-weight: 600; font-size: 13px; }
.tokenrow { display: flex; gap: 8px; align-items: center; }
.tokenrow code { background: var(--bg); border: 1px solid var(--line); padding: 7px 10px; border-radius: 6px; flex: 1; overflow-x: auto; }

table.grid { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.grid th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; padding: 10px 12px; background: var(--panel2); border-bottom: 1px solid var(--line); }
.grid td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid tr:last-child td { border-bottom: none; }
.grid tbody tr.click { cursor: pointer; }
.grid tbody tr.click:hover { background: var(--panel2); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; word-break: break-all; }
.trunc { max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 28px !important; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.sev-critical { background: rgba(255,77,109,.15); color: var(--crit); }
.sev-high { background: rgba(255,138,61,.15); color: var(--high); }
.sev-medium { background: rgba(245,197,66,.15); color: var(--med); }
.sev-low { background: rgba(79,195,161,.15); color: var(--low); }
.sev-informational { background: rgba(127,139,179,.15); color: var(--info); }
.st-online { color: var(--ok); }
.st-offline { color: var(--muted); }
.st-isolated { color: var(--crit); font-weight: 700; }
.tag { display: inline-block; background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; margin: 1px 3px 1px 0; font-size: 11.5px; color: var(--muted); }

.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); background: var(--panel); border-left: 1px solid var(--line); box-shadow: -10px 0 30px rgba(0,0,0,.4); z-index: 10; display: flex; flex-direction: column; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { margin: 0; font-size: 16px; }
#dBody { padding: 16px 20px; overflow-y: auto; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 12px; margin: 10px 0 16px; }
.kv .k { color: var(--muted); font-size: 12.5px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 16px; }
.section-title { color: var(--muted); text-transform: uppercase; font-size: 11.5px; letter-spacing: .6px; margin-top: 18px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line); padding: 10px 18px; border-radius: 8px; z-index: 20; }
