/* Le mie ore — colori di liridonkrasniqi.ch, caratteri grandi, alto contrasto */
:root {
  --notte: #0b1726;     /* blu notte del sito */
  --notte-2: #132841;
  --avorio: #f3efe6;    /* avorio del sito */
  --nebbia: #9fb0c4;
  --blu: #2f5f9e;       /* blu del sito, scurito per leggere meglio */
  --blu-chiaro: #4c7fc2;
  --rosso: #d7263d;
  --verde: #3ecf8e;
  --bianco: #ffffff;
  --grigio: #dcdad3;

  --vacanza: #bdeed6;   --vacanza-bordo: #1f8f5c;
  --malattia: #f7cfd5;  --malattia-bordo: #b01d31;
  --festivo: #cfdcf2;   --festivo-bordo: #2f5f9e;
  --libero: #f5e2a8;    --libero-bordo: #9a7414;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 20px;
  line-height: 1.3;
  color: var(--notte);
  background: var(--avorio);
  padding-bottom: env(safe-area-inset-bottom);
}
button {
  font: inherit; color: inherit; cursor: pointer;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  border: 3px solid var(--notte); border-radius: 16px; background: var(--bianco);
}
button:active { transform: scale(0.97); }
button:focus-visible { outline: 4px solid var(--blu-chiaro); outline-offset: 2px; }

.grande { display: block; width: 100%; min-height: 64px; font-size: 22px; font-weight: 700; margin: 12px 0; padding: 10px 16px; }
.primario { background: var(--blu); border-color: var(--blu); color: var(--bianco); }
.leggero { display: block; width: 100%; margin: 14px 0 0; min-height: 52px; font-size: 18px; background: transparent; border: 2px dashed var(--nebbia); }
.piccolo { font-size: 16px; color: #4a5566; }
.centro { text-align: center; }

/* ---------- Accesso ---------- */
.accesso { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px; max-width: 520px; margin: 0 auto; text-align: center; }
.accesso .logo { font-size: 72px; }
.accesso h1 { font-size: 36px; margin: 0 0 12px; }
.testo { width: 100%; font-size: 22px; padding: 14px; border: 3px solid var(--notte); border-radius: 14px; margin: 8px 0; }
.pallini { display: flex; justify-content: center; gap: 18px; margin: 14px 0 18px; }
.pallini span { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--notte); }
.pallini span.pieno { background: var(--notte); }
.pallini.sbagliato { animation: scuoti .4s; }
@keyframes scuoti { 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }
.tastiera { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 340px; margin: 0 auto; }
.tastiera button { height: 76px; font-size: 34px; font-weight: 700; border-radius: 50px; }
.messaggio { font-size: 20px; font-weight: 600; min-height: 1.5em; }
.messaggio.errore { color: var(--rosso); }

/* ---------- Schede in alto ---------- */
.schede {
  position: sticky; top: 0; z-index: 5;
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: var(--notte);
}
.scheda { min-height: 56px; font-size: 22px; font-weight: 800; background: var(--notte-2); color: var(--avorio); border-color: var(--notte-2); }
.scheda.attiva { background: var(--avorio); color: var(--notte); border-color: var(--avorio); }

.vista { max-width: 620px; margin: 0 auto; padding: 12px 14px 90px; }

/* ---------- Giorno ---------- */
.testata-giorno { display: grid; grid-template-columns: 60px 1fr 60px; align-items: center; gap: 8px; margin-bottom: 8px; }
.freccia { height: 60px; font-size: 24px; }
.testata-testo { text-align: center; }
.titolo-giorno { font-size: 30px; font-weight: 800; }
.data-lunga { font-size: 20px; }
.avviso-festivo { background: var(--festivo); border: 3px solid var(--festivo-bordo); border-radius: 14px; padding: 8px 12px; text-align: center; font-weight: 700; margin-bottom: 8px; }

.campo { background: var(--bianco); border: 3px solid var(--notte); border-radius: 20px; padding: 10px 12px 12px; margin: 10px 0; }
.etichetta { font-size: 20px; font-weight: 700; text-align: center; display: block; }
.regola { display: grid; grid-template-columns: 76px 1fr 76px; align-items: center; gap: 8px; margin: 6px 0; }
.passo { height: 76px; font-size: 40px; font-weight: 700; line-height: 1; background: var(--avorio); user-select: none; -webkit-user-select: none; }
.ora { display: block; text-align: center; font-size: 56px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.ora.vuota { color: #9aa3ad; }
.adesso { display: block; width: 100%; min-height: 58px; font-size: 21px; font-weight: 700; background: var(--notte); color: var(--avorio); border-color: var(--notte); }

.riga-pausa { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 21px; font-weight: 600; margin: 8px 0; }
.piccolo-passo { width: 56px; height: 52px; font-size: 28px; }
.pausa { font-size: 26px; font-weight: 800; min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; }
.nota { text-align: center; font-size: 17px; font-weight: 600; color: var(--blu); }

.risultato {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--notte); color: var(--avorio); border-radius: 20px; padding: 14px 20px; margin: 12px 0;
}
.risultato span { font-size: 22px; font-weight: 700; }
.risultato strong { font-size: 48px; font-variant-numeric: tabular-nums; }

.speciali { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.speciale { min-height: 60px; font-size: 21px; font-weight: 700; }
.speciale.scelto { outline: 5px solid var(--notte); outline-offset: 2px; }
.blocco-speciale { border-radius: 20px; border: 4px solid; padding: 28px 12px; text-align: center; font-size: 38px; font-weight: 800; margin: 10px 0; }
.blocco-speciale small { display: block; font-size: 18px; font-weight: 600; margin-top: 8px; }

.vacanza { background: var(--vacanza); border-color: var(--vacanza-bordo); }
.malattia { background: var(--malattia); border-color: var(--malattia-bordo); }
.festivo { background: var(--festivo); border-color: var(--festivo-bordo); }
.libero { background: var(--libero); border-color: var(--libero-bordo); }

/* ---------- Mese ---------- */
.totale-mese { background: var(--notte); color: var(--avorio); border-radius: 20px; padding: 14px; text-align: center; margin: 8px 0 14px; }
.totale-mese span { font-size: 20px; font-weight: 700; }
.totale-mese strong { display: block; font-size: 60px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.conteggi { font-size: 18px; color: var(--avorio); opacity: .9; }

.settimana, .griglia { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.settimana span { text-align: center; font-size: 16px; font-weight: 800; padding: 4px 0; }
.settimana .we { color: #6b7280; }
.cella {
  min-height: 78px; padding: 3px 2px; border: 2px solid #b9bdc4; border-radius: 8px;
  background: var(--bianco); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1px;
  font-size: 12px; line-height: 1.15; overflow: hidden;
}
.cella.vuota-mese { visibility: hidden; }
.cella .n { font-size: 15px; font-weight: 800; align-self: flex-start; padding-left: 3px; }
.cella .h { font-size: 16px; font-weight: 800; margin-top: auto; font-variant-numeric: tabular-nums; }
.cella .t { font-variant-numeric: tabular-nums; color: #374151; }
.cella .s { font-size: 12px; font-weight: 700; }
.cella.weekend { background: var(--grigio); }
.cella.oggi { border: 3px solid var(--rosso); }
.cella.vacanza { background: var(--vacanza); border-color: var(--vacanza-bordo); }
.cella.malattia { background: var(--malattia); border-color: var(--malattia-bordo); }
.cella.festivo { background: var(--festivo); border-color: var(--festivo-bordo); }
.cella.libero { background: var(--libero); border-color: var(--libero-bordo); }

.legenda { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 10px 0 14px; }
.legenda span { font-size: 15px; font-weight: 700; padding: 3px 10px; border-radius: 8px; border: 2px solid; }
.legenda .weekend { background: var(--grigio); border-color: #9aa0a8; }

.totale-anno { background: var(--bianco); border: 3px solid var(--notte); border-radius: 20px; padding: 12px 16px; margin-top: 14px; font-size: 19px; }
.totale-anno b { font-size: 24px; }

@media (min-width: 700px) {
  .vista { max-width: 900px; }
  #vista-giorno { max-width: 620px; }
  .cella { min-height: 104px; font-size: 15px; }
  .cella .h { font-size: 22px; }
  .cella .n { font-size: 18px; }
  .cella .s { font-size: 15px; }
}

/* ---------- Stato in basso ---------- */
.stato {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--notte); color: var(--avorio); text-align: center; font-size: 17px; font-weight: 600;
}
.stato.attesa { background: #8a5a00; }

/* ---------- Anteprima e stampa ---------- */
.barra-stampa { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.barra-stampa .grande { margin: 4px 0 12px; }
.foglio { background: var(--bianco); color: #000; padding: 12px; border-radius: 12px; border: 2px solid #c8c8c8; font-size: 14px; overflow-x: auto; }
.foglio td:last-child { font-size: 12px; }
.foglio td:first-child { white-space: nowrap; }
.foglio h2 { margin: 0 0 2px; font-size: 22px; }
.foglio .sotto { margin: 0 0 10px; color: #333; }
.foglio table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.foglio th, .foglio td { border: 1px solid #999; padding: 3px 5px; text-align: left; }
.foglio th { background: #e8e8e8; }
.foglio td.num, .foglio th.num { text-align: right; }
.foglio tr.we td { background: #f0f0f0; }
.foglio tr.sp td { font-weight: 700; }
.foglio .riepilogo { margin-top: 12px; display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; max-width: 420px; }
.foglio .riepilogo .num { text-align: right; font-weight: 700; }
.foglio .firma { margin-top: 36px; display: flex; gap: 40px; }
.foglio .firma div { flex: 1; border-top: 1px solid #000; padding-top: 4px; font-size: 13px; }

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; font-size: 12px; padding: 0; }
  .schede, .stato, .solo-schermo { display: none !important; }
  .vista { padding: 0; max-width: none; }
  .foglio { border: 0; padding: 0; font-size: 11.5px; overflow: visible; }
  .foglio td:last-child { font-size: 11px; }
  .foglio th, .foglio td { padding: 2px 4px; }
  .foglio tr.we td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
