/* Strijder PT — design system & shell
   Synthesis: shadcn admin (OKLCH zinc) + VisActor density + Simple Smart calm spacing.
*/

:root {
  /* Light theme tokens */
  --bg:           oklch(0.99 0 0);
  --bg-elev:      oklch(0.985 0 0);
  --surface:      oklch(1 0 0);
  --surface-2:    oklch(0.97 0 0);
  --border:       oklch(0.92 0 0);
  --border-strong:oklch(0.86 0 0);
  --text:         oklch(0.18 0 0);
  --text-muted:   oklch(0.5 0.01 0);
  --text-subtle:  oklch(0.65 0.01 0);

  /* Brand: warm warrior orange */
  --brand:        oklch(0.66 0.19 38);
  --brand-soft:   oklch(0.95 0.04 38);
  --brand-strong: oklch(0.58 0.21 35);
  --on-brand:     oklch(0.99 0 0);

  /* Status */
  --red:          oklch(0.62 0.22 25);
  --red-soft:     oklch(0.96 0.04 25);
  --orange:       oklch(0.74 0.16 60);
  --orange-soft:  oklch(0.96 0.05 60);
  --yellow:       oklch(0.82 0.14 95);
  --yellow-soft:  oklch(0.97 0.05 95);
  --green:        oklch(0.65 0.15 145);
  --green-soft:   oklch(0.95 0.04 145);
  --blue:         oklch(0.62 0.14 240);
  --teal:         oklch(0.66 0.11 195);
  --violet:       oklch(0.6 0.17 295);

  /* Chart palette */
  --c1: var(--brand);
  --c2: oklch(0.66 0.11 195);
  --c3: oklch(0.6 0.17 295);
  --c4: oklch(0.74 0.16 60);
  --c5: oklch(0.65 0.15 145);
  --c6: oklch(0.62 0.14 240);

  /* Geometry */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.04);
  --shadow:    0 4px 16px -6px oklch(0 0 0 / 0.08), 0 2px 6px -3px oklch(0 0 0 / 0.05);

  /* Layout */
  --sidebar-w: 240px;
  --sidebar-collapsed-w: 64px;
  --topbar-h: 56px;
}

[data-theme="dark"] {
  --bg:           oklch(0.16 0.005 270);
  --bg-elev:      oklch(0.19 0.005 270);
  --surface:      oklch(0.21 0.006 270);
  --surface-2:    oklch(0.24 0.007 270);
  --border:       oklch(0.28 0.008 270);
  --border-strong:oklch(0.36 0.01 270);
  --text:         oklch(0.97 0 0);
  --text-muted:   oklch(0.74 0.01 270);
  --text-subtle:  oklch(0.58 0.01 270);
  --brand-soft:   oklch(0.32 0.07 38);
  --red-soft:     oklch(0.32 0.07 25);
  --orange-soft:  oklch(0.34 0.07 60);
  --yellow-soft:  oklch(0.34 0.07 95);
  --green-soft:   oklch(0.32 0.07 145);
  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.4);
  --shadow:    0 8px 24px -8px oklch(0 0 0 / 0.5), 0 2px 6px -3px oklch(0 0 0 / 0.4);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ---------- App shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas: "sidebar topbar" "sidebar main";
  min-height: 100vh;
}
.app[data-collapsed="true"] { grid-template-columns: var(--sidebar-collapsed-w) 1fr; }

/* ---------- Sidebar ---------- */
.sidebar {
  grid-area: sidebar;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.sidebar__brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  display: grid; place-items: center;
  color: var(--on-brand);
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.sidebar__brand-text { font-size: 15px; }
.app[data-collapsed="true"] .sidebar__brand-text { display: none; }

.sidebar__nav { padding: 12px 8px; overflow-y: auto; flex: 1; }
.sidebar__group { margin-bottom: 16px; }
.sidebar__group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  padding: 6px 12px;
  font-weight: 500;
}
.app[data-collapsed="true"] .sidebar__group-label { display: none; }

.sidebar__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.sidebar__item:hover { background: var(--surface-2); color: var(--text); }
.sidebar__item--active { background: var(--brand-soft); color: var(--brand-strong); }
[data-theme="dark"] .sidebar__item--active { color: var(--text); }
.sidebar__item svg { width: 18px; height: 18px; flex-shrink: 0; }
.app[data-collapsed="true"] .sidebar__item-label { display: none; }
.sidebar__item-badge {
  margin-left: auto;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 600;
}
.sidebar__item--active .sidebar__item-badge { background: var(--brand); color: var(--on-brand); }

.sidebar__footer {
  border-top: 1px solid var(--border);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 32px; height: 32px; border-radius: 999px;
  background: linear-gradient(135deg, var(--c3), var(--c1));
  display: grid; place-items: center;
  color: white; font-weight: 600; font-size: 12px;
  flex-shrink: 0;
}
.sidebar__footer-meta { line-height: 1.2; min-width: 0; }
.sidebar__footer-name { font-weight: 600; font-size: 13px; }
.sidebar__footer-role { font-size: 12px; color: var(--text-subtle); }
.app[data-collapsed="true"] .sidebar__footer-meta { display: none; }

/* ---------- Topbar ---------- */
.topbar {
  grid-area: topbar;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar__left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.icon-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

.breadcrumb { display: flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 13px; }
.breadcrumb__sep { color: var(--text-subtle); }
.breadcrumb__current { color: var(--text); font-weight: 500; }

.topbar__search {
  flex: 1; max-width: 420px;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 7px 12px;
  color: var(--text-muted);
}
.topbar__search:focus-within { border-color: var(--border-strong); background: var(--surface); }
.topbar__search > svg { width: 14px; height: 14px; flex-shrink: 0; }
.topbar__search input {
  border: none; outline: none; background: transparent;
  flex: 1; color: var(--text);
  font-family: inherit; font-size: 13px;
}
.topbar__search kbd {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-elev);
  color: var(--text-subtle);
}

.topbar__right { display: flex; align-items: center; gap: 6px; margin-left: auto; }

/* ---------- Main ---------- */
.main {
  grid-area: main;
  padding: 24px 32px 48px;
  overflow-x: hidden;
}
.page-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; gap: 24px; flex-wrap: wrap; }
.page-title { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.page-subtitle { color: var(--text-muted); margin: 4px 0 0; font-size: 14px; }
.page-actions { display: flex; gap: 8px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.btn--primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.btn--primary:hover { background: var(--brand-strong); }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: var(--surface-2); }
.btn svg { width: 14px; height: 14px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card--elev { box-shadow: var(--shadow); }
.card__header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; gap: 16px; }
.card__title { font-size: 14px; font-weight: 600; margin: 0; letter-spacing: -0.005em; }
.card__subtitle { font-size: 12px; color: var(--text-muted); margin: 2px 0 0; }
.card__actions { display: flex; gap: 4px; }

/* ---------- KPI ---------- */
.kpi {
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px 20px;
}
.kpi__label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.kpi__value { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.kpi__delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; }
.kpi__delta--up { color: var(--green); }
.kpi__delta--down { color: var(--red); }
.kpi__spark { margin-top: 8px; height: 36px; }

/* ---------- Grids ---------- */
.grid { display: grid; gap: 16px; }
.grid--kpi { grid-template-columns: repeat(4, 1fr); }
.grid--2 { grid-template-columns: 2fr 1fr; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--12 { grid-template-columns: repeat(12, 1fr); }
.col-4 { grid-column: span 4; }
.col-6 { grid-column: span 6; }
.col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }
.stack { display: flex; flex-direction: column; gap: 16px; }

@media (max-width: 1100px) {
  .grid--kpi { grid-template-columns: repeat(2, 1fr); }
  .grid--2, .grid--3 { grid-template-columns: 1fr; }
  .col-4, .col-6, .col-8 { grid-column: span 12; }
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-muted);
}
.badge--red    { background: var(--red-soft);    color: var(--red); }
.badge--orange { background: var(--orange-soft); color: var(--orange); }
.badge--yellow { background: var(--yellow-soft); color: oklch(0.55 0.16 80); }
.badge--green  { background: var(--green-soft);  color: var(--green); }
.badge--brand  { background: var(--brand-soft);  color: var(--brand-strong); }
.dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; display: inline-block; }

/* ---------- AI-flow card (reference-pattern: atleet-detail risk-card, triage) ---------- */
.aif        { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.aif__head  { padding: 10px 14px; background: linear-gradient(180deg, var(--brand-soft) 0%, transparent 100%); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; }
.aif__label { color: var(--brand-strong); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.aif__sig   { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11px; color: var(--text-muted); background: var(--surface-2); padding: 2px 8px; border-radius: 4px; }
.aif__inputs{ padding: 6px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11px; }
.aif__inputs > .aif__inputs-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-subtle); margin-right: 4px; }
.aif__body  { padding: 12px 14px; }
.aif__foot  { padding: 6px 14px; background: var(--surface-2); border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 11px; color: var(--text-subtle); }
.aif__tag   { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11px; background: var(--surface-2); color: var(--text-muted); padding: 1px 6px; border-radius: 3px; }
.aif__kind  { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 10px; padding: 1px 6px; border-radius: 3px; font-weight: 600; }
.aif__kind--det { background: var(--surface-2); color: var(--text-muted); }
.aif__kind--ai  { background: var(--brand-soft); color: var(--brand-strong); }
.aif__kind--ml  { background: oklch(0.95 0.04 240 / 0.7); color: oklch(0.45 0.14 240); }
[data-theme="dark"] .aif__kind--ml { background: oklch(0.32 0.08 240); color: oklch(0.85 0.06 240); }

/* ---------- Table ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead th {
  text-align: left;
  font-weight: 500;
  color: var(--text-muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.table tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table__name { display: flex; align-items: center; gap: 10px; font-weight: 500; }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.list__item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.list__item:last-child { border-bottom: none; }
.list__title { font-weight: 500; font-size: 13px; }
.list__meta { font-size: 12px; color: var(--text-subtle); }

/* ---------- Misc ---------- */
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.row { display: flex; align-items: center; gap: 8px; }
.row--between { justify-content: space-between; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

.chart { width: 100%; height: 280px; }
.chart--sm { height: 200px; }
.chart--lg { height: 360px; }

/* AI briefing card — distinct */
.ai-card {
  position: relative;
  background:
    radial-gradient(circle at 100% 0%, var(--brand-soft) 0%, transparent 60%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  overflow: hidden;
}
.ai-card__label { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--brand-strong); }
.ai-card__title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; margin: 6px 0 8px; }
.ai-card__body { color: var(--text-muted); line-height: 1.6; max-width: 60ch; }
.ai-card__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.chip {
  font-size: 12px;
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  cursor: pointer;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }

/* Mini bar (for inline ranks) */
.minibar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.minibar__fill { height: 100%; background: var(--brand); border-radius: 999px; }
