/* =========================================================
   Whitebook Offline — stylesheet
   ========================================================= */
[hidden] { display: none !important; }

:root {
  --wb-brand:      #160828;
  --wb-brand-2:    #240f50;
  --wb-accent:     #e8157d;
  --wb-accent-2:   #5b21b6;
  --wb-link:       #4338ca;

  --wb-bg:         #f2f3f7;
  --wb-surface:    #ffffff;
  --wb-surface-2:  #f7f7fc;
  --wb-border:     #e3e3ec;
  --wb-border-2:   #d4d4e4;
  --wb-divider:    #eaeaf2;

  --wb-text:       #0f1623;
  --wb-text-2:     #2d3748;
  --wb-muted:      #64748b;
  --wb-muted-2:    #94a3b8;

  /* Topic palette */
  --t-orange: #d97706;
  --t-red:    #dc2626;
  --t-pink:   #be185d;
  --t-purple: #6d28d9;
  --t-teal:   #0d9488;
  --t-green:  #16a34a;
  --t-blue:   #1d4ed8;

  --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
  --shadow-s:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-m:  0 4px 16px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.04);

  --radius-sm: 5px;
  --radius:    8px;
  --radius-lg: 12px;

  --top-h:   60px;
  --side-w:  252px;
  --font: "Inter", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --sidebar-transition: width .22s ease, opacity .22s ease;
}

/* Collapsed sidebar */
body.sidebar-collapsed { --side-w: 0px; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--wb-bg);
  color: var(--wb-text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 15px;
  line-height: 1.55;
  width: 100%;
  font-feature-settings: "cv02" 1, "cv03" 1, "cv04" 1, "cv11" 1;
  letter-spacing: -.005em;
}
html {
  overflow-x: hidden;
}
body {
  overflow-x: clip;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.home-mobile-hero,
.mobile-tabbar,
.topic-subtopics-sheet {
  display: none;
}

.topic-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topic-subtopics-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--wb-border);
  border-radius: 12px;
  background: var(--wb-surface);
  color: var(--wb-text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-xs);
}
.topic-subtopics-btn svg { width: 18px; height: 18px; }
.topic-subtopics-btn:hover { background: var(--wb-surface-2); }

.article-inline-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  margin-bottom: 12px;
  background: var(--wb-surface);
  border: 1px solid var(--wb-border);
  border-radius: 16px;
  box-shadow: var(--shadow-xs);
}
.article-inline-search svg {
  width: 16px;
  height: 16px;
  color: var(--wb-muted-2);
  flex: none;
}
.article-inline-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
  color: var(--wb-text);
}
.article-inline-search input::placeholder { color: var(--wb-muted-2); }

.article-search-clear {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: var(--wb-surface-2);
  color: var(--wb-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}
.article-search-clear:hover { background: var(--wb-border); color: var(--wb-text); }

/* ── Top bar ────────────────────────────────────────────── */
.wb-top {
  position: sticky; top: 0; z-index: 100;
  display: flex;
  align-items: center; gap: 14px;
  height: var(--top-h);
  padding: 0 18px;
  background: var(--wb-brand);
  border-bottom: 1px solid rgba(255,255,255,.06);
  box-shadow: 0 1px 0 rgba(0,0,0,.18), 0 0 0 0 transparent;
}

.top-spacer { flex: 1; min-width: 8px; }

.top-nav { display: flex; align-items: center; gap: 2px; }
.nav-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  border-radius: 6px; border: 0; background: transparent;
  font-size: 13px; font-weight: 500; letter-spacing: -.01em;
  color: rgba(255,255,255,.6);
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.nav-link:hover { background: rgba(255,255,255,.08); color: rgba(255,255,255,.9); }
.nav-link.active { color: #fff; background: rgba(255,255,255,.1); font-weight: 600; }
.nav-wbia { opacity: .6; cursor: default; }
.nav-wbia .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--wb-accent); flex-shrink: 0;
}
.nav-badge {
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
  background: rgba(232,21,125,.22); color: #f472b6;
  border: 1px solid rgba(232,21,125,.35);
  padding: 1px 6px; border-radius: 20px;
  text-transform: uppercase;
}

.menu-btn {
  color: rgba(255,255,255,.7);
  border-radius: 7px;
}
.menu-btn:hover { color: #fff; background: rgba(255,255,255,.08); }

.brand { display: flex; align-items: center; }
.brand-logo { height: 28px; filter: brightness(0) invert(1); }


.top-search {
  position: relative;
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 7px;
  padding: 0 12px 0 38px;
  display: flex; align-items: center;
  height: 36px;
  flex: 0 1 400px; min-width: 120px;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.top-search:focus-within {
  background: rgba(255,255,255,.16);
  border-color: rgba(255,255,255,.24);
  box-shadow: 0 0 0 3px rgba(255,255,255,.06);
}
.top-search .search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: rgba(255,255,255,.55);
}
.top-search input {
  flex: 1; min-width: 0; border: 0; background: transparent;
  font-size: 13.5px; color: #fff; outline: none;
  width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.top-search input::placeholder { color: rgba(255,255,255,.45); }
.kbd-hint {
  font-size: 10.5px; color: rgba(255,255,255,.4);
  border: 1px solid rgba(255,255,255,.18);
  padding: 1px 5px; border-radius: 4px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}

.search-loading-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(255,255,255,.10);
  color: rgba(255,255,255,.78);
  font-size: 11px; font-weight: 500;
  white-space: nowrap;
}
.search-loading-badge .sl-spinner {
  width: 10px; height: 10px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.25);
  border-top-color: #fff;
  animation: sl-spin .7s linear infinite;
}
@keyframes sl-spin { to { transform: rotate(360deg); } }

.top-search input.search-warming::placeholder {
  color: rgba(255,255,255,.35);
  font-style: italic;
}

.top-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 34px; height: 34px;
  border-radius: 7px; border: 0;
  background: transparent; color: rgba(255,255,255,.7);
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: rgba(255,255,255,.09); color: #fff; }
.icon-btn.avatar {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.14);
}
.icon-btn.tiny {
  width: 26px; height: 26px; color: var(--wb-muted);
  border-radius: 6px;
}
.icon-btn.tiny svg { width: 14px; height: 14px; }
.icon-btn.tiny:hover { background: var(--wb-border); color: var(--wb-text); }

/* ── Layout ─────────────────────────────────────────────── */
.wb-layout {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  min-height: calc(100vh - var(--top-h));
  transition: var(--sidebar-transition);
  max-width: 100vw;
  overflow-x: hidden;
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--side-w);
  overflow: hidden;
  background: var(--wb-surface);
  border-right: 1px solid var(--wb-border);
  position: sticky; top: var(--top-h); align-self: start;
  height: calc(100vh - var(--top-h));
  overflow-y: auto;
  transition: var(--sidebar-transition);
  flex-shrink: 0;
}
body.sidebar-collapsed .sidebar {
  width: 0;
  border-right: 0;
  opacity: 0;
  pointer-events: none;
}
.sidebar-inner {
  padding: 14px 10px 48px;
  min-width: 232px;
}

.side-group { margin-bottom: 20px; }

.side-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 3px 8px 7px;
  font-size: 9.5px; font-weight: 700;
  letter-spacing: .11em; text-transform: uppercase;
  color: var(--wb-muted-2);
}

.side-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  margin: 1px 0;
  border-radius: 6px;
  color: var(--wb-text-2);
  font-size: 13px; font-weight: 500; letter-spacing: -.01em;
  transition: background .12s, color .12s;
}
.side-link:hover { background: var(--wb-surface-2); color: var(--wb-text); }
.side-link.active {
  background: rgba(91,33,182,.09);
  color: var(--wb-accent-2);
  font-weight: 600;
}
.side-link > svg { width: 15px; height: 15px; flex: none; color: var(--wb-muted); }
.side-link.active > svg { color: var(--wb-accent-2); }

.side-icon {
  width: 28px; height: 28px; flex: none;
  border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 10px; font-weight: 900;
  letter-spacing: .02em;
  text-transform: uppercase;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.2),
    0 1px 2px rgba(0,0,0,.15);
}

/* ── Main ───────────────────────────────────────────────── */
.main {
  padding: 24px 28px 72px;
  min-width: 0;
}
.view { max-width: 1020px; margin: 0 auto; }

/* ── Banner ─────────────────────────────────────────────── */
.banner {
  position: relative; overflow: hidden;
  background: var(--wb-brand);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 32px 36px 32px 36px;
  margin-bottom: 4px;
  display: flex; align-items: center;
  min-height: 160px;
  box-shadow: var(--shadow-m);
}
.banner::before {
  content: '';
  position: absolute; right: 0; top: 0; bottom: 0;
  width: 38%;
  background: linear-gradient(135deg, transparent 0%, rgba(109,40,217,.35) 100%);
  pointer-events: none;
}
.banner::after {
  content: '';
  position: absolute; right: 48px; top: 50%; transform: translateY(-50%);
  width: 100px; height: 100px;
  border: 2px solid rgba(255,255,255,.08);
  border-radius: 50%;
  pointer-events: none;
}
.banner-content { position: relative; z-index: 2; max-width: 600px; }
.banner-kicker {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: rgba(255,255,255,.45);
  margin-bottom: 10px;
}
.banner h2 {
  font-size: 22px; font-weight: 800;
  letter-spacing: -.025em; line-height: 1.2;
  margin-bottom: 8px;
}
.banner p {
  margin-bottom: 18px;
  color: rgba(255,255,255,.72);
  font-size: 14px; line-height: 1.5;
  max-width: 480px;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600; font-size: 13.5px; letter-spacing: -.01em;
  border: 0; cursor: pointer;
  transition: opacity .14s, background .14s;
}
.btn:hover { opacity: .85; }
.btn:active { opacity: .7; }
.btn-light { background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.2); }
.btn-light:hover { background: rgba(255,255,255,.2); opacity: 1; }
.btn-primary { background: var(--wb-accent); color: #fff; }
.btn-ghost {
  background: transparent; color: var(--wb-text-2);
  border: 1px solid var(--wb-border-2);
  font-size: 13px;
}
.btn-ghost svg { width: 15px; height: 15px; }
.btn-ghost:hover { background: var(--wb-surface-2); opacity: 1; }
.btn-ghost.active { background: var(--wb-accent); border-color: var(--wb-accent); color: #fff; }

/* ── Section headers ─────────────────────────────────────── */
.section-head {
  display: flex; align-items: center; gap: 8px;
  margin: 28px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--wb-divider);
}
.section-head h3 {
  font-size: 10.5px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--wb-muted);
}
.section-head .icon-btn { margin-left: auto; color: var(--wb-muted-2); }
.section-head .icon-btn:hover { background: var(--wb-border); color: var(--wb-text); }
.section-head .icon-btn svg { width: 16px; height: 16px; }

/* WB+ quick access */
.wbplus { margin-bottom: 4px; }
.wbplus .section-head { margin-top: 20px; }

/* ── Card grid ───────────────────────────────────────────── */
.cards { display: grid; gap: 8px; }
.cards-3 { grid-template-columns: repeat(3, 1fr); }

.card-tile {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--wb-surface);
  border: 1px solid var(--wb-border);
  border-radius: var(--radius);
  color: var(--wb-text);
  font-size: 13.5px; font-weight: 600;
  transition: box-shadow .18s, border-color .18s;
  position: relative; overflow: hidden;
}
.card-tile::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: transparent;
  transition: background .18s;
}
.card-tile:hover {
  box-shadow: var(--shadow-m);
  border-color: var(--wb-border-2);
}
.card-tile:hover::before { background: var(--wb-accent); }
.card-tile[data-color="orange"]:hover::before { background: var(--t-orange); }
.card-tile[data-color="red"]:hover::before    { background: var(--t-red); }
.card-tile[data-color="pink"]:hover::before   { background: var(--t-pink); }
.card-tile[data-color="purple"]:hover::before { background: var(--t-purple); }
.card-tile[data-color="teal"]:hover::before   { background: var(--t-teal); }
.card-tile[data-color="green"]:hover::before  { background: var(--t-green); }
.card-tile[data-color="blue"]:hover::before   { background: var(--t-blue); }

.card-icon {
  width: 36px; height: 36px; flex: none;
  border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 10.5px; font-weight: 900;
  letter-spacing: .02em;
  text-transform: uppercase;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.22),
    inset 0 -1px 0 rgba(0,0,0,.12),
    0 1px 3px rgba(0,0,0,.15);
}
.card-label { flex: 1; min-width: 0; line-height: 1.3; }
.card-count {
  font-size: 11px; color: var(--wb-muted-2);
  font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--wb-surface-2);
  padding: 2px 7px; border-radius: 99px;
  border: 1px solid var(--wb-border);
  white-space: nowrap;
}

/* ── Topic icon (large, in topic view) ───────────────────── */
.topic-icon {
  width: 46px; height: 46px; flex: none;
  border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 12px; font-weight: 900;
  letter-spacing: .03em;
  text-transform: uppercase;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.22),
    inset 0 -1px 0 rgba(0,0,0,.14),
    0 2px 6px rgba(0,0,0,.18);
}
.topic-icon.orange { background: var(--t-orange); }
.topic-icon.red    { background: var(--t-red); }
.topic-icon.pink   { background: var(--t-pink); }
.topic-icon.purple { background: var(--t-purple); }
.topic-icon.teal   { background: var(--t-teal); }
.topic-icon.green  { background: var(--t-green); }
.topic-icon.blue   { background: var(--t-blue); }

/* ── Search results ──────────────────────────────────────── */
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  z-index: 200;
  background: var(--wb-surface);
  border: 1px solid var(--wb-border-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow-m);
  overflow: hidden;
}
.search-results-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 14px;
  border-bottom: 1px solid var(--wb-divider);
  background: var(--wb-surface-2);
  font-size: 11px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--wb-muted);
}
.search-results-head strong { color: var(--wb-text); letter-spacing: normal; font-size: 13px; }
.linkish { border: 0; background: transparent; color: var(--wb-accent); font-weight: 700; font-size: 12px; }
#search-results-list {
  list-style: none;
  max-height: 60vh; overflow-y: auto;
}
.search-hit {
  display: grid; grid-template-columns: auto 1fr auto;
  gap: 12px; align-items: center;
  padding: 11px 14px; border-bottom: 1px solid var(--wb-divider);
  color: inherit;
}
.search-hit:last-child { border-bottom: 0; }
.search-hit:hover { background: var(--wb-surface-2); }
.search-hit .sh-title { font-weight: 600; font-size: 14px; }
.search-hit .sh-meta { font-size: 12px; color: var(--wb-muted); margin-top: 1px; }
.search-hit mark {
  background: rgba(232,21,125,.12); color: var(--wb-accent);
  font-weight: 700; border-radius: 2px; padding: 0 1px;
}
.search-empty { padding: 24px; text-align: center; color: var(--wb-muted); font-size: 14px; }
.chev { color: var(--wb-muted-2); font-size: 16px; line-height: 1; }

/* ── Topic view ──────────────────────────────────────────── */
.breadcrumb {
  display: flex; gap: 7px; align-items: center;
  font-size: 12.5px; color: var(--wb-muted);
  margin-bottom: 12px;
}
.breadcrumb a { color: var(--wb-muted); }
.breadcrumb a:hover { color: var(--wb-accent); }
.breadcrumb .sep { color: var(--wb-muted-2); font-size: 11px; }
.breadcrumb .crumb-current { color: var(--wb-text); font-weight: 600; }

.topic-head {
  display: flex; gap: 14px; align-items: center; justify-content: space-between;
  background: var(--wb-surface);
  border: 1px solid var(--wb-border);
  border-radius: var(--radius-lg);
  padding: 16px 20px; margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
}
.topic-head-left { display: flex; align-items: center; gap: 14px; }
.topic-head h2 { font-size: 20px; font-weight: 800; letter-spacing: -.025em; }
.muted { color: var(--wb-muted); font-size: 12.5px; }

.topic-filter {
  padding: 8px 14px; border-radius: 7px;
  border: 1px solid var(--wb-border-2); background: var(--wb-surface);
  font-size: 13.5px; min-width: 240px; outline: none; color: var(--wb-text);
}
.topic-filter:focus { border-color: var(--wb-accent-2); box-shadow: 0 0 0 3px rgba(109,40,217,.1); }

.subtopic-block {
  background: var(--wb-surface); border: 1px solid var(--wb-border);
  border-radius: var(--radius); margin-bottom: 10px; overflow: hidden;
}
.subtopic-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px; cursor: pointer;
  background: var(--wb-surface-2);
  border-bottom: 1px solid var(--wb-divider);
  user-select: none;
}
.subtopic-head:hover { background: var(--wb-border); }
.subtopic-head h4 {
  margin: 0; font-size: 13.5px; color: var(--wb-text); font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.subtopic-count {
  font-size: 11px; color: var(--wb-muted);
  background: var(--wb-surface);
  padding: 1px 8px; border-radius: 99px;
  border: 1px solid var(--wb-border-2); font-weight: 600;
}
.caret {
  width: 8px; height: 8px; flex: none;
  border-right: 1.8px solid var(--wb-muted);
  border-bottom: 1.8px solid var(--wb-muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform .18s;
}
.subtopic-block.collapsed .caret { transform: rotate(-45deg) translateY(2px); }
.subtopic-block.collapsed .subtopic-list { display: none; }

.subtopic-list { list-style: none; }
.subtopic-list li { border-bottom: 1px solid var(--wb-divider); }
.subtopic-list li:last-child { border-bottom: 0; }
.subtopic-list a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; color: var(--wb-text-2); font-size: 13.5px; gap: 10px;
}
.subtopic-list a:hover { background: var(--wb-surface-2); color: var(--wb-text); }

/* ── Article view ────────────────────────────────────────── */
.article-head {
  background: var(--wb-surface);
  border: 1px solid var(--wb-border);
  border-radius: 16px;
  padding: 14px 18px 8px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-xs);
}
.article-breadcrumb {
  font-size: 11.5px;
  margin-bottom: 4px;
  color: var(--wb-muted);
}
.article-breadcrumb a { color: var(--wb-muted); }
.article-breadcrumb .crumb-current { display: none; }
.article-title {
  font-size: 20px;
  letter-spacing: -.03em;
  line-height: 1.2;
  font-weight: 800;
  color: var(--wb-text);
  margin: 0 0 3px;
}
.article-meta {
  font-size: 11.5px;
  color: var(--wb-muted);
  margin: 0 0 8px;
}
.article-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px solid var(--wb-divider);
  margin-top: 4px;
}
.art-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent;
  color: var(--wb-text-2);
  border: 0;
  padding: 6px 9px;
  border-radius: 6px;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.art-btn svg { width: 15px; height: 15px; flex: none; }
.art-btn:hover { background: var(--wb-border); color: var(--wb-text); }
.art-btn.active { background: var(--wb-accent); color: #fff; }
.art-btn.active:hover { opacity: .92; }
.art-btn-sm {
  padding: 6px 8px; font-size: 11px; font-weight: 800;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  min-width: 30px; justify-content: center;
}
.art-btn-group {
  display: inline-flex; gap: 0;
  border: 1px solid var(--wb-border); border-radius: 6px;
  overflow: hidden; margin-left: auto;
  background: var(--wb-surface);
}
.art-btn-group .art-btn { border-radius: 0; }
.art-btn-group .art-btn + .art-btn { border-left: 1px solid var(--wb-border); }

.article-frame-wrap {
  position: relative;
  background: var(--wb-surface);
  border: 1px solid var(--wb-border);
  border-radius: var(--radius);
  overflow: hidden;
}
#article-frame {
  width: 100%;
  height: calc(100vh - var(--top-h) - 220px);
  border: 0; background: var(--wb-surface);
  min-height: 500px;
  display: block;
}

.article-load-error {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--wb-surface);
  padding: 32px 20px;
  z-index: 2;
}
.article-load-error .ale-inner {
  max-width: 420px; text-align: center;
}
.article-load-error .ale-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--wb-surface-2);
  color: var(--wb-muted);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
}
.article-load-error h3 {
  font-size: 17px; font-weight: 700;
  color: var(--wb-text); margin-bottom: 8px;
}
.article-load-error p {
  font-size: 13.5px; color: var(--wb-muted);
  line-height: 1.55; margin-bottom: 18px;
}
.article-load-error .ale-actions {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
}

.note-panel {
  background: #fffdf3; border: 1px solid #f0de78;
  border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
}
.note-panel textarea {
  width: 100%; min-height: 100px; resize: vertical;
  border: 1px solid #ddd170; border-radius: 6px;
  background: #fff; padding: 10px 12px;
  font-family: inherit; font-size: 14px; outline: none;
}
.note-panel-actions { display: flex; gap: 7px; margin-top: 10px; }

/* ── Favoritos / Notas ───────────────────────────────────── */
.simple-head { margin-bottom: 20px; }
.simple-head h2 { font-size: 22px; font-weight: 800; letter-spacing: -.03em; margin-bottom: 4px; }

.fav-item, .note-item {
  background: var(--wb-surface); border: 1px solid var(--wb-border);
  border-radius: var(--radius); padding: 13px 16px;
  margin-bottom: 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.fav-item a, .note-item a { font-weight: 600; color: var(--wb-text); }
.fav-item a:hover, .note-item a:hover { color: var(--wb-accent); }
.note-preview {
  display: block; color: var(--wb-muted); font-size: 13px;
  margin-top: 3px; max-height: 3.6em; overflow: hidden;
  white-space: pre-wrap;
}
.empty-state {
  text-align: center; padding: 56px 20px; color: var(--wb-muted);
}
.empty-state svg { width: 36px; height: 36px; opacity: .4; display: block; margin: 0 auto 12px; }
.empty-state h3 { margin-bottom: 4px; color: var(--wb-text-2); }

/* ── Loading overlay ─────────────────────────────────────── */
.loading {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(244,245,247,.88);
  display: grid; place-items: center;
  backdrop-filter: blur(3px);
}
.spinner {
  width: 32px; height: 32px;
  border: 2.5px solid var(--wb-border-2);
  border-top-color: var(--wb-accent);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }


/* ── Dark mode ───────────────────────────────────────────── */
body.dark {
  --wb-bg:        #111119;
  --wb-surface:   #1a1a2e;
  --wb-surface-2: #212138;
  --wb-border:    #30304c;
  --wb-border-2:  #3c3c5c;
  --wb-divider:   #262640;
  --wb-text:      #eaeaf4;
  --wb-text-2:    #b8b8d4;
  --wb-muted:     #7878a8;
  --wb-muted-2:   #505080;
}
body.dark .side-link.active { background: rgba(91,33,182,.2); }
body.dark .topic-filter { color: var(--wb-text); }
body.dark #article-frame { background: var(--wb-surface); }
body.dark .section-head { border-bottom-color: var(--wb-divider); }

/* Dark mode toggle icon visibility */
#btn-dark .icon-sun { display: none; }
#btn-dark .icon-moon { display: block; }
body.dark #btn-dark .icon-sun { display: block; }
body.dark #btn-dark .icon-moon { display: none; }

/* ── Reading / focus mode ────────────────────────────────── */
body.reading-mode .sidebar { display: none; }
body.reading-mode .wb-layout { grid-template-columns: 1fr; }
body.reading-mode #article-frame {
  height: calc(100vh - var(--top-h) - 140px);
}

/* ── Typeahead suggestions ───────────────────────────────── */
.top-search { position: relative; }
.sug-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--wb-surface);
  border: 1px solid var(--wb-border-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow-m);
  z-index: 200; overflow: hidden;
  max-height: 320px; overflow-y: auto;
}
.sug-item {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; padding: 9px 14px;
  border-bottom: 1px solid var(--wb-divider);
  color: var(--wb-text); font-size: 13.5px;
  transition: background .1s;
}
.sug-item:last-child { border-bottom: 0; }
.sug-item:hover { background: var(--wb-surface-2); }
.sug-title { font-weight: 600; flex: 1; min-width: 0; }
.sug-meta { font-size: 11.5px; color: var(--wb-muted); white-space: nowrap; }
.sug-title mark {
  background: rgba(232,21,125,.12); color: var(--wb-accent);
  font-weight: 700; border-radius: 2px;
}

/* ── Category filter select ──────────────────────────────── */
.cat-filter-select {
  font-size: 11.5px; font-family: inherit;
  border: 1px solid var(--wb-border-2);
  border-radius: 5px; padding: 3px 7px;
  background: var(--wb-surface); color: var(--wb-text);
  cursor: pointer; outline: none;
}
.cat-filter-select:focus { border-color: var(--wb-accent-2); }

/* ── Article tags row ────────────────────────────────────── */
.article-tags-row {
  margin-bottom: 10px;
}
.tags-row-inner {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.tag-pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--wb-surface-2);
  border: 1px solid var(--tag-c, var(--wb-accent-2));
  color: var(--tag-c, var(--wb-accent-2));
  padding: 2px 8px; border-radius: 99px;
  font-size: 12px; font-weight: 600;
}
.tag-remove {
  background: transparent; border: 0; cursor: pointer;
  color: inherit; opacity: .6; font-size: 14px; line-height: 1;
  padding: 0 1px;
}
.tag-remove:hover { opacity: 1; }
.tag-add-form { display: inline-flex; }
.tag-input {
  border: 1px dashed var(--wb-border-2); background: transparent;
  border-radius: 99px; padding: 2px 10px;
  font-size: 12px; font-family: inherit; color: var(--wb-muted);
  outline: none; width: 130px;
}
.tag-input:focus { border-color: var(--wb-accent-2); color: var(--wb-text); width: 160px; }

/* ── Tags view ───────────────────────────────────────────── */
.tags-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.tag-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 14px 16px;
  background: var(--wb-surface); border: 1px solid var(--wb-border);
  border-radius: var(--radius);
  border-left: 4px solid var(--tag-c, var(--wb-accent));
  transition: box-shadow .16s, transform .16s;
}
.tag-card:hover { box-shadow: var(--shadow-m); transform: translateY(-1px); }
.tag-card-icon { font-size: 18px; font-weight: 900; color: var(--tag-c, var(--wb-accent)); }
.tag-card-name { font-weight: 700; font-size: 14px; color: var(--wb-text); }
.tag-card-count { font-size: 12px; color: var(--wb-muted); }

/* ── Collections panel (in article view) ─────────────────── */
.col-panel {
  background: var(--wb-surface-2); border: 1px solid var(--wb-border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
}
.col-panel-label {
  font-size: 12px; font-weight: 700; color: var(--wb-muted);
  text-transform: uppercase; letter-spacing: .08em;
  margin-bottom: 10px;
}
.col-check-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 4px; cursor: pointer; border-radius: 6px;
  font-size: 13.5px;
}
.col-check-row:hover { background: var(--wb-border); }
.col-check-row input { cursor: pointer; accent-color: var(--wb-accent-2); }
.col-check-row .muted { margin-left: auto; }
.col-empty { color: var(--wb-muted); font-size: 13px; padding: 4px; }
.col-new-row {
  display: flex; gap: 8px; margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--wb-divider);
}
.col-new-row input {
  flex: 1; border: 1px solid var(--wb-border-2); border-radius: 6px;
  padding: 6px 10px; font-family: inherit; font-size: 13.5px;
  background: var(--wb-surface); color: var(--wb-text); outline: none;
}
.col-new-row input:focus { border-color: var(--wb-accent-2); }

/* ── Simple head row ─────────────────────────────────────── */
.simple-head-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 4px;
}
.simple-head-row h2 { font-size: 22px; letter-spacing: -.01em; }

/* ── Sidebar extras ──────────────────────────────────────── */
.side-link-article { align-items: flex-start; }
.side-dot {
  width: 6px; height: 6px; border-radius: 50%;
  flex-shrink: 0; margin-top: 6px;
}
.side-link-truncate {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; font-size: 12.5px;
}

.sidebar-footer {
  margin-top: 24px; padding: 10px 8px 0;
  border-top: 1px solid var(--wb-divider);
}
.version-info {
  display: flex; flex-direction: column; gap: 2px;
  font-size: 11px; color: var(--wb-muted-2);
}

/* ── Load more button ────────────────────────────────────── */
.load-more-btn {
  width: 100%; padding: 10px; text-align: center;
  background: var(--wb-surface-2); border: 0;
  border-top: 1px solid var(--wb-divider);
  font-size: 13px; color: var(--wb-accent-2);
  cursor: pointer; font-family: inherit; font-weight: 600;
}
.load-more-btn:hover { background: var(--wb-border); }

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(10px);
  background: var(--wb-text); color: var(--wb-surface);
  padding: 9px 20px; border-radius: 99px;
  font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow-m); z-index: 500;
  opacity: 0; transition: opacity .2s, transform .2s;
  white-space: nowrap;
}
.toast.toast-visible {
  opacity: 1; transform: translateX(-50%) translateY(0);
}

/* ── Font size only buttons ──────────────────────────────── */
.btn-icon-only {
  padding: 8px 10px; font-size: 12px; font-weight: 800;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  min-width: 36px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1060px) {
  .cards-3 { grid-template-columns: repeat(2, 1fr); }
  .tags-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  :root { --top-h: 56px; }
  .wb-top {
    gap: 6px; padding: 0 8px;
    max-width: 100vw; overflow: visible;
  }
  .top-nav { display: none; }
  .kbd-hint { display: none; }
  .top-spacer { display: none; }
  .brand-logo { height: 22px; }
  .wb-layout { grid-template-columns: 1fr; max-width: 100vw; }
  body.sidebar-collapsed .wb-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: var(--top-h);
    width: 280px !important; max-width: 88%;
    height: calc(100vh - var(--top-h));
    opacity: 1 !important; pointer-events: auto !important;
    transform: translateX(-100%);
    transition: transform .22s ease;
    z-index: 90; box-shadow: var(--shadow-m); overflow-y: auto;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open::after {
    content: ''; position: fixed; inset: var(--top-h) 0 0 0;
    background: rgba(17,24,39,.3); z-index: 80;
  }
  body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
  .main { padding: 14px 12px 80px; max-width: 100vw; overflow-x: hidden; }
  .top-search { flex: 1 1 auto; min-width: 0; }
  .topic-head { flex-direction: column; align-items: stretch; }
  .topic-filter { width: 100%; min-width: 0; }
  .tags-grid { grid-template-columns: repeat(2, 1fr); }
  .simple-head-row { flex-direction: column; align-items: flex-start; }

  /* Hide some top actions on mobile to make room for search */
  .top-actions .icon-btn[aria-label="Notificações"] { display: none; }

  /* Article head adjustments */
  .article-title { font-size: 19px; }
  .article-actions {
    gap: 2px;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .article-actions::-webkit-scrollbar { display: none; }
  .art-btn { padding: 8px 10px; font-size: 12px; white-space: nowrap; flex: none; }
  .art-btn-group { margin-left: 0; }

  /* Tap targets maiores */
  .side-link { padding: 10px 10px; min-height: 44px; }
  .icon-btn { width: 38px; height: 38px; }
  .nav-link { padding: 8px 12px; min-height: 44px; }
  .card-tile { padding: 14px 14px; }

  #article-frame { height: calc(100vh - var(--top-h) - 260px); }

  .search-results,
  .sug-dropdown {
    position: fixed;
    top: calc(var(--top-h) + 8px);
    left: 10px;
    right: 10px;
    width: auto;
    max-height: min(62vh, calc(100vh - var(--top-h) - 20px));
    border-radius: 18px;
    z-index: 220;
  }
  #search-results-list,
  .sug-dropdown {
    max-height: min(56vh, calc(100vh - var(--top-h) - 72px));
  }
  .search-hit,
  .sug-item {
    padding: 13px 14px;
  }
  .search-hit .sh-title,
  .sug-title {
    font-size: 14px;
  }
  .search-hit .sh-meta,
  .sug-meta {
    font-size: 11.5px;
  }
}
@media (max-width: 520px) {
  .cards-3 { grid-template-columns: 1fr; }
  .tags-grid { grid-template-columns: 1fr; }
  .banner { padding: 20px 16px; }
  .banner h2 { font-size: 17px; }
  .banner p { display: none; }

  /* Top bar compacto */
  .wb-top { padding: 0 6px; gap: 4px; height: 52px; overflow: visible; }
  :root { --top-h: 52px; }
  .menu-btn { width: 36px; height: 36px; }
  .top-search {
    flex: 1 1 auto;
    min-width: 0;
    height: 34px;
    padding: 0 8px 0 30px;
  }
  .top-search .search-icon { left: 8px; width: 14px; height: 14px; }
  .top-search input { font-size: 13px; }
  .top-actions { gap: 0; flex: none; }
  .top-actions .icon-btn { width: 36px; height: 36px; }
  .top-actions .icon-btn.avatar { display: none; }

  /* Main sem padding lateral excessivo */
  .main { padding: 10px 10px 80px; }

  /* Conteúdo do artigo não vaza */
  .article-head { padding: 12px 14px 7px; border-radius: 14px; }
  .article-title { font-size: 17px; }
  .article-frame-wrap { overflow-x: hidden; }
  #article-frame { max-width: 100%; height: calc(100vh - var(--top-h) - 240px); }

  .search-results,
  .sug-dropdown {
    left: 8px;
    right: 8px;
    top: calc(var(--top-h) + 8px);
    border-radius: 16px;
  }
  .search-results-head {
    padding: 10px 12px;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  .search-results-head strong { width: 100%; }

  /* Calculadoras */
  .calc-grid { grid-template-columns: 1fr !important; }
  .calc-result { font-size: 15px; }
}
@media (max-width: 860px) {
  body { padding-bottom: 88px; background: linear-gradient(180deg, #160828 0 200px, var(--wb-bg) 200px 100%); }
  body.dark { background: var(--wb-bg); }
  body[data-view="topic"], body[data-view="article"], body[data-view="favoritos"], body[data-view="historico"], body[data-view="notas"], body[data-view="tags"], body[data-view="tag-detail"], body[data-view="colecoes"], body[data-view="colecao-detail"] { background: var(--wb-bg); }
  .home-mobile-hero { display: block; color: #fff; padding: 8px 2px 14px; }
  .home-mobile-greeting { font-size: 16px; font-weight: 500; letter-spacing: -.025em; opacity: .9; }
  .home-search-trigger { width: 100%; height: 46px; border: 0; border-radius: 12px; background: rgba(255,255,255,.97); color: #4b455e; display: inline-flex; align-items: center; gap: 10px; padding: 0 16px; box-shadow: 0 8px 20px rgba(8,10,32,.2), 0 1px 0 rgba(255,255,255,.5); font-size: 15px; font-weight: 500; letter-spacing: -.01em; }
  .home-search-trigger svg { width: 17px; height: 17px; color: #807b94; }
  .wbplus, .home-section { background: var(--wb-surface); border-radius: 20px; padding: 8px 12px 14px; margin-bottom: 12px; box-shadow: 0 8px 24px rgba(18,23,38,.05); }
  .cards-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .view-home .card-tile { min-height: 100px; border: 1px solid var(--wb-border); border-radius: 14px; padding: 14px 12px; align-items: flex-start; box-shadow: 0 4px 12px rgba(15,23,42,.04); }
  .view-home .card-count { position: absolute; top: 12px; right: 12px; font-size: 10.5px; padding: 2px 7px; }
  .mobile-tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end; gap: 4px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 280; padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.97); border-top: 1px solid rgba(15,23,42,.07); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: 0 -1px 0 rgba(15,23,42,.06), 0 -8px 24px rgba(15,23,42,.04); }
  body.dark .mobile-tabbar { background: rgba(26,26,46,.97); border-top-color: rgba(255,255,255,.06); box-shadow: 0 -1px 0 rgba(255,255,255,.05); }
  .mobile-tab { border: 0; background: transparent; color: #8b8799; display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 52px; justify-content: center; font-size: 10.5px; font-weight: 500; letter-spacing: -.01em; }
  .mobile-tab svg { width: 18px; height: 18px; stroke-width: 1.8; }
  .mobile-tab.active { color: var(--wb-accent); }
  .mobile-tab.active span { font-weight: 700; }
  body.dark .mobile-tab { color: #6868a0; }
  body.dark .mobile-tab.active { color: var(--wb-accent); }
  .mobile-tab-center svg { width: 20px; height: 20px; }
  .mobile-tab[disabled] { opacity: 1; color: #7e739c; }
  .topic-head { background: transparent; border: 0; box-shadow: none; border-radius: 0; padding: 8px 0 0; margin-bottom: 16px; flex-direction: column; align-items: stretch; gap: 14px; }
  .topic-head-actions { gap: 10px; }
  .topic-filter { height: 44px; border-radius: 16px; border-color: #edf0f7; background: #fff; box-shadow: 0 10px 22px rgba(15,23,42,.05); }
  .topic-subtopics-btn { display: inline-flex; width: 44px; height: 44px; flex: none; border-radius: 15px; box-shadow: 0 10px 22px rgba(15,23,42,.05); }
  .subtopic-block { border-radius: 14px; border-color: var(--wb-border); box-shadow: 0 4px 12px rgba(15,23,42,.04); }
  .subtopic-head { padding: 15px 16px; background: var(--wb-surface); }
  .subtopic-head:hover { background: var(--wb-surface-2); }
  .subtopic-head h4 { font-size: 15px; gap: 10px; font-weight: 700; letter-spacing: -.02em; }
  .subtopic-list a { padding: 14px 16px; font-size: 15px; }
  .topic-subtopics-sheet { display: block; position: fixed; inset: 0; z-index: 260; }
  .topic-subtopics-backdrop { position: absolute; inset: 0; border: 0; background: rgba(16,18,31,.44); }
  .topic-subtopics-panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 72vh; overflow-y: auto; background: #fff; border-radius: 26px 26px 0 0; padding: 18px 20px 26px; box-shadow: 0 -8px 30px rgba(15,23,42,.18); }
  .topic-subtopics-label { font-size: 13px; color: #a3a0b3; margin-bottom: 12px; }
  .topic-subtopic-item { width: 100%; border: 0; background: transparent; text-align: left; padding: 14px 0; border-bottom: 1px solid #f0f0f4; font-size: 16px; color: #2c253e; }
  .topic-subtopic-item:last-child { border-bottom: 0; }
  .article-head { background: transparent; border: 0; box-shadow: none; border-radius: 0; padding: 8px 0 6px; margin-bottom: 0; }
  .article-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
  .article-meta { font-size: 13px; margin-bottom: 8px; }
  .article-actions { gap: 6px; overflow-x: auto; flex-wrap: nowrap; padding-top: 8px; margin-top: 6px; scrollbar-width: none; }
  .article-actions::-webkit-scrollbar { display: none; }
  .art-btn { padding: 8px 10px; border-radius: 999px; background: #fff; border: 1px solid #eceef5; white-space: nowrap; flex: none; box-shadow: 0 6px 14px rgba(15,23,42,.04); }
  .art-btn-group { margin-left: 0; border-radius: 999px; box-shadow: 0 6px 14px rgba(15,23,42,.04); }
  .article-inline-search { margin-bottom: 14px; border-radius: 18px; border-color: #edf0f7; box-shadow: 0 12px 24px rgba(15,23,42,.05); }
  .article-frame-wrap { border: 0; border-radius: 16px; box-shadow: 0 8px 24px rgba(15,23,42,.06); }
  #article-frame { height: calc(100vh - var(--top-h) - 250px); }
  .search-results, .sug-dropdown { border-radius: 20px; }
}
@media (max-width: 520px) {
  .cards-3, .tags-grid { grid-template-columns: 1fr; }
  .home-mobile-greeting { font-size: 15px; }
  .home-search-trigger { height: 44px; font-size: 15px; }
  .topic-filter { height: 42px; border-radius: 14px; font-size: 13.5px; }
  .topic-subtopics-btn { width: 42px; height: 42px; border-radius: 14px; }
  .article-title { font-size: 17px; }
  .article-meta { font-size: 12px; }
  .article-inline-search { padding: 10px 12px; border-radius: 16px; }
  #article-frame { height: calc(100vh - var(--top-h) - 232px); }
  .mobile-tab { font-size: 10.5px; }
}
@media print {
  .wb-top, .sidebar, .article-actions, .note-panel { display: none !important; }
  .main { padding: 0; }
  .article-frame-wrap { border: 0; box-shadow: none; }
  #article-frame { height: auto; }
}

/* =========================================================
   NEW FEATURES — modal, transitions, read badges, backup,
   profile stats, recent searches, view filters, tag input
   ========================================================= */

/* ── View fade transition ─────────────────────────────── */
@keyframes wb-view-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.view-entering { animation: wb-view-in .18s ease-out both; }

/* ── Read badges ──────────────────────────────────────── */
.read-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--wb-accent-2);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
  margin-left: 6px;
  line-height: 1;
}
.read-badge-inline {
  display: inline;
  font-size: 11px;
  color: var(--wb-accent-2);
  font-weight: 600;
}
.article-read > a { color: var(--wb-muted); }
.subtopic-list li.article-read > a { opacity: .75; }
.search-hit-read .sh-title { color: var(--wb-muted); }

/* ── Sidebar backup row ───────────────────────────────── */
.sidebar-backup-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.btn-xs {
  font-size: 11px;
  padding: 4px 10px;
  height: auto;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.btn-xs svg { width: 12px; height: 12px; flex-shrink: 0; }

/* ── Danger button ────────────────────────────────────── */
.btn-danger {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

/* ── Profile stats grid ───────────────────────────────── */
.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 4px 0 8px;
}
.ps-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  background: var(--wb-surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--wb-border);
}
.ps-num {
  font-size: 22px;
  font-weight: 800;
  color: var(--wb-accent-2);
  line-height: 1;
}
.ps-label {
  font-size: 11px;
  color: var(--wb-muted);
  font-weight: 500;
}

/* ── Recent searches in suggestions dropdown ──────────── */
.sug-recents-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px 4px;
  font-size: 11px;
  color: var(--wb-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.sug-clear-recents {
  background: none;
  border: none;
  font-size: 11px;
  color: var(--wb-link);
  cursor: pointer;
  padding: 0;
}
.sug-clear-recents:hover { text-decoration: underline; }
.sug-item-recent { background: none; border: none; width: 100%; text-align: left; cursor: pointer; }
.sug-recent-icon { width: 14px; height: 14px; flex-shrink: 0; color: var(--wb-muted-2); }

/* ── View filter inputs (favorites / notes / history / collections) */
.view-filter-row {
  padding: 0 0 14px;
}
.view-filter {
  width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--wb-border);
  border-radius: var(--radius);
  background: var(--wb-surface);
  color: var(--wb-text);
  font-size: 14px;
  outline: none;
  box-shadow: var(--shadow-xs);
  box-sizing: border-box;
}
.view-filter:focus { border-color: var(--wb-accent-2); box-shadow: 0 0 0 3px rgba(109,40,217,.12); }

/* ── Tag input form in article view ───────────────────── */
.tag-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
}
.tag-add-row input {
  flex: 1;
  padding: 7px 12px;
  border: 1px solid var(--wb-border);
  border-radius: var(--radius-sm);
  background: var(--wb-surface);
  color: var(--wb-text);
  font-size: 13px;
  outline: none;
  min-width: 0;
}
.tag-add-row input:focus { border-color: var(--wb-accent-2); box-shadow: 0 0 0 2px rgba(109,40,217,.1); }
.tag-add-row .btn { flex-shrink: 0; font-size: 13px; padding: 7px 14px; }

/* ── Collection rename button ─────────────────────────── */
#btn-rename-col { font-size: 13px; }

/* ── Custom modal system ──────────────────────────────── */
#wb-modal-root { position: fixed; inset: 0; pointer-events: none; z-index: 9000; }

.wb-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16,18,31,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  pointer-events: all;
  opacity: 0;
  transition: opacity .2s ease;
  z-index: 9001;
  backdrop-filter: blur(3px);
}
.wb-modal-overlay.wb-modal-visible { opacity: 1; }

.wb-modal-box {
  background: var(--wb-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.28), 0 4px 12px rgba(0,0,0,.12);
  max-width: 440px;
  width: 100%;
  overflow: hidden;
  transform: scale(.94) translateY(8px);
  transition: transform .2s ease, opacity .2s ease;
  opacity: 0;
}
.wb-modal-visible .wb-modal-box {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.wb-modal-title {
  padding: 18px 20px 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--wb-text);
}
.wb-modal-body {
  padding: 12px 20px 8px;
  font-size: 14px;
  color: var(--wb-text-2);
  line-height: 1.55;
}
.wb-modal-body p { margin: 0 0 6px; }
.wb-modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 8px 20px 18px;
}
.wb-modal-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--wb-border);
  border-radius: var(--radius-sm);
  background: var(--wb-bg);
  color: var(--wb-text);
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
  margin-top: 4px;
}
.wb-modal-input:focus { border-color: var(--wb-accent-2); box-shadow: 0 0 0 3px rgba(109,40,217,.12); }

/* ── Notification toast (modal.js notify) ─────────────── */
.wb-notify {
  position: fixed;
  bottom: 24px;
  right: 20px;
  background: var(--wb-text);
  color: var(--wb-surface);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-m);
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .22s ease, transform .22s ease;
  z-index: 9100;
  max-width: 320px;
}
.wb-notify.wb-notify-visible { opacity: 1; transform: translateY(0); }
.wb-notify-success { background: #166534; }
.wb-notify-error   { background: #991b1b; }
.wb-notify-warning { background: #92400e; }

/* ── Dark mode overrides ──────────────────────────────── */
body.dark .wb-modal-box { background: #1e1e32; box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 4px 12px rgba(0,0,0,.4); }
body.dark .wb-modal-title { color: #e8e8f0; }
body.dark .wb-modal-body { color: #b8b8d0; }
body.dark .wb-modal-input { background: #14142a; border-color: #2e2e48; color: #e8e8f0; }
body.dark .wb-modal-input:focus { border-color: #c4b5fd; box-shadow: 0 0 0 3px rgba(196,181,253,.15); }
body.dark .wb-modal-overlay { background: rgba(8,8,20,.72); }
body.dark .ps-item { background: #1a1a2e; border-color: #2e2e48; }
body.dark .view-filter { background: #1a1a2e; border-color: #2e2e48; color: #e8e8f0; }
body.dark .view-filter:focus { border-color: #c4b5fd; box-shadow: 0 0 0 3px rgba(196,181,253,.12); }
body.dark .tag-add-row input { background: #1a1a2e; border-color: #2e2e48; color: #e8e8f0; }
body.dark .wb-notify { background: #e8e8f0; color: #111827; }
body.dark .read-badge { background: #7c3aed; }
body.dark .btn-danger { background: #991b1b; border-color: #991b1b; }
body.dark .btn-danger:hover { background: #7f1d1d; border-color: #7f1d1d; }

/* =========================================================
   BOTTOM SHEETS + VISUAL IMPROVEMENTS v2
   ========================================================= */

/* ── Bottom sheet system ──────────────────────────────── */
.wb-sheet {
  position: fixed; inset: 0; z-index: 700;
  display: flex; flex-direction: column; justify-content: flex-end;
  pointer-events: none;
}
.wb-sheet.wb-sheet-open { pointer-events: all; }

.wb-sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(16,18,31,.52);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity .28s ease;
  cursor: pointer;
}
.wb-sheet-open .wb-sheet-backdrop { opacity: 1; }

.wb-sheet-panel {
  position: relative;
  background: var(--wb-surface);
  border-radius: 20px 20px 0 0;
  max-height: 85vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.32,1,.23,1);
  padding-bottom: max(env(safe-area-inset-bottom), 12px);
  box-shadow: 0 -8px 40px rgba(0,0,0,.16);
}
.wb-sheet-open .wb-sheet-panel { transform: translateY(0); }

.wb-sheet-handle {
  width: 36px; height: 4px;
  background: var(--wb-border-2);
  border-radius: 2px;
  margin: 10px auto 0;
}
.wb-sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px 6px;
}
.wb-sheet-title {
  font-size: 16px; font-weight: 700; color: var(--wb-text);
}
.wb-sheet-body { padding: 8px 20px 16px; }
.wb-sheet-actions {
  display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px;
}

#sheet-note .wb-sheet-body textarea {
  width: 100%; box-sizing: border-box;
  min-height: 140px; max-height: 38vh; resize: vertical;
  border: 1px solid var(--wb-border); border-radius: var(--radius-sm);
  background: var(--wb-surface-2); padding: 12px;
  font-family: inherit; font-size: 14px; line-height: 1.55;
  outline: none; color: var(--wb-text);
}
#sheet-note .wb-sheet-body textarea:focus {
  border-color: var(--wb-accent-2); box-shadow: 0 0 0 3px rgba(109,40,217,.1);
}

.font-sheet-controls {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 0 4px;
}
.font-btn-ctrl { min-width: 80px; font-size: 18px; font-weight: 700; }
.font-size-label {
  flex: 1; text-align: center;
  font-size: 15px; font-weight: 600; color: var(--wb-text-2);
}

/* ── Fix article frame — no more magic calc ───────────── */
#article-frame {
  width: 100%;
  height: calc(100dvh - var(--top-h) - 172px);
  min-height: 400px;
  border: 0; background: var(--wb-surface); display: block;
}
@media (max-width: 860px) {
  #article-frame { height: calc(100dvh - var(--top-h) - 210px); min-height: 300px; }
}
@media (max-width: 520px) {
  #article-frame { height: calc(100dvh - var(--top-h) - 190px); min-height: 260px; }
}

/* ── Related articles ─────────────────────────────────── */
.related-articles {
  margin-top: 20px;
  border-top: 1px solid var(--wb-divider);
  padding-top: 16px;
}
.related-title {
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--wb-muted); margin: 0 0 10px;
}
.related-list {
  list-style: none; margin: 0; padding: 0;
}
.related-list li { border-bottom: 1px solid var(--wb-divider); }
.related-list li:last-child { border-bottom: 0; }
.related-list a {
  display: block; padding: 10px 0;
  font-size: 14px; color: var(--wb-link); text-decoration: none;
  transition: color .15s;
}
.related-list a:hover { color: var(--wb-accent-2); }

/* ── Article prev/next navigation ────────────────────── */
.article-nav {
  margin-top: 16px;
  padding: 12px 0 24px;
  border-top: 1px solid var(--wb-divider);
}
.art-nav-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
.art-nav-btn {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--wb-link); text-decoration: none;
  padding: 8px 12px; border-radius: var(--radius-sm);
  background: var(--wb-surface-2); border: 1px solid var(--wb-border);
  transition: background .15s, color .15s;
  min-width: 0;
}
.art-nav-btn:hover { background: var(--wb-border); color: var(--wb-text); }
.art-nav-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.art-nav-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.art-nav-next { justify-content: flex-end; flex-direction: row-reverse; }
.art-nav-count {
  font-size: 11px; color: var(--wb-muted); white-space: nowrap;
  text-align: center; padding: 0 4px;
}

/* ── Topic cards — stronger color presence ────────────── */
.card-tile { position: relative; overflow: hidden; }
.card-tile::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--wb-border);
  transition: background .2s;
}
.card-tile[data-color="orange"]::before { background: var(--t-orange); }
.card-tile[data-color="red"]::before    { background: var(--t-red); }
.card-tile[data-color="pink"]::before   { background: var(--t-pink); }
.card-tile[data-color="purple"]::before { background: var(--t-purple); }
.card-tile[data-color="teal"]::before   { background: var(--t-teal); }
.card-tile[data-color="green"]::before  { background: var(--t-green); }
.card-tile[data-color="blue"]::before   { background: var(--t-blue); }

/* ── Article list — better read badge spacing ─────────── */
.subtopic-list a {
  display: flex; align-items: center; gap: 8px;
}
.subtopic-list a span:first-child { flex: 1; min-width: 0; }
.subtopic-list .read-badge { flex-shrink: 0; }
.subtopic-list .chev { flex-shrink: 0; color: var(--wb-muted-2); font-size: 16px; }

/* ── Empty states — bigger, more readable ─────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 64px 20px 48px;
}
.empty-state svg { width: 52px; height: 52px; stroke: var(--wb-border-2); margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; font-weight: 700; color: var(--wb-text-2); margin: 0 0 8px; }
.empty-state p.muted { font-size: 14px; line-height: 1.55; max-width: 280px; margin: 0; }

/* ── Search keyboard focus ────────────────────────────── */
.sug-item-focused { background: var(--wb-surface-2) !important; outline: none; }

/* ── Keyboard nav hint in search ─────────────────────── */
.sug-kb-hint {
  padding: 6px 14px 8px;
  font-size: 11px; color: var(--wb-muted-2);
  border-top: 1px solid var(--wb-divider);
  display: flex; gap: 12px;
}

/* ── Dark mode for sheets ─────────────────────────────── */
body.dark .wb-sheet-panel {
  background: var(--wb-surface);
  box-shadow: 0 -8px 40px rgba(0,0,0,.6);
}
body.dark .wb-sheet-handle { background: var(--wb-border-2); }
body.dark .wb-sheet-backdrop { background: rgba(4,4,12,.75); }
body.dark .wb-sheet-title { color: var(--wb-text); }
body.dark #sheet-note .wb-sheet-body textarea {
  background: var(--wb-bg); border-color: var(--wb-border); color: var(--wb-text);
}
body.dark .art-nav-btn { background: var(--wb-surface-2); border-color: var(--wb-border); color: var(--wb-muted); }
body.dark .art-nav-btn:hover { background: var(--wb-border); color: var(--wb-text); }
body.dark .related-articles { border-top-color: var(--wb-divider); }
body.dark .article-nav { border-top-color: var(--wb-divider); }
body.dark .related-list li { border-bottom-color: var(--wb-divider); }
body.dark .subtopic-block { border-color: var(--wb-border); }
body.dark .subtopic-head { background: var(--wb-surface); }
body.dark .subtopic-head:hover { background: var(--wb-surface-2); }
body.dark .article-frame-wrap { box-shadow: none; border-color: var(--wb-border); }
body.dark .wbplus, body.dark .home-section { background: var(--wb-surface); box-shadow: 0 4px 16px rgba(0,0,0,.2); }
body.dark .view-home .card-tile { border-color: var(--wb-border); box-shadow: none; background: var(--wb-surface); }

/* ── Mobile dark mode: fix hard-coded light colors ─────── */
body.dark .topic-filter {
  background: var(--wb-surface) !important;
  border-color: var(--wb-border) !important;
  color: var(--wb-text) !important;
}
body.dark .topic-subtopics-panel {
  background: var(--wb-surface) !important;
  box-shadow: 0 -8px 30px rgba(0,0,0,.5) !important;
}
body.dark .topic-subtopics-label { color: var(--wb-muted) !important; }
body.dark .topic-subtopic-item {
  color: var(--wb-text) !important;
  border-bottom-color: var(--wb-divider) !important;
}
body.dark .art-btn {
  background: var(--wb-surface-2) !important;
  border-color: var(--wb-border) !important;
  color: var(--wb-text-2) !important;
}
body.dark .art-btn.active {
  background: var(--wb-accent) !important;
  border-color: var(--wb-accent) !important;
  color: #fff !important;
}
body.dark .art-btn-group {
  background: var(--wb-surface) !important;
  border-color: var(--wb-border) !important;
  box-shadow: none !important;
}
body.dark .topic-subtopics-btn {
  background: var(--wb-surface) !important;
  border-color: var(--wb-border) !important;
  color: var(--wb-text-2) !important;
}
body.dark .home-search-trigger {
  background: var(--wb-surface) !important;
  color: var(--wb-text-2) !important;
  box-shadow: 0 4px 12px rgba(0,0,0,.3) !important;
}

/* ── Swipe hint indicator (mobile) ───────────────────── */
@media (max-width: 860px) {
  .art-nav-btn { padding: 10px 12px; font-size: 12.5px; }
  .art-nav-count { font-size: 10.5px; }
  .wb-sheet-panel { border-radius: 24px 24px 0 0; }

  /* Mobile note exports row */
  .notes-export-row { display: flex; gap: 8px; flex-wrap: wrap; }
}

/* ── Polish: miscellaneous refinements ─────────────────── */

/* Tighter heading tracking throughout the app */
h1, h2, h3, h4 { letter-spacing: -.02em; }

/* Make fav/history items feel less card-ish on mobile */
@media (max-width: 860px) {
  .fav-item, .note-item {
    border-radius: 12px;
    padding: 14px 16px;
  }
}

/* Dark mode: body background sync */
body.dark { background: var(--wb-bg); }

/* Subtle top accent for brand identity */
.wb-top::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(232,21,125,.3) 30%, rgba(91,33,182,.3) 70%, transparent 100%);
  pointer-events: none;
}

/* Search result and suggestion mark highlight */
.search-hit mark, .sug-title mark {
  background: rgba(232,21,125,.1);
  color: var(--wb-accent);
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 700;
}

/* Subtopic count badge refinement */
.subtopic-count {
  font-size: 10.5px;
  padding: 1px 7px;
}

/* View filter focus color uses accent */
.view-filter:focus { border-color: var(--wb-accent-2); }

/* Smooth scroll for article list */
.subtopic-list { scroll-behavior: smooth; }

/* ══ Article in-article search bar ══════════════════════════ */
.article-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  padding: 7px 12px;
  background: var(--wb-surface);
  border: 1px solid var(--wb-border);
  border-radius: 10px;
  transition: border-color .2s;
}
.article-search-bar:focus-within { border-color: var(--wb-accent-2); }
.article-search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13.5px;
  color: var(--wb-text);
  outline: none;
  min-width: 0;
}
.article-search-bar input::placeholder { color: var(--wb-text-3); }
.art-search-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--wb-text-3);
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
}
.art-search-clear:hover { color: var(--wb-text); }

/* ══ Continuous reading: pulse next button ═══════════════════ */
@keyframes art-nav-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(109,40,217,.35); }
  50%       { box-shadow: 0 0 0 6px rgba(109,40,217,0); }
}
.art-nav-next-pulse {
  animation: art-nav-pulse 1.6s ease-in-out infinite;
  background: var(--wb-accent-2) !important;
  color: #fff !important;
  border-color: transparent !important;
}

/* ══ Voice search button ════════════════════════════════════ */
.voice-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--wb-text-3);
  border-radius: 50%;
  transition: color .15s, background .15s;
  flex-shrink: 0;
}
.voice-btn:hover { color: var(--wb-accent-2); background: var(--wb-surface); }
.voice-btn svg { width: 15px; height: 15px; }
@keyframes voice-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.2); }
}
.voice-btn.voice-listening {
  color: var(--t-red);
  animation: voice-pulse .8s ease-in-out infinite;
}

/* ══ PWA install banner ═════════════════════════════════════ */
.pwa-banner {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 600;
  width: min(calc(100vw - 32px), 480px);
  opacity: 0;
  transition: opacity .28s ease, transform .28s ease;
  pointer-events: none;
}
.pwa-banner.pwa-banner-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.pwa-banner-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--wb-surface);
  border: 1px solid var(--wb-border);
  border-radius: 14px;
  padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  font-size: 13.5px;
  color: var(--wb-text);
}
.pwa-banner-inner span { flex: 1; min-width: 0; }
.pwa-dismiss {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--wb-text-3);
  line-height: 1;
  padding: 0 4px;
  flex-shrink: 0;
}
.pwa-dismiss:hover { color: var(--wb-text); }
@media (min-width: 861px) {
  .pwa-banner { bottom: 24px; }
}

/* ══ Pull-to-refresh indicator ══════════════════════════════ */
.ptr-indicator {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  z-index: 500;
  width: 40px;
  height: 40px;
  background: var(--wb-surface);
  border: 1px solid var(--wb-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
  color: var(--wb-accent-2);
  transition: opacity .2s;
}
.ptr-indicator svg { width: 18px; height: 18px; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }
.ptr-indicator.ptr-loading svg { animation: ptr-spin .7s linear infinite; }

/* ══ Highlight popup ════════════════════════════════════════ */
#wb-hl-popup {
  position: fixed;
  z-index: 800;
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--wb-surface);
  border: 1px solid var(--wb-border);
  border-radius: 10px;
  padding: 6px 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,.2);
}
#wb-hl-popup[hidden] { display: none; }
.wb-hl-color-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .12s, border-color .12s;
}
.wb-hl-color-btn:hover { transform: scale(1.2); border-color: rgba(0,0,0,.25); }
.wb-hl-remove-btn {
  background: none;
  border: 1px solid var(--wb-border);
  border-radius: 6px;
  cursor: pointer;
  color: var(--t-red);
  font-size: 15px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .12s;
}
.wb-hl-remove-btn:hover { background: rgba(239,68,68,.1); }

/* ══ Keyboard shortcuts dialog ══════════════════════════════ */
.kb-shortcuts table { border-collapse: collapse; width: 100%; }
.kb-shortcuts td { padding: 6px 12px; font-size: 13.5px; color: var(--wb-text); }
.kb-shortcuts td:first-child { width: 80px; }
.kb-shortcuts kbd {
  display: inline-block;
  background: var(--wb-surface);
  border: 1px solid var(--wb-border);
  border-radius: 5px;
  padding: 2px 7px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: var(--wb-text);
  box-shadow: 0 1px 0 var(--wb-border);
}

/* ══ Tablet 2-pane layout (861px–1200px) ════════════════════ */
@media (min-width: 861px) and (max-width: 1100px) {
  .sidebar { width: 200px; min-width: 200px; }
  .side-link span:not(.side-dot):not(.side-icon) { font-size: 12px; }
  .side-link { gap: 8px; }
  .side-icon { width: 24px; height: 24px; font-size: 10px; }
}

/* ══ PDF / print improvements ═══════════════════════════════ */
@media print {
  .wb-top, .sidebar, .mobile-tabbar, .article-actions, .article-tags-row,
  .article-search-bar, .article-nav, .related-articles, #wb-modal-root,
  .pwa-banner, .ptr-indicator, #toast { display: none !important; }
  .wb-layout { display: block !important; }
  .main { padding: 0 !important; margin: 0 !important; }
  .article-head { padding: 0 0 12px !important; }
  .article-frame-wrap { height: auto !important; overflow: visible !important; }
  #article-frame { height: 100vh !important; border: none !important; }
}

/* ══ Dark mode: new elements ════════════════════════════════ */
body.dark .article-search-bar {
  background: var(--wb-surface) !important;
  border-color: var(--wb-border) !important;
}
body.dark .article-search-bar input { color: var(--wb-text) !important; }
body.dark .pwa-banner-inner {
  background: var(--wb-surface) !important;
  border-color: var(--wb-border) !important;
}
body.dark #wb-hl-popup {
  background: var(--wb-surface) !important;
  border-color: var(--wb-border) !important;
}
body.dark .ptr-indicator {
  background: var(--wb-surface) !important;
  border-color: var(--wb-border) !important;
}
