/* app.css — Enquesta AUV · Vic
   Layout: una columna centrada per a l'enquesta (mòbil primer); tauler ample amb pestanyes per als resultats.
   Identitat: blanc net, Figtree (la mateixa lletra que la presentació), insígnies rodones de color per
   projecte (com les icones de l'AUV) i dues tintes per als eixos. Les barres de dades porten una sola tinta. */

:root {
  --bg: #ffffff;
  --bg2: #f5f4f0;
  --surface: #ffffff;
  --fg: #1c1b18;
  --fg2: #585650;
  --muted: #8b8980;
  --line: #e5e3dc;
  --line2: #cfcdc4;
  --accent: #c84e12;
  --accent-ink: #ffffff;
  --accent-soft: #fdeee4;
  --territori: #2a78d6;
  --persones: #eb6834;
  --aport: #6250d6;
  --aport-soft: #d6d1f3;
  --ok: #0a7d0a;
  --bad: #c62828;
  --warn-bg: #fff4e5;
  --shadow: 0 1px 2px rgba(28, 27, 24, .05), 0 10px 30px rgba(28, 27, 24, .07);
  --radius: 14px;
  --font: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15181d; --bg2: #1b1f25; --surface: #1f242b; --fg: #eeece7; --fg2: #b9b6ad; --muted: #8b8980;
    --line: #2b3038; --line2: #3b414b; --accent: #f28a4b; --accent-ink: #1c1b18; --accent-soft: #3a2619;
    --territori: #3987e5; --persones: #d95926; --aport: #9085e9; --aport-soft: #3b3570; --ok: #4fc34f; --bad: #ef6b6b;
    --warn-bg: #3a2f1a; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15181d; --bg2: #1b1f25; --surface: #1f242b; --fg: #eeece7; --fg2: #b9b6ad; --muted: #8b8980;
  --line: #2b3038; --line2: #3b414b; --accent: #f28a4b; --accent-ink: #1c1b18; --accent-soft: #3a2619;
  --territori: #3987e5; --persones: #d95926; --aport: #9085e9; --aport-soft: #3b3570; --ok: #4fc34f; --bad: #ef6b6b;
  --warn-bg: #3a2f1a; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg2); color: var(--fg); font-family: var(--font); font-size: 16px; line-height: 1.45;
  min-height: 100dvh;
}
body.enquesta { background: var(--bg); }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; text-wrap: balance; font-weight: 700; }
p { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 1.1em; height: 1.1em; vertical-align: -0.2em; flex: none; }
.muted { color: var(--fg2); }
.small { font-size: .875rem; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; border-radius: 6px; }

/* ---------- capçalera comuna */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line);
  padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.topbar-in { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar .logo { height: 36px; width: auto; background: #fff; border-radius: 8px; padding: 3px 4px; }
.topbar .t { min-width: 0; flex: 1; }
.topbar .t strong { display: block; font-size: 1rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .t span { display: block; font-size: .8rem; color: var(--fg2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--fg2); white-space: nowrap; }
.status i { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); display: inline-block; }
.status.online i { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.status.offline i, .status.unauthorized i { background: var(--bad); }
.status.connecting i { background: var(--accent); animation: pulse 1.2s infinite; }

/* L'enquesta és una columna d'amplada de mòbil a qualsevol pantalla. */
.wrap { max-width: 520px; margin: 0 auto; padding-block: 22px 120px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.wrap.wide { max-width: 1240px; padding-bottom: 60px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line2); background: var(--surface); display: inline-grid; place-items: center; flex: none; padding: 0; }
.icon-btn:hover { background: var(--bg2); }
.icon-btn .ic { width: 20px; height: 20px; }

/* ---------- botons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line2); background: var(--surface);
  color: var(--fg); border-radius: 999px; padding: 10px 18px; font-weight: 600; font-size: .95rem; line-height: 1.2; transition: background .15s, transform .08s, border-color .15s;
}
.btn:hover { background: var(--bg2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--bg2); }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 10%, transparent); }
.btn-sm { padding: 7px 12px; font-size: .85rem; }
.btn-lg { padding: 14px 24px; font-size: 1.05rem; }
.btn-block { width: 100%; }

/* ---------- enquesta: passos */
.stepper { display: flex; gap: 6px; margin-bottom: 22px; }
.stepper div { flex: 1; display: flex; align-items: center; gap: 8px; font-size: .78rem; color: var(--muted); font-weight: 600; min-width: 0; }
.stepper div::before { content: attr(data-n); width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line2); display: inline-grid; place-items: center; font-size: .75rem; flex: none; }
.stepper div span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stepper div.on { color: var(--fg); }
.stepper div.on::before { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.stepper div.done { color: var(--fg2); }
.stepper div.done::before { background: var(--fg2); border-color: var(--fg2); color: var(--bg); }
@media (max-width: 420px) { .stepper div:not(.on) span { display: none; } }

.q { margin-bottom: 18px; }
.q h1 { font-size: clamp(1.45rem, 4.5vw, 1.9rem); margin-bottom: 6px; }
.q p { color: var(--fg2); max-width: 60ch; }
.eyebrow { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }

.field { margin-bottom: 22px; }
.field label { display: block; font-weight: 700; margin-bottom: 8px; }
.input {
  width: 100%; border: 1.5px solid var(--line2); border-radius: 12px; padding: 13px 14px; background: var(--surface); font-size: 1.05rem;
}
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }

.eix-h { display: flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 700; margin: 16px 0 10px; color: var(--fg2); }
.eix-h i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--line2); background: var(--surface); border-radius: 999px; padding: 11px 16px; font-weight: 600; font-size: .95rem; min-height: 44px;
  display: inline-flex; align-items: center; gap: 7px; transition: background .12s, border-color .12s, color .12s;
}
.chip:hover { border-color: var(--c, var(--fg2)); }
.chip[aria-pressed="true"] { background: var(--c, var(--fg)); border-color: var(--c, var(--fg)); color: #fff; }
.chip .ic { width: 1em; height: 1em; }

/* ---------- enquesta: projectes */
.pgrid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.pcard { border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 14px; transition: border-color .15s, box-shadow .15s; }
.pcard[data-sel="directa"] { border-color: var(--aport); box-shadow: 0 0 0 3px color-mix(in srgb, var(--aport) 18%, transparent); }
.pcard[data-sel="indirecta"] { border-color: color-mix(in srgb, var(--aport) 55%, var(--line)); }
.pcard-head { display: flex; align-items: flex-start; gap: 12px; }
.pcard-t { flex: 1; min-width: 0; }
.pcard-t h3 { font-size: 1.05rem; }
.pcard-t p { font-size: .85rem; color: var(--fg2); margin-top: 3px; }
.pcard .pnum { font-size: .72rem; font-weight: 700; color: var(--muted); letter-spacing: .06em; }
.info-btn { border: 1px solid var(--line2); background: transparent; color: var(--fg2); padding: 5px 10px 5px 7px; border-radius: 999px; flex: none; font-size: .78rem; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; }
.info-btn:hover { color: var(--fg); background: var(--bg2); }
.info-btn[aria-expanded="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.pcard-info { font-size: .88rem; color: var(--fg2); margin-top: 10px; padding: 12px 14px; background: var(--bg2); border-radius: 10px; line-height: 1.45; }
.pcard-info p { margin: 0; color: var(--fg); }
.pcard-info .pi-h { margin-top: 10px; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pcard-info ul { margin: 4px 0 0; padding-left: 18px; }
.pcard-info li { margin: 2px 0; }
.badge {
  width: 44px; height: 44px; border-radius: 50%; background: var(--c, var(--muted)); color: #fff; display: inline-grid; place-items: center; flex: none;
}
.badge .ic { width: 24px; height: 24px; }
.badge.sm { width: 30px; height: 30px; }
.badge.sm .ic { width: 17px; height: 17px; }
.badge.xs { width: 24px; height: 24px; }
.badge.xs .ic { width: 14px; height: 14px; }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 12px; }
.seg button {
  border: 1.5px solid var(--line2); background: var(--surface); border-radius: 10px; padding: 10px 8px; font-weight: 700; font-size: .9rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .12s, border-color .12s, color .12s;
}
.seg button:hover { border-color: var(--aport); }
.seg button[aria-pressed="true"] { background: var(--aport); border-color: var(--aport); color: #fff; }
.seg button[data-rel="indirecta"][aria-pressed="true"] { background: var(--aport-soft); border-color: var(--aport); color: var(--fg); }
.seg .ic { width: 1em; height: 1em; }

/* ---------- enquesta: actuacions */
.psec { border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 14px; overflow: hidden; }
.psec-h { display: flex; align-items: center; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--c) 7%, var(--surface)); }
.psec-h h2 { font-size: 1.05rem; flex: 1; min-width: 0; }
.psec-h .rel { font-size: .72rem; font-weight: 700; padding: 4px 9px; border-radius: 999px; background: var(--aport); color: #fff; text-transform: uppercase; letter-spacing: .05em; }
.psec-h .rel.indirecta { background: var(--aport-soft); color: var(--fg); }
.psec-h .cnt { font-size: .8rem; color: var(--fg2); white-space: nowrap; }
.arow { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 10px; padding: 11px 14px; border-top: 1px solid var(--line); }
.arow:first-of-type { border-top: 0; }
.arow:has(input:checked) { background: color-mix(in srgb, var(--aport) 8%, var(--surface)); }
.arow input[type="checkbox"] { width: 22px; height: 22px; margin: 0; accent-color: var(--aport); flex: none; }
.arow .anum { font-size: .72rem; font-weight: 700; color: var(--muted); min-width: 2.2em; font-variant-numeric: tabular-nums; }
.arow label { font-weight: 600; font-size: .95rem; cursor: pointer; }
.arow .more { border: 0; background: transparent; color: var(--muted); padding: 6px; border-radius: 50%; }
.arow .more:hover { color: var(--fg); background: var(--bg2); }
.arow .more[aria-expanded="true"] .ic { transform: rotate(180deg); }
.afull { grid-column: 1 / -1; font-size: .88rem; color: var(--fg2); padding: 2px 0 6px 0; display: grid; gap: 8px; }
.afull p { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--bg2); line-height: 1.4; }
.afull p span { display: block; font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.afull .af-nota { background: color-mix(in srgb, var(--aport) 9%, var(--surface)); color: var(--fg); }
.afull .af-ind { padding: 8px 10px; border-radius: 8px; border: 1.5px dashed var(--line2); }
.afull .af-ind span { display: block; font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.afull .af-ind ul { margin: 0; padding-left: 18px; }
.afull .af-ind li { margin: 2px 0; }
.ind-toggle { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: var(--bg2); color: var(--fg2); padding: 9px 14px; font-size: .82rem; font-weight: 700; display: flex; align-items: center; gap: 6px; text-align: left; }
.ind-toggle .ic:last-child { margin-left: auto; transition: transform .15s; }
.ind-toggle[aria-expanded="true"] .ic:last-child { transform: rotate(180deg); }
.ind-list { margin: 0; padding: 8px 14px 10px 32px; border-bottom: 1px solid var(--line); font-size: .85rem; color: var(--fg2); background: var(--bg2); }
.ind-list li { margin: 3px 0; }

.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding-block: 12px calc(12px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.actionbar-in { max-width: 520px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.actionbar .count { flex: 1; font-weight: 600; font-size: .95rem; }
.actionbar .count b { color: var(--accent); font-size: 1.15rem; }

/* ---------- enquesta: pantalles de gràcies */
.hero { text-align: left; padding: 10px 0 20px; }
.hero .big { font-size: clamp(1.7rem, 6vw, 2.4rem); margin-bottom: 8px; }
.hero .pulse { display: inline-flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; background: var(--bg2); margin-top: 16px; font-weight: 600; }
.hero .pulse i { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse 1.3s infinite; }
.summary { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.summary .s { display: inline-flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 12px 6px 6px; font-size: .88rem; font-weight: 600; background: var(--surface); }
.summary .s small { color: var(--fg2); font-weight: 500; }
.cta-card { margin-top: 22px; padding: 18px; border-radius: var(--radius); background: var(--accent-soft); border: 1.5px solid color-mix(in srgb, var(--accent) 35%, transparent); animation: rise .5s ease-out; }
.cta-card h2 { font-size: 1.15rem; margin-bottom: 6px; }
.cta-card p { color: var(--fg2); margin-bottom: 14px; }
.links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.note { font-size: .85rem; color: var(--fg2); margin-top: 16px; }
.alert { padding: 12px 14px; border-radius: 10px; background: var(--warn-bg); font-size: .9rem; margin-bottom: 16px; }

.other-toggle { margin: 12px 0 4px; }
.other-toggle .ic { transition: transform .15s; }
.other-toggle[aria-expanded="true"] .ic { transform: rotate(180deg); }
.other-group { margin-top: 4px; }
.recover { margin: -6px 0 18px; }
.recover-box { margin-top: 8px; padding: 12px 14px; border-radius: 12px; background: var(--bg2); display: grid; gap: 8px; }
.recover-row { display: flex; gap: 8px; }
.recover-row .input { flex: 1; }
.codi-input { text-transform: uppercase; letter-spacing: .18em; font-weight: 700; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.recover .err { color: var(--bad); font-size: .85rem; font-weight: 600; min-height: 1.1em; }
.codi-box { margin-top: 18px; padding: 14px 16px; border-radius: var(--radius); border: 1.5px dashed var(--line2); display: grid; gap: 8px; }
.codi-box .codi-l { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.codi-box .codi { font-size: 2.2rem; font-weight: 800; letter-spacing: .22em; font-family: ui-monospace, "SF Mono", Menlo, monospace; line-height: 1.1; }
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 50; background: var(--fg); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; font-size: .9rem; font-weight: 600; box-shadow: var(--shadow); max-width: calc(100vw - 32px); opacity: 0; transition: opacity .2s;
}
.toast.show { opacity: 1; }
.toast.err { background: var(--bad); color: #fff; }

.foot { margin-top: 40px; display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: .78rem; flex-wrap: wrap; }
.foot img { height: 22px; width: auto; opacity: .75; }

/* ---------- resultats */
.login-wrap { min-height: calc(100dvh - 60px); display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 1.3rem; margin-bottom: 4px; }
.login-card p { color: var(--fg2); font-size: .9rem; margin-bottom: 18px; }
.login-card .err { color: var(--bad); font-size: .88rem; font-weight: 600; margin-top: 10px; min-height: 1.2em; }

.dash-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.dash-top .grow { flex: 1; }
.hdr-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.live { display: inline-flex; align-items: baseline; gap: 6px; font-weight: 700; font-size: 1rem; white-space: nowrap; }
.live b { font-size: 1.5rem; color: var(--accent); font-variant-numeric: tabular-nums; }
.fase-seg { display: inline-flex; border: 1.5px solid var(--line2); border-radius: 999px; overflow: hidden; background: var(--surface); }
.fase-seg button { border: 0; background: transparent; padding: 8px 14px; font-weight: 700; font-size: .85rem; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.fase-seg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.fase-seg button .ic { width: 1em; height: 1em; }
.tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.menu { position: relative; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; min-width: 260px; z-index: 30; display: grid; gap: 2px; }
.menu-list button { border: 0; background: transparent; text-align: left; padding: 9px 12px; border-radius: 8px; font-weight: 600; font-size: .9rem; display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.menu-list button:hover { background: var(--bg2); }
.menu-list button.danger { color: var(--bad); }
.menu-list hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.confirm-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--warn-bg); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; font-weight: 600; }
.confirm-bar span { flex: 1; display: inline-flex; align-items: center; gap: 8px; }
@media (max-width: 760px) { .topbar-in { flex-wrap: wrap; } .hdr-controls { width: 100%; justify-content: flex-start; } }

/* Qui som: donut + targetes */
.sala { display: grid; grid-template-columns: minmax(0, 2.3fr) minmax(16em, 1fr); gap: 1em; align-items: start; }
@media (max-width: 1000px) { .sala { grid-template-columns: 1fr; } }
.sala-chart { padding-bottom: .4em; }
.sala-chart .legend { margin-bottom: .2em; }
.donut { width: 100%; height: auto; display: block; }
.donut .seg { stroke: var(--surface); stroke-width: 2; cursor: default; transition: opacity .15s; }
.donut .seg:hover { opacity: .8; }
.donut .leader { fill: none; stroke: var(--line2); stroke-width: 1.5; }
.donut .d-label { font-family: var(--font); font-size: 17px; font-weight: 600; fill: var(--fg); }
.donut .d-label .d-n { fill: var(--muted); font-weight: 700; }
.donut .d-big { font-family: var(--font); font-size: 72px; font-weight: 800; fill: var(--fg); }
.donut .d-sub { font-family: var(--font); font-size: 19px; fill: var(--fg2); }
/* Àrees × Projectes: Sankey */
.sankey { width: 100%; height: auto; display: block; }
.sankey .lnk { stroke: none; transition: opacity .15s; }
.sankey .lnk.directa { opacity: .62; }
.sankey .lnk.indirecta { opacity: .26; }
.sankey .lnk:hover { opacity: .9; }
.sankey.focus .lnk { opacity: .05; }
.sankey.focus .lnk.hi.directa { opacity: .85; }
.sankey.focus .lnk.hi.indirecta { opacity: .45; }
.sankey .nd { stroke: var(--surface); stroke-width: 1; cursor: default; }
.sankey .s-label { font-family: var(--font); font-size: 15px; font-weight: 600; fill: var(--fg); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.sankey .s-label .s-n { fill: var(--muted); font-weight: 700; }
.sankey .s-eix { font-size: 17px; font-weight: 700; }
.sankey .s-head { font-family: var(--font); font-size: 12px; font-weight: 700; letter-spacing: .08em; fill: var(--muted); }
.sankey .s-small { font-size: 15px; }
/* Actuacions: contingut a l'esquerra, targetes i llista de projectes a la dreta */
.act-layout { display: grid; grid-template-columns: minmax(0, 2.6fr) minmax(17em, 1fr); gap: 1em; align-items: start; }
@media (max-width: 1000px) { .act-layout { grid-template-columns: 1fr; } }
.act-main { min-width: 0; }
.proj-list { display: grid; gap: 4px; margin-top: .6em; }
.proj-list a { text-decoration: none; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 4px 10px 4px 5px; font-size: .85rem; font-weight: 600; background: var(--surface); }
.proj-list a:hover { border-color: var(--line2); background: var(--bg2); }
.proj-list a .n { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .78rem; }
.proj-list a[aria-current="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.proj-list a[aria-current="true"] .n { color: var(--bg); opacity: .7; }
.proj-list a.tots { margin-top: 4px; border-style: dashed; }
@media (max-width: 1400px) { .psec.res.stage .body { grid-template-columns: 1fr; } }
.tiles.col1 { grid-template-columns: 1fr; gap: .6em; }
.tiles.col1 .tile { display: flex; align-items: baseline; gap: .6em; padding: .55em .9em; }
.tiles.col1 .tile .v { font-size: 1.9rem; min-width: 2.2em; }
.tiles.col1 .tile .l { margin-top: 0; }
.who { margin-top: .6em; }
.who .eix-h { margin: .4em 0 .3em; }
.who .names span { font-size: .78rem; padding: 4px 10px; }
.who .names span b { color: var(--fg); font-weight: 700; }
.who .names .chip-del { position: relative; padding-right: 10px; }
.who .names .chip-del .del { position: absolute; right: -6px; top: -6px; width: 18px; height: 18px; border-radius: 50%; border: 0; background: var(--bad); color: #fff; display: none; place-items: center; padding: 0; cursor: pointer; }
.who .names .chip-del .del .ic { width: 11px; height: 11px; }
.who .names .chip-del:hover .del, .who .names .chip-del:focus-within .del { display: grid; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: transparent; padding: 10px 14px; font-weight: 700; font-size: .95rem; color: var(--fg2); border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 8px; align-items: center; }
.tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); }
.tabs button kbd { font-family: inherit; font-size: .7rem; color: var(--muted); border: 1px solid var(--line2); border-radius: 4px; padding: 0 5px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 20px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.tile .v { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.tile .v small { font-size: 1rem; color: var(--muted); font-weight: 600; }
.tile .l { font-size: .8rem; color: var(--fg2); margin-top: 2px; }
.tile.territori .v { color: var(--territori); }
.tile.persones .v { color: var(--persones); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.panel-h { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-h h2 { font-size: 1.15rem; flex: 1; min-width: 0; }
.panel-h .sub { font-size: .85rem; color: var(--fg2); flex: 1 1 100%; margin-top: -4px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--fg2); align-items: center; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; vertical-align: -2px; margin-right: 5px; background: var(--c); }
.two { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 900px) { .two { grid-template-columns: 1fr 1fr; } }

.brow { display: grid; grid-template-columns: minmax(8em, 13em) 1fr auto; align-items: center; gap: .75em; padding: .3em 0; }
.brow.wide-label { grid-template-columns: minmax(11em, 20em) 1fr auto; }
.brow.sala { grid-template-columns: minmax(7em, 10em) minmax(6em, 1.3fr) 2.2em minmax(0, 2fr); }
.brow.sala .names { margin: 0; }
@media (max-width: 700px) { .brow, .brow.wide-label, .brow.sala { grid-template-columns: 1fr; gap: 4px; padding: 8px 0; } .brow .bval { justify-self: end; } }
.blabel { display: flex; align-items: center; gap: 9px; min-width: 0; font-size: .9rem; font-weight: 600; }
.blabel .bname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blabel .anum { color: var(--muted); font-size: .75rem; min-width: 2.2em; font-variant-numeric: tabular-nums; }
.btrack { height: 18px; background: var(--bg2); border-radius: 4px; display: flex; gap: 2px; overflow: hidden; }
.bfill { height: 100%; width: 0; background: var(--aport); border-radius: 4px; transition: width .7s cubic-bezier(.2, .8, .2, 1); min-width: 0; }
.bfill.indirecta { background: var(--aport-soft); }
.bfill.territori { background: var(--territori); }
.bfill.persones { background: var(--persones); }
.bval { font-weight: 700; font-variant-numeric: tabular-nums; font-size: .95rem; min-width: 2.5em; text-align: right; }
.bval small { color: var(--muted); font-weight: 600; font-size: .78rem; margin-left: 3px; }
.names { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 6px; }
.names span { font-size: .72rem; background: var(--bg2); border-radius: 999px; padding: 2px 8px; color: var(--fg2); animation: pop .35s ease-out; }
.empty { color: var(--muted); font-size: .9rem; padding: 18px; text-align: center; border: 1.5px dashed var(--line2); border-radius: 12px; }

.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.heat { display: grid; grid-template-columns: 10.5em repeat(14, minmax(2.6em, 1fr)) 3em; gap: 2px; min-width: 860px; max-width: 1500px; margin: 0 auto; align-items: center; }
.heat .hh { display: grid; place-items: center; padding: 2px 0; }
.heat .hrow { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 8px; display: flex; align-items: center; gap: 6px; }
.heat .hrow i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); flex: none; }
.heat .hrow.dim { color: var(--muted); font-weight: 500; }
.heat .hcell { height: clamp(18px, 2.3vh, 36px); border-radius: 5px; background: var(--bg2); display: grid; place-items: center; font-size: .8rem; font-weight: 700; color: #fff; transition: background .4s; }
.heat .hcell.d { background: var(--aport); }
.heat .hcell.i { background: var(--aport-soft); color: var(--fg); }
.heat .hcell.m { background: var(--aport); outline: 2px solid var(--aport-soft); outline-offset: -3px; }
.heat .htot { font-size: .8rem; font-weight: 700; color: var(--fg2); text-align: center; font-variant-numeric: tabular-nums; }
.heat .hsep { grid-column: 1 / -1; height: 4px; }

.proj-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: .8em; }
.proj-nav a { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px 4px 4px; font-size: .8rem; font-weight: 600; background: var(--surface); }
.proj-nav a:hover { border-color: var(--line2); background: var(--bg2); }
.proj-nav a[aria-current="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.proj-nav a[aria-current="true"] .n { color: var(--bg); opacity: .7; }
.proj-nav a .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.proj-nav a.tots { border-style: dashed; }
.proj-nav a.tots[aria-current="true"] { border-style: solid; }
.pager { display: inline-flex; align-items: center; gap: 8px; }
.pager .pos { font-variant-numeric: tabular-nums; color: var(--fg2); font-weight: 600; font-size: .9rem; }
.psec.res { background: var(--surface); }
.psec.res .psec-h h2 { font-size: 1.1rem; }
.psec.res .body { padding: 10px 14px 14px; }
.psec.res .orphan { font-size: .78rem; color: var(--fg2); background: var(--bg2); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
/* Mode diapositiva: un projecte per pantalla, gràfic a l'esquerra i taula a la dreta. */
.psec.res.stage .psec-h h2 { font-size: 1.35rem; }
/* Llista d'actuacions que fa de gràfic i de taula de freqüències alhora */
/* Columnes en rem (no em): la capçalera té una mida de lletra diferent i ha de quadrar amb les files. */
.frow { display: grid; grid-template-columns: minmax(14rem, 30rem) minmax(6rem, 1fr) 3rem minmax(8rem, 18rem); gap: .7rem; align-items: center; padding: .32em 0; border-top: 1px solid var(--line); font-size: .92rem; }
.frow .bname .anum { font-size: inherit; color: var(--muted); }
.frow.head { border-top: 0; font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding-bottom: .1em; }
.frow .anum { color: var(--muted); font-size: .78rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.frow .bname { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.frow .bval { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.frow .bpct, .frow .r { text-align: right; color: var(--fg2); font-variant-numeric: tabular-nums; font-size: .85rem; }
.frow .bareas { color: var(--fg2); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media (max-width: 760px) { .frow { grid-template-columns: 1fr 3rem; } .frow .btrack, .frow .bareas { grid-column: 1 / -1; } .frow.head span:nth-child(2), .frow.head span:nth-child(4) { display: none; } }
.tabs-right { margin-left: auto; display: flex; align-items: center; gap: 12px; flex: none; }
.tabs-right .tabs-hint { margin-left: 0; }
@media (max-width: 1000px) { .psec.res.stage .body { grid-template-columns: 1fr; } }
.tabs-hint { margin-left: auto; align-self: center; font-size: .78rem; color: var(--muted); white-space: nowrap; padding-right: 4px; }
@media (max-width: 1100px) { .tabs-hint { display: none; } }
body.resultats .wrap.wide { max-width: none; padding-block: 1vh 3vh; }
body.resultats .tiles { margin-bottom: 1.2vh; }
body.resultats .tile { padding: .6em .9em; }
body.resultats .tile .v { font-size: 2.1rem; }
body.resultats .panel { padding: 1em 1.1em; margin-bottom: .9em; }
body.resultats .dash-top { margin-bottom: .7em; }
body.resultats .tabs { margin-bottom: .9em; }
details.freq { margin-top: 10px; }
details.freq summary { cursor: pointer; font-weight: 700; font-size: .88rem; color: var(--fg2); padding: 6px 0; list-style: none; display: flex; align-items: center; gap: 6px; }
details.freq summary::-webkit-details-marker { display: none; }
details.freq[open] summary .ic { transform: rotate(180deg); }
table.ft { width: 100%; border-collapse: collapse; font-size: .85rem; margin-top: 6px; }
table.ft th, table.ft td { text-align: left; padding: 7px 8px; border-top: 1px solid var(--line); vertical-align: top; }
table.ft th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-top: 0; }
table.ft td.n, table.ft th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.ft td.c { color: var(--fg2); }

.qr-panel { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: grid; place-items: center; padding: 24px; text-align: center; }
.qr-panel .in { max-width: 720px; width: 100%; }
.qr-panel svg { width: min(62vh, 92vw, 520px); height: auto; margin: 0 auto 18px; display: block; border-radius: 12px; background: #fff; padding: 12px; }
.qr-panel .url { font-size: clamp(1.1rem, 3.5vw, 1.9rem); font-weight: 700; word-break: break-all; }
.qr-panel .live { justify-content: center; margin-top: 14px; display: flex; }
.qr-panel .close { position: absolute; top: 16px; right: 16px; }

.sort-tog { display: inline-flex; gap: 4px; }
.sort-tog button { border: 1px solid var(--line2); background: var(--surface); border-radius: 999px; padding: 4px 10px; font-size: .78rem; font-weight: 600; }
.sort-tog button[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }

.tooltip { position: fixed; z-index: 60; background: var(--fg); color: var(--bg); padding: 8px 10px; border-radius: 8px; font-size: .8rem; max-width: 280px; pointer-events: none; box-shadow: var(--shadow); line-height: 1.35; }
.tooltip b { display: block; margin-bottom: 2px; }

.confirm { display: inline-flex; align-items: center; gap: 8px; background: var(--warn-bg); padding: 6px 8px 6px 12px; border-radius: 999px; font-size: .85rem; font-weight: 600; }

@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.8); } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
