/* Gestionale HACCP - sfondo azzurrino, barra header scura, pulsanti fissi */
/* Transizioni: ogni cambio di stato con cubic-bezier Material */
body.dashboard-page .table-list tbody tr,
body.dashboard-page .table-clienti tbody tr,
#areaTab .nav-link,
body.dashboard-page .btn,
body.dashboard-page .list-group-item,
.dashboard-icon-trash,
body.dashboard-page .card { transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
body.dashboard-page { font-family: var(--g-font-data); background: #e3f2fd !important; -webkit-text-size-adjust: 100%; }
.dashboard-header {
  background: #0d3d10;
  border-bottom: 3px solid #fff;
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: 0 2px 12px rgba(0,0,0,0.35);
}
.dashboard-header h1,
.dashboard-header .dashboard-header-title { font-family: var(--g-font-heading); font-size: 1rem; color: #b2dfdb !important; font-weight: 700; }
.dashboard-header-logo { max-height: 72px; height: auto; width: auto; max-width: min(420px, 70vw); display: block; object-fit: contain; vertical-align: middle; }
.login-logo-wrap { text-align: center; }
.login-logo { max-height: 100px; max-width: 100%; width: auto; object-fit: contain; }
@media (max-width: 576px) {
  .dashboard-header-logo { max-height: 52px; max-width: 60vw; }
  .login-logo { max-height: 80px; }
}
.dashboard-header .btn {
  font-family: var(--g-font-heading);
  border-width: 2px;
  font-weight: 600;
}
.dashboard-header .btn:not(.btn-danger):not(.btn-outline-danger) {
  background: #1976d2 !important;
  color: #fff !important;
  border-color: #1976d2 !important;
}
.dashboard-header .btn:not(.btn-danger):not(.btn-outline-danger):hover,
.dashboard-header .btn:not(.btn-danger):not(.btn-outline-danger):focus {
  background: #1565c0 !important;
  color: #fff !important;
  border-color: #1565c0 !important;
}
.dashboard-header .btn-outline-danger,
.dashboard-header .btn-danger {
  background: #c62828 !important;
  color: #fff !important;
  border-color: #c62828 !important;
}
.dashboard-header .d-flex { flex-wrap: wrap; gap: 0.5rem; }
.dashboard-toolbar-sticky { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.dashboard-search-form { flex-wrap: nowrap !important; min-width: 0; }
.dashboard-search-form .gestionale-search-input { width: 280px; max-width: 100%; flex: 0 0 auto; }
.dashboard-search-form .gestionale-search-btn { flex: 0 0 auto; white-space: nowrap; }
/* Contenuto: sfondo azzurrino, pannelli contrastanti */
.dashboard-page .container-fluid { background: #e3f2fd; }
.dashboard-page .card { background: #bbdefb; border: 2px solid #1976d2; border-radius: 6px; }
.dashboard-page .card-header { font-family: var(--g-font-heading); border-bottom: 2px solid #1976d2; }
.dashboard-page .table-list { background: #e1f5fe; border-collapse: separate; border-spacing: 0 0.5rem; }
.dashboard-page .table-list tbody tr td { background: rgba(255,255,255,0.95); padding: 0.75rem 1rem; vertical-align: middle; }
.dashboard-page .table-list tbody tr td:first-child { border-radius: 10px 0 0 10px; }
.dashboard-page .table-list tbody tr td:last-child { border-radius: 0 10px 10px 0; }
.dashboard-page .table-list tbody tr:hover td { background: rgba(255,255,255,0.98); box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
.dashboard-page .table-list tbody tr:hover { transform: translateY(-2px); }
.dashboard-page .list-group-item { background: #e1f5fe; border-color: #1976d2; }
.dashboard-page .list-group-small .list-group-item { border-left-width: 4px; border-left-color: #1565c0; }
/* Caselle stato Attivo / Non attivo: colore stabile, no cambio al click */
.stato-radio-cell { white-space: nowrap; background: inherit; }
.stato-radio-form { font-size: 0.8rem; background: transparent !important; }
.stato-radio-label { display: inline-block; margin-right: 0.5rem; margin-bottom: 0; cursor: pointer; background: transparent; }
.stato-radio-label input { margin-right: 0.25rem; vertical-align: middle; }
.stato-radio-label input:focus { outline: none; }
.stato-radio-form:focus-within { background: transparent !important; }
/* Ricerca e campi ben visibili */
.dashboard-toolbar-sticky .form-control,
.gestionale-search-input {
  border: 2px solid #1B5E20;
  border-radius: 4px;
  font-weight: 500;
  background: #fff;
}
.dashboard-toolbar-sticky .btn,
.gestionale-search-btn { font-family: var(--g-font-heading); border: 2px solid #1B5E20; font-weight: 600; }
.scheda-toolbar .form-control,
.scheda-toolbar input[type="text"],
.scheda-toolbar input[type="email"],
.scheda-toolbar textarea { border: 2px solid #1B5E20; border-radius: 4px; background: #fff; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* Tabella clienti: larghezza fissa, niente scroll orizzontale, ellissi, header sticky */
.table-wrap-clienti { overflow-x: hidden; }
.dashboard-clienti-loading { opacity: 0.65; pointer-events: none; transition: opacity 0.15s ease; }
.table-clienti { table-layout: fixed; width: 100%; font-size: 0.72rem; border-collapse: separate; border-spacing: 0 0.5rem; }
.table-clienti th,
.table-clienti td { padding: 0.5rem 0.75rem; vertical-align: middle; }
.dashboard-page .table-clienti tbody tr td { background: rgba(255,255,255,0.95); }
.dashboard-page .table-clienti tbody tr td:first-child { border-radius: 10px 0 0 10px; }
.dashboard-page .table-clienti tbody tr td:last-child { border-radius: 0 10px 10px 0; }
.dashboard-page .table-clienti tbody tr:hover td { background: rgba(255,255,255,0.98); box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
.dashboard-page .table-clienti tbody tr:hover { transform: translateY(-2px); }
.table-clienti .th-ragione,
.table-clienti .td-ragione { width: 34%; }
.table-clienti .th-piva,
.table-clienti .td-piva { width: 13%; }
.table-clienti .th-email,
.table-clienti .td-email { width: 26%; }
.table-clienti .th-stato,
.table-clienti .stato-radio-cell { width: 17%; }
.table-clienti .th-azioni,
.table-clienti .td-azioni { width: 10%; }
.table-clienti:not(.table-clienti-has-stato) .th-ragione,
.table-clienti:not(.table-clienti-has-stato) .td-ragione { width: 40%; }
.table-clienti:not(.table-clienti-has-stato) .th-piva,
.table-clienti:not(.table-clienti-has-stato) .td-piva { width: 13%; }
.table-clienti:not(.table-clienti-has-stato) .th-email,
.table-clienti:not(.table-clienti-has-stato) .td-email { width: 30%; }
.table-clienti:not(.table-clienti-has-stato) .th-azioni,
.table-clienti:not(.table-clienti-has-stato) .td-azioni { width: 17%; }
.table-clienti .td-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 0; }
.table-clienti .td-ragione { overflow: hidden; max-width: 0; vertical-align: middle; }
.table-clienti:not(.table-clienti-has-nome-att) .td-ragione { white-space: nowrap; text-overflow: ellipsis; }
.table-clienti.table-clienti-has-nome-att .td-ragione { white-space: normal; }
.table-clienti .td-ragione .cliente-ragione-stack { min-width: 0; }
.table-clienti .td-ragione .cliente-ragione-link { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #1b5e20; text-decoration: none; }
.table-clienti .td-ragione .cliente-ragione-link:hover { text-decoration: underline; color: #0d3d10; }
.table-clienti .td-ragione .cliente-nome-attivita { font-size: 0.85em; color: #5d4037; line-height: 1.25; margin-top: 0.15rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.table-clienti .td-piva { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-clienti thead th { position: sticky; top: 0; z-index: 2; background: #1B5E20 !important; box-shadow: 0 1px 0 0 rgba(0,0,0,0.1); }
.dashboard-icon-trash { display: inline-flex; align-items: center; justify-content: center; color: #c62828; padding: 0.25rem; border: none; background: transparent; text-decoration: none; border-radius: 4px; }
.dashboard-icon-trash:hover { color: #b71c1c; background: rgba(198,40,40,0.1); text-decoration: none; }
.dashboard-icon-trash .fa-trash-alt { font-size: 1rem; }
.dashboard-pagination { background: #e1f5fe; font-size: 0.9rem; }
.scheda-toolbar .form-control { max-width: 100%; }
@media (max-width: 576px) {
  .scheda-toolbar .d-flex > div { flex: 1 1 100%; }
  .scheda-toolbar input[style*="width"] { width: 100% !important; max-width: 100%; }
  .scheda-form-inline .form-control, .scheda-form-inline .form-select { margin-bottom: 0.25rem; }
  #areaTab .nav-link { font-size: 0.85rem; padding: 0.4rem 0.5rem; }
}
.table-list th { font-family: var(--g-font-heading); background: #1B5E20 !important; color: #fff; }
.dashboard-page .table-list td { border-color: #2e7d32; color: #1b5e20; }
/* Icone Font Awesome: i btn usano Montserrat/Inter; gli <i> devono restare su FA altrimenti compaiono quadratini */
.dashboard-page .btn .fas,
.dashboard-page .btn .far,
.dashboard-page .btn .fab,
.dashboard-page .btn i.fa,
.dashboard-page label.btn .fas,
.dashboard-page label.btn .far { font-family: "Font Awesome 5 Free" !important; font-weight: 900; }
.dashboard-page .btn .far { font-weight: 400; }
/* Carica / Apri / Elimina: stesse caratteristiche visive in tutto il gestionale */
.dashboard-page .btn-outline-primary,
.dashboard-page .btn-outline-secondary,
.dashboard-page .btn-outline-danger { font-family: var(--g-font-heading); border-width: 1px !important; border-radius: 4px !important; font-weight: 600 !important; }
.dashboard-page .btn-outline-primary.py-0,
.dashboard-page .btn-outline-secondary.py-0,
.dashboard-page .btn-outline-danger.py-0 { padding: 0.25rem 0.5rem !important; }
/* Celle file Piano: pulsanti snelli + nome file */
.piano-file-cell { font-size: 0.8rem; max-width: 220px; vertical-align: top !important; }
.piano-file-cell .piano-btn { padding: 0.15rem 0.35rem !important; font-size: 0.75rem !important; }
.piano-btn { min-width: 2rem; text-align: center; }
.piano-btn .fas, .piano-btn .fa { font-size: 0.81rem; }
.piano-file-name { display: block; max-width: 100%; white-space: normal; word-break: break-word; overflow-wrap: break-word; font-size: 0.875rem; color: #111; margin-bottom: 0.2rem; }
/* Gestionale: Carica = blu, Apri = grigio, Elimina = rosso */
.dashboard-page .btn-primary,
.dashboard-page .btn-outline-primary,
.dashboard-page .btn-outline-success,
.dashboard-page .btn-success { font-family: var(--g-font-heading); background: #1976d2 !important; color: #fff !important; border-color: #1976d2 !important; }
.dashboard-page .btn-primary:hover, .dashboard-page .btn-primary:focus,
.dashboard-page .btn-outline-primary:hover, .dashboard-page .btn-outline-primary:focus,
.dashboard-page .btn-outline-success:hover, .dashboard-page .btn-outline-success:focus,
.dashboard-page .btn-success:hover, .dashboard-page .btn-success:focus { background: #1565c0 !important; color: #fff !important; border-color: #1565c0 !important; }
/* Apri: grigio (stesso stile ovunque) */
.dashboard-page .btn-outline-secondary,
.dashboard-page .btn-secondary { font-family: var(--g-font-heading); background: #f5f5f5 !important; color: #424242 !important; border-color: #9e9e9e !important; }
.dashboard-page .btn-outline-secondary:hover, .dashboard-page .btn-outline-secondary:focus,
.dashboard-page .btn-secondary:hover, .dashboard-page .btn-secondary:focus { background: #eeeeee !important; color: #212121 !important; border-color: #757575 !important; }
/* Elimina: rosso (stesso stile ovunque) */
.dashboard-page .btn-danger,
.dashboard-page .btn-outline-danger { font-family: var(--g-font-heading); background: #c62828 !important; color: #fff !important; border-color: #c62828 !important; }
.dashboard-page .btn-danger:hover, .dashboard-page .btn-danger:focus,
.dashboard-page .btn-outline-danger:hover, .dashboard-page .btn-outline-danger:focus { background: #b71c1c !important; color: #fff !important; border-color: #b71c1c !important; }
/* Icone sempre attive e non opache (anche i placeholder disabled) */
.dashboard-page .piano-btn.disabled,
.dashboard-page .btn-outline-danger.disabled,
.dashboard-page .btn-outline-secondary.disabled { opacity: 1 !important; }
.dashboard-page .btn-outline-danger.disabled { background: #c62828 !important; color: #fff !important; border-color: #c62828 !important; cursor: not-allowed; }
/* Toolbar (Cerca, Aggiungi nuovo cliente) */
.dashboard-toolbar-sticky .btn:not(.btn-danger):not(.btn-outline-danger),
.gestionale-search-btn { background: #1976d2 !important; color: #fff !important; border-color: #1976d2 !important; }
.dashboard-toolbar-sticky .btn:hover, .gestionale-search-btn:hover { background: #1565c0 !important; border-color: #1565c0 !important; }
a { color: #1B5E20; }
.list-group-small .list-group-item { padding: 0.5rem 0.75rem; font-size: 0.9rem; }
.alert-rosso { background: #ffcdd2; border-left: 4px solid #c62828; }
.alert-arancione { background: #ffe0b2; border-left: 4px solid #ef6c00; }
/* Badge pillola scadenza: colori pulsanti vivaci */
.badge-scadenza-pill { display: inline-block; padding: 0.25rem 0.6rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.badge-scadenza-scaduto { background: #7cb342; color: #fff; }
.badge-scadenza-scaduto:hover { background: #689f38; }
.badge-scadenza-rosso { background: #dc2626; color: #fff; }
.badge-scadenza-rosso:hover { background: #b91c1c; }
.badge-scadenza-arancione { background: #ea580c; color: #fff; }
.badge-scadenza-arancione:hover { background: #c2410c; }
/* Alert Scadenze: colonna stretta, stesso aspetto della card Clienti */
.dashboard-page .dashboard-alert-card { max-width: 320px; }
.dashboard-page .card.bg-warning { background: #bbdefb !important; border: 2px solid #1976d2; border-radius: 6px; color: #0d47a1; }
.dashboard-page .card.bg-warning .card-header { background: #1B5E20 !important; color: #fff !important; border-bottom: 2px solid #1976d2; }
.dashboard-page .card.bg-warning .list-group-item { background: #e1f5fe; border-color: #1976d2; padding: 0.4rem 0.75rem; font-size: 0.875rem; }
.dashboard-page .dashboard-alert-card .dashboard-alert-cliente { font-size: 0.9rem; }
.dashboard-page .dashboard-alert-card .dashboard-alert-dettaglio { font-size: 0.75rem; }
.dashboard-page .table-secondary { background: #cfd8dc !important; }

/* Dashboard alert: triangolo lampeggiante + link scheda (flex per evitare sovrapposizione) */
.dashboard-alert-list { list-style: none; }
.dashboard-alert-item { display: flex; align-items: flex-start; gap: 0.5rem; }
.dashboard-alert-item .dashboard-alert-triangle { flex-shrink: 0; margin-top: 0.2rem; }
.dashboard-alert-triangle {
  display: inline-block;
  width: 0; height: 0; min-width: 12px;
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-bottom: 10px solid #c62828;
  animation: dashboard-blink 1s ease-in-out infinite;
}
.dashboard-alert-link { text-decoration: none; color: inherit; display: block; flex: 1; min-width: 0; }
.dashboard-alert-link:hover { text-decoration: none; color: #1B5E20; }
.dashboard-alert-cliente { font-weight: 700; display: block; }
.dashboard-alert-dettaglio { font-size: 0.8rem; color: #555; display: block; margin-top: 0.15rem; }
@keyframes dashboard-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.area-haccp .card-header { background: #1B5E20; color: #fff; }
.area-sicurezza .card-header { background: #0d47a1; color: #fff; }

/* Scheda cliente: sfondo azzurrino, layout contrastante */
.dashboard-page .container-fluid { background: #e3f2fd; }
.scheda-toolbar { background: #bbdefb; border: 2px solid #1976d2; border-radius: 6px; padding: 0.75rem 1rem; }
.scheda-dati-cliente-box {
  display: inline-block;
  width: 100%;
  max-width: 100%;
  padding: 0.5rem 0.75rem;
  border: 2px solid #1B5E20;
  border-radius: 6px;
  background: #e8f5e9;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  font-size: 0.9rem;
}
#dati-cliente-display.scheda-dati-cliente-box .d-flex { gap: 0.5rem !important; margin-bottom: 0.35rem !important; }
#dati-cliente-display.scheda-dati-cliente-box .mb-2 { margin-bottom: 0.35rem !important; }
#dati-cliente-display.scheda-dati-cliente-box .d-flex:last-of-type { margin-bottom: 0 !important; }
.scheda-tab-content { min-height: 320px; background: #bbdefb; border: 2px solid #1976d2; border-top: 0; border-radius: 0 0 6px 6px; }
.dashboard-page h1, .dashboard-page h2, .dashboard-page h3 { font-family: var(--g-font-heading); }
#areaTab .nav-link { font-family: var(--g-font-heading); font-weight: 600; color: #0d47a1; background: #e3f2fd; border-color: #1976d2; border-bottom-color: #90caf9; }
#areaTab .nav-link:hover { background: #bbdefb; color: #0d47a1; }
#areaTab .nav-link.active { color: #fff !important; background: #1565c0 !important; border-color: #1976d2 #1976d2 transparent !important; border-bottom: 2px solid #bbdefb; font-weight: 700; box-shadow: 0 -2px 4px rgba(0,0,0,.1); }
.scheda-riquadro { border: 2px solid #1976d2; border-radius: 6px; padding: 0.75rem 1rem; background: #e1f5fe; }
.scheda-table { font-size: 0.875rem; background: #fff; border-color: #1976d2; }
.scheda-table th { background: #1B5E20; color: #fff; font-weight: 600; }
.scheda-table td, .scheda-table th { padding: 0.4rem 0.6rem; vertical-align: middle; }
.scheda-table td.piano-file-cell { vertical-align: top !important; }
.scheda-table td { color: #1b5e20; }
.scheda-table td.scheda-data { font-weight: bold; }
.scheda-form-inline .form-control-sm, .scheda-form-inline .form-select-sm { display: inline-block; }
/* Scheda cliente: triangolo rosso lampeggiante nelle righe in alert */
.scheda-alert-triangle {
  display: inline-block; width: 0; height: 0;
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-bottom: 8px solid #c62828;
  animation: dashboard-blink 1s ease-in-out infinite;
  vertical-align: middle;
}

/* Modal cliente (nuovo / modifica): bordi e campi legati al tema */
.modalCliente .modal-content {
  border: var(--g-card-border-width) solid var(--g-card-border);
  border-radius: var(--g-card-radius);
  overflow: hidden;
  box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.15);
}
.modalCliente .modalCliente-header {
  background: var(--g-card-header);
  color: #fff;
}
.modalCliente .modal-body {
  background: #e1f5fe;
  color: var(--g-table-list-td-color);
}
.modalCliente .modal-footer {
  background: #e1f5fe;
}
.modal-cliente-form .form-label {
  color: var(--g-link);
  font-family: var(--g-font-heading);
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 0.3rem;
}
.modal-cliente-form .form-control {
  border-width: 2px;
  border-color: var(--g-form-border);
  background-color: #fff;
  font-family: var(--g-font-data);
  color: inherit;
}
.modal-cliente-form .form-control:focus {
  border-color: var(--g-primary);
  box-shadow: 0 0 0 0.15rem rgba(0, 0, 0, 0.12);
  outline: 0;
}
.modalCliente .btn-modal-cliente-submit.btn-primary {
  background-color: var(--g-primary);
  border-color: var(--g-primary);
  color: #fff;
}
.modalCliente .btn-modal-cliente-submit.btn-primary:hover {
  background-color: var(--g-primary-hover);
  border-color: var(--g-primary-hover);
  color: #fff;
}
