/* ============================================================
   Tim's Teachers – Math Curriculum System
   styles.css
   Brand: primary #305e7a · secondary #3a708b · accent #90d0be
          highlight #d4a454 · bg #f5f5f5 · card #ffffff
   ============================================================ */

/* ── Reset / Base ────────────────────────────────────────────── */
.tt-math-wrap *,
.tt-math-wrap *::before,
.tt-math-wrap *::after {
  box-sizing: border-box;
}

.tt-math-wrap {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: #2d2d2d;
  background: #f5f5f5;
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

/* ── Page title ──────────────────────────────────────────────── */
.tt-page-title {
  font-size: 22px;
  font-weight: 700;
  color: #305e7a;
  margin: 0 0 20px;
  padding-bottom: 10px;
  border-bottom: 3px solid #90d0be;
}

/* ── Cards ───────────────────────────────────────────────────── */
.tt-card {
  background: #ffffff;
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.tt-card h3 {
  font-size: 15px;
  font-weight: 700;
  color: #305e7a;
  margin: 0 0 14px;
}

/* ── Inputs & Selects ────────────────────────────────────────── */
.tt-input {
  border: 1px solid #c5d8e3;
  border-radius: 5px;
  padding: 7px 10px;
  font-size: 13px;
  color: #2d2d2d;
  background: #fff;
  transition: border-color 0.15s;
  width: 100%;
}

.tt-input:focus {
  outline: none;
  border-color: #305e7a;
  box-shadow: 0 0 0 2px rgba(48,94,122,0.15);
}

.tt-input-sm    { width: auto; min-width: 140px; }
.tt-input-score { width: 80px; }

.tt-select {
  border: 1px solid #c5d8e3;
  border-radius: 5px;
  padding: 7px 10px;
  font-size: 13px;
  color: #2d2d2d;
  background: #fff;
  cursor: pointer;
}

.tt-select:focus {
  outline: none;
  border-color: #305e7a;
}

.tt-select-wide { width: 100%; max-width: 400px; }
.tt-select-sm   { width: auto; min-width: 110px; }

.tt-textarea {
  border: 1px solid #c5d8e3;
  border-radius: 5px;
  padding: 7px 10px;
  font-size: 13px;
  width: 100%;
  resize: vertical;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.tt-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  border-radius: 5px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.tt-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.tt-btn-primary   { background: #305e7a; color: #fff; }
.tt-btn-primary:hover:not(:disabled)   { background: #264d65; }

.tt-btn-secondary { background: #e0e8ed; color: #305e7a; }
.tt-btn-secondary:hover:not(:disabled) { background: #cdd9e1; }

.tt-btn-success   { background: #2e8a5f; color: #fff; }
.tt-btn-success:hover:not(:disabled)   { background: #256f4c; }

.tt-btn-danger    { background: #c0392b; color: #fff; }
.tt-btn-danger:hover:not(:disabled)    { background: #a93226; }

.tt-btn-warning   { background: #d4a454; color: #fff; }
.tt-btn-warning:hover:not(:disabled)   { background: #be8f3e; }

.tt-btn-sm { padding: 5px 11px; font-size: 12px; }

/* ── Toolbar ─────────────────────────────────────────────────── */
.tt-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

/* ── Search grid ─────────────────────────────────────────────── */
.tt-search-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

@media (max-width: 768px) {
  .tt-search-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .tt-search-grid { grid-template-columns: 1fr; }
}

.tt-search-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Row layout ──────────────────────────────────────────────── */
.tt-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Tables ──────────────────────────────────────────────────── */
.tt-table-scroll {
  overflow-x: auto;
}

.tt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.tt-table th {
  background: #305e7a;
  color: #fff;
  font-weight: 600;
  padding: 9px 10px;
  text-align: left;
  white-space: nowrap;
}

.tt-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e8eef2;
  vertical-align: middle;
}

.tt-table tbody tr:nth-child(even) td {
  background: #f2f8fb;
}

.tt-table tbody tr:hover td {
  background: #e6f3f9;
}

.tt-table-sm td, .tt-table-sm th {
  padding: 6px 8px;
  font-size: 12px;
}

.tt-table-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}

/* ── Assignment panel (below search results) ─────────────────── */
.tt-assign-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e0e8ed;
}

/* ── Student panel (score entry) ─────────────────────────────── */
.tt-student-panel {
  padding: 16px 0 0;
}

.tt-section {
  margin-bottom: 24px;
}

.tt-section-title {
  font-size: 14px;
  font-weight: 700;
  color: #305e7a;
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid #90d0be;
}

/* ── Assignment cards (score entry) ──────────────────────────── */
.tt-assignment-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tt-assign-card {
  border: 1px solid #c5d8e3;
  border-radius: 7px;
  background: #fafcfe;
  overflow: hidden;
}

.tt-assign-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px 8px;
  background: #e8f2f8;
  flex-wrap: wrap;
}

.tt-assign-card-title {
  font-weight: 700;
  font-size: 14px;
  color: #1e3d4f;
}

.tt-assign-card-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tt-assign-card-body {
  padding: 10px 14px 14px;
}

.tt-assign-info {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  font-size: 12px;
  color: #555;
  margin-bottom: 12px;
  align-items: center;
}

/* ── Score form ──────────────────────────────────────────────── */
.tt-score-form {
  border-top: 1px solid #e0e8ed;
  padding-top: 10px;
}

.tt-score-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tt-score-feedback {
  margin-top: 6px;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 4px;
}

.tt-feedback-warn    { background: #fff3cd; color: #856404; }
.tt-feedback-error   { background: #f8d7da; color: #721c24; }
.tt-feedback-success { background: #d1e7dd; color: #0f5132; }

/* ── Quick score presets ─────────────────────────────────────── */
.tt-quick-scores {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
}

.tt-quick-label {
  font-size: 11px;
  font-weight: 700;
  color: #305e7a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 2px;
}

.tt-quick-btn {
  border: 2px solid #c5d8e3;
  border-radius: 20px;
  background: #fff;
  color: #305e7a;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.tt-quick-btn:hover  { background: #305e7a; color: #fff; border-color: #305e7a; }
.tt-quick-btn.tt-quick-mastered { border-color: #1a7a4a; color: #1a7a4a; }
.tt-quick-btn.tt-quick-mastered:hover { background: #1a7a4a; color: #fff; }
.tt-quick-btn.tt-quick-passed   { border-color: #d4a454; color: #8a5a00; }
.tt-quick-btn.tt-quick-passed:hover   { background: #d4a454; color: #fff; }
.tt-quick-btn.tt-quick-failed   { border-color: #c0392b; color: #c0392b; }
.tt-quick-btn.tt-quick-failed:hover   { background: #c0392b; color: #fff; }

/* ── Sticky student summary bar ──────────────────────────────── */
.tt-student-sticky {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #305e7a;
  color: #fff;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 -20px 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.tt-sticky-name {
  font-size: 15px;
  font-weight: 700;
  flex: 1;
}

.tt-sticky-streak {
  font-size: 13px;
  font-weight: 600;
  color: #90d0be;
}

.tt-sticky-status {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 10px;
}

.tt-sticky-critical { background: #c0392b; color: #fff; }
.tt-sticky-warning  { background: #d4a454; color: #fff; }
.tt-sticky-streak-badge { background: #1a7a4a; color: #fff; }
.tt-sticky-normal   { display: none; }

/* ── Tabs ─────────────────────────────────────────────────────── */
.tt-tab-bar {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 2px solid #305e7a;
  margin-bottom: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  background: #f5f5f5;
  padding-top: 4px;
}

.tt-tab-btn {
  padding: 8px 16px;
  border: 1px solid #c5d8e3;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: #e8f2f8;
  color: #305e7a;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.tt-tab-btn:hover { background: #d0e5f0; }

.tt-tab-btn.tt-tab-active {
  background: #305e7a;
  color: #fff;
  border-color: #305e7a;
}

.tt-tab-panels {
  background: #fff;
  border: 1px solid #c5d8e3;
  border-top: none;
  border-radius: 0 0 7px 7px;
  min-height: 100px;
  overflow: hidden;
  touch-action: pan-y;
}

.tt-tab-panel { display: none; padding: 16px 20px; }
.tt-tab-panel.tt-tab-panel-active { display: block; }

/* ── Badges ──────────────────────────────────────────────────── */
.tt-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.tt-badge-blue    { background: #d0e7f5; color: #1a4a6e; }
.tt-badge-teal    { background: #d0f0e8; color: #1a5c44; }
.tt-badge-gray    { background: #e8e8e8; color: #444; }
.tt-badge-green   { background: #d1e7dd; color: #0f5132; }
.tt-badge-red     { background: #f8d7da; color: #721c24; }
.tt-badge-warn    { background: #fff3cd; color: #856404; }
.tt-badge-mastered { background: #1a5c44; color: #fff; }

/* ── Count badge ─────────────────────────────────────────────── */
.tt-count-badge {
  display: inline-block;
  background: #90d0be;
  color: #1a4a3a;
  border-radius: 10px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
}

/* ── Messages ────────────────────────────────────────────────── */
.tt-msg {
  padding: 10px 14px;
  border-radius: 5px;
  font-size: 13px;
  margin-top: 10px;
}

.tt-msg-success { background: #d1e7dd; color: #0f5132; border: 1px solid #a3cfbb; }
.tt-msg-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c2c7; }
.tt-msg-warn    { background: #fff3cd; color: #664d03; border: 1px solid #ffe69c; }
.tt-msg-info    { background: #cff4fc; color: #055160; border: 1px solid #9eeaf9; }

/* ── Loading indicator ───────────────────────────────────────── */
.tt-loading {
  color: #3a708b;
  font-style: italic;
  padding: 10px 0;
  font-size: 13px;
}

/* ── Code ────────────────────────────────────────────────────── */
.tt-code {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  background: #eef4f8;
  padding: 1px 5px;
  border-radius: 3px;
  color: #1e3d4f;
}

.tt-code-block {
  display: block;
  background: #eef4f8;
  border: 1px solid #c5d8e3;
  border-radius: 5px;
  padding: 10px 14px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.7;
  color: #1e3d4f;
  margin: 10px 0;
  white-space: pre-wrap;
}

/* ── Typography helpers ──────────────────────────────────────── */
.tt-muted    { color: #6c757d; font-size: 13px; }
.tt-muted-sm { color: #6c757d; font-size: 12px; }
.tt-error    { color: #c0392b; font-size: 13px; }

/* ── Checkbox ────────────────────────────────────────────────── */
.tt-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

/* ── Import page ─────────────────────────────────────────────── */
.tt-import-form {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.tt-file-input { font-size: 13px; }

.tt-import-summary {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.tt-summary-item {
  flex: 1 1 100px;
  text-align: center;
  padding: 14px;
  border-radius: 7px;
  font-size: 13px;
}

.tt-summary-item strong {
  display: block;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

.tt-success-bg { background: #d1e7dd; color: #0f5132; }
.tt-warn-bg    { background: #fff3cd; color: #664d03; }
.tt-danger-bg  { background: #f8d7da; color: #721c24; }

/* ── Modal ───────────────────────────────────────────────────── */
.tt-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.tt-modal-box {
  background: #fff;
  border-radius: 10px;
  padding: 28px 32px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
}

.tt-modal-box h3 {
  margin: 0 0 10px;
  font-size: 17px;
  color: #305e7a;
}

.tt-modal-skill {
  font-weight: 700;
  color: #1e3d4f;
  font-size: 14px;
  margin: 0 0 12px;
}

.tt-modal-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0;
}

.tt-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  justify-content: flex-end;
}

/* ── Accordion ───────────────────────────────────────────────── */
.tt-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: #e8f2f8;
  cursor: pointer;
  flex-wrap: wrap;
  user-select: none;
  transition: background 0.15s;
}

.tt-accordion-header:hover { background: #d8eaf5; }

.tt-accordion-header.tt-accordion-open { background: #305e7a; }

.tt-accordion-header.tt-accordion-open .tt-assign-card-title { color: #fff; }
.tt-accordion-header.tt-accordion-open .tt-accordion-arrow  { color: #90d0be; }
.tt-accordion-header.tt-accordion-open .tt-badge-blue {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

.tt-accordion-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tt-accordion-arrow {
  font-size: 14px;
  color: #305e7a;
  width: 14px;
  flex-shrink: 0;
}

.tt-accordion-body { border-top: 1px solid #c5d8e3; }

/* ── Score fraction inputs ───────────────────────────────────── */
.tt-score-fraction {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tt-fraction-sep {
  font-size: 13px;
  color: #555;
  white-space: nowrap;
}

.tt-pct-display {
  font-size: 15px;
  font-weight: 700;
  min-width: 48px;
}

/* ── Edit form ───────────────────────────────────────────────── */
.tt-edit-form {
  background: #f0f7fb;
  border: 1px solid #c5d8e3;
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.tt-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.tt-edit-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #305e7a;
}

.tt-edit-actions { display: flex; gap: 8px; }

@media (max-width: 600px) {
  .tt-edit-grid { grid-template-columns: 1fr; }
}

/* ── Consistently failed alert ───────────────────────────────── */
.tt-fail-alert {
  background: #fff0f0;
  border: 2px solid #c0392b;
  border-radius: 7px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.tt-fail-alert-title {
  font-size: 13px;
  font-weight: 700;
  color: #c0392b;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tt-fail-alert-list {
  margin: 0;
  padding: 0 0 0 16px;
  list-style: disc;
}

.tt-fail-alert-list li {
  font-size: 13px;
  color: #7b1a1a;
  margin-bottom: 4px;
  line-height: 1.5;
}

.tt-fail-meta {
  font-size: 11px;
  color: #a93226;
  margin-left: 6px;
}

/* ── Streak banner ───────────────────────────────────────────── */
.tt-streak-banner {
  background: linear-gradient(135deg, #1a7a4a, #2e8a5f);
  color: #fff;
  border-radius: 7px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
}

/* ── K-12 grade progress bar ─────────────────────────────────── */
.tt-grade-bar-wrap {
  background: #fff;
  border: 1px solid #c5d8e3;
  border-radius: 7px;
  padding: 12px 14px;
  margin-bottom: 14px;
  position: relative;
}

.tt-grade-bar-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #305e7a;
  margin-bottom: 8px;
}

.tt-grade-bar-track {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  height: 60px;
}

.tt-grade-segment {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  cursor: pointer;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.tt-grade-segment.tt-grade-current::after {
  content: '▲';
  position: absolute;
  bottom: -14px;
  font-size: 10px;
  color: #305e7a;
}

.tt-grade-fill {
  width: 100%;
  border-radius: 3px 3px 0 0;
  min-height: 3px;
  transition: height 0.3s ease;
}

.tt-grade-label {
  font-size: 10px;
  font-weight: 700;
  color: #305e7a;
  margin-top: 4px;
}

.tt-grade-segment.tt-grade-current .tt-grade-label { color: #c0392b; }

/* Grade bar tap popup */
.tt-grade-popup {
  display: none;
  position: absolute;
  bottom: calc(100% + 18px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e3d4f;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 5px;
  white-space: nowrap;
  z-index: 200;
  pointer-events: none;
  line-height: 1.5;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.tt-grade-popup::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1e3d4f;
}

.tt-grade-segment.tt-grade-popup-active .tt-grade-popup,
.tt-grade-segment:hover .tt-grade-popup {
  display: block;
}

/* ── Last session summary ─────────────────────────────────────── */
.tt-last-session {
  background: #f0f7fb;
  border: 1px solid #c5d8e3;
  border-radius: 7px;
  padding: 12px 16px;
  margin-bottom: 14px;
}

.tt-last-session-title {
  font-size: 12px;
  font-weight: 700;
  color: #305e7a;
  margin-bottom: 8px;
}

.tt-last-session-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.tt-stat-chip {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 10px;
}

.tt-stat-pass   { background: #d1e7dd; color: #0f5132; }
.tt-stat-fail   { background: #f8d7da; color: #721c24; }
.tt-stat-bypass { background: #fff3cd; color: #856404; }

.tt-last-session-skills { font-size: 12px; }
.tt-sess-skill {
  padding: 3px 0;
  border-bottom: 1px solid #e0e8ed;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tt-sess-skill:last-child { border-bottom: none; }

/* ── Flagged skills alert ─────────────────────────────────────── */
.tt-flag-alert {
  background: #fff8e6;
  border: 2px solid #f0a500;
  border-radius: 7px;
  padding: 12px 16px;
  margin-bottom: 14px;
}

.tt-flag-alert-title {
  font-size: 13px;
  font-weight: 700;
  color: #8a5a00;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tt-flag-list { margin: 0; padding: 0 0 0 16px; list-style: disc; }

.tt-flag-list li {
  font-size: 13px;
  color: #5a3a00;
  margin-bottom: 10px;
  line-height: 1.6;
}

.tt-flag-skill-name { font-weight: 700; margin-bottom: 2px; }
.tt-flag-note       { font-style: italic; color: #7a5200; font-size: 12px; margin-bottom: 4px; }
.tt-flag-meta       { font-size: 11px; color: #9a7000; margin-bottom: 6px; }

/* ── Domain grouping ──────────────────────────────────────────── */
.tt-domain-list { display: flex; flex-direction: column; gap: 16px; }

.tt-domain-group {
  border: 1px solid #c5d8e3;
  border-radius: 8px;
  overflow: hidden;
}

.tt-domain-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: #305e7a;
  flex-wrap: wrap;
}

.tt-domain-title  { font-size: 13px; font-weight: 700; color: #fff; flex: 1; }
.tt-domain-count  { font-size: 12px; color: #90d0be; }

.tt-domain-skills { display: flex; flex-direction: column; gap: 0; }

.tt-domain-skills .tt-assign-card {
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
  border-bottom: 1px solid #e0e8ed;
}

.tt-domain-skills .tt-assign-card:last-child { border-bottom: none; }

/* ── Grade bar legend ────────────────────────────────────────── */
.tt-grade-bar-legend {
  display: flex;
  gap: 16px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.tt-legend-item { font-size: 11px; font-weight: 700; }

/* ── Swipe hint (shows briefly on first load) ────────────────── */
.tt-swipe-hint {
  text-align: center;
  font-size: 11px;
  color: #90d0be;
  padding: 4px 0 0;
  opacity: 1;
  transition: opacity 0.5s;
}

.tt-swipe-hint.tt-hint-fade { opacity: 0; }

/* ═══════════════════════════════════════════════════════════════
   TABLET OPTIMIZATIONS  (≤ 1024px)
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {

  /* Larger base font */
  .tt-math-wrap { font-size: 15px; padding: 12px; }

  /* All buttons — 44px min touch target */
  .tt-btn    { padding: 11px 18px; font-size: 14px; min-height: 44px; }
  .tt-btn-sm { padding: 9px 14px;  font-size: 13px; min-height: 44px; }

  /* Quick score preset buttons */
  .tt-quick-btn { padding: 8px 16px; font-size: 13px; min-height: 44px; }

  /* Tabs — taller tap targets */
  .tt-tab-btn { padding: 12px 18px; font-size: 14px; min-height: 44px; }

  /* Accordion headers — bigger tap area */
  .tt-accordion-header  { padding: 14px 16px; }
  .tt-accordion-arrow   { font-size: 18px; width: 20px; }
  .tt-assign-card-title { font-size: 15px; }

  /* Score row — stack vertically */
  .tt-score-row { flex-direction: column; align-items: flex-start; gap: 12px; }

  /* Big score inputs for fat fingers */
  .tt-input-score {
    width: 90px;
    font-size: 20px;
    font-weight: 700;
    padding: 10px;
    text-align: center;
    min-height: 56px;
  }

  .tt-fraction-sep { font-size: 16px; }
  .tt-pct-display  { font-size: 20px; }

  /* Comment input full width */
  .tt-input-sm { width: 100%; min-width: unset; }

  /* Save / Bypass buttons wider */
  .tt-score-row > .tt-btn { min-width: 160px; justify-content: center; }

  /* All inputs easier to tap */
  .tt-input, .tt-select, .tt-textarea {
    font-size: 15px;
    padding: 10px 12px;
    min-height: 44px;
  }

  /* Grade bar taller */
  .tt-grade-bar-track { height: 80px; }
  .tt-grade-label     { font-size: 11px; }

  /* Modal — near full screen */
  .tt-modal-box { padding: 24px 20px; max-width: 95vw; }
  .tt-modal-actions { flex-direction: column-reverse; }
  .tt-modal-actions .tt-btn {
    width: 100%;
    justify-content: center;
    min-height: 50px;
    font-size: 15px;
  }

  /* Stat chips */
  .tt-stat-chip { font-size: 13px; padding: 5px 14px; }

  /* Session skill rows */
  .tt-sess-skill { font-size: 13px; padding: 6px 0; gap: 10px; }

  /* Edit grid — single column */
  .tt-edit-grid { grid-template-columns: 1fr; }

  /* History table */
  .tt-table-sm td, .tt-table-sm th { font-size: 13px; padding: 8px 10px; }

  /* Domain header */
  .tt-domain-title { font-size: 14px; }

  /* Sticky summary bar */
  .tt-student-sticky { margin: 0 -12px 14px; padding: 10px 16px; }
  .tt-sticky-name    { font-size: 16px; }
}

/* ═══════════════════════════════════════════════════════════════
   MATH ASSIGNMENT PAGE
   ═══════════════════════════════════════════════════════════════ */

/* ── Top card ────────────────────────────────────────────────── */
.ma-top-card { margin-bottom: 0; border-radius: 8px 8px 0 0; }

.ma-top-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.ma-top-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1 1 200px;
}

.ma-top-field-sm { flex: 0 1 120px; }

.ma-field-label {
  font-size: 12px;
  font-weight: 700;
  color: #305e7a;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.ma-student-status {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e0e8ed;
  align-items: center;
}

.ma-status-chip {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  background: #e8f2f8;
  color: #305e7a;
}

.ma-chip-green  { background: #d1e7dd; color: #0f5132; }
.ma-chip-blue   { background: #d0e7f5; color: #1a4a6e; }

/* ── Mode tabs ───────────────────────────────────────────────── */
.ma-mode-tabs {
  border-radius: 0;
  margin-bottom: 0;
}

.ma-tab-panels {
  border-radius: 0 0 8px 8px;
}

/* ── Grade pills ─────────────────────────────────────────────── */
.ma-grade-controls {
  background: #f0f7fb;
  border: 1px solid #c5d8e3;
  border-radius: 7px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.ma-grade-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.ma-grade-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.ma-grade-pill {
  width: 42px;
  height: 42px;
  border: 2px solid #c5d8e3;
  border-radius: 50%;
  background: #fff;
  color: #305e7a;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.ma-grade-pill:hover          { background: #e0f0fa; border-color: #305e7a; }
.ma-grade-pill.ma-grade-pill-active {
  background: #305e7a;
  color: #fff;
  border-color: #305e7a;
  transform: scale(1.1);
}

.ma-grade-options {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

/* ── Domain checklist ────────────────────────────────────────── */
.ma-domain-checklist {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 80px; /* room for sticky assign bar */
}

.ma-domain-block {
  border: 1px solid #c5d8e3;
  border-radius: 8px;
  overflow: hidden;
}

.ma-domain-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #305e7a;
  flex-wrap: wrap;
}

.ma-domain-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex: 1;
}

.ma-domain-check-label input[type=checkbox] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.ma-domain-name {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.ma-domain-meta {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ma-domain-count {
  font-size: 12px;
  color: #90d0be;
  font-weight: 600;
}

.ma-domain-passed {
  font-size: 11px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
}

/* ── Skill rows ──────────────────────────────────────────────── */
.ma-domain-skills {
  display: flex;
  flex-direction: column;
}

.ma-skill-row {
  border-bottom: 1px solid #e8eef2;
  padding: 0;
  transition: background 0.1s;
}

.ma-skill-row:last-child { border-bottom: none; }
.ma-skill-row:hover { background: #f0f8fc; }

.ma-skill-row.ma-skill-passed   { background: #f0faf4; }
.ma-skill-row.ma-skill-assigned { background: #f0f6fc; }

.ma-skill-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  width: 100%;
}

.ma-skill-label input[type=checkbox] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
}

.ma-skill-info { flex: 1; }

.ma-skill-name {
  font-size: 13px;
  font-weight: 600;
  color: #1e3d4f;
  margin-bottom: 4px;
  line-height: 1.4;
}

.ma-skill-codes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Assign bar (sticky bottom) ──────────────────────────────── */
.ma-assign-bar {
  position: sticky;
  bottom: 0;
  z-index: 50;
  background: #fff;
  border-top: 2px solid #90d0be;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  box-shadow: 0 -3px 12px rgba(0,0,0,0.1);
  margin: 0 -20px;
}

.ma-assign-summary {
  font-size: 14px;
  font-weight: 600;
  color: #305e7a;
}

/* ── Assigned domain blocks ──────────────────────────────────── */
.ma-assigned-domain {
  margin-bottom: 20px;
}

.ma-assigned-domain-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #305e7a;
  padding: 8px 0 6px;
  border-bottom: 2px solid #90d0be;
  margin-bottom: 8px;
}

/* ── Search results status rows ──────────────────────────────── */
.ma-row-passed   td { background: #f0faf4; }
.ma-row-assigned td { background: #f0f6fc; }

/* ── Tablet: assignment page ─────────────────────────────────── */
@media (max-width: 1024px) {
  .ma-grade-pill { width: 48px; height: 48px; font-size: 14px; }
  .ma-skill-label { padding: 12px 14px; gap: 14px; }
  .ma-skill-label input[type=checkbox] { width: 22px; height: 22px; margin-top: 1px; }
  .ma-skill-name  { font-size: 14px; }
  .ma-domain-check-label input[type=checkbox] { width: 22px; height: 22px; }
  .ma-assign-bar  { padding: 14px 16px; margin: 0 -12px; }
  .ma-assign-bar .tt-btn { min-width: 200px; justify-content: center; }
  .ma-top-field   { flex: 1 1 100%; }
  .ma-top-field-sm { flex: 1 1 100%; }
}

/* ═══════════════════════════════════════════════════════════════
   MATH ASSIGNMENT PAGE — v2 (multi-grade accumulation)
   ═══════════════════════════════════════════════════════════════ */

/* ── Top card ────────────────────────────────────────────────── */
.ma-top-card { border-radius: 8px 8px 0 0; margin-bottom: 0; }

.ma-top-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.ma-top-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1 1 200px;
}

.ma-top-field-sm { flex: 0 1 130px; }

.ma-field-label {
  font-size: 11px;
  font-weight: 700;
  color: #305e7a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Student status chips */
.ma-student-status {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e0e8ed;
  align-items: center;
}

.ma-status-chip {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  background: #e8f2f8;
  color: #305e7a;
}

.ma-chip-green { background: #d1e7dd; color: #0f5132; }
.ma-chip-blue  { background: #d0e7f5; color: #1a4a6e; }

/* ── Mode tabs ───────────────────────────────────────────────── */
.ma-mode-tabs    { border-radius: 0; margin-bottom: 0; }
.ma-tab-panels   { border-radius: 0 0 8px 8px; }

/* ── Grade controls box ──────────────────────────────────────── */
.ma-grade-controls {
  background: #f0f7fb;
  border: 1px solid #c5d8e3;
  border-radius: 7px;
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ma-grade-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Grade pills */
.ma-grade-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

.ma-grade-pill {
  width: 44px;
  height: 44px;
  border: 2px solid #c5d8e3;
  border-radius: 50%;
  background: #fff;
  color: #305e7a;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  position: relative;
}

.ma-grade-pill:hover {
  background: #e0f0fa;
  border-color: #305e7a;
  transform: scale(1.08);
}

.ma-grade-pill.ma-grade-pill-active {
  background: #305e7a;
  color: #fff;
  border-color: #305e7a;
  box-shadow: 0 2px 8px rgba(48,94,122,0.35);
}

.ma-grade-pill.ma-grade-pill-loading {
  opacity: 0.6;
  cursor: wait;
}

/* Active grades bar */
.ma-active-grades-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #c5d8e3;
  border-radius: 6px;
}

.ma-active-grade-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.ma-grade-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #305e7a;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px 3px 10px;
  border-radius: 20px;
}

.ma-grade-tag-remove {
  background: none;
  border: none;
  color: #90d0be;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0;
  margin-left: 2px;
}

.ma-grade-tag-remove:hover { color: #fff; }

/* Filter options */
.ma-grade-options {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

/* ── Empty state ─────────────────────────────────────────────── */
.ma-empty-state {
  text-align: center;
  padding: 48px 20px;
  color: #6c757d;
}

.ma-empty-icon  { font-size: 48px; margin-bottom: 14px; }
.ma-empty-title { font-size: 18px; font-weight: 700; color: #305e7a; margin-bottom: 8px; }
.ma-empty-sub   { font-size: 14px; max-width: 440px; margin: 0 auto; line-height: 1.6; }

/* ── Domain checklist ────────────────────────────────────────── */
.ma-domain-checklist {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 90px; /* room for sticky assign bar */
}

.ma-domain-block {
  border: 1px solid #c5d8e3;
  border-radius: 8px;
  overflow: hidden;
}

.ma-domain-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #305e7a;
  flex-wrap: wrap;
}

.ma-domain-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}

.ma-domain-check-label input[type=checkbox] {
  width: 18px; height: 18px;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: #90d0be;
}

.ma-domain-name {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ma-domain-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ma-domain-grade-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(255,255,255,0.18);
  color: #fff;
}

.ma-domain-count-label {
  font-size: 12px;
  color: #90d0be;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Skill rows ──────────────────────────────────────────────── */
.ma-domain-skills { display: flex; flex-direction: column; }

.ma-skill-row {
  border-bottom: 1px solid #e8eef2;
  transition: background 0.1s;
}

.ma-skill-row:last-child    { border-bottom: none; }
.ma-skill-row:hover         { background: #f0f8fc; }
.ma-skill-row.ma-skill-passed   { background: #f0faf4; }
.ma-skill-row.ma-skill-assigned { background: #f0f6fc; }

.ma-skill-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  width: 100%;
}

.ma-skill-label input[type=checkbox] {
  width: 18px; height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: #305e7a;
}

.ma-skill-info { flex: 1; min-width: 0; }

.ma-skill-name {
  font-size: 13px;
  font-weight: 600;
  color: #1e3d4f;
  margin-bottom: 4px;
  line-height: 1.4;
}

.ma-skill-codes {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.ma-skill-grade-tag {
  font-size: 10px;
  font-weight: 700;
  background: #305e7a;
  color: #fff;
  padding: 1px 6px;
  border-radius: 8px;
}

/* ── Sticky assign bar ───────────────────────────────────────── */
.ma-assign-bar {
  position: sticky;
  bottom: 0;
  z-index: 200;
  background: #fff;
  border-top: 3px solid #90d0be;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.12);
  margin: 0 -20px;
  padding: 0;
  display: flex;
}

.ma-assign-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  width: 100%;
  padding: 12px 24px;
}

.ma-assign-summary {
  font-size: 15px;
  font-weight: 700;
  color: #305e7a;
}

/* ── Assigned tab domain blocks ──────────────────────────────── */
.ma-assigned-domain { margin-bottom: 20px; }

.ma-assigned-domain-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #305e7a;
  padding: 8px 0 6px;
  border-bottom: 2px solid #90d0be;
  margin-bottom: 8px;
}

/* ── Search result status rows ───────────────────────────────── */
.ma-row-passed   td { background: #f0faf4; }
.ma-row-assigned td { background: #f0f6fc; }

/* ── Tablet ──────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .ma-grade-pill { width: 50px; height: 50px; font-size: 14px; }
  .ma-skill-label { padding: 12px 14px; gap: 14px; }
  .ma-skill-label input[type=checkbox],
  .ma-domain-check-label input[type=checkbox] { width: 22px; height: 22px; }
  .ma-skill-name { font-size: 14px; }
  .ma-assign-bar-inner { padding: 14px 16px; }
  .ma-assign-bar-inner .tt-btn { width: 100%; justify-content: center; }
  .ma-assign-summary { font-size: 14px; }
  .ma-top-field, .ma-top-field-sm { flex: 1 1 100%; }
}