/* Olympus dashboard. One stylesheet, no build step. Colours are custom properties so charts
   (static/app.js) can read them, light and dark alike. */

:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #667085;
  --border: #e3e6eb;
  --accent: #2563eb;
  --accent-soft: #e8efff;
  --series-1: #2563eb;
  --series-2: #f59e0b;
  --series-3: #8b5cf6;
  --series-4: #10b981;
  --info-bg: #f3efff;
  --info-text: #4c1d95;
  --warn-bg: #fff6e0;
  --warn-text: #7a4a00;
  --grid: #eceef2;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a21;
    --text: #e6e8ec;
    --muted: #98a2b3;
    --border: #2a2f3a;
    --accent: #6ea0ff;
    --accent-soft: #1d2a45;
    --series-1: #6ea0ff;
    --series-2: #fbbf24;
    --series-3: #a78bfa;
    --series-4: #34d399;
    --info-bg: #241d3d;
    --info-text: #ddd3ff;
    --warn-bg: #3a2d10;
    --warn-text: #ffd889;
    --grid: #232833;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.45rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 2rem 0 0.75rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 0.5rem; }
p { margin: 0.5rem 0; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* Header and navigation */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.top-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.brand { font-weight: 700; color: var(--text); padding: 0.75rem 0; }
.brand:hover { text-decoration: none; }

.nav {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}

.nav a {
  color: var(--muted);
  padding: 0.85rem 0.6rem;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}

.nav a:hover { color: var(--text); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

.logout { margin: 0; }

main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

/* Page head: title, period switcher, freshness */

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin-bottom: 0.75rem;
}

.period { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.period-label { font-weight: 600; font-variant-numeric: tabular-nums; }

.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.segmented a { padding: 0.3rem 0.65rem; color: var(--muted); border-left: 1px solid var(--border); }
.segmented a:first-child { border-left: 0; }
.segmented a[aria-current="true"] { background: var(--accent-soft); color: var(--text); }
.segmented a:hover { text-decoration: none; color: var(--text); }

.step {
  display: inline-block;
  min-width: 2rem;
  padding: 0.3rem 0.5rem;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}
.step:hover { text-decoration: none; background: var(--accent-soft); }
.step[aria-disabled="true"] { color: var(--muted); opacity: 0.5; pointer-events: none; }

.freshness {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin: 0 0 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Cards */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0.75rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  min-width: 0;
}

.card-label { font-size: 0.8rem; color: var(--muted); }
.card-value { font-size: 1.45rem; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 0.15rem; }
.card-value .unit { font-size: 0.85rem; font-weight: 500; color: var(--muted); margin-left: 0.2rem; }
.card-foot { font-size: 0.78rem; color: var(--muted); margin-top: 0.2rem; }

/* Missing data must never look like a zero: dashed outline, a dash and the reason. */
.card.missing { border-style: dashed; background: transparent; }
.card.missing .card-value { color: var(--muted); font-weight: 400; }
.missing-text { color: var(--muted); font-style: italic; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}

.empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  color: var(--muted);
  font-style: italic;
}

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 1rem; }

/* Notes: neutral, informational observations — never alarm colours. */

.notes { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.4rem; }
.note { background: var(--info-bg); color: var(--info-text); border-radius: 8px; padding: 0.5rem 0.75rem; }
.warn { background: var(--warn-bg); color: var(--warn-text); border-radius: 8px; padding: 0.5rem 0.75rem; }

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  vertical-align: middle;
  white-space: nowrap;
}
.badge.warn { background: var(--warn-bg); color: var(--warn-text); padding: 0.05rem 0.4rem; }
.badge.plain { background: transparent; border: 1px solid var(--border); color: var(--muted); }

/* Tables */

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { padding: 0.45rem 0.7rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.yes { color: var(--accent); text-align: center; }
td.no { color: var(--muted); text-align: center; }

/* Charts */

.chart { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 0.75rem 0.25rem; min-width: 0; }
.chart figcaption { font-size: 0.85rem; font-weight: 600; margin-bottom: 0.25rem; }
.chart-canvas { width: 100%; min-height: 200px; }
.chart-canvas .u-legend { font-size: 0.78rem; color: var(--muted); }
.chart-canvas .u-legend th { color: var(--muted); }
.chart noscript, .chart .chart-empty { display: block; color: var(--muted); font-style: italic; padding: 1rem 0; }

/* Forms */

form.inline { display: inline; margin: 0; }
label { display: block; font-size: 0.85rem; color: var(--muted); margin: 0.6rem 0 0.25rem; }
input[type="text"], input[type="password"], input[type="date"], select {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  width: 100%;
  max-width: 24rem;
}
input[type="date"] { width: auto; }
fieldset { border: 0; padding: 0; margin: 0.6rem 0; }
legend { font-size: 0.85rem; color: var(--muted); padding: 0; }
.check { display: flex; gap: 0.5rem; align-items: baseline; color: var(--text); font-size: 0.9rem; margin: 0.3rem 0; }

button, .button {
  font: inherit;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
}
button:hover { background: var(--accent-soft); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { filter: brightness(1.08); }
button.quiet { border-color: transparent; background: transparent; color: var(--muted); }
button.quiet:hover { color: var(--text); background: var(--accent-soft); }

.secret {
  font-family: var(--mono);
  font-size: 0.9rem;
  word-break: break-all;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  margin: 0.5rem 0;
  user-select: all;
}

.custom-range { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0; }
.custom-range label { display: inline; margin: 0; }

/* Login */

.login {
  max-width: 22rem;
  margin: 12vh auto 0;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.login h1 { margin-bottom: 1rem; }
.login input { max-width: none; }
.login button { width: 100%; margin-top: 1rem; padding: 0.55rem; }
.error { color: var(--warn-text); background: var(--warn-bg); border-radius: 8px; padding: 0.5rem 0.75rem; margin: 0.5rem 0; }

@media (max-width: 40rem) {
  body { font-size: 14px; }
  .top-inner { gap: 0 0.5rem; padding: 0 0.6rem; flex-wrap: wrap; justify-content: space-between; }
  .brand { padding: 0.6rem 0 0.2rem; }
  .nav { order: 3; flex-basis: 100%; }
  .nav a { padding: 0.5rem 0.55rem 0.6rem; }
  .nav a:first-child { padding-left: 0; }
  main { padding: 1rem 0.6rem 2.5rem; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
  .card-value { font-size: 1.25rem; }
  .grid-2 { grid-template-columns: 1fr; }
  .hide-narrow { display: none; }
}
