/* ═══════════ ComicForge — estética Notion ═══════════ */
:root {
  --text: #37352f;
  --text-2: #73716e;
  --text-3: #8a8885;
  --bg: #ffffff;
  --bg-soft: #f7f6f3;
  --bg-hover: #f1f1ef;
  --border: rgba(55, 53, 47, 0.09);
  --border-strong: rgba(55, 53, 47, 0.16);
  --accent: #37352f;
  --red: #e16259;
  --red-soft: #fdebec;
  --amber: #d9730d;
  --amber-soft: #fdf3e4;
  --green: #448361;
  --green-soft: #e8f3ee;
  --shadow-1: 0 1px 2px rgba(15, 15, 15, 0.06), 0 2px 8px rgba(15, 15, 15, 0.04);
  --shadow-2: 0 4px 14px rgba(15, 15, 15, 0.10), 0 12px 40px rgba(15, 15, 15, 0.10);
  --r-s: 6px; --r-m: 10px; --r-l: 16px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 15px; line-height: 1.55;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
[hidden] { display: none !important; }

/* ── botones ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: var(--r-s);
  font-size: 13.5px; font-weight: 500; line-height: 1.4;
  border: 1px solid transparent; cursor: pointer;
  transition: all .18s var(--ease);
  user-select: none; white-space: nowrap; text-decoration: none;
}
.btn:active { transform: scale(0.965); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-1); }
.btn-primary:hover { background: #23211d; box-shadow: 0 3px 10px rgba(15,15,15,.18); }
.btn-ghost { background: transparent; color: var(--text-2); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-block { width: 100%; justify-content: center; padding: 9px 13px; }
.btn-icon { padding: 7px; }
.btn:disabled { opacity: .55; cursor: default; pointer-events: none; }

/* ── login ── */
.login-view {
  min-height: 100dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 26px;
  background: var(--bg-soft); padding: 24px;
}
.login-card {
  width: min(360px, 100%); background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--r-l);
  box-shadow: var(--shadow-2); padding: 36px 32px 30px;
  animation: pop-in .5s var(--ease) both;
}
.login-mark { margin-bottom: 14px; }
.login-card h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.login-sub { color: var(--text-2); font-size: 14px; margin: 4px 0 22px; }
.field input {
  width: 100%; padding: 9px 12px; font: inherit; font-size: 14px;
  border: 1px solid var(--border-strong); border-radius: var(--r-s);
  background: var(--bg-soft); color: var(--text); outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(55,53,47,.08); }
#loginForm .btn { margin-top: 12px; }
.login-error { color: var(--red); font-size: 13px; margin-top: 10px; }
.login-card.shake { animation: shake .4s var(--ease); }
.login-foot { color: var(--text-3); font-size: 12.5px; }
@keyframes shake { 20%,60% { transform: translateX(-7px); } 40%,80% { transform: translateX(7px); } }
@keyframes pop-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* ── topbar ── */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255,255,255,.86); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 10px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15.5px; letter-spacing: -0.01em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.queue-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--amber-soft); color: var(--amber);
  font-size: 12.5px; font-weight: 600;
  animation: fade-in .3s var(--ease);
}
.spinner {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; transform: translateY(-4px); } }

/* ── biblioteca ── */
.main { max-width: 1180px; margin: 0 auto; padding: 30px 24px 140px; }
.library-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.library-head h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.library-count { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.search {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border: 1px solid var(--border-strong);
  border-radius: var(--r-s); background: var(--bg-soft);
  color: var(--text-3); min-width: min(300px, 100%);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(55,53,47,.07); }
.search input { border: 0; outline: 0; background: transparent; font: inherit; font-size: 13.5px; color: var(--text); width: 100%; }

/* ── grid de tarjetas ── */
.grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
}
.card {
  position: relative; cursor: pointer; border-radius: var(--r-m);
  transition: transform .25s var(--ease);
}
.card.animate-in { animation: card-in .45s var(--ease) both; }
.card:hover { transform: translateY(-4px); }
.card.animate-in:nth-child(2n) { animation-delay: .04s; }
.card.animate-in:nth-child(3n) { animation-delay: .08s; }
@keyframes card-in { from { opacity: 0; transform: translateY(12px); } }
.card-cover {
  position: relative; aspect-ratio: 3 / 4.1; border-radius: var(--r-m);
  overflow: hidden; background: var(--bg-soft);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
  transition: box-shadow .25s var(--ease);
}
.card:hover .card-cover { box-shadow: var(--shadow-2); }
.card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-cover .cover-fallback {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 34px; font-weight: 700;
  background: linear-gradient(140deg, #f1f1ef, #e4e2de);
}
.card-check {
  position: absolute; top: 8px; left: 8px; z-index: 3;
  width: 24px; height: 24px; border-radius: 7px;
  border: 1.5px solid rgba(255,255,255,.9);
  background: rgba(15,15,15,.30); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: scale(.7);
  transition: all .18s var(--ease); cursor: pointer; color: #fff;
}
.card:hover .card-check, .card.selected .card-check { opacity: 1; transform: scale(1); }
.card.selected .card-check { background: var(--accent); border-color: var(--accent); }
.card.selected .card-cover { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.card-status {
  position: absolute; left: 8px; bottom: 8px; z-index: 2;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: rgba(15,15,15,.55); color: #fff; backdrop-filter: blur(6px);
}
.card-status.error { background: rgba(190,60,50,.85); }
.card-status.ok { background: rgba(50,110,80,.85); }
.card-title {
  margin-top: 9px; font-size: 13.5px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.card-progress { margin-top: 7px; height: 4px; border-radius: 4px; background: var(--bg-hover); overflow: hidden; }
.card-progress-fill { height: 100%; border-radius: 4px; background: var(--accent); transition: width .4s var(--ease); }

.detail-progress { margin: 4px 0 16px; }
.detail-progress-bar { height: 6px; border-radius: 6px; background: var(--bg-hover); overflow: hidden; }
.detail-progress-fill { height: 100%; border-radius: 6px; background: var(--accent); transition: width .4s var(--ease); }
.detail-progress-label { display: inline-block; margin-top: 7px; font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.format-parts { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-sm { padding: 4px 9px; font-size: 12px; }

/* ── estado vacío ── */
.empty { text-align: center; padding: 70px 20px; color: var(--text-2); }
.empty-art { margin-bottom: 16px; }
.empty h3 { font-size: 18px; color: var(--text); margin-bottom: 6px; letter-spacing: -0.01em; }
.empty p { font-size: 14px; margin-bottom: 20px; }

/* ── barra de selección ── */
.selection-bar {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 50; display: flex; align-items: center; gap: 16px;
  padding: 10px 14px 10px 18px; border-radius: 14px;
  background: rgba(35,33,29,.92); color: #fff; backdrop-filter: blur(10px);
  box-shadow: var(--shadow-2);
  animation: bar-in .3s var(--ease);
  max-width: calc(100vw - 32px); flex-wrap: wrap; justify-content: center;
}
@keyframes bar-in { from { opacity: 0; transform: translate(-50%, 14px); } }
.selection-count { font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.selection-actions { display: flex; align-items: center; gap: 10px; }
.selection-bar .btn-primary { background: #fff; color: var(--text); }
.selection-bar .btn-primary:hover { background: #eae9e6; }
.selection-bar .btn-ghost { color: rgba(255,255,255,.75); border-color: rgba(255,255,255,.25); }
.selection-bar .btn-ghost:hover { background: rgba(255,255,255,.12); color: #fff; }
.format-picker {
  display: flex; background: rgba(255,255,255,.12); border-radius: 8px; padding: 3px; gap: 2px;
}
.format-picker .fmt {
  border: 0; background: transparent; color: rgba(255,255,255,.75);
  font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 4px 11px; border-radius: 6px; cursor: pointer;
  transition: all .15s var(--ease);
}
.format-picker .fmt:hover { color: #fff; }
.format-picker .fmt.active { background: #fff; color: var(--text); }

/* ── detalle ── */
.detail-overlay { position: fixed; inset: 0; z-index: 60; }
.detail-backdrop {
  position: absolute; inset: 0; background: rgba(15,15,15,.42);
  animation: fade-in .25s var(--ease);
}
.detail-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(680px, 100%); background: var(--bg);
  box-shadow: -14px 0 50px rgba(15,15,15,.25);
  overflow-y: auto; overscroll-behavior: contain;
  animation: slide-in .38s var(--ease);
}
@keyframes slide-in { from { transform: translateX(60px); opacity: 0; } }
.detail-close {
  position: sticky; top: 14px; margin: 14px 14px -50px auto; z-index: 5;
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: rgba(255,255,255,.9); backdrop-filter: blur(6px);
  color: var(--text-2); cursor: pointer; box-shadow: var(--shadow-1);
  transition: all .15s var(--ease);
}
.detail-close:hover { background: var(--bg-hover); color: var(--text); transform: rotate(90deg); }
.detail-body { padding: 34px 38px 60px; }

.detail-cols { display: grid; grid-template-columns: 240px 1fr; gap: 30px; align-items: start; }
.detail-cover {
  border-radius: var(--r-m); overflow: hidden;
  border: 1px solid var(--border); box-shadow: var(--shadow-2);
  background: var(--bg-soft); aspect-ratio: 3 / 4.1;
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-cover .cover-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 46px; font-weight: 700; color: var(--text-3); background: linear-gradient(140deg,#f1f1ef,#e4e2de); }
.detail-cover-note { font-size: 11.5px; color: var(--text-2); text-align: center; margin-top: 8px; }

.detail-info h2 { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; margin-bottom: 4px; }
.detail-series { color: var(--text-2); font-size: 13.5px; margin-bottom: 14px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.badge {
  font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: var(--bg-soft); color: var(--text-2); border: 1px solid var(--border);
}
.badge.ok { background: var(--green-soft); color: var(--green); border-color: transparent; }
.badge.busy { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.badge.err { background: var(--red-soft); color: var(--red); border-color: transparent; }
.meta-note { font-size: 12.5px; color: var(--text-2); margin: -8px 0 16px; }
.detail-summary { font-size: 13.5px; color: var(--text-2); margin-bottom: 18px; }

.meta-table { display: grid; grid-template-columns: auto 1fr; gap: 5px 18px; font-size: 13px; margin-bottom: 22px; }
.meta-table dt { color: var(--text-3); font-weight: 500; white-space: nowrap; }
.meta-table dd { color: var(--text); }

.formats h4, .detail-danger h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: 10px; }
.format-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--r-s);
  margin-bottom: 8px; background: var(--bg);
  transition: all .15s var(--ease);
}
.format-row:hover { border-color: var(--border-strong); box-shadow: var(--shadow-1); }
.format-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.format-chip {
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  padding: 4px 8px; border-radius: 5px; background: var(--accent); color: #fff;
}
.format-name { font-size: 13.5px; font-weight: 600; }
.format-size { font-size: 12.5px; color: var(--text-2); }
.format-row.pending { opacity: .55; }
.detail-error-box {
  padding: 12px 14px; border-radius: var(--r-s); margin-bottom: 14px;
  background: var(--red-soft); color: var(--red); font-size: 12.5px;
  font-family: ui-monospace, monospace; white-space: pre-wrap; word-break: break-word;
  max-height: 160px; overflow: auto;
}
.detail-danger { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border); }
.btn-danger { background: transparent; color: var(--red); border: 1px solid rgba(225,98,89,.4); }
.btn-danger:hover { background: var(--red-soft); }

/* ── bandeja de subidas ── */
.upload-tray {
  position: fixed; right: 20px; bottom: 20px; z-index: 55;
  display: flex; flex-direction: column; gap: 8px; width: min(330px, calc(100vw - 40px));
}
.upload-item {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-m);
  box-shadow: var(--shadow-2); padding: 12px 14px;
  animation: bar-in2 .3s var(--ease);
}
@keyframes bar-in2 { from { opacity: 0; transform: translateY(10px); } }
.upload-item .u-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item .u-bar { height: 4px; border-radius: 4px; background: var(--bg-hover); margin-top: 8px; overflow: hidden; }
.upload-item .u-fill { height: 100%; border-radius: 4px; background: var(--accent); transition: width .25s var(--ease); }
.upload-item .u-pct { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }
.upload-item.done .u-fill { background: var(--green); }
.upload-item.fail .u-fill { background: var(--red); }

/* ── drop overlay ── */
.drop-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(255,255,255,.82); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
}
.drop-box {
  border: 2px dashed var(--border-strong); border-radius: var(--r-l);
  padding: 60px 80px; text-align: center; color: var(--text-2);
  font-size: 16px; font-weight: 600; background: var(--bg);
  animation: pop-in .25s var(--ease);
}
.drop-box svg { margin-bottom: 10px; color: var(--text-3); }

/* ── lector ── */
.reader {
  position: fixed; inset: 0; z-index: 80;
  background: #191919; color: #e8e6e3;
  display: flex; animation: fade-in .22s var(--ease);
}
.reader-main { position: relative; flex: 1; min-width: 0; }

/* chrome: dos barras absolutas sobre el stage */
.reader-top, .reader-bottom {
  position: absolute; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 9px 14px;
  background: linear-gradient(rgba(15,15,15,.75), rgba(15,15,15,.45));
  backdrop-filter: blur(12px);
  transition: transform .3s var(--ease), opacity .3s var(--ease);
}
.reader-top { top: 0; justify-content: space-between; }
.reader-bottom { bottom: 0; flex-direction: column; align-items: stretch; gap: 8px; padding-bottom: calc(9px + env(safe-area-inset-bottom)); background: linear-gradient(rgba(15,15,15,.45), rgba(15,15,15,.75)); }
.reader-top.chrome-hide { transform: translateY(-100%); opacity: 0; pointer-events: none; }
.reader-bottom.chrome-hide { transform: translateY(100%); opacity: 0; pointer-events: none; }
.reader.chrome-off { cursor: none; }

/* botones del chrome */
.rc-btn {
  min-width: 36px; height: 34px; padding: 0 9px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid rgba(255,255,255,.16); border-radius: 8px;
  background: rgba(255,255,255,.06); color: #e8e6e3;
  font: inherit; font-size: 12px; font-weight: 700;
  cursor: pointer; transition: all .15s var(--ease); white-space: nowrap;
}
.rc-btn:hover { background: rgba(255,255,255,.16); }
.rc-btn.active { background: #e8e6e3; color: #191919; border-color: #e8e6e3; }
.rc-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.rc-dir { font-size: 11px; letter-spacing: .05em; }
.rc-zoomval { font-size: 12px; font-weight: 600; min-width: 46px; text-align: center; }
.rt-left, .rt-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rt-title { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-sep { width: 1px; height: 22px; background: rgba(255,255,255,.15); }
.rt-group { display: flex; align-items: center; gap: 5px; }

/* barra inferior: fila de controles + fila de navegación */
.rb-row { display: flex; align-items: center; gap: 7px; justify-content: center; flex-wrap: wrap; }
.rb-nav { display: flex; align-items: center; gap: 12px; }
.rc-page { font-size: 12.5px; font-weight: 600; white-space: nowrap; min-width: 70px; text-align: center; }
#rdSlider { flex: 1; accent-color: #e8e6e3; height: 3px; cursor: pointer; }
.rc-jump { display: flex; gap: 5px; align-items: center; }
.rc-jump input {
  width: 60px; padding: 5px 8px; border-radius: 7px;
  border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.07);
  color: #e8e6e3; font: inherit; font-size: 12.5px; outline: none;
}
.rc-jump input:focus { border-color: rgba(255,255,255,.4); }

/* segmentados */
.rc-seg { display: flex; background: rgba(255,255,255,.08); border-radius: 9px; padding: 3px; gap: 2px; }
.rc-seg button {
  width: 34px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 6px; background: transparent; color: rgba(232,230,227,.7);
  cursor: pointer; transition: all .14s var(--ease);
}
.rc-seg button svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.rc-seg button:hover { color: #fff; }
.rc-seg button.active { background: #e8e6e3; color: #191919; }

/* stage */
.reader-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.rd-paged { display: flex; align-items: center; justify-content: center; gap: 4px; width: 100%; height: 100%; }
.rd-paged img { user-select: none; animation: page-in .16s var(--ease); }
@keyframes page-in { from { opacity: 0; } }
.reader-stage[data-fit="width"] .rd-paged img { max-width: 100%; max-height: 100%; object-fit: contain; }
.reader-stage[data-fit="width"][data-layout="double"] .rd-paged img { max-width: 50%; }
.reader-stage[data-fit="width"][data-layout="double"] .rd-paged img:only-child { max-width: 50%; margin: 0 auto; }
.reader-stage[data-fit="width"][data-layout="double"] .rd-paged:has(img:only-child) { justify-content: center; }
.reader-stage[data-fit="height"] .rd-paged img { height: 100%; width: auto; max-width: none; }
.reader-stage[data-fit="zoom"] .rd-paged { overflow: auto; align-items: center; justify-content: center; }
.reader-stage[data-fit="zoom"] .rd-zoomwrap {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  width: calc(var(--zoom, 1) * 100%); max-width: none;
}
.reader-stage[data-fit="zoom"][data-layout="single"] .rd-zoomwrap img,
.reader-stage[data-fit="zoom"][data-layout="double"] .rd-zoomwrap img { width: 100%; height: auto; }
.reader-stage[data-fit="zoom"][data-layout="double"] .rd-zoomwrap img { width: 50%; }

.reader-zone { position: absolute; top: 0; bottom: 0; width: 30%; cursor: pointer; z-index: 2; }
.reader-zone.left { left: 0; }
.reader-zone.right { right: 0; }
.reader-stage[data-fit="zoom"] .reader-zone { display: none; }

.rd-scroll { position: absolute; inset: 0; overflow-y: auto; display: flex; flex-direction: column; align-items: center; }
.rd-scroll img { width: 100%; display: block; user-select: none; }
.rd-scroll img.fit-h { width: auto; height: 100vh; max-width: none; }

/* barra lateral de marcadores (izquierda, en flujo) */
.rd-bmsidebar {
  width: min(300px, 84vw); flex: none; z-index: 30;
  background: #1e1e1e; border-right: 1px solid rgba(255,255,255,.09);
  display: flex; flex-direction: column; animation: bm-in .28s var(--ease);
}
@keyframes bm-in { from { transform: translateX(-30px); opacity: 0; } }
.rd-bmhead { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.09); }
.rd-bmhead h3 { font-size: 14px; font-weight: 700; }
.rd-bmlist { flex: 1; overflow-y: auto; padding: 8px; }
.bm-empty { padding: 30px 16px; text-align: center; color: rgba(232,230,227,.5); font-size: 13px; line-height: 1.7; }
.bm-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; transition: background .15s; }
.bm-item:hover { background: rgba(255,255,255,.06); }
.bm-dot { width: 32px; height: 32px; border-radius: 8px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.bm-meta { flex: 1; min-width: 0; }
.bm-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-page { font-size: 11.5px; color: rgba(232,230,227,.5); }
.bm-go, .bm-edit { width: 28px; height: 28px; border-radius: 7px; border: 0; cursor: pointer; background: transparent; color: rgba(232,230,227,.6); font-size: 14px; transition: all .15s; }
.bm-go:hover, .bm-edit:hover { background: rgba(255,255,255,.12); color: #e8e6e3; }

/* modal marcador */
.bm-modal { position: fixed; inset: 0; z-index: 95; background: rgba(15,15,15,.5); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade-in .2s var(--ease); }
.bm-card { width: min(380px, 100%); background: var(--bg); color: var(--text); border-radius: var(--r-l); box-shadow: var(--shadow-2); padding: 24px; animation: pop-in .3s var(--ease); }
.bm-card h3 { font-size: 16px; margin-bottom: 14px; }
.bm-card input[type="text"] { width: 100%; padding: 9px 12px; font: inherit; font-size: 14px; border: 1px solid var(--border-strong); border-radius: var(--r-s); background: var(--bg-soft); color: var(--text); outline: none; margin-bottom: 16px; }
.bm-card input[type="text"]:focus { border-color: var(--accent); background: #fff; }
.bm-row { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.bm-row > span { font-size: 12.5px; font-weight: 600; color: var(--text-2); width: 40px; }
.bm-swatches, .bm-icons { display: flex; gap: 7px; flex-wrap: wrap; }
.bm-sw { width: 26px; height: 26px; border-radius: 7px; border: 2px solid transparent; cursor: pointer; transition: transform .12s; }
.bm-sw.active { border-color: var(--text); transform: scale(1.15); }
.bm-ic { width: 32px; height: 32px; border-radius: 7px; border: 1px solid var(--border-strong); background: transparent; font-size: 15px; cursor: pointer; }
.bm-ic.active { background: var(--bg-hover); border-color: var(--accent); }
.bm-actions { display: flex; align-items: center; gap: 9px; margin-top: 20px; }

.detail-actions { display: flex; gap: 9px; margin-bottom: 20px; flex-wrap: wrap; }
@media (max-width: 640px) {
  .reader-top { flex-wrap: wrap; gap: 8px; }
  .rb-row { gap: 5px; }
  .rc-btn { min-width: 33px; height: 31px; padding: 0 7px; }
}

/* enlace kindle */
.kindle-hint { font-size: 13.5px; color: var(--text-2); margin-bottom: 12px; }
.kindle-url {
  font-family: ui-monospace, monospace; font-size: 13px;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--r-s); padding: 12px 14px; word-break: break-all;
  margin-bottom: 18px; user-select: all;
}
  padding: 9px 10px; border-radius: 9px; cursor: default;
  transition: background .15s;
}
.bm-item:hover { background: rgba(255,255,255,.06); }
.bm-dot {
  width: 32px; height: 32px; border-radius: 8px; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.bm-meta { flex: 1; min-width: 0; }
.bm-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-page { font-size: 11.5px; color: rgba(232,230,227,.5); }
.bm-go, .bm-edit {
  width: 28px; height: 28px; border-radius: 7px; border: 0; cursor: pointer;
  background: transparent; color: rgba(232,230,227,.6); font-size: 14px;
  transition: all .15s;
}
.bm-go:hover, .bm-edit:hover { background: rgba(255,255,255,.12); color: #e8e6e3; }

/* modal marcador */
.bm-modal {
  position: fixed; inset: 0; z-index: 95; background: rgba(15,15,15,.5);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade-in .2s var(--ease);
}
.bm-card {
  width: min(380px, 100%); background: var(--bg); color: var(--text);
  border-radius: var(--r-l); box-shadow: var(--shadow-2); padding: 24px;
  animation: pop-in .3s var(--ease);
}
.bm-card h3 { font-size: 16px; margin-bottom: 14px; }
.bm-card input[type="text"] {
  width: 100%; padding: 9px 12px; font: inherit; font-size: 14px;
  border: 1px solid var(--border-strong); border-radius: var(--r-s);
  background: var(--bg-soft); color: var(--text); outline: none; margin-bottom: 16px;
}
.bm-card input[type="text"]:focus { border-color: var(--accent); background: #fff; }
.bm-row { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.bm-row > span { font-size: 12.5px; font-weight: 600; color: var(--text-2); width: 40px; }
.bm-swatches, .bm-icons { display: flex; gap: 7px; flex-wrap: wrap; }
.bm-sw { width: 26px; height: 26px; border-radius: 7px; border: 2px solid transparent; cursor: pointer; transition: transform .12s; }
.bm-sw.active { border-color: var(--text); transform: scale(1.15); }
.bm-ic { width: 32px; height: 32px; border-radius: 7px; border: 1px solid var(--border-strong); background: transparent; font-size: 15px; cursor: pointer; }
.bm-ic.active { background: var(--bg-hover); border-color: var(--accent); }
.bm-actions { display: flex; align-items: center; gap: 9px; margin-top: 20px; }

@media (max-width: 640px) {
  .reader-btn span:not(#rdZoomPct):not(#rdDirLbl) { display: none; }
  .reader-btn { min-width: 34px; padding: 0 8px; }
}

/* ── toasts ── */
.toast-zone { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  padding: 9px 16px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: rgba(35,33,29,.92); color: #fff; box-shadow: var(--shadow-2);
  animation: toast-in .3s var(--ease); backdrop-filter: blur(8px);
}
.toast.error { background: rgba(190,60,50,.94); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }

/* ── responsive ── */
@media (max-width: 860px) {
  .detail-cols { grid-template-columns: 190px 1fr; gap: 20px; }
}
@media (max-width: 640px) {
  .main { padding: 20px 14px 150px; }
  .topbar-inner { padding: 10px 14px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 13px; }
  .detail-panel { width: 100%; }
  .detail-body { padding: 24px 18px 48px; }
  .detail-cols { grid-template-columns: 1fr; }
  .detail-cover { max-width: 230px; margin: 0 auto; }
  .library-head h2 { font-size: 20px; }
  .search { min-width: 100%; }
  .queue-pill { display: none; }
  .selection-bar { gap: 10px; padding: 9px 12px; bottom: 14px; }
  .selection-count { font-size: 12.5px; }
}
