:root {
  --bg: #111417;
  --panel: #191d21;
  --panel-2: #20262b;
  --line: #3a4148;
  --text: #edf1f5;
  --muted: #9aa6b2;
  --accent: #3fb950;
  --accent-2: #58a6ff;
  --danger: #ff6b6b;
  --warn: #f2cc60;
  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: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, .button, input, textarea { border-radius: 2px; font: inherit; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 36px;
  border: 1px solid var(--line); background: #252b31; color: var(--text); padding: 0 12px; cursor: pointer;
}
button:hover, .button:hover { border-color: var(--accent-2); }
.primary { background: #1f6f43; border-color: #2ea043; color: #fff; }
.danger { border-color: #8e2f2f; color: #ffd5d5; }
.ghost { background: transparent; }
.full { width: 100%; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 240px; padding: 24px 18px; background: #0d1013;
  border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 28px;
}
.brand { font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.sidebar nav { display: grid; gap: 4px; }
.sidebar nav a { padding: 10px 8px; border-left: 3px solid transparent; color: var(--muted); }
.sidebar nav a:hover { color: var(--text); border-left-color: var(--accent-2); background: #151a1f; }
.shell { margin-left: 240px; padding: 28px; display: grid; gap: 22px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: 28px; margin-bottom: 4px; }
h2 { font-size: 18px; margin-bottom: 14px; }
.topbar p, small, .muted { color: var(--muted); }
.status { border: 1px solid var(--line); padding: 8px 12px; text-transform: uppercase; font-size: 12px; letter-spacing: .04em; }
.status.ok { border-color: var(--accent); color: #9be9a8; }
.status.down { border-color: var(--warn); color: #ffdf80; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metrics div, .panel, .toolbar { background: var(--panel); border: 1px solid var(--line); }
.metrics div { padding: 16px; display: grid; gap: 8px; }
.metrics span { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.metrics strong { font-size: 20px; overflow-wrap: anywhere; }
.toolbar { display: flex; gap: 8px; padding: 12px; flex-wrap: wrap; }
.panel { padding: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #11161b; color: var(--muted); font-size: 12px; text-transform: uppercase; }
td small { display: block; margin-top: 4px; }
.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.actions form { margin: 0; }
.empty { color: var(--muted); text-align: center; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
dl { display: grid; grid-template-columns: 120px 1fr; gap: 10px; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
.key, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
pre { background: #0d1013; border: 1px solid var(--line); padding: 12px; overflow: auto; min-height: 160px; }

.auth { display: grid; place-items: center; padding: 24px; }
.auth-panel, .setup-panel { width: min(480px, 100%); background: var(--panel); border: 1px solid var(--line); padding: 28px; }
.setup-panel { width: min(760px, 100%); }
.stack, .grid-form { display: grid; gap: 14px; }
.grid-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span { grid-column: 1 / -1; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
input, textarea {
  width: 100%; border: 1px solid var(--line); background: #0d1013; color: var(--text);
  padding: 10px 11px; outline: none;
}
input:focus, textarea:focus { border-color: var(--accent-2); }
.banner { border: 1px solid var(--line); padding: 10px 12px; margin-bottom: 14px; }
.banner.error { border-color: #8e2f2f; color: #ffd5d5; background: #2a1518; }

.modal {
  width: min(560px, calc(100vw - 32px)); background: var(--panel); color: var(--text);
  border: 1px solid var(--line); padding: 18px; border-radius: 2px;
}
.modal::backdrop { background: rgba(0, 0, 0, .72); }
.modal.small { width: min(380px, calc(100vw - 32px)); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.modal-head h2 { margin: 0; }
.modal-head button { width: 34px; padding: 0; font-size: 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
#qr-image { display: block; width: min(280px, 100%); margin: 12px auto 0; background: white; padding: 10px; }

@media (max-width: 840px) {
  .sidebar { position: static; width: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .shell { margin-left: 0; padding: 18px; }
  .topbar, .panel-head { align-items: stretch; flex-direction: column; }
  .metrics, .split, .grid-form { grid-template-columns: 1fr; }
}

