/* ── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-bg: #111827;
  --sidebar-hover: #1f2937;
  --sidebar-active: #1e3a5f;
  --accent: #3b82f6;
  --accent-dark: #2563eb;
  --text: #1f2937;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --border: #e5e7eb;
  --bg: #f9fafb;
  --white: #ffffff;
  --status-unread: #94a3b8;
  --status-reading: #f59e0b;
  --status-read: #10b981;
  --danger: #ef4444;
  --sidebar-text: #d1d5db;
  --sidebar-text-muted: #9ca3af;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.1);
}

body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); height: 100vh; overflow: hidden; }

/* ── Layout ───────────────────────────────────────────── */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* ── Sidebar ──────────────────────────────────────────── */
#sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid #1f2937;
  transition: width .3s cubic-bezier(.4,0,.2,1);
  min-width: 0;
}
#sidebar.collapsed { width: 0; border-right-width: 0; }

.sidebar-top { padding: 16px 12px 8px; flex-shrink: 0; }

.app-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.app-title { font-size: 14px; font-weight: 700; color: #f9fafb; letter-spacing: .3px; }
.settings-icon { background: none; border: none; font-size: 15px; cursor: pointer; opacity: .6; transition: opacity .15s; }
.settings-icon:hover { opacity: 1; }

.search-wrap { position: relative; }

#global-search {
  width: 100%;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: var(--radius);
  padding: 7px 10px;
  color: var(--sidebar-text);
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}
#global-search::placeholder { color: var(--sidebar-text-muted); }
#global-search:focus { border-color: var(--accent); }

.search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: var(--radius);
  z-index: 200;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}

.search-result-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #374151;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: #374151; }
.sri-label { font-size: 10px; color: var(--accent); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 2px; }
.sri-title { font-size: 12px; color: var(--sidebar-text); line-height: 1.3; }

#collections-tree {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
#collections-tree::-webkit-scrollbar { width: 4px; }
#collections-tree::-webkit-scrollbar-thumb { background: #374151; border-radius: 4px; }

.collection-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  cursor: pointer;
  color: var(--sidebar-text-muted);
  font-size: 13px;
  transition: background .1s, color .1s;
  user-select: none;
}
.collection-item:hover { background: var(--sidebar-hover); color: var(--sidebar-text); }
.collection-item.active { background: var(--sidebar-active); color: #93c5fd; }
.col-toggle { font-size: 10px; flex-shrink: 0; width: 12px; text-align: center; }
.col-icon { font-size: 11px; flex-shrink: 0; }
.col-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-count { font-size: 10px; color: var(--sidebar-text-muted); flex-shrink: 0; }
.col-actions { display: none; gap: 2px; }
.collection-item:hover .col-actions { display: flex; }
.col-action-btn { background: none; border: none; color: var(--sidebar-text-muted); cursor: pointer; font-size: 11px; padding: 0 3px; line-height: 1; }
.col-action-btn:hover { color: var(--sidebar-text); }
.collection-children { }

.sidebar-footer {
  padding: 8px 12px 12px;
  border-top: 1px solid #1f2937;
  flex-shrink: 0;
}

/* ── List Panel ───────────────────────────────────────── */
#list-panel { /* wider so year is always visible */
  width: 320px;
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width .3s cubic-bezier(.4,0,.2,1);
  min-width: 0;
}
#list-panel.collapsed { width: 0; border-right-width: 0; }

.list-header {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.filter-tabs { display: flex; gap: 2px; flex: 1; }
.ftab {
  background: none;
  border: none;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  transition: all .15s;
}
.ftab:hover { background: var(--bg); color: var(--text); }
.ftab.active { background: #eff6ff; color: var(--accent); }

.list-view-btns { display: flex; gap: 2px; flex-shrink: 0; }
.view-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 4px 7px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
}
.view-btn.active, .view-btn:hover { background: var(--bg); color: var(--accent); border-color: var(--accent); }

.list-sort-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px 3px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
#article-search {
  flex: 1; min-width: 0;
  border: 1px solid var(--border); border-radius: 5px;
  padding: 4px 8px; font-size: 11px; color: var(--text);
  background: var(--bg); outline: none;
}
#article-search::placeholder { color: var(--text-light); }
#article-search:focus { border-color: var(--accent); background: var(--white); }
.sort-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; flex-shrink: 0; }
#sort-select {
  border: 1px solid var(--border); border-radius: 5px;
  padding: 3px 4px; font-size: 11px; color: var(--text-muted);
  background: var(--white); outline: none; cursor: pointer; flex-shrink: 0;
}
#sort-select:focus { border-color: var(--accent); }

#articles-list { flex: 1; overflow-y: auto; padding: 6px; }
#articles-list::-webkit-scrollbar { width: 4px; }
#articles-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.article-card {
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  margin-bottom: 2px;
  transition: all .1s;
}
.article-card:hover { background: var(--bg); border-color: var(--border); }
.article-card.active { background: #eff6ff; border-color: #bfdbfe; }
.article-card.sel-active { background: #dbeafe; border-color: #93c5fd; }
.card-header { display: flex; align-items: center; gap: 6px; margin-bottom: 1px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.status-dot.unread { background: var(--status-unread); }
.status-dot.reading { background: var(--status-reading); }
.status-dot.read { background: var(--status-read); }
.card-title { font-size: 12px; font-weight: 500; color: var(--text); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { font-size: 10px; color: var(--text-muted); padding-left: 12px; display: flex; align-items: center; overflow: hidden; }

.empty-state { text-align: center; color: var(--text-muted); padding: 30px 16px; font-size: 12px; line-height: 1.6; }

/* ── Quick-add zone ───────────────────────────────────── */
#quick-add-zone {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 6px 8px 5px;
  background: var(--white);
  transition: background .15s, border-color .15s;
}
#quick-add-zone.drag-active {
  background: #eff6ff;
  border-top-color: var(--accent);
  outline: 2px dashed var(--accent);
  outline-offset: -3px;
}
#quick-add-row { display: flex; gap: 4px; align-items: center; }
#quick-doi {
  flex: 1; min-width: 0;
  border: 1px solid var(--border); border-radius: 6px;
  padding: 5px 8px; font-size: 11px; color: var(--text);
  background: var(--bg); outline: none;
  transition: border-color .15s, background .15s;
}
#quick-doi::placeholder { color: var(--text-light); }
#quick-doi:focus { border-color: var(--accent); background: var(--white); }
#quick-doi.loading { opacity: .6; }
#quick-pdf-btn {
  flex-shrink: 0; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); padding: 4px 7px; font-size: 14px;
  cursor: pointer; line-height: 1; transition: background .12s;
}
#quick-pdf-btn:hover { background: #eff6ff; border-color: var(--accent); }
#quick-drop-hint {
  font-size: 10px; color: var(--text-light); text-align: center;
  margin-top: 3px; letter-spacing: .2px;
}
#quick-status { font-size: 10px; color: var(--text-muted); margin-top: 2px; min-height: 14px; }
#quick-status.error { color: var(--danger); }
#quick-status.ok { color: var(--status-read); }

/* ── Semantic Map ─────────────────────────────────────── */
#map-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 8px;
}
.map-hint { font-size: 11px; color: var(--text-muted); text-align: center; margin-bottom: 8px; line-height: 1.4; }
#map-svg-wrap { flex: 1; overflow: hidden; position: relative; }
#map-svg-wrap svg { width: 100%; height: 100%; }
.map-node circle { transition: r .1s; }
.map-node:hover circle { r: 11; }
.map-node text { pointer-events: none; }
.map-tooltip {
  position: absolute;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 11px;
  max-width: 200px;
  line-height: 1.4;
  pointer-events: none;
  z-index: 50;
  box-shadow: var(--shadow-md);
}
.map-tooltip-title { font-weight: 600; margin-bottom: 2px; }
.map-tooltip-meta { color: var(--sidebar-text-muted); }

/* ── Detail Panel ─────────────────────────────────────── */
#detail-panel { flex: 1; display: flex; overflow: hidden; min-width: 0; position: relative; }
#detail-placeholder { flex: 1; display: flex; align-items: center; justify-content: center; }
.placeholder-inner { text-align: center; color: var(--text-muted); }
.placeholder-icon { font-size: 48px; margin-bottom: 12px; opacity: .4; }
#detail-content { flex: 1; display: flex; overflow: hidden; }

/* ── PDF Half ─────────────────────────────────────────── */
#pdf-half {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f0f0f0;
  overflow: hidden;
  min-width: 0;
}
.pdf-toolbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-muted);
}
.pdf-sep { color: var(--border); }
.pdf-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
}
.pdf-btn:hover { background: var(--bg); }
.pdf-notice { font-size: 11px; color: var(--text-muted); margin-left: 8px; }
#pdf-canvas-wrap {
  flex: 1; overflow-y: auto; overflow-x: auto;
  background: #525659;
  padding: 12px 0;
  display: flex; justify-content: center;
}
#pdf-pages-container {
  display: flex; flex-direction: column;
  align-items: center; gap: 10px;
  padding: 0 12px;
}
.pdf-page {
  position: relative; flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
  background: white;
}
.pdf-page canvas {
  display: block;
  pointer-events: none;   /* ← lets text layer receive all events */
}
.pdf-page-info-label { font-size: 11px; color: rgba(255,255,255,.7); font-variant-numeric: tabular-nums; }

/* ── PDF.js text layer ─────────────────────────────────── */
.textLayer { opacity: 1 !important; z-index: 3; }
.textLayer span { cursor: default; }

/* ── Highlight mode ────────────────────────────────────── */
.pdf-hl-btn { font-size: 11px; padding: 2px 8px; border-radius: 5px; }
.pdf-hl-btn.active { background: #fde68a; border-color: #f59e0b; color: #92400e; }
#pdf-canvas-wrap.hl-mode { cursor: crosshair !important; }
#pdf-canvas-wrap.hl-mode .textLayer { pointer-events: none; }
#hl-band {
  position: absolute; pointer-events: none; z-index: 20;
  border: 1.5px dashed rgba(0,100,220,0.7);
  background: rgba(0,100,220,0.08);
}

/* ── Highlight canvas overlay ──────────────────────────── */
.hl-canvas {
  position: absolute; top: 0; left: 0;
  pointer-events: none;   /* text layer still receives events */
  z-index: 2;
}

/* ── Highlight colour picker ──────────────────────────── */
#hl-picker {
  position: fixed; z-index: 999;
  background: white; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 6px 8px; display: flex; gap: 6px; align-items: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
}
.hl-color-btn {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer; padding: 0;
  transition: transform .12s, border-color .12s;
}
.hl-color-btn:hover { transform: scale(1.3); border-color: #94a3b8; }
.hl-sep { width: 1px; height: 16px; background: #e2e8f0; }
.hl-remove-btn {
  background: none; border: none; cursor: pointer;
  color: #94a3b8; font-size: 12px; padding: 0 2px; line-height: 1;
}
.hl-remove-btn:hover { color: var(--danger); }

/* ── Info Half ────────────────────────────────────────── */
#info-half {
  width: 380px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--white);
  border-left: 1px solid var(--border);
  transition: width .3s cubic-bezier(.4,0,.2,1);
  min-width: 0;
}
#info-half.collapsed { width: 0; border-left-width: 0; }
.info-tabs { display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.itab {
  flex: 1;
  padding: 10px 2px;
  background: none;
  border: none;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all .15s;
}
.itab:hover { color: var(--text); }
.itab.active { color: var(--accent); border-bottom-color: var(--accent); }
.itab-content { flex: 1; overflow-y: auto; padding: 14px; }
.itab-content::-webkit-scrollbar { width: 4px; }
.itab-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── Meta block ───────────────────────────────────────── */
.detail-meta { margin-bottom: 16px; }
.meta-title { font-size: 14px; font-weight: 600; line-height: 1.4; color: var(--text); margin-bottom: 6px; }
.meta-title-edit { width: 100%; font-size: 14px; font-weight: 600; border: 1px solid var(--accent); border-radius: 4px; padding: 4px 6px; outline: none; color: var(--text); }
.meta-authors { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
.meta-venue { font-size: 12px; color: var(--text-muted); font-style: italic; margin-bottom: 2px; }
.meta-doi { font-size: 11px; color: var(--accent); text-decoration: none; }
.meta-doi:hover { text-decoration: underline; }
.meta-abstract { font-size: 12px; color: var(--text); line-height: 1.6; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); max-height: 100px; overflow-y: auto; }

/* ── Fields ───────────────────────────────────────────── */
.field-group { margin-bottom: 14px; }
.field-group label { display: block; font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.status-btns { display: flex; gap: 5px; }
.status-btn { flex: 1; padding: 6px 2px; border: 1px solid var(--border); background: var(--bg); border-radius: 6px; font-size: 11px; font-weight: 500; color: var(--text-muted); cursor: pointer; transition: all .15s; }
.status-btn:hover { border-color: var(--accent); color: var(--accent); }
.status-btn.active[data-status="unread"] { background: #f1f5f9; border-color: var(--status-unread); color: #475569; }
.status-btn.active[data-status="reading"] { background: #fffbeb; border-color: var(--status-reading); color: #92400e; }
.status-btn.active[data-status="read"] { background: #ecfdf5; border-color: var(--status-read); color: #065f46; }

#collection-select, .modal-input select { width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; color: var(--text); background: var(--white); outline: none; cursor: pointer; }
#collection-select:focus { border-color: var(--accent); }

#tags-container { border: 1px solid var(--border); border-radius: var(--radius); padding: 6px; min-height: 36px; }
#tags-list { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.tag-chip { background: #eff6ff; color: var(--accent); border-radius: 4px; padding: 2px 8px; font-size: 11px; display: flex; align-items: center; gap: 4px; }
.tag-chip .tag-remove { cursor: pointer; opacity: .6; }
.tag-chip .tag-remove:hover { opacity: 1; }
#tag-input { border: none; outline: none; font-size: 12px; color: var(--text); width: 100%; background: transparent; }

/* ── Notes ────────────────────────────────────────────── */
.notes-header { margin-bottom: 8px; }
.notes-hint { font-size: 11px; color: var(--text-muted); }
#notes-area {
  width: 100%;
  height: calc(100% - 50px);
  min-height: 300px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  resize: none;
  outline: none;
  line-height: 1.7;
}
#notes-area:focus { border-color: var(--accent); }
.notes-saved { font-size: 11px; color: var(--status-read); margin-top: 6px; }

/* ── Summaries ────────────────────────────────────────── */
.summary-tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.stab { flex: 1; padding: 5px 2px; border: 1px solid var(--border); background: var(--bg); border-radius: 6px; font-size: 11px; font-weight: 500; color: var(--text-muted); cursor: pointer; transition: all .15s; }
.stab.active { background: var(--accent); border-color: var(--accent); color: white; }
.stab:hover:not(.active) { border-color: var(--accent); color: var(--accent); }
.stab-regen { flex: none; padding: 5px 8px; color: var(--text-muted); white-space: nowrap; border-style: dashed; }
.stab-regen:hover { border-color: var(--status-reading); color: var(--status-reading); border-style: solid; }
.stab-regen.spinning { opacity: .6; pointer-events: none; }
#summary-actions { margin-bottom: 10px; display: flex; align-items: center; gap: 10px; }
.summary-body { font-size: 13px; line-height: 1.7; color: var(--text); position: relative; padding-top: 32px; }
.summary-body h1, .summary-body h2 { font-size: 13px; font-weight: 600; margin: 10px 0 5px; }
.summary-body h3 { font-size: 12px; font-weight: 600; margin: 8px 0 3px; }
.summary-body ul, .summary-body ol { padding-left: 16px; margin: 4px 0; }
.summary-body li { margin-bottom: 3px; }
.summary-body strong { font-weight: 600; }
.summary-body p { margin-bottom: 6px; }
.copy-btn {
  position: absolute; top: 0; right: 0;
  background: var(--white); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 10px;
  font-size: 11px; color: var(--text-muted); cursor: pointer;
  z-index: 2;
}
.copy-btn:hover { background: var(--bg); color: var(--accent); }

/* ── Panel edge toggle buttons ────────────────────────── */
.panel-tab {
  position: absolute; z-index: 200; top: 50%; transform: translateY(-50%);
  width: 18px; height: 52px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 0 10px 10px 0;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 3px 0 8px rgba(0,0,0,0.10);
  transition: box-shadow .2s, background .15s, width .15s;
  color: var(--text-muted); font-size: 9px; font-weight: 700;
  padding: 0;
  user-select: none;
}
.panel-tab:hover { background: #eff6ff; color: var(--accent); box-shadow: 4px 0 14px rgba(0,0,0,0.15); width: 22px; }
.panel-tab.right-tab {
  border-radius: 10px 0 0 10px;
  box-shadow: -3px 0 8px rgba(0,0,0,0.10);
}
.panel-tab.right-tab:hover { box-shadow: -4px 0 14px rgba(0,0,0,0.15); }

#tab-toggle-sidebar { left: 0; background: #111827; color: white; border-color: #374151; }
#tab-toggle-sidebar:hover { background: #1f2937; color: #93c5fd; }
#tab-toggle-list    { left: 0; }
#tab-toggle-info    { right: 0; }

/* ── Collection chips ─────────────────────────────────── */
#current-collections { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; min-height: 10px; }
.col-chip {
  display: flex; align-items: center; gap: 4px;
  background: #eff6ff; color: var(--accent);
  border: 1px solid #bfdbfe; border-radius: 6px;
  padding: 3px 8px; font-size: 11px; font-weight: 500;
}
.col-chip-remove { cursor: pointer; opacity: .6; margin-left: 2px; }
.col-chip-remove:hover { opacity: 1; color: var(--danger); }

.suggestions-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
#collection-suggestions { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }

.suggest-chip {
  display: flex; align-items: center; gap: 4px;
  border-radius: 6px; padding: 4px 10px;
  font-size: 11px; font-weight: 500; cursor: pointer;
  transition: all .15s; user-select: none;
}
.suggest-chip.existing {
  background: var(--bg); border: 1px solid var(--border); color: var(--text-muted);
}
.suggest-chip.existing:hover { border-color: var(--accent); color: var(--accent); background: #eff6ff; }
.suggest-chip.new-col {
  background: white; border: 1.5px dashed var(--accent); color: var(--accent);
}
.suggest-chip.new-col:hover { background: #eff6ff; }
.suggest-chip .chip-icon { font-size: 10px; }

.btn-suggest {
  background: none; border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 10px;
  font-size: 11px; color: var(--text-muted); cursor: pointer;
  transition: all .15s; margin-top: 4px;
}
.btn-suggest:hover { border-color: var(--accent); color: var(--accent); }
.btn-suggest:disabled { opacity: .5; cursor: not-allowed; }

/* ── New collection popup similar list ─────────────────── */
.new-col-similar-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.new-col-similar-item:last-child { border-bottom: none; }
.new-col-similar-item input[type=checkbox] { flex-shrink: 0; }
.new-col-similar-title { flex: 1; color: var(--text); }
.new-col-similar-score { font-size: 10px; color: var(--accent); font-weight: 600; flex-shrink: 0; }

/* ── Similar ──────────────────────────────────────────── */
.similar-hint { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.similar-card { padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; cursor: pointer; transition: all .12s; }
.similar-card:hover { border-color: var(--accent); background: #eff6ff; }
.similar-score { display: inline-block; font-size: 10px; font-weight: 600; color: var(--accent); background: #eff6ff; border-radius: 4px; padding: 1px 6px; margin-bottom: 4px; }
.similar-title { font-size: 12px; font-weight: 500; line-height: 1.4; }
.similar-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── Buttons ──────────────────────────────────────────── */
.btn-primary { background: var(--accent); color: white; border: none; border-radius: var(--radius); padding: 8px 14px; font-size: 13px; font-weight: 500; cursor: pointer; transition: background .15s; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 5px 10px !important; font-size: 12px !important; }
.btn-ghost { background: none; color: var(--text-muted); border: 1px solid var(--border); border-radius: var(--radius); padding: 7px 14px; font-size: 12px; cursor: pointer; transition: all .15s; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost:hover { border-color: var(--accent); color: #93c5fd; }
.btn-ghost-sm { background: none; color: var(--sidebar-text-muted); border: 1px solid #4b5563; border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.btn-ghost-sm:hover { border-color: #9ca3af; color: var(--sidebar-text); }
.btn-danger { background: none; border: 1px solid #fca5a5; color: var(--danger); border-radius: var(--radius); padding: 6px 12px; font-size: 12px; cursor: pointer; width: 100%; transition: all .15s; }
.btn-danger:hover { background: #fef2f2; border-color: var(--danger); }

/* ── Modal ────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 200; backdrop-filter: blur(2px); }
.modal { background: var(--white); border-radius: 12px; width: 440px; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.15); }
.modal-sm { width: 340px; }
.modal-settings { width: 480px; }
.settings-section { margin-bottom: 20px; }
.settings-label { display: block; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.provider-btns { display: flex; gap: 8px; }
.provider-btn { flex: 1; padding: 8px; border: 1px solid var(--border); background: var(--bg); border-radius: var(--radius); font-size: 13px; font-weight: 500; color: var(--text-muted); cursor: pointer; transition: all .15s; }
.provider-btn.active { background: #eff6ff; border-color: var(--accent); color: var(--accent); }
.key-row { display: flex; gap: 8px; align-items: center; }
.settings-status { font-size: 12px; margin-bottom: 8px; min-height: 18px; }
.settings-status.ok { color: var(--status-read); }
.settings-status.err { color: var(--danger); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 16px; cursor: pointer; color: var(--text-muted); }
.modal-close:hover { color: var(--text); }
.modal-tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.mtab { padding: 8px 16px; background: none; border: none; font-size: 13px; font-weight: 500; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.mtab.active { color: var(--accent); border-bottom-color: var(--accent); }
.mtab-content { display: none; }
.modal-hint { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; line-height: 1.5; }
.modal-input { width: 100%; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; font-size: 13px; outline: none; margin-bottom: 12px; color: var(--text); font-family: inherit; }
.modal-input:focus { border-color: var(--accent); }
.modal-submit { width: 100%; }

#drop-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 32px; text-align: center; cursor: pointer; transition: all .15s; margin-bottom: 12px; }
#drop-zone:hover, #drop-zone.drag-over { border-color: var(--accent); background: #eff6ff; }
.drop-icon { font-size: 32px; margin-bottom: 8px; }
#drop-zone p { font-size: 13px; color: var(--text-muted); }
.error-msg { color: #dc2626; font-size: 12px; margin-bottom: 8px; }

/* ── Classify banner ──────────────────────────────────── */
#classify-banner { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 150; min-width: 420px; max-width: 620px; }
.banner-inner { background: var(--sidebar-bg); color: var(--sidebar-text); border-radius: 10px; padding: 12px 16px; display: flex; align-items: center; gap: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.2); font-size: 13px; }
#banner-text { flex: 1; line-height: 1.4; }
.banner-btns { display: flex; gap: 8px; flex-shrink: 0; }

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