/* =============================================
   GIAMS — Dark Theme Verde Oliva
   Green Integrated Agricultural Management System
   ============================================= */

:root {
  --bg-main: #0a0f0a;
  --bg-sidebar: #000000;
  --bg-card: #111a11;
  --bg-card-hover: #1a2a1a;
  --accent: #4d7c0f;
  --accent-hover: #65a30d;
  --accent-light: #86efac;
  --text-primary: #f0fdf4;
  --text-secondary: #86efac;
  --text-muted: #8aab8a;
  --border-color: rgba(77, 124, 15, 0.2);
  --border-light: rgba(77, 124, 15, 0.1);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  /* Elevazione (shadow system) */
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 12px 36px rgba(0, 0, 0, 0.6);
  /* Transizioni standard */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
}

/* ---- Links ---- */
a { color: var(--accent-light); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-hover); }
/* Firefox */
html { scrollbar-color: var(--accent) var(--bg-main); scrollbar-width: thin; }

/* =============================================
   LOGIN PAGE
   ============================================= */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #050a05 0%, #0a1a0a 50%, #0f1f0f 100%);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.login-logo {
  text-align: center;
  margin-bottom: 0.5rem;
}

.login-logo-img {
  width: 140px;
  height: auto;
  margin-bottom: 0.5rem;
}

.login-logo-title {
  font-size: 1.8rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.08em;
}

.login-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 2rem;
}

.login-form-group {
  margin-bottom: 1.2rem;
}

.login-form-group label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.login-form-group input {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.login-form-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(77, 124, 15, 0.15);
}

.login-btn {
  width: 100%;
  padding: 0.7rem;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: white;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.login-btn:hover { opacity: 0.9; }
.login-btn:active { transform: scale(0.98); }

.login-error {
  color: #ef4444;
  text-align: center;
  font-size: 0.85rem;
  margin-top: 1rem;
}

.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

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

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
.shake { animation: shake 0.4s ease-in-out; }

/* =============================================
   APP SHELL
   ============================================= */
.app-shell { min-height: 100vh; }

#app-sidebar {
  width: 260px;
  min-width: 260px;
  border-right: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  transition: width 0.3s ease, min-width 0.3s ease;
  z-index: 1040;
}

/* Header e footer sidebar non si restringono */
#app-sidebar > .sidebar-header,
#app-sidebar > .mt-auto {
  flex-shrink: 0;
}

/* Sidebar collapsed — nascosta completamente */
.sidebar-collapsed #app-sidebar {
  margin-left: -260px;
}

#main-content {
  min-height: 0;
}

/* ---- Main Wrapper ---- */
.main-wrapper {
  min-height: 100vh;
  background: var(--bg-main);
}

/* ---- Content Topbar ---- */
.content-topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 1rem 0.25rem 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1030;
  min-height: 36px;
}
.topbar-text {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  min-width: 0;
}
.topbar-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #d4a843;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.topbar-subtitle {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Separatore visivo tra titolo e sottotitolo */
.topbar-subtitle:not(:empty)::before {
  content: "\00b7";
  margin-right: 0.75rem;
  color: var(--border-color);
  font-size: 1.1rem;
  font-weight: 700;
}
/* Azioni topbar (bottoni a destra) */
.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}
.topbar-actions .btn {
  font-size: 0.8rem;
  padding: 0.3rem 0.65rem;
}

/* ---- Breadcrumb ---- */
.breadcrumb-bar {
  padding: 0.35rem 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-light);
}
.breadcrumb-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0;
  font-size: 0.78rem;
  flex-wrap: wrap;
}
.breadcrumb-list li {
  display: flex;
  align-items: center;
  color: var(--text-muted);
}
.breadcrumb-list li:not(:last-child)::after {
  content: "\203A";
  margin: 0 0.5rem;
  color: var(--border-color);
  font-size: 1rem;
}
.breadcrumb-list li a {
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s;
}
.breadcrumb-list li a:hover {
  color: var(--accent-light);
}
.breadcrumb-list li:last-child {
  color: var(--accent-light);
  font-weight: 600;
}

/* ---- Sidebar Toggle (hamburger animato, nella topbar) ---- */
.sidebar-toggle {
  width: 38px;
  height: 100%;
  min-height: 36px;
  border: none;
  border-right: 1px solid var(--border-color);
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 0.5rem;
  transition: background 0.2s;
}
.sidebar-toggle:hover {
  background: var(--accent);
}
.sidebar-toggle:hover .hamburger-line {
  background: #fff;
}

/* Hamburger 3 lines */
.hamburger-box {
  width: 20px;
  height: 16px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.hamburger-line {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform-origin: center;
}

/* Stato attivo (sidebar aperta): hamburger → X */
.sidebar-toggle.is-active .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.sidebar-toggle.is-active .hamburger-line:nth-child(2) {
  opacity: 0;
}
.sidebar-toggle.is-active .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---- Sidebar Backdrop (mobile only) ---- */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1035;
}

/* ---- Mobile: sidebar overlay ---- */
@media (max-width: 767px) {
  #app-sidebar {
    position: fixed;
    top: 0;
    left: -260px;
    width: 260px !important;
    min-width: 260px !important;
    height: 100vh;
    transition: left 0.3s ease;
  }
  .sidebar-open #app-sidebar {
    left: 0;
  }
  .sidebar-open .sidebar-backdrop {
    display: block;
  }
}

/* ---- Sidebar ---- */
.sidebar-logo-img {
  width: 90px;
  height: auto;
  margin-bottom: 0.5rem;
}

.sidebar-app-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-light);
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.app-version {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 4px;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.sidebar-link {
  border: none;
  background: transparent !important;
  color: rgba(197, 206, 219, 0.75) !important;
  font-size: 0.88rem;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  transition: all 0.25s ease;
}

.sidebar-link i {
  transition: color 0.25s ease, transform 0.25s ease;
  opacity: 0.7;
}

.sidebar-link:hover:not(.disabled) {
  background: transparent !important;
  color: var(--accent-light) !important;
}

.sidebar-link:hover:not(.disabled) i {
  color: var(--accent-light);
  opacity: 1;
  transform: scale(1.1);
}

.sidebar-link.active {
  background: linear-gradient(135deg, rgba(77, 124, 15, 0.22), rgba(101, 163, 13, 0.10)) !important;
  color: var(--accent-light) !important;
  border-left: 3px solid var(--accent);
}

.sidebar-link.active i {
  color: var(--accent-light) !important;
  opacity: 1;
}

.sidebar-link.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ---- Sidebar gruppi accordion ---- */
.sidebar-nav {
  gap: 3px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  padding-right: 4px;
  flex-wrap: nowrap !important;
}

/* Scrollbar personalizzata sidebar */
.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}
.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(77, 124, 15, 0.3);
  border-radius: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(77, 124, 15, 0.5);
}

.sidebar-group {
  border-radius: var(--radius-lg);
  margin-top: 4px;
  border-left: 3px solid transparent;
  transition: background 0.3s ease, border-color 0.3s ease;
}

/* Separatore sottile tra gruppi */
.sidebar-group + .sidebar-group {
  border-top: 1px solid rgba(197, 206, 219, 0.06);
}

.sidebar-group-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: none;
  background: transparent;
  color: rgba(197, 206, 219, 0.7);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s ease;
  border-radius: 8px;
}

.sidebar-group-toggle:hover {
  background: rgba(77, 124, 15, 0.12);
  color: var(--accent-light);
}

.sidebar-group.open > .sidebar-group-toggle {
  color: var(--accent-light);
  background: transparent;
}

.sidebar-group-icon {
  width: 24px;
  text-align: center;
  margin-right: 9px;
  font-size: 0.92rem;
  opacity: 0.65;
  transition: opacity 0.25s ease, transform 0.25s ease, color 0.25s ease;
}

.sidebar-group-toggle:hover .sidebar-group-icon {
  opacity: 1;
  transform: scale(1.12);
}

.sidebar-group.open > .sidebar-group-toggle .sidebar-group-icon {
  opacity: 1;
  color: var(--accent-light);
}

.sidebar-group-label {
  flex: 1;
  text-align: left;
}

.sidebar-chevron {
  font-size: 0.6rem;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0.4;
}

.sidebar-group-toggle:hover .sidebar-chevron {
  opacity: 0.7;
}

.sidebar-group.open > .sidebar-group-toggle .sidebar-chevron {
  transform: rotate(180deg);
  opacity: 0.9;
}

.sidebar-group-items {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-group.open > .sidebar-group-items {
  max-height: 300px;
}

.sidebar-subitem {
  position: relative;
  padding-left: 2.2rem !important;
  font-size: 0.88rem !important;
  padding-top: 0.45rem !important;
  padding-bottom: 0.45rem !important;
  border-radius: 6px !important;
  opacity: 0;
  transform: translateX(-6px);
  animation: none;
}

/* Animazione fade-in slide delle sotto-voci */
.sidebar-group.open > .sidebar-group-items .sidebar-subitem {
  animation: sidebarItemIn 0.3s ease forwards;
}
.sidebar-group.open > .sidebar-group-items .sidebar-subitem:nth-child(1) { animation-delay: 0.04s; }
.sidebar-group.open > .sidebar-group-items .sidebar-subitem:nth-child(2) { animation-delay: 0.08s; }
.sidebar-group.open > .sidebar-group-items .sidebar-subitem:nth-child(3) { animation-delay: 0.12s; }
.sidebar-group.open > .sidebar-group-items .sidebar-subitem:nth-child(4) { animation-delay: 0.16s; }

@keyframes sidebarItemIn {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.sidebar-subitem::before {
  content: "";
  position: absolute;
  left: 1.15rem;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(197, 206, 219, 0.15);
  transform: translateY(-50%);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-subitem:hover::before {
  background: var(--accent);
}

.sidebar-subitem.active::before {
  background: var(--accent-light);
  box-shadow: 0 0 6px rgba(101, 163, 13, 0.5);
}

/* Glow verde sulla sotto-voce attiva */
.sidebar-subitem.active {
  text-shadow: 0 0 8px rgba(101, 163, 13, 0.15);
}

/* Indicatore laterale verde sul gruppo attivo */
.sidebar-group.has-active {
  border-left-color: var(--accent);
  background: linear-gradient(135deg, rgba(77, 124, 15, 0.08), rgba(34, 87, 46, 0.04));
}

.sidebar-group.has-active > .sidebar-group-toggle {
  color: var(--accent-light);
}

/* =============================================
   CARDS & COMPONENTS
   ============================================= */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
}
/* Card affiancate in colonne Bootstrap — altezza uguale */
.row > [class*="col"] > .card {
  height: 100%;
}

.card-section-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-light);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-light);
}

/* Variante glass per barre filtro */
.card.bg-glass {
  background: rgba(17, 26, 17, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-color: var(--border-light);
}

/* ---- Module Header ---- */
.module-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.module-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
}

.module-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ---- Stat Cards ---- */
/* L. Animazione fade-in dal basso al caricamento */
@keyframes statCardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
/* Riga stat cards — altezza uniforme */
.row > [class*="col"] > .stat-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: statCardIn 0.4s ease-out both;
}
.row > [class*="col"]:nth-child(1) > .stat-card { animation-delay: 0s; }
.row > [class*="col"]:nth-child(2) > .stat-card { animation-delay: 0.05s; }
.row > [class*="col"]:nth-child(3) > .stat-card { animation-delay: 0.1s; }
.row > [class*="col"]:nth-child(4) > .stat-card { animation-delay: 0.15s; }
.row > [class*="col"]:nth-child(5) > .stat-card { animation-delay: 0.2s; }
.row > [class*="col"]:nth-child(6) > .stat-card { animation-delay: 0.25s; }
.row > [class*="col"]:nth-child(7) > .stat-card { animation-delay: 0.3s; }

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  text-align: center;
}

/* Variante 3D */
.stat-card.stat-card-3d {
  background: linear-gradient(160deg, #1e3320 0%, #0c140c 100%);
  border: 1px solid rgba(77, 124, 15, 0.35);
  border-top: 2px solid rgba(134, 239, 172, 0.25);
  border-left: 1px solid rgba(134, 239, 172, 0.12);
  border-bottom: 1px solid rgba(0, 0, 0, 0.6);
  border-right: 1px solid rgba(0, 0, 0, 0.4);
  box-shadow:
    6px 6px 18px rgba(0, 0, 0, 0.8),
    -2px -2px 8px rgba(77, 124, 15, 0.07),
    inset 0 2px 3px rgba(134, 239, 172, 0.12),
    inset 0 -2px 4px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  padding: 0.5rem 0.5rem;
}
.stat-card.stat-card-3d:hover {
  transform: translateY(-4px);
  box-shadow:
    10px 10px 25px rgba(0, 0, 0, 0.9),
    -3px -3px 12px rgba(77, 124, 15, 0.1),
    0 0 15px rgba(77, 124, 15, 0.15),
    inset 0 2px 3px rgba(134, 239, 172, 0.2),
    inset 0 -2px 4px rgba(0, 0, 0, 0.4);
  border-top-color: rgba(134, 239, 172, 0.4);
}
.stat-card.stat-card-3d:hover .stat-icon,
.stat-card.stat-card-glass:hover .stat-icon {
  color: #a3e635;
  transform: scale(1.15);
}

/* ========== Variante Glass — Vetro premium con 3D ========== */
.stat-card.stat-card-glass {
  --light-x: 50%;
  --light-y: 30%;
  position: relative;
  overflow: hidden;
  /* Vetro con luce dinamica sottile che segue il cursore */
  background:
    radial-gradient(
      ellipse 280px 180px at var(--light-x) var(--light-y),
      rgba(134, 239, 172, 0.18) 0%,
      transparent 70%
    ),
    linear-gradient(145deg,
      rgba(40, 70, 40, 0.48) 0%,
      rgba(15, 25, 15, 0.2) 35%,
      rgba(25, 50, 28, 0.32) 65%,
      rgba(10, 18, 10, 0.42) 100%
    );
  backdrop-filter: blur(26px) saturate(1.85) brightness(1.1);
  -webkit-backdrop-filter: blur(26px) saturate(1.85) brightness(1.1);
  /* Bordi luce/ombra per effetto 3D */
  border: 1px solid rgba(134, 239, 172, 0.18);
  border-top: 1px solid rgba(180, 255, 200, 0.38);
  border-left: 1px solid rgba(134, 239, 172, 0.22);
  border-bottom: 1px solid rgba(0, 0, 0, 0.5);
  border-right: 1px solid rgba(0, 0, 0, 0.38);
  /* Shadow multi-livello con glow verde sottile */
  box-shadow:
    0 10px 36px rgba(0, 0, 0, 0.5),
    0 3px 10px rgba(0, 0, 0, 0.35),
    0 1px 3px rgba(0, 0, 0, 0.25),
    0 6px 24px rgba(34, 197, 94, 0.08),
    inset 0 1px 1px rgba(180, 255, 200, 0.15),
    inset 0 -2px 6px rgba(0, 0, 0, 0.15);
  /* 3D perspective */
  transform-style: preserve-3d;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              border-color 0.3s ease;
  padding: 0.6rem 0.5rem;
  will-change: transform;
}
/* Elementi interni — transizioni fluide per parallax JS */
.stat-card.stat-card-glass .stat-icon,
.stat-card.stat-card-glass .stat-value,
.stat-card.stat-card-glass .stat-label {
  position: relative;
  z-index: 3;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
/* Riflesso luce dall'alto */
.stat-card.stat-card-glass::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(
    175deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(180, 255, 200, 0.04) 25%,
    transparent 55%
  );
  pointer-events: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: 1;
}
/* Shimmer — striscia di luce */
.stat-card.stat-card-glass::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -100%;
  width: 55%;
  height: 200%;
  background: linear-gradient(
    105deg,
    transparent 35%,
    rgba(255, 255, 255, 0.04) 40%,
    rgba(255, 255, 255, 0.12) 50%,
    rgba(255, 255, 255, 0.04) 60%,
    transparent 65%
  );
  transition: left 0.75s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  z-index: 2;
}
.stat-card.stat-card-glass:hover::after {
  left: 150%;
}
/* Hover — glow moderato + shadow espansa */
.stat-card.stat-card-glass:hover {
  border-top-color: rgba(180, 255, 200, 0.5);
  border-left-color: rgba(134, 239, 172, 0.3);
  box-shadow:
    0 18px 56px rgba(0, 0, 0, 0.55),
    0 6px 18px rgba(0, 0, 0, 0.35),
    0 2px 6px rgba(0, 0, 0, 0.25),
    0 0 35px rgba(34, 197, 94, 0.15),
    0 20px 45px -10px rgba(34, 197, 94, 0.12),
    inset 0 1px 2px rgba(180, 255, 200, 0.2),
    inset 0 -2px 6px rgba(0, 0, 0, 0.15);
}
/* Active — pressione */
.stat-card.stat-card-glass:active {
  transform: translateY(-1px) scale(0.98) rotateX(0deg) !important;
  transition-duration: 0.1s;
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.45),
    0 1px 4px rgba(0, 0, 0, 0.3),
    inset 0 2px 4px rgba(0, 0, 0, 0.2),
    inset 0 -1px 0 rgba(180, 255, 200, 0.1);
}

/* I. Text-shadow per profondita' 3D + K. Tabular nums allineamento cifre */
.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent-light);
  text-shadow: 0 1px 8px rgba(134, 239, 172, 0.15);
  font-variant-numeric: tabular-nums;
}

.stat-value.stat-value-sm {
  font-size: 1.1rem;
}

.costo-doc-viewer {
  width: 100%;
  height: 500px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: #1a1a1a;
}

/* H. Separatore visivo + sotto-valore compatto */
.stat-sub {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 1px;
  padding-top: 3px;
  line-height: 1.2;
  border-top: 1px solid rgba(77, 124, 15, 0.2);
  display: inline-block;
}

/* J. Label con transizione hover */
.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color var(--transition-fast);
}
.stat-card:hover .stat-label {
  color: var(--text-primary);
}


/* A. Icona identificativa sopra il valore */
.stat-icon {
  font-size: 0.95rem;
  color: var(--accent-light);
  margin-bottom: 0.15rem;
  transition: color var(--transition-fast), transform var(--transition-fast);
}

/* B. Bordo laterale condizionale margine positivo/negativo */
.stat-card-positive {
  border-left: 3px solid #4ade80;
}
.stat-card-negative {
  border-left: 3px solid #f87171;
}
/* R. Bordo superiore colorato per tipo card */
.stat-card-accent-green { border-top: 2px solid #4ade80; }
.stat-card-accent-amber { border-top: 2px solid #fbbf24; }
.stat-card-accent-blue  { border-top: 2px solid #60a5fa; }
.stat-card-accent-red   { border-top: 2px solid #f87171;
}

/* ---- Buttons ---- */
.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  border: none;
  color: white;
  font-weight: 600;
  border-radius: 8px;
  padding: 0.45rem 1rem;
  font-size: 0.88rem;
}

.btn-accent:hover {
  opacity: 0.9;
  color: white;
}
.btn-accent:disabled, .btn-accent.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-accent:focus-visible,
.btn-outline-secondary:focus-visible,
.btn-outline-danger:focus-visible {
  outline: 2px solid var(--accent-light);
  outline-offset: 2px;
}

.btn-outline-secondary {
  border-color: rgba(255, 255, 255, 0.2);
  color: #c5cedb;
}

.btn-outline-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

/* ---- Forms ---- */
.form-control, .form-select {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 8px;
}

.form-control::placeholder {
  color: #999;
  opacity: 1;
}

.form-control:focus, .form-select:focus {
  background: rgba(0, 0, 0, 0.4);
  border-color: var(--accent);
  color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(77, 124, 15, 0.15);
}
.form-control.is-invalid, .form-select.is-invalid {
  border-color: #f87171;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15);
}
.form-control.is-valid, .form-select.is-valid {
  border-color: #4ade80;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.15);
}
.invalid-feedback { color: #fca5a5; font-size: 0.82rem; }
.valid-feedback { color: #86efac; font-size: 0.82rem; }

.form-label {
  font-size: 0.88rem;
  color: #a8c8a8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
  font-weight: 500;
}

.form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

/* ---- Form check/radio dark theme ---- */
.form-check-input {
  background-color: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
}
.form-check-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(77, 124, 15, 0.15);
}
.form-check-label {
  color: var(--text-primary);
}

/* ---- Input group dark theme ---- */
.input-group-text {
  background: rgba(77, 124, 15, 0.1);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

/* ---- Nav tabs dark theme generico ---- */
.nav-tabs {
  border-bottom-color: var(--border-color);
}
.nav-tabs .nav-link {
  color: var(--text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.nav-tabs .nav-link:hover {
  color: var(--text-primary);
  border-bottom-color: rgba(77, 124, 15, 0.3);
}
.nav-tabs .nav-link.active {
  background: transparent;
  color: var(--accent-light);
  border-color: transparent;
  border-bottom: 2px solid var(--accent-hover);
}

/* ---- Modal miglioramenti ---- */
.modal-dark .modal-title {
  color: var(--text-primary);
  font-weight: 600;
}
.modal-dark .btn-close-white {
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}
.modal-dark .btn-close-white:hover {
  opacity: 1;
}
.modal-dark .form-label {
  color: var(--text-muted);
}

/* ---- Tables ---- */
.table-responsive {
  border: 1px solid rgba(77, 124, 15, 0.3);
  border-top: 2px solid rgba(134, 239, 172, 0.2);
  border-bottom: 1px solid rgba(0, 0, 0, 0.5);
  border-radius: 12px;
  box-shadow:
    6px 6px 18px rgba(0, 0, 0, 0.7),
    -2px -2px 8px rgba(77, 124, 15, 0.05);
  overflow: hidden;
}

.table-dark {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text-primary);
  --bs-table-border-color: var(--border-light);
  --bs-table-hover-bg: rgba(77, 124, 15, 0.08);
  --bs-table-hover-color: var(--text-primary);
  margin-bottom: 0;
}

.table-dark thead th {
  background: rgba(0, 0, 0, 0.3);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  padding: 0.7rem 0.75rem;
}

.table-dark tbody td {
  padding: 0.6rem 0.75rem;
  font-size: 0.88rem;
  vertical-align: middle;
}

.table-dark tbody tr:nth-child(odd) {
  background: rgba(0, 0, 0, 0.2);
}

.table-dark tbody tr:nth-child(even) {
  background: rgba(77, 124, 15, 0.08);
}

.table-dark tbody tr:hover {
  background: rgba(77, 124, 15, 0.1) !important;
}

/* ---- Badges ---- */
.badge-stato-produttivo {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-stato-giovane {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-stato-riposo {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fde68a;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-stato-dismesso {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ---- Badges Lotto ---- */
.badge-stato-disponibile {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-stato-in_vendita {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-stato-esaurito {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ---- Produzione Tabs ---- */
.produzione-tabs {
  border-bottom: 1px solid var(--border-color);
}

.produzione-tabs .nav-link {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}

.produzione-tabs .nav-link:hover {
  color: var(--text-primary);
}

.produzione-tabs .nav-link.active {
  color: var(--accent-hover);
  border-bottom: 2px solid var(--accent-hover);
}

/* ---- Raccolta Parcelle Selezione ---- */
.raccolta-parcella-row {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-light);
}

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

/* ---- Badge Contenitore Confezionamento ---- */
.badge-contenitore {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #c4b5fd;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ---- Contenitori Card Grid ---- */
.ct-card {
  border: 1px solid var(--border-light);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s;
  display: flex;
  flex-direction: row;
  background: var(--bg-card);
}

.ct-card:hover {
  border-color: var(--accent);
}

.ct-card-inattivo {
  opacity: 0.55;
}

.ct-card-body {
  flex: 1;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.ct-card-img-wrap {
  width: 120px;
  min-height: 120px;
  background: rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ct-card-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}

.ct-card-placeholder {
  color: var(--text-muted);
  text-align: center;
}

.ct-card-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}

.ct-card-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.ct-card-cap {
  font-size: 0.9rem;
  color: var(--accent-light);
  font-weight: 600;
}

.ct-card-code {
  font-size: 0.75rem;
}

.ct-card-actions {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

@media (max-width: 575px) {
  .ct-card { flex-direction: column; }
  .ct-card-img-wrap { width: 100%; min-height: 140px; }
}

/* ---- Contenitore Form Foto Preview ---- */
.ct-foto-preview-box {
  width: 180px;
  height: 180px;
  border: 2px dashed var(--border-light);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  overflow: hidden;
  background: var(--bg-card);
}

.ct-foto-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-lg);
}

/* ---- Badge Tipo Cliente ---- */
.badge-tipo-privato {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-tipo-azienda {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #c4b5fd;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ---- Conf Lotto Selezione ---- */
.conf-lotto-row {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-light);
}

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

/* ---- Badge Resa ---- */
.badge-resa {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fde68a;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ---- Btn outline accent ---- */
.btn-outline-accent {
  border: 1px solid var(--accent);
  color: var(--accent-light);
  background: transparent;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
}

.btn-outline-accent:hover {
  background: var(--accent);
  color: white;
}

/* =============================================
   HOME PAGE
   ============================================= */
/* ---- HOME PAGE ---- */
/* ---- HOME PAGE ---- */
.home-page { padding: 0.6rem 1.5rem 2rem; position: relative; }

/* Animazione generica fade-up */
.home-fade-up {
  opacity: 0;
  animation: homeFadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes homeFadeUp {
  0% { opacity: 0; transform: translateY(16px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Meteo in alto a destra — absolute per non influire sul centraggio */
.home-meteo-corner {
  position: absolute;
  top: 0.6rem;
  right: 1.5rem;
  z-index: 2;
}
@media (max-width: 768px) {
  .home-meteo-corner {
    position: static;
    display: flex;
    justify-content: center;
    margin: 0 0 1rem 0;
  }
}

/* Hero centrato rispetto alle cards */
.home-hero-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 0.8rem;
  margin-bottom: 2rem;
}

/* Titolo G.I.A.M.S. — effetto 3D / glow */
.home-hero-title {
  font-size: 3.2rem;
  font-weight: 900;
  line-height: 1;
  margin: 0 0 0.5rem 0;
  display: inline-flex;
  align-items: baseline;
  perspective: 600px;
  justify-content: center;
}
.hero-letter {
  display: inline-block;
  background: linear-gradient(180deg, #f0ffe0 0%, #a3e635 35%, var(--accent-light) 70%, #65a30d 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 2px 6px rgba(134, 239, 172, 0.4)) drop-shadow(0 0 20px rgba(77, 124, 15, 0.25));
  transform: translateZ(0);
  animation: heroLetterIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.hero-letter:nth-child(1) { animation-delay: 0s; }
.hero-letter:nth-child(3) { animation-delay: 0.07s; }
.hero-letter:nth-child(5) { animation-delay: 0.14s; }
.hero-letter:nth-child(7) { animation-delay: 0.21s; }
.hero-letter:nth-child(9) { animation-delay: 0.28s; }
@keyframes heroLetterIn {
  0% {
    opacity: 0;
    transform: translateY(-20px) rotateX(40deg) scale(0.8);
    filter: drop-shadow(0 0 0 transparent);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotateX(0) scale(1);
    filter: drop-shadow(0 2px 6px rgba(134, 239, 172, 0.4)) drop-shadow(0 0 20px rgba(77, 124, 15, 0.25));
  }
}
.hero-dot {
  display: inline-block;
  background: linear-gradient(180deg, var(--accent-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 2.4rem;
  font-weight: 900;
  margin: 0 0.04em;
  opacity: 0;
  animation: heroDotIn 0.4s ease-out forwards;
}
.hero-dot:nth-child(2) { animation-delay: 0.35s; }
.hero-dot:nth-child(4) { animation-delay: 0.42s; }
.hero-dot:nth-child(6) { animation-delay: 0.49s; }
.hero-dot:nth-child(8) { animation-delay: 0.56s; }
.hero-dot:nth-child(10) { animation-delay: 0.63s; }
@keyframes heroDotIn {
  0% { opacity: 0; transform: scale(0); }
  60% { opacity: 1; transform: scale(1.4); }
  100% { opacity: 0.7; transform: scale(1); }
}

/* Sottotitolo — gradient verde multi-tonalità */
.home-hero-subtitle {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin: 0 0 0.5rem 0;
  background: linear-gradient(90deg, #4ade80, #a3e635, #86efac, #22c55e, #65a30d, #4ade80);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: subtitleShimmer 6s ease-in-out infinite;
}
@keyframes subtitleShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Benvenuto centrato */
.home-hero-welcome {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 0;
}
.home-hero-welcome span {
  color: var(--accent-light);
  font-weight: 600;
}

/* Widget Meteo */
.meteo-widget {
  background: linear-gradient(160deg, rgba(17, 30, 17, 0.85), rgba(10, 18, 10, 0.95));
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 0.7rem 0.9rem;
  backdrop-filter: blur(8px);
  width: 220px;
}
.meteo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}
.meteo-header-title {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.meteo-header-live {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.62rem;
  color: var(--accent-light);
}
.meteo-header-live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-light);
  animation: meteoPulse 2s ease-in-out infinite;
}
@keyframes meteoPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.meteo-main {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}
.meteo-icon {
  font-size: 2rem;
  color: var(--accent-light);
  filter: drop-shadow(0 0 6px rgba(134, 239, 172, 0.3));
}
.meteo-temp {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.meteo-condition {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.meteo-divider {
  height: 1px;
  background: linear-gradient(90deg, var(--border-color), transparent);
  margin: 0.5rem 0;
}

.meteo-details {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.meteo-detail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-muted);
}
.meteo-detail-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.meteo-detail i {
  color: var(--accent-light);
  width: 12px;
  text-align: center;
  font-size: 0.62rem;
}
.meteo-detail-value {
  font-weight: 600;
  color: var(--text-primary);
}

.meteo-location {
  font-size: 0.6rem;
  color: var(--text-muted);
  opacity: 0.5;
  margin-top: 0.5rem;
  text-align: center;
}

.meteo-error {
  color: var(--text-muted);
  font-size: 0.82rem;
  opacity: 0.6;
  text-align: center;
  padding: 1rem 0;
}

/* Quick Cards */
.quick-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.quick-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(77, 124, 15, 0.12);
}

.home-card-enter {
  opacity: 0;
  animation: homeCardIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes homeCardIn {
  0% { opacity: 0; transform: translateY(18px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.quick-card-icon {
  font-size: 1.5rem;
  color: var(--accent-light);
  margin-bottom: 0.4rem;
}
.quick-card-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
}
.quick-card-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* Footer home */
.home-footer {
  opacity: 0.3;
  transition: opacity 0.3s;
  margin-top: 2rem;
}
.home-footer:hover { opacity: 0.6; }
.home-footer img { width: 60px; height: auto; }
.home-footer-text {
  font-size: 0.65rem;
  color: var(--text-muted);
}
.home-footer-version {
  font-size: 0.58rem;
  color: var(--accent-light);
  opacity: 0.5;
  margin-top: 0.3rem;
  letter-spacing: 0.06em;
}

/* ---- Action Buttons in Table ---- */
.btn-action {
  width: 30px; height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: none;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-action-edit {
  background: rgba(77, 124, 15, 0.15);
  color: var(--accent-light);
}
.btn-action-edit:hover {
  background: rgba(77, 124, 15, 0.3);
}

.btn-action-delete {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}
.btn-action-delete:hover {
  background: rgba(239, 68, 68, 0.3);
}

.btn-action-warning {
  background: rgba(234, 179, 8, 0.15);
  color: #fde047;
}
.btn-action-warning:hover {
  background: rgba(234, 179, 8, 0.3);
}

.btn-action-success {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}
.btn-action-success:hover {
  background: rgba(34, 197, 94, 0.3);
}

/* ---- Alert ---- */
.alert { border-radius: var(--radius-lg); }

/* ---- Modale conferma ---- */
.modal-confirm-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}

.modal-confirm-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 400px;
  width: 90%;
  text-align: center;
}

.modal-confirm-box h5 { margin-bottom: 1rem; }

.modal-confirm-box .btn { min-width: 100px; }

/* ---- Modal dark theme globale ---- */
.modal-dark {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: #e0e0e0;
}
.modal-dark .modal-header {
  border-bottom: 1px solid var(--border-color);
}
.modal-dark .modal-footer {
  border-top: 1px solid var(--border-color);
}
.modal-dark .form-control,
.modal-dark .form-select {
  background: var(--bg-main);
  border-color: var(--border-color);
  color: #e0e0e0;
}
.modal-dark .form-control::placeholder {
  color: rgba(255, 255, 255, 0.35);
}
.modal-dark .form-control:focus,
.modal-dark .form-select:focus {
  background: var(--bg-main);
  border-color: var(--accent);
  color: #e0e0e0;
  box-shadow: 0 0 0 2px rgba(101, 163, 13, 0.2);
}
.modal-dark .text-accent { color: var(--accent) !important; }
.modal-backdrop { --bs-backdrop-opacity: 0.7; }

/* ---- Righe tipi documento nel modal ---- */
.tipo-doc-row {
  border-bottom: 1px solid rgba(77, 124, 15, 0.15);
  border-radius: 4px;
  transition: background 0.15s;
}
.tipo-doc-row:hover {
  background: rgba(77, 124, 15, 0.08);
}
.tipo-doc-row:last-child {
  border-bottom: none;
}
.modal-dark .form-check-input {
  background-color: var(--bg-main);
  border-color: var(--border-color);
}
.modal-dark .form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}


/* =============================================
   Listino Prezzi - Righe alternate
   ============================================= */

.listino-row-even {
  background-color: rgba(77, 124, 15, 0.08) !important;
}

.listino-row-odd {
  background-color: rgba(77, 124, 15, 0.22) !important;
}


/* =============================================
   Utility
   ============================================= */

.text-accent { color: var(--accent-light) !important; }


/* =============================================
   Flatpickr Dark Theme Override
   ============================================= */

.flatpickr-calendar {
  border: 1px solid var(--border-color) !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5) !important;
}

.flatpickr-calendar .flatpickr-day.selected,
.flatpickr-calendar .flatpickr-day.selected:hover {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
}

.flatpickr-calendar .flatpickr-day:hover {
  background: var(--bg-card-hover) !important;
}

.flatpickr-calendar .flatpickr-day.today {
  border-color: var(--accent-light) !important;
}

input.flatpickr-date + .form-control {
  cursor: pointer;
}

/* =============================================
   PAGINATION
   ============================================= */
.pagination-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
  padding: 0.5rem 0;
}

.pagination-info {
  font-size: 0.8rem;
  color: #b0b0b0;
}

.pagination-controls {
  display: flex;
  gap: 4px;
}

.pagination-controls .btn {
  min-width: 34px;
  height: 34px;
  padding: 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: #c0c0c0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.pagination-controls .btn:hover:not(:disabled) {
  background: rgba(77, 124, 15, 0.15);
  border-color: var(--accent);
  color: var(--accent-light);
}

.pagination-controls .btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pagination-controls .btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ---- CSV Export Button ---- */
.btn-csv {
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #c5cedb;
  background: transparent;
  font-size: 0.8rem;
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  transition: all 0.15s;
}

.btn-csv:hover {
  background: rgba(255, 255, 255, 0.08);
  color: white;
  border-color: rgba(255, 255, 255, 0.3);
}

/* =============================================
   DASHBOARD ANALITICA
   ============================================= */

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.dashboard-header h4 {
  color: var(--text-secondary);
  font-weight: 600;
}

/* O. Dashboard Tabs — stile pill premium */
.dash-tabs {
  display: flex;
  gap: 6px;
  border-bottom: none;
  padding: 4px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
}

.dash-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.5rem 1.2rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.dash-tab:hover {
  color: var(--text-primary);
  background: rgba(77, 124, 15, 0.1);
}

.dash-tab.active {
  color: var(--accent-light);
  background: rgba(77, 124, 15, 0.2);
  box-shadow: var(--shadow-sm);
}

.dash-tab-content {
  display: none;
}

.dash-tab-content.active {
  display: block;
}

/* Q. Separatore decorativo tra sezioni dashboard */
.dashboard-section + .dashboard-section {
  position: relative;
  margin-top: 2rem;
}
.dashboard-section + .dashboard-section::before {
  content: "";
  position: absolute;
  top: -1.25rem;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

/* C. Bordo sinistro accent sulle sezioni dashboard */
.dashboard-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.dashboard-section h5 {
  color: var(--accent-light);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
/* G. Icona titolo sezione con sfondo circolare */
.dashboard-section h5 > i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(77, 124, 15, 0.2);
  color: var(--accent-light);
  font-size: 0.8rem;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-light);
}

.dashboard-table {
  font-size: 0.82rem;
  margin-bottom: 0;
}

/* P. Header tabelle con gradient */
.dashboard-table thead {
  background: linear-gradient(180deg, #142014 0%, #0f170f 100%);
}
.dashboard-table th {
  color: var(--accent-light);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  border-bottom: 2px solid rgba(77, 124, 15, 0.25) !important;
  padding: 0.55rem 0.5rem;
}

/* D. Hover migliorato sulle righe tabella dashboard */
.dashboard-table td {
  border-bottom-color: var(--border-light) !important;
  vertical-align: middle;
  transition: background var(--transition-fast);
}
.dashboard-table tbody tr:hover td {
  background: rgba(77, 124, 15, 0.08);
}

.dashboard-table .text-end {
  font-variant-numeric: tabular-nums;
}

/* E. Cornice grafici */
.chart-container {
  position: relative;
  min-height: 260px;
  max-height: 320px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.15);
}

.margine-positivo { color: #4ade80; }
.margine-negativo { color: #f87171; }
.stat-card-positive .stat-value { color: #4ade80 !important; }
.stat-card-negative .stat-value { color: #f87171 !important; }

/* Dashboard responsive */
@media (max-width: 991px) {
  .dashboard-header { flex-direction: column; align-items: flex-start; }
  .chart-container { margin-top: 1rem; min-height: 220px; }
}

/* Sortable column headers */
.sortable-th, th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  color: #e0e0e0;
}
.sortable-th:hover, th.sortable:hover {
  color: var(--accent);
}
th.sortable i {
  font-size: .7rem;
  color: #9e9e9e;
  margin-left: 4px;
  transition: color .15s;
}
th.sortable.active-sort i {
  color: var(--accent);
}
.sort-icon {
  font-size: .7rem;
  color: #9e9e9e;
  margin-left: 4px;
  transition: color .15s;
}
.sort-icon.active {
  color: var(--accent);
}

/* Costi — celle tabella */
.table td.codice-cell {
  font-weight: 600;
  color: #6ecfcf !important;
  letter-spacing: 0.02em;
  font-size: 0.9rem;
}
.table td.data-cell {
  white-space: nowrap;
  font-size: 0.85rem;
}
.table td.totale-cell {
  white-space: nowrap;
}

/* =============================================
   Loading Overlay Globale
   ============================================= */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.loading-overlay.show {
  opacity: 1;
}
.loading-spinner {
  text-align: center;
}
.loading-text {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* =============================================
   Toast Notifications
   ============================================= */
#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.toast-msg {
  pointer-events: auto;
  min-width: 280px;
  max-width: 420px;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  color: #fff;
  font-size: 0.88rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: toastIn 0.3s ease-out;
}
.toast-msg.toast-success { background: #1b6e3d; border-left: 4px solid #2ecc71; }
.toast-msg.toast-error   { background: #7a1c1c; border-left: 4px solid #e74c3c; }
.toast-msg.toast-info    { background: #1a4a6e; border-left: 4px solid #3498db; }
.toast-msg.toast-warning { background: #6e5a1a; border-left: 4px solid #f39c12; }
.toast-msg.toast-out { animation: toastOut 0.3s ease-in forwards; }
.toast-msg i { font-size: 1.1rem; flex-shrink: 0; }
@keyframes toastIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(100%); } }

/* =============================================
   MAPPA AZIENDALE — Leaflet dark theme
   ============================================= */
#mappa-container {
  background: var(--bg-card, #1a1a2e);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
/* Popup stile dark */
.leaflet-popup-content-wrapper {
  background: #1e1e2e !important;
  color: #e0e0e0 !important;
  border-radius: 8px !important;
  border: 1px solid rgba(77,124,15,0.3) !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5) !important;
}
.leaflet-popup-tip {
  background: #1e1e2e !important;
}
.leaflet-popup-content {
  margin: 10px 14px !important;
  font-size: 0.85rem !important;
  line-height: 1.5 !important;
}
/* Tooltip stile dark */
.mappa-tooltip {
  background: rgba(30,30,46,0.92) !important;
  color: #e0e0e0 !important;
  border: 1px solid rgba(77,124,15,0.4) !important;
  border-radius: 6px !important;
  padding: 4px 10px !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4) !important;
}
.mappa-tooltip::before {
  border-top-color: rgba(30,30,46,0.92) !important;
}
/* Controlli Leaflet dark */
.leaflet-control-zoom a,
.leaflet-control-layers-toggle {
  background: #1e1e2e !important;
  color: #e0e0e0 !important;
  border-color: rgba(77,124,15,0.3) !important;
}
.leaflet-control-zoom a:hover {
  background: #2a2a3e !important;
}
.leaflet-control-layers {
  background: #1e1e2e !important;
  color: #e0e0e0 !important;
  border: 1px solid rgba(77,124,15,0.3) !important;
  border-radius: 8px !important;
}
.leaflet-control-layers label {
  color: #e0e0e0 !important;
}
/* Attribution link discreto */
.leaflet-control-attribution {
  background: rgba(0,0,0,0.5) !important;
  color: #888 !important;
  font-size: 0.65rem !important;
}
.leaflet-control-attribution a {
  color: #aaa !important;
}
/* Marker azienda — rimuovi background di default */
.mappa-marker-azienda {
  background: none !important;
  border: none !important;
}

/* ═══ Riscontro Bancario ═══ */
.riscontro-dropzone {
  border: 2px dashed rgba(77, 124, 15, 0.4);
  border-radius: 12px;
  padding: 2rem;
  transition: all 0.3s ease;
  cursor: pointer;
}
.riscontro-dropzone:hover,
.riscontro-dropzone.dragover {
  border-color: var(--accent);
  background: rgba(77, 124, 15, 0.08);
}
.riscontro-dropzone.dragover {
  transform: scale(1.01);
}
.riscontro-errore-row {
  background: rgba(220, 38, 38, 0.15) !important;
}
.riscontro-errore-row:hover {
  background: rgba(220, 38, 38, 0.25) !important;
}

/* ========================================
   TRACCIABILITA' — Timeline Layout
   ======================================== */
.tracc-timeline {
  position: relative;
  padding-left: 2.5rem;
}
.tracc-timeline::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 15px;
  bottom: 15px;
  width: 2px;
  background: linear-gradient(180deg, #22c55e, #3b82f6, #8b5cf6, #ef4444);
  opacity: 0.4;
}
.tracc-section {
  position: relative;
  margin-bottom: 1.5rem;
}
.tracc-section:last-child { margin-bottom: 0; }
.tracc-section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}
.tracc-section-dot {
  position: absolute;
  left: -2.5rem;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-main);
  border: 2px solid var(--tracc-color, var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.tracc-section-dot i {
  font-size: 0.7rem;
  color: var(--tracc-color, var(--accent));
}
.tracc-section-title {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.tracc-section-title strong {
  font-size: 0.9rem;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.tracc-section-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.tracc-section-body {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--tracc-color, var(--accent));
  border-radius: 12px;
  padding: 1rem;
}
.tracc-dr { margin-bottom: 0.2rem; }
.tracc-dr-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  display: block;
  line-height: 1.2;
}
.tracc-dr-value {
  font-size: 0.88rem;
  color: var(--text-primary);
}
@media (max-width: 575px) {
  .tracc-timeline { padding-left: 2rem; }
  .tracc-section-dot { left: -2rem; width: 26px; height: 26px; }
}

/* ---- Tabulator — Dark Theme Override (GIAMS) ---- */
.tabulator {
  background-color: #0c120c;
  border: 2px solid #2d4a08 !important;
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-size: 0.85rem;
  color: var(--text-primary);
  box-shadow:
    0 4px 12px rgba(100,100,100,0.15),
    0 10px 30px rgba(80,80,80,0.1),
    0 1px 3px rgba(150,150,150,0.08);
}
/* -- Header con sfondo verde scuro (stesso del footer) -- */
.tabulator .tabulator-header {
  background: linear-gradient(180deg, #142014 0%, #0f170f 100%) !important;
  border-bottom: 2px solid rgba(77,124,15,0.35);
  color: var(--text-secondary);
}
.tabulator .tabulator-header .tabulator-col {
  background: transparent !important;
  border-right: 1px solid rgba(77,124,15,0.25) !important;
}
.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover {
  background-color: rgba(77,124,15,0.12) !important;
}
.tabulator .tabulator-header .tabulator-col .tabulator-col-title {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--accent-light);
  text-align: center;
}
.tabulator .tabulator-header .tabulator-col .tabulator-col-content {
  justify-content: center;
  padding-top: 3px;
}
.tabulator .tabulator-header .tabulator-col .tabulator-header-filter {
  background: transparent;
  padding: 8px 4px;
}
.tabulator .tabulator-header .tabulator-col .tabulator-header-filter input {
  background: rgba(77,124,15,0.08) !important;
  border: 1px solid rgba(77,124,15,0.25) !important;
  color: var(--text-primary) !important;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.78rem;
}
.tabulator .tabulator-header .tabulator-col .tabulator-header-filter input:focus {
  border-color: var(--accent) !important;
  outline: none;
  box-shadow: 0 0 0 2px rgba(77,124,15,0.2);
}
.tabulator .tabulator-header .tabulator-col .tabulator-header-filter select {
  background: rgba(77,124,15,0.08) !important;
  border: 1px solid rgba(77,124,15,0.25) !important;
  color: var(--text-primary) !important;
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 0.78rem;
}
/* -- Righe alternate: verde scuro / verde leggermente piu' chiaro -- */
.tabulator .tabulator-tableholder .tabulator-table .tabulator-row {
  background-color: #0c120c;
  border-bottom: 1px solid rgba(77,124,15,0.18);
  color: var(--text-primary);
  transition: background-color 0.15s ease;
}
.tabulator .tabulator-tableholder .tabulator-table .tabulator-row:nth-child(even) {
  background-color: #121e12;
}
.tabulator .tabulator-tableholder .tabulator-table .tabulator-row:hover {
  background-color: rgba(77,124,15,0.18);
}
/* -- Separatori celle visibili -- */
.tabulator .tabulator-tableholder .tabulator-table .tabulator-row .tabulator-cell {
  border-right: 1px solid rgba(77,124,15,0.12);
  vertical-align: middle;
}
/* -- Footer con sfondo verde scuro -- */
.tabulator .tabulator-footer {
  background: linear-gradient(0deg, #142014 0%, #0f170f 100%) !important;
  border-top: 2px solid rgba(77,124,15,0.35);
  color: var(--text-muted);
  padding: 8px 12px;
}
.tabulator .tabulator-footer .tabulator-page {
  background: rgba(77,124,15,0.08);
  border: 1px solid rgba(77,124,15,0.25);
  color: var(--text-secondary);
  border-radius: 6px;
  margin: 0 2px;
  padding: 4px 10px;
}
.tabulator .tabulator-footer .tabulator-page.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}
.tabulator .tabulator-footer .tabulator-page:hover:not(.active):not(.disabled) {
  background: rgba(77,124,15,0.18);
}
.tabulator .tabulator-footer .tabulator-page.disabled {
  opacity: 0.3;
}
.tabulator .tabulator-footer .tabulator-page-size {
  background: rgba(77,124,15,0.06);
  border: 1px solid rgba(77,124,15,0.25);
  color: var(--text-primary);
  border-radius: 6px;
}
.tabulator .tabulator-placeholder {
  background: rgba(77, 124, 15, 0.03);
}
.tabulator .tabulator-placeholder span {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
/* Componente stato vuoto riutilizzabile */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}
.empty-state i {
  font-size: 2.5rem;
  opacity: 0.4;
  margin-bottom: 0.75rem;
  display: block;
}
.empty-state p {
  font-size: 0.92rem;
  margin: 0;
}
.tabulator .btn-action {
  background: none;
  border: none;
  cursor: pointer;
}
.tabulator-export-btn {
  background: rgba(77,124,15,0.12);
  border: 1px solid rgba(77,124,15,0.3);
  color: var(--accent-light);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s ease;
  margin-left: auto;
  margin-top: 2px;
  order: 99;
}
.tabulator-export-btn:hover {
  background: rgba(77,124,15,0.25);
}

/* =============================================
   RESPONSIVE — Tablet (768px – 1024px)
   ============================================= */
@media (min-width: 768px) and (max-width: 1024px) {
  .stat-cards-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  .module-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .chart-container { min-height: 200px; max-height: 280px; }
  .filter-bar { flex-wrap: wrap; gap: 0.5rem; }
  .filter-bar .form-control,
  .filter-bar .form-select { min-width: 140px; }
}

/* =============================================
   RESPONSIVE — Mobile Form Fixes (iOS zoom prevention)
   ============================================= */
@media (max-width: 767px) {
  /* Touch target minimo 44px (WCAG 2.5.5) */
  .btn, .btn-accent, .btn-outline-secondary,
  .form-control, .form-select,
  .tabulator .tabulator-header .tabulator-col {
    min-height: 44px;
  }
  /* Font 16px per prevenire zoom automatico iOS su focus input */
  .form-control, .form-select, textarea.form-control {
    font-size: 16px !important;
  }
  /* Stat cards in colonna singola su mobile */
  .stat-cards-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .stat-card { padding: 0.75rem; }
  .stat-value { font-size: 1.4rem; }
  /* Tabella: scroll orizzontale con hint */
  .tabulator {
    border-radius: 8px;
  }
  .tabulator .tabulator-header .tabulator-col .tabulator-col-title {
    font-size: 0.68rem;
  }
  .tabulator .tabulator-row .tabulator-cell {
    font-size: 0.78rem;
    padding: 6px 8px;
  }
  /* Filtri in colonna su mobile */
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-bar .form-control,
  .filter-bar .form-select {
    width: 100%;
  }
  /* Dashboard header stackato */
  .dashboard-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
}

/* =============================================
   PRINT STYLESHEET
   ============================================= */
@media print {
  /* Nascondi elementi interattivi */
  #app-sidebar,
  .sidebar-backdrop,
  .sidebar-toggle,
  .topbar,
  .toast-container,
  .btn, .btn-accent,
  .btn-outline-secondary,
  .filter-bar,
  .tabulator-footer,
  .tabulator-export-btn,
  .modal-overlay,
  .chart-container,
  nav, footer {
    display: none !important;
  }
  /* Layout pagina piena */
  body {
    background: white !important;
    color: black !important;
    font-size: 12pt;
    margin: 0;
    padding: 0;
  }
  #app-content {
    margin: 0 !important;
    padding: 1cm !important;
    width: 100% !important;
  }
  .app-layout {
    display: block !important;
  }
  /* Colori leggibili su carta */
  .stat-card, .stat-card-3d {
    background: white !important;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    color: black !important;
    break-inside: avoid;
  }
  .stat-value, .stat-label, .stat-sub {
    color: black !important;
  }
  .module-title, .module-subtitle {
    color: black !important;
  }
  /* Tabelle leggibili */
  .tabulator {
    background: white !important;
    border: 1px solid #333 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }
  .tabulator .tabulator-header {
    background: #f0f0f0 !important;
    border-bottom: 2px solid #333 !important;
  }
  .tabulator .tabulator-header .tabulator-col .tabulator-col-title {
    color: black !important;
    font-weight: bold;
  }
  .tabulator .tabulator-row {
    background: white !important;
    color: black !important;
    border-bottom: 1px solid #ddd !important;
  }
  .tabulator .tabulator-row:nth-child(even) {
    background: #f8f8f8 !important;
  }
  .tabulator .tabulator-cell {
    color: black !important;
  }
  /* Badge leggibili in stampa */
  .badge {
    border: 1px solid #999 !important;
    color: black !important;
    background: #eee !important;
  }
  /* Link visibili */
  a { color: black !important; text-decoration: underline; }
  /* Evita taglio contenuti */
  .stat-card, .tabulator-row, tr {
    break-inside: avoid;
  }
  /* Header stampa */
  @page {
    margin: 1.5cm;
    size: A4;
  }
}
