:root {
  --bg: #0a0c0f;
  --surface: #11141a;
  --surface-2: #171b22;
  --border: #222833;
  --text: #e7e9ee;
  --muted: #8a93a3;
  --accent: #8aa4ff;
  --accent-ink: #0a0c0f;
  --up: #3fb950;
  --warn: #d29922;
  --down: #f85149;
  --absent: #5b6472;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --radius: 10px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #f0f2f5;
    --border: #dde1e7;
    --text: #14171c;
    --muted: #5d6675;
    --accent: #3a5bdc;
    --accent-ink: #ffffff;
    --absent: #a3abb8;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.eyebrow {
  font: 12px var(--mono);
  color: var(--muted);
  text-transform: lowercase;
  margin: 0 0 6px;
}
.eyebrow::before { content: "› "; color: var(--accent); }

.button, button {
  font: 500 13px var(--sans);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.button:hover, button:hover { border-color: var(--muted); }
.button.primary, button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.danger { color: var(--down); }
button:disabled { opacity: 0.5; cursor: default; }
input, select {
  font: 13px var(--sans);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
}
input:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ---------- login / message pages ---------- */
.centered { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
}
.narrow { width: min(420px, 100%); }
.narrow h1 { font-size: 22px; margin-bottom: 8px; }
.narrow .button { margin-top: 16px; }
.notice { margin-top: 16px; font-size: 13px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); }
.notice.error { color: var(--down); }
.prompt-line { font: 13px var(--mono); color: var(--muted); margin-top: 20px; }
.prompt-line .cursor { display: inline-block; width: 7px; height: 14px; background: var(--accent); vertical-align: -2px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- hub layout ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.wordmark { font: 600 15px var(--mono); white-space: nowrap; }
.wordmark span { color: var(--accent); }
.jump {
  flex: 1;
  max-width: 460px;
  margin: 0 auto;
  justify-content: space-between;
  color: var(--muted);
  background: var(--surface);
}
.kbd { font: 11px var(--mono); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; color: var(--muted); }
.user { display: flex; align-items: center; gap: 10px; font-size: 13px; white-space: nowrap; }
.role { font: 11px var(--mono); padding: 2px 6px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); }

main.hub { max-width: 1240px; margin: 0 auto; padding: 24px; display: grid; gap: 32px; }
section > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
section > header h2 { font-size: 15px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.kpi { background: var(--surface); padding: 14px 16px; min-height: 84px; }
.kpi .label { font-size: 12px; color: var(--muted); }
.kpi .value { font: 600 22px var(--mono); margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--muted); }
.meter { height: 4px; border-radius: 2px; background: var(--surface-2); margin-top: 8px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); }
.meter.hot > i { background: var(--warn); }
.meter.critical > i { background: var(--down); }

/* Products */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.product { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.product .head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.product h3 { font-size: 16px; }
.product .rev { font: 12px var(--mono); color: var(--muted); text-align: right; }
.product ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.product li a {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px; margin: 0 -8px;
  border-radius: 6px; text-decoration: none;
}
.product li a:hover { background: var(--surface-2); }
.product li .kind { margin-left: auto; font: 11px var(--mono); color: var(--muted); }

/* Tiles */
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px; }
.group h3 { font: 12px var(--mono); color: var(--muted); margin-bottom: 8px; text-transform: lowercase; }
.tiles { display: grid; gap: 8px; }
.tile {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none;
}
.tile:hover { border-color: var(--muted); }
.tile .name { font-weight: 500; }
.tile .desc { font-size: 12px; color: var(--muted); }
.tile .arrow { margin-left: auto; color: var(--muted); font-family: var(--mono); }

.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--border); }
.dot.up { background: var(--up); box-shadow: 0 0 0 3px color-mix(in srgb, var(--up) 20%, transparent); }
.dot.down { background: var(--down); }
.dot.absent { background: transparent; border: 1px dashed var(--absent); }

/* Access */
.access { display: grid; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card h3 { font-size: 14px; margin-bottom: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font: 11px var(--mono); color: var(--muted); font-weight: 400; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.apps { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.apps label { display: inline-flex; gap: 6px; align-items: center; font: 12px var(--mono); white-space: nowrap; }
.empty { color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; }

/* Command palette */
dialog.palette {
  width: min(560px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); margin-top: 12vh;
}
dialog.palette::backdrop { background: rgb(0 0 0 / 0.5); }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 14px 16px; font-size: 15px; background: transparent; }
.palette input:focus { outline: none; }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.palette li { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 6px; cursor: pointer; }
.palette li[aria-selected="true"] { background: var(--surface-2); }
.palette li .where { margin-left: auto; font: 11px var(--mono); color: var(--muted); }

.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--border); padding: 8px 14px; border-radius: 8px; font-size: 13px; }

@media (max-width: 720px) {
  .topbar { padding: 10px 16px; flex-wrap: wrap; }
  .jump { order: 3; max-width: none; flex-basis: 100%; }
  .user .who { display: none; }
  main.hub { padding: 16px; gap: 24px; }
}
