/* Inkeer — legacy componentstijlen (v0.8), kleuren via tokens in app.css */
  /* tokens: zie boven */
  * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: 'Newsreader', Georgia, serif; font-size: 17px; line-height: 1.55; min-height: 100vh; -webkit-font-smoothing: antialiased; }
  body { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
  h1, h2, h3 { font-family: 'Fraunces', Georgia, serif; font-weight: 500; letter-spacing: 0.01em; }
  h1 { font-size: 1.6rem; margin: 0; color: var(--gold); }
  h2 { font-size: 1.25rem; margin: 0 0 0.6rem; color: var(--gold); }
  h3 { font-size: 1.05rem; margin: 0 0 0.4rem; color: var(--text); }
  h4 { font-family: 'Fraunces', serif; font-size: 0.9rem; color: var(--gold-soft); letter-spacing: 0.06em; text-transform: uppercase; margin: 1.2rem 0 0.4rem; font-weight: 500; }
  .app { max-width: 1080px; margin: 0 auto; padding: 1rem 1rem 6rem; }
  header.top { display: flex; align-items: baseline; justify-content: space-between; padding: 0.5rem 0 1rem; border-bottom: 1px solid var(--line); margin-bottom: 1.2rem; }
  header.top .sub { color: var(--text-faint); font-size: 0.85rem; font-style: italic; }
  header.top .status-pill { font-size: 0.78rem; padding: 0.25rem 0.7rem; border-radius: 999px; border: 1px solid var(--ok); color: var(--ok); }
  header.top .status-pill.warn { color: var(--danger); border-color: var(--danger); }
  nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: var(--bg-soft); border-top: 1px solid var(--line); display: flex; justify-content: space-around; padding: 0.5rem 0 calc(0.5rem + env(safe-area-inset-bottom)); z-index: 100; }
  nav.tabs button { background: none; border: none; color: var(--text-dim); font-family: inherit; font-size: 0.78rem; padding: 0.4rem 0.8rem; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 0.15rem; letter-spacing: 0.05em; }
  nav.tabs button.active { color: var(--gold); }
  nav.tabs button .ic { font-size: 1.05rem; }
  .tab-content { display: none; }
  .tab-content.active { display: block; animation: fade 0.2s ease; }
  @keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
  button.btn, .btn { background: var(--gold); color: var(--bg); border: none; border-radius: 4px; padding: 0.55rem 1rem; font-family: inherit; font-size: 0.95rem; font-weight: 500; cursor: pointer; transition: opacity 0.15s; }
  button.btn:hover { opacity: 0.85; }
  button.btn:disabled { opacity: 0.4; cursor: not-allowed; }
  button.btn.ghost { background: transparent; color: var(--gold); border: 1px solid var(--gold-soft); }
  button.btn.subtle { background: transparent; color: var(--text-dim); border: 1px solid var(--line); }
  button.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
  button.btn.small { padding: 0.3rem 0.7rem; font-size: 0.85rem; }
  button.btn.rec { background: var(--rec); color: white; }
  button.btn.rec.active { animation: pulse 1.4s ease-in-out infinite; }
  @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
  .card { background: var(--bg-card); border: 1px solid var(--line); border-radius: 6px; padding: 1rem; margin-bottom: 0.9rem; }
  .row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
  .grow { flex: 1; min-width: 0; }
  input[type="text"], input[type="password"], textarea, select { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 4px; padding: 0.55rem 0.7rem; font-family: inherit; font-size: 1rem; margin-bottom: 0.5rem; }
  textarea { resize: vertical; min-height: 100px; line-height: 1.5; }
  input:focus, textarea:focus, select:focus { outline: none; border-color: var(--gold-soft); }
  label { display: block; color: var(--text-dim); font-size: 0.85rem; margin: 0.4rem 0 0.2rem; letter-spacing: 0.04em; }
  .input-with-mic { position: relative; }
  .input-with-mic textarea { padding-right: 3rem; }
  .input-with-mic .mic-btn { position: absolute; right: 0.5rem; top: 0.5rem; background: transparent; border: 1px solid var(--line); color: var(--text-dim); border-radius: 4px; padding: 0.35rem 0.55rem; cursor: pointer; font-size: 1rem; }
  .input-with-mic .mic-btn:hover { color: var(--gold); border-color: var(--gold-soft); }
  .input-with-mic .mic-btn.listening { color: white; background: var(--rec); border-color: var(--rec); animation: pulse 1.4s ease-in-out infinite; }
  .chapter { border: 1px solid var(--line); border-radius: 6px; margin-bottom: 0.7rem; overflow: hidden; }
  .chapter-head { background: var(--bg-soft); padding: 0.7rem 0.9rem; display: flex; align-items: center; gap: 0.6rem; cursor: pointer; }
  .chapter-head .roman { color: var(--gold); font-family: 'Fraunces', serif; font-size: 0.95rem; min-width: 2.2rem; }
  .chapter-head .title { flex: 1; font-weight: 500; }
  .chapter-head .progress { color: var(--text-faint); font-size: 0.8rem; }
  .chapter-head .chev { color: var(--text-faint); transition: transform 0.2s; font-size: 1.1rem; }
  .chapter.open .chev { transform: rotate(90deg); }
  .chapter-body { padding: 0.5rem 0.9rem 0.9rem; display: none; }
  .chapter.open .chapter-body { display: block; }
  .video-item { border-top: 1px solid var(--line); padding: 0.65rem 0; display: flex; align-items: center; gap: 0.6rem; cursor: pointer; }
  .video-item:first-child { border-top: none; }
  .video-item .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bg); border: 1px solid var(--gold-soft); flex-shrink: 0; }
  .video-item.s-leren .dot { background: var(--gold-soft); }
  .video-item.s-vertrouwd .dot { background: var(--gold); border-color: var(--gold); }
  .video-item.s-beheerst .dot { background: var(--gold); box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 3px var(--gold); }
  .video-item .vtitle { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .video-item .badge { font-size: 0.7rem; color: var(--text-faint); padding: 0.1rem 0.45rem; border: 1px solid var(--line); border-radius: 999px; }
  .detail-back { color: var(--gold); cursor: pointer; padding: 0.3rem 0; display: inline-block; font-size: 0.9rem; }
  .status-pills { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.5rem 0 1rem; }
  .pill { padding: 0.3rem 0.7rem; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--text-dim); font-size: 0.83rem; cursor: pointer; }
  .pill.active { border-color: var(--gold); color: var(--gold); background: var(--bg-card); }
  .empty { text-align: center; color: var(--text-faint); font-style: italic; padding: 2rem 1rem; }
  .script-item { cursor: pointer; }
  .script-item:hover { border-color: var(--gold-soft); }
  .script-item .preview { color: var(--text-dim); font-size: 0.9rem; margin-top: 0.3rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .tag { display: inline-block; background: var(--bg); color: var(--gold-soft); padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.75rem; margin: 0 0.3rem 0.3rem 0; border: 1px solid var(--line); }
  .conv { margin: 0.5rem 0 1rem; max-height: 460px; overflow-y: auto; padding: 0.4rem 0; }
  .msg { padding: 0.7rem 0.9rem; border-radius: 6px; margin-bottom: 0.6rem; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
  .msg.user { background: var(--bg-soft); border: 1px solid var(--line); }
  .msg.assistant { background: var(--bg-card); border: 1px solid var(--gold-soft); }
  .msg .who { font-family: 'Fraunces', serif; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-soft); margin-bottom: 0.3rem; display: flex; justify-content: space-between; }
  .msg .when { color: var(--text-faint); font-style: italic; font-weight: normal; letter-spacing: 0.02em; text-transform: none; }
  .msg.thinking { color: var(--text-faint); font-style: italic; }
  .leraar-layout { display: flex; gap: 1rem; align-items: flex-start; }
  .chat-sidebar { width: 240px; flex-shrink: 0; background: var(--bg-card); border: 1px solid var(--line); border-radius: 6px; padding: 0.6rem; }
  .chat-sidebar h4 { margin: 0.4rem 0.4rem 0.3rem; font-size: 0.72rem; }
  .chat-main { flex: 1; min-width: 0; }
  .chat-list-item { padding: 0.5rem 0.6rem; border-radius: 4px; cursor: pointer; display: flex; align-items: center; gap: 0.4rem; color: var(--text-dim); border: 1px solid transparent; margin-bottom: 0.2rem; }
  .chat-list-item:hover { background: var(--bg); color: var(--text); }
  .chat-list-item.active { background: var(--bg); color: var(--gold); border-color: var(--gold-soft); }
  .chat-list-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.92rem; }
  .chat-list-item .pin { color: var(--gold-soft); font-size: 0.85rem; }
  .chat-list-item .menu-trigger { opacity: 0.4; padding: 0 0.3rem; }
  .chat-list-item:hover .menu-trigger { opacity: 1; }
  .chat-actions { padding: 0.4rem 0.4rem; border-top: 1px solid var(--line); margin-top: 0.4rem; }
  @media (max-width: 760px) { .leraar-layout { flex-direction: column; } .chat-sidebar { width: 100%; } }
  .vu-meter { height: 7px; background: var(--bg); border-radius: 4px; overflow: hidden; margin-top: 0.4rem; }
  .vu-fill { height: 100%; background: linear-gradient(90deg, var(--ok) 0%, var(--gold) 60%, var(--rec) 100%); width: 0%; transition: width 0.08s ease-out; border-radius: 4px; }
  .vu-status { font-size: 0.78rem; color: var(--text-faint); margin-top: 0.2rem; }
  .vu-status.live { color: var(--ok); }
  .vu-status.silent { color: var(--danger); }
  .audio-btn { background: transparent; color: var(--text-dim); border: 1px solid var(--line); border-radius: 4px; padding: 0.55rem 0.8rem; cursor: pointer; font-size: 0.95rem; font-family: inherit; }
  .audio-btn:hover { color: var(--rec); border-color: var(--rec); }
  .audio-recorder-panel { background: var(--bg-soft); border: 2px solid var(--rec); border-radius: 6px; padding: 0.7rem 0.9rem; margin: 0.5rem 0; display: flex; align-items: center; gap: 0.7rem; }
  .audio-recorder-panel.preview { border-color: var(--gold); }
  .audio-recorder-panel .rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--rec); animation: pulse 1.4s ease-in-out infinite; flex-shrink: 0; }
  .audio-recorder-panel .timer { font-family: 'Fraunces', serif; font-size: 1.05rem; }
  .image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.5rem; margin: 0.5rem 0 1rem; }
  .image-grid .photo-cell { position: relative; }
  .image-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; cursor: pointer; border: 1px solid var(--line); }
  .image-grid img:hover { border-color: var(--gold-soft); }
  .image-grid .photo-del { position: absolute; top: 0.3rem; right: 0.3rem; background: rgba(0,0,0,0.7); color: white; border: none; border-radius: 4px; padding: 0.2rem 0.4rem; cursor: pointer; font-size: 0.75rem; opacity: 0; transition: opacity 0.15s; }
  .image-grid .photo-cell:hover .photo-del { opacity: 1; }
  .image-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 2rem; cursor: zoom-out; }
  .image-modal img { max-width: 100%; max-height: 100%; object-fit: contain; }
  .ai-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
  .ai-modal-content { background: var(--bg-card); border: 1px solid var(--gold-soft); border-radius: 8px; padding: 1.2rem; max-width: 1100px; width: 100%; max-height: 90vh; overflow-y: auto; display: flex; flex-direction: column; gap: 0.6rem; }
  .ai-diff { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
  @media (max-width: 720px) { .ai-diff { grid-template-columns: 1fr; } }
  .ai-pane textarea { min-height: 280px; }
  .ai-pane .readonly { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 0.55rem 0.7rem; min-height: 280px; max-height: 50vh; overflow-y: auto; white-space: pre-wrap; line-height: 1.5; color: var(--text-dim); font-size: 0.95rem; }
  .toast { position: fixed; left: 50%; bottom: 5rem; transform: translateX(-50%); background: var(--gold); color: var(--bg); padding: 0.6rem 1.2rem; border-radius: 999px; font-size: 0.9rem; z-index: 1000; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
  .toast.show { opacity: 1; }
  .muted { color: var(--text-faint); font-size: 0.85rem; font-style: italic; }
  code { font-family: 'JetBrains Mono', Consolas, monospace; font-size: 0.88rem; background: var(--bg); padding: 0.1rem 0.35rem; border-radius: 3px; }
  .script-pre { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 0.8rem 1rem; max-height: 50vh; overflow-y: auto; white-space: pre-wrap; line-height: 1.6; }
  .session-card { border: 1px solid var(--line); border-radius: 6px; padding: 0.8rem; margin-bottom: 0.6rem; background: var(--bg-soft); }
  .session-card + .session-card { position: relative; }
  .session-card + .session-card::before { content:""; position:absolute; left:1rem; right:1rem; top:-0.4rem; height:1px; background: var(--line); opacity:0.5; }
  .session-card .grade-badge { flex: 0 0 auto; align-self: flex-start; margin-top: 0.15rem; }
  .grade-badge { display: inline-block; padding: 0.2rem 0.7rem; border-radius: 999px; background: var(--gold); color: var(--bg); font-family: 'Fraunces', serif; font-weight: 600; font-size: 0.92rem; }
  .grade-badge.low { background: var(--danger); color: white; }
  .grade-badge.mid { background: var(--gold-soft); }
  .criterion-row { display: flex; gap: 0.6rem; padding: 0.35rem 0; border-top: 1px dashed var(--line); }
  .criterion-row:first-of-type { border-top: none; }
  .criterion-row .crit-name { flex: 1; color: var(--text-dim); }
  .criterion-row .crit-grade { font-family: 'Fraunces', serif; color: var(--gold); min-width: 2.2rem; text-align: right; }
  .criterion-row .crit-fb { color: var(--text-faint); font-style: italic; font-size: 0.88rem; flex-basis: 100%; padding-left: 0.5rem; }
  /* === Fullscreen modal === */
  .fs-modal { position: fixed; inset: 0; background: var(--bg); z-index: 1000; display: flex; flex-direction: column; }
  .fs-modal .fs-header { padding: 0.5rem 1rem; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 0.8rem; background: var(--bg-soft); flex: 0 0 auto; }
  .fs-modal .fs-header h3 { margin: 0; font-size: 1.05rem; flex: 1; color: var(--gold); }
  .fs-modal .fs-body { flex: 1 1 auto; padding: 0.6rem 1rem 0.6rem; overflow: hidden; display: flex; flex-direction: column; gap: 0.5rem; min-height: 0; }
  .fs-modal textarea { flex: 1 1 auto; width: 100%; min-height: 0; font-size: 1.15rem; line-height: 1.75; padding: 1rem; background: var(--bg-soft); color: var(--text); border: 1px solid var(--line); border-radius: 4px; box-sizing: border-box; font-family: 'Newsreader', Georgia, serif; resize: none; }
  .fs-modal .conv { flex: 1 1 auto; overflow-y: auto; padding: 0.8rem; border: 1px solid var(--line); border-radius: 4px; background: var(--bg-soft); min-height: 200px; }
  .fs-modal .fs-input-row { flex: 0 0 auto; }
  .fs-modal .fs-input-row textarea { min-height: 70px; max-height: 25vh; }
  .fs-btn { position: absolute; right: 3rem; top: 0.5rem; background: transparent; border: 1px solid var(--line); color: var(--text-dim); border-radius: 4px; padding: 0.35rem 0.55rem; cursor: pointer; font-size: 1rem; }
  .input-with-mic .fs-btn:hover { color: var(--gold); border-color: var(--gold-soft); }
  /* if no mic btn the fs-btn moves to mic position */
  .input-with-mic textarea { padding-right: 5.5rem; }

  /* === Practice / diff === */
  .diff-view { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 4px; padding: 1rem; line-height: 1.9; white-space: pre-wrap; font-size: 1.02rem; max-height: 60vh; overflow-y: auto; }
  .diff-match { color: var(--ok); }
  .diff-miss { color: var(--danger); text-decoration: line-through; opacity: 0.85; }
  .diff-extra { color: var(--rec); font-style: italic; }
  .diff-pending { color: var(--text-dim); opacity: 0.5; }
  .diff-paren { color: var(--text-faint); font-style: italic; }
  .diff-heading { color: var(--gold); font-family: 'Fraunces', serif; font-weight: 600; font-size: 1.05em; display: inline-block; margin: 0.4rem 0 0.2rem; border-bottom: 1px solid var(--gold-soft); padding-bottom: 0.15rem; }
  .diff-embedded { background: rgba(201,163,92,0.15); padding: 0 0.2rem; border-radius: 3px; font-weight: 600; }
  .diff-pause { color: var(--gold-soft); font-weight: 700; letter-spacing: 0.15em; }
  .timing-note { display: inline-block; font-size: 0.78rem; color: var(--text-faint); margin-left: 0.3rem; padding: 0 0.3rem; border: 1px dashed var(--line); border-radius: 3px; }
  .timing-note.warn { color: var(--rec); border-color: var(--rec); }
  .timing-note.good { color: var(--ok); border-color: var(--ok); }
  .practice-toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.6rem 0; padding: 0.6rem; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 4px; }
  .practice-toolbar label { margin: 0; color: var(--text-dim); font-size: 0.9rem; }
  .practice-toolbar select { background: var(--bg); color: var(--text); border: 1px solid var(--line); padding: 0.3rem 0.5rem; border-radius: 4px; font-family: inherit; }
  .mode-pill { display: inline-block; padding: 0.3rem 0.8rem; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; color: var(--text-dim); font-size: 0.88rem; }
  .mode-pill.active { background: var(--gold); color: var(--bg); border-color: var(--gold); }
  .first-letter-view { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 4px; padding: 1rem; line-height: 2.0; font-size: 1.1rem; letter-spacing: 0.05em; max-height: 50vh; overflow-y: auto; font-family: 'Fraunces', serif; }
  .live-transcript { background: var(--bg-soft); border: 1px dashed var(--gold-soft); border-radius: 4px; padding: 0.8rem; min-height: 80px; line-height: 1.7; font-style: italic; color: var(--text-dim); }
  .live-transcript .interim { color: var(--text-faint); }
  .cloze-hidden { background: var(--bg); padding: 0 0.4rem; border-bottom: 2px solid var(--gold-soft); color: transparent; user-select: none; }
  .cloze-hidden.revealed { color: var(--gold); background: transparent; border-bottom: 1px dashed var(--gold-soft); }
  .practice-toolbar input[type="range"] { accent-color: var(--gold); }
  .practice-toolbar .density-val { color: var(--gold); font-family: 'Fraunces', serif; min-width: 1.5rem; text-align: center; }


  .login-screen { max-width: 460px; margin: 4rem auto; padding: 2rem; background: var(--bg-card); border: 1px solid var(--gold-soft); border-radius: 8px; text-align: center; }
  .login-screen h1 { margin-bottom: 0.5rem; }
  .login-screen p { color: var(--text-dim); }