:root {
  /* deeplearning.ai-inspired dark palette */
  --bg: #0a1828;            /* deep navy base */
  --bg-2: #0d2138;          /* subtle gradient stop */
  --panel: #102742;         /* card surface */
  --panel-2: #15314f;       /* nested surface */
  --text: #eef4fb;
  --muted: #9db1c8;
  --line: #234063;          /* hairline borders */
  --accent: #2f9bf4;        /* signature azure blue */
  --accent-strong: #1f8ae6; /* hover/pressed */
  --accent-soft: rgba(47, 155, 244, .14);
  --accent-2: #2dd4bf;      /* teal — success / positive */
  --warn: #f6c358;
  --bad: #f87f8f;
  --shadow: 0 12px 34px rgba(3, 12, 25, .38);
  --radius: 14px;
  --radius-sm: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Lato, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 460px);
  background-color: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
.shell { max-width: 1380px; margin: 0 auto; padding: 40px 32px 56px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr); gap: 28px; align-items: stretch; margin-bottom: 28px; }
h1 { font-size: clamp(34px, 5vw, 58px); line-height: 1.02; margin: 6px 0 14px; letter-spacing: -0.02em; font-weight: 900; }
h2 { margin: 0; font-size: 21px; letter-spacing: -0.01em; font-weight: 700; }
h3 { margin: 0 0 8px; font-size: 16px; font-weight: 700; }
p { color: var(--muted); line-height: 1.6; }
.sub { font-size: 18px; max-width: 640px; color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; color: var(--accent); font-weight: 700; margin: 0 0 8px; }

.goal-card, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.goal-card { padding: 26px; }
.goal-card h2 { font-size: 26px; margin-bottom: 12px; }
.goal-card > p { color: #c4d2e3; }

.label, .pill { display: inline-flex; align-items: center; white-space: nowrap; border: 1px solid var(--line); background: var(--accent-soft); color: var(--accent); padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }

.grid { display: grid; grid-template-columns: 1.08fr 1.12fr .8fr; gap: 22px; align-items: start; }
.panel { padding: 22px; min-height: 300px; }
.coach-panel { min-height: 240px; display: flex; flex-direction: column; }
.visual-panel { min-height: 500px; }
.score-panel { min-height: 0; }
.side-col { display: flex; flex-direction: column; gap: 22px; }

.dataset-panel { min-height: 0; }
.dataset-tables { display: flex; flex-direction: column; gap: 12px; max-height: 460px; overflow: auto; padding-right: 4px; }
.ds-table { flex: 0 0 auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); overflow: hidden; }
.ds-table > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 13px; font-weight: 700; color: var(--text); font-size: 14px; }
.ds-table > summary > span:first-of-type { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-table > summary .ds-rows { flex: 0 0 auto; }
.ds-table > summary::-webkit-details-marker { display: none; }
.ds-table > summary::before { content: "▸"; color: var(--accent); font-size: 11px; margin-right: 2px; transition: transform .15s ease; display: inline-block; }
.ds-table[open] > summary::before { transform: rotate(90deg); }
.ds-table .ds-rows { color: var(--muted); font-weight: 400; font-size: 12px; white-space: nowrap; }
.ds-cols { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 13px 13px; }
.ds-col { display: inline-flex; align-items: baseline; gap: 5px; background: #0b1d33; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; font-size: 12px; color: var(--text); }
.ds-col .ds-type { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.ds-col.ds-missing { border-color: rgba(246, 195, 88, .4); }
.ds-col .ds-warn { color: var(--warn); font-size: 10px; }

.head-actions { display: flex; align-items: center; gap: 10px; }
.fold-btn { background: transparent; color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 700; }
.fold-btn:hover { background: var(--accent-soft); }
.score-body { display: block; }
#scorePanel.folded .score-body { display: none; }
#scorePanel.folded { min-height: 0; }
.report-panel { grid-column: 1 / -1; }
.panel-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 18px; }
.panel-head > div:first-child { flex: 1; min-width: 0; }
.panel-head .eyebrow { white-space: nowrap; }

button { border: 0; border-radius: var(--radius-sm); padding: 12px 18px; background: var(--accent); color: #fff; font-weight: 700; font-size: 14px; cursor: pointer; transition: background .15s ease, transform .05s ease; }
button:hover { background: var(--accent-strong); }
button:active { transform: translateY(1px); }
button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
button.secondary:hover { background: var(--accent-soft); }
button.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); font-weight: 700; }
button.ghost:hover { background: var(--accent-soft); }
button:disabled, input:disabled { opacity: .6; cursor: not-allowed; }

.principle-box, .starter-box { background: var(--panel-2); padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); margin-bottom: 14px; }
.principle-box p, .starter-box p { margin: 0; font-size: 14px; }
.principle-box strong { color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; font-size: 13px; font-weight: 700; cursor: pointer; transition: background .15s ease; }
.chip:hover { background: rgba(47, 155, 244, .24); }

.session-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 18px; }
.session-actions button { margin-top: 0; }

.chat { flex: 1; overflow: auto; padding-right: 4px; margin-top: 16px; }
.turn { margin-bottom: 6px; }
.turn + .turn { border-top: 1px solid var(--line); padding-top: 12px; }
.msg { padding: 15px 16px; border-radius: var(--radius-sm); margin-bottom: 12px; border: 1px solid var(--line); }
.msg.user { background: var(--accent-soft); border-color: rgba(47, 155, 244, .35); }
.msg.coach { background: var(--panel-2); }
.msg strong { color: var(--text); }

.ask-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 0; }
input { width: 100%; padding: 13px 16px; border-radius: var(--radius-sm); background: #0b1d33; border: 1px solid var(--line); color: var(--text); font-size: 15px; font-family: inherit; transition: border-color .15s ease, box-shadow .15s ease; }
input::placeholder { color: #6d8199; }
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.chart { min-height: 300px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 20px; display: grid; place-items: center; overflow: hidden; }
.chart.empty { text-align: center; }
.chart svg { width: 100%; max-height: 340px; }
.insight { margin-top: 16px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; }
.insight:empty { display: none; }
.insight p { margin: 8px 0 0; }

.rubric { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 38px; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); }
.bar-track { height: 9px; background: #0b1d33; border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; }

.score-badge { display: inline-grid; place-items: center; min-width: 48px; height: 48px; border-radius: 50%; background: var(--accent-soft); border: 1px solid var(--accent); font-weight: 900; color: var(--accent); }
.score-badge.large { min-width: 72px; height: 72px; font-size: 24px; }

.history-wrap { margin-top: 24px; }
#history { padding-left: 20px; color: var(--muted); }
#history li { margin-bottom: 9px; }

.hidden { display: none; }
.report-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.report-card { background: var(--panel-2); border: 1px solid var(--line); padding: 18px; border-radius: var(--radius-sm); }
.report-card ul { color: var(--muted); padding-left: 20px; }
.kpi { font-size: 38px; font-weight: 900; letter-spacing: -0.03em; color: var(--text); }

@media (max-width: 1100px) { .grid, .hero { grid-template-columns: 1fr; } .report-grid { grid-template-columns: 1fr; } }

.ai-note { color: #7d93ab; font-size: 0.88rem; margin-top: 0.75rem; }

.stage-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0; }
.stage-toggle button { padding: 11px 12px; font-size: 13px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.stage-toggle button:hover { color: var(--text); }
.stage-toggle button.active { background: var(--accent); color: #fff; border-color: transparent; }
.stage-now { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; margin: 12px 0 0; }
.stage-now strong { color: var(--text); }

.pill.subtle { color: var(--muted); background: transparent; }
.table-wrap { width: 100%; max-height: 330px; overflow: auto; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table-wrap th, .table-wrap td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.table-wrap th { color: var(--text); position: sticky; top: 0; background: var(--panel-2); }
.table-wrap td:first-child, .table-wrap td:nth-child(2), .table-wrap td:nth-child(3) { color: var(--text); }
.muted { color: var(--muted); font-size: 13px; }
ul { color: var(--muted); line-height: 1.6; }
.pill.warning { color: var(--warn); border-color: rgba(246, 195, 88, .45); background: rgba(246, 195, 88, .1); }
