/* layout.css - Screen layouts, tabs, profile structure */

/* Screens */
.screen        { display: none; min-height: 100vh; flex-direction: column; }
.screen.active { display: flex; }

/* Shared app header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.5rem;
  background: var(--primary);
  border-bottom: 3px solid var(--gold);
  box-shadow: var(--shadow-lg);
  flex-shrink: 0;
}
.app-header h1 { font-size: 1.1rem; color: #fff; font-weight: 700; letter-spacing: 0.01em; }
.header-right  { display: flex; align-items: center; gap: 0.75rem; font-size: 0.9rem; color: rgba(255,255,255,0.75); }
.header-right .btn-ghost { color: rgba(255,255,255,0.85); }
.header-right .btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,0.12); }
.header-right .teacher-name { color: rgba(255,255,255,0.75); }

/* Logo in header */
.app-header-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.app-header-logo img {
  height: 36px;
  width: auto;
}

/* Login screen */
.login-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
  padding: 2rem;
}
.login-center img {
  height: 80px;
  width: auto;
  margin-bottom: 0.5rem;
}
.login-center h1 {
  color: var(--primary);
  font-size: 1.6rem;
}
.login-divider {
  width: 48px;
  height: 3px;
  background: var(--gold);
  border-radius: 2px;
  margin: 0 auto -0.25rem;
}

/* Student list screen */
.students-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  gap: 1rem;
}

.student-list { display: flex; flex-direction: column; gap: 0.5rem; }

.student-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.student-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.student-card-name  { font-weight: 600; }

/* Profile screen */
#screen-profile { background: var(--bg); }

.profile-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1.5rem;
  background: var(--primary);
  border-bottom: 3px solid var(--gold);
  box-shadow: var(--shadow-lg);
  flex-shrink: 0;
}
.profile-header h2 { font-size: 1.1rem; margin: 0; color: #fff; }
.profile-header .btn-ghost { color: rgba(255,255,255,0.85); }
.profile-header .btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,0.12); }
.profile-header-right { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; font-size: 0.9rem; color: rgba(255,255,255,0.75); }

/* Tabs */
.tab-bar {
  display: flex;
  gap: 0;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  flex-shrink: 0;
  padding: 0 1.5rem;
}
.tab-btn {
  padding: 0.7rem 1.2rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.tab-btn:hover  { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--gold); }

/* Tab panels */
.tab-panels { flex: 1; overflow-y: auto; }
.tab-panel  { padding: 1.5rem; max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; gap: 1.5rem; }

/* Program selector bar (Fluency + GBL tabs) */
.program-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.program-bar select { max-width: 320px; }

/* Student info tab */
.info-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.info-row {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}
.info-label {
  min-width: 110px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.subsite-link { font-size: 0.9rem; }

/* Student Info — compact detail layout */
.si-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.si-sub-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3rem;
  margin-bottom: 0.25rem;
}
.si-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.55rem 1.25rem;
}
.si-tile {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.si-key {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.si-val { font-size: 0.9rem; }
.si-perm-yes { color: #16a34a; font-weight: 600; }
.si-perm-no  { color: #dc2626; font-weight: 600; }

/* Parent / Guardian blocks */
.si-parents {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.si-parent-block {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.si-parent-name { font-size: 0.92rem; font-weight: 600; }
.si-pronun      { font-size: 0.82rem; font-weight: 400; }
.si-contact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.9rem;
}
.si-contact-item {
  font-size: 0.82rem;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
}
.si-contact-item:hover { text-decoration: underline; }
.si-parent-note {
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 0.1rem;
}
.si-sharepoint {
  border-top: 1px solid var(--border);
  padding-top: 0.6rem;
  font-size: 0.87rem;
}

/* Programs table */
.programs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.programs-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
}
.programs-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.actions-cell { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* Section card */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.section-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.section-card-header h3 { font-size: 0.95rem; margin: 0; }
.section-card-body { padding: 1rem; }

/* Lesson Progress tab */
#panel-lessons { max-width: none; }

/* Planning & Behaviour Notes */
#notes-section {
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  flex-shrink: 0;
}
.notes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.notes-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.notes-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.75rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.88rem;
}
/* Quill editor sizing */
.notes-card .ql-container { font-size: 0.9rem; }
.notes-card .ql-editor    { min-height: 60px; max-height: 120px; overflow-y: auto; }
.notes-card .ql-toolbar   { border-top: none; padding: 4px 8px; }
.notes-card .ql-toolbar .ql-formats { margin-right: 8px; }

.lesson-toolbar {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#session-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  width: 100%;
}

.session-card {
  background: var(--surface);
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
}
.session-card:nth-child(even) { background: var(--bg); }

.session-fields {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.35rem 1rem;
  overflow-x: auto;
}

.session-fields .field-group {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex-shrink: 0;
}
.session-fields .field-group label {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* Compact inputs inside session cards */
.session-fields input[type="text"],
.session-fields input[type="number"],
.session-fields input[type="date"],
.session-fields select {
  padding: 0.25rem 0.4rem;
  font-size: 0.875rem;
}

.fg-date    { flex: 0 0 130px; }
.fg-narrow  { flex: 0 0 76px; }
.fg-teacher { flex: 0 0 150px; }
.fg-grow    { flex: 1 1 100px; min-width: 90px; }
.fg-checkbox { flex: 0 0 50px; align-items: flex-start; }
.fg-checkbox input[type="checkbox"] { width: 1.1rem; height: 1.1rem; margin-top: 0.25rem; }
.fg-end { flex: 0 0 auto; align-items: center; }
.full-width { flex: 1 0 100%; }

/* Save status inline in fields row */
.session-fields .save-status {
  font-size: 0.72rem;
  color: var(--muted);
  align-self: flex-end;
  padding-bottom: 0.3rem;
  white-space: nowrap;
  margin-left: auto;
}

/* Comments toggle button */
.btn-comments-toggle {
  padding: 0.2rem 0.45rem;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  margin-top: 0.15rem;
}
.btn-comments-toggle.has-comments {
  color: var(--primary);
  border-color: var(--primary);
}
.btn-delete-session {
  padding: 0.2rem 0.45rem;
  font-size: 0.8rem;
  border: 1px solid transparent;
  border-radius: 99px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  margin-top: 0.15rem;
  opacity: 0.4;
  transition: opacity 0.15s, color 0.15s, border-color 0.15s;
}
.btn-delete-session:hover {
  opacity: 1;
  color: #c0392b;
  border-color: #c0392b;
}

/* Collapsible comments */
.session-comments {
  padding: 0.3rem 1rem 0.4rem;
}
.session-comments textarea {
  width: 100%;
  padding: 0.3rem 0.5rem;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  resize: vertical;
  min-height: 3rem;
  background: inherit;
}
.session-comments textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
  outline: none;
}

/* Labels are hidden in cards — column headers are rendered as a separate row */
.session-fields .field-group label { display: none; }

/* Reading row: labels shown inline to the left of each input */
.session-reading-row .field-group {
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
}
.session-reading-row .field-group label {
  display: block;
  white-space: nowrap;
}
.session-reading-row .field-group input {
  width: 60px;
}

/* Sticky column header row above session list */
.session-col-headers {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 1rem 0.25rem;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
  overflow-x: auto;
  scrollbar-width: none;
}
.session-col-headers::-webkit-scrollbar { display: none; }

.sch-col {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.field-static {
  font-size: 0.875rem;
  padding: 0.25rem 0.4rem;
  color: var(--text);
  display: inline-block;
}
.field-total-points {
  font-weight: 600;
  color: var(--text);
}

/* Placeholder panels */
.placeholder-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--muted);
  font-style: italic;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  padding: 1.75rem;
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.modal h3 { margin: 0; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; }

/* Loading overlay */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  z-index: 200;
}
.loading-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.loading-message { color: var(--muted); font-size: 0.9rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Math Drill overlay ---- */

.math-drill-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.md-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
  padding: 1.75rem;
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 90vh;
  overflow-y: auto;
}
.md-drill-card { max-width: 620px; }

.md-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}
.md-card-header h3 { margin: 0; }

.md-drill-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.md-drill-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0 1rem;
}

.md-results-grid {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 0.5rem;
}
.md-result-item {
  text-align: center;
  padding: 1rem 1.25rem;
  background: var(--bg);
  border-radius: var(--radius);
  min-width: 90px;
}
.md-result-value {
  font-size: 2.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
}
.md-result-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  cursor: pointer;
}

/* ---- Timer + drill problem (shared with print screen) ---- */

.timer {
  font-size: 2.5rem;
  font-weight: 700;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  min-width: 4ch;
  text-align: center;
}
.timer.timer-warning {
  color: var(--danger);
  animation: md-pulse 0.8s ease-in-out infinite;
}
@keyframes md-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.drill-progress {
  font-size: 1.2rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.problem-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  flex-wrap: wrap;
}
.problem-display {
  font-size: clamp(2.5rem, 10vw, 5.5rem);
  font-family: var(--mono);
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.05em;
  line-height: 1;
  user-select: none;
  white-space: nowrap;
}
.answer-input {
  font-size: clamp(2.5rem, 10vw, 5.5rem);
  font-family: var(--mono);
  font-weight: 700;
  text-align: center;
  width: 4.5ch;
  padding: 0.4rem 0.25rem;
  border: 3px solid var(--primary);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface);
  -moz-appearance: textfield;
}
.answer-input::-webkit-outer-spin-button,
.answer-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.answer-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37,99,235,.2);
}

/* ---- Worksheet wrap (full-screen, shown during print flow) ---- */

#md-worksheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 160;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ---- Worksheet toolbar timer ---- */

.ws-timer-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.ws-timer-display {
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 3ch;
  color: var(--text);
  letter-spacing: 0.02em;
}

.ws-timer-display.running {
  color: var(--primary);
}

/* ---- Worksheet page styles ---- */

.worksheet-page,
.answer-key-page {
  background: #fff;
  width: 8.5in;
  padding: 0.5in;
  margin: 0 auto 1.5rem;
  box-shadow: 0 4px 24px rgba(0,0,0,.18);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  min-height: 11in;
}
.worksheet-header {
  flex-shrink: 0;
  padding-bottom: 0.12in;
  margin-bottom: 0.15in;
  border-bottom: 2px solid #000;
}
.worksheet-skill-name {
  font-size: 13pt;
  font-weight: 700;
  font-family: var(--mono);
  margin-bottom: 0.08in;
}
.answer-key-label {
  font-size: 9pt;
  font-weight: 700;
  color: var(--danger);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 0.04in;
}
.ws-fields-row { display: flex; gap: 1.5rem; margin-top: 0.05in; }
.ws-field { font-size: 11pt; white-space: nowrap; }
.fill-line-name  { display: inline-block; width: 2.4in; border-bottom: 1px solid #000; margin-left: 4px; vertical-align: bottom; }
.fill-line-short { display: inline-block; width: 0.6in; border-bottom: 1px solid #000; margin-left: 4px; vertical-align: bottom; }

.worksheet-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(11, 1fr);
  grid-auto-flow: column;
  column-gap: 0.2in;
}
.problem-cell {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid #ddd;
  padding-bottom: 0.03in;
  overflow: hidden;
}
.problem-fact {
  font-family: var(--mono);
  font-size: 14pt;
  line-height: 1.2;
  flex-shrink: 0;
  display: flex;
  align-items: baseline;
  gap: 0.15em;
  padding-top: 0.04in;
}
.problem-num {
  font-size: 7.5pt;
  color: #888;
  min-width: 1.3rem;
  text-align: right;
  flex-shrink: 0;
}
.answer-line {
  flex: 1;
  border-bottom: 1.5px solid #444;
  margin: 0.04in 0 0 1.5rem;
  min-height: 0.15in;
}
.answer-blank-inline {
  display: inline-block;
  width: 0.3in;
  border-bottom: 1.5px solid #444;
  margin: 0 0.08em;
  vertical-align: bottom;
}
.problem-fact strong { color: #cc0000; }

/* ============================================================
   GOODBYE LIST PAGE
   ============================================================ */

.gbl-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.gbl-toolbar select { flex: 0 1 220px; }
.gbl-toolbar-right  { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }

.gbl-date-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.gbl-date-label input[type="date"] { font-size: 0.85rem; padding: 0.25rem 0.4rem; }

/* New skill form */
.gbl-new-skill-form {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.gbl-new-skill-form input[type="text"] { flex: 1; min-width: 200px; }
.gbl-req-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.gbl-req-label input[type="number"] { width: 52px; text-align: center; padding: 0.25rem 0.3rem; }

/* Skill rows */
.gbl-skill-row {
  display: flex;
  flex-direction: column;
  padding: 0.4rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.gbl-skill-row:nth-child(even) { background: var(--bg); }

.gbl-skill-main {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 34px;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.gbl-skill-name {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
  min-width: 120px;
}

/* Attempt dots */
.gbl-attempts-track {
  display: flex;
  gap: 3px;
  align-items: center;
  flex-shrink: 0;
}
.attempt-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
  cursor: default;
}
.attempt-dot.correct  { background: #22c55e; }
.attempt-dot.prompted { background: #f59e0b; }
.attempt-dot.error    { background: #ef4444; }
.gbl-no-attempts { font-size: 0.72rem; color: var(--muted); font-style: italic; white-space: nowrap; }

/* Streak / required */
.gbl-streak {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.gbl-streak-done { color: #16a34a; }
.gbl-required-input {
  width: 36px;
  text-align: center;
  padding: 0.1rem 0.2rem;
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: inherit;
  background: transparent;
}

/* Outcome buttons */
.gbl-outcome-btns { display: flex; gap: 5px; flex-shrink: 0; }
.gbl-outcome-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  background: none;
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
}
.gbl-btn-correct  { border-color: #22c55e; color: #22c55e; }
.gbl-btn-prompted { border-color: #f59e0b; color: #d97706; }
.gbl-btn-error    { border-color: #ef4444; color: #ef4444; }
.gbl-btn-correct:hover  { background: #22c55e; color: #fff; }
.gbl-btn-prompted:hover { background: #f59e0b; color: #fff; }
.gbl-btn-error:hover    { background: #ef4444; color: #fff; }
.gbl-outcome-btn:disabled { opacity: 0.4; cursor: default; }

/* Complete button */
.gbl-complete-btn {
  padding: 0.2rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  background: #22c55e;
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s;
  flex-shrink: 0;
}
.gbl-complete-btn:hover { background: #16a34a; }
.gbl-complete-placeholder { flex: 0 0 76px; } /* keeps row height stable when no button */

/* Error note inline entry */
.gbl-error-entry {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0 0.1rem;
}
.gbl-error-note-input { flex: 1; max-width: 380px; padding: 0.25rem 0.5rem; font-size: 0.875rem; }

/* Attempt history list (below each skill row) */
.gbl-attempts-list {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.3rem 0 0.1rem 0.25rem;
  border-top: 1px solid var(--border);
  margin-top: 0.3rem;
}
.atl-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  font-size: 0.78rem;
  line-height: 1.5;
}
.atl-date {
  color: var(--muted);
  min-width: 100px;
  flex-shrink: 0;
}
.atl-outcome {
  font-weight: 600;
}
.atl-correct  { color: #16a34a; }
.atl-prompted { color: #d97706; }
.atl-error    { color: #dc2626; }
.atl-note {
  font-weight: 400;
  margin-left: 0.25rem;
  color: var(--text);
}
.atl-row[data-attempt-id] { cursor: default; }
.atl-row[data-attempt-id]:hover { background: rgba(0,0,0,.03); border-radius: 3px; }

/* Inline edit form for an attempt */
.atl-row-editing {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  padding: 0.15rem 0;
}
.atl-edit-date    { font-size: 0.8rem; padding: 0.15rem 0.3rem; width: 130px; }
.atl-edit-outcome { font-size: 0.8rem; padding: 0.15rem 0.3rem; }
.atl-edit-note    { font-size: 0.8rem; padding: 0.15rem 0.3rem; flex: 1; min-width: 140px; }

/* Completed section toggle */
.gbl-section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  background: var(--surface);
  border: none;
  border-top: 2px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-align: left;
}
.gbl-section-toggle:hover { background: var(--bg); }
.gbl-section-count {
  font-size: 0.78rem;
  background: var(--border);
  color: var(--muted);
  border-radius: 99px;
  padding: 0.1rem 0.45rem;
  font-weight: 600;
}
.toggle-chevron { font-size: 0.7rem; margin-right: 0.1rem; }

/* Completed skill rows */
.gbl-skill-row-complete .gbl-skill-name { color: var(--muted); }
.gbl-completed-label { font-size: 0.78rem; color: var(--muted); white-space: nowrap; flex-shrink: 0; }

/* Placeholder */
.gbl-placeholder {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ============================================================
   CALENDAR VIEW
   ============================================================ */

/* View toggle buttons (Calendar | List) in app header */
.btn-view-toggle {
  flex: 1;
  padding: 0.3rem 0.9rem;
  background: none;
  border: none;
  border-right: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn-view-toggle:last-child { border-right: none; }
.btn-view-toggle:hover       { background: var(--bg); color: var(--text); }
.btn-view-toggle.active      { background: var(--primary); color: #fff; }

/* Calendar controls bar */
.cal-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cal-week-label {
  font-size: 0.9rem;
  font-weight: 600;
  min-width: 160px;
  text-align: center;
}
.cal-controls-right { margin-left: auto; }
.cal-controls-right select { font-size: 0.875rem; max-width: 220px; }

/* Calendar grid wrapper — fills remaining screen height */
.cal-grid-wrap {
  flex: 1;
  overflow: auto;
  min-height: 0;
  background: var(--bg);
}

/* Inner calendar grid (built by CalendarView.js) */
.cal-grid {
  display: flex;
  flex-direction: column;
  min-width: 560px;
}

/* Sticky day-header row */
.cal-header-row {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  flex-shrink: 0;
}
.cal-time-corner {
  width: 52px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
}
.cal-day-hdr {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.35rem 0.25rem;
  border-left: 1px solid var(--border);
  min-width: 90px;
}
.cal-today-hdr { background: rgba(37,99,235,.05); }
.cal-hdr-day {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.cal-hdr-date {
  font-size: 1.2rem;
  font-weight: 700;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  line-height: 1;
}
.cal-today-circle {
  background: var(--primary);
  color: #fff;
}

/* Body row: time axis + day event columns */
.cal-body-row {
  display: flex;
  flex: 1;
}

/* Time axis column */
.cal-time-axis {
  width: 52px;
  flex-shrink: 0;
  position: relative;
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.cal-hour-label {
  position: absolute;
  right: 6px;
  font-size: 0.67rem;
  color: var(--muted);
  transform: translateY(-50%);
  white-space: nowrap;
  user-select: none;
}

/* Day event columns */
.cal-day-events {
  flex: 1;
  position: relative;
  border-left: 1px solid var(--border);
  min-width: 90px;
}

/* Hour / half-hour grid lines */
.cal-hour-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid var(--border);
  pointer-events: none;
}
.cal-half-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed var(--border);
  opacity: 0.5;
  pointer-events: none;
}

/* Appointment cards */
.cal-event {
  position: absolute;
  left: 2px;
  right: 2px;
  overflow: hidden;
  border-radius: 4px;
  padding: 2px 5px;
  box-sizing: border-box;
  background: #dbeafe;
  border-left: 3px solid var(--primary);
  font-size: 0.74rem;
  line-height: 1.35;
  transition: filter 0.1s;
}
.cal-event-linked {
  cursor: pointer;
}
.cal-event-linked:hover {
  filter: brightness(0.93);
}
.cal-event-unmatched {
  background: #f1f5f9;
  border-left-color: var(--muted);
  opacity: 0.7;
}
.cal-event-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-event-time {
  font-size: 0.68rem;
  color: var(--text);
}
.cal-event-loc {
  font-size: 0.68rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Loading / error / empty states inside the grid */
.cal-loading,
.cal-error,
.cal-empty {
  padding: 3rem 2rem;
  text-align: center;
  color: var(--muted);
  font-style: italic;
}
.cal-error { color: var(--danger, #dc2626); }

/* ---- Print media ---- */

@media print {
  /* Only show worksheet during print flow */
  body.printing-worksheet > *:not(#md-worksheet-wrap) { display: none !important; }
  body.printing-worksheet #md-worksheet-wrap {
    position: static;
    display: block !important;
  }
  body.printing-worksheet .print-controls { display: none !important; }

  @page { size: letter portrait; margin: 0.5in; }

  .worksheet-page {
    width: 7.5in;
    height: 10in;
    padding: 0;
    margin: 0;
    box-shadow: none;
    min-height: 0;
  }
  .worksheet-header {
    height: 0.8in;
    margin-bottom: 0.05in;
    overflow: hidden;
    padding-bottom: 0.08in;
  }
  .worksheet-grid {
    height: 9.15in;
    flex: none;
    column-gap: 0.15in;
  }
  .problem-fact  { font-size: 16pt; }
  .problem-num   { display: none; }
  .ws-field      { font-size: 10.5pt; }
  .answer-line         { border-bottom-color: #000; }
  .answer-blank-inline { border-bottom-color: #000; }
  .problem-cell        { border-bottom-color: #bbb; }
}

/* ---- Fluency tab ---- */

#panel-fluency { max-width: none; }

.fluency-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chart-type-group {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.btn-chart-type {
  flex: 1;
  padding: 0.4rem 1rem;
  background: none;
  border: none;
  border-right: 1px solid var(--border);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  text-align: center;
}
.btn-chart-type:last-child { border-right: none; }
.btn-chart-type:hover  { background: var(--bg); color: var(--text); }
.btn-chart-type.active { background: var(--primary); color: #fff; }

.fluency-chart-wrap {
  position: relative;
  height: 300px;
  padding: 0.75rem 1.5rem;
  box-sizing: border-box;
}
.fluency-chart-wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}
.fluency-chart-wrap .placeholder-panel {
  height: 100%;
  border-radius: var(--radius);
}

.fluency-entries-wrap {
  overflow-x: auto;
  padding: 0.75rem 1.5rem 1.5rem;
}

.fluency-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  white-space: nowrap;
}
.fluency-table th {
  text-align: left;
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
}
.fluency-table td {
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.fluency-table tr:nth-child(even) { background: var(--bg); }
.fluency-row-clickable { cursor: pointer; }
.fluency-row-clickable:hover td { background: rgba(37,99,235,.06); }

/* ── Session Notes (OneNote) tab ─────────────────────────────────── */

#panel-onenote { max-width: none; display: flex; flex-direction: column; }

.on-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.on-toolbar-right { margin-left: auto; display: flex; gap: 0.5rem; }

.on-status {
  font-size: 0.875rem;
  color: var(--muted);
  font-style: italic;
}

.on-pages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.on-page {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.on-page-hdr {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.on-page-title {
  font-weight: 600;
  font-size: 0.95rem;
}
.on-page-date {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.on-page-content {
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  line-height: 1.6;
  overflow-x: auto;
}
/* Constrain images from OneNote so they don't overflow the card */
.on-page-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}
/* Tighten up OneNote's default paragraph spacing */
.on-page-content p { margin: 0.2em 0; }

.on-msg-error {
  color: var(--danger, #dc2626);
  font-size: 0.875rem;
}

.on-spinner {
  text-align: center;
  padding: 1.5rem;
  color: var(--muted);
  font-size: 0.875rem;
  font-style: italic;
}

.on-load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 0.75rem 1rem 1.25rem;
  flex-shrink: 0;
}

/* ============================================================
   HELP MODAL
   ============================================================ */

.help-modal-inner {
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.help-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-shrink: 0;
}
.help-modal-header h3 { margin: 0; }

.help-modal-body {
  overflow-y: auto;
  flex: 1;
  line-height: 1.65;
  font-size: 0.925rem;
}
.help-modal-body h2 { font-size: 1.05rem; font-weight: 700; margin: 1.25rem 0 0.35rem; }
.help-modal-body h3 { font-size: 0.95rem; font-weight: 600; margin: 1rem 0 0.25rem; }
.help-modal-body h4 { font-size: 0.9rem;  font-weight: 600; margin: 0.75rem 0 0.2rem; }
.help-modal-body h2:first-child,
.help-modal-body h3:first-child { margin-top: 0; }
.help-modal-body p  { margin: 0.35rem 0; }
.help-modal-body ul { margin: 0.35rem 0; padding-left: 1.4rem; }
.help-modal-body li { margin: 0.25rem 0; }

/* ============================================================
   PLANS SECTION
   ============================================================ */

.plan-chip-row  { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }

.plan-chip {
  padding: 0.35rem 0.85rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  white-space: nowrap;
}
.plan-chip:hover  { border-color: var(--primary); }
.plan-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.plan-detail { display: flex; flex-direction: column; gap: 0.85rem; }

.plan-dates-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.plan-date-tile { display: flex; flex-direction: column; gap: 0.1rem; }
.plan-date-key  { font-size: 0.7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.plan-date-val  { font-size: 0.9rem; font-weight: 500; }

.plan-section-hdr   { border-top: 1px solid var(--border); padding-top: 0.5rem; }
.plan-section-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

.plan-notes-content      { font-size: 0.875rem; line-height: 1.6; }
.plan-notes-content p    { margin: 0 0 0.35rem; }
.plan-notes-content ul,
.plan-notes-content ol   { margin: 0 0 0.35rem; padding-left: 1.4rem; }
.plan-notes-empty        { font-size: 0.875rem; color: var(--muted); font-style: italic; }

.plan-progs-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.plan-progs-table th {
  text-align: left;
  padding: 0.35rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
}
.plan-progs-table td { padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.plan-progs-table tbody tr:hover { background: var(--bg); }

.plans-msg { color: var(--muted); font-style: italic; font-size: 0.9rem; margin: 0; }
