* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 16px/1.5 var(--font); background: var(--bg); color: var(--ink); }
h1, h2, h3 { font-family: var(--font-head); font-weight: 800; letter-spacing: -.01em; line-height: 1.2; margin: 0 0 .6em; color: var(--ink); }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
a { color: var(--brand); }
.boot { padding: 2rem; text-align: center; color: var(--muted); }

header.top { background: var(--brand); color: #fff; display: flex; align-items: center; gap: 1rem; padding: .7rem 1.2rem; flex-wrap: wrap; }
header.top .brand { font-weight: 700; font-size: 1.1rem; color: #fff; text-decoration: none; }
header.top nav { display: flex; gap: .3rem; flex: 1; flex-wrap: wrap; }
header.top nav a { color: var(--on-brand-soft); text-decoration: none; padding: .3rem .7rem; border-radius: 6px; }
header.top nav a.active, header.top nav a:hover { background: rgba(255, 255, 255, .18); color: #fff; }
header.top .who { font-size: .9rem; opacity: .9; }

main { max-width: 1000px; margin: 1.2rem auto; padding: 0 1rem 3rem; }
main.wide { max-width: 1350px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.auth-card { max-width: 420px; margin: 3rem auto; }
.row { display: flex; gap: .8rem; flex-wrap: wrap; }
.row > * { flex: 1 1 220px; }
.row.tight > * { flex: 0 1 auto; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hint { color: var(--muted); font-size: .85rem; margin-top: .2rem; }
.note { background: var(--note-warn-bg); border: 1px solid var(--note-warn-line); border-radius: 8px; padding: .6rem .8rem; font-size: .9rem; margin: .6rem 0; }
.note.info { background: var(--tint); border-color: var(--line-strong); }
.note.bad { background: #fdecea; border-color: #f2b8b2; }

label.field { display: block; margin: 0 0 .8rem; font-weight: 600; font-size: .92rem; }
label.field .req { color: var(--bad); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=number], select, textarea {
  display: block; width: 100%; margin-top: .25rem; padding: .55rem .65rem; font: inherit; font-weight: 400;
  border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 3px solid var(--focus); border-color: var(--brand); }
.field.err input, .field.err select, .field.err textarea, .fieldset.err { border-color: var(--bad); }
.errmsg { color: var(--bad); font-size: .85rem; font-weight: 500; margin-top: .2rem; }
fieldset.fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 .9rem; padding: .6rem .8rem .8rem; }
fieldset.fieldset legend { font-weight: 600; font-size: .92rem; padding: 0 .3rem; }
.choices { display: flex; flex-wrap: wrap; gap: .3rem .9rem; }
.choices label { font-weight: 400; display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; }
.choices input { width: auto; margin: 0; }
.weeks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .35rem .8rem; }
.weeks label { font-weight: 400; display: flex; align-items: center; gap: .4rem; padding: .25rem .4rem; border-radius: 6px; cursor: pointer; }
.weeks label:hover { background: var(--tint); }
.weeks input { width: auto; margin: 0; }
.weeks select { margin: 0 0 0 auto; width: auto; font-size: .8rem; padding: .15rem .3rem; }

button, .btn { font: inherit; border: 1px solid var(--brand); background: var(--brand); color: #fff; padding: .55rem 1rem; border-radius: var(--radius-btn); cursor: pointer; text-decoration: none; display: inline-block; font-weight: 700; }
button:hover, .btn:hover { background: var(--brand-dark); }
button.secondary, .btn.secondary { background: #fff; color: var(--brand); }
header.top button.secondary { background: transparent; color: #fff; border-color: rgba(255,255,255,.55); }
header.top button.secondary:hover { background: rgba(255,255,255,.16); }
button.secondary:hover, .btn.secondary:hover { background: var(--tint); }
button.danger { background: var(--bad); border-color: var(--bad); }
button.danger:hover { background: var(--bad-dark); }
button.accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.accent:hover { background: var(--accent-dark); }
button.small, .btn.small { padding: .25rem .6rem; font-size: .85rem; }
button:disabled { opacity: .55; cursor: not-allowed; }
.link { background: none; border: none; color: var(--brand); padding: 0; text-decoration: underline; }
.link:hover { background: none; }

.steps { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: 1rem; }
.steps button { background: #fff; color: var(--ink); border-color: var(--line); font-size: .85rem; padding: .4rem .7rem; }
.steps button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.steps button.has-err { border-color: var(--bad); color: var(--bad); }
.steps button.active.has-err { color: #fff; background: var(--bad); }
.savestate { font-size: .85rem; color: var(--muted); }
.savestate.err { color: var(--bad); }

.chip { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); border-color: #b5e0c4; }
.chip.warn { background: #fff1db; color: var(--warn); border-color: #f0d09b; }
.chip.bad { background: #fdecea; color: var(--bad); border-color: #f2b8b2; }
.chip.grey { background: var(--tint); color: var(--muted); border-color: var(--line); }

.econ { display: grid; grid-template-columns: 1fr auto; gap: .2rem 1.2rem; max-width: 460px; }
.econ .num { text-align: right; font-variant-numeric: tabular-nums; }
.econ .total { font-weight: 700; border-top: 1px solid var(--line); padding-top: .3rem; margin-top: .2rem; }
.econ .pend { font-weight: 700; color: var(--accent); }

.child-card { display: grid; grid-template-columns: 1fr auto; gap: .6rem 1rem; align-items: center; }
.docrow { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; padding: .6rem 0; border-top: 1px solid var(--line); }
.docrow:first-child { border-top: none; }
.docrow .label { flex: 1 1 260px; }
.docrow .files { flex: 1 1 260px; display: flex; flex-direction: column; gap: .3rem; }
.filechip { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; font-size: .88rem; }

table.grid { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.grid th, table.grid td { text-align: left; padding: .45rem .55rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid th { background: var(--tint); position: sticky; top: 0; white-space: nowrap; }
table.grid tr:hover td { background: var(--tint-2); }
table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tablewrap { overflow-x: auto; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .6rem; align-items: end; margin-bottom: .8rem; }
.filters label.field { margin: 0; }
.payrows { width: 100%; border-collapse: collapse; }
.payrows td, .payrows th { padding: .25rem .3rem; text-align: left; }
.payrows input, .payrows select { margin: 0; }

.modal-bg { position: fixed; inset: 0; background: rgba(15, 25, 35, .6); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 1rem; }
.modal { background: #fff; border-radius: 10px; width: min(900px, 100%); height: min(86vh, 900px); display: flex; flex-direction: column; overflow: hidden; }
.modal .bar { display: flex; justify-content: space-between; align-items: center; padding: .6rem .9rem; border-bottom: 1px solid var(--line); gap: 1rem; }
.modal iframe, .modal img { flex: 1; width: 100%; border: 0; object-fit: contain; min-height: 0; background: var(--tint); }

.toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%) translateY(150%); background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 8px; transition: transform .25s; z-index: 80; max-width: 90vw; }
.toast { opacity: 0; pointer-events: none; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.bad { background: var(--bad); }

@media (max-width: 640px) {
  main { padding: 0 .6rem 3rem; }
  .child-card { grid-template-columns: 1fr; }
  h1 { font-size: 1.35rem; }
}

input.inline-date { display: inline-block; width: auto; margin: 0 0 0 .3rem; padding: .2rem .4rem; font-size: .85rem; }
.files label.field { margin: .2rem 0; font-size: .85rem; }
.checklist { list-style: none; padding: 0; line-height: 1.9; }
.econ + .muted.small { margin-top: .3rem; }
.pricein { width: 5.5rem; }

details > summary { cursor: pointer; padding: .2rem 0; }

.lang-sel { width: auto; padding: .3rem .4rem; font-size: .9rem; }

/* Inscripcions amb grup o amics: fila destacada a la llista de l'administració */
tr.row-grup td { background: #fff6cc; }

/* L'atribut hidden sempre amaga l'element (també els botons amb classe .btn) */
[hidden] { display: none !important; }
