/* Interfaccia frontend del gestionale. Nessun riferimento visivo a WordPress:
   per chi la usa e' un applicativo, non un sito con un pannello dietro. */

:root {
  --blu:        #1c3f6e;
  --blu-scuro:  #142f52;
  --blu-tenue:  #e9eff7;
  --inchiostro: #16202e;
  --grigio:     #5b6674;
  --bordo:      #dde2e9;
  --fondo:      #f4f6f9;
  --bianco:     #ffffff;
  --verde:      #2c6a4f;
  --verde-tenue:#e6f0ea;
  --rosso:      #b32d2e;
  --rosso-tenue:#fbeaea;
  --ambra:      #8a5f1c;
  --ambra-tenue:#f8f0dd;
  --raggio:     6px;
}

* { box-sizing: border-box; }

body.imlp {
  margin: 0;
  background: var(--fondo);
  color: var(--inchiostro);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blu); }

/* ---------- intestazione ---------- */

.imlp-testa {
  background: var(--blu);
  color: #fff;
  padding: 0 20px;
}
.imlp-testa-riga {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  flex-wrap: wrap;
}
.imlp-marchio { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.imlp-marchio span { display: block; font-weight: 400; font-size: 12px; opacity: .75; }
.imlp-utente { font-size: 13px; display: flex; align-items: center; gap: 12px; }
.imlp-utente a { color: #fff; text-decoration: underline; }
.imlp-utente select { font-size: 13px; padding: 3px 6px; border-radius: 4px; border: 0; }

.imlp-nav {
  background: var(--blu-scuro);
  padding: 0 20px;
  overflow-x: auto;
}
.imlp-nav ul {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
  display: flex;
  gap: 2px;
  white-space: nowrap;
}
.imlp-nav a {
  display: block;
  padding: 11px 15px;
  color: rgba(255,255,255,.82);
  text-decoration: none;
  font-size: 14.5px;
  border-bottom: 3px solid transparent;
}
.imlp-nav a:hover { color: #fff; background: rgba(255,255,255,.07); }
.imlp-nav a.attivo { color: #fff; border-bottom-color: #fff; font-weight: 600; }
.imlp-menu-toggle, .imlp-nav-utente { display: none; }
.imlp-nav .pallino {
  display: inline-block;
  background: var(--rosso);
  color: #fff;
  border-radius: 10px;
  font-size: 11px;
  padding: 1px 7px;
  margin-left: 5px;
  font-weight: 600;
}

/* ---------- impaginazione ---------- */

.imlp-corpo { max-width: 1180px; margin: 0 auto; padding: 26px 20px 60px; }
.imlp-corpo h1 { font-size: 25px; margin: 0 0 4px; letter-spacing: -0.01em; }
.imlp-corpo h2 { font-size: 18px; margin: 34px 0 12px; }
.imlp-sottotitolo { color: var(--grigio); margin: 0 0 22px; font-size: 15px; }

.imlp-scheda {
  background: var(--bianco);
  border: 1px solid var(--bordo);
  border-radius: var(--raggio);
  padding: 20px;
  margin-bottom: 20px;
}

.imlp-riquadri { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 14px; margin-bottom: 24px; }
.imlp-riquadro { background: var(--bianco); border: 1px solid var(--bordo); border-radius: var(--raggio); padding: 15px 17px; }
.imlp-riquadro .etichetta { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--grigio); }
.imlp-riquadro .valore { font-size: 27px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.imlp-riquadro.allarme .valore { color: var(--rosso); }

/* ---------- tabelle ---------- */

.imlp-tabella-wrap { overflow-x: auto; background: var(--bianco); border: 1px solid var(--bordo); border-radius: var(--raggio); }
table.imlp-tabella { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.imlp-tabella th {
  text-align: left;
  padding: 11px 14px;
  background: #f7f9fb;
  border-bottom: 1px solid var(--bordo);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--grigio);
  white-space: nowrap;
}
table.imlp-tabella td { padding: 11px 14px; border-bottom: 1px solid #eef1f5; vertical-align: top; }
table.imlp-tabella tr:last-child td { border-bottom: 0; }
table.imlp-tabella td.num, table.imlp-tabella th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.imlp-tabella tfoot td { font-weight: 600; background: #f7f9fb; }
.imlp-vuoto { padding: 26px 14px; color: var(--grigio); text-align: center; }

/* ---------- moduli ---------- */

.imlp-campi { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.imlp-campo label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.imlp-campo .aiuto { font-size: 12.5px; color: var(--grigio); margin-top: 4px; }
.imlp-campo input[type=text], .imlp-campo input[type=email], .imlp-campo input[type=date],
.imlp-campo input[type=time], .imlp-campo input[type=number], .imlp-campo input[type=password],
.imlp-campo input[type=search],
.imlp-campo select, .imlp-campo textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--bordo);
  border-radius: 5px;
  font: inherit;
  font-size: 15px;
  background: #fff;
  color: var(--inchiostro);
}
.imlp-campo input:focus, .imlp-campo select:focus, .imlp-campo textarea:focus {
  outline: 2px solid var(--blu);
  outline-offset: 0;
  border-color: var(--blu);
}
.imlp-filtri { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.imlp-filtri .imlp-campo input[type=search] { -webkit-appearance: none; }
.imlp-pagine { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 14px 0 4px; }
.imlp-pagine .conteggio { color: var(--grigio); font-size: 14px; margin-right: 6px; }
.imlp-filtri .imlp-campo { min-width: 145px; }
.imlp-azione-secondaria { display: inline-block; margin-left: 10px; vertical-align: bottom; }

/* ---------- bottoni ---------- */

.imlp-btn {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid var(--blu);
  background: var(--blu);
  color: #fff;
  border-radius: 5px;
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.35;
}
.imlp-btn:hover { background: var(--blu-scuro); border-color: var(--blu-scuro); }
.imlp-btn:focus-visible { outline: 3px solid #98b7dd; outline-offset: 1px; }
.imlp-btn.secondario { background: #fff; color: var(--blu); }
.imlp-btn.secondario:hover { background: var(--blu-tenue); }
.imlp-btn.piccolo { padding: 5px 10px; font-size: 13px; font-weight: 500; }
.imlp-btn.grande { padding: 15px 26px; font-size: 17px; }
.imlp-btn.pericolo { background: #fff; color: var(--rosso); border-color: var(--rosso); }
.imlp-btn[disabled] { opacity: .6; cursor: default; }

/* ---------- stati e avvisi ---------- */

.imlp-avviso { padding: 12px 15px; border-radius: var(--raggio); margin-bottom: 18px; font-size: 14.5px; border: 1px solid; }
.imlp-avviso.ok      { background: var(--verde-tenue); border-color: #bcd9c9; color: var(--verde); }
.imlp-avviso.errore  { background: var(--rosso-tenue); border-color: #eebfbf; color: var(--rosso); }
.imlp-avviso.info    { background: var(--blu-tenue);  border-color: #c6d7ec; color: var(--blu); }
.imlp-avviso.attenzione { background: var(--ambra-tenue); border-color: #e3d2a8; color: var(--ambra); }

.imlp-pillola {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 11px;
  background: #eef1f5;
  color: var(--grigio);
  white-space: nowrap;
}
.imlp-pillola.verde { background: var(--verde-tenue); color: var(--verde); }
.imlp-pillola.rossa { background: var(--rosso-tenue); color: var(--rosso); }
.imlp-pillola.ambra { background: var(--ambra-tenue); color: var(--ambra); }
.imlp-pillola.blu   { background: var(--blu-tenue);   color: var(--blu); }

/* ---------- credenziali generate ---------- */

.imlp-credenziali { border: 2px solid var(--verde); background: var(--verde-tenue); }
.imlp-credenziali .etichetta { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--grigio); }
.imlp-credenziali .valore {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 18px; font-weight: 600; margin-top: 3px;
  user-select: all; -webkit-user-select: all; word-break: break-all;
}

/* ---------- turni della giornata ---------- */

.imlp-turno {
  background: var(--bianco);
  border: 1px solid var(--bordo);
  border-left: 4px solid var(--blu);
  border-radius: var(--raggio);
  padding: 18px 20px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.imlp-turno.fatto { border-left-color: var(--verde); }
.imlp-turno.corso { border-left-color: var(--ambra); }
.imlp-turno .orario { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.imlp-turno .dettaglio { color: var(--grigio); font-size: 14px; margin-top: 3px; }

/* ---------- accesso ---------- */

.imlp-accesso {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #1c3f6e 0%, #142f52 100%);
}
.imlp-accesso-scheda {
  background: #fff;
  border-radius: 10px;
  padding: 34px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 18px 45px rgba(10, 25, 47, .28);
}
.imlp-accesso-scheda h1 { font-size: 21px; margin: 0 0 4px; }
.imlp-accesso-scheda .occhiello { font-size: 13px; color: var(--grigio); margin: 0 0 24px; }
.imlp-accesso-scheda .imlp-campo { margin-bottom: 16px; }
.imlp-accesso-scheda .imlp-btn { width: 100%; text-align: center; padding: 12px; font-size: 16px; }
.imlp-accesso-pie { margin-top: 20px; font-size: 12.5px; color: var(--grigio); text-align: center; }

/* ---------- responsivo ---------- */

@media (max-width: 640px) {
  .imlp-corpo { padding: 16px 12px 50px; }
  .imlp-corpo h1 { font-size: 21px; }
  .imlp-corpo h2 { font-size: 16.5px; margin-top: 26px; }
  .imlp-scheda { padding: 14px; }

  /* intestazione: marchio a sinistra, bottone del menu a destra */
  .imlp-testa { padding: 0 12px; }
  .imlp-testa-riga { min-height: 54px; flex-wrap: nowrap; gap: 10px; }
  .imlp-marchio { font-size: 15.5px; min-width: 0; }
  .imlp-marchio span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .imlp-utente { display: none; }
  .imlp-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    background: rgba(255,255,255,.1);
    color: #fff;
    border: 1px solid rgba(255,255,255,.35);
    border-radius: 6px;
    padding: 7px 11px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
  }
  .imlp-menu-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
  .imlp-menu-icona {
    width: 16px; height: 12px;
    background: linear-gradient(#fff 0 2px, transparent 2px 5px, #fff 5px 7px, transparent 7px 10px, #fff 10px 12px);
  }
  body.imlp-menu-aperto .imlp-menu-icona {
    background: none; position: relative;
  }
  body.imlp-menu-aperto .imlp-menu-icona::before, body.imlp-menu-aperto .imlp-menu-icona::after {
    content: ""; position: absolute; left: 0; top: 5px; width: 16px; height: 2px; background: #fff;
  }
  body.imlp-menu-aperto .imlp-menu-icona::before { transform: rotate(45deg); }
  body.imlp-menu-aperto .imlp-menu-icona::after { transform: rotate(-45deg); }

  /* il menu e' chiuso di default e si apre a pannello, con tutte le voci */
  .imlp-nav { display: none; padding: 0; overflow: visible; }
  .imlp-nav.aperto { display: block; }
  .imlp-nav ul { flex-direction: column; gap: 0; white-space: normal; }
  .imlp-nav a {
    padding: 13px 16px;
    font-size: 15.5px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    border-left: 3px solid transparent;
  }
  .imlp-nav a.attivo { border-left-color: #fff; border-bottom-color: rgba(255,255,255,.08); }
  .imlp-nav-utente {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    padding: 12px 16px;
    color: rgba(255,255,255,.85);
    font-size: 14px;
    background: rgba(0,0,0,.18);
  }
  .imlp-nav-utente a { color: #fff; text-decoration: underline; }
  .imlp-nav-utente select { font-size: 14px; padding: 5px 8px; border-radius: 4px; border: 0; flex: 1 1 100%; }

  /* riquadri numerici: due per riga, cifre piu' contenute */
  .imlp-riquadri { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .imlp-riquadro { padding: 12px 13px; }
  .imlp-riquadro .valore { font-size: 22px; }

  /* filtri e moduli: un campo per riga */
  .imlp-filtri .imlp-campo { flex: 1 1 100%; min-width: 0; }
  .imlp-filtri > div:last-child { flex: 1 1 100%; }
  .imlp-filtri > div:last-child .imlp-btn { flex: 1 1 auto; }
  .imlp-pagine .conteggio { flex: 1 1 100%; }
  .imlp-filtri .imlp-btn { width: 100%; text-align: center; }
  .imlp-campi { grid-template-columns: 1fr; }
  .imlp-azione-secondaria { display: block; margin: 10px 0 0; }
  .imlp-azione-secondaria .imlp-btn { width: 100%; text-align: center; }
  table.imlp-tabella td > span { text-align: right; }

  /* turni della giornata */
  .imlp-turno { flex-direction: column; align-items: stretch; }
  .imlp-turno .imlp-btn { width: 100%; text-align: center; }
  .imlp-turno form { width: 100%; }

  /* tabelle -> schede: ogni riga un blocco, ogni cella etichetta + valore */
  .imlp-tabella-wrap { overflow: visible; border: 0; background: transparent; }
  table.imlp-tabella, table.imlp-tabella tbody, table.imlp-tabella tfoot,
  table.imlp-tabella tr, table.imlp-tabella td { display: block; }
  table.imlp-tabella thead { display: none; }
  table.imlp-tabella tr {
    background: var(--bianco);
    border: 1px solid var(--bordo);
    border-radius: var(--raggio);
    padding: 6px 14px;
    margin-bottom: 10px;
  }
  table.imlp-tabella td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 14px;
    padding: 6px 0;
    border: 0;
    border-bottom: 1px solid #f0f2f5;
    text-align: right;
  }
  table.imlp-tabella td:last-child { border-bottom: 0; }
  table.imlp-tabella td::before {
    content: attr(data-etichetta);
    flex: 0 0 40%;
    text-align: left;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--grigio);
    font-weight: 500;
  }
  table.imlp-tabella td:empty { display: none; }
  /* celle senza intestazione (azioni): niente etichetta, contenuto a sinistra */
  table.imlp-tabella td[data-etichetta=""] { justify-content: flex-start; text-align: left; padding-top: 10px; }
  table.imlp-tabella td[data-etichetta=""]::before { display: none; }
  table.imlp-tabella td[data-etichetta=""] form { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
  table.imlp-tabella td[data-etichetta=""] input[type=text],
  table.imlp-tabella td[data-etichetta=""] select { flex: 1 1 100%; max-width: none !important; }
  table.imlp-tabella td[data-etichetta=""] .imlp-btn { flex: 1 1 auto; text-align: center; }
  /* riga "nessun dato" */
  table.imlp-tabella td[colspan] { display: block; text-align: center; }
  table.imlp-tabella td[colspan]::before { display: none; }
  /* totali */
  table.imlp-tabella tfoot tr { background: #f7f9fb; }
  table.imlp-tabella tfoot td { font-weight: 600; }

  /* paginazione */
  .imlp-corpo > p .imlp-btn.piccolo { margin-bottom: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
