:root{--bg:#ffffff;--text:#0f172a;--muted:#64748b;--line:#e2e8f0;--brand:#0f766e;--bg-subtle:#f8fafc}
*{box-sizing:border-box} body{margin:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;background:var(--bg);color:var(--text);line-height:1.5}
header{padding:20px 20px;border-bottom:1px solid var(--line);background:var(--bg-subtle)}
h1{font-size:20px;margin:0;font-weight:700;color:var(--text)}
.author{margin:6px 0 0 0;font-size:14px;color:var(--muted)}
.author a{color:var(--brand);text-decoration:none;font-weight:500}
.author a:hover{text-decoration:underline}
.container{max-width:1400px;margin:0 auto}
.controls{display:flex;flex-wrap:wrap;gap:20px;padding:20px 20px;border-bottom:1px solid var(--line);background:var(--bg-subtle)}
.control{display:flex;flex-direction:column;gap:8px;min-width:180px}
label{font-size:13px;color:var(--muted);font-weight:600;text-transform:uppercase;letter-spacing:0.025em}
select,input[type="number"]{padding:12px 14px;border:1px solid var(--line);border-radius:10px;background:#fff;font-size:15px;font-weight:500;font-family:inherit;transition:all 0.2s;appearance:none;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");background-position:right 12px center;background-repeat:no-repeat;background-size:16px;padding-right:40px}
select option{font-family:inherit !important;font-size:15px;font-weight:500}
select:focus,input[type="number"]:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 3px rgba(15,118,110,0.1);transform:translateY(-1px)}
input[type="number"]{background-image:none;padding-right:14px}
input[type="range"]{-webkit-appearance:none;appearance:none;width:100%;height:8px;padding:0;background:#e5e7eb;border-radius:9999px;border:none;outline:none;cursor:pointer}
input[type="range"]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:16px;height:16px;border-radius:50%;background:var(--brand);cursor:pointer;border:none}
input[type="range"]::-moz-range-thumb{width:16px;height:16px;border-radius:50%;background:var(--brand);cursor:pointer;border:none}
.hint{font-size:12px;color:var(--muted)}
.segmented{display:inline-flex;gap:0;border:1px solid var(--line);border-radius:10px;overflow:hidden}
.segmented input{display:none}
.segmented label{padding:6px 10px;cursor:pointer;font-size:12px;color:var(--muted);background:#fff}
.segmented input:checked+label{background:var(--brand);color:#fff}
.segmented label+input+label{border-left:1px solid var(--line)}
.table-wrap{padding:16px 20px}
table{width:100%;border-collapse:collapse;background:#fff;border-radius:12px;overflow:hidden;box-shadow:0 1px 3px rgba(0,0,0,0.1)}
thead th{font-size:12px;color:var(--muted);text-align:left;border-bottom:2px solid var(--line);padding:10px 12px;background:var(--bg-subtle);font-weight:600;text-transform:uppercase;letter-spacing:0.025em}
tbody td{padding:12px 12px;border-bottom:1px solid var(--line)}
tbody tr:hover{background:#f8fafc;transform:translateY(-1px);box-shadow:0 2px 4px rgba(0,0,0,0.05)}
tbody tr.selected{background:#f0fdfa;border-left:4px solid var(--brand);transform:translateY(-1px);box-shadow:0 2px 8px rgba(15,118,110,0.15)}
tbody tr.selected:hover{background:#ecfdf5}
tbody tr:last-child td{border-bottom:none}
tbody tr{transition:all 0.2s}
.num{text-align:right;font-variant-numeric:tabular-nums}
footer{padding:20px 20px;color:var(--muted);background:var(--bg-subtle);border-top:1px solid var(--line)}
.footer-content{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:12px}
.source{margin:0;font-size:13px;color:var(--muted)}
.signature{margin:0;font-size:13px;color:var(--muted)}
.signature a{color:var(--brand);text-decoration:none;font-weight:500}
.signature a:hover{text-decoration:underline}

@media (max-width: 640px) {
  .footer-content{flex-direction:column;align-items:flex-start;gap:8px}
}

/* Lugar (dos líneas) - más compacto */
.place{display:flex;flex-direction:column;line-height:1.3}
.place .mun{font-weight:600;font-size:14px}
.place .prov{font-size:11px;color:var(--muted);margin-top:-1px}

/* Población sin pill - más pequeña */
.poblacion{color:var(--muted);font-variant-numeric:tabular-nums;font-size:12px}

/* Pill para totales - más compacta */
.pill{display:inline-block;background:#e2e8f0;color:#475569;border-radius:10px;padding:3px 8px;font-size:11px;font-weight:500}

/* Barra con texto antes - más compacta y ancha */
.bar-cell{display:flex;align-items:center;gap:8px;padding:4px 0}
.bar-label{font-variant-numeric:tabular-nums;font-weight:700;font-size:13px;color:var(--text);min-width:40px;text-align:right}
.bar-container{flex:1;position:relative;background:#f1f5f9;border-radius:5px;height:18px;border:1px solid #e2e8f0;min-width:120px}
.bar{position:absolute;left:0;top:0;bottom:0;background:linear-gradient(90deg, var(--brand), #0d9488);opacity:0.9;border-radius:6px;min-width:2px}

/* Desktop layout */
.content-container{padding:20px 20px}
.desktop-layout{display:flex;flex-direction:column;gap:32px}
.desktop-layout.provinces-only{justify-content:center}

/* Responsive desktop layout */
@media (min-width: 1024px) {
  .desktop-layout{flex-direction:row;gap:32px;align-items:flex-start}
  .map-section{flex:1.2;min-width:0}
  .ranking-section{flex:1;min-width:400px}
}

.section-header{margin-bottom:20px}
.section-header h2{margin:0;font-size:22px;font-weight:700;color:var(--text)}

/* Ranking section */
.ranking-section{}
.ranking-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px;padding-bottom:12px;border-bottom:2px solid var(--line)}
.ranking-header h3{margin:0;font-size:20px;font-weight:700;color:var(--text)}
.ranking-controls{display:flex;gap:20px;align-items:end}
.ranking-controls .control{min-width:120px}
.ranking-controls .segmented label{padding:8px 12px;font-size:13px;font-weight:500}

/* Table container with scroll - sin barra visible */
.table-container{border-radius:12px;border:1px solid var(--line);max-height:800px;overflow-y:auto;scrollbar-width:none;-ms-overflow-style:none}
.table-container::-webkit-scrollbar{display:none}

/* Compact controls */
.compact-select{padding:8px 12px !important;font-size:14px !important;min-width:90px !important;font-family:inherit !important;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e") !important;background-position:right 8px center !important;padding-right:32px !important}
.segmented.compact{border-radius:6px}
.segmented.compact label{padding:6px 8px;font-size:16px;font-weight:700}
.ranking-controls{gap:12px}

/* Tooltip personalizado */
.custom-tooltip-wrapper{background:none !important;border:none !important;box-shadow:none !important}
.custom-tooltip{background:#fff;border-radius:8px;padding:12px;box-shadow:0 4px 12px rgba(0,0,0,0.15);border:1px solid #e2e8f0;min-width:180px}
.tooltip-title{font-weight:700;font-size:14px;color:var(--text);margin-bottom:2px}
.tooltip-subtitle{font-size:12px;color:var(--muted);margin-bottom:8px}
.tooltip-value{font-size:16px;font-weight:700;color:var(--brand);margin-bottom:4px}
.tooltip-detail{font-size:12px;color:var(--muted)}


