/* Chrome follows xomdata.com: Space Grotesk, neutral gray (chroma 0) + brand
   blue #3a81f6, light sidebar, radius 8px. Tokens converted from the oklch set
   in xomdata_academy/src/app/globals.css.

   Series colors are NOT xomdata's chart-1..5: that set fails CVD (its green
   #19b036 and amber #d48e00 sit at ΔE 4.1 under protanopia). Slot 1 keeps their
   brand blue; slots 2-3 come from a validated palette. */

@import url('/static/fonts.css');

:root {
  --sidebar-width: 236px;

  --bg: #fdfdfd;
  --surface: #ffffff;
  --surface2: #f5f5f5;
  --border: #e5e5e5;
  --border2: #d8d8d8;
  --text: #1b1b1b;
  --muted: #696969;
  --accent: #3a81f6;
  --green: #16a34a;
  --red: #ea3c3f;

  --sidebar-bg: #f5f5f5;
  --sidebar-text: #696969;
  --sidebar-hover: #ebebeb;

  /* validated categorical slots (light, white surface) */
  --series-1: #3a81f6;
  --series-2: #eb6834;
  --series-3: #1baf7a;

  --grid: #f0f0f0;
  --axis: #d8d8d8;

  --radius: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04);
  --sans: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; padding: 0; }

body {
  background: var(--bg);
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

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

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d4d4d4; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #b4b4b4; }

/* ---------- shell ---------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  color: var(--sidebar-text);
  padding: 18px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { color: var(--text); font-size: 15px; font-weight: 700; padding: 0 8px 4px; letter-spacing: -.01em; }
.brand span { display: block; font-size: 11.5px; font-weight: 400; color: var(--muted); letter-spacing: 0; }

.nav { margin-top: 20px; display: flex; flex-direction: column; gap: 2px; }

.nav a {
  color: var(--muted);
  padding: 7px 9px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}

.nav a:hover { background: var(--sidebar-hover); color: var(--text); }
.nav a.active { background: var(--sidebar-hover); color: var(--accent); }

.sidebar .foot {
  position: absolute;
  bottom: 16px;
  left: 12px;
  right: 12px;
  font-size: 11.5px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.main { flex: 1; min-width: 0; padding: 22px 26px 48px; }

.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; font-weight: 700; margin: 0; letter-spacing: -.02em; }
.page-head .meta { color: var(--muted); font-size: 12px; }

.notice {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  border-radius: var(--radius);
  padding: 10px 13px;
  font-size: 12.5px;
  margin: 14px 0 0;
}

/* ---------- controls: one row, scopes every chart ---------- */

.filters {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 18px;
  flex-wrap: wrap;
}

.seg { display: inline-flex; border: 1px solid var(--border2); border-radius: 7px; overflow: hidden; background: var(--surface); }

.seg button {
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--muted);
  padding: 6px 12px;
  cursor: pointer;
  border-right: 1px solid var(--border);
}

.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--surface2); color: var(--text); font-weight: 600; }

.spacer { flex: 1; }

/* ---------- tiles ---------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(172px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 15px;
  box-shadow: var(--shadow);
}

.tile .k { color: var(--muted); font-size: 11.5px; font-weight: 500; }
/* proportional figures: tabular-nums makes standalone numbers look loose */
.tile .v { font-size: 24px; font-weight: 700; letter-spacing: -.03em; margin-top: 3px; }
.tile .s { color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.tile .s.good { color: var(--green); }
.tile .s.bad { color: var(--red); }

/* ---------- cards ---------- */

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(430px, 1fr)); gap: 14px; margin-bottom: 14px; }
.grid.full { grid-template-columns: 1fr; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 15px 16px 12px;
  min-width: 0;
}

.card header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 2px; }
.card h2 { font-size: 13.5px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.card .hint { color: var(--muted); font-size: 11.5px; margin: 0 0 10px; }

.card .toggle {
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--muted);
  font-family: inherit;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.card .toggle:hover { background: var(--surface2); color: var(--text); }

.legend { display: flex; gap: 14px; flex-wrap: wrap; margin: 0 0 6px; }
.legend .item { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.legend .swatch { width: 9px; height: 9px; border-radius: 2px; flex: 0 0 9px; }

.plot { width: 100%; overflow-x: auto; }
.plot svg { display: block; width: 100%; height: auto; }

.tableview { display: none; max-height: 300px; overflow: auto; margin-top: 8px; }
.tableview.show { display: block; }
.plot.hide { display: none; }

table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 5px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 500; position: sticky; top: 0; background: var(--surface); }
tbody tr:hover { background: var(--surface2); }
td.mono { font-family: var(--mono); font-size: 11px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.bad { background: #fee2e2; color: #991b1b; }

.empty { color: var(--muted); font-size: 12px; padding: 26px 0; text-align: center; }

/* ---------- tooltip ---------- */

.tip {
  position: fixed;
  pointer-events: none;
  background: #1b1b1b;
  color: #fff;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 11.5px;
  line-height: 1.5;
  z-index: 50;
  opacity: 0;
  transition: opacity .08s;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .22);
  max-width: 250px;
}

.tip.show { opacity: 1; }
.tip .t { color: #a3a3a3; }
.tip b { font-weight: 700; }

@media (max-width: 760px) {
  .sidebar { display: none; }
  .main { padding: 16px; }
  .grid { grid-template-columns: 1fr; }
}
