@import url('https://fonts.googleapis.com/icon?family=Material+Icons');

.pu-dashboard {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pu-dashboard input[type="text"]:focus,
.pu-dashboard input[type="search"]:focus,
.pu-dashboard input[type="email"]:focus,
.pu-dashboard input[type="password"]:focus,
.pu-dashboard input[type="tel"]:focus,
.pu-dashboard textarea:focus,
.pu-dashboard select:focus,
.pu-dashboard .dt-input:focus {
  outline: none;
  border-color: #2e7d32;
  box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.2);
}

.pu-card {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.pu-card.datatables-manager-container {
  margin: 0 !important;
  padding: 14px !important;
  padding-top: 14px !important;
}

.pu-card.datatables-manager-container .pu-card__header {
  margin-bottom: 8px;
  padding-top: 0;
}

.pu-card.datatables-manager-container .pu-card__title {
  margin-bottom: 0;
}

.pu-card.datatables-manager-container .pu-card__subtitle {
  display: block;
  margin-top: 0;
}

.pu-card .dataTables_wrapper {
  margin-top: 0;
}

.pu-card .datatables-top-controls {
  margin: 6px 0 10px;
}

.pu-card__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.pu-card__title {
  margin: 0;
  flex: 1;
}

.pu-card__subtitle {
  color: #666;
  font-size: 13px;
}

.pu-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pu-actions--left {
  justify-content: flex-start;
  margin-bottom: 10px;
}

.pu-actions--password {
  margin-top: 2px;
}

.pu-dashboard .dt-button {
  background: #6aa84f;
  border: 1px solid #5b9144;
  color: #fff;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
}

.pu-dashboard .dt-button:hover {
  background: #639e49;
  border-color: #52853c;
}

.pu-dashboard .dt-button:focus {
  outline: 2px solid #6aa84f;
  outline-offset: 1px;
}

.pu-dashboard .pu-btn--cancel-edit,
.pu-dashboard .pu-btn--cancel-password,
.pu-dashboard .pu-btn--cancel-email {
  background: #9e9e9e;
  border-color: #8a8a8a;
}

.pu-dashboard .pu-btn--cancel-edit:hover,
.pu-dashboard .pu-btn--cancel-password:hover,
.pu-dashboard .pu-btn--cancel-email:hover {
  background: #8a8a8a;
  border-color: #7a7a7a;
}

.pu-btn--save-profile,
.pu-btn--cancel-edit,
.pu-btn--save-password,
.pu-btn--cancel-password {
  display: none;
}

.pu-form {
  margin: 0;
}

.pu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.pu-grid--password {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.pu-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 16px;
  color: #555;
}

.pu-field span {
  font-weight: 600;
}

.pu-value {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid #ccc;
  background: #f7f7f7;
  border-radius: 4px;
  color: #333;
  box-sizing: border-box;
}

.pu-value.is-empty {
  color: #999;
}

.pu-field input,
.pu-field select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}

.pu-field select {
  min-height: 38px;
}

.pu-input {
  display: none;
}

.pu-dashboard.is-editing .pu-input {
  display: block;
}

.pu-dashboard.is-editing .pu-value {
  display: none;
}

.pu-actions .pu-btn--save-profile,
.pu-actions .pu-btn--cancel-edit {
  display: none;
}

.pu-dashboard.is-editing .pu-actions .pu-btn--save-profile,
.pu-dashboard.is-editing .pu-actions .pu-btn--cancel-edit {
  display: inline-flex;
}

.pu-dashboard.is-editing .pu-actions .pu-btn--edit-profile {
  display: none;
}

.pu-password-form {
  display: none;
}

.pu-dashboard.is-password-open .pu-password-form {
  display: block;
}

.pu-email-form {
  display: none;
}

.pu-dashboard.is-email-open .pu-email-form {
  display: block;
}

.pu-actions--password .pu-btn--save-password,
.pu-actions--password .pu-btn--cancel-password {
  display: none;
}

.pu-dashboard.is-password-open .pu-actions--password .pu-btn--save-password,
.pu-dashboard.is-password-open .pu-actions--password .pu-btn--cancel-password {
  display: inline-flex;
}

.pu-actions--email .pu-btn--save-email,
.pu-actions--email .pu-btn--cancel-email {
  display: none;
}

.pu-dashboard.is-email-open .pu-actions--email .pu-btn--save-email,
.pu-dashboard.is-email-open .pu-actions--email .pu-btn--cancel-email {
  display: inline-flex;
}

.pu-dashboard.is-email-open .pu-actions--email .pu-btn--toggle-email {
  display: none;
}

.pu-email-current,
.pu-email-pending {
  margin-bottom: 6px;
}

.pu-email-current {
  font-size: 16px;
  font-weight: 600;
}

.pu-dashboard.is-password-open .pu-actions--password .pu-btn--toggle-password {
  display: none;
}

.pu-card--hidden {
  display: none;
}

.pu-email-confirm__loading {
  font-size: 16px;
}

.pu-email-confirm__link {
  display: inline-flex;
  margin-top: 8px;
  color: #2e7d32;
  text-decoration: none;
  font-weight: 600;
}

.pu-email-confirm__link:hover {
  text-decoration: underline;
}

.pu-loading {
  padding: 8px 0;
  color: #666;
  font-size: 16px;
}

.pu-list {
  display: grid;
  gap: 8px;
}

.pu-list__item {
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 8px 10px;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pu-list__item strong {
  font-weight: 600;
}

.pu-list__meta {
  color: #666;
  font-size: 16px;
}

.pu-field input[readonly],
.pu-field input[disabled] {
  background: #f7f7f7;
  color: #666;
}

.pu-hint {
  margin: 8px 0 0;
  color: #666;
  font-size: 16px;
}

.pu-status {
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 16px;
}

.pu-status--error {
  background: #fff3f3;
  border-color: #f5c2c2;
  color: #9b1c1c;
}

.pu-status--success {
  background: #f1faf4;
  border-color: #bfe3c7;
  color: #1e6b2b;
}

/* Badge neutro (pagamento "non pagato"): riusa i grigi di .pu-notice. */
.pu-status--neutral {
  background: #fafafa;
  border-color: #e0e0e0;
  color: #666;
}

.pu-notice {
  padding: 12px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background: #fafafa;
  text-align: center;
}

.pu-table--selectable tbody tr {
  cursor: pointer;
}

.pu-table--selectable tbody tr.is-selected {
  background: #e8f5e9 !important;
}

.pu-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pu-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.pu-modal--hidden {
  display: none;
}

.pu-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 0;
}

.pu-modal__content {
  position: relative;
  background: #fff;
  width: min(1100px, 92vw);
  max-height: 85vh;
  overflow: hidden;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  z-index: 1;
  display: flex;
  flex-direction: column;
}

.pu-modal__content:focus,
.pu-modal__content:focus-visible {
  outline: none !important;
}

.pu-modal__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.pu-modal__title {
  margin: 0;
  flex: 1;
}

.pu-modal__close {
  background: transparent;
  border: none;
  color: #333;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.pu-modal__close:hover {
  color: #000;
}

.pu-modal__body {
  flex: 0 1 auto;
  overflow: auto;
  max-height: calc(85vh - 130px);
}

.pu-modal .dataTables_wrapper {
  margin-top: 0;
}

.pu-modal .datatables-top-controls {
  display: flex !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  gap: 16px !important;
  justify-content: space-between !important;
  margin: 6px 0 10px;
}

.pu-modal .datatables-top-controls .dataTables_length {
  flex: 0 0 auto !important;
  margin: 0 !important;
  float: none !important;
}

.pu-modal .datatables-top-controls .dataTables_filter {
  flex: 1 1 auto !important;
  display: flex !important;
  justify-content: flex-end !important;
  margin: 0 !important;
  float: none !important;
}

.pu-modal .datatables-top-controls .dataTables_filter label {
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  margin: 0 !important;
}

.pu-modal .datatables-top-controls .dataTables_filter input {
  width: 100% !important;
  min-width: 240px !important;
  max-width: none !important;
  margin-left: 0 !important;
}

.pu-modal .datatables-top-controls .dt-search {
  flex: 1 1 auto;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.pu-modal .datatables-top-controls .dt-search label {
  margin: 0;
}

.pu-modal .datatables-top-controls .dt-search .dt-input {
  width: 100%;
  min-width: 240px;
  max-width: none;
}

@media (max-width: 768px) {
  .pu-card {
    padding: 14px;
  }

  .pu-modal__content {
    width: 96vw;
    max-height: 90vh;
    padding: 12px;
  }

  .pu-modal__body {
    max-height: calc(90vh - 120px);
  }
}

/* === Schede profilo (pilota): barra viste verdi stile pannello admin === */
.pu-view-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-bottom: 18px;
}

.pu-view-switch .pu-view-btn {
  margin: 0 !important;
  border-radius: 0;
}

.pu-view-switch .pu-view-btn:first-child {
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}

.pu-view-switch .pu-view-btn:last-child {
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

.pu-dashboard .pu-view-btn.is-active {
  background: #3f7028 !important;
  border-color: #2f5a1d !important;
  color: #fff !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25) !important;
}

/* I pannelli replicano il layout di .pu-dashboard (flex column, gap) così le card
   wrappate mantengono la stessa spaziatura di prima. */
.pu-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pu-panel--hidden {
  display: none !important;
}

/* Dettaglio sola lettura (riusa .pu-modal e .pu-list__*) */
.pu-detail__row {
  display: flex;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid #eee;
}

.pu-detail__label {
  flex: 0 0 38%;
  font-weight: 600;
  color: #555;
}

.pu-detail__value {
  flex: 1 1 auto;
  word-break: break-word;
}

.pu-detail__section {
  margin-top: 16px;
}

.pu-detail__section h5 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #3f7028;
}

/* Selettore account (discriminante pagamento) sopra le tabelle Gestione Utenze */
.pu-gu-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pu-gu-filter__label {
  font-weight: 600;
  color: #555;
}

.pu-gu-filter__select {
  min-width: 260px;
  max-width: 100%;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  color: #333;
}

/* Dettagli licenza: usate / disponibili / totali + stato e validità */
.pu-gu-details {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fafafa;
}

.pu-gu-details__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.pu-gu-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.pu-gu-stat__num {
  font-size: 22px;
  font-weight: 700;
  color: #3f7028;
  line-height: 1.1;
}

.pu-gu-stat__lbl {
  font-size: 13px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pu-gu-details__meta {
  margin-top: 10px;
  font-size: 15px;
  color: #555;
}
/* Il badge stato ha font-size proprio (16px) e resta invariato: non eredita il +font del testo. */

/* Disponibili < 0 (sovra-assegnazione): rosso, palette errore. */
.pu-gu-stat--alert .pu-gu-stat__num,
.pu-gu-stat--alert .pu-gu-stat__lbl {
  color: #c0392b;
}

/* Disponibili = 0 (posti esauriti, non un errore): grigio scuro. */
.pu-gu-stat--full .pu-gu-stat__num,
.pu-gu-stat--full .pu-gu-stat__lbl {
  color: #444;
}

.pu-gu-details__warn {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
}

.pu-gu-details__warn--full {
  background: #f2f2f2;
  border: 1px solid #d6d6d6;
  color: #444;
}

.pu-gu-details__warn--over {
  background: #fff3f3;
  border: 1px solid #f5c2c2;
  color: #9b1c1c;
}

/* Popover creazione azienda */
.pu-gu-create__step .pu-hint {
  margin: 8px 0 12px;
}

.pu-gu-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.pu-gu-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pu-gu-field span {
  font-weight: 600;
  font-size: 13px;
  color: #555;
}

.pu-gu-input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  color: #333;
}

.pu-gu-btn--back-piva {
  background: #9e9e9e !important;
  border-color: #8a8a8a !important;
}

.pu-gu-btn--back-piva:hover {
  background: #8a8a8a !important;
  border-color: #7a7a7a !important;
}

@media (max-width: 600px) {
  .pu-gu-form-grid {
    grid-template-columns: 1fr;
  }
}
