body.chat-active { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
/* A dedicated reader keeps the composer visible; only chat scrollbars are replaced. */
.app-shell { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
.app-shell .chat-layout { min-height: 0; height: 100%; overflow: hidden; }
.app-shell .topbar { position: relative; flex: 0 0 auto; }
.app-shell .composer-wrap { position: relative; inset: auto; flex: 0 0 auto; max-height: 42dvh; overflow: auto; padding-top: 10px; }
.chat-reader { flex: 1 1 auto; min-height: 0; display: flex; position: relative; }
.chat-viewport { flex: 1; min-width: 0; overflow: auto; scrollbar-width: none; overscroll-behavior: contain; }
.chat-viewport::-webkit-scrollbar { display: none; }
.chat-viewport .messages { padding: 18px 12px 30px; }
.chat-viewport .empty-state { min-height: 100%; padding-bottom: 32px; }
.chat-viewport:focus-visible { outline: 1px solid var(--border); outline-offset: -1px; }
.highlight-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 5px 12px; flex: 0 0 auto; font-size: .75rem; border-bottom: 1px solid var(--border); }
.highlight-tools button, .highlight-tools select { font: inherit; color: var(--muted); border: 1px solid var(--border); background: var(--bg); border-radius: 7px; padding: 5px 8px; min-height: 32px; cursor: pointer; }
.highlight-tools button:disabled { opacity: .5; cursor: default; }
.highlight-inline-status { color: var(--muted); font-size: .68rem; }
.chat-scrollbar { position: relative; flex: 0 0 30px; touch-action: none; background: var(--bg); }
.chat-scrollbar::before { content: ''; position: absolute; inset: 0 auto 0 5px; width: 5px; background: var(--surface); border-radius: 4px; }
.chat-scroll-thumb { position: absolute; left: 3px; width: 9px; min-height: 30px; border-radius: 7px; background: color-mix(in srgb, var(--muted) 48%, var(--bg)); cursor: grab; z-index: 1; }
.chat-scroll-thumb:hover, .chat-scroll-thumb:focus-visible { background: var(--muted); }
.chat-scroll-thumb:active { cursor: grabbing; }
.chat-scroll-markers { position: absolute; top: 0; bottom: 0; left: 14px; right: 0; }
[data-color="amber"] { --mark-color: #c59536; --mark-tint: #fbf0d7; }
[data-color="sage"] { --mark-color: #648e70; --mark-tint: #e8f1e9; }
[data-color="blue"] { --mark-color: #638aa8; --mark-tint: #e5eff7; }
[data-color="lavender"] { --mark-color: #9478ad; --mark-tint: #f0e8f7; }
.highlight-marker { position: absolute; right: calc(var(--lane) * 3px); width: 10px; height: 14px; padding: 0; border: 0; background: transparent; cursor: pointer; border-radius: 3px; }
.highlight-marker::before { content: ''; position: absolute; left: 0; right: 0; top: 4px; bottom: 4px; min-height: 5px; border-radius: 2px; background: var(--mark-color); opacity: .7; }
.highlight-marker:hover::before, .highlight-marker:focus-visible::before, .highlight-marker.is-selected::before { opacity: 1; box-shadow: 0 0 0 2px var(--mark-tint); }
.highlight-marker:focus-visible, .chat-scroll-thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; z-index: 3; }
mark.chat-highlight { background: var(--mark-tint); color: inherit; border-bottom: 2px solid var(--mark-color); border-radius: 2px; }
mark.chat-highlight.is-current { outline: 2px solid var(--mark-color); outline-offset: 1px; }
.highlights-dialog { width: min(860px, calc(100vw - 24px)); max-width: none; max-height: calc(100dvh - 24px); margin: auto; padding: 22px; overflow: auto; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 14px; }
.highlights-dialog::backdrop { background: rgba(0,0,0,.35); }
.highlights-heading, .highlights-actions, .highlight-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; }
.highlights-heading h2 { margin: 0; font-size: 1.15rem; }
.highlights-actions { justify-content: flex-start; margin-top: 18px; }
.highlights-list { display: grid; gap: 12px; }
.highlight-card { background: var(--mark-tint); border-left: 3px solid var(--mark-color); border-radius: 7px; padding: 12px; }
.highlight-card p { margin: 0 0 10px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); line-height: 1.6; }
.highlight-card-actions { justify-content: flex-end; }
.highlight-card-actions button, .highlight-card-actions select { font: inherit; font-size: .75rem; padding: 6px; min-height: 32px; border: 1px solid var(--border); border-radius: 5px; background: var(--bg); color: var(--text); cursor: pointer; }
#highlights-status, #highlights-empty, #highlights-draft-help { font-size: .82rem; color: var(--muted); }
.highlights-draft-panel { margin-top: 20px; }
.highlights-draft-panel label { display: block; font-weight: 600; }
#highlights-editor { width: 100%; min-height: 180px; max-height: 55dvh; resize: vertical; font: inherit; line-height: 1.6; padding: 12px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 7px; margin-bottom: 10px; }
@media (max-width: 520px) {
  .highlight-tools { gap: 4px; padding: 4px 7px; }
  .highlight-tools button, .highlight-tools select { min-height: 40px; padding: 4px 6px; }
  .highlight-inline-status { flex-basis: 100%; }
  .highlight-inline-status:empty { display: none; }
  .chat-scrollbar { flex-basis: 30px; }
  .highlights-dialog { padding: 14px; }
  .highlight-card-actions button, .highlight-card-actions select { min-height: 44px; }
}
@media (forced-colors: active) {
  mark.chat-highlight, .highlight-card { border: 2px solid Highlight; }
  .highlight-marker::before, .chat-scroll-thumb { background: Highlight; forced-color-adjust: none; }
}

@media (prefers-color-scheme: dark) {
  [data-color="amber"] { --mark-color: #cba762; --mark-tint: #3e382b; }
  [data-color="sage"] { --mark-color: #8ab497; --mark-tint: #2c3b30; }
  [data-color="blue"] { --mark-color: #87aeca; --mark-tint: #2c3741; }
  [data-color="lavender"] { --mark-color: #b69acd; --mark-tint: #3a3044; }
}
