/* Teach the AI — coach, modal, lesson history. Follows the AT Central type standard:
   500 for data/helper text, 600 for labels and controls, sentence case. */

.ai-teach-flag {
  display: inline-block; margin-top: 6px; padding: 0; border: 0; background: none;
  color: var(--blue); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.ai-teach-flag:hover { text-decoration: underline; }
/* AI replies sit in solid blue bubbles: make the link white so it is visible. */
.message.outbound .ai-teach-flag { display: block; color: #fff; text-decoration: underline; text-underline-offset: 2px; opacity: .95; }
.message.outbound .ai-teach-flag:hover { opacity: 1; }

.teach-coach { display: flex; flex-direction: column; gap: 14px; }
.teach-field { display: flex; flex-direction: column; gap: 6px; }
.teach-field > span { font-size: 13px; font-weight: 600; color: var(--ink); }
.teach-field textarea {
  width: 100%; box-sizing: border-box; resize: vertical; min-height: 56px;
  border: 1px solid var(--line-dark); border-radius: var(--radius); padding: 10px 12px;
  font: inherit; font-size: 14px; font-weight: 500; color: var(--ink); background: var(--surface);
}
.teach-field textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }

.teach-mic { align-self: flex-start; display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.teach-mic-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.teach-mic.is-listening { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.teach-mic.is-listening .teach-mic-dot { background: var(--danger); animation: teachPulse 1s ease-in-out infinite; }
@keyframes teachPulse { 50% { opacity: .3; } }

.teach-context { display: flex; flex-direction: column; gap: 8px; }
.teach-bubble { border-radius: var(--radius); padding: 10px 12px; background: var(--canvas); border: 1px solid var(--line); }
.teach-bubble > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.teach-bubble > p { margin: 0; font-size: 13.5px; font-weight: 500; color: var(--ink); white-space: pre-wrap; }
.teach-bubble.is-ai { background: var(--blue-soft); border-color: transparent; }
.teach-bubble.is-new { background: var(--success-soft); }
.teach-bubble.is-note { background: var(--warning-soft); border-color: transparent; }

.teach-block { display: flex; flex-direction: column; gap: 6px; }
.teach-block > p { margin: 0; font-size: 14px; font-weight: 500; color: var(--ink); }
.teach-kicker { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.teach-question > p { font-weight: 600; }

.teach-change { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.teach-change > summary { display: flex; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer; list-style: none; }
.teach-change > summary::-webkit-details-marker { display: none; }
.teach-change[open] > summary { border-bottom: 1px solid var(--line); }
.teach-change-name { font-size: 13.5px; font-weight: 500; color: var(--ink); }
.teach-op { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--blue-soft); color: var(--blue-dark); }
.teach-op-create { background: var(--success-soft); color: var(--success); }
.teach-op-disable { background: var(--danger-soft); color: var(--danger); }
.teach-why { margin: 10px 12px 0; font-size: 13px; font-weight: 500; color: var(--muted); }
.teach-diff { margin: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.teach-diff-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.teach-diff-before, .teach-diff-after { font-size: 13px; font-weight: 500; white-space: pre-wrap; padding: 8px 10px; border-radius: 6px; }
.teach-diff-before { background: var(--danger-soft); color: var(--ink); text-decoration: line-through; text-decoration-color: rgba(194,65,75,.45); }
.teach-diff-after { background: var(--success-soft); color: var(--ink); }

.teach-checks { border-radius: var(--radius); padding: 10px 12px; font-size: 13.5px; font-weight: 500; }
.teach-checks.is-ok { background: var(--success-soft); color: var(--success); }
.teach-checks.is-warn { background: var(--warning-soft); color: var(--ink); }
.teach-checks strong { display: block; font-weight: 600; margin-bottom: 6px; }
.teach-checks p { margin: 8px 0 0; color: var(--muted); }
.teach-check-row { display: flex; flex-direction: column; padding: 4px 0; }
.teach-check-row small { color: var(--muted); font-size: 12.5px; }

.teach-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.teach-actions .teach-discard { margin-right: auto; color: var(--danger, #b42318); }
.teach-draft-note { font-size: 13px; font-weight: 500; color: var(--muted); margin: 0 0 8px; }
.teach-working { display: flex; align-items: center; gap: 10px; padding: 24px 4px; font-size: 14px; font-weight: 500; color: var(--muted); }
.teach-spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-dark); border-top-color: var(--blue); animation: teachSpin .8s linear infinite; flex: none; }
@keyframes teachSpin { to { transform: rotate(360deg); } }

/* After apply */
.teach-done { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: var(--radius); background: var(--success-soft); }
.teach-done strong { font-size: 14.5px; font-weight: 600; color: var(--success); }
.teach-done span { font-size: 13px; font-weight: 500; color: var(--ink); }
.teach-updated { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.teach-updated li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; color: var(--ink); }
.teach-muted { margin: 0; font-size: 13px; font-weight: 500; color: var(--muted); }

/* Same mistake elsewhere */
.teach-similar-summary { margin: 0 0 8px; font-size: 13.5px; font-weight: 500; color: var(--ink); }
.teach-similar-summary strong { font-weight: 700; }
.teach-similar-list { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; padding-right: 2px; }
.teach-similar-row { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; cursor: pointer; background: var(--surface); }
.teach-similar-row input, .teach-select-all input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; cursor: pointer; accent-color: var(--blue); }
.teach-similar-row:hover { border-color: var(--line-dark); }
.teach-similar-row:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.teach-similar-row.is-closed:not(:has(input:checked)) .teach-similar-main { opacity: .7; }
.teach-select-all { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; padding: 0 12px; cursor: pointer; }
.teach-select-all span { font-size: 13px; font-weight: 600; color: var(--ink); }
.teach-select-all small { margin-left: auto; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.teach-similar-choose.is-empty > span { color: var(--warning); }
.teach-similar-choose button:disabled { opacity: .45; cursor: not-allowed; }
.teach-similar-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.teach-similar-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.teach-similar-head strong { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.teach-similar-head span { font-size: 12px; font-weight: 500; color: var(--muted); }
.teach-similar-head a { margin-left: auto; font-size: 12.5px; font-weight: 600; color: var(--blue); text-decoration: none; }
.teach-similar-head a:hover { text-decoration: underline; }
.teach-similar-text { font-size: 13px; font-weight: 500; color: var(--ink); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.teach-similar-text span { color: var(--muted); font-weight: 600; }
.teach-similar-note { align-self: flex-start; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--canvas); color: var(--muted); }
.is-open .teach-similar-note { background: var(--danger-soft); color: var(--danger); }
.is-booked .teach-similar-note { background: var(--warning-soft); color: var(--warning); }
.is-answered .teach-similar-note { background: var(--blue-soft); color: var(--blue-dark); }
.teach-similar-choose { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.teach-similar-choose > span { font-size: 13px; font-weight: 600; color: var(--ink); }
.teach-one-by-one, .teach-group { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.teach-one-by-one a { display: flex; flex-direction: column; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; }
.teach-one-by-one a:hover { border-color: var(--blue); }
.teach-one-by-one a strong { font-size: 13.5px; font-weight: 600; color: var(--blue); }
.teach-one-by-one a span { font-size: 12px; font-weight: 500; color: var(--muted); }
.teach-sender { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink); margin-right: auto; }
.teach-sender select { font: inherit; font-weight: 500; padding: 6px 8px; border: 1px solid var(--line-dark); border-radius: 6px; }
.teach-similar-link { align-self: flex-start; padding: 0; border: 0; background: none; color: var(--blue); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.teach-similar-link:hover { text-decoration: underline; }

/* Self-audit health */
.teach-health { margin-bottom: 16px; }
.teach-health-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.teach-health-bar strong { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.teach-health-bar > span:not(.teach-health-dot) { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.teach-health-bar button { margin-left: auto; padding: 0; border: 0; background: none; color: var(--blue); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.teach-health-bar button:disabled { color: var(--muted); cursor: default; }
.teach-health-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--success); flex: none; }
.teach-health-bar.is-warn { border-color: transparent; background: var(--warning-soft); }
.teach-health-bar.is-warn .teach-health-dot { background: var(--warning); }
.teach-health-panel { display: flex; flex-direction: column; gap: 10px; }
.teach-conflicts { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.teach-conflict { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.teach-conflict strong { font-size: 14px; font-weight: 600; color: var(--ink); }
.teach-conflict p { margin: 0; font-size: 13px; font-weight: 500; color: var(--muted); }
.teach-conflict p.teach-conflict-q { color: var(--ink); font-weight: 600; }
.teach-conflict-refs { display: flex; flex-direction: column; gap: 8px; }
.teach-conflict-names { margin: 0; padding-left: 18px; font-size: 13px; font-weight: 500; color: var(--ink); }
.teach-conflict-ask { margin: 6px 0 0 !important; font-weight: 600 !important; }

/* Settle a contradiction */
.teach-modal.teach-modal-wide { width: min(860px, 100%); }
.teach-entries { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.teach-entry { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.teach-entry-head { display: flex; flex-direction: column; gap: 2px; }
.teach-entry-kind { font-size: 12px; font-weight: 600; color: var(--muted); }
.teach-entry-head strong { font-size: 14px; font-weight: 600; color: var(--ink); }
.teach-entry-field span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.teach-entry-field p { margin: 0; font-size: 13.5px; font-weight: 500; color: var(--ink); white-space: pre-wrap; }
.teach-entry .teach-actions { margin-top: auto; justify-content: flex-start; }
.teach-mark { background: var(--warning-soft); color: var(--ink); padding: 1px 2px; border-radius: 3px; box-shadow: inset 0 -2px 0 var(--warning); }
.teach-change-flat { padding-bottom: 2px; }
.teach-change-top { display: flex; align-items: center; gap: 8px; padding: 10px 12px 0; }
.teach-diff-edit { width: 100%; box-sizing: border-box; resize: vertical; font: inherit; font-size: 13px; font-weight: 500; color: var(--ink); background: var(--success-soft); border: 1px solid transparent; border-radius: 6px; padding: 8px 10px; }
.teach-diff-edit:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.teach-change-flat + .teach-change-flat { margin-top: 8px; }

/* Modal */
.teach-modal-backdrop { position: fixed; inset: 0; z-index: 4000; background: rgba(15,25,40,.38); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow-y: auto; }
.teach-modal { width: min(640px, 100%); background: var(--surface); border-radius: 12px; box-shadow: 0 18px 50px rgba(15,25,40,.25); }
.teach-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.teach-modal-head h3 { margin: 0; font-size: 17px; font-weight: 600; color: var(--ink); }
.teach-close { border: 0; background: none; font-size: 24px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.teach-modal-body { padding: 18px 20px 20px; }

/* Teach tab */
.teach-tab-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.teach-tab-grid .panel { padding: 18px; }
.teach-tab-grid h4 { margin: 0 0 14px; font-size: 16px; font-weight: 600; color: var(--ink); }
.teach-history-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.teach-history-head h4 { margin: 0; flex: 1; }
.teach-tests-meta { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.teach-history { display: flex; flex-direction: column; gap: 10px; }
.teach-lesson { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.teach-lesson.is-undone { opacity: .55; }
.teach-lesson-head { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.teach-lesson-head strong { display: block; font-size: 13.5px; font-weight: 500; color: var(--ink); }
.teach-lesson-head small { font-size: 12px; font-weight: 500; color: var(--muted); }
.teach-lesson details > summary { font-size: 12.5px; font-weight: 600; color: var(--blue); cursor: pointer; }
.teach-lesson details[open] { display: flex; flex-direction: column; gap: 8px; }

/* Coaching additions (Oct 17 2026): primer, who-is-this-for, scope, reach, pattern nudge */
.teach-primer { border: 1px solid var(--line); border-radius: var(--radius); background: var(--canvas); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.teach-primer strong { font-size: 14px; font-weight: 600; color: var(--ink); }
.teach-primer ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; }
.teach-primer li { font-size: 13px; font-weight: 500; color: var(--ink); }
.teach-primer li b { font-weight: 600; }
.teach-primer button { align-self: flex-start; }
.teach-who { display: flex; flex-direction: column; gap: 6px; }
.teach-who > span { font-size: 13px; font-weight: 600; color: var(--ink); }
.teach-who-options { display: flex; flex-wrap: wrap; gap: 8px; }
.teach-who-btn { border: 1px solid var(--line-dark); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 7px 13px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.teach-who-btn:hover { border-color: var(--blue); }
.teach-who-btn.is-on { background: var(--blue-soft); border-color: var(--blue); color: var(--blue-dark); }
.teach-special, .teach-nudge { border-radius: var(--radius); padding: 10px 12px; background: var(--warning-soft); }
.teach-nudge button { align-self: flex-start; margin-top: 2px; }
.teach-scope { display: flex; align-items: center; gap: 8px; margin: 10px 12px 0; }
.teach-scope > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.teach-scope select { font: inherit; font-size: 13px; font-weight: 500; color: var(--ink); border: 1px solid var(--line-dark); border-radius: 6px; padding: 4px 8px; background: var(--surface); }
.teach-scope-tag { margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--canvas); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }
.teach-also { display: flex; flex-direction: column; gap: 6px; padding-top: 4px; }
.teach-also + .teach-also { border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 4px; }
.teach-muted { margin: 0; font-size: 12.5px; font-weight: 500; color: var(--muted); }

@media (max-width: 980px) { .teach-tab-grid { grid-template-columns: 1fr; } }

/* Nov 2 2026: Teach the AI layout — score, Needs attention, folded Correct the AI, What Allie has learned. Brand colors only. */
[data-player-ai-panel="teach"] { display: flex; flex-direction: column; gap: 16px; }
[data-player-ai-panel="teach"]:not(.is-active) { display: none; }
.teach-score { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.teach-score:empty { display: none; }
.teach-score-card { background: #fff; border: 1px solid #d9e2ec; border-radius: 12px; padding: 14px 18px; display: flex; flex-direction: column; gap: 4px; }
.teach-score-card span { font-size: 13px; font-weight: 600; color: #3f4f61; }
.teach-score-card strong { font-size: 26px; font-weight: 700; color: #0a1f56; }
.teach-score-card small { font-size: 12.5px; color: #3f4f61; }
/* Nov 4 2026: score cards are clickable */
button.teach-score-card { font: inherit; text-align: left; cursor: pointer; width: 100%; }
button.teach-score-card:hover { border-color: #9fb3c8; }
button.teach-score-card.is-active { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.teach-attention[hidden], .teach-score-list[hidden] { display: none; }
.teach-score-list .teach-attention-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.teach-score-item { padding: 12px 20px; border-bottom: 1px solid #e6ebf1; display: flex; flex-direction: column; gap: 4px; }
.teach-score-item p { margin: 0; font-size: 14px; color: #1f2d3d; overflow-wrap: anywhere; }
.teach-score-item-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.teach-score-item-head small { color: #3f4f61; font-size: 12.5px; }
.teach-score-item-head a { font-size: 13px; font-weight: 600; color: var(--blue); }
.teach-score-list > .secondary-button { margin: 12px 20px; }
.teach-score-loading { padding: 16px 20px; }
.teach-attention, .teach-tab-history, .teach-fold { padding: 0; overflow: hidden; }
.teach-attention-head { padding: 16px 20px; border-bottom: 1px solid #e6ebf1; }
.teach-attention-head h4, .teach-tab-history h4 { margin: 0; font-size: 17px; font-weight: 700; color: #0a1f56; }
.teach-attention-list:empty { display: none; }
.teach-gap { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; padding: 14px 20px; border-bottom: 1px solid #e6ebf1; }
.teach-gap-main { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.teach-gap-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.teach-gap-title strong { font-size: 15px; color: #0a1f56; }
.teach-gap p { margin: 0; font-size: 13px; line-height: 1.5; color: #3f4f61; }
.teach-gap small { font-size: 12.5px; color: #3f4f61; }
.teach-gap .teach-actions { display: flex; gap: 8px; align-items: center; }
.teach-gap-editor { flex: 1 1 100%; display: flex; flex-direction: column; gap: 10px; background: #f8fafc; border: 1px solid #e6ebf1; border-radius: 10px; padding: 12px; }
.teach-gap-editor label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: #0a1f56; }
.teach-gap-editor textarea { font: inherit; font-size: 14px; padding: 10px; border: 1px solid #d9e2ec; border-radius: 8px; resize: vertical; }
.teach-kind { font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; color: #0a1f56; background: #e4e8ee; }
.teach-kind.is-gap { background: #d4e5f8; }
.teach-kind.is-conflict { background: #d7eff0; }
.teach-health { margin: 0; }
.teach-health:empty { display: none; }
.teach-health-fold > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 20px; }
.teach-health-fold > summary::-webkit-details-marker { display: none; }
.teach-health-fold > summary strong { font-size: 15px; color: #0a1f56; }
.teach-fold-meta { font-size: 12.5px; color: #3f4f61; }
.teach-health-fold .teach-conflicts { padding: 0 20px 16px; }
.teach-fold > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; }
.teach-fold > summary::-webkit-details-marker { display: none; }
.teach-fold > summary > span:first-child { display: flex; flex-direction: column; gap: 3px; }
.teach-fold > summary strong { font-size: 17px; color: #0a1f56; }
.teach-fold > summary small { font-size: 13px; color: #3f4f61; }
.teach-fold[open] .teach-fold-button { display: none; }
.teach-fold #aiTeachCoach { padding: 0 20px 20px; }
.teach-tab-history .teach-history-head { padding: 16px 20px; margin: 0; border-bottom: 1px solid #e6ebf1; flex-wrap: wrap; }
.teach-tab-history .teach-history { padding: 0 20px; }
.teach-tab-history #aiTeachShowAll { margin: 12px 20px 16px; }
.teach-search { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: #3f4f61; }
.teach-search input { font: inherit; font-size: 13px; height: 36px; width: 260px; max-width: 60vw; padding: 0 12px; border: 1px solid #d9e2ec; border-radius: 8px; }
@media (max-width: 760px) { .teach-score { grid-template-columns: 1fr; } }