:root{
  --brand:#8d1021;
  --brand-dark:#650b17;
  --brand-soft:#f8ecef;
  --ink:#172033;
  --muted:#667085;
  --line:#e5e9f0;
  --surface:#fff;
  --soft:#f6f7f9;
  --shadow:0 10px 30px rgba(20,30,50,.07);
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{margin:0;font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:var(--ink);background:var(--soft)}
.container{width:min(1180px,calc(100% - 32px));margin:auto}
.site-header{position:sticky;top:0;z-index:20;background:rgba(255,255,255,.96);backdrop-filter:blur(12px);border-bottom:1px solid var(--line)}
.header-inner{height:66px;display:flex;align-items:center;justify-content:space-between}
.brand{display:flex;align-items:center;gap:10px;color:var(--ink);text-decoration:none}
.brand img{width:42px;height:42px;object-fit:contain}.brand span{display:flex;flex-direction:column;line-height:1.1}.brand strong{font-size:.96rem}.brand small{font-size:.7rem;color:var(--muted);letter-spacing:.11em;margin-top:4px}
.public-label{font-size:.72rem;font-weight:700;color:var(--brand);background:var(--brand-soft);padding:7px 10px;border-radius:999px}
.intro{background:#fff;border-bottom:1px solid var(--line)}
.intro-inner{display:flex;justify-content:space-between;align-items:flex-end;gap:36px;padding:34px 0 28px}.intro-copy{max-width:760px}.eyebrow{display:inline-block;font-size:.7rem;font-weight:800;letter-spacing:.13em;text-transform:uppercase;color:var(--brand);margin-bottom:9px}.intro h1{font-size:clamp(1.7rem,3.4vw,2.65rem);line-height:1.12;margin:0 0 10px;letter-spacing:-.025em}.intro p{margin:0;color:var(--muted);font-size:.98rem;line-height:1.6}
.quick-stats{display:flex;gap:24px;flex:0 0 auto}.quick-stats div{display:flex;flex-direction:column;min-width:76px}.quick-stats strong{font-size:1.28rem;line-height:1.1}.quick-stats span{font-size:.72rem;color:var(--muted);margin-top:4px}
.library-section{padding:26px 0 56px}.filters{background:var(--surface);border:1px solid var(--line);border-radius:16px;padding:14px;box-shadow:0 5px 18px rgba(20,30,50,.04)}.search-wrap{position:relative}.search-wrap span{position:absolute;left:15px;top:10px;font-size:1.2rem;color:#8a94a6}.filters input,.filters select{width:100%;height:44px;border:1px solid var(--line);border-radius:10px;background:#fff;padding:0 12px;color:var(--ink);font:inherit;outline:none}.filters input:focus,.filters select:focus{border-color:#c77b86;box-shadow:0 0 0 3px rgba(141,16,33,.08)}.search-wrap input{padding-left:40px}.filter-row{display:grid;grid-template-columns:repeat(3,minmax(140px,1fr)) auto auto;gap:9px;margin-top:10px}.btn{display:inline-flex;align-items:center;justify-content:center;height:44px;padding:0 16px;border-radius:10px;text-decoration:none;border:0;font-weight:750;cursor:pointer;font-size:.88rem}.btn-primary{background:var(--brand);color:#fff}.btn-primary:hover{background:var(--brand-dark)}.btn-light{background:#f2f4f7;color:var(--ink)}
.results-head{display:flex;justify-content:space-between;gap:16px;margin:24px 2px 14px;color:var(--muted);font-size:.84rem}
.resource-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px}
.resource-card{background:#fff;border:1px solid var(--line);border-radius:18px;padding:16px;box-shadow:0 4px 18px rgba(20,30,50,.04);transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease;min-width:0;display:flex;flex-direction:column}
.resource-card:hover{transform:translateY(-3px);box-shadow:var(--shadow);border-color:#d7dde7}
.resource-card-top{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
.resource-icon{width:48px;height:48px;border-radius:14px;display:grid;place-items:center;font-size:1.45rem;color:#fff;flex:0 0 auto;background:linear-gradient(145deg,#7d1726,#a82d40)}
.cover-norm{background:linear-gradient(145deg,#841526,#ae3145)}.cover-hazmat{background:linear-gradient(145deg,#72550b,#a77d13)}.cover-civil{background:linear-gradient(145deg,#225471,#3d86aa)}.cover-fire{background:linear-gradient(145deg,#8a2a12,#d15424)}.cover-hyd{background:linear-gradient(145deg,#17627b,#3297b3)}.cover-invest{background:linear-gradient(145deg,#503472,#7e60ae)}.cover-tech{background:linear-gradient(145deg,#344b61,#657f98)}.cover-risk{background:linear-gradient(145deg,#385e4b,#6a947d)}.cover-medical{background:linear-gradient(145deg,#86294e,#be4e79)}.cover-rescue{background:linear-gradient(145deg,#6d5028,#a47d41)}.cover-forest{background:linear-gradient(145deg,#486936,#799553)}.cover-default{background:linear-gradient(145deg,#46505f,#748092)}
.badges{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}.badge{font-size:.62rem;font-weight:800;padding:5px 8px;border-radius:999px}.badge-red{background:#fee9ec;color:#951a30}.badge-purple{background:#f0ebfb;color:#604596}.badge-gold{background:#fff4dc;color:#846100}.badge-green{background:#e7f6ed;color:#2d7049}.badge-blue{background:#e7f2f8;color:#27637d}.badge-neutral{background:#f1f3f5;color:#626b79}
.resource-body{display:flex;flex-direction:column;min-width:0;flex:1}.category-label{font-size:.66rem;font-weight:800;letter-spacing:.07em;text-transform:uppercase;color:var(--brand);margin-bottom:7px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.resource-body h2{font-size:1rem;line-height:1.38;margin:0 0 8px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.resource-body p{font-size:.8rem;line-height:1.5;color:var(--muted);margin:0 0 12px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.meta-line{display:flex;justify-content:space-between;gap:10px;font-size:.7rem;color:var(--muted);margin-top:auto;padding-top:11px;border-top:1px solid #edf0f4}.card-footer-row{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:12px}
.metrics{display:flex;align-items:center;gap:5px}.metric-item,.reaction{height:32px;min-width:46px;border:0;background:#f5f7fa;border-radius:9px;padding:0 8px;display:inline-flex;align-items:center;justify-content:center;gap:5px;color:#647084;font-size:.72rem}.metric-item svg,.reaction svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.reaction{cursor:pointer;transition:background .15s ease,color .15s ease,transform .15s ease}.reaction:hover{background:#eceff4;transform:translateY(-1px)}.reaction.active.like{background:#e8f6ed;color:#267047}.reaction.active.dislike{background:#fbeaec;color:#a12539}.reaction.active svg{fill:currentColor;stroke:currentColor}
.open-btn{display:inline-flex;align-items:center;gap:7px;background:var(--brand);color:#fff;text-decoration:none;border-radius:10px;padding:9px 12px;font-weight:800;font-size:.76rem;white-space:nowrap}.open-btn:hover{background:var(--brand-dark)}
.pagination{display:flex;justify-content:center;gap:7px;margin-top:28px}.pagination a{width:36px;height:36px;display:grid;place-items:center;border:1px solid var(--line);background:#fff;border-radius:9px;color:var(--ink);text-decoration:none;font-size:.82rem}.pagination a.current{background:var(--brand);color:#fff;border-color:var(--brand)}.empty{padding:46px;text-align:center;background:#fff;border:1px solid var(--line);border-radius:16px;color:var(--muted)}
.footer{background:#fff;border-top:1px solid var(--line);padding:24px 0}.footer-inner{display:flex;align-items:center;justify-content:space-between;gap:24px}.footer-brand{display:flex;align-items:center;gap:10px}.footer-brand img{width:44px;height:44px;object-fit:contain}.footer-brand div{display:flex;flex-direction:column}.footer-brand strong{font-size:.9rem}.footer-brand span,.footer small{color:var(--muted);font-size:.72rem}
@media(max-width:1020px){.intro-inner{align-items:flex-start}.resource-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.filter-row{grid-template-columns:1fr 1fr 1fr}.quick-stats{gap:16px}}
@media(max-width:760px){.container{width:min(100% - 22px,1180px)}.header-inner{height:62px}.brand img{width:38px;height:38px}.public-label{font-size:.66rem;padding:6px 8px}.intro-inner{display:block;padding:27px 0 22px}.intro h1{font-size:1.75rem}.intro p{font-size:.9rem}.quick-stats{margin-top:18px;padding-top:15px;border-top:1px solid var(--line);justify-content:space-between}.quick-stats div{min-width:auto}.filter-row{grid-template-columns:1fr}.resource-grid{grid-template-columns:1fr}.results-head{font-size:.76rem}.footer-inner{flex-direction:column;align-items:flex-start}}
@media(max-width:440px){.public-label{display:none}.resource-card{padding:14px}.resource-icon{width:44px;height:44px;border-radius:12px}.resource-card-top{align-items:flex-start}.badges{max-width:72%}.card-footer-row{align-items:flex-end}.metrics{gap:4px}.metric-item,.reaction{height:31px;min-width:40px;padding:0 6px}.open-btn{font-size:0;width:38px;height:38px;padding:0;justify-content:center;border-radius:10px}.open-btn span{font-size:1rem}.category-label{font-size:.62rem}}

/* Paginación y selector de cantidad */
.results-toolbar{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:24px 2px 14px;color:var(--muted);font-size:.84rem}
.results-summary{display:flex;align-items:center;gap:7px;flex-wrap:wrap}.results-summary strong{color:var(--ink)}
.page-size-form{display:flex;align-items:center;gap:8px;white-space:nowrap}.page-size-form label,.page-size-form span{font-size:.78rem;color:var(--muted)}
.page-size-form select{height:36px;min-width:72px;border:1px solid var(--line);border-radius:9px;background:#fff;padding:0 28px 0 10px;color:var(--ink);font:inherit;font-size:.8rem;outline:none;cursor:pointer}
.page-size-form select:focus{border-color:#c77b86;box-shadow:0 0 0 3px rgba(141,16,33,.08)}
.pagination-wrap{display:flex;flex-direction:column;align-items:center;gap:10px;margin-top:28px}
.pagination{margin-top:0;display:flex;justify-content:center;align-items:center;flex-wrap:wrap;gap:7px}
.pagination a{min-width:36px;width:auto;padding:0 11px}
.pagination .page-nav{gap:6px;padding:0 13px;font-weight:700}
.page-ellipsis{height:36px;min-width:24px;display:grid;place-items:center;color:var(--muted)}
.pagination-info{margin:0;color:var(--muted);font-size:.75rem}
@media(max-width:760px){.results-toolbar{align-items:flex-start;flex-direction:column;gap:10px}.page-size-form{width:100%;justify-content:flex-end}.pagination .page-nav span{display:none}.pagination .page-nav{min-width:36px;padding:0 10px}}
@media(max-width:440px){.page-size-form{justify-content:space-between}.pagination{gap:5px}.pagination a{min-width:34px;height:34px;padding:0 9px}.page-ellipsis{height:34px}.pagination-info{font-size:.7rem}}

/* ===== v6.4: UX responsivo integral y paginación compacta ===== */
html{overflow-x:hidden}
body{min-width:0;overflow-x:hidden}
img,svg{max-width:100%}
.container{max-width:1180px;width:calc(100% - 32px);margin-inline:auto}

.results-toolbar{margin:22px 0 14px;padding:0 2px}
.results-summary{min-width:0}
.page-size-form select{appearance:auto}

.pagination-wrap{margin-top:30px;display:flex;flex-direction:column;align-items:center;gap:12px}
.pagination-info{order:0;margin:0;color:var(--muted);font-size:.78rem;line-height:1.4;text-align:center}
.pagination-info strong{color:var(--ink);font-weight:800}
.pagination{order:1;width:100%;margin:0;display:flex;align-items:center;justify-content:center;gap:8px;flex-wrap:nowrap}
.page-numbers{display:flex;align-items:center;justify-content:center;gap:6px;min-width:0}
.pagination a,.pagination .page-nav,.pagination .disabled{box-sizing:border-box;height:40px;border:1px solid var(--line);background:#fff;border-radius:10px;color:var(--ink);text-decoration:none;display:inline-flex;align-items:center;justify-content:center;font-size:.82rem;font-weight:750;line-height:1;transition:.16s ease}
.page-numbers a{width:40px;min-width:40px;padding:0}
.pagination a:hover{border-color:#c5ccd7;background:#f8f9fb;transform:translateY(-1px)}
.pagination a.current{background:var(--brand);border-color:var(--brand);color:#fff;box-shadow:0 5px 14px rgba(141,16,33,.16)}
.pagination .page-nav{width:auto;min-width:108px;padding:0 14px;gap:7px}
.pagination .page-nav svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex:0 0 auto}
.pagination .disabled{opacity:.42;cursor:not-allowed;background:#f7f8fa}
.page-ellipsis{height:40px;min-width:22px;display:grid;place-items:center;color:var(--muted);font-weight:800}

@media(max-width:1020px){
  .container{width:calc(100% - 28px)}
  .resource-grid{gap:14px}
  .resource-card{min-width:0}
  .card-footer-row{flex-wrap:wrap}
}

@media(max-width:760px){
  .container{width:calc(100% - 24px)}
  .site-header{position:relative}
  .intro-inner{gap:20px}
  .quick-stats{width:100%;display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
  .quick-stats div{padding:10px 8px;border-radius:10px;background:#f7f8fa;text-align:center}
  .filters{padding:12px}
  .filter-row{display:grid;grid-template-columns:1fr;gap:8px}
  .filter-row .btn{width:100%}
  .results-toolbar{flex-direction:row;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
  .page-size-form{width:auto;margin-left:auto;justify-content:flex-end}
  .resource-grid{grid-template-columns:1fr}
  .resource-card{width:100%}
  .pagination{justify-content:space-between;gap:8px}
  .pagination .page-nav{min-width:44px;width:44px;padding:0}
  .pagination .page-nav span{display:none}
  .page-numbers{flex:1;gap:5px;overflow:hidden}
  .page-numbers a{width:36px;min-width:36px;height:38px}
  .page-ellipsis{height:38px;min-width:16px}
  .page-numbers a:not(.current){display:none}
  .page-numbers a.current{display:inline-flex}
  .page-numbers .page-ellipsis{display:none}
  .pagination-info{font-size:.74rem}
  .footer-inner{width:100%}
}

@media(max-width:520px){
  .container{width:calc(100% - 18px)}
  .header-inner{height:60px}
  .brand span strong{font-size:.86rem}
  .intro-inner{padding:23px 0 19px}
  .intro h1{font-size:1.52rem;line-height:1.18}
  .intro p{font-size:.86rem}
  .quick-stats strong{font-size:1.02rem}
  .quick-stats span{font-size:.64rem}
  .library-section{padding-top:18px}
  .results-toolbar{display:grid;grid-template-columns:1fr auto;align-items:end}
  .results-summary{font-size:.76rem;line-height:1.4}
  .results-summary span:nth-of-type(1),.results-summary span:nth-of-type(2){display:none}
  .page-size-form label,.page-size-form>span{display:none}
  .page-size-form select{height:38px;min-width:68px}
  .resource-card{padding:13px;border-radius:15px}
  .resource-card-top{margin-bottom:11px}
  .resource-body h2{font-size:.96rem}
  .card-footer-row{display:grid;grid-template-columns:1fr auto;align-items:center;gap:8px}
  .metrics{min-width:0;gap:4px}
  .metric-item,.reaction{min-width:38px;height:32px;padding:0 6px}
  .open-btn{width:40px;height:40px;padding:0;font-size:0;justify-content:center}
  .open-btn span{font-size:1rem}
  .pagination-wrap{margin-top:24px}
  .pagination{max-width:320px}
  .pagination .page-nav{height:40px;width:44px}
  .page-numbers a.current{width:auto;min-width:86px;padding:0 13px}
  .page-numbers a.current::before{content:'Página ';font-weight:650}
  .footer{padding:20px 0}
  .footer-brand img{width:38px;height:38px}
}
