/*
  Magazzino — Tema Professionale
  -------------------------------------------------
  - Palette moderna con variabili CSS
  - Tipografia pulita
  - Componenti coerenti (bottoni, card, tabelle, modali)
  - Accessibilità: focus visibile, contrasto adeguato
  - Responsive: mobile-first
*/

/* =====================
   ROOT & THEME TOKENS
===================== */
@import url("https://fonts.googleapis.com/css?family=Roboto+Condensed");

:root {
  --logo-top: 14px;
  --logo-left: 12px;
  /* Colori principali */
  --brand-50:  #eef2ff;
  --brand-100: #e0e7ff;
  --brand-200: #c7d2fe;
  --brand-300: #a5b4fc;
  --brand-400: #818cf8;
  --brand-500: #6366f1; /* primary */
  --brand-600: #4f46e5;
  --brand-700: #4338ca;

  --accent-500: #22d3ee; /* ciano */
  --accent-600: #06b6d4;

  /* Neutri */
  --bg:        #f6f7fb;
  --bg-card:   #ffffff;
  --text:      #1f2937; /* slate-800 */
  --text-dim:  #4b5563; /* slate-600 */
  --border:    #e5e7eb;
  --muted:     #f3f4f6;
  --shadow:    0 8px 24px rgba(0,0,0,.06);

  /* Stati */
  --success:   #10b981;
  --danger:    #ef4444;
  --warning:   #f59e0b;

  /* Raggi & spaziature */
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --pad:       16px;
}

/* =====================
   BASE
===================== */
* { box-sizing: border-box; }
html, body {
  height: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

@supports (overflow: clip) {
  html, body { overflow-x: clip; }
}

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Arial, sans-serif;
  background: linear-gradient(120deg, var(--brand-50), var(--bg) 40%, #fefefe);
  color: var(--text);
  margin: 0;
  padding: 24px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  animation: gradientBackground 16s ease-in-out infinite;
  background-size: 200% 200%;
}

@keyframes gradientBackground {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

h1, h2, h3 {
  margin: 0 0 12px;
  line-height: 1.2;
}

h1 {
  text-align: center;
  font-weight: 800;
  font-size: clamp(24px, 3vw, 32px);
  color: #111827; /* slate-900 */
  letter-spacing: -0.02em;
}

p { color: var(--text-dim); }

img { display: block; max-width: 100%; height: auto; }

/* =====================
   LAYOUT CONTAINERS
===================== */
#main-container,
#search-container,
#load-container,
#update-container,
#add-container,
#order-requests-container,
#print-container,
#inventory-container,
#changes-container,
#daily-changes-container,
#order-container,
#order-pdf-container,
#product-details,
#modify-product-container {
  margin: 20px 0;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

#modify-product-container,
#update-container,
#add-container,
#order-requests-container,
#inventory-container {
  scroll-margin-top: 88px;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.section-reveal {
  border-color: var(--brand-400) !important;
  box-shadow: 0 0 0 3px rgba(99,102,241,.22), var(--shadow);
}

/* Spazio sotto il titolo principale */
#search-container { margin-top: 24px; }
.search-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.search-header label {
  margin: 0;
  flex: 1;
  min-width: 200px;
  transform: translateY(-6px); /* alza leggermente il titolo della ricerca */
}
#search-container .button-container {
  align-items: center;
  flex-wrap: nowrap;
}
#search-container .button-container .inputGroup--full {
  flex: 1 1 auto;
  width: auto;
  min-width: 220px;
}
#search-container .inputGroup {
  overflow: visible; /* evita che la label flottante venga tagliata ai bordi */
}
#search-container .inputGroup label {
  padding-left: 1.15em;
  padding-right: 0.25em;
  width: auto;
}
#search-container .inputGroup input {
  /* Aggiunge respiro tra testo e bordo sinistro della barra, senza toccare la label flottante */
  padding-left: 1.15em;
  padding-right: 0.85em;
}
.ghost-button {
  background: transparent;
  color: var(--brand-600);
  border: 1px solid rgba(99,102,241,.35);
  box-shadow: none;
  padding-inline: 18px;
}
.mini-ghost {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: linear-gradient(180deg, rgba(99,102,241,.14), rgba(99,102,241,.04));
  color: var(--brand-700);
  border: 1px solid rgba(99,102,241,.45);
  border-radius: 999px;
  padding: 6px 14px 7px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(99,102,241,.08);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, color .18s ease;
}
.mini-ghost__stars {
  display: block;
  font-size: 11px;
  letter-spacing: 1.5px;
  line-height: 1;
  color: var(--brand-500);
}
.mini-ghost__label {
  display: block;
  font-size: 11px;
  letter-spacing: 1.2px;
  line-height: 1;
}
.mini-ghost:hover {
  background: linear-gradient(180deg, rgba(99,102,241,.22), rgba(99,102,241,.08));
  box-shadow: 0 6px 14px rgba(99,102,241,.18);
  transform: translateY(-1px);
}
.mini-ghost:active {
  transform: translateY(0);
  box-shadow: none;
}
.mini-ghost:focus-visible {
  outline: 2px solid var(--accent-500);
  outline-offset: 2px;
}
.ghost-button:hover {
  background: rgba(99,102,241,.08);
  color: var(--brand-600);
  box-shadow: 0 8px 18px rgba(99,102,241,.18);
}
.ghost-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

/* Logo fissato in alto a sinistra (all views) */
.top-left,
#logo-logout,
#issue-logo {
  position: fixed !important;
  top: 14px !important;
  left: 12px !important;
  right: auto !important;
  width: clamp(56px, 7vw, 78px) !important;
  height: auto !important;
  max-width: 78px !important;
  max-height: 78px !important;
  z-index: 1300 !important;
  pointer-events: auto;
  transform: translate3d(0,0,0) !important;
  margin: 0 !important;
  transition: opacity .2s ease, transform .2s ease;
}

#logo-logout img,
#issue-logo img {
  display: block;
  width: 100% !important;
  height: auto !important;
}

@media (max-width: 640px) {
  .top-left,
  #logo-logout,
  #issue-logo {
    top: 12px !important;
    left: 10px !important;
    width: 60px !important;
    max-width: 64px !important;
    max-height: 64px !important;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .top-left,
  #logo-logout,
  #issue-logo {
    top: 14px !important;
    left: 14px !important;
    width: 72px !important;
    max-width: 78px !important;
    max-height: 78px !important;
  }
}

#logo-logout.logo-hidden,
.top-left.logo-hidden,
#issue-logo.logo-hidden {
  display: none !important;
}

/* iPad / tablet safeguard: force fixed positioning */
@media (pointer: coarse) and (min-width: 641px) and (max-width: 1024px) {
  .top-left,
  #logo-logout,
  #issue-logo {
    position: fixed !important;
    top: 14px !important;
    left: 14px !important;
    right: auto !important;
    transform: translate3d(0,0,0) !important;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .top-left,
  #logo-logout,
  #issue-logo {
    top: 14px !important;
    left: 14px !important;
    right: auto !important;
    width: 72px !important;
    max-width: 78px !important;
    max-height: 78px !important;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  body { padding: 18px; }
  header.content-narrow { padding: 18px 18px 0 18px; }
}

/* Pulsante info flottante (home) con nuovo stile animato */
.floating-info {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 1300;
  border: none;
  color: #e8e8e8;
  background: #2b2f4a;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  min-width: 118px;
  height: 42px;
  padding: 8px 9px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(79, 70, 229, 0.25);
  transition: all 0.3s cubic-bezier(0.23, 1, 0.320, 1);
  overflow: hidden;
}

.floating-info .span {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.6s cubic-bezier(0.23, 1, 0.320, 1);
  transition-delay: 0.6s;
}

.floating-info:hover .span:nth-child(1) {
  transform: translateY(-100%);
  transition-delay: 0s;
}
.floating-info:hover .span:nth-child(2) {
  transform: translateY(-100%);
  transition-delay: 0s;
}

.floating-info::before {
  position: absolute;
  content: "";
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: linear-gradient(-45deg, var(--brand-600) 0%, var(--brand-400) 100%);
  transform: scaleX(0);
  transition: all 0.6s cubic-bezier(0.23, 1, 0.320, 1);
  transition-delay: 0;
  transform-origin: left;
}

.floating-info:hover::before {
  transform: scaleX(1);
  transition-delay: 0.6s;
}

.floating-info:active {
  box-shadow: none;
  transform: translateY(1px);
}

.floating-info:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

@media (max-width: 640px) {
  .floating-info {
    right: 12px;
    bottom: 16px;
    padding: 7px 8px;
    min-width: 110px;
    font-size: 12px;
    height: 40px;
  }
}

/* Popup info: layout più compatto e leggibile */
#infoModal .modal-content {
  width: min(520px, 92vw);
  padding: 26px 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

#infoModal .issue-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--danger);
  width: 38px;
  height: 30px;
  cursor: pointer;
  padding: 0;
  margin-top: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  transition: background .2s ease, color .2s ease, box-shadow .2s ease, border-color .2s ease, transform .2s ease;
}

#infoModal .issue-close svg {
  width: 16px;
  height: 16px;
}

#infoModal .issue-close:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #b91c1c;
  box-shadow: 0 8px 18px rgba(239, 68, 68, 0.18);
  transform: translateY(-1px);
}

#infoModal .issue-close:active {
  transform: translateY(0);
}

#infoModal .issue-close:focus-visible {
  outline: 2px solid var(--danger);
  outline-offset: 2px;
}

#infoModal h2 {
  margin: 2px 0 6px;
  font-size: 24px;
  line-height: 1.25;
}

#infoModal .inputGroup {
  max-width: none;
  width: 100%;
  margin: 10px 0;
}

#infoModal .inputGroup input,
#infoModal .inputGroup textarea {
  font-size: 15px;
  padding: 12px 14px;
  border-radius: 12px;
}

#infoModal .inputGroup textarea {
  min-height: 112px;
}

#infoModal .inputGroup label {
  padding: 0 14px;
}

#infoModal .issue-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 8px;
}

#infoModal .issue-send-btn {
  width: auto;
  min-width: 140px;
  justify-content: center;
  font-size: 15px;
  padding: 10px 14px;
  gap: 8px;
  align-self: center;
  box-shadow: 0 10px 24px rgba(79, 70, 229, 0.18);
}

header.content-narrow {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px 24px 0 24px;
}

.page-title {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.page-title__logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
}

.header-cta {
  position: absolute;
  right: 24px;
  top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: none;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-500));
  box-shadow: 0 10px 18px rgba(79,70,229,.22);
  cursor: pointer;
  font-weight: 700;
  z-index: 1100;
}

.header-cta:hover { filter: brightness(1.05); transform: translateY(-1px); }
.header-cta:active { transform: translateY(0); }

.setting-btn {
  width: 45px;
  height: 45px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background-color: rgb(129, 110, 216);
  border-radius: 10px;
  cursor: pointer;
  border: none;
  box-shadow: 0px 0px 0px 2px rgb(212, 209, 255);
  padding: 0;
  position: absolute;
  right: 24px;
  top: 12px;
  z-index: 1101;
}

.setting-btn .bar {
  width: 50%;
  height: 2px;
  background-color: rgb(229, 229, 229);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-radius: 2px;
}

.setting-btn .bar::before {
  content: "";
  width: 2px;
  height: 2px;
  background-color: rgb(126, 117, 255);
  position: absolute;
  border-radius: 50%;
  border: 2px solid white;
  transition: all 0.3s;
  box-shadow: 0px 0px 5px white;
}

.setting-btn .bar1::before { transform: translateX(-4px); }
.setting-btn .bar2::before { transform: translateX(4px); }
.setting-btn:hover .bar1::before { transform: translateX(4px); }
.setting-btn:hover .bar2::before { transform: translateX(-4px); }

.setting-tooltip {
  position: absolute;
  right: 110%;
  top: 50%;
  transform: translateY(-50%) scale(.95);
  background: #111827;
  color: #f9fafb;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  box-shadow: 0 8px 18px rgba(0,0,0,.18);
}

.setting-btn:hover .setting-tooltip {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

header.content-narrow h1 {
  margin: 0;
  text-align: center;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  header.content-narrow {
    flex-direction: column;
    align-items: flex-start;
    padding: 24px 18px 0 18px;
  }

  .page-title {
    width: 100%;
    justify-content: center;
  }

  .header-cta {
    position: static;
    align-self: flex-end;
    margin-top: 4px;
  }

  header.content-narrow h1 {
    text-align: center;
  }

  .setting-btn {
    position: static;
    align-self: flex-end;
    margin-top: 4px;
  }
}

/* =====================
   BUTTONS
===================== */
button,
input[type="submit"] {
  -webkit-appearance: none;
  appearance: none;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-500));
  color: #fff;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(79,70,229,.25);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease, background .3s ease;
}
button:hover,
input[type="submit"]:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(79,70,229,.28);
}
button.is-selected {
  background: linear-gradient(135deg, #7dd3fc, #38bdf8);
  border-color: rgba(56,189,248,.45);
  color: #0f172a;
  box-shadow: 0 10px 24px rgba(56,189,248,.25);
}
button.is-selected:hover {
  filter: brightness(1.02);
  box-shadow: 0 12px 28px rgba(56,189,248,.28);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex: 0 0 auto;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 10px;
  position: relative;
}

.icon-button .print-icon {
  width: 16px;
  height: 16px;
  background: center/18px 18px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9V2h12v7'/%3E%3Cpath d='M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2'/%3E%3Crect x='6' y='14' width='12' height='8' rx='1' ry='1'/%3E%3Cpath d='M9 17h6'/%3E%3C/svg%3E");
}

.icon-button .plus-icon {
  width: 16px;
  height: 16px;
  background: center/18px 18px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
}

/* Tooltip generico per pulsanti con icone */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(17,24,39,0.92);
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
  box-shadow: 0 8px 16px rgba(0,0,0,0.15);
  opacity: 0;
  pointer-events: none;
  z-index: 5;
  transition: opacity .16s ease, transform .16s ease;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
button:active,
input[type="submit"]:active { transform: translateY(0); }
button:focus-visible,
input[type="submit"]:focus-visible {
  outline: 3px solid var(--accent-500);
  outline-offset: 1px;
}

/* Pulsante elimina con coperchio animato */
.delete-button {
  --sz: 1rem;
  position: relative;
  padding: 0.4rem 0.5rem;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  cursor: pointer;
  transition: transform 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: calc(var(--sz) * 2.5);
  width: calc(var(--sz) * 2.5);
}
.trash-svg {
  width: calc(var(--sz) * 2.5);
  height: calc(var(--sz) * 2.5);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
  overflow: visible;
}
#lid-group {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: 12px 18px;
}
.delete-button:hover #lid-group {
  transform: rotate(-28deg) translateY(2px);
}
.delete-button:active #lid-group {
  transform: rotate(-12deg) scale(0.98);
}
.delete-button:hover .trash-svg {
  transform: scale(1.08) rotate(3deg);
}
.delete-button:active .trash-svg {
  transform: scale(0.96) rotate(-1deg);
}

/* Pulsante salva animato */
.action_has {
  --color: 0 0% 60%;
  --color-has: 211deg 100% 48%;
  --sz: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: calc(var(--sz) * 2.5);
  width: calc(var(--sz) * 2.5);
  padding: 0.4rem 0.5rem;
  border-radius: 0.375rem;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #0f172a;
}
.has_saved:hover svg {
  color: hsl(var(--color-has));
}
.has_saved svg {
  overflow: visible;
  height: calc(var(--sz) * 1.75);
  width: calc(var(--sz) * 1.75);
  --ease: cubic-bezier(0.5, 0, 0.25, 1);
  --zoom-from: 1.75;
  --zoom-via: 0.75;
  --zoom-to: 1;
  --duration: 1s;
}
.has_saved:hover path[data-path="box"] {
  transition: all 0.3s var(--ease);
  animation: has-saved var(--duration) var(--ease) forwards;
  fill: hsl(var(--color-has) / 0.35);
}
.has_saved:hover path[data-path="line-top"] {
  animation: has-saved-line-top var(--duration) var(--ease) forwards;
}
.has_saved:hover path[data-path="line-bottom"] {
  animation: has-saved-line-bottom var(--duration) var(--ease) forwards,
    has-saved-line-bottom-2 calc(var(--duration) * 1) var(--ease) calc(var(--duration) * 0.75);
}

@keyframes has-saved-line-top {
  33.333% { transform: rotate(0deg) translate(1px, 2px) scale(var(--zoom-from)); d: path("M 3 5 L 3 8 L 3 8"); }
  66.666% { transform: rotate(20deg) translate(2px, -2px) scale(var(--zoom-via)); }
  99.999% { transform: rotate(0deg) translate(0px, 0px) scale(var(--zoom-to)); }
}

/* CTA per ricerche (modifiche/prelievi) */
.search-cta {
  position: relative;
  border: none;
  background-color: #0ea5e9;
  color: #fff;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  gap: 10px;
  border-radius: 10px;
  transition: all 0.6s cubic-bezier(0.23, 1, 0.320, 1);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  overflow: hidden;
  min-width: 170px;
}
.search-cta span {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  gap: 10px;
}
.search-cta::before {
  content: "";
  position: absolute;
  background-color: #38bdf8;
  width: 100%;
  height: 100%;
  left: 0%;
  bottom: 0%;
  transform: translate(-100%, 100%);
  border-radius: inherit;
}
.search-cta svg {
  fill: #fff;
  transition: all 0.6s cubic-bezier(0.23, 1, 0.320, 1);
}
.search-cta:hover::before {
  animation: search-cta-shake 0.6s forwards;
}
.search-cta:hover svg {
  fill: white;
  scale: 1.15;
}
.search-cta:active {
  box-shadow: none;
}
.search-cta__label {
  white-space: nowrap;
}
.search-cta--text {
  gap: 0;
  min-width: auto;
  padding: 10px 16px;
}
.search-cta--text span {
  gap: 0;
}
.search-cta--icon {
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 10px;
  gap: 0;
}
.search-cta--icon span {
  gap: 0;
}
.reset-cta {
  height: 44px;
  width: 44px;
  min-width: 44px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: #111827;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, color .18s ease;
}
.reset-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(0,0,0,.12);
  border-color: rgba(15, 23, 42, 0.2);
  color: #0f172a;
}
.reset-cta .reset-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.reset-cta .reset-icon .reset-lottie {
  width: 20px;
  height: 20px;
}
@keyframes search-cta-shake {
  0% { transform: translate(-100%, 100%); }
  50% { transform: translate(20%, -20%); }
  100% { transform: translate(0%, 0%); }
}

/* Pulsante stampa animato */
.print-btn {
  width: 44px;
  min-width: 44px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 8px;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-500));
  border: none;
  border-radius: 12px;
  font-size: 0;
  cursor: pointer;
  overflow: visible;
  font-weight: 500;
  color: #fff;
  box-shadow: 0 10px 18px rgba(79,70,229,.24);
  transition: all 0.3s;
  position: relative;
  z-index: 1;
}
.print-btn:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(79,70,229,.28);
}
.print-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%) translateY(2px) scale(.95);
  background: #0f172a;
  color: #f9fafb;
  padding: 4px 8px;
  border-radius: 8px;
  border: 2px solid #1f2937;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 10px 18px rgba(0,0,0,.24);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease, filter .18s ease;
  z-index: 10;
}
.print-btn:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}
.printer-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 100%;
}
.printer-container {
  height: 50%;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.printer-container svg {
  width: 100%;
  height: auto;
  transform: translateY(4px);
}
.print-btn svg path { stroke: #fff; fill: #fff; }
.print-btn svg circle { fill: #fff; }
.printer-page-wrapper {
  width: 100%;
  height: 50%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.printer-page {
  width: 70%;
  height: 10px;
  border: 1px solid black;
  background-color: white;
  transform: translateY(0px);
  transition: all 0.3s ease;
  transform-origin: top;
}
.print-btn:hover .printer-page {
  height: 16px;
  background-color: rgb(239, 239, 239);
}

@media (max-width: 540px) {
  .print-btn {
    gap: 0;
    padding: 8px;
  }
}
@keyframes has-saved-line-bottom {
  33.333% { transform: rotate(0deg) translate(1px, 2px) scale(var(--zoom-from)); d: path("M 17 20 L 17 13 L 7 13 L 7 20"); }
  66.666% { transform: rotate(20deg) translate(2px, -2px) scale(var(--zoom-via)); }
  99.999% { transform: rotate(0deg) translate(0px, 0px) scale(var(--zoom-to)); d: path("M 17 21 L 17 21 L 7 21 L 7 21"); }
}
@keyframes has-saved-line-bottom-2 {
  from { d: path("M 17 21 L 17 21 L 7 21 L 7 21"); }
  to { transform: rotate(0deg) translate(0px, 0px) scale(var(--zoom-to)); d: path("M 17 20 L 17 13 L 7 13 L 7 20"); fill: white; }
}
@keyframes has-saved {
  33.333% { transform: rotate(0deg) translate(1px, 2px) scale(var(--zoom-from)); }
  66.666% { transform: rotate(20deg) translate(2px, -2px) scale(var(--zoom-via)); }
  99.999% { transform: rotate(0deg) translate(0px, 0px) scale(var(--zoom-to)); }
}

/* Variazioni */
button.align-left-text { text-align: left; width: 100%; }
.button-container, .button-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 12px 0 4px;
}
.button-container button, .button-group button { flex: 1 1 160px; }
.button-container .search-cta { flex: 0 0 auto; }
.active-button { background: linear-gradient(135deg, var(--warning), #f59e0b); color: #111827; }

.management-sections button {
  white-space: normal;
  line-height: 1.25;
}

.management-sections button.is-selected {
  border-color: rgba(56,189,248,.55);
  box-shadow: 0 0 0 2px rgba(56,189,248,.22), 0 10px 24px rgba(56,189,248,.18);
}

.actions-toolbar {
  position: relative;
  justify-content: flex-end;
  gap: 8px;
  min-height: 52px;
}
.actions-toolbar #load-button {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.actions-toolbar button { flex: 0 0 auto; }
.actions-toolbar .icon-button {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 8px;
}

@media (max-width: 640px) {
  .management-sections {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
  }

  .management-sections button {
    flex: 1 1 calc(50% - 10px);
    min-width: 140px;
    margin: 0;
    min-height: 52px;
    padding: 12px 10px;
    font-size: 14px;
    text-align: center;
    border-radius: 12px;
  }

  .actions-toolbar {
    min-height: 0;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
  }

  .actions-toolbar #load-button {
    order: 2;
    position: static;
    left: auto;
    transform: none;
    flex: 1 1 100%;
    width: 100%;
    margin: 0;
  }

  .actions-toolbar .print-btn,
  .actions-toolbar .icon-button {
    order: 1;
    flex: 0 0 auto;
    margin: 0;
  }
}

@media (max-width: 360px) {
  .management-sections button {
    flex-basis: 100%;
  }
}

.fixed-button {
  position: fixed;
  top: 24px;
  right: 16px;
  z-index: 1100;
  padding: 8px 10px;
  width: 120px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
  border-radius: 12px;
  background: linear-gradient(135deg, #10b981, #059669);
  border: 1px solid rgba(5,150,105,.2);
  box-shadow: 0 12px 32px rgba(16,185,129,.25);
}

#order-requests-container .button-container > .fixed-button.save-suppliers-btn,
#inventory-container > .fixed-button.save-inventory-btn {
  width: 96px;
  min-width: 96px;
}

/* Pulsante Esci in alto a destra (se presente inline nell'HTML) */
#logout-button {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 1101; /* sopra al fixed-button */
}

.fixed-button,
.product-save-btn,
.btn-save {
  overflow: hidden;
  isolation: isolate;
}

.btn-save {
  position: relative;
}

.fixed-button::before,
.product-save-btn::before,
.btn-save::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 160px;
  height: 160px;
  transform: translate(-50%, -50%) scale(0.55);
  border-radius: 999px;
  background: radial-gradient(circle,
    transparent 0 28%,
    rgba(255, 255, 255, 0.14) 29% 31%,
    transparent 32% 48%,
    rgba(255, 255, 255, 0.12) 49% 51%,
    transparent 52% 68%,
    rgba(255, 255, 255, 0.1) 69% 71%,
    transparent 72% 88%,
    rgba(255, 255, 255, 0.08) 89% 91%,
    transparent 92% 100%);
  opacity: 0.8;
  animation: ripple 0.8s linear infinite;
  pointer-events: none;
}

.fixed-button:hover,
.product-save-btn:hover,
.btn-save:hover {
  opacity: 0.95;
}

@keyframes ripple {
  0% {
    transform: translate(-50%, -50%) scale(0.55);
    opacity: 0.8;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0;
  }
}

/* =====================
   FORM ELEMENTS
===================== */
label { display: block; margin: 8px 0 6px; font-weight: 600; color: #111827; }

input[type="text"],
input[type="number"],
input[type="date"],
select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
input::placeholder { color: #9ca3af; }

input:focus, select:focus {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 4px rgba(99,102,241,.15);
}

/* Campi con etichetta flottante */
.inputGroup {
  font-family: 'Segoe UI', sans-serif;
  margin: 1em 0;
  max-width: 190px;
  position: relative;
  --input-group-surface: var(--bg-card);
}

/* Allinea i campi data (calendar-field) all'altezza degli altri input */
.history-pane__grid > div {
  display: flex;
}
.history-pane__grid > div .calendar-field,
.history-pane__grid > div .inputGroup {
  flex: 1 1 auto;
}

.inputGroup--full {
  max-width: none;
  width: 100%;
}

.inputGroup input,
.inputGroup textarea {
  font-size: 92%;
  padding: 0.6em;
  outline: none;
  border: 2px solid rgb(200, 200, 200);
  background-color: var(--input-group-surface);
  border-radius: 14px;
  width: 100%;
  transition: border-color .3s ease, box-shadow .3s ease;
}

.inputGroup textarea {
  line-height: 1.4;
  min-height: 110px;
  resize: vertical;
}
.inputGroup label {
  font-size: 92%;
  position: absolute;
  top: 0;
  left: 0;
  right: auto;
  bottom: auto;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  transform: none;
  padding: 0 0.2em 0 0.7em;
  margin: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  color: rgb(100, 100, 100);
  transform-origin: left center;
  width: auto;
  max-width: calc(100% - 1.4em);
  text-align: left;
}

.inputGroup:focus-within label,
.inputGroup.filled label {
  top: 0;
  right: auto;
  bottom: auto;
  min-height: 0;
  height: auto;
  transform: translateY(-68%) scale(.9);
  margin: 0;
  margin-left: 0.75em;
  padding: 0.25em 0.18em 0.25em 0.75em;
  justify-content: flex-start;
  background-color: var(--input-group-surface);
  box-shadow: 0 0 0 4px var(--input-group-surface);
  line-height: 1.1;
  width: auto;
  max-width: calc(100% - 1.4em);
  text-align: left;
}

.inputGroup:focus-within :is(input, textarea),
.inputGroup.filled :is(input, textarea) {
  border-color: rgb(150, 150, 200);
}

.inputGroup :is(input:focus, textarea:focus) { box-shadow: none; }

/* Nuovo Ordine: campi statici senza etichette flottanti */
#update-container .order-field {
  margin: 0;
  max-width: none;
  display: grid;
  gap: 6px;
}

#update-container .order-field > label {
  position: static;
  inset: auto;
  display: block;
  transform: none;
  padding: 0;
  margin: 0;
  pointer-events: auto;
  width: auto;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  color: rgb(75, 85, 99);
  background: transparent;
  box-shadow: none;
}

#update-container .order-field > input {
  font-size: 92%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}

#update-container .order-field:focus-within > label,
#update-container .order-field.filled > label {
  top: auto;
  right: auto;
  bottom: auto;
  transform: none;
  margin: 0;
  padding: 0;
  width: auto;
  text-align: left;
  background: transparent;
  box-shadow: none;
}

#update-container .order-field:focus-within > input,
#update-container .order-field.filled > input {
  border-color: var(--brand-400);
}

#update-container .order-field > input:focus {
  box-shadow: 0 0 0 4px rgba(99,102,241,.15);
}

#update-container .order-field.has-suggestions .inline-suggestion {
  display: none;
}

#update-container .order-field.has-suggestions input {
  background-color: #fff;
}

/* Nuovo Ordine: allineamento uniforme colonne input/azioni */
#update-table tbody td {
  vertical-align: top;
}

#update-table .number-control {
  width: 100%;
  max-width: none;
  margin: 0;
}

#update-table tbody td:nth-child(4) > button:not(.delete-button) {
  width: 100%;
}

@media (min-width: 641px) {
  /* Compensa la riga etichetta presente in ID/Fornitore */
  #update-table tbody td:nth-child(2)::before,
  #update-table tbody td:nth-child(4)::before {
    content: "";
    display: block;
    height: 22px;
  }
}

/* Mobile: disattiva l'effetto label flottante nelle 4 pagine operative */
@media (max-width: 640px) {
  body.mobile-static-labels .inputGroup {
    display: grid;
    gap: 6px;
  }

  body.mobile-static-labels .inputGroup label {
    position: static;
    inset: auto;
    display: block;
    transform: none !important;
    padding: 0;
    margin: 0;
    pointer-events: auto;
    width: auto;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    color: rgb(75, 85, 99);
    background: transparent !important;
    box-shadow: none !important;
    transition: none;
  }

  body.mobile-static-labels .inputGroup:focus-within label,
  body.mobile-static-labels .inputGroup.filled label {
    top: auto;
    right: auto;
    bottom: auto;
    transform: none !important;
    margin: 0;
    padding: 0;
    width: auto;
    text-align: left;
    background: transparent !important;
    box-shadow: none !important;
  }
}

.calendar-input {
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Controllo numerico con +/- */
.number-control {
  display: flex;
  align-items: stretch;
  width: 100%;
  max-width: 220px;
  border: 1px solid var(--brand-600);
  border-radius: 8px;
  overflow: hidden;
  background: var(--brand-600);
  min-height: 32px;
  margin: 0 auto;
}

.number-left,
.number-right {
  display: flex;
}

.number-left::before,
.number-right::after {
  content: attr(data-content);
  background: var(--brand-600);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  width: 34px;
  height: 100%;
  color: #fff;
  transition: filter 0.2s ease;
  cursor: pointer;
}

.number-left::before {
  content: "-";
  border-radius: 0;
}

.number-right::after {
  content: "+";
  border-radius: 0;
}

.number-quantity {
  flex: 1 1 auto;
  padding: 8px 10px;
  border: 0;
  width: auto;
  min-width: 0;
  -moz-appearance: textfield;
  font-weight: 600;
  color: #fff;
  background: var(--brand-600);
  text-align: center;
}

#order-requests-table .number-left::before,
#order-requests-table .number-right::after {
  width: 18px;
  font-size: 0.8em;
}

.number-quantity::placeholder {
  color: var(--brand-100);
}

.number-quantity::-webkit-inner-spin-button,
.number-quantity::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* =====================
   HISTORY CARD (Modifiche + Prelievi)
===================== */
.history-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.history-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.history-card__eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-700);
  font-weight: 800;
}

.history-card__subtitle {
  margin: 4px 0 0;
  color: var(--text-dim);
  max-width: 52ch;
}

.history-filters {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--muted);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
}

.history-filter {
  background: transparent;
  color: var(--text-dim);
  border-color: transparent;
  box-shadow: none;
  padding: 10px 14px;
  min-width: 120px;
  font-weight: 700;
}

.history-filter:hover {
  background: rgba(99,102,241,.08);
  color: var(--brand-700);
}

.history-filter.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-500));
  box-shadow: 0 10px 22px rgba(79,70,229,.22);
}

.history-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

/* Calendario stile Keyframers con bottone chiuso */
.calendar-field {
  position: relative;
  width: 100%;
  isolation: isolate;
  margin: 1em 0;
  --unit: 9px;
  --day: 30px;
  --height-collapsed: var(--day);
  --height-expanded: auto;
  --width: 220px;
  --duration: 0.28s;
  font-family: "Roboto Condensed", "Inter", system-ui, sans-serif;
}

.calendar-field.is-open {
  z-index: 80;
}

/* Allinea i pulsanti calendario (inizio/fine) all'altezza degli altri campi */
#changes-container .calendar-toggle {
  min-height: 40px;
  padding: 8px 10px;
  font-size: 14px;
}

.calendar-field::before {
  content: "";
  display: none;
}

.calendar-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  color: #1f2937;
  border: 1px solid #d8dee9;
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 8px 18px rgba(0,0,0,.12);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  line-height: 1.1;
  min-height: 40px;
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}

.calendar-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(108,123,255,.35);
  border-color: rgba(108,123,255,.45);
}

.calendar-field.is-open .calendar-toggle {
  box-shadow: 0 0 0 3px rgba(108,123,255,.35), 0 16px 32px rgba(0,0,0,.18);
  border-color: rgba(108,123,255,.45);
}

.calendar-toggle__value {
  flex: 1 1 auto;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.1;
  color: #111827;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-toggle__reset {
  color: #6b7280;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 13px;
  cursor: pointer;
}

.calendar-toggle__reset[hidden] { display: none !important; }

.calendar-toggle__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #4b5563;
}

.calendar-toggle__icon svg {
  width: 18px;
  height: 18px;
}

.calendar-native {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.ui-calendar {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  width: min(220px, calc(100vw - 24px));
  height: auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0,0,0,.18);
  border: 1px solid #d5dbe7;
  padding: 6px 8px 8px;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -4px);
  transform-origin: top center;
  transition: opacity var(--duration) ease, transform var(--duration) ease, visibility var(--duration) ease;
  z-index: 1600;
  pointer-events: none;
}

.calendar-field.is-open .ui-calendar {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

@media (min-width: 641px) {
  .ui-calendar {
    width: 100%;
    max-width: none;
  }

  .calendar-field.is-open .ui-calendar {
    transform: translate(-50%, -1px);
  }
}

.ui-calendar .ui-header {
  position: relative;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #374151;
  padding: 8px 10px 6px;
  overflow: visible;
}

.ui-text {
  position: static;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  letter-spacing: 0.08em;
  transition: opacity calc(var(--duration) * .35) ease;
}

.ui-text.-empty { opacity: 0; }

.ui-text.-month-year {
  opacity: 1;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  gap: 6px;
  white-space: nowrap;
  text-align: center;
  justify-content: center;
}

.ui-nav {
  border: none;
  background: none;
  font-size: 18px;
  line-height: 1;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  appearance: none;
  border-radius: 0;
  box-shadow: none;
  outline: none;
  transition: none;
}

.ui-nav:hover {
  color: #6b7280;
}

.ui-nav.ui-nav--prev { }
.ui-nav.ui-nav--next { }

.ui-grid {
  display: none;
}

.ui-bg {
  position: absolute;
  inset: 0;
  background-color: #fff;
  border-radius: 14px;
  transform-origin: top center;
  box-shadow: 0 1rem 1rem rgba(0,0,0,0.12);
  transition-duration: calc(var(--duration) * 0.5);
  transition-delay: calc(var(--duration) * 0.4);
  overflow: hidden;
}

.ui-days {
  position: relative;
  margin-top: 2px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(6, 30px);
  gap: 0;
  border: 1px solid #d8dee9;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity calc(var(--duration) * .35) ease, transform calc(var(--duration) * .35) ease;
}

.calendar-field.is-open .ui-days {
  opacity: 1;
  transform: translateY(0);
}

.ui-day {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #1f2937;
  background: #fff;
  border: 1px solid #d8dee9;
  aspect-ratio: 1 / 1;
  min-height: 30px;
  opacity: 0;
  transition: background .2s ease, color .2s ease, border-color .2s ease, opacity .25s ease;
}

.calendar-field.is-open .ui-day {
  opacity: 1;
}

.ui-day:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
}

.ui-day.-current {
  background: #111827;
  color: #fff;
  border-color: #0f172a;
}

.ui-day.-today {
  outline: 2px solid #94a3b8;
  outline-offset: -2px;
  background: #f8fafc;
}
.ui-day.is-empty {
  cursor: default;
  background: transparent;
  color: transparent;
  border-color: transparent;
  pointer-events: none;
}

/* ---------------------------------- */

.history-pane__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-start;
  margin-top: 8px;
}

.history-pane__actions .reset-cta {
  margin-left: auto;
}

.history-pane__actions input[type="submit"] {
  flex: 0 0 auto;
  margin-left: auto;
}

.history-pane__hint {
  margin: 0;
  color: var(--text-dim);
  font-size: 12px;
  flex: 1 1 100%;
  order: -1;
}

.history-results {
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.history-results__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.history-results__header h4 {
  margin: 0;
}

.history-card table {
  margin-top: 8px;
}

.history-pane[hidden] {
  display: none !important;
}

@media (max-width: 720px) {
  .history-filters {
    width: 100%;
    justify-content: space-between;
  }

  .history-filter {
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
  }
}

@media (max-width: 640px) {
  .history-pane__grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .history-pane__actions {
    gap: 10px;
  }

  .history-pane__actions .reset-cta,
  .history-pane__actions input[type="submit"] {
    margin-left: 0;
  }

  .calendar-field {
    margin: 0;
    z-index: 1;
  }

  .calendar-field .ui-calendar {
    left: 0;
    right: auto;
    width: min(360px, calc(100vw - 44px));
    max-width: 100%;
    transform: translateY(-4px);
    z-index: 1300;
  }

  .calendar-field.is-open {
    z-index: 40;
    margin-bottom: 236px;
  }

  .calendar-field.is-open .ui-calendar {
    transform: translateY(0);
  }

  /* Su mobile mantieni la griglia completa visibile */
  .ui-day.is-empty {
    background: #f8fafc;
    border-color: #e5e7eb;
  }

  .history-results {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #changes-result,
  #changes-by-date-name-result {
    min-width: 720px;
  }
}

.number-left:hover::before,
.number-right:hover::after {
  filter: brightness(1.08);
}

#addForm {
  display: grid;
  grid-template-columns: minmax(140px, 180px) 1fr;
  gap: 12px 16px;
}
#addForm input[type="submit"] { grid-column: 1 / -1; justify-self: center; }

.form-feedback {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  background: var(--muted);
  color: var(--text-dim);
}

.form-feedback.is-success {
  border-color: rgba(16,185,129,.35);
  background: rgba(16,185,129,.12);
  color: var(--success);
}

.form-feedback.is-error {
  border-color: rgba(239,68,68,.35);
  background: rgba(239,68,68,.12);
  color: var(--danger);
}

.form-hint {
  grid-column: 1 / -1;
  margin: 12px 0 0;
  font-size: 0.92rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-hint kbd {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--muted);
  border: 1px solid var(--border);
  font-size: 0.86rem;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  color: var(--text);
  box-shadow: inset 0 -1px 0 rgba(15,23,42,.1);
}

@media (max-width: 600px) {
  #addForm { grid-template-columns: 1fr; }
  input[type="text"], input[type="number"], input[type="date"], button, select { width: 100%; margin: 6px 0; }
  #search-container .button-container {
    flex-wrap: wrap;
  }
  #search-container .button-container .inputGroup--full {
    width: 100%;
    min-width: 0;
  }
}

/* =====================
   TABLES
===================== */
table { width: 100%; border-collapse: collapse; margin: 16px 0; }

th, td {
  border: 1px solid var(--border);
  padding: 12px;
  text-align: left;
}

th {
  background: linear-gradient(180deg, var(--muted), #fff);
  color: #111827;
  font-weight: 700;
  position: relative;
}

tbody tr:nth-child(odd)  { background: #fafafc; }
tbody tr:nth-child(even) { background: #ffffff; }

tbody tr:hover { background: #f8fafc; }

.qty-delta {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.qty-delta-sign {
  font-weight: 700;
  margin-right: 2px;
}

.qty-delta--positive {
  color: #15803d;
}

.qty-delta--negative {
  color: #dc2626;
}

.qty-delta--neutral {
  color: var(--text-dim);
}

.table-group-row td {
  background: #f3f4f6;
  font-weight: 700;
  color: #111827;
}

.recently-added {
  background: linear-gradient(90deg, rgba(99,102,241,.08), rgba(129,140,248,.03));
  transition: background .25s ease;
}

.recently-added:hover {
  background: linear-gradient(90deg, rgba(99,102,241,.12), rgba(129,140,248,.06));
}

/* Tabella principale risultati */
#result thead th,
#update-table thead th,
#inventory-table thead th,
#changes-result thead th,
#changes-by-date-name-result thead th,
#order-requests-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  box-shadow: inset 0 -1px 0 var(--border), 0 2px 4px rgba(0,0,0,.04);
}

/* Contenitore richieste ordine con scroll tabella */
#order-requests-container { overflow: visible; }
.order-requests-table-wrapper {
  max-height: 700px;
  overflow-y: auto;
}

@media (max-width: 640px) {
  #main-container,
  #update-container,
  #order-requests-container,
  #inventory-container {
    padding: 14px;
  }

  #update-container > .fixed-button,
  #inventory-container > .fixed-button,
  #order-requests-container .button-container > .fixed-button {
    position: static;
    top: auto;
    right: auto;
    width: 100%;
    margin: 0 0 10px;
    z-index: auto;
  }

  #order-requests-container .button-container > .fixed-button.save-suppliers-btn,
  #inventory-container > .fixed-button.save-inventory-btn {
    width: 100%;
    min-width: 0;
  }

  #order-requests-container .button-container {
    justify-content: stretch !important;
  }

  #order-requests-container .order-requests-table-wrapper {
    max-height: none;
    overflow: visible;
  }

  #result,
  #update-table,
  #inventory-table,
  #order-requests-table {
    margin: 10px 0 0;
  }

  #result thead,
  #update-table thead,
  #inventory-table thead,
  #order-requests-table thead {
    display: none;
  }

  #result tbody,
  #update-table tbody,
  #inventory-table tbody,
  #order-requests-table tbody {
    display: grid;
    gap: 10px;
  }

  #result tbody tr,
  #update-table tbody tr,
  #inventory-table tbody tr,
  #order-requests-table tbody tr {
    display: block;
    border: 1px solid rgba(99, 102, 241, 0.22);
    border-radius: 12px;
    background: #fff !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    overflow: hidden;
  }

  #result td,
  #update-table td,
  #inventory-table td,
  #order-requests-table td {
    display: flex;
    flex-direction: column;
    gap: 6px;
    border: 0;
    border-top: 1px solid var(--border);
    padding: 10px 12px;
    min-width: 0;
  }

  #result td:first-child,
  #update-table td:first-child,
  #inventory-table td:first-child,
  #order-requests-table td:first-child {
    border-top: 0;
  }

  #result td::before,
  #update-table td::before,
  #inventory-table td::before,
  #order-requests-table td::before {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-dim);
  }

  #result td:nth-child(1)::before { content: "ID prodotto"; }
  #result td:nth-child(2)::before { content: "Nome prodotto"; }
  #result td:nth-child(3)::before { content: "Giacenza"; }

  #update-table td:nth-child(1)::before { content: "ID prodotto"; }
  #update-table td:nth-child(2)::before { content: "Quantita da ordinare"; }
  #update-table td:nth-child(3)::before { content: "Fornitore"; }
  #update-table td:nth-child(4)::before { content: "Azione"; }

  #inventory-table td:nth-child(1)::before { content: "ID prodotto"; }
  #inventory-table td:nth-child(2)::before { content: "Nome prodotto"; }
  #inventory-table td:nth-child(3)::before { content: "Numero"; }

  #order-requests-table td:nth-child(1)::before { content: "ID prodotto"; }
  #order-requests-table td:nth-child(2)::before { content: "Nome prodotto"; }
  #order-requests-table td:nth-child(3)::before { content: "Giacenza attuale"; }
  #order-requests-table td:nth-child(4)::before { content: "Quantita richiesta"; }
  #order-requests-table td:nth-child(5)::before { content: "Pezzi per scatola"; }
  #order-requests-table td:nth-child(6)::before { content: "Totale pezzi"; }
  #order-requests-table td:nth-child(7)::before { content: "Fornitore"; }
  #order-requests-table td:nth-child(8)::before { content: "Salva"; }
  #order-requests-table td:nth-child(9)::before { content: "Rimuovi"; }

  #result td :is(input, select, button),
  #update-table td :is(input, select, button),
  #inventory-table td :is(input, select, button),
  #order-requests-table td :is(input, select, button) {
    margin: 0;
  }

  #result td button,
  #update-table td button,
  #inventory-table td button,
  #order-requests-table td button {
    width: auto;
  }

  #update-table td:nth-child(4) button {
    width: 100%;
  }

  #update-table .number-control,
  #inventory-table .number-control,
  #order-requests-table .number-control {
    width: 100%;
    max-width: none;
    margin: 0;
  }

  #order-requests-table .number-left::before,
  #order-requests-table .number-right::after {
    width: 32px;
    font-size: 1rem;
  }

  #order-requests-table tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  #order-requests-table td {
    grid-column: 1 / -1;
  }

  #order-requests-table td:nth-child(8),
  #order-requests-table td:nth-child(9) {
    grid-column: auto;
    align-items: stretch;
    flex-direction: row;
    justify-content: center;
  }

  #order-requests-table td:nth-child(8) {
    grid-column: 2;
    grid-row: 8;
  }

  #order-requests-table td:nth-child(9) {
    grid-column: 1;
    grid-row: 8;
  }

  #order-requests-table td:nth-child(8)::before,
  #order-requests-table td:nth-child(9)::before {
    display: none;
  }

  #order-requests-table td:nth-child(8) button,
  #order-requests-table td:nth-child(9) button {
    width: 100%;
  }
}

.supplier-search-row {
  --supplier-search-control-height: 40px;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  max-width: none;
}
.supplier-search-row .inputGroup {
  margin: 0;
  flex: 1 1 0%;
  width: auto;
  min-width: 0;
}
.supplier-search-row button {
  flex: 0 0 auto;
  width: auto;
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  font-size: 0.85rem;
  line-height: 1;
}
.supplier-search-row .supplier-search-btn {
  min-width: 168px;
  width: auto;
  margin-left: auto;
  min-height: var(--supplier-search-control-height);
  height: var(--supplier-search-control-height);
  box-sizing: border-box;
  padding: 0 18px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1;
  box-shadow: 0 10px 22px rgba(79, 70, 229, 0.24);
}
.supplier-search-row .supplier-search-btn:hover {
  box-shadow: 0 12px 26px rgba(79, 70, 229, 0.3);
}
.supplier-search-row .supplier-search-btn:active {
  transform: translateY(0);
}
@media (max-width: 640px) {
  .supplier-search-row {
    --supplier-search-control-height: 40px;
    flex-wrap: wrap;
    max-width: none;
  }
  .supplier-search-row .inputGroup {
    flex: 1 1 100%;
    width: 100%;
  }
  .supplier-search-row .supplier-search-btn {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    min-height: var(--supplier-search-control-height);
    height: var(--supplier-search-control-height);
    margin: 0;
  }
}
.inputGroup.has-suggestions,
.supplier-search-group {
  position: relative;
  overflow: visible;
}
.inputGroup.has-suggestions .inline-suggestion,
.supplier-search-group .inline-suggestion {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 0.6em;
  color: #cbd5e1;
  font-size: 92%;
  font-family: inherit;
  pointer-events: none;
  white-space: pre;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity .12s ease;
  z-index: 0;
}
.inputGroup.has-suggestions .inline-suggestion.is-visible,
.supplier-search-group .inline-suggestion.is-visible {
  opacity: 1;
}
.inputGroup.has-suggestions .inline-suggestion__prefix,
.supplier-search-group .inline-suggestion__prefix {
  visibility: hidden;
}
.inputGroup.has-suggestions .inline-suggestion__rest,
.supplier-search-group .inline-suggestion__rest {
  color: #cbd5e1;
  padding-left: 2px;
}
.inputGroup.has-suggestions input,
.supplier-search-group input {
  position: relative;
  z-index: 1;
  background-color: transparent;
  height: var(--supplier-search-control-height);
  min-height: var(--supplier-search-control-height);
  box-sizing: border-box;
}
.inputGroup.has-suggestions label,
.supplier-search-group label {
  z-index: 2;
}
.suggestions-bar {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: none;
  padding: 6px 8px;
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(99, 102, 241, 0.04);
  max-height: 220px;
  overflow-y: auto;
  z-index: 20;
  text-align: left;
  backdrop-filter: blur(6px);
}
.suggestions-bar.is-open { display: grid; gap: 4px; }
.suggestions-bar__item {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  box-shadow: none;
  transform: none;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.suggestions-bar__item:hover,
.suggestions-bar__item.is-active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.16), rgba(99, 102, 241, 0.04));
  border-color: rgba(99, 102, 241, 0.28);
  box-shadow: inset 3px 0 0 rgba(99, 102, 241, 0.6);
}
.suggestions-bar__item:focus-visible {
  outline: 2px solid var(--brand-400);
  outline-offset: 1px;
}
.suggestions-bar__name {
  font-weight: 600;
  color: #0f172a;
}
.suggestions-bar__meta {
  margin-left: auto;
  font-size: 0.75rem;
  color: #4338ca;
  white-space: nowrap;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.suggestions-bar__meta:empty { display: none; }
.suggestions-bar__empty {
  padding: 8px 10px;
  color: var(--text-dim);
  font-size: 0.88rem;
}

/* Evidenzia duplicati (usata da JS) */
#order-requests-table tbody tr[style*="background-color: #ffcccc"] {
  background-color: #ffe2e2 !important;
}

/* Quantità negativa o alert visivo */
.badge-warning {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px;
  background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa;
}

/* =====================
   SUPPLIER MANAGEMENT
===================== */
#supplier-management p {
  margin: 4px 0 0;
  color: var(--text-dim);
}

.supplier-management__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.supplier-management__header-actions button {
  flex: none;
  min-width: 160px;
}

.supplier-management__form {
  margin: 16px 0 12px;
}

.supplier-management__form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.supplier-management__form-row input {
  flex: 1 1 240px;
}

.supplier-management__form-row button {
  flex: none;
  min-width: 160px;
}

#supplier-feedback {
  margin-top: 0;
}

.supplier-table-wrapper {
  overflow-x: auto;
}

#suppliers-table input[type="text"] {
  margin: 0;
}

#suppliers-table td:first-child {
  width: 100px;
  font-weight: 600;
}

#operators-table td:first-child {
  width: 80px;
  font-weight: 600;
}

#suppliers-table .actions-column {
  width: 200px;
  text-align: center;
}

#operators-table .actions-column {
  width: 260px;
  text-align: center;
}

#operators-table input,
#operators-table select {
  width: 100%;
  margin: 0;
}

.operator-status {
  font-weight: 600;
}

.operator-status--active {
  color: var(--success);
}

.operator-status--inactive {
  color: var(--danger);
}

#operators-table th:nth-child(4),
.operator-status-cell {
  text-align: center;
  vertical-align: middle;
}

.operator-status-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.checkbox-wrapper-44 input[type="checkbox"] {
  display: none;
  visibility: hidden;
}

.checkbox-wrapper-44 *,
.checkbox-wrapper-44 *::before,
.checkbox-wrapper-44 *::after {
  box-sizing: border-box;
}

.checkbox-wrapper-44 .toggleButton {
  cursor: pointer;
  display: block;
  margin: 0;
  transform-origin: 50% 50%;
  transform-style: preserve-3d;
  transition: transform 0.14s ease;
}

.checkbox-wrapper-44 .toggleButton:active {
  transform: rotateX(30deg);
}

.checkbox-wrapper-44 .toggleButton input + div {
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-radius: 50%;
  position: relative;
  width: 32px;
  height: 32px;
}

/* Stato operatori: rosso se disattivo, verde se attivo */
.operator-status-cell .toggleButton input + div {
  border-color: rgba(239, 68, 68, 0.55);
  background: #fee2e2;
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.18);
}

.operator-status-cell .toggleButton input + div svg {
  stroke: #b91c1c;
}

.operator-status-cell .toggleButton input + div:before,
.operator-status-cell .toggleButton input + div:after {
  background: #b91c1c;
}

.operator-status-cell .toggleButton input:checked + div {
  border-color: rgba(16, 185, 129, 0.6);
  background: #dcfce7;
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.2);
}

.operator-status-cell .toggleButton input:checked + div svg {
  stroke: #047857;
}

.operator-status-cell .toggleButton input:checked + div:before,
.operator-status-cell .toggleButton input:checked + div:after {
  background: #047857;
}

.checkbox-wrapper-44 .toggleButton input + div svg {
  fill: none;
  stroke-width: 2.6;
  stroke: #000;
  stroke-linecap: round;
  stroke-linejoin: round;
  width: 32px;
  height: 32px;
  display: block;
  position: absolute;
  left: -2px;
  top: -2px;
  right: -2px;
  bottom: -2px;
  z-index: 1;
  stroke-dashoffset: 124.6;
  stroke-dasharray: 0 162.6 133 29.6;
  transition: all 0.4s ease 0s;
}

.checkbox-wrapper-44 .toggleButton input + div:before,
.checkbox-wrapper-44 .toggleButton input + div:after {
  content: "";
  width: 2px;
  height: 12px;
  background: #000;
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 5px;
}

.checkbox-wrapper-44 .toggleButton input + div:before {
  opacity: 0;
  transform: scale(0.3) translate(-50%, -50%) rotate(45deg);
  -webkit-animation: bounceInBefore-44 0.3s linear forwards 0.3s;
  animation: bounceInBefore-44 0.3s linear forwards 0.3s;
}

.checkbox-wrapper-44 .toggleButton input + div:after {
  opacity: 0;
  transform: scale(0.3) translate(-50%, -50%) rotate(-45deg);
  -webkit-animation: bounceInAfter-44 0.3s linear forwards 0.3s;
  animation: bounceInAfter-44 0.3s linear forwards 0.3s;
}

.checkbox-wrapper-44 .toggleButton input:checked + div svg {
  stroke-dashoffset: 162.6;
  stroke-dasharray: 0 162.6 28 134.6;
  transition: all 0.4s ease 0.2s;
}

.checkbox-wrapper-44 .toggleButton input:checked + div:before {
  opacity: 0;
  transform: scale(0.3) translate(-50%, -50%) rotate(45deg);
  -webkit-animation: bounceInBeforeDont-44 0.3s linear forwards 0s;
  animation: bounceInBeforeDont-44 0.3s linear forwards 0s;
}

.checkbox-wrapper-44 .toggleButton input:checked + div:after {
  opacity: 0;
  transform: scale(0.3) translate(-50%, -50%) rotate(-45deg);
  -webkit-animation: bounceInAfterDont-44 0.3s linear forwards 0s;
  animation: bounceInAfterDont-44 0.3s linear forwards 0s;
}

@-webkit-keyframes bounceInBefore-44 {
  0% {
    opacity: 0;
    transform: scale(0.3) translate(-50%, -50%) rotate(45deg);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.1) translate(-50%, -50%) rotate(45deg);
  }
  80% {
    opacity: 1;
    transform: scale(0.89) translate(-50%, -50%) rotate(45deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) translate(-50%, -50%) rotate(45deg);
  }
}

@keyframes bounceInBefore-44 {
  0% {
    opacity: 0;
    transform: scale(0.3) translate(-50%, -50%) rotate(45deg);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.1) translate(-50%, -50%) rotate(45deg);
  }
  80% {
    opacity: 1;
    transform: scale(0.89) translate(-50%, -50%) rotate(45deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) translate(-50%, -50%) rotate(45deg);
  }
}

@-webkit-keyframes bounceInAfter-44 {
  0% {
    opacity: 0;
    transform: scale(0.3) translate(-50%, -50%) rotate(-45deg);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.1) translate(-50%, -50%) rotate(-45deg);
  }
  80% {
    opacity: 1;
    transform: scale(0.89) translate(-50%, -50%) rotate(-45deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) translate(-50%, -50%) rotate(-45deg);
  }
}

@keyframes bounceInAfter-44 {
  0% {
    opacity: 0;
    transform: scale(0.3) translate(-50%, -50%) rotate(-45deg);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.1) translate(-50%, -50%) rotate(-45deg);
  }
  80% {
    opacity: 1;
    transform: scale(0.89) translate(-50%, -50%) rotate(-45deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) translate(-50%, -50%) rotate(-45deg);
  }
}

@-webkit-keyframes bounceInBeforeDont-44 {
  0% {
    opacity: 1;
    transform: scale(1) translate(-50%, -50%) rotate(45deg);
  }
  100% {
    opacity: 0;
    transform: scale(0.3) translate(-50%, -50%) rotate(45deg);
  }
}

@keyframes bounceInBeforeDont-44 {
  0% {
    opacity: 1;
    transform: scale(1) translate(-50%, -50%) rotate(45deg);
  }
  100% {
    opacity: 0;
    transform: scale(0.3) translate(-50%, -50%) rotate(45deg);
  }
}

@-webkit-keyframes bounceInAfterDont-44 {
  0% {
    opacity: 1;
    transform: scale(1) translate(-50%, -50%) rotate(-45deg);
  }
  100% {
    opacity: 0;
    transform: scale(0.3) translate(-50%, -50%) rotate(-45deg);
  }
}

@keyframes bounceInAfterDont-44 {
  0% {
    opacity: 1;
    transform: scale(1) translate(-50%, -50%) rotate(-45deg);
  }
  100% {
    opacity: 0;
    transform: scale(0.3) translate(-50%, -50%) rotate(-45deg);
  }
}

.supplier-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  align-items: center;
}

.supplier-actions button {
  flex: 0 0 auto;
  border-radius: 10px;
  padding: 0;
}

.supplier-actions .mini-ghost {
  padding: 6px 14px 7px;
  min-height: 40px;
}

.supplier-placeholder td {
  text-align: center;
  font-style: italic;
  color: var(--text-dim);
}

@media (max-width: 640px) {
  .supplier-management__header-actions button,
  .supplier-management__form-row button {
    width: 100%;
  }

  #suppliers-table .actions-column {
    width: auto;
  }

  .supplier-actions {
    flex-direction: column;
  }
}

/* =====================
   MODAL
===================== */
.modal {
  display: none;
  position: fixed;
  z-index: 1200;
  inset: 0;
  padding: 24px;
  background-color: rgba(17,24,39,0.55); /* slate-900/55 */
  backdrop-filter: blur(2px);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--bg-card);
  margin: 0;
  padding: 20px;
  border: 1px solid var(--border);
  width: min(680px, 92%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
}

#product-details-modal {
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#product-details-modal .modal-content {
  width: min(720px, 94vw);
  margin: 0;
  max-height: 90vh;
  overflow-y: auto;
}

/* Inputs nel pop-up Dettagli Prodotto: mantieni bianco, ma riduci il bagliore */
#product-details-modal .inputGroup input,
#product-details-modal .inputGroup textarea {
  background-color: #fcfdff; /* quasi bianco, non grigio evidente */
  border-color: #dfe3ef;
}

#product-details-modal .inputGroup:focus-within label,
#product-details-modal .inputGroup.filled label {
  background-color: #fcfdff;
  box-shadow: 0 0 0 1px #fcfdff;
}

#product-details-modal .inputGroup :is(input:focus, textarea:focus) {
  box-shadow: none;
}

/* Allinea le dimensioni dei bottoni azione nel modale */
#product-details-modal .button-container .product-save-btn,
#product-details-modal .button-container .product-delete-btn {
  height: 50px;
  min-width: 150px;
}

@media (max-width: 640px) {
  #product-details-modal {
    padding: 12px;
  }

  #product-details-modal .modal-content {
    width: 100%;
    max-height: 92vh;
    padding: 16px;
  }
}

#supplier-management-modal {
  align-items: center;
  justify-content: center;
}

#supplier-management-modal .modal-content {
  margin: 0;
}

#operator-management-modal {
  align-items: center;
  justify-content: center;
}

#operator-management-modal .modal-content {
  margin: 0;
}

.confirm-modal {
  align-items: center;
  justify-content: center;
  z-index: 1400;
}

.confirm-modal .modal-content {
  width: min(420px, 92%);
  margin: 0;
}

#confirm-dialog.confirm-modal,
#prompt-dialog.confirm-modal {
  position: fixed;
  inset: 0;
  padding: 24px;
  background-color: rgba(17,24,39,0.55);
  backdrop-filter: blur(2px);
  border: none;
  border-radius: 0;
  box-shadow: none;
  width: auto;
  gap: 0;
}

#confirm-dialog #confirm-title,
#confirm-dialog #confirm-message {
  text-align: center;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

.confirm-actions button {
  width: auto;
  margin: 0;
}

.confirm-cancel {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.confirm-cancel:hover {
  background: var(--muted);
  box-shadow: none;
}

.supplier-print-modal .modal-content {
  width: min(720px, 94%);
  margin: 0;
}

.supplier-print-actions {
  justify-content: space-between;
  align-items: center;
}

.supplier-print-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.supplier-print-btn {
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease;
}

.supplier-print-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  border-color: var(--brand-200);
}

.supplier-print-btn.is-all {
  background: linear-gradient(135deg, var(--success), #059669);
  color: #fff;
  border-color: rgba(5,150,105,.25);
}

.supplier-print-note {
  margin: 10px 0 0;
  font-size: .85rem;
  color: var(--text-dim);
}

.prompt-input {
  width: 100%;
  margin-top: 12px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
}

.prompt-error {
  color: var(--danger);
  font-size: 12px;
  margin: 6px 0 0;
  min-height: 16px;
}

.modal-wide {
  width: min(820px, 95%);
  max-height: 90vh;
  overflow-y: auto;
}

.close {
  color: var(--danger);
  float: right;
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  border-radius: 10px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  background: transparent;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, transform .15s ease, box-shadow .2s ease;
}
.close:hover {
  color: #b91c1c;
  background: #fee2e2;
  border-color: rgba(239, 68, 68, 0.35);
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 8px 18px rgba(239, 68, 68, 0.18);
}
.close:active { transform: translateY(0); }
.close:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
  border-color: var(--brand-200);
}

body.has-modal-open {
  overflow: hidden;
}

.product-delete-btn {
  position: relative;
  width: 150px;
  height: 50px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 16px;
  background: #e62222;
  border: none;
  border-radius: 5px;
  box-shadow: 1px 1px 3px rgba(0,0,0,0.15);
  overflow: hidden;
}

.product-delete-btn,
.product-delete-btn span {
  transition: all 200ms ease;
}

.product-delete-btn .text {
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.2px;
  transform: translateX(0);
}

.product-delete-btn .icon {
  position: absolute;
  border-left: 1px solid #c41b1b;
  right: 10px;
  transform: translateX(0);
  height: 40px;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-delete-btn svg {
  width: 15px;
  height: 15px;
  fill: #eee;
}

.product-delete-btn:hover {
  background: #ff3636;
}

.product-delete-btn:hover .text {
  color: transparent;
  transform: translateX(-6px);
}

.product-delete-btn:hover .icon {
  width: 100%;
  height: 100%;
  left: 0;
  right: 0;
  border-left: none;
  transform: translateX(0);
  justify-content: center;
  align-items: center;
}

.product-delete-btn:focus {
  outline: none;
}

.product-delete-btn:active .icon svg {
  transform: scale(0.86);
}

.product-save-btn {
  position: relative;
  width: 150px;
  height: 50px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 16px;
  background: #16a34a;
  border: none;
  border-radius: 5px;
  box-shadow: 1px 1px 3px rgba(0,0,0,0.15);
  overflow: hidden;
}

.product-save-btn::before {
  content: none;
}

.product-save-btn,
.product-save-btn span {
  transition: all 200ms ease;
}

.product-save-btn .text {
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.2px;
  transform: translateX(0);
}

.product-save-btn .icon {
  position: absolute;
  border-left: 1px solid #12813b;
  right: 10px;
  transform: translateX(0);
  height: 40px;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-save-btn svg {
  width: 15px;
  height: 15px;
  fill: #e8ffe6;
}

.product-save-btn:hover {
  background: #22c55e;
}

.product-save-btn:hover .text {
  color: transparent;
  transform: translateX(-6px);
}

.product-save-btn:hover .icon {
  width: 100%;
  height: 100%;
  left: 0;
  right: 0;
  border-left: none;
  transform: translateX(0);
  justify-content: center;
  align-items: center;
}

.product-save-btn:focus {
  outline: none;
}

.product-save-btn:active .icon svg {
  transform: scale(0.86);
}

/* =====================
   UTILITIES
===================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.hidden { display: none !important; }
.center { display: grid; place-items: center; }
.content-narrow { max-width: 1100px; margin-inline: auto; }
#order-requests-container.content-narrow {
  margin-left: auto;
  margin-right: auto;
}

.field-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239,68,68,.2);
}

.inputGroup:focus-within :is(input.field-invalid, textarea.field-invalid),
.inputGroup.filled :is(input.field-invalid, textarea.field-invalid) {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239,68,68,.2);
}

/* Toast notifications (banner in basso a destra) */
.toast-stack {
  position: fixed;
  right: 18px;
  bottom: max(18px, env(safe-area-inset-bottom));
  display: grid;
  gap: 10px;
  width: min(360px, calc(100% - 24px));
  z-index: 2147483650; /* sopra il gate admin */
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: #0f172a;
  color: #f8fafc;
  padding: 14px 16px;
  border-radius: 12px;
  box-shadow: 0 14px 38px rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.08);
  font-weight: 600;
  letter-spacing: 0.01em;
  animation: toastIn 180ms ease-out;
}

.toast--info { background: linear-gradient(135deg, #0f172a, #111827); }
.toast--success { background: linear-gradient(135deg, #0f172a, #166534); }
.toast--error { background: linear-gradient(135deg, #0f172a, #991b1b); }

.toast--closing {
  animation: toastOut 160ms ease-in forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(6px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(6px) scale(.98); }
}

/* =====================
   PRINT STYLES
===================== */
@media print {
  @page {
    size: A4;
    margin: 12mm;
  }
  body { background: #fff; padding: 0; }
  .fixed-button, #logout-button, .top-left { display: none !important; }
  #order-requests-container { max-height: none; overflow: visible; }
  .order-requests-table-wrapper { max-height: none; overflow: visible; }
  /* Rimuovi ombre e colori intensi per la stampa */
  #main-container,
  #search-container,
  #load-container,
  #update-container,
  #add-container,
  #order-requests-container,
  #print-container,
  #inventory-container,
  #changes-container,
  #daily-changes-container,
  #order-container,
  #order-pdf-container,
  #product-details,
  #modify-product-container {
    box-shadow: none; border-color: #bbb;
  }

  #inventory-container,
  #changes-container {
    page-break-inside: avoid;
  }

  #inventory-table,
  #changes-result,
  #changes-by-date-name-result {
    margin: 8px 0 0;
    border: 1px solid #9ca3af;
  }

  #inventory-table th,
  #inventory-table td,
  #changes-result th,
  #changes-result td,
  #changes-by-date-name-result th,
  #changes-by-date-name-result td {
    padding: 6px 8px;
    border-color: #b6bcc6;
  }

  #inventory-table th,
  #changes-result th,
  #changes-by-date-name-result th {
    background: #e5e7eb !important;
    color: #111827;
    box-shadow: none !important;
    position: static;
  }

  #inventory-table thead,
  #changes-result thead,
  #changes-by-date-name-result thead {
    display: table-header-group;
  }

  #inventory-table tbody tr:nth-child(odd),
  #changes-result tbody tr:nth-child(odd),
  #changes-by-date-name-result tbody tr:nth-child(odd) {
    background: #f8fafc !important;
  }

  #inventory-table tbody tr:nth-child(even),
  #changes-result tbody tr:nth-child(even),
  #changes-by-date-name-result tbody tr:nth-child(even) {
    background: #ffffff !important;
  }

  #inventory-table tbody tr:hover,
  #changes-result tbody tr:hover,
  #changes-by-date-name-result tbody tr:hover {
    background: transparent !important;
  }

  #inventory-table tr,
  #changes-result tr,
  #changes-by-date-name-result tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  #inventory-table th:nth-child(3),
  #inventory-table td:nth-child(3),
  #changes-result th:nth-child(4),
  #changes-result td:nth-child(4),
  #changes-result th:nth-child(5),
  #changes-result td:nth-child(5),
  #changes-result th:nth-child(6),
  #changes-result td:nth-child(6),
  #changes-by-date-name-result th:nth-child(4),
  #changes-by-date-name-result td:nth-child(4),
  #changes-by-date-name-result th:nth-child(5),
  #changes-by-date-name-result td:nth-child(5),
  #changes-by-date-name-result th:nth-child(6),
  #changes-by-date-name-result td:nth-child(6) {
    text-align: right;
    font-variant-numeric: tabular-nums;
  }
}

/* Pulsante invio segnalazione */
.issue-modal .inputGroup {
  margin: 1em 0;
}

.issue-modal .inputGroup :is(input, textarea) {
  font-size: 100%;
  padding: 0.8em;
  outline: none;
  border: 2px solid rgb(200, 200, 200);
  text-align: left;
  color: var(--text);
  background-color: var(--bg);
  border-radius: 20px;
  width: 100%;
}

.issue-modal .inputGroup label {
  font-size: 100%;
  position: absolute;
  top: 0;
  right: auto;
  bottom: auto;
  left: 0;
  padding: 0.8em 0.2em 0.8em 0.8em;
  margin-left: 0.5em;
  width: auto;
  pointer-events: none;
  transition: all 0.3s ease;
  color: rgb(100, 100, 100);
}

.issue-modal .inputGroup:focus-within label,
.issue-modal .inputGroup.filled label {
  transform: translateY(-50%) scale(.9);
  margin: 0;
  margin-left: 1.3em;
  padding: 0.4em 0.15em 0.4em 0.4em;
  background-color: var(--bg);
  width: auto;
  box-shadow: none;
}

.issue-modal .inputGroup:focus-within :is(input, textarea),
.issue-modal .inputGroup.filled :is(input, textarea) {
  border-color: rgb(150, 150, 200);
}

.issue-modal .inputGroup textarea {
  min-height: 112px;
  line-height: 1.5;
  resize: vertical;
}

.issue-modal .issue-send-btn {
  font-family: inherit;
  font-size: 20px;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-500));
  color: #fff;
  padding: 0.7em 1em;
  padding-left: 0.9em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(99,102,241,.25);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.2s;
  cursor: pointer;
  margin: 12px auto 0;
}
.issue-send-btn__label {
  display: block;
  margin-left: 0.3em;
  transition: all 0.3s ease-in-out;
  white-space: nowrap;
}
.svg-wrapper-1 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.svg-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.issue-send-btn svg {
  display: block;
  transform-origin: center center;
  transition: transform 0.3s ease-in-out;
}
.issue-send-btn:hover .svg-wrapper {
  animation: issue-send-fly 0.6s ease-in-out infinite alternate;
}
.issue-send-btn:hover svg {
  transform: translateX(1.2em) rotate(45deg) scale(1.1);
}
.issue-send-btn:hover .issue-send-btn__label {
  transform: translateX(5em);
}
.issue-send-btn:active {
  transform: scale(0.95);
}
@keyframes issue-send-fly {
  from { transform: translateY(0.1em); }
  to { transform: translateY(-0.1em); }
}

@media (max-width: 720px) {
  .issue-modal .issue-send-btn { width: 100%; justify-content: center; }
}

/* =====================
   ACCESSIBILITÀ EXTRA
===================== */
:focus-visible { outline: 3px solid var(--accent-500); outline-offset: 2px; }

/* Riduci animazioni se l'utente preferisce meno movimento */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
