/* =========================================
   CORE FRAMEWORK - TRACCIAFOOD
   Tema Aurora Glassmorphism + Design System
   ========================================= */
:root {
  --bg-body: #0f172a;
  --bg-glass: rgba(255, 255, 255, 0.08);
  --color-primary: #10b981;
  --color-secondary: #3b82f6;
  --color-danger: #ef4444;
  --color-text: #f8fafc;
  --color-muted: #cbd5e1;
  --color-gray: #64748b;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  overflow-x: hidden;
  max-width: 100%;
}

body {
  background-color: var(--bg-body);
  background-image:
    radial-gradient(circle at 15% 50%, rgba(139, 92, 246, 0.15), transparent 40%),
    radial-gradient(circle at 85% 30%, rgba(59, 130, 246, 0.15), transparent 40%),
    radial-gradient(circle at 50% 80%, rgba(236, 72, 153, 0.1), transparent 40%);
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  min-height: 100vh;
  padding-bottom: 80px;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.auth-form { display: contents; }

.glass-panel {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

button, .btn, h1, h2, h3 {
  white-space: normal;
  overflow-wrap: break-word;
  word-wrap: break-word;
  line-height: 1.3;
}

/* =========================================================
   SCHERMATA LOGIN / REGISTRAZIONE (SFONDO CHIARO)
   ========================================================= */
.auth-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-box {
  background: #ffffff;
  color: #0f172a;
  padding: 36px 24px;
  border-radius: 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.logo { font-size: 56px; margin-bottom: 8px; }
.auth-box h1 { margin: 0; font-size: 26px; font-weight: 800; color: #0f172a; }
.sub { color: #475569; font-size: 14px; margin: 4px 0 22px; }

.auth-box label {
  display: block;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
  text-transform: uppercase;
}

#auth-screen input:not([type="hidden"]),
#auth-screen select {
  width: 100%;
  padding: 14px;
  margin-bottom: 12px;
  border: 1.5px solid #94a3b8;
  border-radius: 12px;
  font-size: 16px;
  background: #f1f5f9;
  color: #0f172a;
  font-family: inherit;
}

#auth-screen input:not([type="hidden"])::placeholder {
  color: #475569;
  opacity: 1;
}

#auth-screen input:not([type="hidden"]):focus,
#auth-screen select:focus {
  outline: none;
  background: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.biometric-login-wrap {
  margin-bottom: 12px;
}

.biometric-pass-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bio-pass-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.btn-biometric {
  flex: 1;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid #0f172a;
  background: #0f172a;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}

.bio-pass-remove {
  width: 44px;
  min-height: 48px;
  border-radius: 12px;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: #dc2626;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 8px;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #cbd5e1;
}

.btn-primary {
  width: 100%;
  padding: 14px 16px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  background: #2563eb;
  color: #ffffff;
  margin-bottom: 10px;
  min-height: 48px;
}

.btn-outline {
  width: 100%;
  padding: 13px 16px;
  border: 2px solid #3b82f6;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  background: transparent;
  color: #3b82f6;
  margin-bottom: 10px;
  min-height: 46px;
}

.btn-danger {
  width: 100%;
  padding: 14px 16px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  background: #ef4444;
  color: #ffffff;
  min-height: 46px;
}

.link {
  color: #2563eb;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  display: block;
  margin-top: 12px;
}

.link.link-admin {
  color: #b45309;
  font-weight: 700;
  margin-top: 18px;
}

.error {
  color: #dc2626;
  font-size: 13px;
  min-height: 18px;
  margin-bottom: 6px;
  font-weight: 600;
}

.auth-info {
  color: #059669;
  font-size: 13px;
  min-height: 18px;
  margin-bottom: 6px;
  font-weight: 600;
}

/* =========================================================
   HEADER APP & MENU TRE PUNTINI
   ========================================================= */
.app-header {
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  padding-top: calc(14px + env(safe-area-inset-top));
  border-radius: 0 0 22px 22px;
}

.header-left h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
}

.user-info-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 12px;
  color: #cbd5e1;
  flex-wrap: wrap;
}

#user-name { font-weight: 700; color: #60a5fa; }
.clock-small { font-size: 11px; color: #94a3b8; }

.status-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.status-pill.is-online {
  background: rgba(16, 185, 129, 0.22);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.status-pill.is-offline {
  background: rgba(245, 158, 11, 0.25);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.5);
}

.btn-sync {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.5);
  background: rgba(59, 130, 246, 0.25);
  color: #dbeafe;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.header-right {
  text-align: right;
  flex-shrink: 0;
}

.header-menu-wrap {
  position: relative;
}

.btn-menu-dots {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.header-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  padding: 8px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  z-index: 250;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.header-menu-item {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #f8fafc;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  min-height: 42px;
}

.header-menu-item.is-danger {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fecaca;
}

.btn-header-action {
  padding: 6px 11px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  min-height: 36px;
}

.btn-header-action.is-active {
  background: rgba(59, 130, 246, 0.35);
  border-color: rgba(96, 165, 250, 0.65);
}

/* =========================================================
   CONTENITORE, TILE GRID, RICERCA & MULTITASKING
   ========================================================= */
.container {
  padding: 16px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding-bottom: 100px;
}

.tile-grid {
  display: grid;
  gap: 14px;
  margin: 18px 0;
  padding: 6px;
}

.tile-grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 768px) {
  .tile-grid.cols-2 {
    grid-template-columns: repeat(2, 138px);
    justify-content: center;
  }
}

.tile {
  display: flex;
  justify-content: center;
  min-width: 0;
}

.tile-btn {
  width: 112px;
  height: 104px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  background-image: linear-gradient(145deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 4px 14px rgba(0, 0, 0, 0.25);
  color: #ffffff;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.tile-btn:active { transform: scale(0.95); }

.tile-btn-wide {
  width: 100%;
  height: auto;
  min-height: 54px;
  flex-direction: row;
  gap: 10px;
  padding: 12px 16px;
}

.add-product-wrap {
  margin: 12px 0;
}

.tile-btn.green,
.bg-green {
  background-color: rgba(16, 185, 129, 0.24);
  border-color: rgba(16, 185, 129, 0.45);
}

.tile-btn.blue,
.bg-blue {
  background-color: rgba(59, 130, 246, 0.24);
  border-color: rgba(59, 130, 246, 0.45);
}

.tile-btn.red,
.bg-red {
  background-color: rgba(244, 63, 94, 0.24);
  border-color: rgba(244, 63, 94, 0.45);
}

.tile-btn.orange,
.bg-orange {
  background-color: rgba(249, 115, 22, 0.34);
  background-image: linear-gradient(145deg, rgba(251, 146, 60, 0.46), rgba(234, 88, 12, 0.28));
  border-color: rgba(251, 146, 60, 0.8);
}

.home-asl-wrap {
  margin: 0 0 14px;
  padding: 0 6px;
}

.asl-header {
  border-bottom: 2px solid rgba(249, 115, 22, 0.75);
}

.asl-badge-readonly {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: rgba(249, 115, 22, 0.3);
  border: 1px solid rgba(251, 146, 60, 0.75);
  color: #ffedd5;
  margin-bottom: 4px;
}

.asl-header-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.asl-qr-box {
  text-align: center;
  background: #ffffff;
  padding: 16px;
  border-radius: 16px;
  margin: 0 auto 12px;
  width: fit-content;
  min-width: 220px;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.asl-qr-box canvas,
.asl-qr-box img {
  display: block;
  margin: 0 auto;
}

.asl-detail-body {
  max-height: 60vh;
  overflow-y: auto;
}

.tile-label {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
}

.tile-symbol {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  color: #ffffff;
}

.trash-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.trash-back-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.trash-back-arrow {
  color: #ffffff;
  font-size: 20px;
  line-height: 1;
}

.btn-empty-trash {
  padding: 10px 14px;
  border: 1px solid rgba(244, 63, 94, 0.5);
  border-radius: 12px;
  background: rgba(244, 63, 94, 0.22);
  color: #fecdd3;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* Multitasking Drafts */
.drafts-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 2px 12px;
  margin-bottom: 8px;
}

.draft-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 14px;
  border: 1px solid rgba(96, 165, 250, 0.45);
  background: rgba(59, 130, 246, 0.2);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.draft-chip.is-active {
  background: rgba(16, 185, 129, 0.28);
  border-color: rgba(16, 185, 129, 0.6);
}

.draft-chip-close {
  border: none;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.search {
  width: 100%;
  padding: 14px 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  margin-bottom: 12px;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.search::placeholder { color: rgba(255, 255, 255, 0.6); }
.search:focus { outline: none; border-color: #60a5fa; }

.qr-counter {
  font-size: 13px;
  font-weight: 700;
  color: #93c5fd;
  margin: 0 0 12px;
}

/* =========================================================
   CARD PRODOTTO (3 TASTI DIRETTI + NOTE INLINE + TRACCIABILITÀ)
   ========================================================= */
.card {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-left: 6px solid #10b981;
  border-radius: 20px;
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  color: #ffffff;
}

.card.is-pending-sync {
  border-left-color: #f59e0b;
}

.card h3 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: #ffffff;
}

.card p {
  margin: 4px 0;
  font-size: 13px;
  color: #cbd5e1;
  overflow-wrap: anywhere;
}

.card-note-box {
  margin: 8px 0;
  padding: 9px 12px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(96, 165, 250, 0.32);
  font-size: 13px;
  color: #eff6ff;
  overflow-wrap: anywhere;
}

.quick-note-box {
  margin: 10px 0 4px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(96, 165, 250, 0.4);
}

.quick-note-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  min-height: 68px;
  resize: vertical;
}

.quick-note-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.quick-note-actions button {
  flex: 1;
  min-height: 40px;
  border-radius: 10px;
  border: none;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.btn-quick-save {
  background: #10b981;
  color: #ffffff;
}

.btn-quick-cancel {
  background: rgba(255, 255, 255, 0.14);
  color: #f8fafc;
}

.card-trace {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 12px;
  color: #94a3b8;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.card-thumbs-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.card-thumb-btn {
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.6);
  overflow: hidden;
  width: 56px;
  height: 56px;
  cursor: pointer;
}

.card-thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.badge {
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  color: #f8fafc;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-cold {
  background: rgba(59, 130, 246, 0.3);
  color: #bfdbfe;
}

.badge-warn {
  background: rgba(245, 158, 11, 0.3);
  color: #fde68a;
}

.actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.actions.cols-2-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.actions button {
  min-width: 0;
  min-height: 44px;
  padding: 10px 6px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
}

/* =========================================================
   MODALI & FORM SCURI GLASSMORPHISM
   ========================================================= */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal.show { display: flex; }

.modal-box {
  background: rgba(15, 23, 42, 0.94);
  color: #f8fafc;
  width: 100%;
  max-width: 620px;
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 24px 24px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 20px;
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
  animation: slideUp 0.25s ease;
}

.modal-box-compact {
  max-width: 440px;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-handle {
  width: 40px;
  height: 5px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 10px;
  margin: 0 auto 16px;
}

.modal-box h2 {
  margin: 0 0 16px;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  color: #ffffff;
}

.modal-box label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #cbd5e1;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.modal-box input:not([type="checkbox"]):not([type="file"]),
.modal-box textarea,
.modal-box select {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-family: inherit;
}

.modal-box select option {
  background: #0f172a;
  color: #f8fafc;
}

.modal-box input::placeholder,
.modal-box textarea::placeholder {
  color: rgba(255, 255, 255, 0.55);
}

.modal-box input:focus,
.modal-box textarea:focus,
.modal-box select:focus {
  outline: none;
  border-color: #60a5fa;
  background: rgba(255, 255, 255, 0.14);
}

.modal-box input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

#note-text-main {
  min-height: 84px;
  resize: vertical;
}

.form-group { margin-bottom: 10px; }

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
  margin-bottom: 14px;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0;
  color: #f8fafc;
  font-size: 14px;
  text-transform: none;
  cursor: pointer;
}

.checkbox-field input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: #10b981;
}

.form-hint {
  color: #cbd5e1;
  font-size: 13px;
  margin: 0 0 12px;
}

.reuse-banner {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.14);
  margin-bottom: 14px;
}

.reuse-banner-text {
  font-size: 13px;
  color: #fde68a;
  margin: 0 0 10px;
  line-height: 1.4;
}

.ingredient-row {
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
}

.ingredient-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.ingredient-row-title {
  font-size: 12px;
  font-weight: 700;
  color: #93c5fd;
  text-transform: uppercase;
}

.ing-remove-btn {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(244, 63, 94, 0.45);
  background: rgba(244, 63, 94, 0.18);
  color: #fecdd3;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.ingredient-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap: 10px;
}

.ingredient-field input {
  margin-bottom: 0;
}

.ing-photo-bar {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.ing-photo-btn {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(96, 165, 250, 0.55);
  background: rgba(59, 130, 246, 0.25);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  min-height: 42px;
}

.ing-photo-count {
  font-size: 12px;
  color: #cbd5e1;
}

.ing-photos-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.ing-photo-item {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(15, 23, 42, 0.7);
}

.ing-photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
}

.ing-photo-del {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(220, 38, 38, 0.92);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.switch-tenant-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.switch-tenant-btn {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.switch-tenant-btn.is-current {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.22);
}

/* Fotocamera Zero-Trace */
.camera-stage {
  position: relative;
  width: 100%;
  background: #020617;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 12px;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#camera-video,
#camera-snapshot {
  width: 100%;
  max-height: 55vh;
  object-fit: cover;
  display: block;
}

#reader {
  width: 100%;
  min-height: 260px;
  border-radius: 16px;
  overflow: hidden;
  background: #020617;
  margin-bottom: 12px;
}

.scan-manual-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-top: 4px;
}

.scan-manual-row input {
  flex: 1;
  min-width: 0;
  margin-bottom: 0 !important;
}

.scan-manual-row button {
  width: auto;
  min-width: 116px;
  margin-bottom: 0;
}

#qr-box {
  text-align: center;
  background: #ffffff;
  padding: 16px;
  border-radius: 16px;
  margin: 0 auto 12px;
  width: fit-content;
}

#qr-box canvas,
#qr-box img {
  display: block;
  margin: 0 auto;
}

.qr-print-code {
  font-family: monospace;
  font-size: 13px;
  text-align: center;
  color: #cbd5e1;
  margin: 0 0 12px;
  overflow-wrap: anywhere;
}

.modal-btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.modal-btn-row button {
  flex: 1;
  min-width: 110px;
  margin-bottom: 0;
}

.modal-action { margin-top: 14px; }

.detail-section { margin: 14px 0; }
.detail-section p { color: #cbd5e1; font-size: 14px; }
.detail-section img {
  max-width: 100%;
  max-height: 60vh;
  border-radius: 12px;
}

.photo-viewer-stage {
  text-align: center;
}

/* Modale Ispezione & Audit */
.inspection-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.inspection-content {
  max-height: 50vh;
  overflow-y: auto;
  margin-bottom: 12px;
}

.inspection-card {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  margin-bottom: 10px;
}

.inspection-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
  color: #ffffff;
}

.inspection-card p {
  margin: 2px 0;
  font-size: 13px;
  color: #cbd5e1;
}

.audit-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.audit-entry {
  padding: 10px 12px;
  border-left: 3px solid #3b82f6;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 0 12px 12px 0;
  margin-bottom: 8px;
  font-size: 13px;
  color: #f8fafc;
}

.audit-meta {
  margin-top: 4px;
  color: #94a3b8;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.confirm-message {
  color: #e2e8f0;
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
  margin: 0 0 16px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: calc(18px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 420px);
  pointer-events: none;
}

.toast {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  text-align: center;
}

.toast.is-success { border-color: #10b981; background: rgba(6, 78, 59, 0.95); }
.toast.is-error { border-color: #ef4444; background: rgba(127, 29, 29, 0.95); }
.toast.is-warn { border-color: #f59e0b; background: rgba(120, 53, 15, 0.95); }

@media (min-width: 768px) {
  .modal { align-items: center; }
  .modal-box { border-radius: 24px; padding: 26px; }
}

@media print {
  body { background: #ffffff !important; color: #000000 !important; }
  #auth-screen, #app-screen, .toast-container, .no-print, button, #asl-search, .inspection-tabs, .home-asl-wrap { display: none !important; }
  .modal { position: static; display: none !important; background: #ffffff; }
  body:not(.printing-inspection):not(.printing-asl) #m-qr.show { display: block !important; }
  body.printing-inspection #m-inspection.show { display: block !important; }
  body.printing-asl #asl-screen { display: block !important; }
  body.printing-asl #asl-screen h1,
  body.printing-asl #asl-screen span { color: #000000 !important; }
  .modal-box {
    max-width: none;
    max-height: none;
    overflow: visible;
    background: #ffffff !important;
    color: #000000 !important;
    border: none;
    box-shadow: none;
  }
  .inspection-content { max-height: none; overflow: visible; }
  .inspection-card, .inspection-card h3, .inspection-card p, .audit-entry {
    color: #000000 !important;
    border-color: #cbd5e1 !important;
  }
}

.inspection-print-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inspection-print-hint {
  margin: 0;
  font-size: 12px;
  color: #93c5fd;
}

.inspection-print-buttons {
  display: flex;
  gap: 8px;
  width: 100%;
}

.inspection-print-buttons button {
  flex: 1;
}

.admin-badge-active { background: #d1fae5; color: #065f46; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; display: inline-block; }
.admin-badge-grace { background: #fef3c7; color: #b45309; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; display: inline-block; }
.admin-badge-expired { background: #fee2e2; color: #991b1b; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; display: inline-block; }
.azienda-dettagli { font-size: 13px; color: #475569; line-height: 1.5; margin-top: 8px; }

