:root {
  --primary: #4F46E5;
  --primary-light: #818CF8;
  --primary-dark: #3730A3;
  --success: #10B981;
  --success-light: #D1FAE5;
  --warning: #F59E0B;
  --danger: #EF4444;
  --bg: #F3F4F6;
  --surface: #FFFFFF;
  --text: #111827;
  --text-secondary: #6B7280;
  --border: #E5E7EB;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { overscroll-behavior: none; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
  overscroll-behavior: none;
}

/* ========== HEADER ========== */
.header {
  background: linear-gradient(135deg, #312E81, var(--primary));
  color: white; padding: 14px 24px; box-shadow: 0 2px 12px rgba(49,46,129,0.35);
  position: sticky; top: 0; z-index: 100;
}
.header-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; gap: 12px; flex-wrap: wrap;
}
.header-top.no-steps { margin-bottom: 0; }
.brand-title {
  font-size: 20px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; gap: 8px; user-select: none; white-space: nowrap;
}
.brand-icon {
  width: 30px; height: 30px; background: rgba(255,255,255,0.2); border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; flex-shrink: 0;
}
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-back-home {
  color: white; border-color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.1); font-size: 13px;
}
.btn-back-home:hover { background: rgba(255,255,255,0.2); }
.steps-bar { display: flex; gap: 6px; flex-wrap: wrap; }
.step-indicator {
  display: flex; align-items: center; gap: 6px; padding: 6px 12px;
  border-radius: 999px; font-size: 13px; font-weight: 500;
  background: rgba(255,255,255,0.15); color: rgba(255,255,255,0.6);
  transition: all 0.3s; cursor: default; white-space: nowrap;
}
.step-indicator.active { background: rgba(255,255,255,0.95); color: var(--primary-dark); }
.step-indicator.completed { background: rgba(255,255,255,0.3); color: white; }
.step-num {
  width: 22px; height: 22px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 11px;
  font-weight: 700; background: rgba(255,255,255,0.2); flex-shrink: 0;
}
.step-indicator.active .step-num { background: var(--primary); color: white; }
.step-indicator.completed .step-num { background: var(--success); color: white; }

/* ========== MAIN ========== */
.main { max-width: 1600px; margin: 0 auto; padding: 20px 24px; }
.step-content { display: none; }
.step-content.active { display: block; }

#home-view { max-width: 100%; }

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border: none; border-radius: var(--radius-sm); font-size: 13px;
  font-weight: 600; cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 2px 4px rgba(79,70,229,0.3); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-success { background: var(--success); color: white; box-shadow: 0 2px 4px rgba(16,185,129,0.3); }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-copy { background: var(--primary); color: white; padding: 6px 14px; font-size: 12px; }
.btn-copy.copied { background: var(--success); }

/* ========== STEP 1 ========== */
.input-section {
  background: var(--surface); border-radius: var(--radius);
  padding: 20px 20px 0; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.input-section h2 { font-size: 17px; margin-bottom: 4px; }
.input-section p { color: var(--text-secondary); font-size: 13px; margin-bottom: 12px; }
.research-input {
  width: 100%; min-height: 300px; padding: 14px; border: 2px solid var(--border);
  border-radius: var(--radius-sm); font-family: 'SF Mono','Fira Code','Consolas',monospace;
  font-size: 13px; line-height: 1.6; resize: vertical; transition: border-color 0.2s;
}
.research-input:focus { outline: none; border-color: var(--primary-light); }
.input-actions {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; margin-top: 0; gap: 8px; flex-wrap: wrap;
  border-top: 1px solid var(--border); background: var(--surface);
  border-radius: 0 0 var(--radius) var(--radius);
  position: sticky; bottom: 0; z-index: 5;
}
.research-preview {
  width: 100%; min-height: 300px; max-height: 70vh; overflow-y: auto;
  padding: 20px; border: 2px solid var(--border); border-radius: var(--radius-sm);
  background: #FFFFFF; line-height: 1.6;
}
.research-preview h1 { font-family: Arial, sans-serif; font-size: 24px; font-weight: bold; margin: 0 0 14px 0; color: var(--text); }
.research-preview h2 { font-family: Arial, sans-serif; font-size: 18px; font-weight: bold; margin: 20px 0 10px 0; color: var(--text); }
.research-preview h3 { font-family: Arial, sans-serif; font-size: 15px; font-weight: bold; margin: 16px 0 6px 0; color: var(--text); }
.research-preview p { font-family: Arial, sans-serif; font-size: 14px; line-height: 1.6; margin: 0 0 10px 0; color: var(--text); }
.research-preview table { font-family: Arial, sans-serif; font-size: 13px; border-collapse: collapse; width: 100%; margin: 10px 0; }
.research-preview th { font-weight: bold; padding: 6px 10px; border: 1px solid #ccc; background: #f0f0f0; text-align: left; }
.research-preview td { padding: 6px 10px; border: 1px solid #ccc; }
.research-preview .empty-hint { color: var(--text-secondary); font-size: 13px; padding: 40px 20px; text-align: center; }
.step1-mode-toggle {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12px;
  font-weight: 600; cursor: pointer; background: var(--bg); color: var(--text-secondary);
  transition: all 0.2s;
}
.step1-mode-toggle:hover { border-color: var(--primary-light); color: var(--text); }
.step1-mode-toggle.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ========== ANNOTATION MODAL ========== */
.annotation-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.annotation-modal {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  max-width: 640px; width: 100%; max-height: 80vh; display: flex; flex-direction: column;
}
.annotation-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.annotation-modal-header h3 { font-size: 15px; font-weight: 600; }
.annotation-modal-close {
  width: 30px; height: 30px; border: none; background: var(--bg); border-radius: 6px;
  font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); transition: all 0.2s;
}
.annotation-modal-close:hover { background: var(--danger); color: white; }
.annotation-modal-body {
  padding: 20px; overflow-y: auto; flex: 1;
  font-size: 13px; line-height: 1.7; white-space: pre-wrap; word-break: break-word;
}

/* ========== STEP 2 ========== */
.review-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel-header {
  padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
}
.panel-body { padding: 16px; }
.colored-text {
  font-family: 'SF Mono','Fira Code','Consolas',monospace; font-size: 12px;
  line-height: 1.7; white-space: pre-wrap; word-break: break-word;
  max-height: 65vh; overflow-y: auto;
}
.colored-text .block-segment { display: inline; padding: 1px 0; border-radius: 2px; transition: opacity 0.2s; }
.colored-text .block-segment:hover { opacity: 0.8; }
.colored-text .sources-text { color: #9CA3AF; font-style: italic; }
.blocks-list { display: flex; flex-direction: column; gap: 10px; max-height: 65vh; overflow-y: auto; }
.block-card { border: 2px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; transition: border-color 0.2s; flex-shrink: 0; }
.block-card:hover { border-color: var(--primary-light); }
.block-card-header { display: flex; align-items: center; gap: 8px; padding: 10px 14px; cursor: pointer; user-select: none; }
.color-badge { width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; }
.block-title { flex: 1; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.block-meta { font-size: 11px; color: var(--text-secondary); flex-shrink: 0; }
.block-expand-icon { font-size: 11px; color: var(--text-secondary); transition: transform 0.2s; flex-shrink: 0; }
.block-card.expanded .block-expand-icon { transform: rotate(90deg); }
.block-card-body { display: none; padding: 0 14px 14px; }
.block-card.expanded .block-card-body { display: block; }
.block-text-edit {
  width: 100%; min-height: 100px; padding: 8px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-family: 'SF Mono','Fira Code','Consolas',monospace;
  font-size: 11px; line-height: 1.5; resize: vertical; margin-bottom: 10px;
}
.block-text-edit:focus { outline: none; border-color: var(--primary-light); }
.refs-section { margin-bottom: 10px; }
.refs-section label, .sources-for-block label {
  display: block; font-size: 11px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px;
}
.refs-tags { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.ref-tag { display: inline-flex; align-items: center; gap: 3px; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 600; cursor: default; }
.ref-tag .remove-ref { cursor: pointer; opacity: 0.6; font-size: 13px; line-height: 1; }
.ref-tag .remove-ref:hover { opacity: 1; }
.add-ref-input { width: 42px; padding: 2px 4px; border: 1px dashed var(--border); border-radius: 4px; font-size: 11px; text-align: center; }
.add-ref-input:focus { outline: none; border-color: var(--primary); }
.sources-for-block { margin-bottom: 10px; }
.source-item { font-size: 11px; padding: 2px 0; color: var(--text-secondary); word-break: break-all; }
.source-item a { color: var(--primary); text-decoration: none; }
.source-item a:hover { text-decoration: underline; }
.block-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.step-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); gap: 8px; flex-wrap: wrap; }
#step-2 .step-actions { position: sticky; bottom: 0; z-index: 10; background: var(--bg); padding: 12px 0; box-shadow: 0 -2px 8px rgba(0,0,0,0.05); }
#tool-output-view .step-actions {
  position: sticky; bottom: 0; z-index: 10; background: var(--bg);
  padding: 12px 0; box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
}
#step-1 .input-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  position: sticky; bottom: 0; z-index: 10; background: var(--surface);
  margin: 0; padding: 12px 0 16px;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
  border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius);
}
#original-view .backup-actions {
  position: sticky; bottom: 0; z-index: 10; background: var(--surface);
  margin: 0 -20px -20px; padding: 12px 20px;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
  border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius);
}
.sources-panel { margin-top: 16px; }
.sources-edit-area {
  width: 100%; min-height: 150px; padding: 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-family: 'SF Mono','Fira Code','Consolas',monospace;
  font-size: 11px; line-height: 1.6; resize: vertical;
}
.sources-edit-area:focus { outline: none; border-color: var(--primary-light); }

/* ========== PROJECT DASHBOARD ========== */
.dashboard-source-bar {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px 16px; margin-bottom: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.source-bar-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.dashboard-source-bar .source-info {
  display: flex; gap: 8px; flex-wrap: wrap; font-size: 13px; font-weight: 600; color: var(--text);
}
.dashboard-source-bar .source-info span {
  display: flex; align-items: center; gap: 4px;
  background: var(--bg); padding: 4px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.dashboard-source-bar .source-actions { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.dashboard-source-bar .source-actions .btn { font-size: 12px; padding: 5px 12px; }
.source-divider {
  width: 1px; height: 20px; background: var(--border); margin: 0 2px; flex-shrink: 0;
}

/* ========== TOOLS GRID ========== */
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tool-card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; cursor: pointer; transition: all 0.22s cubic-bezier(0.4,0,0.2,1);
  border: 2px solid transparent; position: relative; overflow: hidden;
  min-height: 130px;
}
.tool-card:hover { border-color: var(--primary-light); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.tool-card:active { transform: translateY(0); }
.tool-card-icon { font-size: 26px; margin-bottom: 8px; line-height: 1; }
.tool-card-name { font-size: 13px; font-weight: 700; margin-bottom: 5px; line-height: 1.3; }
.tool-card-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.45; }
.tool-card-type {
  position: absolute; top: 10px; right: 10px; font-size: 9px; padding: 2px 7px;
  border-radius: 999px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px;
}
.tool-card-type.prompt { background: #EDE9FE; color: #7C3AED; }
.tool-card-type.utility { background: #DBEAFE; color: #2563EB; }

/* ========== STEP 3: TOOL OUTPUT ========== */
.tool-output-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
  justify-content: space-between;
}
.tool-output-header h2 { font-size: 18px; font-weight: 700; }
.tool-link-btn { white-space: nowrap; flex-shrink: 0; }
.prompts-grid { display: flex; flex-direction: column; gap: 12px; }
.prompt-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.prompt-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border); gap: 8px;
}
.prompt-card-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; min-width: 0; overflow: hidden; }
.prompt-card-title span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prompt-card-actions { display: flex; gap: 6px; flex-shrink: 0; }
.prompt-text-wrapper { position: relative; }
.prompt-text {
  padding: 14px 16px; font-family: 'SF Mono','Fira Code','Consolas',monospace;
  font-size: 11px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
  max-height: 300px; overflow-y: auto; background: #F9FAFB;
}
.prompt-text.expanded { max-height: none; }
.toggle-expand {
  display: block; width: 100%; padding: 6px; border: none;
  background: linear-gradient(to bottom, transparent, var(--bg));
  color: var(--primary); font-size: 12px; font-weight: 600; cursor: pointer; text-align: center;
}
.copy-all-section { display: flex; justify-content: center; margin-top: 16px; gap: 8px; }

/* ========== UTILITY TOOL: SOURCES LIST ========== */
.sources-list-output {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; font-size: 14px; line-height: 1.8;
}
.sources-list-output h3 { font-size: 17px; font-weight: 700; margin-bottom: 12px; }
.sources-list-output ol { padding-left: 24px; }
.sources-list-output li { margin-bottom: 4px; word-break: break-all; }
.sources-list-output a { color: var(--primary); text-decoration: none; }
.sources-list-output a:hover { text-decoration: underline; }

/* ========== RENUMBER TOOL ========== */
.renumber-output { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.renumber-output h3 { font-size: 17px; font-weight: 700; margin-bottom: 12px; }
.renumber-mapping-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13px; }
.renumber-mapping-table th { text-align: left; padding: 8px 12px; background: var(--bg); border: 1px solid var(--border); font-weight: 600; }
.renumber-mapping-table td { padding: 8px 12px; border: 1px solid var(--border); }
.renumber-mapping-table tr:hover td { background: #F0F9FF; }
.renumber-old { color: var(--danger); text-decoration: line-through; font-weight: 600; }
.renumber-new { color: var(--success); font-weight: 700; }
.renumber-preview-text {
  background: #F9FAFB; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px; font-family: 'SF Mono','Fira Code','Consolas',monospace;
  font-size: 12px; line-height: 1.6; max-height: 400px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-word; margin: 12px 0;
}
.renumber-stats { display: flex; gap: 16px; flex-wrap: wrap; margin: 12px 0; font-size: 13px; color: var(--text-secondary); }
.renumber-stats strong { color: var(--text); }
.renumber-actions { display: flex; gap: 8px; margin-top: 16px; justify-content: center; flex-wrap: wrap; }

/* ========== FORMATTED EXPORT ========== */
.formatted-export { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.formatted-preview {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 24px; margin: 12px 0; background: white; max-height: 600px; overflow-y: auto;
}
.formatted-preview h1 { font-family: Arial, sans-serif; font-size: 26px; font-weight: bold; line-height: 1.5; margin: 0 0 16px 0; }
.formatted-preview h2 { font-family: Arial, sans-serif; font-size: 20px; font-weight: bold; line-height: 1.5; margin: 24px 0 12px 0; }
.formatted-preview h3 { font-family: Arial, sans-serif; font-size: 16px; font-weight: bold; line-height: 1.5; margin: 20px 0 8px 0; }
.formatted-preview p { font-family: Arial, sans-serif; font-size: 14px; line-height: 1.5; margin: 0 0 12px 0; }
.formatted-preview table { font-family: Arial, sans-serif; font-size: 14px; border-collapse: collapse; width: 100%; margin: 12px 0; line-height: 1.5; }
.formatted-preview th { font-weight: bold; padding: 8px 12px; border: 1px solid #ccc; background: #f5f5f5; text-align: left; }
.formatted-preview td { padding: 8px 12px; border: 1px solid #ccc; }
.formatted-actions { display: flex; gap: 8px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.paste-format-badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px;
  border-radius: 999px; font-size: 11px; font-weight: 600; margin-left: 8px;
}
.paste-format-badge.html { background: #DBEAFE; color: #1D4ED8; }
.paste-format-badge.plain { background: var(--bg); color: var(--text-secondary); }

/* ========== SETTINGS VIEW ========== */
.settings-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.settings-header h2 { font-size: 20px; font-weight: 700; }
.settings-tools-list { display: flex; flex-direction: column; gap: 12px; }
.settings-tool-card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; border: 2px solid transparent;
}
.settings-tool-card.editing { border-color: var(--primary-light); }
.settings-tool-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.settings-tool-name { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.settings-tool-badge {
  font-size: 10px; padding: 2px 8px; border-radius: 999px; font-weight: 600; text-transform: uppercase;
}
.badge-prompt { background: #EDE9FE; color: #7C3AED; }
.badge-utility { background: #DBEAFE; color: #2563EB; }
.badge-builtin { background: var(--bg); color: var(--text-secondary); }
.settings-tool-actions { display: flex; gap: 6px; }
.settings-tool-editor { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.entity-buttons { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; align-items: center; }
.entity-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px;
  border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer;
  border: 2px dashed; transition: all 0.2s;
}
.entity-btn-text { border-color: #3B82F6; color: #3B82F6; background: #EFF6FF; }
.entity-btn-text:hover { background: #DBEAFE; }
.entity-btn-sources { border-color: #10B981; color: #047857; background: #ECFDF5; }
.entity-btn-sources:hover { background: #D1FAE5; }
.entity-settings { display: flex; gap: 16px; margin: 10px 0; flex-wrap: wrap; align-items: center; }
.entity-setting { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.entity-setting label { cursor: pointer; user-select: none; }
.entity-setting select { padding: 4px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; }
.tpl-editor-wrap { position: relative; }
.tpl-backdrop {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  padding: 10px; margin: 0;
  font-family: 'SF Mono','Fira Code','Consolas',monospace;
  font-size: 12px; line-height: 1.5;
  white-space: pre-wrap; word-wrap: break-word; word-break: break-word;
  color: var(--text); overflow: hidden;
  pointer-events: none; border: 1px solid transparent;
  border-radius: var(--radius-sm); z-index: 0;
}
.tpl-textarea {
  width: 100%; min-height: 200px; padding: 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-family: 'SF Mono','Fira Code','Consolas',monospace;
  font-size: 12px; line-height: 1.5; resize: vertical;
  background: transparent; color: transparent; caret-color: var(--text);
  position: relative; z-index: 1;
}
.tpl-textarea::selection { background: rgba(79,70,229,0.2); }
.tpl-textarea:focus { outline: none; border-color: var(--primary-light); }
.entity-hl { border-radius: 4px; padding: 1px 4px; font-weight: 700; }
.entity-hl-text { background: #DBEAFE; color: #1D4ED8; }
.entity-hl-sources { background: #D1FAE5; color: #047857; }
.entity-hl-count { background: #FEF3C7; color: #B45309; }
.entity-hl-geo { background: #FCE7F3; color: #BE185D; }
.entity-hl-audience { background: #E0E7FF; color: #4338CA; }
.entity-hl-topic { background: #CCFBF1; color: #0F766E; }
.entity-hl-structure { background: #FED7AA; color: #C2410C; }

/* ========== ENTITY CARDS ========== */
.entity-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px; margin: 10px 0;
}
.entity-card {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 10px; background: var(--bg); display: flex; align-items: center; gap: 8px;
}
.entity-card-header {
  display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600;
  white-space: nowrap; flex-shrink: 0;
}
.entity-card-badge {
  padding: 1px 5px; border-radius: 3px; font-size: 9px; font-weight: 700;
  font-family: 'SF Mono','Fira Code','Consolas',monospace; white-space: nowrap;
}
.entity-card-badge-text { background: #DBEAFE; color: #1D4ED8; }
.entity-card-badge-sources { background: #D1FAE5; color: #047857; }
.entity-card-badge-count { background: #FEF3C7; color: #B45309; }
.entity-card-badge-geo { background: #FCE7F3; color: #BE185D; }
.entity-card-badge-audience { background: #E0E7FF; color: #4338CA; }
.entity-card-badge-topic { background: #CCFBF1; color: #0F766E; }
.entity-card-badge-structure { background: #FED7AA; color: #C2410C; }
.entity-card-body { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; justify-content: flex-end; }
.entity-card-body select { width: 90px; padding: 3px 4px; border: 1px solid var(--border); border-radius: 4px; font-size: 10px; flex-shrink: 0; }
.entity-card-insert {
  padding: 3px 8px; border: none; border-radius: 4px; font-size: 10px;
  font-weight: 600; cursor: pointer; background: var(--primary); color: white; transition: all 0.2s;
  white-space: nowrap; flex-shrink: 0;
}
.entity-card-insert:hover { background: var(--primary-dark); }
.entity-card-desc {
  font-size: 9px; color: var(--text-secondary); max-width: 100px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-shrink: 1; min-width: 0;
}

/* ========== PROJECT META MODAL ========== */
.project-meta-modal { padding: 0; max-width: 520px; }
.project-meta-modal-header {
  padding: 20px 24px 0; display: flex; align-items: center; justify-content: space-between;
}
.project-meta-modal-header h3 {
  font-size: 16px; font-weight: 700; margin: 0; color: var(--text-primary);
}
.project-meta-modal-body { padding: 20px 24px 24px; overflow-y: auto; flex: 1; }
.project-meta-form { display: flex; flex-direction: column; gap: 16px; }
.meta-field { display: flex; flex-direction: column; gap: 5px; }
.meta-label {
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.4px;
}
.meta-required { color: var(--danger); text-transform: none; }
.meta-input {
  padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit; transition: all 0.2s; background: var(--bg);
}
.meta-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.08); }
.meta-textarea {
  padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; line-height: 1.6; resize: vertical; font-family: inherit;
  transition: all 0.2s; background: var(--bg); min-height: 100px;
}
.meta-textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.08); }
.meta-divider { height: 1px; background: var(--border); margin: 2px 0; }
.structure-preview {
  margin-top: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); overflow: hidden;
}
.structure-preview-header {
  padding: 8px 12px; font-size: 11px; font-weight: 600; color: var(--text-secondary);
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.structure-preview-header .count-badge {
  background: var(--primary); color: white; font-size: 10px; font-weight: 700;
  padding: 1px 7px; border-radius: 999px;
}
.structure-preview-sections { max-height: 200px; overflow-y: auto; }
.structure-preview-section {
  padding: 8px 12px; font-size: 12px; line-height: 1.5;
  border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: flex-start;
}
.structure-preview-section:last-child { border-bottom: none; }
.structure-preview-idx {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: white; margin-top: 1px;
}
.structure-preview-text {
  flex: 1; white-space: pre-wrap; word-break: break-word; color: var(--text-primary);
  max-height: 60px; overflow: hidden;
}
.structure-preview-text.truncated::after {
  content: '...'; color: var(--text-secondary);
}
.structure-preview-offset {
  padding: 6px 12px; font-size: 11px; color: var(--primary);
  background: rgba(79,70,229,0.06); border-bottom: 1px solid var(--border);
  font-weight: 500;
}
.structure-preview-block-map {
  font-size: 10px; color: var(--text-secondary); margin-top: 2px; font-weight: 500;
}
.meta-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  padding-top: 16px; border-top: 1px solid var(--border); margin-top: 4px;
}

/* ========== DASHBOARD META TAGS ========== */
.dash-meta-row {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  padding-top: 4px; border-top: 1px solid var(--border);
}
.dash-meta-tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px;
  border-radius: 999px; font-size: 11px; font-weight: 500;
  background: #EEF2FF; border: 1px solid #C7D2FE;
  max-width: 240px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; color: #4338CA;
}

/* ========== DASHBOARD TOOLBAR ========== */
.dashboard-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.dashboard-search {
  padding: 7px 14px; border: 1.5px solid var(--border); border-radius: 999px;
  font-size: 13px; width: 220px; transition: all 0.2s; background: var(--surface);
}
.dashboard-search:focus { outline: none; border-color: var(--primary-light); width: 260px; box-shadow: 0 0 0 3px rgba(79,70,229,0.08); }
.dashboard-search::placeholder { color: #9CA3AF; }
.dashboard-title { font-size: 16px; font-weight: 700; margin-bottom: 0; display: flex; align-items: center; gap: 8px; }
.dashboard-title::before { content: ''; width: 4px; height: 18px; background: var(--primary); border-radius: 2px; }
.tool-card-fav {
  position: absolute; top: 8px; left: 8px; background: none; border: none;
  cursor: pointer; font-size: 14px; opacity: 0.25; transition: all 0.2s; z-index: 2;
  padding: 2px; line-height: 1;
}
.tool-card-fav:hover { opacity: 0.7; transform: scale(1.2); }
.tool-card-fav.active { opacity: 1; }
.tool-card.dragging { opacity: 0.4; transform: scale(0.95); }
.tool-card.drag-over { border-color: var(--primary); border-style: dashed; }
.tool-card.favorite { border-color: #FDE68A; background: linear-gradient(135deg, #FFFBEB 0%, var(--surface) 40%); }
.tool-card.favorite:hover { border-color: #FCD34D; }
.dashboard-no-results {
  grid-column: 1 / -1; text-align: center; padding: 40px 20px;
  color: var(--text-secondary); font-size: 14px;
}

/* ========== EMOJI PICKER ========== */
.emoji-picker-popup {
  position: fixed; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 10px;
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px;
  max-width: 310px; max-height: 220px; overflow-y: auto; z-index: 1000;
}
.emoji-option {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 6px; cursor: pointer;
  font-size: 18px; transition: background 0.15s;
}
.emoji-option:hover { background: var(--bg); }
.settings-tool-icon-btn {
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 10px; cursor: pointer; font-size: 20px; transition: all 0.2s;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 36px;
}
.settings-tool-icon-btn:hover { border-color: var(--primary-light); background: #EDE9FE; }

/* ========== VALIDATOR PROCESSOR ========== */
.vp-container { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.vp-section { margin: 16px 0; }
.vp-section h4 { font-size: 14px; font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.vp-section h4 .vp-badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.vp-textarea {
  width: 100%; min-height: 120px; padding: 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-family: 'SF Mono','Fira Code','Consolas',monospace;
  font-size: 12px; line-height: 1.5; resize: vertical;
}
.vp-textarea:focus { outline: none; border-color: var(--primary-light); }
.vp-annotation {
  background: #F9FAFB; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px; font-size: 12px; line-height: 1.6; max-height: 400px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-word;
}
.vp-log { margin-top: 16px; }
.vp-log-entry {
  padding: 10px 14px; border-left: 3px solid var(--success); background: var(--success-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-bottom: 8px; font-size: 12px;
}
.vp-log-entry strong { font-size: 13px; }
.vp-block-selector { margin-bottom: 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.vp-block-selector select {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; min-width: 200px;
}
.vp-actions { display: flex; gap: 8px; margin-top: 16px; justify-content: center; flex-wrap: wrap; }
.vp-parsed { display: none; }
.vp-parsed.visible { display: block; }
.vp-renumber { margin-top: 12px; padding: 14px; background: #F0F9FF; border: 1px solid #BAE6FD; border-radius: 8px; }
.vp-renumber h4 { font-size: 13px; font-weight: 600; margin-bottom: 10px; color: #0369A1; }
.vp-renumber-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vp-renumber-row input { width: 80px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; text-align: center; font-weight: 600; }
.vp-renumber-row input:focus { outline: none; border-color: var(--primary-light); }
.vp-renumber-row .btn { font-size: 12px; padding: 5px 12px; }
.vp-renumber-preview { margin-top: 10px; font-size: 12px; color: var(--text-secondary); padding: 8px; background: #F8FAFC; border-radius: 6px; border: 1px solid #E2E8F0; max-height: 120px; overflow-y: auto; white-space: pre-wrap; font-family: var(--font-mono); }

/* ========== ORIGINAL TEXT VIEW ========== */
.original-view-content {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px;
}
.original-view-content h2 { font-size: 17px; margin-bottom: 4px; }
.original-view-content p { color: var(--text-secondary); font-size: 13px; margin-bottom: 12px; }
.original-text-display {
  width: 100%; min-height: 300px; padding: 14px; border: 2px solid var(--border);
  border-radius: var(--radius-sm); font-family: 'SF Mono','Fira Code','Consolas',monospace;
  font-size: 13px; line-height: 1.6; background: #FAFAFA; color: var(--text);
  white-space: pre-wrap; word-break: break-word; max-height: 60vh; overflow-y: auto;
}
.backup-actions {
  display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; align-items: center;
  padding-top: 12px; border-top: 1px solid var(--border);
}
.backup-label { font-size: 12px; color: var(--text-secondary); margin-right: auto; }
.backup-inline-actions {
  display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap;
}
.backup-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.backup-tab {
  padding: 6px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600; cursor: pointer; background: var(--bg); color: var(--text-secondary);
  transition: all 0.2s;
}
.backup-tab.active { background: var(--primary); color: white; border-color: var(--primary); }
.backup-tab:hover:not(.active) { background: var(--surface); }

/* ========== HOME VIEW ========== */
.home-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px; gap: 12px; flex-wrap: wrap;
}
.home-header h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.3px; }
.home-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.project-card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 22px; cursor: pointer; transition: all 0.22s cubic-bezier(0.4,0,0.2,1);
  border: 2px solid transparent; position: relative; overflow: hidden;
}
.project-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  opacity: 0; transition: opacity 0.2s;
}
.project-card:hover { border-color: var(--primary-light); transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.project-card:hover::before { opacity: 1; }
.project-card:hover .project-delete-btn { opacity: 1; pointer-events: auto; }
.project-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.project-card-name { font-size: 15px; font-weight: 700; line-height: 1.35; flex: 1; }
.project-card-meta { font-size: 12px; color: var(--text-secondary); margin-bottom: 10px; }
.project-card-stats { font-size: 12px; color: var(--text-secondary); display: flex; gap: 12px; flex-wrap: wrap; }
.project-card-actions { display: flex; justify-content: flex-end; margin-top: 12px; gap: 6px; }
.project-delete-btn {
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
  width: 28px; height: 28px; padding: 0; display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}

/* Status badges */
.project-status-badge {
  font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
  white-space: nowrap; flex-shrink: 0; align-self: flex-start; margin-top: 2px;
}
.project-status-ready { background: #D1FAE5; color: #065F46; }
.project-status-loaded { background: #DBEAFE; color: #1E40AF; }
.project-status-new { background: var(--bg); color: var(--text-secondary); }

.home-empty { text-align: center; padding: 80px 16px; color: var(--text-secondary); font-size: 15px; }
.home-empty-icon { font-size: 56px; margin-bottom: 16px; opacity: 0.35; }

.dashboard-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.dashboard-title::before { content: ''; width: 4px; height: 20px; background: var(--primary); border-radius: 2px; }

/* ========== SNAPSHOTS ========== */
.snapshot-create-modal { padding: 0; max-width: 400px; }
.snapshot-create-header {
  padding: 18px 22px 0; display: flex; align-items: center;
}
.snapshot-create-header h3 { font-size: 16px; font-weight: 700; margin: 0; }
.snapshot-create-body {
  padding: 12px 22px 22px;
}
.snapshot-create-body p {
  font-size: 12px; color: var(--text-secondary); margin: 0 0 12px;
}
.snapshot-create-actions {
  display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px;
}
.snapshot-section {
  margin-top: 20px; border-top: 1px solid var(--border); padding-top: 16px;
}
.snapshot-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; font-size: 14px; font-weight: 600;
}
.snapshot-count {
  font-size: 11px; font-weight: 500; color: var(--text-secondary);
  background: var(--bg); padding: 2px 8px; border-radius: 999px;
}
.snapshot-cards { display: flex; flex-direction: column; gap: 8px; }
.snapshot-card {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg); transition: all 0.2s;
  flex-wrap: wrap;
}
.snapshot-card:hover { border-color: var(--primary-light); background: #F8F7FF; }
.snapshot-card-active { border-color: var(--primary) !important; background: #EDE9FE !important; }
.snapshot-card-info { flex: 1; min-width: 0; }
.snapshot-card-name {
  font-size: 13px; font-weight: 600; margin-bottom: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.snapshot-card-meta {
  display: flex; gap: 10px; font-size: 11px; color: var(--text-secondary); flex-wrap: wrap;
}
.snapshot-card-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ========== AUTO EDITOR ========== */
.ae-container {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.ae-empty-state {
  text-align: center; padding: 30px 20px;
}
.ae-empty-icon {
  font-size: 48px; margin-bottom: 10px; line-height: 1;
}
.ae-empty-state h3 { font-size: 16px; margin-bottom: 8px; }
.ae-empty-state p { color: var(--text-secondary); font-size: 13px; margin-bottom: 16px; }

/* Block selection */
.ae-select-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 12px; flex-wrap: wrap;
}
.ae-select-count { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.ae-select-actions { display: flex; gap: 6px; }
.ae-blocks-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 55vh; overflow-y: auto;
}
.ae-block-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.2s; background: var(--bg);
}
.ae-block-item:hover { border-color: var(--primary-light); }
.ae-block-item.selected { border-color: var(--primary); background: #EDE9FE; }
.ae-block-item input[type="checkbox"] { flex-shrink: 0; width: 16px; height: 16px; cursor: pointer; }
.ae-block-info { flex: 1; min-width: 0; }
.ae-block-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.ae-block-preview {
  font-size: 11px; color: var(--text-secondary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ae-center-actions { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }
.ae-btn-lg { padding: 12px 28px; font-size: 15px; }

/* Progress */
.ae-progress-bar-wrap {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
}
.ae-progress-bar {
  flex: 1; height: 8px; background: var(--bg);
  border-radius: 4px; overflow: hidden;
}
.ae-progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 4px; transition: width 0.4s ease;
}
.ae-progress-text { font-size: 13px; font-weight: 700; color: var(--primary); flex-shrink: 0; min-width: 36px; }
.ae-progress-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.ae-progress-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border-radius: var(--radius-sm); font-size: 13px; transition: all 0.3s;
}
.ae-progress-item.pending { background: var(--bg); color: var(--text-secondary); }
.ae-progress-item.generating { background: #DBEAFE; color: #1D4ED8; }
.ae-progress-item.done { background: var(--success-light); color: #047857; }
.ae-progress-item.error { background: #FEE2E2; color: #B91C1C; }
.ae-prog-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ae-prog-status { font-weight: 600; flex-shrink: 0; }
@keyframes ae-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.ae-progress-item.generating { animation: ae-pulse 1.5s ease-in-out infinite; }
.ae-spin { display: inline-block; animation: ae-pulse 1s ease-in-out infinite; }

/* Review */
.ae-review-header {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-radius: var(--radius-sm); background: var(--bg); margin-bottom: 16px;
  border-left: 4px solid var(--border);
}
.ae-review-actions {
  display: flex; gap: 8px; justify-content: center;
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border);
}
.ae-conv-info {
  margin-top: 6px; padding: 6px 10px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 11px;
}

/* Reasoning */
.ae-reasoning {
  margin-bottom: 16px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden;
}
.ae-reasoning summary {
  padding: 10px 14px; font-size: 13px; font-weight: 600;
  cursor: pointer; background: var(--bg); user-select: none;
}
.ae-reasoning summary:hover { background: #E5E7EB; }
.ae-reasoning-content {
  padding: 12px 14px; font-size: 12px; line-height: 1.6;
  max-height: 300px; overflow-y: auto; white-space: pre-wrap; word-break: break-word;
  color: var(--text-secondary); background: #FAFAFA;
  font-family: 'SF Mono','Fira Code','Consolas',monospace;
}

/* Completion stats */
.ae-stats { display: flex; gap: 28px; justify-content: center; margin: 16px 0; }
.ae-stat { text-align: center; }
.ae-stat strong { display: block; font-size: 28px; color: var(--success); line-height: 1.2; }
.ae-stat span { font-size: 12px; color: var(--text-secondary); }
.ae-stat-err strong { color: var(--danger); }

/* Settings card */
.ae-settings-card { border-color: var(--primary-light) !important; }

/* ========== EDIT HISTORY MODAL ========== */
.eh-modal {
  width: 90%; max-width: 700px; max-height: 85vh;
  display: flex; flex-direction: column;
}
.eh-modal-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  position: relative;
}
.eh-modal-header h3 { font-size: 16px; margin-bottom: 4px; }
.eh-modal-subtitle { font-size: 12px; color: var(--text-secondary); }
.eh-modal-close {
  position: absolute; top: 12px; right: 16px; background: none;
  border: none; font-size: 22px; cursor: pointer; color: var(--text-secondary);
  line-height: 1; padding: 4px;
}
.eh-modal-close:hover { color: var(--text); }
.eh-modal-body {
  padding: 16px 20px; overflow-y: auto; flex: 1;
  display: flex; flex-direction: column; gap: 12px;
}
.eh-entry {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; background: var(--bg); transition: border-color 0.2s;
}
.eh-entry:hover { border-color: var(--primary-light); }
.eh-entry-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px; gap: 8px;
}
.eh-entry-source {
  font-size: 12px; font-weight: 600; padding: 2px 8px;
  border-radius: 999px; background: #DBEAFE; color: #1D4ED8;
}
.eh-entry-date { font-size: 11px; color: var(--text-secondary); }
.eh-details {
  margin: 6px 0; border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden;
}
.eh-details summary {
  padding: 6px 10px; font-size: 12px; font-weight: 600;
  cursor: pointer; background: var(--surface); user-select: none;
}
.eh-details summary:hover { background: #F3F4F6; }
.eh-diff-wrap {
  padding: 8px 10px; display: flex; flex-direction: column; gap: 8px;
}
.eh-text {
  font-size: 11px; line-height: 1.5; padding: 8px 10px;
  border-radius: 4px; word-break: break-word; white-space: pre-wrap;
  font-family: 'SF Mono','Fira Code','Consolas',monospace;
}
.eh-text-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 4px;
}
.eh-text-before { background: #FEE2E2; color: #7F1D1D; }
.eh-text-before .eh-text-label { color: #B91C1C; }
.eh-text-after { background: #D1FAE5; color: #064E3B; }
.eh-text-after .eh-text-label { color: #047857; }
.eh-sources {
  font-size: 12px; color: var(--text-secondary); margin: 6px 0;
  padding: 6px 10px; background: #DBEAFE; border-radius: 4px;
}
.eh-sources-list {
  font-size: 11px; margin-top: 4px; color: #1D4ED8; word-break: break-all;
}
.eh-annotation {
  padding: 8px 10px; font-size: 11px; line-height: 1.5;
  color: var(--text-secondary); white-space: pre-wrap; word-break: break-word;
}
.eh-actions {
  margin-top: 8px; display: flex; gap: 6px; justify-content: flex-end;
}

/* ========== SMART EDITOR ========== */
.se-header-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 8px; margin-bottom: 12px;
}
.se-main-title { font-size: 18px; font-weight: 700; margin-bottom: 3px; }
.se-subtitle { color: var(--text-secondary); font-size: 12px; margin: 0; }

.se-toolbar {
  display: flex; align-items: center; gap: 3px; padding: 6px 10px;
  background: #FAFAFA; border: 1px solid var(--border);
  border-bottom: 1px solid #E2E8F0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  flex-wrap: wrap; min-height: 44px;
}
.se-style-select {
  padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px;
  font-size: 12px; background: var(--surface); cursor: pointer; min-width: 100px;
  color: var(--text);
}
.se-tool-btn {
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 4px; background: none;
  font-size: 13px; cursor: pointer; color: var(--text); transition: all 0.15s;
}
.se-tool-btn:hover { background: var(--surface); border-color: var(--border); }
.se-tool-btn:active { background: var(--border); }
.se-toolbar-divider {
  width: 1px; height: 18px; background: var(--border); margin: 0 3px; flex-shrink: 0;
}
.se-toolbar-spacer { flex: 1; }
.se-ai-hint {
  font-size: 11px; color: var(--primary); padding: 3px 8px;
  background: #EEF2FF; border-radius: 4px; white-space: nowrap; cursor: default;
  font-weight: 600;
}
.se-word-count {
  font-size: 11px; color: var(--text-secondary); white-space: nowrap; cursor: default;
  padding: 0 4px;
}

/* Zoom controls */
.se-zoom-btn { width: 26px; height: 26px; font-size: 16px; font-weight: 700; }
.se-zoom-slider {
  width: 80px; height: 4px; cursor: pointer; accent-color: var(--primary);
  flex-shrink: 0;
}
.se-zoom-label {
  font-size: 11px; font-weight: 600; color: var(--text-secondary); cursor: pointer;
  min-width: 36px; text-align: center; padding: 2px 4px; border-radius: 3px;
  transition: background 0.15s;
}
.se-zoom-label:hover { background: var(--bg); color: var(--text); }

/* Page-like editor wrapper */
.se-page-wrap {
  background: #E8EAED;
  border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  overflow-y: auto; max-height: calc(100vh - 220px); min-height: 300px;
  padding: 32px 20px;
}
.se-page {
  background: #FFFFFF;
  max-width: 820px;
  margin: 0 auto;
  padding: 56px 72px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08), 0 8px 24px rgba(0,0,0,0.10);
  border-radius: 2px;
  min-height: 700px;
}

.se-editor {
  --se-title-size: 26px;
  --se-h1-size: 20px;
  --se-h2-size: 16px;
  --se-text-size: 14px;
  min-height: 500px;
  font-family: Arial, sans-serif; font-size: var(--se-text-size);
  line-height: 1.7; color: var(--text);
  outline: none; cursor: text;
}
.se-editor:focus { outline: none; }
.se-editor h1 {
  font-size: var(--se-title-size); font-weight: bold; line-height: 1.3;
  margin: 0 0 14px 0; color: var(--text);
}
.se-editor h2 {
  font-size: var(--se-h1-size); font-weight: bold; line-height: 1.4;
  margin: 24px 0 10px 0; color: var(--text);
}
.se-editor h3 {
  font-size: var(--se-h2-size); font-weight: bold; line-height: 1.4;
  margin: 18px 0 8px 0; color: var(--text);
}
.se-editor p {
  margin: 0 0 12px 0; line-height: 1.7;
}
.se-editor table {
  border-collapse: collapse; width: 100%; margin: 16px 0;
  font-size: var(--se-text-size);
}
.se-editor th, .se-editor td {
  border: 1px solid #D1D5DB; padding: 8px 12px; text-align: left;
}
.se-editor th { background: #F3F4F6; font-weight: 600; }
.se-editor td { background: #FFFFFF; }
.se-editor strong, .se-editor b { font-weight: bold; }
.se-editor em, .se-editor i { font-style: italic; }

/* AI Loading animation */
.se-ai-loading {
  background: linear-gradient(90deg, #E0E7FF, #C7D2FE, #E0E7FF);
  background-size: 200% 100%;
  animation: se-shimmer 1.5s infinite;
  border-radius: 3px; padding: 0 2px;
}
@keyframes se-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ========== SETTINGS TABS ========== */
.settings-tabs {
  display: flex; gap: 2px; margin-bottom: 16px;
  background: var(--bg); border-radius: var(--radius-sm);
  padding: 3px; border: 1px solid var(--border);
  overflow-x: auto; flex-wrap: nowrap;
}
.settings-tab {
  flex: 1; padding: 8px 16px; border: none; background: none;
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  cursor: pointer; border-radius: 6px; transition: all 0.2s;
  white-space: nowrap;
}
.settings-tab:hover { color: var(--text); background: rgba(255,255,255,0.5); }
.settings-tab.active {
  background: var(--surface); color: var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08); font-weight: 600;
}

/* Smart editor settings panel */
.se-settings-panel {
  background: var(--surface); border-radius: var(--radius);
  padding: 20px 24px; border: 1px solid var(--border);
}

/* Auto-editor inline settings */
.ae-inline-settings {
  border-top: 1px solid var(--border); margin-top: 12px; padding-top: 12px;
}

/* kbd tag for keyboard shortcuts */
kbd {
  display: inline-block; padding: 1px 5px; font-size: 11px;
  font-family: -apple-system, BlinkMacSystemFont, monospace;
  color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 3px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.08);
}

/* ========== TOAST ========== */
.toast {
  position: fixed; bottom: 20px; right: 20px; padding: 10px 18px;
  background: #1F2937; color: white; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg);
  transform: translateY(100px); opacity: 0; transition: all 0.3s; z-index: 1000;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ========== SCROLLBARS ========== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9CA3AF; }

/* ========== FEEDBACK EDITOR ========== */
.fe-type-badge {
  width: 28px; height: 28px; border-radius: 6px; display: flex;
  align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0;
}
.fe-type-edit { background: #DBEAFE; }
.fe-type-remove { background: #FEE2E2; }
.fe-type-add { background: #D1FAE5; }
.fe-type-simplify { background: #FEF3C7; }
.fe-structural-notes {
  margin-top: 16px; padding: 14px; background: #FFFBEB;
  border: 1px solid #FCD34D; border-radius: var(--radius-sm);
}
.fe-note-item {
  font-size: 13px; color: #92400E; padding: 4px 0; line-height: 1.5;
}
.fe-corrections-summary {
  margin-bottom: 12px; padding: 10px 14px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.fe-corr-item {
  font-size: 12px; color: var(--text-secondary); padding: 3px 0;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1200px) {
  .review-layout { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .review-layout { grid-template-columns: 1fr; }
  .colored-text, .blocks-list { max-height: 50vh; }
  .main { padding: 16px; }
  .header { padding: 12px 16px; }
}
@media (max-width: 600px) {
  .brand-title { font-size: 16px; }
  .step-indicator { font-size: 11px; padding: 4px 8px; }
  .step-indicator .step-text { display: none; }
  .projects-grid { grid-template-columns: 1fr; }
  .tools-grid { grid-template-columns: 1fr; }
}

/* ========== COMMENTS SIDEBAR ========== */
#comments-sidebar {
  position: fixed;
  top: 0;
  right: -340px;
  width: 320px;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 20px rgba(0,0,0,0.08);
  z-index: 200;
  overflow-y: auto;
  transition: right 0.25s cubic-bezier(0.4,0,0.2,1);
  padding: 0;
  display: flex;
  flex-direction: column;
}
#comments-sidebar.cs-visible {
  right: 0;
}
.cs-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.cs-title { font-size: 15px; font-weight: 700; color: var(--text); }
.cs-add-btn {
  font-size: 13px; padding: 5px 12px;
  background: var(--primary); color: white; border: none;
  border-radius: 6px; cursor: pointer; font-weight: 600;
}
.cs-add-btn:hover { background: var(--primary-dark); }
.cs-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
}
.cs-empty kbd {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  font-family: monospace;
}
.cs-card {
  margin: 8px 12px;
  padding: 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.cs-card:hover { border-color: var(--primary-light); box-shadow: 0 2px 8px rgba(79,70,229,0.08); }
.cs-card-active { border-color: var(--primary) !important; box-shadow: 0 2px 12px rgba(79,70,229,0.15); }
.cs-card-resolved { opacity: 0.55; }
.cs-card-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}
.cs-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  color: white;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.cs-avatar-sm { width: 22px; height: 22px; font-size: 9px; }
.cs-author-info { flex: 1; min-width: 0; }
.cs-author-name {
  font-size: 12px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cs-author-time { font-size: 11px; color: var(--text-secondary); margin-top: 1px; }
.cs-card-actions { display: flex; gap: 4px; flex-shrink: 0; }
.cs-btn {
  background: none; border: none; cursor: pointer;
  width: 24px; height: 24px; border-radius: 4px;
  font-size: 13px; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.cs-btn:hover { background: var(--bg); }
.cs-btn-resolve { color: var(--success); }
.cs-btn-resolve.resolved { color: var(--text-secondary); }
.cs-btn-delete { color: var(--danger); }
.cs-quote {
  background: #FFFBEB;
  border-left: 3px solid #F59E0B;
  padding: 6px 10px;
  font-size: 12px;
  color: #78350F;
  border-radius: 0 6px 6px 0;
  margin-bottom: 8px;
  font-style: italic;
  line-height: 1.4;
  cursor: pointer;
}
.cs-quote:hover { background: #FEF3C7; }
.cs-body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.cs-replies { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.cs-reply { display: flex; gap: 8px; align-items: flex-start; }
.cs-reply-body { font-size: 12px; line-height: 1.4; flex: 1; }
.cs-reply-author { font-weight: 600; }
.cs-reply-time { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.cs-reply-form { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 10px; }
.cs-reply-input {
  width: 100%; padding: 8px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 13px; resize: none;
  font-family: inherit; background: var(--bg);
}
.cs-reply-input:focus { outline: none; border-color: var(--primary); background: white; }
.cs-reply-actions { display: flex; gap: 6px; margin-top: 8px; justify-content: flex-end; }
.cs-btn-primary {
  background: var(--primary); color: white; border: none;
  padding: 6px 14px; border-radius: 6px; font-size: 12px; cursor: pointer; font-weight: 600;
}
.cs-btn-primary:hover { background: var(--primary-dark); }
.cs-btn-cancel {
  background: none; color: var(--text-secondary); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 6px; font-size: 12px; cursor: pointer;
}
.cs-btn-cancel:hover { background: var(--bg); }
.cs-section-divider {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 16px; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); background: var(--bg);
  margin: 8px 0 0;
  user-select: none;
}

/* Comments toggle button */
#comments-toggle-btn {
  position: relative;
}
#comments-count-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: #EF4444; color: white;
  font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  display: none; align-items: center; justify-content: center;
  padding: 0 3px;
}
#comments-count-badge:not(:empty) {
  display: flex;
}

/* Comment create modal */
#comment-create-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 600;
  display: none;
  align-items: center;
  justify-content: center;
}
.cc-modal-box {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  width: 400px;
  max-width: calc(100vw - 32px);
  padding: 20px;
}
.cc-modal-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
#cc-quote-preview {
  background: #FFFBEB;
  border-left: 3px solid #F59E0B;
  padding: 8px 12px;
  font-size: 12px;
  color: #78350F;
  border-radius: 0 8px 8px 0;
  margin-bottom: 12px;
  font-style: italic;
  line-height: 1.5;
}
#cc-text {
  width: 100%; min-height: 80px; padding: 10px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; resize: vertical;
}
#cc-text:focus { outline: none; border-color: var(--primary); }
.cc-modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }

/* Comment selection button (floating) */
#comment-selection-btn {
  position: fixed;
  display: none;
  width: 32px; height: 32px;
  background: var(--primary);
  color: white; border: none; border-radius: 50%;
  font-size: 16px; cursor: pointer;
  align-items: center; justify-content: center;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  transition: transform 0.15s;
}
#comment-selection-btn:hover { transform: scale(1.1); background: var(--primary-dark); }

/* ========== CONTEXT MENU ========== */
#editor-context-menu {
  position: fixed;
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 500;
  min-width: 180px;
  overflow: hidden;
  padding: 4px 0;
}
.ctx-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.1s;
  user-select: none;
}
.ctx-menu-item:hover { background: var(--bg); }
.ctx-menu-item-icon { font-size: 15px; width: 20px; text-align: center; }
.ctx-menu-item-shortcut { margin-left: auto; font-size: 11px; color: var(--text-secondary); }
.ctx-menu-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ========== ONLINE USERS PANEL ========== */
#online-users-panel {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--bg); border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.online-panel-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}
#online-users-list { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.online-user-item {
  display: flex; align-items: center; gap: 6px;
}
.online-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  color: white; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.online-user-info { flex: 1; min-width: 0; }
.online-user-email { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.online-me-badge { color: var(--text-secondary); font-weight: 400; }
.online-status-dot {
  width: 8px; height: 8px;
  background: #10B981;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(16,185,129,0.2);
}

/* ========== SHARE PROJECT MODAL ========== */
#share-project-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 600;
  display: none;
  align-items: center; justify-content: center;
}
.share-modal-box {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  width: 440px; max-width: calc(100vw - 32px);
  padding: 24px;
}
.share-modal-title { font-size: 17px; font-weight: 700; margin-bottom: 16px; }
.share-input-row {
  display: flex; gap: 8px; margin-bottom: 14px;
}
.share-email-input {
  flex: 1; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 13px;
}
.share-email-input:focus { outline: none; border-color: var(--primary); }
.share-members-list { margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.share-member-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: var(--bg); border-radius: 8px;
}
.share-member-email { flex: 1; font-size: 13px; }
.share-member-role { font-size: 11px; color: var(--text-secondary); }
.share-modal-actions { display: flex; justify-content: flex-end; }

/* ========== ADMIN USERS TAB ========== */
.admin-user-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
}
.admin-user-email { flex: 1; font-size: 13px; font-weight: 500; }
.admin-user-role {
  font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 12px; background: var(--bg); color: var(--text-secondary);
}
.admin-user-role.admin { background: #EDE9FE; color: var(--primary); }
.admin-user-status { font-size: 11px; color: var(--text-secondary); }
.admin-create-form {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 20px;
}
.admin-form-title { font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.admin-form-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.admin-form-row input, .admin-form-row select {
  flex: 1; min-width: 120px; padding: 8px 10px;
  border: 1.5px solid var(--border); border-radius: 8px; font-size: 13px;
}
.admin-form-row input:focus, .admin-form-row select:focus { outline: none; border-color: var(--primary); }

/* ngrok banner removed — URL shown in Settings → API */

/* ========== GOOGLE DOCS-STYLE COMMENTS LAYOUT ========== */
/* When comments sidebar is open, push the main content left */
body.comments-open .main {
  padding-right: 340px;
  transition: padding-right 0.25s cubic-bezier(0.4,0,0.2,1);
}
.main {
  transition: padding-right 0.25s cubic-bezier(0.4,0,0.2,1);
}

/* Comments toggle button active state */
#comments-toggle-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
#comments-toggle-btn.active:hover { background: var(--primary-dark); }

/* Step 1 layout */
.step1-with-comments {
  display: flex;
  gap: 0;
  position: relative;
}
