/* ASOS · món visual: rajola hidràulica de l'Eixample, en clau lluminosa.
   Fons càlid i clar, fitxes blanques amb ombra suau, blau Eixample per a l'acció
   i pigments (verd aigua, ambre, terracota) només on hi ha un estat. */

/* Archivo servida des del projecte (OFL-1.1, vegeu fonts/OFL.txt): cap petició a tercers */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fonts/archivo-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fonts/archivo-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #F3F0EA;
  --surface: #FFFFFF;
  --surface-2: #F7F5F1;
  --line: #EAE5DC;
  --line-2: #D8D0C3;
  --ink: #1D2433;
  --ink-2: #5E6676;
  --ink-3: #8A91A0;

  --primary: #3D5DA8;
  --primary-2: #31508F;
  --primary-tint: #E8EEF9;
  --on-primary: #FFFFFF;

  --ok: #2B8A70;
  --ok-ink: #1D6B55;
  --ok-tint: #DFF2EB;
  --sky: #4F86C2;
  --warn: #E3A23A;
  --warn-ink: #8C5A0A;
  --warn-tint: #FCF0D8;
  --block: #D0533F;
  --block-ink: #A63A28;
  --block-tint: #FBE3DE;
  --violet: #7A64C4;
  --violet-tint: #EEEAF9;
  --rose-tint: #FBE6E1;

  --side: #1F2A44;
  --side-2: #2A3756;
  --on-side: #FFFFFF;
  --on-side-2: #AEB8CF;

  --focus: #E3A23A;
  --sh-1: 0 1px 2px rgb(29 36 51 / 0.06), 0 1px 3px rgb(29 36 51 / 0.05);
  --sh-2: 0 10px 30px -14px rgb(29 36 51 / 0.28), 0 2px 6px rgb(29 36 51 / 0.05);

  --r-s: 8px;
  --r-m: 12px;
  --r-l: 18px;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151C;
    --surface: #1A2029;
    --surface-2: #212834;
    --line: #2A3240;
    --line-2: #3A4351;
    --ink: #E9ECF1;
    --ink-2: #A6AEBB;
    --ink-3: #7C8594;
    --primary: #86A2E6;
    --primary-2: #9CB4EC;
    --primary-tint: #232D47;
    --on-primary: #0F1522;
    --ok: #4DB894;
    --ok-ink: #72D2B0;
    --ok-tint: #17322A;
    --sky: #6D9FD6;
    --warn: #E9B04F;
    --warn-ink: #F0C46E;
    --warn-tint: #362A15;
    --block: #E57461;
    --block-ink: #F29484;
    --block-tint: #3B201C;
    --violet: #A592E6;
    --violet-tint: #2A2540;
    --rose-tint: #3A2422;
    --side: #0C1017;
    --side-2: #1B2230;
    --on-side-2: #8F99AD;
    --sh-1: 0 1px 2px rgb(0 0 0 / 0.4);
    --sh-2: 0 12px 30px -14px rgb(0 0 0 / 0.75);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 16px/1.5 var(--font);
  color: var(--ink);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
  caret-color: var(--primary);
  accent-color: var(--primary);
  scrollbar-color: var(--line-2) transparent;
}
::selection { background: var(--primary-tint); color: var(--ink); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 30px; line-height: 1.15; font-weight: 800; letter-spacing: -0.025em; }
h2 { font-size: 18px; line-height: 1.25; font-weight: 700; }
[hidden] { display: none !important; }
.sprite { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-2); }
kbd { font: 600 12px var(--font); background: var(--surface); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; padding: 1px 7px; color: var(--ink-2); }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- Marca: quatre peces de rajola ---------- */
/* Símbol de Greenhub (la G amb el node ocre) */
.logo { width: 34px; height: 34px; flex: none; stroke: none; }
.mark { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 3px; width: 34px; height: 34px; flex: none; }
.mark i { border-radius: 3px 1px; }
.mark i:nth-child(1) { background: var(--warn); }
.mark i:nth-child(2) { background: var(--ok); border-radius: 1px 3px; }
.mark i:nth-child(3) { background: var(--sky); border-radius: 1px 3px; }
.mark i:nth-child(4) { background: var(--block); }

/* ---------- Controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 48px; padding: 0 var(--sp-5);
  border: 1.5px solid transparent; border-radius: var(--r-m);
  font: 700 16px var(--font); cursor: pointer; white-space: nowrap;
  transition: background-color 150ms, border-color 150ms, box-shadow 150ms, transform 150ms var(--ease-out);
}
.btn svg { width: 20px; height: 20px; }
.btn:active { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 6px 16px -8px var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-2); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-2); box-shadow: var(--sh-1); }
.btn-secondary:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { color: var(--ink); background: var(--surface-2); }
.btn-lg { min-height: 56px; font-size: 18px; }
.btn-icon { width: 48px; padding: 0; }
.btn-icon.on { border-color: var(--ok); color: var(--ok-ink); background: var(--ok-tint); }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink); }
.field small { font-weight: 400; color: var(--ink-2); }
input, select, textarea {
  width: 100%; min-height: 48px; padding: 0 var(--sp-3);
  font: 400 16px var(--font); color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line-2); border-radius: var(--r-m);
  transition: border-color 150ms, box-shadow 150ms;
}
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-tint); }
input[aria-invalid="true"] { border-color: var(--block); }
.check { display: flex; align-items: center; gap: var(--sp-3); font-weight: 500; min-height: 48px; }
.check input { width: 22px; min-height: 22px; height: 22px; }
.form-error { color: var(--block-ink); background: var(--block-tint); border-radius: var(--r-s); padding: var(--sp-2) var(--sp-3); font-weight: 600; font-size: 14px; }
.form-error:empty { display: none; }
.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; }

/* ---------- Accés ---------- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(420px, 560px); }
.auth-art {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: var(--sp-6);
  padding: var(--sp-7); color: #FFFFFF;
  background: radial-gradient(120% 90% at 0% 0%, #3D5DA8 0%, #1F2A44 60%, #161E31 100%);
}
.brand { display: flex; align-items: center; gap: var(--sp-3); font-size: 20px; font-weight: 800; letter-spacing: 0.04em; }
/* «Greenhub club» a dalt i el nom de l'associació a sota, més petit */
.brand-text { display: grid; line-height: 1.15; min-width: 0; }
.brand-club { font-size: 14px; font-weight: 600; letter-spacing: 0; opacity: 0.75; }
.brand-club:empty { display: none; }
.mosaic {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px;
  width: min(100%, 520px); align-self: center;
}
.mosaic i { aspect-ratio: 1; border-radius: 10px; position: relative; overflow: hidden; opacity: 0.95; }
.mosaic i::after { content: ""; position: absolute; inset: 20%; border: 3px solid rgb(255 255 255 / 0.75); border-radius: 50% 0; }
.mosaic i.r1::after { border-radius: 0 50%; }
.mosaic i.r2::after { border-radius: 50%; inset: 28%; }
.mosaic i.r3::after { inset: 34%; border-radius: 2px; transform: rotate(45deg); }
.mosaic .m1 { background: #2B8A70; }
.mosaic .m2 { background: #4F86C2; }
.mosaic .m3 { background: #E3A23A; }
.mosaic .m4 { background: rgb(255 255 255 / 0.1); }
.mosaic .m4::after { border-color: rgb(255 255 255 / 0.3); }
.auth-claim { font-size: clamp(22px, 2.4vw, 30px); font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; max-width: 22ch; }

/* Ancorat a dalt (no centrat): els avisos i errors no fan saltar el formulari mentre s'escriu */
.auth-panel { display: grid; place-items: start center; padding: clamp(32px, 12vh, 120px) var(--sp-5) var(--sp-6); background: var(--bg); }
.auth-sheet { width: 100%; max-width: 420px; }
.brand-compact { display: none; margin-bottom: var(--sp-5); }
.auth h1 { margin-bottom: var(--sp-5); }

/* Avís a dalt del formulari: sessió caducada, canvi de torn, chip de soci… */
.auth-powered { margin: var(--sp-4) 0 0; font-size: 12px; color: var(--ink-2); text-align: center; }
.brand-logo-row { display: flex; align-items: center; gap: var(--sp-3); font-weight: 400; color: var(--ink-2); }
.brand-logo-row .logo { object-fit: contain; border-radius: 8px; }
.auth-notice {
  margin: calc(var(--sp-2) * -1) 0 var(--sp-4); padding: var(--sp-3) var(--sp-4);
  background: var(--primary-tint); color: var(--ink); border-radius: var(--r-m);
  font-size: 15px; font-weight: 600; line-height: 1.4;
}

/* Qui fa torn: el personal que ha entrat en aquest dispositiu */
.who-picks { margin-bottom: var(--sp-4); }
.who-picks-label { margin-bottom: var(--sp-3); font-size: 14px; font-weight: 600; color: var(--ink-2); }
.who-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.who-pick {
  width: 100%; min-height: 64px; display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3); text-align: left; cursor: pointer;
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line-2); border-radius: var(--r-m); box-shadow: var(--sh-1);
  transition: border-color 150ms, background-color 150ms, transform 150ms var(--ease-out);
}
.who-pick:hover { border-color: var(--primary); }
.who-pick:active { transform: translateY(1px); }
.who-pick-text { display: grid; min-width: 0; line-height: 1.25; }
.who-pick-text b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-pick-text small { font-size: 13px; color: var(--ink-2); }
.who-pick .avatar { width: 44px; height: 44px; }
.who-other { background: transparent; box-shadow: none; border-style: dashed; }
.who-other .avatar { background: var(--surface-2); color: var(--ink-2); border: 1.5px solid var(--line-2); }
.who-other .avatar svg { width: 20px; height: 20px; }

/* Persona triada: només falta la contrasenya */
.who-chosen {
  display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-m);
}
.who-chosen .avatar { width: 48px; height: 48px; font-size: 16px; }
.who-chosen-text { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.who-chosen-text b { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-chosen-text small { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-chosen-change { min-height: 44px; padding: 0 var(--sp-3); font-size: 15px; color: var(--primary); }

/* Contrasenya amb botó per mostrar-la */
.pass { position: relative; }
.pass input { padding-right: 56px; }
.pass-toggle {
  position: absolute; top: 0; right: 0; width: 52px; height: 100%; min-height: 48px;
  display: grid; place-items: center; border: 0; background: none; color: var(--ink-2);
  border-radius: 0 var(--r-m) var(--r-m) 0; cursor: pointer;
}
.pass-toggle:hover { color: var(--ink); }
.pass-toggle svg { width: 22px; height: 22px; }
.field .caps-hint { color: var(--warn-ink); font-weight: 600; }
.caps-hint::before { content: "⇪ "; }

/* Botó ocupat: el text canvia a «Entrant…» i gira un petit indicador */
.spinner { display: none; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin 700ms linear infinite; }
.btn[aria-busy="true"] .spinner { display: inline-block; }
.btn[aria-busy="true"] { opacity: 0.85; }
@keyframes spin { to { transform: rotate(360deg); } }

.link-btn.who-forget { align-self: center; min-height: 44px; font-size: 14px; font-weight: 600; color: var(--ink-2); text-decoration-color: var(--line-2); }
.link-btn.who-forget:hover { color: var(--ink); }
.auth-hint { margin-top: var(--sp-5); font-size: 14px; color: var(--ink-2); line-height: 1.45; }

.link-btn { border: 0; padding: 0; background: none; font: inherit; color: var(--primary); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---------- Finestres: escàner i carnet ---------- */
.modal {
  width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: var(--sp-5);
  border: 0; border-radius: var(--r-l); background: var(--surface); color: var(--ink); box-shadow: var(--sh-2);
}
.modal::backdrop { background: rgb(17 21 28 / 0.55); backdrop-filter: blur(3px); }
.modal[open] { display: grid; gap: var(--sp-4); animation: pop 260ms var(--ease-out); }
@keyframes pop { from { transform: translateY(12px) scale(0.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.modal-head .btn-icon { min-height: 40px; width: 40px; }
.scan-view { position: relative; aspect-ratio: 1; border-radius: var(--r-m); overflow: hidden; background: #0C1017; }
.scan-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 18%; border-radius: 16px; box-shadow: 0 0 0 999px rgb(0 0 0 / 0.35); outline: 3px solid var(--warn); }
#scan-status.err, #photo-status.err { color: var(--block-ink); font-weight: 600; }
.photo-guide { position: absolute; inset: 14% 22% 10%; border-radius: 50% / 45%; outline: 2px dashed rgb(255 255 255 / 0.7); pointer-events: none; }
.photo-view.taken .photo-guide, .photo-view.off .photo-guide { display: none; }
.photo-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.photo-actions > .btn { flex: 1 1 140px; }
.photo-actions > .btn-lg { flex-basis: 100%; }
.card-qr-box { justify-self: center; width: min(260px, 100%); padding: var(--sp-3); background: #FFFFFF; border-radius: var(--r-m); box-shadow: var(--sh-1); border: 1px solid var(--line); }
.card-qr-box img { display: block; width: 100%; aspect-ratio: 1; }
.card-steps { margin: 0; padding-left: 1.3em; display: grid; gap: var(--sp-1); color: var(--ink-2); font-size: 15px; }
.card-link { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-2); }
.card-link input { min-height: 44px; font-size: 14px; color: var(--ink-2); }
.card-link .btn { min-height: 44px; }
.card-actions { justify-content: space-between; border-top: 1px solid var(--line); padding-top: var(--sp-3); }
.card-actions .btn { min-height: 40px; padding: 0 var(--sp-3); }
.btn-ghost.danger { color: var(--block-ink); }
.btn-ghost.danger:hover { background: var(--block-tint); }

/* Ones de lectura al voltant de la icona del chip */
.nfc-waves { --s: 72px; position: relative; width: var(--s); height: var(--s); display: grid; place-items: center; color: var(--primary); }
.nfc-waves.small { --s: 64px; }
.nfc-waves svg { position: relative; width: 30px; height: 30px; }
.nfc-waves::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--primary-tint); }
.nfc-waves span { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--primary); opacity: 0; animation: wave 2.4s var(--ease-out) infinite; }
.nfc-waves span:nth-child(2) { animation-delay: 0.8s; }
.nfc-waves span:nth-child(3) { animation-delay: 1.6s; }
@keyframes wave { 0% { transform: scale(0.7); opacity: 0.55; } 100% { transform: scale(1.5); opacity: 0; } }

.register { margin-top: var(--sp-5); border-top: 1px solid var(--line); padding-top: var(--sp-3); }
.register summary { cursor: pointer; font-weight: 600; color: var(--primary); min-height: 44px; display: flex; align-items: center; }
.register summary:hover { color: var(--primary-2); }
.register form { margin-top: var(--sp-4); }

/* ---------- Estructura ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100dvh; }
.side {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: var(--sp-5);
  background: var(--side); color: var(--on-side); padding: var(--sp-5) var(--sp-4);
}
.side-brand { display: flex; align-items: center; gap: var(--sp-3); padding: 0 var(--sp-2); }
.side-brand-text { display: grid; min-width: 0; line-height: 1.2; }
.side-brand-text b { font-size: 18px; letter-spacing: 0.04em; }
.side-brand-text small { color: var(--on-side-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-nav { display: grid; gap: 4px; }
.side-nav a, .side-out {
  display: flex; align-items: center; gap: var(--sp-3); min-height: 48px; padding: 0 var(--sp-3);
  color: var(--on-side-2); font: 600 15px var(--font); text-decoration: none;
  border: 0; background: transparent; border-radius: var(--r-m); cursor: pointer;
  transition: background-color 150ms, color 150ms;
}
.side-nav a:hover, .side-out:hover { color: var(--on-side); background: var(--side-2); }
.side-nav a[aria-current="page"] { color: var(--on-side); background: var(--side-2); box-shadow: inset 3px 0 0 var(--warn); }
.side-nav a[aria-current="page"] svg { color: var(--warn); }
.side-foot { margin-top: auto; display: grid; gap: var(--sp-2); padding-top: var(--sp-4); border-top: 1px solid var(--side-2); }
.me { display: flex; align-items: center; gap: var(--sp-3); padding: 0 var(--sp-2); min-width: 0; }
.me-text { display: grid; line-height: 1.25; min-width: 0; }
.me-text b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { color: var(--on-side-2); font-size: 13px; }
.avatar {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px;
  background: linear-gradient(135deg, var(--sky), var(--ok)); color: #FFFFFF; font-weight: 800; font-size: 15px; letter-spacing: 0.02em;
}

/* ---------- Idioma: un select natiu invisible a sobre de l'etiqueta (globus, nom o codi, fletxa) ---------- */
.lang {
  position: relative; display: flex; align-items: center; gap: var(--sp-2); border-radius: var(--r-m);
  transition: background-color 150ms, color 150ms;
}
.lang svg { width: 18px; height: 18px; }
.lang .lang-arrow { width: 16px; height: 16px; }
.lang-code { display: none; }
.lang-select { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.lang:has(.lang-select:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.auth-lang { width: fit-content; min-height: 44px; margin: var(--sp-4) 0 0 calc(var(--sp-2) * -1); padding: 0 var(--sp-2); color: var(--ink-2); font-size: 14px; font-weight: 600; }
.auth-lang:hover { color: var(--ink); background: var(--surface-2); }
.side-lang { min-height: 44px; padding: 0 var(--sp-3); gap: var(--sp-3); color: var(--on-side-2); font: 600 15px var(--font); }
.side-lang:hover { color: var(--on-side); background: var(--side-2); }
.side-lang svg:first-child { width: 22px; height: 22px; }
.side-lang .lang-arrow { margin-left: auto; }

.work { padding: var(--sp-5) var(--sp-6) var(--sp-7); min-width: 0; max-width: 1480px; }
.topbar { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-6); }
.search {
  flex: 1; display: flex; align-items: center; gap: var(--sp-3);
  height: 60px; padding: 0 var(--sp-5);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-l); box-shadow: var(--sh-1);
  transition: border-color 150ms, box-shadow 150ms;
}
.search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-tint); }
.search svg { color: var(--ink-3); }
.search input { border: 0; min-height: 0; height: 100%; padding: 0; font-size: 20px; background: transparent; }
.search input:focus-visible { box-shadow: none; }
.reader {
  display: flex; align-items: center; gap: var(--sp-2); height: 48px; padding: 0 var(--sp-4);
  border-radius: 999px; background: var(--ok-tint); color: var(--ok-ink); font-size: 14px; font-weight: 700; white-space: nowrap;
}
.reader-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: beacon 2.4s ease-out infinite; }
@keyframes beacon { 0% { box-shadow: 0 0 0 0 rgb(43 138 112 / 0.5); } 70%, 100% { box-shadow: 0 0 0 8px rgb(43 138 112 / 0); } }
.reader.read { animation: read 600ms var(--ease-out); }
@keyframes read { 30% { background: var(--ok); color: #FFFFFF; } }

.panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-5); flex-wrap: wrap; }
.panel-sub { color: var(--ink-2); margin-top: var(--sp-1); }
.panel-sub::first-letter { text-transform: uppercase; }
.sheet { background: var(--surface); border-radius: var(--r-l); padding: var(--sp-5); box-shadow: var(--sh-2); }
.sheet > h2 { margin-bottom: var(--sp-4); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-5); }
.span-all { grid-column: 1 / -1; }

/* ---------- Avís ---------- */
.toast { position: fixed; z-index: 10; left: 50%; bottom: var(--sp-5); transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); font-weight: 600; padding: var(--sp-3) var(--sp-5); border-radius: 999px; box-shadow: var(--sh-2);
  transition: opacity 200ms, transform 300ms var(--ease-out); max-width: calc(100vw - 32px); }
.toast::before { content: "✓"; margin-right: var(--sp-2); color: var(--ok); font-weight: 800; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--block); color: #FFFFFF; }
.toast.err::before { content: "!"; color: #FFFFFF; }

/* ---------- Dispensar: estat buit ---------- */
.empty { display: grid; justify-items: center; text-align: center; padding: var(--sp-6) 0; }
.empty-title { font-size: clamp(32px, 4vw, 44px); }
.empty-sub { color: var(--ink-2); margin-top: var(--sp-2); font-size: 17px; }
.ways { display: grid; grid-template-columns: repeat(2, minmax(0, 300px)); gap: var(--sp-5); margin-top: var(--sp-6); }
.way { display: grid; justify-items: center; gap: var(--sp-2); padding: var(--sp-6) var(--sp-5); background: var(--surface); border-radius: var(--r-l); box-shadow: var(--sh-2); }
.way h2 { margin-top: var(--sp-3); }
.way p { color: var(--ink-2); font-size: 15px; }
.way-icon { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 50%; background: var(--warn-tint); color: var(--warn-ink); }
.way-icon svg { width: 28px; height: 28px; }

.results { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.result {
  display: grid; grid-template-columns: 88px 1fr auto; align-items: center; gap: var(--sp-4);
  min-height: 64px; padding: 0 var(--sp-5); text-align: left;
  background: var(--surface); border: 1.5px solid transparent; border-radius: var(--r-m); box-shadow: var(--sh-1);
  font: 500 16px var(--font); color: var(--ink); cursor: pointer; transition: border-color 150ms;
}
.result:hover { border-color: var(--primary); }
.result b { font-size: 22px; font-weight: 800; color: var(--primary); }
.result span:last-child { color: var(--ink-2); }

/* ---------- Dispensar: fitxa ---------- */
/* A dalt, a tota l'amplada, el cobrament (enganxat a dalt de la pantalla). A sota, dues columnes: la fitxa a
   l'esquerra ocupa totes les files; a la dreta, un sota l'altre, el producte, la caixa del soci i el bar.
   L'última fila és flexible: si la fitxa és més llarga, l'espai sobrant hi va a parar i no obre forats a la dreta. */
.dispense {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); grid-template-rows: auto repeat(4, auto) 1fr;
  gap: var(--sp-5); align-items: start;
}
.dispense > .checkout { grid-column: 1 / -1; grid-row: 1; }
.dispense > .member-sheet { grid-column: 1; grid-row: 2 / -1; }
.dispense > :not(.member-sheet):not(.checkout) { grid-column: 2; }
.dispense > .bar-sheet { order: 1; } /* el bar, al final: primer el producte */
/* Cobrament: pagament a l'esquerra, botó Dispensar amb el total a la dreta i el motiu a sota.
   Enganxat a dalt de la pantalla: es veu sempre, sense baixar, amb la fitxa llarga i el cistell ple. */
.checkout {
  position: sticky; z-index: 3; top: 0;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: center; gap: var(--sp-1) var(--sp-4);
  padding: var(--sp-3) var(--sp-4); box-shadow: 0 6px 18px -8px rgb(31 43 51 / 0.35), var(--sh-2);
}
.checkout .pay { margin: 0; }
.checkout .pay[hidden] ~ .go { grid-column: 1 / -1; }
.checkout .go { margin-top: 0; min-height: 64px; }
.checkout .go-note { grid-column: 2; margin: 0; min-height: 1.3em; }
.checkout .pay[hidden] ~ .go-note { grid-column: 1 / -1; }
.checkout .go-note:empty { min-height: 0; }
.till-sheet .till { margin-top: 0; padding-top: 0; border-top: 0; }
.member-sheet .who { display: flex; justify-content: space-between; gap: var(--sp-4); align-items: flex-start; }
.member-sheet { container-type: inline-size; }
/* El número s'ajusta a l'espai que deixen la foto i la rajola (2 × 148 px + espais) */
.member-num { font-size: clamp(44px, calc((100cqi - 380px) / 2.6), 84px); line-height: 0.9; font-weight: 800; letter-spacing: -0.04em; color: var(--primary); }
.member-name { font-size: 24px; font-weight: 700; margin-top: var(--sp-3); line-height: 1.2; }
.member-meta { color: var(--ink-2); margin-top: var(--sp-1); }
.who-text { flex: 1; min-width: 0; }
.member-edit { margin-top: var(--sp-2); font-size: 14px; }
.member-edit + .member-edit { margin-left: var(--sp-4); }

/* Finestra de dades del soci */
.member-dialog { width: min(560px, calc(100vw - 32px)); overflow-y: auto; overscroll-behavior: contain; }
.member-dialog .modal-head h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.015em; }
.md-form { display: grid; gap: var(--sp-4); }
.md-fields { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3) var(--sp-4); }
.md-wide { grid-column: 1 / -1; }
.md-fields .check { min-height: 40px; }
.md-fields textarea { padding: var(--sp-2) var(--sp-3); resize: vertical; }
.md-actions { border-top: 1px solid var(--line); padding-top: var(--sp-4); }
@media (max-width: 560px) { .md-fields { grid-template-columns: 1fr; } .member-dialog { padding: var(--sp-4); } }

/* Foto del soci: mateixa peça quadrada que la rajola, per reconèixer-lo d'un cop d'ull */
.photo {
  --size: 148px;
  flex: none; width: var(--size); height: var(--size); padding: 0; position: relative; overflow: hidden;
  display: grid; place-items: center; align-content: center; gap: var(--sp-1);
  background: linear-gradient(135deg, var(--primary-tint), var(--surface-2)); border: 0; border-radius: var(--r-m); cursor: pointer; color: var(--ink-2);
  font: 600 13px var(--font);
}
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .initials { font-size: 44px; font-weight: 800; letter-spacing: -0.02em; color: var(--primary); line-height: 1; }
.photo::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 2px transparent; transition: box-shadow 150ms; }
.photo:hover::after { box-shadow: inset 0 0 0 3px var(--primary); }

/* Chip del soci */
.link-chip { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); margin-top: var(--sp-4); }
.link-chip > .chip-wait, .link-chip > .chip-manual { grid-column: 1 / -1; }
.id-row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); min-height: 60px; padding: var(--sp-2) var(--sp-3); background: var(--surface-2); border-radius: var(--r-m); border: 1.5px solid transparent; }
.id-row.on { background: var(--ok-tint); }
.id-row p { flex: 1; min-width: 8em; display: grid; line-height: 1.25; }
.id-row small { color: var(--ink-2); font-size: 13px; }
.id-row.on small { color: var(--ok-ink); }
.id-ico { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--surface); color: var(--ink-3); }
.id-row.on .id-ico { color: var(--ok-ink); }
.id-ico svg { width: 20px; height: 20px; }
.link-chip code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-weight: 600; letter-spacing: 0.04em; }
.link-chip .btn { min-height: 38px; padding: 0 var(--sp-3); font-size: 14px; }
.chip-wait { display: flex; align-items: center; gap: var(--sp-3); font-weight: 700; width: 100%; color: var(--primary); }
.chip-pulse { width: 12px; height: 12px; flex: none; border-radius: 50%; background: var(--primary); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(0.6); opacity: 0.5; } }
.chip-manual { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--sp-2); width: 100%; }
.chip-manual input { min-height: 40px; }

/* Títols petits de la fitxa del soci */
.usual h3, .history h3 { font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 0; text-transform: uppercase; letter-spacing: 0.06em; }

/* Sol agafar: barra prima amb el pes de cada preu i fins a 3 propostes per oferir-li */
.usual { margin-top: var(--sp-3); }
.usual-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-1) var(--sp-3); margin-bottom: var(--sp-2); }
/* La mitjana és la xifra clau del bloc: gran i amb el color del preu més proper */
.usual-avg {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: 13px; font-weight: 700; color: var(--ink-2); white-space: nowrap;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.usual-avg strong {
  padding: 4px 12px; border-radius: 999px; background: var(--pc); color: var(--pc-ink);
  font-size: 20px; font-weight: 800; line-height: 1.2; letter-spacing: 0; text-transform: none;
  font-variant-numeric: tabular-nums;
}
.mix { display: flex; gap: 2px; height: 6px; margin-bottom: var(--sp-2); }
.mix span { flex-basis: 0; min-width: 4px; background: var(--pc); border-radius: 3px; }
.usual-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.usual-pick {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; max-width: 100%; padding: 4px 10px 4px 5px;
  font: 600 13px var(--font); color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line-2); border-radius: 999px; cursor: pointer;
  transition: border-color 150ms, background-color 150ms;
}
.usual-pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usual-pick small { font-size: 12px; font-weight: 700; color: var(--ink-3); }
.usual-pick .price-tag { min-width: 0; padding: 1px 7px; font-size: 11px; flex: none; }
.usual-pick:hover { border-color: var(--primary); }
.usual-pick[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-tint); }
.usual-pick:disabled { opacity: 0.5; cursor: default; }

/* La rajola d'estat */
.tile {
  --size: 148px;
  flex: none; width: var(--size); height: var(--size);
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 6px;
  background: var(--side); border-radius: var(--r-m);
}
.q { position: relative; border-radius: 4px; overflow: hidden; background: var(--line-2); }
.q::after { content: ""; position: absolute; inset: 22%; border: 3px solid rgb(255 255 255 / 0.85); }
.q-ok:nth-child(1), .q-ok:nth-child(4) { background: var(--ok); }
.q-ok:nth-child(2), .q-ok:nth-child(3) { background: var(--sky); }
/* Pètals orientats cap al centre: quan tots quatre casen, formen la flor */
.q:nth-child(1)::after { border-radius: 50% 0; }
.q:nth-child(2)::after { border-radius: 0 50%; }
.q:nth-child(3)::after { border-radius: 0 50%; }
.q:nth-child(4)::after { border-radius: 50% 0; }
.q-warn { background: repeating-linear-gradient(45deg, #E3A23A 0 7px, #C98A25 7px 14px); }
.q-block { background: repeating-linear-gradient(45deg, #D0533F 0 7px, #B0412F 7px 14px); }
.q-warn::after, .q-block::after { border-style: dashed; border-color: rgb(255 255 255 / 0.65); }
.tile.settle .q { animation: settle 520ms var(--ease-out) both; }
.tile.settle .q:nth-child(2) { animation-delay: 60ms; }
.tile.settle .q:nth-child(3) { animation-delay: 120ms; }
.tile.settle .q:nth-child(4) { animation-delay: 180ms; }
@keyframes settle { from { transform: scale(0.82); filter: blur(2px); } to { transform: none; filter: none; } }

.states { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); margin-top: var(--sp-5); }
.state { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); min-height: 52px; padding: 0 var(--sp-4); border-radius: var(--r-m); background: var(--surface-2); font-weight: 700; }
.state::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); flex: none; }
.state span { margin-left: auto; font-weight: 500; color: var(--ink-2); text-align: right; white-space: nowrap; }
.state.ok { background: var(--ok-tint); color: var(--ok-ink); }
.state.ok::before { background: var(--ok); }
.state.warn { background: var(--warn-tint); color: var(--warn-ink); }
.state.warn::before { background: var(--warn); }
.state.warn span { color: var(--warn-ink); font-weight: 600; }
.state.block { background: var(--block-tint); color: var(--block-ink); }
.state.block::before { background: var(--block); }
.state.block span { color: var(--block-ink); font-weight: 600; }

.meter { margin-top: var(--sp-5); }
.meter-head { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: var(--sp-2); }
.meter-head span { color: var(--ink-2); font-weight: 500; }
.cells { display: grid; grid-template-columns: repeat(var(--n, 30), 1fr); gap: 3px; }
.cells i { height: 20px; background: var(--line); border-radius: 3px; }
.cells i.f { background: var(--primary); }
.cells i.add { background: var(--warn); }

/* Historial compacte, al final de la fitxa */
.history { margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--line); }
.history h3 { margin-bottom: var(--sp-1); }
.history ol { list-style: none; margin: 0; padding: 0; }
.history li { display: grid; grid-template-columns: 8em auto minmax(0, 1fr) auto auto; align-items: center; gap: var(--sp-2); padding: 3px 0; font-size: 13px; line-height: 1.3; }
.history li + li { border-top: 1px solid var(--line); }
.history .when { color: var(--ink-2); }
.history .what { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history .paid { font-weight: 700; text-align: right; }
.history .price-tag { min-width: 0; padding: 1px 7px; font-size: 11px; }
/* Anul·lar una compra: botó discret a la fila; les anul·lades queden ratllades però visibles */
.void-btn { min-height: 32px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 999px; background: none; font: inherit; font-size: 12px; font-weight: 700; color: var(--ink-2); cursor: pointer; }
.void-btn:hover { border-color: var(--block); color: var(--block-ink); background: var(--block-tint); }
/* Full diari de control */
.date-input { width: auto; }
.daily-heading { font-weight: 600; margin-bottom: var(--sp-3); }
.daily-totals { margin-top: var(--sp-3); font-weight: 700; }
.table.daily td.sig { min-width: 140px; }
.table tr.voided td.sig { text-decoration: none; font-weight: 600; color: var(--block-ink); }
.table.daily td.sig img { display: block; height: 44px; width: auto; background: #FFFFFF; border-radius: 4px; }

/* Firma del soci */
.sign { width: min(680px, calc(100vw - 32px)); padding: var(--sp-5); border: 0; border-radius: var(--r-l, 16px); background: var(--surface, #fff); color: inherit; box-shadow: 0 12px 40px rgb(0 0 0 / 0.25); }
.sign::backdrop { background: rgb(15 22 27 / 0.55); }
.sign-who { font-size: 20px; font-weight: 800; margin-top: var(--sp-2); }
.sign-what { color: var(--ink-2); }
.sign canvas { display: block; width: 100%; height: auto; aspect-ratio: 640 / 240; touch-action: none; cursor: crosshair; background: #FFFFFF; border: 2px dashed var(--line, #ccc); border-radius: 12px; }
.sign .actions { justify-content: flex-end; }

@media print {
  body { background: #FFFFFF; color: #000000; }
  .side, .side-nav, .toast, .panel-head .actions { display: none !important; }
  .table-wrap { overflow: visible; border: 0; background: none; }
}

.void-tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--block-tint); color: var(--block-ink); text-decoration: none; }
.history li.voided .when, .history li.voided .what, .history li.voided .paid,
.table tr.voided td:not(:nth-child(3)) { text-decoration: line-through; color: var(--ink-3); }
.history li.voided .price-tag { opacity: 0.45; }
.btn-danger { background: var(--block-tint); color: var(--block-ink); border-color: var(--block); }
.btn-danger:hover:not(:disabled) { box-shadow: inset 0 0 0 1px var(--block); }
.void-form { display: grid; gap: var(--sp-3); }
.void-form p { margin: 0; }
.void-what { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sp-2); padding: var(--sp-3); border-radius: var(--r-m); background: var(--surface-2); }
.void-what span { color: var(--ink-2); }

/* Colors per preu: del més barat al més car */
.price-verdigris { --pc: var(--ok); --pc-ink: #FFFFFF; }
.price-blue { --pc: var(--sky); --pc-ink: #FFFFFF; }
.price-ochre { --pc: var(--warn); --pc-ink: #1D2433; }
.price-ox { --pc: var(--block); --pc-ink: #FFFFFF; }
.price-tag {
  display: inline-flex; align-items: center; justify-content: center; min-width: 5.2em; padding: 3px 10px;
  background: var(--pc); color: var(--pc-ink); border-radius: 999px;
  font-size: 13px; font-weight: 800; white-space: nowrap;
}


/* Selecció de producte i quantitat */
.picker h2 { margin-bottom: var(--sp-3); }
.picker-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.picker-head h2 { margin: 0; }
.product-search { position: relative; flex: 0 1 260px; min-width: 0; }
.product-search svg { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.product-search input { min-height: 44px; padding-left: 38px; }
.product-none { margin-bottom: var(--sp-3); }
.product[hidden] { display: none; }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--sp-3); }
.product {
  display: grid; gap: var(--sp-2); text-align: left; padding: var(--sp-4);
  background: var(--surface-2); border: 2px solid transparent; border-radius: var(--r-m);
  font: 500 15px var(--font); color: var(--ink-2); cursor: pointer;
  transition: border-color 150ms, box-shadow 200ms var(--ease-out), background-color 150ms;
}
.product b { font-size: 17px; color: var(--ink); }
.product .row { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); }
.product:hover { border-color: var(--line-2); background: var(--surface); }
.product[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-tint); box-shadow: 0 8px 20px -12px var(--primary); }
.product .low { color: var(--block-ink); font-weight: 700; }
.product:disabled { opacity: 0.5; cursor: not-allowed; }

/* La quantitat va a dalt de la zona de producte (a prop del botó Dispensar); el títol «Producte» i la llista, a sota */
.qty-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.picker .picker-head { margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--line); }
.qty-head h2 { margin: 0; }
.seg { display: inline-grid; grid-auto-flow: column; padding: 4px; gap: 4px; background: var(--surface-2); border-radius: var(--r-m); }
.seg button {
  min-height: 40px; min-width: 84px; padding: 0 var(--sp-4); border: 0; border-radius: 9px; background: transparent;
  font: 700 15px var(--font); color: var(--ink-2); cursor: pointer; transition: background-color 150ms, color 150ms;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--primary); box-shadow: var(--sh-1); }
.qty { display: grid; grid-template-columns: repeat(var(--chips, 4), minmax(0, 1fr)) 1.4fr; gap: var(--sp-2); margin-top: var(--sp-3); }
.qty-equiv { margin-top: var(--sp-2); min-height: 1.5em; color: var(--ink-2); font-size: 15px; }
.chip {
  min-height: 56px; border: 1.5px solid var(--line-2); border-radius: var(--r-m); background: var(--surface);
  font: 700 18px var(--font); color: var(--ink); cursor: pointer; transition: border-color 150ms, background-color 150ms;
}
.chip:hover { border-color: var(--primary); }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.qty input { min-height: 56px; font-size: 18px; font-weight: 700; text-align: center; }

.go {
  width: 100%; margin-top: var(--sp-4); min-height: 72px; padding: 0 var(--sp-5);
  display: flex; align-items: center; justify-content: space-between;
  border: 0; border-radius: var(--r-l); background: var(--primary); color: var(--on-primary);
  font: 800 20px var(--font); cursor: pointer; box-shadow: 0 12px 24px -12px var(--primary);
  transition: background-color 150ms, box-shadow 150ms;
}
.go:hover:not(:disabled) { background: var(--primary-2); }
.go .total { background: rgb(255 255 255 / 0.18); padding: 4px 12px; border-radius: 999px; }
.go .total:empty { display: none; }
.go:disabled { background: var(--line); color: var(--ink-3); cursor: not-allowed; box-shadow: none; }
.go:disabled .total { background: transparent; }
.go-note { margin-top: var(--sp-2); min-height: 1.5em; font-weight: 600; font-size: 14px; color: var(--block-ink); }
.go-note.warn { color: var(--warn-ink); }

/* Cistell: diverses línies en una sola venda */
.equiv-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-top: var(--sp-2); }
.equiv-row .qty-equiv { margin: 0; flex: 1 1 auto; min-width: 0; }
.add-cart { flex: 0 0 auto; min-height: 44px; padding: 0 var(--sp-4); font-size: 15px; }
.add-cart:disabled { opacity: 0.45; box-shadow: none; }
.cart { margin-top: var(--sp-3); padding: var(--sp-3) var(--sp-4); border: 1.5px solid var(--line-2); border-radius: var(--r-m); background: var(--surface-2); }
.cart h3 { margin: 0 0 var(--sp-1); font-size: 13px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.06em; }
.cart ul { list-style: none; margin: 0; padding: 0; }
.cart li { display: grid; grid-template-columns: minmax(0, 1fr) auto 6.5em 44px; align-items: center; gap: var(--sp-2); min-height: 44px; font-size: 15px; }
.cart li + li { border-top: 1px solid var(--line); }
.cart .what { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.cart .g { color: var(--ink-2); }
.cart .paid { font-weight: 700; text-align: right; }
.cart li.pending { color: var(--ink-2); }
.cart li.pending .what { font-weight: 600; }
.pending-tag { display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 999px; background: var(--surface); font-size: 11px; font-weight: 700; color: var(--ink-2); }
.cart-remove { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 999px; background: none; color: var(--ink-2); cursor: pointer; }
.cart-remove svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.cart-remove:hover { color: var(--block-ink); background: var(--block-tint); }
.cart-sum { display: grid; grid-template-columns: minmax(0, 1fr) auto 6.5em 44px; gap: var(--sp-2); margin: 0; padding-top: var(--sp-2); border-top: 1.5px solid var(--line-2); font-size: 16px; }
.cart-sum b:last-child { text-align: right; }
.cart-after { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-4); margin: var(--sp-1) 0 0; font-size: 13px; color: var(--ink-2); }
.cart-after .neg { color: var(--block-ink); font-weight: 700; }
/* Historial: les línies d'una venda queden unides per una marca al costat */
.history li.in-sale { box-shadow: inset 3px 0 0 var(--line-2); padding-left: 8px; }
.history li.same-sale { border-top-color: transparent; }
.history li.same-sale .when { color: transparent; }
/* ---------- Bàscula ---------- */
/* Pes real en gran, comparat amb el demanat. L'estat va sempre amb text (Dins / Fora de marge) i, fora de marge, ratllat */
.scale {
  margin-top: var(--sp-4); padding: var(--sp-4); border-radius: var(--r-l);
  background: var(--surface-2); border: 2px solid var(--line-2);
  --tone: var(--ink-2); --tone-ink: var(--ink-2); --tone-tint: transparent;
}
.scale[data-state="ok"] { --tone: var(--ok); --tone-ink: var(--ok-ink); --tone-tint: var(--ok-tint); border-color: var(--ok); }
.scale[data-state="warn"], .scale[data-state="moving"] { --tone: var(--warn); --tone-ink: var(--warn-ink); --tone-tint: var(--warn-tint); border-color: var(--warn); }
.scale[data-state="block"] { --tone: var(--block); --tone-ink: var(--block-ink); --tone-tint: var(--block-tint); border-color: var(--block); }
.scale[data-state="warn"], .scale[data-state="block"] {
  background: repeating-linear-gradient(135deg, var(--tone-tint) 0 10px, var(--surface-2) 10px 20px);
}
.scale-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.scale-tools { display: flex; gap: var(--sp-2); }
.scale-tools .btn { min-height: 40px; }
.scale-read { display: flex; align-items: baseline; gap: var(--sp-2); margin-top: var(--sp-3); flex-wrap: wrap; }
.scale .scale-weight {
  width: 6.2ch; min-height: 0; padding: 0 var(--sp-2); border-radius: var(--r-m);
  font: 800 clamp(48px, 6vw, 72px)/1.1 var(--font); letter-spacing: -0.04em; text-align: right;
  font-variant-numeric: tabular-nums; color: var(--ink); background: var(--surface);
}
.scale .scale-weight[readonly] { background: transparent; border-color: transparent; }
.scale-unit { font: 800 28px var(--font); color: var(--ink-2); }
.scale-verdict { display: grid; margin-left: auto; text-align: right; }
.scale-verdict b { font-size: 18px; color: var(--tone-ink); }
.scale-verdict span { font-size: 22px; font-weight: 800; color: var(--tone-ink); }
.scale-gauge { position: relative; height: 14px; margin-top: var(--sp-3); border-radius: 999px; background: var(--line); }
.scale-gauge .band { position: absolute; top: 0; bottom: 0; left: var(--lo); right: calc(100% - var(--hi)); background: var(--ok-tint); border: 2px solid var(--ok); border-radius: 999px; }
.scale-gauge .mark { position: absolute; top: -3px; bottom: -3px; left: 50%; width: 2px; background: var(--ink-2); }
.scale-gauge .needle { position: absolute; top: -6px; bottom: -6px; left: var(--at); width: 6px; margin-left: -3px; border-radius: 3px; background: var(--tone); opacity: 0; transition: left 120ms linear; }
.scale-gauge.has-weight .needle { opacity: 1; }
.scale-target { margin-top: var(--sp-2); font-size: 15px; color: var(--ink-2); }
.scale-link { margin-top: var(--sp-1); font-size: 13px; color: var(--ink-3); }
.go.go-out:not(:disabled) { background: var(--warn); color: #1D2433; box-shadow: none; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
@media (max-width: 560px) { .field-pair { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .scale-gauge .needle { transition: none; } }

.till { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); margin-top: var(--sp-5); padding-top: var(--sp-5); border-top: 1px solid var(--line); }
.till form { display: grid; gap: var(--sp-2); align-content: start; }
.till h3 { font-size: 15px; font-weight: 700; margin: 0; }
.till .inline { display: grid; grid-template-columns: minmax(96px, 1fr) minmax(0, 1fr); gap: var(--sp-2); }

/* ---------- Taules ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--r-l); box-shadow: var(--sh-2); }
.table-wrap.flush { box-shadow: none; background: transparent; border-radius: 0; margin: 0 calc(var(--sp-5) * -1); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.06em; padding: var(--sp-3) var(--sp-5); background: var(--surface-2); white-space: nowrap; }
.table-wrap.flush .table th { background: transparent; border-bottom: 1px solid var(--line); }
.table td { padding: var(--sp-3) var(--sp-5); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table td.num b { color: var(--primary); }
.table .low { color: var(--block-ink); font-weight: 700; }
.table tbody tr.link { cursor: pointer; transition: background-color 120ms; }
.table tbody tr.link:hover { background: var(--primary-tint); }
.table .row-link { color: inherit; text-decoration: none; }
.table .row-link:hover, .table .row-link:focus-visible { text-decoration: underline; }
.table td.empty-row { text-align: center; color: var(--ink-2); padding: var(--sp-6); white-space: normal; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-weight: 700; font-size: 13px; background: var(--ok-tint); color: var(--ok-ink); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.pill.off { background: var(--surface-2); color: var(--ink-2); }
.pill.off::before { background: var(--ink-3); }
.pill.bad { background: var(--block-tint); color: var(--block-ink); }
.pill.bad::before { background: var(--block); }
.stock-adjust { display: flex; gap: var(--sp-2); }
.stock-adjust input { width: 110px; min-height: 40px; }
.stock-adjust .btn { min-height: 40px; padding: 0 var(--sp-4); }

/* ---------- Caixa ---------- */
textarea { padding: var(--sp-3); line-height: 1.4; resize: vertical; min-height: 88px; }
.steps { list-style: none; display: flex; gap: var(--sp-2); padding: 0; margin: 0 0 var(--sp-5); flex-wrap: wrap; }
.steps li { display: flex; align-items: center; gap: var(--sp-2); padding: 6px 14px 6px 6px; border-radius: 999px; background: var(--surface); box-shadow: var(--sh-1); font-weight: 700; color: var(--ink-3); }
.steps li span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); font-size: 14px; }
.steps li span svg { width: 16px; height: 16px; stroke-width: 3; }
.steps li.now { color: var(--ink); }
.steps li.now span { background: var(--primary); color: var(--on-primary); }
.steps li.done { color: var(--ok-ink); }
.steps li.done span { background: var(--ok); color: #FFFFFF; }

.cash-hint { display: grid; gap: var(--sp-3); margin-bottom: var(--sp-5); font-size: 17px; }
.cash-chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
/* Pistes de teclat: només on n'hi ha (a la tauleta no diuen res) */
.kbd-hint { font-size: 14px; color: var(--ink-2); line-height: 1.8; }
.btn-keys { display: inline-flex; align-items: center; gap: 2px; margin-left: var(--sp-2); font-size: 12px; font-weight: 600; opacity: 0.85; }
.btn-keys kbd { background: transparent; color: inherit; border-color: currentColor; }
@media (hover: none), (pointer: coarse) { .kbd-hint, .btn-keys { display: none; } }
.confirm-dialog h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.015em; }
.confirm-dialog p { font-size: 16px; }
.confirm-dialog .actions > .btn { flex: 1 1 auto; }
.kbd-btn { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--primary); color: var(--on-primary); font-weight: 800; }
.den-group { margin-bottom: var(--sp-4); }
.dens { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: var(--sp-3); }
.dens-bill { --cols: 6; }
.den { display: grid; gap: var(--sp-2); justify-items: center; padding: var(--sp-3); border-radius: var(--r-m); background: var(--surface-2); border: 2px solid transparent; transition: border-color 150ms, background-color 150ms; }
.den.has { border-color: var(--primary); background: var(--primary-tint); }
.den-face { display: grid; place-items: center; font-weight: 800; font-size: 20px; letter-spacing: -0.01em; color: #1D2433; }
.den-bill .den-face { width: 100%; height: 56px; border-radius: 6px; box-shadow: inset 0 0 0 3px rgb(255 255 255 / 0.45); }
.d-500 .den-face { background: #B9BEC6; }
.d-1000 .den-face { background: #E59B8C; }
.d-2000 .den-face { background: #8DB4E2; }
.d-5000 .den-face { background: #F0B866; }
.d-10000 .den-face { background: #8CC9A9; }
.d-20000 .den-face { background: #E9D27A; }
.den-coin .den-face { width: 60px; height: 60px; border-radius: 50%; font-size: 15px; box-shadow: inset 0 0 0 4px rgb(255 255 255 / 0.35), 0 2px 0 rgb(0 0 0 / 0.12); }
.d-200 .den-face, .d-100 .den-face { background: radial-gradient(circle, #E3C66A 0 46%, #C9CDD3 47%); }
.d-100 .den-face { background: radial-gradient(circle, #C9CDD3 0 46%, #E3C66A 47%); }
.d-50 .den-face, .d-20 .den-face, .d-10 .den-face { background: #E3C66A; }
.d-5 .den-face, .d-2 .den-face, .d-1 .den-face { background: #D29A6E; }
.den-ctrl { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 6px; width: 100%; }
.den-btn { height: 52px; border: 0; border-radius: var(--r-m); background: var(--surface); box-shadow: var(--sh-1); color: var(--ink); cursor: pointer; display: grid; place-items: center; transition: background-color 120ms, transform 120ms; }
.den-btn[data-step="1"] { background: var(--primary); color: var(--on-primary); }
.den-btn:active { transform: scale(0.94); }
.den-btn svg { width: 22px; height: 22px; stroke-width: 2.6; }
.den-n { min-height: 52px; padding: 0 4px; text-align: center; font-size: 22px; font-weight: 800; }
.den-sub { min-height: 1.3em; font-weight: 700; color: var(--primary); }

.cash-bar {
  position: sticky; bottom: var(--sp-4); z-index: 4; display: flex; align-items: center; gap: var(--sp-3);
  margin-top: var(--sp-5); padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-5);
  background: var(--surface); border-radius: var(--r-l); box-shadow: 0 16px 40px -16px rgb(29 36 51 / 0.45), var(--sh-1);
}
.cash-bar > div { display: grid; margin-right: auto; line-height: 1.1; }
.cash-bar small { color: var(--ink-2); font-weight: 600; }
.cash-bar b { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; }

.verdict { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-5); border-radius: var(--r-l); margin-bottom: var(--sp-5); }
.verdict h2 { font-size: clamp(26px, 3.2vw, 36px); font-weight: 800; letter-spacing: -0.02em; }
.verdict p { margin-top: var(--sp-1); font-size: 16px; }
.verdict-icon { width: 64px; height: 64px; flex: none; display: grid; place-items: center; border-radius: 50%; color: #FFFFFF; font-size: 34px; font-weight: 800; }
.verdict-icon svg { width: 34px; height: 34px; stroke-width: 3; }
.verdict.ok { background: var(--ok-tint); color: var(--ok-ink); }
.verdict.ok .verdict-icon { background: var(--ok); }
.verdict.warn { background: var(--warn-tint); color: var(--warn-ink); }
.verdict.warn .verdict-icon { background: var(--warn); }
.verdict.bad { background: var(--block-tint); color: var(--block-ink); }
.verdict.bad .verdict-icon { background: var(--block); }

.cash-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
.cash-lines { margin: 0; display: grid; }
.cash-lines div { display: flex; justify-content: space-between; gap: var(--sp-3); padding: 10px 0; border-top: 1px solid var(--line); }
.cash-lines div:first-child { border-top: 0; }
.cash-lines dt { color: var(--ink-2); }
.cash-lines dd { margin: 0; font-weight: 700; }
.cash-lines .sum dt { color: var(--ink); font-weight: 700; }
.cash-lines .sum dd { font-size: 18px; font-weight: 800; }
.cash-lines dd.neg { color: var(--block-ink); }
.cash-lines dd.pos { color: var(--warn-ink); }
.cash-aside { margin-top: var(--sp-3); font-size: 14px; }
.cash-note { margin-top: var(--sp-4); }
.out-box { display: grid; gap: var(--sp-4); }
.out-box > h2 { margin-bottom: 0; }
.out-take { display: grid; padding: var(--sp-4); border-radius: var(--r-m); background: var(--warn-tint); color: var(--warn-ink); }
.out-take small { font-weight: 700; font-size: 14px; }
.out-take b { font-size: 36px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); }
.cash-done { max-width: 720px; display: grid; gap: var(--sp-4); }
.cash-done .verdict { margin-bottom: 0; }
.done-figs { display: grid; grid-template-columns: 1.3fr 1fr; gap: var(--sp-3); }
.done-figs .out-take:not(.big) { background: var(--surface-2); color: var(--ink-2); }
.done-figs .out-take:not(.big) b { font-size: 28px; }
.cash-history { margin-top: var(--sp-6); }
.note-cell { white-space: normal !important; min-width: 180px; color: var(--ink-2); }
.pill.warn { background: var(--warn-tint); color: var(--warn-ink); }
.pill.warn::before { background: var(--warn); }

@media print {
  body { background: #FFFFFF; }
  .side, .topbar, .panel-head, .steps, .no-print, .cash-history, .toast { display: none !important; }
  .shell { display: block; }
  .work { padding: 0; }
  .cash-done { box-shadow: none; max-width: none; }
}

/* ---------- Configuració ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--sp-5); align-items: start; }
.settings-grid .sheet > h2 { margin-bottom: 0; }
.settings-grid .sheet:last-child { grid-column: 1 / -1; }
.saved { align-self: center; font-weight: 600; color: var(--ok-ink); }
.staff-list { list-style: none; margin: var(--sp-4) 0 0; padding: 0; }
.staff-list li { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-4) 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.staff-list li:first-child { border-top: 0; }
.staff-list li.is-target { background: var(--primary-tint); border-radius: var(--r-m); padding-inline: var(--sp-3); }
.staff-list li.off { opacity: 0.6; }
.staff-who { display: grid; gap: 2px; flex: 1; min-width: 200px; }
.staff-who .pill { margin-left: var(--sp-2); vertical-align: 2px; }
.staff-list small { display: block; color: var(--ink-2); font-size: 14px; }
.staff-list .chip-wait { font-size: 14px; }
.staff-zones { flex-basis: 100%; display: grid; gap: var(--sp-3); justify-items: start; }
.staff-zones fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); }
.staff-zones legend { font-weight: 600; margin-bottom: var(--sp-2); }
.staff-zones .check { display: flex; align-items: center; gap: var(--sp-2); font-size: 15px; }
.staff-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.staff-list .btn { min-height: 40px; padding: 0 var(--sp-3); font-size: 15px; }
.staff-form { margin-top: var(--sp-5); padding-top: var(--sp-5); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); align-items: end; }
.staff-form h3, .staff-form .form-error { grid-column: 1 / -1; margin: 0; font-size: 16px; }
.staff-form .form-error { font-size: 14px; }

/* ---------- Tauler ---------- */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--sp-4); margin: 0 0 var(--sp-5); }
.fig { --tone: var(--primary); --tone-tint: var(--primary-tint); position: relative; padding: var(--sp-5); background: var(--surface); border-radius: var(--r-l); box-shadow: var(--sh-2); overflow: hidden; }
.fig::after { content: ""; position: absolute; right: -24px; bottom: -24px; width: 88px; height: 88px; border-radius: 50% 0; background: var(--tone-tint); }
.fig-teal { --tone: var(--ok-ink); --tone-tint: var(--ok-tint); }
.fig-amber { --tone: var(--warn-ink); --tone-tint: var(--warn-tint); }
.fig-rose { --tone: var(--block-ink); --tone-tint: var(--rose-tint); }
.fig-violet { --tone: var(--violet); --tone-tint: var(--violet-tint); }
.fig-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--tone-tint); color: var(--tone); margin-bottom: var(--sp-4); }
.figures dt { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.figures dd { position: relative; z-index: 1; margin: var(--sp-1) 0 0; font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
.stock-list { list-style: none; margin: 0; padding: 0; }
.stock-list li { display: flex; justify-content: space-between; align-items: center; padding: var(--sp-3) 0; border-top: 1px solid var(--line); }
.stock-list li:first-child { border-top: 0; }
.stock-list b { color: var(--block-ink); background: var(--block-tint); padding: 2px 10px; border-radius: 999px; font-size: 14px; }

/* ---------- Adaptació ---------- */
@media (max-width: 1100px) {
  .auth { grid-template-columns: minmax(0, 0.8fr) minmax(400px, 1fr); }
  .shell { grid-template-columns: 88px minmax(0, 1fr); }
  .side { padding: var(--sp-5) var(--sp-2); align-items: center; }
  .side-brand-text, .me-text { display: none; }
  .side-brand, .me { padding: 0; justify-content: center; }
  .side-nav { width: 100%; }
  .side-nav a, .side-out { flex-direction: column; justify-content: center; gap: 4px; min-height: 64px; padding: 0; font-size: 12px; }
  .side-nav a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--warn); }
  .side-foot { width: 100%; justify-items: center; }
  .side-out { width: 100%; }
  .side-lang { width: 100%; flex-direction: column; justify-content: center; gap: 4px; min-height: 56px; padding: 0; font-size: 12px; }
  .side-lang .lang-name, .side-lang .lang-arrow { display: none; }
  .side-lang .lang-code { display: inline; }
  .dash-grid { grid-template-columns: 1fr; }
  .work { padding-inline: var(--sp-5); }
  .tile, .photo { --size: 124px; }
  .products { grid-template-columns: 1fr 1fr; }
  .reader span:last-child { display: none; }
  .dens-bill { --cols: 3; }
  .reader { width: 48px; padding: 0; justify-content: center; }
}
@media (max-width: 900px) {
  .dispense { grid-template-columns: 1fr; grid-template-rows: none; }
  .dispense > .checkout, .dispense > .member-sheet, .dispense > :not(.member-sheet):not(.checkout) { grid-column: auto; grid-row: auto; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .brand-compact { display: flex; }
}
@media (max-width: 760px) {
  h1 { font-size: 26px; }
  .shell { grid-template-columns: 1fr; padding-bottom: 76px; }
  .side {
    position: fixed; z-index: 5; inset: auto 0 0 0; top: auto; height: auto; width: 100%;
    flex-direction: row; padding: 4px var(--sp-2) calc(4px + env(safe-area-inset-bottom)); gap: 0;
    box-shadow: 0 -6px 20px -10px rgb(0 0 0 / 0.35);
  }
  .side-brand, .me { display: none; }
  .side-nav { display: flex; flex: 1; gap: 0; min-width: 0; }
  .side-foot { display: flex; margin: 0; padding: 0; border: 0; width: auto; }
  .side-lang { flex: 0 0 44px; width: auto; min-height: 60px; font-size: 10.5px; }
  .side-nav a, .side-out { flex: 1; min-width: 0; min-height: 60px; font-size: 10.5px; }
  .side-nav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side-out { flex: 0 0 44px; }
  .side-out span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .side-nav a[aria-current="page"] { box-shadow: inset 0 3px 0 var(--warn); }
  .work { padding: var(--sp-4) var(--sp-4) var(--sp-6); }
  .topbar { margin-bottom: var(--sp-5); }
  .search { height: 54px; padding: 0 var(--sp-4); }
  .search input { font-size: 18px; }
  .search kbd { display: none; }
  .ways { grid-template-columns: 1fr; width: 100%; gap: var(--sp-3); margin-top: var(--sp-5); }
  .way { padding: var(--sp-5); }
  .tile { --size: 108px; }
  .member-sheet .who { flex-wrap: wrap; }
  .photo { --size: 108px; }
  .who-text { order: 3; flex-basis: 100%; }
  .member-num { font-size: 56px; }
  .history li { grid-template-columns: auto auto minmax(0, 1fr) auto auto; gap: 6px; font-size: 12px; }
  .cart { padding: var(--sp-2) var(--sp-3); }
  /* Al mòbil, el cobrament en una columna i més compacte: el selector ja diu «Mètode de pagament» al lector de pantalla */
  .checkout { grid-template-columns: 1fr; padding: var(--sp-2) var(--sp-3); }
  .checkout .pay-row:not(.pay-rest) > .pay-label { display: none; }
  .checkout .go { min-height: 56px; font-size: 18px; }
  .checkout .go-note { grid-column: auto; font-size: 13px; }
  .cart li, .cart-sum { grid-template-columns: minmax(0, 1fr) auto 5.5em 44px; gap: 6px; font-size: 14px; }
  .chip-manual { grid-template-columns: 1fr 1fr; }
  .chip-manual input { grid-column: 1 / -1; }
  .states, .till, .link-chip, .cash-grid, .done-figs { grid-template-columns: 1fr; }
  /* Al mòbil, una fila per bitllet o moneda: imatge a l'esquerra, botons a la dreta */
  .dens, .dens-bill { --cols: 1; gap: var(--sp-2); }
  .den-group { padding: var(--sp-4); }
  .den { grid-template-columns: 76px minmax(0, 1fr); align-items: center; column-gap: var(--sp-3); row-gap: 2px; padding: var(--sp-2); }
  .den-bill .den-face { height: 44px; font-size: 16px; }
  .den-coin .den-face { width: 48px; height: 48px; font-size: 12px; justify-self: center; }
  .den-sub { grid-column: 2; justify-self: center; min-height: 0; font-size: 13px; }
  .den-sub:empty { display: none; }
  .den-ctrl { grid-template-columns: 52px minmax(0, 1fr) 52px; }
  .den-btn, .den-n { height: 52px; min-height: 52px; }
  .steps { gap: 6px; }
  .steps li { padding-right: 10px; }
  .cash-bar { bottom: 84px; flex-wrap: wrap; padding: var(--sp-3); }
  .cash-bar b { font-size: 26px; }
  .cash-bar #cash-check { flex: 1 1 100%; }
  .steps li { font-size: 13px; }
  .products { grid-template-columns: 1fr 1fr; }
  .product { padding: var(--sp-3); }
  .qty { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
  .qty input { grid-column: 1 / -1; }
  .settings-grid { grid-template-columns: 1fr; }
  .result { grid-template-columns: 64px 1fr; padding: 0 var(--sp-4); }
  .result span:last-child { display: none; }
  .figures { grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
  .fig { padding: var(--sp-4); }
  .figures dd { font-size: 24px; }
  .toast { bottom: 92px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Camps obligatoris: asterisc (no només color) i avís de camps que falten a la fitxa */
.req-mark { color: var(--block-ink); font-weight: 800; }
.member-missing { display: flex; align-items: center; gap: 6px; margin: 4px 0; font-size: 13px; font-weight: 700; color: var(--warn-ink); }
.member-missing svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; }
.fee-periods, .req-fields { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); }
.fee-periods legend, .req-fields legend { font-weight: 700; margin-bottom: var(--sp-1); }
.fee-seg { margin-bottom: var(--sp-2); }

/* Registre d'activitat */
.audit-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--sp-3); align-items: end; margin-bottom: var(--sp-4); }
.audit-chip { grid-column: 1 / -1; display: inline-flex; align-items: center; gap: var(--sp-2); justify-self: start; margin: 0; padding: 2px 4px 2px 12px; border-radius: 999px; background: var(--primary-tint); color: var(--primary); font-weight: 700; }
.audit-list { list-style: none; margin: 0 0 var(--sp-3); padding: 0; }
.audit-row { display: grid; grid-template-columns: 9em minmax(0, 1fr) auto; gap: 2px var(--sp-3); padding: var(--sp-2) 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.audit-when, .audit-who { color: var(--ink-2); }
.audit-changes { grid-column: 2 / -1; list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 13px; color: var(--ink-2); }
.audit-changes b { color: var(--ink); font-weight: 700; }
.audit-old { text-decoration: line-through; color: var(--ink-3); }
.audit-empty { padding: var(--sp-4) 0; }
@media (max-width: 640px) {
  .audit-row { grid-template-columns: 1fr auto; }
  .audit-what, .audit-changes { grid-column: 1 / -1; }
}

/* Configuració per seccions: menú a l'esquerra i una sola columna de targetes */
.settings-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
.settings-nav { position: sticky; top: var(--sp-4); display: grid; gap: 4px; }
.settings-nav a { display: grid; gap: 2px; text-align: left; text-decoration: none; padding: 10px 14px; border: 1px solid transparent; border-radius: var(--r-m); background: none; font: inherit; color: var(--ink); cursor: pointer; }
.settings-nav a small { color: var(--ink-2); font-size: 12px; line-height: 1.3; }
.settings-nav a:hover { background: var(--surface-2); }
.settings-nav a[aria-current="true"] { background: var(--surface); border-color: var(--line-2); box-shadow: var(--sh-1); }
.settings-nav a[aria-current="true"] b { color: var(--primary); }
.settings-layout .settings-grid { grid-template-columns: minmax(0, 720px); }
.settings-layout .settings-grid .sheet:last-child { grid-column: auto; }
@media (max-width: 860px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: flex; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .settings-nav a { flex: none; padding: 8px 12px; }
  .settings-nav a small { display: none; }
}
/* Comentaris i incidències de la fitxa del soci */
.notes { margin: var(--sp-3, 12px) 0; }
.notes-alert { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; padding: 8px 12px; border-radius: 10px; font-weight: 700; background: var(--block-tint); color: var(--block-ink); }
.notes-alert svg, .note-flag svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; }
.notes summary { cursor: pointer; font-weight: 700; min-height: 32px; }
.note-form { display: grid; gap: 6px; margin: 8px 0; }
.note-form textarea { width: 100%; font: inherit; padding: 8px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface, transparent); color: inherit; }
.note-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.note { padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 10px; }
.note-incident { border-color: var(--block); background: var(--block-tint); }
.note-text { margin: 0 0 4px; white-space: pre-wrap; }
.note-flag { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--block-ink); }
.note-meta { margin: 0; font-size: 12px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.bar-qty { max-width: 110px; }
.bar-sheet .products { margin-top: 8px; }

/* Avisos del club (Configuració → Espai del soci) */
.notice-list { list-style: none; margin: 0; padding: 0; }
.notice-list li { display: flex; align-items: flex-start; gap: var(--sp-4); padding: var(--sp-3) 0; border-top: 1px solid var(--line); }
.notice-list li:first-child { border-top: 0; }
.notice-list li.off { opacity: 0.55; }
.notice-list .notice-text { flex: 1; min-width: 0; margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.notice-list .notice-text small { display: block; color: var(--ink-2); margin-top: var(--sp-1); }
.notice-list .empty { color: var(--ink-2); }
