/* Teacher feedback canvas (teacher-feedback-board.js). Quiet dotted canvas, floating tool rail,
 * the answer on a wide "paper", marks drawn over the words. Used by the CRM review screen and
 * (read-only) the student's feedback page. */
.tfb, .tfb-vars {
    --tfb-fix: #E5484D; --tfb-tip: #E09100; --tfb-good: #12A08A;
    --tfb-fix-soft: #FDE4E4; --tfb-tip-soft: #FDF0D5; --tfb-good-soft: #D5F4EE;
    --tfb-bg: var(--crm-bg, #F6F8FB); --tfb-surface: var(--crm-surface, #fff); --tfb-sunk: var(--crm-surface-dim, #EEF2F7);
    --tfb-line: var(--crm-border, #E2E8F0); --tfb-fg: var(--crm-text-main, #131A26); --tfb-muted: var(--crm-text-muted, #66748A);
    --tfb-primary: #3B82F6; --tfb-primary-soft: #DCE9FE;
    --tfb-read: 'Literata', Georgia, 'Times New Roman', serif;
    --tfb-shadow: 0 1px 2px rgba(19,26,38,.06), 0 6px 20px -6px rgba(19,26,38,.14);
    color: var(--tfb-fg);
}
.tfb-tone-fix { --c: var(--tfb-fix); } .tfb-tone-tip { --c: var(--tfb-tip); } .tfb-tone-good { --c: var(--tfb-good); }
.tfb [hidden] { display: none !important; }
.tfb-icon { width: 18px; height: 18px; flex: none; }
.tfb [data-tip] { position: relative; }
.tfb [data-tip]:hover::after { content: attr(data-tip); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%); white-space: nowrap; background: var(--tfb-fg); color: var(--tfb-surface); font: 500 12px/1.4 Inter, system-ui, sans-serif; padding: 4px 8px; border-radius: 6px; pointer-events: none; z-index: 20; }

.tfb-area { position: relative; min-height: 600px; overflow: hidden;
    background: radial-gradient(circle at 1px 1px, var(--tfb-line) 1px, transparent 1.2px) 0 0 / 22px 22px, var(--tfb-bg); }
.tfb-tools { position: absolute; left: 16px; top: 24px; z-index: 6; display: flex; flex-direction: column; gap: 2px; padding: 6px; background: var(--tfb-surface); border: 1px solid var(--tfb-line); border-radius: 14px; box-shadow: var(--tfb-shadow); }
.tfb-tools hr { border: 0; border-top: 1px solid var(--tfb-line); margin: 4px 2px; }
.tfb-tool { width: 38px; height: 38px; border: 0; border-radius: 9px; background: transparent; display: grid; place-items: center; color: var(--tfb-muted); cursor: pointer; }
.tfb-tool:hover { background: var(--tfb-sunk); color: var(--tfb-fg); }
.tfb-tool[aria-pressed="true"] { background: var(--tfb-primary-soft); color: var(--tfb-primary); }
.tfb-swatch { width: 38px; height: 30px; border: 0; background: transparent; display: grid; place-items: center; border-radius: 9px; cursor: pointer; }
.tfb-swatch i { width: 16px; height: 16px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--tfb-surface); }
.tfb-swatch[aria-pressed="true"] i { box-shadow: 0 0 0 2px var(--tfb-surface), 0 0 0 4px var(--c); }
.tfb-stamps { position: absolute; left: 66px; z-index: 7; display: flex; gap: 2px; padding: 4px; background: var(--tfb-surface); border: 1px solid var(--tfb-line); border-radius: 12px; box-shadow: var(--tfb-shadow); }
.tfb-stamps button { width: 36px; height: 36px; border: 0; background: transparent; border-radius: 8px; font: 500 20px var(--tfb-read); color: var(--tfb-fg); cursor: pointer; }
.tfb-stamps button:hover { background: var(--tfb-sunk); }
.tfb-stamps button[aria-pressed="true"] { background: var(--tfb-primary-soft); color: var(--tfb-primary); }
.tfb-stamps [data-tip]:hover::after { left: 50%; top: calc(100% + 8px); transform: translateX(-50%); }

.tfb-stage { padding: 48px 96px 120px; display: grid; justify-items: center; }
.tfb-paper { position: relative; width: min(860px, 100%); touch-action: none; }
.tfb-paper[data-tool="pen"], .tfb-paper[data-tool="highlight"] { cursor: crosshair; }
.tfb-paper[data-tool="stamp"], .tfb-paper[data-tool="pin"], .tfb-paper[data-tool="voice"] { cursor: copy; }
.tfb-paper[data-tool="erase"] { cursor: cell; }
.tfb-paper[data-tool]:not([data-tool="select"]) .tfb-text { user-select: none; }
.tfb-ink { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.tfb-marks { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.tfb-mark { position: absolute; pointer-events: auto; user-select: none; }
.tfb-stamp { transform: translate(-50%, -50%); font: 600 26px/1 var(--tfb-read); color: var(--c); cursor: grab; padding: 2px 4px; }
.tfb-pin { width: 26px; height: 26px; border-radius: 50% 50% 50% 4px; border: 0; background: var(--c); color: #fff; font: 700 12px ui-monospace, 'JetBrains Mono', monospace; display: grid; place-items: center; box-shadow: 0 2px 6px -1px rgba(0,0,0,.3); cursor: pointer; transform: translate(-4px, -100%); padding: 0; }
.tfb-pin.has-voice::after { content: ''; position: absolute; right: -3px; top: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--tfb-surface); box-shadow: inset 0 0 0 3px var(--c); }
.tfb-pin.is-open { outline: 2px solid var(--tfb-fg); outline-offset: 2px; }

.tfb-text { position: relative; z-index: 1; }
.tfb-transcript { font: 400 26px/2.7 var(--tfb-read); letter-spacing: .005em; }
.tfb-essay { font: 400 21px/2.3 var(--tfb-read); max-width: 68ch; }
.tfb-essay p { margin: 0 0 26px; }
.tfb-empty { font: 15px/1.5 Inter, system-ui, sans-serif; color: var(--tfb-muted); margin: 0; }
.tfb-w { border-radius: 4px; padding: 0 1px; text-decoration-thickness: 2px; text-underline-offset: 8px; }
.tfb-paper[data-tool="select"] .tfb-transcript .tfb-w { cursor: pointer; }
.tfb-ai .tfb-w.is-mid { text-decoration: underline dotted var(--tfb-tip); }
.tfb-ai .tfb-w.is-low { text-decoration: underline dotted var(--tfb-fix); }
.tfb-ai .tfb-w.is-miss { color: var(--tfb-muted); text-decoration: line-through; }
.tfb-w.is-now { background: var(--tfb-primary-soft); }

/* Note popover */
.tfb-pop { position: absolute; z-index: 8; width: 300px; background: var(--tfb-surface); border: 1px solid var(--tfb-line); border-radius: 12px; box-shadow: var(--tfb-shadow); padding: 10px; display: grid; gap: 8px; font: 14px/1.5 Inter, system-ui, sans-serif; }
.tfb-pop-head { display: flex; align-items: center; gap: 6px; font: 12px ui-monospace, 'JetBrains Mono', monospace; color: var(--tfb-muted); }
.tfb-pop-head span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tfb-dot { display: block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.tfb-dotbtn { border: 0; background: transparent; padding: 4px; border-radius: 6px; cursor: pointer; }
.tfb-dotbtn[aria-pressed="true"] { background: var(--tfb-sunk); }
.tfb-dotbtn[aria-pressed="true"] .tfb-dot { box-shadow: 0 0 0 2px var(--tfb-surface), 0 0 0 3.5px var(--c); }
.tfb-pop-head button[data-pop="close"], .tfb-linkbtn { border: 0; background: transparent; color: var(--tfb-muted); border-radius: 6px; padding: 2px 6px; cursor: pointer; font: inherit; font-size: 12px; }
.tfb-pop-head button[data-pop="close"]:hover, .tfb-linkbtn:hover { background: var(--tfb-sunk); color: var(--tfb-fg); }
.tfb-pop textarea, .tfb-pop input, .tfb-pop select { font: 14px/1.5 Inter, system-ui, sans-serif; color: var(--tfb-fg); background: var(--tfb-sunk); border: 0; border-radius: 8px; padding: 8px 10px; width: 100%; }
.tfb-pop textarea { resize: none; min-height: 64px; }
.tfb-pop input { font-size: 13px; padding: 6px 10px; }
.tfb-pop select { width: auto; font-size: 12px; padding: 4px 6px; }
.tfb-pop-text { margin: 0; white-space: pre-wrap; }
.tfb-pop-better { margin: 0; font-size: 13px; }
.tfb-pop-row { display: flex; align-items: center; gap: 8px; }
.tfb-grow { flex: 1; }
.tfb-vslot { display: inline-flex; align-items: center; gap: 4px; }
.tfb-rec { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--tfb-line); background: var(--tfb-surface); border-radius: 999px; padding: 4px 12px 4px 8px; font: 600 12px Inter, system-ui, sans-serif; color: var(--tfb-fg); cursor: pointer; white-space: nowrap; }
.tfb-rec::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--tfb-fix); }
.tfb-rec.is-on { background: var(--tfb-fix); border-color: var(--tfb-fix); color: #fff; }
.tfb-rec.is-on::before { background: #fff; animation: tfb-blink 1s infinite; }
@keyframes tfb-blink { 50% { opacity: .3; } }
.tfb-vchip { display: inline-flex; align-items: center; gap: 8px; background: var(--tfb-sunk); border-radius: 999px; padding: 3px 10px 3px 3px; font: 12px ui-monospace, 'JetBrains Mono', monospace; }
.tfb-vchip button { width: 24px; height: 24px; border: 0; border-radius: 50%; background: var(--tfb-fg); color: var(--tfb-surface); display: grid; place-items: center; cursor: pointer; font-size: 10px; padding: 0; }
.tfb-vchip i { width: 60px; height: 14px; background: repeating-linear-gradient(90deg, var(--tfb-muted) 0 2px, transparent 2px 5px); opacity: .6; border-radius: 2px; }
@media (prefers-reduced-motion: reduce) { .tfb * { animation: none !important; transition: none !important; } }
