/* tutor.css — the tutor-facing screens. */

/* Role picker */

.role-picker { display: inline-flex; }
.role-picker__select {
  min-height: 36px;
  padding: 2px var(--sp-2);
  font: inherit;
  font-size: .875rem;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 999px;
}
body[data-role="tutor"] .role-picker__select {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* Shared */

.grid--two { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.plain-list { margin: var(--sp-1) 0 0; padding: 0; list-style: none; }

.stat--hours { text-align: left; }
.stat__unit {
  margin-left: 2px;
  font-size: .9375rem;
  font-weight: 550;
  color: var(--ink-faint);
  letter-spacing: 0;
}

/* Next class */

.next-class { margin-bottom: var(--sp-4); border-left: 3px solid var(--accent); }
.next-class--empty { border-left-color: var(--line); }

.next-class__who {
  display: flex; align-items: center; gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.next-class__name {
  font-size: 1.25rem; font-weight: 680;
  color: var(--ink); text-decoration: none;
}
.next-class__name:hover { text-decoration: underline; }

.next-class__clocks {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-4);
  padding: var(--sp-4);
  background: var(--paper-3);
  border-radius: var(--r-md);
}
.next-class__clock { flex: 1 1 150px; }
.next-class__eq { flex: none; font-size: 1.25rem; color: var(--ink-faint); }
.next-class__weekday { font-size: 1rem; font-weight: 650; }
.next-class__time {
  font-size: 1.875rem; font-weight: 680; line-height: 1.15; letter-spacing: -.02em;
}

.next-class__actions { margin-top: var(--sp-4); }

.next-class__last {
  display: flex; flex-direction: column; gap: var(--sp-3);
  margin-top: var(--sp-4); padding-top: var(--sp-4);
  border-top: 1px solid var(--line);
}
.next-class__homework {
  margin: 2px 0 0;
  font-size: 1.0625rem;
  font-weight: 550;
}

/* The nudge — a list, never a countdown */

.nudge { margin-bottom: var(--sp-4); border-left: 3px solid var(--warn); }
.nudge__list { margin: var(--sp-3) 0 0; padding: 0; list-style: none; }
.nudge__item {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) 0;
}
.nudge__item + .nudge__item { border-top: 1px solid var(--line); }
.nudge__when { font-size: .9375rem; font-weight: 550; }
.nudge__who { flex: 1; font-size: .9375rem; color: var(--ink-soft); }

/* Hours */

.hours-block { margin-bottom: var(--sp-5); }

.breakdown { margin-top: var(--sp-4); }
.breakdown__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.breakdown__part {
  padding: var(--sp-3);
  background: var(--paper-2);
  border-radius: var(--r-md);
}
.breakdown__part.is-total { background: var(--accent-soft); }
.breakdown__value { display: block; font-size: 1.5rem; font-weight: 680; }
.breakdown__label { font-size: .8125rem; color: var(--ink-soft); }

.export-panel { margin-top: var(--sp-4); border-left: 3px solid var(--good); }
.export-panel__actions { margin-top: var(--sp-3); }
.period-select {
  min-height: 44px; padding: var(--sp-2) var(--sp-3);
  font: inherit; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md);
}

/* Student tiles */

.students-block { margin-top: var(--sp-5); }
.student-tile { display: flex; flex-direction: column; gap: var(--sp-2); }
.student-tile__name {
  font-size: 1.0625rem; font-weight: 650;
  color: var(--ink); text-decoration: none;
}
.student-tile__name:hover { text-decoration: underline; }
.student-tile__tags { gap: var(--sp-1); }
.student-tile__row p { margin: 0; }
.student-tile__covered {
  padding: var(--sp-2);
  background: var(--paper-2);
  border-radius: var(--r-sm);
}
.student-tile__actions { margin-top: auto; padding-top: var(--sp-2); }

/* Student page */

.student-head {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.student-head h1 { margin: 0; }
.student-head__actions { margin-left: auto; }
.student-windows { margin-top: var(--sp-3); }

.handover { border-left: 3px solid var(--accent); }
.handover__body { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-3); }
.handover__body p { margin: 2px 0 0; }

.history { margin: var(--sp-3) 0 0; padding: 0; list-style: none; }
.history__item {
  display: flex; flex-wrap: wrap; gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-top: 1px solid var(--line);
}
.history__item:first-child { border-top: none; }
.history__item.is-missed { opacity: .65; }
.history__when { flex: 0 0 auto; min-width: 130px; }
.history__date { display: block; font-size: .9375rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.history__body { flex: 1 1 260px; }
.history__covered { margin: 0 0 var(--sp-1); }
.history__tag {
  font-size: .75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--ink-faint);
}

/* Availability */

.accepting { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.accepting.is-off { border-left: 3px solid var(--line); }
.accepting.is-on { border-left: 3px solid var(--good); }

.switch {
  display: inline-flex; align-items: center; gap: var(--sp-3);
  min-height: 44px; padding: 0;
  font: inherit; font-weight: 600;
  color: var(--ink); background: none; border: none; cursor: pointer;
  text-align: left;
}
.switch__track {
  flex: none; position: relative;
  width: 48px; height: 28px;
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: background .15s ease, border-color .15s ease;
}
.switch__thumb {
  position: absolute; top: 2px; left: 2px;
  width: 22px; height: 22px;
  background: var(--paper);
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,.25);
  transition: transform .15s ease;
}
.switch[aria-checked="true"] .switch__track { background: var(--good); border-color: var(--good); }
.switch[aria-checked="true"] .switch__thumb { transform: translateX(20px); }

.avail-list { display: flex; flex-direction: column; gap: var(--sp-3); margin: var(--sp-3) 0; }
.avail-row {
  padding: var(--sp-3);
  background: var(--paper-2);
  border-radius: var(--r-md);
}
.avail-row__controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.avail-row__day { min-height: 44px; padding: var(--sp-1) var(--sp-2); font: inherit;
  color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); }
.avail-row__time { min-height: 44px; }
.avail-row__dash { color: var(--ink-faint); }
.avail-row__echo { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-top: var(--sp-2); }
.avail-actions { margin-top: var(--sp-3); }

/* ------------------------------------------------------------------ *
 * Log a session
 *
 * Sized to fit a 390x664 phone viewport with no scrolling. Every tap target
 * is at least 44px; the text inputs sit last so the keyboard covers nothing
 * that still needs a tap.
 * ------------------------------------------------------------------ */

.log-head { display: flex; align-items: flex-start; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.log-head__back {
  display: grid; place-items: center;
  width: 40px; height: 40px; flex: none;
  font-size: 1.25rem; color: var(--ink); text-decoration: none;
  border-radius: var(--r-md);
}
.log-head__back:hover { background: var(--paper-3); }
.log-head__title { margin: 0; font-size: 1.25rem; }
.log-head__sub { margin: 0; }

.log-form { display: flex; flex-direction: column; gap: var(--sp-3); }

.log-field { display: flex; flex-direction: column; gap: var(--sp-1); }
.log-field__label {
  font-size: .75rem; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-faint);
}

.log-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

.chip {
  flex: 1 1 auto;
  min-width: 56px; min-height: 48px;
  padding: var(--sp-2) var(--sp-3);
  font: inherit; font-size: 1rem; font-weight: 600;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background .1s ease, border-color .1s ease, color .1s ease;
}
.chip:hover { background: var(--paper-3); }
.chip[aria-pressed="true"] {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}
.log-chips--yesno .chip { min-height: 52px; font-size: 1.0625rem; }

.log-details { display: flex; flex-direction: column; gap: var(--sp-3); }
.log-details[data-hidden="true"] { display: none; }

.log-input {
  min-height: 48px;
  font-size: 1rem;
}

.log-total {
  display: flex; align-items: center; gap: var(--sp-2);
  margin: 0; color: var(--ink-soft);
}

.log-save { min-height: 54px; font-size: 1.0625rem; }

@media (max-width: 700px) {
  .next-class__eq { display: none; }
  .student-head__actions { margin-left: 0; width: 100%; }

  /*
   * Logging a session has a hard budget: it must complete without scrolling
   * on a small phone. On a 375x667 screen the shell alone costs about a fifth
   * of the viewport, so on this one screen the nav and footer stand down —
   * the form carries its own back arrow, and there is nothing else to do here.
   */
  body[data-screen="tutor-log"] .app-header,
  body[data-screen="tutor-log"] .app-footer { display: none; }
  body[data-screen="tutor-log"] .app-main { padding: var(--sp-3) var(--sp-3) var(--sp-4); }

  .log-form { gap: var(--sp-2); }
  .log-field { gap: 2px; }
  .log-field__label { font-size: .6875rem; }
  .log-head { margin-bottom: var(--sp-2); }
  .log-head__title { font-size: 1.125rem; }
  .chip { min-height: 44px; }
  .log-chips--yesno .chip { min-height: 48px; }
  .log-input { min-height: 44px; }
  .log-save { min-height: 50px; }
}

/* The printable verification record lives in the page but is only visible to
   the printer — see css/print.css. One source, so the paper cannot disagree
   with the screen. */
.cert { display: none; }

/* ------------------------------------------------------------------ *
 * Student / guardian
 *
 * Built for a phone on a slow connection: no images, no icon font, nothing
 * fetched. Type and spacing do all the work.
 * ------------------------------------------------------------------ */

.st-head { margin-bottom: var(--sp-4); }
.st-head h1 { margin-bottom: var(--sp-1); }

.st-next { border-left: 3px solid var(--accent); margin-bottom: var(--sp-4); }
.st-next__day { margin: 0; font-size: 1.125rem; font-weight: 650; }
.st-next__time {
  margin: 0;
  font-size: 2.5rem; font-weight: 700; line-height: 1.05; letter-spacing: -.02em;
}
.st-next__theirs { margin-top: var(--sp-2); }
.st-next__join { margin-top: var(--sp-3); }

.st-homework { border-left: 3px solid var(--good); margin-bottom: var(--sp-4); }
.st-homework.is-empty { border-left-color: var(--line); }
.st-homework__text { margin: 0 0 var(--sp-1); font-size: 1.125rem; font-weight: 550; }

.st-tutor { margin-bottom: var(--sp-4); }
.st-tutor__name { margin: 0 0 var(--sp-2); font-size: 1.125rem; font-weight: 650; }

.st-history { margin: var(--sp-2) 0 0; padding: 0; list-style: none; }
.st-history__item {
  display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3);
  padding: var(--sp-3) 0;
  border-top: 1px solid var(--line);
}
.st-history__item:first-child { border-top: none; }
.st-history__item.is-missed { opacity: .6; }
.st-history__date { flex: 0 0 auto; font-size: .875rem; font-weight: 600; color: var(--ink-soft); }
.st-history__item > div { flex: 1 1 200px; }
.st-history__covered { margin: 0 0 var(--sp-1); }

.gd-contact { border-left: 3px solid var(--warn); margin-top: var(--sp-4); }
.gd-fields { display: flex; flex-direction: column; gap: var(--sp-3); margin: var(--sp-3) 0; }
.gd-field { display: flex; flex-direction: column; gap: var(--sp-1); }
.gd-field__label { font-size: .8125rem; font-weight: 550; color: var(--ink-soft); }

/* ------------------------------------------------------------------ *
 * Matching
 * ------------------------------------------------------------------ */

.match-block { margin-bottom: var(--sp-6); }
.match-block > h2 { margin-bottom: var(--sp-1); }

.match-student__head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.match-student__name { margin: 0; font-size: 1.0625rem; }

.match-candidates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-3);
}

.match-candidate {
  display: flex; flex-direction: column; gap: var(--sp-3);
  padding: var(--sp-3);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.match-candidate.is-top { border-color: var(--accent); background: var(--accent-soft); }

.match-candidate__head {
  display: flex; align-items: baseline; gap: var(--sp-2);
}
.match-candidate__rank {
  font-size: .6875rem; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-faint);
}
.match-candidate__name { flex: 1; font-weight: 650; }
.match-candidate__score {
  font-size: 1.125rem; font-weight: 700; color: var(--accent);
}

.match-reasons__title {
  display: block;
  font-size: .6875rem; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 2px;
}
.match-reasons ul { margin: 0; padding-left: 1.1em; font-size: .875rem; }
.match-reasons.is-watch ul { color: var(--warn); }
.match-candidate__actions { margin-top: auto; }
.match-candidate__actions .btn { width: 100%; }

.match-blocked { border-left: 3px solid var(--warn); }
.match-blocked__fix { margin: var(--sp-2) 0 0; font-weight: 550; }
.match-blocked__nearest { margin-top: var(--sp-2); }

.match-stale { border-left: 3px solid var(--line); }
.match-stale__who { margin: 0 0 2px; }

/* ------------------------------------------------------------------ *
 * Admin
 * ------------------------------------------------------------------ */

.admin-computed {
  margin-top: var(--sp-6);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line);
  max-width: 62ch;
}

/* Overview */

.admin-hours { margin-top: var(--sp-4); }
.admin-hours__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: var(--sp-3);
}
.admin-hours__cell { padding: var(--sp-3); background: var(--paper-2); border-radius: var(--r-md); }
.admin-hours__cell.is-total { background: var(--accent-soft); }
.admin-hours__value { display: block; font-size: 1.5rem; font-weight: 680; font-variant-numeric: tabular-nums; }
.admin-hours__label { font-size: .8125rem; color: var(--ink-soft); }

.admin-growth { margin-top: var(--sp-4); }
.admin-growth__legend { display: flex; flex-wrap: wrap; gap: var(--sp-4); margin: var(--sp-3) 0 var(--sp-1); font-size: .875rem; }
.admin-growth__key { display: inline-flex; align-items: center; gap: var(--sp-2); }
.admin-growth__swatch { width: 12px; height: 3px; border-radius: 2px; }
.admin-growth__key.is-students .admin-growth__swatch { background: var(--accent); }
.admin-growth__key.is-tutors .admin-growth__swatch { background: var(--good); }
.admin-growth__chart { overflow-x: auto; }

.chart { display: block; width: 100%; height: auto; }
.chart__grid { stroke: var(--line); stroke-width: 1; }
.chart__tick, .chart__label { fill: var(--ink-faint); font-size: 11px; font-family: var(--font); }
.chart__line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart__line.is-students { stroke: var(--accent); }
.chart__line.is-tutors { stroke: var(--good); }
.chart__area { stroke: none; opacity: .12; }
.chart__area.is-students { fill: var(--accent); }
.chart__area.is-tutors { fill: var(--good); }
.chart__dot.is-students { fill: var(--accent); }
.chart__dot.is-tutors { fill: var(--good); }
.chart__bar { fill: var(--accent); opacity: .55; }

/* Needs attention */

.attention-clear { border-left: 3px solid var(--good); margin-bottom: var(--sp-4); }
.attention-block { margin-bottom: var(--sp-6); }
.attention-block.is-primary .attention-row { border-left: 3px solid var(--warn); }
.attention-block__head { display: flex; align-items: center; gap: var(--sp-3); }
.attention-block__head h2 { margin: 0; font-size: 1.0625rem; }

.attention-list { margin: var(--sp-3) 0 var(--sp-3); padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--sp-2); }
.attention-row {
  display: flex; flex-wrap: wrap; gap: var(--sp-3);
  padding: var(--sp-3);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.attention-row__lead { flex: 0 0 auto; min-width: 92px; font-size: .875rem; font-weight: 650; color: var(--ink-soft); }
.attention-row__body { flex: 1 1 240px; display: flex; flex-direction: column; gap: 2px; }
.attention-row__who { font-weight: 600; }
.attention-name { color: var(--ink); text-decoration: none; }
.attention-name:hover { text-decoration: underline; }
.attention-contact { color: var(--ink-soft); }

/* Roster */

.roster-controls { margin-bottom: var(--sp-4); }
.roster-filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.roster-search { flex: 1 1 200px; min-width: 0; }
.roster-select {
  min-height: 44px; padding: var(--sp-1) var(--sp-2); font: inherit;
  color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md);
}
.roster-actions { align-items: flex-start; gap: var(--sp-4); }
.roster-new { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.roster-new__label { font-size: .8125rem; font-weight: 600; color: var(--ink-faint); }
.roster-new__input { max-width: 180px; }
.roster-import { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.roster-table a { color: var(--ink); }

/* Person detail */

.person-head { display: flex; align-items: flex-start; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.person-head h1 { margin: 0; }
.person-head__actions { margin-left: auto; }
.person-editor { margin-bottom: var(--sp-4); }
.person-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--sp-3);
  margin: var(--sp-3) 0;
}
.person-field { display: flex; flex-direction: column; gap: var(--sp-1); }
.person-field.is-wide { grid-column: 1 / -1; }
.person-field__label { font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-faint); }
.person-pairing { padding: 2px 0; }

/* Export */

.export-panel.is-primary { border-left: 3px solid var(--good); }
.export-panel.is-handover { border-left: 3px solid var(--accent); }
.export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}
.export-grid .btn { width: 100%; }

@media (max-width: 700px) {
  .person-head__actions { margin-left: 0; width: 100%; }
  .attention-row__lead { min-width: 0; }
}

/* The hint under a log field — last session's notes, or what to write. */
.log-field__hint {
  font-size: .75rem;
  color: var(--ink-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
