/* Campi con bordo (stile A) - vale per i contenitori .nh-form, .settings-form-grid, .form-grid e .commesse-form-grid (Standard e Partner), tranne i form compatti (login, 2FA, password: .compact-form).
   Cambia soltanto il layout di etichetta, campi di testo, menu, area di testo, file e colore: pulsanti,
   interruttori e font NON sono toccati. Usa i colori del sito (--muted, --primary, --danger, --border-strong).
   Non modifica site.css: per tornare indietro basta fare git revert del commit che introduce questo file. */

:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) {
  row-gap: 16px;
  column-gap: 24px;
}

/* Etichetta sopra il campo, sentence case, leggibile (era maiuscolo 12px grigio chiaro). */
:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) label.field {
  gap: 4px;
}

:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) label.field > span:first-child {
  color: #334155;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 15px;
  letter-spacing: 0;
  text-transform: none;
}

/* Obbligatorio: asterisco rosso (regola UX: asterisco o testo, non solo colore). */
:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) label.field:has(input[required]):not(:has(.required-mark)) > span:first-child::after {
  content: " *";
  color: var(--danger);
  font-weight: 600;
}

/* Campo: bordo scuro (contrasto >= 3:1), raggio del sito, altezza 34px (etichetta + campo = 53px come prima). */
:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) .dxbl-text-edit,
:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) textarea.form-control,
:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) input[type="file"].form-control {
  min-height: 34px;
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: none;
  color: var(--text);
  transition: border-color .12s, box-shadow .12s;
}

:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) .dxbl-text-edit {
  height: 34px;
}

:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) .dxbl-text-edit input,
:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) .dxbl-text-edit .dxbl-text-edit-input {
  height: 32px;
  padding: 0 10px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}

:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) textarea.form-control {
  min-height: 64px;
  padding: 6px 10px;
  font-size: 14px;
}

/* Elementi decorativi interni dei campi DevExpress: disegnavano la fascia grigia dei campi disabilitati. */
:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) dxbl-input-editor::before,
:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) dxbl-input-editor::after,
:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) .dxbl-text-edit::before,
:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) .dxbl-text-edit::after {
  display: none;
}

:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) .dxbl-text-edit:hover:not(.dxbl-disabled),
:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) textarea.form-control:hover:not(:disabled) {
  border-color: #334155;
}

/* Focus: bordo blu + anello da 3px (contrasto >= 3:1). */
:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) .dxbl-text-edit:focus-within,
:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) textarea.form-control:focus,
:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) input[type="file"].form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .25);
}

/* Disabilitato dentro un form in modifica (es. Azienda): tratteggiato, spento, cursore "non consentito".
   !important perche' site.css forza i campi disabilitati a testo semplice con !important. */
:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) .dxbl-text-edit.dxbl-disabled,
:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) textarea.form-control:disabled {
  border: 1px dashed var(--border-strong) !important;
  background: var(--surface-soft) !important;
  color: var(--muted) !important;
  -webkit-text-fill-color: var(--muted) !important;
  opacity: .75 !important;
  cursor: not-allowed;
}

/* Sola lettura = nessun campo DevExpress abilitato nel form: contorno leggero (--border), senza freccia; stesso ingombro e stesso rientro del testo della modifica. */
:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)):not(:has(.dxbl-text-edit:not(.dxbl-disabled), textarea.form-control:not(:disabled))) .dxbl-text-edit,
:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)):not(:has(.dxbl-text-edit:not(.dxbl-disabled), textarea.form-control:not(:disabled))) textarea.form-control,
:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)):not(:has(.dxbl-text-edit:not(.dxbl-disabled), textarea.form-control:not(:disabled))) input[type="file"].form-control {
  border-color: var(--border) !important;
  border-style: solid !important;
  background: transparent !important;
  color: var(--text) !important;
  -webkit-text-fill-color: var(--text) !important;
  opacity: 1 !important;
  cursor: default;
}

:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)):not(:has(.dxbl-text-edit:not(.dxbl-disabled), textarea.form-control:not(:disabled))) .dxbl-edit-btn-dropdown,
:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)):not(:has(.dxbl-text-edit:not(.dxbl-disabled), textarea.form-control:not(:disabled))) .dxbl-btn-group-right {
  display: none;
}

/* Colore: campione tondo al posto della barra a tutta larghezza. */
:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) dxbl-input-editor.form-control:has(input[type="color"]) {
  justify-self: start;
  width: 34px;
  min-width: 34px;
  padding: 0;
  border: 0 !important;
  background: transparent !important;
  height: 34px;
}

:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) input[type="color"].dxbl-text-edit-input {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  overflow: hidden;
  background: none;
}

:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) input[type="color"].dxbl-text-edit-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) input[type="color"].dxbl-text-edit-input::-webkit-color-swatch {
  border: 0;
  border-radius: 50%;
}

/* Campo data standard (StandardDateInput): l'etichetta e' un <label> dentro .standard-date-input, non una label.field.
   font-weight con !important perche' il sito forza "body label" a 600 con !important. */
:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) .standard-date-input {
  gap: 4px;
}

:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) .standard-date-input > label {
  display: block; /* la label del sito e' una griglia: l'asterisco andrebbe a capo */
  color: #334155;
  font-size: 12.5px;
  font-weight: 500 !important;
  line-height: 15px;
  letter-spacing: 0;
  text-transform: none;
}

:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) .standard-date-input.required > label::after {
  content: " *";
  color: var(--danger);
  font-weight: 600;
}

/* Area di testo (DxMemo): non eredita l'altezza fissa di 34px dei campi a riga singola. */
:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) .dxbl-memo-edit {
  height: auto;
  min-height: 96px;
  align-items: stretch;
}

:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) .dxbl-memo-edit textarea {
  height: auto;
  min-height: 88px;
  padding: 6px 10px;
  font-size: 14px;
  line-height: 1.4;
  background: transparent;
  color: var(--text);
}

/* Pulsante interno dei campi (calendario, freccia): dentro il bordo del campo, senza riquadro proprio ne' angoli
   squadrati che escono dal raggio. */
:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) .dxbl-text-edit .dxbl-btn-group-right {
  background: transparent;
  border-radius: 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0;
  overflow: hidden;
  box-shadow: none;
  border-left: 0;
}

:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) .dxbl-text-edit .dxbl-edit-btn-dropdown {
  background: transparent;
  border-radius: 0;
  border-left: 0;
  box-shadow: none;
  color: var(--text-muted, #64748b);
}

:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)) .dxbl-text-edit .dxbl-edit-btn-dropdown:hover {
  background: var(--primary-soft, #eaf2ff);
  color: var(--primary-strong, #1d4ed8);
}

/* In sola lettura l'area di testo non ha bisogno dell'altezza di scrittura. */
:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)):not(:has(.dxbl-text-edit:not(.dxbl-disabled), textarea.form-control:not(:disabled))) .dxbl-memo-edit {
  min-height: 56px;
}

:is(.nh-form, .settings-form-grid, .form-grid, .commesse-form-grid):where(:not(.compact-form, .two-factor-form)):not(:has(.dxbl-text-edit:not(.dxbl-disabled), textarea.form-control:not(:disabled))) .dxbl-memo-edit textarea {
  min-height: 48px;
}

/* Asterisco dei campi obbligatori disegnato da BlazorFormField (vale ovunque, anche fuori dai form con bordo). */
.required-mark,
.field span.required-mark { /* il sito colora ".field span" in --muted: serve la specificita' maggiore */
  color: var(--danger);
  font-weight: 600;
}

/* ---- Nuova spesa: pannello Allegati e testi di aiuto (estensione al resto del sito da valutare) ---- */
/* Testi di aiuto e dati di sola visualizzazione accanto ai campi (Massimale, Costo km, Totale): frase normale, non piu'
   maiuscoletto 11px/900 grigio chiaro. Stessa scala delle etichette dei form; il valore resta in evidenza. */
.expense-field-with-note > span,
.expense-field-info span,
.expense-total-preview span {
  color: #475569;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.expense-field-with-note > span strong,
.expense-field-info strong {
  color: #0f172a;
  font-weight: 600;
}

.expense-field-info strong {
  font-size: 14px;
}

/* Dato mostrato ma non modificabile (es. Costo km): stesso aspetto dei campi in sola lettura (contorno leggero, senza fondo grigio). */
.expense-field-info {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
}

/* Pannello Scontrino / Allegati. */
.expense-row-editor-attachments {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.expense-row-editor-attachments h3 {
  color: #0f172a;
  font-size: 14px;
  font-weight: 600;
}

.expense-attachment-dropzone {
  min-height: 132px;
  gap: 6px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: #fff;
}

.expense-attachment-dropzone strong {
  color: #0f172a;
  font-size: 13px;
  font-weight: 600;
}

.expense-attachment-dropzone span {
  color: #475569;
  font-size: 12px;
  font-weight: 400;
}

.expense-attachment-dropzone:hover,
.expense-attachment-dropzone:focus-visible,
.expense-attachment-dropzone.dragging {
  border-color: var(--primary);
  background: var(--primary-soft);
}

/* L'icona e' un glifo di testo (freccia): si nasconde e si disegna una icona di caricamento con i colori del sito. */
.expense-attachment-dropzone .expense-attachment-dropzone-icon {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-soft);
  font-size: 0;
}

.expense-attachment-dropzone .expense-attachment-dropzone-icon::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--primary);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4'/%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3Cpath d='M5 20h14'/%3E%3C/svg%3E") center / 20px 20px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4'/%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3Cpath d='M5 20h14'/%3E%3C/svg%3E") center / 20px 20px no-repeat;
}

.expense-attachment-dropzone:hover .expense-attachment-dropzone-icon,
.expense-attachment-dropzone.dragging .expense-attachment-dropzone-icon {
  background: #fff;
}

/* Scansione da scanner: pulsante sotto la dropzone e finestra di scansione (l'interfaccia e' nel portale,
   lo strumento locale e' solo il ponte verso lo scanner). */
.scan-attachment {
  display: grid;
  justify-items: start;
  margin-top: 8px;
}

.scan-attachment__spinner {
  flex: none;
  width: 14px;
  height: 14px;
  border: 2px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: scan-attachment-spin 0.9s linear infinite;
}

@keyframes scan-attachment-spin {
  to { transform: rotate(360deg); }
}

/* Strumento non collegato: testo semplice e pulsante Installa. */
.scan-install {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.scan-install p {
  margin: 0;
  color: #334155;
  font-size: 14px;
  line-height: 1.5;
}

.scan-install__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}


/* Opzioni a sinistra, pagine acquisite a destra; in colonna su schermi stretti. */
.scan-workspace {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  margin-bottom: 16px;
}

.scan-options {
  display: grid;
  gap: 12px;
}

.scan-options__pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.scan-options__note {
  color: #475569;
  font-size: 13px;
  line-height: 1.5;
}

.scan-options__scan {
  justify-self: start;
}

.scan-pages {
  min-height: 420px;
  padding: 12px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.scan-pages__empty {
  display: grid;
  place-items: center;
  min-height: 396px;
  margin: 0;
  color: #475569;
  font-size: 13px;
  text-align: center;
}

.scan-pages__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.scan-page {
  position: relative;
  display: grid;
  gap: 6px;
  justify-items: center;
}

.scan-page img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.scan-page__label {
  color: #334155;
  font-size: 12px;
}


.scan-page__remove:hover:not(:disabled) {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}


.scan-page--busy {
  align-content: center;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

@media (max-width: 720px) {
  .scan-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .scan-pages,
  .scan-pages__empty {
    min-height: 160px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scan-attachment__spinner { animation-duration: 3s; }
}

.expense-attachment-empty {
  color: #475569;
  font-size: 12.5px;
  font-weight: 400;
}

/* Barra del Totale (Nuova spesa): verde pieno invece della sfumatura sbiadita, stessi verdi dei badge di successo. */
.expense-total-preview {
  background: #bbf7d0;
  border: 1px solid #4ade80;
}

.expense-total-preview span {
  color: #166534;
  font-weight: 600;
}

.expense-total-preview strong {
  color: #14532d;
  font-weight: 700;
}

/* Pagina di scansione: contenitore, gruppi di impostazioni, anteprima e visualizzatore. */
.scan-surface {
  padding: 16px;
}

.scan-options__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}





.scan-range {
  display: grid;
  gap: 4px;
}

.scan-range__label {
  display: flex;
  justify-content: space-between;
  color: #334155;
  font-size: 13px;
}

.scan-range input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}




.scan-preview__sheet {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 60vh;
  border: 1px solid var(--border);
  background: #fff;
}

.scan-preview__sheet img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.scan-preview__area {
  position: absolute;
  border: 2px solid var(--primary);
  background: rgba(37, 99, 235, 0.12);
  pointer-events: none;
}

.scan-page__open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

.scan-viewer {
  display: grid;
  gap: 12px;
}

.scan-viewer__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

.scan-viewer__info {
  color: #334155;
  font-size: 13px;
}

.scan-viewer__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.scan-viewer__image {
  display: block;
  width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border: 1px solid var(--border);
  background: #fff;
}


/* Avanzamento della scansione e rotazione pagine. */
.scan-progress {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.scan-progress__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #0f172a;
  font-size: 13.5px;
  font-weight: 600;
}

.scan-progress__bar {
  width: 100%;
  height: 8px;
  accent-color: var(--primary);
}


/* Schermata di scansione a tutta pagina, aperta sopra la pagina della spesa (stessa scheda). */
.scan-screen {
  position: fixed;
  inset: 0;
  z-index: 1060;
  overflow: auto;
  background: var(--bg);
}

.scan-screen__body {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px;
}
