/* OKLCH neutrals tinted toward an ISAAC-blue hue (250°) so the dashboard
   reads as "instrument cluster", not generic admin-cream. */
:root {
  --bg: oklch(0.98 0.005 250);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.965 0.006 250);
  --border: oklch(0.92 0.008 250);
  --text: oklch(0.22 0.012 250);
  --muted: oklch(0.55 0.012 250);
  --accent: oklch(0.55 0.18 250);

  --ok: oklch(0.62 0.16 145);
  --warn: oklch(0.72 0.15 75);
  --bad: oklch(0.6 0.2 25);
}

* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1rem 4rem;
  color: var(--text);
  background: var(--bg);
}
/* Dark instrument-cluster header so both partner logos (white-on-transparent)
   render correctly without bleaching out. */
header {
  background: oklch(0.22 0.02 250);
  margin: -1.25rem -1rem 1rem;
  padding: 0.9rem 1.25rem;
  color: oklch(0.95 0.005 250);
  border-bottom: 1px solid oklch(0.32 0.025 250);
}
.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1.25rem;
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
}
.header-title h1 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.005em;
}
.header-title .muted {
  margin: 0;
  font-size: 0.78rem;
  color: oklch(0.7 0.012 250);
}
.brand-luthi {
  height: 32px;
  width: auto;
  display: block;
}
.brand-isaac {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  opacity: 0.9;
  transition: opacity 150ms;
}
.brand-isaac:hover { opacity: 1; }
.brand-isaac img {
  height: 22px;
  width: auto;
  display: block;
}
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
code { font-family: ui-monospace, SFMono-Regular, monospace; font-size: 0.9em; }

/* ─── Strip header (Health + Today, collapsed by default) ─── */
.strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.strip-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0;
}
.strip-detail summary {
  display: flex; align-items: baseline; gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  list-style: none;
}
.strip-detail summary::-webkit-details-marker { display: none; }
.strip-detail summary::before {
  content: "▸";
  color: var(--muted);
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-block;
}
.strip-detail[open] summary::before { transform: rotate(90deg); }
.strip-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.strip-value { font-size: 0.9rem; }
.strip-detail[open] > div { padding: 0.75rem; border-top: 1px solid var(--border); }

.status-ok { color: var(--ok); font-weight: 600; }
.status-bad { color: var(--bad); font-weight: 600; }

/* ─── Panel base ─── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem 1rem;
  margin-bottom: 1rem;
}
.panel h2 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.6rem;
  letter-spacing: -0.005em;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.refresh-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85em;
  border-radius: 4px;
  padding: 0.05rem 0.45rem;
  cursor: pointer;
  line-height: 1.3;
  margin-left: auto;
}
.refresh-btn:hover { color: var(--accent); border-color: var(--accent); }
.panel > details > summary { list-style: none; cursor: pointer; padding: 0.25rem 0; }
.panel > details > summary::-webkit-details-marker { display: none; }
.panel > details > summary::before {
  content: "▸"; color: var(--muted); margin-right: 0.4rem;
  display: inline-block;
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
.panel > details[open] > summary::before { transform: rotate(90deg); }
.panel > details[open] > div { margin-top: 0.5rem; }

/* ─── Fleet list ─── */
.panel-fleet { padding-bottom: 0.5rem; }
.fleet { list-style: none; margin: 0; padding: 0; }
.truck {
  border-bottom: 1px solid var(--border);
}
.truck:last-child { border-bottom: none; }
.truck > details > summary {
  display: grid;
  grid-template-columns: 1rem 4rem minmax(14rem, 1fr) minmax(0, 1.6fr);
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.55rem 0.5rem;
  cursor: pointer;
  list-style: none;
  font-variant-numeric: tabular-nums;
  border-radius: 4px;
  transition: background 100ms;
}
.truck > details > summary::-webkit-details-marker { display: none; }
.truck > details > summary::before {
  content: "›";
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1;
  display: inline-block;
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
.truck > details[open] > summary::before { transform: rotate(90deg); }
.truck > details > summary:hover { background: var(--surface-2); }

.truck-no {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.truck-op { color: var(--text); }
.truck-op .muted { font-size: 0.85em; }
.truck-activity {
  display: flex; gap: 0.6rem; align-items: baseline;
  min-width: 0;
}
.truck-activity .when {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 0.88em;
}
.truck-activity .subject {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.truck.truck-quiet .truck-no,
.truck.truck-quiet .truck-op strong {
  color: var(--muted);
  font-weight: 500;
}
.truck.truck-active .truck-no { color: var(--accent); }

/* Logged-in dot */
.dot {
  display: inline-block;
  width: 0.55em; height: 0.55em;
  border-radius: 50%;
  background: var(--muted);
  vertical-align: middle;
  margin-right: 0.25em;
}
.dot-on { background: var(--ok); box-shadow: 0 0 0 3px oklch(0.62 0.16 145 / 0.18); }

/* Truck detail (expanded) */
.truck-detail {
  background: var(--surface-2);
  margin: 0 -1rem;
  padding: 0.75rem 1rem 1rem 2.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.92em;
}
.truck-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.2rem 0.75rem;
  margin: 0 0 0.6rem;
}
.truck-meta dt {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  align-self: center;
}
.truck-meta dd { margin: 0; align-self: center; }

/* ─── Recent messages tables (existing + truck-scoped) ─── */
.recent { width: 100%; border-collapse: collapse; font-size: 0.92em; }
.recent th, .recent td {
  text-align: left;
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.recent th {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.recent tr.outcome-sent td:last-child { color: var(--ok); }
.recent tr.outcome-no_route td:last-child,
.recent tr.outcome-oversized td:last-child,
.recent tr.outcome-malformed td:last-child,
.recent tr.outcome-isaac_4xx td:last-child { color: var(--bad); }
.recent tr.outcome-skipped td:last-child { color: var(--muted); }
.recent-truck { background: var(--surface); border-radius: 4px; }

/* ─── Health panel internals (kept compact) ─── */
.health { display: grid; grid-template-columns: max-content 1fr; gap: 0.2rem 1rem; }
.health dt {
  font-size: 0.78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted);
}
.health dd { margin: 0; }
.jobs { width: 100%; border-collapse: collapse; margin-top: 0.5rem; font-size: 0.9em; }
.jobs th, .jobs td {
  text-align: left;
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
.jobs th { font-size: 0.78rem; color: var(--muted); }

/* Today counters (used inside collapsed strip — compact layout) */
.counters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.4rem;
}
.counter {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.4rem 0.6rem;
  text-align: left;
}
.counter .label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.counter .value {
  display: block;
  font-size: 1.3rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.counter.total .value, .counter.ndrs .value { color: var(--warn); }
.counter.sent .value { color: var(--ok); }
.counter.ndr .value { color: var(--bad); }
.counter.skipped .value { color: var(--muted); }
.window { margin-top: 0.5rem; font-size: 0.85em; color: var(--muted); }

/* ─── Hide the legacy panels we replaced (kept for direct URL access) ─── */
/* (no rule needed; templates simply don't reference them anymore) */
