/* AI Tutor screen (2026-11-15). Scoped under .tt-*; uses the portal tokens
   (--primary, --card, --text, --border, --bg) with fallbacks. */
#screen-tutor { padding: 0; }
/* The "Get the Sanviora app" bar sat on the message box and Send button on
   phones (2026-11-17); hide it while the tutor is open, as during calls. */
body:has(#screen-tutor.active) #pwa-banner { display: none !important; }
/* Same for the floating Feedback button, which covers Send on narrow screens.
   (The live-chat bubble hides itself: chat-widget.js KEEP_CLEAR.) */
body:has(#screen-tutor.active) #float-feedback-btn { display: none !important; } /* all widths since the tutor fills the screen (2026-11-22) */
#tutor-root { max-width: 860px; margin: 0 auto; padding: 16px; box-sizing: border-box; }
.tt-card { background: var(--card, #fff); border: 1px solid var(--border, #E5E7EB); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.tt-title { margin: 0; font-size: 1.35rem; color: var(--text, #111827); }
.tt-sub { margin: 0; color: #5b6170; line-height: 1.5; }
.tt-dim { color: #7a8090; font-size: .85rem; }
.tt-err { color: #b42318; margin: 0; min-height: 0; }
.tt-err:empty { display: none; }
.tt-warn { background: #fff7e6; border: 1px solid #f5d79e; color: #8a5a00; padding: 10px 12px; border-radius: 10px; margin: 0 0 12px; }
.tt-ok { background: #ecfdf3; border: 1px solid #b7ebcd; color: #0a6b2d; padding: 10px 12px; border-radius: 10px; margin: 0; }
.tt-lab { display: flex; flex-direction: column; gap: 6px; font-weight: 600; color: var(--text, #111827); font-size: .95rem; }
.tt-in { min-height: 42px; border: 1px solid var(--border, #E5E7EB); border-radius: 10px; padding: 8px 12px; font: inherit; background: #fff; color: var(--text, #111827); box-sizing: border-box; max-width: 100%; }
.tt-area { min-height: 90px; width: 100%; resize: vertical; }
.tt-seg { display: flex; gap: 8px; flex-wrap: wrap; }
.tt-segb { min-height: 42px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border, #E5E7EB); background: #fff; font: inherit; cursor: pointer; }
.tt-segb.on { border-color: var(--primary, #1471D8); background: rgba(20, 113, 216, .08); color: var(--primary, #1471D8); font-weight: 600; }
.tt-notice { background: var(--bg, #F4F5FF); border-radius: 10px; padding: 12px 14px; font-size: .9rem; line-height: 1.5; }
.tt-notice p { margin: 0 0 6px; font-weight: 600; }
.tt-notice ul { margin: 0 0 6px; padding-left: 18px; }
.tt-b { min-height: 42px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent; background: transparent; font: inherit; font-weight: 600; color: var(--primary, #1471D8); cursor: pointer; }
.tt-b.pri { background: var(--primary, #1471D8); color: #fff; }
.tt-b.out { border-color: var(--border, #D9DCE3); color: var(--text, #111827); background: #fff; }
.tt-b.sm { min-height: 34px; padding: 0 12px; font-size: .88rem; }
.tt-b:disabled { opacity: .55; cursor: default; }
.tt-danger { color: #b42318 !important; }

/* chat layout */
.tt-wrap { display: flex; flex-direction: column; height: calc(100vh - 120px); min-height: 480px; background: var(--card, #fff); border: 1px solid var(--border, #E5E7EB); border-radius: 14px; overflow: hidden; }
.tt-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border, #E5E7EB); flex-wrap: wrap; }
.tt-exam { min-height: 36px; max-width: 220px; }
.tt-counters { display: inline-flex; gap: 8px; align-items: center; border: 1px solid var(--border, #E5E7EB); background: var(--bg, #F4F5FF); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .85rem; cursor: pointer; color: var(--text, #111827); }
.tt-cn { white-space: nowrap; }
.tt-tools { margin-left: auto; display: flex; gap: 2px; flex-wrap: wrap; }
.tt-list { flex: 1; overflow-y: auto; padding: 16px 12px; display: flex; flex-direction: column; gap: 12px; background: var(--bg, #F7F8FC); }
.tt-msg { display: flex; flex-direction: column; max-width: 88%; }
.tt-me { align-self: flex-end; align-items: flex-end; }
.tt-ai { align-self: flex-start; }
.tt-bub { padding: 10px 14px; border-radius: 14px; line-height: 1.55; word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; }
.tt-me .tt-bub { background: var(--primary, #1471D8); color: #fff; border-bottom-right-radius: 4px; }
.tt-ai .tt-bub { background: #fff; border: 1px solid var(--border, #E5E7EB); color: var(--text, #111827); border-bottom-left-radius: 4px; white-space: normal; }
.tt-unsure .tt-bub { border-color: #f5d79e; background: #fffbf0; }
.tt-errmsg .tt-bub { border-color: #f3c1bc; background: #fff5f4; color: #8a1c12; }
.tt-typing { color: #7a8090; font-style: italic; }
.tt-md p { margin: 0 0 8px; } .tt-md p:last-child { margin-bottom: 0; }
.tt-md ol, .tt-md ul { margin: 4px 0 8px; padding-left: 22px; }
.tt-md li { margin: 2px 0; }
.tt-md .tt-li-more { margin: 4px 0; overflow-x: auto; }
.tt-md h4 { margin: 8px 0 4px; font-size: 1rem; }
.tt-md .katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.tt-sol { margin-top: 8px; border-top: 1px dashed var(--border, #D9DCE3); padding-top: 8px; }
.tt-key { margin: 8px 0 0; font-size: .88rem; color: #0a6b2d; font-weight: 600; }
.tt-acts { display: flex; gap: 4px; margin-top: 4px; }
.tt-a { background: none; border: 0; color: #7a8090; font: inherit; font-size: .8rem; cursor: pointer; padding: 2px 6px; }
.tt-acts { flex-wrap: wrap; align-items: center; }
.tt-cost { font-size: .78rem; color: #7a8090; padding: 2px 6px; margin-right: 4px; border-right: 1px solid #e3e6ee; }
.tt-a:hover { color: var(--primary, #1471D8); }
.tt-report { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; font-size: .85rem; color: #5b6170; }
.tt-sys { align-self: center; font-size: .85rem; color: #5b6170; background: #fff; border: 1px solid var(--border, #E5E7EB); border-radius: 999px; padding: 4px 12px; text-align: center; max-width: 92%; }
.tt-chips { display: flex; gap: 6px; padding: 8px 12px 0; flex-wrap: wrap; }
.tt-chips:empty { display: none; }
.tt-chip { min-height: 32px; border: 1px solid var(--border, #D9DCE3); background: #fff; border-radius: 999px; padding: 0 12px; font: inherit; font-size: .85rem; cursor: pointer; color: var(--text, #111827); }
.tt-chip:hover { border-color: var(--primary, #1471D8); color: var(--primary, #1471D8); }
.tt-comp { display: flex; gap: 8px; padding: 10px 12px; align-items: flex-end; }
.tt-text { flex: 1; min-height: 44px; max-height: 140px; resize: none; border: 1px solid var(--border, #D9DCE3); border-radius: 12px; padding: 11px 12px; font: inherit; line-height: 1.4; box-sizing: border-box; }
.tt-send { min-height: 44px; padding: 0 18px; border: 0; border-radius: 12px; background: var(--primary, #1471D8); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.tt-send:disabled { opacity: .55; }
.tt-foot { margin: 0; padding: 0 12px 8px; font-size: .75rem; color: #8a90a0; text-align: center; }

/* welcome + offers */
.tt-welcome { display: flex; flex-direction: column; gap: 10px; }
.tt-hello { margin: 0; font-size: 1.1rem; font-weight: 700; color: var(--text, #111827); }
.tt-offer { background: #fff; border: 1px solid var(--border, #E5E7EB); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.tt-offer-h { margin: 0; font-weight: 600; }
.tt-mist { text-align: left; display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--border, #E5E7EB); background: var(--bg, #F7F8FC); border-radius: 10px; padding: 10px 12px; font: inherit; cursor: pointer; }
.tt-mist:hover { border-color: var(--primary, #1471D8); }
.tt-mist-q { color: var(--text, #111827); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tt-starters { display: flex; gap: 8px; flex-wrap: wrap; }

/* quiz */
.tt-quiz { background: #fff; border: 1px solid var(--border, #E5E7EB); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; max-width: 100%; }
.tt-quiz.ok { border-color: #9fd9b4; } .tt-quiz.bad { border-color: #f3c1bc; }
.tt-qmeta { font-size: .8rem; color: #7a8090; }
.tt-opts { display: flex; flex-direction: column; gap: 6px; }
.tt-opt { text-align: left; min-height: 42px; border: 1px solid var(--border, #D9DCE3); background: #fff; border-radius: 10px; padding: 8px 12px; font: inherit; cursor: pointer; color: var(--text, #111827); }
.tt-opt.on { border-color: var(--primary, #1471D8); background: rgba(20, 113, 216, .07); }
.tt-qverdict { margin: 0 0 4px; font-weight: 700; }
.tt-qacts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }

/* sheets */
.tt-sheet-back { position: fixed; inset: 0; background: rgba(15, 20, 35, .4); display: flex; align-items: flex-end; justify-content: center; z-index: 1200; }
.tt-sheet { background: #fff; width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; border-radius: 16px 16px 0 0; }
@media (min-width: 700px) { .tt-sheet-back { align-items: center; } .tt-sheet { border-radius: 16px; } }
.tt-sheet-h { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border, #E5E7EB); position: sticky; top: 0; background: #fff; }
.tt-sheet-h h3 { margin: 0; font-size: 1.05rem; }
.tt-x { background: none; border: 0; font-size: 26px; line-height: 1; cursor: pointer; color: #5b6170; min-width: 40px; min-height: 40px; }
.tt-sheet-b { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.tt-sheet-b h4 { margin: 8px 0 0; }
.tt-kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; }
.tt-plans { display: flex; flex-direction: column; gap: 8px; }
.tt-plan { border: 1px solid var(--border, #E5E7EB); border-radius: 12px; padding: 12px; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.tt-plan-n { font-weight: 700; grid-column: 1; }
.tt-plan .tt-dim { grid-column: 1; }
.tt-plan-p { grid-column: 2; grid-row: 1; font-weight: 700; font-size: 1.05rem; text-align: right; }
.tt-plan .tt-b { grid-column: 2; grid-row: 2; }
.tt-hrow { display: flex; justify-content: space-between; gap: 12px; text-align: left; border: 0; border-bottom: 1px solid var(--border, #EEF0F4); background: none; padding: 10px 0; font: inherit; cursor: pointer; color: var(--text, #111827); }
.tt-check { display: flex; gap: 8px; align-items: center; }

@media (max-width: 640px) {
  #tutor-root { padding: 8px; }
  .tt-wrap { height: calc(100vh - 92px); border-radius: 10px; }
  .tt-msg { max-width: 94%; }
  .tt-tools .tt-b { padding: 0 8px; }
  .tt-exam { max-width: 150px; }
}

/* voice + photo (2026-11-15) */
.tt-iconb { min-width: 44px; min-height: 44px; border: 1px solid var(--border, #D9DCE3); border-radius: 12px; background: #fff; font-size: 1.15rem; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
.tt-mic.on { background: #fdecea; border-color: #f3a39b; color: #b42318; font-size: .85rem; font-weight: 700; min-width: 64px; animation: tt-pulse 1.2s infinite; }
@keyframes tt-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(180, 35, 24, .35); } 50% { box-shadow: 0 0 0 6px rgba(180, 35, 24, 0); } }
@media (prefers-reduced-motion: reduce) { .tt-mic.on { animation: none; } }
.tt-stopaudio { align-self: center; margin: 0 0 6px; min-height: 36px; padding: 0 16px; border: 0; border-radius: 999px; background: #17171C; color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.tt-voicetog[aria-pressed="true"] { color: #0a6b2d; }
.tt-photo { padding: 4px; background: #fff !important; border: 1px solid var(--border, #E5E7EB); }
.tt-photo img { display: block; max-width: 220px; max-height: 220px; border-radius: 10px; }
.tt-readprev { margin: 8px 0; padding: 8px 10px; background: var(--bg, #F7F8FC); border-radius: 8px; font-size: .92rem; }
@media (max-width: 640px) { .tt-comp { gap: 6px; } .tt-send { padding: 0 12px; } .tt-iconb { min-width: 40px; } }

/* lessons + study plan (2026-11-15) */
.tt-lesson .tt-bub { border-left: 3px solid var(--primary, #1471D8); }
.tt-plancard { border-color: #cfe0f7; background: #f7fbff; }
.tt-planhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tt-days { font-size: .82rem; font-weight: 700; color: var(--primary, #1471D8); background: #e8f1fc; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.tt-task { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border, #EEF0F4); }
.tt-task:last-child { border-bottom: 0; }
.tt-task input[type="checkbox"] { width: 20px; height: 20px; flex: none; }
.tt-task-t { flex: 1; min-width: 0; }
.tt-task-l { font-weight: 600; color: var(--text, #111827); overflow-wrap: anywhere; }
.tt-task.done .tt-task-l { text-decoration: line-through; color: #7a8090; }
.tt-focus { border: 1px solid var(--border, #E5E7EB); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }

/* viva (2026-11-15) */
.tt-viva .tt-bub { border-left: 3px solid #7c3aed; }
.tt-v-ok .tt-bub { border-color: #9fd9b4; background: #f3fbf6; }
.tt-v-part .tt-bub { border-color: #f5d79e; background: #fffbf0; }
.tt-v-bad .tt-bub { border-color: #f3c1bc; background: #fff7f6; }

/* Trust + clarity (2026-11-17, roadmap/2026-11-17-tutor-trust-and-clarity) */
.tt-head { position: relative; }
.tt-more { display: none; margin-left: auto; font-size: 1.2rem; min-width: 40px; }
.tt-menu { position: absolute; right: 8px; top: calc(100% - 4px); z-index: 20; background: #fff; border: 1px solid var(--border, #E5E7EB); border-radius: 12px; box-shadow: 0 10px 30px rgba(15, 27, 61, .14); padding: 6px; display: flex; flex-direction: column; min-width: 230px; }
.tt-menu-i { text-align: left; background: none; border: 0; border-radius: 8px; padding: 10px 12px; font: inherit; font-size: .92rem; color: var(--text, #111827); cursor: pointer; min-height: 42px; }
.tt-menu-i:hover, .tt-menu-i:focus-visible { background: var(--bg, #F4F5FF); outline: none; }
.tt-intents { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tt-intent { display: flex; flex-direction: column; gap: 4px; text-align: left; border: 1px solid var(--border, #E5E7EB); background: #fff; border-radius: 12px; padding: 12px 14px; font: inherit; cursor: pointer; min-height: 76px; }
.tt-intent:hover, .tt-intent:focus-visible { border-color: var(--primary, #1471D8); outline: none; box-shadow: 0 0 0 3px rgba(20, 113, 216, .12); }
.tt-intent-t { font-weight: 700; color: var(--text, #111827); }
.tt-intent-s { font-size: .84rem; color: #5b6170; }
.tt-morelinks { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: .88rem; }
.tt-link { background: none; border: 0; padding: 6px 0; font: inherit; color: var(--primary, #1471D8); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-align: left; }
.tt-next .tt-task { border-bottom: 0; padding: 0; }
.tt-prow { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border, #EEF0F4); flex-wrap: wrap; }
.tt-prow:last-of-type { border-bottom: 0; }
.tt-prow-a { display: flex; gap: 6px; flex-wrap: wrap; }
.tt-langmenu { display: flex; gap: 6px; flex-basis: 100%; padding-top: 2px; }
.tt-challenge { font-size: .85rem; margin-top: 4px; }
.tt-chbox { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.tt-how { font-size: .9rem; }
.tt-how summary { cursor: pointer; font-weight: 600; color: var(--primary, #1471D8); }
.tt-how ul { margin: 6px 0 0; padding-left: 18px; }
@media (max-width: 640px) {
  .tt-head { flex-wrap: nowrap; gap: 6px; padding: 8px; }
  .tt-tools { display: none; }
  .tt-more { display: inline-flex; align-items: center; justify-content: center; }
  .tt-exam { max-width: none; min-width: 72px; flex: 1 1 0; }
  .tt-cn-x { display: none; }
  .tt-counters { gap: 6px; padding: 5px 9px; font-size: .78rem; flex: none; }
  .tt-intents { grid-template-columns: minmax(0, 1fr); }
  .tt-intent { min-height: 0; }
}
@media (max-width: 380px) { .tt-cn:last-child { display: none; } }

/* Setup with one exam shows it as text (2026-11-22) */
.tt-exam-one { display: block; font-size: 1.05rem; margin-top: 4px; color: var(--text, #111827); }

/* Fill the whole content area (founder, 2026-11-22, roadmap/2026-11-22-tutor-full-space).
   Width: no centred 860 px column. Height: tutor.js fitWrap() sets the exact
   height from the window; the calc below is only the fallback. */
#tutor-root { max-width: none; margin: 0; padding: 12px; }
.tt-wrap { min-height: 420px; }
.tt-msg { max-width: min(88%, 1000px); }
.tt-card .tt-sub, .tt-notice { max-width: 75ch; }
.tt-intents { max-width: 1100px; }
@media (max-width: 640px) { #tutor-root { padding: 8px; } .tt-msg { max-width: 94%; } }
/* The page container's own padding (36/44/56 px) is dropped while the tutor is
   open, so the tutor reaches the edges of the area beside the side menu. */
main:has(> #screen-tutor.active) { padding: 0 !important; }
/* At 900 px and below the app's fixed top bar (.app-mobilebar, 56 px) sits above the page: keep room for it. */
@media (max-width: 900px) { main:has(> #screen-tutor.active) { padding: 56px 0 0 !important; } }

/* From your plan banner (2026-11-22, design P3) */
.tt-planbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: #F7FAFF; border: 1px solid #DCE7FA; border-radius: 10px; padding: 8px 12px; margin: 0 0 8px; font-size: 13px; }
.tt-planbar-t { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
.tt-planbar-k { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: #1563D6; }
.tt-planbar-a { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.tt-planbar-ok { color: #12805C; font-weight: 600; }
.tt-planbar-x { width: 28px; height: 28px; font-size: 16px; }

/* OI-58 (2026-11-28): card buttons sit under their text instead of spanning
   the whole content area on wide screens (setup "Start" was 1240 px wide). */
@media (min-width: 640px) { .tt-card > .tt-b.pri { align-self: flex-start; min-width: 200px; } }
