:root{
  --primary:#556a39;
  --primary-dark:#43542d;
  --accent:#b99b52;
  --bg:#f4f7f1;
  --bg-soft:#eef3e8;
  --dark:#162018;
  --muted:#66715d;
  --border:#dbe3d2;
  --danger:#b91c1c;
  --warning:#8a6d1f;
  --card:#ffffff;
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{margin:0;font-family:Arial,sans-serif;background:linear-gradient(135deg,#f4f7f1 0%,#ffffff 55%,#eef3eb 100%);color:var(--dark)}
a{transition:all .25s ease}
.flash{position:fixed;top:16px;right:16px;padding:14px 16px;border-radius:12px;z-index:9999;box-shadow:0 8px 24px rgba(0,0,0,.1)}
.flash-success{background:#dcfce7;color:#166534}.flash-error{background:#fee2e2;color:#991b1b}
.card{background:var(--card);border:1px solid var(--border);border-radius:24px;box-shadow:0 8px 24px rgba(0,0,0,.05);transition:transform .25s ease, box-shadow .25s ease}
.card:hover{box-shadow:0 16px 38px rgba(0,0,0,.08)}
.alert-box{padding:14px 16px;border-radius:14px;margin:0 0 18px}.alert-warning{background:#fff8db;color:var(--warning);border:1px solid #ecd98c}
.section-separator{border:none;border-top:1px solid var(--border);margin:24px 0}.subheading{margin:0 0 12px}.compact-box p{margin:6px 0}
input,textarea,select{width:100%;padding:12px 14px;border-radius:14px;border:1px solid #cbd5e1;margin-bottom:14px;background:#fff;transition:border-color .2s ease, box-shadow .2s ease}
input:focus,textarea:focus,select:focus{outline:none;border-color:#889b6e;box-shadow:0 0 0 4px rgba(85,106,57,.10)}
textarea{min-height:130px;resize:vertical}
label{display:block;font-weight:700;margin-bottom:8px}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;text-decoration:none;padding:11px 16px;border-radius:14px;border:none;cursor:pointer;font-weight:700;transition:transform .2s ease, opacity .2s ease, box-shadow .2s ease}
.btn:hover{transform:translateY(-1px);box-shadow:0 8px 18px rgba(0,0,0,.08)}
.btn-primary{background:linear-gradient(90deg,var(--primary) 0%,var(--primary-dark) 100%);color:#fff}.btn-secondary{background:#fff;color:#0f172a;border:1px solid #cbd5e1}.btn-danger{background:var(--danger);color:#fff}.btn-block{width:100%}
.fade-in-up{animation:fadeUp .5s ease both}@keyframes fadeUp{from{opacity:0;transform:translateY(18px)}to{opacity:1;transform:translateY(0)}}
.landing-shell{min-height:100vh;width:100%;display:flex;align-items:stretch}
.landing-left{width:60%;padding:42px 48px;display:flex;flex-direction:column;justify-content:center}
.landing-right{width:40%;padding:42px 36px;display:flex;align-items:center;justify-content:center;background:rgba(255,255,255,.5)}
.brand-box{display:flex;align-items:center;gap:18px;margin-bottom:24px}
.brand-logo{width:106px;height:106px;object-fit:contain;border-radius:22px;background:#fff;padding:8px;box-shadow:0 8px 24px rgba(0,0,0,.08)}
.brand-text{font-size:18px;color:#3b4a32;line-height:1.4;max-width:620px}
.hero-title{margin:0 0 16px;font-size:64px;line-height:1.03;font-weight:800;color:#172016;max-width:760px}
.hero-text{margin:0 0 32px;font-size:20px;line-height:1.7;color:#5f6d5a;max-width:780px}
.roles-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:22px;max-width:980px}
.role-card{background:rgba(255,255,255,.94);border-radius:24px;padding:24px 22px;box-shadow:0 10px 28px rgba(0,0,0,.06);min-height:270px;transition:transform .25s ease, box-shadow .25s ease}
.role-card:hover{transform:translateY(-4px);box-shadow:0 18px 36px rgba(0,0,0,.10)}
.role-icon{width:84px;height:84px;border-radius:22px;display:flex;align-items:center;justify-content:center;font-size:40px;margin-bottom:18px;background:#eef3e3;border:1px solid #d8e2cc}
.role-card h3{margin:0 0 14px;font-size:22px;line-height:1.2;color:#182018}.role-card p{margin:0;font-size:16px;line-height:1.65;color:#5d675b}
.login-card{width:100%;max-width:460px;background:#fff;border-radius:28px;padding:34px 32px;box-shadow:0 18px 45px rgba(0,0,0,.08)}
.login-card h2{margin:0 0 12px;font-size:28px;color:#1a2117}.login-card p{margin:0 0 24px;color:#677260;font-size:18px;line-height:1.5}.login-card form{display:flex;flex-direction:column;gap:14px}.login-card input{height:54px;margin:0}
.login-card button{height:54px;border:none;border-radius:14px;background:linear-gradient(90deg,#6f8b48 0%,#556a39 100%);color:#fff;font-size:17px;font-weight:700;cursor:pointer}.forgot-link{display:inline-block;margin-top:16px;color:#556a39;text-decoration:none;font-weight:600}.forgot-link:hover{text-decoration:underline}
.simple-auth-page{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px}.auth-card{max-width:560px;width:100%;padding:30px}
.app-layout{display:grid;grid-template-columns:280px 1fr;min-height:100vh}.sidebar{background:#17211a;color:#fff;padding:20px;display:flex;flex-direction:column;gap:10px}.sidebar-brand{display:flex;align-items:center;gap:12px;margin-bottom:20px}.sidebar-sub{color:#d0d7c8;font-size:13px}.logo-sm{width:26px;height:26px;object-fit:contain}
.user-box{background:#223027;padding:16px;border-radius:18px;margin-bottom:10px;line-height:1.6}.small-light{color:#cbd5e1;font-size:13px}.role-tag{display:inline-block;margin-top:8px;background:var(--accent);color:#fff;padding:4px 10px;border-radius:999px;font-size:12px}.temp-note{margin-top:8px;font-size:12px;color:#ffe7a9}
.nav-menu{display:flex;flex-direction:column;gap:10px}.nav-menu a{color:#e7ece3;text-decoration:none;padding:14px 16px;border-radius:16px}.nav-menu a:hover,.logout-link:hover{background:#fff;color:#0f172a}.logout-link{margin-top:auto;background:#e2e8f0;color:#0f172a}
.main{padding:28px}.stats-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:18px;margin:20px 0}.stat-card{padding:22px;display:flex;flex-direction:column;gap:10px}.stat-card strong{font-size:30px}
.panel-card{padding:24px;margin-bottom:18px}.card-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:18px}.book-card{background:#fff;border:1px solid var(--border);border-radius:24px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,.04);transition:transform .25s ease, box-shadow .25s ease}.book-card:hover{transform:translateY(-4px)}.book-card img{width:100%;height:220px;object-fit:cover}.book-body{padding:18px;display:flex;flex-direction:column;gap:10px}.book-head{display:flex;justify-content:space-between;gap:10px;align-items:center}.badge{background:#e7ebdf;border-radius:999px;font-size:12px;padding:4px 10px;display:inline-block;color:#40502c}.header-row{display:flex;justify-content:space-between;align-items:center;gap:16px;flex-wrap:wrap}.search-form,.row-actions{display:flex;gap:10px;flex-wrap:wrap}.reader-grid{display:grid;grid-template-columns:360px 1fr;gap:20px}.reader-cover{width:100%;height:320px;object-fit:cover;border-radius:20px;margin-bottom:16px}.reader-toolbar{display:flex;justify-content:space-between;align-items:center;gap:16px;margin-bottom:16px;padding:16px;border-radius:18px;background:#f8fafc;border:1px solid var(--border)}.small-muted{color:var(--muted);font-size:13px}.pdf-frame{width:100%;min-height:720px;border:1px solid var(--border);border-radius:20px;background:#fff}.reader-text{margin-top:18px;padding:18px;border:1px solid var(--border);border-radius:18px;background:#fff}.table{width:100%;border-collapse:collapse}.table th,.table td{border-bottom:1px solid var(--border);padding:12px;text-align:left;vertical-align:top}.form-panel{max-width:980px}.grid-2{display:grid;grid-template-columns:repeat(2,1fr);gap:14px}.thumb{width:80px;height:110px;object-fit:cover;border-radius:10px;border:1px solid #cbd5e1}
code{background:#f2f4ed;padding:2px 6px;border-radius:6px}
@media (max-width:1200px){.landing-shell{flex-direction:column}.landing-left,.landing-right{width:100%}.landing-left{padding:36px 28px 20px}.landing-right{padding:10px 28px 36px;background:transparent}.hero-title{font-size:52px;max-width:100%}.hero-text{max-width:100%}.roles-grid{grid-template-columns:repeat(2,minmax(0,1fr));max-width:100%}.login-card{max-width:100%}}
@media (max-width:980px){.app-layout,.reader-grid,.stats-grid,.grid-2{grid-template-columns:1fr}.main{padding:16px}.hero-title{font-size:42px}.roles-grid{grid-template-columns:1fr}.brand-box{flex-direction:column;align-items:flex-start}.brand-logo{width:88px;height:88px}}


/* Catálogo uniforme de libros */
.catalog-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:22px;align-items:stretch}
.catalog-card{background:#fff;border:1px solid var(--border);border-radius:24px;overflow:hidden;box-shadow:0 8px 24px rgba(0,0,0,.05);display:flex;flex-direction:column;height:100%;min-height:520px;transition:transform .25s ease, box-shadow .25s ease}
.catalog-card:hover{transform:translateY(-4px);box-shadow:0 16px 36px rgba(0,0,0,.09)}
.catalog-cover-wrap{padding:16px 16px 0}
.catalog-cover{width:100%;height:270px;object-fit:cover;border-radius:18px;background:#f4f7f1;display:block}
.catalog-body{padding:16px 18px 18px;display:flex;flex-direction:column;gap:8px;flex:1}
.catalog-title{margin:0;font-size:25px;line-height:1.2;color:var(--dark);min-height:60px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.catalog-meta{color:#48533f;font-size:18px;line-height:1.45;min-height:52px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.catalog-year{color:var(--muted);font-weight:700;font-size:16px;margin-bottom:8px;min-height:24px}
.catalog-actions{margin-top:auto;display:flex;gap:10px;flex-wrap:wrap}
.catalog-actions .btn{min-width:110px}
@media (max-width:980px){.catalog-grid{grid-template-columns:repeat(auto-fill,minmax(200px,1fr))}.catalog-cover{height:240px}.catalog-card{min-height:480px}.catalog-title{font-size:22px}.catalog-meta{font-size:16px}}
@media (max-width:640px){.catalog-grid{grid-template-columns:1fr}.catalog-card{min-height:auto}.catalog-cover{height:260px}.catalog-title,.catalog-meta{min-height:auto}}


/* Catálogo premium tipo biblioteca digital */
.premium-catalog-grid{grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:26px}
.premium-catalog-card{position:relative;min-height:0;border-radius:26px;background:linear-gradient(180deg,#ffffff 0%,#fbfcfa 100%);overflow:hidden}
.premium-catalog-card:hover{transform:translateY(-8px) scale(1.01);box-shadow:0 22px 48px rgba(0,0,0,.12)}
.catalog-cover-link{text-decoration:none;color:inherit;display:block}
.premium-cover-wrap{padding:18px 18px 0;position:relative}
.premium-cover-wrap::after{content:"";position:absolute;left:18px;right:18px;bottom:0;height:44%;background:linear-gradient(180deg,rgba(0,0,0,0) 0%,rgba(17,24,39,.12) 100%);border-radius:0 0 18px 18px;pointer-events:none}
.catalog-overlay{position:absolute;top:30px;left:30px;right:30px;display:flex;justify-content:flex-start;pointer-events:none}
.catalog-chip{display:inline-flex;align-items:center;padding:8px 12px;border-radius:999px;background:rgba(255,255,255,.92);backdrop-filter:blur(6px);font-size:13px;font-weight:700;color:#30411f;box-shadow:0 8px 20px rgba(0,0,0,.08)}
.premium-catalog-body{padding:18px 20px 20px;gap:10px}
.premium-catalog-title{font-size:22px;line-height:1.28;min-height:0;display:block;overflow:visible;word-break:break-word;display:block}
.premium-catalog-meta{font-size:16px;min-height:0;color:#516048;display:block;overflow:visible;word-break:break-word}
.premium-catalog-year{display:inline-flex;align-items:center;justify-content:center;width:max-content;padding:7px 12px;border-radius:999px;background:#eef3e3;color:#42562d;font-size:14px;margin-bottom:8px}
.premium-catalog-actions{gap:10px}
.premium-catalog-actions .btn{flex:1 1 auto;min-width:0;justify-content:center}
@media (max-width:980px){.premium-catalog-grid{grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:20px}.premium-catalog-title{font-size:20px}}
@media (max-width:640px){.premium-catalog-grid{grid-template-columns:1fr}.premium-cover-wrap{padding:16px 16px 0}.catalog-overlay{top:26px;left:26px;right:26px}}


/* Modo oscuro */
:root[data-theme="dark"]{
  --primary:#8da96d;
  --primary-dark:#6c874f;
  --accent:#d3b56b;
  --bg:#0f1411;
  --bg-soft:#17201a;
  --dark:#eef6ea;
  --muted:#b2c1b0;
  --border:#2d3a31;
  --card:#182119;
  --danger:#ef4444;
  --warning:#d6b455;
}
:root[data-theme="dark"] body{background:linear-gradient(135deg,#0f1411 0%,#151d17 55%,#101612 100%);color:var(--dark)}
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .login-card,
:root[data-theme="dark"] .role-card,
:root[data-theme="dark"] .book-card,
:root[data-theme="dark"] .catalog-card,
:root[data-theme="dark"] .premium-catalog-card,
:root[data-theme="dark"] .panel-card,
:root[data-theme="dark"] .stat-card,
:root[data-theme="dark"] .reader-text,
:root[data-theme="dark"] .reader-toolbar,
:root[data-theme="dark"] .auth-card,
:root[data-theme="dark"] .form-panel,
:root[data-theme="dark"] .table-wrap{background:var(--card);border-color:var(--border);box-shadow:0 16px 36px rgba(0,0,0,.28)}
:root[data-theme="dark"] .landing-right{background:rgba(24,33,25,.72)}
:root[data-theme="dark"] .brand-logo{background:#121814}
:root[data-theme="dark"] .brand-text,
:root[data-theme="dark"] .hero-text,
:root[data-theme="dark"] .role-card p,
:root[data-theme="dark"] .login-card p,
:root[data-theme="dark"] .small-muted,
:root[data-theme="dark"] .catalog-meta,
:root[data-theme="dark"] .catalog-year,
:root[data-theme="dark"] .premium-catalog-meta,
:root[data-theme="dark"] .table td,
:root[data-theme="dark"] .table th,
:root[data-theme="dark"] p{color:var(--muted)}
:root[data-theme="dark"] .hero-title,
:root[data-theme="dark"] .role-card h3,
:root[data-theme="dark"] .login-card h2,
:root[data-theme="dark"] .catalog-title,
:root[data-theme="dark"] .premium-catalog-title,
:root[data-theme="dark"] h1,
:root[data-theme="dark"] h2,
:root[data-theme="dark"] h3,
:root[data-theme="dark"] strong,
:root[data-theme="dark"] .book-title{color:var(--dark)}
:root[data-theme="dark"] input,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] select{background:#111713;color:var(--dark);border-color:var(--border)}
:root[data-theme="dark"] .btn-secondary{background:#111713;color:var(--dark);border-color:var(--border)}
:root[data-theme="dark"] .badge,
:root[data-theme="dark"] .premium-catalog-year,
:root[data-theme="dark"] .role-icon{background:#202b21;color:var(--dark);border-color:var(--border)}
:root[data-theme="dark"] .catalog-chip{background:rgba(24,33,25,.88);color:var(--dark)}
:root[data-theme="dark"] code{background:#101612;color:#d7e8d4}
:root[data-theme="dark"] .table th,:root[data-theme="dark"] .table td{border-bottom-color:var(--border)}

.theme-toggle{position:fixed;top:16px;right:16px;z-index:10000;border:none;border-radius:999px;padding:10px 14px;display:inline-flex;align-items:center;gap:8px;background:rgba(255,255,255,.94);color:#172016;box-shadow:0 12px 32px rgba(0,0,0,.12);cursor:pointer;font-weight:700;backdrop-filter:blur(10px)}
.theme-toggle:hover{transform:translateY(-1px)}
.theme-toggle-icon{font-size:18px;line-height:1}
:root[data-theme="dark"] .theme-toggle{background:rgba(24,33,25,.94);color:#eef6ea}

.logo-lg{width:54px;height:54px;object-fit:contain;border-radius:14px;background:#fff;padding:6px;box-shadow:0 8px 18px rgba(0,0,0,.10)}
:root[data-theme="dark"] .logo-lg{background:#101612}
.logo-sm{width:30px;height:30px}

.library-landing .roles-grid-library{max-width:1100px}
.login-form-grid{display:flex;flex-direction:column;gap:14px}
.login-form-grid input{margin:0}

.sidebar{position:sticky;top:0;min-height:100vh}
.nav-menu a{display:flex;align-items:center;gap:10px;font-weight:700}
.logout-link{background:#dc2626;color:#fff !important;justify-content:center;margin-top:18px;box-shadow:0 8px 18px rgba(185,28,28,.25)}
.logout-link:hover{background:#b91c1c !important;color:#fff !important}

.main{max-width:100%;overflow-x:hidden}
.header-row h1{margin:0 0 6px;font-size:clamp(28px,4vw,42px)}
.search-form input{min-width:260px}
.reader-grid{align-items:start}
.table-wrap{overflow:auto;border-radius:18px}
.table{min-width:720px}

@media (max-width:1100px){
  .landing-left{padding:34px 24px 16px}
  .landing-right{padding:16px 24px 34px}
  .hero-title{font-size:48px}
  .hero-text{font-size:18px}
  .roles-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .app-layout{grid-template-columns:1fr}
  .sidebar{position:relative;min-height:auto;border-bottom:1px solid var(--border)}
  .nav-menu{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
  .logout-link{grid-column:1/-1}
}
@media (max-width:820px){
  .theme-toggle{top:12px;right:12px;padding:9px 12px}
  .theme-toggle-text{display:none}
  .landing-shell{flex-direction:column}
  .landing-left,.landing-right{width:100%}
  .brand-box{gap:14px}
  .brand-logo{width:88px;height:88px}
  .hero-title{font-size:40px;line-height:1.08}
  .hero-text{font-size:17px;line-height:1.6}
  .roles-grid{grid-template-columns:1fr}
  .role-card{min-height:auto}
  .main{padding:14px}
  .search-form{width:100%}
  .search-form input,.search-form .btn{width:100%}
  .card-grid,.catalog-grid,.premium-catalog-grid,.stats-grid,.grid-2,.reader-grid{grid-template-columns:1fr}
  .nav-menu{grid-template-columns:repeat(2,minmax(0,1fr))}
  .book-card img,.catalog-cover{height:240px}
  .login-card{padding:26px 20px;border-radius:22px}
}
@media (max-width:560px){
  .landing-left,.landing-right{padding-left:16px;padding-right:16px}
  .brand-box{flex-direction:column;align-items:flex-start}
  .brand-text{font-size:15px}
  .hero-title{font-size:32px}
  .hero-text{font-size:16px}
  .sidebar{padding:16px}
  .sidebar-brand{align-items:flex-start}
  .nav-menu{grid-template-columns:1fr}
  .user-box{padding:14px}
  .catalog-actions,.premium-catalog-actions,.row-actions{flex-direction:column}
  .catalog-actions .btn,.premium-catalog-actions .btn,.row-actions .btn{width:100%}
  .reader-toolbar{flex-direction:column;align-items:stretch}
  .table{min-width:620px}
}


/* Ajustes v3: edición de usuarios y catálogo por defecto */
.nav-menu a.active-link{background:rgba(255,255,255,.18);color:#fff;border-color:transparent}
:root[data-theme="dark"] .nav-menu a.active-link{background:rgba(255,255,255,.08);color:var(--dark)}


/* Optimización de visor PDF */
.reader-quick-actions{display:flex;flex-direction:column;gap:10px;margin-top:14px}
.pdf-placeholder{min-height:420px;border:1px dashed var(--border);border-radius:22px;background:linear-gradient(180deg,#fbfcfa 0%,#f4f7f1 100%);display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:32px}
.pdf-placeholder-icon{font-size:52px;line-height:1;margin-bottom:12px}
.pdf-placeholder h3{margin:0 0 10px;font-size:28px;color:var(--dark)}
.pdf-placeholder p{max-width:560px;margin:0 0 18px;color:var(--muted);line-height:1.7}
.reader-inline-actions{display:flex;gap:12px;flex-wrap:wrap;justify-content:center}
.pdf-frame{content-visibility:auto;contain-intrinsic-size:720px}
@media (max-width:560px){.reader-inline-actions{flex-direction:column;width:100%}.reader-inline-actions .btn{width:100%}.pdf-placeholder{min-height:320px;padding:22px}}


/* Branding institucional completo */
.brand-logo-premium{
  width:150px;
  height:150px;
  padding:12px;
  border-radius:28px;
  border:1px solid rgba(185,155,82,.22);
  box-shadow:0 20px 42px rgba(85,106,57,.12), 0 0 0 8px rgba(255,255,255,.58);
}
.hero-brand-strip{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  margin:0 0 28px;
}
.hero-brand-strip span{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 16px;
  border-radius:999px;
  background:rgba(255,255,255,.86);
  border:1px solid rgba(185,155,82,.22);
  color:#445535;
  font-weight:700;
  box-shadow:0 8px 22px rgba(0,0,0,.05);
}
.institutional-sidebar{
  background:linear-gradient(180deg,#17211a 0%, #1e2b21 52%, #152017 100%);
  border-right:1px solid rgba(255,255,255,.06);
}
.sidebar-brand-premium{
  display:flex;
  flex-direction:column;
  align-items:center;
  text-align:center;
  gap:14px;
  padding:10px 6px 18px;
  margin-bottom:8px;
}
.sidebar-logo-wrap{
  width:122px;
  height:122px;
  border-radius:30px;
  background:linear-gradient(180deg,rgba(255,255,255,.96),rgba(242,246,238,.92));
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow:0 18px 34px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.9);
}
.logo-emphasis{
  width:96px;
  height:96px;
  padding:0;
  background:transparent;
  box-shadow:none;
}
.sidebar-brand-copy strong{
  display:block;
  font-size:24px;
  line-height:1.1;
  color:#fff;
  margin-bottom:6px;
}
.brand-kicker{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:6px 12px;
  border-radius:999px;
  background:rgba(185,155,82,.16);
  color:#f1dca4;
  font-size:12px;
  font-weight:700;
  letter-spacing:.04em;
  text-transform:uppercase;
  margin-bottom:10px;
}
.sidebar-sub{
  font-size:13px;
  line-height:1.5;
  color:#d9e1d3;
}
.institution-badge{
  background:linear-gradient(135deg,rgba(185,155,82,.18),rgba(85,106,57,.22));
  border:1px solid rgba(255,255,255,.08);
  border-radius:22px;
  padding:14px 16px;
  margin:4px 0 16px;
  text-align:center;
  box-shadow:0 12px 26px rgba(0,0,0,.16);
}
.institution-badge-line{
  display:block;
  color:#e8eee1;
  font-size:13px;
  line-height:1.5;
}
.institution-badge-strong{
  color:#f0dca4;
  font-weight:700;
  margin-top:2px;
}
.user-box{
  background:linear-gradient(180deg,rgba(255,255,255,.08),rgba(255,255,255,.04));
  border:1px solid rgba(255,255,255,.06);
}
.nav-menu a{
  border:1px solid transparent;
}
.nav-menu a:hover,.nav-menu a.active-link{
  background:rgba(255,255,255,.10);
  border-color:rgba(255,255,255,.08);
  color:#fff;
}
.logout-link{
  border:none;
  font-size:15px;
  box-shadow:0 12px 24px rgba(185,28,28,.28);
}
.theme-toggle{font-weight:800}
:root[data-theme="dark"] .brand-logo-premium{
  background:#121814;
  box-shadow:0 20px 42px rgba(0,0,0,.35), 0 0 0 8px rgba(16,24,18,.52);
}
:root[data-theme="dark"] .hero-brand-strip span{
  background:rgba(24,33,25,.92);
  color:#dde9d9;
  border-color:rgba(255,255,255,.08);
}
:root[data-theme="dark"] .sidebar-logo-wrap{
  background:linear-gradient(180deg,#1b241d,#121814);
}
@media (max-width:1100px){
  .sidebar-brand-premium{flex-direction:row;align-items:center;text-align:left;padding:6px 0 14px}
  .sidebar-logo-wrap{width:98px;height:98px;border-radius:24px}
  .logo-emphasis{width:76px;height:76px}
  .sidebar-brand-copy strong{font-size:22px}
}
@media (max-width:820px){
  .brand-logo-premium{width:120px;height:120px}
  .hero-brand-strip span{font-size:13px;padding:9px 14px}
}
@media (max-width:560px){
  .brand-logo-premium{width:102px;height:102px;padding:8px}
  .sidebar-brand-premium{flex-direction:column;text-align:center}
  .sidebar-logo-wrap{width:92px;height:92px}
  .logo-emphasis{width:68px;height:68px}
  .sidebar-brand-copy strong{font-size:20px}
  .institution-badge{padding:12px 14px}
}


/* Catalog search + mobile PDF optimizations */
.catalog-toolbar{width:100%;margin:0 0 28px;display:flex;justify-content:center}
.catalog-search-form{width:100%}
.catalog-search-center{width:100%;max-width:980px;background:#fff;border:1px solid #e5e7eb;border-radius:24px;padding:28px;box-shadow:0 10px 24px rgba(0,0,0,.05);display:flex;flex-direction:column;gap:18px;margin:0 auto}
.catalog-search-input{width:100%;height:58px;border:1px solid #d1d5db;border-radius:16px;padding:0 18px;font-size:16px;background:#fff;outline:none}
.catalog-search-input:focus,.catalog-filter-select:focus{border-color:#6b7f45;box-shadow:0 0 0 3px rgba(107,127,69,.12)}
.catalog-filter-select{width:100%;height:58px;border:1px solid #d1d5db;border-radius:16px;padding:0 18px;font-size:16px;background:#fff;outline:none}
.catalog-search-btn{height:52px;padding:0 18px;border:none;border-radius:12px;background:#667c3e;color:#fff;font-weight:700;cursor:pointer}
.catalog-clear-btn{height:52px;padding:0 18px;display:inline-flex;align-items:center;justify-content:center;border-radius:12px;background:#f3f4f6;color:#111827;text-decoration:none;font-weight:600;border:1px solid #d1d5db}
@media (max-width:768px){.catalog-search-center{padding:18px}.catalog-search-actions{flex-direction:column;width:100%}.catalog-search-input,.catalog-filter-select,.catalog-search-btn,.catalog-show-all-btn,.catalog-clear-btn{width:100%;min-width:100%}}
:root[data-theme="dark"] .catalog-search-center{background:#0f172a;border-color:#334155;box-shadow:none}
:root[data-theme="dark"] .catalog-search-input,:root[data-theme="dark"] .catalog-filter-select{background:#111827;color:#e5e7eb;border-color:#334155}
:root[data-theme="dark"] .catalog-clear-btn{background:#1f2937;color:#f9fafb;border-color:#374151}


.catalog-empty-state{max-width:980px;margin:28px auto 0;background:#fff;border:1px dashed #cbd5e1;border-radius:20px;padding:36px 24px;text-align:center;box-shadow:0 8px 24px rgba(0,0,0,.04)}
.catalog-empty-state h3{margin:0 0 10px;font-size:24px;color:#111827}
.catalog-empty-state p{margin:0;font-size:16px;color:#6b7280;line-height:1.6}


/* Visor PDF rápido y móvil */
  .reader-toolbar{flex-direction:column;align-items:stretch}
  .table{min-width:620px}
}


/* Ajustes v3: edición de usuarios y catálogo por defecto */
.nav-menu a.active-link{background:rgba(255,255,255,.18);color:#fff;border-color:transparent}
:root[data-theme="dark"] .nav-menu a.active-link{background:rgba(255,255,255,.08);color:var(--dark)}


.catalog-toolbar{width:100%;margin:0 0 28px;display:flex;justify-content:center}
.catalog-search-form{width:100%}
.catalog-search-center{width:100%;max-width:980px;display:flex;justify-content:center;align-items:center;gap:12px;flex-wrap:wrap;background:#fff;border:1px solid #e5e7eb;border-radius:18px;padding:18px;box-shadow:0 8px 24px rgba(0,0,0,.06)}
.catalog-search-input{flex:1 1 420px;min-width:260px;height:52px;border:1px solid #d1d5db;border-radius:12px;padding:0 16px;font-size:16px;outline:none}
.catalog-search-input:focus,.catalog-filter-select:focus{border-color:#6b7f45;box-shadow:0 0 0 3px rgba(107,127,69,.12)}
.catalog-filter-select{height:52px;min-width:170px;border:1px solid #d1d5db;border-radius:12px;padding:0 14px;font-size:15px;background:#fff;outline:none}
.catalog-search-btn{height:52px;padding:0 18px;border:none;border-radius:12px;background:#667c3e;color:#fff;font-weight:700;cursor:pointer}
.catalog-clear-btn{height:52px;padding:0 18px;display:inline-flex;align-items:center;justify-content:center;border-radius:12px;background:#f3f4f6;color:#111827;text-decoration:none;font-weight:600;border:1px solid #d1d5db}
@media (max-width:768px){.catalog-search-center{flex-direction:column;align-items:stretch}.catalog-search-input,.catalog-filter-select,.catalog-search-btn,.catalog-clear-btn{width:100%}}
:root[data-theme="dark"] .catalog-search-center{background:#0f172a;border-color:#334155;box-shadow:none}
:root[data-theme="dark"] .catalog-search-input,:root[data-theme="dark"] .catalog-filter-select{background:#111827;color:#e5e7eb;border-color:#334155}
:root[data-theme="dark"] .catalog-clear-btn{background:#1f2937;color:#f9fafb;border-color:#374151}


.pdf-frame{display:none}
.pdf-preview-box{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;min-height:320px;border:1px dashed var(--border);border-radius:20px;background:linear-gradient(180deg,#fafcf8 0%,#f3f7ee 100%);padding:32px 24px}.pdf-preview-icon{font-size:52px;line-height:1;margin-bottom:14px}.pdf-preview-box h3{margin:0 0 10px;font-size:24px;color:#22301a}.pdf-preview-box p{margin:0 0 10px;max-width:680px}.btn[disabled]{opacity:.7;cursor:default}


.site-legal-footer{margin:24px auto 12px;max-width:1200px;padding:14px 18px;border:1px solid #d9e0cf;border-radius:16px;background:#f6f8f2;color:#334155;font-size:14px;line-height:1.5}
.legal-panel{margin-top:14px;padding:14px 16px;border-radius:16px;background:#f8fafc;border:1px solid #dbe4d2}
.audit-legal-banner{margin:0 0 18px;padding:14px 16px;border-radius:16px;background:linear-gradient(180deg,#f4f7ed,#eef4e4);border:1px solid #cdd8b9;color:#243119;line-height:1.5}
.legal-mini-stack{display:flex;gap:8px;flex-wrap:wrap;margin:10px 0 2px}.legal-mini-stack-reader{margin:14px 0}
.catalog-chip-legal{background:#eef4e4;color:#334b18;border:1px solid #c8d4b5}
.catalog-chip-scope{background:#eef2ff;color:#3730a3;border:1px solid #c7d2fe}
.btn-disabled{pointer-events:none;opacity:.92;text-align:center}
.table-responsive{overflow:auto}
:root[data-theme="dark"] .site-legal-footer{background:#111827;border-color:#374151;color:#e5e7eb}
:root[data-theme="dark"] .legal-panel{background:#0f172a;border-color:#334155}
:root[data-theme="dark"] .audit-legal-banner{background:#16211a;border-color:#314030;color:#e6f0df}
:root[data-theme="dark"] .catalog-chip-legal{background:#1d2a1a;border-color:#3e533a;color:#d7e7c7}
:root[data-theme="dark"] .catalog-chip-scope{background:#172036;border-color:#334155;color:#dbeafe}


/* search-compact-override-file */
input[type="text"][placeholder*="Buscar por título"],
input[type="text"][placeholder*="Buscar por título"],
input[type="search"][placeholder*="Buscar por título"],
input[type="search"][placeholder*="Buscar por título"],
textarea[placeholder*="Buscar por título"],
textarea[placeholder*="Buscar por título"],
input[name="q"], input[id="q"], textarea[name="q"], textarea[id="q"]{
  height:56px !important;
  min-height:56px !important;
  max-height:56px !important;
  padding:0 20px !important;
  line-height:56px !important;
  font-size:16px !important;
  border-radius:16px !important;
  resize:none !important;
  overflow:hidden !important;
  box-sizing:border-box !important;
}
.search-form,.search-toolbar,.catalog-toolbar,.filters-bar{align-items:center !important;}


.search-helper-text{
  margin:10px 4px 0;
  color:#66735c;
  font-size:14px;
}


.pdf-loader-wrap{
  display:block;
  margin: 0 0 14px 0;
  padding: 14px 16px;
  background: #f3f6ed;
  border: 1px solid #d9e2cf;
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(0,0,0,.06);
}
.pdf-loader-label{
  font-size: 14px;
  color: #516143;
  margin-bottom: 8px;
}
.pdf-loader-bar{
  width: 100%;
  height: 10px;
  background: #dde6d2;
  border-radius: 999px;
  overflow: hidden;
}
.pdf-loader-bar span{
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #6f8340, #9aae63);
  transition: width .25s ease;
}


/* Catálogo con sugeridos aleatorios y paginación */
.books-page{max-width:1200px;margin:0 auto;}
.books-header h1{margin:0 0 8px 0;font-size:56px;line-height:1.05;}
.books-header p{margin:0 0 18px 0;color:#66735c;}
.books-toolbar{
  display:grid;
  grid-template-columns:minmax(280px,1.7fr) minmax(160px,.7fr) auto auto auto;
  gap:12px;
  align-items:center;
  padding:16px;
  background:#fff;
  border-radius:20px;
  border:1px solid #e4eadc;
  margin:14px 0 10px 0;
}
.catalog-search-input,.catalog-filter-select{
  height:56px !important;
  min-height:56px !important;
  border-radius:16px !important;
  border:1px solid #d6dfca !important;
  padding:0 18px !important;
  box-sizing:border-box !important;
  background:#fff !important;
}
.search-helper-text{margin:8px 2px 18px;color:#66735c;font-size:14px;}
.section-title-row{
  display:flex;align-items:center;justify-content:space-between;gap:12px;margin:12px 0 14px;
}
.section-title-row h2{margin:0;font-size:28px;}
.results-count{color:#66735c;font-size:14px;}
.books-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(200px,1fr));
  gap:18px;
}
.featured-grid{margin-bottom:26px;}
.book-card{
  background:#fff;
  border:1px solid #e4eadc;
  border-radius:22px;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  min-height:340px;
  box-shadow:0 8px 20px rgba(0,0,0,.04);
}
.book-cover-wrap{
  display:flex;align-items:center;justify-content:center;
  padding:18px 18px 6px;
}
.book-cover{
  width:132px;height:180px;object-fit:cover;border-radius:12px;
  box-shadow:0 8px 18px rgba(0,0,0,.12);
}
.placeholder-cover{
  width:132px;height:180px;border-radius:12px;background:#eef3e7;
  display:flex;align-items:center;justify-content:center;color:#55634b;font-weight:700;
}
.book-card-body{padding:14px 16px 18px;display:flex;flex-direction:column;gap:8px;height:100%;}
.book-card-body h3{
  margin:0;font-size:18px;line-height:1.22;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;
}
.book-meta{margin:0;color:#66735c;font-size:14px;}
.btn-block{width:100%;margin-top:auto;}
.empty-state-box{
  background:#fff;border:1px dashed #d6dfca;border-radius:22px;padding:34px;text-align:center;color:#66735c;
}
.empty-state-box h3{margin:0 0 8px 0;color:#1f2a1f;}
.pagination-bar{
  display:flex;align-items:center;justify-content:center;gap:12px;
  margin:24px 0 8px;flex-wrap:wrap;
}
.pagination-pages{display:flex;gap:8px;flex-wrap:wrap;justify-content:center;}
.pagination-btn,.pagination-number{
  min-width:42px;height:42px;padding:0 14px;border-radius:12px;border:1px solid #d6dfca;
  display:inline-flex;align-items:center;justify-content:center;text-decoration:none;
  background:#fff;color:#33412b;font-weight:700;
}
.pagination-number.is-active{background:#6f8340;color:#fff;border-color:#6f8340;}
.pagination-btn.is-disabled{pointer-events:none;opacity:.45;}
@media (max-width: 920px){
  .books-header h1{font-size:40px;}
  .books-toolbar{grid-template-columns:1fr;}
}


/* Sidebar izquierda para biblioteca */
.page-shell{
  display:block;
  margin-left:260px;
  padding:0 18px 18px 18px;
}
.library-sidebar-shell{
  position:fixed;
  left:0;
  top:0;
  width:220px;
  height:100vh;
  padding:12px;
  z-index:40;
  background:linear-gradient(180deg,#152012 0%, #1d2a16 50%, #182312 100%);
}
.library-sidebar-card{
  height:100%;
  border-radius:24px;
  padding:16px 14px;
  color:#fff;
  display:flex;
  flex-direction:column;
  background:linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  box-shadow:inset 0 0 40px rgba(152,190,86,.08);
}
.library-logo-box{
  width:92px;height:92px;border-radius:24px;background:#fff;margin:2px auto 14px;
  display:flex;align-items:center;justify-content:center;overflow:hidden;
}
.library-logo-image{max-width:86px;max-height:86px;object-fit:contain;}
.library-logo-fallback{
  width:86px;height:86px;border:3px solid #95b56a;border-radius:18px;
  display:flex;align-items:center;justify-content:center;color:#95b56a;font-weight:800;
}
.library-sidebar-badge{
  margin:0 auto 10px;padding:8px 14px;border-radius:999px;background:rgba(166,188,90,.16);
  color:#e5d88c;font-size:12px;font-weight:700;text-align:center;
}
.library-sidebar-title{margin:0;text-align:center;font-size:22px;line-height:1.1;}
.library-sidebar-subtitle{margin:8px 0 16px;text-align:center;color:#e2ead8;font-size:14px;line-height:1.35;}
.library-sidebar-panel{
  border-radius:18px;padding:14px;background:rgba(255,255,255,.04);margin-bottom:16px;
  border:1px solid rgba(168,185,118,.15);
}
.library-sidebar-small{font-size:13px;color:#d6e3c4;}
.library-sidebar-user{font-size:18px;font-weight:800;}
.library-sidebar-role{
  display:inline-flex;margin-top:8px;padding:6px 10px;border-radius:999px;background:#d8be57;color:#fff;font-size:12px;font-weight:700;
}
.library-sidebar-nav{display:flex;flex-direction:column;gap:8px;margin:8px 0 18px;}
.library-sidebar-link{
  color:#fff;text-decoration:none;padding:10px 12px;border-radius:14px;font-weight:700;
}
.library-sidebar-link:hover{background:rgba(255,255,255,.06);}
.library-sidebar-logout{
  margin-top:auto;text-decoration:none;background:#cf3c2e;color:#fff;text-align:center;
  padding:12px 14px;border-radius:16px;font-weight:800;
}

/* Mejor carátula y grilla */
.book-cover{
  width:140px;height:200px;object-fit:cover;border-radius:12px;
  box-shadow:0 12px 22px rgba(0,0,0,.18);
  background:#f2f2f2;
}
.placeholder-cover{
  width:140px;height:200px;
}
.featured-grid{
  grid-template-columns:repeat(3, minmax(220px,1fr));
}
.books-grid{
  grid-template-columns:repeat(auto-fit, minmax(220px,1fr));
}

@media (max-width: 980px){
  .page-shell{margin-left:0;padding:0 12px 12px;}
  .library-sidebar-shell{display:none;}
  .featured-grid{grid-template-columns:1fr;}
}


/* Botones uniformes en catálogo */
.btn-uniform{
  height:48px !important;
  min-width:140px !important;
  padding:0 20px !important;
  border-radius:16px !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  font-weight:800 !important;
  text-decoration:none !important;
  box-sizing:border-box !important;
  white-space:nowrap !important;
}
.books-toolbar .btn-uniform.btn-secondary{
  background:#eef2e8 !important;
  color:#2e3a23 !important;
  border:1px solid #cfd7c2 !important;
}
.books-toolbar .btn-uniform.btn-primary{
  background:linear-gradient(90deg,var(--primary) 0%,var(--primary-dark) 100%) !important;
  color:#fff !important;
  border:none !important;
}
.books-toolbar .btn-uniform:hover{
  transform:translateY(-2px);
  box-shadow:0 8px 18px rgba(0,0,0,0.12);
}

/* Sidebar activo */
.library-sidebar-link.is-active{
  background:rgba(255,255,255,.10);
  box-shadow:inset 0 0 0 1px rgba(168,185,118,.20);
}


/* Corrección de sidebar para evitar doble barra o superposición */
body{
  overflow-x:hidden;
}
.library-sidebar-shell{
  isolation:isolate;
}
.page-shell{
  position:relative;
  z-index:1;
}
.app-main-no-sidebar,
.content-no-sidebar{
  margin-left:0 !important;
  padding-left:0 !important;
}
body.library-has-sidebar .page-shell{
  margin-left:260px !important;
}
body.library-has-sidebar .landing-shell,
body.library-has-sidebar .login-card,
body.library-has-sidebar .landing-left,
body.library-has-sidebar .landing-right{
  margin-left:0 !important;
}
@media (max-width: 980px){
  body.library-has-sidebar .page-shell{
    margin-left:0 !important;
  }
}


/* Usuarios: búsqueda y paginación */
.users-table-wrap{
  background:#fff;
  border:1px solid #e4eadc;
  border-radius:22px;
  overflow:auto;
  box-shadow:0 8px 20px rgba(0,0,0,.04);
}
.users-table{
  width:100%;
  border-collapse:collapse;
}
.users-table th,
.users-table td{
  padding:14px 16px;
  border-bottom:1px solid #edf1e8;
  text-align:left;
}
.users-table th{
  background:#f7faf4;
  color:#33412b;
  font-size:14px;
}
.users-table td{
  font-size:14px;
  color:#23301f;
}


/* Sistema real completo: layout unificado */
body{overflow-x:hidden;}
body.library-has-sidebar{padding-left:232px;}
.page-shell{
  margin-left:0 !important;
  padding:0 18px 18px 18px;
  position:relative;
  z-index:1;
}
.page-shell-inner{
  margin-left:0 !important;
}
.library-sidebar-shell{
  position:fixed;
  left:0;
  top:0;
  width:220px;
  height:100vh;
  z-index:1000;
}
.main{
  padding:18px 18px 22px 18px;
}
.site-legal-footer{
  margin-left:232px;
}
.admin-header-row{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  margin-bottom:10px;
}

.btn-uniform{
  height:48px !important;
  min-width:140px !important;
  padding:0 20px !important;
  border-radius:16px !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  font-weight:800 !important;
  text-decoration:none !important;
  box-sizing:border-box !important;
  white-space:nowrap !important;
}
.books-toolbar{
  grid-template-columns:minmax(280px,1.7fr) minmax(120px,.7fr) 140px 140px 140px !important;
}
.books-toolbar .btn-uniform.btn-secondary{
  background:#eef2e8 !important;
  color:#2e3a23 !important;
  border:1px solid #cfd7c2 !important;
}
.books-toolbar .btn-uniform.btn-primary{
  background:linear-gradient(90deg,var(--primary) 0%,var(--primary-dark) 100%) !important;
  color:#fff !important;
  border:none !important;
}
.library-sidebar-link.is-active{
  background:rgba(255,255,255,.10);
  box-shadow:inset 0 0 0 1px rgba(168,185,118,.20);
}
.btn-small{
  height:42px !important;
  min-width:92px !important;
  padding:0 16px !important;
  border-radius:14px !important;
}
.users-table-wrap{
  background:#fff;
  border:1px solid #e4eadc;
  border-radius:22px;
  overflow:auto;
  box-shadow:0 8px 20px rgba(0,0,0,.04);
}
.users-table{width:100%;border-collapse:collapse;}
.users-table th,.users-table td{
  padding:14px 16px;
  border-bottom:1px solid #edf1e8;
  text-align:left;
  vertical-align:middle;
}
.users-table th{background:#f7faf4;color:#33412b;font-size:14px;}
.users-table td{font-size:14px;color:#23301f;}
.th-actions,.td-actions{text-align:left;}
.td-actions{
  display:flex;
  gap:10px;
  align-items:center;
  white-space:nowrap;
}
@media (max-width: 980px){
  body.library-has-sidebar{padding-left:0;}
  .library-sidebar-shell{display:none;}
  .site-legal-footer{margin-left:0;}
  .books-toolbar{grid-template-columns:1fr !important;}
  .admin-header-row{flex-direction:column;align-items:stretch;}
  .td-actions{flex-wrap:wrap;}
}


/* Corrección final sidebar + usuarios */
body.library-has-sidebar{
  padding-left:280px !important;
}
.library-sidebar-shell{
  width:260px !important;
  padding:14px !important;
  background:linear-gradient(180deg,#121b10 0%, #172414 45%, #111a0f 100%) !important;
  box-shadow:8px 0 26px rgba(0,0,0,.12);
}
.library-sidebar-card{
  padding:18px 16px !important;
  border-radius:28px !important;
  background:
    radial-gradient(circle at top, rgba(160,184,86,.12), transparent 36%),
    linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02)) !important;
  box-shadow:inset 0 0 60px rgba(154,182,86,.08), 0 20px 40px rgba(0,0,0,.08) !important;
}
.library-logo-box{
  width:104px !important;
  height:104px !important;
  border-radius:26px !important;
  margin:0 auto 16px !important;
}
.library-sidebar-badge{
  width:100%;
  text-align:center;
  font-size:13px !important;
  padding:10px 14px !important;
  margin-bottom:12px !important;
}
.library-sidebar-title{
  font-size:28px !important;
  line-height:1.05 !important;
}
.library-sidebar-subtitle{
  font-size:15px !important;
  line-height:1.45 !important;
  margin-bottom:20px !important;
}
.library-sidebar-panel{
  padding:16px !important;
  border-radius:20px !important;
  margin-bottom:18px !important;
}
.library-sidebar-user{
  font-size:19px !important;
  line-height:1.15 !important;
}
.library-sidebar-role{
  font-size:13px !important;
  padding:7px 12px !important;
}
.library-sidebar-nav{
  gap:10px !important;
}
.library-sidebar-link{
  padding:12px 14px !important;
  border-radius:16px !important;
  font-size:15px !important;
}
.library-sidebar-logout{
  padding:14px 16px !important;
  border-radius:18px !important;
  font-size:16px !important;
}
.page-shell{
  padding:0 22px 22px 22px !important;
}
.site-legal-footer{
  margin-left:280px !important;
}
.users-table-wrap{
  overflow-x:auto;
}
.users-table{
  min-width:860px;
}
.th-actions,.td-actions{
  text-align:left;
}
.td-actions{
  display:flex !important;
  gap:10px !important;
  align-items:center !important;
  white-space:nowrap !important;
}
.btn-small{
  height:42px !important;
  min-width:96px !important;
}
@media (max-width: 980px){
  body.library-has-sidebar{
    padding-left:0 !important;
  }
  .library-sidebar-shell{
    display:none !important;
  }
  .site-legal-footer{
    margin-left:0 !important;
  }
}


/* Ajuste final de sidebar, marca y toggle */
body.library-has-sidebar{
  padding-left:320px !important;
}
.library-sidebar-shell{
  width:292px !important;
  padding:16px !important;
}
.library-sidebar-card{
  padding:22px 18px !important;
}
.library-logo-box{
  width:112px !important;
  height:112px !important;
}
.library-sidebar-badge{
  font-size:14px !important;
  padding:11px 16px !important;
}
.library-sidebar-title{
  font-size:30px !important;
}
.library-sidebar-subtitle{
  font-size:16px !important;
}
.library-sidebar-panel{
  padding:18px !important;
}
.library-sidebar-user{
  font-size:20px !important;
}
.library-sidebar-link{
  font-size:16px !important;
  padding:13px 15px !important;
}
.library-sidebar-logout{
  font-size:17px !important;
  padding:15px 16px !important;
}
.page-shell{
  padding:0 24px 24px 24px !important;
}
.site-legal-footer{
  margin-left:320px !important;
}

/* El botón de modo oscuro no debe tapar acciones superiores */
.theme-toggle-floating{
  position:fixed !important;
  top:14px !important;
  right:18px !important;
  z-index:1200 !important;
}
.admin-header-row{
  padding-right:220px !important;
  position:relative;
}

@media (max-width: 1200px){
  .admin-header-row{
    padding-right:180px !important;
  }
}

@media (max-width: 980px){
  body.library-has-sidebar{
    padding-left:0 !important;
  }
  .library-sidebar-shell{
    display:none !important;
  }
  .site-legal-footer{
    margin-left:0 !important;
  }
  .admin-header-row{
    padding-right:0 !important;
  }
}


/* ===== SIDEBAR PROTAGONISTA NIVEL PRO ===== */
body.library-has-sidebar{
  padding-left:360px !important;
}

/* Sidebar mucho más dominante */
.library-sidebar-shell{
  width:330px !important;
  background:linear-gradient(180deg,#0f180d 0%, #172414 50%, #0f180d 100%) !important;
  box-shadow:12px 0 40px rgba(0,0,0,.25) !important;
}

/* Tarjeta interna más elegante */
.library-sidebar-card{
  padding:26px 20px !important;
  border-radius:30px !important;
}

/* Logo más grande */
.library-logo-box{
  width:130px !important;
  height:130px !important;
  border-radius:28px !important;
}

/* Títulos más grandes */
.library-sidebar-title{
  font-size:34px !important;
}

.library-sidebar-subtitle{
  font-size:17px !important;
  opacity:.9;
}

/* Usuario destacado */
.library-sidebar-user{
  font-size:22px !important;
  font-weight:800 !important;
}

/* Menú más visible */
.library-sidebar-link{
  font-size:17px !important;
  padding:14px 18px !important;
  border-radius:18px !important;
}

.library-sidebar-link:hover{
  background:rgba(168,185,118,.15) !important;
}

/* Botón cerrar sesión más grande */
.library-sidebar-logout{
  font-size:18px !important;
  padding:16px 18px !important;
  border-radius:20px !important;
}

/* CONTENIDO MÁS CENTRADO */
.page-shell{
  max-width:1400px;
  margin:0 auto !important;
  padding:0 30px 30px 30px !important;
}

/* Ajuste header */
.admin-header-row{
  justify-content:space-between;
  align-items:center;
}

/* Footer alineado */
.site-legal-footer{
  margin-left:360px !important;
}

/* RESPONSIVE */
@media (max-width: 1100px){
  body.library-has-sidebar{
    padding-left:0 !important;
  }
  .library-sidebar-shell{
    display:none !important;
  }
  .site-legal-footer{
    margin-left:0 !important;
  }
}


/* ===== DASHBOARD PRO ===== */
.dashboard-pro-page{
  max-width:1400px;
  margin:0 auto;
  padding:4px 0 24px;
}
.dashboard-hero{
  display:flex;
  align-items:stretch;
  justify-content:space-between;
  gap:18px;
  padding:28px;
  border-radius:30px;
  margin-bottom:22px;
}
.dashboard-kicker{
  margin:0 0 10px;
  color:var(--muted);
  font-weight:700;
  letter-spacing:.04em;
  text-transform:uppercase;
  font-size:13px;
}
.dashboard-hero h1{
  margin:0 0 12px;
  font-size:54px;
  line-height:1.02;
}
.dashboard-lead{
  margin:0;
  max-width:780px;
  font-size:19px;
  line-height:1.6;
  color:#5f6d5a;
}
.dashboard-hero-badge{
  min-width:240px;
  background:linear-gradient(180deg,#f6faef,#eef5e3);
  border:1px solid #d9e3cc;
  border-radius:24px;
  padding:18px;
  display:flex;
  flex-direction:column;
  justify-content:center;
}
.dashboard-hero-badge span{
  font-size:13px;
  color:var(--muted);
}
.dashboard-hero-badge strong{
  font-size:28px;
  margin:8px 0 4px;
}
.dashboard-hero-badge small{
  font-size:14px;
  color:#5e6d54;
}
.dashboard-stats-pro{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:18px;
  margin-bottom:22px;
}
.dashboard-stat-pro{
  padding:24px 22px;
  border-radius:26px;
}
.dashboard-stat-icon{
  width:56px;
  height:56px;
  border-radius:18px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:#eef4e6;
  font-size:28px;
  margin-bottom:16px;
}
.dashboard-stat-number{
  font-size:40px;
  font-weight:800;
  line-height:1;
  margin-bottom:8px;
}
.dashboard-stat-label{
  color:#66735c;
  font-size:15px;
}
.dashboard-main-grid{
  display:grid;
  grid-template-columns:1.35fr .95fr;
  gap:18px;
  margin-bottom:22px;
}
.dashboard-panel{
  padding:24px;
  border-radius:28px;
}
.dashboard-panel-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:18px;
}
.dashboard-panel-head h2{
  margin:0;
  font-size:30px;
}
.dashboard-top-books{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:16px;
}
.dashboard-book-mini{
  display:flex;
  gap:14px;
  align-items:flex-start;
  border:1px solid #e6ecdf;
  background:#fbfdf8;
  border-radius:22px;
  padding:14px;
}
.dashboard-book-cover-wrap{
  flex:0 0 auto;
}
.dashboard-book-cover{
  width:82px;
  height:112px;
  object-fit:cover;
  border-radius:10px;
  box-shadow:0 8px 18px rgba(0,0,0,.14);
}
.dashboard-book-content h3{
  margin:0 0 6px;
  font-size:18px;
  line-height:1.2;
}
.dashboard-book-content p{
  margin:0 0 6px;
  color:#62705b;
  font-size:14px;
}
.dashboard-book-content span{
  color:#4f5c47;
  font-size:13px;
  font-weight:700;
}
.dashboard-quick-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
}
.dashboard-quick-card{
  display:flex;
  flex-direction:column;
  gap:8px;
  padding:18px;
  background:#fbfdf8;
  border:1px solid #e6ecdf;
  border-radius:22px;
  text-decoration:none;
  color:inherit;
  min-height:140px;
}
.dashboard-quick-card:hover{
  transform:translateY(-2px);
  box-shadow:0 12px 24px rgba(0,0,0,.08);
}
.quick-icon{
  font-size:28px;
}
.dashboard-quick-card strong{
  font-size:18px;
  line-height:1.2;
}
.dashboard-quick-card small{
  font-size:14px;
  color:#66735c;
  line-height:1.45;
}
.dashboard-banner-pro{
  padding:24px 28px;
  border-radius:28px;
  background:linear-gradient(90deg,#f4f9ec 0%,#ffffff 100%);
}
.dashboard-banner-pro h2{
  margin:0 0 10px;
  font-size:30px;
}
.dashboard-banner-pro p{
  margin:0;
  color:#62705b;
  font-size:17px;
  line-height:1.55;
}

@media (max-width: 1200px){
  .dashboard-stats-pro{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .dashboard-main-grid{
    grid-template-columns:1fr;
  }
}
@media (max-width: 820px){
  .dashboard-hero{
    flex-direction:column;
  }
  .dashboard-hero h1{
    font-size:38px;
  }
  .dashboard-stats-pro,
  .dashboard-top-books,
  .dashboard-quick-grid{
    grid-template-columns:1fr;
  }
}


/* Aprovechar mejor el espacio con sidebar más protagonista pero menos desperdicio */
body.library-has-sidebar{
  padding-left:300px !important;
}
.library-sidebar-shell{
  width:272px !important;
}
.site-legal-footer{
  margin-left:300px !important;
}
.page-shell{
  max-width:none !important;
  width:calc(100vw - 300px) !important;
  margin:0 !important;
  padding:0 20px 24px 20px !important;
}
.books-page-wide{
  max-width:none !important;
  width:100% !important;
}
.books-grid{
  grid-template-columns:repeat(auto-fit, minmax(240px,1fr)) !important;
}
.featured-grid{
  grid-template-columns:repeat(3, minmax(240px, 1fr)) !important;
}
.books-toolbar{
  grid-template-columns:minmax(320px,1.8fr) minmax(160px,.7fr) 140px 140px 140px !important;
}
@media (max-width: 1200px){
  body.library-has-sidebar{
    padding-left:280px !important;
  }
  .library-sidebar-shell{
    width:252px !important;
  }
  .site-legal-footer{
    margin-left:280px !important;
  }
  .page-shell{
    width:calc(100vw - 280px) !important;
  }
}
@media (max-width: 980px){
  body.library-has-sidebar{
    padding-left:0 !important;
  }
  .library-sidebar-shell{
    display:none !important;
  }
  .site-legal-footer{
    margin-left:0 !important;
  }
  .page-shell{
    width:100% !important;
    padding:0 12px 20px 12px !important;
  }
  .featured-grid{
    grid-template-columns:1fr !important;
  }
  .books-toolbar{
    grid-template-columns:1fr !important;
  }
}


/* ===== CORRECCIÓN DE LAYOUT: evitar corte a la derecha ===== */
body.library-has-sidebar{
  padding-left: 300px !important;
}

.library-sidebar-shell{
  width: 272px !important;
}

.page-shell{
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 18px 24px 18px !important;
}

.books-page,
.books-page-wide,
.dashboard-pro-page{
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
}

.books-toolbar{
  width: 100% !important;
  max-width: none !important;
  overflow: visible !important;
}

.featured-random-books,
.books-results,
.users-table-wrap,
.dashboard-main-grid,
.dashboard-stats-pro,
.dashboard-hero{
  width: 100% !important;
  max-width: none !important;
}

.books-grid{
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 18px !important;
}

.featured-grid{
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 18px !important;
}

.book-card{
  min-width: 0 !important;
}

.book-cover{
  width: 100% !important;
  max-width: 100% !important;
  height: 245px !important;
  object-fit: cover !important;
}

.book-cover-wrap{
  padding: 18px 18px 10px 18px !important;
}

.book-card-body{
  padding: 10px 16px 18px 16px !important;
}

.site-legal-footer{
  margin-left: 300px !important;
}

@media (max-width: 1400px){
  .books-grid,
  .featured-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 980px){
  body.library-has-sidebar{
    padding-left: 0 !important;
  }

  .library-sidebar-shell{
    display: none !important;
  }

  .page-shell{
    width: 100% !important;
    padding: 0 12px 20px 12px !important;
  }

  .site-legal-footer{
    margin-left: 0 !important;
  }

  .books-grid,
  .featured-grid{
    grid-template-columns: 1fr !important;
  }
}


/* ===== Sidebar ocultable ===== */
.sidebar-toggle{
  position:fixed !important;
  top:16px !important;
  left:312px !important;
  z-index:1250 !important;
  width:48px !important;
  height:48px !important;
  border:none !important;
  border-radius:14px !important;
  background:linear-gradient(90deg,var(--primary) 0%,var(--primary-dark) 100%) !important;
  color:#fff !important;
  font-size:22px !important;
  font-weight:800 !important;
  cursor:pointer !important;
  box-shadow:0 10px 24px rgba(0,0,0,.18) !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
}
.theme-toggle-floating{
  right:18px !important;
}
html[data-sidebar-state="hidden"] body.library-has-sidebar{
  padding-left:0 !important;
}
html[data-sidebar-state="hidden"] .library-sidebar-shell{
  transform:translateX(-110%) !important;
  opacity:0 !important;
  pointer-events:none !important;
}
html[data-sidebar-state="hidden"] .site-legal-footer{
  margin-left:0 !important;
}
html[data-sidebar-state="hidden"] .sidebar-toggle{
  left:16px !important;
}
.library-sidebar-shell{
  transition:transform .28s ease, opacity .22s ease !important;
}
body.library-has-sidebar,
.site-legal-footer,
.page-shell{
  transition:all .28s ease !important;
}

@media (max-width: 980px){
  .sidebar-toggle{
    left:14px !important;
    top:14px !important;
  }
}


/* ===== Corrección final de espacio excesivo y contenido muy a la derecha ===== */
body.library-has-sidebar{
  padding-left: 0 !important;
}

.library-sidebar-shell{
  width: 280px !important;
  left: 14px !important;
  top: 14px !important;
  height: calc(100vh - 28px) !important;
  border-radius: 30px !important;
}

.page-shell{
  margin-left: 315px !important;
  width: calc(100% - 335px) !important;
  max-width: none !important;
  padding: 0 18px 24px 12px !important;
}

.site-legal-footer{
  margin-left: 315px !important;
  width: calc(100% - 315px) !important;
}

.sidebar-toggle{
  left: 318px !important;
}

html[data-sidebar-state="hidden"] .page-shell{
  margin-left: 18px !important;
  width: calc(100% - 36px) !important;
  padding: 0 18px 24px 18px !important;
}

html[data-sidebar-state="hidden"] .site-legal-footer{
  margin-left: 0 !important;
  width: 100% !important;
}

html[data-sidebar-state="hidden"] .sidebar-toggle{
  left: 16px !important;
}

.books-page,
.books-page-wide,
.dashboard-pro-page{
  margin-left: 0 !important;
  padding-left: 0 !important;
}

.books-toolbar,
.books-grid,
.featured-grid,
.books-results,
.featured-random-books,
.dashboard-main-grid,
.dashboard-stats-pro,
.dashboard-hero{
  width: 100% !important;
  max-width: none !important;
}

@media (max-width: 980px){
  .library-sidebar-shell{
    left: 0 !important;
    top: 0 !important;
    height: 100vh !important;
    width: 100% !important;
    border-radius: 0 !important;
  }

  .page-shell{
    margin-left: 0 !important;
    width: 100% !important;
    padding: 0 12px 20px 12px !important;
  }

  .site-legal-footer{
    margin-left: 0 !important;
    width: 100% !important;
  }

  .sidebar-toggle{
    left: 14px !important;
  }
}


/* ===== Corrección automática de proporción sidebar/contenido ===== */
:root{
  --sidebar-gap-left: 16px;
  --sidebar-width-pro: 272px;
  --sidebar-total-space: calc(var(--sidebar-gap-left) + var(--sidebar-width-pro) + 22px);
}

body.library-has-sidebar{
  padding-left: 0 !important;
}

.library-sidebar-shell{
  width: var(--sidebar-width-pro) !important;
  left: var(--sidebar-gap-left) !important;
  top: 14px !important;
  height: calc(100vh - 28px) !important;
  border-radius: 30px !important;
}

.page-shell{
  margin-left: var(--sidebar-total-space) !important;
  width: calc(100% - var(--sidebar-total-space) - 12px) !important;
  max-width: none !important;
  padding: 0 14px 24px 6px !important;
  box-sizing: border-box !important;
}

.site-legal-footer{
  margin-left: var(--sidebar-total-space) !important;
  width: calc(100% - var(--sidebar-total-space) - 12px) !important;
  box-sizing: border-box !important;
}

.sidebar-toggle{
  left: calc(var(--sidebar-total-space) - 40px) !important;
  top: 12px !important;
}

html[data-sidebar-state="hidden"] .page-shell{
  margin-left: 14px !important;
  width: calc(100% - 28px) !important;
  padding: 0 14px 24px 14px !important;
}

html[data-sidebar-state="hidden"] .site-legal-footer{
  margin-left: 0 !important;
  width: 100% !important;
}

html[data-sidebar-state="hidden"] .sidebar-toggle{
  left: 14px !important;
}

.books-page,
.books-page-wide,
.dashboard-pro-page{
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.books-toolbar{
  width: 100% !important;
  max-width: none !important;
  overflow: visible !important;
}

.books-grid,
.featured-grid{
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 18px !important;
  width: 100% !important;
}

.book-card{
  min-width: 0 !important;
  overflow: hidden !important;
}

.book-cover{
  width: 100% !important;
  max-width: 100% !important;
  height: 210px !important;
  object-fit: cover !important;
}

@media (max-width: 1400px){
  .books-grid,
  .featured-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 980px){
  .library-sidebar-shell{
    display: none !important;
  }

  .page-shell{
    margin-left: 0 !important;
    width: 100% !important;
    padding: 0 12px 20px 12px !important;
  }

  .site-legal-footer{
    margin-left: 0 !important;
    width: 100% !important;
  }

  .sidebar-toggle{
    left: 12px !important;
  }

  .books-grid,
  .featured-grid{
    grid-template-columns: 1fr !important;
  }
}


/* ===== Carátulas completas, proporcionales y más compactas ===== */
.books-grid,
.featured-grid{
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)) !important;
  gap: 18px !important;
}

.book-card{
  min-height: 320px !important;
}

.book-cover-wrap{
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  padding: 16px 16px 8px 16px !important;
  background: transparent !important;
}

.book-cover{
  width: 100% !important;
  max-width: 180px !important;
  height: 250px !important;
  object-fit: contain !important;
  object-position: center !important;
  background: #fff !important;
  border-radius: 12px !important;
  box-shadow: 0 8px 18px rgba(0,0,0,.12) !important;
}

.placeholder-cover{
  width: 180px !important;
  height: 250px !important;
}

.book-card-body{
  gap: 6px !important;
}

.book-card-body h3{
  font-size: 17px !important;
  line-height: 1.2 !important;
  -webkit-line-clamp: 2 !important;
}

.book-meta{
  font-size: 13px !important;
}

.book-admin-actions{
  display:flex !important;
  gap:8px !important;
  margin-top:10px !important;
  flex-wrap:wrap !important;
}

.book-admin-actions .btn{
  flex:1 1 auto;
  min-width:96px;
}

@media (max-width: 1400px){
  .books-grid,
  .featured-grid{
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 1100px){
  .books-grid,
  .featured-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 700px){
  .books-grid,
  .featured-grid{
    grid-template-columns: 1fr !important;
  }

  .book-cover{
    max-width: 170px !important;
    height: 230px !important;
  }
}


/* ===== Netflix real ===== */
.netflix-book-card{
  transition: transform .22s ease, box-shadow .22s ease !important;
}
.netflix-book-card:hover{
  transform: translateY(-6px) scale(1.02) !important;
  box-shadow: 0 18px 36px rgba(0,0,0,.16) !important;
}
.netflix-book-card .book-cover{
  transition: transform .25s ease !important;
}
.netflix-book-card:hover .book-cover{
  transform: scale(1.04) !important;
}
.book-card-actions-row{
  display:flex;
  gap:10px;
  margin-top:auto;
  flex-wrap:wrap;
}
.book-card-actions-row .btn{
  flex:1 1 0;
}
.book-preview-modal{
  position:fixed;
  inset:0;
  z-index:2000;
  display:none;
}
.book-preview-modal.is-open{
  display:block;
}
.book-preview-backdrop{
  position:absolute;
  inset:0;
  background:rgba(15,20,12,.62);
  backdrop-filter:blur(4px);
}
.book-preview-dialog{
  position:relative;
  width:min(900px, calc(100vw - 28px));
  margin:24px auto;
  background:#fff;
  border-radius:28px;
  overflow:hidden;
  box-shadow:0 30px 80px rgba(0,0,0,.24);
}
.book-preview-close{
  position:absolute;
  top:14px;
  right:14px;
  width:42px;
  height:42px;
  border:none;
  border-radius:14px;
  background:#eef2e8;
  font-size:28px;
  cursor:pointer;
}
.book-preview-grid{
  display:grid;
  grid-template-columns:300px 1fr;
  gap:0;
}
.book-preview-cover-col{
  padding:28px;
  background:#f7faf4;
  display:flex;
  align-items:center;
  justify-content:center;
}
.book-preview-cover{
  width:100%;
  max-width:240px;
  height:340px;
  object-fit:contain;
  border-radius:14px;
  box-shadow:0 12px 24px rgba(0,0,0,.16);
  background:#fff;
}
.book-preview-content{
  padding:34px 28px 28px;
}
.book-preview-kicker{
  margin:0 0 8px;
  color:#69765f;
  text-transform:uppercase;
  letter-spacing:.04em;
  font-size:12px;
  font-weight:700;
}
.book-preview-content h3{
  margin:0 0 12px;
  font-size:34px;
  line-height:1.08;
}
.book-preview-meta{
  margin:0 0 16px;
  color:#5d6b55;
  font-weight:700;
}
.book-preview-description{
  color:#2d3628;
  line-height:1.65;
  font-size:16px;
  min-height:120px;
}
.book-preview-actions{
  margin-top:20px;
}
html.preview-open,
html.preview-open body{
  overflow:hidden !important;
}

/* ===== Dashboard con métricas reales ===== */
.dashboard-stats-pro{
  grid-template-columns:repeat(6,minmax(0,1fr)) !important;
}
.dashboard-latest-list{
  display:grid;
  gap:12px;
}
.dashboard-latest-item{
  padding:14px 16px;
  border-radius:18px;
  background:#fbfdf8;
  border:1px solid #e6ecdf;
}
.dashboard-latest-item strong{
  display:block;
  margin-bottom:4px;
  font-size:16px;
}
.dashboard-latest-item span{
  color:#62705b;
  font-size:14px;
}

@media (max-width: 1400px){
  .dashboard-stats-pro{
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
  }
}
@media (max-width: 900px){
  .book-preview-grid{
    grid-template-columns:1fr;
  }
  .dashboard-stats-pro{
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  }
}
@media (max-width: 640px){
  .dashboard-stats-pro{
    grid-template-columns:1fr !important;
  }
}


/* ===== AJUSTE FINAL: sidebar fija sin botón ocultar + resultados sin espacios ===== */
:root{
  --library-sidebar-width: 274px;
  --library-sidebar-left: 16px;
  --library-sidebar-gap: 20px;
  --library-content-right: 18px;
}

body.library-has-sidebar{
  padding-left: 0 !important;
}

.library-sidebar-shell{
  display: block !important;
  position: fixed !important;
  left: var(--library-sidebar-left) !important;
  top: 14px !important;
  width: var(--library-sidebar-width) !important;
  height: calc(100vh - 28px) !important;
  transform: none !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.sidebar-toggle,
[data-sidebar-toggle]{
  display: none !important;
}

.page-shell{
  margin-left: calc(var(--library-sidebar-left) + var(--library-sidebar-width) + var(--library-sidebar-gap)) !important;
  width: calc(100% - (var(--library-sidebar-left) + var(--library-sidebar-width) + var(--library-sidebar-gap)) - var(--library-content-right)) !important;
  max-width: none !important;
  padding: 0 0 24px 0 !important;
  box-sizing: border-box !important;
}

.site-legal-footer{
  margin-left: calc(var(--library-sidebar-left) + var(--library-sidebar-width) + var(--library-sidebar-gap)) !important;
  width: calc(100% - (var(--library-sidebar-left) + var(--library-sidebar-width) + var(--library-sidebar-gap)) - var(--library-content-right)) !important;
  box-sizing: border-box !important;
}

.books-page,
.books-page-wide,
.books-results,
.featured-random-books,
.books-toolbar,
.dashboard-pro-page,
.dashboard-hero,
.dashboard-main-grid,
.dashboard-stats-pro{
  width: 100% !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.books-grid,
.featured-grid{
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
  gap: 18px !important;
  width: 100% !important;
  align-items: stretch !important;
}

.books-results .books-grid{
  grid-auto-flow: row dense !important;
}

.book-card{
  width: 100% !important;
  min-width: 0 !important;
  min-height: 100% !important;
}

@media (min-width: 1500px){
  .books-grid,
  .featured-grid{
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 1150px) and (max-width: 1499px){
  .books-grid,
  .featured-grid{
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 820px) and (max-width: 1149px){
  .books-grid,
  .featured-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 979px){
  .library-sidebar-shell{
    display: none !important;
  }

  .page-shell,
  .site-legal-footer{
    margin-left: 0 !important;
    width: 100% !important;
  }

  .page-shell{
    padding: 0 12px 20px 12px !important;
  }

  .books-grid,
  .featured-grid{
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
  }
}

@media (max-width: 640px){
  .books-grid,
  .featured-grid{
    grid-template-columns: 1fr !important;
  }
}

/* ===== VERSION PRO FINAL: corrección definitiva de sidebar + catálogo ===== */
:root{
  --library-sidebar-width: 276px;
  --library-sidebar-left: 18px;
  --library-sidebar-gap: 28px;
  --library-content-right: 20px;
}
html,body{overflow-x:hidden !important;}
body.library-has-sidebar{
  padding-left:0 !important;
}
.library-sidebar-shell{
  position:fixed !important;
  top:18px !important;
  left:var(--library-sidebar-left) !important;
  width:var(--library-sidebar-width) !important;
  height:calc(100vh - 36px) !important;
  z-index:1200 !important;
}
.library-sidebar-card{
  height:100% !important;
  overflow:auto !important;
}
.page-shell{
  margin-left:calc(var(--library-sidebar-left) + var(--library-sidebar-width) + var(--library-sidebar-gap)) !important;
  width:calc(100% - (var(--library-sidebar-left) + var(--library-sidebar-width) + var(--library-sidebar-gap)) - var(--library-content-right)) !important;
  max-width:none !important;
  padding:0 0 26px 0 !important;
}
.page-shell > .books-page,
.page-shell > .books-page-wide,
.page-shell > .dashboard-pro-page,
.page-shell > .dashboard-page,
.page-shell > .profile-page,
.page-shell > .form-panel,
.page-shell > .panel-card{
  width:100% !important;
  max-width:none !important;
}
.site-legal-footer{
  margin-left:calc(var(--library-sidebar-left) + var(--library-sidebar-width) + var(--library-sidebar-gap)) !important;
  width:calc(100% - (var(--library-sidebar-left) + var(--library-sidebar-width) + var(--library-sidebar-gap)) - var(--library-content-right)) !important;
  max-width:none !important;
}
.books-header,
.section-title-row,
.search-helper-text,
.pagination-bar,
.empty-state-box{
  width:100% !important;
}
.books-toolbar{
  display:grid !important;
  grid-template-columns:minmax(320px,1.8fr) minmax(180px,.7fr) auto auto auto !important;
  gap:12px !important;
  align-items:center !important;
  width:100% !important;
}
.catalog-search-input,
.catalog-filter-select{
  width:100% !important;
  min-width:0 !important;
}
.books-grid,
.featured-grid,
.books-results .books-grid{
  display:grid !important;
  grid-template-columns:repeat(3, minmax(0, 1fr)) !important;
  gap:20px !important;
  align-items:stretch !important;
  grid-auto-flow:row dense !important;
  width:100% !important;
}
.netflix-book-card,
.book-card{
  width:100% !important;
  min-width:0 !important;
  height:100% !important;
}
.book-card-body{
  display:flex !important;
  flex-direction:column !important;
  height:100% !important;
}
.book-card-actions-row,
.book-admin-actions{
  margin-top:auto !important;
}
.book-cover-wrap{
  aspect-ratio:3 / 4 !important;
  height:auto !important;
}
.book-cover,
.netflix-book-card .book-cover{
  width:100% !important;
  height:100% !important;
  object-fit:contain !important;
  background:#f8faf5 !important;
}
@media (min-width:1500px){
  .books-grid,
  .featured-grid,
  .books-results .books-grid{
    grid-template-columns:repeat(4, minmax(0, 1fr)) !important;
  }
}
@media (max-width:1200px){
  .books-toolbar{
    grid-template-columns:minmax(250px,1fr) minmax(170px,.7fr) auto auto auto !important;
  }
  .books-grid,
  .featured-grid,
  .books-results .books-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr)) !important;
  }
}
@media (max-width:980px){
  body.library-has-sidebar{padding-left:0 !important;}
  .library-sidebar-shell{display:none !important;}
  .page-shell,
  .site-legal-footer{
    margin-left:0 !important;
    width:100% !important;
  }
  .page-shell{padding:0 12px 20px !important;}
  .books-toolbar{
    grid-template-columns:1fr !important;
  }
}
@media (max-width:640px){
  .books-grid,
  .featured-grid,
  .books-results .books-grid{
    grid-template-columns:1fr !important;
  }
}


/* ===== CORRECCION FINAL REAL: SIDEBAR + CONTENIDO + CARATULAS ===== */
body.library-has-sidebar{
  padding-left:0 !important;
}

.library-sidebar-shell{
  width:230px !important;
  padding:10px !important;
  z-index:1000 !important;
}

.library-sidebar-card{
  border-radius:26px !important;
  padding:16px 14px !important;
}

.library-logo-box{
  width:88px !important;
  height:88px !important;
  margin:0 auto 12px !important;
}

.library-sidebar-title{
  font-size:26px !important;
  line-height:1.05 !important;
}

.library-sidebar-subtitle{
  font-size:14px !important;
  margin:8px 0 14px !important;
}

.library-sidebar-panel{
  padding:14px !important;
  margin-bottom:14px !important;
}

.library-sidebar-user{
  font-size:17px !important;
}

.library-sidebar-link{
  font-size:14px !important;
  padding:11px 12px !important;
}

.library-sidebar-logout{
  font-size:15px !important;
  padding:13px 14px !important;
}

.page-shell,
body.library-has-sidebar .page-shell{
  width:calc(100% - 230px) !important;
  margin-left:230px !important;
  max-width:none !important;
  padding:0 24px 28px 24px !important;
  box-sizing:border-box !important;
}

.page-shell-inner{
  margin-left:230px !important;
}

.books-page,
.books-page-wide,
.dashboard-shell,
.profile-shell,
.reader-shell,
.form-panel,
.admin-users-page{
  max-width:1280px !important;
  margin:0 auto !important;
}

.books-header,
.admin-header-row{
  max-width:1280px !important;
  margin-left:auto !important;
  margin-right:auto !important;
}

.site-legal-footer{
  margin-left:230px !important;
  width:calc(100% - 230px) !important;
  box-sizing:border-box !important;
}

.theme-toggle-floating{
  right:18px !important;
  top:12px !important;
}

.admin-header-row{
  padding-right:170px !important;
}

.books-grid,
.featured-grid{
  display:grid !important;
  grid-template-columns:repeat(auto-fit,minmax(260px,1fr)) !important;
  gap:22px !important;
  align-items:stretch !important;
}

.book-card{
  min-height:0 !important;
  height:100% !important;
  border-radius:24px !important;
}

.book-cover-wrap{
  padding:22px 22px 10px !important;
  min-height:290px !important;
}

.book-cover,
.book-card img.book-cover{
  width:190px !important;
  max-width:100% !important;
  height:260px !important;
  object-fit:contain !important;
  object-position:center top !important;
  border-radius:14px !important;
  background:#ffffff !important;
}

.placeholder-cover{
  width:190px !important;
  max-width:100% !important;
  height:260px !important;
  border-radius:14px !important;
}

.book-card-body{
  padding:14px 18px 18px !important;
}

.book-card-body h3{
  min-height:44px !important;
}

.book-card-actions-row,
.book-admin-actions{
  display:grid !important;
  grid-template-columns:1fr 1fr !important;
  gap:10px !important;
}

.book-card-actions-row .btn,
.book-admin-actions .btn{
  width:100% !important;
  min-width:0 !important;
}

.books-toolbar{
  max-width:1280px !important;
  margin-left:auto !important;
  margin-right:auto !important;
  grid-template-columns:minmax(300px,1.8fr) minmax(150px,.7fr) 140px 150px 120px !important;
}

@media (max-width: 1100px){
  .page-shell,
  body.library-has-sidebar .page-shell,
  .page-shell-inner,
  .site-legal-footer{
    width:100% !important;
    margin-left:0 !important;
  }

  body.library-has-sidebar{
    padding-left:0 !important;
  }

  .library-sidebar-shell{
    display:none !important;
  }

  .admin-header-row{
    padding-right:0 !important;
  }
}

@media (max-width: 768px){
  .page-shell,
  body.library-has-sidebar .page-shell{
    padding:0 14px 22px 14px !important;
  }

  .books-toolbar,
  .book-card-actions-row,
  .book-admin-actions,
  .books-grid,
  .featured-grid{
    grid-template-columns:1fr !important;
  }

  .book-cover-wrap{
    min-height:auto !important;
  }

  .book-cover,
  .book-card img.book-cover,
  .placeholder-cover{
    width:170px !important;
    height:230px !important;
  }
}

/* ===== NIVEL NETFLIX INSTITUCIONAL PRO MAXIMO ===== */
:root{
  --pro-sidebar-width: 218px;
  --pro-sidebar-left: 18px;
  --pro-content-gap: 34px;
  --pro-content-right: 28px;
  --pro-content-start: calc(var(--pro-sidebar-left) + var(--pro-sidebar-width) + var(--pro-content-gap));
}

body.library-has-sidebar{
  overflow-x:hidden;
}

.library-sidebar-shell{
  left:var(--pro-sidebar-left) !important;
  width:var(--pro-sidebar-width) !important;
  top:14px !important;
  bottom:14px !important;
  z-index:1200 !important;
}

.library-sidebar-card{
  width:100% !important;
  min-height:calc(100vh - 28px) !important;
  border-radius:30px !important;
  padding:18px 16px 20px !important;
  box-shadow:0 16px 44px rgba(0,0,0,.16) !important;
}

.library-logo-box{
  width:92px !important;
  height:92px !important;
  margin:4px auto 14px !important;
}

.library-sidebar-badge{
  font-size:11px !important;
  line-height:1.3 !important;
  padding:10px 14px !important;
  margin-bottom:12px !important;
}

.library-sidebar-title{
  font-size:19px !important;
  line-height:1.06 !important;
}

.library-sidebar-subtitle{
  font-size:13px !important;
  line-height:1.4 !important;
  margin:8px 0 14px !important;
}

.library-sidebar-panel{
  padding:13px !important;
  margin-bottom:14px !important;
}

.library-sidebar-user{
  font-size:16px !important;
}

.library-sidebar-link{
  padding:11px 12px !important;
  font-size:14px !important;
  border-radius:14px !important;
}

.library-sidebar-logout{
  padding:14px 14px !important;
  border-radius:18px !important;
  font-size:14px !important;
}

.page-shell,
body.library-has-sidebar .page-shell,
.page-shell-inner,
body.library-has-sidebar .page-shell-inner{
  margin-left:var(--pro-content-start) !important;
  width:calc(100% - var(--pro-content-start) - var(--pro-content-right)) !important;
  max-width:none !important;
  padding:22px 0 30px !important;
  box-sizing:border-box !important;
}

.page-shell > .books-page,
.page-shell > .books-page-wide,
.page-shell > .dashboard-page,
.page-shell > .dashboard-pro-page,
.page-shell > .dashboard-shell,
.page-shell > .profile-page,
.page-shell > .profile-shell,
.page-shell > .reader-shell,
.page-shell > .admin-users-page,
.page-shell > .form-panel,
.page-shell > .panel-card,
.page-shell > main.main{
  width:min(1360px, 100%) !important;
  max-width:1360px !important;
  margin-left:auto !important;
  margin-right:auto !important;
}

main.main{
  padding:0 !important;
}

.books-page,
.books-page-wide,
.dashboard-shell,
.profile-shell,
.reader-shell,
.form-panel,
.admin-users-page{
  max-width:1360px !important;
  margin:0 auto !important;
}

.books-header,
.admin-header-row{
  max-width:1360px !important;
  margin-left:auto !important;
  margin-right:auto !important;
}

.books-header{
  padding:0 4px 6px !important;
}

.books-header h1{
  margin:0 0 6px !important;
  font-size:clamp(38px, 4.2vw, 62px) !important;
  line-height:1.02 !important;
}

.books-toolbar{
  max-width:1360px !important;
  margin:0 auto 12px !important;
  padding:12px !important;
  display:grid !important;
  grid-template-columns:minmax(320px, 2fr) minmax(150px, .8fr) 126px 142px 118px !important;
  gap:12px !important;
  align-items:center !important;
}

.catalog-search-input,
.catalog-filter-select,
.books-toolbar .btn{
  min-height:52px !important;
}

.search-helper-text,
.section-title-row,
.books-results,
.featured-random-books{
  max-width:1360px !important;
  margin-left:auto !important;
  margin-right:auto !important;
}

.books-grid,
.featured-grid,
.books-results .books-grid{
  display:grid !important;
  grid-template-columns:repeat(auto-fit, minmax(220px, 236px)) !important;
  justify-content:center !important;
  gap:20px 18px !important;
  align-items:start !important;
}

.netflix-book-card,
.book-card{
  width:100% !important;
  max-width:236px !important;
  min-height:0 !important;
  height:auto !important;
  border-radius:22px !important;
  overflow:hidden !important;
}

.book-cover-wrap{
  min-height:auto !important;
  padding:18px 18px 8px !important;
  display:flex !important;
  align-items:flex-start !important;
  justify-content:center !important;
}

.book-cover,
.book-card img.book-cover,
.netflix-book-card .book-cover,
.placeholder-cover{
  width:164px !important;
  max-width:100% !important;
  height:246px !important;
  object-fit:contain !important;
  object-position:center center !important;
  border-radius:14px !important;
  background:#f7f7f1 !important;
  box-shadow:0 10px 24px rgba(0,0,0,.10) !important;
}

.book-card-body{
  padding:12px 14px 16px !important;
  display:flex !important;
  flex-direction:column !important;
  gap:6px !important;
}

.book-card-body h3{
  margin:0 !important;
  min-height:48px !important;
  font-size:14px !important;
  line-height:1.28 !important;
  display:-webkit-box !important;
  -webkit-line-clamp:2 !important;
  -webkit-box-orient:vertical !important;
  overflow:hidden !important;
}

.book-meta{
  margin:0 !important;
  font-size:13px !important;
  line-height:1.35 !important;
}

.book-card-actions-row,
.book-admin-actions{
  display:grid !important;
  grid-template-columns:1fr 1fr !important;
  gap:8px !important;
  margin-top:8px !important;
}

.book-card-actions-row .btn,
.book-admin-actions .btn{
  width:100% !important;
  min-width:0 !important;
  min-height:38px !important;
  padding:9px 8px !important;
  font-size:13px !important;
  border-radius:12px !important;
}

.reader-grid{
  grid-template-columns:minmax(260px, 300px) minmax(0, 1fr) !important;
  gap:22px !important;
}

.reader-cover{
  width:100% !important;
  max-width:188px !important;
  height:282px !important;
  object-fit:contain !important;
  display:block !important;
  margin:0 auto 18px !important;
  background:#f7f7f1 !important;
}

.site-legal-footer{
  margin-left:var(--pro-content-start) !important;
  width:calc(100% - var(--pro-content-start) - var(--pro-content-right)) !important;
  max-width:none !important;
  padding:18px 24px 24px !important;
  box-sizing:border-box !important;
}

.theme-toggle-floating{
  top:14px !important;
  right:18px !important;
}

@media (max-width: 1240px){
  .books-toolbar{
    grid-template-columns:minmax(250px, 1fr) minmax(150px, .7fr) repeat(3, minmax(116px, 1fr)) !important;
  }
}

@media (max-width: 1120px){
  .library-sidebar-shell{display:none !important;}

  .page-shell,
  body.library-has-sidebar .page-shell,
  .page-shell-inner,
  body.library-has-sidebar .page-shell-inner,
  .site-legal-footer{
    margin-left:0 !important;
    width:100% !important;
  }

  .page-shell{
    padding:18px 16px 24px !important;
  }

  .books-grid,
  .featured-grid,
  .books-results .books-grid{
    grid-template-columns:repeat(auto-fit, minmax(210px, 228px)) !important;
  }
}

@media (max-width: 860px){
  .books-toolbar{
    grid-template-columns:1fr !important;
  }

  .books-grid,
  .featured-grid,
  .books-results .books-grid{
    grid-template-columns:repeat(auto-fit, minmax(190px, 220px)) !important;
  }

  .reader-grid{
    grid-template-columns:1fr !important;
  }
}

@media (max-width: 560px){
  .page-shell{
    padding:14px 12px 20px !important;
  }

  .books-header h1{
    font-size:34px !important;
  }

  .books-grid,
  .featured-grid,
  .books-results .books-grid{
    grid-template-columns:1fr !important;
  }

  .netflix-book-card,
  .book-card{
    max-width:260px !important;
    margin-left:auto !important;
    margin-right:auto !important;
  }

  .book-cover,
  .book-card img.book-cover,
  .netflix-book-card .book-cover,
  .placeholder-cover{
    width:156px !important;
    height:234px !important;
  }
}

/* === UI institucional premium final: proporción fina de botones === */
:root{
  --premium-toolbar-height: 52px;
  --premium-toolbar-radius: 16px;
  --premium-toolbar-gap: 12px;
}

.books-toolbar{
  display:grid !important;
  grid-template-columns:minmax(320px,1.9fr) minmax(160px,.7fr) max-content max-content max-content !important;
  gap:var(--premium-toolbar-gap) !important;
  align-items:center !important;
  justify-content:start !important;
  width:100% !important;
  max-width:100% !important;
  box-sizing:border-box !important;
}

.catalog-search-input,
.catalog-filter-select{
  height:var(--premium-toolbar-height) !important;
  min-height:var(--premium-toolbar-height) !important;
  padding:0 18px !important;
  border-radius:var(--premium-toolbar-radius) !important;
  font-size:15px !important;
  line-height:1.2 !important;
  box-sizing:border-box !important;
}

.books-toolbar .btn-uniform{
  height:var(--premium-toolbar-height) !important;
  min-height:var(--premium-toolbar-height) !important;
  padding:0 22px !important;
  border-radius:var(--premium-toolbar-radius) !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  white-space:nowrap !important;
  font-size:14px !important;
  font-weight:800 !important;
  line-height:1 !important;
  width:auto !important;
  min-width:132px !important;
  max-width:100% !important;
  box-sizing:border-box !important;
  text-align:center !important;
}

.books-toolbar .btn-uniform.btn-primary{
  min-width:138px !important;
}

.books-toolbar .btn-uniform.btn-secondary{
  min-width:148px !important;
}

.library-sidebar-card{
  padding:22px 18px 18px !important;
  box-sizing:border-box !important;
}

.library-sidebar-logout{
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  width:100% !important;
  max-width:100% !important;
  min-height:54px !important;
  padding:0 16px !important;
  margin-top:18px !important;
  border-radius:18px !important;
  font-size:15px !important;
  font-weight:800 !important;
  line-height:1 !important;
  box-sizing:border-box !important;
  text-align:center !important;
}

@media (max-width: 1380px){
  .books-toolbar{
    grid-template-columns:minmax(280px,1.6fr) minmax(150px,.7fr) repeat(3,max-content) !important;
  }

  .books-toolbar .btn-uniform{
    min-width:124px !important;
    padding:0 18px !important;
  }

  .books-toolbar .btn-uniform.btn-secondary{
    min-width:136px !important;
  }
}

@media (max-width: 1180px){
  .books-toolbar{
    grid-template-columns:minmax(240px,1fr) minmax(150px,.7fr) !important;
  }

  .books-toolbar .btn-uniform{
    width:100% !important;
  }
}

@media (max-width: 860px){
  .books-toolbar{
    grid-template-columns:1fr !important;
  }

  .books-toolbar .btn-uniform,
  .catalog-search-input,
  .catalog-filter-select{
    width:100% !important;
  }
}


/* === Entrega final: logo real + bienvenida centrada === */
.landing-shell-centered{
  min-height:calc(100vh - 92px);
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  padding:42px 20px 120px !important;
  background:radial-gradient(circle at top, rgba(135,160,94,.12) 0%, rgba(255,255,255,.94) 42%, #f4f7f1 100%);
}
.landing-centered-wrap{
  width:min(100%, 980px);
  margin:0 auto;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  gap:22px;
}
.landing-centered-brand{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:14px;
}
.brand-logo-main{
  width:132px !important;
  height:132px !important;
  border-radius:30px !important;
  background:rgba(255,255,255,.96) !important;
  box-shadow:0 18px 40px rgba(36,58,22,.12), 0 0 0 8px rgba(255,255,255,.75) !important;
  object-fit:contain !important;
}
.landing-mini-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 18px;
  border-radius:999px;
  background:rgba(85,106,57,.10);
  color:#556a39;
  font-weight:800;
  letter-spacing:.01em;
}
.landing-copy-centered{
  max-width:820px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:10px;
}
.hero-title-centered{
  margin:0 !important;
  max-width:none !important;
  text-align:center !important;
  font-size:clamp(48px, 7vw, 92px) !important;
}
.hero-text-centered{
  margin:0 !important;
  max-width:760px !important;
  text-align:center !important;
  font-size:clamp(18px, 2vw, 28px) !important;
  line-height:1.65 !important;
}
.login-card-centered{
  width:min(100%, 520px) !important;
  margin:8px auto 0 !important;
  text-align:center !important;
}
.login-card-centered h2,
.login-card-centered p,
.login-card-centered .forgot-link{
  text-align:center !important;
}
.login-card-icon{
  width:82px;
  height:82px;
  margin:0 auto 16px;
  border-radius:24px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:linear-gradient(180deg,#eef3e3 0%,#f4f7f1 100%);
  border:1px solid var(--border);
  font-size:38px;
}
.library-logo-box{
  width:128px !important;
  height:128px !important;
  padding:10px !important;
}
.library-logo-image{
  width:100% !important;
  height:100% !important;
  object-fit:contain !important;
  display:block !important;
}
.library-logo-fallback{display:none !important;}
.library-sidebar-title,
.library-sidebar-subtitle,
.library-sidebar-panel,
.library-sidebar-badge{
  text-align:center !important;
}
@media (max-width: 820px){
  .landing-shell-centered{
    padding:32px 16px 112px !important;
  }
  .brand-logo-main{
    width:112px !important;
    height:112px !important;
  }
  .login-card-centered{
    width:min(100%, 100%) !important;
  }
}


/* ===== Navegación móvil real para biblioteca ===== */
.library-mobile-topbar,
.library-mobile-overlay,
.library-mobile-drawer{display:none;}

@media (max-width: 980px){
  body.library-has-sidebar{padding-top:74px !important;}
  .library-mobile-topbar{
    display:flex !important;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    position:fixed;
    top:0;left:0;right:0;
    z-index:1400;
    padding:12px 14px;
    background:rgba(13, 23, 14, 0.96);
    backdrop-filter:blur(10px);
    box-shadow:0 10px 24px rgba(15, 23, 42, 0.18);
  }
  .library-mobile-menu-btn,
  .library-mobile-close{
    border:0;
    background:#5f7439;
    color:#fff;
    width:42px;height:42px;
    border-radius:12px;
    font-size:22px;
    line-height:1;
    display:inline-flex;align-items:center;justify-content:center;
  }
  .library-mobile-brand{
    display:flex;align-items:center;gap:10px;
    min-width:0;
    color:#fff;
    font-weight:800;
    letter-spacing:-0.02em;
  }
  .library-mobile-brand span{
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    font-size:18px;
  }
  .library-mobile-brand-logo{
    width:38px;height:38px;object-fit:contain;
    border-radius:10px;background:rgba(255,255,255,.92);padding:4px;
    flex:0 0 auto;
  }
  .library-mobile-overlay{
    position:fixed;inset:0;
    background:rgba(0,0,0,.42);
    z-index:1498;
  }
  .library-mobile-drawer{
    position:fixed;
    top:0;left:0;bottom:0;
    width:min(86vw, 320px);
    background:linear-gradient(180deg,#0e180f 0%, #162515 100%);
    color:#fff;
    z-index:1499;
    padding:16px;
    transform:translateX(-100%);
    transition:transform .28s ease;
    box-shadow:16px 0 36px rgba(0,0,0,.25);
    display:flex !important;
    flex-direction:column;
    gap:14px;
  }
  .library-mobile-drawer-head{display:flex;align-items:center;justify-content:space-between;gap:10px;}
  .library-mobile-user{
    display:flex;flex-direction:column;gap:4px;
    background:rgba(255,255,255,.06);
    border:1px solid rgba(255,255,255,.08);
    border-radius:16px;padding:12px 14px;
  }
  .library-mobile-user strong{font-size:18px;line-height:1.15;}
  .library-mobile-user span{color:#d6e3c4;font-size:13px;text-transform:capitalize;}
  .library-mobile-nav{display:flex;flex-direction:column;gap:8px;}
  .library-mobile-nav a, .library-mobile-logout{
    color:#fff;text-decoration:none;
    padding:13px 14px;
    border-radius:14px;
    background:rgba(255,255,255,.05);
    font-weight:700;
    border:1px solid rgba(255,255,255,.06);
  }
  .library-mobile-nav a.is-active{background:rgba(209, 186, 90, .18);border-color:rgba(209,186,90,.24);}
  .library-mobile-logout{margin-top:auto;background:#bd4733;border-color:#bd4733;text-align:center;}
  html.mobile-nav-open{overflow:hidden;}
  html.mobile-nav-open .library-mobile-overlay{display:block !important;}
  html.mobile-nav-open .library-mobile-drawer{transform:translateX(0);}
  .theme-toggle-floating{top:84px !important;right:12px !important;transform:scale(.92);transform-origin:top right;}
}

@media (max-width: 640px){
  body.library-has-sidebar{padding-top:72px !important;}
  .library-mobile-topbar{padding:10px 12px;}
  .library-mobile-brand span{font-size:16px;}
  .library-mobile-brand-logo{width:34px;height:34px;}
}


/* ===== Login premium institucional ===== */
.site-legal-footer{display:none !important;}
.premium-login-page{position:relative;overflow:hidden;isolation:isolate;background:
  radial-gradient(circle at 15% 20%, rgba(144,169,104,.20) 0%, rgba(244,247,241,.10) 25%, transparent 45%),
  radial-gradient(circle at 85% 15%, rgba(185,155,82,.12) 0%, rgba(255,255,255,.05) 22%, transparent 40%),
  linear-gradient(180deg, #f7f8f4 0%, #f2f5ee 52%, #edf3e6 100%) !important;}
.premium-login-page::before{content:"";position:absolute;inset:0;background:linear-gradient(90deg, rgba(255,255,255,.70) 0%, rgba(255,255,255,.16) 40%, rgba(255,255,255,.06) 100%);z-index:-1;}
.premium-login-wrap{position:relative;z-index:2;width:min(100%, 1080px) !important;padding:18px 0 0;}
.premium-login-orb{position:absolute;border-radius:999px;filter:blur(2px);opacity:.75;animation:premiumFloat 7s ease-in-out infinite;}
.orb-left{width:220px;height:220px;left:-60px;top:120px;background:radial-gradient(circle, rgba(119,148,82,.22) 0%, rgba(119,148,82,.05) 58%, transparent 72%);}
.orb-right{width:300px;height:300px;right:-80px;top:90px;background:radial-gradient(circle, rgba(185,155,82,.18) 0%, rgba(185,155,82,.06) 58%, transparent 72%);animation-delay:1.4s;}
.orb-bottom{width:360px;height:360px;left:50%;bottom:-170px;transform:translateX(-50%);background:radial-gradient(circle, rgba(85,106,57,.14) 0%, rgba(85,106,57,.04) 60%, transparent 74%);animation-delay:2.2s;}
@keyframes premiumFloat{0%,100%{transform:translateY(0px)}50%{transform:translateY(-12px)}}
.premium-brand-block{gap:16px;}
.brand-logo-main{background:rgba(255,255,255,.92) !important;border:1px solid rgba(85,106,57,.14) !important;box-shadow:0 24px 58px rgba(49,66,33,.14), 0 0 0 10px rgba(255,255,255,.65) !important;animation:logoPulse 4.6s ease-in-out infinite;}
@keyframes logoPulse{0%,100%{transform:scale(1)}50%{transform:scale(1.025)}}
.landing-mini-badge{box-shadow:0 10px 24px rgba(85,106,57,.08);}
.hero-title-centered{letter-spacing:-.03em;text-shadow:0 10px 28px rgba(23,32,22,.06);}
.hero-text-centered{max-width:780px !important;color:#5f6d59 !important;}
.premium-hero-points{display:flex;flex-wrap:wrap;justify-content:center;gap:12px;margin-top:14px;}
.premium-hero-points span{display:inline-flex;align-items:center;gap:8px;padding:10px 14px;border-radius:999px;background:rgba(255,255,255,.74);border:1px solid rgba(85,106,57,.10);box-shadow:0 8px 18px rgba(85,106,57,.06);font-weight:700;color:#445734;}
.premium-login-card{max-width:540px !important;padding:34px 30px !important;border:1px solid rgba(85,106,57,.10);background:rgba(255,255,255,.86) !important;backdrop-filter:blur(10px);box-shadow:0 28px 58px rgba(17,24,39,.10) !important;}
.premium-login-icon{background:linear-gradient(180deg,#eef3e3 0%,#f8fbf5 100%) !important;box-shadow:0 12px 22px rgba(85,106,57,.10);}
.premium-login-form input{height:58px !important;border-radius:18px !important;background:rgba(246,249,242,.96) !important;font-size:16px;padding-inline:16px !important;}
.premium-login-form input:focus{background:#fff !important;}
.premium-login-form button{height:58px !important;border-radius:18px !important;background:linear-gradient(90deg,#718c49 0%, #556a39 100%) !important;box-shadow:0 16px 32px rgba(85,106,57,.22);font-size:18px;transition:transform .25s ease, box-shadow .25s ease, filter .25s ease;}
.premium-login-form button:hover{transform:translateY(-2px);box-shadow:0 20px 36px rgba(85,106,57,.28);filter:saturate(1.04);}
.forgot-link{margin-top:18px !important;}
@media (max-width: 820px){.premium-login-wrap{padding-top:8px}.premium-hero-points{gap:10px}.premium-hero-points span{font-size:14px;padding:9px 12px}.premium-login-card{padding:26px 18px !important}.orb-left{left:-100px;top:80px}.orb-right{right:-120px;top:120px}}
@media (max-width: 560px){.landing-shell-centered{padding-top:26px !important;padding-bottom:40px !important;min-height:100vh !important}.brand-logo-main{width:104px !important;height:104px !important}.landing-mini-badge{font-size:13px;padding:9px 14px}.hero-title-centered{font-size:clamp(34px, 10vw, 48px) !important}.hero-text-centered{font-size:16px !important;line-height:1.58 !important}.premium-hero-points{display:grid;grid-template-columns:1fr; width:100%;}.premium-hero-points span{justify-content:center}.premium-login-card{border-radius:24px !important}}
