/* Reconnecta't · Escola Paidós — colors extrets del logotip */
:root {
  --blue: #005A84; --blue-d: #003F5E; --sky: #E3EEF4;
  --ink: #1F2A33; --mut: #56616B; --line: #E4E0D8; --bg: #F6F4EF; --white: #FFFFFF;
  --yel: #F7B83B; --mag: #D1006F; --grn: #45A688; --grn-d: #2B7A5F;
  --ora: #EE8A00; --ora-d: #A85600; --vio: #6675B4; --vio-d: #4A5796;
  --ok-bg: #DDF1E8; --warn-bg: #FCEBD6; --mag-bg: #FBE3EE;
  --r-lg: 18px; --r-md: 14px; --r-sm: 10px;
  --nav-h: 72px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif; background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.5; }
img { max-width: 100%; display: block; }
h1 { margin: 0; font-size: 26px; font-weight: 900; line-height: 1.15; }
h2 { margin: 0; }
p { margin: 0; }
a { color: var(--blue); }
a:hover { color: var(--blue-d); }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--yel); outline-offset: 2px; }
.vh { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Estructura ---------- */
.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.app-wide { max-width: 1180px; }
.appbar { position: sticky; top: 0; z-index: 20; height: 64px; padding: 0 16px; padding-top: env(safe-area-inset-top, 0); background: var(--white); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.appbar-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--blue); }
.appbar-logo img { height: 36px; width: auto; }
.brand { font-weight: 900; font-size: 18px; }
.main { flex: 1; padding: 20px 16px 32px; }
.main.has-nav { padding-bottom: calc(var(--nav-h) + 28px + env(safe-area-inset-bottom, 0)); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 600px) { .grid-3 { grid-template-columns: 1fr; } }
.center { text-align: center; }
.muted { color: var(--mut); }
.label { font-size: 13px; font-weight: 700; color: var(--mut); }
.hint { font-size: 13px; color: var(--mut); }
.page-head { display: flex; flex-direction: column; gap: 6px; }
.meta { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; color: var(--mut); }
.meta.sm { font-size: 13px; gap: 6px; }
.back { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; text-decoration: none; min-height: 32px; }
.c-blue { color: var(--blue); } .c-grn { color: var(--grn-d); } .c-vio { color: var(--vio-d); } .c-mag { color: var(--mag); }

/* Colors d'etapa */
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: var(--blue); }
.et-inf { background: var(--yel); } .et-ini { background: var(--ora); } .et-mit { background: var(--grn); }
.et-sup { background: var(--vio); } .et-eso { background: var(--mag); }

/* ---------- Components ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; }
.h-card { font-size: 18px; font-weight: 900; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 12px; border: 2px solid transparent; font-size: 16px; font-weight: 800; text-decoration: none; cursor: pointer; background: none; }
.btn-lg { min-height: 56px; font-size: 17px; border-radius: var(--r-md); }
.btn-block { width: 100%; }
.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover { background: var(--blue-d); color: var(--white); }
.btn-primary[disabled] { background: #C3CBD1; color: #3F4A53; cursor: progress; }
.btn-outline { border-color: var(--blue); color: var(--blue); background: var(--white); }
.btn-outline:focus-within { outline: 3px solid var(--yel); outline-offset: 2px; }
.btn-white { background: var(--white); color: var(--blue); }
.link-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0; border: none; background: none; color: var(--mut); font-size: 13px; font-weight: 800; cursor: pointer; }
.link-strong { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; text-decoration: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 3px 12px; font-size: 13px; font-weight: 800; white-space: nowrap; }
.chip.sm { font-size: 11px; padding: 1px 8px; }
.chip-yel { background: var(--yel); color: var(--ink); }
.chip-sky { background: var(--sky); color: var(--blue); }
.chip-line { background: var(--white); border: 1px solid var(--line); color: var(--mut); }
.chip-ok { background: var(--ok-bg); color: var(--grn-d); }
.chip-warn { background: var(--warn-bg); color: var(--ora-d); }
.chip-mag { background: var(--mag-bg); color: var(--mag); }
.chip-blue { background: var(--blue); color: var(--white); }
.chip-glass { background: rgba(255,255,255,.16); color: var(--white); font-weight: 700; }
.pill { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--white); color: var(--ink); font-size: 14px; font-weight: 800; text-decoration: none; }
.pill.is-on { background: var(--blue); border-color: var(--blue); color: var(--white); }
.flash { border-radius: var(--r-md); padding: 12px 14px; font-weight: 700; margin-bottom: 16px; }
.flash ul { margin: 0; padding-left: 18px; }
.flash-ok { background: var(--ok-bg); color: var(--grn-d); }
.flash-error { background: var(--mag-bg); color: #9C0053; }
.flash-info { background: var(--sky); color: var(--blue); }
.stars-txt { color: var(--ora-d); font-size: 15px; letter-spacing: 1px; }
.empty-card p, .empty p { color: var(--mut); }
.empty { align-items: flex-start; padding-top: 40px; }

/* Formularis */
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > label, .field > legend, .field-label, .stars legend { font-size: 14px; font-weight: 800; padding: 0; }
input[type=text], input[type=number], input[type=date], input[type=url], textarea, select { width: 100%; min-height: 46px; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--white); font-size: 16px; }
textarea { resize: vertical; background: var(--bg); line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px var(--sky); }
.accept { display: flex; gap: 12px; align-items: flex-start; background: var(--sky); border-radius: var(--r-md); padding: 14px; }
.accept input { width: 24px; height: 24px; margin: 0; flex-shrink: 0; accent-color: var(--blue); }
.accept label { font-size: 15px; font-weight: 700; line-height: 1.4; }
.form-error { color: #9C0053; font-weight: 800; font-size: 14px; }

/* ---------- Bottom nav ---------- */
.bottom-nav { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 560px; z-index: 30; height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0)); padding-bottom: env(safe-area-inset-bottom, 0); background: var(--white); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.bottom-nav.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.app-wide .bottom-nav { max-width: 1180px; }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-decoration: none; color: var(--mut); font-size: 12px; font-weight: 700; border-top: 3px solid transparent; }
.bottom-nav a.is-on { color: var(--blue); font-weight: 900; border-top-color: var(--blue); }

/* Menú d'usuari */
.menu { position: relative; }
.menu summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; min-height: 44px; }
.menu summary::-webkit-details-marker { display: none; }
.lang-pill { font-size: 12px; font-weight: 800; color: var(--blue); border: 1.5px solid var(--blue); border-radius: 999px; padding: 3px 9px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--blue); color: var(--white); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 280px; background: var(--white); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 12px 32px rgba(31,42,51,.14); }
.menu-name span { font-size: 13px; color: var(--mut); word-break: break-all; }
.menu-label { font-size: 13px; font-weight: 800; color: var(--mut); }
.menu-langs { display: flex; flex-wrap: wrap; gap: 6px; }
.menu-langs .pill { min-height: 38px; padding: 0 12px; font-size: 13px; }

/* ---------- Login ---------- */
.login-body { background: var(--white); min-height: 100dvh; display: flex; flex-direction: column; }
.login { flex: 1; width: 100%; max-width: 420px; margin: 0 auto; padding: 32px 28px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; }
.login-logo { width: 240px; height: auto; }
.login-title { text-align: center; display: flex; flex-direction: column; gap: 8px; }
.login-title h1 { font-size: 46px; color: var(--blue); line-height: 1; }
.kicker { font-size: 13px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--mut); }
.lead { font-size: 17px; color: var(--mut); line-height: 1.45; }
.login-note { font-size: 13px; color: var(--mut); text-align: center; }
.login-langs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.brand-strip { display: flex; height: 10px; }
.brand-strip span { flex: 1; }
.brand-strip span:nth-child(1) { background: var(--blue); } .brand-strip span:nth-child(2) { background: var(--yel); }
.brand-strip span:nth-child(3) { background: var(--mag); } .brand-strip span:nth-child(4) { background: var(--grn); }
.brand-strip span:nth-child(5) { background: var(--ora); } .brand-strip span:nth-child(6) { background: var(--vio); }

/* ---------- Normes ---------- */
.normes { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; font-size: 15px; }

/* ---------- Inici ---------- */
.score { display: flex; flex-direction: column; gap: 12px; }
.score-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.score-row > div { display: flex; flex-direction: column; }
.score-row .right { align-items: flex-end; }
.big { font-size: 44px; font-weight: 900; color: var(--blue); line-height: 1; }
.mid { font-size: 26px; font-weight: 900; }
.progress { height: 12px; background: #EDEAE3; border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--grn); border-radius: 999px; }
.hero { background: var(--blue); border-color: var(--blue); color: var(--white); display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.hero .kicker { color: var(--yel); }
.hero h2 { font-size: 23px; font-weight: 900; line-height: 1.2; }
.row-link { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); }
.row-link .muted { font-size: 14px; }
.sq { width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.sq-yel { background: var(--yel); color: var(--ink); }
.stat { background: var(--bg); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; }
.stat-n { font-size: 26px; font-weight: 900; }

/* ---------- Llista de reptes ---------- */
.segmented { display: grid; gap: 4px; background: var(--white); border: 1px solid var(--line); border-radius: var(--r-md); padding: 4px; }
.segmented.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.segmented.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.segmented a { min-height: 44px; display: flex; align-items: center; justify-content: center; border-radius: var(--r-sm); font-size: 15px; font-weight: 800; color: var(--ink); text-decoration: none; }
.segmented a.is-on { background: var(--blue); color: var(--white); }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px; text-decoration: none; color: var(--ink); }
.list-item:hover { border-color: var(--blue); color: var(--ink); }
.month { width: 56px; height: 56px; border-radius: var(--r-md); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 900; letter-spacing: .04em; }
.m-now { background: var(--blue); color: var(--white); }
.m-past { background: var(--vio-d); color: var(--white); }
.m-extra { background: var(--yel); color: var(--ink); }
.item-title { font-size: 16px; line-height: 1.25; }
.pts { font-size: 13px; font-weight: 700; color: var(--blue); }
.status { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

/* ---------- Detall ---------- */
.media { border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 16 / 9; background: var(--blue); }
.media iframe { width: 100%; height: 100%; border: 0; display: block; }
.media-link { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--white); text-decoration: none; font-weight: 800; }
.media-link:hover { color: var(--white); }
.play { width: 64px; height: 64px; border-radius: 50%; background: rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center; }
.desc { font-size: 16px; line-height: 1.6; }
.quote { background: var(--bg); border-radius: 12px; padding: 12px; font-size: 15px; }
.done-head { display: flex; align-items: center; justify-content: space-between; }
.notice { font-weight: 700; }
.notice-mag { background: var(--mag-bg); border-color: var(--mag-bg); color: #9C0053; }
.picker { display: flex; flex-direction: column; gap: 10px; }
.slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.slot { aspect-ratio: 1 / 1; border-radius: var(--r-md); position: relative; overflow: hidden; }
.slot-empty { border: 2px dashed #B9C3CA; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--mut); font-size: 12px; font-weight: 700; }
.slot-full { background: #CFE3EC; }
.slot-full img { width: 100%; height: 100%; object-fit: cover; }
.slot-full a { display: block; height: 100%; }
.slot-x { position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--white); color: var(--ink); display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.slot form { margin: 0; }

/* Estrelles (radio accessibles, sense JavaScript) */
.stars { border: 0; padding: 0; margin: 0; }
.stars legend { margin-bottom: 6px; }
.stars-row { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 6px; }
.stars-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.stars-row label { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; color: #CBD2D8; cursor: pointer; border-radius: 10px; }
.stars-row input:checked ~ label, .stars-row label:hover, .stars-row label:hover ~ label { color: var(--ora); }
.stars-row input:focus-visible + label { outline: 3px solid var(--yel); }

/* Galeria */
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 900px) { .app-wide .gallery { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.g-card { background: var(--white); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; }
.g-img { position: relative; display: block; aspect-ratio: 4 / 3; background: #CFE3EC; }
.g-img img { width: 100%; height: 100%; object-fit: cover; }
.g-count { position: absolute; right: 8px; bottom: 8px; background: rgba(31,42,51,.8); color: var(--white); border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 800; }
.g-body { padding: 10px; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.g-body form { margin: 0; }

/* ---------- Rànquing ---------- */
.private { background: var(--sky); border-color: var(--sky); display: flex; align-items: center; gap: 14px; }
.private > span:last-child { display: flex; flex-direction: column; }
.pos { width: 52px; height: 52px; flex-shrink: 0; border-radius: 50%; background: var(--blue); color: var(--white); display: flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 900; }
.rank { gap: 8px; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--r-md); }
.rank-row.is-mine { border: 2px solid var(--blue); background: #F0F6F9; }
.rank-n { width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%; background: #EDEAE3; display: flex; align-items: center; justify-content: center; font-weight: 900; }
.rank-n.first { background: var(--yel); }
.rank-cls { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.rank-pts { display: flex; flex-direction: column; align-items: flex-end; }
.rank-pts strong { font-size: 18px; color: var(--blue); }
.rank-pts .label { font-size: 11px; }

/* ---------- Suggeriments ---------- */
.sug-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sug-text { font-weight: 700; }
.reply { background: var(--bg); border-radius: 12px; padding: 12px; display: flex; gap: 10px; font-size: 14px; }

/* ---------- Administració ---------- */
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi-n { font-size: 34px; font-weight: 900; line-height: 1.1; }
.table-wrap { overflow-x: auto; margin-top: 8px; }
.table { width: 100%; border-collapse: collapse; min-width: 640px; }
.table th { text-align: left; font-size: 12px; font-weight: 900; color: var(--mut); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.radio-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.radio-pills input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.radio-pills span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1.5px solid var(--line); font-weight: 800; font-size: 14px; cursor: pointer; background: var(--white); }
.radio-pills input:checked + span { background: var(--blue); border-color: var(--blue); color: var(--white); }
.radio-pills input:focus-visible + span { outline: 3px solid var(--yel); outline-offset: 2px; }
.lang-blocks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 900px) { .lang-blocks { grid-template-columns: 1fr; } }
.lang-block { border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; margin: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.lang-block legend { font-weight: 900; padding: 0 6px; color: var(--blue); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
