@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500&display=swap");

:root {
  --fons: #eef1f5;
  --paper: #ffffff;
  --tinta: #0f172a;
  --muted: #64748b;
  --linia: #e2e8f0;
  --linia-forta: #cbd5e1;
  --marca: #0b3d5c;
  --marca-suau: #e8f1f7;
  --accent: #0f766e;
  --accent-hover: #0d9488;
  --sortida: #b45309;
  --sortida-hover: #c2410c;
  --perill: #b91c1c;
  --ombra: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.04);
  --radi: 12px;
  --radi-sm: 8px;
  color: var(--tinta);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background: var(--fons);
  line-height: 1.45;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: var(--marca); text-decoration: none; }
a:hover { color: var(--accent); }
h1 {
  font-weight: 650;
  letter-spacing: -0.03em;
  margin: 0 0 0.35rem;
  font-size: clamp(1.5rem, 2.4vw, 1.85rem);
}
button, input, select { font: inherit; }

.barra {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  padding: 0.7rem 1.5rem;
  background: var(--marca);
  color: #f8fafc;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.barra a { color: rgba(248, 250, 252, 0.82); text-decoration: none; }
.barra a:hover,
.barra a.actiu { color: #fff; }
.barra nav {
  display: flex;
  gap: 0.25rem;
  flex: 1;
  flex-wrap: wrap;
}
.barra nav a {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
}
.barra nav a.actiu {
  background: rgba(255, 255, 255, 0.12);
}
.marca {
  font-weight: 700;
  letter-spacing: -0.04em;
  font-size: 1.05rem;
  color: #fff !important;
  white-space: nowrap;
}
.barra form {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin: 0;
  font-size: 0.9rem;
}
.barra .usuari-nom {
  color: rgba(248, 250, 252, 0.7);
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
button {
  border: 0;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radi-sm);
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  font-weight: 600;
}
button:hover { background: var(--accent-hover); }
button.text {
  background: transparent;
  color: rgba(248, 250, 252, 0.85);
  padding: 0.35rem 0.55rem;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}
button.text:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
button.petit {
  padding: 0.28rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
}
button.secundari {
  background: #fff;
  color: var(--marca);
  border: 1px solid var(--linia-forta);
}
button.secundari:hover { background: var(--marca-suau); }

main {
  padding: 1.5rem 1.25rem 2.5rem;
  max-width: 1180px;
  margin: 0 auto;
}
body.sense-barra main,
body.mode-fitxatge main {
  padding: 0;
  max-width: none;
}
body.mode-fitxatge {
  background:
    radial-gradient(1000px 480px at 0% 0%, #d7e8f2 0%, transparent 55%),
    radial-gradient(900px 420px at 100% 10%, #d9efe9 0%, transparent 50%),
    var(--fons);
}
.flash {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  border-radius: var(--radi-sm);
  padding: 0.75rem 0.95rem;
  margin: 0 0 1rem;
  font-size: 0.95rem;
}
body.mode-fitxatge .flash,
body.sense-barra .flash {
  width: min(100% - 2rem, 34rem);
  margin: 1rem auto 0;
}

.panell {
  background: var(--paper);
  border: 1px solid var(--linia);
  border-radius: var(--radi);
  box-shadow: var(--ombra);
  overflow: hidden;
}
.panell-cap {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.15rem 1.25rem 1rem;
  border-bottom: 1px solid var(--linia);
}
.panell-cap .sub,
.panell .sub {
  color: var(--muted);
  margin: 0;
  font-size: 0.92rem;
}
.panell-cos { padding: 0; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(1200px 500px at 10% -10%, #d7e8f2 0%, transparent 55%),
    radial-gradient(900px 420px at 100% 0%, #d9efe9 0%, transparent 50%),
    var(--fons);
}
.login {
  width: min(100%, 24rem);
  background: var(--paper);
  border: 1px solid var(--linia);
  border-radius: 16px;
  box-shadow: var(--ombra);
  padding: 1.75rem 1.5rem 1.5rem;
}
.login .sobre {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}
.login h1 {
  font-size: 2rem;
  margin-top: 0.35rem;
}
.login .sub { margin: 0.15rem 0 0; color: var(--muted); }
.login form, .formulari form { display: grid; gap: 0.9rem; margin-top: 1.35rem; }
label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.86rem;
  font-weight: 560;
  color: #334155;
}
input, select {
  border: 1px solid var(--linia-forta);
  background: #fff;
  border-radius: var(--radi-sm);
  padding: 0.65rem 0.75rem;
  color: var(--tinta);
}
input:focus, select:focus {
  outline: 2px solid rgba(15, 118, 110, 0.25);
  border-color: var(--accent);
}
button.primari {
  padding: 0.8rem 1rem;
  margin-top: 0.2rem;
  width: 100%;
}

.camp-clau {
  position: relative;
  display: block;
}
.camp-clau input {
  width: 100%;
  padding-right: 2.7rem;
}
.camp-clau .ull {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
}
.camp-clau .ull:hover {
  background: var(--marca-suau);
  color: var(--marca);
}
.camp-clau .ull svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
}
.camp-clau .ull svg[hidden] {
  display: none !important;
}

.fitxatge-login .rellotge-caixes { margin: 1.25rem 0 0.35rem; }
.rellotge-caixes {
  display: grid;
  gap: 0.75rem;
  justify-items: center;
  margin: 1.4rem 0 1.2rem;
}
.caixa-grup {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  justify-content: center;
}
.caixa-grup.hora { gap: 0.35rem; }
.caixa {
  min-width: 3.1rem;
  padding: 0.55rem 0.45rem;
  border-radius: 10px;
  background: #f1f5f9;
  border: 1px solid var(--linia-forta);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 1.35rem;
  font-weight: 500;
  text-align: center;
  color: var(--marca);
  font-variant-numeric: tabular-nums;
}
.caixa.ample { min-width: 4.6rem; }
.caixa.gran {
  min-width: 4.4rem;
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  padding: 0.7rem 0.55rem;
  background: #fff;
  box-shadow: var(--ombra);
}
.separador {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 2.4rem;
  color: var(--marca);
  font-weight: 500;
}

.pantalla-fitxatge {
  width: min(100%, 34rem);
  margin: 0 auto;
  padding: 1.5rem 1.1rem 2rem;
  text-align: center;
}
.fitxatge-cap {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  text-align: left;
  margin-bottom: 0.5rem;
}
.fitxatge-cap .sobre { margin: 0; }
.etiqueta-empleat {
  margin: 0.55rem 0 0.1rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 650;
}
.fitxatge-cap h1 {
  margin: 0;
  font-size: clamp(1.55rem, 4vw, 2rem);
}
.avui {
  list-style: none;
  padding: 0;
  margin: 0 0 1.1rem;
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}
.avui li {
  background: var(--marca-suau);
  color: var(--marca);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.88rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.botons-fitxatge {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin: 0.4rem 0 1.1rem;
}
.botons-fitxatge button {
  min-height: 8.5rem;
  border-radius: 16px;
  display: grid;
  place-items: center;
  gap: 0.45rem;
  padding: 1rem 0.7rem;
  font-size: 1.05rem;
}
.botons-fitxatge .icona {
  width: 2.6rem;
  height: 2.6rem;
  display: grid;
  place-items: center;
}
.botons-fitxatge .icona svg { width: 2.4rem; height: 2.4rem; }
.botons-fitxatge .text-boto {
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 0.95rem;
}
button.entrada { background: #1d4ed8; }
button.entrada:hover { background: #1e40af; }
button.sortida { background: #dc2626; }
button.sortida:hover { background: #b91c1c; }
.accions-secundaries {
  display: grid;
  gap: 0.65rem;
}
.boto-secundari,
.bloc-anotacio summary {
  display: block;
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--linia-forta);
  background: #fff;
  color: var(--marca);
  font-weight: 650;
  text-align: center;
  cursor: pointer;
}
.boto-secundari:hover,
.bloc-anotacio summary:hover { background: var(--marca-suau); }
.bloc-anotacio {
  background: #fff;
  border: 1px solid var(--linia);
  border-radius: 10px;
  text-align: left;
  overflow: hidden;
}
.bloc-anotacio summary { border: 0; border-radius: 0; list-style: none; }
.bloc-anotacio summary::-webkit-details-marker { display: none; }
.bloc-anotacio form {
  display: grid;
  gap: 0.7rem;
  padding: 0 0.9rem 0.9rem;
}
.bloc-anotacio textarea {
  width: 100%;
  border: 1px solid var(--linia-forta);
  border-radius: var(--radi-sm);
  padding: 0.65rem 0.75rem;
  resize: vertical;
  font: inherit;
}
.nota { max-width: none; margin: 0; text-align: left; }

@media (max-width: 520px) {
  .botons-fitxatge { grid-template-columns: 1fr; }
  .fitxatge-cap { flex-direction: column; }
}

.cap {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.navegacio {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  flex-wrap: wrap;
}
.navegacio a {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--linia-forta);
  background: #fff;
  font-size: 0.88rem;
  font-weight: 550;
}
.navegacio strong {
  font-size: 0.95rem;
  text-transform: capitalize;
  padding: 0 0.3rem;
}
.llegenda {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin: 0 0 0.9rem;
}
.etiqueta {
  padding: 0.22rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--linia);
  color: #475569;
}
.etiqueta.baixa { background: #fce7f3; border-color: #f9a8d4; color: #9d174d; }
.etiqueta.vacances { background: #dcfce7; border-color: #86efac; color: #166534; }
.etiqueta.permis { background: #cffafe; border-color: #67e8f9; color: #155e75; }
.etiqueta.festa { background: #ffedd5; border-color: #fdba74; color: #9a3412; }
.etiqueta.pendent { background: #fff7ed; border-color: #fdba74; color: #c2410c; }

.calendari {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.5rem;
}
.dia, .buit { min-height: 7rem; }
.dia {
  background: var(--paper);
  border: 1px solid var(--linia);
  border-radius: var(--radi-sm);
  padding: 0.5rem 0.55rem;
  box-shadow: 0 1px 1px rgba(15, 23, 42, 0.02);
}
.dia header {
  display: flex;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}
.dia header span {
  color: var(--muted);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.78rem;
}
.dia.baixa { background: #fdf2f8; }
.dia.vacances { background: #f0fdf4; }
.dia.vacances-reduc { background: #f7fef9; }
.dia.permis { background: #ecfeff; }
.dia.permis-reduc { background: #faf5ff; }
.dia.festa, .dia.festa-hores { background: #fff7ed; }
.dia.capsetmana { background: #f8fafc; }
.dia.pendent { box-shadow: inset 0 0 0 2px #ea580c; }
.parella, .tipus, .anotacio { margin: 0.18rem 0; font-size: 0.8rem; }
.parella {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  color: #334155;
}
.tipus { font-weight: 600; color: #475569; }
.anotacio { color: var(--muted); }

.taula-embolcall { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper);
}
th, td {
  text-align: left;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--linia);
  vertical-align: middle;
  font-size: 0.92rem;
}
th {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 650;
  background: #f8fafc;
  white-space: nowrap;
}
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: 0; }
.codi {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  color: var(--muted);
  font-size: 0.86rem;
}
.nom-cell { font-weight: 600; }
.meta { color: var(--muted); font-size: 0.84rem; font-weight: 400; }
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.badge-historic { background: #f1f5f9; color: #475569; }
.badge-inactiu { background: #fee2e2; color: #991b1b; }
.badge-actiu { background: #dcfce7; color: #166534; }
.marques-llista {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.marca-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.marca-chip.entrada { background: #dcfce7; color: #166534; }
.marca-chip.sortida { background: #ffedd5; color: #9a3412; }
.accions-fila { display: flex; gap: 0.45rem; justify-content: flex-end; }
.accions-fila a {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--linia-forta);
  background: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--marca);
}
.accions-fila a:hover {
  background: var(--marca-suau);
  border-color: #94a3b8;
}

.horari, .filtres {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  align-items: end;
  background: var(--paper);
  padding: 0.95rem 1rem;
  border-radius: var(--radi);
  margin: 0.7rem 0;
  border: 1px solid var(--linia);
  box-shadow: var(--ombra);
}
.horari label, .filtres label { min-width: 7.5rem; }
.formulari {
  max-width: 28rem;
  background: var(--paper);
  border: 1px solid var(--linia);
  border-radius: var(--radi);
  box-shadow: var(--ombra);
  padding: 1.25rem;
}

@media (max-width: 860px) {
  .calendari { grid-template-columns: 1fr 1fr; }
  .buit { display: none; }
  .barra { flex-wrap: wrap; }
  th, td { padding: 0.7rem 0.75rem; }
}
@media (max-width: 560px) {
  .calendari { grid-template-columns: 1fr; }
  .botons button { width: 100%; }
}
