/* ═══════════════════════════════════════════════════════════════════════
   hilink web app — styles
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e2e5ea;
  --border-focus: #94a3b8;
  --text: #1a1a2e;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #dbeafe;
  --danger: #ef4444;
  --success: #10b981;

  --nest-color: #10b981;
  --touch-color: #f59e0b;
  --echo-color: #8b5cf6;

  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --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);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
}

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

html {
  font-size: 15px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Header ───────────────────────────────────────────────────────── */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  font-size: 22px;
  color: var(--accent);
}

.app-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.mode-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
}

.mode-btn {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 2px 6px 4px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
  position: relative;
}

.mode-btn:hover {
  color: var(--text-secondary);
}

.mode-btn.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.vennr-n-select {
  font-size: 13px;
  padding: 1px 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  margin-left: 4px;
  display: none;
}

.mode-btn.active .vennr-n-select {
  display: inline;
}

.tagline {
  font-family: 'Special Elite', 'Courier New', monospace;
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 4px;
  white-space: nowrap;
}

.tagline a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
}

.tagline a:hover {
  color: var(--accent-hover);
  border-bottom-style: solid;
}

@media (max-width: 768px) {
  .tagline { display: none; }
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-stop-btn {
  padding: 6px 14px;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.header-stop-btn:hover {
  background: #dc2626;
}

.auth-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.auth-status:hover {
  border-color: var(--border-focus);
}

.auth-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  transition: background 0.2s ease;
}

.auth-status.connected .auth-dot {
  background: var(--success);
}

.auth-status.connected .auth-label {
  color: var(--success);
}

/* ── Main Content ─────────────────────────────────────────────────── */

.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 24px 60px;
}

/* ── Document Panels ──────────────────────────────────────────────── */

.doc-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 768px) {
  .doc-panels {
    grid-template-columns: 1fr;
  }
}

.doc-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}

.panel-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.doc-input {
  width: 100%;
  min-height: 320px;
  padding: 16px;
  border: none;
  outline: none;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text);
  background: var(--surface);
}

.doc-input::placeholder {
  color: var(--text-muted);
}

.doc-rendered {
  padding: 16px 20px;
  font-size: 14.5px;
  line-height: 1.7;
}

.doc-panel .doc-rendered {
  min-height: 320px;
  max-height: 600px;
  overflow-y: auto;
}

.doc-rendered h1, .doc-rendered h2, .doc-rendered h3,
.doc-rendered h4, .doc-rendered h5, .doc-rendered h6 {
  margin-top: 1.2em;
  margin-bottom: 0.5em;
  line-height: 1.3;
}

.doc-rendered h1 { font-size: 1.6em; }
.doc-rendered h2 { font-size: 1.35em; }
.doc-rendered h3 { font-size: 1.15em; }

.doc-rendered p {
  margin-bottom: 0.8em;
}

.doc-rendered ul, .doc-rendered ol {
  margin-bottom: 0.8em;
  padding-left: 1.5em;
}

.doc-rendered blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1em;
  color: var(--text-secondary);
  margin-bottom: 0.8em;
}

.doc-rendered code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: #f1f5f9;
  padding: 2px 5px;
  border-radius: 3px;
}

.doc-rendered pre {
  background: #f1f5f9;
  padding: 12px 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 0.8em;
}

.doc-rendered pre code {
  background: none;
  padding: 0;
}

/* ── Controls Bar ─────────────────────────────────────────────────── */

.controls-bar {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.control-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.model-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.model-select-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  min-width: 220px;
  transition: border-color 0.15s ease;
}

.model-select-btn:hover {
  border-color: var(--border-focus);
}

.model-select-btn .chevron {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 11px;
}

#model-display {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-settings-btn {
  padding: 4px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  color: var(--text-muted);
  transition: border-color 0.15s, color 0.15s;
}
.api-settings-btn:hover {
  border-color: var(--border-focus);
  color: var(--text);
}

.max-hilinks-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  min-width: 80px;
}

.max-hilinks-select:focus {
  outline: none;
  border-color: var(--accent);
}

.control-actions {
  margin-left: auto;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.intersection-only-label {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}
.intersection-only-label input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}
.intersection-only-label span {
  font-family: "Special Elite", monospace;
  letter-spacing: 0.5px;
}

#complete-vennr-btn {
  background: var(--accent);
  color: white;
  border: none;
  font-weight: 600;
  white-space: nowrap;
}

.generate-btn {
  padding: 9px 22px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}

.generate-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.generate-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.generate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.generate-btn.stop-mode {
  background: var(--danger);
}

.generate-btn.stop-mode:hover {
  background: #dc2626;
}

.generate-btn.reset-mode {
  background: #64748b;
}

.generate-btn.reset-mode:hover {
  background: #475569;
}

.secondary-btn {
  padding: 9px 16px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.secondary-btn:hover {
  background: #f1f5f9;
  border-color: var(--border-focus);
}

.secondary-btn.active-toggle {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

.lucky-btn {
  padding: 9px 16px;
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  font-family: 'Special Elite', 'Courier New', monospace;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.lucky-btn:hover {
  background: #f8fafc;
  border-color: var(--accent);
  color: var(--accent);
}

@media (max-width: 768px) {
  .controls-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .control-actions {
    margin-left: 0;
    justify-content: stretch;
    flex-wrap: wrap;
  }
  .generate-btn, .secondary-btn {
    flex: 1;
    min-width: 0;
  }
  .model-select-btn {
    min-width: unset;
    width: 100%;
  }
}

/* ── Generation Status ────────────────────────────────────────────── */

.generation-status {
  padding: 12px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.status-text {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
}

.status-progress {
  font-size: 13px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s ease;
}

/* ── Hilinks Table ────────────────────────────────────────────────── */

.hilinks-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.section-title {
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}

.hilinks-table-wrap {
  overflow-x: auto;
}

.hilinks-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.hilinks-table th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
  white-space: nowrap;
}

.hilinks-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
}

.hilinks-table tr:last-child td {
  border-bottom: none;
}

.hilinks-table tbody tr {
  transition: background 0.1s ease, opacity 0.2s ease;
  cursor: pointer;
  border-left: 4px solid transparent;
}

.hilinks-table tbody tr:hover {
  background: #f8fafc;
}

.hilinks-table tbody tr.row-off {
  opacity: 0.45;
  border-left-color: transparent !important;
}

.hilink-id-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #333;
}

.hilinks-table tr.highlight-row {
  animation: row-flash 0.6s ease;
}

@keyframes row-flash {
  0% { background: var(--accent-light); }
  100% { background: transparent; }
}

.col-id { width: 40px; text-align: center; font-weight: 700; }
.col-a, .col-b { max-width: 250px; }
.col-type { width: 70px; }
.col-score { width: 60px; text-align: center; }
.col-desc { min-width: 200px; }

.cell-quote {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
  max-height: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
}

.score-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.hilinks-footer {
  padding: 12px 20px;
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
  border-top: 1px solid var(--border);
}

/* ── Hilink Highlights ────────────────────────────────────────────── */

mark.hilink-mark {
  border-radius: 2px;
  padding: 1px 0;
  cursor: pointer;
  transition: filter 0.15s ease;
}

mark.hilink-mark:hover {
  filter: brightness(0.88);
}

.hilink-fulltext-indicator {
  border-left: 4px solid rgba(150, 150, 150, 0.5);
  padding-left: 12px;
  margin-left: -4px;
  cursor: pointer;
  transition: border-left-color 0.2s ease;
}

.hilink-fulltext-indicator:hover {
  border-left-width: 6px;
}

/* ── Tooltip ──────────────────────────────────────────────────────── */

.hilink-tooltip {
  position: fixed;
  z-index: 10000;
  max-width: 380px;
  padding: 10px 14px;
  background: rgba(24, 24, 28, 0.96);
  color: #e4e4e4;
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-xl);
  pointer-events: auto;
  animation: tooltip-in 0.12s ease;
}

.tooltip-close {
  position: absolute;
  top: 4px;
  right: 6px;
  background: none;
  border: none;
  color: #888;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
}

.tooltip-close:hover {
  color: #ddd;
}

@keyframes tooltip-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tooltip-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.tooltip-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.tooltip-type {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.type-label-nest { color: #6ee7b7; }
.type-label-touch { color: #fcd34d; }
.type-label-echo { color: #c4b5fd; }

.tooltip-score {
  font-size: 12px;
  color: #999;
}

.tooltip-desc {
  color: #d0d0d0;
  font-size: 12.5px;
  line-height: 1.55;
}

.tooltip-partner {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: #999;
  font-size: 11.5px;
  font-style: italic;
  line-height: 1.45;
}

/* ── Overlays ─────────────────────────────────────────────────────── */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: overlay-in 0.2s ease;
}

@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}

.overlay-content {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 32px;
  max-width: 460px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
}

.overlay-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.overlay-close:hover {
  color: var(--text);
}

.overlay-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}

.overlay-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* Auth Modal */

.auth-section {
  margin-bottom: 0;
}

.input-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.text-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s ease;
}

.text-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.api-key-row {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.api-key-row .text-input {
  flex: 1;
}

.icon-btn {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-size: 16px;
  transition: background 0.15s ease;
}

.icon-btn:hover {
  background: #f1f5f9;
}

.primary-btn {
  padding: 10px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.primary-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.full-width {
  width: 100%;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.oauth-btn:hover {
  background: #f8fafc;
  border-color: var(--border-focus);
}

.auth-hint {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.auth-hint a {
  color: var(--accent);
  text-decoration: none;
}

.auth-hint a:hover {
  text-decoration: underline;
}

.auth-error {
  margin-top: 12px;
  padding: 10px 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  color: var(--danger);
  font-size: 13px;
}

/* Model Modal */

.model-modal {
  max-width: 520px;
}

.model-search-input {
  margin-bottom: 12px;
}

.model-list {
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.model-list-loading {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.model-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.1s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.model-item:last-child {
  border-bottom: none;
}

.model-item:hover {
  background: #f8fafc;
}

.model-item.selected {
  background: var(--accent-light);
}

.model-item-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
}

.model-item-id {
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 1px;
}

.model-item-context {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Vennr Layout ────────────────────────────────────────────────── */

body.vennr-active .main-content {
  max-width: none;
  transition: margin-left 0.2s ease;
}

.vennr-layout {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  align-items: flex-start;
}

/* Sidebar — fixed to left edge of viewport below header */
.vennr-sidebar {
  position: fixed;
  left: 0;
  top: 52px;
  bottom: 0;
  width: 280px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  font-size: 13px;
  z-index: 50;
  transition: width 0.2s ease;
}

.vennr-sidebar.collapsed {
  width: 36px;
  overflow: hidden;
}

.vennr-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 2;
  user-select: none;
}

.vennr-sidebar-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
}

.vennr-sidebar.collapsed .vennr-sidebar-title {
  display: none;
}

.vennr-sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  flex-shrink: 0;
}

.vennr-sidebar-toggle:hover {
  background: #eef1f5;
  color: var(--text);
}

.vennr-sidebar.collapsed .vennr-sidebar-content {
  display: none;
}

.vennr-sidebar-resize {
  position: absolute;
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 3;
}

.vennr-sidebar-resize:hover,
.vennr-sidebar-resize.dragging {
  background: var(--accent);
  opacity: 0.3;
}

.vennr-folder-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: #fafbfc;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-weight: 600;
  user-select: none;
  font-size: 13px;
}

.vennr-folder-header input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

.vennr-folder-caret {
  font-size: 10px;
  display: inline-block;
  transition: transform 0.15s ease;
  width: 12px;
  text-align: center;
}

.vennr-folder-caret.expanded {
  transform: rotate(90deg);
}

.vennr-folder-label {
  flex: 1;
  letter-spacing: 0.02em;
}

.vennr-folder-items {
  /* collapsible via JS */
}

.vennr-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 5px 10px 5px 26px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  font-size: 12.5px;
  line-height: 1.4;
}

.vennr-item:hover {
  background: #f8fafc;
}

/* Atomizr: one atomized sentence per line in Document B */
.doc-line {
  padding: 2px 0;
}

/* Atomizr: atom whose verbatim span could not be located in the source */
.vennr-item.atomizr-missed .vennr-item-title {
  text-decoration: underline dotted #b91c1c;
}

.vennr-item input[type="checkbox"] {
  margin: 2px 0 0;
  cursor: pointer;
  flex-shrink: 0;
}

.vennr-item-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
  margin-top: 1px;
}

.vennr-item-label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--text-secondary);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.vennr-item-significance {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.3;
}

/* Example banner (default contrastr landing) */
.example-banner {
  text-align: center;
  padding: 10px 20px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.example-banner a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.example-banner a:hover {
  text-decoration: underline;
}

/* Not Reported section (contrastr mode) */
.not-reported-section {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 2px dashed var(--border);
}

.not-reported-heading {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 12px 0;
}

.not-reported-content {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.not-reported-item {
  margin-bottom: 8px;
  padding: 4px 8px;
  border-radius: var(--radius);
  background: var(--bg);
}

.not-reported-item p {
  margin: 0;
}

/* Document panels — floating cards */
.vennr-doc-panels {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  align-items: flex-start;
}

.vennr-doc-panel {
  flex: 1 1 0;
  min-width: 220px;
  max-width: 700px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: visible;
}

.vennr-doc-panel .panel-header {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.vennr-doc-panel .doc-rendered {
  padding: 16px;
  max-height: none;
  overflow-y: visible;
  min-height: 0;
}

/* ── Utility ──────────────────────────────────────────────────────── */

.hidden { display: none !important; }

/* ── Settings Modal ────────────────────────────────────────── */

.settings-modal {
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
}

.settings-section {
  margin-bottom: 24px;
}

.settings-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.settings-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  min-width: 130px;
}

.settings-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
}
.settings-toggle input { margin: 0; cursor: pointer; }

.settings-temp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  max-width: 280px;
}
.settings-temp-row input[type="range"] { flex: 1; }
.settings-temp-value {
  font-family: "Special Elite", monospace;
  font-size: 14px;
  min-width: 28px;
  text-align: right;
  color: var(--text);
}

.settings-select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13px;
  color: var(--text);
}

.settings-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 8px;
}
.settings-hint code {
  background: var(--border);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
}

.settings-prompt-textarea {
  width: 100%;
  min-height: 260px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: monospace;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
  resize: vertical;
  box-sizing: border-box;
}
.settings-prompt-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.settings-reset-link {
  font-size: 12px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.settings-reset-link:hover { text-decoration: underline; }

.config-presets-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.config-preset-select { flex: 1; }
.config-preset-name { flex: 1; }
.config-preset-delete {
  padding: 4px 8px;
  color: var(--text-muted);
  font-size: 13px;
}
.config-preset-delete:hover { color: var(--danger, #ef4444); }

.settings-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
  html { font-size: 14px; }
  .app-header { padding: 10px 16px; }
  .main-content { padding: 12px 12px 40px; }
  .overlay-content { padding: 24px 20px; }
}
