/* Estil de l'app dels conductors d'Elsa (disseny de l'Albert: Satoshi, blau #000046 → #1b1464). */
:root {
  --fosc: #000046;
  --fosc2: #1b1464;
  --text: #0d0b4a;
  --gris: #8a8aa0;
  --full: #f1f1f5;
  --linia: #e3e3ea;
  --boto: #2a2a8a;
  --verd: #6cc72e;
  --punt: #43d43c;
  --taronja: #f5a623;
  --vermell: #e53935;
  --vermell-fons: #ffdfe3;
  --vermell-text: #e8243c;
  --lila-fons: #f0dcfa;
  --lila-text: #8a4fc7;
  --lila: #8d4fd0;
  --groc-fons: #fff6c9;
  --groc: #f5c02e;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Satoshi', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  background: linear-gradient(180deg, var(--fosc) 0%, var(--fosc2) 100%) fixed;
  color: #fff;
  -webkit-font-smoothing: antialiased;
  /* Comportament de app: sense seleccionar text, sense menú en mantenir premut, sense flaix blau. */
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
input, textarea { -webkit-user-select: text; user-select: text; font-family: inherit; }
button { font-family: inherit; border: 0; cursor: pointer; color: inherit; background: none; transition: transform .08s ease; }
button:active { transform: scale(.96); }
button:disabled { opacity: .5; }

#app { min-height: 100%; display: flex; flex-direction: column; }

/* ───────── Capçalera fosca ───────── */
.cap { padding: calc(env(safe-area-inset-top) + 14px) 22px 0; }
.titol-app { text-align: center; font-weight: 500; font-size: 15px; opacity: .95; margin-bottom: 28px; }
.fila { display: flex; justify-content: space-between; align-items: center; }
.nom-cond { font-size: 22px; font-weight: 700; }
.data { font-size: 16px; font-weight: 500; }
.temps-fila { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.temps { font-size: 38px; font-weight: 700; letter-spacing: -.5px; flex: 1; }
.punt { width: 20px; height: 20px; border-radius: 50%; background: var(--punt); box-shadow: 0 0 0 4px rgba(67,212,60,.25); flex: none; }
.punt.pausa { background: var(--taronja); box-shadow: 0 0 0 4px rgba(245,166,35,.25); }
.punt.parat { background: #6b6b9a; box-shadow: none; }
.bq { width: 46px; height: 46px; border-radius: 9px; background: var(--boto); display: grid; place-items: center; flex: none; }
.bq.clar { background: #e9e9f1; }
.ic-pausa { width: 14px; height: 16px; border-left: 5px solid #fff; border-right: 5px solid #fff; }
.ic-play { width: 0; height: 0; border-left: 15px solid var(--fosc); border-top: 9px solid transparent; border-bottom: 9px solid transparent; margin-left: 4px; }
.ic-stop { width: 16px; height: 16px; background: #f01e1e; border-radius: 2px; }
.en-pausa { color: var(--taronja); font-weight: 700; font-size: 14px; margin-top: 4px; }
.en-pausa span { color: #fff; font-weight: 500; }
.acabada { color: #b9b9e0; font-size: 14px; margin-top: 4px; }
.desfes { color: #b9b9e0; font-size: 13px; text-decoration: underline; padding: 6px 0 0; }

.linia-dia { position: relative; height: 4px; background: rgba(255,255,255,.12); border-radius: 2px; margin: 22px 0 6px; }
.linia-dia i { position: absolute; top: 0; bottom: 0; border-radius: 2px; background: #3d3db5; }
.linia-dia i.tram-pausa { background: var(--taronja); }
.hores-dia { display: flex; justify-content: space-between; font-size: 10px; font-weight: 500; opacity: .9; }

/* ───────── Pantalla d'inici (i de càrrega) ───────── */
.inici { flex: 1; display: flex; flex-direction: column; }
.boto-comenca { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 30px;
  background: var(--verd); color: #fff; font-weight: 700; font-size: 16px; padding: 13px; border-radius: 8px; }
.ic-tri { width: 0; height: 0; border-left: 11px solid #fff; border-top: 7px solid transparent; border-bottom: 7px solid transparent; }
.escena { position: relative; flex: 1; min-height: 260px; margin-top: 20px; overflow: hidden; }
.escena .silueta { position: absolute; left: 0; right: 0; bottom: 21%; width: 100%; height: 40%; object-fit: cover; object-position: bottom; }
.escena .llum { position: absolute; left: 50%; bottom: 14%; width: 120%; height: 30%; transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(205,205,255,.55) 0%, rgba(120,120,230,.18) 45%, rgba(27,20,100,0) 70%); }
.escena .furgo { position: absolute; left: 50%; bottom: 18%; width: 38%; max-width: 200px; transform: translateX(-50%);
  animation: bota 1.1s ease-in-out infinite; }
@keyframes bota { 0%, 100% { transform: translate(-50%, 0); } 40% { transform: translate(-50%, -5px); } 55% { transform: translate(-50%, -1px); } }

/* Esquelet mentre carrega */
.sk { background: linear-gradient(90deg, rgba(255,255,255,.08) 25%, rgba(255,255,255,.18) 50%, rgba(255,255,255,.08) 75%);
  background-size: 200% 100%; animation: brilla 1.3s infinite linear; border-radius: 6px; }
@keyframes brilla { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ───────── Full blanc amb la ruta ───────── */
.full { flex: 1; background: var(--full); color: var(--text); border-radius: 22px 22px 0 0; margin-top: 18px;
  display: flex; flex-direction: column; min-height: 50vh; padding-bottom: calc(env(safe-area-inset-bottom) + 70px); }
.pestanyes { display: flex; border-bottom: 1px solid var(--linia); background: #fff; border-radius: 22px 22px 0 0; }
.pt { flex: 1; text-align: center; padding: 16px 0 10px; font-weight: 700; font-size: 18px; color: #9b9bb0; }
.pt small { display: block; font-size: 13px; font-weight: 700; margin-top: 1px; }
.pt.act { color: var(--text); }
.p { display: flex; align-items: center; gap: 16px; padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--linia); position: relative; }
.p .h { font-weight: 700; font-size: 19px; min-width: 50px; }
.p .info { min-width: 0; flex: 1; }
.p .n { font-weight: 700; font-size: 19px; white-space: nowrap; overflow: hidden; line-height: 1.2; }
.p .d { font-size: 12px; font-weight: 700; color: var(--gris); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p .etiq { position: absolute; right: 12px; bottom: 9px; font-size: 9px; font-weight: 900; color: #fff; padding: 2px 6px; border-radius: 4px; letter-spacing: .3px; }
.p.no { background: var(--vermell-fons); color: var(--vermell-text); }
.p.no .d { color: var(--vermell-text); opacity: .85; }
.p.nou { background: var(--lila-fons); color: var(--lila-text); }
.p.nou .d { color: var(--lila-text); opacity: .8; }
.p.cadira { background: var(--groc-fons); }
.etiq.no { background: var(--vermell-text); }
.etiq.nou { background: var(--lila); }
.etiq.cadira { background: var(--groc); }
.etiq + .etiq { right: auto; }
.etiquetes { position: absolute; right: 12px; bottom: 9px; display: flex; gap: 4px; }
.etiquetes .etiq { position: static; }
.p.centre { background: transparent; color: var(--gris); }
.p.centre .h { font-weight: 500; }
.p.centre .fletxa { flex: 1; display: flex; align-items: center; gap: 12px; font-size: 12px; font-weight: 700; }
.p.centre .fletxa i { flex: 1; max-width: 90px; height: 1px; background: var(--gris); position: relative; }
.p.centre .fletxa i::after { content: ''; position: absolute; right: 0; top: -4px; border-left: 7px solid var(--gris); border-top: 4.5px solid transparent; border-bottom: 4.5px solid transparent; }
.p.guardant { opacity: .6; }
.buit { padding: 40px 24px; text-align: center; color: var(--gris); font-weight: 500; }

/* ───────── Barra de baix ───────── */
.nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 26px;
  padding: 10px 0 calc(env(safe-area-inset-bottom) + 12px); background: var(--full); border-top: 1px solid var(--linia); z-index: 5; }
.nav button { min-width: 92px; padding: 9px 20px; border-radius: 22px; font-size: 18px; font-weight: 500; }
.nav .act { background: var(--fosc2); color: #fff; }
.nav .off { border: 1px solid #c9c9d6; color: #c3c3d0; }

/* ───────── Panell (marcar una falta) ───────── */
.capa { position: fixed; inset: 0; background: rgba(0,0,30,.55); display: none; align-items: flex-end; z-index: 20; }
.capa.oberta { display: flex; }
.panell { background: #fff; color: var(--text); width: 100%; max-height: 92vh; overflow-y: auto; border-radius: 22px 22px 0 0;
  padding: 20px 18px calc(env(safe-area-inset-bottom) + 22px); }
.panell h3 { font-size: 22px; font-weight: 700; }
.panell .sub { color: var(--gris); font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.panell h4 { font-size: 13px; font-weight: 700; color: var(--gris); letter-spacing: .6px; margin: 16px 0 8px; text-transform: uppercase; }
.xips { display: flex; flex-wrap: wrap; gap: 8px; }
.xip { padding: 11px 14px; border-radius: 10px; background: var(--full); font-weight: 700; font-size: 15px; color: var(--text); }
.xip.si { background: var(--fosc2); color: #fff; }
.camp { width: 100%; font-size: 17px; padding: 12px; border: 1.5px solid #c9c9d6; border-radius: 10px; margin-top: 8px; color: var(--text); background: #fff; }
.avis-salut { background: #fff6c9; border-radius: 8px; padding: 8px 10px; font-size: 13px; font-weight: 500; margin-top: 8px; }
.gran { display: block; width: 100%; padding: 15px; border-radius: 12px; font-size: 17px; font-weight: 700; margin-top: 18px; text-align: center; text-decoration: none; }
.gran.blau { background: var(--fosc2); color: #fff; }
.gran.verd { background: #25a244; color: #fff; }
.gran.gris { background: var(--full); color: var(--text); margin-top: 10px; }
.gran.vora { border: 1.5px solid #c9c9d6; color: var(--text); margin-top: 10px; }
.falta-ja { background: var(--vermell-fons); color: var(--vermell-text); border-radius: 12px; padding: 12px; margin-top: 10px; font-weight: 700; }
.falta-ja small { display: block; font-weight: 500; color: var(--text); opacity: .7; margin-top: 2px; }
.ok-gran { font-size: 22px; font-weight: 700; color: #1d8a3a; }
.missatge { background: var(--full); border-radius: 10px; padding: 12px; margin-top: 10px; font-weight: 500; }

/* ───────── Diàleg (preguntes) i avís d'error ───────── */
.dialeg { position: fixed; inset: 0; background: rgba(0,0,30,.6); display: none; align-items: center; justify-content: center; z-index: 30; padding: 24px; }
.dialeg.obert { display: flex; }
.caixa { background: #fff; color: var(--text); border-radius: 18px; padding: 22px 20px 16px; width: 100%; max-width: 360px; }
.caixa p { font-size: 17px; font-weight: 500; line-height: 1.35; white-space: pre-line; }
.caixa .botons2 { display: flex; gap: 10px; margin-top: 18px; }
.caixa .botons2 button { flex: 1; padding: 13px 8px; border-radius: 11px; font-weight: 700; font-size: 16px; }
.caixa .si { background: var(--fosc2); color: #fff; }
.caixa .no { background: var(--full); }
.avis { position: fixed; left: 14px; right: 14px; bottom: calc(env(safe-area-inset-bottom) + 78px); background: #c62828; color: #fff;
  border-radius: 12px; padding: 13px 14px; font-weight: 700; font-size: 15px; z-index: 40; display: none; box-shadow: 0 6px 20px rgba(0,0,0,.3); }
.avis.vist { display: block; }

/* ───────── Oficina ───────── */
.tria { display: flex; gap: 10px; margin-top: 4px; }
.tria select { flex: 1; font-size: 16px; font-family: inherit; padding: 10px; border-radius: 10px; border: 0; background: rgba(255,255,255,.12); color: #fff; }
.tria option { color: #000; }
.bloc-of { background: #fff; margin: 12px 14px 0; border-radius: 14px; padding: 14px; color: var(--text); }
.bloc-of h4 { font-size: 13px; color: var(--gris); letter-spacing: .6px; text-transform: uppercase; margin-bottom: 8px; }
.bloc-of .lin { padding: 6px 0; border-bottom: 1px solid var(--linia); font-weight: 500; font-size: 15px; }
.bloc-of .lin:last-child { border-bottom: 0; }
.bloc-of .lin.mal { color: var(--vermell-text); font-weight: 700; }
.bloc-of input[type=time] { font-size: 16px; padding: 8px; border-radius: 8px; border: 1.5px solid #c9c9d6; margin: 4px 6px 4px 0; }
.petit { padding: 8px 12px; border-radius: 9px; font-weight: 700; font-size: 14px; background: var(--full); margin: 4px 6px 0 0; }
.petit.blau { background: var(--fosc2); color: #fff; }

.sense-clau { padding: 120px 30px; text-align: center; font-size: 19px; font-weight: 500; line-height: 1.4; }
