/* plan.css — see docs/LEARNING.md §6.3. Brand tokens from app.css only; everything works at 360 px.
   Prefixes: .plan-* Home "Today's plan" card · .tst-* self-serve practice tests (#/tests) ·
   .rp-work-* "Skills to work on" on the student score report (inside .rp, so the report palette applies). */

/* `hidden` must win over component display rules. */
.tst [hidden] { display: none !important; }

/* =========================================================================
   Home: Today's plan
   ========================================================================= */
.plan-slot { margin: 0 0 24px; }
.plan-slot:empty { display: none; }
.plan { overflow: hidden; }
.plan-loading .spinner-wrap { padding: 28px 16px; }
.plan-error-body { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; }

.plan-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--brand-soft), var(--card));
}
.plan-head-text { min-width: 0; }
.plan-title { font-size: 20px; font-weight: 800; letter-spacing: -.01em; margin: 0; }
.plan-date { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.plan-streak { display: inline-flex; align-items: center; gap: 10px; max-width: 100%; min-width: 0; padding: 5px 14px 5px 5px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.plan-streak-icon { flex: none; width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--fill); color: var(--muted); }
.plan-streak:not(.is-zero) .plan-streak-icon { background: var(--brand-soft); color: var(--brand-dark); }
.plan-streak.is-active .plan-streak-icon { background: var(--brand); color: #fff; }
.plan-streak-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.plan-streak-text strong { font-size: 14px; }
.plan-streak-hint { font-size: 12px; color: var(--muted); }

.plan-body { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.plan-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; padding: 18px; }
.plan-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; padding: 18px; border-left: 1px solid var(--line); background: #fcfcfd; }
@media (max-width: 860px) {
  .plan-body { grid-template-columns: minmax(0, 1fr); }
  .plan-side { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 480px) {
  .plan-head, .plan-main, .plan-side { padding-left: 14px; padding-right: 14px; }
}

/* today's progress */
.plan-today { display: flex; flex-direction: column; gap: 6px; }
.plan-today-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; }
.plan-today-label { font-weight: 700; font-size: 14px; }
.plan-today-value { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.plan-today-value strong { font-size: 18px; color: var(--ink); }
.plan-progress { height: 10px; }
.plan-today.is-met .plan-progress > span { background: var(--ok); }
.plan-today-sub { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.plan-today.is-met .plan-today-sub { color: var(--ok-text); font-weight: 600; }

/* steps */
.plan-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.plan-step { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.plan-step.is-next { border-color: #ffc6ae; background: var(--brand-soft); }
.plan-step.is-done { background: var(--surface-2); }
.plan-step-mark { flex: none; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--fill); color: var(--muted); font-weight: 800; font-size: 14px; }
.plan-step.is-next .plan-step-mark { background: var(--brand); color: #fff; }
.plan-step.is-done .plan-step-mark { background: var(--ok); color: var(--on-status); }
.plan-step-body { flex: 1 1 0; min-width: 0; }
.plan-step-title { font-weight: 700; overflow-wrap: anywhere; }
.plan-step.is-done .plan-step-title { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.plan-step-detail { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.plan-step-btn { flex: none; }
@media (max-width: 480px) {
  /* The button moves under the text (aligned with it) instead of squeezing it. */
  .plan-step-body { flex-basis: calc(100% - 42px); }
  .plan-step-btn { margin-left: 42px; }
}
.plan-none { margin: 0; }
.plan-alldone { display: flex; align-items: center; gap: 8px; margin: 0; }
.plan-alldone .icon { flex: none; }

/* side: goal, stats, focus skills */
.plan-sub { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0; }
.plan-goal { display: flex; flex-direction: column; gap: 6px; }
.plan-goal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plan-goal-head .btn { margin-right: -8px; }
.plan-goal-score { display: flex; align-items: baseline; gap: 8px; }
.plan-goal-num { font-size: 36px; font-weight: 800; line-height: 1.1; letter-spacing: -.03em; color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.plan-goal-unit { font-size: 13px; font-weight: 600; color: var(--muted); }
.plan-goal-gap { margin: 0; font-size: 13px; color: var(--muted); }
.plan-goal-meta { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.plan-goal-meta li { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.plan-goal-meta li > .icon { flex: none; margin-top: 2px; color: var(--muted); }
.plan-goal-meta li > span { min-width: 0; overflow-wrap: anywhere; }
.plan-countdown { display: block; color: var(--brand-dark); }
.plan-countdown.is-past { color: #9a6700; }
.plan-linklike { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--brand-dark); text-decoration: underline; cursor: pointer; }

.plan-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.plan-stat { display: flex; flex-direction: column; gap: 1px; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: inherit; text-decoration: none; }
a.plan-stat:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.plan-stat-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.plan-stat-value { font-size: 22px; font-weight: 800; line-height: 1.2; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.plan-stat-sub { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.plan-stat.is-attn { border-color: #f3c27a; background: var(--warn-soft); }
.plan-stat.is-attn .plan-stat-value { color: var(--warn-text); }

.plan-focus { display: flex; flex-direction: column; gap: 4px; }
.plan-focus-list { list-style: none; margin: 0; padding: 0; }
.plan-focus-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.plan-focus-item:last-child { border-bottom: 0; }
.plan-focus-main { display: flex; flex-direction: column; flex: 1 1 150px; min-width: 0; }
.plan-focus-skill { font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }
.plan-focus-meta { font-size: 12px; color: var(--muted); }
.plan-focus-links { display: flex; gap: 2px; flex: none; margin-right: -8px; }
.plan-focus-links .btn { padding: 0 8px; }

/* goal dialog (rendered in the modal, outside .home) */
.plan-goal-form .input-group .btn { flex: none; }
.plan-goal-form .notice { margin: 0; }

/* Home intro / empty-state actions */
.home-intro-actions { gap: 8px; }
.home-empty-actions { justify-content: center; gap: 8px; }

/* =========================================================================
   #/tests — self-serve practice tests
   ========================================================================= */
.tst-tip { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 16px; }
.tst-tip .icon { flex: none; margin-top: 2px; }
.tst-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 860px) { .tst-list { grid-template-columns: minmax(0, 1fr); } }
.tst-card { display: flex; flex-direction: column; scroll-margin-top: 80px; }
.tst-card.is-target { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(252, 91, 32, .18), var(--shadow); }
.tst-body { display: flex; flex-direction: column; gap: 10px; }
.tst-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.tst-title { font-size: 18px; margin: 0; overflow-wrap: anywhere; }
.tst-desc { margin: 0; font-size: 14px; }
.tst-meta { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.tst-meta li { display: inline-flex; align-items: center; gap: 5px; }
.tst-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 4px; }
.tst-score-pill { background: var(--bg); border-radius: 999px; padding: 1px 8px; font-size: 13px; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .tst-actions .btn { flex: 1 1 auto; } }

.tst-history { margin-top: 2px; padding-top: 10px; border-top: 1px solid var(--line); }
.tst-history-h { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 4px; }
.tst-atts { list-style: none; margin: 0; padding: 0; }
.tst-atts li + li { border-top: 1px solid var(--line); }
.tst-att { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 4px; border-radius: 8px; color: inherit; text-decoration: none; }
a.tst-att:hover { background: var(--surface-2); }
.tst-att-main { display: flex; flex-direction: column; min-width: 0; }
.tst-att-date { font-size: 14px; font-weight: 600; }
.tst-att-sub { font-size: 12px; color: var(--muted); }
.tst-att-side { display: flex; align-items: center; gap: 6px; flex: none; }
.tst-att-score { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tst-more { margin-top: 4px; }

/* start dialog (rendered in the modal, outside .tst) */
.tst-start-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.tst-timing { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.tst-timing > legend { padding: 0; margin-bottom: 8px; }
.tst-timing-opt { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer; transition: border-color .15s, background .15s; }
.tst-timing-opt:hover { border-color: var(--line-strong); }
.tst-timing-opt input { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--brand); }
.tst-timing-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.tst-timing-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tst-timing-title { font-weight: 700; font-size: 15px; }
.tst-timing-desc { font-size: 13px; color: var(--muted); }

/* =========================================================================
   Score report (student): Skills to work on
   ========================================================================= */
.rp-work { margin-top: 40px; }
.rp-work-h { font-size: 24px; font-weight: 700; margin: 0 0 4px; }
.rp-work-intro { margin: 0 0 12px; font-size: 16px; }
.rp-work-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--cb-line); }
.rp-work-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 12px 0; border-bottom: 1px solid var(--cb-line); }
.rp-work-main { display: flex; flex-direction: column; flex: 1 1 240px; min-width: 0; }
.rp-work-skill { font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
.rp-work-meta { font-size: 13px; color: var(--cb-muted); }
.rp-work-links { display: flex; flex-wrap: wrap; gap: 8px; }
.rp-work-link {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 6px 18px;
  border: 1px solid var(--cb-ink); border-radius: 999px; background: var(--card); color: var(--cb-ink);
  font-size: 14px; font-weight: 700; text-decoration: none; white-space: nowrap;
}
.rp-work-link:hover { background: var(--cb-gray); }
@media (max-width: 640px) {
  .rp-work { margin-top: 28px; }
  .rp-work-h { font-size: 20px; }
  .rp-work-links { width: 100%; }
  .rp-work-link { flex: 1 1 0; }
}

/* ---------- Dark theme ---------- */
/* a done step fades toward the page (in dark --surface-2 is lighter than a card, so it would look raised) */
:root[data-theme="dark"] .plan-step.is-done { background: var(--bg); }
:root[data-theme="dark"] .tst-card.is-target { box-shadow: 0 0 0 3px var(--brand-line), var(--shadow); }
:root[data-theme="dark"] .plan-side { background: var(--surface-2); }
:root[data-theme="dark"] .plan-step.is-next { border-color: var(--brand-line); }
:root[data-theme="dark"] .plan-countdown.is-past { color: var(--warn-text); }
:root[data-theme="dark"] .plan-stat.is-attn { border-color: var(--warn-line); }
/* The rule above out-ranks a.plan-stat:hover, which wins over .is-attn in light. */
:root[data-theme="dark"] a.plan-stat.is-attn:hover { border-color: var(--line-strong); }
