/* Valores del diseño "Nube" (el predeterminado). Se declaran también en cada [data-theme] para que
   las vistas previas de un diseño dentro de otro no hereden colores ajenos. */
:root, [data-theme] {
  --page: #e9eef6;
  --surface: #ffffff;
  --surface-2: #f3f6fb;
  --line: #e3e8f1;
  --ink: #141b34;
  --muted: #7a8299;
  --blue: #2e5bff;
  --blue-soft: #e8eeff;
  --navy: #0a1a4a;
  --navy-2: #13275f;
  --teal: #1fb5c4;
  --teal-soft: #e4f7f9;
  --danger: #d33a2c;
  --warn: #b7791f;
  --radius-lg: 22px;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-cover: 0 10px 24px -12px rgb(10 26 74 / 45%);
  --font: "Poppins", system-ui, "Segoe UI", sans-serif;
  --font-display: var(--font);
  --font-cover: "DM Serif Display", Georgia, serif;
  --base-size: 14px;
  --on-accent: #ffffff;
  --soft-ink: var(--navy-2);          /* texto sobre fondos suaves (chips, avisos) */
  --link-ink: var(--navy);
  --line-strong: #c8cfdc;
  --texture: none;
  --sidebar-bg: var(--surface);
  --sidebar-ink: var(--ink);
  --sidebar-muted: var(--muted);
  --sidebar-hover: var(--surface-2);
  --panel-bg: var(--navy);
  --panel-ink: #ffffff;
  --panel-link: #9db4ff;
  --shelf: transparent;               /* tabla de estante bajo los libros (diseños tradicionales) */
  --login-bg: radial-gradient(circle at 85% 10%, #d7f3f6 0, transparent 45%), linear-gradient(180deg, #eefafb, #f6fbfc);
  --login-frame-bg: rgb(255 255 255 / 75%);
  --login-border: #cdecef;
  --field-bg: #f4f5f7;
  --btn-dark: #050c33;
  --ill-ink: #0a1a4a;                 /* colores de la ilustración del ingreso */
  --ill-accent: #1fb5c4;
  --ill-soft: #bdebf0;
  --ill-bg: #eaf8fa;
  color-scheme: light;
}

/* ================= Diseños ================= */
/* El admin elige uno en Panel de control → Diseño del sitio. Cada bloque redefine las variables;
   también se aplican a las vistas previas, que llevan su propio data-theme. */

/* --- Moderno: Grafito (oscuro, violeta) --- */
[data-theme="grafito"] {
  --panel-link: #c4bbff;
  --page: #0f1218; --surface: #171b23; --surface-2: #1f2430; --line: #2a303d; --line-strong: #3d4556;
  --ink: #e8eaf0; --muted: #959cab; --blue: #7564ee; --blue-soft: #262142; --navy: #0b0d13; --navy-2: #2b2450;
  --teal: #8f80ff; --teal-soft: #262142; --danger: #ff7b72; --warn: #e3b341; --soft-ink: #d3ccff; --link-ink: #b7adff;
  --panel-bg: linear-gradient(180deg, #221c45, #141029); --sidebar-bg: #12151c; --sidebar-hover: #1f2430;
  --font: "Manrope", system-ui, sans-serif; --font-display: "Manrope", system-ui, sans-serif;
  --shadow-cover: 0 12px 26px -12px rgb(0 0 0 / 75%);
  --login-bg: radial-gradient(circle at 85% 10%, #2a2352 0, transparent 50%), #0f1218;
  --login-frame-bg: rgb(23 27 35 / 85%); --login-border: #2a303d; --field-bg: #1f2430; --btn-dark: #7564ee;
  --ill-ink: #d6d0ff; --ill-accent: #8f80ff; --ill-soft: #2f2858; --ill-bg: #1a1d29;
  color-scheme: dark;
}

/* --- Moderno: Brisa (claro, verde agua, esquinas suaves) --- */
[data-theme="brisa"] {
  --panel-link: #8fe3d3;
  --page: #edf5f2; --surface: #ffffff; --surface-2: #f1f8f5; --line: #dbe9e4; --line-strong: #bfd5ce;
  --ink: #12302b; --muted: #687f7a; --blue: #0d8a79; --blue-soft: #dcf2ec; --navy: #0b3b36; --navy-2: #145049;
  --teal: #0d8a79; --teal-soft: #dcf2ec;
  --radius-lg: 28px; --radius: 20px; --radius-sm: 12px;
  --font: "Plus Jakarta Sans", system-ui, sans-serif; --font-display: "Plus Jakarta Sans", system-ui, sans-serif;
  --shadow-cover: 0 14px 28px -14px rgb(11 59 54 / 45%);
  --login-bg: radial-gradient(circle at 80% 0%, #cdeee5 0, transparent 50%), linear-gradient(180deg, #f3faf8, #edf5f2);
  --login-border: #d0e9e2; --btn-dark: #0b3b36;
  --ill-ink: #0b3b36; --ill-accent: #0d8a79; --ill-soft: #c6eadf; --ill-bg: #e3f5ef;
}

/* --- Tradicional: Nogal (madera, papel crema, bronce) --- */
[data-theme="nogal"] {
  --panel-link: #e6bf82;
  --page: #ede1c8; --surface: #fbf6ec; --surface-2: #f3e9d6; --line: #e0cfae; --line-strong: #cdb68c;
  --ink: #2f2116; --muted: #7b6852; --blue: #8f5f26; --blue-soft: #f1e0c2; --navy: #3a2316; --navy-2: #5a3a24;
  --teal: #8f5f26; --teal-soft: #f1e0c2; --soft-ink: #5a3a24; --link-ink: #5a3a24;
  --radius-lg: 10px; --radius: 6px; --radius-sm: 4px;
  --font: "Lora", Georgia, serif; --font-display: "Libre Baskerville", Georgia, serif; --base-size: 14.5px;
  --texture: repeating-linear-gradient(0deg, rgb(120 80 40 / 3%) 0 1px, transparent 1px 4px);
  --sidebar-bg: linear-gradient(180deg, #4b2f1d, #34200f); --sidebar-ink: #f4e7cd; --sidebar-muted: #cbb490; --sidebar-hover: rgb(255 255 255 / 8%);
  --panel-bg: linear-gradient(180deg, #4b2f1d, #2a180c);
  --shelf: #6b4426;
  --shadow-cover: 3px 3px 0 rgb(40 20 5 / 18%), 0 12px 22px -12px rgb(40 20 5 / 65%);
  --login-bg: repeating-linear-gradient(0deg, rgb(120 80 40 / 4%) 0 1px, transparent 1px 4px), linear-gradient(180deg, #efe3ca, #e4d4b4);
  --login-frame-bg: rgb(251 246 236 / 80%); --login-border: #d8c39c; --field-bg: #f3e9d6; --btn-dark: #3a2316;
  --ill-ink: #3a2316; --ill-accent: #a5713a; --ill-soft: #e6cfa6; --ill-bg: #f1e4c9;
}

/* --- Tradicional: Pergamino (manuscrito, sepia, rojo lacre) --- */
[data-theme="pergamino"] {
  --panel-link: #eab0a6;
  --page: #f2e9d3; --surface: #fbf7ec; --surface-2: #f1e7d0; --line: #e0d1ae; --line-strong: #cbb78c;
  --ink: #2b2118; --muted: #786450; --blue: #8a2525; --blue-soft: #f1dbd2; --navy: #2b2118; --navy-2: #463627;
  --teal: #8a2525; --teal-soft: #f1dbd2; --soft-ink: #5e1b1b; --link-ink: #8a2525;
  --radius-lg: 6px; --radius: 4px; --radius-sm: 3px;
  --font: "EB Garamond", Georgia, serif; --font-display: "Cormorant Garamond", Georgia, serif; --base-size: 16px;
  --texture: radial-gradient(circle at 15% 10%, rgb(255 255 255 / 55%), transparent 40%), radial-gradient(circle at 85% 95%, rgb(140 100 50 / 10%), transparent 45%);
  --sidebar-bg: #efe3c6; --sidebar-hover: rgb(43 33 24 / 6%);
  --panel-bg: linear-gradient(180deg, #33271c, #1f170f);
  --shelf: #8a6a45;
  --shadow-cover: 2px 2px 0 rgb(60 40 20 / 15%), 0 10px 20px -12px rgb(60 40 20 / 55%);
  --login-bg: radial-gradient(circle at 20% 15%, rgb(255 255 255 / 60%), transparent 45%), linear-gradient(180deg, #f2e8d0, #e8dbbd);
  --login-frame-bg: rgb(251 247 236 / 80%); --login-border: #dccaa3; --field-bg: #f3ead6; --btn-dark: #8a2525;
  --ill-ink: #2b2118; --ill-accent: #8a2525; --ill-soft: #ead8b6; --ill-bg: #f4ead3;
}

/* --- Tradicional: Sala de lectura (verde biblioteca, dorado, cuero) --- */
[data-theme="sala-verde"] {
  --panel-link: #e6cb76;
  --page: #e7e5da; --surface: #fbfaf4; --surface-2: #f0eee3; --line: #dcd8c6; --line-strong: #c4bfa8;
  --ink: #1c2a21; --muted: #64705e; --blue: #1f5a3d; --blue-soft: #dce8de; --navy: #173826; --navy-2: #24503a;
  --teal: #a37f27; --teal-soft: #f1e8cc; --soft-ink: #1f4a33; --link-ink: #1f5a3d;
  --radius-lg: 12px; --radius: 8px; --radius-sm: 6px;
  --font: "Source Serif 4", Georgia, serif; --font-display: "Playfair Display", Georgia, serif; --base-size: 14.5px;
  --sidebar-bg: linear-gradient(180deg, #1b4130, #12291d); --sidebar-ink: #f3ebd2; --sidebar-muted: #b6c2a8; --sidebar-hover: rgb(255 255 255 / 7%);
  --panel-bg: linear-gradient(180deg, #1d4632, #10251a);
  --shelf: #4a3220;
  --shadow-cover: 2px 3px 0 rgb(20 30 20 / 15%), 0 12px 22px -12px rgb(10 30 20 / 60%);
  --login-bg: radial-gradient(ellipse at 50% -15%, #f3e2ae 0, transparent 55%), linear-gradient(180deg, #e9e6d9, #d9d5c2);
  --login-frame-bg: rgb(251 250 244 / 82%); --login-border: #d6d0b8; --field-bg: #f1efe4; --btn-dark: #173826;
  --ill-ink: #173826; --ill-accent: #1f5a3d; --ill-soft: #d4e1d1; --ill-bg: #eceee2;
}

/* --- Diseño 2 - Marrón: franja arena, verde oscuro y acento naranja --- */
[data-theme="marron"] {
  --page: #f8f6f1; --surface: #fffefb; --surface-2: #f3f0e8; --line: #e8e3d7; --line-strong: #d4ccb9;
  --ink: #1c1e1a; --muted: #8b8778; --blue: #1f3b33; --blue-soft: #ebe7db; --navy: #1f3b33; --navy-2: #2d4b41;
  --teal: #f0693a; --teal-soft: #fde6db; --soft-ink: #39402f; --link-ink: #1f3b33; --panel-link: #e9cfa3;
  --hero: #dcd5c3;                       /* franja superior */
  --side-card-bg: #d9b3f2;
  --radius-lg: 26px; --radius: 14px; --radius-sm: 9px;
  --font: "DM Sans", system-ui, sans-serif; --font-display: "DM Sans", system-ui, sans-serif; --base-size: 13.5px;
  --sidebar-bg: #fffefb; --sidebar-hover: #f3f0e8; --sidebar-muted: #8b8778;
  --panel-bg: linear-gradient(180deg, #24443a, #17302a);
  --shadow-cover: 0 20px 30px -16px rgb(45 38 20 / 50%);
  --login-bg: linear-gradient(180deg, #dcd5c3 0 46%, #f8f6f1 46%);
  --login-frame-bg: rgb(255 254 251 / 92%); --login-border: #e3ddcf; --field-bg: #f3f0e8; --btn-dark: #1f3b33;
  --ill-ink: #1f3b33; --ill-accent: #f0693a; --ill-soft: #ecd9c4; --ill-bg: #efe9dc;
}

/* Disposición propia del Diseño 2 */
[data-theme="marron"] .main { background: linear-gradient(var(--hero) 0 330px, var(--page) 330px); }
[data-theme="marron"] .topbar { background: transparent; padding-top: 22px; }
[data-theme="marron"] .sidebar { gap: 1rem; padding: 26px 18px; border-right: 0; }
[data-theme="marron"] .logo-word { text-transform: uppercase; letter-spacing: .1em; font-size: .82rem; font-weight: 700; }
[data-theme="marron"] .logo-mark { width: 26px; height: 26px; background: var(--teal); }
[data-theme="marron"] .nav-label { display: block; margin: 14px 0 0 .5rem; font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
[data-theme="marron"] .nav-item { font-size: .8rem; gap: .65rem; padding: .42rem .5rem; color: var(--muted); }
[data-theme="marron"] .nav-item svg { width: 26px; height: 26px; padding: 6px; border-radius: 8px; background: var(--surface-2); color: var(--ink); }
[data-theme="marron"] .nav-item[aria-current="page"] svg { width: 26px; height: 26px; margin: 0; padding: 6px; background: var(--teal); color: #fff; }
[data-theme="marron"] .nav-item[aria-current="page"] { color: var(--ink); }
[data-theme="marron"] .nav-bottom { border-top-color: var(--line); }
[data-theme="marron"] .side-card { display: grid; justify-items: center; gap: 8px; margin-top: 14px; padding-top: 16px; border-top: 1px solid var(--line); }
[data-theme="marron"] .side-card svg { width: 76px; height: 76px; stroke: none; }
[data-theme="marron"] .side-card span { font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; }

[data-theme="marron"] .search-wrap { max-width: 560px; padding: 5px; border-radius: 10px; background: var(--surface); box-shadow: 0 10px 24px -18px rgb(40 35 20 / 60%); }
[data-theme="marron"] .search { background: transparent; padding: 0 .5rem; }
[data-theme="marron"] .search-area { display: block; width: auto; max-width: 170px; border: 0; border-right: 1px solid var(--line); border-radius: 0; background: transparent; font-size: .76rem; padding: .3rem .6rem; color: var(--muted); }
[data-theme="marron"] .search-go { display: inline-flex; padding: .42rem 1.1rem; border-radius: 7px; }

[data-theme="marron"] .view-hero { display: block; margin: 2px 0 -4px; font-size: 1.9rem; font-weight: 700; letter-spacing: -.01em; }
[data-theme="marron"] #view-discover .block { background: transparent; padding: 0; }
[data-theme="marron"] #view-discover .block-head h2 { font-weight: 500; font-size: 1.05rem; }
[data-theme="marron"] #view-discover .pill-link { background: var(--surface); color: var(--ink); box-shadow: 0 6px 14px -10px rgb(40 35 20 / 55%); }
[data-theme="marron"] .shelf { grid-auto-columns: 170px; gap: 22px; scrollbar-width: none; }
[data-theme="marron"] .shelf::-webkit-scrollbar { display: none; }
[data-theme="marron"] .shelf .book-title, [data-theme="marron"] .shelf .book-author { display: none; }
[data-theme="marron"] .shelf .cover { border-radius: 4px; }
[data-theme="marron"] #area-chips { display: none; }
[data-theme="marron"] #btn-filters { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }

/* Tarjetas de categoría: la tapa de un libro del área sobre un pedestal claro. */
[data-theme="marron"] .cat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px; margin-bottom: 26px; }
.cat-card { display: grid; justify-items: center; gap: 10px; padding: 0; border: 0; background: none; cursor: pointer; color: var(--ink); font: inherit; }
.cat-stand { position: relative; display: grid; place-items: end center; width: 100%; height: 132px; padding-bottom: 10px; }
.cat-stand::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 58%; border-radius: 12px; background: var(--surface-2); }
.cat-stand .cover { position: relative; width: 68px; font-size: 6px; box-shadow: 0 14px 20px -12px rgb(40 35 20 / 60%); transition: transform .2s ease; }
.cat-card:hover .cover { transform: translateY(-4px); }
.cat-card strong { font-size: .82rem; font-weight: 600; text-align: center; }
.cat-card small { color: var(--muted); font-size: .72rem; margin-top: -8px; }
.cat-card[aria-pressed="true"] .cat-stand::before { background: var(--blue-soft); box-shadow: inset 0 0 0 2px var(--blue); }

/* Diseños tradicionales: los libros apoyados en un estante. */
[data-theme="nogal"] .shelf, [data-theme="pergamino"] .shelf, [data-theme="sala-verde"] .shelf {
  padding-bottom: 6px; border-bottom: 10px solid var(--shelf); border-radius: 0 0 2px 2px;
  box-shadow: 0 10px 12px -10px rgb(0 0 0 / 45%);
}
[data-theme="nogal"] .sidebar .logo-mark, [data-theme="sala-verde"] .sidebar .logo-mark { background: var(--teal); }
[data-theme="nogal"] .logo-word, [data-theme="pergamino"] .logo-word, [data-theme="sala-verde"] .logo-word { letter-spacing: .02em; }
[data-theme="pergamino"] h2 { font-weight: 700; font-size: 1.35rem; }

/* Ilustración del ingreso: toma los colores del diseño. */
.login-art [fill="#0a1a4a"] { fill: var(--ill-ink); }
.login-art [stroke="#0a1a4a"] { stroke: var(--ill-ink); }
.login-art [fill="#1fb5c4"] { fill: var(--ill-accent); }
.login-art [stroke="#1fb5c4"] { stroke: var(--ill-accent); }
.login-art [fill="#bdebf0"] { fill: var(--ill-soft); }
.login-art [fill="#eaf8fa"] { fill: var(--ill-bg); }
.login-art [stroke="#17a0ae"] { stroke: var(--ill-accent); }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: var(--base-size); line-height: 1.5; color: var(--ink); background: var(--page); background-image: var(--texture); background-attachment: fixed; }
h1, h2, h3, .logo-word, .book-title, .panel h3, .kpi strong { font-family: var(--font-display); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 1.15rem; font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

a { color: var(--link-ink); }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.error-msg { color: var(--danger); font-size: .85rem; min-height: 1.2em; }

input, select, textarea {
  width: 100%; padding: .6rem .8rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface);
}
textarea { resize: vertical; min-height: 7rem; }
label { display: grid; gap: .3rem; font-size: .8rem; color: var(--muted); }
label > input, label > select, label > textarea { color: var(--ink); font-size: .9rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .4rem .8rem; border-radius: var(--radius-sm); font-size: .84rem; line-height: 1.35;
  border: 1px solid var(--line); background: var(--surface);
  font-weight: 500; cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(.92); }
.btn.small { padding: .26rem .55rem; font-size: .76rem; }
.btn svg { width: 15px; height: 15px; }
.btn.small svg { width: 14px; height: 14px; }
.btn:disabled { opacity: .55; cursor: default; }

.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px;
  border: 0; border-radius: var(--radius-sm); background: var(--blue-soft); color: var(--blue); cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn[aria-pressed="false"] { background: transparent; color: var(--muted); }
.icon-btn[aria-expanded="true"] { background: var(--blue); color: var(--on-accent); }

/* ================= App shell ================= */

.app-body { padding: 18px; min-height: 100vh; }

.shell {
  display: grid; grid-template-columns: 210px minmax(0, 1fr);
  min-height: calc(100vh - 36px);
  background: var(--surface); border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: 0 30px 60px -40px rgb(10 26 74 / 35%);
}
.shell.with-panel { grid-template-columns: 210px minmax(0, 1fr) 330px; }

.sidebar { display: flex; flex-direction: column; gap: 1.5rem; padding: 26px 16px; border-right: 1px solid var(--line); background: var(--sidebar-bg); color: var(--sidebar-ink); }
.logo { display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.15rem; color: var(--sidebar-ink); text-decoration: none; padding: 0 .5rem; }
.logo-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--blue); color: var(--on-accent); }
.logo-mark svg { width: 18px; height: 18px; }
.nav { display: grid; gap: 4px; }
.nav-bottom { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--line); }
.nav-item {
  display: flex; align-items: center; gap: .75rem; width: 100%;
  padding: .48rem .65rem; border: 0; border-radius: var(--radius-sm); background: none; font-size: .88rem;
  color: var(--muted); font-weight: 500; text-align: left; cursor: pointer;
}
.nav-item svg { width: 17px; height: 17px; }
.nav-item:hover { color: var(--sidebar-ink); background: var(--sidebar-hover); }
.nav-item[aria-current="page"] { color: var(--sidebar-ink); font-weight: 600; }
.nav-item[aria-current="page"] svg { color: var(--on-accent); background: var(--blue); border-radius: 6px; padding: 3px; width: 23px; height: 23px; margin: -3px; }

.main { display: flex; flex-direction: column; min-width: 0; background: var(--page); }
.topbar { display: flex; align-items: center; gap: 1rem; padding: 18px 26px; background: var(--surface); }
.search {
  display: flex; align-items: center; gap: .6rem; flex: 1; max-width: 420px;
  padding: 0 .9rem; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted);
}
.search svg { width: 18px; height: 18px; }
.search-wrap { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 420px; margin: 0; }
.search-wrap .search { max-width: none; }

/* Piezas que solo usan algunos diseños (p. ej. el Diseño 2 - Marrón); en el resto quedan ocultas. */
.nav-label, .side-card, .view-hero, .search-area, .search-go, .cat-cards { display: none; }
.search input { border: 0; background: transparent; padding: .65rem 0; outline: none; font-size: .9rem; }
.me { margin-left: auto; display: flex; align-items: center; gap: .6rem; font-weight: 500; }
.avatar {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--navy); color: #fff; font-size: .8rem; font-weight: 600;
}

.me { position: relative; }
.me-btn { display: flex; align-items: center; gap: .6rem; padding: 4px 8px 4px 4px; border: 0; border-radius: 999px; background: none; cursor: pointer; text-align: left; }
.me-btn:hover, .me-btn[aria-expanded="true"] { background: var(--surface-2); }
.me-name { display: grid; line-height: 1.2; }
.me-name strong { font-weight: 600; font-size: .88rem; }
.me-name small { color: var(--muted); font-size: .72rem; }
.me-btn .chev { width: 16px; height: 16px; color: var(--muted); }
.me-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; min-width: 220px;
  display: grid; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 20px 40px -18px rgb(10 26 74 / 40%);
}
.me-menu button, .me-menu a {
  display: flex; align-items: center; gap: .55rem; padding: .42rem .6rem; border: 0; border-radius: 7px;
  background: none; text-align: left; cursor: pointer; font-size: .82rem; color: var(--ink); text-decoration: none;
}
.me-menu button:hover, .me-menu a:hover { background: var(--surface-2); }
.me-menu button svg, .me-menu a svg { width: 17px; height: 17px; color: var(--muted); }
.me-menu .danger, .me-menu .danger svg { color: var(--danger); }
.me-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; width: auto; }

.content { padding: 22px 26px 32px; display: grid; gap: 22px; align-content: start; }
.view { display: grid; gap: 22px; }
.block { background: var(--surface); border-radius: var(--radius); padding: 20px 22px; min-width: 0; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 16px; }
.pill-link {
  border: 0; border-radius: 8px; padding: .3rem .75rem; background: var(--blue-soft); color: var(--blue);
  font-weight: 600; font-size: .8rem; cursor: pointer;
}

/* ================= Portadas ================= */

.cover {
  position: relative; aspect-ratio: 2 / 3; width: 100%;
  border-radius: 6px; overflow: hidden; background: var(--surface-2);
  box-shadow: var(--shadow-cover);
}
.cover img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.cover-gen {
  display: flex; flex-direction: column; justify-content: space-between; height: 100%;
  padding: 12% 10%;
  background: linear-gradient(160deg, hsl(var(--hue) 62% 42%), hsl(var(--hue) 70% 26%));
  color: #fff;
}
.cover-gen::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 7%; background: rgb(0 0 0 / 18%); }
.cover-gen .g-area { font-size: .62em; letter-spacing: .04em; opacity: .8; }
.cover-gen .g-title {
  font-family: var(--font-cover); font-size: 1.15em; line-height: 1.1;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.cover-gen .g-author { font-size: .62em; opacity: .85; }
.cover-wait { display: grid; place-items: center; height: 100%; text-align: center; padding: 1rem; color: var(--muted); font-size: .8rem; }
.cover-wait.error { color: var(--danger); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--blue); animation: spin .9s linear infinite; margin: 0 auto .5rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Tarjeta de libro (estante, categorías, biblioteca) */
.book {
  position: relative; display: grid; gap: .55rem; align-content: start;
  padding: 0; border: 0; background: none; text-align: left; cursor: pointer; min-width: 0;
}
.book .cover { transition: transform .18s ease, box-shadow .18s ease; }
.book:hover .cover, .book.active .cover { transform: translateY(-4px); box-shadow: 0 18px 30px -14px rgb(10 26 74 / 55%); }
.book.active .cover { outline: 3px solid var(--blue); outline-offset: 3px; }
.book-title { font-weight: 600; font-size: .86rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-author { color: var(--muted); font-size: .76rem; margin-top: -.35rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  border: 0; background: rgb(255 255 255 / 92%); color: var(--muted); cursor: pointer;
  opacity: 0; transition: opacity .15s;
}
.fav svg { width: 15px; height: 15px; }
.book:hover .fav, .book:focus-within .fav, .fav.on { opacity: 1; }
.fav.on { color: #e5484d; }
.fav.on svg { fill: currentColor; }

.shelf {
  display: grid; grid-auto-flow: column; grid-auto-columns: 150px; gap: 18px;
  overflow-x: auto; padding: 4px 2px 14px; scroll-snap-type: x proximity;
}
.shelf .book { scroll-snap-align: start; }

.chips-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; }
.chip-btn {
  flex: none; padding: .28rem .75rem; border-radius: 8px; border: 0;
  background: var(--blue-soft); color: var(--soft-ink); font-size: .8rem; font-weight: 500; cursor: pointer;
}
.chip-btn .n { opacity: .55; margin-left: .3rem; }
.chip-btn[aria-pressed="true"] { background: var(--blue); color: var(--on-accent); }

.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 220px)); gap: 12px; margin-bottom: 16px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 22px 18px; }

.empty { grid-column: 1 / -1; text-align: center; padding: 2.5rem 1rem; color: var(--muted); }

/* ================= Todos los libros ================= */

.library-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 22px; }
.library-bar p { margin: .15rem 0 0; font-size: .82rem; }
.library-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.library-tools select { width: auto; padding: .45rem .7rem; font-size: .84rem; }
.toggle { display: flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--surface-2); }

.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 26px 20px; }
.wall .book { text-align: center; }
.wall .book-author { margin-top: -.4rem; }

.wall.list { grid-template-columns: 1fr; gap: 0; }
.wall.list .book {
  grid-template-columns: 46px minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) 50px;
  align-items: center; gap: 1rem; padding: 10px 6px; text-align: left; border-bottom: 1px solid var(--line);
}
.wall.list .book:hover { background: var(--surface-2); }
.wall.list .book .cover { box-shadow: 0 4px 10px -6px rgb(10 26 74 / 50%); font-size: 6px; }
.wall.list .book:hover .cover, .wall.list .book.active .cover { transform: none; }
.wall.list .book-author { margin: 0; }
.wall.list .fav { display: none; }
.row-meta { color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { display: none; }
.wall.list .row-meta { display: block; }

/* ================= Panel de detalle ================= */

.panel {
  position: relative; background: var(--panel-bg); color: var(--panel-ink);
  padding: 28px 24px 26px; overflow-y: auto; max-height: calc(100vh - 36px);
  position: sticky; top: 18px; align-self: start; height: calc(100vh - 36px);
}
/* Apertura: el panel entra deslizándose y su contenido aparece en cascada; al cerrar sale hacia la derecha. */
.panel:not([hidden]) { animation: panel-in .46s cubic-bezier(.22, .9, .24, 1) both; }
.panel.closing { animation: panel-out .26s cubic-bezier(.5, 0, .9, .4) both; pointer-events: none; }
@keyframes panel-in { from { opacity: 0; transform: translateX(56px); } }
@keyframes panel-out { to { opacity: 0; transform: translateX(44px); } }
.panel-body > * { animation: p-item .5s cubic-bezier(.22, .9, .24, 1) both; }
.panel-body > :nth-child(1) { animation-delay: .04s; }
.panel-body > :nth-child(2) { animation-delay: .09s; }
.panel-body > :nth-child(3) { animation-delay: .13s; }
.panel-body > :nth-child(4) { animation-delay: .17s; }
.panel-body > :nth-child(5) { animation-delay: .21s; }
.panel-body > :nth-child(6) { animation-delay: .25s; }
.panel-body > :nth-child(n+7) { animation-delay: .29s; }
@keyframes p-item { from { opacity: 0; transform: translateY(12px); } }
.panel-cover .cover { animation: p-cover .6s cubic-bezier(.22, .9, .24, 1) both .06s; }
@keyframes p-cover { from { opacity: 0; transform: translateY(16px) scale(.95) rotate(-2deg); } }
.panel-close {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  border: 0; background: rgb(255 255 255 / 10%); color: #fff; cursor: pointer;
}
.panel-close:hover { background: rgb(255 255 255 / 20%); }
.panel-close svg { width: 16px; height: 16px; }
.panel-cover {
  width: 62%; margin: 8px auto 20px; padding: 10px;
  background: rgb(255 255 255 / 8%); border-radius: 12px;
}
.panel-cover .cover { font-size: 16px; box-shadow: 0 18px 30px -12px rgb(0 0 0 / 60%); }
.panel h3 { text-align: center; font-size: 1.05rem; font-weight: 600; }
.panel .p-author { text-align: center; color: rgb(255 255 255 / 65%); font-size: .84rem; margin-top: .2rem; }
.p-tags { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 14px 0 4px; }
.p-tag { padding: .2rem .6rem; border-radius: 6px; background: rgb(255 255 255 / 10%); font-size: .74rem; }
.p-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 18px 0; padding: 12px 0; border-block: 1px solid rgb(255 255 255 / 12%); text-align: center; }
.p-stats div + div { border-left: 1px solid rgb(255 255 255 / 12%); }
.p-stats strong { display: block; font-size: .95rem; font-weight: 600; }
.p-stats span { font-size: .72rem; color: rgb(255 255 255 / 60%); }
.p-details { display: grid; grid-template-columns: auto 1fr; gap: .35rem .9rem; margin: 0 0 18px; font-size: .8rem; }
.p-details dt { color: rgb(255 255 255 / 55%); }
.p-details dd { margin: 0; color: rgb(255 255 255 / 90%); overflow-wrap: anywhere; }
.p-heading { font-size: .8rem; font-weight: 600; color: rgb(255 255 255 / 60%); margin: 0 0 6px; }
.p-summary {
  font-size: .82rem; line-height: 1.65; color: rgb(255 255 255 / 80%); margin: 0 0 14px;
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden;
}
.p-summary.open { -webkit-line-clamp: unset; }
.p-more { border: 0; background: none; padding: 0; margin: -8px 0 14px; color: var(--panel-link); font-size: .78rem; cursor: pointer; }
.p-keywords { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 20px; }
.p-keywords span, .p-keywords button { font: inherit; font-size: .72rem; color: rgb(255 255 255 / 70%); background: none; border: 1px solid rgb(255 255 255 / 18%); border-radius: 999px; padding: .1rem .55rem; }
.p-keywords button { cursor: pointer; transition: background .15s, color .15s; }
.p-keywords button:hover { background: rgb(255 255 255 / 12%); color: var(--panel-ink); }
.p-actions { display: flex; gap: 8px; justify-content: center; }
.p-actions .btn.primary { padding: .45rem 1rem; }
.panel .btn.ghost, .p-admin .btn {
  background: rgb(255 255 255 / 8%); border-color: rgb(255 255 255 / 16%); color: #fff;
}
.panel .btn.ghost:hover, .p-admin .btn:hover { background: rgb(255 255 255 / 16%); }
.p-actions .btn.ghost.on { color: #ff7a7f; }
.p-actions .btn.ghost.on svg { fill: currentColor; }
.p-admin { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 18px; padding-top: 16px; border-top: 1px solid rgb(255 255 255 / 12%); }
.p-admin .btn.danger { color: #ff8f86; }
.p-note { text-align: center; font-size: .72rem; color: rgb(255 255 255 / 45%); margin-top: 12px; }
.p-status { text-align: center; margin: 1rem 0; color: rgb(255 255 255 / 80%); }

.cover { font-size: 12px; }

/* ================= Panel de control ================= */

.dash { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 22px; align-items: start; }
.dash-main { display: grid; gap: 18px; min-width: 0; }
.greet { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.greet p { margin: .15rem 0 0; font-size: .84rem; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { display: flex; justify-content: space-between; align-items: flex-end; gap: .5rem; background: var(--surface); border-radius: var(--radius); padding: 16px 18px; }
.kpi strong { display: block; font-size: 1.65rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi span { font-size: .78rem; color: var(--muted); }
.kpi-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); flex: none; }
.kpi-icon svg { width: 19px; height: 19px; }

.dash-row { display: grid; gap: 18px; }
.dash-row.two { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.dash-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.chart { position: relative; height: 220px; }
.chart svg { width: 100%; height: 100%; display: block; stroke: none; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 11px; }
.chart .line { fill: none; stroke: var(--blue); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--blue); stroke: var(--surface); stroke-width: 2; }
.chart .crosshair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .peak-label { fill: var(--ink); font-size: 11px; font-weight: 600; }
.chart .hit { fill: transparent; cursor: crosshair; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 3; transform: translate(-50%, calc(-100% - 12px));
  background: var(--navy); color: #fff; font-size: .76rem; padding: .35rem .6rem; border-radius: 7px; white-space: nowrap;
}
.chart-table summary { cursor: pointer; font-size: .78rem; color: var(--muted); margin-top: 6px; }
.chart-table table { margin-top: 6px; font-size: .78rem; }
.chart-table td, .chart-table th { padding: .25rem .4rem; }

.hbars { display: grid; gap: 11px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; font-size: .8rem; }
.hbar .track { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--surface-2); }
.hbar .fill { height: 100%; border-radius: 4px; background: var(--blue); min-width: 4px; }
.hbar .val { font-variant-numeric: tabular-nums; color: var(--muted); }

.status-list { display: grid; gap: 10px; font-size: .84rem; }
.status-item { display: flex; align-items: center; gap: .6rem; }
.status-item .ico { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--surface-2); font-size: .8rem; }
.status-item .num { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.status-item.bad .ico { background: #fde8e6; color: var(--danger); }
.status-item.wait .ico { background: #fff4e0; color: var(--warn); }

.mini-list { display: grid; gap: 10px; }
.mini {
  display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: .7rem; align-items: center;
  padding: 0; border: 0; background: none; text-align: left; cursor: pointer;
}
.mini .cover { font-size: 5px; box-shadow: 0 4px 10px -6px rgb(10 26 74 / 50%); }
.mini strong { display: block; font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini span { display: block; font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini:hover strong { color: var(--blue); }

.dash-side { display: grid; gap: 20px; position: sticky; top: 18px; }
.side-sec { border-top: 1px solid var(--line); padding-top: 18px; }
.side-sec .block-head { margin-bottom: 12px; }
.side-sec h2 { font-size: .95rem; }
.profile { display: grid; grid-template-columns: 52px 1fr; gap: .2rem .9rem; align-items: center; }
.profile .avatar { width: 52px; height: 52px; font-size: 1.05rem; grid-row: span 2; }
.profile strong { font-weight: 600; }
.profile .role { color: var(--muted); font-size: .8rem; }
.profile-stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: 14px; }
.profile-stats span { display: block; font-size: .72rem; color: var(--muted); }
.profile-stats strong { font-size: .92rem; }

.cal-nav { display: flex; align-items: center; gap: 2px; font-size: .78rem; color: var(--muted); }
.cal-nav .icon-btn { width: 26px; height: 26px; }
.cal-nav span { min-width: 92px; text-align: center; white-space: nowrap; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; font-size: .76rem; }
.calendar .dow { color: var(--muted); font-size: .7rem; padding-bottom: 2px; }
.calendar .day { aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; color: var(--ink); }
.calendar .day.has { background: var(--blue); color: #fff; font-weight: 600; }
.calendar .day.today { box-shadow: inset 0 0 0 1.5px var(--navy); }

/* ================= Página del libro ================= */

.book-page { display: grid; grid-template-columns: minmax(180px, 260px) minmax(0, 1fr); gap: 32px; align-items: start; animation: p-item .45s cubic-bezier(.22, .9, .24, 1) both; }
.bp-cover .cover { font-size: 18px; }
.bp-cover .actions-col { display: grid; gap: 8px; margin-top: 18px; }
.bp-cover .btn { width: 100%; }
.bp-cover .btn.on { color: #e5484d; }
.bp-cover .btn.on svg { fill: currentColor; }
.book-page h1 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); line-height: 1.2; margin-bottom: 6px; }
.bp-authors { font-size: 1.02rem; color: var(--muted); margin: 0 0 14px; }
.bp-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; }
.bp-tags span { padding: .25rem .7rem; border-radius: 999px; background: var(--blue-soft); color: var(--soft-ink); font-size: .8rem; font-weight: 500; }
/* Cada sección (Descripción, Conceptos, Ficha) separada por una línea y con su título destacado. */
.bp-section { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.bp-tags + .bp-section { margin-top: 6px; }
.book-page .bp-section > h2 {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 14px; font-size: 1.15rem; font-weight: 700; color: var(--ink);
}
.book-page .bp-section > h2::before {
  content: ""; width: 4px; height: 1.1em; border-radius: 2px; background: var(--blue); flex: none;
}
.bp-description { font-size: 1rem; line-height: 1.75; max-width: 72ch; margin: 0; white-space: pre-line; }
.bp-toc { list-style: none; margin: 0; padding: 0; max-width: 72ch; counter-reset: none; }
.bp-toc li { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.bp-toc li span:first-child { flex: 1; }
.bp-toc li.lvl1 { font-weight: 600; }
.bp-toc li.lvl2 { padding-left: 22px; font-size: .92rem; color: var(--muted); }
.bp-toc .pg { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 400; font-size: .85rem; }
.bp-concepts { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.bp-concepts div { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface-2); border-left: 3px solid var(--blue); }
.bp-concepts strong { display: block; margin-bottom: 4px; }
.bp-concepts p { margin: 0; font-size: .88rem; line-height: 1.55; color: var(--muted); }
.bp-details { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 24px; margin: 0; }
.bp-details div { border-top: 1px solid var(--line); padding-top: 8px; }
.bp-details dt { font-size: .76rem; color: var(--muted); }
.bp-details dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.bp-keywords { display: flex; flex-wrap: wrap; gap: 6px; }
.bp-keywords button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: .2rem .7rem; font: inherit; font-size: .8rem; cursor: pointer; color: var(--ink); }
.bp-keywords button:hover { border-color: var(--blue); color: var(--blue); }
.bp-note { margin-top: 22px; font-size: .78rem; color: var(--muted); }
.p-more-info { display: block; width: 100%; margin-top: 10px; }

/* Página del libro: tapa que se agranda, botón del índice y palabras clave en la columna izquierda. */
.bp-cover-btn { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 6px; }
.bp-cover-btn .cover { transition: transform .2s ease, box-shadow .2s ease; }
.bp-cover-btn:hover .cover { transform: translateY(-3px); box-shadow: 0 24px 36px -16px rgb(10 26 74 / 55%); }
.toc-btn { justify-content: flex-start; }
.toc-btn span { flex: 1; text-align: left; }
.toc-btn small { min-width: 24px; padding: .05rem .45rem; border-radius: 999px; background: var(--blue-soft); color: var(--soft-ink); font-size: .72rem; font-weight: 600; text-align: center; }
.bp-side-keywords { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.bp-side-keywords h3 { font-size: .82rem; font-weight: 600; color: var(--muted); margin: 0 0 10px; font-family: var(--font); }

/* Ventana del índice de contenidos */
.toc-dialog { width: min(620px, calc(100vw - 32px)); display: none; flex-direction: column; max-height: min(82vh, 760px); }
.toc-dialog[open] { display: flex; animation: cover-zoom .26s cubic-bezier(.22, .9, .24, 1) both; }
.toc-dialog .dialog-head h2 { margin: 0; }
.toc-dialog .dialog-head p { margin: 2px 0 0; }
.toc-dialog .dialog-body { flex: 1; overflow: auto; padding-top: 8px; }
.toc-dialog .bp-toc { max-width: none; }
.toc-foot { display: flex; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--line); }

/* Tapa del panel: al tocarla aparece un menú con tres opciones. */
.panel-cover.has-menu { position: relative; }
.cover-btn { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 6px; }
.cover-btn .cover { transition: transform .2s ease, box-shadow .2s ease; }
.cover-btn:hover .cover, .cover-btn[aria-expanded="true"] .cover { transform: translateY(-3px); box-shadow: 0 22px 34px -14px rgb(0 0 0 / 70%); }
.cover-menu {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 3;
  display: grid; gap: 0; min-width: 168px; padding: 4px;
  background: var(--surface); color: var(--ink); border-radius: 12px;
  box-shadow: 0 18px 40px -12px rgb(0 0 0 / 55%);
  animation: menu-in .18s cubic-bezier(.22, .9, .24, 1) both;
}
@keyframes menu-in { from { opacity: 0; transform: translate(-50%, 8px) scale(.97); } }
.cover-menu button {
  display: flex; align-items: center; gap: .5rem; padding: .38rem .6rem; border: 0; border-radius: 7px;
  background: none; color: inherit; font: inherit; font-size: .8rem; line-height: 1.3; text-align: left; cursor: pointer; white-space: nowrap;
}
.cover-menu button:hover, .cover-menu button:focus-visible { background: var(--surface-2); }
.cover-menu svg { width: 15px; height: 15px; color: var(--blue); }

/* Tapa en grande */
.cover-view { width: fit-content; max-width: min(92vw, 560px); padding: 0; border: 0; background: transparent; box-shadow: none; overflow: visible; cursor: zoom-out; outline: none; }
.cover-view:focus, .cover-view:focus-visible { outline: none; }
#cover-view-body { display: grid; justify-items: center; }
.cover-view::backdrop { background: rgb(5 10 25 / 82%); }
.cover-view[open] #cover-view-body { animation: cover-zoom .32s cubic-bezier(.22, .9, .24, 1) both; }
@keyframes cover-zoom { from { opacity: 0; transform: scale(.88); } }
#cover-view-body img { display: block; max-width: 100%; max-height: 82vh; border-radius: 6px; box-shadow: 0 30px 70px -20px rgb(0 0 0 / 80%); }
.cover-view-gen { width: min(70vw, 380px); }
.cover-view-gen .cover { font-size: 22px; }
#cover-view-title { margin: 14px 0 0; text-align: center; color: #fff; font-family: var(--font-display); font-size: 1rem; text-shadow: 0 1px 8px rgb(0 0 0 / 60%); }

/* Etiquetas y autores que llevan a "más de lo mismo". */
button.p-tag { border: 0; font: inherit; font-size: .74rem; color: inherit; cursor: pointer; transition: background .15s; }
button.p-tag:hover { background: rgb(255 255 255 / 22%); }
.author-link { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; transition: text-decoration-color .15s; }
.author-link:hover { text-decoration-color: currentColor; }
.bp-tags button { border: 0; padding: .25rem .7rem; border-radius: 999px; background: var(--blue-soft); color: var(--soft-ink); font: inherit; font-size: .8rem; font-weight: 500; cursor: pointer; }
.bp-tags button:hover { background: var(--blue); color: var(--on-accent); }
.filter-kind { display: block; font-family: var(--font); font-size: .74rem; font-weight: 500; color: var(--muted); margin-bottom: 2px; }
.clear-filter { margin-left: 10px; font-family: var(--font); font-size: .8rem; vertical-align: middle; }
.summary-src { display: block; margin: -6px 0 14px; font-size: .72rem; opacity: .6; }
.bp-description + .summary-src { margin: 8px 0 0; color: var(--muted); opacity: 1; }

@media (max-width: 760px) {
  .book-page { grid-template-columns: 1fr; gap: 20px; }
  .bp-cover { max-width: 220px; }
}

/* ================= Configuración: orden de la ficha ================= */

.sort-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; max-width: 460px; counter-reset: sec; }
.sort-list li {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); cursor: grab; user-select: none; counter-increment: sec; transition: box-shadow .15s, opacity .15s;
}
.sort-list li::before { content: counter(sec); width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--blue-soft); color: var(--soft-ink); font-size: .72rem; font-weight: 700; flex: none; }
.sort-list li .grip { color: var(--muted); display: grid; }
.sort-list li .grip svg { width: 16px; height: 16px; }
.sort-list li span.name { flex: 1; font-weight: 500; }
.sort-list li.dragging { opacity: .45; }
.sort-list li.over { box-shadow: 0 -2px 0 var(--blue) inset, 0 2px 0 var(--blue); }
.sort-list .move { width: 26px; height: 26px; }

/* ================= Configuración: IA ================= */

.ai-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; margin-bottom: 14px; }
.ai-key { grid-column: 1 / -1; display: grid; gap: 6px; padding: 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.ai-key p { margin: 0; }
.ai-form .switch { grid-column: 1 / -1; }
.ai-form .switch small { display: block; }
.ai-save { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; }
.ai-ok { color: #1d7a4a; }
.badge.activa { background: #e3f6ec; color: #1d7a4a; }
.badge.pausada, .badge.sin_clave { background: #eceff4; color: #4f5870; }
.badge.tope { background: #fff4e0; color: #8a5a00; }
.secret-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-bottom: 12px; }
.secret-card { display: grid; gap: 8px; align-content: start; padding: 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.secret-card p { margin: 0; }
.daybars { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding-top: 18px; position: relative; }
.daybars .bar { flex: 1; min-width: 4px; border-radius: 4px 4px 0 0; background: var(--blue); position: relative; }
.daybars .bar.zero { background: var(--line); min-height: 2px; }
.daybars .bar:hover { filter: brightness(1.15); }
.daybars-axis { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); margin-top: 6px; }

/* ================= Selector de diseños ================= */

.theme-actions { display: flex; gap: 8px; }
.theme-group { font-family: var(--font); font-size: .82rem; font-weight: 600; color: var(--muted); margin: 6px 0 10px; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.theme-card {
  display: grid; gap: 10px; padding: 10px; border: 2px solid var(--line); border-radius: var(--radius);
  background: var(--surface); text-align: left; cursor: pointer; color: var(--ink);
}
.theme-card:hover { border-color: var(--line-strong); }
.theme-card[aria-pressed="true"] { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.theme-info strong { display: block; font-size: .9rem; }
.theme-info span { display: block; font-size: .76rem; color: var(--muted); line-height: 1.4; margin-top: 2px; }
.theme-info em { display: inline-block; margin-top: 6px; font-style: normal; font-size: .7rem; font-weight: 600; color: var(--blue); }

/* Vista previa en miniatura: usa las variables de su propio data-theme. */
.theme-preview {
  display: grid; grid-template-columns: 22% 1fr 26%; height: 118px; overflow: hidden;
  border-radius: calc(var(--radius) * .6); background: var(--page); background-image: var(--texture);
  font-family: var(--font-display); color: var(--ink); border: 1px solid var(--line);
}
.tp-side { background: var(--sidebar-bg); padding: 8px 6px; display: grid; align-content: start; gap: 5px; border-right: 1px solid var(--line); }
.tp-side .tp-mark { width: 14px; height: 14px; border-radius: 4px; background: var(--blue); margin-bottom: 4px; }
.tp-side i { height: 4px; border-radius: 2px; background: var(--sidebar-muted); opacity: .55; }
.tp-side i:first-of-type { background: var(--blue); opacity: 1; }
.tp-main { padding: 8px; display: grid; align-content: start; gap: 6px; }
.tp-title { font-size: 10px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; }
.tp-shelf { display: flex; gap: 4px; padding-bottom: 3px; border-bottom: 4px solid var(--shelf); }
.tp-shelf b { width: 15px; height: 22px; border-radius: 2px; box-shadow: var(--shadow-cover); }
.tp-shelf b:nth-child(1) { background: var(--blue); }
.tp-shelf b:nth-child(2) { background: var(--teal); }
.tp-shelf b:nth-child(3) { background: var(--navy-2); }
.tp-shelf b:nth-child(4) { background: var(--muted); }
.tp-chips { display: flex; gap: 3px; }
.tp-chips i { height: 7px; width: 18px; border-radius: 3px; background: var(--blue-soft); }
.tp-chips i:first-child { background: var(--blue); }
.tp-panel { background: var(--panel-bg); padding: 10px 7px; display: grid; justify-items: center; align-content: start; gap: 5px; }
.tp-panel b { width: 24px; height: 34px; border-radius: 2px; background: var(--surface); opacity: .9; }
.tp-panel i { height: 3px; width: 80%; border-radius: 2px; background: var(--panel-ink); opacity: .35; }
.tp-panel span { margin-top: 3px; height: 8px; width: 70%; border-radius: 3px; background: var(--blue); }

/* ================= Mi perfil ================= */

.profile-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; }
.profile-card { display: grid; justify-items: center; text-align: center; gap: .2rem; }
.profile-card form { width: 100%; max-width: 360px; margin-top: 16px; text-align: left; }
.avatar.xl { width: 84px; height: 84px; font-size: 1.6rem; margin-bottom: 10px; }
.profile-card p { margin: 0; font-size: .84rem; }
.pf-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; max-width: 360px; margin-top: 16px; }
.pf-stats div { padding: 10px 6px; border-radius: 10px; background: var(--surface-2); }
.pf-stats strong { display: block; font-size: 1.15rem; font-weight: 600; }
.pf-stats span { font-size: .72rem; color: var(--muted); }
.pf-logout { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.pf-logout p { margin: 0 0 10px; }

/* ================= Edición: portada ================= */

.cover-edit { display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: center; padding-bottom: 16px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.cover-edit .cover { font-size: 8px; }
.cover-edit .actions-col { display: grid; gap: 8px; justify-items: start; }
.cover-edit .muted { font-size: .78rem; margin: 0; }

/* ================= Subida y usuarios ================= */

.banner { padding: .75rem 1rem; border-radius: var(--radius-sm); background: var(--blue-soft); color: var(--soft-ink); font-size: .85rem; margin-bottom: 14px; }
.banner.warn { background: #fff4e0; color: #7a4d00; }
.dropzone {
  display: grid; place-items: center; gap: .4rem; text-align: center; color: var(--ink); font-size: .92rem;
  padding: 2.8rem 1rem; border: 2px dashed var(--line); border-radius: var(--radius); cursor: pointer;
  transition: background .15s, border-color .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--blue); background: var(--blue-soft); }
.drop-icon { width: 34px; height: 34px; color: var(--blue); }
.upload-list { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 10px; }
.upload-list li { display: grid; grid-template-columns: 1fr auto; gap: .2rem 1rem; font-size: .86rem; }
.upload-list progress { grid-column: 1 / -1; width: 100%; height: 5px; accent-color: var(--blue); }

.user-form { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) auto; gap: 12px; align-items: end; }
.form-note { margin: 10px 0 0; }

/* ================= Correos ================= */

.mail-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 22px; }
.switch { display: grid; grid-template-columns: auto 1fr; gap: .8rem; align-items: center; cursor: pointer; color: var(--ink); font-size: .88rem; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { position: relative; width: 40px; height: 23px; border-radius: 999px; background: var(--line-strong); transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgb(0 0 0 / 25%); }
.switch input:checked + .track { background: var(--blue); }
.switch input:checked + .track::after { transform: translateX(17px); }
.switch input:focus-visible + .track { outline: 2px solid var(--blue); outline-offset: 2px; }
.switch input:disabled + .track { opacity: .45; }
.switch small { display: block; font-size: .76rem; }
.switch.big { padding: 14px; border-radius: 12px; background: var(--surface-2); margin-bottom: 14px; }
.switch.big strong { font-weight: 600; }
.kind-list { display: grid; gap: 12px; padding: 4px 6px; }
.kind-list.off { opacity: .5; }
.smtp-line { display: flex; align-items: center; gap: .6rem; font-size: .86rem; margin-bottom: 8px; }
.test-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; margin-top: 14px; }

.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.enviado { background: #e3f6ec; color: #1d7a4a; }
.badge.bloqueado { background: #eceff4; color: #4f5870; }
.badge.sin_configurar { background: #fff4e0; color: #8a5a00; }
.badge.error { background: #fde8e6; color: var(--danger); }
.mail-table tbody tr { cursor: pointer; }
.mail-table tbody tr:hover { background: var(--surface-2); }
.mail-table td { vertical-align: top; }
.mail-table .subj { font-weight: 500; }
.mail-body { white-space: pre-wrap; font: inherit; font-size: .88rem; line-height: 1.6; background: var(--surface-2); padding: 14px; border-radius: 10px; margin: 12px 0 0; }
.mail-meta { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; font-size: .86rem; margin: 0; }
.mail-meta dt { color: var(--muted); }
.mail-meta dd { margin: 0; overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { text-align: left; padding: .7rem .5rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: .78rem; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.btn.danger { color: var(--danger); }

/* ================= Diálogos ================= */

dialog {
  border: 0; border-radius: var(--radius); padding: 0; color: var(--ink); background: var(--surface);
  width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  box-shadow: 0 30px 80px -20px rgb(10 26 74 / 50%);
}
dialog::backdrop { background: rgb(10 26 74 / 55%); }
dialog.narrow { width: min(420px, calc(100vw - 32px)); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 1rem; }
.dialog-body { padding: 20px; overflow: auto; }
.stack { display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; }

.reader { width: calc(100vw - 32px); height: calc(100vh - 32px); max-width: none; max-height: none; display: none; flex-direction: column; overflow: hidden; }
.reader[open] { display: flex; }
.reader-head { display: flex; align-items: center; gap: .6rem; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.reader-head strong { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader iframe { flex: 1; width: 100%; border: 0; background: var(--surface-2); }

/* ================= Login ================= */

.login-body {
  min-height: 100vh; min-height: 100dvh; padding: clamp(12px, 3vh, 24px);
  background: var(--login-bg);
  display: grid; place-items: center;
}
.login-frame {
  width: min(1040px, 100%); padding: clamp(18px, 4vh, 32px) 48px clamp(20px, 5vh, 44px);
  background: var(--login-frame-bg); border: 1px solid var(--login-border); border-radius: calc(var(--radius-lg) + 6px);
}
.login-frame .logo { padding: 0; margin-bottom: clamp(12px, 3vh, 28px); }
.login-frame .logo-mark { background: var(--teal); }
.login-grid { display: grid; grid-template-columns: minmax(0, 390px) minmax(0, 1fr); gap: 48px; align-items: center; }
.login-card { padding: clamp(22px, 4vh, 36px) 40px clamp(20px, 3.5vh, 30px); background: var(--surface); border: 1px solid var(--login-border); border-radius: 22px; }
.login-card h1 { text-align: center; font-size: 1.35rem; font-weight: 600; margin-bottom: clamp(14px, 3vh, 24px); }
.login-card form { display: grid; gap: clamp(10px, 2vh, 14px); }
.login-card .error-msg:empty { display: none; }
.field {
  display: flex; align-items: center; gap: .7rem; padding: 0 1rem;
  border: 1.5px solid transparent; border-radius: var(--radius-sm); background: var(--field-bg); color: var(--muted);
  transition: border-color .15s, background .15s;
}
.field:focus-within { border-color: var(--teal); background: var(--surface); color: var(--teal); }
.field input { border: 0; background: transparent; padding: .7rem 0; outline: none; font-size: .9rem; color: var(--ink); }
.field svg { width: 18px; height: 18px; }
.field .show-pass { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px; display: grid; }
.login-row { display: flex; justify-content: space-between; align-items: center; gap: .5rem; font-size: .76rem; color: var(--muted); }
.check { display: flex; align-items: center; gap: .45rem; cursor: pointer; font-size: .76rem; }
.check input { width: 15px; height: 15px; accent-color: var(--teal); margin: 0; }
.link-btn { border: 0; background: none; padding: 0; color: var(--link-ink); font-size: .76rem; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.login-hint { font-size: .78rem; color: var(--navy-2); background: var(--teal-soft); border-radius: 8px; padding: .6rem .8rem; }
.login-submit {
  margin-top: clamp(4px, 1.5vh, 12px); padding: .65rem; border: 0; border-radius: 10px;
  background: var(--btn-dark); color: var(--on-accent); font-weight: 600; font-size: .88rem; cursor: pointer;
}
.login-submit:hover { filter: brightness(1.15); }
.login-submit:disabled { opacity: .6; }
.login-foot { text-align: center; font-size: .76rem; color: var(--muted); margin: clamp(10px, 2vh, 16px) 0 0; }
.narrow-frame { width: min(480px, 100%); }
.login-lead { text-align: center; color: var(--muted); font-size: .86rem; margin: -10px 0 18px; }
.forgot-view form { display: grid; gap: clamp(10px, 2vh, 14px); }
.forgot-view .login-lead { margin-top: 0; }
.back-btn { display: block; margin: 14px auto 0; }
.login-foot a { color: var(--link-ink); font-weight: 500; text-underline-offset: 3px; }
.login-art svg { display: block; width: 100%; height: auto; max-height: min(420px, 62vh); stroke: none; }

/* ================= Responsive ================= */

@media (max-width: 1180px) {
  .shell.with-panel { grid-template-columns: 210px minmax(0, 1fr); }
  .panel {
    position: fixed; inset: 0 0 0 auto; top: 0; z-index: 30;
    width: min(380px, 100vw); height: 100vh; max-height: none;
    box-shadow: -20px 0 60px rgb(10 26 74 / 35%);
  }
}

@media (max-width: 1280px) {
  .dash { grid-template-columns: 1fr; }
  .dash-side { position: static; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .side-sec { border-top: 0; padding-top: 0; }
}

@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-row.two, .dash-row.three, .mail-grid { grid-template-columns: 1fr; }
  .user-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  [data-theme="marron"] .nav-label, [data-theme="marron"] .side-card, [data-theme="marron"] .search-area,
  [data-theme="marron"] .search-go { display: none; }
  [data-theme="marron"] .nav-item, [data-theme="marron"] .logo-word { font-size: 0; gap: 0; }
  [data-theme="marron"] .main { background: linear-gradient(var(--hero) 0 220px, var(--page) 220px); }
  [data-theme="marron"] .view-hero { font-size: 1.5rem; }
  [data-theme="marron"] .shelf { grid-auto-columns: 128px; }
  .app-body { padding: 0; }
  .shell, .shell.with-panel { grid-template-columns: 1fr; border-radius: 0; min-height: 100vh; }
  .sidebar { flex-direction: row; align-items: center; gap: 1rem; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .sidebar .logo span:not(.logo-mark), .sidebar .logo { font-size: 0; gap: 0; }
  .nav { display: flex; gap: 2px; }
  .nav-bottom { margin: 0 0 0 auto; padding: 0; border: 0; }
  .nav-item { width: auto; font-size: 0; gap: 0; padding: .55rem; }
  .topbar { padding: 12px 16px; }
  .me-name, .me-btn .chev { display: none; }
  .profile-grid { grid-template-columns: 1fr; }
  .content { padding: 16px; gap: 16px; }
  .block { padding: 16px; }
  .shelf { grid-auto-columns: 120px; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 18px 14px; }
  .wall { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 20px 14px; }
  .wall.list .book { grid-template-columns: 40px minmax(0, 1.3fr) minmax(0, 1fr) 40px; gap: .75rem; }
  .shelf, .chips-row, .sidebar { scrollbar-width: none; }
  .shelf::-webkit-scrollbar, .chips-row::-webkit-scrollbar, .sidebar::-webkit-scrollbar { display: none; }
  .wall.list .row-meta.area-col, .wall.list .row-meta.type-col { display: none; }
  .user-form { grid-template-columns: 1fr 1fr; }
  .login-grid { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-frame { padding: 24px; }
}

@media (max-width: 520px) {
  .login-body { padding: 12px; }
  .login-frame { padding: 20px 16px; border-radius: 20px; }
  .login-card { padding: 28px 20px; }
  .form-grid, .user-form { grid-template-columns: 1fr; }
}

/* Pantallas bajas (notebook con zoom, celular apaisado): el login se compacta para no tener scroll. */
@media (max-height: 560px) {
  .login-frame .logo { display: none; }
  .login-card h1 { font-size: 1.15rem; margin-bottom: 10px; }
  .field input { padding: .65rem 0; }
  .login-submit { padding: .7rem; }
  .login-foot { margin-top: 8px; }
  .login-art svg { max-height: 72vh; }
}
@media (max-height: 460px) {
  .login-foot, .login-lead { display: none; }
  .login-frame { padding-top: 14px; padding-bottom: 14px; }
  .login-card { padding-top: 16px; padding-bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Buscador dentro de los libros ---------- */
.topic-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.topic-row:empty { display: none; }
.hits { display: grid; gap: 14px; }
.hit { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.hit-cover { border: 0; padding: 0; background: none; cursor: pointer; align-self: start; }
.hit-cover .cover { width: 64px; }
.hit-title { border: 0; padding: 0; background: none; font: inherit; font-weight: 600; color: var(--ink); text-align: left; cursor: pointer; }
.hit-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.hit-snips { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .35rem; font-size: .84rem; line-height: 1.45; }
.hit-snips li { display: flex; gap: .5rem; align-items: baseline; }
.hit-snips .link-btn { flex: none; }
.hit-snips mark { background: var(--blue-soft); color: inherit; border-radius: 3px; padding: 0 .1em; }
.badge.sem { background: var(--blue-soft); color: var(--ink); margin-left: .4rem; }
.search-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-bottom: 14px; }
.search-mode { display: grid; gap: .7rem; align-content: start; padding: 14px; border-radius: 12px; background: var(--surface-2); }
.search-mode .btn { justify-self: start; }
.search-mode label:not(.switch) { display: grid; gap: .3rem; }
#search-block .kpis { margin-bottom: 14px; }
#search-block .kpi { background: var(--surface-2); }
@media (max-width: 900px) { #search-block .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Archivos por subir (con su categoría) ---------- */
.pending-box { margin-top: 16px; padding: 14px; border-radius: 12px; background: var(--surface-2); }
.pending-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.pending-bar label { display: flex; align-items: center; gap: .5rem; white-space: nowrap; }
.pending-bar strong { white-space: nowrap; }
.pending-actions { display: flex; gap: 8px; margin-left: auto; }
.pending-box > p { margin: .6rem 0; }
.pending-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pending-list li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, 240px) auto; gap: 10px; align-items: center;
  padding: 6px 8px; border-radius: 8px; background: var(--surface); font-size: .86rem; }
.pending-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-box select { max-width: 100%; }
@media (max-width: 600px) {
  .pending-list li { grid-template-columns: minmax(0, 1fr) auto; }
  .pending-list select { grid-column: 1 / -1; grid-row: 2; }
  .pending-actions { margin-left: 0; }
}

/* ---------- Espacio en el servidor ---------- */
.meter { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 4px 0 10px; }
.meter span { display: block; height: 100%; border-radius: inherit; background: var(--blue); }
.meter.warn span { background: var(--warn); }
.meter.bad span { background: var(--danger); }
.storage-main { margin: 0 0 .2rem; font-size: .95rem; }
#card-storage .status-list { margin-top: 14px; }
.storage-foot { margin: 14px 0 0; }
