:root {
  /* Paleta de la família Xoriguer: negre, taronja i blanc trencat */
  --fons: #33363c;
  --superficie: #3e4148;
  --superficie-2: #474a52;
  --text: #faf6f0;
  --text-suau: #c9c3ba;
  --vora: #555963;
  --primari: #ff8a1f;
  --primari-fort: #ff6a00;
  --primari-suau: #54391f;
  --sobre-primari: #111112;
  --degradat: linear-gradient(90deg, #ff5a00, #ff8a1f 55%, #ffb43a);
  --alerta: #ffb15c;
  --alerta-fons: #4b3a27;
  --ok: #7fd49a;
  --ok-fons: #2c4535;
  --info: #9cc6ee;
  --info-fons: #2b3d55;
  --puja: #7fd49a;
  --baixa: #ff8b7d;
  --radi: 12px;
  --ombra: 0 1px 0 rgb(255 255 255 / .04) inset, 0 6px 18px rgb(0 0 0 / .22);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 520px at 50% -220px, #42454c, transparent), var(--fons);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1 { font-size: 1.6rem; margin: 0 0 .5rem; line-height: 1.2; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 .5rem; }
a { color: var(--primari); }
.petit { font-size: .85rem; color: var(--text-suau); }
.intro { color: var(--text-suau); margin-top: 0; }

/* Barra superior */
.barra {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 16px; padding-top: max(.75rem, env(safe-area-inset-top));
  background: var(--superficie); border-bottom: 1px solid var(--vora);
  position: sticky; top: 0; z-index: 10;
}
.marca-logo { border-radius: 10px; box-shadow: 0 2px 8px rgb(0 0 0 / .3); }
.marca { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); }
.marca-text { display: flex; flex-direction: column; line-height: 1; }
.marca-nom { font-weight: 900; font-style: italic; font-size: 1.25rem; letter-spacing: .02em; }
.marca-nom b { color: var(--primari); }
.marca-sub { font-size: .62rem; font-weight: 700; letter-spacing: .38em; color: var(--primari); margin-top: .2rem; }

/* Disseny general */
.disseny { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; }
.menu {
  display: flex; gap: .25rem; overflow-x: auto; padding: .5rem 16px;
  border-bottom: 1px solid var(--vora); scrollbar-width: none;
}
.menu a, .menu-desactivat {
  white-space: nowrap; padding: .45rem .8rem; border-radius: 999px;
  text-decoration: none; color: var(--text-suau); font-size: .95rem;
}
.menu a[aria-current="page"] { background: var(--primari-suau); color: var(--primari); font-weight: 600; }
.menu-desactivat { opacity: .5; cursor: default; }
main { padding: 1.25rem 16px 2rem; outline: none; min-width: 0; flex: 1; }

@media (min-width: 900px) {
  .disseny { flex-direction: row; }
  .menu { flex-direction: column; border-bottom: 0; border-right: 1px solid var(--vora); padding: 1.25rem .75rem; min-width: 210px; position: sticky; top: 57px; align-self: flex-start; }
  .menu a, .menu-desactivat { border-radius: 8px; }
  main { padding: 1.25rem 2rem 2rem; }
}

.peu { padding: 1rem 16px 1.5rem; text-align: center; font-size: .85rem; color: var(--text-suau); border-top: 1px solid var(--vora); }
.peu p { margin: .25rem 0; }

/* Inici */
.heroi { padding: .5rem 0 1rem; max-width: 640px; }
.heroi h1 { font-size: 2rem; }
.heroi h1 span { background: var(--degradat); -webkit-background-clip: text; background-clip: text; color: transparent; }
.heroi p { color: var(--text-suau); font-size: 1.05rem; }
.targetes { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.targeta {
  display: block; padding: 1.25rem; background: var(--superficie); border: 1px solid var(--vora);
  border-radius: var(--radi); box-shadow: var(--ombra); text-decoration: none; color: var(--text);
  transition: border-color .15s, transform .15s;
}
a.targeta:hover { border-color: var(--primari); transform: translateY(-1px); box-shadow: 0 8px 28px rgb(255 106 0 / .12); }
.targeta h2 { margin: .5rem 0 .25rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.targeta p { margin: 0; color: var(--text-suau); font-size: .95rem; }
.targeta-icona { font-size: 1.75rem; }
.targeta.desactivada { opacity: .6; }
.etiqueta { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; padding: .15rem .5rem; border-radius: 999px; background: var(--primari-suau); color: var(--primari); }

/* Formularis */
.dues-columnes { display: grid; gap: 1.5rem; }
@media (min-width: 1000px) {
  .dues-columnes { grid-template-columns: minmax(320px, 420px) 1fr; align-items: start; }
  .resultat { position: sticky; top: 80px; }
}
.formulari fieldset {
  border: 1px solid var(--vora); border-radius: var(--radi); background: var(--superficie);
  padding: .75rem 1rem 1rem; margin: 0 0 1rem;
}
.formulari legend { font-weight: 700; padding: 0 .35rem; }
.camp { margin: .6rem 0; }
.camp label { display: block; font-size: .92rem; margin-bottom: .25rem; }
.entrada { display: flex; align-items: center; border: 1px solid var(--vora); border-radius: 8px; background: var(--fons); }
.entrada:focus-within { border-color: var(--primari); box-shadow: 0 0 0 3px var(--primari-suau); }
.entrada input { flex: 1; min-width: 0; border: 0; background: transparent; padding: .6rem .7rem; font: inherit; color: var(--text); outline: none; }
.sufix { padding: 0 .7rem; color: var(--text-suau); }
select, input[type="search"] {
  width: 100%; padding: .6rem .7rem; font: inherit; color: var(--text);
  border: 1px solid var(--vora); border-radius: 8px; background: var(--fons);
}
input[type="range"] { width: 100%; accent-color: var(--primari); }
.casella { display: flex; gap: .5rem; align-items: flex-start; font-size: .92rem; margin: .6rem 0; cursor: pointer; }
.casella input { margin-top: .25rem; accent-color: var(--primari); }
.accions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; }

.boto {
  font: inherit; font-size: .92rem; padding: .5rem .9rem; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--primari); background: var(--degradat); color: var(--sobre-primari); font-weight: 600;
}
.boto.secundari { background: transparent; color: var(--primari); font-weight: 500; }
.boto:hover { filter: brightness(1.05); }
.enllac { font: inherit; background: none; border: 0; padding: 0; color: var(--primari); text-decoration: underline; cursor: pointer; }
.preselec { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1rem; }

/* Ajudes */
details.ajuda { margin-top: .3rem; font-size: .85rem; color: var(--text-suau); }
details.ajuda summary { cursor: pointer; color: var(--primari); width: fit-content; }
details.ajuda p { margin: .3rem 0 0; }
details.ajuda.gran { margin-top: 1.5rem; padding: .75rem 1rem; border: 1px solid var(--vora); border-radius: var(--radi); background: var(--superficie); font-size: .92rem; }
details.linia summary { cursor: pointer; list-style: none; text-decoration: underline dotted var(--text-suau); text-underline-offset: 3px; width: fit-content; }
details.linia summary::-webkit-details-marker { display: none; }
details.linia p { margin: .35rem 0 .2rem; font-size: .85rem; color: var(--text-suau); max-width: 50ch; }

/* Resultat */
.resultat { min-width: 0; }
.buit { padding: 2rem 1.25rem; text-align: center; border: 1px dashed var(--vora); border-radius: var(--radi); color: var(--text-suau); }
.xifra-net {
  display: flex; flex-direction: column; gap: .15rem; padding: 1.1rem 1.25rem; margin-bottom: 1rem;
  background: var(--superficie); border: 1px solid var(--primari-suau); border-left: 4px solid var(--primari); border-radius: var(--radi); color: var(--text);
}
.xifra-net strong { font-size: 2.2rem; font-variant-numeric: tabular-nums; background: var(--degradat); -webkit-background-clip: text; background-clip: text; color: transparent; width: fit-content; }
.avis { padding: .75rem 1rem; border-radius: 10px; margin: .5rem 0; font-size: .93rem; border-left: 4px solid; }
.avis.alerta { background: var(--alerta-fons); border-color: var(--alerta); }
.avis.ok { background: var(--ok-fons); border-color: var(--ok); }
.avis.info { background: var(--info-fons); border-color: var(--info); }

.taula { width: 100%; border-collapse: collapse; background: var(--superficie); border: 1px solid var(--vora); border-radius: var(--radi); overflow: hidden; font-size: .95rem; }
.taula th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-suau); padding: .6rem .9rem .3rem; background: var(--fons); }
.taula td { padding: .5rem .9rem; border-top: 1px solid var(--vora); vertical-align: top; }
.taula .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.taula .detall { display: block; font-size: .8rem; color: var(--text-suau); }
.taula tr.subtotal td { color: var(--text-suau); }
.taula tr.total td { font-weight: 700; }
.taula tr.gran td { font-size: 1.1rem; color: var(--primari); }
.taula .puja { color: var(--puja); }
.taula .baixa { color: var(--baixa); }
.comparativa td:first-child { min-width: 9rem; }
@media (max-width: 480px) {
  .taula { font-size: .88rem; }
  .taula td, .taula th { padding-left: .55rem; padding-right: .55rem; }
  .comparativa { display: block; overflow-x: auto; }
}

/* Glossari */
.cerca { max-width: 420px; }
.glossari { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin: 1rem 0 0; }
.terme { padding: 1rem; background: var(--superficie); border: 1px solid var(--vora); border-radius: var(--radi); }
.terme[hidden] { display: none; }
.terme dt { font-weight: 700; margin-bottom: .25rem; }
.terme dd { margin: 0; color: var(--text-suau); font-size: .93rem; }

/* Resum flotant al mòbil */
.resum-mobil {
  position: sticky; bottom: max(12px, env(safe-area-inset-bottom)); display: block; margin: 1rem auto 0;
  font: inherit; font-weight: 600; padding: .7rem 1.1rem; border: 0; border-radius: 999px;
  background: var(--degradat); color: var(--sobre-primari); box-shadow: 0 6px 20px rgb(255 106 0 / .3); cursor: pointer;
}
.resum-mobil[hidden] { display: none; }
@media (min-width: 1000px) { .resum-mobil { display: none !important; } }

/* Model 145 */
.model145 h3 { font-size: 1rem; margin: 1.25rem 0 .25rem; }
.model145 > .petit { margin-top: 0; }
.etiqueta-camp { display: block; font-size: .92rem; margin-bottom: .35rem; }
.opcio { display: flex; gap: .6rem; align-items: flex-start; padding: .55rem .7rem; margin: .35rem 0; border: 1px solid var(--vora); border-radius: 8px; cursor: pointer; font-size: .92rem; }
.opcio:has(input:checked) { border-color: var(--primari); background: var(--primari-suau); }
.opcio input { margin-top: .3rem; accent-color: var(--primari); }
.fila-llista { border: 1px solid var(--vora); border-radius: 10px; padding: .5rem .75rem; margin: .5rem 0; background: var(--fons); }
.fila-cap { display: flex; justify-content: space-between; align-items: center; font-size: .92rem; }
.graella { display: grid; gap: 0 .75rem; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.graella input { width: 100%; padding: .5rem .6rem; font: inherit; color: var(--text); border: 1px solid var(--vora); border-radius: 8px; background: var(--superficie); }
.graella select { background: var(--superficie); }
.graella .camp label { font-size: .82rem; }
.petit-boto { font-size: .85rem; padding: .35rem .7rem; }
.taula.compacta { margin: .75rem 0; font-size: .88rem; }

.contingut { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.avis-global { margin: 1rem 16px 0; }
@media (min-width: 900px) { .avis-global { margin: 1.25rem 2rem 0; } }

/* Selector d'idioma */
.barra-dreta { display: flex; align-items: center; gap: .6rem; }
.idioma { display: inline-flex; border: 1px solid var(--vora); border-radius: 999px; overflow: hidden; }
.idioma button {
  background: transparent; color: var(--text-suau); border: 0; padding: .35rem .7rem;
  font: inherit; font-size: .8rem; font-weight: 700; letter-spacing: .05em; cursor: pointer;
}
.idioma button[aria-pressed="true"] { background: var(--primari); color: var(--sobre-primari); }
.idioma button:focus-visible { outline: 2px solid var(--primari); outline-offset: -2px; }

/* Factura de llum: on van els diners */
.barra-parts { display: flex; height: 22px; border-radius: 999px; overflow: hidden; background: var(--superficie-2); margin: .5rem 0 .75rem; }
.barra-parts span { display: block; height: 100%; }
.part-regulat { background: #6aa9ff; }
.part-comercial { background: var(--primari); }
.part-impostos { background: #c9c3ba; }
.part-altres { background: #7c8090; }
.llegenda { list-style: none; padding: 0; margin: 0 0 .5rem; display: grid; gap: .35rem; }
.llegenda li { display: flex; align-items: center; gap: .5rem; font-size: .92rem; }
.llegenda strong { margin-left: auto; padding-left: .5rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.llegenda .punt { width: 12px; height: 12px; border-radius: 50%; flex: none; }

/* ---------- Nòmina explicada (exemple amb punts, aspecte de nòmina real) ---------- */
.np-marc { position: relative; margin: 1rem 0; }
.np-scroll { overflow-x: auto; border-radius: 4px; box-shadow: var(--ombra); }
.np-llisca { display: none; }
@media (max-width: 639px) { .np-llisca { display: block; } }
.nomina-paper {
  min-width: 600px; padding: 1.4rem 1.25rem; background: #fff; color: #1d1d1f;
  font-family: "Courier New", Courier, monospace; font-size: .82rem; line-height: 1.3;
  --linia: #3a3a3a;
}
.nomina-paper b { font-weight: 700; }
.np-cel { display: flex; flex-direction: column; gap: .15rem; padding: .3rem .45rem; border: 1px solid var(--linia); margin: -1px 0 0 -1px; }
.np-cel b { display: flex; align-items: center; gap: .35rem; }
.np-cel span { min-height: 1.1em; }
.np-cap { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.np-caixa { display: grid; grid-template-columns: 1fr 1fr; padding: 1px 0 0 1px; align-content: start; }
.np-caixa:last-child { grid-template-columns: 1.4fr 1fr .5fr 1fr; }
.np-caixa:last-child .np-cel:nth-child(1) { grid-column: 1 / -1; }
.np-caixa:last-child .np-cel:nth-child(2) { grid-column: 1 / 3; }
.np-caixa:last-child .np-cel:nth-child(3) { grid-column: 3 / -1; }
.np-caixa:last-child .np-cel:nth-child(4) { grid-column: 1 / 2; }
.np-caixa:last-child .np-cel:nth-child(5) { grid-column: 2 / 3; }
.np-caixa:last-child .np-cel:nth-child(6) { grid-column: 3 / -1; }
.np-caixa:first-child .np-ample { grid-column: 1 / -1; }
.np-periode, .np-totals { display: grid; grid-template-columns: 2fr 1fr 1fr; margin-top: .8rem; padding: 1px 0 0 1px; }
.np-totals { grid-template-columns: 1fr 1fr 1fr; }
.np-totals span, .np-periode span { font-size: .95rem; padding-left: 1.6rem; }
.np-liquid { background: #fff1e2; }
.np-taula { width: 100%; margin-top: .8rem; border-collapse: collapse; border: 1px solid var(--linia); }
.np-taula th { font-size: .68rem; font-weight: 700; padding: .35rem .3rem; border-bottom: 1px solid var(--linia); text-align: center; }
.np-taula td { padding: .18rem .45rem; border-left: 1px solid var(--linia); white-space: nowrap; }
.np-taula th + th { border-left: 1px solid var(--linia); }
.np-taula td.np-c-punt, .np-taula th.np-c-punt { border-left: 0; width: 2rem; padding: .18rem .2rem; text-align: center; }
.np-taula tr.np-buit td { height: 5rem; }
.np-num { text-align: right; font-variant-numeric: tabular-nums; }
.np-bases { margin-top: .8rem; border: 1px solid var(--linia); padding: .5rem .6rem; font-size: .7rem; }
.np-bases-titol { margin: 0 0 .4rem; }
.np-bases table { width: 100%; border-collapse: collapse; }
.np-bases th { font-weight: 400; padding: .15rem .3rem; }
.np-bases th:nth-child(2) { text-align: left; }
.np-bases th .np-punt { margin-right: .3rem; }
.np-bases td { padding: .15rem .3rem; vertical-align: top; }
.np-bases td.np-c-punt { width: 2rem; text-align: center; }
.np-bases td small { font-size: 1em; color: #444; }
.np-bases .np-sang { padding-left: 2.5rem; }
.np-firmes { display: grid; grid-template-columns: 1fr 1fr; margin-top: .8rem; padding: 1px 0 0 1px; }
.np-firmes .np-cel { min-height: 5rem; font-size: .9rem; }
.np-actiu { background: #ffe1c2 !important; outline: 2px solid var(--primari); outline-offset: -2px; }
.np-punt {
  display: inline-grid; place-items: center; width: 1.45rem; height: 1.45rem; flex: none; padding: 0;
  border: 0; border-radius: 50%; background: var(--primari); color: var(--sobre-primari);
  font: 700 .72rem/1 system-ui, sans-serif; cursor: pointer;
  box-shadow: 0 0 0 3px rgb(255 138 31 / .3);
}
.np-punt:hover, .np-punt[aria-expanded="true"] { background: var(--primari-fort); box-shadow: 0 0 0 4px rgb(255 106 0 / .4); }
.np-punt:focus-visible { outline: 2px solid #1d1d1f; outline-offset: 2px; }
.np-pop {
  position: absolute; left: .5rem; right: .5rem; z-index: 5; max-width: 30rem;
  padding: .8rem 1rem; background: var(--superficie); color: var(--text);
  border: 1px solid var(--primari); border-radius: var(--radi); box-shadow: 0 10px 30px rgb(0 0 0 / .35);
}
@media (min-width: 640px) { .np-pop { left: 2.4rem; } }
@media (max-width: 639px) {
  .np-pop { position: fixed; top: auto !important; bottom: 0; left: 0; right: 0; max-width: none; z-index: 50;
    border-radius: var(--radi) var(--radi) 0 0; max-height: 55vh; overflow-y: auto; padding-bottom: calc(.8rem + env(safe-area-inset-bottom)); }
}
.np-pop:focus { outline: none; }
.np-pop-cap { display: flex; align-items: center; gap: .5rem; }
.np-pop-cap h2 { flex: 1; margin: 0; font-size: 1rem; }
.np-pop-n { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--primari); color: var(--sobre-primari); font-weight: 700; font-size: .75rem; }
.np-tanca { border: 0; background: transparent; color: var(--text-suau); font-size: 1.4rem; line-height: 1; cursor: pointer; padding: 0 .25rem; }
.np-pop-text { margin: .5rem 0; }
.np-pop-detall { margin: .4rem 0; padding: .4rem .6rem; background: var(--primari-suau); border-radius: 8px; font-size: .88rem; }
.np-pop-nav { display: flex; justify-content: space-between; gap: .5rem; margin-top: .6rem; }
.np-pop-nav .boto:disabled { opacity: .4; cursor: default; }

/* ---------- Llegir la nòmina en PDF ---------- */
.llegir-pdf, .lectura-pdf { margin: 0 0 1.5rem; padding: 1rem 1.1rem; background: var(--superficie); border: 1px dashed var(--primari); border-radius: var(--radi); }
.lectura-pdf { border-style: solid; scroll-margin-top: 80px; }
.llegir-pdf h2, .lectura-pdf h2 { margin: 0 0 .3rem; font-size: 1.1rem; }
.llegir-pdf .boto { display: inline-block; cursor: pointer; }
.llegir-pdf:focus-within label.boto { outline: 2px solid var(--primari); outline-offset: 2px; }
.amagat { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip-path: inset(50%); }
.pdf-contrasenya { margin-top: .8rem; }
.pdf-contrasenya label { display: block; font-size: .92rem; margin-bottom: .35rem; }
.fila-clau { display: flex; gap: .5rem; }
.fila-clau input { flex: 1; min-width: 0; padding: .55rem .7rem; border-radius: 8px; border: 1px solid var(--vora); background: var(--fons); color: var(--text); font: inherit; }
.lectura-pdf .taula { max-width: 34rem; }
.text-pdf { max-height: 16rem; overflow: auto; padding: .6rem; background: var(--fons); border-radius: 8px; font-size: .75rem; white-space: pre; }

/* ---------- Factura de llum explicada ---------- */
.factura-paper { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: .8rem; }
.fp-cap { display: flex; justify-content: space-between; align-items: center; padding-bottom: .6rem; border-bottom: 3px solid #1d6f8c; margin-bottom: .8rem; }
.fp-logo { padding: .4rem .7rem; background: #1d6f8c; color: #fff; font-size: .7rem; letter-spacing: .06em; line-height: 1.2; border-radius: 4px; }
.fp-logo b { font-size: 1rem; }
.fp-titol { text-align: right; display: flex; flex-direction: column; }
.fp-titol b { font-size: 1rem; color: #1d6f8c; }
.fp-graella { display: grid; grid-template-columns: 1.4fr 1fr; gap: .7rem; }
.fp-caixa { border: 1px solid #c8d6dc; border-radius: 6px; padding: .55rem .7rem; margin-bottom: .7rem; }
.fp-caixa h3 { display: flex; align-items: center; gap: .4rem; margin: 0 0 .4rem; font-size: .82rem; color: #1d6f8c; text-transform: uppercase; letter-spacing: .03em; }
.fp-caixa p { margin: .2rem 0; display: flex; align-items: center; gap: .4rem; }
.fp-total { background: #eaf4f7; text-align: center; }
.fp-total h3 { justify-content: center; }
.fp-total strong { display: block; font-size: 1.8rem; color: #1d1d1f; margin: .3rem 0; }
.fp-total p { justify-content: center; color: #555; }
.fp-resum, .fp-detall, .fp-lectures { width: 100%; border-collapse: collapse; }
.fp-resum td, .fp-detall td, .fp-lectures td, .fp-lectures th { padding: .22rem .3rem; border-bottom: 1px solid #e3eaed; vertical-align: middle; }
.fp-lectures th { font-weight: 600; text-align: left; font-size: .72rem; color: #555; }
.fp-detall small { display: block; color: #555; font-size: .72rem; }
.fp-detall td.np-c-punt, .fp-lectures .np-c-punt { width: 2rem; text-align: center; }
.fp-tot td { font-weight: 700; border-bottom: 0; }
.fp-historial { display: flex; gap: .4rem; align-items: flex-start; margin-top: .3rem; }
.fp-historial > div { flex: 1; }
.fp-historial svg { width: 100%; max-width: 340px; display: block; }
.fp-llegenda { list-style: none; padding: 0; margin: .4rem 0 0; font-size: .74rem; }
.fp-llegenda li { display: flex; align-items: center; gap: .35rem; }
.fp-llegenda .punt { width: .7rem; height: .7rem; border-radius: 2px; display: inline-block; }
.fp-etiqueta { display: flex; flex-direction: column; gap: 2px; }
.fp-etiqueta span { color: #fff; font-weight: 700; font-size: .7rem; padding: 1px 6px; clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%); }
.fp-l0 { background: #2e8b3e; } .fp-l1 { background: #58a33a; } .fp-l2 { background: #a7c33a; } .fp-l3 { background: #e6c62b; }
.fp-l4 { background: #e89a2b; } .fp-l5 { background: #e0612a; } .fp-l6 { background: #c8322a; }
.fp-sel { outline: 2px solid #1d1d1f; }
.fp-peu { border-top: 1px solid #c8d6dc; padding-top: .5rem; font-size: .74rem; color: #333; }
.fp-peu p { display: flex; align-items: center; gap: .4rem; margin: .25rem 0; }

/* ---------- Historial ---------- */
.peu-resultat { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--vora); }
.desa-historial { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.desa-historial label { font-size: .9rem; }
.desa-historial input { padding: .45rem .6rem; border-radius: 8px; border: 1px solid var(--vora); background: var(--fons); color: var(--text); font: inherit; color-scheme: dark; }
.seccio-historial { margin: 1.5rem 0 2rem; }
.seccio-historial h2 { margin-bottom: .6rem; }
.accions-historial { display: flex; flex-wrap: wrap; gap: .5rem; }
.accions-historial label.boto { cursor: pointer; }
.grafic { margin: 1rem 0; padding: .9rem 1rem .5rem; background: var(--superficie); border: 1px solid var(--vora); border-radius: var(--radi); }
.grafic figcaption { font-weight: 600; margin-bottom: .4rem; }
.grafic svg { width: 100%; height: auto; display: block; overflow: visible; }
.g-grid { stroke: var(--vora); stroke-width: 1; }
.g-eix { fill: var(--text-suau); font-size: 11px; font-family: inherit; }
.g-zona { fill: transparent; }
.g-marca { fill: color-mix(in srgb, var(--primari) 55%, var(--superficie)); }
.g-marca.g-ultima { fill: var(--primari); }
.g-barra:hover .g-marca, .g-barra:focus .g-marca { fill: var(--primari-fort); }
.g-barra:hover .g-zona, .g-barra:focus .g-zona { fill: rgb(255 255 255 / .04); }
.g-barra:focus { outline: none; }
.grafic .petit { margin: .3rem 0 0; }

/* ---------- Informe (PDF / imprimir) ---------- */
.accions-informe { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.accions-informe .petit { flex-basis: 100%; margin: 0; }
.informe { background: #fff; color: #1d1d1f; padding: 1.5rem 1.6rem; border-radius: 6px; max-width: 46rem; box-shadow: var(--ombra); }
.informe h2 { font-size: 1rem; margin: 1.2rem 0 .4rem; color: #1d1d1f; border-bottom: 2px solid var(--primari); padding-bottom: .2rem; }
.informe-cap { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.informe-cap div { display: flex; flex-direction: column; }
.informe-cap strong { font-size: 1.3rem; }
.informe-cap span { color: #555; font-size: .85rem; }
.informe .taula { background: #fff; border-color: #ddd; color: #1d1d1f; }
.informe .taula td { border-color: #e5e5e5; }
.informe .taula .detall { color: #666; }
.informe .taula tr.gran td { color: #c25400; }
.informe .taula tr.alerta td { color: #b3261e; }
.informe-avisos { padding-left: 1.1rem; margin: 0; font-size: .9rem; }
.informe-avisos li { margin: .3rem 0; }
.informe-avisos li.alerta::marker { content: "⚠ "; }
.informe-fonts { padding-left: 1.1rem; font-size: .8rem; color: #444; }
.informe-peu { margin-top: 1.2rem; padding-top: .6rem; border-top: 1px solid #ddd; font-size: .78rem; color: #555; }
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff !important; color: #000; }
  .barra, .menu, .peu, .no-imprimir, .avis-global, .resum-mobil, .lectura-pdf, .llegir-pdf { display: none !important; }
  .informe { box-shadow: none; padding: 0; max-width: none; }
  .informe .taula { font-size: .82rem; }
  main, #vista { padding: 0 !important; margin: 0 !important; }
}
.botons-pdf { display: flex; flex-wrap: wrap; gap: .5rem; margin: .4rem 0; }
.botons-pdf label { cursor: pointer; }
.llegir-pdf:focus-within .botons-pdf label.boto { outline: none; }
.llegir-pdf input:focus-visible + label, .botons-pdf input:focus-visible ~ label { outline: 2px solid var(--primari); outline-offset: 2px; }

/* ---------- Bo social ---------- */
.sense-dret { background: none !important; -webkit-background-clip: initial !important; background-clip: initial !important; color: var(--text) !important; font-size: 1.6rem !important; }
.gran-estalvi { font-size: 1.2rem; margin: .2rem 0 .6rem; }
.gran-estalvi strong { color: var(--primari); font-size: 1.6rem; }
.passos { padding-left: 1.2rem; }
.passos li { margin: .4rem 0; }
.sagnat { margin: -.2rem 0 .5rem 1.7rem; }
