/* GCE Word Processor — Light theme. Calm. Professional. */
/* The document is the codebase. The agent is the developer. The user is the reviewer. */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&display=swap');

:root {
  --bg: #FAFAFA;
  --white: #FFFFFF;
  --text: #111111;
  --muted: #666666;
  --border: rgba(0, 0, 0, 0.08);
  --accent: #2563EB;
  --green: #7dba7d;
  --green-bg: #1a2e1a;
  --red: #c96b6b;
  --red-bg: #2e1a1a;
  --yellow: #d4a84d;
  --yellow-bg: #2e2a1a;
  --purple: #7C3AED;
  --ui: 'IBM Plex Sans', system-ui, sans-serif;
  --serif: Georgia, 'Times New Roman', serif;

  /* Phase 1: Tier colors (T0-T12) */
  --t0: #64748B;
  --t1: #0EA5E9;
  --t2: #22C55E;
  --t3: #3B82F6;
  --t4: #A855F7;
  --t5: #F59E0B;
  --t6: #6366F1;
  --t7: #EC4899;
  --t8: #EF4444;
  --t9: #94A3B8;
  --t10: #14B8A6;
  --t11: #F97316;
  --t12: #78716C;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--ui);
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── TOPBAR ── */
.topbar {
  height: 48px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  flex-shrink: 0;
}
.brand { font-size: 15px; font-weight: 600; color: var(--text); }
.brand span { color: var(--muted); font-weight: 400; margin-left: 6px; font-size: 13px; }
.top-right { margin-left: auto; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }

/* Phase 5: Status dot (connection indicator) */
.status-dot {
  width: 6px; height: 6px; border-radius: 50%; display: inline-block;
  background: var(--muted);
}
.status-dot.ok { background: var(--green); }
.status-dot.err { background: var(--red); }

/* ── MAIN ── */
.main { flex: 1; display: flex; overflow: hidden; }

/* ── PANEL 1: MY WORK — 220px ── */
.panel-nav {
  width: 220px;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}
.nav-section { padding: 16px; border-bottom: 1px solid var(--border); }
.nav-label {
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px;
}
.new-doc-btn {
  width: 100%; padding: 10px; background: var(--accent); color: white;
  border: none; border-radius: 6px; font-size: 14px; font-weight: 500;
  cursor: pointer;
}
.new-doc-btn:hover { filter: brightness(1.1); }
.doc-item {
  padding: 8px 0; border-bottom: 1px solid rgba(0,0,0,0.04);
  cursor: pointer; font-size: 13px;
}
.doc-item:hover { color: var(--accent); }
/* Phase 4: Active doc highlight */
.doc-item.active {
  border-left: 3px solid var(--accent);
  padding-left: 8px;
  background: rgba(37, 99, 235, 0.04);
  color: var(--accent);
}
.doc-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.doc-finalized-badge {
  font-size: 9px; background: var(--green-bg); color: var(--green);
  padding: 1px 5px; border-radius: 3px; font-weight: 600; margin-left: 4px;
}
.settings-toggle {
  padding: 16px; margin-top: auto; font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 8px; cursor: pointer;
}
.settings-toggle input { accent-color: var(--accent); }

/* Phase 2: Auto-approve toggle */
.auto-approve-toggle {
  padding: 10px 20px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted); background: var(--white);
}
.auto-approve-toggle input { accent-color: var(--accent); }

/* Reasoning — inline in narration stream (Cursor-style) */
.reasoning-group {
  margin: 4px 0;
}
.reasoning-group-toggle {
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  padding: 6px 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  user-select: none;
}
.reasoning-group-toggle:hover { background: rgba(37, 99, 235, 0.04); }
.reasoning-group-toggle .thinking-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: thinkPulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
}
.reasoning-group-toggle .thinking-done {
  color: var(--green); font-weight: 600;
}
.reasoning-group.collapsed .reasoning-group-lines { display: none; }
.reasoning-group-lines {
  max-height: 280px;
  overflow-y: auto;
  padding: 0 20px 4px 32px;
  border-left: 2px solid var(--accent);
  margin-left: 26px;
}
.reasoning-line {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  font-family: 'SF Mono', 'Fira Code', monospace;
  padding: 2px 0;
  opacity: 0;
  transform: translateY(3px);
  animation: reasonFadeIn 0.25s ease forwards;
}
.reasoning-line .step-icon {
  display: inline-block; width: 18px; text-align: center;
  margin-right: 4px; font-size: 11px;
}
.reasoning-line.done-line { color: var(--green); font-weight: 500; }
.reasoning-line.error-line { color: var(--red); }

@keyframes thinkPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
@keyframes reasonFadeIn {
  to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════
   WORD PROCESSOR FEATURES
   ═══════════════════════════════════════════════ */

/* Formatting Toolbar */
.fmt-toolbar {
  display: flex; align-items: center; gap: 2px;
  padding: 4px 12px; border-bottom: 1px solid var(--border);
  background: var(--white); flex-wrap: wrap; flex-shrink: 0;
}
.fmt-group { display: flex; align-items: center; gap: 2px; }
.fmt-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.fmt-btn {
  padding: 4px 8px; background: none; border: 1px solid transparent;
  border-radius: 4px; cursor: pointer; font-size: 12px; color: var(--text);
  font-family: var(--ui); line-height: 1;
}
.fmt-btn:hover { background: var(--bg); border-color: var(--border); }
.fmt-btn:active { background: rgba(0, 0, 0, 0.08); }
.fmt-select {
  padding: 3px 4px; border: 1px solid var(--border); border-radius: 4px;
  font-size: 11px; background: var(--white); color: var(--text);
  font-family: var(--ui); cursor: pointer;
}
.fmt-color { width: 24px; height: 24px; border: 1px solid var(--border); border-radius: 4px; cursor: pointer; padding: 0; }

/* Find/Replace Bar */
.find-bar {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-bottom: 1px solid var(--border);
  background: #F5F5F5; flex-shrink: 0;
}
.find-input {
  padding: 4px 8px; border: 1px solid var(--border); border-radius: 4px;
  font-size: 13px; font-family: var(--ui); width: 160px;
}
.find-input:focus { outline: none; border-color: var(--accent); }
.find-count { font-size: 11px; color: var(--muted); min-width: 40px; }
.find-btn {
  padding: 3px 8px; background: none; border: 1px solid var(--border);
  border-radius: 4px; cursor: pointer; font-size: 12px; color: var(--text);
}
.find-btn:hover { background: var(--bg); }

/* Selected sentence */
.doc-sentence.selected { background: rgba(37, 99, 235, 0.06); outline: 2px solid var(--accent); outline-offset: -2px; }

/* Rich text formatting */
.doc-sentence .sent-text { display: inline; }
.doc-sentence h1.sent-text { font-size: 28px; font-weight: 700; margin: 4px 0; display: block; }
.doc-sentence h2.sent-text { font-size: 22px; font-weight: 600; margin: 3px 0; display: block; }
.doc-sentence h3.sent-text { font-size: 18px; font-weight: 600; margin: 2px 0; display: block; }

.doc-sentence.fmt-blockquote {
  border-left: 3px solid var(--muted) !important;
  padding-left: 16px; font-style: italic; color: var(--muted); background: #F5F5F5;
}
.doc-sentence.fmt-list-item { padding-left: 24px; position: relative; }
.doc-sentence.fmt-list-item.fmt-ul::before { content: '\2022'; position: absolute; left: 12px; color: var(--text); }
.doc-sentence.fmt-list-item.fmt-ol { counter-increment: ol-counter; }
.doc-sentence.fmt-list-item.fmt-ol::before { content: counter(ol-counter) '.'; position: absolute; left: 8px; color: var(--muted); font-size: 12px; }

/* Tables */
.fmt-table {
  width: 100%; border-collapse: collapse; margin: 4px 0;
  font-size: 13px; font-family: var(--ui);
}
.fmt-table th, .fmt-table td {
  border: 1px solid var(--border); padding: 6px 10px; text-align: left;
  min-width: 60px;
}
.fmt-table th { background: #EEEEEE; font-weight: 600; font-size: 12px; }
.fmt-table td:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: #FAFBFF; }
.table-controls {
  display: flex; gap: 4px; padding: 4px 0;
}
.table-controls button {
  padding: 2px 8px; font-size: 11px; border: 1px solid var(--border);
  border-radius: 3px; background: var(--white); cursor: pointer; color: var(--muted);
}
.table-controls button:hover { background: var(--bg); color: var(--text); }

/* Images */
.doc-image img { max-width: 100%; border-radius: 4px; border: 1px solid var(--border); }
.img-caption { font-size: 12px; color: var(--muted); text-align: center; margin-top: 4px; font-style: italic; }

/* Charts */
.doc-chart svg { max-width: 100%; display: block; margin: 0 auto; }
.chart-title { font-size: 14px; font-weight: 600; text-align: center; margin-bottom: 4px; }

/* Find highlight */
.doc-sentence mark { background: #FEF08A; border-radius: 2px; padding: 0 1px; }

/* Spell check errors */
.spell-error { border-bottom: 2px wavy var(--red); cursor: help; }

/* Drag reorder */
.doc-sentence[draggable] { cursor: grab; }
.doc-sentence.dragging { opacity: 0.4; }
.doc-sentence.drag-over { border-top: 2px solid var(--accent); }

/* Code blocks */
.doc-code { background: #1E1E1E; border-radius: 6px; padding: 0; overflow: hidden; }
.doc-code pre { margin: 0; padding: 12px 16px; overflow-x: auto; }
.doc-code code { font-family: 'IBM Plex Mono', 'SF Mono', monospace; font-size: 13px; color: #D4D4D4; line-height: 1.5; white-space: pre; }
.code-lang { font-size: 10px; color: #888; padding: 4px 16px 0; text-transform: uppercase; letter-spacing: 0.05em; }

/* Table of Contents */
.doc-toc { background: #F5F5F5; border: 1px solid var(--border); border-radius: 6px; padding: 12px 16px; }
.toc-title { font-size: 14px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.toc-entry { font-size: 13px; color: var(--accent); padding: 2px 0; cursor: pointer; }
.toc-entry:hover { text-decoration: underline; }
.toc-level-2 { padding-left: 16px; }
.toc-level-3 { padding-left: 32px; }

/* Page breaks */
.doc-page-break { text-align: center; padding: 8px 0; }
.doc-page-break hr { border: none; border-top: 2px dashed var(--border); }
.page-break-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* Footnotes */
.footnote-ref { color: var(--accent); cursor: help; font-size: 11px; margin-left: 2px; }
.footnotes-section { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 12px; }
.footnotes-title { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.footnote-item { font-size: 12px; color: var(--muted); padding: 2px 0; line-height: 1.5; }

/* Analytics overlay */
.analytics-overlay {
  position: fixed; right: 16px; top: 60px; width: 380px; max-height: 80vh;
  background: var(--white); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1); z-index: 100; overflow: hidden;
}
.analytics-header {
  padding: 12px 16px; font-size: 14px; font-weight: 600; border-bottom: 1px solid var(--border);
  cursor: pointer; background: #F5F5F5;
}
.analytics-body { padding: 12px 16px; overflow-y: auto; max-height: calc(80vh - 50px); }
.analytics-stat { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.analytics-label { color: var(--muted); }
.analytics-value { font-weight: 600; color: var(--text); }
.analytics-section { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 12px 0 6px; }
.analytics-bar { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.analytics-bar-label { font-size: 11px; color: var(--muted); width: 80px; flex-shrink: 0; }
.analytics-bar-fill { height: 12px; border-radius: 2px; min-width: 2px; }
.analytics-bar-val { font-size: 11px; color: var(--text); font-weight: 500; }
.analytics-words { line-height: 1.8; }
.analytics-word { font-size: 12px; color: var(--text); background: var(--bg); padding: 2px 6px; border-radius: 3px; margin: 2px; display: inline-block; }

/* Code Health badges */
.health-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 3px 0; font-size: 12px;
}
.health-fn { color: var(--text); font-weight: 500; }
.health-badge {
  font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 4px; white-space: nowrap;
}
.health-no-data {
  font-size: 12px; color: var(--muted); padding: 4px 0;
}

/* Revision history */
.revision-item { padding: 8px 0; border-bottom: 1px solid var(--border); }
.revision-item.approved { border-left: 3px solid var(--green); padding-left: 8px; }
.revision-item.denied { border-left: 3px solid var(--red); padding-left: 8px; }
.revision-item.undone { border-left: 3px solid var(--yellow); padding-left: 8px; opacity: 0.6; }
.revision-meta { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.revision-before { font-size: 12px; color: var(--red); background: var(--red-bg); padding: 4px 8px; border-radius: 3px; margin: 2px 0; text-decoration: line-through; }
.revision-after { font-size: 12px; color: var(--green); background: var(--green-bg); padding: 4px 8px; border-radius: 3px; margin: 2px 0; }
.revision-reason { font-size: 11px; color: var(--muted); font-style: italic; }

/* Comments */
.comment-badge {
  font-size: 11px; color: var(--accent); cursor: pointer; margin-left: 8px;
  padding: 1px 5px; background: rgba(37,99,235,0.08); border-radius: 8px;
}
.comment-badge:hover { background: rgba(37,99,235,0.15); }
.comment-item { padding: 8px 0; border-bottom: 1px solid var(--border); }
.comment-item.resolved { opacity: 0.5; }
.comment-author { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.comment-text { font-size: 13px; color: var(--text); }
.comment-input {
  width: 100%; box-sizing: border-box; background: var(--surface, #1a1a2e);
  border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px;
  color: var(--text); font-size: 13px; font-family: inherit; resize: vertical;
}
.comment-input:focus { outline: none; border-color: var(--accent); }
.mention { color: var(--accent); font-weight: 600; }
.mention-dropdown {
  position: absolute; left: 0; right: 0; background: var(--surface, #1a1a2e);
  border: 1px solid var(--border); border-radius: 6px; max-height: 150px;
  overflow-y: auto; z-index: 100; box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.mention-option {
  padding: 6px 10px; cursor: pointer; font-size: 13px; color: var(--text);
}
.mention-option:hover, .mention-option.selected {
  background: rgba(37,99,235,0.12);
}

/* Phase 6: Binder section */
.binder-section { padding: 16px; border-bottom: 1px solid var(--border); }
.binder-item {
  padding: 6px 0; cursor: pointer; font-size: 13px;
  display: flex; align-items: center; gap: 6px;
}
.binder-item:hover { color: var(--accent); }
.binder-icon { font-size: 14px; }
.binder-count {
  font-size: 10px; color: var(--muted); background: var(--bg);
  padding: 1px 5px; border-radius: 8px; margin-left: auto;
}
.binder-actions { display: flex; gap: 4px; }
.new-binder-btn {
  width: 100%; padding: 6px; background: var(--bg); color: var(--muted);
  border: 1px dashed var(--border); border-radius: 4px; font-size: 12px;
  cursor: pointer; margin-top: 8px;
}
.new-binder-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── PANEL 2: ASSISTANT ── */
.panel-assistant {
  flex: 1; min-width: 280px;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

/* Zone A: narration */
.zone-narration {
  flex: 1; overflow-y: auto; padding: 20px;
}
.narration-msg {
  margin-bottom: 12px; font-size: 14px; line-height: 1.6; color: var(--text);
  max-width: 85%; padding: 8px 12px; border-radius: 12px;
  position: relative;
}
.narration-msg.system {
  color: var(--muted); font-style: italic;
  background: none; padding: 0; max-width: 100%;
}
/* Phase 3: User bubble (right-aligned blue) */
.narration-msg.user {
  background: var(--accent); color: white; font-weight: 500;
  margin-left: auto; border-bottom-right-radius: 4px;
}
/* Phase 3: Assistant bubble (left-aligned bordered) */
.narration-msg:not(.system):not(.user) {
  background: var(--white); border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
/* Phase 3: Timestamp */
.narration-time {
  font-size: 9px; color: var(--muted); margin-top: 2px;
  display: block;
}
/* Phase 2: Intent badge */
.intent-badge {
  display: inline-block; font-size: 10px; padding: 2px 8px;
  border: 1px solid var(--border); border-radius: 10px;
  color: var(--muted); margin-top: 4px;
}

/* Phase 3: Typing indicator */
.typing-indicator {
  display: flex; align-items: center; gap: 4px;
  padding: 8px 12px; max-width: 60px;
}
.typing-indicator span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted); display: inline-block;
  animation: typing 1.2s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Zone B: change controls */
.zone-changes {
  padding: 12px 20px; border-top: 1px solid var(--border);
  background: var(--white); display: none;
}
.zone-changes.visible { display: block; }
.change-summary { font-size: 13px; margin-bottom: 8px; }
.change-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-approve-all {
  padding: 6px 14px; background: var(--green); color: white;
  border: none; border-radius: 4px; font-size: 12px; cursor: pointer;
}
.btn-deny-all {
  padding: 6px 14px; background: white; color: var(--red);
  border: 1px solid var(--red); border-radius: 4px; font-size: 12px; cursor: pointer;
}
.btn-review {
  padding: 6px 14px; background: white; color: var(--accent);
  border: 1px solid var(--accent); border-radius: 4px; font-size: 12px; cursor: pointer;
}
/* Phase 2: Undo button */
.btn-undo {
  padding: 6px 14px; background: white; color: var(--yellow);
  border: 1px solid var(--yellow); border-radius: 4px; font-size: 12px; cursor: pointer;
}
.btn-undo:disabled { opacity: 0.4; cursor: not-allowed; }

/* Zone C: chat bar */
.zone-chat {
  padding: 12px 20px; border-top: 1px solid var(--border);
  background: var(--white); display: flex; gap: 8px;
  align-items: center; position: relative;
}
.chat-input {
  flex: 1; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; font-family: var(--ui);
  outline: none; color: var(--text); background: var(--surface, #FFFFFF);
}
.chat-input:focus { border-color: var(--accent); }
.chat-input::placeholder { color: #999; }
.chat-send {
  padding: 10px 18px; background: var(--accent); color: white;
  border: none; border-radius: 8px; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: opacity 0.2s;
}
.chat-send:hover { filter: brightness(1.1); }
/* Phase 3: Loading state */
.chat-send.loading { opacity: 0.5; pointer-events: none; }
/* Phase 4: Character counter */
.char-count {
  font-size: 10px; color: var(--muted); position: absolute;
  right: 100px; bottom: 4px;
}

/* ── PANEL 3: DOCUMENT ── */
.panel-document {
  flex: 1.5; min-width: 400px;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.doc-toolbar {
  padding: 8px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  font-size: 12px; color: var(--muted); flex-wrap: wrap;
}
/* Phase 4: Editable title */
#docTitle {
  font-weight: 500; color: var(--text); cursor: default;
}
#docTitle:hover { border-bottom: 1px dashed var(--border); }
#docTitle[contenteditable="true"] {
  border-bottom: 1px solid var(--accent); outline: none;
  cursor: text;
}
.doc-status { margin-left: auto; display: flex; align-items: center; gap: 8px; }
/* Phase 4: Toolbar stats */
.doc-toolbar-stats {
  display: flex; align-items: center; gap: 12px; font-size: 11px; color: var(--muted);
}
.word-count { font-size: 11px; color: var(--muted); }
/* Phase 4: Tier mini-bar */
.tier-mini-bar {
  display: flex; height: 4px; width: 80px; border-radius: 2px; overflow: hidden;
  background: var(--border);
}
.tier-mini-bar span { height: 100%; display: block; }
/* Phase 2: Finalize button */
.btn-finalize {
  padding: 5px 12px; background: var(--accent); color: white;
  border: none; border-radius: 4px; font-size: 11px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
}
.btn-finalize:hover { filter: brightness(1.1); }
/* Phase 6: Add to Binder dropdown */
.binder-dropdown-wrap { position: relative; display: inline-block; }
.btn-binder {
  padding: 5px 10px; background: var(--bg); color: var(--muted);
  border: 1px solid var(--border); border-radius: 4px; font-size: 11px;
  cursor: pointer; white-space: nowrap;
}
.btn-binder:hover { border-color: var(--accent); color: var(--accent); }
.binder-dropdown {
  display: none; position: absolute; top: 100%; right: 0;
  background: var(--white); border: 1px solid var(--border);
  border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  min-width: 160px; z-index: 20; margin-top: 4px;
}
.binder-dropdown.show { display: block; }
.binder-dropdown-item {
  padding: 8px 12px; font-size: 12px; cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.binder-dropdown-item:last-child { border-bottom: none; }
.binder-dropdown-item:hover { background: var(--bg); color: var(--accent); }

.doc-content {
  flex: 1; overflow-y: auto;
  padding: 32px 48px;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  /* IDE workspace: editable surface */
  outline: none;
  min-height: 200px;
  cursor: text;
}
.doc-content:focus {
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.15);
}
.doc-content[contenteditable]:empty::before {
  content: attr(data-placeholder);
  color: #999999;
  font-style: italic;
  pointer-events: none;
}
.doc-content .empty {
  color: #999999; font-size: 15px; padding-top: 60px; text-align: center;
}
/* Phase 4: Empty guide */
.empty-guide {
  padding-top: 40px; max-width: 400px; margin: 0 auto;
  font-family: var(--ui); color: var(--muted);
}
.empty-guide h3 { font-size: 16px; color: var(--text); margin-bottom: 16px; font-weight: 500; }
.empty-guide .step {
  display: flex; gap: 12px; margin-bottom: 16px; font-size: 13px; line-height: 1.5;
}
.empty-guide .step-num {
  width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: white;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600;
  flex-shrink: 0;
}

/* Document typography */
.doc-content { font-family: var(--serif); font-size: 16px; line-height: 1.75; color: var(--text); }
.doc-content h1 { font-size: 24px; margin: 0 0 16px; font-weight: 600; }
.doc-content h2 { font-size: 20px; margin: 24px 0 12px; font-weight: 600; }
.doc-content h3 { font-size: 17px; margin: 20px 0 8px; font-weight: 600; }

/* Phase 1: Sentence rendering with tier visualization */
.doc-sentence {
  margin-bottom: 8px; padding: 6px 12px 6px 14px;
  border-left: 3px solid transparent;
  position: relative; border-radius: 2px;
  transition: background 0.15s;
}
.doc-sentence:hover { background: rgba(0,0,0,0.015); }
.sentence-meta {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 3px; flex-wrap: wrap;
}
.tier-badge {
  display: inline-block; font-size: 10px; font-weight: 600;
  padding: 1px 6px; border-radius: 3px; color: white;
  font-family: var(--ui); letter-spacing: 0.03em;
}
.conf-dot {
  width: 6px; height: 6px; border-radius: 50%; display: inline-block;
}
.domain-label {
  font-size: 11px; color: var(--muted); font-family: var(--ui);
}
.sentence-status {
  font-size: 9px; padding: 1px 5px; border-radius: 3px;
  border: 1px solid var(--border); color: var(--muted); font-family: var(--ui);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.sentence-status.verified { border-color: var(--green); color: var(--green); }
.sentence-status.reconciled { border-color: var(--accent); color: var(--accent); }
.sentence-status.flagged { border-color: var(--red); color: var(--red); }
.sentence-integrity {
  font-size: 10px; color: var(--muted); font-family: var(--ui);
  margin-left: auto;
}

/* Inline diffs */
.diff-block {
  border: 1px solid var(--border); border-radius: 8px;
  margin: 12px 0; overflow: hidden;
  animation: slideIn 0.25s ease-out;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.diff-remove {
  background: var(--red-bg); color: var(--red);
  padding: 10px 16px; font-family: var(--serif); font-size: 16px; line-height: 1.75;
}
.diff-add {
  background: var(--green-bg); color: var(--green);
  padding: 10px 16px; font-family: var(--serif); font-size: 16px; line-height: 1.75;
}
.diff-insert {
  background: var(--yellow-bg); color: var(--yellow);
  padding: 10px 16px; font-family: var(--serif); font-size: 16px; line-height: 1.75;
}
.diff-reason {
  padding: 8px 16px; font-size: 13px; color: var(--muted);
  font-family: var(--ui); border-top: 1px solid var(--border);
}
.diff-controls {
  padding: 8px 16px; display: flex; gap: 8px;
  border-top: 1px solid var(--border); background: var(--bg);
}
.btn-approve {
  padding: 5px 12px; background: var(--green); color: white;
  border: none; border-radius: 4px; font-size: 12px; cursor: pointer;
}
.btn-deny {
  padding: 5px 12px; background: white; color: var(--red);
  border: 1px solid var(--red); border-radius: 4px; font-size: 12px; cursor: pointer;
}
.btn-suggest {
  padding: 5px 12px; background: white; color: var(--muted);
  border: 1px solid var(--border); border-radius: 4px; font-size: 12px; cursor: pointer;
}

/* ── PANEL 4: FINISHED ── */
.panel-finished {
  width: 280px;
  background: var(--white);
  display: none; /* hidden until document is sent here */
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}
.panel-finished.open {
  display: flex;
}
.panel-finished-toggle {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  width: 20px; height: 40px; background: var(--border); border: none;
  border-radius: 4px 0 0 4px; cursor: pointer; font-size: 10px;
  color: var(--muted); z-index: 10; display: flex; align-items: center;
  justify-content: center;
}
.finished-toolbar {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; gap: 8px;
}
.mode-btn {
  flex: 1; padding: 6px; text-align: center; font-size: 12px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; cursor: pointer; color: var(--muted);
}
.mode-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
/* Phase 5: Finished content typography (simple markdown) */
.finished-content {
  flex: 1; overflow-y: auto; padding: 20px;
  font-family: var(--serif); font-size: 15px; line-height: 1.7;
}
.finished-content h1 { font-size: 22px; font-weight: 600; margin: 0 0 12px; }
.finished-content h2 { font-size: 18px; font-weight: 600; margin: 16px 0 8px; }
.finished-content h3 { font-size: 16px; font-weight: 600; margin: 12px 0 6px; }
.finished-content p { margin-bottom: 10px; }
.finished-content ul, .finished-content ol { margin: 8px 0 8px 20px; }
.finished-content li { margin-bottom: 4px; }
.finished-content strong { font-weight: 600; }
.finished-content em { font-style: italic; }
.finished-empty { color: #999999; font-size: 14px; text-align: center; padding-top: 40px; font-family: var(--ui); }
.export-btns {
  padding: 12px 16px; border-top: 1px solid var(--border);
  display: flex; gap: 6px; flex-wrap: wrap;
}
.export-btn {
  padding: 6px 12px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; font-size: 11px; cursor: pointer; color: var(--muted);
}
.export-btn:hover { border-color: var(--accent); color: var(--accent); }
/* Phase 5: JSON export button accent */
.export-btn.json { border-color: var(--accent); color: var(--accent); }
.export-btn.json:hover { background: var(--accent); color: white; }

/* Phase 3: Toast notification */
#toast {
  position: fixed; top: 60px; right: 20px; z-index: 100;
  padding: 10px 18px; border-radius: 8px; font-size: 13px;
  font-family: var(--ui); box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  opacity: 0; transform: translateY(-8px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
#toast.show {
  opacity: 1; transform: translateY(0); pointer-events: auto;
}
#toast.ok { background: var(--green-bg); color: var(--green); border: 1px solid var(--green); }
#toast.err { background: var(--red-bg); color: var(--red); border: 1px solid var(--red); }

/* Phase 5: Confirmation dialog */
#confirmDialog {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,0.3); display: none;
  align-items: center; justify-content: center;
}
#confirmDialog.show { display: flex; }
.confirm-box {
  background: var(--white); border-radius: 12px; padding: 24px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15); max-width: 360px; width: 90%;
}
.confirm-msg { font-size: 14px; margin-bottom: 16px; line-height: 1.5; }
.confirm-btns { display: flex; gap: 8px; justify-content: flex-end; }
.confirm-btns button {
  padding: 8px 16px; border-radius: 6px; font-size: 13px; cursor: pointer;
  border: 1px solid var(--border);
}
.confirm-btns .confirm-ok {
  background: var(--red); color: white; border-color: var(--red);
}
.confirm-btns .confirm-cancel {
  background: var(--white); color: var(--muted);
}

/* Suggestion flow: change description list in narration */
.change-descriptions {
  background: var(--white) !important;
  border: 1px solid var(--border) !important;
  border-bottom-left-radius: 4px;
  max-width: 95%;
}
.change-desc-header {
  font-weight: 500;
  margin-bottom: 8px;
  font-size: 14px;
}
.change-desc-list {
  margin: 0;
  padding-left: 20px;
  list-style: decimal;
}
.change-desc-item {
  margin-bottom: 6px;
  font-size: 13px;
  line-height: 1.5;
  cursor: pointer;
  padding: 2px 0;
}
.change-desc-item:hover {
  color: var(--accent);
}
.change-desc-item strong {
  font-weight: 600;
}

/* Phase 5: Keyboard shortcut hints */
.shortcut-hint {
  font-size: 9px; font-family: var(--ui); color: var(--muted);
  background: var(--bg); border: 1px solid var(--border);
  padding: 1px 4px; border-radius: 3px; margin-left: 4px;
  font-weight: 500;
}

/* Phase 3: Document search */
.doc-search {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 12px; font-family: var(--ui);
  outline: none; color: var(--text); background: var(--bg);
}
.doc-search:focus { border-color: var(--accent); }

/* Phase 2: Delete button on doc items */
.doc-item-row { display: flex; align-items: center; justify-content: space-between; }
.doc-delete-btn {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 14px; padding: 0 2px; opacity: 0; transition: opacity 0.15s;
}
.doc-item:hover .doc-delete-btn { opacity: 1; }
.doc-delete-btn:hover { color: var(--red); }

/* Phase 4: Inline edit textarea */
.inline-edit {
  width: 100%; padding: 6px 8px; border: 1px solid var(--accent);
  border-radius: 4px; font-family: var(--serif); font-size: 16px;
  line-height: 1.75; resize: vertical; outline: none;
  color: var(--text); background: var(--white);
}

/* ── Collaborative Editing (C2: Multi-User) ── */
.sentence-locked {
  border-left: 3px solid #f59e0b !important;
  opacity: 0.7;
  pointer-events: none;
  position: relative;
}
.sentence-locked-by {
  font-size: 10px;
  color: #f59e0b;
  font-family: var(--ui);
  position: absolute;
  top: 2px;
  right: 8px;
  font-weight: 500;
}
.sentence-editing {
  border-left: 3px solid var(--accent) !important;
}
.presence-bar {
  display: flex;
  gap: 12px;
  padding: 4px 16px;
  font-size: 11px;
  font-family: var(--ui);
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--white);
  align-items: center;
  flex-shrink: 0;
}
.presence-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
  vertical-align: middle;
}
.cursor-indicator {
  position: absolute;
  left: 0;
  top: 4px;
  width: 2px;
  height: 1.2em;
  border-radius: 1px;
  animation: collabBlink 1s step-end infinite;
  pointer-events: none;
}
@keyframes collabBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Phase 4b: Binder drag-and-drop items */
.binder-doc-list { margin-bottom: 16px; }
.binder-doc-item {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 4px;
  margin-bottom: 4px; display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-family: var(--ui); cursor: grab; background: var(--white);
  transition: background 0.15s;
}
.binder-doc-item:hover { background: var(--bg); }
.binder-doc-item.dragging { opacity: 0.4; }
.binder-drag-handle { color: var(--muted); cursor: grab; }

/* Phase 6: Binder score summary */
.binder-score-summary {
  padding: 10px 16px; margin-bottom: 12px; font-size: 13px;
  color: var(--muted); font-family: var(--ui);
  background: var(--bg); border-radius: 6px; border: 1px solid var(--border);
}

/* Phase 5: Skip-to-content link */
.skip-link {
  position: absolute; left: -9999px; top: auto;
  width: 1px; height: 1px; overflow: hidden;
  z-index: 999;
}
.skip-link:focus {
  position: fixed; top: 8px; left: 8px;
  width: auto; height: auto; padding: 8px 16px;
  background: var(--accent); color: white; border-radius: 4px;
  font-size: 13px; z-index: 999; text-decoration: none;
}

/* Keyboard focus indicator for accessibility */
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Phase 7: Theme toggle button */
.theme-toggle {
  background: none; border: 1px solid var(--border); border-radius: 4px;
  cursor: pointer; font-size: 16px; padding: 2px 8px; color: var(--muted);
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* Dark mode removed — SovrenAI Universal Design Standard v1.0 */
/* Light only. White always. No exceptions. */

/* F11+F10: Document Status Bar */
.doc-status-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 16px; font-size: 11px; color: var(--muted);
  border-top: 1px solid var(--border); background: var(--bg);
  flex-shrink: 0;
}
.doc-status-bar .status-sep { color: var(--border); }
.doc-status-bar .readability-good { color: #7dba7d; }
.doc-status-bar .readability-mid { color: #d4a84d; }
.doc-status-bar .readability-hard { color: #c96b6b; }

/* F1: IDE Copilot Panel */
.ide-copilot-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.2); z-index: 90;
}
.ide-copilot-panel {
  position: fixed; right: 0; top: 0; bottom: 0; width: 360px; z-index: 91;
  background: var(--white); border-left: 1px solid var(--border);
  box-shadow: -4px 0 12px rgba(0,0,0,0.08);
  display: flex; flex-direction: column;
}
.ide-copilot-header {
  padding: 10px 14px; font-weight: 600; font-size: 13px;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.ide-copilot-history {
  flex: 1; overflow-y: auto; padding: 8px 0;
}
.ide-copilot-input-row {
  display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.ide-copilot-input-row input {
  flex: 1; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 12px; font-family: inherit; background: var(--bg); color: var(--text); outline: none;
}
.ide-copilot-input-row input:focus { border-color: var(--accent); }
.ide-copilot-input-row button {
  padding: 6px 14px; background: var(--accent); color: #fff; border: none;
  border-radius: 6px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.ide-copilot-panel .copilot-example {
  display: inline-block; padding: 3px 8px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 10px; color: var(--muted); cursor: pointer;
}
.ide-copilot-panel .copilot-example:hover { border-color: var(--accent); color: var(--accent); }

/* F1: Inline Autocomplete Ghost */
.autocomplete-ghost {
  position: absolute; bottom: 2px; right: 8px;
  color: var(--muted); font-style: italic; font-size: 11px;
  pointer-events: none; opacity: 0.6;
}

/* F5: Print Preview handled via inline styles on modal */

/* F8: Slash Command Menu */
.slash-menu {
  position: absolute; bottom: 48px; left: 16px; z-index: 50;
  background: var(--white); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1); min-width: 200px; padding: 4px 0;
  max-height: 300px; overflow-y: auto;
}
.slash-item {
  padding: 8px 14px; cursor: pointer; font-size: 13px; display: flex;
  align-items: center; gap: 8px; transition: background 0.1s;
}
.slash-item:hover { background: rgba(37,99,235,0.06); }
.slash-icon {
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
  background: var(--bg); border-radius: 4px; font-size: 12px; flex-shrink: 0;
  border: 1px solid var(--border);
}

/* F7: Drag-and-Drop */
.doc-sentence { cursor: default; position: relative; }
.doc-sentence::before {
  content: '\\2807'; position: absolute; left: -16px; top: 50%; transform: translateY(-50%);
  color: var(--border); font-size: 14px; cursor: grab; opacity: 0;
  transition: opacity 0.15s;
}
.doc-sentence:hover::before { opacity: 0.6; }
.doc-sentence.dragging { opacity: 0.4; }
.doc-sentence.drag-over { border-top: 2px solid var(--accent); }

/* F2: Track Changes Inline */
.tc-remove {
  text-decoration: line-through; color: #c96b6b; background: #2e1a1a;
  padding: 1px 3px; border-radius: 2px;
}
.tc-add {
  color: #7dba7d; background: #1a2e1a;
  padding: 1px 3px; border-radius: 2px;
}
.tc-insert-line { margin: 2px 0; padding-left: 16px; }
.tc-approve, .tc-deny {
  border: none; background: none; cursor: pointer; font-size: 12px; padding: 1px 4px;
  border-radius: 3px; vertical-align: middle;
}
.tc-approve { color: #7dba7d; } .tc-approve:hover { background: #1a2e1a; }
.tc-deny { color: #c96b6b; } .tc-deny:hover { background: #2e1a1a; }
#trackChangesBtn.active { background: var(--accent); color: #fff; border-radius: 4px; }

/* F3: Version Diff Viewer */
.version-item {
  padding: 6px 10px; cursor: pointer; border: 1px solid var(--border);
  border-radius: 4px; margin: 3px 0; font-size: 12px; transition: background 0.1s;
}
.version-item:hover { background: rgba(37,99,235,0.05); }
.version-item.selected { border-color: var(--accent); background: rgba(37,99,235,0.08); }

/* F9: Focus Mode */
.focus-mode .panel-nav,
.focus-mode .panel-assistant,
.focus-mode .panel-finished { display: none !important; }
.focus-mode .panel-document {
  flex: 1; max-width: 100%;
}
.focus-mode .doc-content {
  max-width: 720px; margin: 0 auto;
}
.focus-mode .fmt-toolbar { justify-content: center; }
.focus-mode #focusToggleBtn { background: var(--accent); color: #fff; border-radius: 4px; }

/* F6: TOC Sidebar */
.toc-sidebar {
  width: 200px; border-right: 1px solid var(--border); background: var(--bg);
  overflow-y: auto; flex-shrink: 0; font-size: 12px;
}
.toc-header {
  padding: 8px 12px; font-weight: 600; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted); display: flex; align-items: center;
  justify-content: space-between; border-bottom: 1px solid var(--border);
}
.toc-close { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; }
.toc-list { padding: 4px 0; }
.toc-entry {
  padding: 4px 12px; cursor: pointer; color: var(--text); line-height: 1.4;
  border-left: 2px solid transparent; transition: background 0.1s;
}
.toc-entry:hover { background: var(--accent); background: rgba(37,99,235,0.05); }
.toc-entry.h1 { font-weight: 600; padding-left: 12px; }
.toc-entry.h2 { padding-left: 24px; }
.toc-entry.h3 { padding-left: 36px; color: var(--muted); }
#tocToggleBtn.active { background: var(--accent); color: #fff; border-radius: 4px; }

/* ── Phase 6: Responsive breakpoints ── */
@media (max-width: 1200px) {
  .panel-finished { width: 220px; }
}

@media (max-width: 900px) {
  .main { flex-direction: column; overflow-y: auto; }
  .panel-nav {
    width: 100%; flex-direction: row; overflow-x: auto;
    border-right: none; border-bottom: 1px solid var(--border);
    max-height: 80px;
  }
  .nav-section { padding: 8px; border-bottom: none; }
  .panel-assistant { max-height: 300px; min-width: 0; border-right: none; border-bottom: 1px solid var(--border); }
  .panel-document { min-width: 0; border-right: none; }
  .panel-finished { width: 100%; max-height: 300px; }
}

@media (max-width: 900px) {
  .fmt-btn, .find-btn, .btn-approve-all, .btn-undo { min-height: 36px; padding: 6px 10px; }
}
@media (max-width: 600px) {
  .panel-nav { display: none; }
  .doc-content { padding: 16px; }
  .shortcut-hint { display: none; }
  .zone-narration { padding: 10px; }
  .zone-chat { padding: 8px 10px; }
  .fmt-btn, .find-btn, .btn-approve-all, .btn-undo { min-height: 44px; padding: 10px 12px; font-size: 13px; }
  .fmt-toolbar { flex-wrap: wrap; gap: 4px; }
}

/* ── ATOM TOOLTIP (Phase 3) ── */
.atom-word { cursor: default; }
.atom-word:hover { background: rgba(37, 99, 235, 0.08); border-radius: 2px; }
.atom-word.unregistered { text-decoration-line: underline; text-decoration-style: wavy; text-decoration-color: var(--yellow); }

.atom-tooltip {
  position: fixed; z-index: 9999;
  background: white; border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  max-width: 320px; font-size: 13px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s;
  font-family: var(--ui);
}
.atom-tooltip.visible { opacity: 1; pointer-events: auto; }
.at-word { font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.at-label { color: var(--muted); font-size: 11px; }
.at-def { color: var(--text); margin: 6px 0; line-height: 1.5; }
.at-row { display: flex; gap: 6px; align-items: center; font-size: 12px; }
.at-row code { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--accent); }

/* ── ATOM DIFF METADATA (Phase 4) ── */
.diff-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin-bottom: 4px; }
.diff-text { font-family: Georgia, serif; font-size: 15px; line-height: 1.6; }
.atom-meta-row { font-size: 11px; color: var(--muted); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; }
.integrity-delta { font-weight: 600; font-size: 11px; }
.integrity-delta.positive { color: var(--green); }
.integrity-delta.negative { color: var(--red); }
.unregistered-warning { color: var(--yellow); font-weight: 500; }
.diff-warning { background: var(--yellow-bg); color: #92400E; padding: 8px 12px; border-radius: 4px; font-size: 12px; margin: 4px 0; }

/* ── INTEGRITY BAR (Phase 5) ── */
.integrity-bar {
  position: sticky; bottom: 0;
  background: white; border-top: 1px solid var(--border);
  padding: 6px 16px; font-size: 12px; color: var(--muted);
  cursor: pointer; display: none;
  font-family: var(--ui);
}
.integrity-bar:hover { background: var(--bg); }
.integrity-detail { padding: 8px 0; }
.integrity-line { font-size: 12px; color: var(--text); padding: 2px 0; }

/* ── C4: EXAMPLE LIBRARY MODAL ── */
.from-example-btn {
  width: 100%; padding: 8px; margin-top: 6px;
  background: transparent; color: var(--accent); border: 1px solid var(--accent);
  border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer;
}
.from-example-btn:hover { background: rgba(37, 99, 235, 0.08); }

.example-modal {
  display: none; position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.6); align-items: center; justify-content: center;
}
.example-modal-inner {
  background: var(--white); border-radius: 12px; width: 640px; max-width: 92vw;
  max-height: 80vh; display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--border);
}
.example-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.example-modal-header h2 { font-size: 16px; font-weight: 600; }
.example-modal-close {
  background: none; border: none; font-size: 22px; cursor: pointer;
  color: var(--muted); line-height: 1;
}
.example-modal-close:hover { color: var(--text); }

.category-filter {
  display: flex; gap: 6px; padding: 12px 20px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}
.cat-btn {
  padding: 4px 12px; border-radius: 14px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); font-size: 12px; cursor: pointer;
}
.cat-btn:hover { border-color: var(--accent); color: var(--accent); }
.cat-btn.active { background: var(--accent); color: white; border-color: var(--accent); }

.example-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  padding: 16px 20px; overflow-y: auto;
}
.example-loading { grid-column: 1/-1; text-align: center; color: var(--muted); padding: 40px 0; }

.example-card {
  border: 1px solid var(--border); border-radius: 8px; padding: 14px;
  cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s;
}
.example-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
}
.example-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.example-title { font-size: 14px; font-weight: 600; }
.example-category {
  font-size: 10px; font-weight: 600; color: white; padding: 2px 8px;
  border-radius: 10px; text-transform: uppercase; letter-spacing: 0.03em;
}
.example-desc { font-size: 12px; color: var(--muted); line-height: 1.4; margin-bottom: 8px; }
.example-card-bottom { display: flex; justify-content: space-between; font-size: 11px; }
.example-difficulty { font-weight: 600; text-transform: capitalize; }
.example-scount { color: var(--muted); }

/* ── C5: TIME MACHINE SLIDER ── */
.time-machine-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: #1a1a2e;
  border-bottom: 1px solid rgba(37, 99, 235, 0.3);
  font-size: 12px;
  color: #a0a0c0;
}
.time-machine-bar.active { display: flex; }
.time-machine-label {
  font-weight: 600; color: var(--accent); white-space: nowrap; font-size: 12px;
}
.time-machine-slider {
  flex: 1; height: 4px; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background: var(--border); border-radius: 2px; outline: none;
}
.time-machine-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--border);
  cursor: pointer;
}
.time-machine-slider::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--border);
  cursor: pointer;
}
.time-machine-info {
  color: var(--muted); font-size: 11px; white-space: nowrap; min-width: 100px; text-align: center;
}
.time-machine-sparkline {
  border-radius: 4px; background: rgba(0,0,0,0.03);
}
.time-machine-exit {
  background: transparent; color: var(--accent); border: 1px solid var(--accent);
  border-radius: 4px; padding: 4px 10px; font-size: 11px; cursor: pointer;
  white-space: nowrap;
}
.time-machine-exit:hover { background: rgba(37, 99, 235, 0.15); }
.time-machine-overlay-label {
  background: rgba(37, 99, 235, 0.08); color: var(--accent); font-size: 11px;
  padding: 4px 12px; border-radius: 4px; margin-bottom: 8px;
}
.doc-content.time-machine-readonly {
  pointer-events: none; opacity: 0.85; position: relative;
}
.doc-content.time-machine-readonly::before {
  content: ''; position: absolute; inset: 0; z-index: 10;
  background: repeating-linear-gradient(
    -45deg, transparent, transparent 8px,
    rgba(37, 99, 235, 0.03) 8px, rgba(37, 99, 235, 0.03) 16px
  );
  pointer-events: none;
}

/* ── C6: OUTLINE MODE ── */
.fmt-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
.outline-header {
  font-size: 13px; color: var(--muted); font-family: var(--ui);
  padding: 12px 0 16px; border-bottom: 1px solid var(--border); margin-bottom: 12px;
}
.outline-entry {
  padding: 10px 14px; border-left: 3px solid var(--muted);
  border-radius: 0 6px 6px 0; margin-bottom: 8px;
  cursor: pointer; transition: background 0.15s;
  background: var(--bg);
}
.outline-entry:hover { background: rgba(37, 99, 235, 0.06); }
.outline-reason {
  display: inline-block; font-size: 10px; font-weight: 600;
  padding: 2px 8px; border-radius: 10px; color: white;
  font-family: var(--ui); text-transform: capitalize; letter-spacing: 0.02em;
}
.outline-text {
  font-family: var(--serif); font-size: 15px; line-height: 1.5;
  margin: 6px 0 4px; color: var(--text); opacity: 0.9;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.outline-meta {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--muted); font-family: var(--ui);
}
.outline-empty {
  text-align: center; padding: 60px 20px; color: var(--muted);
  font-size: 14px; font-family: var(--ui);
}

/* ── PRINT ── */
@media print {
  .panel-nav, .panel-assistant, .panel-finished,
  .topbar, .doc-toolbar, #toast, #confirmDialog { display: none !important; }
  .main { display: block !important; }
  .panel-document {
    width: 100% !important; min-width: 0 !important;
    border: none !important;
  }
  .doc-content { max-width: 100% !important; padding: 0 !important; }
  .sentence-meta { display: none !important; }
  .doc-sentence { border-left: none !important; padding-left: 0 !important; }
  .diff-block { break-inside: avoid; }
}
