:root {
  color-scheme: dark;
  --canvas: #07101f;
  --surface: #101c31;
  --surface-2: #172640;
  --border: #2a3e61;
  --text: #edf4ff;
  --muted: #9badc9;
  --accent: #7c5cff;
  --accent-strong: #947dff;
  --danger: #ef6374;
  --success: #52c68b;
  --warning: #edba52;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 20% 0%, #182c51 0, var(--canvas) 45%);
  color: var(--text);
  font: 16px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: #b2a4ff; text-decoration: none; }
a:hover { color: #d3cbff; text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 2.6rem;
  padding: .55rem .95rem;
  color: white;
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: .6rem;
  cursor: pointer;
  font-weight: 650;
}
button:hover, .button:hover { background: var(--accent-strong); color: white; text-decoration: none; }
button.secondary, .button.secondary { background: transparent; border-color: var(--border); color: var(--text); }
button.danger { background: transparent; border-color: var(--danger); color: #ffabb5; }
button.danger:hover { background: #542530; }
input, select, textarea {
  width: 100%;
  padding: .65rem .72rem;
  color: var(--text);
  background: #0a1427;
  border: 1px solid var(--border);
  border-radius: .5rem;
}
textarea { min-height: 7rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #7c5cffaa; outline-offset: 1px; }
label { display: grid; gap: .35rem; color: var(--muted); font-size: .9rem; }
.auth-shell { display: grid; min-height: 100vh; place-items: center; padding: 1.5rem; }
.auth-card { width: min(100%, 29rem); padding: 2rem; background: #0f1b30ee; border: 1px solid var(--border); border-radius: 1rem; box-shadow: 0 2rem 5rem #0008; }
.brand { display: flex; align-items: center; gap: .8rem; font-size: 1.2rem; font-weight: 750; }
.brand-mark { display: grid; place-items: center; width: 2.15rem; height: 2.15rem; color: white; background: linear-gradient(135deg, #9a7bff, #5c43cf); border-radius: .65rem; }
.subtle { color: var(--muted); }
.stack { display: grid; gap: 1rem; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.6rem; padding: 0 1.5rem; border-bottom: 1px solid var(--border); background: #091528e8; }
.topbar nav { display: flex; flex-wrap: wrap; gap: .2rem; }
.topbar nav a { padding: .45rem .6rem; border-radius: .4rem; color: var(--muted); }
.topbar nav a.active, .topbar nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.user-nav { display: flex; align-items: center; gap: .75rem; }
.inline-form { display: inline; }
.layout { width: min(100% - 2rem, 72rem); margin: 2rem auto 4rem; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.page-head h1 { margin: 0; font-size: clamp(1.6rem, 4vw, 2.25rem); }
.grid { display: grid; gap: 1rem; }
.grid.stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { padding: 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: .85rem; }
.stat-number { margin-top: .35rem; font-size: 2rem; font-weight: 750; }
.card h2, .card h3 { margin-top: 0; }
.status { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .9rem; }
.dot { width: .58rem; height: .58rem; border-radius: 99px; background: var(--muted); }
.dot.good { background: var(--success); box-shadow: 0 0 0 .25rem #52c68b22; }
.dot.bad { background: var(--danger); box-shadow: 0 0 0 .25rem #ef637422; }
.dot.unknown { background: var(--warning); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .8rem .7rem; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
td.notes { max-width: 18rem; overflow: hidden; text-overflow: ellipsis; }
.tag { display: inline-block; margin: .1rem .2rem .1rem 0; padding: .14rem .48rem; color: #cac0ff; background: #7c5cff20; border: 1px solid #7c5cff40; border-radius: 2rem; font-size: .78rem; }
.flash { margin-bottom: 1rem; padding: .72rem .85rem; border: 1px solid var(--border); border-radius: .55rem; background: #213353; }
.flash.error { border-color: #8c4050; background: #41202a; }
.flash.success { border-color: #357c5c; background: #143a2d; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.form-grid .wide { grid-column: 1 / -1; }
.actions { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }
code, .monospace { overflow-wrap: anywhere; padding: .15rem .35rem; color: #d7d0ff; background: #07101f; border-radius: .3rem; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.qr { display: block; width: min(100%, 15rem); margin: 1rem 0; padding: .5rem; background: white; border-radius: .5rem; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }
.footer-note { margin-top: 1rem; color: var(--muted); font-size: .85rem; }
.section-space { margin-top: 1rem; }
@media (max-width: 720px) {
  .topbar { align-items: flex-start; flex-direction: column; padding: 1rem; }
  .user-nav { width: 100%; justify-content: space-between; }
  .grid.stats, .grid.two, .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .layout { width: min(100% - 1.2rem, 72rem); margin-top: 1.2rem; }
}
