/* Ustaad-X v0.8 adaptive-learning, account and PWA interface. */
.auth-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.auth-tab { min-width: 0; }
.text-button {
  border: 0;
  padding: 8px 0;
  background: transparent;
  color: var(--teal);
  font-weight: 750;
  text-align: left;
}
.auth-subpanel {
  margin-top: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: #f9fbfa;
}
.inline-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.inline-form { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.inline-form label { flex: 1 1 260px; }
.auth-fieldset {
  min-width: 0;
  margin: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
}
.auth-fieldset legend {
  padding: 0 6px;
  color: var(--navy);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.course-check-grid, .day-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 7px;
}
.day-check-grid { grid-template-columns: repeat(7, minmax(45px, 1fr)); }
.course-check-grid label, .day-check-grid label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--white);
  font-size: 11px;
  font-weight: 700;
}
.course-check-grid input, .day-check-grid input { width: auto; margin: 0; }

.v8-two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr);
  gap: 18px;
  margin-bottom: 18px;
}
.v8-setup-card { display: grid; gap: 18px; margin-bottom: 18px; }
.v8-setup-card h3 { margin: 0 0 8px; color: var(--navy); }
.v8-setup-card p { margin: 0; color: var(--muted); line-height: 1.55; }
.v8-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
}
.v8-card-list { display: grid; gap: 10px; }
.v8-card {
  display: grid;
  gap: 8px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfb;
}
.v8-card-row { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.v8-card h4 { margin: 0; color: var(--navy); font-size: 14px; }
.v8-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.v8-card small { color: var(--teal-dark); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.v8-card-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.v8-mini-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--navy);
  padding: 7px 9px;
  font-size: 10px;
  font-weight: 800;
}
.v8-mini-button.primary { background: var(--teal); border-color: var(--teal); color: var(--white); }
.mastery-bar { height: 7px; overflow: hidden; border-radius: 999px; background: #e7eceb; }
.mastery-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--teal); }

.weekly-plan { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.plan-day { min-height: 145px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfb; }
.plan-day.today { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(13,118,110,.08); }
.plan-day > strong { display: block; color: var(--navy); font-size: 12px; text-transform: capitalize; }
.plan-day > small { color: var(--muted); font-size: 9px; }
.plan-task { margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--line); }
.plan-task b { display: block; font-size: 10px; line-height: 1.35; }
.plan-task span { color: var(--muted); font-size: 9px; }

.assessment-form { display: grid; gap: 15px; }
.assessment-question {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fbfcfb;
}
.assessment-question legend { padding: 0 7px; color: var(--navy); font-size: 13px; font-weight: 800; line-height: 1.45; }
.assessment-meta { display: flex; gap: 8px; margin-bottom: 10px; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.assessment-options { display: grid; gap: 7px; }
.assessment-option { display: flex; flex-direction: row; align-items: start; gap: 9px; padding: 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--white); font-size: 11px; }
.assessment-option input { width: auto; margin-top: 2px; }
.result-hero { padding: 18px; border-radius: 14px; background: var(--navy); color: var(--white); display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.result-hero strong { font-size: 34px; color: var(--lime); }
.result-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin-top: 14px; }
.result-topic { padding: 11px; border: 1px solid var(--line); border-radius: 10px; }
.result-topic b { display: block; color: var(--navy); font-size: 12px; }
.result-topic span { color: var(--muted); font-size: 10px; }

.exam-clock {
  min-width: 105px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--navy);
  color: var(--lime);
  font-weight: 900;
  letter-spacing: .08em;
  text-align: center;
}
.exam-clock.warning { background: #7d3030; color: var(--white); }
.exam-session-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; }
.exam-question-index { align-self: start; position: sticky; top: 20px; }
.exam-question-nav { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 12px 0; }
.exam-question-nav button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); color: var(--navy); font-weight: 800; }
.exam-question-nav button.active { background: var(--teal); color: var(--white); border-color: var(--teal); }
.exam-question-nav button.answered { box-shadow: inset 0 -4px 0 var(--lime); }
.exam-question-nav button.flagged { outline: 2px solid var(--orange); }
.exam-session-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 15px; }
.exam-active-question h3 { color: var(--navy); line-height: 1.5; }
.exam-active-question textarea { width: 100%; min-height: 180px; }
.exam-option-list { display: grid; gap: 8px; margin: 12px 0; }
.exam-option-list label { flex-direction: row; align-items: start; gap: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; }
.exam-option-list input { width: auto; }

.stem-tool-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.stem-tool-tab { border: 1px solid var(--line); border-radius: 999px; padding: 9px 13px; background: var(--white); color: var(--muted); font-size: 11px; font-weight: 800; }
.stem-tool-tab.active { background: var(--teal); border-color: var(--teal); color: var(--white); }
.stem-tool-panel { display: grid; gap: 15px; }
#graph-canvas { width: 100%; height: min(440px, 48vw); min-height: 280px; border: 1px solid var(--line); border-radius: 13px; background: var(--white); touch-action: none; }
.tool-result { min-height: 64px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfb; line-height: 1.55; }
.balance-table { width: 100%; border-collapse: collapse; }
.balance-table th, .balance-table td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; font-size: 11px; }
.balance-ok { color: var(--teal-dark); font-weight: 850; }
.balance-bad { color: var(--red); font-weight: 850; }
.punnett-grid { display: grid; grid-template-columns: repeat(3, minmax(70px, 1fr)); max-width: 430px; gap: 5px; margin: 10px 0; }
.punnett-cell { display: grid; place-items: center; min-height: 55px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); font-weight: 850; }
.punnett-cell.header { background: var(--mint); color: var(--teal-dark); }

.guardian-banner { background: linear-gradient(125deg, var(--navy), #184c54); }
.guardian-student-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 16px; }
.student-insight-card { display: grid; gap: 13px; padding: 17px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow-small); }
.student-insight-head { display: flex; justify-content: space-between; gap: 12px; }
.student-insight-head h3 { margin: 0; color: var(--navy); }
.student-insight-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.student-insight-metrics div { padding: 10px; border-radius: 10px; background: #f5f8f7; }
.student-insight-metrics strong { display: block; color: var(--navy); font-size: 18px; }
.student-insight-metrics small { color: var(--muted); font-size: 8px; text-transform: uppercase; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 5px 8px; border-radius: 999px; background: var(--mint); color: var(--teal-dark); font-size: 9px; font-weight: 750; }
.account-summary { display: grid; grid-template-columns: minmax(120px, .45fr) 1fr; gap: 7px 12px; }
.account-summary dt { color: var(--muted); font-size: 10px; }
.account-summary dd { margin: 0; color: var(--navy); font-size: 11px; font-weight: 700; overflow-wrap: anywhere; }

.offline-banner {
  position: fixed;
  inset: auto 18px 18px auto;
  z-index: 500;
  max-width: 360px;
  padding: 11px 14px;
  border-radius: 12px;
  background: #7d3030;
  color: var(--white);
  box-shadow: var(--shadow);
  font-size: 11px;
}

/* Room resilience controls */
.room-preflight {
  position: absolute;
  z-index: 25;
  inset: 18px auto auto 18px;
  width: min(360px, calc(100% - 36px));
  padding: 14px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  background: rgba(7,25,32,.9);
  backdrop-filter: blur(10px);
  color: var(--white);
}
.room-preflight h2 { margin: 0 0 7px; font-size: 16px; }
.room-preflight p { margin: 0 0 10px; color: rgba(255,255,255,.68); font-size: 10px; line-height: 1.5; }
.preflight-list { display: grid; gap: 6px; margin-bottom: 10px; }
.preflight-item { display: flex; justify-content: space-between; gap: 10px; padding: 7px 8px; border-radius: 8px; background: rgba(255,255,255,.07); font-size: 10px; }
.preflight-item b.ok { color: #80e0a7; }
.preflight-item b.warn { color: #f4d879; }
.preflight-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.room-quality { display: inline-flex; gap: 7px; align-items: center; padding: 6px 9px; border-radius: 999px; background: rgba(255,255,255,.08); color: rgba(255,255,255,.75); font-size: 9px; }
.room-quality.good { color: #80e0a7; }
.room-quality.warn { color: #f4d879; }
.room-quality.bad { color: #ff9e9e; }
.call-button.reconnect { background: #264e5a; }

@media (max-width: 1120px) {
  .weekly-plan { grid-template-columns: repeat(7, 150px); }
  .v8-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .v8-two-column, .exam-session-layout { grid-template-columns: 1fr; }
  .exam-question-index { position: static; }
  .course-check-grid { grid-template-columns: 1fr; }
  .day-check-grid { grid-template-columns: repeat(4, minmax(55px, 1fr)); }
  .guardian-student-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .auth-tabs { grid-template-columns: 1fr; }
  .v8-form-grid, .result-grid { grid-template-columns: 1fr; }
  .student-insight-metrics { grid-template-columns: 1fr; }
  .exam-question-nav { grid-template-columns: repeat(6, 1fr); }
  .day-check-grid { grid-template-columns: repeat(2, minmax(70px, 1fr)); }
  .room-preflight { position: relative; inset: auto; width: auto; margin: 12px; }
}
