/* Sistema de disseny: sobri, llegible en tauleta, mode fosc automàtic. Tot amb classes: la CSP no permet estils en línia. */
:root {
  --bg: #f3f5f4; --card: #ffffff; --ink: #14201b; --muted: #5b6b64; --line: #dbe2de; --soft: #eaf0ed;
  --brand: #1b6b50; --brand-ink: #ffffff; --brand-soft: #e1f0ea; --danger: #b3261e; --danger-soft: #fbeae8;
  --warn: #8a5a00; --warn-soft: #fbf1dc; --ok: #1b6b50; --radius: 14px; --shadow: 0 1px 2px rgba(16, 32, 26, .06), 0 4px 14px rgba(16, 32, 26, .05);
  --side: 232px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1412; --card: #19201d; --ink: #e8efec; --muted: #9aaba3; --line: #2b3732; --soft: #212b27;
          --brand: #3aa882; --brand-ink: #06130e; --brand-soft: #173026; --danger: #ff8a80; --danger-soft: #3a1f1c;
          --warn: #ffc266; --warn-soft: #3a2f17; --ok: #5fd0a6; --shadow: none; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1 { font-size: 1.25rem; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.35rem; margin: 0 0 4px; letter-spacing: -.01em; }
h3 { font-size: .95rem; margin: 18px 0 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.lead { color: var(--muted); margin: 0 0 16px; }

/* Estructura: barra lateral (escriptori) / pestanyes inferiors (mòbil) */
#app { min-height: 100vh; }
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { align-self: stretch; min-height: 100vh; background: linear-gradient(180deg, #8dc177 0%, #4aa38a 100%); background-attachment: fixed; color: #fff; }
.side-in { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; font-weight: 650; border-bottom: 1px solid rgba(255, 255, 255, .28); }
.brand .logo { width: 36px; height: 36px; border-radius: 50%; background: rgba(255, 255, 255, .92); color: #3f8f73; display: grid; place-items: center; font-weight: 700; }
.brand small { display: block; color: rgba(255, 255, 255, .85); font-size: .78rem; font-weight: 400; }
nav.tabs { display: flex; flex-direction: column; gap: 0; flex: 1 0 auto; }
nav.tabs button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 6px 18px; border: 0; border-bottom: 1px solid rgba(255, 255, 255, .28); border-radius: 0; background: transparent; color: #fff; font-weight: 500; text-align: left; }
nav.tabs button:hover { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .28); }
nav.tabs button[aria-current="page"] { background: rgba(0, 0, 0, .18); color: #fff; font-weight: 650; box-shadow: inset 3px 0 0 #f4e27a; }
nav.tabs .sub-group { background: rgba(0, 0, 0, .1); }
nav.tabs button.sub { min-height: 38px; padding: 4px 18px 4px 50px; font-size: .9rem; font-weight: 450; border-bottom: 1px solid rgba(255, 255, 255, .16); }
nav.tabs svg { width: 20px; height: 20px; flex: none; }
.side .who { flex: none; padding: 14px 16px 16px; border-top: 1px solid rgba(255, 255, 255, .28); font-size: .88rem; }
.side .who select, .side .who button { background: rgba(255, 255, 255, .92); color: #14201b; border-color: transparent; }
.side .who select { margin: 8px 0; min-height: 40px; }
.main { padding: 30px clamp(16px, 3vw, 48px) 60px; width: 100%; min-width: 0; }
.page-head { margin: -30px calc(-1 * clamp(16px, 3vw, 48px)) 22px; padding: 22px clamp(16px, 3vw, 48px) 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.page-head h2 { margin: 0; }
.page-head .lead { margin: 4px 0 0; }

/* Subseccions: una tasca per pantalla */
.segments { display: flex; gap: 4px; padding: 4px; margin: 0 0 18px; background: var(--soft); border-radius: 12px; overflow-x: auto; scrollbar-width: none; }
.segments::-webkit-scrollbar { display: none; }
.segments button { flex: 1 0 auto; min-height: 40px; padding: 6px 16px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 600; white-space: nowrap; }
.segments button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

/* Components */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 0 0 14px; box-shadow: var(--shadow); }
.card > h3:first-child { margin-top: 0; }
label { display: block; font-weight: 600; margin: 14px 0 5px; font-size: .88rem; }
input, select, textarea { width: 100%; min-height: 46px; padding: 9px 12px; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
input[type="checkbox"] { width: 20px; min-height: 20px; height: 20px; vertical-align: middle; accent-color: var(--brand); }
input:focus, select:focus, button:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 1px; border-color: var(--brand); }
.row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
button { min-height: 46px; padding: 8px 18px; font: inherit; font-weight: 600; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--brand); }
button.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
button.primary:hover:not(:disabled) { filter: brightness(1.08); }
button.danger { color: var(--danger); border-color: var(--danger); }
button.small { min-height: 36px; padding: 4px 12px; font-size: .88rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; border: 1px solid var(--line); background: var(--soft); }
.pill.ok { color: var(--ok); background: var(--brand-soft); border-color: transparent; }
.pill.bad { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.pill.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.big { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat { padding: 14px; border-radius: 12px; background: var(--soft); }
.stat .big { margin-top: 2px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 8px; border-bottom: 1px solid var(--line); }
th { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.msg { padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); margin-top: 12px; }
.msg.err { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.msg.ok { color: var(--ok); background: var(--brand-soft); border-color: transparent; }
.secret { font-family: ui-monospace, Menlo, monospace; word-break: break-all; padding: 12px; background: var(--soft); border: 1px dashed var(--line); border-radius: 10px; }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 90px; max-width: 90vw; padding: 12px 20px; background: var(--ink); color: var(--bg); border-radius: 12px; z-index: 20; box-shadow: var(--shadow); }
.login { max-width: 420px; margin: 10vh auto 0; }
.products { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.products button { text-align: left; display: flex; flex-direction: column; gap: 2px; min-height: 64px; }
.products button[aria-pressed="true"] { border: 2px solid var(--brand); background: var(--brand-soft); }
.member { display: flex; gap: 14px; align-items: flex-start; }
img.foto { width: 96px; height: 96px; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); flex: none; }
canvas.sig { width: 100%; max-width: 640px; background: #fff; border: 2px dashed var(--line); border-radius: 12px; touch-action: none; display: block; }
.steps { display: flex; gap: 8px; margin: 0 0 16px; flex-wrap: wrap; }
.steps .pill { background: var(--card); }
.steps .pill[aria-current="step"] { background: var(--brand); color: var(--brand-ink); }

/* Targeta de soci imprimible (carnet) */
.carnet-print { width: 85.6mm; height: 54mm; padding: 5mm; border: 1px solid #000; border-radius: 3mm; background: #fff; color: #000; display: grid; grid-template-columns: 22mm 1fr; gap: 4mm; align-content: start; }
.carnet-print img { width: 22mm; height: 22mm; object-fit: cover; border-radius: 2mm; }
.carnet-print svg.barcode { grid-column: 1 / -1; width: 100%; height: 16mm; }
.carnet-print .nom { font-weight: 700; font-size: 11pt; }

@media (max-width: 880px) {
  nav.tabs .sub-group { display: none; }
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 10; inset: auto 0 0 0; min-height: 0; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
  .side-in { position: static; height: auto; flex-direction: row; }
  .brand, .side .who { display: none; }
  .page-head { margin: -16px -16px 16px; padding: 16px; }
  nav.tabs { flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  nav.tabs button { flex-direction: column; gap: 2px; min-width: 76px; min-height: 54px; padding: 6px 8px; font-size: .72rem; justify-content: center; text-align: center; border-bottom: 0; border-radius: 10px; }
  nav.tabs button[aria-current="page"] { box-shadow: none; }
  .topbar { display: flex; }
  .main { padding: 16px 16px 110px; }
}
.topbar { display: none; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px 0; }
.topbar select { width: auto; min-height: 40px; }

@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; left: 0; top: 0; }
  .carnet-print { border: 1px solid #000; }
}

/* Diagnòstic de dispositius */
.checks { list-style: none; margin: 8px 0 0; padding: 0; }
.checks li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.checks li:last-child { border-bottom: 0; }
.checks .mark { display: inline-block; width: 1.4em; font-weight: 700; }
.checks li.ok .mark { color: var(--ok); }
.checks li.bad .mark { color: var(--danger); }
.diag { margin-top: 12px; }

/* Miniatures de producte */
img.thumb, .thumb.vacia { border-radius: 10px; object-fit: cover; flex: none; }
.thumb.vacia { width: 36px; height: 36px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.imgrow { align-items: center; margin-top: 10px; }
.imgrow .thumb.vacia { width: 56px; height: 56px; font-size: 1.4rem; }
.products button img.thumb, .products button .thumb { margin-bottom: 4px; }

.prod-cell { display: inline-flex; align-items: center; gap: 10px; }
.searchbar { display: flex; justify-content: flex-end; margin: 8px 0; }
.searchbar input { max-width: 280px; min-height: 40px; }

/* ---- Pulit visual: micro-interaccions i detalls (només classes; la CSP no permet estils en línia) ---- */
:root { --ease: cubic-bezier(.2, .7, .2, 1); --ring: color-mix(in srgb, var(--brand) 28%, transparent); }
body { font-feature-settings: "cv11", "ss01"; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
button, input, select, textarea, nav.tabs button, .segments button { transition: background-color .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease), transform .12s var(--ease), color .15s var(--ease); }
button:active:not(:disabled) { transform: translateY(1px) scale(.985); }
button.primary { box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 1px 2px rgba(16, 32, 26, .18); }
button.primary:hover:not(:disabled) { filter: none; background: color-mix(in srgb, var(--brand) 88%, #000); }
input:hover:not(:focus), select:hover:not(:focus) { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 4px var(--ring); outline: none; }

/* Entrada suau de cada pantalla */
@keyframes entra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.main > div, .segments + div > * { animation: entra .28s var(--ease) both; }
.card { transition: box-shadow .2s var(--ease), border-color .2s var(--ease); }
.card:hover { border-color: color-mix(in srgb, var(--brand) 22%, var(--line)); }

/* Capçalera de pàgina amb filet de marca */
.page-head { box-shadow: 0 1px 0 var(--line), 0 6px 18px -12px rgba(16, 32, 26, .25); position: relative; }
.page-head::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(180deg, #8dc177, #4aa38a); }
.page-head h2 { font-size: 1.5rem; }

/* Taules: capçalera fixa en llistats llargs, files amb hover i xifres alineades */
.table-wrap { border-radius: var(--radius); }
.table-wrap th { position: sticky; top: 0; background: var(--card); z-index: 1; }
tbody tr { transition: background-color .12s var(--ease); }
tbody tr:hover { background: color-mix(in srgb, var(--brand) 6%, transparent); }
td input { min-height: 38px; padding: 5px 10px; }

/* Barra lateral: indicador d'activa més clar i sortida suau dels submenús */
nav.tabs button { position: relative; }
nav.tabs button[aria-current="page"]::after { content: ""; position: absolute; right: 14px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: #f4e27a; }
nav.tabs .sub-group { animation: entra .2s var(--ease) both; }
nav.tabs button.sub[aria-current="page"] { background: rgba(0, 0, 0, .22); box-shadow: inset 3px 0 0 #f4e27a; }

/* Segments (subpantalles): estat actiu amb més presència */
.segments button[aria-selected="true"] { box-shadow: var(--shadow), 0 0 0 1px var(--line); }
.segments button:hover:not([aria-selected="true"]) { color: var(--ink); background: color-mix(in srgb, var(--card) 60%, transparent); }

/* Etiquetes i miniatures */
.pill { letter-spacing: .01em; }
.thumb { border-radius: 10px; object-fit: cover; }
.thumb.vacia { background: linear-gradient(135deg, var(--brand-soft), var(--soft)); color: var(--brand); font-weight: 700; display: grid; place-items: center; }

/* KPI dels informes */
.row > div > .big { color: var(--brand); }
progress { width: 100%; height: 8px; accent-color: var(--brand); border-radius: 999px; }

/* Pantalla d'entrada: fons suau de marca i targeta centrada */
.login { margin-top: 12vh; padding: 28px; box-shadow: 0 10px 40px -12px rgba(16, 32, 26, .28); border-radius: calc(var(--radius) + 4px); }
.login h1 { font-size: 1.6rem; letter-spacing: -.02em; margin-bottom: 6px; }
#app:has(.login) { background: radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, #8dc177 30%, transparent), transparent 70%), var(--bg); }

/* Toast i missatges */
#toast { animation: entra .25s var(--ease) both; box-shadow: 0 8px 28px -8px rgba(0, 0, 0, .35); }
.msg { animation: entra .2s var(--ease) both; }

/* Accessibilitat: sense moviment si l'usuari ho demana */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* =====================================================================
   Aspecte professional: paleta esmeralda sobria, menú fosc amb bon contrast,
   components més compactes a escriptori (tàctils a tauleta). Va al final: sobreescriu.
   ===================================================================== */
:root {
  --bg: #f5f7f6; --card: #ffffff; --ink: #0f1f19; --muted: #5d6e66; --line: #e2e8e5; --soft: #eef2f0;
  --brand: #0f7556; --brand-ink: #ffffff; --brand-soft: #e3f3ec; --ok: #0f7556;
  --nav-a: #0b2e24; --nav-b: #0f4a38; --nav-ink: rgba(255, 255, 255, .78); --nav-line: rgba(255, 255, 255, .09); --nav-accent: #5fd3a6;
  --radius: 12px; --shadow: 0 1px 2px rgba(15, 31, 25, .05), 0 6px 20px -8px rgba(15, 31, 25, .10);
  --side: 248px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0c1210; --card: #151c19; --ink: #e8efec; --muted: #94a69d; --line: #26312c; --soft: #1b2420; --brand: #35b88c; --brand-ink: #06130e; --brand-soft: #14302a; --ok: #5fd0a6; }
}
body { font-size: 15px; line-height: 1.5; }
h1 { font-weight: 650; } h2 { font-weight: 650; }
h3 { font-size: .74rem; letter-spacing: .08em; margin: 22px 0 10px; }

/* Menú lateral fosc */
.side { background: linear-gradient(185deg, var(--nav-a) 0%, var(--nav-b) 100%); color: #fff; box-shadow: 1px 0 0 rgba(0, 0, 0, .25); }
.brand { padding: 20px 18px 18px; border-bottom: 1px solid var(--nav-line); gap: 12px; }
.brand .logo { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, #7be0b4, #2fae80); color: #04261a; font-weight: 800; box-shadow: 0 4px 14px -4px rgba(95, 211, 166, .55); }
.brand small { color: rgba(255, 255, 255, .55); }
nav.tabs { padding: 10px 10px; gap: 2px; }
nav.tabs button { min-height: 42px; padding: 8px 12px; border: 0; border-radius: 9px; background: transparent; color: var(--nav-ink); font-weight: 500; font-size: .93rem; }
nav.tabs button:hover { background: rgba(255, 255, 255, .07); color: #fff; border-color: transparent; }
nav.tabs button[aria-current="page"] { background: rgba(95, 211, 166, .14); color: #fff; font-weight: 600; box-shadow: none; }
nav.tabs button[aria-current="page"]::after { display: none; }
nav.tabs button[aria-current="page"] svg { color: var(--nav-accent); }
nav.tabs svg { width: 18px; height: 18px; opacity: .9; }
nav.tabs .sub-group { background: transparent; margin: 2px 0 6px 18px; padding-left: 12px; border-left: 1px solid var(--nav-line); }
nav.tabs button.sub { min-height: 34px; padding: 4px 10px; font-size: .87rem; border: 0; border-radius: 7px; color: rgba(255, 255, 255, .66); }
nav.tabs button.sub[aria-current="page"] { background: rgba(95, 211, 166, .16); color: #fff; box-shadow: none; }
.side .who { margin: 8px 10px 12px; padding: 12px; border: 1px solid var(--nav-line); border-radius: 12px; background: rgba(255, 255, 255, .05); }
.side .who select { background: rgba(255, 255, 255, .08); color: #fff; border: 1px solid var(--nav-line); min-height: 38px; margin: 6px 0 0; font-size: .88rem; }
.side .who select option { color: #14201b; background: #fff; }
.side .who button { background: transparent; color: rgba(255, 255, 255, .8); border: 1px solid var(--nav-line); min-height: 34px; margin-top: 8px; font-size: .85rem; }
.side .who button:hover:not(:disabled) { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .25); color: #fff; }

/* Capçalera de pàgina: títol net sobre fons blanc, sense franja de color */
.page-head { background: var(--card); border-bottom: 1px solid var(--line); box-shadow: none; padding-top: 24px; padding-bottom: 18px; }
.page-head::before { display: none; }
.page-head h2 { font-size: 1.45rem; letter-spacing: -.02em; }
.page-head .lead { margin: 4px 0 0; font-size: .95rem; }
.main { padding-top: 28px; }

/* Components: compactes a escriptori, tàctils a tauleta */
.card { border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.card > h3:first-child { margin-top: 0; }
@media (pointer: fine) {
  input, select, textarea { min-height: 40px; padding: 7px 11px; font-size: .94rem; }
  button { min-height: 40px; padding: 7px 16px; font-size: .92rem; }
  button.small { min-height: 32px; font-size: .84rem; }
}
label { font-size: .8rem; font-weight: 600; color: var(--muted); margin: 14px 0 5px; letter-spacing: .01em; }
button { border-radius: 9px; font-weight: 600; }
button.primary { background: var(--brand); border-color: var(--brand); }
.segments { background: var(--soft); border: 1px solid var(--line); border-radius: 11px; padding: 4px; }
.segments button { min-height: 36px; border-radius: 8px; font-size: .88rem; }
.pill { font-size: .72rem; padding: 2px 9px; }
th { font-size: .72rem; letter-spacing: .07em; }
th, td { padding: 10px 10px; }
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 8px; background: var(--card); box-shadow: var(--shadow); }
.table-wrap .card { box-shadow: none; }
.big { font-size: 1.6rem; font-weight: 680; letter-spacing: -.025em; }
.row > div > .muted { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.empty { border-style: dashed; background: transparent; box-shadow: none; }
.products button { border-radius: 11px; }
.products button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ring); }

/* Entrada: panell de marca + formulari */
#app:has(.auth) { background: var(--bg); }
.auth { display: grid; grid-template-columns: minmax(320px, 5fr) 6fr; min-height: 100vh; }
.auth-brand { display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 6vw; color: #fff;
  background: radial-gradient(900px 500px at 0% 0%, rgba(95, 211, 166, .28), transparent 60%), linear-gradient(160deg, var(--nav-a), var(--nav-b)); }
.auth-brand .brand-mark { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 1.6rem; font-weight: 800; color: #04261a;
  background: linear-gradient(135deg, #7be0b4, #2fae80); box-shadow: 0 10px 30px -8px rgba(95, 211, 166, .6); }
.auth-brand h1 { font-size: 2.1rem; letter-spacing: -.03em; line-height: 1.1; margin-top: 10px; }
.auth-brand p { color: rgba(255, 255, 255, .72); max-width: 34ch; font-size: 1.02rem; }
.auth-brand ul { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 10px; }
.auth-brand li { padding-left: 26px; position: relative; color: rgba(255, 255, 255, .85); }
.auth-brand li::before { content: ""; position: absolute; left: 0; top: .45em; width: 14px; height: 14px; border-radius: 50%; background: rgba(95, 211, 166, .25); border: 2px solid var(--nav-accent); }
.auth-panel { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 32px; position: relative; }
.auth-lang { position: absolute; top: 20px; right: 24px; width: 150px; }
.auth .login { width: 100%; max-width: 400px; margin: 0; padding: 0; border: 0; box-shadow: none; background: transparent; }
.auth-title { font-size: 1.6rem; letter-spacing: -.025em; margin: 0 0 4px; }
.auth .login .actions button { width: 100%; min-height: 44px; }
@media (max-width: 880px) { .auth { grid-template-columns: 1fr; } .auth-brand { padding: 28px 24px; } .auth-brand ul, .auth-brand p { display: none; } .auth-brand h1 { font-size: 1.5rem; } .auth-brand .brand-mark { width: 44px; height: 44px; } }

/* Ajustos finals del menú i les taules */
.side-in { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .22) transparent; }
.side-in::-webkit-scrollbar { width: 6px; }
.side-in::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .22); border-radius: 6px; }
nav.tabs { flex: 1 0 auto; }
nav.tabs button.sub { min-height: 30px; }
.side .who { position: sticky; bottom: 0; margin-top: auto; background: color-mix(in srgb, var(--nav-b) 92%, #000); backdrop-filter: blur(6px); }
/* A l'escriptori el menú ja desplega les subpantalles d'Estoc i Informes: no es repeteix la barra de segments */
@media (min-width: 881px) { body[data-view="estoc"] .segments { display: none; } }
td:first-child:has(.thumb) { width: 56px; padding-right: 0; }

.card .table-wrap { border: 0; box-shadow: none; padding: 0; border-radius: 0; }

/* Alta de soci: indicador de passos, ajudes de camp i resum */
.stepper { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 18px; flex-wrap: wrap; }
.stepper li { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--muted); font-size: .85rem; font-weight: 600; }
.stepper .num-pas { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); font-size: .78rem; }
.stepper li.actual { color: var(--ink); border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.stepper li.actual .num-pas { background: var(--brand); color: var(--brand-ink); }
.stepper li.fet .num-pas { background: var(--brand-soft); color: var(--brand); }
.hint { min-height: 1.2em; margin-top: 4px; font-size: .8rem; color: var(--muted); }
.hint.ok { color: var(--ok); }
.hint.bad { color: var(--danger); }
input[aria-invalid="true"] { border-color: var(--danger); }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; font-size: .88rem; color: var(--ink); margin-top: 18px; }
label.check input { margin-top: 2px; flex: none; }
ul.resum { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
ul.resum li { display: flex; gap: 10px; align-items: center; color: var(--muted); }
ul.resum li.ok { color: var(--ink); }
ul.resum .marca { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); font-weight: 700; }
ul.resum li.ok .marca { background: var(--brand-soft); color: var(--brand); }
.fet-alta { text-align: center; padding: 36px 20px; }
.gran-marca { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; font-size: 2rem; background: var(--brand-soft); color: var(--brand); }
.fet-alta .actions { justify-content: center; }

/* Entrada amb carnet RFID */
.auth-carnet { width: 100%; max-width: 400px; margin: 0 0 4px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow);
  display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: center; }
.auth-carnet .carnet-icona { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.4rem; background: var(--brand-soft); color: var(--brand); }
.auth-carnet .carnet-text { display: grid; line-height: 1.3; }
.auth-carnet .card-input, .auth-carnet .actions, .auth-carnet > div:not(.carnet-icona):not(.carnet-text) { grid-column: 1 / -1; }
.auth-carnet .card-input { margin-top: 12px; text-align: center; letter-spacing: .08em; font-weight: 600; }
.auth-carnet .actions button { width: 100%; }
.auth-carnet .separador { margin: 14px 0 0; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.auth-carnet .separador::before, .auth-carnet .separador::after { content: ""; flex: 1; height: 1px; background: var(--line); }
@media (max-width: 880px) { .auth-carnet { margin-top: 8px; } }

/* Entrada amb carnet + PIN: teclat numèric tàctil */
.auth-carnet .carnet-pas { grid-column: 1 / -1; }
.auth-carnet .carnet-pas[hidden] { display: none; }
.auth-carnet .carnet-pas p { margin: 8px 0 0; font-size: .85rem; }
.auth-carnet .carnet-hola { margin: 12px 0 8px; font-weight: 600; font-size: .95rem; }
.auth-carnet .pin-input { font-size: 1.5rem; letter-spacing: .5em; padding-left: .5em; }
.teclat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.teclat button { min-height: 52px; font-size: 1.25rem; font-weight: 600; width: 100%; }
@media (pointer: fine) { .teclat button { min-height: 44px; font-size: 1.1rem; } }
.auth-carnet .carnet-pas .actions button { width: auto; }

/* Logotip */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.auth-logo { width: min(80%, 340px); height: auto; margin: 0 0 8px -6px; filter: drop-shadow(0 12px 28px rgba(0, 0, 0, .35)); }
.brand .brand-logo { width: 42px; height: auto; flex: none; margin: -2px 0; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .35)); }
.topbar-marca { display: flex; align-items: center; gap: 8px; }
.topbar-marca img { height: 30px; width: auto; }
.carnet-print { position: relative; }
.carnet-print img.carnet-logo { position: absolute; top: 3mm; right: 3mm; width: auto; height: 12mm; border-radius: 0; object-fit: contain; }
.carnet-print > div:nth-child(3) { padding-right: 13mm; }
@media (max-width: 880px) { .auth-logo { width: 150px; margin: 0; } }
