/* Pàgina pública de reserves (disseny de la proposta de Robert, 06/11): una columna estreta, de dalt a baix.
   Lletres desades aquí mateix (lletres/, llicència SIL OFL): la pàgina no carrega res de Google. */
@font-face { font-family: 'Young Serif'; font-weight: 400; font-display: swap; src: url(lletres/young-serif-latin.woff2) format('woff2');
  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: 'Young Serif'; font-weight: 400; font-display: swap; src: url(lletres/young-serif-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
/* «la mOd» (Robert, 17/11): La Mod no té logo en fitxer; és «la mOd» en Rufina Bold, la lletra de la carta impresa */
@font-face { font-family: 'Rufina'; font-weight: 700; font-display: swap; src: url(lletres/rufina-latin.woff2) format('woff2');
  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: 'Rufina'; font-weight: 700; font-display: swap; src: url(lletres/rufina-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Figtree'; font-weight: 300 900; font-display: swap; src: url(lletres/figtree-latin.woff2) format('woff2');
  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: 'Figtree'; font-weight: 300 900; font-display: swap; src: url(lletres/figtree-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --paper: #f6f4f7;
  --card: #ffffff;
  --ink: #2f2533;
  --muted: #6d6272;
  --plum: #6b5a70;
  --plum-soft: #ece6ee;
  --brass: #a8824a;
  --brass-text: #8a6a3a; /* el daurat per a text sobre blanc: contrast suficient */
  --line: #e2dbe5;
  --ok: #2f7a57;
  --err: #b3261e;
  --err-soft: #fbecea;
  --display: 'Young Serif', Georgia, 'Times New Roman', serif;
  --body: 'Figtree', -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1c1820; --card: #27212b; --ink: #f1ecf3; --muted: #b3a8b8; --plum: #b9a3c0; --plum-soft: #352c3a;
    --brass: #d0ab72; --brass-text: #d0ab72; --line: #3a3240; --ok: #6cc59b; --err: #f2948c; --err-soft: #3a2224; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
/* La pàgina no es desplaça mai de costat (Robert, 06/11) */
html, body { overflow-x: hidden; }
/* La barra de reservar (a baix): el que es porta a la vista (un camp, un avís) queda per sobre seu */
html { scroll-padding-bottom: 170px; }
@supports (overflow: clip) { html, body { overflow-x: clip; } }
body {
  margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.5 var(--body);
  padding: 22px max(16px, env(safe-area-inset-right, 0px)) 56px max(16px, env(safe-area-inset-left, 0px));
}
[hidden] { display: none !important; }
.wrap { max-width: 26rem; margin: 0 auto; display: flex; flex-direction: column; gap: 30px; }
.passos { display: flex; flex-direction: column; gap: 30px; }

/* Capçalera */
.cap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.idiomes { align-self: flex-end; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px; }
.idiomes button { appearance: none; border: 0; background: none; color: var(--muted); font: 600 .85rem var(--body); padding: 6px 7px; border-radius: 6px; min-height: 32px; min-width: 32px; cursor: pointer; }
.idiomes button[aria-pressed='true'] { color: var(--plum); background: var(--plum-soft); }
.logo { font-family: 'Rufina', Georgia, 'Times New Roman', serif; font-weight: 700; font-size: 2.3rem; line-height: 1; color: var(--plum); text-align: center; }
.logo small { display: block; font-family: var(--body); font-weight: 400; font-size: .9rem; color: var(--muted); margin-top: 6px; letter-spacing: .02em; }
h1 { font-family: var(--display); font-weight: 400; font-size: 1.55rem; margin: 0; text-align: center; text-wrap: balance; }

/* Passos */
.pas { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.pas h2 { margin: 0; font-size: 1.05rem; font-weight: 600; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.pas h2 .lateral { font-weight: 500; color: var(--muted); font-size: .95rem; }
.ajuda { margin: 0; font-size: .9rem; color: var(--muted); }

/* Pastilles (persones, hores) */
.pastilles { display: grid; gap: 8px; }
.pastilles.sis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.pastilles.hores { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pastilles.tres { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.zones { display: grid; gap: 8px; margin-top: 14px; }
.zones h3 { margin: 0; font-size: 1rem; }
.past { appearance: none; border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  font: 600 1rem var(--body); min-height: 46px; border-radius: 999px; cursor: pointer; font-variant-numeric: tabular-nums; padding: 0 4px; }
.past:hover:not(:disabled) { border-color: var(--plum); }
.past[aria-pressed='true'] { background: var(--plum); border-color: var(--plum); color: var(--card); }
.past:disabled { color: var(--muted); background: transparent; border-style: dashed; text-decoration: line-through; cursor: not-allowed; font-weight: 500; }
.past:focus-visible, .boto:focus-visible, .dia button:focus-visible, .idiomes button:focus-visible, .enllac:focus-visible,
input:focus-visible, textarea:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
.torn { font-size: .9rem; font-weight: 700; color: var(--muted); margin: 6px 0 -2px; }
/* Un torn tancat aquest dia (Robert, 18/11): un requadre centrat, que no es confon amb el títol */
.torn-tancat { margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--plum-soft); text-align: center; font-size: .92rem; }
/* Sense persones, quan ja s'ha triat el dia (Robert, 18/11): es veu què falta */
#persones.falta { outline: 2px solid var(--brass); outline-offset: 5px; border-radius: 12px; }
/* Sense zoom amb dos tocs seguits (les fletxes dels dies, Robert 18/11); el de dos dits es manté */
html, body, button, a, label, input, select, textarea { touch-action: manipulation; }

/* Dia: ‹ dia › (tocar el dia obre el calendari propi, .cal) */
.dia { display: grid; grid-template-columns: 46px minmax(0, 1fr) 46px; align-items: center; gap: 8px; max-width: 21rem; margin: 0 auto; width: 100%; position: relative; }
.dia > button { appearance: none; border: 1.5px solid var(--line); background: var(--card); color: var(--plum); border-radius: 999px; height: 46px; font-size: 1.3rem; cursor: pointer; }
.dia > button:disabled { opacity: .35; cursor: default; }
.dia .dia-mig { height: auto; min-height: 46px; border: 0; background: none; color: var(--ink); font-family: var(--display); font-size: 1.2rem; line-height: 1.2; padding: 4px; border-radius: 12px; }
.dia .dia-mig > span { display: block; }
.dia .dia-mig small { display: block; font-family: var(--body); font-size: .85rem; color: var(--muted); min-height: 1.2em; }
.amagat { position: absolute; left: 50%; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }

.avis { margin: 0; padding: 10px 14px; border-radius: 10px; background: var(--plum-soft); font-size: .92rem; }
.avis.error { background: var(--err-soft); color: var(--err); font-weight: 600; }

/* Dades */
.camps { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.camp { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.camp.ample { grid-column: 1 / -1; }
.camp label { font-size: .9rem; font-weight: 600; }
.camp label i { font-style: normal; font-weight: 400; color: var(--muted); }
/* 16 px o més: el mòbil no fa zoom en tocar-los (Robert, 06/11) */
input, textarea { font: 16px var(--body); color: var(--ink); background: var(--card); border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 12px; width: 100%; min-width: 0; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
textarea { min-height: 76px; resize: vertical; }
.consent { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 4px 10px; align-items: start; padding: 12px; border-radius: 10px; border: 1.5px solid transparent; font-size: .92rem; }
.consent input { width: 20px; height: 20px; margin: 2px 0 0; padding: 0; accent-color: var(--plum); }
.consent label { cursor: pointer; }
.consent .enllac, .consent .privacitat, .consent .msg { grid-column: 2; }
.consent.falta { border-color: var(--err); background: var(--err-soft); }
.consent.falta input { accent-color: var(--err); outline: 2px solid var(--err); outline-offset: 1px; }
.consent .msg { margin: 4px 0 0; color: var(--err); font-weight: 600; }
.consent .privacitat { margin: 4px 0 0; color: var(--muted); font-size: .88rem; }
.puntualitat { margin: 0 0 10px; color: var(--muted); font-size: .88rem; }
.enllac { appearance: none; border: 0; background: none; padding: 0; justify-self: start; color: var(--plum); font: inherit; text-decoration: underline; cursor: pointer; min-height: 32px; }
#turnstile { min-height: 65px; }

.boto { appearance: none; border: 0; background: var(--plum); color: var(--card); font: 600 1.05rem var(--body);
  min-height: 52px; border-radius: 999px; padding: 0 28px; cursor: pointer; width: 100%; }
.boto:disabled { opacity: .6; cursor: default; }
.boto.sec { background: transparent; color: var(--plum); border: 1.5px solid var(--plum); width: auto; min-height: 48px; }

/* Barra flotant de reservar (Robert, 17/11): el resguard en petit, enganxat a baix. Com que és l'últim element del formulari,
   a baix de tot es queda al seu lloc i no tapa res (ni l'últim camp, ni la protecció de dades, ni el peu). Amb un camp de text
   obert (teclat del mòbil), deixa d'enganxar-se perquè no tapi on s'escriu. */
.barra { position: sticky; bottom: 0; z-index: 5; margin: 0 -6px; padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 -8px 24px -16px rgba(47, 37, 51, .45); }
.escrivint .barra { position: static; }
.barra .plec { margin: 0 0 8px; height: 12px; background-position: center 4px; }
.barra-cos { display: flex; flex-direction: column; gap: 10px; padding: 0 16px 14px; }
.barra .reservat { margin: 0; font-size: .95rem; }
.barra-linia { margin: 2px 0 0; font-family: var(--display); font-size: 1.1rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra-linia #barra-hora { font-size: 1.3em; font-variant-numeric: tabular-nums; }
.barra-linia .sep { color: var(--muted); }
.barra-linia .falta { color: var(--muted); }
.barra-linia .llarg { display: none; }
.reservar { appearance: none; min-height: 50px; width: 100%; padding: 0 26px; border-radius: 999px; cursor: pointer;
  font: 1.15rem var(--display); color: var(--brass-text); border: 1.5px solid var(--brass); background: #fbf7ef; }
.reservar[aria-disabled='true'] { color: var(--muted); border-color: var(--line); background: var(--paper); }
.reservar:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
.reservar:disabled { opacity: .6; cursor: default; }
@media (prefers-color-scheme: dark) { .reservar { background: #2f2820; } }
@media (min-width: 600px) {
  /* Més ampla que la columna del formulari (fins a 40rem, centrada): el dia llarg i el botó hi caben en una línia */
  .barra { margin-inline: calc((100% - min(40rem, 100vw - 32px)) / 2); }
  .barra-cos { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; }
  .barra-text { min-width: 0; flex: 1; }
  .barra-linia .curt { display: none; }
  .barra-linia .llarg { display: inline; }
  .reservar { width: auto; flex: none; }
}

/* Confirmació: el cartellet de «taula reservada» */
.final { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.estat { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1.15rem; color: var(--ok); outline: none; }
.estat svg { width: 26px; height: 26px; flex: none; }
.cartell { width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 0 22px 26px; text-align: center;
  box-shadow: 0 10px 30px -18px rgba(47, 37, 51, .45); }
.plec { height: 14px; margin: 0 -22px 22px; border-bottom: 1px dashed var(--line); border-radius: 14px 14px 0 0;
  background: linear-gradient(var(--plum), var(--plum)) center 5px / 44px 3px no-repeat; }
.reservat { font-family: var(--display); color: var(--brass-text); margin: 0 0 4px; }
.tel { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.nota .tel { color: var(--ink); }
.nom { font-size: 1.15rem; font-weight: 600; margin: 0 0 18px; overflow-wrap: anywhere; }
.cdia { font-family: var(--display); font-size: 1.55rem; line-height: 1.2; margin: 0; text-wrap: balance; }
.chora { font-family: var(--display); font-size: 3.6rem; line-height: 1; margin: 10px 0 8px; font-variant-numeric: tabular-nums; }
.cpax { margin: 0; color: var(--muted); font-size: 1.05rem; }
.cpax b { color: var(--ink); font-weight: 600; }
.nota { margin: 0; color: var(--muted); text-align: center; font-size: .98rem; }
.nota strong { color: var(--ink); white-space: nowrap; }
.final .avis { width: 100%; }

@media (max-width: 380px) {
  .pastilles.hores { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .camps { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
/* Al·lèrgies amb casella pròpia (Robert, 16/11) */
.etiqueta { margin: 0; font-size: .9rem; font-weight: 600; }
.etiqueta i { font-style: normal; font-weight: 400; color: var(--muted); }
#casella-alergies { padding: 6px 0; }
.camp .consent label { font-weight: 400; }
.consent .privacitat a { color: var(--plum); }
/* Peu: les pàgines legals */
.peu { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin: 28px 0 8px; font-size: .88rem; }
.peu a { color: var(--muted); min-height: 32px; display: inline-flex; align-items: center; }
/* Pàgines legals (Robert, 16/11): text llarg, llegible al mòbil, taules que no es surten de la pantalla */
.legal #text { font-size: .95rem; line-height: 1.55; }
.legal #text h2 { font-family: var(--display); font-weight: 400; font-size: 1.1rem; margin: 26px 0 8px; }
.legal #text ul { padding-left: 20px; margin: 8px 0; }
.legal #text li { margin: 4px 0; }
.legal #text a { color: var(--plum); overflow-wrap: anywhere; }
.legal #text table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: .9rem; table-layout: fixed; }
.legal #text th, .legal #text td { text-align: left; vertical-align: top; padding: 8px 6px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.legal #text thead th { color: var(--muted); font-weight: 600; }
.legal #text tbody th { font-weight: 600; }
.legal #text thead th:first-child { width: 45%; }
.legal .actualitzat { color: var(--muted); font-size: .88rem; }

/* Hores mentre es carreguen (Robert, 17/11): les mateixes caixes al seu lloc, en gris; res no salta */
.lector { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.torn-bloc { display: grid; gap: 8px; align-content: start; }
#hores { display: grid; gap: 8px; align-content: start; }
.past.buit { display: block; background: var(--line); border-color: var(--line); }
#hores.esperant .past { color: transparent; background: var(--line); border-color: var(--line); border-style: solid; text-decoration: none; pointer-events: none; }
#hores.esperant .ajuda, #hores.esperant .avis, #hores.esperant .torn-tancat { visibility: hidden; }
/* L'avís de la terrassa té el lloc guardat: triar zona no mou res */
#avis-terrassa[hidden] { display: block; visibility: hidden; }

/* Calendari propi (Robert, 17/11): un mes a sobre de la pàgina */
.cal-icona { font-size: .85em; }
.cal-capa { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgb(30 22 34 / .45); }
.cal-capa[hidden] { display: none; }
html.cal-obert { overflow: hidden; }
.cal { width: min(22rem, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--card); color: var(--ink); border-radius: 18px;
  padding: 16px; display: grid; gap: 10px; box-shadow: 0 18px 40px rgb(0 0 0 / .25); }
.cal-cap { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; }
.cal-cap h3 { margin: 0; text-align: center; font-family: var(--display); font-weight: 400; font-size: 1.2rem; }
.cal-cap button { appearance: none; height: 44px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); color: var(--plum); font-size: 1.3rem; cursor: pointer; }
.cal-cap button:disabled { opacity: .35; cursor: default; }
.cal-setmana, .cal-dies { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; }
.cal-setmana span { font-size: .8rem; color: var(--muted); font-weight: 600; }
.cal-dies button { appearance: none; aspect-ratio: 1; min-height: 40px; border: 0; border-radius: 999px; background: none; color: var(--ink);
  font: 600 1rem var(--body); cursor: pointer; touch-action: manipulation; }
.cal-dies button:hover:not(:disabled) { background: var(--plum-soft); }
.cal-dies button.avui { box-shadow: inset 0 0 0 1.5px var(--plum); }
.cal-dies button[aria-current] { background: var(--plum); color: var(--card); }
.cal-dies button:disabled { color: var(--muted); opacity: .45; cursor: default; text-decoration: line-through; }
.cal-dies button:focus-visible, .cal-cap button:focus-visible { outline: 2px solid var(--plum); outline-offset: 2px; }

/* El telèfon, sempre junt (Robert, 17/11) */
.tel { white-space: nowrap; }
