/* ── VerbaSave Biblioteca ─────────────────────────────────────────────────── */
:root {
  --accent-1:  #4F8EF7;
  --accent-2:  #0D9488;
  --grad:      linear-gradient(135deg,#4F8EF7,#0D9488);
  --r-sm:      8px;
  --r-md:      14px;
  --r-lg:      20px;
}

/* ── Themes ──────────────────────────────────────────────────────────────── */
body, body.theme-dark {
  --bg:        #0A0A0F;
  --surface:   #111118;
  --surface-2: #1A1A24;
  --border:    rgba(255,255,255,0.07);
  --border-hi: rgba(255,255,255,0.13);
  --text-1:    #FFFFFF;
  --text-2:    rgba(255,255,255,0.55);
  --text-3:    rgba(255,255,255,0.28);
  --hl-bar:    #0D0D13;
}
body.theme-light {
  --bg:        #FFFFFF;
  --surface:   #F4F4F4;
  --surface-2: #EBEBEB;
  --border:    rgba(0,0,0,0.08);
  --border-hi: rgba(0,0,0,0.15);
  --text-1:    #1A1A1A;
  --text-2:    rgba(0,0,0,0.55);
  --text-3:    rgba(0,0,0,0.35);
  --hl-bar:    #F0F0F0;
}
body.theme-warm {
  --bg:        #F2F0E3;
  --surface:   #EAE7D6;
  --surface-2: #E0DCC8;
  --border:    rgba(60,50,20,0.10);
  --border-hi: rgba(60,50,20,0.18);
  --text-1:    #2C2A20;
  --text-2:    rgba(44,42,32,0.60);
  --text-3:    rgba(44,42,32,0.38);
  --hl-bar:    #E8E5D4;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Nunito', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.bib-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 57px;
  min-height: 57px;
  max-height: 57px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
  gap: 16px;
}

.bib-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 16px;
  color: var(--text-1);
  flex-shrink: 0;
}
.bib-logo img { height: 24px; }

.bib-search-wrap {
  position: relative;
  width: 200px;
}
.bib-search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}
.bib-search {
  width: 100%;
  padding: 9px 14px 9px 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-1);
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}
.bib-search:focus { border-color: var(--accent-1); }
.bib-search::placeholder { color: var(--text-3); }

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

/* Center nav */
.bib-header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.bib-nav-link {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Nunito', sans-serif;
  color: var(--text-2);
  text-decoration: none;
  transition: background .15s, color .15s;
}
.bib-nav-link:hover { background: var(--surface); color: var(--text-1); }
.bib-nav-link.active { color: var(--text-1); background: var(--surface); }

/* User chip */
.bib-user-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px 4px 4px;
}
.bib-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  font-family: 'Nunito', sans-serif;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
}
.bib-username {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-1);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bib-logout-btn {
  width: 22px;
  height: 22px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color .15s, background .15s;
  padding: 0;
}
.bib-logout-btn:hover { color: #F05A5A; background: rgba(240,90,90,.1); }

.bib-count {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 600;
}

.bib-btn-ghost {
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-hi);
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  font-family: 'Nunito', sans-serif;
  text-decoration: none;
  transition: border-color .15s, color .15s;
  white-space: nowrap;
}
.bib-btn-ghost:hover { border-color: var(--accent-1); color: var(--text-1); }

/* ── Tab bar ─────────────────────────────────────────────────────────────── */
.bib-tabbar {
  height: 38px;
  min-height: 38px;
  max-height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 57px;   /* height of header */
  z-index: 90;
  scrollbar-width: none;
}
.bib-tabbar::-webkit-scrollbar { display: none; }

.bib-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  min-width: 120px;
  max-width: 200px;
  height: 38px;
  cursor: pointer;
  border-right: 1px solid var(--border);
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  font-family: 'Nunito', sans-serif;
  white-space: nowrap;
  transition: background .15s, color .15s;
  flex-shrink: 0;
  user-select: none;
  position: relative;
}
.bib-tab:hover { background: var(--surface-2); color: var(--text-2); }
.bib-tab.active {
  background: var(--surface);
  color: var(--text-1);
  border-bottom: 2px solid var(--accent-1);
}
.bib-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0; right: 0;
  height: 1px;
  background: var(--surface);
}

.bib-tab-icon { flex-shrink: 0; opacity: 0.7; }
.bib-tab.active .bib-tab-icon { opacity: 1; }

.bib-tab-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.bib-tab-close {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: none;
  background: none;
  color: var(--text-3);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  padding: 0;
}
.bib-tab-close:hover { background: rgba(255,255,255,0.1); color: var(--text-1); }

/* ── Toolbar ─────────────────────────────────────────────────────────────── */
.bib-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.bib-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.filter-btn:hover { border-color: var(--border-hi); color: var(--text-1); }
.filter-btn.active {
  background: var(--grad);
  border-color: transparent;
  color: #fff;
}

.bib-sort {
  padding: 7px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: border-color .15s;
}
.bib-sort:focus { border-color: var(--accent-1); }
.bib-sort option { background: var(--surface-2); }

/* ── Grid ────────────────────────────────────────────────────────────────── */
.bib-main {
  padding: 28px 32px 80px;
}

.bib-grid {
  columns: 3;
  column-gap: 18px;
}

.bib-card {
  break-inside: avoid;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform .2s, border-color .2s, box-shadow .2s;
  display: block;
}
.bib-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-hi);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

/* Cover image */
.bib-card-cover {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}
.bib-card-cover-grad {
  width: 100%;
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  color: rgba(255,255,255,0.15);
  letter-spacing: -1px;
}

/* Body */
.bib-card-body {
  padding: 14px 16px 16px;
}

.bib-card-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.bib-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid var(--border);
  color: var(--text-3);
  background: transparent;
}
.bib-badge.ai     { color: var(--accent-2); border-color: rgba(13,148,136,0.3); background: rgba(13,148,136,0.08); }
.bib-badge.hl     { color: var(--accent-1); border-color: rgba(79,142,247,0.3); background: rgba(79,142,247,0.08); }
.bib-badge.fav    { color: #ff4466; border-color: rgba(255,68,102,0.3); background: rgba(255,68,102,0.08); }
.bib-badge.unread { color: #aaaaaa; border-color: rgba(170,170,170,0.2); background: rgba(170,170,170,0.06); font-size: 9px; }

.bib-card-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-1);
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bib-card-author {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bib-card-domain {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.bib-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--text-3);
}

.bib-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.bib-card-del {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, background .15s;
  padding: 0;
  opacity: 0;
}
.bib-card:hover .bib-card-del { opacity: 1; }
.bib-card-del:hover { color: #F05A5A; background: rgba(240,90,90,.12); }

.bib-card-source {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-3);
  transition: color .15s;
  flex: 1;
  min-width: 0;
}
.bib-card-source:hover { color: var(--accent-1); }

/* ── Empty / loading ─────────────────────────────────────────────────────── */
.bib-empty {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-2);
}
.bib-empty h2 { font-size: 20px; color: var(--text-1); margin-bottom: 10px; }
.bib-spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-1);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 80px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Reader toolbar ──────────────────────────────────────────────────────── */
.reader-toolbar {
  display: flex;
  align-items: center;
  justify-content: center; /* centre buttons on full viewport width */
  gap: 4px;
  padding: 0 32px;
  height: 42px;
  flex-shrink: 0;
  background: var(--hl-bar, #0D0D13);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 95px; /* header(57) + tabbar(38) */
  z-index: 80;
  overflow-x: auto;
  scrollbar-width: none;
}
.reader-toolbar::-webkit-scrollbar { display: none; }

/* Inner wrapper — transparent pass-through for flex children */
.rt-inner {
  display: contents; /* children participate directly in toolbar flex */
}

.rt-group {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.rt-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  background: none;
  color: var(--text-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.rt-btn:hover  { background: var(--surface-2); color: var(--text-2); }
.rt-btn.active { background: rgba(79,142,247,0.18); color: var(--accent-1); }
/* Eraser tool — red tint when active */
.rt-eraser-btn.active { background: rgba(240,90,90,0.16); color: #F05A5A; }
/* Reset all — always subtle red */
.rt-reset-btn { color: var(--text-3); }
.rt-reset-btn:hover { background: rgba(240,90,90,0.14); color: #F05A5A; }

/* Font size buttons */
.rt-font-btn {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 11px;
  width: auto;
  padding: 0 8px;
  letter-spacing: .02em;
}

.rt-sep {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 6px;
  flex-shrink: 0;
}

.rt-colors {
  gap: 6px;
}
.rt-color {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  transition: transform .15s, border-color .15s;
  padding: 0;
  flex-shrink: 0;
}
.rt-color:hover  { transform: scale(1.15); }
.rt-color.active { border-color: var(--text-1); transform: scale(1.1); }

.rt-theme-btn {
  padding: 4px 7px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 15px;
  border-radius: 7px;
  opacity: 0.45;
  transition: opacity .15s, background .15s;
  flex-shrink: 0;
}
.rt-theme-btn:hover  { opacity: 0.75; background: var(--surface-2); }
.rt-theme-btn.active { opacity: 1; background: var(--surface); }

/* ── Lettore inline ──────────────────────────────────────────────────────── */
#view-reader {
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

:root { --bib-reader-font: 18px; }
.bib-reader-content { font-size: var(--bib-reader-font) !important; }

.bib-reader-loading {
  text-align: center;
  padding: 80px 24px;
  font-family: 'Nunito', sans-serif;
  color: var(--text-2);
}
.bib-reader-spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-1);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 16px;
}

/* Meta */
.bib-reader-meta { margin-bottom: 32px; font-family: 'Nunito', sans-serif; }
.bib-reader-title {
  font-family: 'Lora', Georgia, serif;
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-1);
  margin-bottom: 14px;
}
.bib-reader-byline {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 10px;
}
.bib-reader-readtime {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 20px;
}
.bib-reader-source-note {
  font-size: 11px;
  color: var(--text-3);
  padding: 8px 12px;
  background: var(--surface);
  border-left: 3px solid var(--border-hi);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  margin-bottom: 28px;
}
.bib-reader-source-note a { color: var(--accent-1); }

/* Content */
.bib-reader-content {
  font-family: 'Lora', Georgia, serif;
  font-size: 18px;
  line-height: 1.85;
  color: var(--text-1);
  position: relative;
}
.bib-reader-content p  { margin-bottom: 1.4em; }
.bib-reader-content h1,
.bib-reader-content h2,
.bib-reader-content h3,
.bib-reader-content h4 {
  font-family: 'Lora', serif;
  font-weight: 600;
  margin: 1.8em 0 0.6em;
  color: var(--text-1);
  line-height: 1.3;
}
.bib-reader-content h1 { font-size: 1.7em; }
.bib-reader-content h2 { font-size: 1.4em; }
.bib-reader-content h3 { font-size: 1.15em; }
.bib-reader-content a  { color: var(--accent-1); }
.bib-reader-content img {
  max-width: 100%;
  border-radius: var(--r-md);
  margin: 1.5em 0;
}
.bib-reader-content blockquote {
  border-left: 3px solid var(--accent-2);
  padding: 8px 20px;
  margin: 1.5em 0;
  color: var(--text-2);
  font-style: italic;
}
.bib-reader-content ul,
.bib-reader-content ol { padding-left: 1.5em; margin-bottom: 1.4em; }
.bib-reader-content li { margin-bottom: 0.4em; }
.bib-reader-content pre,
.bib-reader-content code {
  font-family: 'Courier New', monospace;
  font-size: 0.85em;
  background: var(--surface);
  border-radius: var(--r-sm);
}
.bib-reader-content code { padding: 2px 6px; }
.bib-reader-content pre  { padding: 16px; overflow-x: auto; margin-bottom: 1.4em; }
.bib-reader-content pre code { background: none; padding: 0; }

/* Highlights in inline reader — cursor only; colors handled by .vs-reader-highlight[data-color] below */
.bib-reader-content .vs-reader-highlight {
  border-radius: 2px;
  cursor: pointer;
  transition: background .15s;
}

/* Divider */
.bib-reader-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0 28px;
}

/* Highlights section */
.bib-reader-section-title {
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  margin-bottom: 14px;
}
.bib-reader-hl-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 28px; }
.bib-reader-hl-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid rgba(255,214,0,.6);
  border-radius: var(--r-sm);
  font-size: 14px;
  font-family: 'Lora', serif;
  color: var(--text-1);
  font-style: italic;
}
.bib-reader-hl-item p { flex: 1; line-height: 1.6; }
.reader-hl-quote {
  font-style: italic;
  line-height: 1.55;
  font-size: 14px;
  color: var(--text-1);
  margin-bottom: 4px;
}
.reader-hl-note-text {
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.45;
  font-style: normal;
  background: rgba(255,224,102,0.07);
  border-radius: 6px;
  padding: 4px 8px;
  margin-top: 4px;
}

.bib-reader-hl-del {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 16px;
  padding: 0 2px;
  flex-shrink: 0;
  transition: color .15s;
}
.bib-reader-hl-del:hover { color: #F05A5A; }
.bib-reader-hl-empty {
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  color: var(--text-3);
  font-style: italic;
  text-align: center;
  padding: 16px 0;
}

/* Actions */
.bib-reader-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.bib-reader-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--border-hi);
  background: transparent;
  color: var(--text-1);
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.bib-reader-btn:hover { background: var(--surface); border-color: var(--accent-1); }
.bib-reader-btn.primary { background: var(--grad); border-color: transparent; color: #fff; }
.bib-reader-btn.primary:hover { opacity: .88; }

/* Footer */
.bib-reader-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-family: 'Nunito', sans-serif;
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.6;
  text-align: center;
}
.bib-reader-footer a { color: var(--text-2); }

/* old tooltip/popup removed — replaced by reader toolbar */

/* ── Colored highlights ──────────────────────────────────────────────────── */
.vs-reader-highlight {
  background: rgba(255,224,102,0.32);
  border-bottom: 2px solid rgba(255,200,0,0.65);
  border-radius: 2px;
  cursor: pointer;
  color: inherit; /* override <mark> browser default black */
  transition: background .15s;
}
.vs-reader-highlight[data-color="green"] { background: rgba(102,255,153,0.22); border-bottom-color: rgba(0,200,80,0.55); }
.vs-reader-highlight[data-color="red"]   { background: rgba(255,102,102,0.22); border-bottom-color: rgba(220,50,50,0.55); }
.vs-reader-highlight[data-color="blue"]  { background: rgba(102,178,255,0.22); border-bottom-color: rgba(50,130,220,0.55); }

/* Underline type */
.vs-reader-highlight[data-color="ul-yellow"] { background: none; border-bottom: 2.5px solid rgba(255,224,102,0.85); }
.vs-reader-highlight[data-color="ul-green"]  { background: none; border-bottom: 2.5px solid rgba(102,255,153,0.85); }
.vs-reader-highlight[data-color="ul-red"]    { background: none; border-bottom: 2.5px solid rgba(255,102,102,0.85); }
.vs-reader-highlight[data-color="ul-blue"]   { background: none; border-bottom: 2.5px solid rgba(102,178,255,0.85); }

/* ── Sticky notes ────────────────────────────────────────────────────────── */
#br-content-wrap { position: relative; }
#stickies-layer  { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }

.sticky-note {
  position: absolute;
  width: 180px;
  min-height: 120px;
  border-radius: 3px;
  background: #FFE066; /* always yellow — visible in all themes */
  box-shadow: 3px 4px 14px rgba(0,0,0,0.45), 0 1px 3px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  z-index: 50;
  transform: rotate(-1deg);
}
.sticky-note:nth-child(even) { transform: rotate(0.8deg); }
.sticky-drag-handle {
  height: 22px;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 0 8px;
  border-radius: 3px 3px 0 0;
  background: rgba(0,0,0,0.12);
}
.sticky-drag-handle:active { cursor: grabbing; }
.sticky-drag-dots { font-size: 10px; color: rgba(0,0,0,0.35); letter-spacing: 1px; }
.sticky-close {
  background: none;
  border: none;
  color: rgba(0,0,0,0.4);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  transition: color .15s;
}
.sticky-close:hover { color: rgba(0,0,0,0.7); }
.sticky-textarea {
  flex: 1;
  border: none;
  background: transparent;
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  line-height: 1.5;
  padding: 6px 10px 10px;
  resize: none;
  outline: none;
  color: rgba(0,0,0,0.75);
  min-height: 80px;
}
.sticky-textarea::placeholder { color: rgba(0,0,0,0.3); }
.sticky-color-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ── Mini selection toolbar ──────────────────────────────────────────────── */
.hl-mini-toolbar {
  position: fixed;
  display: none;
  align-items: center;
  gap: 3px;
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: 10px;
  padding: 5px 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  z-index: 600;
  pointer-events: auto;
}
.hl-mini-toolbar.show { display: flex; }
.hmt-btn {
  width: 28px; height: 28px;
  border: none;
  border-radius: 7px;
  background: none;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s, color .12s;
}
.hmt-btn:hover { background: var(--surface-2); color: var(--text-1); }
.hmt-btn-del { color: #F05A5A; }
.hmt-btn-del:hover { background: rgba(240,90,90,0.14); color: #e03a3a; }
.hmt-sep {
  width: 1px; height: 18px;
  background: var(--border);
  margin: 0 4px;
  flex-shrink: 0;
}
.hmt-color-chip {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.2);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: transform .12s;
}
.hmt-color-chip:hover { transform: scale(1.15); }
.hmt-color-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: 2px;
}
.hmt-color-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform .12s, border-color .12s;
}
.hmt-color-dot:hover { transform: scale(1.2); }
.hmt-color-dot.active { border-color: var(--text-1); }

/* ── Side toolbar (legacy — unused but kept for safety) ──────────────────── */
#bib-side-toolbar {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: #1A1A24;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 10px 7px;
  box-shadow: 0 4px 24px rgba(0,0,0,.5);
}
.st-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  background: none;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}
.st-btn:hover  { background: rgba(255,255,255,0.08); color: #fff; }
.st-btn.active { background: rgba(79,142,247,0.2); color: #4F8EF7; }
.st-btn.inactive { color: rgba(255,255,255,0.2); }

.st-color-dot {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  cursor: pointer;
  transition: transform .15s, border-color .15s;
  padding: 0;
}
.st-color-dot:hover { transform: scale(1.15); border-color: #fff; }

.st-sep {
  width: 18px;
  height: 1px;
  background: rgba(255,255,255,0.08);
}

@media (max-width: 900px) { #bib-side-toolbar { display: none !important; } }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .bib-grid { columns: 2; }
}
@media (max-width: 600px) {
  .bib-header     { padding: 12px 16px; }
  .bib-toolbar    { padding: 12px 16px; }
  .bib-tabbar     { top: 57px; } /* header height stays 57px — keep in sync */
  .bib-tab        { min-width: 90px; padding: 0 10px; font-size: 11px; }
  .bib-main       { padding: 16px 16px 60px; }
  .bib-grid       { columns: 1; }
  .bib-search-wrap { display: none; }
  #view-reader    { padding: 24px 16px 60px; }
  .bib-reader-title   { font-size: 1.5rem; }
  .bib-reader-content { font-size: 16px; }
}

/* ══════════════════════════════════════════════════════════════════════════════
   FLASHCARD SYSTEM — view-flashcards + reader panel + study overlay
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Nav button (bib-nav-link as button) ───────────────────────────────────── */
button.bib-nav-link {
  background: none;
  border: none;
  cursor: pointer;
}

/* ── Flashcard main view ───────────────────────────────────────────────────── */
#view-flashcards {
  max-width: 780px;
  margin: 0 auto;
  padding: 40px 24px 80px;
  font-family: 'Nunito', sans-serif;
}

.fv-hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.fv-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-1);
  margin-bottom: 8px;
}
.fv-stats {
  display: flex;
  gap: 20px;
  font-size: 13px;
  color: var(--text-2);
}
.fv-stat strong { color: var(--text-1); font-weight: 700; }
.fv-stat-due strong { color: var(--accent-1); }

.fv-study-btn {
  padding: 10px 22px;
  border-radius: 999px;
  border: none;
  background: var(--grad);
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.fv-study-btn:hover { opacity: .85; }

.fv-loading {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text-3);
  font-size: 13px;
  padding: 32px 0;
}

.fv-pro-gate {
  text-align: center;
  padding: 64px 32px;
  font-family: 'Nunito', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.fv-pro-gate-icon { font-size: 52px; line-height: 1; }
.fv-pro-gate h2   { font-size: 22px; font-weight: 800; color: var(--text-1); }
.fv-pro-gate p    { font-size: 14px; color: var(--text-2); line-height: 1.6; max-width: 400px; }
.fv-pro-upgrade-btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 999px;
  background: var(--grad);
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: opacity .15s;
  margin-top: 4px;
}
.fv-pro-upgrade-btn:hover { opacity: .85; }

.fv-empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-3);
  font-size: 14px;
  line-height: 1.7;
}
.fv-empty p { margin-bottom: 8px; }
.fv-empty strong { color: var(--text-2); }

/* Groups */
.fv-group {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 14px;
  overflow: hidden;
  background: var(--surface);
}
.fv-group-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  cursor: default;
}
.fv-group-hdr-left { flex: 1; min-width: 0; }
.fv-group-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  margin-bottom: 3px;
}
.fv-group-meta {
  font-size: 12px;
  color: var(--text-3);
}
.fv-due-badge {
  color: var(--accent-1);
  font-weight: 700;
}
.fv-group-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.fv-group-study-btn {
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--accent-1);
  background: transparent;
  color: var(--accent-1);
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.fv-group-study-btn:hover { background: rgba(79,142,247,.1); }
.fv-group-toggle {
  width: 28px; height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.fv-group-toggle:hover { background: var(--surface-2); color: var(--text-1); }

.fv-group-body {
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0;
}
.fv-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.fv-card:last-child { border-bottom: none; }
.fv-card:hover { background: var(--surface-2); }
.fv-card-body { flex: 1; min-width: 0; }
.fv-card-front {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 4px;
  line-height: 1.45;
}
.fv-card-back {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.45;
}
.fv-card-del {
  width: 24px; height: 24px;
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  border-radius: 6px;
  transition: color .12s, background .12s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fv-card-del:hover { color: #F05A5A; background: rgba(240,90,90,.1); }

/* ── FC Sidebar (fixed right panel) ───────────────────────────────────────── */
#br-fc-sidebar {
  position: fixed;
  top: 0; right: 0;
  width: 340px;
  max-width: 100vw;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border-hi);
  box-shadow: -6px 0 32px rgba(0,0,0,.22);
  z-index: 500;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
#br-fc-sidebar.open { transform: translateX(0); }

.br-fc-sb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 57px;
  min-height: 57px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}
.br-fc-sb-head-left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-3);
}
.br-fc-sb-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-1);
}
.br-fc-sb-head-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.br-fc-sb-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.br-fc-sb-close:hover { background: rgba(240,90,90,.1); color: #F05A5A; border-color: #F05A5A; }

.br-fc-sb-article {
  font-family: 'Nunito', sans-serif;
  font-size: 11px;
  color: var(--text-3);
  padding: 8px 16px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.br-fc-sb-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* All the scrollable content below the actions */
#br-fc-sidebar .br-fc-generating,
#br-fc-sidebar .br-fc-ai-preview,
#br-fc-sidebar .br-fc-form,
#br-fc-sidebar .br-fc-error,
#br-fc-sidebar .br-fc-list,
#br-fc-sidebar .br-fc-list-empty {
  padding: 0 16px;
  overflow-y: auto;
}
#br-fc-sidebar .br-fc-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}
#br-fc-sidebar .br-fc-ai-preview { padding: 12px 16px; overflow-y: auto; }
#br-fc-sidebar .br-fc-form { margin: 12px 16px 0; }
#br-fc-sidebar .br-fc-generating { padding: 12px 16px; }
#br-fc-sidebar .br-fc-list-empty { padding: 20px 16px; }
#br-fc-sidebar .br-fc-error { padding: 8px 16px 0; }

/* Pro gate overlay */
.br-fc-pro-gate {
  position: absolute;
  inset: 0;
  background: var(--surface);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  padding: 32px 24px;
  font-family: 'Nunito', sans-serif;
}
.br-fc-pro-gate-icon { font-size: 40px; line-height: 1; }
.br-fc-pro-gate h2 { font-size: 18px; font-weight: 800; color: var(--text-1); }
.br-fc-pro-gate p  { font-size: 13px; color: var(--text-2); line-height: 1.55; }
.br-fc-pro-gate .br-fc-sb-close { margin-top: 8px; width: auto; border-radius: 999px; padding: 6px 16px; font-size: 13px; height: auto; }

/* ── Reader FC panel (old reference — now sidebar, keep for safety) ────────── */
.br-fc-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.br-fc-hdr-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.br-fc-count-lbl {
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  color: var(--text-3);
  font-weight: 700;
}
.br-fc-action-btn {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-hi);
  background: transparent;
  color: var(--text-2);
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.br-fc-action-btn:hover { border-color: var(--accent-1); color: var(--text-1); background: var(--surface); }
.br-fc-action-btn:disabled { opacity: .45; cursor: not-allowed; }
.br-fc-action-primary { background: var(--grad); border-color: transparent; color: #fff; }
.br-fc-action-primary:hover { opacity: .85; background: var(--grad); color: #fff; }

.br-fc-generating {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  color: var(--text-2);
  padding: 12px 0;
}
.bib-reader-spinner {
  width: 22px; height: 22px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent-1);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* AI preview */
.br-fc-ai-preview { margin-bottom: 16px; }
.br-fc-preview-label {
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 10px;
}
.br-fc-preview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  margin-bottom: 8px;
  transition: border-color .15s;
}
.br-fc-preview-card:hover { border-color: var(--border-hi); }
.br-fc-preview-card-inner { display: flex; flex-direction: column; gap: 6px; }
.br-fc-preview-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}

/* Manual form */
.br-fc-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.br-fc-textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-1);
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  transition: border-color .15s;
}
.br-fc-textarea:focus { border-color: var(--accent-1); }
.br-fc-textarea::placeholder { color: var(--text-3); }
.br-fc-form-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* Error */
.br-fc-error {
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  color: #F05A5A;
  padding: 8px 0;
}

/* Card list in reader */
.br-fc-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.br-fc-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  transition: border-color .15s;
}
.br-fc-card:hover { border-color: var(--border-hi); }
.br-fc-card-body { flex: 1; min-width: 0; }
.br-fc-card-q {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.45;
  margin-bottom: 4px;
}
.br-fc-card-a {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.45;
}
.br-fc-card-a[contenteditable], .br-fc-card-q[contenteditable] {
  outline: none;
  border-radius: 4px;
  padding: 2px 4px;
  transition: background .12s;
}
.br-fc-card-a[contenteditable]:focus,
.br-fc-card-q[contenteditable]:focus { background: var(--surface-2); }
.br-fc-card-del {
  width: 22px; height: 22px;
  border: none; background: transparent;
  color: var(--text-3);
  cursor: pointer; font-size: 18px; line-height: 1; padding: 0;
  flex-shrink: 0; border-radius: 6px;
  transition: color .12s, background .12s;
  display: flex; align-items: center; justify-content: center;
}
.br-fc-card-del:hover { color: #F05A5A; background: rgba(240,90,90,.1); }
.br-fc-list-empty {
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  color: var(--text-3);
  font-style: italic;
  text-align: center;
  padding: 12px 0;
}

/* ── Study overlay ─────────────────────────────────────────────────────────── */
#fc-study-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 900;
  display: flex;
  flex-direction: column;
  font-family: 'Nunito', sans-serif;
  overflow-y: auto;
}
.fso-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.fso-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fso-progress-lbl {
  font-size: 13px;
  color: var(--text-3);
  flex-shrink: 0;
}
.fso-close {
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.fso-close:hover { background: rgba(240,90,90,.1); color: #F05A5A; border-color: #F05A5A; }

.fso-progress-bar {
  height: 3px;
  background: var(--surface);
  flex-shrink: 0;
}
.fso-progress-fill {
  height: 100%;
  background: var(--grad);
  transition: width .4s ease;
}

.fso-flip-scene {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  perspective: 1200px;
  cursor: pointer;
  min-height: 280px;
}
.fso-flip-card {
  width: 100%;
  max-width: 600px;
  min-height: 220px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform .5s cubic-bezier(.4,0,.2,1);
}
.fso-flip-card.flipped { transform: rotateY(180deg); }
.fso-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-lg);
  padding: 36px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
}
.fso-back { transform: rotateY(180deg); }
.fso-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-3);
}
.fso-text {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.55;
  max-width: 520px;
}
.fso-hint {
  font-size: 12px;
  color: var(--text-3);
  font-style: italic;
}

.fso-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 24px 24px 40px;
  flex-shrink: 0;
}
.fso-btn-no, .fso-btn-yes {
  padding: 13px 36px;
  border-radius: 999px;
  border: none;
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.fso-btn-no:hover,  .fso-btn-yes:hover  { opacity: .85; transform: scale(1.03); }
.fso-btn-no  { background: rgba(240,90,90,.15); color: #F05A5A; border: 1px solid rgba(240,90,90,.3); }
.fso-btn-yes { background: var(--grad); color: #fff; }

.fso-done {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  gap: 12px;
}
.fso-done-icon { font-size: 56px; line-height: 1; }
.fso-done h2  { font-size: 22px; font-weight: 800; color: var(--text-1); }
.fso-done p   { font-size: 14px; color: var(--text-2); }

.btn-primary {
  padding: 11px 28px;
  border-radius: 999px;
  border: none;
  background: var(--grad);
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-primary:hover { opacity: .85; }

/* ── Mind Map Modal (biblioteca) ─────────────────────────────────────────── */
.mm-box {
  width: 95vw;
  height: 90vh;
  background: #0A0A0F;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.8);
}
.mm-header {
  height: 52px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.mm-header-title {
  flex: 1;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #F5F5F5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mm-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.mm-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1C1C2E;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  color: #C8C8D0;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.mm-btn:hover { background: #252540; color: #F5F5F5; }
.mm-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.mm-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: #1C1C2E;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 8px;
  color: #C8C8D0;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.mm-close:hover { background: #3A1C1C; color: #F05A5A; }
.mm-area {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: #0A0A0F;
}
.mm-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-family: 'Nunito', sans-serif;
  color: rgba(255,255,255,0.55);
  font-size: 14px;
  text-align: center;
  padding: 24px;
}
.mm-footer {
  height: 32px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.mm-footer-text {
  font-family: 'Nunito', sans-serif;
  font-size: 11px;
  color: #8E8E93;
}
#rt-btn-mindmap.mm-active { color: var(--accent-1); }

/* ── Mindmap box-style nodes ───────────────────── */
#bib-mindmap-svg .markmap-node > line {
  stroke-opacity: 0;          /* hide underlines */
}
#bib-mindmap-svg .markmap-foreign div {
  border-radius: 8px;
  color: #dde4f5;
  font-family: 'Nunito', sans-serif !important;
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
}

