/* Focused teacher, family and learner journeys.
   Loaded only by the three role portals so shared application styling remains stable. */

.role-portal-head,
.role-section-heading,
.role-section-title,
.family-scan-child,
.family-scan-actions,
.family-child-head,
.role-primary-action {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.role-section-heading {
  align-items: end;
  margin-bottom: 1rem;
}

.role-section-heading h2,
.role-section-title h3,
.family-scan-card h3,
.family-scan-card p,
.role-notification h3,
.role-notification p {
  margin: 0;
}

.role-section-title p,
.family-scan-card p {
  color: var(--muted);
  font-size: .9rem;
  margin-top: .25rem;
}

.role-chip.is-support {
  background: var(--amber-100);
  border-color: color-mix(in srgb, var(--gold) 55%, var(--line));
  color: #684500;
}

.role-score {
  color: var(--brand-primary);
  font-size: 1.55rem;
  line-height: 1;
}

.role-empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.role-empty-state h3 {
  margin-top: 0;
}

.role-anchor-tabs {
  position: sticky;
  top: .5rem;
  z-index: 8;
  display: flex;
  gap: .45rem;
  overflow-x: auto;
  padding: .55rem;
  margin: 1rem 0 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--white) 94%, transparent);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
  scrollbar-width: thin;
}

.role-anchor-tabs a {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: .65rem .9rem;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: .9rem;
  font-weight: 750;
  text-decoration: none;
}

.role-anchor-tabs a:hover,
.role-anchor-tabs a:focus-visible {
  background: var(--brand-soft);
  color: var(--brand-primary);
  outline: none;
}

.role-anchor-tabs a:focus-visible,
.role-subject-details summary:focus-visible,
.role-details summary:focus-visible {
  box-shadow: var(--focus-ring);
}

.role-journey-section {
  scroll-margin-top: 6rem;
  margin: 0 0 2.25rem;
}

/* Teacher: make the register and review queue the first working surface. */
.teacher-today-grid {
  align-items: start;
}

.role-register-list {
  display: grid;
  gap: .55rem;
  max-height: min(60vh, 35rem);
  overflow: auto;
  padding: .15rem .15rem .15rem 0;
}

.role-register-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .55rem;
  align-items: center;
  padding: .8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--white);
}

.role-register-learner {
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
}

.role-register-learner strong,
.role-register-learner small {
  display: block;
}

.role-register-learner small {
  margin-top: .15rem;
  color: var(--muted);
  line-height: 1.35;
}

.role-register-learner:hover strong,
.role-register-learner:focus-visible strong {
  color: var(--brand-primary);
  text-decoration: underline;
}

.role-register-status {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 750;
}

.role-register-row select {
  min-height: 2.75rem;
  margin: 0;
}

.role-primary-action {
  align-items: center;
  flex-wrap: wrap;
  margin-top: .9rem;
  padding-top: .9rem;
  border-top: 1px solid var(--line);
}

.role-primary-action span {
  color: var(--muted);
  font-size: .88rem;
}

/* Family: one mobile-first child scan, then combined marks and homework. */
.family-portal-shell {
  max-width: 88rem;
}

.family-daily-scan {
  border-top: 4px solid var(--brand-primary);
}

.family-scan-grid,
.family-learning-grid,
.family-record-grid {
  display: grid;
  gap: .9rem;
}

.family-scan-card {
  display: grid;
  gap: .9rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, var(--white), var(--brand-faint));
}

.family-scan-child {
  align-items: center;
}

.family-scan-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .45rem;
}

.family-scan-metrics > div {
  min-width: 0;
  padding: .75rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.family-scan-metrics > div.needs-attention {
  background: #fff0ed;
  color: #8d241c;
}

.family-scan-metrics span,
.family-scan-metrics strong,
.family-scan-metrics small {
  display: block;
}

.family-scan-metrics span,
.family-scan-metrics small {
  overflow: hidden;
  color: inherit;
  font-size: .72rem;
  line-height: 1.25;
  opacity: .76;
  text-overflow: ellipsis;
}

.family-scan-metrics strong {
  margin: .2rem 0;
  font-size: 1.2rem;
}

.family-scan-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.family-child-panel {
  scroll-margin-top: 6rem;
  margin-bottom: 1.25rem;
}

.family-learning-grid {
  margin-top: 1rem;
}

.family-gradebook-card,
.family-work-card {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.family-work-card h4 {
  margin: 1rem 0 .4rem;
  color: var(--muted);
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.role-subject-list {
  display: grid;
  gap: .45rem;
  margin-top: .9rem;
}

.role-subject-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .15rem .75rem;
  align-items: center;
  padding: .7rem 0;
  border-top: 1px solid var(--line);
}

.role-subject-row small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.role-dated-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .65rem 0;
  border-top: 1px solid var(--line);
}

.role-dated-row > span,
.role-dated-row > span strong,
.role-dated-row > span small {
  min-width: 0;
  display: block;
}

.role-dated-row small,
.role-dated-row time {
  color: var(--muted);
  font-size: .78rem;
}

.role-dated-row time {
  flex: 0 0 auto;
  text-align: right;
}

.role-dated-row.is-overdue time {
  color: var(--red);
  font-weight: 800;
}

.family-report-card {
  margin-top: 1rem;
}

.role-details {
  overflow: hidden;
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--white);
}

.role-details > summary {
  min-height: 3.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1rem;
  cursor: pointer;
  color: var(--ink);
  font-weight: 800;
}

.role-details[open] > summary {
  border-bottom: 1px solid var(--line);
  background: var(--brand-faint);
}

.family-record-grid,
.learner-schedule-details .week-schedule {
  padding: 1rem;
}

.family-updates-grid {
  align-items: start;
}

.role-notification {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  padding: .85rem 0;
  border-top: 1px solid var(--line);
}

.role-notification.is-unread {
  padding-left: .85rem;
  border-left: 3px solid var(--brand-primary);
}

.role-notification time {
  color: var(--muted);
  font-size: .76rem;
}

.role-notification h3 {
  margin-top: .18rem;
  font-size: 1rem;
}

.role-notification p {
  margin-top: .2rem;
  color: var(--muted);
  font-size: .9rem;
}

.family-reporting-details {
  display: block;
  padding: 0;
  overflow: hidden;
}

.family-reporting-details > summary {
  min-height: 4.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem;
  cursor: pointer;
}

.family-reporting-details > summary span,
.family-reporting-details > summary strong {
  display: block;
}

.family-reporting-details > summary > span:last-child {
  color: var(--brand-primary);
  font-size: .85rem;
  font-weight: 800;
}

.family-reporting-content {
  padding: 0 1.15rem 1.15rem;
  border-top: 1px solid var(--line);
}

/* Learner: cumulative sections with drill-down rather than repeated dashboards. */
.learner-profile-hero {
  margin-bottom: 0;
}

.learner-overview-stats {
  margin-bottom: 1rem;
}

.learner-next-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-left: 4px solid var(--gold);
}

.learner-next-action h3,
.learner-next-action p {
  margin: .15rem 0 0;
}

.learner-progress-grid,
.learner-calendar-grid,
.learner-attendance-grid,
.learner-growth-grid,
.learner-records-grid {
  align-items: start;
}

.role-subject-details {
  border-top: 1px solid var(--line);
}

.role-subject-details > summary {
  min-height: 3.25rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .1rem .8rem;
  align-items: center;
  cursor: pointer;
  list-style-position: inside;
}

.role-subject-details > summary small {
  grid-column: 1 / -1;
  padding-left: 1.1rem;
  color: var(--muted);
}

.role-subject-details[open] > summary {
  color: var(--brand-primary);
}

.role-mark-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin: 0 0 .45rem 1rem;
  padding: .7rem;
  border-radius: var(--radius-sm);
  background: var(--brand-faint);
  color: var(--ink);
  text-decoration: none;
}

.role-mark-row span,
.role-mark-row strong,
.role-mark-row small {
  display: block;
}

.role-mark-row small {
  color: var(--muted);
}

.role-mark-row:hover,
.role-mark-row:focus-visible {
  background: var(--brand-soft);
  color: var(--brand-primary);
}

.role-task-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .6rem;
  align-items: center;
  padding: .75rem 0;
  border-top: 1px solid var(--line);
}

.role-task-row > span:first-child,
.role-task-row > span strong,
.role-task-row > span small {
  min-width: 0;
  display: block;
}

.role-task-row > span small {
  color: var(--muted);
}

.role-task-row .button {
  grid-column: 1 / -1;
  justify-self: start;
}

.role-task-state {
  padding: .3rem .55rem;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: .75rem;
  font-weight: 800;
}

.role-task-row.is-overdue .role-task-state {
  background: #fff0ed;
  color: #8d241c;
}

.learner-schedule-details {
  padding: 0;
}

.learner-schedule-details > summary span {
  color: var(--muted);
  font-size: .85rem;
}

.role-due-calendar .calendar-day {
  min-height: 5rem;
}

.role-due-calendar .calendar-day small {
  display: block;
  overflow: hidden;
  margin-top: .25rem;
  padding: .15rem .25rem;
  border-radius: .3rem;
  background: var(--brand-soft);
  color: var(--brand-primary);
  font-size: .65rem;
  line-height: 1.2;
  text-overflow: ellipsis;
}

.role-attendance-row {
  display: grid;
  grid-template-columns: minmax(6rem, auto) minmax(0, 1fr) auto;
  gap: .75rem;
  align-items: center;
  padding: .75rem 0;
  border-top: 1px solid var(--line);
}

.role-attendance-row time strong,
.role-attendance-row time span {
  display: block;
}

.role-attendance-row time span,
.role-attendance-row > span {
  color: var(--muted);
  font-size: .8rem;
}

.role-attendance-row > strong {
  color: var(--red);
}

.role-positive-state {
  padding: .9rem;
  border-radius: var(--radius-sm);
  background: var(--green-100);
  color: var(--green-900);
}

.learner-attendance-summary > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .8rem 0;
  border-top: 1px solid var(--line);
}

.role-goal-card {
  padding: .85rem 0;
  border-top: 1px solid var(--line);
}

.role-goal-card > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.role-goal-card progress {
  width: 100%;
  height: .65rem;
  accent-color: var(--brand-primary);
}

.role-goal-card small {
  color: var(--muted);
}

.role-recommendation {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .75rem;
  padding: .8rem 0;
  border-top: 1px solid var(--line);
}

.role-recommendation > span {
  height: fit-content;
  padding: .25rem .45rem;
  border-radius: .4rem;
  background: var(--amber-100);
  color: #684500;
  font-size: .7rem;
  font-weight: 850;
}

.role-recommendation h4,
.role-recommendation p {
  margin: 0;
}

.role-recommendation p {
  margin-top: .2rem;
  color: var(--muted);
  font-size: .88rem;
}

.learner-profile-form textarea {
  min-height: 8rem;
  resize: vertical;
}

@media (min-width: 700px) {
  .role-register-row {
    grid-template-columns: minmax(13rem, 1fr) auto minmax(9rem, .45fr) auto;
  }

  .role-register-status {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .family-learning-grid,
  .family-record-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .role-task-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .role-task-row .button {
    grid-column: auto;
  }
}

@media (min-width: 960px) {
  .family-scan-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 699px) {
  .role-portal-head,
  .role-section-heading,
  .role-section-title,
  .family-child-head,
  .role-primary-action,
  .learner-next-action,
  .role-notification {
    align-items: stretch;
    flex-direction: column;
  }

  .family-scan-metrics {
    grid-template-columns: repeat(3, minmax(5rem, 1fr));
    overflow-x: auto;
  }

  .family-scan-actions .button,
  .family-child-head .button,
  .role-primary-action button,
  .learner-next-action .button {
    width: 100%;
    justify-content: center;
  }

  .family-reporting-details > summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .role-attendance-row {
    grid-template-columns: minmax(5rem, auto) minmax(0, 1fr);
  }

  .role-attendance-row > strong {
    grid-column: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .role-anchor-tabs {
    scroll-behavior: auto;
  }
}
