:root {
  color-scheme: light dark;
  --page: light-dark(#eaf0f7, #101722);
  --sheet: light-dark(#fbfcff, #161f2e);
  --ink: light-dark(#18243a, #eef3fc);
  --muted: light-dark(#4b5d77, #b3c0d5);
  --line: light-dark(#cdd9e8, #34445d);
  --blue: light-dark(#3059b7, #a3bcff);
  --bar: light-dark(#8da7df, #5672b2);
  --blue-wash: light-dark(#e6edff, #283858);
  --red: light-dark(#a2352c, #ffc1bc);
  --amber: light-dark(#805206, #ffd189);
  --green: light-dark(#09664a, #91e0bf);
  --radius: 1rem;
  font: 1rem/1.55 system-ui, sans-serif;
  background: var(--page);
  color: var(--ink);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, p, dl, dd { margin: 0; }
a { color: inherit; }
button, select, input { font: inherit; color: inherit; }
button, select, input[type="search"] {
  background: var(--sheet); border: 1px solid var(--line); border-radius: .5rem; padding: .48rem .75rem;
}
button, summary, select { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
button:hover:not(:disabled), summary:hover { color: var(--blue); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--sheet); border-bottom: 1px solid var(--line); padding: .85rem clamp(1rem, 5vw, 4rem);
}
.brand { display: inline-flex; align-items: center; gap: .5rem; font-size: 1.3rem; font-weight: 750; text-decoration: none; white-space: nowrap; }
.brand small { margin-left: .15rem; color: var(--muted); font: 650 .72rem/1 ui-monospace, monospace; text-transform: uppercase; letter-spacing: .06em; }
.topbar nav, .topbar form { display: flex; align-items: center; gap: clamp(.55rem, 2vw, 1.4rem); font-size: .9rem; }
.topbar nav a { text-decoration: none; color: var(--muted); }
.topbar nav a:hover { text-decoration: underline; }
#viewer { color: var(--muted); }

#dashboard { margin: auto; padding: clamp(1.4rem, 4vw, 3.25rem) clamp(.9rem, 4vw, 3rem); max-width: 89rem; }
.intro { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 1rem; }
h1 { font-size: clamp(2rem, 4.7vw, 3.8rem); line-height: 1.1; letter-spacing: -.065em; }
.intro p { margin-top: .55rem; color: var(--muted); }
.period { display: flex; align-items: center; gap: .65rem; }
.period label, #load-status { color: var(--muted); font-size: .86rem; }
#load-status { margin: .8rem 0 1rem; }

.metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 1rem; }
.metrics div { background: var(--sheet); padding: 1.1rem; min-width: 0; }
.metrics div:first-child { background: var(--blue-wash); }
.metrics div + div { border-left: 1px solid var(--line); }
.metrics dt, .metrics small { color: var(--muted); font-size: .84rem; }
.metrics dd { font-size: clamp(1.55rem, 4vw, 2.65rem); line-height: 1.25; font-weight: 750; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.panel { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; padding: clamp(.9rem, 2vw, 1.35rem); margin-bottom: 1rem; scroll-margin-top: 1rem; }
.panel-title { display: flex; align-items: start; justify-content: space-between; flex-wrap: wrap; gap: .65rem; margin-bottom: 1.1rem; }
.panel-title h2 { font-size: 1.2rem; letter-spacing: -.022em; }
.panel-title p, .empty { color: var(--muted); font-size: .9rem; }
.first-row { display: grid; grid-template-columns: minmax(0,2fr) minmax(0,1fr); gap: 1rem; }
.chart-selection { color: var(--blue); font-size: .91rem; font-weight: 650; margin: .5rem 0 .85rem; }
.chart-wrap { display: grid; grid-template-columns: 2rem 1fr; height: clamp(9rem, 19vw, 14rem); }
#axis { display: flex; flex-direction: column; justify-content: space-between; text-align: right; padding-right: .4rem; color: var(--muted); font: .75rem ui-monospace, monospace; }
#chart { border-block: 1px solid var(--line); background: linear-gradient(var(--line),var(--line)) center / 100% 1px no-repeat; }
#chart svg { display: block; height: 100%; width: 100%; overflow: visible; }
.chart-hit { fill: transparent; }
.chart-bar { fill: var(--bar); }
.chart-day:is(.selected,:focus-visible) .chart-bar { fill: var(--blue); }
.chart-day:is(.selected,:focus-visible) .chart-hit { fill: var(--blue-wash); }
#chart-range { display: flex; margin: .45rem 0 0 2rem; justify-content: space-between; color: var(--muted); font: .75rem ui-monospace, monospace; }
.health dl div, .activity-log li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.health dd { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.health dd small { display: block; color: var(--muted); font-size: .8rem; font-weight: 400; }
.ops { margin-top: .9rem; font-size: .84rem; color: var(--muted); }
.ops dd { color: var(--ink); }

.status { display: inline-block; border-radius: .35rem; padding: .12rem .4rem; background: var(--page); font-size: .8rem; font-weight: 650; }
.status.failed { color: var(--red); }
.status.stopped { color: var(--amber); }
.status.ready { color: var(--green); }
.filters { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; margin-bottom: .75rem; }
.filters input[type="search"] { width: min(100%, 24rem); min-width: 15rem; }
.primary { background: var(--blue); border-color: transparent; color: light-dark(#fff,#13254a); font-weight: 650; }
.primary:hover:not(:disabled) { color: light-dark(#fff,#13254a); filter: brightness(.92); }
.check { font-size: .9rem; }
.directory-row { border-top: 1px solid var(--line); }
.directory-row summary {
  display: flex; gap: .8rem; align-items: center; justify-content: space-between; padding: .65rem .15rem;
  list-style: none; font-size: .94rem;
}
.directory-row summary::-webkit-details-marker { display: none; }
.directory-row summary > span:first-child { min-width: 0; }
.directory-row summary > span:last-child { text-align: right; }
.directory-row summary::after { content: '+'; color: var(--blue); font-size: 1.1rem; }
.directory-row[open] summary::after { content: '−'; }
.directory-row summary > span:last-child { margin-left: auto; }
.directory-row :is(small,dt), .activity-log small { color: var(--muted); font-size: .85rem; display: block; overflow-wrap: anywhere; }
.directory-row dl { display: grid; grid-template-columns: repeat(auto-fit,minmax(12rem,1fr)); gap: .55rem 1rem; padding: .75rem; background: var(--page); border-radius: .45rem; font-size: .9rem; overflow-wrap: anywhere; }
.directory-row .owned { display: flex; flex-wrap: wrap; gap: .6rem 1.1rem; list-style: none; padding: 0 .75rem; font-size: .88rem; }
.directory-row .owned .status { margin-left: .3rem; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: .85rem; color: var(--muted); margin-top: 1rem; }
.activity-log ul { margin: 0; padding: 0; list-style: none; }
.activity-log time { color: var(--muted); font: .78rem ui-monospace, monospace; }
.coverage { color: var(--muted); font-size: .86rem; max-width: 70ch; }

.sign-in { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.sign-in-card { width: min(31rem,100%); padding: clamp(1.3rem,5vw,2.5rem); background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); }
.sign-in-card h1 { font-size: clamp(1.85rem,5vw,2.55rem); margin: .9rem 0 .5rem; }
.sign-in-card p { color: var(--muted); }
.sign-in-card form { margin-top: 1.4rem; }
.sign-in-card #auth-error { color: var(--red); margin-top: .8rem; }

@media (max-width: 52rem) {
  .first-row { grid-template-columns: 1fr; gap: 0; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metrics div:nth-child(3) { border-left: 0; }
  .metrics div:nth-child(n + 3) { border-top: 1px solid var(--line); }
}
@media (max-width: 36rem) {
  .topbar { flex-wrap: wrap; }
  .topbar nav { order: 3; flex-basis: 100%; }
  #viewer { display: none; }
  .metrics div { padding: .8rem .65rem; }
  .directory-row summary { gap: .4rem; }
  .pager { flex-wrap: wrap; }
}
