:root {
  --header-h: 56px;
  --footer-h: 35px;
}

/* HEADER FISSO */
.pwa-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  z-index: 2000;
  background: #0066cc;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.pwa-header-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
}

.pwa-header-left,
.pwa-header-right {
  width: 40px;
  display: flex;
  align-items: center;
}

.pwa-btn-back,
.pwa-btn-logout {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pwa-btn-back svg,
.pwa-btn-logout svg {
  width: 24px;
  height: 24px;
  fill: #fff;
}

/* OFFSET HEADER */
.pwa-main {
  padding-top: var(--header-h);
  min-height: 100vh;
}

/* FOTOCAMERA */
.pwa-camera-preview {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}

.pwa-camera-preview video,
.pwa-camera-preview img {
  width: 100%;
  display: block;
}


/* FOOTER FISSO */
.pwa-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid #e0e0e0;
  font-size: 0.75rem;
  z-index: 2000;
}

.pwa-main {
  padding-bottom: 2.5rem;
}


/* FIX MODAL */
.modal.show {
  display: flex !important;
  align-items: flex-start;
  justify-content: center;
  padding: calc(var(--header-h) + 0.5rem) 1rem calc(var(--footer-h) + 0.5rem) 1rem !important;
}

.modal.show .modal-dialog.modal-dialog-centered {
  margin: 0;
  width: 100%;
  max-width: 500px;
}

.modal-content {
  max-height: calc(100dvh - var(--header-h) - var(--footer-h) - 1rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-body {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}


/* FILTRI e ORDINAMENTO */
.filtri-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.filtri-lbl {
  font-size: .7rem;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: #5c6f82;
  margin: 0;
}

.filtro-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 5px 2px;
  min-height: 44px;
  font-size: .75rem;
  line-height: 1.2;
}

.filtro-btn.filtro-attivo,
.filtro-btn.filtro-attivo:hover {
  background: color-mix(in srgb, var(--bs-primary) 12%, #fff);
  border-color: var(--bs-primary);
  color: var(--bs-primary);
  box-shadow: inset 0 0 0 1px var(--bs-primary);
}

#filtriToggle .filtri-chevron {
  transition: transform .2s;
}

#filtriToggle[aria-expanded="true"] .filtri-chevron {
  transform: rotate(180deg);
}

#btnOrdineDir.ordine-desc svg { transform: rotate(180deg); }