/* Teacher app layout, phone first (412px wide mockups), after the design handoff. */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--screen); color: var(--ink); font: 15px/1.45 var(--font-ui); font-variant-numeric: tabular-nums; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.app { max-width: 480px; min-height: 100%; margin: 0 auto; background: var(--screen); display: flex; flex-direction: column; }
.screen { flex: 1; display: flex; flex-direction: column; padding-bottom: 24px; }
.content { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
h1 { font-size: 22px; font-weight: 600; margin: 0; }
h2 { font-size: 16px; font-weight: 600; margin: 0; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-muted); }
.muted { color: var(--ink-muted); font-size: 13px; }
.hint { color: var(--ink-hint); font-size: 12px; }
.error-text { color: var(--error-ink); font-size: 13px; }

/* Top bar */
.topbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.topbar h1 { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 19px; }
.back { color: var(--primary); text-decoration: none; font-weight: 500; min-height: var(--tap); display: inline-flex; align-items: center; background: none; border: 0; padding: 0; cursor: pointer; }

/* Buttons */
.button { min-height: var(--tap); padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--input-line); background: var(--card); font-weight: 600; cursor: pointer; }
.button.primary { background: var(--primary); border-color: var(--primary); color: #fff; min-height: 52px; border-radius: var(--radius-card); width: 100%; }
.button.primary:active { background: var(--primary-dark); }
.button.primary:disabled { background: var(--ink-hint); border-color: var(--ink-hint); }
.button:disabled:not(.primary) { opacity: .5; cursor: default; }
.button.big { min-height: 60px; font-size: 17px; }
.button.danger { color: var(--intensive); border-color: var(--intensive); }
.button.link { border: 0; background: none; color: var(--primary); padding: 0; min-height: var(--tap); font-weight: 500; text-align: left; }
.button.link.danger { color: var(--intensive); }
.button.block { width: 100%; }
.icon-button { min-width: var(--tap); min-height: var(--tap); border: 0; background: none; font-size: 20px; color: var(--primary); cursor: pointer; }

/* Cards and rows */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 12px 14px; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-card); overflow: hidden; }
.row { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 14px; border-bottom: 1px solid var(--line-soft); width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; cursor: pointer; }
.row:last-child { border-bottom: 0; }
.row:disabled { cursor: default; opacity: .6; }
.place { padding: 12px 16px 0; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; }
.progress { height: 6px; background: var(--line-soft); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.progress > span { display: block; height: 100%; background: var(--lime); }
.banner { border-radius: var(--radius-card); padding: 12px 14px; }
.banner.period { background: var(--primary); color: #fff; }
.banner.period .eyebrow { color: rgba(255,255,255,.8); }
.banner.warning { background: var(--strategic-tint); color: var(--warning-ink); }
.banner.error { background: var(--intensive-tint); color: var(--error-ink); }
.banner.info { background: var(--teal-tint); color: var(--teal); }
.banner.dark { background: var(--ink); color: #fff; }

/* Chips and bands */
.chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--canvas); color: var(--ink-muted); }
.chip.ok { background: var(--benchmark-tint); color: var(--benchmark); }
.chip.pending { background: var(--strategic-tint); color: var(--strategic); }
.chip.error { background: var(--intensive-tint); color: var(--intensive); }
.chip.progress-chip { background: var(--primary-tint); color: var(--primary-dark); }
.chip.outline { background: var(--card); border: 1px solid var(--input-line); }
.chip.provisional { background: var(--card); border: 1.5px dashed var(--ink-hint); color: var(--ink-muted); }
.band { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; }
.band.benchmark { background: var(--benchmark-tint); color: var(--benchmark); }
.band.strategic { background: var(--strategic-tint); color: var(--strategic); }
.band.intensive { background: var(--intensive-tint); color: var(--intensive); }
.band.none { background: var(--canvas); color: var(--ink-muted); }

/* Forms */
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-muted); }
input[type="text"], input[type="email"], input[type="number"], input[type="date"], input[type="search"], select, textarea {
  min-height: var(--tap); border: 1px solid var(--input-line); border-radius: var(--radius); padding: 8px 12px; background: var(--card); color: var(--ink); width: 100%;
}
textarea { min-height: 88px; resize: vertical; }
.check { display: flex; align-items: center; gap: 12px; min-height: var(--tap); padding: 6px 14px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.check:last-child { border-bottom: 0; }
.check input { width: 22px; height: 22px; accent-color: var(--primary); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.fact .value { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }

/* Dialogs */
dialog.dialog { border: 0; border-radius: var(--radius-card); padding: 16px; width: min(92vw, 420px); }
dialog.dialog::backdrop { background: rgba(28,31,36,.45); }
dialog.dialog form { display: flex; flex-direction: column; gap: 12px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; }
.dialog-actions .button { flex: 1; }
.choice { display: flex; align-items: center; gap: 10px; min-height: 48px; }

/* Sign-in */
.signin { flex: 1; background: var(--primary); color: #fff; padding: 48px 24px 28px; display: flex; flex-direction: column; gap: 16px; }
.signin .logo-img { width: 220px; max-width: 80%; height: auto; background: #fff; border-radius: 16px; padding: 10px; box-sizing: border-box; }
.signin h1 { font-size: 24px; }
.signin p { color: rgba(255,255,255,.88); }
.signin .button.primary { background: #fff; color: var(--primary-dark); border-color: #fff; }
.signin .banner.error { background: #fff; }
.signin .spacer { flex: 1; }
.signin input { color: var(--ink); }
.lang-switch { display: flex; gap: 8px; }
.lang-chip { flex: none; min-height: 32px; min-width: 40px; justify-content: center; cursor: pointer; }
.lang-chip:disabled { opacity: .45; cursor: default; }
.runner-hint .lang-chip { min-height: 0; padding: 1px 8px; }
.lang-switch .chip { font-size: 13px; padding: 5px 12px; }
.lang-switch .chip.progress-chip { border: 1px solid var(--primary); }
.signin .lang-switch { justify-content: center; }

/* Runner */
.runner { display: flex; flex-direction: column; min-height: 100vh; }
.runner-header { background: var(--primary); color: #fff; padding: 10px 14px; display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 2; }
.runner-header .who { flex: 1; min-width: 0; }
.runner-header .who .small { font-size: 12px; opacity: .85; }
.runner-header .who .measure { font-weight: 600; }
.live { display: flex; gap: 10px; }
.live .stat { text-align: center; }
.live .stat .label { font-size: 10px; letter-spacing: .04em; opacity: .85; }
.live .stat .value { font-size: 18px; font-weight: 700; }
.timer { text-align: center; min-width: 58px; }
.timer .label { font-size: 10px; letter-spacing: .04em; opacity: .85; }
.timer .value { font-size: 22px; font-weight: 700; }
.timer.warning .value { color: #ffd2cf; animation: pulse 1s infinite; }
.timer.zero .value { color: #fff; background: var(--ink); border-radius: 6px; padding: 0 4px; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.runner-hint { margin: 0; padding: 8px 14px; font-size: 12px; color: var(--ink-muted); background: var(--card); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.runner-hint > span { flex: 1; }
.runner-body { flex: 1; padding: 10px 8px 16px; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.runner.dimmed .runner-body { opacity: .3; pointer-events: none; }
.message-slot { display: grid; margin: 8px 12px 0; }
.message { grid-area: 1 / 1; visibility: hidden; }
.message.active { visibility: visible; }
.no-response.active { animation: pulse 1s infinite; }
.discontinue-message { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; }
.discontinue-text { flex: 1 1 auto; min-width: 0; }
.runner-footer { position: sticky; bottom: 0; z-index: 3; background: var(--card); border-top: 1px solid var(--line); padding: 10px 12px; display: flex; gap: 8px; }
.runner-footer .button { flex: 1; }
.runner-footer .end-summary { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.overlay { position: fixed; inset: 0; background: rgba(28,31,36,.55); display: flex; align-items: flex-end; z-index: 5; }
.overlay .sheet { background: var(--card); width: 100%; max-width: 480px; margin: 0 auto; border-radius: 16px 16px 0 0; padding: 16px; display: flex; flex-direction: column; gap: 8px; }

/* Letter grid and passage marks */
.grid { display: flex; flex-direction: column; gap: 4px; }
.grid-row { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)) 28px; gap: 3px; align-items: center; }
.item { min-height: 40px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); font-size: 21px; padding: 0 2px; position: relative; cursor: pointer; }
.item[data-state="error"] { background: var(--intensive-tint); color: var(--intensive); text-decoration: line-through; text-decoration-thickness: 2px; }
.item[data-state="self_corrected"] { background: var(--teal-tint); color: var(--teal); }
.item[data-state="self_corrected"]::after { content: "ac"; position: absolute; top: -2px; right: 2px; font-size: 9px; font-weight: 700; }
.item.after-last { opacity: .35; }
.item.last { box-shadow: inset -3px 0 0 var(--teal); }
.count { font-size: 11px; color: var(--ink-hint); text-align: right; }
.skipped .item { opacity: .35; text-decoration: line-through; }
.passage { font-family: var(--font-read); font-size: 22px; line-height: 1.9; }
.line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; padding: 2px 4px; border-radius: 6px; }
.line .item { font: inherit; border: 0; background: none; min-height: 36px; padding: 0 3px; }
.line .count { margin-left: auto; font-family: var(--font-ui); }
.line.skipped { background: var(--canvas); }

/* Segmentation */
.seg-word { text-align: center; font-family: var(--font-read); font-size: 54px; margin: 12px 0 4px; }
.seg-phonemes { display: flex; justify-content: center; gap: 12px; margin: 12px 0; flex-wrap: wrap; }
.seg-syllable { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.seg-syllable .phonemes { display: flex; gap: 6px; }
.phoneme { min-width: 52px; min-height: 56px; border-radius: var(--radius); border: 1.5px solid var(--input-line); background: var(--card); font-size: 22px; font-weight: 600; cursor: pointer; touch-action: none; }
.phoneme.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.syllable-button { min-height: 48px; border-radius: 999px; border: 1px dashed var(--primary); background: var(--card); color: var(--primary); font-weight: 600; cursor: pointer; }
.syllable-button.on { background: var(--primary-tint); border-style: solid; }
.seg-divider { width: 1px; background: var(--ink-hint); align-self: stretch; }
.segments { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; min-height: 32px; }

/* Nonsense words */
.fps-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin-bottom: 6px; }
.fps-word { min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--card); padding: 3px 2px; display: flex; flex-direction: column; align-items: stretch; gap: 3px; }
.fps-word.whole { border-color: var(--primary); background: var(--primary-tint); }
.fps-word.skipped { opacity: .45; }
.fps-word.after-last { opacity: .3; }
.fps-word.last { box-shadow: inset -3px 0 0 var(--teal); }
.fps-letters { display: flex; gap: 1px; }
.letter { flex: 1; min-width: 0; min-height: 44px; border: 0; border-radius: 4px; background: none; font-size: 19px; cursor: pointer; padding: 0; }
.letter.ok { background: var(--benchmark-tint); color: var(--benchmark); font-weight: 700; }
.whole-button { font-size: 10px; font-weight: 700; letter-spacing: .02em; border: 0; border-radius: 999px; background: var(--canvas); color: var(--ink-muted); min-height: 48px; padding: 0; width: 100%; cursor: pointer; }
.fps-word.whole .whole-button { background: var(--primary); color: #fff; }
.fps-tag { font-size: 9px; font-weight: 700; color: var(--intensive); }

/* Retell */
.retell { display: flex; flex-direction: column; gap: 12px; padding: 4px 8px; }
.retell-count { text-align: center; }
.retell-count .value { font-size: 56px; font-weight: 700; }
.plus-word { min-height: 120px; font-size: 26px; border-radius: 18px; }
.quality { display: flex; flex-direction: column; gap: 6px; }
.quality .choice { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 12px; background: var(--card); }

/* Directions and results */
.script { font-family: var(--font-read); font-size: 19px; line-height: 1.55; }
.totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.total { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; text-align: center; cursor: default; }
.total.editable { cursor: pointer; }
.total.edited { border: 2px solid var(--teal); }
.total .value { font-size: 26px; font-weight: 700; }
.total .original { font-size: 12px; color: var(--ink-hint); text-decoration: line-through; }

/* Summary */
.measure-card { display: flex; flex-direction: column; gap: 6px; }
.measure-card .top { display: flex; align-items: center; gap: 8px; }
.measure-card .top .name { flex: 1; font-weight: 600; }
.measure-card .score { font-size: 30px; font-weight: 700; }
.measure-card .unit { color: var(--ink-muted); font-size: 13px; }
.delta { font-size: 13px; font-weight: 600; }
.delta.up { color: var(--benchmark); }
.delta.down { color: var(--intensive); }

/* Outbox and settings */
.upload.rejected { border-left: 3px solid var(--intensive); }
.danger-zone { border-color: var(--intensive-tint); }

/* Word use */
.worduse { display: flex; flex-direction: column; gap: 6px; padding: 4px 8px; }
/* The gap sets the spacing; a paragraph's own margins would come on top of it. */
.worduse > p { margin: 0; }
/* The word shrinks with the phone's width so the longest one ("comunicación") fits at 320px. */
.worduse .seg-word { font-size: min(54px, 12vw); margin: 0; line-height: 1.15; overflow-wrap: anywhere; }
.worduse .retell-count { display: flex; justify-content: center; align-items: baseline; gap: 8px; }
.worduse .retell-count .value { font-size: 40px; line-height: 1.1; }
/* +1 and Deshacer share one row so both stay above the footer without scrolling. */
.worduse .count-actions { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 8px; }
.worduse .count-actions .button { padding: 0 8px; }
/* The sentence being counted when the probe locks is not in the result: hide it, keep its place. */
.worduse.locked .retell-count { visibility: hidden; }
/* A phone as short as 568px has about 170px for all of this under the header, the tap hint and
   the reserved message slot, so drop the repeated prompt and tighten the rest. */
@media (max-height: 620px) {
  .worduse { gap: 4px; padding-top: 0; }
  .worduse .say { display: none; }
  .worduse .retell-count .value { font-size: 34px; }
  .worduse .count-actions .button { min-height: 46px; }
}

/* Preschool checklist */
.checklist { display: flex; flex-direction: column; gap: 8px; padding: 4px 8px; }
.check-progress { text-align: center; }
.check-item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.check-label { font-size: 15px; overflow-wrap: anywhere; }
.choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.choice-button { min-height: var(--tap); padding: 0 4px; border: 1px solid var(--input-line); border-radius: 999px; background: var(--card); font-size: 13px; line-height: 1.2; cursor: pointer; }
.choice-button.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
/* Pausar, Abandonar and Terminar are three one-word buttons: at the usual side padding the
   widest of them pushes the row 3px past a 320px phone's edge. */
@media (max-width: 340px) {
  .runner-footer .button { padding: 0 8px; }
}
/* Once the area is finished the choices stay in sight, the ones made at full strength. */
.checklist.locked .choice-button { cursor: default; }
.checklist.locked .choice-button:not(.on) { opacity: .5; }
/* The result screen lists the items read-only, each with its choice at the right. */
div.check { cursor: default; }
.check .grow { flex: 1; min-width: 0; }
div.check strong { white-space: nowrap; }
/* Manual entry types one score per item: a row each, the item's words beside a narrow field. */
.facts.item-scores { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.item-scores label.field { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
.item-scores label.field input { width: 72px; flex: none; text-align: center; }
/* The range stays in one piece: a break between "(0–" and "2)" reads as noise. */
.item-scores .range { white-space: nowrap; }
/* A row of a typed area that is empty or out of range, so the teacher sees which. */
.item-scores label.field input.invalid { border-color: var(--intensive); background: var(--intensive-tint); }
/* An area's total reads "20 de 20", wider than the third of the row the grid gives it at 320px. */
.total.wide { grid-column: 1 / -1; }

/* A published report (T2): the document fills the screen below the bar and scrolls inside. */
.report-screen { height: 100dvh; padding-bottom: 0; }
.report-screen .topbar h1 { min-width: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-frame { flex: 1; width: 100%; border: 0; background: #fff; }
