:root {
  --bg: linear-gradient(135deg, #0f1117 0%, #1a1d2d 50%, #0f1117 100%);
  --bg-solid: #0f1117;
  --surface: #1a1d27;
  --surface2: #22263a;
  --border: #2e3350;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent2: #7c6af7;
  --green: #3ecf8e;
  --yellow: #f6c94e;
  --orange: #fb923c;
  --red: #f87171;
  --text: #e2e8f0;
  --muted: #cbd5e1;
  --radius: 8px;
  --radius-sm: 6px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --header-height: 52px;
  --sidebar-width: 320px;
}

/* Reset & Base */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); background-color: var(--bg-solid); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.app { display: grid; grid-template-rows: var(--header-height) 1fr; height: 100vh; }
.spacer { flex: 1; }

/* Header */
header { display: flex; align-items: center; gap: 12px; height: var(--header-height); padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--border); flex-shrink: 0; position: sticky; top: 0; z-index: 10; overflow: clip; overflow-clip-margin: 0; }
header h1 { font-size: 15px; font-weight: 600; letter-spacing: .3px; }
header .pill { background: var(--accent); color: #fff; border-radius: 99px; padding: 2px 10px; font-size: 11px; font-weight: 700; }

/* Navigation Clock */
.nav-clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding: 4px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-left: auto;
  flex-shrink: 0;
}
.clock-time {
  font-size: 14px;
  font-weight: 600;
  color: #e2e8f0;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Droid Sans Mono', 'Source Code Pro', monospace;
  letter-spacing: 1px;
}
.clock-date {
  font-size: 10px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Page Header (for sub-pages) */
.page-header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.page-header h1 { font-size: 15px; font-weight: 600; color: var(--text); }
.page-header .count { background: var(--accent); color: #fff; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; }
.page-header .refresh { margin-left: auto; }
.page-header .cache-info { font-size: 11px; color: var(--muted); }

/* Panel components - reusable */
.panel { background:var(--surface); border:1px solid var(--border); border-radius:12px; display:flex; flex-direction:column; overflow:hidden; }
.panel-header { padding:8px 12px; background:var(--surface2); border-bottom:1px solid var(--border); }
.panel-header h3 { font-size:11px; font-weight:600; color:var(--muted); text-transform:uppercase; letter-spacing:.5px; }
.panel-body { flex:1; overflow-y:auto; padding:8px; }
.panel-footer { padding:8px 12px; background:var(--surface2); border-top:1px solid var(--border); display:flex; gap:6px; flex-wrap:wrap; }
.panel-footer button { font-size:11px; padding:4px 10px; }

/* List item - can be reused */
.list-item { display:flex; align-items:center; gap:8px; padding:6px 10px; background:var(--bg); border:1px solid var(--border); border-radius:6px; margin-bottom:6px; transition:border-color .15s; }
.list-item:hover { border-color:var(--accent); }
.list-item .item-name { font-size:12px; color:var(--text); flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.list-item .item-meta { font-size:10px; color:var(--muted); }
.list-item .item-icon { font-size:14px; }

/* Toolbar */
.toolbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.toolbar input { flex: 1; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; font-size: 12px; color: var(--text); outline: none; }
.toolbar input:focus { border-color: var(--accent); }
.toolbar button { background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 6px 12px; font-size: 12px; color: var(--text); cursor: pointer; }
.toolbar button:hover { border-color: var(--accent); color: var(--accent); }

/* Table */
.table-container { flex: 1; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; }
th { position: sticky; top: 0; background: var(--surface2); padding: 10px 12px; text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text); }
tr:last-child td { border-bottom: none; }
tr:hover { background: var(--bg); }

/* Empty/Loading/Error States */
.empty, .loading, .status {
  text-align: center;
  color: var(--muted);
  padding: 40px;
  font-size: 13px;
}
.error-msg {
  color: var(--red);
  background: rgba(248,113,113,.1);
  border: 1px solid rgba(248,113,113,.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
}

/* Navigation */
.nav-links {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  flex-shrink: 1;
  min-width: 0;
}
.nav-links .btn { flex-shrink: 1; white-space: nowrap; }
.toolbar-links { display: flex; gap: 6px; align-items: center; }
.toolbar-link { color: #60a5fa; }
.toolbar-link:hover { color: #3b82f6; text-decoration: underline; }

@media (max-width: 640px) {
  header { padding: 0 10px; gap: 8px; }
  .nav-clock { display: none; }
  .nav-links { flex: 1; min-width: 0; }
  .spacer { display: none; }
}

/* Buttons - Unified System */
.btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: border-color .15s, color .15s, background-color .15s;
  font-weight: 500;
}
.btn:hover { border-color: var(--accent); color: var(--accent); background: var(--border); }
.btn:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; padding: 8px 16px; font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }

.btn-secondary { background: var(--surface2); border: 1px solid var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--border); color: var(--accent); }

.btn-danger { color: var(--red); border-color: var(--red); background: transparent; }
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface2); }

.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-lg { padding: 10px 20px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

.nav-links .btn.active,
.toolbar-links .btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  pointer-events: none;
}
/* Ensure active button has sufficient contrast */
.btn.active {
  background: #2563eb !important;
  border-color: #2563eb !important;
  color: #fff !important;
}

/* Main Layout */
.main { display: grid; grid-template-columns: var(--sidebar-width) 1fr; overflow: hidden; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
.content { display: flex; flex-direction: column; overflow: hidden; }

/* Sections */
.section { padding: 16px; border-bottom: 1px solid var(--border); }
.section h2 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 12px; }

/* Forms & Inputs */
input, select, textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 7px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: #8899b0; }

/* Status Indicators & Badges */
.status, .badge {
  font-size: 10px;
  font-weight: 700;
  border-radius: 4px;
  padding: 1px 6px;
  display: inline-block;
}
.status-pending, .badge-warn { background: rgba(246,201,78,.15); color: var(--yellow); }
.status-ok, .badge-ok { background: rgba(62,207,142,.15); color: var(--green); }
.status-error, .badge-err { background: rgba(248,113,113,.15); color: var(--red); }
.status-dup { background: rgba(100,148,237,.15); color: #6495ed; }
.badge-stock { background: rgba(79,142,247,.15); color: var(--accent); }
.badge-crypto { background: rgba(246,201,78,.15); color: var(--yellow); }

/* Loading Spinner */
.spin, .spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: middle;
  margin-right: 5px;
}
.spinner { width: 20px; height: 20px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Utility */
#count { font-size: 12px; color: var(--muted); }
.text-muted { color: var(--muted); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--red); }
.text-success { color: var(--green); }

/* Component-specific utilities */
.tag-limit-input { width: 52px; padding: 3px 6px; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; color: var(--text); font-size: 11px; }
.network-container { width: 100%; height: 600px; background: var(--bg); }

/* Utility classes for common inline patterns */
.w-full { width: 100%; }
.h-full { height: 100%; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.p-0 { padding: 0; }
.p-2 { padding: 8px; }
.p-4 { padding: 16px; }
.m-0 { margin: 0; }
.m-auto { margin: auto; }
.text-xs { font-size: 11px; }
.text-sm { font-size: 12px; }
.text-lg { font-size: 16px; }
.font-mono { font-family: monospace; }
.cursor-pointer { cursor: pointer; }

/* Drop Zone & Upload Zone */
.drop-zone, .upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: var(--surface);
}
.upload-zone { padding: 40px 24px; margin-bottom: 24px; }
.drop-zone.drag, .upload-zone.drag { border-color: var(--accent); background: rgba(79,142,247,.07); }
.drop-zone input, .upload-zone input { display: none; }
.drop-zone .icon, .upload-icon { font-size: 28px; margin-bottom: 8px; }
.upload-icon { font-size: 32px; margin-bottom: 10px; }
.drop-zone p, .upload-zone p { color: var(--muted); font-size: 13px; }
.drop-zone strong, .upload-zone strong { color: var(--text); }

/* File List */
.file-list {
  list-style: none;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}
.file-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
}
.file-list li .fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list li .fsize { color: var(--muted); white-space: nowrap; }
.file-list li .rm { cursor: pointer; color: var(--muted); font-size: 14px; line-height: 1; padding: 0 2px; }
.file-list li .rm:hover { color: var(--red); }

/* Queue Grid */
.queue-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.qcard {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  transition: background .15s;
}
.qcard:hover { background: var(--border); }
.qcard .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.qcard .val { font-size: 22px; font-weight: 700; margin-top: 2px; }
.qcard.warn .val { color: var(--yellow); }
.qcard.ok .val { color: var(--green); }
.qcard.bad .val { color: var(--red); }

/* Queue Items */
.queue-item {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 12px;
}
.queue-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.queue-item-id { font-family: monospace; font-weight: 600; color: var(--accent); }
.queue-item-size { color: var(--muted); font-size: 11px; }
.queue-item-meta { display: flex; gap: 12px; color: var(--muted); font-size: 11px; }
.queue-item-meta span { color: var(--text); }

/* Refresh Button */
.refresh-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.refresh-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 12px;
  padding: 3px 10px;
  cursor: pointer;
}
.refresh-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Tooltip */
.tooltip-popup {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 11px;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.tooltip-popup.visible { opacity: 1; }
.tooltip-popup .shortcut {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 6px;
  font-family: monospace;
  font-weight: 600;
  margin-left: 6px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10001;
}
.modal-overlay.visible { display: flex; }
.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.modal-large { max-width: 900px; max-height: 90vh; }
.modal-medium { max-width: 700px; }
.modal-header { font-size: 16px; font-weight: 600; margin-bottom: 16px; color: var(--text); }
.modal-body { margin-bottom: 16px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; }
.modal-input-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.modal-input-group label {
  font-size: 12px;
  color: var(--muted);
  min-width: 40px;
}
.modal-input-group input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 13px;
}
.modal-btn {
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
}
.modal-btn-primary { background: var(--accent); color: #fff; }
.modal-btn-primary:hover { opacity: 0.85; }
.modal-btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.modal-btn-secondary:hover { background: var(--border); }

/* Chat-specific styles */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 85%;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.message.user { align-self: flex-end; }
.message.assistant { align-self: flex-start; }

.message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}
.message-header .role {
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.message.user .role { color: var(--green); }

.message-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.message.user .message-content {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.message-actions {
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity .15s;
}
.message:hover .message-actions { opacity: 1; }

.action-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background-color .15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.action-btn:hover { border-color: var(--accent); color: var(--accent); }

.model-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 12px;
  font-size: 13px;
  width: 100%;
  cursor: pointer;
}

.btn-group { display: flex; gap: 8px; }

/* Input area */
.input-area {
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  background: var(--surface);
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--text);
  font-size: 14px;
  resize: none;
  min-height: 48px;
  max-height: 200px;
}
.chat-input:focus { outline: none; border-color: var(--accent); }

/* Empty state */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  gap: 12px;
}
.empty-state .icon { font-size: 48px; opacity: .5; }
.empty-state p { font-size: 14px; }

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}
.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--muted);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}
.typing-indicator span:nth-child(1) { animation-delay: -.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -.16s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
  transform: translateY(100px);
  opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
  will-change: transform, opacity;
  z-index: 200;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-color: var(--green); }
.toast-icon { font-size: 16px; }

/* Section title */
.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

/* Security & Accessibility */
/* Content Security Policy recommendations:
 * Add to HTTP headers: Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' https://cdn.sheetjs.com; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; connect-src 'self';
 * Add Subresource Integrity (SRI) for external scripts: <script src="https://cdn.sheetjs.com/xlsx-0.20.1/package/dist/xlsx.full.min.js" integrity="sha384-..." crossorigin="anonymous"></script>
 */

/* Focus indicators for accessibility */
*:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:focus-visible, .btn-secondary:focus-visible, .toolbar-link:focus-visible,
.action-btn:focus-visible, .send-btn:focus-visible, .copy-btn:focus-visible,
.load-more-btn:focus-visible, .model-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* PubMed-specific styles */
.searchbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.layout { display: flex; flex: 1; overflow: hidden; }
.sidebar-list { flex: 1; overflow-y: auto; }
.result-status {
  padding: 10px 14px;
  font-size: 11px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.result-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .1s;
}
.result-item:hover { background: var(--surface2); }
.result-item.active {
  background: rgba(59,130,246,.13);
  border-left: 3px solid var(--accent);
  padding-left: 11px;
}
.result-title { font-size: 12px; font-weight: 600; line-height: 1.4; margin-bottom: 3px; }
.result-authors { font-size: 11px; color: var(--muted); }
.result-meta { font-size: 10px; color: var(--muted); margin-top: 2px; }
.result-cid {
  font-size: 10px;
  color: var(--accent);
  font-family: monospace;
  margin-top: 2px;
}
.main-pane { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* Word preview */
#previewZone {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: none;
  background: var(--surface);
}
.pv-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 10px;
}
#wordBars { display: flex; flex-direction: column; gap: 5px; }
.wbar-row { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.wbar-row:hover .wbar-word { color: var(--accent); }
.wbar-word {
  font-size: 12px;
  color: var(--text);
  width: 130px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wbar-track {
  flex: 1;
  height: 7px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
}
.wbar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width .35s ease;
}
.wbar-count { font-size: 11px; color: var(--muted); width: 26px; }
#tagCloud { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.tag {
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity .15s;
}
.tag:hover { opacity: .7; }

/* Abstract pane */
#abstractPane { flex: 1; overflow-y: auto; padding: 24px 28px; }
#abstractPane h2 { font-size: 16px; font-weight: 700; line-height: 1.4; margin-bottom: 10px; }
.abs-authors { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.abs-journal { font-size: 12px; color: var(--muted); font-style: italic; margin-bottom: 18px; }
.abs-text { font-size: 13px; line-height: 1.85; }
.abs-text mark {
  background: rgba(59,130,246,.25);
  color: var(--text);
  border-radius: 2px;
  padding: 0 2px;
}
.abs-links {
  margin-top: 18px;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}
.abs-links a { color: var(--accent); text-decoration: none; }
.abs-links a:hover { text-decoration: underline; }
.abs-cid {
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.abs-cid .cid-label {
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.abs-cid .cid-value {
  color: var(--accent);
  font-family: monospace;
  flex: 1;
}
.copy-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
.copy-btn:hover { opacity: .8; }
.copy-btn:active { transform: scale(0.95); }
.placeholder { color: var(--muted); font-size: 13px; padding: 40px 28px; }

/* Load more button */
.load-more-container {
  padding: 16px;
  text-align: center;
  border-top: 1px solid var(--border);
}
.load-more-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s, background-color .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.load-more-btn:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.load-more-btn:disabled { opacity: .5; cursor: not-allowed; }
.load-more-btn .spin { margin: 0; }

/* Shared Status Bar */
.status-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 8px 16px;
  display: flex;
  gap: 24px;
  align-items: center;
  font-size: 11px;
  z-index: 100;
}
.status-section {
  display: flex;
  align-items: center;
  gap: 6px;
}
.status-label {
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.status-value {
  color: var(--text);
  font-weight: 500;
}
.status-value.authenticated {
  color: var(--green);
}
.status-value.unauthenticated {
  color: var(--muted);
}
.status-value.active {
  color: var(--accent);
}

/* Command Palette */
.command-palette-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  z-index: 10000;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.command-palette {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.command-palette-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.command-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  outline: none;
}
.command-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(79, 142, 247, 0.2);
}

.command-hint {
  font-size: 11px;
  color: var(--muted);
  background: var(--surface2);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.command-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.command-category {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  padding: 12px 12px 8px;
}

.command-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
}
.command-item:hover {
  background: var(--surface2);
}
.command-item.selected {
  background: rgba(79, 142, 247, 0.15);
  border: 1px solid var(--accent);
}

.command-label {
  font-size: 13px;
  color: var(--text);
}

.command-shortcut {
  font-size: 11px;
  color: var(--muted);
  background: var(--surface2);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  font-family: 'SF Mono', 'Monaco', monospace;
}

.command-footer {
  display: flex;
  justify-content: center;
  padding: 10px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.command-shortcut-hint {
  font-size: 11px;
  color: var(--muted);
}

/* Keyboard Shortcut Badge */
.kbd {
  display: inline-block;
  padding: 2px 6px;
  font-size: 11px;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  line-height: 1.4;
  vertical-align: middle;
}
.kbd kbd {
  padding: 0 2px;
  font-size: 10px;
}

/* More dropdown styles */
.more-dropdown {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  z-index: 1000;
  min-width: 200px;
  max-height: 400px;
  overflow-y: auto;
}

.more-dropdown-item {
  display: block;
  padding: 10px 16px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  transition: background 0.15s;
}

.more-dropdown-item:hover {
  background: var(--surface2);
}

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

/* Toolbar separator */
.toolbar-separator {
  color: var(--muted);
  margin: 0 8px;
}

/* Toolbar links */
.toolbar-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.toolbar-link {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.toolbar-link:hover {
  background: var(--surface2);
}

.toolbar-link.active {
  background: var(--accent);
  color: #fff;
}
