* {
  box-sizing: border-box;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

input[type="number"] {
  -moz-appearance: textfield;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f3f5f8;
  color: #1f2937;
}

.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* SIDEBAR */

.sidebar {
  width: 250px;
  background: #111827;
  color: #f9fafb;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #1f2937;
}

.logo {
  margin: 0 0 28px 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu-item {
  width: 100%;
  background: transparent;
  color: #d1d5db;
  border: none;
  text-align: left;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.98rem;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.menu-item:hover {
  background: #1f2937;
  color: #ffffff;
}

.menu-item.active {
  background: #2563eb;
  color: #ffffff;
}

.logout-btn {
  margin-top: auto;
  width: 100%;
  background: transparent;
  color: #9ca3af;
  border: 1px solid #374151;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.95rem;
  cursor: pointer;
  text-align: left;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.logout-btn:hover {
  background: #1f2937;
  color: #f9fafb;
}

/* CONTENUTO */

.content {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

.page {
  display: none;
}

.page.active-page {
  display: block;
}

h1 {
  margin-top: 0;
  margin-bottom: 24px;
  font-size: 2rem;
  color: #111827;
}

h2 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 1.2rem;
  color: #111827;
}

/* BOX */

.box {
  background: #ffffff;
  border: 1px solid #dbe2ea;
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 22px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

/* RIGHE */

.form-row,
.search-row,
.actions,
.status-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.form-row,
.search-row,
.actions {
  margin-bottom: 12px;
}

.status-row {
  justify-content: space-between;
  margin-bottom: 14px;
}

/* INPUT */

input,
select,
textarea {
  min-width: 180px;
  flex: 1;
  padding: 11px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 0.95rem;
  background: #ffffff;
  color: #6b7280;
  box-sizing: border-box;
  font-family: inherit;
}

textarea {
  resize: vertical;
}

#categoria {
  flex: 0 0 100px;
  min-width: 100px;
  max-width: 100px;
}

select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* BOTTONI */

button {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.95rem;
  cursor: pointer;
  transition:
    opacity 0.2s ease,
    transform 0.1s ease;
}

button:hover {
  opacity: 0.95;
}

button:active {
  transform: translateY(1px);
}

.primary-btn {
  background: #2563eb;
  color: #ffffff;
}

.secondary-btn {
  background: #e5e7eb;
  color: #111827;
}

.danger-btn {
  background: #dc2626;
  color: #ffffff;
}

/* BADGE */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #e8eefc;
  color: #1d4ed8;
  font-size: 0.85rem;
  font-weight: 600;
}

/* TABELLE */

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.95rem;
}

th {
  background: #f8fafc;
  color: #374151;
  font-weight: 700;
}

td {
  color: #111827;
}

/* MESSAGGI */

#messaggio,
#mov-search-message {
  min-height: 20px;
  margin-top: 8px;
  font-size: 0.92rem;
}

.success {
  color: #15803d;
}

.error {
  color: #dc2626;
}

.info-text {
  color: #475569;
}

.empty-state,
.table-placeholder {
  color: #6b7280;
  text-align: center;
  padding: 18px 10px;
}

.input-hint {
  font-size: 0.85rem;
  color: #6b7280;
  margin-top: 4px;
}

/* FORM PRODOTTO — label sinistra + campo destra */

.form-prodotto label,
.form-categoria label,
.form-fornitore label {
  flex: 0 0 210px;
  text-align: right;
  font-size: 0.95rem;
  color: #374151;
  white-space: nowrap;
}

.form-prodotto input,
.form-prodotto select,
.form-prodotto textarea,
.form-categoria input,
.form-categoria textarea,
.form-fornitore input,
.form-fornitore textarea {
  flex: 0 0 auto;
  min-width: unset;
  max-width: 100%;
}

.form-categoria #categoria-codice {
  width: 7ch;
}
.form-categoria #categoria-note {
  width: 100ch;
  resize: vertical;
}
.form-categoria #categoria-descrizione {
  width: 100ch;
}
.form-categoria #categoria-contenuto {
  width: 100ch;
  resize: vertical;
}

.form-fornitore #fornitore-nome {
  width: 100ch;
}
.form-fornitore #fornitore-piva {
  width: 15ch;
}
.form-fornitore #fornitore-cf {
  width: 22h;
}
.form-fornitore #fornitore-indirizzo {
  width: 100ch;
}
.form-fornitore #fornitore-sito {
  width: 100ch;
}
.form-fornitore #fornitore-contatto {
  width: 100ch;
}
.form-fornitore #fornitore-email {
  width: 100ch;
}
.form-fornitore #fornitore-telefono {
  width: 23ch;
}
.form-fornitore #fornitore-note {
  width: 100ch;
  resize: vertical;
}

.form-prodotto #categoria {
  width: 3ch;
}
.form-prodotto #nome {
  width: 100ch;
}
.form-prodotto #fornitore-id {
  width: 300px;
}
.form-prodotto #codice-fornitore {
  width: 30ch;
}
.form-prodotto #prezzo-vendita {
  width: 15ch;
  text-align: right;
}
.form-prodotto #prezzo-acquisto {
  width: 15ch;
  text-align: right;
}
.form-prodotto #quantita {
  width: 15ch;
  text-align: right;
}
.form-prodotto #posizione-magazzino {
  width: 100ch;
}
.form-prodotto #note-prodotto {
  width: 100ch;
}

.input-currency {
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-currency span,
.input-suffix {
  font-size: 0.95rem;
  color: #374151;
}

/* TABELLA PRODOTTI */

#tabella-prodotti th,
#tabella-prodotti td,
#tabella-fornitori th,
#tabella-fornitori td,
#tabella-fornitori-disattivi th,
#tabella-fornitori-disattivi td {
  white-space: nowrap;
  padding: 12px 16px;
}

/* STATO MODIFICA FORM */

#form-box.editing {
  border: 1px solid #93c5fd;
  box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.18);
}

/* RESPONSIVE */

@media (max-width: 900px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #1f2937;
  }

  .menu {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .menu-item {
    width: auto;
  }

  .content {
    padding: 20px;
  }

  .status-row {
    align-items: flex-start;
    justify-content: flex-start;
  }
}

.input-small {
  width: 140px;
  max-width: 140px;
  flex: 0 0 140px;
}

#mov-prodotto-tabella,
#mov-storico-tabella {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

#mov-prodotto-tabella td,
#mov-storico-tabella td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

td,
th {
  font-variant-numeric: tabular-nums;
}

/* numeri */
.col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* STATISTICHE */

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #e5e7eb;
  gap: 16px;
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-label {
  color: #374151;
  font-size: 0.95rem;
}

.stat-value {
  font-weight: 700;
  font-size: 1rem;
  color: #111827;
  font-variant-numeric: tabular-nums;
}

.stat-categoria {
  margin-bottom: 20px;
}

.stat-categoria:last-child {
  margin-bottom: 0;
}

.stat-categoria-titolo {
  font-size: 0.85rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

/* testo lungo */
.col-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
