/* Coach Console dashboard. Black and white only. */

:root {
  --ink: #000;
  --paper: #fff;
  --grey-1: #111;
  --grey-2: #555;
  --grey-3: #767676;
  --line: #e4e4e4;
  --tint: #f6f6f6;
  --on-ink-2: #bbb;
  --inv-track: #333;
  --gutter: 16px;
}

/* Dark mode: follows the system setting. Black and white swap. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #fff;
    --paper: #0a0a0a;
    --grey-1: #eee;
    --grey-2: #aaa;
    --grey-3: #777;
    --line: #2a2a2a;
    --tint: #111;
    --on-ink-2: #555;
    --inv-track: #ccc;
  }
}
:root[data-theme="dark"] {
  --ink: #fff;
  --paper: #0a0a0a;
  --grey-1: #eee;
  --grey-2: #aaa;
  --grey-3: #777;
  --line: #2a2a2a;
  --tint: #111;
  --on-ink-2: #555;
  --inv-track: #ccc;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Header ---------- */

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 32px var(--gutter) 24px;
  max-width: 1100px;
  margin: 0 auto;
  border-bottom: 1px solid var(--ink);
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--grey-2);
}

h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.picker {
  display: flex;
  align-items: center;
  gap: 12px;
}

.picker label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--grey-2);
}

select {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 0;
  padding: 8px 36px 8px 12px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%),
    linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

select:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* ---------- Layout ---------- */

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px var(--gutter) 48px;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(12, 1fr);
}

.card {
  border: 1px solid var(--line);
  padding: 20px;
  background: var(--paper);
  min-width: 0;
}

.card h2 {
  margin: 0 0 16px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--grey-2);
}

.span-12 { grid-column: span 12; }

/* ---------- Summary card ---------- */

.summary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
}

.summary h2 {
  color: var(--on-ink-2);
}

.score {
  font-size: 72px;
  line-height: 1;
  font-weight: 300;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.score small {
  font-size: 20px;
  color: var(--on-ink-2);
  font-weight: 400;
}

.meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 0;
}

.meta dt {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--on-ink-2);
}

.meta dd {
  margin: 2px 0 0;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.pass-bar {
  position: relative;
  height: 6px;
  background: var(--inv-track);
}

.pass-bar .fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--paper);
}

.pass-bar .mark {
  position: absolute;
  top: -6px;
  bottom: -6px;
  width: 1px;
  background: var(--paper);
}

.pass-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--on-ink-2);
  margin-top: 8px;
}

/* ---------- Bars (skills and traits) ---------- */

.rows {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.row-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
}

.row-name {
  font-weight: 600;
}

.row-value {
  font-variant-numeric: tabular-nums;
  color: var(--grey-1);
}

.row-value span {
  color: var(--grey-3);
}

.track {
  position: relative;
  height: 8px;
  background: var(--tint);
  border: 1px solid var(--line);
}

.track .fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--ink);
}

.track.is-locked .fill {
  background: repeating-linear-gradient(
    45deg,
    var(--ink) 0 2px,
    var(--paper) 2px 5px
  );
}

.focus-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  border: 1px solid var(--ink);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  vertical-align: middle;
}

.note {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--grey-2);
}

.note strong {
  color: var(--ink);
}

.unit {
  font-size: 14px;
  color: var(--grey-3);
}

/* ---------- Trend chart ---------- */

.chart {
  width: 100%;
  height: auto;
  display: block;
}

.chart .grid {
  stroke: var(--line);
  stroke-width: 1;
}

.chart .pass {
  stroke: var(--ink);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.chart .trend {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
}

.chart .dot {
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 2;
}

.chart text {
  fill: var(--grey-2);
  font-size: 11px;
  font-family: inherit;
}

/* ---------- Status lights ---------- */

.light {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.light.red { background: var(--paper); }

/* ---------- Checkpoint table ---------- */

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}

th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--grey-2);
  border-bottom: 1px solid var(--ink);
}

td.num,
th.num {
  text-align: right;
}

tr:last-child td {
  border-bottom: 0;
}

.table-wrap {
  overflow-x: auto;
}

/* ---------- Footer ---------- */

footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--gutter) 32px;
  font-size: 12px;
  color: var(--grey-3);
}

/* ---------- Tablet and phone ---------- */

@media (max-width: 560px) {
  h1 {
    font-size: 24px;
  }

  .score {
    font-size: 56px;
  }

  .card {
    padding: 16px;
  }

}

/* ---------- Coach Console screens (Members, Monthly assessment, Backup, Help) ----------
   The console's own stylesheet is loaded first. These rules repaint it in the black and white look above. */

:root {
  --bg: #fff; --fg: #000; --mut: #555; --line: #e4e4e4; --panel: #f6f6f6;
  --lime: #e4e4e4; --blue: #000; --blue-ink: #000; --on-lime: #000; --head: #fff; --head-fg: #000;
  --good: #000; --good-bg: #f6f6f6; --warn: #000; --warn-bg: #f6f6f6; --bad: #000; --bad-bg: #f6f6f6;
  --range: #999; --strip: #f6f6f6; --hm-none: #e4e4e4; --hm-ok: #000; --hm-miss: #999; --hm-p2: #555; --hm-lv: #000;
  --display: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --body: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0a; --fg: #fff; --mut: #aaa; --line: #2a2a2a; --panel: #111;
    --lime: #2a2a2a; --blue: #fff; --blue-ink: #fff; --on-lime: #fff; --head: #0a0a0a; --head-fg: #fff;
    --good: #fff; --good-bg: #111; --warn: #fff; --warn-bg: #111; --bad: #fff; --bad-bg: #111;
    --range: #999; --strip: #111; --hm-none: #2a2a2a; --hm-ok: #fff; --hm-miss: #999; --hm-p2: #aaa; --hm-lv: #fff;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0a0a; --fg: #fff; --mut: #aaa; --line: #2a2a2a; --panel: #111;
  --lime: #2a2a2a; --blue: #fff; --blue-ink: #fff; --on-lime: #fff; --head: #0a0a0a; --head-fg: #fff;
  --good: #fff; --good-bg: #111; --warn: #fff; --warn-bg: #111; --bad: #fff; --bad-bg: #111;
  --range: #999; --strip: #111; --hm-none: #2a2a2a; --hm-ok: #fff; --hm-miss: #999; --hm-p2: #aaa; --hm-lv: #fff;
}

/* Which block shows: the dashboard or the console */
body[data-view="dash"] #view,
body[data-view="dash"] #consoleBar,
body[data-view="console"] #app,
body[data-view="console"] .picker { display: none; }

/* On Progress, the console's own tab (kept selected in the background) must not look selected too */
body[data-view="dash"] #tabs button[aria-selected="true"] { color: var(--grey-2); border-bottom-color: transparent; }

.tabs-in { display: flex; align-items: stretch; }
.tabs-list { display: flex; overflow-x: auto; }
.tabs-in > #dashTab { border: 0; background: none; color: var(--grey-2); padding: 13px 14px 11px; font: 600 13px/1 var(--body); border-bottom: 3px solid transparent; white-space: nowrap; cursor: pointer; }
.tabs-in > #dashTab[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }

#view {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px var(--gutter) 48px;
  display: grid;
  gap: 16px;
}

.console-bar {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px var(--gutter) 0;
}

.console-bar label { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--grey-2); }

.console-bar .chip-day { background: var(--ink); color: var(--paper); padding: 4px 10px; font-size: 12px; font-weight: 600; }

.console-bar button.sync { padding: 6px 12px; font-size: 12px; }

#toast { background: var(--ink); color: var(--paper); }

.card h2, #view h2 { font-family: inherit; text-transform: none; }
#view .card h2 { font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--grey-2); margin: 0 0 12px; }
#view h3 { font-size: 15px; }
#app .card h2 { text-transform: uppercase; }
#app > .empty { grid-column: span 12; }

/* ---------- Speaking Score: radar + English and Confidence in one box ---------- */

.radar { width: 100%; height: auto; display: block; }
.r-grid { fill: none; stroke: var(--line); }
.r-axis { stroke: var(--line); }
.r-shape { fill: var(--ink); fill-opacity: 0.12; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.r-dot { fill: #fff; stroke: var(--ink); stroke-width: 1.5; }
.r-lab { fill: var(--grey-1); font-size: 13px; }
.r-val { fill: var(--ink); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.r-conf { fill: var(--hm-p2); fill-opacity: 0.18; stroke: var(--hm-p2); stroke-width: 1.5; stroke-linejoin: round; }
.r-level2 { fill: none; stroke: var(--line); stroke-width: 1; stroke-dasharray: 6 5; }
.r-lvl { fill: var(--grey-2); font-size: 12px; font-weight: 600; letter-spacing: 0.04em; }
.r-sub { fill: var(--grey-2); font-size: 11px; }
.r-dot-c { fill: var(--ink); }
.r-val-c { fill: var(--grey-1); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Radar card: the chart fills the card and is centred, with a legend underneath */
.radar-card { display: flex; flex-direction: column; }
.radar-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 8px 0; }
.radar-wrap .radar { max-width: 600px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: center; margin-top: 8px; font-size: 12px; color: var(--grey-2); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { display: inline-block; width: 22px; border-top: 2px solid var(--ink); }
.legend i.conf { border-top-color: var(--hm-p2); }
.legend i.dash { border-top: 1.5px dashed var(--ink); }

/* Overview grid. Desktop: radar and bars on row 1; Speaking Score and trend on row 2, sharing a bottom edge.
   Phone: one column in the same order. */
.overview {
  grid-column: span 12;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  grid-template-areas: "radar bars" "summary trend";
  gap: 16px;
  align-items: stretch;
}

.overview > * { min-width: 0; }
.radar-card { grid-area: radar; }
.speaking { grid-area: bars; }
.summary { grid-area: summary; }
.trend { grid-area: trend; }

/* Speaking Score box */
.summary { padding: 16px 18px; gap: 16px; }
.summary .score { font-size: 52px; }

/* Trend fills its box */
.trend { display: flex; flex-direction: column; }
.trend .chart { width: 100%; height: 100%; flex: 1; min-height: 0; }

/* Bars box: each English skill sits in the same row as the confidence trait it unlocks */
.speaking { display: flex; flex-direction: column; padding: 16px 18px; }
.pairs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px 22px; align-content: start; }
.pairs-head { font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--grey-2); }
.pair { min-width: 0; }
.speaking .note { font-size: 12px; line-height: 1.35; margin-top: 4px; }

@media (max-width: 900px) {
  .overview {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "radar" "summary" "bars" "trend";
  }
}

@media (max-width: 560px) {
  .pairs { grid-template-columns: minmax(0, 1fr); }
  /* One column mixes skills and traits, so the two column headings no longer fit */
  .pairs-head { display: none; }
  /* Phone: the radar shrinks to about 70%, so its text is drawn larger */
  .radar { overflow: visible; }
  .r-lab { font-size: 17px; }
  .r-sub, .r-val-c { font-size: 14px; }
  .r-val, .r-lvl { font-size: 14px; }
}

#cbText { min-height: 200px; }

/* ---------- Monthly assessment: compact, not stretched ---------- */
#view .grid2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 14px; }
#view .srow2 { padding: 5px 0; gap: 8px; }
#view .confgrid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; align-items: start; }
#view .confcell { border: 1px solid var(--line); padding: 6px 8px; min-width: 0; }
#view .confcell.locked { opacity: .6; }
#view .confcell .beh-head { gap: 8px; margin-bottom: 4px; }
#view .confcell .none-btn { margin-left: auto; padding: 2px 8px; font-size: 11px; }
#view .beh-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
#view .beh-grid .beh { font-size: 12px; padding: 3px 6px; gap: 6px; align-items: center; }
#view .beh-grid .beh input { margin: 0; }
#view .beh-item { display: flex; align-items: center; gap: 4px; }
#view .beh-item .beh { flex: 1; min-width: 0; }
#view .beh-item .na-btn { padding: 1px 6px; font-size: 10px; white-space: nowrap; opacity: .7; }
#view .beh-item .na-btn.on { opacity: 1; font-weight: 600; }
#view .beh-item.na .beh { opacity: .45; text-decoration: line-through; }
#view .desk { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
#view .desk-video { position: sticky; top: 64px; display: grid; gap: 8px; z-index: 2; border: 1px solid var(--line); background: var(--paper, #fff); padding: 12px; }
#view .desk-video .lab { margin: 0; }
#view .desk #recplay { min-height: 220px; }
#view .desk-side { display: grid; gap: 12px; min-width: 0; }
#view .desk #recplay video { width: 100%; max-width: 100%; max-height: 70vh !important; background: #000; display: block; }
#view .desk .beh-grid { grid-template-columns: minmax(0, 1fr); gap: 2px; }
@media (max-width: 900px) { #view .desk { grid-template-columns: minmax(0, 1fr); } #view .desk-video { position: static; } #view .desk #recplay video { max-height: 40vh !important; } }
#view .confcell .srow2 { border: 0; padding: 0; }
#view .confcell .conf-desc { margin: 6px 0 0; }
#view .beh { padding: 4px 6px; gap: 8px; }
#view .vbig .vgrid { grid-template-columns: minmax(0, 480px); }
#view #recplay video { max-height: 240px; width: auto; max-width: 100%; display: block; }
#view .srtbox { max-height: 200px; }
#view .card .how, #view .card ol.how { max-width: 90ch; }
#view textarea#msgA { min-height: 150px !important; }

/* Black-and-white theme: text colours that were fixed black/white vanished on the grey/white fills */
.pill.lime { background: var(--lime); color: var(--on-lime); }
.pill.blue { background: var(--blue); color: var(--bg); }
button.p:hover { background: var(--blue); color: var(--bg); border-color: var(--blue); }
.ctr .tap:hover, .toc a:hover { background: var(--lime); color: var(--on-lime); }
.chip-day { background: var(--fg); color: var(--bg); }

.sw.on button.tog, button.sync.blue, button.sync.blue:hover { color: var(--bg); }

/* ---------- Progress entrance animation ---------- */
@media (prefers-reduced-motion: no-preference) {
  .enter .r-shape { transform-box: view-box; transform-origin: 260px 220px; animation: radarGrow .5s ease-out both; }
  .enter .r-dot { animation: fadeIn .3s ease-out .4s both; }
  .enter .track .fill, .enter .pass-bar .fill { transform-origin: left; animation: barFill .8s ease-out both; }
}
@keyframes radarGrow { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes barFill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Monthly: red band on wrong-grammar sentences ---------- */
.srow.no { box-shadow: inset 3px 0 0 #e5484d; }

/* ---------- Monthly: step-by-step hidden behind a ? button ---------- */
#view .card { position: relative; }
.how-tip { position: absolute; top: 12px; right: 12px; margin: 0; z-index: 5; }
.how-tip summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border: 1px solid var(--line); border-radius: 50%; font: 600 12px/1 var(--body); color: var(--mut); user-select: none; }
.how-tip summary::-webkit-details-marker { display: none; }
.how-tip summary:hover, .how-tip[open] summary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.how-tip .how { position: absolute; top: 28px; right: 0; width: min(520px, 80vw); margin: 0; box-shadow: 0 4px 16px rgba(0,0,0,.18); }

/* Radar point values show only on hover */
.r-hit { fill: transparent; }
.r-pt .r-val { opacity: 0; pointer-events: none; transition: opacity .15s; }
.r-pt:hover .r-val { opacity: 1; }

/* Progress: breathing room under the tabs */
#app { padding-top: 40px; }

/* Logo, Google button icon and a thin green stripe under the header */
.eyebrow.brand { display: flex; align-items: center; gap: 8px; }
.brand-icon { display: block; width: 44px; height: 44px; }
button#googleBtn, button#fbIn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.gicon { display: inline-flex; background: #fff; border-radius: 3px; padding: 3px; }
.top { box-shadow: 0 3px 0 #C5FF7A; }
button.p:hover { background: #4574B8; color: #fff; border-color: #4574B8; opacity: 1; }

/* Light / dark toggle button */
button.theme { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); background: var(--paper); color: var(--ink); }
button.theme:hover { border-color: var(--ink); background: var(--paper); }
button.theme svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
button.theme-corner { position: fixed; top: 16px; right: 16px; }
.top-r { display: flex; align-items: center; gap: 12px; }

/* ---------- Loading screen: simple "Loading" text, then fades into the page ---------- */
#loader { position: fixed; inset: 0; z-index: 100; background: var(--paper); color: var(--ink); display: grid; place-items: center; font-size: 13px; letter-spacing: 0.2em; text-transform: uppercase; transition: opacity .5s ease, visibility 0s linear .5s; }
#loader.done { opacity: 0; visibility: hidden; pointer-events: none; }
/* If the page scripts never start, don't leave the screen covered forever */
#loader { animation: loaderGiveUp .5s ease 12s forwards; }
@keyframes loaderGiveUp { to { opacity: 0; visibility: hidden; } }

/* Log out matches the light/dark button's height so their top and bottom edges line up */
.top-r #logoutBtn, .top-r #switchBtn { height: 36px; padding-top: 0; padding-bottom: 0; }
