:root {
  /* Light theme defaults (forced) */
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-elev: #f2f5fc;
  --text: #1f2937;      /* gray-800 for softer contrast */
  --muted: #64748b;     /* slate-500 */
  --primary: #355cf6;
  --accent: #0891b2;
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --grid-gap: 20px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Noto Sans, Ubuntu, Cantarell, Helvetica Neue, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: radial-gradient(1200px 800px at 10% 0%, #e9eefc 0%, var(--bg) 50%) fixed;
  color: var(--text);
}

.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  position: sticky; top: 0; z-index: 10;
  background: linear-gradient(180deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.75) 100%);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.app-header h1 { margin: 0; font-size: 22px; letter-spacing: 0.2px; color: #0f172a; }
.header-left { display: flex; align-items: baseline; gap: 10px; }
.header-right { display: flex; gap: 8px; }

.container { max-width: 1240px; margin: 0 auto; padding: 24px; }

.cards.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--grid-gap); margin-bottom: 20px; }
.card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-elev) 100%);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 14px;
  padding: 18px 18px 12px;
  box-shadow: 0 6px 20px rgba(15,23,42,0.08);
}
.card h2 { margin: 0 0 12px 0; font-size: 16px; font-weight: 700; color: #0f172a; }

.chart { width: 100%; height: 380px; margin-top: 8px; }
.chart.tall { height: 260px; }

.section-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.controls { display: flex; gap: 12px; align-items: center; }
.control { display: inline-flex; align-items: center; gap: 8px; }
select { background: var(--surface); color: #111827; border: 1px solid rgba(0,0,0,0.08); padding: 6px 10px; border-radius: 8px; }

.btn {
  background: var(--surface-elev); color: var(--text);
  border: 1px solid rgba(0,0,0,0.08);
  padding: 8px 10px; border-radius: 10px; cursor: pointer;
}
.btn:hover { border-color: rgba(0,0,0,0.2); }

.muted { color: var(--muted); }
.small { font-size: 12px; }

.app-footer { max-width: 1240px; margin: 16px auto 40px; padding: 0 24px; }

/* Responsive */
@media (max-width: 900px) {
  .cards.two-col { grid-template-columns: 1fr; }
  .chart { height: 320px; }
  .chart.tall { height: 260px; }
  .stacked-label { flex-basis: 160px; min-width: 160px; }
  .stacked-counts { flex-basis: 200px; min-width: 200px; max-width: 200px; }
}

/* Assessments grid */
.assessments-grid {
  display: grid;
  grid-template-columns: 1fr; /* stack vertically for many assessments */
  gap: 18px;
  margin-top: 10px;
}
.assessment-card {
  border: 1px dashed rgba(0,0,0,0.06);
  border-radius: 12px;
  padding: 12px;
}
.assessment-card h3 {
  margin: 0 0 6px 6px;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

/* Variant: tiles view */
.tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.tile-card {
  background: var(--surface);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 4px 12px rgba(15,23,42,0.06);
}
.tile-card .tile-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 12px;
  color: #0f172a;
  background: var(--surface-elev);
  border: 1px solid rgba(0,0,0,0.06);
  padding: 4px 8px;
  border-radius: 999px;
}
.tile-card .tile-meta { color: var(--muted); font-size: 12px; margin-top: 6px; }
.score-chip { display:inline-block; min-width: 28px; text-align:center; padding:2px 6px; border-radius: 999px; font-weight:700; }
.score-1 { background:#FDE2E7; color:#A90E2B; }
.score-2 { background:#FFE1E5; color:#9F1239; }
.score-3 { background:#E6F7EE; color:#166534; }
.score-4 { background:#F6FBD9; color:#4d4d00; }
.score-5 { background:#EEF6C2; color:#3F6212; }

/* Variant: bars view */
/* (removed sparkline view) */

/* Variant: stacked distribution */
.stacked-grid { display:grid; grid-template-columns: 1fr; gap: 10px; }
.stacked-row { display:flex; align-items:center; gap:12px; padding:6px 8px; border:1px solid rgba(0,0,0,0.06); border-radius:10px; background:linear-gradient(180deg, var(--surface) 0%, var(--surface-elev) 100%); }
.stacked-label { flex: 0 0 220px; min-width: 220px; font-weight:600; color:#0f172a; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.stacked-chart { flex:1; height: 42px; }
.stacked-counts { flex: 0 0 240px; min-width: 240px; max-width: 240px; display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; font-size: 12px; color: var(--muted); text-align:right; }

/* (removed boxplot rows) */

/* (removed stacked 100%) */

/* (removed lollipop) */

/* (removed score matrix) */

/* (removed beeswarm) */

/* Variant: merged heatmap container tweaks */
.merged-card { padding: 12px 12px 6px; }
.legend-inline { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.legend-swatch { width: 12px; height: 12px; border-radius:2px; border:1px solid rgba(0,0,0,0.1); display:inline-block; }
.legend-label { font-size:12px; color:#64748b; }
.legend-tick { font-size:12px; color:#64748b; }
.legend-sep { width: 1px; height: 14px; background: rgba(0,0,0,0.08); display:inline-block; margin: 0 6px; }
.legend-gradient { width: 160px; height: 10px; border-radius: 999px; border: 1px solid rgba(0,0,0,0.06); display:inline-block; background: linear-gradient(90deg, #ef4444 0%, #f59e0b 50%, #22c55e 100%); }

/* ECharts tooltip: allow wrapping for CJK/no-space text */
.echarts-tooltip {
  white-space: normal !important;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.4;
  max-width: 440px;
}
