@font-face {
  font-family: "Michroma";
  src: url("/static/fonts/Michroma-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --bg: #0d0f12;
  --panel: #14171c;
  --panel-2: #1a1e25;
  --line: #262b34;
  --text: #e6e8eb;
  --muted: #8a919c;
  --accent: #8b5cf6;
  --ok: #34d399;
  --ok-bg: rgba(52, 211, 153, 0.12);
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.12);
  --crit: #f87171;
  --crit-bg: rgba(248, 113, 113, 0.14);
  --display: "Michroma", ui-sans-serif, system-ui, sans-serif;
  --ui: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f6f8; --panel: #ffffff; --panel-2: #f0f2f5; --line: #dde1e7;
    --text: #15181d; --muted: #5e6672; --accent: #6d28d9;
    --ok: #047857; --ok-bg: #d1fae5; --warn: #b45309; --warn-bg: #fef3c7; --crit: #b91c1c; --crit-bg: #fee2e2;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--ui); line-height: 1.45; }
a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
.muted { color: var(--muted); }

h1, h2, .brand, .tile .k, th, .pill { font-family: var(--display); letter-spacing: 0.06em; }
h1 { font-size: 1.45rem; font-weight: 400; margin: 0 0 1.2rem; display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
h2 { font-size: 0.85rem; font-weight: 400; text-transform: uppercase; color: var(--muted); margin: 2.2rem 0 0.8rem; }

.top { display: flex; align-items: center; gap: 2rem; padding: 0.9rem 1.5rem; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 2; flex-wrap: wrap; }
.brand { text-decoration: none; font-size: 1rem; text-transform: uppercase; display: flex; align-items: baseline; gap: 0.7rem; }
.brand span { color: var(--accent); font-size: 0.7rem; }
nav { display: flex; gap: 1.2rem; }
nav a { text-decoration: none; color: var(--muted); font-size: 0.9rem; padding: 0.2rem 0; border-bottom: 2px solid transparent; }
nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.clock { margin-left: auto; color: var(--muted); font-family: var(--mono); font-size: 0.8rem; }

main { padding: 1.6rem 1.5rem 3rem; max-width: 1500px; margin: 0 auto; }
footer { color: var(--muted); font-size: 0.8rem; text-align: center; padding: 1.5rem; border-top: 1px solid var(--line); }
.crumbs { color: var(--muted); margin: 0 0 0.4rem; font-size: 0.85rem; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.8rem; margin-bottom: 1.4rem; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 0.9rem 1rem; display: flex; flex-direction: column; gap: 0.3rem; }
.tile .k { font-size: 0.62rem; text-transform: uppercase; color: var(--muted); }
.tile .v { font-size: 1.9rem; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tile.ok .v { color: var(--ok); } .tile.warn .v { color: var(--warn); } .tile.crit .v { color: var(--crit); }

.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
table { border-collapse: collapse; width: 100%; }
th { font-size: 0.58rem; font-weight: 400; text-transform: uppercase; color: var(--muted); text-align: left; padding: 0.7rem 0.75rem; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--panel-2); }
td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--panel-2); }
td.num { text-align: right; }
.fleet td:nth-child(2) { white-space: normal; min-width: 14rem; }
.sub { display: block; color: var(--muted); font-size: 0.78rem; margin-top: 0.1rem; }
.issue { display: inline-block; font-size: 0.72rem; margin: 0.35rem 0.3rem 0 0; padding: 0.05rem 0.45rem; border-radius: 4px; }
.issue.warn { color: var(--warn); background: var(--warn-bg); } .issue.crit { color: var(--crit); background: var(--crit-bg); }
.row-crit td:first-child { box-shadow: inset 3px 0 var(--crit); }
.row-warn td:first-child { box-shadow: inset 3px 0 var(--warn); }
td.warn, dd.warn { color: var(--warn); } td.crit, dd.crit { color: var(--crit); }
table.plain { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); overflow: hidden; }

.pill { font-size: 0.55rem; text-transform: uppercase; padding: 0.25rem 0.55rem; border-radius: 999px; white-space: nowrap; vertical-align: middle; }
.pill.ok { color: var(--ok); background: var(--ok-bg); }
.pill.info { color: var(--accent); background: rgba(139, 92, 246, 0.14); margin-left: 0.35rem; } .pill.warn { color: var(--warn); background: var(--warn-bg); } .pill.crit { color: var(--crit); background: var(--crit-bg); }

.disk { display: inline-flex; align-items: center; gap: 0.5rem; }
.disk .bar { width: 70px; height: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.disk .fill { display: block; height: 100%; background: var(--ok); }
.disk .fill.warn { background: var(--warn); } .disk .fill.crit { background: var(--crit); }
.disk .num { font-family: var(--mono); font-size: 0.85rem; font-variant-numeric: tabular-nums; }

.issues { list-style: none; padding: 0; margin: 0 0 1.2rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.issues li { padding: 0.35rem 0.7rem; border-radius: 6px; font-size: 0.88rem; }
.issues li.warn { color: var(--warn); background: var(--warn-bg); } .issues li.crit { color: var(--crit); background: var(--crit-bg); }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; }
.facts { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1.2rem; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.2rem; }
.facts dt { color: var(--muted); font-size: 0.85rem; }
.facts dd { margin: 0; min-width: 0; }
.wrap { word-break: break-all; }
td.wrap-text { white-space: normal; min-width: 18rem; }
.units { margin: 0; padding-left: 1.2rem; color: var(--warn); }

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 1rem; }
.chart { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 0.8rem 1rem; }
.chart figcaption { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.82rem; margin-bottom: 0.5rem; }
.chart svg { width: 100%; height: 110px; display: block; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart .dot { fill: var(--accent); }
.chart .grid { stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.chart .grid.g80 { stroke: var(--warn); opacity: 0.5; } .chart .grid.g90 { stroke: var(--crit); opacity: 0.5; }
.chart .bar { fill: var(--accent); opacity: 0.8; } .chart .bar.empty { fill: var(--crit); opacity: 0.5; }
.chart .axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.72rem; margin-top: 0.3rem; }

.tenant { margin-bottom: 2.4rem; }
.bundle { margin-top: 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 0.9rem 1.2rem; }
.bundle h3 { font-family: var(--display); font-size: 0.7rem; font-weight: 400; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0 0 0.6rem; }
.bundle p { margin: 0.4rem 0; }
.diff { list-style: none; padding: 0; margin: 0.4rem 0 0.6rem; }
.diff li { padding: 0.15rem 0; }
details summary { cursor: pointer; color: var(--muted); margin-top: 0.6rem; }
pre.json { font-family: var(--mono); font-size: 0.8rem; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 0.8rem; overflow-x: auto; margin: 0.5rem 0 0; }
.tenant header { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.tenant h2 { margin: 0; color: var(--text); font-size: 1rem; text-transform: none; }
.empty { padding: 2rem; text-align: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--line); border-radius: 8px; }
.stale { opacity: 0.55; transition: opacity 0.3s; }

@media (max-width: 640px) {
  .top { padding: 0.8rem 1rem; gap: 1rem; }
  main { padding: 1.2rem 1rem 2rem; }
  .clock { margin-left: 0; width: 100%; }
}

/* The appliance page's tabs, and its collapsible sections. */
.tabs { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0.5rem 0 1.25rem; border-bottom: 1px solid var(--line); }
.tabs a { padding: 0.5rem 0.9rem; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.tabs .dot { display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 50%; margin-left: 0.3rem; vertical-align: middle; }
.tabs .dot.warn { background: var(--warn); } .tabs .dot.crit { background: var(--crit); }
details.section { margin: 1.5rem 0; }
details.section > summary { display: flex; align-items: baseline; gap: 1rem; cursor: pointer; list-style: none; }
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary h2 { margin: 0; display: inline; }
details.section > summary::before { content: "▸"; color: var(--muted); }
details.section[open] > summary::before { content: "▾"; }

/* Stacked lines in a table cell keep their warning colour. */
span.warn, .sub.warn { color: var(--warn); } span.crit, .sub.crit { color: var(--crit); }
table.fleet td { vertical-align: top; }

/* Sign-in and passkey registration, and signing out. */
main.auth { max-width: 32rem; margin: 4rem auto; }
main.auth button { font: inherit; padding: 0.7rem 1.3rem; margin-top: 1rem; border: 0; border-radius: 6px; background: var(--accent); color: #fff; cursor: pointer; }
main.auth button:disabled { opacity: 0.6; cursor: wait; }
.auth-error { color: var(--crit); }
form.signout { margin: 0 0 0 1rem; }
form.signout button { font: inherit; font-size: 0.85rem; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; }
form.signout button:hover { color: var(--text); }
