* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f5f7fa; color: #1a1a2e; }
a { color: #1565c0; text-decoration: none; }
a:hover { text-decoration: underline; }

header { background: #1565c0; color: white; padding: 1rem 2rem; display: flex; align-items: center; gap: 1rem; }
header h1 { font-size: 1.4rem; }
header .subtitle { font-size: 0.85rem; opacity: 0.8; }
nav { background: #0d47a1; padding: 0.5rem 2rem; overflow-x: auto; white-space: nowrap; }
nav a { color: rgba(255,255,255,0.85); margin-right: 1.5rem; font-size: 0.9rem; }
nav a:hover { color: white; text-decoration: none; }

.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
.page-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; color: #0d47a1; }
.page-subtitle { color: #666; font-size: 0.9rem; margin-bottom: 1.5rem; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: white; border-radius: 8px; padding: 1.25rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); text-align: center; }
.stat-card .value { font-size: 2rem; font-weight: 700; color: #1565c0; }
.stat-card .label { font-size: 0.8rem; color: #888; margin-top: 0.25rem; }
.stat-card .sublabel { font-size: 0.75rem; color: #aaa; margin-top: 0.15rem; }

.bar-wrap { background: #e0e0e0; border-radius: 4px; height: 8px; overflow: hidden; margin: 0.5rem 0; }
.bar { height: 100%; border-radius: 4px; transition: width 0.3s; }

.section-title { font-size: 1.1rem; font-weight: 600; margin: 1.5rem 0 0.75rem; color: #333; border-bottom: 2px solid #e0e0e0; padding-bottom: 0.4rem; }

.cuencas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.cuenca-card { background: white; border-radius: 8px; padding: 1rem 1.25rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.cuenca-card h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.cuenca-card .pct { font-size: 1.5rem; font-weight: 700; }
.cuenca-card .info { font-size: 0.8rem; color: #888; }
.cuenca-card .anyo-ant { font-size: 0.8rem; color: #aaa; margin-top: 0.25rem; }

.embalses-table { width: 100%; border-collapse: collapse; background: white; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.embalses-table th { background: #1565c0; color: white; padding: 0.75rem 1rem; text-align: left; font-size: 0.85rem; font-weight: 600; }
.embalses-table td { padding: 0.6rem 1rem; border-bottom: 1px solid #f0f0f0; font-size: 0.9rem; }
.embalses-table tr:last-child td { border-bottom: none; }
.embalses-table tr:hover td { background: #f5f7fa; }
.embalses-table .pct-val { font-weight: 600; }

.var { font-size: 0.8rem; font-weight: 600; }
.var.pos { color: #2e7d32; }
.var.neg { color: #c62828; }
.var.neu { color: #888; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.badge.critico { background: #ffebee; color: #c62828; }
.badge.bajo { background: #fff3e0; color: #e65100; }
.badge.normal { background: #e8f5e9; color: #2e7d32; }

.embalse-hero { background: white; border-radius: 8px; padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); margin-bottom: 1.5rem; }
.embalse-hero .big-pct { font-size: 3.5rem; font-weight: 700; line-height: 1; }
.embalse-hero .meta { color: #666; font-size: 0.9rem; margin-top: 0.5rem; }
.embalse-hero .volumes { display: flex; gap: 2rem; margin-top: 1rem; flex-wrap: wrap; }
.embalse-hero .vol-item .val { font-size: 1.4rem; font-weight: 600; color: #1565c0; }
.embalse-hero .vol-item .lbl { font-size: 0.8rem; color: #888; }

.comparativa-box { background: #f8f9fa; border: 1px solid #e0e0e0; border-radius: 8px; padding: 1rem 1.25rem; margin-bottom: 1.5rem; }
.comparativa-box h3 { font-size: 0.95rem; font-weight: 600; color: #555; margin-bottom: 0.75rem; }
.comparativa-row { display: flex; gap: 2rem; flex-wrap: wrap; }
.comparativa-item { }
.comparativa-item .cv { font-size: 1.3rem; font-weight: 700; }
.comparativa-item .cl { font-size: 0.78rem; color: #888; margin-top: 0.1rem; }

.ficha-box { background: white; border-radius: 8px; padding: 0.75rem 1.25rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); margin-bottom: 1.5rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0; }
.ficha-row { display: flex; flex-direction: column; padding: 0.65rem 0.75rem; border-bottom: 1px solid #f0f0f0; }
.ficha-row:last-child { border-bottom: none; }
.ficha-key { font-size: 0.75rem; color: #888; text-transform: uppercase; letter-spacing: 0.04em; }
.ficha-val { font-size: 0.95rem; font-weight: 500; color: #1a1a2e; margin-top: 0.1rem; }

.breadcrumb { font-size: 0.85rem; color: #888; margin-bottom: 1rem; }
.breadcrumb a { color: #1565c0; }
.breadcrumb span { margin: 0 0.4rem; }

.search-box { width: 100%; padding: 0.75rem 1rem; border: 1px solid #ddd; border-radius: 8px; font-size: 1rem; margin-bottom: 1rem; }
.search-box:focus { outline: none; border-color: #1565c0; box-shadow: 0 0 0 2px rgba(21,101,192,0.15); }

footer { background: #0d47a1; color: rgba(255,255,255,0.7); text-align: center; padding: 1.5rem; font-size: 0.8rem; margin-top: 3rem; }
footer a { color: rgba(255,255,255,0.9); }

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .embalses-table .hide-mobile { display: none; }
  header { padding: 0.75rem 1rem; }
  .container { padding: 1rem; }
  .embalse-hero .volumes { gap: 1rem; }
}