:root {
  --bg: #0f1216; --panel: #171b21; --panel2: #1e232b; --line: #2a313b; --text: #e3e7ec; --muted: #8b95a3;
  --accent: #d6a24a; --accent2: #f0c46b; --ok: #4fb37a; --bad: #e0605a; --warn: #e3a33a; --link: #79b0ff;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--link); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0 0 14px; }
h2 { font-size: 15px; margin: 22px 0 8px; color: var(--accent2); }
button, input, select, textarea { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; }
button { cursor: pointer; background: #2a3039; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: #1a1408; border-color: var(--accent); font-weight: 600; }
button.danger { background: #4a1f1f; border-color: var(--bad); color: #ffd9d6; }
button:disabled { opacity: .5; cursor: default; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { width: 100%; min-height: 70px; }

.layout { display: flex; min-height: 100vh; }
.side { width: 210px; flex: none; background: var(--panel); border-right: 1px solid var(--line); padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { font-weight: 700; color: var(--accent2); font-size: 16px; padding: 4px 8px 14px; }
.brand small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.nav a { display: block; padding: 7px 10px; border-radius: 6px; color: var(--text); }
.nav a:hover { background: var(--panel2); text-decoration: none; }
.nav a.on { background: var(--panel2); color: var(--accent2); }
.who { margin-top: 18px; padding: 10px 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.who button { margin-top: 8px; width: 100%; }
.main { flex: 1; min-width: 0; padding: 20px 24px 60px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.tile .v { font-size: 22px; font-weight: 700; }
.tile .k { color: var(--muted); font-size: 12px; }
.tile.bad .v { color: var(--bad); } .tile.ok .v { color: var(--ok); } .tile.warn .v { color: var(--warn); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 14px; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 16px; }
.kv div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dashed var(--line); padding: 3px 0; min-width: 0; }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { text-align: right; overflow-wrap: anywhere; }

.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.bar input[type=search], .bar input[type=text] { min-width: 260px; }
.grow { flex: 1; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin: 16px 0 10px; }
.tabs a { padding: 7px 12px; border-radius: 6px 6px 0 0; color: var(--muted); }
.tabs a.on { background: var(--panel); color: var(--accent2); border: 1px solid var(--line); border-bottom-color: var(--panel); margin-bottom: -1px; }

.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 6px 9px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; vertical-align: top; }
td.wrap { white-space: normal; min-width: 260px; max-width: 640px; overflow-wrap: anywhere; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
th { position: sticky; top: 0; background: var(--panel2); color: var(--muted); font-weight: 600; cursor: pointer; user-select: none; }
tr:hover td { background: #1b2028; }
.count { color: var(--muted); font-size: 12px; margin: 6px 2px; }
.empty { color: var(--muted); padding: 14px; }
.err { color: var(--bad); padding: 8px 0; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: var(--panel2); border: 1px solid var(--line); }
.pill.ok { color: var(--ok); border-color: #2c5a40; } .pill.bad { color: var(--bad); border-color: #6a2b28; } .pill.warn { color: var(--warn); border-color: #6a4d1e; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; }
pre.log { background: #0b0d10; border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow: auto; max-height: 70vh; font: 12px/1.4 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.form { display: grid; gap: 10px; max-width: 520px; }
.form label { display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chart { width: 100%; height: 160px; display: block; }
.chart rect { fill: var(--accent); }
.chart text { fill: var(--muted); font-size: 10px; }

.login { max-width: 380px; margin: 9vh auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 26px; }
.login h1 { color: var(--accent2); }
.login .form { max-width: none; }
.login img { display: block; margin: 10px auto; background: #fff; padding: 8px; border-radius: 8px; }
.secret { font: 14px var(--mono); letter-spacing: 1px; background: var(--panel2); padding: 8px; border-radius: 6px; overflow-wrap: anywhere; text-align: center; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 16px; }
.modal .box { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px; width: 100%; max-width: 460px; }
.toast { position: fixed; right: 18px; bottom: 18px; background: var(--panel2); border: 1px solid var(--accent); border-radius: 8px; padding: 10px 14px; z-index: 20; max-width: 420px; }
.toast.bad { border-color: var(--bad); }

@media (max-width: 760px) {
  .layout { display: block; }
  .side { width: auto; height: auto; position: static; }
  .nav { display: flex; flex-wrap: wrap; gap: 2px; }
  .main { padding: 14px 16px 40px; }
  .bar input[type=search], .bar input[type=text] { min-width: 0; width: 100%; }
  .row2 { grid-template-columns: 1fr; }
}
