:root {
  --bg: #212121;
  --bg-side: #171717;
  --bg-elev: #2f2f2f;
  --bg-hover: #2a2a2a;
  --bg-user: #303030;
  --text: #ececec;
  --muted: #9b9b9b;
  --border: #3a3a3a;
  --accent: #10a37f;
  --accent-text: #fff;
  --danger: #ef4444;
  --warn: #f59e0b;
  --ok: #22c55e;
  --shadow: 0 8px 30px rgba(0, 0, 0, .45);
  --side-w: 280px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-side: #f7f7f8;
  --bg-elev: #f4f4f4;
  --bg-hover: #ececec;
  --bg-user: #f0f0f0;
  --text: #202123;
  --muted: #6b6c72;
  --border: #dcdcdf;
  --shadow: 0 8px 30px rgba(0, 0, 0, .15);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%; overflow: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.only-mobile { display: none; }

/* --- каркас --- */
#app { display: flex; height: 100dvh; }
#sidebar {
  width: var(--side-w); flex: none; background: var(--bg-side); display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); transition: transform .22s ease, margin .22s ease;
  border-right: 1px solid var(--border); z-index: 30;
}
#sidebar.collapsed { margin-left: calc(-1 * var(--side-w)); }
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100dvh; }
#scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 25; }

.side-head { display: flex; gap: 8px; padding: 12px; align-items: center; }
.new-chat {
  flex: 1; text-align: left; padding: 10px 14px; border-radius: 10px; background: transparent;
  border: 1px solid var(--border); font-weight: 500;
}
.new-chat:hover { background: var(--bg-hover); }
.chat-list { flex: 1; overflow-y: auto; padding: 4px 8px; }
.chat-item {
  display: flex; align-items: center; gap: 6px; padding: 9px 10px; border-radius: 10px; cursor: pointer;
  position: relative; margin-bottom: 2px;
}
.chat-item:hover { background: var(--bg-hover); }
.chat-item.active { background: var(--bg-elev); }
.chat-item .ci-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item .ci-pin { color: var(--muted); font-size: 13px; }
.chat-item .ci-actions { display: none; gap: 2px; }
.chat-item:hover .ci-actions, .chat-item.active .ci-actions { display: flex; }
.chat-item .ci-actions button {
  background: transparent; border: 0; padding: 2px 6px; border-radius: 6px; color: var(--muted);
}
.chat-item .ci-actions button:hover { background: var(--bg-hover); color: var(--text); }
.side-sep { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 12px 10px 4px; }
.side-foot { border-top: 1px solid var(--border); padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.side-foot form { margin: 0; }
.side-btn {
  width: 100%; text-align: left; background: transparent; border: 0; padding: 10px; border-radius: 10px;
}
.side-btn:hover { background: var(--bg-hover); }

.topbar {
  display: flex; align-items: center; gap: 8px; padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
  border-bottom: 1px solid var(--border); min-height: 52px;
}
.topbar h1 { font-size: 16px; font-weight: 600; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
  background: transparent; border: 0; border-radius: 10px; min-width: 40px; height: 40px; padding: 0 8px;
  font-size: 18px; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--bg-hover); }
.icon-btn.small { font-size: 13px; min-width: 56px; }

/* --- сообщения --- */
.messages { flex: 1; overflow-y: auto; padding: 16px 0 8px; scroll-behavior: smooth; -webkit-overflow-scrolling: touch; }
.empty { max-width: 720px; margin: 15vh auto 0; text-align: center; padding: 0 20px; color: var(--muted); }
.empty h2 { color: var(--text); font-size: 26px; margin-bottom: 6px; }
.msg { max-width: 760px; margin: 0 auto; padding: 8px 16px; display: flex; flex-direction: column; }
.msg.user { align-items: flex-end; }
.bubble { background: var(--bg-user); padding: 10px 16px; border-radius: 20px; max-width: 85%; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.msg.user .meta { display: flex; align-items: center; gap: 2px; margin-top: 2px; position: relative; }
.msg .edited { font-size: 12px; color: var(--muted); margin-right: 4px; }
.dots-btn { background: transparent; border: 0; color: var(--muted); font-size: 20px; padding: 0 10px; height: 32px; border-radius: 8px; }
.dots-btn:hover { background: var(--bg-hover); color: var(--text); }
.menu {
  position: absolute; right: 0; top: 34px; z-index: 20; min-width: 250px; background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 6px;
}
.menu button, .menu select {
  display: block; width: 100%; text-align: left; background: transparent; border: 0; padding: 10px 12px; border-radius: 8px;
}
.menu button:hover { background: var(--bg-hover); }
.menu select { background: var(--bg); border: 1px solid var(--border); margin-top: 4px; }
.menu .menu-title { font-size: 12px; color: var(--muted); padding: 6px 12px 2px; }

.msg.assistant { align-items: flex-start; flex-direction: row; gap: 12px; }
.avatar { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; display: grid; place-items: center; margin-top: 2px; }
.a-body { flex: 1; min-width: 0; }
.a-text { white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.a-text.error { color: var(--danger); }
.typing { display: inline-flex; gap: 4px; padding: 8px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.edit-box { width: min(100%, 560px); display: flex; flex-direction: column; gap: 8px; }
.edit-box textarea {
  width: 100%; min-height: 80px; resize: vertical; padding: 10px 12px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--bg-elev);
}
.edit-box .row { display: flex; gap: 8px; justify-content: flex-end; }

button.primary, button.ghost, button.danger {
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border); background: transparent; font-weight: 500;
}
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.primary:hover { filter: brightness(1.08); }
button.ghost:hover { background: var(--bg-hover); }
button.danger { color: var(--danger); }
button:disabled { opacity: .5; cursor: default; }

/* --- миниатюры и карточки --- */
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; justify-content: flex-end; }
.msg.assistant .thumbs { justify-content: flex-start; }
.thumb {
  position: relative; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border);
  padding: 0; background: var(--bg-elev);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb::after { content: "🔍"; position: absolute; right: 2px; bottom: 2px; font-size: 11px; background: rgba(0,0,0,.55); border-radius: 6px; padding: 0 3px; }
.thumb.big { width: 84px; height: 84px; }

.card { border: 1px solid var(--border); background: var(--bg-elev); border-radius: 14px; padding: 14px; margin-top: 10px; }
.card h3 { margin: 0 0 6px; font-size: 15px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card .sub { color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.task { padding: 6px 0; border-top: 1px solid var(--border); font-size: 14px; }
.task:first-of-type { border-top: 0; }
.task .err { color: var(--danger); }
.task .ok { color: var(--ok); }
.mark-box { display: flex; gap: 10px; align-items: center; margin: 10px 0; flex-wrap: wrap; }
.mark { font-size: 28px; font-weight: 700; width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--accent); color: #fff; }
.mark.m2 { background: #ef4444; } .mark.m3 { background: #f59e0b; } .mark.m4 { background: #84cc16; } .mark.m5 { background: #22c55e; }
.issues { color: var(--warn); font-size: 14px; margin: 6px 0; }
.pick { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; padding: 10px; border: 1px dashed var(--warn); border-radius: 10px; }
.pick label { font-size: 14px; color: var(--warn); }
.pick select { padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.card-result { margin-top: 10px; font-size: 14px; }
.card-result.ok { color: var(--ok); } .card-result.bad { color: var(--danger); } .card-result.muted { color: var(--muted); }
pre.desc { white-space: pre-wrap; margin: 0; font: inherit; }

.file-card { display: flex; gap: 12px; align-items: center; border: 1px solid var(--border); background: var(--bg-elev); border-radius: 14px; padding: 12px; margin-top: 10px; }
.file-ico { flex: none; width: 44px; height: 52px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px; background: #64748b; }
.file-ico.docx { background: #2b6cd4; } .file-ico.xlsx { background: #1f9d55; } .file-ico.pptx { background: #d9622b; }
.file-info { flex: 1; min-width: 0; }
.file-info .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-info .s { font-size: 13px; color: var(--muted); }
.file-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.file-actions a, .file-actions button {
  text-decoration: none; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: transparent; font-size: 14px; color: var(--text);
}
.file-actions .dl { background: var(--accent); border-color: var(--accent); color: #fff; }
.file-actions a:hover, .file-actions button:hover { filter: brightness(1.1); }

/* --- ввод --- */
.composer-wrap { padding: 8px 12px calc(env(safe-area-inset-bottom) + 8px); max-width: 784px; width: 100%; margin: 0 auto; }
.previews { display: flex; gap: 8px; flex-wrap: wrap; padding: 6px 4px 8px; }
.prev { position: relative; width: 64px; height: 64px; }
.prev img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.prev button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--danger); color: #fff; font-size: 12px; line-height: 1; padding: 0; }
.composer { display: flex; align-items: flex-end; gap: 4px; background: var(--bg-elev); border-radius: 26px; padding: 6px 6px 6px 8px; }
.composer > * { flex-shrink: 0; }
.composer textarea { flex: 1 1 auto; min-width: 0; width: 100%; resize: none; border: 0; outline: 0; background: transparent; padding: 9px 6px; max-height: 200px; line-height: 1.4; }
.send { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--text); color: var(--bg); font-size: 16px; }
.send:disabled { opacity: .3; }
.composer > .composer textarea, .composer > textarea { flex-shrink: 1; }
.mic-btn { position: relative; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--bg-elev); color: var(--text); font-size: 18px; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: transform .12s, background .2s; z-index: 2; }
.mic-btn::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: rgba(229,57,53,.28); z-index: -1; opacity: 0; transform: scale(1); pointer-events: none; }
.mic-btn.rec::before { opacity: 1; transform: scale(var(--halo, 1)); }
.mic-btn.rec { transform: scale(1.3); }
.mic-btn.locked { transform: none; }
.mic-btn.rec { background: #e53935; color: #fff; }
.mic-btn.locked { background: var(--accent); }
.voice-hint { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; opacity: 0; transition: opacity .2s; }
.voice-hint.show { opacity: .8; }
.voice-pause { position: absolute; right: 6px; bottom: 70px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--bg-elev); box-shadow: var(--shadow); font-size: 18px; }
.reply-quote { display: flex; flex-direction: column; gap: 2px; border-left: 3px solid var(--accent); background: var(--bg-elev); border-radius: 6px; padding: 4px 10px; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.nb-video { display: flex; flex-direction: column; gap: 6px; padding: 8px 12px; }
.nb-video input { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-elev); color: var(--text); min-width: 0; width: 100%; }
.nb-video-time { display: flex; gap: 6px; }
.nb-back { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex: none; border: 0; border-radius: 50%; background: var(--accent); color: #fff; padding: 0; cursor: pointer; }
.nb-back svg { width: 20px; height: 20px; pointer-events: none; }
.hint { text-align: center; font-size: 12px; color: var(--muted); margin: 6px 0 0; }

/* --- просмотрщик фото --- */
.viewer { position: fixed; inset: 0; background: rgba(0, 0, 0, .94); z-index: 100; display: flex; flex-direction: column; }
.viewer-bar { display: flex; align-items: center; gap: 4px; padding: calc(env(safe-area-inset-top) + 8px) 10px 8px; color: #fff; }
.viewer-bar .icon-btn { color: #fff; }
.viewer-bar .icon-btn:hover { background: rgba(255, 255, 255, .15); }
.viewer-stage { flex: 1; overflow: hidden; position: relative; touch-action: none; cursor: grab; }
.viewer-stage.drag { cursor: grabbing; }
.viewer-stage img { position: absolute; left: 0; top: 0; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; max-width: none; }

.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 90px); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; z-index: 200; box-shadow: var(--shadow); max-width: 90vw; }

/* --- вход --- */
.login-body { display: grid; place-items: center; min-height: 100dvh; overflow: auto; }
.login-card { width: min(92vw, 360px); text-align: center; padding: 24px; }
.login-card h1 { margin: 8px 0 0; }
.login-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }
.login-card input[type=password] { padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-elev); }
.login-card button.primary { padding: 13px; border-radius: 12px; }
.logo { width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 32px; font-weight: 700; display: grid; place-items: center; margin: 0 auto; }
.error { color: var(--danger); }

/* --- мобильная версия --- */
@media (max-width: 820px) {
  .only-mobile { display: inline-flex; }
  #sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); margin-left: 0 !important; width: min(84vw, 320px); box-shadow: var(--shadow); }
  #sidebar.open { transform: none; }
  .bubble { max-width: 92%; }
  .chat-item .ci-actions { display: flex; }
  .msg { padding: 6px 12px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* --- Markdown в ответах --- */
.md { white-space: normal; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: .6em 0; }
.md h2, .md h3, .md h4, .md h5, .md h6 { margin: 1.1em 0 .4em; line-height: 1.3; }
.md h2 { font-size: 1.35em; } .md h3 { font-size: 1.18em; } .md h4 { font-size: 1.05em; } .md h5, .md h6 { font-size: 1em; color: var(--muted); }
.md ul, .md ol { margin: .5em 0; padding-left: 1.5em; }
.md li { margin: .2em 0; }
.md li > ul, .md li > ol { margin: .2em 0; }
.md li.task-item { list-style: none; margin-left: -1.2em; }
.md li.task-item input { margin-right: .5em; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 1em 0; }
.md a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.md blockquote { margin: .7em 0; padding: .1em 1em; border-left: 3px solid var(--accent); color: var(--muted); background: var(--bg-elev); border-radius: 0 8px 8px 0; }
.md code { font: 0.9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--bg-elev); padding: .15em .4em; border-radius: 6px; border: 1px solid var(--border); }
.md pre { position: relative; margin: .8em 0; padding: 14px 14px 12px; background: var(--code-bg, #0d0d0d); color: var(--code-fg, #e6e6e6); border-radius: 12px; overflow-x: auto; border: 1px solid var(--border); -webkit-overflow-scrolling: touch; }
.md pre[data-lang]::before { content: attr(data-lang); display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.md pre code { background: none; border: 0; padding: 0; color: inherit; white-space: pre; font-size: 13.5px; line-height: 1.5; }
.md .copy-code { position: absolute; top: 8px; right: 8px; font-size: 12px; padding: 3px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-elev); color: var(--text); opacity: .85; }
:root[data-theme="light"] { --code-bg: #f6f6f7; --code-fg: #202123; --th-bg: #ececef; --row-alt: #f7f7f9; }
:root { --th-bg: #3a3a3a; --row-alt: #292929; }

/* таблицы: границы, чередование строк, горизонтальная прокрутка на узких экранах */
.md-table-wrap { margin: .8em 0; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: 12px; max-width: 100%; background: var(--bg); }
.md-table-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.md table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: .95em; }
.md th, .md td { padding: 9px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); min-width: 90px; max-width: 26em; overflow-wrap: break-word; word-break: normal; }
.md th:last-child, .md td:last-child { border-right: 0; }
.md tbody tr:last-child td { border-bottom: 0; }
.md thead th { background: var(--th-bg); font-weight: 600; position: sticky; top: 0; white-space: nowrap; }
.md tbody tr:nth-child(even) td { background: var(--row-alt); }
.md tbody tr:hover td { background: var(--bg-hover); }
.md td code { white-space: nowrap; }

/* --- изображения в ленте, источники, переключатель модели --- */
.chat-figure { margin: 10px 0 0; max-width: min(100%, 520px); }
.chat-image { display: block; padding: 0; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: #fff; cursor: zoom-in; width: 100%; }
.chat-image img { display: block; width: 100%; height: auto; }
.chat-figure figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; }
.sources { margin-top: 10px; font-size: 14px; border: 1px solid var(--border); border-radius: 12px; padding: 6px 12px; background: var(--bg-elev); }
.sources summary { cursor: pointer; color: var(--muted); }
.sources-list { margin: 6px 0 2px; padding-left: 1.4em; }
.sources-list a { color: var(--accent); }
.model-switch { display: inline-flex; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 999px; padding: 2px; flex: none; }
.model-switch button { background: transparent; border: 0; border-radius: 999px; padding: 5px 12px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.model-switch button[aria-checked="true"] { background: var(--accent); color: #fff; }
.viewer-bar a.icon-btn { color: #fff; text-decoration: none; }
@media (max-width: 420px) { .model-switch button { padding: 5px 9px; font-size: 12px; } .topbar h1 { max-width: 38vw; } }

/* --- пересылка, таблица проверки, Notebook --- */
.menu .fwd-note { width: 100%; box-sizing: border-box; margin-top: 4px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }
.menu .primary { background: var(--accent); color: var(--accent-text); margin-top: 4px; border-radius: 8px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 8px 0; }
.review-table { border-collapse: collapse; width: 100%; font-size: 14px; min-width: 640px; }
.review-table th, .review-table td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; vertical-align: top; }
.review-table th { background: var(--bg-hover); font-size: 13px; }
.review-table .thumb { width: 52px; height: 52px; padding: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: none; cursor: zoom-in; }
.review-table .thumb img { width: 100%; height: 100%; object-fit: cover; }
.bad-strong { color: var(--danger); font-weight: 700; }
.pick-wrap { position: relative; display: inline-block; margin-left: 4px; }
.mini { padding: 0 8px; min-height: 28px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); cursor: pointer; }
.pick-list { position: absolute; top: 30px; left: 0; z-index: 20; min-width: 150px; max-height: 220px; overflow-y: auto; }
.pick-list[hidden] { display: none; }
.nb-toggle { margin: 8px 12px; width: calc(100% - 24px); }
.nb-toggle.active { background: var(--accent); color: var(--accent-text); }
.nb { flex: 1; min-width: 0; display: flex; position: relative; height: 100%; }
.nb[hidden] { display: none; }
.nb-sources { width: var(--side-w); flex: none; background: var(--bg-side); display: flex; flex-direction: column; border-right: 1px solid var(--border); }
.nb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; }
.nb-books { overflow-y: auto; padding: 8px; flex: 1; }
.nb-book { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 8px; }
.nb-book:hover { background: var(--bg-hover); }
.nb-book span { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
.nb-book input { width: 18px; height: 18px; accent-color: var(--accent); }
.nb-book button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 16px; }
.nb-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 29; }
.nb-scrim[hidden] { display: none; }
.dl-card { display: inline-flex; gap: 8px; align-items: center; margin-top: 8px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-elev); color: var(--text); text-decoration: none; }
@media (max-width: 820px) {
  .nb-sources { position: fixed; top: 0; bottom: 0; left: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; padding-top: env(safe-area-inset-top); }
  .nb-sources.open { transform: none; }
}
