/* ==========================================================================
   diseno-fichas-b.css · fichas de embalse, cuenca e incendio en el diseño nuevo
   (templates/diseno/{embalse,cuenca,incendio}.php). Solo con la bandera; se
   apoya en sistema.css y diseno-lugar.css.
   ========================================================================== */

/* Tramos de llenado (los cinco de EmbalseService::classifyFillLevel) y colores propios */
:root {
  --fb-n1: #d2432f; --fb-n2: #ee8a1c; --fb-n3: #d9b310; --fb-n4: #2f7fd8; --fb-n5: #2f9e57; --fb-nd: #aab3bc;
  --fb-agua: #1f6fc4; --fb-fuego: #e0601c; --fb-pico: #c0261b; --fb-sube: #1d7d3e; --fb-baja: #b3261e;
  --fb-ojo: #9b4805; --fb-azul: #1f6fc4;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fb-n1: #ee6a55; --fb-n2: #f5a04a; --fb-n3: #e8c84a; --fb-n4: #5ea2ee; --fb-n5: #4fbf78; --fb-nd: #56616d;
    --fb-agua: #5ea2ee; --fb-fuego: #f08a46; --fb-pico: #ff6b5c; --fb-sube: #68ca80; --fb-baja: #fe7f78; --fb-ojo: #ffa659; --fb-azul: #7db6f2;
  }
}
:root[data-theme="dark"] {
  --fb-n1: #ee6a55; --fb-n2: #f5a04a; --fb-n3: #e8c84a; --fb-n4: #5ea2ee; --fb-n5: #4fbf78; --fb-nd: #56616d;
  --fb-agua: #5ea2ee; --fb-fuego: #f08a46; --fb-pico: #ff6b5c; --fb-sube: #68ca80; --fb-baja: #fe7f78; --fb-ojo: #ffa659; --fb-azul: #7db6f2;
}
.fb-n1 { --c: var(--fb-n1); } .fb-n2 { --c: var(--fb-n2); } .fb-n3 { --c: var(--fb-n3); }
.fb-n4 { --c: var(--fb-n4); } .fb-n5 { --c: var(--fb-n5); } .fb-nd { --c: var(--fb-nd); }
.fb-fb-estado-gris, .fb-estado-gris { --c: var(--faint); }

.fb-sube { color: var(--fb-sube); } .fb-baja { color: var(--fb-baja); }
.fb-ojo { color: var(--fb-ojo); font-weight: 600; } .fb-azul { color: var(--fb-azul); font-weight: 600; } .fb-rojo { color: var(--fb-baja); font-weight: 600; }
.fb-ico-abajo { transform: rotate(180deg); }

/* Avisos */
.fb-avisos { display: grid; gap: var(--e-2); grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.fb-sinavisos { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fb-sinavisos .ico { color: var(--ok); }

/* La respuesta */
.fb-resp { display: grid; gap: var(--e-4); }
.fb-resp__ppal { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--e-3); }
.fb-big { display: grid; gap: 2px; }
.fb-big .cifra small { vertical-align: .95em; }
.fb-big__lado { display: flex; flex-wrap: wrap; gap: var(--e-2); align-items: center; }
.fb-cifras .l-cifra__v small, .fb-cifras-inc .l-cifra__v small { font-size: var(--t-1); }
.fb-v-s { font-size: var(--t-4) !important; }
.fb-v-s a { text-decoration: underline; text-decoration-color: var(--senal); text-underline-offset: 3px; }
.fb-cifra--fuerte { border-color: var(--ink); }
.fb-nd-v { color: var(--faint); }
.fb-atrasado { background: color-mix(in srgb, var(--av-naranja) 22%, var(--surface)); color: var(--ink); }

/* Barra de llenado con marcas */
.fb-barra { display: grid; gap: 4px; }
.fb-barra__pista { position: relative; height: 18px; border-radius: var(--r-1); background: var(--sunk); overflow: visible; }
.fb-barra__agua { position: absolute; inset: 0 auto 0 0; border-radius: var(--r-1); background: var(--c, var(--fb-agua)); }
.fb-barra__m { position: absolute; top: -4px; bottom: -4px; width: 0; border-left: 2px solid var(--ink); }
.fb-barra__m--anio { border-left: 2px dashed var(--muted); }
.fb-barra__esc { display: flex; justify-content: space-between; font-size: var(--t-1); color: var(--muted); font-variant-numeric: tabular-nums; }
.fb-barra__ley, .fb-clave, .fb-ley { display: flex; flex-wrap: wrap; gap: 4px var(--e-3); align-items: center; }
.fb-barra__ley span, .fb-clave span, .fb-ley span { display: inline-flex; align-items: center; gap: 6px; }
.fb-m { display: inline-block; width: 14px; height: 10px; border-radius: 2px; flex: none; }
.fb-m--agua { background: var(--fb-agua); }
.fb-m--normal { width: 0; height: 14px; border-left: 2px solid var(--ink); border-radius: 0; }
.fb-m--anio { width: 0; height: 14px; border-left: 2px dashed var(--muted); border-radius: 0; }
.fb-m--med { height: 0; border-top: 2px dashed var(--ink); border-radius: 0; }
.fb-m--rango { background: var(--line-2); opacity: .5; }
.fb-m--fuego { background: var(--fb-fuego); } .fb-m--pico { background: var(--fb-pico); }
.fb-pt { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--fb-nd)); flex: none; }
.fb-cuad { display: inline-block; width: 12px; height: 12px; border-radius: 2px; background: var(--c, var(--fb-nd)); flex: none; }

/* Gráficos */
.fb-g-agua { --c: var(--fb-agua); }
.fb-g-fuego { --c: var(--fb-fuego); }
.d2-fb .g-acento { --c: var(--fb-pico); }
.d2-fb .g-banda.fb-g-agua { opacity: .16; }
.d2-fb .g-banda.g-gris { opacity: .45; }
.d2-fb .g-previsto { stroke-dasharray: 5 4; }
.fb-fila-sel > * { background: var(--senal-suave) !important; }
.fb-rango { margin-right: auto; }
.graf-fig__cab:has(.fb-rango) { flex-wrap: wrap; }

/* Lista de días con lluvia prevista */
.fb-frase-ll { display: flex; gap: 8px; align-items: flex-start; font-size: var(--t-3); }
.fb-frase-ll .ico { color: var(--fb-azul); margin-top: 3px; flex: none; }
.fb-dias { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-3); background: var(--surface); overflow: hidden; }
.fb-dia { display: grid; justify-items: center; gap: 4px; padding: 10px 4px; text-align: center; font-variant-numeric: tabular-nums; min-width: 0; }
.fb-dia + .fb-dia { border-left: 1px solid var(--line); }
.fb-dia__n { font-size: var(--t-1); color: var(--muted); white-space: nowrap; }
.fb-dia__n b { color: var(--ink); }
.fb-dia__ico { width: 26px; height: 26px; }
.fb-dia__t { white-space: nowrap; }
.fb-dia__ll { display: grid; justify-items: center; align-content: end; min-height: 46px; font-size: var(--t-1); color: var(--muted); white-space: nowrap; }
.fb-dia__ll--si { color: var(--fb-azul); font-weight: 600; }
.fb-dia__llb { width: 14px; border-radius: 2px 2px 0 0; background: #46afec; margin-bottom: 2px; }
.fb-dia__p { min-height: 1.2em; }
@media (max-width: 520px) {
  .fb-dia { padding: 8px 2px; }
  .fb-dia__ico { width: 22px; height: 22px; }
  .fb-dia__ll { font-size: 11px; }
  .fb-dia__t .nota { display: block; }
}

/* Ficha técnica y listas de definiciones */
.fb-dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: var(--e-3) var(--e-4); margin: 0; }
.fb-dl > div { display: grid; gap: 2px; min-width: 0; }
.fb-dl dt { font-size: var(--t-1); color: var(--muted); display: flex; align-items: center; gap: 6px; }
.fb-dl dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.fb-dl dd a { text-decoration: underline; text-decoration-color: var(--senal); text-underline-offset: 3px; }
.fb-dl--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fb-dl--usos { grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }

/* Listas de embalses (hermanos y cercanos) */
.fb-emb { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: var(--e-2); }
.fb-emb a { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--surface); text-decoration: none; color: var(--ink); min-height: 52px; }
.fb-emb a:hover { border-color: var(--ink); }
.fb-emb__n { min-width: 0; }
.fb-emb__n b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-emb__n small { display: block; color: var(--muted); font-size: var(--t-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-emb__p { display: grid; gap: 3px; justify-items: end; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fb-emb__b { display: block; width: 56px; height: 5px; border-radius: 3px; background: var(--sunk); overflow: hidden; }
.fb-emb__b > span { display: block; height: 100%; background: var(--c); }
.fb-mas summary { cursor: pointer; font-weight: 600; padding: 8px 0; color: var(--ink-2); }
.fb-mas[open] summary { margin-bottom: var(--e-2); }

/* Fuentes */
.fb-fuentes { list-style: disc; padding-left: 1.2em; margin: 0; display: grid; gap: 6px; max-width: 80ch; }
.fb-fuentes a, .proc a, .d2-fb .texto a, .d2-fb .nota a { text-decoration: underline; text-decoration-color: var(--senal); text-underline-offset: 3px; }
.fb-seguir { margin: 0; }

/* Mapas (Leaflet) */
.fb-mapa { height: 420px; }
.fb-mapa--inc { height: 520px; }
@media (max-width: 700px) { .fb-mapa { height: 340px; } .fb-mapa--inc { height: 400px; } }
.fb-mapa .leaflet-container { background: var(--mar); font: inherit; }
.fb-mapa-ctl { flex-wrap: wrap; max-width: calc(100% - 24px); }
.fb-mapa-ctl .btn[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.fb-pop b { display: block; }
.fb-pop a { text-decoration: underline; }
.fb-cuad--per { background: rgba(127, 29, 29, .35); border: 2px solid #dc2626; }
.fb-grad { display: inline-block; width: 44px; height: 10px; border-radius: 5px; background: linear-gradient(90deg, rgb(250, 204, 21), rgb(185, 28, 28)); }

/* Tabla de embalses de la cuenca */
.fb-tabla-emb { max-height: 34rem; }
.fb-tabla-emb th a { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 600; white-space: normal; }
.fb-tabla-emb th a:hover { text-decoration: underline; }
.fb-tabla-emb tbody th { white-space: normal; min-width: 11em; }
.fb-hidro { font-size: 12px; }
@media (max-width: 600px) { .fb-col-prov { display: none; } }
.fb-2col { display: grid; gap: var(--e-3); grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }
.fb-rank { list-style: decimal; padding-left: 1.4em; margin: 0; display: grid; gap: 6px; }
.fb-rank li { padding-left: 2px; }
.fb-rank li a { color: var(--ink); }
.fb-rank li b { float: right; font-variant-numeric: tabular-nums; }

/* Mapa de calor año × semana */
.fb-calor-caja { display: grid; gap: var(--e-3); overflow-x: auto; }
.fb-calor { display: grid; gap: 2px; min-width: 300px; }
.fb-calor__f { display: grid; grid-template-columns: 2.6em repeat(52, minmax(3px, 1fr)); gap: 1px; align-items: center; }
.fb-calor__a { font-size: var(--t-1); color: var(--muted); font-variant-numeric: tabular-nums; }
.fb-calor__c { height: 14px; background: var(--c); border-radius: 1px; }
.fb-calor__cab { height: 16px; }
.fb-calor__m { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: visible; width: 0; }
@media (max-width: 600px) { .fb-calor__m:nth-child(odd) { visibility: hidden; } .fb-calor__c { height: 12px; } }

/* Incendio */
.fb-estados { margin-top: calc(-1 * var(--e-4)); }
.fb-relato { max-width: 75ch; }
.fb-relato b, .lc__sub b { font-weight: 600; }
.fb-aparte { border-left: 3px solid var(--av-naranja); padding-left: 10px; max-width: 75ch; }
.fb-topo { display: flex; gap: 8px; align-items: flex-start; }
.fb-topo .ico { flex: none; margin-top: 2px; }
.fb-viento { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
.fb-viento__f { color: var(--ink); display: inline-flex; }
.fb-flecha { display: inline-block; vertical-align: -2px; }
.fb-fwi { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: var(--r-2); background: var(--c); color: #fff; font-weight: 600; font-size: var(--t-1); }
.fb-sub { display: block; font-weight: 400; }
.fb-chip-origen { height: 22px; background: color-mix(in srgb, var(--fb-pico) 16%, var(--surface)); color: var(--ink); }
.fb-tabla-pueblos tbody th { white-space: normal; min-width: 10em; }
.fb-tabla-pueblos th a { font-weight: 600; color: var(--ink); }
.fb-pctbar { display: inline-flex; align-items: center; gap: 6px; }
.fb-pctbar__b { display: inline-block; width: 48px; height: 6px; border-radius: 3px; background: var(--sunk); overflow: hidden; }
.fb-pctbar__b > span { display: block; height: 100%; background: var(--fb-fuego); }
@media (max-width: 520px) { .fb-pctbar__b { display: none; } }
.fb-despues > * { color: var(--muted); }
.fb-apilada { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--sunk); }
.fb-apilada > span { display: block; height: 100%; background: var(--c); }
.fb-uso--esclerofilo { --c: #d99a1c; } .fb-uso--frondosas { --c: #2f8f3a; } .fb-uso--coniferas { --c: #0d7d70; } .fb-uso--mixto { --c: #6a9a1f; }
.fb-uso--transicion { --c: #9c6a12; } .fb-uso--agricola { --c: #e3c33b; } .fb-uso--otros_nat { --c: #8a837b; } .fb-uso--artificial { --c: #5c6670; }
.fb-natura { display: flex; gap: 8px; align-items: flex-start; padding-top: var(--e-2); border-top: 1px solid var(--line); }
.fb-natura .ico { color: var(--ok); flex: none; margin-top: 2px; }
.fb-reinc { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-3); background: var(--surface); }
.fb-reinc li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px 12px; }
.fb-reinc li + li { border-top: 1px solid var(--line); }
.fb-reinc li > span:last-child { display: grid; min-width: 0; }
.fb-reinc__a { display: inline-grid; place-items: center; min-width: 3.4em; height: 30px; border-radius: var(--r-2); background: color-mix(in srgb, var(--fb-fuego) 18%, var(--surface)); font-weight: 700; font-variant-numeric: tabular-nums; }

/* Índice de la cuenca */
.fb-indice { margin-top: calc(-1 * var(--e-3)); }
.fb-indice .chip:hover { border-color: var(--ink); }
