@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:wght@400;500;600;700&family=Fraunces:opsz,wght@9..144,600;9..144,700&display=swap');
/* ────────────────────────────────────────────────────────────────────────────
   NORVI · sistema
   Mòbil primer. Es llegeix dret, a les 13:40, amb el mòbil a una mà.
   ────────────────────────────────────────────────────────────────────────── */

:root {
  /* Norvi is a service-room tool: ink, linen and a single hot pass accent. */
  --navy: #102f35; --navy-2: #1c4b50; --emerald: #e5b85c; --emerald-ink: #b4771d;
  --bg: #f3efe6; --surface: #fbf8f0; --surface-2: #e8e4d9; --line: #d6d1c3; --line-2: #e5e0d5;
  --ink: #182a2b; --ink-2: #566463; --ink-3: #7b8781;
  --good: #28745b; --warn: #a45d24; --crit: #a83f36;
  --good-bg: #e5f0e9; --warn-bg: #f8ead8; --crit-bg: #f5e3df;
  /* sèries · paleta validada, ordre fix, no s'amplia */
  --s1: #0E9C78; --s2: #D2691E; --s3: #3A6FD8; --s4: #B0576F;
  --band: rgba(14, 156, 120, .13);
  /* escala */
  --sp1: 4px; --sp2: 8px; --sp3: 12px; --sp4: 16px; --sp5: 24px; --sp6: 32px; --sp7: 48px;
  --r: 16px; --r-s: 10px; --r-xs: 8px; --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(16,47,53,.06);
  --shadow-2: 0 1px 2px rgba(16,47,53,.06), 0 16px 34px -12px rgba(16,47,53,.22);
  --font: "DM Sans", sans-serif; --display: "Fraunces", Georgia, serif;
  --mono: "DM Mono", ui-monospace, monospace;
  --nav-h: 68px;
  --ease: cubic-bezier(.22,.61,.36,1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
*:focus-visible { outline: 3px solid rgba(108,145,64,.55); outline-offset: 3px; }

html { width: 100%; max-width: 100%; overflow-x: clip; -webkit-text-size-adjust: 100%; }

body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg);
  font-size: 16px; line-height: 1.5; overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  width: 100%; max-width: 100%; overflow-x: clip;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.018em; font-family: var(--display); }
p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
img, video, canvas, svg { max-width: 100%; }
h1, h2, h3, p, li, a, button, span, div { overflow-wrap: anywhere; }

/* ── capçalera ───────────────────────────────────────────────────────────── */
.hd {
  position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,.86);
  backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top);
}
.hd__in {
  display: flex; align-items: center; gap: var(--sp3); flex-wrap: wrap; row-gap: 6px;
  padding: var(--sp3) var(--sp4); max-width: 1120px; margin: 0 auto;
}
/* el marge negatiu compensa el farciment: 44 px de dit sense moure la capçalera */
.hd__logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--navy); font-weight: 700; letter-spacing: .06em; font-size: 14px; min-height: 44px; padding: 0 6px; margin: -11px -6px; }
.hd__logo img { width: 22px; height: 22px; display: block; }
.hd__title { font-weight: 650; font-size: 15px; color: var(--ink); min-width: 0; }
.hd__end { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; min-width: 0; }
/* A mòbil l'etiqueta de font baixa a una segona fila, però el botó de compte
   es queda a la primera: si no, la capçalera creix a tres línies. */
@media (max-width: 560px) {
  .hd__end { margin-left: 0; flex: 1 0 100%; justify-content: flex-start; order: 3; }
  .hd__compte { order: 2; margin-left: auto; }
}

/* ── estat de font · sempre visible, mai un error disfressat ─────────────── */
.src {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 5px 10px; border-radius: var(--r-pill); border: 1px solid var(--line);
  max-width: 100%; background: var(--surface); color: var(--ink-2); white-space: normal;
}
.src::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex: none; }
.src--viu { color: var(--good); border-color: #BFE3CC; background: var(--good-bg); }
.src--viu::before { background: var(--good); }
.src--cache { color: var(--ink-2); }
.src--simulat { color: var(--navy-2); border-style: dashed; }
.src--simulat::before { background: var(--navy-2); }
.src--pendent { color: var(--warn); border-color: #F0D5B0; background: var(--warn-bg); }
.src--pendent::before { background: var(--warn); }

/* ── contenidor ──────────────────────────────────────────────────────────── */
.wrap { width: 100%; min-width: 0; max-width: 1120px; margin: 0 auto; padding: var(--sp5) var(--sp4) var(--sp7); }
.view { min-width: 0; animation: enter .26s var(--ease); }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view { animation: none; } }

/* ── el bloc de missatge: eyebrow + titular + frase + accions ────────────── */
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: var(--sp2); }
.titular { font-size: clamp(26px, 6.4vw, 34px); line-height: 1.16; letter-spacing: -.026em; }
.titular em { font-style: normal; box-shadow: inset 0 -.32em 0 rgba(22,199,154,.28); }
.frase { margin-top: var(--sp3); color: var(--ink-2); font-size: 16px; max-width: 62ch; }

/* xifra traçable: àrea tàctil de 44 px sense moure la maqueta */
.tr { position: relative; font-weight: 700; color: var(--ink); border-bottom: 1.5px dotted var(--ink-3); cursor: pointer; background: none; border-left: 0; border-right: 0; border-top: 0; padding: 0; }
.tr::after { content: ""; position: absolute; left: -6px; right: -6px; top: 50%; height: 44px; transform: translateY(-50%); }
.tr:hover { border-bottom-color: var(--emerald-ink); }

/* interruptor: 36 px de dibuix, 44 px de dit */
.switch { position: relative; }
.switch::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%); }

/* ── accions ─────────────────────────────────────────────────────────────── */
.accions { display: flex; flex-direction: column; gap: var(--sp2); margin-top: var(--sp5); }
.btn {
  min-width: 0; max-width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 54px;
  padding: 14px 20px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface);
  font-weight: 650; font-size: 16px; cursor: pointer; text-decoration: none; color: var(--ink);
  transition: transform .12s var(--ease), box-shadow .18s var(--ease), background .18s;
}
.btn:active { transform: scale(.985); }
.btn__sub { font-weight: 500; color: var(--ink-3); font-size: 14px; }
.btn--main { background: var(--emerald-ink); border-color: var(--emerald-ink); color: #fff; box-shadow: 0 6px 18px -8px rgba(14,156,120,.7); }
.btn--main .btn__sub { color: rgba(255,255,255,.82); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-2); min-height: 46px; }

/* ── el calaix «Per què» ─────────────────────────────────────────────────── */
.perque { margin-top: var(--sp5); border-top: 1px solid var(--line); }
.perque__btn {
  width: 100%; display: flex; align-items: center; gap: var(--sp3); padding: 16px 2px;
  background: none; border: 0; cursor: pointer; font-weight: 650; color: var(--emerald-ink); font-size: 15px;
}
.perque__meta { margin-left: auto; color: var(--ink-3); font-weight: 500; font-size: 13px; }
.perque__chev { transition: transform .24s var(--ease); color: var(--ink-3); }
.perque[open] .perque__chev { transform: rotate(180deg); }
.perque__body { padding: 0 0 var(--sp5); animation: enter .22s var(--ease); }

/* ── targetes ────────────────────────────────────────────────────────────── */
.card { min-width: 0; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--sp4); box-shadow: var(--shadow-1); }
.card + .card { margin-top: var(--sp3); }
.card__t { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: var(--sp3); }

.grid { min-width: 0; display: grid; gap: var(--sp3); }
@media (min-width: 768px) { .grid--2 { grid-template-columns: 1fr 1fr; } .grid--3 { grid-template-columns: repeat(3, 1fr); } }

/* traça d'una xifra */
.traca { background: var(--surface-2); border-radius: var(--r-s); padding: var(--sp3); font-size: 14px; }
.traca__row { display: flex; gap: var(--sp3); padding: 7px 0; border-bottom: 1px solid var(--line-2); }
.traca__row:last-child { border-bottom: 0; }
.traca__k { color: var(--ink-3); flex: 0 0 96px; font-size: 13px; }
.traca__v { color: var(--ink); }

/* píndola d'especialista */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; letter-spacing: .09em; padding: 4px 9px; border-radius: var(--r-pill); background: var(--navy); color: #fff; }
.pill--soft { background: var(--surface-2); color: var(--ink-2); }

/* ── silenci ─────────────────────────────────────────────────────────────── */
.silenci { text-align: center; padding: var(--sp7) var(--sp4); }
.silenci__ico { width: 56px; height: 56px; margin: 0 auto var(--sp4); border-radius: 50%; background: var(--good-bg); display: grid; place-items: center; color: var(--good); }
.silenci__t { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.silenci__p { color: var(--ink-2); margin-top: var(--sp2); }

/* ── gràfics ─────────────────────────────────────────────────────────────── */
.chart { width: 100%; overflow: visible; }
.chart-wrap { position: relative; }
.g-grid { stroke: var(--line); stroke-width: 1; }
.g-axis { stroke: var(--line); stroke-width: 1; }
.g-lbl { fill: var(--ink-3); font-size: 11px; font-family: var(--font); }
.g-lbl--str { fill: var(--ink-2); font-weight: 650; }
.g-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.g-band { fill: var(--band); }
.g-dot { r: 4; stroke: var(--surface); stroke-width: 2; }
.g-bar { rx: 4; }
.legend { display: flex; flex-wrap: wrap; gap: var(--sp4); margin-top: var(--sp3); font-size: 13px; color: var(--ink-2); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: -1px; }
.tip { position: absolute; pointer-events: none; background: var(--navy); color: #fff; font-size: 12px; padding: 7px 10px; border-radius: var(--r-xs); opacity: 0; transition: opacity .12s; white-space: nowrap; z-index: 5; }
.tip.on { opacity: 1; }

/* ── navegació ───────────────────────────────────────────────────────────── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar__in { display: flex; max-width: 560px; margin: 0 auto; }
.tabbar__more { flex: 1; min-width: 0; }
.tabbar__more > summary { list-style: none; }
.tabbar__more > summary::-webkit-details-marker { display: none; }
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 4px 8px;
  text-decoration: none; color: var(--ink-3); font-size: 11px; font-weight: 600; position: relative; min-height: var(--nav-h);
}
.tab svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tab.on { color: var(--navy); }
.tab.on::before { content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 26px; height: 3px; border-radius: 0 0 3px 3px; background: var(--emerald); }
.tab__n { position: absolute; top: 5px; right: 50%; margin-right: -20px; background: var(--crit); color: #fff; font-size: 10px; font-weight: 700; min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }
.tab--more { border: 0; background: transparent; cursor: pointer; font-family: inherit; }

/* tauleta i escriptori: la navegació passa al lateral */
@media (min-width: 900px) {
  body { padding-bottom: 0; padding-left: 264px; }
  .tabbar { display: none; }
  .hd { padding-left: 264px; background: rgba(244,241,233,.9); }
}

/* ── rail: el mapa del restaurant ───────────────────────────────────────── */
.rail { position: fixed; inset: 0 auto 0 0; z-index: 45; width: 264px; padding: 26px 18px 24px;
  background: #e7eadf; border-right: 1px solid #d0d6c7; overflow-y: auto; }
.rail__brand { display: grid; grid-template-columns: 25px auto; align-items: center; column-gap: 9px;
  color: var(--navy); font-weight: 700; letter-spacing: .11em; font-size: 14px; padding: 0 12px 28px; }
.rail__brand img { width: 25px; height: 25px; grid-row: span 2; }
.rail__brand small { grid-column: 2; color: var(--ink-3); font-size: 10px; letter-spacing: .03em; font-weight: 500; margin-top: -2px; }
.rail__section { margin: 19px 12px 7px; color: #79857d; font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
.rail__link { display: flex; align-items: center; gap: 11px; min-height: 38px; padding: 8px 12px; border-radius: 9px;
  color: var(--ink-2); text-decoration: none; font-size: 14px; font-weight: 600; transition: background .18s, color .18s, transform .18s; }
.rail__link:hover { background: rgba(251,250,245,.7); color: var(--navy); transform: translateX(2px); }
.rail__link.on { background: var(--navy); color: #f7f5eb; box-shadow: 0 5px 14px rgba(23,59,61,.12); }
.rail__account { margin-top: 26px; padding-top: 12px; border-top: 1px solid #d0d6c7; }
.rail__account .rail__link { font-size: 13px; min-height: 34px; font-weight: 500; }
.rail__mark { width: 17px; height: 17px; border: 1.6px solid currentColor; border-radius: 5px; opacity: .75; position: relative; }
.rail__mark--today { border-radius: 50%; }.rail__mark--service::after { content:""; position:absolute; left:3px; right:3px; top:7px; border-top:1px solid currentColor; }
.rail__mark--book { border-radius: 2px 5px 5px 2px; }.rail__mark--numbers { border-radius: 2px; }
.rail__mark--numbers::after { content:""; position:absolute; width:8px; border-top:1.5px solid currentColor; transform:rotate(-35deg); left:3px; top:9px; }
.rail__mark--nori { border-radius: 50%; }.rail__note { margin-left: auto; font-family: var(--mono); font-size: 9px; opacity: .65; }
.mobile-nav { display: none; }
.sense-xrome .rail { display: none; }
@media (max-width: 899px) {
  .rail { display: none; }
  .mobile-nav { position: fixed; display: block; left: 12px; right: 12px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px);
    z-index: 55; max-height: calc(100dvh - var(--nav-h) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 28px);
    overflow-y: auto; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 14px 38px rgba(23,59,61,.18); animation: enter .18s var(--ease); }
  .mobile-nav[hidden] { display: none; }
  .mobile-nav__head { display:flex; justify-content:space-between; align-items:center; padding: 2px 3px 12px; border-bottom:1px solid var(--line-2); }
  .mobile-nav__head button { border:0; background:none; font-size:25px; line-height:1; color:var(--ink-3); cursor:pointer; min-width:38px; min-height:38px; }
  .mobile-nav__grid { display:grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 3px 8px; padding-top: 9px; }
  .mobile-nav__grid a { min-width:0; min-height:43px; display:flex; align-items:center; padding: 8px 7px; color:var(--ink-2); font-size:14px; font-weight:600; text-decoration:none; border-radius:8px; }
  .mobile-nav__grid a:hover { background:var(--surface-2); color:var(--navy); }
}
@media (min-width: 900px) {
  body.sense-xrome { padding-left: 0; }
  body.sense-xrome .hd { padding-left: 0; }
}

/* ── xat amb Nori ────────────────────────────────────────────────────────── */
.xat { display: flex; flex-direction: column; gap: var(--sp3); padding-bottom: 96px; }
.bombolla { max-width: 88%; padding: 12px 15px; border-radius: 18px; font-size: 15.5px; line-height: 1.48; white-space: pre-wrap; }
.bombolla--nori { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; align-self: flex-start; box-shadow: var(--shadow-1); }
.bombolla--jo { background: var(--navy); color: #fff; border-bottom-right-radius: 6px; align-self: flex-end; }
.pensant { display: inline-flex; gap: 4px; align-items: center; color: var(--ink-3); font-size: 13px; }
.pensant i { width: 5px; height: 5px; border-radius: 50%; background: var(--ink-3); animation: bl 1.1s infinite; }
.pensant i:nth-child(2) { animation-delay: .18s; } .pensant i:nth-child(3) { animation-delay: .36s; }
@keyframes bl { 0%,60%,100% { opacity: .25; } 30% { opacity: 1; } }
.composer {
  position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding: var(--sp3) var(--sp4) var(--sp3); background: rgba(246,248,249,.94);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line);
}
.composer__in { display: flex; gap: var(--sp2); max-width: 1120px; margin: 0 auto; }
.composer input {
  flex: 1; min-height: 48px; padding: 12px 16px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface); outline: none; font-size: 16px;
}
.composer input:focus { border-color: var(--emerald-ink); box-shadow: 0 0 0 3px rgba(22,199,154,.16); }
.composer button { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--navy); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.composer button:disabled { opacity: .4; }
@media (min-width: 900px) { .composer { left: 232px; bottom: 0; } }

/* ── esquelet de càrrega ─────────────────────────────────────────────────── */
.sk { background: linear-gradient(90deg, var(--surface-2) 25%, #E7ECEE 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: sh 1.3s ease infinite; border-radius: var(--r-s); }
@keyframes sh { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ── instal·lació ────────────────────────────────────────────────────────── */
.install { position: fixed; left: var(--sp4); right: var(--sp4); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px); z-index: 60;
  background: var(--navy); color: #fff; border-radius: var(--r); padding: var(--sp4); box-shadow: var(--shadow-2); display: flex; gap: var(--sp3); align-items: center; }
.install p { font-size: 14px; line-height: 1.4; }
.install button { border: 0; border-radius: var(--r-s); padding: 10px 14px; font-weight: 650; cursor: pointer; }
.install .si { background: var(--emerald); color: var(--navy); }
.install .no { background: transparent; color: rgba(255,255,255,.6); }

.mut { color: var(--ink-3); font-size: 13px; }
.peu { margin-top: var(--sp5); padding-top: var(--sp4); border-top: 1px solid var(--line); color: var(--ink-3); font-size: 13px; }

/* llista secundària del radar: la píndola d'especialista ocupa sempre el mateix
   ample perquè els titulars quedin alineats a la mateixa columna */
.pila { display: flex; flex-direction: column; }
.pila > button { display: flex; align-items: center; gap: var(--sp3); width: 100%; text-align: left;
  background: none; border: 0; border-top: 1px solid var(--line-2); padding: 14px 2px; cursor: pointer; min-height: 56px; }
.pila > button:first-child { border-top: 0; }
.pila .pill { flex: 0 0 auto; width: 104px; justify-content: center; }

/* ══ CAPA DE PLATAFORMA ═══════════════════════════════════════════════════
   Accés, alta, compte, equip i pla. Mateix sistema: una columna, objectius
   tàctils de 44 px i cap element decoratiu que no digui res.
   ─────────────────────────────────────────────────────────────────────────── */

/* ── botó de compte i menú ───────────────────────────────────────────────── */
.hd__compte {
  margin-left: 10px; flex: none; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2);
  display: grid; place-items: center; padding: 0; line-height: 1; text-align: center;
  font-size: 12px; font-weight: 800; letter-spacing: .04em; cursor: pointer; position: relative;
}
.hd__compte::after { content: ""; position: absolute; inset: -5px; }
.hd__compte:hover { border-color: var(--ink-3); }

.account-shell { position: relative; flex: none; margin-left: auto; }
.account-shell > summary { list-style: none; display: inline-flex !important; align-items: center; justify-content: center; }
.account-shell > summary::-webkit-details-marker { display: none; }
.account-shell > summary::marker { content: ""; }
.hd__compte #compteText { display: block; line-height: 1; text-align: center; }
.menu {
  position: fixed; z-index: 70; top: calc(58px + env(safe-area-inset-top)); right: var(--sp4);
  width: min(320px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-2); padding: var(--sp2); display: none;
  max-height: calc(100vh - 80px); overflow-y: auto;
}
.account-shell[open] .menu { display: block; animation: enter .16s var(--ease); }
.menu.on { display: block; animation: enter .16s var(--ease); }
.menu__cap { padding: var(--sp3); border-bottom: 1px solid var(--line-2); }
.menu__nom { font-weight: 700; }
.menu__sub { color: var(--ink-3); font-size: 13px; margin-top: 2px; word-break: break-all; }
.menu__pill { margin-top: var(--sp2); display: inline-block; font-size: 11px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); background: var(--surface-2);
  border-radius: var(--r-pill); padding: 4px 9px; }
.menu__grup { padding: var(--sp2) 0; border-bottom: 1px solid var(--line-2); }
.menu__grup:last-child { border-bottom: 0; }
.menu__et { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-3); padding: var(--sp2) var(--sp3); }
.menu__it {
  display: flex; align-items: center; width: 100%; min-height: 44px; padding: 10px var(--sp3);
  border: 0; background: none; text-align: left; text-decoration: none; color: var(--ink);
  font-size: 15px; font-family: inherit; border-radius: var(--r-s); cursor: pointer;
}
.menu__it:hover { background: var(--surface-2); }
.menu__it.on { font-weight: 650; }
.menu__it.on::after { content: "·"; margin-left: auto; color: var(--emerald-ink); font-size: 26px; line-height: 0; }
.menu__it--fluix { color: var(--ink-3); }

/* ── pantalles d'accés ───────────────────────────────────────────────────── */
body.sense-xrome .tabbar { display: none; }
body.sense-xrome { padding-bottom: 0; padding-left: 0; }
body.sense-xrome .hd { display: none; }

.porta { max-width: 420px; margin: 0 auto; padding: var(--sp5) 0 var(--sp7); animation: enter .26s var(--ease); }
.porta__marca { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .06em;
  font-size: 13px; color: var(--navy); margin-bottom: var(--sp6); }
.porta__marca img { width: 22px; height: 22px; }
.porta__t { font-size: clamp(26px, 6.4vw, 32px); line-height: 1.16; letter-spacing: -.026em; }
.porta__p { margin-top: var(--sp3); color: var(--ink-2); }
.porta__cos { margin-top: var(--sp5); }
.porta__peu { margin-top: var(--sp5); padding-top: var(--sp4); border-top: 1px solid var(--line);
  color: var(--ink-3); font-size: 14px; }
.porta__peu a, .porta__p a { color: var(--emerald-ink); font-weight: 650; }

/* ── formularis ──────────────────────────────────────────────────────────── */
.camp { display: block; margin-bottom: var(--sp4); }
.camp--grup { border: 1px solid var(--line); border-radius: var(--r-s); padding: var(--sp3); }
.camp__t { display: block; font-size: 13px; font-weight: 650; color: var(--ink-2); margin-bottom: 6px; }
.camp__in {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: var(--r-s);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 16px; font-family: inherit; outline: none; -webkit-appearance: none; appearance: none;
}
select.camp__in { background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 19px) 21px, calc(100% - 14px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 38px; }
.camp__in--petit { min-height: 40px; padding: 8px 10px; font-size: 14px; }
.camp__in:focus { border-color: var(--emerald-ink); box-shadow: 0 0 0 3px rgba(22,199,154,.16); }
.camp__ajuda { display: block; margin-top: 6px; color: var(--ink-3); font-size: 13px; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp3); }
.btn--ample { width: 100%; justify-content: center; }
form .btn { margin-top: var(--sp2); }

.dies { display: flex; flex-wrap: wrap; gap: var(--sp2); }
.dia { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--r-pill); font-size: 14px; cursor: pointer; }
.dia:has(input:checked) { border-color: var(--emerald-ink); background: var(--good-bg); color: var(--good); font-weight: 650; }
.dia input { accent-color: var(--emerald-ink); width: 16px; height: 16px; }

.tria { display: flex; gap: var(--sp3); align-items: flex-start; padding: var(--sp3);
  border: 1px solid var(--line); border-radius: var(--r-s); cursor: pointer; margin-top: var(--sp2); }
.tria:has(input:checked) { border-color: var(--emerald-ink); background: var(--good-bg); }
.tria input { accent-color: var(--emerald-ink); width: 20px; height: 20px; margin-top: 2px; flex: none; }
.tria__c b { display: block; font-size: 15px; }
.tria__c em { display: block; font-style: normal; color: var(--ink-2); font-size: 14px; margin-top: 4px; line-height: 1.45; }

/* ── avisos ──────────────────────────────────────────────────────────────── */
.avis { border-radius: var(--r-s); padding: var(--sp3); font-size: 14px; line-height: 1.5;
  background: var(--surface-2); color: var(--ink-2); margin-bottom: var(--sp4); }
.avis--mal { background: var(--crit-bg); color: var(--crit); }
.avis--be { background: var(--good-bg); color: var(--good); }
.codi { display: block; margin-top: 8px; font-family: var(--mono); font-size: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xs);
  padding: 8px 10px; word-break: break-all; color: var(--ink); }

/* ── taules ──────────────────────────────────────────────────────────────── */
.taula { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.taula th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-3); padding: 0 8px 8px 0; }
.taula td { padding: 11px 8px 11px 0; border-top: 1px solid var(--line-2); vertical-align: middle; }
.taula tr:first-child td { border-top: 0; }
.taula td:last-child, .taula th:last-child { padding-right: 0; }
.dre { text-align: right; font-variant-numeric: tabular-nums; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tr--mal { color: var(--crit); border-bottom-color: rgba(185,28,28,.4); font-size: 13px; }
.pill--mal { background: var(--crit-bg); color: var(--crit); }

/* ── plans ───────────────────────────────────────────────────────────────── */
.pla { border: 1px solid var(--line); border-radius: var(--r-s); padding: var(--sp3); margin-top: var(--sp2); }
.pla--on { border-color: var(--emerald-ink); background: var(--good-bg); }
.pla__cap { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp3); }
.pla__cap span { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.pla__p { color: var(--ink-2); font-size: 14px; margin-top: 6px; line-height: 1.45; }
.pla__l { margin-top: 6px; }
.pla .btn { margin-top: var(--sp3); }

.barra { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.barra i { display: block; height: 100%; background: var(--emerald-ink); border-radius: 4px; }

/* ── fitxa de persona a l'equip ──────────────────────────────────────────── */
.persona { padding: var(--sp3) 0; border-top: 1px solid var(--line-2); }
.persona:first-of-type { border-top: 0; padding-top: 0; }
.persona__resum { display: flex; align-items: center; justify-content: space-between; gap: var(--sp3); cursor: pointer; list-style: none; }
.persona__resum::-webkit-details-marker { display: none; }
.persona__resum::after { content: "⌄"; color: var(--ink-3); font-size: 18px; line-height: 1; }
.persona[open] .persona__resum::after { transform: rotate(180deg); }
.persona__resum b { display: block; }
.persona__c { display: block; color: var(--ink-3); font-size: 13px; word-break: break-all; margin-top: 2px; }
.persona--inactiva { opacity: .68; }
.persona__estat { flex: 0 0 auto; font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); background: var(--surface-2); border-radius: var(--r-pill); padding: 4px 8px; }
.persona__estat--actiu { color: var(--good); background: var(--good-bg); }
.persona__fitxa { margin-top: var(--sp3); padding: var(--sp3); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-s); }
.persona__valor { display: block; min-height: 48px; padding: 13px 0; color: var(--ink-2); }
.persona__locals { margin: var(--sp3) 0 0; padding: var(--sp2) 0 0; border: 0; border-top: 1px solid var(--line-2); }
.persona__locals legend { padding: 0; color: var(--ink-3); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.persona__locals-list { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 9px; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13px; }
.check input { accent-color: var(--emerald-ink); }
.persona__accions { margin-top: var(--sp3); }

/* les dues columnes s'alineen per la base: si una etiqueta ocupa dues línies,
   els camps no han de quedar escalonats */
.dos { align-items: end; }

/* ═══════════════════════════════════════════════════════════════════════════
   SHELL 2.0 · the service board
   The shell is deliberately quieter than the data: a dark petrol map on the
   left, linen work surface in the middle, amber only for "current".
   ═══════════════════════════════════════════════════════════════════════════ */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 100;
  opacity: .028; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
}

.hd {
  background: rgba(243,239,230,.94);
  border-bottom-color: var(--line);
}
.hd__in {
  max-width: 1240px; min-height: 72px; padding: 12px 28px;
  gap: 14px;
}
.hd__logo {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  color: var(--navy); font-size: 11px; font-weight: 800; letter-spacing: .1em;
  text-decoration: none; min-width: 44px; min-height: 44px; padding: 0 6px; margin: 0;
}
.hd__logo img { width: 18px; height: 18px; flex: none; }
.hd__context {
  color: var(--ink-3); font-family: var(--mono); font-size: 10px;
  letter-spacing: .14em; font-weight: 500; padding-right: 4px;
}
.hd__title {
  font-family: var(--display); font-size: 23px; letter-spacing: -.02em;
  color: var(--navy); border-left: 1px solid var(--line); padding-left: 16px;
}
.hd__end { gap: 8px; }
.hd__compte {
  width: 40px; height: 40px; margin-left: 14px; background: var(--navy);
  border: 3px solid var(--surface); color: var(--emerald); box-shadow: 0 0 0 1px var(--navy);
}
.hd__compte:hover { background: var(--navy-2); border-color: var(--emerald); transform: translateY(-1px); }

.wrap {
  max-width: 1240px; padding: 38px 28px 64px;
}
.view { max-width: 920px; }
.eyebrow { color: var(--emerald-ink); letter-spacing: .16em; }
.titular { font-size: clamp(30px, 4vw, 46px); max-width: 760px; }
.frase { max-width: 68ch; }
.card {
  border-radius: 13px; border-color: var(--line); box-shadow: var(--shadow-1);
  transition: box-shadow .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.card:hover { border-color: #c8c1b1; box-shadow: var(--shadow-2); }
.btn { border-radius: 11px; }
.btn:hover { border-color: #b9b09f; background: #fffaf0; box-shadow: 0 5px 14px rgba(16,47,53,.08); transform: translateY(-1px); }
.btn--main { background: var(--navy); border-color: var(--navy); box-shadow: 0 7px 16px -8px rgba(16,47,53,.75); }
.btn--main:hover { background: var(--navy-2); border-color: var(--navy-2); }
.btn--ghost:hover { background: rgba(229,184,92,.12); color: var(--navy); }

.rail {
  width: 232px; padding: 18px 12px 16px; background: var(--navy);
  border-right: 0; color: #e8eee8; box-shadow: 8px 0 26px rgba(16,47,53,.08);
}
.rail__brand { color: #f7f1e4; padding: 0 10px 14px; font-size: 13px; }
.rail__brand img { width: 22px; height: 22px; filter: brightness(0) invert(1); }
.rail__brand small { color: #9bb0a8; }
.rail__status {
  display: flex; align-items: center; gap: 8px; margin: 0 10px 19px;
  padding: 9px 10px; border: 1px solid rgba(229,184,92,.2); border-radius: 7px;
  color: #b6c8c0; font-family: var(--mono); font-size: 9px; letter-spacing: .04em;
}
.rail__status i { width: 6px; height: 6px; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 0 3px rgba(229,184,92,.15); }
.rail__section { margin: 14px 10px 5px; color: #718d88; font-size: 9px; }
.rail__section:first-child { margin-top: 0; }
.rail__link { min-height: 36px; color: #b5c6c0; border-radius: 8px; padding: 7px 10px; }
.rail__link:hover { background: rgba(255,255,255,.08); color: #fff7e8; transform: translateX(3px); }
.rail__link.on { background: var(--emerald); color: var(--navy); box-shadow: 0 7px 18px rgba(0,0,0,.18); }
.rail__link.on .rail__mark { opacity: 1; }
.rail__account { margin-top: 22px; padding-top: 14px; border-top-color: rgba(255,255,255,.13); }
.rail__account .rail__link { color: #91aaa2; }
.rail__account .rail__link:hover { color: #fff7e8; }
.rail__mark { width: 16px; height: 16px; }
.rail__note { color: var(--emerald); }
.rail__link.on .rail__note { color: var(--navy); }

.menu {
  top: 78px; right: 24px; width: min(350px, calc(100vw - 32px));
  border-color: var(--line); box-shadow: 0 18px 42px rgba(16,47,53,.22);
}
.menu__cap { padding: 17px; background: var(--navy); color: #f8f2e8; border-radius: 12px 12px 0 0; margin: -8px -8px 8px; }
.menu__sub { color: #afc1ba; }
.menu__pill { background: rgba(229,184,92,.18); color: var(--emerald); }
.menu__it:hover { background: var(--surface-2); }

@media (min-width: 900px) {
  body { padding-left: 232px; }
  .tabbar { display: none; }
  .hd { padding-left: 232px; }
  .hd__logo { display: none; }
  .composer { left: 232px; bottom: 0; background: rgba(243,239,230,.94); }
}
@media (min-width: 1200px) {
  .wrap { padding-top: 46px; }
  .view { max-width: 960px; }
}

/* Mobile is a compact instrument panel, not a squeezed desktop. */
@media (max-width: 899px) {
  body.nav-oberta { overflow: hidden; }
  body { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
  .hd__in { width: 100%; min-width: 0; min-height: 56px; padding: 8px 16px; gap: 10px; flex-wrap: nowrap; }
  .hd__logo { min-width: 0; }
  .hd__context { display: none; }
  .hd__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 21px; border-left: 0; padding-left: 0; }
  .hd__end { display: none; }
  .hd__compte { margin-left: auto; width: 38px; height: 38px; }
  .wrap { padding: 25px 16px 44px; }
  .titular { font-size: clamp(29px, 8.2vw, 37px); }
  .accions { margin-top: 20px; }
  .card { padding: 15px; }
  .tabbar { background: rgba(251,248,240,.96); border-top-color: var(--line); }
  .tabbar__in { padding: 0 4px; }
  .tab { min-height: var(--nav-h); padding-top: 10px; font-size: 10px; }
  .tab svg { width: 21px; height: 21px; }
  .tab.on { color: var(--navy); }
  .tab.on::before { background: var(--emerald-ink); height: 3px; }
  .mobile-nav { left: 10px; right: 10px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px); }
  .mobile-nav__groups { display: grid; gap: 12px; padding-right: 2px; }
  .mobile-nav__group { border-top: 1px solid var(--line-2); padding-top: 10px; }
  .mobile-nav__group:first-child { border-top: 0; padding-top: 0; }
  .mobile-nav__label { color: var(--ink-3); font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; margin: 0 5px 4px; }
  .mobile-nav__grid a.on { background: var(--navy); color: #fff7e8; box-shadow: var(--shadow-1); }
}
@media (max-width: 420px) {
  .hd__in { padding-left: 13px; padding-right: 13px; }
  .wrap { padding-left: 13px; padding-right: 13px; }
  .tab { padding-left: 1px; padding-right: 1px; }
  .tab svg { width: 20px; height: 20px; }
  .tab--more { flex: .82; }
  .dos { grid-template-columns: 1fr; gap: 0; }
}
@media (max-height: 620px) and (max-width: 899px) {
  .hd__in { min-height: 54px; padding-top: 6px; padding-bottom: 6px; }
  .hd__end { display: none; }
  .tab { min-height: 58px; padding-top: 6px; }
  :root { --nav-h: 58px; }
  .wrap { padding-top: 18px; }
  .mobile-nav { max-height: calc(100dvh - 84px); overflow-y: auto; }
}

/* ── primitives de composició ────────────────────────────────────────────── */
.card--spaced { margin-top: var(--sp5); }
.stack { display: grid; gap: var(--sp3); }
.stack--roomy { gap: var(--sp5); }
.row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row--wrap { flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.row__grow { flex: 1; min-width: 0; }
.metric { font-size: 30px; font-weight: 700; letter-spacing: -.025em; line-height: 1; }
.metric--small { font-size: 24px; }
.data-row { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.data-row:last-child { border-bottom: 0; }
.data-row__label { flex: 0 0 96px; color: var(--ink-3); font-size: 13px; }
.data-row__value { flex: 1; min-width: 0; font-size: 15px; }
.action-list { display: grid; gap: var(--sp2); margin-top: var(--sp5); }
.action-list .btn { justify-content: flex-start; text-align: left; }
.action-list__text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; font-size: 15px; }
.action-list__chev { display: flex; flex: none; color: var(--ink-3); }
.status-card { border-color: #e4c28f; background: var(--warn-bg); box-shadow: var(--shadow-2); }
.notice { margin-top: var(--sp3); padding: 12px 14px; border-radius: var(--r-s); font-size: 14.5px; }
.notice--good { background: var(--good-bg); color: var(--good); }
.notice--warn { background: var(--warn-bg); color: var(--warn); }
@media (max-width: 420px) {
  .data-row__label { flex-basis: 82px; }
  .metric { font-size: 27px; }
}

/* ── arrencada en fred ───────────────────────────────────────────────────── */
.fred { text-align: center; padding: var(--sp6) 0 var(--sp4); max-width: 460px; margin: 0 auto; }
.fred__ico { width: 56px; height: 56px; margin: 0 auto var(--sp4); border-radius: 50%;
  background: var(--surface-2); display: grid; place-items: center; color: var(--ink-3); }
.fred__t { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.fred__p { color: var(--ink-2); margin-top: var(--sp2); }
.fred .accions { align-items: center; }
.fred .btn { width: 100%; justify-content: center; }

/* ── fitxa d’agent · El Torn ─────────────────────────────────────────────── */
.agent-view { max-width: 960px; }
.agent-back { display: inline-flex; align-items: center; gap: 7px; color: var(--emerald-ink); font-size: 13px; font-weight: 700; text-decoration: none; margin-bottom: var(--sp4); }
.agent-back:hover { color: var(--navy); }
.agent-hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 14px; align-items: stretch; }
.agent-hero__main { padding: 26px; border-radius: var(--r); background: var(--navy); color: #f7f5eb; }
.agent-hero__main p { color: rgba(247,245,235,.72); margin-top: 12px; max-width: 54ch; }
.agent-eyebrow { color: var(--emerald-ink); font: 500 11px var(--mono); letter-spacing: .13em; text-transform: uppercase; }
.agent-hero__main .agent-eyebrow { color: var(--emerald); }
.agent-heading { color: #f7f5eb; font-size: clamp(32px, 4vw, 48px); margin-top: 8px; line-height: 1.08; letter-spacing: -.035em; }
.agent-facts { padding: 22px; border: 1px solid #d0d6c7; border-radius: var(--r); background: #e7eadf; }
.agent-fact { padding: 11px 0; border-bottom: 1px solid #d0d6c7; }
.agent-fact:last-child { border-bottom: 0; padding-bottom: 0; }
.agent-fact small { display: block; color: var(--ink-3); font: 500 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.agent-fact b { display: block; margin-top: 3px; font-size: 14px; }
.agent-good { color: var(--good); }
.agent-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 17px; }
.agent-primary, .agent-secondary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 10px 14px; border-radius: var(--r-s); font-size: 13px; font-weight: 700; text-decoration: none; cursor: pointer; }
.agent-primary { border: 1px solid var(--emerald-ink); background: var(--emerald-ink); color: #fff; }
.agent-primary:hover { background: #c5861d; border-color: #c5861d; }
.agent-secondary { border: 1px solid var(--line); background: transparent; color: var(--ink-2); }
.agent-secondary:hover { border-color: #b9b09f; background: #fffaf0; color: var(--navy); }
.agent-summary { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding: 16px 18px; border: 1px solid #d0d6c7; border-radius: var(--r); background: #e7eadf; }
.agent-summary__mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--emerald-ink); color: #fff; font: 700 22px var(--mono); flex: none; }
.agent-summary b, .agent-summary span { display: block; }
.agent-summary b { font-size: 15px; }
.agent-summary span { color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.agent-summary__metric { margin-left: auto; color: var(--navy); font: 700 18px var(--mono); white-space: nowrap; }
.agent-summary__metric small { display: inline; color: var(--ink-3); font: 500 12px var(--font); }
.agent-columns { display: grid; grid-template-columns: 1.1fr .9fr; gap: 12px; margin-top: 14px; }
.agent-panel { padding: 20px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.agent-panel h2 { margin-bottom: 16px; font: 700 18px var(--font); letter-spacing: -.025em; }
.agent-panel__heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.agent-panel__heading h2 { margin-top: 5px; margin-bottom: 0; }
.agent-panel__link { color: var(--emerald-ink); font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.agent-list { list-style: none; margin: 0; padding: 0; }
.agent-list li { display: flex; align-items: flex-start; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line-2); font-size: 14px; }
.agent-list li:first-child { padding-top: 0; border-top: 0; }
.agent-list small, .agent-decision-row small { display: block; margin-top: 3px; color: var(--ink-3); font-size: 12px; }
.agent-check { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--good-bg); color: var(--good); flex: none; font-size: 12px; }
.agent-source { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.agent-source:first-of-type { padding-top: 0; border-top: 0; }
.agent-source b { display: block; font-size: 13px; }
.agent-source small { display: block; color: var(--ink-3); font-size: 12px; margin-top: 3px; }
.agent-font { border-radius: var(--r-pill); padding: 5px 8px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.agent-font--viu { color: var(--good); background: var(--good-bg); }
.agent-font--pendent { color: var(--warn); background: var(--warn-bg); }
.agent-trace { margin-top: 7px; border-top: 1px solid var(--line-2); }
.agent-trace summary, .agent-why summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 0 2px; color: var(--emerald-ink); cursor: pointer; font-size: 13px; font-weight: 700; list-style: none; }
.agent-trace summary::-webkit-details-marker, .agent-why summary::-webkit-details-marker { display: none; }
.agent-trace__body { margin-top: 8px; padding: 10px 12px; border-radius: var(--r-s); background: var(--surface-2); }
.agent-trace__row { display: flex; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line-2); font-size: 12px; }
.agent-trace__row:last-child { border-bottom: 0; }
.agent-trace__row span { flex: 0 0 70px; color: var(--ink-3); }
.agent-trace__row b { font-weight: 600; }
.agent-status { border-radius: var(--r-pill); padding: 5px 9px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.agent-status--pending { color: var(--warn); background: var(--warn-bg); }
.agent-panel--result { margin-top: 12px; }
.agent-result { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 14px; border-left: 3px solid var(--emerald); background: #f1eee4; }
.agent-result b { font-size: 15px; }
.agent-result p { margin-top: 4px; color: var(--ink-2); font-size: 14px; }
.agent-result__numbers { text-align: right; white-space: nowrap; }
.agent-result__numbers strong { display: block; color: var(--emerald-ink); font-size: 28px; line-height: 1; }
.agent-result__numbers span { display: block; margin-top: 3px; color: var(--ink-3); font-size: 11px; }
.agent-movement { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 15px; margin-top: 15px; }
.agent-movement > div:not(.agent-movement__arrow) { min-width: 0; }
.agent-movement span { display: block; color: var(--ink-3); font-size: 12px; }
.agent-movement b { display: block; margin-top: 4px; font-size: 14px; }
.agent-movement__arrow { color: var(--emerald-ink); font-size: 22px; }
.agent-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.agent-tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink-2); font-size: 11px; font-weight: 650; }
.agent-tag i { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.agent-muted { margin-top: 7px; color: var(--ink-3); font-size: 12px; }
.agent-cost-line { margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line-2); color: var(--ink-2); font-size: 13px; }
.agent-cost-line span { color: var(--ink-3); }
.agent-actions--decision { margin-top: 18px; }
.agent-confirmation { display: flex; align-items: center; gap: 8px; margin-top: 18px; padding: 12px 14px; border-radius: var(--r-s); background: var(--good-bg); color: var(--good); font-size: 13px; }
.agent-confirmation a { margin-left: auto; color: inherit; font-weight: 700; }
.agent-confirmation--error { background: var(--crit-bg); color: var(--crit); }
.agent-panel--decision { margin-top: 12px; }
.agent-decision-row { display: flex; align-items: flex-start; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.agent-decision-row:first-of-type { border-top: 0; padding-top: 0; }
.agent-decision-number { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); font: 700 11px var(--mono); flex: none; }
.agent-why { margin-top: 12px; border-top: 1px solid var(--line); }
.agent-why summary span { color: var(--ink-3); font-weight: 500; }
.agent-why__body { padding: 0 0 4px; color: var(--ink-2); font-size: 14px; }
.agent-why__body p + p { margin-top: 10px; }
@media (max-width: 767px) {
  .agent-hero, .agent-columns { grid-template-columns: 1fr; }
  .agent-summary { align-items: flex-start; flex-wrap: wrap; }
  .agent-summary__metric { width: 100%; margin-left: 62px; margin-top: -8px; }
  .agent-movement { grid-template-columns: 1fr; gap: 10px; }
  .agent-movement__arrow { transform: rotate(90deg); justify-self: center; }
}
@media (max-width: 560px) {
  .agent-hero__main, .agent-facts, .agent-panel { padding: 17px; }
  .agent-result { flex-direction: column; gap: 12px; }
  .agent-result__numbers { text-align: left; }
  .agent-why summary { align-items: flex-start; flex-direction: column; }
}

/* ── EL TORN · recomanació i horari confirmat ─────────────────────────── */
.horari { max-width: 1060px; }
.horari__recomanacio { background: linear-gradient(145deg, #fffdf7, #f5efdf); border: 1px solid #ded2b7;
  border-radius: var(--r); padding: clamp(18px, 3vw, 28px); box-shadow: var(--shadow-1); }
.horari__recomanacio-cap { display:flex; align-items:flex-start; justify-content:space-between; gap:var(--sp4); margin-bottom:var(--sp4); }
.horari__recomanacio .titular { margin: 4px 0 0; max-width: 690px; }
.horari__metric { flex:0 0 auto; text-align:right; color:var(--navy); display:flex; flex-direction:column; align-items:flex-end; }
.horari__metric b { font-size:clamp(40px, 7vw, 62px); line-height:.85; letter-spacing:-.06em; }
.horari__metric span { max-width:110px; margin-top:6px; color:var(--ink-2); font-size:12px; font-weight:650; }
.horari__pills { display:flex; flex-wrap:wrap; gap:6px; margin-top:7px; }
.horari__servei { text-transform:none; letter-spacing:0; font-weight:650; }
.horari__servei i { width:6px; height:6px; border-radius:50%; display:inline-block; }
.horari__cap { display:flex; align-items:flex-end; justify-content:space-between; gap:var(--sp4); margin:var(--sp6) 0 var(--sp3); }
.horari__cap h2 { margin:2px 0 4px; font-size:clamp(24px,4vw,32px); letter-spacing:-.03em; }
.horari__cap .btn { flex:0 0 auto; }
.horari__navega { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:5px; border:1px solid var(--line); border-radius:var(--r-s); background:var(--surface); }
.horari__navega .btn { min-width:46px; margin:0; font-size:22px; padding:6px 10px; }
.horari__navega div { text-align:center; line-height:1.2; }
.horari__navega span { display:block; margin-top:3px; font-size:12px; color:var(--ink-3); }
.horari__resum { display:flex; flex-wrap:wrap; gap:0; margin:var(--sp3) 0; border:1px solid var(--line); border-radius:var(--r-s); background:var(--surface); }
.horari__resum span { display:flex; flex:1 1 180px; flex-direction:column; gap:2px; padding:12px 14px; border-right:1px solid var(--line); }
.horari__resum span:last-child { border-right:0; }
.horari__resum b { font-size:18px; }
.horari__resum small { color:var(--ink-3); font-size:12px; }
.horari__editor { margin-bottom:var(--sp3); }
.horari__editor .card__t { margin-bottom:3px; }
.horari__editor form .btn { margin-top:0; }
.horari__editor [data-conflictes] { margin:var(--sp3) 0; }
.horari__editor [data-conflictes] ul { margin:6px 0 0; padding-left:18px; }
.horari__setmana { display:grid; grid-template-columns:repeat(7, minmax(130px, 1fr)); gap:10px; overflow-x:auto; padding-bottom:8px; }
.horari__dia { min-height:225px; border:1px solid var(--line); border-radius:var(--r-s); background:var(--surface); overflow:hidden; }
.horari__dia--avui { border-color:var(--emerald-ink); box-shadow:0 0 0 2px rgba(180,119,29,.12); }
.horari__dia > header { display:flex; align-items:baseline; justify-content:space-between; padding:10px 11px 8px; background:var(--surface-2); border-bottom:1px solid var(--line-2); }
.horari__dia > header b { font-size:13px; }
.horari__dia > header span { color:var(--ink-3); font-size:12px; }
.horari__dia-torns { padding:7px; display:flex; flex-direction:column; gap:7px; }
.horari__buit-dia { padding:9px 5px; margin:0; }
.horari__torn { border:1px solid var(--line); border-radius:10px; padding:9px; background:#fffefa; }
.horari__torn--cancelat { opacity:.58; background:var(--surface-2); text-decoration-color:var(--ink-3); }
.horari__torn--cancelat .horari__persona { text-decoration:line-through; }
.horari__persona { margin:5px 0 1px; font-size:14px; font-weight:700; line-height:1.25; }
.horari__estat { font-size:9px; padding:3px 6px; }
.horari__estat--cancelat { color:var(--crit); }
.horari__previsio { margin:7px 0 0; padding-top:7px; border-top:1px solid var(--line-2); color:var(--ink-2); font-size:11px; line-height:1.35; }
.horari__previsio span { display:block; color:var(--ink-3); margin-top:1px; }
.horari__accions { display:flex; flex-wrap:wrap; gap:2px; margin-top:8px; }
.horari__accions .btn { min-height:30px; margin:0; padding:4px 5px; font-size:11px; }
.horari__cancelar { color:var(--crit); }
@media (max-width: 899px) {
  .horari__setmana { grid-template-columns:1fr; overflow:visible; }
  .horari__dia { min-height:0; }
  .horari__dia-torns { display:grid; grid-template-columns:repeat(auto-fit, minmax(200px, 1fr)); }
}
@media (max-width: 560px) {
  .horari__recomanacio-cap, .horari__cap { align-items:flex-start; flex-direction:column; }
  .horari__metric { align-items:flex-start; text-align:left; flex-direction:row; gap:9px; }
  .horari__metric span { max-width:190px; margin:0; align-self:center; }
  .horari__cap .btn { width:100%; justify-content:center; }
  .horari__resum span { flex-basis:100%; border-right:0; border-bottom:1px solid var(--line); }
  .horari__resum span:last-child { border-bottom:0; }
  .horari__dia-torns { grid-template-columns:1fr; }
}
.fred .peu { text-align: left; }

/* ── EL TORN · planificador setmanal ─────────────────────────────────────── */
.pt-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: var(--sp4); }
.pt-nav__set { font-weight: 750; font-size: 17px; letter-spacing: -.015em; }
.pt-nav .btn { min-height: 40px; padding: 7px 13px; font-size: 14px; }
.pt-graella { display: grid; grid-template-columns: 118px repeat(7, minmax(108px, 1fr)) 86px; min-width: 1020px; font-size: 13px; }
.pt-cap { padding: 8px 6px; border-bottom: 2px solid var(--line); font-weight: 700; }
.pt-cap--avui { color: var(--emerald-ink); }
.pt-cob { font-weight: 450; font-size: 11.5px; color: var(--ink-3); margin-top: 3px; line-height: 1.45; }
.pt-cob b { font-weight: 650; }
.pt-cob .falta { color: var(--warn); font-weight: 700; }
.pt-cob .prou { color: var(--good); }
.pt-persona { position: sticky; left: 0; background: var(--bg); z-index: 2; padding: 10px 8px 10px 2px; border-bottom: 1px solid var(--line-2); font-weight: 650; display: flex; flex-direction: column; justify-content: center; }
.pt-persona small { font-weight: 450; color: var(--ink-3); }
.pt-cella { border-bottom: 1px solid var(--line-2); border-left: 1px solid var(--line-2); padding: 5px 4px; display: flex; flex-direction: column; gap: 4px; min-height: 56px; }
.pt-cella--tancat { background: repeating-linear-gradient(-45deg, transparent 0 7px, var(--line-2) 7px 9px); }
.pt-bloc { display: block; width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 8px; padding: 5px 7px; font: inherit; font-size: 12px; line-height: 1.35; cursor: pointer; background: var(--surface); }
.pt-bloc b { font-size: 12.5px; }
.pt-bloc--esborrany { border-style: dashed; border-color: var(--emerald-ink); background: rgba(22,199,154,.07); }
.pt-bloc--modificat { border-color: var(--warn); background: var(--warn-bg); }
.pt-bloc--cancelat { opacity: .55; text-decoration: line-through; }
.pt-mes { border: 1px dashed var(--line); border-radius: 8px; background: none; color: var(--ink-3); font: inherit; font-size: 15px; cursor: pointer; padding: 2px 0; min-height: 26px; }
.pt-mes:hover { color: var(--emerald-ink); border-color: var(--emerald-ink); }
.pt-total { border-bottom: 1px solid var(--line-2); border-left: 1px solid var(--line-2); padding: 10px 8px; text-align: right; }
.pt-total b { font-size: 14px; }
.pt-total small { display: block; color: var(--ink-3); }
.pt-total .mal { color: var(--warn); font-weight: 650; }

/* el calaix lateral d'edició */
.calaix-fons { position: fixed; inset: 0; background: rgba(11,26,34,.35); z-index: 70; }
.calaix { position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 94vw); background: var(--surface); z-index: 71;
  box-shadow: -12px 0 40px rgba(11,26,34,.18); padding: var(--sp5) var(--sp4) calc(var(--sp5) + env(safe-area-inset-bottom));
  overflow-y: auto; animation: calaix-entra .22s var(--ease); }
@keyframes calaix-entra { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.calaix h2 { font-size: 19px; margin-bottom: var(--sp4); }

/* ── Centre dels nou agents ─────────────────────────────────────────────── */
.rail__mark--agents { border-radius: 3px; background: conic-gradient(from 45deg, #6c58d9, #178272, #d04d2e, #6c58d9); }
.agents-center { max-width: 1120px; }
.agents-intro { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 36px; align-items: end; padding: 26px 0 23px; border-bottom: 1px solid var(--line); }
.agents-intro h1 { max-width: 760px; margin-top: 8px; color: var(--navy); font-size: clamp(31px, 4vw, 54px); line-height: .99; letter-spacing: -.052em; }
.agents-intro p { max-width: 740px; margin-top: 16px; color: var(--ink-2); font-size: 16px; line-height: 1.58; }
.agents-counts { display: grid; grid-template-columns: repeat(3, 88px); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.agents-counts div { padding: 15px 10px; border-left: 1px solid var(--line-2); text-align: center; }
.agents-counts div:first-child { border-left: 0; }
.agents-counts b { display: block; color: var(--navy); font: 750 24px var(--mono); }
.agents-counts span { display: block; margin-top: 3px; color: var(--ink-3); font-size: 10px; line-height: 1.2; }
.agents-legend { display: flex; gap: 20px; flex-wrap: wrap; padding: 15px 0; color: var(--ink-2); font-size: 12px; }
.agents-legend span { display: inline-flex; align-items: center; gap: 6px; }
.agents-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.agents-dot--actiu { background: var(--good); }
.agents-dot--parcial { background: var(--warn); }
.agents-dot--pendent { background: #8d8b84; }
.agents-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.agents-card { position: relative; display: flex; min-height: 315px; flex-direction: column; padding: 20px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: inherit; text-decoration: none; box-shadow: 0 1px 0 rgb(0 0 0 / 2%); overflow: hidden; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.agents-card::before { position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--agent); content: ''; opacity: .85; }
.agents-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--agent) 48%, var(--line)); box-shadow: 0 8px 24px rgb(0 27 42 / 7%); }
.agents-card__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 22px; }
.agents-card__icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--agent) 12%, white); color: var(--agent); font: 750 15px var(--mono); }
.agents-status { padding: 5px 8px; border-radius: var(--r-pill); color: var(--ink-2); background: var(--surface-2); font-size: 9px; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; }
.agents-status--actiu { color: var(--good); background: var(--good-bg); }
.agents-status--parcial { color: var(--warn); background: var(--warn-bg); }
.agents-status--bloquejat { color: var(--ink-3); }
.agents-card h2 { margin-top: 6px; color: var(--navy); font-size: 25px; letter-spacing: -.035em; }
.agents-card > p { margin-top: 8px; color: var(--ink-2); font-size: 13px; line-height: 1.48; }
.agents-card__result, .agents-card__missing { margin-top: 16px; padding: 11px 12px; border-radius: var(--r-s); background: color-mix(in srgb, var(--agent) 7%, var(--surface-2)); }
.agents-card__result b, .agents-card__result span { display: block; }
.agents-card__result b { font-size: 12px; line-height: 1.35; }
.agents-card__result span, .agents-card__missing { margin-top: 4px; color: var(--ink-3); font-size: 11px; line-height: 1.4; }
.agents-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 18px; color: var(--agent); font-size: 12px; font-weight: 750; }
.agent-hero[style*="--agent"] { border-top: 3px solid var(--agent); }
.agent-empty-state { margin-top: 14px; padding: 24px; border: 1px dashed #beb9ac; border-radius: var(--r); background: var(--surface-2); }
.agent-empty-state h2 { margin-top: 5px; font-size: 22px; }
.agent-empty-state p { max-width: 700px; margin-top: 7px; color: var(--ink-2); }
.agent-list--plain li { min-height: 42px; align-items: center; }
.agent-status--ready { color: var(--good); background: var(--good-bg); }
.agent-result-copy { max-width: 760px; color: var(--ink-2); line-height: 1.55; }
.agent-subheading { margin: 22px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.agent-limit { margin-top: 12px; padding: 16px 18px; border-left: 3px solid var(--warn); background: var(--warn-bg); }
.agent-limit b { font-size: 13px; }
.agent-limit p { margin-top: 4px; color: var(--ink-2); font-size: 13px; }

@media (max-width: 960px) {
  .agents-intro { grid-template-columns: 1fr; gap: 20px; }
  .agents-counts { width: max-content; }
  .agents-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .agents-intro { padding-top: 12px; }
  .agents-intro h1 { font-size: 36px; }
  .agents-counts { width: 100%; grid-template-columns: repeat(3, 1fr); }
  .agents-grid { grid-template-columns: 1fr; }
  .agents-card { min-height: 280px; }
  .agents-legend { display: grid; gap: 8px; }
}
