/* PAU Interactiva */
:root {
  --fons: #f6f7fb; --paper: #fff; --tinta: #1c2333; --silenciat: #67708a;
  --primari: #4338ca; --primari-clar: #eef2ff; --vora: #e3e6f0;
  --be: #16a34a; --mig: #d97706; --mal: #dc2626;
  --ombra: 0 1px 3px rgba(28,35,51,.08), 0 4px 16px rgba(28,35,51,.06);
  --radi: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--fons); color: var(--tinta);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2, h3 { line-height: 1.25; }
a { color: var(--primari); }

header {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .9rem 1.2rem; background: var(--paper); border-bottom: 1px solid var(--vora);
}
.marca { display: flex; gap: .7rem; align-items: center; }
.logo { font-size: 2rem; }
header h1 { margin: 0; font-size: 1.25rem; }
.sub { margin: 0; color: var(--silenciat); font-size: .8rem; }
.perfil-caixa { display: flex; gap: .4rem; }
.perfil-caixa select, .perfil-caixa button {
  padding: .45rem .6rem; border: 1px solid var(--vora); border-radius: 8px;
  background: var(--paper); font-size: .9rem; cursor: pointer;
}

nav#pestanyes {
  display: flex; gap: .3rem; padding: .5rem 1rem; background: var(--paper);
  border-bottom: 1px solid var(--vora); overflow-x: auto; position: sticky; top: 0; z-index: 20;
}
nav#pestanyes button {
  border: 0; background: none; padding: .55rem .9rem; border-radius: 999px;
  font-size: .95rem; cursor: pointer; white-space: nowrap; color: var(--silenciat);
}
nav#pestanyes button.actiu { background: var(--primari-clar); color: var(--primari); font-weight: 600; }

main { max-width: 1000px; margin: 0 auto; padding: 1.2rem 1rem 4rem; }
.sec { display: none; }
.sec.activa { display: block; }
.ocult { display: none !important; }
.silenciat { color: var(--silenciat); font-size: .88rem; }

.camp { margin: .9rem 0; }
.camp > label { display: block; font-weight: 600; margin-bottom: .35rem; }
input, select {
  font: inherit; padding: .5rem .7rem; border: 1px solid var(--vora);
  border-radius: 8px; background: var(--paper); color: var(--tinta);
}
button { font: inherit; cursor: pointer; }
button.primari {
  background: var(--primari); color: #fff; border: 0; border-radius: 10px;
  padding: .6rem 1.1rem; font-weight: 600;
}
button.primari:hover { filter: brightness(1.1); }
button.gran { font-size: 1.05rem; padding: .8rem 1.4rem; }
button.lleuger, a.lleuger {
  background: var(--paper); border: 1px solid var(--vora); border-radius: 10px;
  padding: .55rem .9rem; color: var(--tinta); text-decoration: none; display: inline-block;
}

.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip {
  border: 1.5px solid var(--vora); background: var(--paper); border-radius: 999px;
  padding: .35rem .85rem; font-size: .9rem; cursor: pointer; user-select: none;
}
.chip.actiu { background: var(--primari); border-color: var(--primari); color: #fff; }

/* pregunta */
.pregunta-cap { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .7rem; }
.etiquetes { display: flex; gap: .35rem; flex-wrap: wrap; }
.etiqueta {
  background: var(--primari-clar); color: var(--primari); border-radius: 6px;
  font-size: .78rem; padding: .15rem .5rem; font-weight: 600;
}
.etiqueta.gris { background: #eef0f6; color: var(--silenciat); }
.imatges { display: flex; flex-direction: column; gap: .4rem; }
.imatges img {
  width: 100%; height: auto; background: #fff; border: 1px solid var(--vora);
  border-radius: var(--radi); box-shadow: var(--ombra); display: block;
}
.imatges.solucio img { border-left: 5px solid var(--be); }
.accions-pregunta { display: flex; gap: .6rem; margin: .9rem 0; flex-wrap: wrap; align-items: center; }
.valora {
  background: var(--paper); border: 1px solid var(--vora); border-radius: var(--radi);
  padding: .9rem 1.1rem; display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
  box-shadow: var(--ombra); margin-top: 1rem;
}
.valora p { margin: 0; font-weight: 600; }
.valora button { border: 2px solid transparent; border-radius: 10px; padding: .55rem 1rem; font-weight: 600; background: #f2f4f9; }
.valora .v-be:hover { border-color: var(--be); } .valora .v-mig:hover { border-color: var(--mig); } .valora .v-mal:hover { border-color: var(--mal); }
.recursos-mini { margin-top: 1rem; font-size: .92rem; }
.recursos-mini a { margin-right: .8rem; }

/* explorar */
.filtres { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.filtres input[type=search] { flex: 1; min-width: 220px; }
.targetes { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .8rem; }
.targeta {
  background: var(--paper); border: 1px solid var(--vora); border-radius: var(--radi);
  padding: .85rem .95rem; box-shadow: var(--ombra); cursor: pointer; transition: transform .08s;
}
.targeta:hover { transform: translateY(-2px); }
.targeta .text { font-size: .88rem; color: var(--tinta); margin: .5rem 0 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.targeta.feta { outline: 2px solid var(--be); }

/* temes */
.tema-bloc {
  background: var(--paper); border: 1px solid var(--vora); border-radius: var(--radi);
  margin: .7rem 0; box-shadow: var(--ombra); overflow: hidden;
}
.tema-cap { display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; cursor: pointer; }
.tema-cap h3 { margin: 0; font-size: 1.02rem; flex: 1; }
.barra-fons { background: #edeff5; border-radius: 99px; height: 10px; width: 160px; overflow: hidden; }
.barra { height: 100%; background: var(--primari); border-radius: 99px; }
.tema-pct { font-weight: 700; color: var(--primari); min-width: 3.2rem; text-align: right; }
.tema-cos { padding: 0 1rem 1rem; border-top: 1px dashed var(--vora); display: none; }
.tema-bloc.obert .tema-cos { display: block; }
.tema-cos h4 { margin: .9rem 0 .3rem; font-size: .9rem; color: var(--silenciat); text-transform: uppercase; letter-spacing: .03em; }
.recursos .targeta { cursor: default; }
.recursos .targeta a { font-weight: 600; }

/* pla */
#pla-resultat { margin-top: 1.4rem; }
.setmana { margin: 1rem 0; }
.setmana h4 { margin: .3rem 0 .5rem; }
.sessions { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6rem; }
.sessio {
  background: var(--paper); border: 1px solid var(--vora); border-left: 5px solid var(--primari);
  border-radius: 10px; padding: .6rem .8rem; font-size: .92rem; box-shadow: var(--ombra);
}
.sessio.feta { opacity: .55; border-left-color: var(--be); }
.sessio .dia { font-weight: 700; font-size: .8rem; color: var(--silenciat); }
.sessio label { display: flex; gap: .4rem; align-items: baseline; cursor: pointer; margin-top: .3rem; }
.sessio .accions { margin-top: .35rem; }
.sessio .accions a { font-size: .82rem; margin-right: .6rem; }

/* progrés */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .7rem; margin-bottom: 1.2rem; }
.kpi { background: var(--paper); border: 1px solid var(--vora); border-radius: var(--radi); padding: .8rem; text-align: center; box-shadow: var(--ombra); }
.kpi b { display: block; font-size: 1.6rem; color: var(--primari); }
.prog-tema { display: flex; align-items: center; gap: .7rem; margin: .45rem 0; }
.prog-tema span.nom { flex: 1; font-size: .93rem; }
.prog-barra { flex: 2; background: #edeff5; height: 14px; border-radius: 99px; overflow: hidden; display: flex; }
.prog-barra i { height: 100%; display: block; }
.prog-barra .pb { background: var(--be); } .prog-barra .pm { background: var(--mig); } .prog-barra .px { background: var(--mal); }

/* modal */
#modal { position: fixed; inset: 0; background: rgba(20,24,38,.55); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 2rem 1rem; overflow-y: auto; }
#modal-cos { background: var(--fons); border-radius: 14px; max-width: 900px; width: 100%; padding: 1.2rem; position: relative; }
#modal-tanca { position: absolute; top: .6rem; right: .7rem; border: 0; background: var(--paper); border-radius: 99px; width: 2rem; height: 2rem; font-size: 1rem; box-shadow: var(--ombra); }

footer { max-width: 1000px; margin: 0 auto; padding: 1rem; color: var(--silenciat); font-size: .8rem; border-top: 1px solid var(--vora); }

/* notes PAU */
.taula-embolcall { overflow-x: auto; }
.taula-notes { border-collapse: collapse; width: 100%; background: var(--paper); border-radius: var(--radi); box-shadow: var(--ombra); font-size: .93rem; }
.taula-notes th, .taula-notes td { padding: .5rem .8rem; border-bottom: 1px solid var(--vora); text-align: left; }
.taula-notes th { background: var(--primari-clar); color: var(--primari); }
.taula-notes td.alt { color: var(--be); font-weight: 700; }
.taula-notes td.baix { color: var(--mal); font-weight: 700; }
.analisi { background: var(--paper); border: 1px solid var(--vora); border-radius: var(--radi); padding: .9rem 1.1rem; box-shadow: var(--ombra); }

/* zona personal */
button.compte { background: var(--primari-clar); color: var(--primari); border: 0; font-weight: 600; }
button.compte.connectat { background: #e7f7ec; color: var(--be); }
#modal-compte { position: fixed; inset: 0; background: rgba(20,24,38,.55); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 1rem; }
#modal-compte-cos { background: var(--paper); border-radius: 14px; max-width: 420px; width: 100%; padding: 1.4rem; position: relative; box-shadow: var(--ombra); }
#compte-tanca { position: absolute; top: .6rem; right: .7rem; border: 0; background: var(--fons); border-radius: 99px; width: 2rem; height: 2rem; }
#modal-compte input { width: 100%; margin: .6rem 0; font-size: 1.05rem; }
#compte-codi { letter-spacing: .5em; text-align: center; font-size: 1.4rem !important; }
.error { color: var(--mal); font-size: .88rem; min-height: 1.2em; }

@media (max-width: 640px) {
  header { flex-direction: column; align-items: flex-start; }
  .barra-fons { width: 90px; }
}
