:root {
  /* Palette Professionale Ispirata ai Toni del Capello - Tema Chiaro */
  --bg-color: #f7f5f0; /* Biondo Freddo / Sabbia Chiarissimo */
  --sidebar-bg: linear-gradient(
    180deg,
    #1c120c 0%,
    #120a06 100%
  ); /* Castano Intenso / Cioccolato di Contrasto */
  --card-bg: rgba(255, 255, 255, 0.85); /* Platino/Bianco Latte Vetro */
  --card-border: rgba(
    28,
    20,
    17,
    0.16
  ); /* Castano Chiarissimo / Sabbia - Maggiore visibilità */
  --text-main: #1f1611; /* Castano Intenso / Cioccolato Fondente */
  --text-muted: #6b5c52; /* Cenere / Biondo Sabbia Muted */

  /* Accenti */
  --primary: #c2410c; /* Rosso Rame Intenso */
  --primary-hover: #9a3412; /* Mogano Profondo */
  --primary-glow: rgba(194, 65, 12, 0.15);

  --accent-sand: #7e6f63; /* Biondo Sabbia Scuro per Contrasti */
  --success: #059669; /* Smeraldo */
  --success-glow: rgba(5, 150, 105, 0.1);
  --info: #2563eb;
  --warning: #d97706;
  --danger: #dc2626;
  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  /* Type scale */
  --fs-xs: 0.75rem;
  --fs-sm: 0.85rem;
  --fs-md: 1rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.75rem;
  /* Elevation */
  --shadow-sm: 0 1px 3px rgba(28, 20, 17, 0.08);
  --shadow-md: 0 4px 12px rgba(28, 20, 17, 0.08);
  --shadow-lg: 0 12px 32px rgba(28, 20, 17, 0.16);
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Outfit', sans-serif;
  --transition: 180ms ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  background-image:
    radial-gradient(
      circle at 0% 0%,
      rgba(194, 65, 12, 0.04) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 100% 100%,
      rgba(212, 197, 185, 0.15) 0%,
      transparent 50%
    );
}

/* Layout Full Screen */
.app-container {
  display: flex;
  width: 100%;
  height: 100%;
}

/* Sidebar - Castano/Cioccolato e Rame */
aside {
  width: 280px;
  height: 100%;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--card-border);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  width: 100%;
}

/* Link rapido al sito pubblico, subito sotto il brand */
.brand-site-link {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 30px 2px;
  padding: 6px 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-sand);
  text-decoration: none;
  border: 1px solid rgba(212, 197, 185, 0.25);
  border-radius: 8px;
  transition: border-color 0.15s, color 0.15s;
}

.brand-site-link:hover {
  color: #f4f0ea;
  border-color: rgba(212, 197, 185, 0.55);
}

/* Nome dell'operatore loggato (visibile solo per account non-admin) */
.brand-operator-label {
  font-size: 0.78rem;
  color: var(--accent-sand);
  opacity: 0.85;
  margin: -6px 0 18px 2px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--accent-sand));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #130d0a;
  font-size: 1.3rem;
  box-shadow: 0 0 20px var(--primary-glow);
}

.brand-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, #f4f0ea, #d4c5b9);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-grow: 1;
  overflow-y: auto;
  scrollbar-width: none;
  /* Senza min-height un flex item non scende sotto il suo contenuto: la lista
     non scrollava e spingeva il footer (Disconnetti + versione) fuori schermo. */
  min-height: 0;
}

.nav-list::-webkit-scrollbar {
  display: none;
}

.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.nav-item {
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  color: #fff;
  background: rgba(194, 65, 12, 0.15);
  border-left: 3px solid var(--primary);
  box-shadow: inset 5px 0 15px rgba(194, 65, 12, 0.05);
}

.nav-item svg {
  transition: transform 0.25s ease;
}

.nav-item:hover svg {
  transform: scale(1.1);
}

/* Main Area - Nero Naturale */
main {
  flex-grow: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 32px 40px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 24px;
  flex-shrink: 0;
}

.page-title {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--success);
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--success);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* Scrollable Tab Content */
.tabs-content {
  flex-grow: 1;
  overflow-y: auto;
  margin-top: 24px;
  padding-right: 8px;
}

.tabs-content::-webkit-scrollbar {
  width: 8px;
}
.tabs-content::-webkit-scrollbar-track {
  background: transparent;
}
.tabs-content::-webkit-scrollbar-thumb {
  background: #1b1411;
  border-radius: 4px;
  border: 2px solid var(--bg-color);
}
.tabs-content::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Dashboard Widgets Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

/* Cards - Cioccolato Glassmorphism */
.card {
  background: var(--card-bg);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-md);
  transition:
    box-shadow var(--transition),
    transform var(--transition);
  display: flex;
  flex-direction: column;
  gap: 16px;
  /* Perf: il backdrop-filter (blur) è costoso su ogni card a ogni repaint.
         content-visibility salta del tutto il rendering (e il blur) delle card
         fuori dal viewport; contain isola i ricalcoli di layout/style della
         card dal resto della pagina. Niente "contain: paint" per non clippare
         dropdown/popover che escono dai bordi della card. Il vetro resta. */
  content-visibility: auto;
  contain-intrinsic-size: auto 320px;
  contain: layout style;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(212, 197, 185, 0.25);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 12px;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent-sand);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Buttons - Rosso Rame / Mogano */
.btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background var(--transition),
    transform var(--transition),
    box-shadow var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 6px 20px rgba(194, 65, 12, 0.45);
}

.btn-secondary {
  background: rgba(212, 197, 185, 0.05);
  border: 1px solid var(--card-border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(212, 197, 185, 0.1);
  border-color: var(--accent-sand);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 6px;
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

input,
select,
textarea {
  background: #ffffff;
  border: 1px solid rgba(28, 20, 17, 0.15);
  border-radius: 6px;
  padding: 10px 14px;
  color: #1e1611;
  font-family: var(--font);
  font-size: 0.9rem;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 8px rgba(194, 65, 12, 0.15);
}

/* List Wrappers */
.list-wrapper {
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
}

.list-wrapper::-webkit-scrollbar {
  width: 6px;
}
.list-wrapper::-webkit-scrollbar-track {
  background: transparent;
}
.list-wrapper::-webkit-scrollbar-thumb {
  background: rgba(212, 197, 185, 0.1);
  border-radius: 3px;
}

.list-item {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.list-item:hover {
  background: rgba(212, 197, 185, 0.03);
  border-color: rgba(194, 65, 12, 0.3);
  box-shadow: 0 3px 8px rgba(28, 20, 17, 0.06);
}

.item-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-title {
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.95rem;
}

.item-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Badges */
.badge {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-primary {
  background: rgba(212, 197, 185, 0.15);
  color: var(--accent-sand);
}
.badge-success {
  background: var(--success-glow);
  color: #34d399;
}
.badge-info {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
}
.badge-warning {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
}
.badge-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}

/* Notiziario — badge e righe notizie */
.badge-new {
  display: inline-block;
  background: #c0392b;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 7px;
  margin-left: 6px;
  vertical-align: middle;
}
.news-row {
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}
.news-row:last-child { border-bottom: none; }
.news-row.is-new { border-left: 3px solid #c0392b; padding-left: 8px; }
.news-source {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.news-title { display: block; color: #1a3c6e; text-decoration: none; font-size: 14px; }
.news-title:hover { text-decoration: underline; }
.news-date { font-size: 11px; color: #999; }

/* Notifiche pratiche portale (sidebar, New, messaggi non letti) */
.notif-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #dc2626;
  color: #fff;
  font-size: 0.66rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  line-height: 1;
  border-radius: 999px;
  padding: 0 5px;
}

/* Notiziario: striscia orizzontale in primo piano (dashboard) */
.news-strip-card { margin-bottom: 16px; }
.news-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}
.news-tile {
  flex: 0 0 240px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fafafa;
  text-decoration: none;
  transition: border-color .15s;
}
.news-tile:hover { border-color: #1a3c6e; }
.news-tile.is-new { border-left: 3px solid #c0392b; }
.news-tile-title {
  color: #1a3c6e;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-tile .news-date { margin-top: auto; }

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(28, 20, 17, 0.4);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: #ffffff;
  border: 1px solid rgba(28, 20, 17, 0.15);
  border-radius: var(--radius);
  width: 90%;
  max-width: 750px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  transform: translateY(20px);
  transition: transform 0.3s ease;
  box-shadow: 0 25px 60px rgba(28, 20, 17, 0.15);
}

.modal-backdrop.open .modal {
  transform: translateY(0);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.f24-spinner {
  width: 54px;
  height: 54px;
  border: 5px solid rgba(194, 65, 12, 0.18);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 22px;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex-grow: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--card-border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

pre {
  background: #1c120c; /* Pre rimane scuro per evidenziare la sintassi XML */
  padding: 18px;
  border-radius: 6px;
  font-family: monospace;
  color: #f4f0ea;
  font-size: 0.85rem;
  white-space: pre-wrap;
  max-height: 450px;
  overflow-y: auto;
  border: 1px solid var(--card-border);
}

.ai-bubble {
  background: linear-gradient(
    135deg,
    rgba(194, 65, 12, 0.08) 0%,
    rgba(28, 20, 17, 0.02) 100%
  );
  border: 1px solid rgba(194, 65, 12, 0.15);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: var(--text-main);
}

.tabs-content > div {
  display: none;
}

.tabs-content > div.active {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* Calendario Scadenze */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.calendar-day {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 4px;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
  height: 104px;
  overflow: hidden;
}

.calendar-day:hover {
  background: rgba(212, 197, 185, 0.08);
  border-color: var(--accent-sand);
}

.calendar-day.has-events {
  background: rgba(217, 119, 6, 0.07);
  border-color: rgba(217, 119, 6, 0.35);
}

.calendar-day.has-events .day-number {
  font-weight: 800;
}

/* Dashboard Cliente - Tile cliccabili per adempimento */
.cd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 16px;
}

.cd-tile {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-top: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 18px 16px;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 6px;
  min-height: 150px;
  position: relative;
  overflow: hidden;
}

.cd-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(28, 20, 17, 0.13);
}

/* Filigrana documento: watermark in basso a destra */
.cd-tile .cd-glyph {
  position: absolute;
  right: -6px;
  bottom: -8px;
  width: 82px;
  height: 82px;
  opacity: 0.15;
  z-index: 0;
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}
.cd-tile:hover .cd-glyph {
  opacity: 0.24;
  transform: scale(1.06) rotate(-3deg);
}

/* Il contenuto resta sopra la filigrana */
.cd-tile .cd-emblem {
  position: relative;
  z-index: 1;
  margin-bottom: 4px;
  filter: drop-shadow(0 2px 4px rgba(28, 20, 17, 0.15));
}
.cd-tile .cd-label {
  position: relative;
  z-index: 1;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-main);
  line-height: 1.2;
}
.cd-tile .cd-desc {
  position: relative;
  z-index: 1;
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.35;
  flex-grow: 1;
}
.cd-tile .cd-ente {
  position: relative;
  z-index: 1;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  opacity: 0.75;
  margin-top: 2px;
}
.cd-wip-badge {
  z-index: 2;
}

/* Input/select della sezione Documenti */
.cd-doc-input {
  padding: 8px 10px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  font-size: 0.82rem;
  background: #fff;
  color: var(--text-main);
  font-family: inherit;
}
.cd-doc-input:focus {
  outline: none;
  border-color: var(--primary);
}

.cd-wip-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--warning);
  background: rgba(217, 119, 6, 0.1);
  border: 1px solid rgba(217, 119, 6, 0.25);
  padding: 2px 6px;
  border-radius: 8px;
}

.cd-profile-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 16px;
  margin-bottom: 18px;
  background: #faf9f7;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
}
.cd-profile-badge {
  font-size: 0.74rem;
  padding: 3px 10px;
  background: rgba(194, 65, 12, 0.08);
  color: var(--primary);
  border: 1px solid rgba(194, 65, 12, 0.18);
  border-radius: 12px;
  white-space: nowrap;
}
.cd-excluded-note {
  margin-top: 18px;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.4;
  padding: 10px 14px;
  background: rgba(126, 111, 99, 0.05);
  border-left: 3px solid var(--accent-sand);
  border-radius: 6px;
}

.calendar-day.empty {
  background: transparent;
  border: none;
  cursor: default;
  pointer-events: none;
}

.calendar-day.selected {
  border: 2px solid var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
  background: rgba(194, 65, 12, 0.03);
}

.calendar-day.today {
  border-color: var(--accent-sand);
  background: rgba(126, 111, 99, 0.05);
}

.calendar-day.today .day-number {
  color: var(--primary);
  font-weight: 700;
}

.day-number {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.calendar-dots {
  display: flex;
  gap: 4px;
  justify-content: center;
  min-height: 6px;
  width: 100%;
}

.calendar-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.dot-pending {
  background-color: var(--warning);
  box-shadow: 0 0 4px var(--warning);
}

.dot-overdue {
  background-color: var(--danger);
  box-shadow: 0 0 4px var(--danger);
}

.dot-paid {
  background-color: var(--success);
  box-shadow: 0 0 4px var(--success);
}

.calendar-events {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  overflow: hidden;
}
.calendar-event {
  font-size: 0.62rem;
  line-height: 1.3;
  padding: 1px 4px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}
.calendar-event.ev-pending {
  background: #fffbeb;
  color: #92400e;
}
.calendar-event.ev-paid {
  background: #f0fdf4;
  color: #166534;
}
.calendar-event.ev-overdue {
  background: #fef2f2;
  color: #b91c1c;
}
.calendar-event.ev-adempimento {
  box-shadow: inset 2px 0 0 #6a4c93;
}
.calendar-event.ev-more {
  background: transparent;
  color: var(--text-muted);
  font-style: italic;
}

.btn-inbox-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 500;
  border-radius: 6px;
  transition: all 0.2s ease;
}
.btn-inbox-tab:hover {
  color: var(--text-main);
}
.btn-inbox-tab.active {
  background: #ffffff !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  color: var(--primary) !important;
  font-weight: 600 !important;
}

.inbox-select-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 24px;
  background: rgba(194, 65, 12, 0.04);
  border-bottom: 1px solid var(--card-border);
  font-size: 0.85rem;
  color: var(--text-muted);
}
.inbox-select-toolbar label {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  color: var(--text-main);
  font-weight: 500;
}
.inbox-select-toolbar input[type='checkbox'] {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
}
.inbox-row-checkbox {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.multi-contact-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}
.multi-contact-row input {
  flex: 1;
}
.multi-contact-row .btn-remove-contact {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.25);
}
.channel-prefs-group {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.channel-prefs-group label {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-weight: 500;
  color: var(--text-main);
}
.channel-prefs-group input[type='checkbox'] {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
}
.field-readonly-hint {
  display: none;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-style: italic;
}

.inbox-item-container {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
  transition: all 0.2s ease;
}
.inbox-item-container:hover {
  border-color: rgba(194, 65, 12, 0.2);
  background: rgba(212, 197, 185, 0.02);
}

/* Login Container & Card Styles */
#login-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(
    circle at 10% 20%,
    rgba(28, 18, 12, 0.96) 0%,
    rgba(18, 10, 6, 0.99) 100%
  );
  z-index: 9999;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.035);
  -webkit-backdrop-filter: blur(25px);
  backdrop-filter: blur(25px);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 30px;
  animation: loginFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.login-logo {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary), var(--accent-sand));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #130d0a;
  font-size: 1.8rem;
  box-shadow: 0 0 30px var(--primary-glow);
  margin-bottom: 8px;
}

.login-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, #f4f0ea, #d4c5b9);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-header p {
  color: #9a8a7f;
  font-size: 0.95rem;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#login-container .form-group label {
  color: #d4c5b9;
  font-size: 0.9rem;
  font-weight: 500;
}

#login-container .form-group input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px 16px;
  color: #fff;
  font-family: var(--font);
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

#login-container .form-group input:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(194, 65, 12, 0.25);
}

#login-container .form-group input::placeholder {
  color: #6b5c52;
}

.login-error-msg {
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(220, 38, 38, 0.3);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  text-align: center;
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}

.btn-login {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 14px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font);
  box-shadow: 0 4px 12px rgba(194, 65, 12, 0.3);
  margin-top: 10px;
}

.btn-login:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(194, 65, 12, 0.4);
}

.btn-login:active {
  transform: translateY(1px);
}

#nav-logout {
  color: #ef4444;
}

#nav-logout:hover {
  color: #f87171 !important;
  background: rgba(239, 68, 68, 0.08) !important;
}

/* Stili per la Griglia Compensi Ordinari */
.grid-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--card-border);
  vertical-align: middle;
}
.grid-table th {
  border-bottom: 1px solid var(--card-border);
}
.grid-cell-active {
  cursor: pointer;
  text-align: center;
  font-weight: 600;
  transition: all 0.15s ease;
  position: relative;
}
.grid-cell-active:hover {
  filter: brightness(0.92) contrast(1.1);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}
.grid-cell-empty {
  text-align: center;
  color: var(--text-muted);
  opacity: 0.5;
}
.grid-input-debt,
.grid-input-notes {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  font-family: var(--font);
  font-size: 0.85rem;
  padding: 6px 8px;
  border-radius: 4px;
  color: var(--text-main);
  transition: all 0.2s ease;
}
.grid-input-debt {
  text-align: right;
  font-weight: 500;
}
.grid-input-debt:hover,
.grid-input-notes:hover {
  border-color: rgba(28, 20, 17, 0.15);
  background: rgba(255, 255, 255, 0.5);
}
.grid-input-debt:focus,
.grid-input-notes:focus {
  border-color: var(--primary);
  background: #fff;
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Switch / Toggle styling */
.switch input:checked + .slider {
  background-color: var(--success);
}
.switch input:focus + .slider {
  box-shadow: 0 0 1px var(--success);
}
.switch input:checked + .slider:before {
  transform: translateX(22px);
}
.slider:before {
  position: absolute;
  content: '';
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

/* Batch notify modal: hover sui client header */
.batch-client-header:hover {
  background: rgba(194, 65, 12, 0.03);
}
.batch-client-row {
  transition: box-shadow 0.15s;
}
.batch-client-row:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* ===== Design system v2 ===== */
.grid-table thead th,
[style*='overflow-x: auto'] table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-color);
  z-index: 1;
}
.grid-table tbody tr,
[style*='overflow-x: auto'] table tbody tr {
  transition: background var(--transition);
}
.grid-table tbody tr:hover,
[style*='overflow-x: auto'] table tbody tr:hover {
  background: rgba(194, 65, 12, 0.04);
}
/* Nessuna animazione al cambio tab: il fadeIn (opacità + translateY) portava
   il contenuto su un layer composito per 200ms e, con le card in
   backdrop-filter, Chrome ridisegnava il testo con antialiasing diverso
   (più sottile) per poi tornare normale a fine animazione: a ogni click le
   scritte sembravano rimpicciolirsi e ingrandirsi. */
.empty-state {
  text-align: center;
  padding: var(--sp-6);
  color: var(--text-muted);
}
.empty-state .empty-icon {
  font-size: 2rem;
  margin-bottom: var(--sp-2);
  opacity: 0.5;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Modalità leggera (toggle in Impostazioni): massima fluidità su GPU deboli,
   accelerazione HW disattivata o Desktop Remoto/VM. Spegne i costi di rendering
   per-frame: backdrop-filter (blur), ombre, transizioni e animazioni. */
body.lite-mode .card,
body.lite-mode .login-card,
body.lite-mode .modal-backdrop {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}
body.lite-mode .card {
  background: #ffffff !important;
}
body.lite-mode *,
body.lite-mode *::before,
body.lite-mode *::after {
  box-shadow: none !important;
  animation: none !important;
  transition: none !important;
}

/* --- Grouped collapsible sidebar --- */
.nav-group-label {
  font-size: 0.62rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--accent-sand);
  padding: var(--sp-3) 18px var(--sp-1);
  list-style: none;
}
#sidebar-toggle {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  transition:
    background var(--transition),
    color var(--transition);
  margin-left: auto;
}
#sidebar-toggle:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}
#sidebar-toggle svg {
  display: block;
  transition: transform var(--transition);
}
body.sidebar-collapsed #sidebar-toggle {
  margin-left: 0;
}
body.sidebar-collapsed .brand {
  flex-direction: column;
  gap: 12px;
}
body.sidebar-collapsed #sidebar-toggle svg {
  transform: rotate(180deg);
}
aside {
  transition:
    width var(--transition),
    transform var(--transition);
  overflow: visible;
}
body.sidebar-collapsed aside {
  width: 64px;
  padding: 32px 8px;
}
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .nav-group-label,
body.sidebar-collapsed .brand-title,
body.sidebar-collapsed #app-version,
body.sidebar-collapsed .brand-site-label {
  display: none;
}
body.sidebar-collapsed .brand-site-link {
  justify-content: center;
  padding: 6px;
}
body.sidebar-collapsed .nav-item {
  justify-content: center;
}
body.sidebar-collapsed .nav-list {
  overflow: visible;
}
.nav-item {
  position: relative;
}
body.sidebar-collapsed .nav-item:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 70px;
  background: var(--text-main);
  color: #fff;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  white-space: nowrap;
  z-index: 1000;
}

/* --- Cockpit Dashboard --- */
.text-muted {
  color: var(--text-muted);
}
.cockpit-greeting {
  margin-bottom: var(--sp-5);
}
.cockpit-greeting h2 {
  font-size: var(--fs-xl);
  margin-bottom: var(--sp-1);
}
.cockpit-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: var(--sp-5);
  align-items: start;
}
.cockpit-main,
.cockpit-side {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}
.quick-actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.kpi-row {
  display: flex;
  gap: var(--sp-5);
}
.kpi {
  display: flex;
  flex-direction: column;
}
.kpi-value {
  font-size: var(--fs-xl);
  font-weight: 800;
}
.kpi-label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.feed-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--radius-sm);
  margin-bottom: var(--sp-2);
  cursor: pointer;
  transition: background var(--transition);
}
.feed-item:hover {
  filter: brightness(0.97);
}
.feed-red {
  background: #fef2f2;
}
.feed-yellow {
  background: #fffbeb;
}
.feed-purple {
  background: #f5f3ff;
}
.feed-neutral {
  background: #f8f7f4;
}

/* ── Mobile Responsive (≤900px) ── */
#mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--text-main);
  cursor: pointer;
  padding: 0 var(--sp-2) 0 0;
}
@media (max-width: 900px) {
  #mobile-menu-btn {
    display: inline-block;
  }
  aside {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 999;
    transform: translateX(-100%);
  }
  body.sidebar-open aside {
    transform: none;
    box-shadow: var(--shadow-lg);
  }
  /* Always show full sidebar on mobile, never icon-only mode */
  body.sidebar-collapsed aside {
    width: 280px;
    padding: 32px 24px;
    transform: translateX(-100%);
  }
  body.sidebar-open.sidebar-collapsed aside {
    transform: none;
  }
  /* main fills full width since aside is fixed out of flex flow */
  main {
    width: 100%;
    padding: var(--sp-3);
  }
  .cockpit-grid,
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }
  table {
    display: block;
    overflow-x: auto;
  }
}

/* --- Clients two-column layout --- */
.clients-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
  align-items: start;
}
.clients-columns > div {
  min-width: 0;
}
.clients-columns .list-wrapper {
  max-height: calc(100vh - 330px);
  overflow-y: auto;
}

/* --- Report Scadenze table --- */
.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.report-table th,
.report-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--card-border);
  text-align: left;
  white-space: nowrap;
}
.report-table td:nth-child(2) {
  white-space: normal;
}

/* --- Batch notify message preview (pre and textarea) --- */
.notify-preview {
  background: #f8f7f4;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.78rem;
  white-space: pre-wrap;
  font-family: inherit;
  margin-top: 8px;
  display: none;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--card-border);
}
.notify-preview[style*='display: block'] {
  display: block;
}
textarea.notify-preview {
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
}

/* Generated Utility Classes for Inline Style Warnings Removal */
.us-1 {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: none;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
  pointer-events: none;
}
.us-2 {
  display: none;
}
.us-3 {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}
.us-4 {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.15rem;
  color: rgba(255, 255, 255, 0.75);
  padding: 4px 6px;
  line-height: 1;
}
.us-5 {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 110%;
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  min-width: 200px;
  z-index: 1000;
  overflow: hidden;
}
.us-6 {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text-main);
}
.us-7 {
  padding: 12px 18px;
  font-size: 0.7rem;
  color: var(--accent-sand);
  opacity: 0.65;
  letter-spacing: 0.3px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.us-8 {
  opacity: 0.8;
}
.us-9 {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}
.us-10 {
  display: none;
}
.us-11 {
  color: #6a4c93;
}
.us-12 {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.us-13 {
  color: var(--warning);
}
.us-14 {
  border-top: 1px solid var(--card-border);
}
.us-15 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  background: rgba(5, 150, 105, 0.04);
  border-bottom: 1px solid rgba(5, 150, 105, 0.15);
}
.us-16 {
  display: flex;
  align-items: center;
  gap: 10px;
}
.us-17 {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #059669;
  flex-shrink: 0;
}
.us-18 {
  font-weight: 700;
  font-size: 0.9rem;
  color: #065f46;
}
.us-19 {
  font-size: 0.75rem;
  background: #059669;
  color: white;
  border-radius: 10px;
  padding: 1px 8px;
  font-weight: 600;
}
.us-20 {
  font-size: 0.7rem;
  color: #059669;
}
.us-21 {
  max-height: 65vh;
  overflow-y: auto;
  padding: 8px 12px;
  display: block;
}
.us-22 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  background: rgba(124, 58, 237, 0.04);
  border-bottom: 1px solid rgba(124, 58, 237, 0.15);
}
.us-23 {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #7c3aed;
  flex-shrink: 0;
}
.us-24 {
  font-weight: 700;
  font-size: 0.9rem;
  color: #4c1d95;
}
.us-25 {
  font-size: 0.75rem;
  background: #7c3aed;
  color: white;
  border-radius: 10px;
  padding: 1px 8px;
  font-weight: 600;
}
.us-26 {
  font-size: 0.7rem;
  color: #7c3aed;
}
.us-27 {
  border-bottom: none;
  padding-bottom: 0;
}
.us-28 {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 16px;
  padding-left: 24px;
  padding-right: 24px;
  margin-top: 12px;
}
.us-29 {
  display: flex;
  gap: 4px;
  background: rgba(28, 20, 17, 0.05);
  padding: 4px;
  border-radius: 8px;
  align-items: center;
}
.us-30 {
  padding: 6px 12px;
  font-weight: 500;
  font-size: 0.85rem;
}
.us-31 {
  padding: 6px 12px;
  font-weight: 500;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.us-32 {
  font-size: 0.75rem;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--primary);
  color: white;
  display: none;
}
.us-33 {
  display: flex;
  gap: 10px;
  flex-grow: 1;
  justify-content: flex-end;
}
.us-34 {
  padding: 6px 10px;
  font-size: 0.85rem;
  border-radius: 6px;
  background: white;
  border: 1px solid rgba(28, 20, 17, 0.15);
  width: auto;
}
.us-35 {
  max-height: 550px;
  padding-left: 24px;
  padding-right: 24px;
  padding-bottom: 24px;
}
.us-36 {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.us-37 {
  display: none;
  background: rgba(194, 65, 12, 0.05);
  border: 1px solid rgba(194, 65, 12, 0.2);
}
.us-38 {
  color: var(--text-main);
}
.us-39 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 12px;
  font-size: 0.9rem;
}
.us-40 {
  font-family: monospace;
}
.us-41 {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--card-border);
  padding-bottom: 12px;
}
.us-42 {
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
}
.us-43 {
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-main);
}
.us-44 {
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-main);
  border-left: 3px solid rgba(124, 58, 237, 0.4);
}
.us-45 {
  display: block;
}
.us-46 {
  margin-bottom: 24px;
  padding: 16px 20px;
  display: flex;
  flex-direction: row;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.us-47 {
  flex-grow: 1;
  min-width: 250px;
}
.us-48 {
  font-size: 0.8rem;
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
}
.us-49 {
  width: 100%;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  background: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font);
}
.us-50 {
  width: 150px;
}
.us-51 {
  width: 100%;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  background: #fff;
  font-family: var(--font);
  color: var(--text-main);
  font-weight: 500;
}
.us-52 {
  font-size: 0.8rem;
  color: transparent;
  display: block;
  margin-bottom: 4px;
}
.us-53 {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
}
.us-54 {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--card-border);
}
.us-55 {
  padding: 16px 24px;
  border-bottom: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.01);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.us-56 {
  display: flex;
  align-items: center;
  gap: 16px;
}
.us-57 {
  margin-bottom: 0;
}
.us-58 {
  font-size: 0.85rem;
}
.us-59 {
  display: inline-block;
  width: 12px;
  height: 12px;
  background: rgba(5, 150, 105, 0.12);
  border: 1px solid rgba(5, 150, 105, 0.3);
  border-radius: 3px;
  margin-left: 8px;
  vertical-align: middle;
}
.us-60 {
  display: inline-block;
  width: 12px;
  height: 12px;
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid rgba(220, 38, 38, 0.3);
  border-radius: 3px;
  margin-left: 8px;
  vertical-align: middle;
}
.us-61 {
  margin-left: 8px;
  vertical-align: middle;
}
.us-62 {
  overflow-x: hidden;
  width: 100%;
}
.us-63 {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.7rem;
  table-layout: fixed;
}
.us-63 th,
.us-63 td {
  padding: 5px 6px !important;
  overflow: hidden;
}
.us-63 th.us-74,
.us-63 th.us-75 {
  padding: 5px 2px !important;
}
.us-63 td {
  white-space: normal;
  word-break: break-word;
}
.us-63 input.grid-input-debt,
.us-63 input.grid-input-notes {
  font-size: 0.7rem;
  padding: 3px 4px;
}
.us-64 {
  background: rgba(0, 0, 0, 0.02);
  border-bottom: 2px solid var(--card-border);
}
.us-65 {
  padding: 10px 16px;
  border-right: 1px solid var(--card-border);
  font-weight: 600;
  width: 200px;
}
.us-66 {
  padding: 10px 6px;
  border-right: 1px solid var(--card-border);
  font-weight: 600;
  text-align: center;
  width: 82px;
}
.us-67 {
  padding: 10px 16px;
  border-right: 1px solid var(--card-border);
  font-weight: 600;
  text-align: right;
  width: 140px;
}
.us-68 {
  padding: 6px 16px;
  border-right: 1px solid var(--card-border);
  font-weight: 600;
  text-align: center;
  background: rgba(0, 0, 0, 0.01);
}
.us-69 {
  padding: 10px 16px;
  border-right: 1px solid var(--card-border);
  font-weight: 600;
  text-align: right;
  width: 100px;
}
.us-70 {
  padding: 10px 16px;
  border-right: 1px solid var(--card-border);
  font-weight: 600;
  text-align: right;
  width: 130px;
}
.us-71 {
  padding: 10px 16px;
  border-right: 1px solid var(--card-border);
  font-weight: 600;
  text-align: right;
  width: 120px;
  background: rgba(194, 65, 12, 0.03);
  color: var(--primary);
}
.us-72 {
  padding: 10px 16px;
  font-weight: 600;
  width: 130px;
}
.us-73 {
  background: rgba(0, 0, 0, 0.01);
  border-bottom: 1px solid var(--card-border);
}
.us-74 {
  padding: 6px 2px;
  font-weight: 500;
  font-size: 0.61rem;
  white-space: nowrap;
  text-align: center;
  border-right: 1px solid rgba(0, 0, 0, 0.05);
  width: 68px;
}
.us-75 {
  padding: 6px 2px;
  font-weight: 500;
  font-size: 0.61rem;
  white-space: nowrap;
  text-align: center;
  border-right: 1px solid var(--card-border);
  width: 68px;
}
.us-76 {
  margin-bottom: 24px;
}
.us-77 {
  border-top: 4px solid var(--warning);
}
.us-78 {
  color: var(--warning);
}
.us-79 {
  font-size: 2.2rem;
  font-weight: 700;
}
.us-80 {
  border-top: 4px solid var(--info);
}
.us-81 {
  color: var(--info);
}
.us-82 {
  border-top: 4px solid var(--accent-sand);
}
.us-83 {
  color: var(--accent-sand);
}
.us-84 {
  border-top: 4px solid var(--success);
}
.us-85 {
  color: var(--success);
}
.us-86 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-bottom: 24px;
}
.us-87 {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.us-88 {
  display: none;
  padding-top: 16px;
  border-top: 1px solid var(--card-border);
  margin-top: 16px;
}
.us-89 {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 16px;
}
.us-90 {
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  background: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font);
}
.us-91 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.us-92 {
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.us-93 {
  cursor: pointer;
  font-size: 0.95rem;
}
.us-94 {
  align-self: flex-start;
  padding: 10px 24px;
}
.us-95 {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.us-96 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.us-97 {
  display: flex;
  gap: 12px;
  align-items: center;
}
.us-98 {
  background: var(--primary);
  padding: 8px 16px;
  font-weight: 600;
}
.us-99 {
  padding: 16px 24px;
  background: rgba(0, 0, 0, 0.02);
  border-bottom: 1px solid var(--card-border);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.us-100 {
  flex: 1;
  min-width: 200px;
}
.us-101 {
  font-size: 0.8rem;
  display: block;
  margin-bottom: 4px;
}
.us-102 {
  width: 100%;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  background: #fff;
  font-family: var(--font);
}
.us-103 {
  overflow-x: auto;
}
.us-104 {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}
.us-105 {
  padding: 14px 24px;
  width: 40px;
}
.us-106 {
  padding: 14px 24px;
}
.us-107 {
  padding: 14px 24px;
  width: 120px;
}
.us-108 {
  padding: 14px 24px;
  width: 150px;
}
.us-109 {
  padding: 14px 24px;
  width: 140px;
}
.us-110 {
  padding: 14px 24px;
  width: 130px;
}
.us-111 {
  padding: 14px 24px;
  width: 80px;
  text-align: center;
}
.us-112 {
  max-height: 500px;
}
.us-113 {
  margin-bottom: 18px;
  background: rgba(124, 58, 237, 0.04);
  border: 1px solid rgba(124, 58, 237, 0.15);
  padding: 14px 20px;
}
.us-114 {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: space-between;
}
.us-115 {
  font-weight: 700;
  color: #4c1d95;
  font-size: 0.95rem;
}
.us-116 {
  font-size: 0.82rem;
  margin-top: 4px;
}
.us-117 {
  padding: 7px 12px;
  border-radius: 6px;
  border: 1px solid rgba(124, 58, 237, 0.2);
  background: #fff;
  font-family: inherit;
  font-size: 0.85rem;
  width: 220px;
}
.us-118 {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.us-119 {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  padding-bottom: 2px;
}
.us-120 {
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  background: none;
  border: none;
  border-bottom: 3px solid var(--primary);
  color: var(--primary);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.us-121 {
  margin-top: -1px;
}
.us-122 {
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 500;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.us-123 {
  padding: 20px;
}
.us-124 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: none;
  padding-bottom: 0;
}
.us-125 {
  display: flex;
  align-items: center;
  gap: 12px;
}
.us-126 {
  padding: 6px 10px;
}
.us-127 {
  font-weight: 600;
  font-size: 1.1rem;
  min-width: 145px;
  text-align: center;
  color: var(--text-main);
}
.us-128 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  margin-left: 12px;
}
.us-129 {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  text-align: center;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 20px;
}
.us-130 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--card-border);
}
.us-131 {
  color: var(--text-main);
  font-size: 1.05rem;
}
.us-132 {
  display: flex;
  gap: 8px;
}
.us-133 {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  margin-bottom: 5px;
  flex-wrap: wrap;
  align-items: center;
}
.us-134 {
  display: none;
  padding: 6px 10px;
  font-size: 0.85rem;
  border-radius: 6px;
  background: white;
  border: 1px solid rgba(28, 20, 17, 0.15);
  width: auto;
}
.us-135 {
  padding: 6px 10px;
  font-size: 0.85rem;
  border-radius: 6px;
  background: white;
  border: 1px solid rgba(28, 20, 17, 0.15);
  width: auto;
  flex-grow: 1;
  max-width: 250px;
}
.us-136 {
  max-height: 440px;
  margin-top: 10px;
}
.us-137 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.us-138 {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.us-139 {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  padding: 14px 0 10px;
}
.us-140 {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.us-141 {
  font-size: 0.78rem;
}
.us-142 {
  padding: 6px 10px;
  font-size: 0.85rem;
  border-radius: 6px;
  border: 1px solid rgba(28, 20, 17, 0.15);
  background: white;
}
.us-143 {
  padding: 6px 10px;
  font-size: 0.85rem;
  border-radius: 6px;
  border: 1px solid rgba(28, 20, 17, 0.15);
  background: white;
  min-width: 160px;
}
.us-144 {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-grow: 1;
  min-width: 160px;
}
.us-145 {
  overflow-x: auto;
  max-height: 65vh;
  overflow-y: auto;
}
.us-146 {
  text-align: right;
}
.us-147 {
  padding: 10px 4px;
  font-weight: 600;
}
.us-148 {
  max-width: 460px;
  margin: 40px auto;
  text-align: center;
}
.us-149 {
  font-size: 2rem;
  margin-bottom: 6px;
}
.us-150 {
  justify-content: center;
}
.us-151 {
  font-size: 0.86rem;
  margin: 8px 0 16px;
}
.us-152 {
  width: 100%;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
}
.us-153 {
  width: 100%;
}
.us-154 {
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 10px;
}
.us-155 {
  display: flex;
  gap: 8px;
}
.us-156 {
  font-size: 0.84rem;
  margin: 0 0 14px;
}
.us-157 {
  max-width: 640px;
  background: #ffffff;
}
.us-158 {
  color: #1f1611;
}
.us-159 {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.us-160 {
  margin-top: 6px;
}
.us-161 {
  display: block;
  margin-bottom: 6px;
}
.us-162 {
  background: rgba(194, 65, 12, 0.05);
  border: 1px solid rgba(194, 65, 12, 0.15);
  border-radius: 8px;
  padding: 14px;
  margin-top: 4px;
}
.us-163 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.us-164 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}
.us-165 {
  width: 100%;
}
.us-166 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 20px;
  margin-top: 5px;
}
.us-167 {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.intm-billing-panel {
  display: none;
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border, #e2e2e2);
  border-radius: 8px;
  background: rgba(194, 65, 12, 0.03);
}
.billing-intm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.billing-intm-card {
  border: 1px solid var(--card-border, #e2e2e2);
  border-radius: 10px;
  padding: 16px 18px;
  background: var(--card-bg, #fff);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.billing-intm-card:hover {
  border-color: var(--primary, #c2410c);
  background: rgba(194, 65, 12, 0.04);
}
.billing-intm-card-name {
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}
.billing-intm-card-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.intm-billing-panel.open {
  display: block;
}
.intm-billing-panel .intm-billing-section-title {
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: var(--primary, #c2410c);
}
.us-168 {
  width: auto;
}
.us-169 {
  margin-top: 10px;
}
.us-170 {
  max-width: 600px;
  background: #ffffff;
}
.us-171 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 20px;
}
.us-172 {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-main);
}
.us-173 {
  max-width: 500px;
  background: #ffffff;
}
.us-174 {
  max-width: 560px;
  background: #ffffff;
}
.us-175 {
  color: #1f1611;
}
.us-176 {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.us-177 {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.78rem;
}
.us-178 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-main);
}
.us-179 {
  width: auto;
}
.us-180 {
  max-width: 640px;
  background: #fff;
}
.us-181 {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.us-182 {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
}
.us-183 {
  max-height: 50vh;
  overflow: auto;
}
.us-184 {
  max-width: 480px;
  background: #ffffff;
}
.us-185 {
  max-height: 480px;
  overflow-y: auto;
}
.us-186 {
  margin-top: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.us-187 {
  font-weight: 600;
  font-size: 0.88rem;
  display: block;
  margin-bottom: 6px;
}
.us-188 {
  width: 100%;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid var(--card-border);
}
.us-189 {
  margin-top: 16px;
}
.us-190 {
  font-weight: 600;
  font-size: 0.88rem;
  display: block;
  margin-bottom: 8px;
}
.us-191 {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.us-192 {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--card-border);
}
.us-193 {
  display: none;
  width: 100%;
}
.us-194 {
  color: #1f1611;
  margin: 0;
}
.us-195 {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}
.us-196 {
  padding-top: 8px;
}
.us-197 {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 12px;
}
.us-198 {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.us-199 {
  flex: 1;
  min-width: 120px;
  padding: 4px 10px;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: inherit;
  background: #fff;
  color: var(--text-main);
}
.us-200 {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
}
.us-201 {
  max-width: 1000px;
  width: 95%;
  background: #ffffff;
}
.us-202 {
  color: var(--text-muted);
  text-align: center;
  padding: 30px;
  grid-column: 1/-1;
}
.us-203 {
  margin-bottom: 18px;
}
.us-204 {
  z-index: 3000;
}
.us-205 {
  max-width: 420px;
  text-align: center;
  padding: 40px 32px;
}
.us-206 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}
.us-207 {
  font-size: 0.9rem;
  color: var(--text-muted);
  min-height: 1.2em;
}
.us-208 {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 16px;
}
.us-209 {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}
.us-210 {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  padding: 24px;
  position: relative;
}
.us-211 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.us-212 {
  font-weight: 700;
  color: var(--text-main);
  font-size: 1.15rem;
  margin: 0;
}
.us-213 {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}
.us-214 {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}
.us-215 {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.us-216 {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-main);
}
.us-217 {
  font-size: 0.95rem;
  color: var(--text-main);
}
.us-218 {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
}
.us-219 {
  border: 0;
  border-top: 1px solid var(--card-border);
  margin: 4px 0;
}
.us-220 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}
.us-221 {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
}
.us-222 {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.us-223 {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}
.us-224 {
  opacity: 0;
  width: 0;
  height: 0;
}
.us-225 {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 34px;
}
.us-226 {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
.us-227 {
  padding: 10px 20px;
  font-weight: 600;
}
.us-228 {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}
.us-229 {
  background: #fff;
  border-radius: 14px;
  padding: 28px 32px;
  min-width: 520px;
  max-width: 640px;
  width: 92%;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}
.us-230 {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-muted);
}
.us-231 {
  margin: 0 0 6px;
  font-size: 1.15rem;
  color: var(--text-main);
}
.us-232 {
  margin: 0 0 18px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.us-233 {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--text-main);
}
.us-234 {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.88rem;
  border: 1px solid rgba(28, 20, 17, 0.18);
  border-radius: 8px;
  font-family: var(--font);
  resize: vertical;
  box-sizing: border-box;
}
.us-235 {
  margin-bottom: 24px;
}
.us-236 {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Custom Styles for Automation Rules and report delete */
.btn-delete-selected {
  display: none;
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.25);
}

.report-select-all-header {
  width: 32px;
  text-align: center;
}

.modal-large {
  max-width: 1300px;
  width: 95%;
}

.automation-toolbar {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.label-small {
  font-size: 0.78rem;
}

.input-year-small {
  width: 120px;
  padding: 6px 8px;
  border: 1px solid var(--card-border);
  border-radius: 6px;
}

.ml-auto {
  margin-left: auto;
}

#automation-rule-form {
  display: none;
  margin-top: 16px;
}

.modal-hr {
  margin: 18px 0;
  border: none;
  border-top: 1px solid var(--card-border);
}

.select-preview-client {
  min-width: 260px;
  padding: 6px 8px;
  border: 1px solid var(--card-border);
  border-radius: 6px;
}

.automation-client-preview {
  margin-top: 10px;
}

.sortable-header {
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  white-space: nowrap;
}

.automation-note {
  font-size: 0.82rem;
  margin-bottom: 12px;
}

.back-to-tools-btn {
  margin-bottom: 14px;
}

.d-none {
  display: none;
}

.card-compact {
  margin-bottom: 16px;
  padding: 16px;
}

.settings-title {
  margin: 0 0 8px;
  color: var(--text-main);
}

.lite-mode-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-main);
}

.lite-mode-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.modal-body-pdf {
  padding: 0;
  overflow: hidden;
  height: 70vh;
}

.pdf-iframe-full {
  width: 100%;
  height: 100%;
  border: none;
}

/* Proforma Document Styles */
.proforma-document {
  padding: 30px;
  background: #ffffff;
  color: #1a1a1a;
  font-family: 'Outfit', sans-serif;
  line-height: 1.5;
  border: 1px solid rgba(28, 20, 17, 0.1);
  border-radius: var(--radius);
  margin: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.proforma-header {
  display: flex;
  justify-content: space-between;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 20px;
  margin-bottom: 20px;
}

.proforma-title-box h2 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
  text-transform: uppercase;
}

.proforma-title-box p {
  margin: 5px 0 0;
  font-size: 0.95rem;
  color: #666;
}

.proforma-supplier-details {
  text-align: right;
  font-size: 0.9rem;
}

.proforma-supplier-details h3 {
  margin: 0 0 5px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
}

.proforma-supplier-details p {
  margin: 2px 0;
  color: #555;
}

.proforma-parties-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 35px;
  background: #fdfdfd;
  padding: 15px;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.03);
}

.proforma-party-box h4 {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #eee;
  padding-bottom: 5px;
}

.proforma-party-box p {
  margin: 3px 0;
  font-size: 0.95rem;
  color: #333;
}

.proforma-party-box strong {
  color: #111;
  font-size: 1.05rem;
}

.proforma-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 30px;
}

.proforma-table th {
  background: #f5f5f5;
  color: #444;
  font-weight: 600;
  text-align: left;
  padding: 12px 15px;
  font-size: 0.9rem;
  border-bottom: 2px solid #ddd;
}

.proforma-table td {
  padding: 12px 15px;
  border-bottom: 1px solid #eee;
  font-size: 0.95rem;
  color: #333;
}

.proforma-totals-container {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 30px;
}

.proforma-totals-table {
  width: 350px;
  border-collapse: collapse;
}

.proforma-totals-table td {
  padding: 8px 12px;
  font-size: 0.95rem;
  color: #555;
}

.proforma-totals-table tr.total-row td {
  font-weight: 700;
  font-size: 1.15rem;
  color: #000;
  border-top: 2px solid var(--primary);
  border-bottom: 2px solid var(--primary);
  padding: 12px 12px;
}

.proforma-totals-table tr.total-row.net-row td {
  color: var(--primary);
  background: rgba(28, 20, 17, 0.03);
}

.proforma-payment-info {
  border-top: 1px solid #eee;
  padding-top: 20px;
  font-size: 0.9rem;
  color: #555;
}

.proforma-payment-info h4 {
  margin: 0 0 8px;
  font-weight: 600;
  color: #333;
}

.proforma-payment-info p {
  margin: 3px 0;
}

.proforma-footer-notes {
  margin-top: 30px;
  padding-top: 15px;
  border-top: 1px dashed #ddd;
  font-size: 0.8rem;
  color: #777;
  text-align: center;
  line-height: 1.4;
}

/* Print Specific CSS */
@media print {
  body * {
    visibility: hidden;
  }
  #proforma-print-area, #proforma-print-area * {
    visibility: visible;
  }
  #proforma-print-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
  }
  .modal-backdrop {
    display: none !important;
  }
}

.intm-billing-section-divider {
  border-top: 1px solid var(--card-border);
  margin: 15px 0 10px;
  padding-top: 15px;
}

.intm-billing-section-title {
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.modal-proforma {
  max-width: 900px !important;
  max-height: 90vh !important;
}

.modal-body-scrollable {
  overflow-y: auto;
}

/* Stili per la modale di anteprima notifica */
.notif-input-readonly {
  background-color: var(--background-hover) !important;
}

.notif-textarea-monospace {
  font-family: monospace;
  font-size: 0.95rem;
  width: 100%;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background-color: var(--background-card);
  color: var(--text-color);
}

.notif-checkbox-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.notif-checkbox-input {
  width: auto !important;
  margin: 0 !important;
}

.notif-checkbox-label {
  margin: 0 !important;
  font-weight: normal !important;
  cursor: pointer;
}

/* ---- Dashboard: lista scadenze imminenti (stile minimal a filetto) ---- */
.dd-list { display: flex; flex-direction: column; }
.dd-row {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 0 13px 14px; position: relative;
  border-bottom: 1px solid #f4f1ec;
}
.dd-row:last-child { border-bottom: 0; }
.dd-row::before {
  content: ""; position: absolute; left: 0; top: 13px; bottom: 13px;
  width: 2px; border-radius: 2px; background: var(--dd, #cbd5e1);
}
.dd-main { flex: 1; min-width: 0; }
.dd-title {
  font-size: 0.92rem; font-weight: 600; color: #23262e; letter-spacing: -0.1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dd-meta {
  font-size: 0.76rem; color: #9a9ea7; margin-top: 3px;
  display: flex; align-items: center; gap: 8px;
}
.dd-type { font-size: 0.64rem; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; }
.dd-right { text-align: right; flex: 0 0 auto; }
.dd-amt { font-size: 0.92rem; font-weight: 700; color: #23262e; }
.dd-amt.muted { color: #c4c8d0; font-weight: 500; font-size: 0.8rem; }
.dd-date { font-size: 0.74rem; color: #9a9ea7; margin-top: 2px; }
.dd-date.urgent { color: #dc2626; font-weight: 600; }

/* ---- Dashboard: gruppi di urgenza estendibili ---- */
.dd-group { border-bottom: 1px solid #efece6; }
.dd-group:last-child { border-bottom: 0; }
.dd-group-head {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background: none; border: 0; cursor: pointer; padding: 11px 4px;
  font: inherit; color: #23262e; text-align: left;
}
.dd-group-head:hover { background: #faf9f7; }
.dd-chev { font-size: 0.7rem; color: #9a9ea7; transition: transform 0.15s; display: inline-block; }
.dd-group.open .dd-chev { transform: rotate(90deg); }
.dd-group-label { font-weight: 700; font-size: 0.82rem; }
.dd-group-count {
  font-size: 0.68rem; font-weight: 700; color: #6b7280;
  background: #f0ede8; border-radius: 10px; padding: 1px 8px;
}
.dd-group-total { margin-left: auto; font-weight: 700; font-size: 0.82rem; color: #23262e; }
.dd-group-body { display: none; padding: 0 0 6px 4px; }
.dd-group.open .dd-group-body { display: block; }
.dd-group-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }

/* Pulsante azione sui compensi scaduti in dashboard (leggero, niente effetti GPU). */
.dd-action {
  margin-top: 6px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  background: #16a34a;
  border: 1px solid #15803d;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.dd-action:hover {
  background: #15803d;
}

/* Evidenze clienti dal portale (badge nelle card cliente) */
@keyframes blinkNew {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}
.badge-portal-new {
  font-size: 0.7rem;
  padding: 2px 9px;
  background: #dc2626;
  color: #fff;
  border-radius: 10px;
  font-weight: 700;
  white-space: nowrap;
  animation: blinkNew 1s ease-in-out infinite;
}
.badge-portal-730 {
  font-size: 0.7rem;
  padding: 2px 7px;
  background: rgba(37, 99, 160, 0.1);
  color: #2563a0;
  border: 1px solid rgba(37, 99, 160, 0.25);
  border-radius: 10px;
  white-space: nowrap;
}
.badge-portal-piva {
  font-size: 0.7rem;
  padding: 2px 7px;
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: 10px;
  white-space: nowrap;
}

/* Utility: nasconde gli elementi toggolati via classList (usata dal pannello
   dettaglio Portale Pratiche e dal bottone avanzamento stato). */
.hidden {
  display: none !important;
}

/* Chat pratica: allegati (upload/download) */
.chat-attach-btn {
  flex: 0 0 auto;
  cursor: pointer;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 6px;
  background: #fff;
  font-size: 1rem;
  padding: 0 12px;
  line-height: 1;
}
.chat-attach-btn:hover { border-color: var(--primary); }
.chat-attach-btn:disabled { opacity: .5; cursor: not-allowed; }
.chat-attachment {
  cursor: pointer;
  text-decoration: underline;
  color: var(--primary);
  font-size: 0.85rem;
}
.chat-attachment:hover { color: var(--primary-hover); }

/* Stili portale pratiche: hover ed evidenza selezione */
#portal-submissions-list .list-item {
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 8px;
  cursor: pointer;
  background: #ffffff;
  border: 1px solid var(--card-border);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

#portal-submissions-list .list-item:hover {
  background: rgba(194, 65, 12, 0.03);
  border-color: rgba(194, 65, 12, 0.35);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(28, 20, 17, 0.06);
}

#portal-submissions-list .list-item.active {
  background: rgba(194, 65, 12, 0.06);
  border-color: var(--primary);
  border-left: 4px solid var(--primary);
  box-shadow: inset 4px 0 10px rgba(194, 65, 12, 0.04), 0 4px 12px rgba(194, 65, 12, 0.06);
}


/* ===== Profilo Operatore: card + riquadri ===== */
.op-card {
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: #fff;
  padding: 0 22px 22px;
  margin-bottom: 20px;
  overflow: hidden;
}
.op-card__head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 -22px 18px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--card-border);
  background: linear-gradient(180deg, rgba(194, 65, 12, 0.04), transparent);
}
.op-card__avatar {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent-sand));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #130d0a;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.op-card__name {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.op-card__email {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.op-card__role {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
}
.op-section__label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 16px 0 8px;
}
.op-tiles {
  display: grid;
  gap: 12px;
}
.op-tiles--3 {
  grid-template-columns: repeat(3, 1fr);
}
.op-tile {
  padding: 15px 12px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--card-border);
  text-align: center;
}
.op-tile__val {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-main);
}
.op-tile__val--sm {
  font-size: 1.15rem;
}
.op-tile__cap {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 5px;
}
/* Riquadro credito evidenziato (il dato "soldi") */
.op-tile--accent {
  background: rgba(194, 65, 12, 0.06);
  border-color: rgba(194, 65, 12, 0.22);
}
.op-tile--accent .op-tile__val {
  color: var(--primary);
}
/* Barra riscatto */
.op-payout {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.op-payout__hint {
  font-size: 0.84rem;
  color: var(--text-muted);
}
.op-payout--pending {
  background: #fff7ed;
  border-color: #fed7aa;
}
.op-payout__label {
  font-size: 0.88rem;
  color: #9a3412;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.op-payout__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ea580c;
  flex-shrink: 0;
}

/* Profilo operatore: nota work-in-progress */
.op-wip {
  margin-top: 4px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px dashed var(--card-border);
  background: #f8fafc;
  font-size: 0.84rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
}
.op-wip__tag {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--primary);
  background: rgba(194, 65, 12, 0.08);
  border: 1px solid rgba(194, 65, 12, 0.2);
  border-radius: 6px;
  padding: 2px 7px;
  flex-shrink: 0;
}

/* Pannello "Gestione operatori" (solo admin) */
.op-manage {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--card-border);
}
.op-manage__form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}
.op-manage__form input,
.op-manage__form select {
  flex: 1 1 160px;
  padding: 9px 12px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
}
.op-manage__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.op-manage__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: #f8fafc;
  flex-wrap: wrap;
}
.op-manage__row-info {
  flex: 1 1 160px;
  min-width: 0;
}
.op-manage__row-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
}
.op-manage__row-email {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.op-manage__row-role {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--card-border);
  flex-shrink: 0;
}
.op-manage__row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Suggerimenti dei titoli mentre si scrive una scadenza.
   Nessuna ombra né effetto pesante: bordo e sfondo pieno. */
.title-suggestions {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 30;
  max-height: 240px;
  overflow-y: auto;
  background: var(--card-bg, #fff);
  border: 1px solid var(--card-border, #d4d4d8);
  border-radius: 6px;
}

.title-suggestions.open {
  display: block;
}

.title-suggestion {
  padding: 7px 10px;
  cursor: pointer;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--card-border, #e4e4e7);
}

.title-suggestion:last-child {
  border-bottom: none;
}

.title-suggestion:hover,
.title-suggestion.active {
  background: var(--hover-bg, rgba(124, 58, 237, 0.08));
}

.title-suggestion__type {
  font-size: 0.76rem;
  opacity: 0.7;
}

/* Piano di dilazione: griglie fisse invece di flex-wrap, così i campi non
   vanno a capo in ordine imprevedibile al variare della larghezza. */
.dila-riga {
  display: grid;
  gap: 12px;
}

/* auto-fit invece di colonne fisse + media query: le colonne si adattano
   allo spazio del contenitore, non alla larghezza della finestra. Il modale
   puo essere stretto anche su schermo largo. */
.dila-riga--3 {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.dila-riga--2 {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

/* Data e importo della prima rata raggruppati: appartengono alla stessa
   decisione, e separati si leggevano come due impostazioni slegate. */
.dila-blocco {
  border: 1px solid var(--card-border, #e4e4e7);
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 10px;
}

.dila-blocco__titolo {
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 8px;
  opacity: 0.85;
}

.dila-blocco__nota {
  font-size: 0.78rem;
  opacity: 0.7;
  margin-top: 8px;
}

.dila-facolt {
  font-weight: 400;
  font-size: 0.75rem;
  opacity: 0.65;
}


/* Giorni non lavorativi nel calendario scadenze: nessuna scadenza fiscale può
   cadere di sabato, domenica o festivo (il motore le slitta), quindi vederli
   spiega a colpo d'occhio perché una scadenza è finita più avanti.
   Sfondi pieni e leggeri: niente ombre né effetti pesanti. */
.calendar-day.is-weekend {
  background: rgba(28, 20, 17, 0.11);
  border-color: rgba(28, 20, 17, 0.18);
}

.calendar-day.is-weekend .day-number {
  color: rgba(31, 22, 17, 0.55);
}

/* I festivi nazionali pesano più del weekend: numero in rosso attenuato. */
.calendar-day.is-holiday {
  background: rgba(190, 18, 60, 0.13);
  border-color: rgba(190, 18, 60, 0.3);
}

.calendar-day.is-holiday .day-number {
  color: #be123c;
  opacity: 1;
  font-weight: 600;
}

/* Le scadenze restano la cosa più importante: se un giorno non lavorativo ne
   contiene comunque (storiche o inserite a mano), vince l'evidenza dell'evento. */
.calendar-day.is-weekend.has-events,
.calendar-day.is-holiday.has-events {
  background: rgba(217, 119, 6, 0.07);
  border-color: rgba(217, 119, 6, 0.35);
}

.calendar-day.is-weekend.has-events .day-number,
.calendar-day.is-holiday.has-events .day-number {
  opacity: 1;
}

/* Oggi e la selezione hanno la precedenza su tutto. */
.calendar-day.is-weekend.today,
.calendar-day.is-holiday.today {
  border-color: var(--accent-sand);
  background: rgba(126, 111, 99, 0.05);
}

/* --- Circolari di studio --- */
.circ-switch { display: flex; gap: 8px; margin-bottom: 12px; }
.circ-row { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 16px; cursor: pointer; font-size: 0.9rem; }
.circ-badge { font-size: 0.75rem; padding: 2px 8px; border-radius: 10px;
  background: var(--bg-soft, #f2ede7); }
.circ-badge.ok { color: #2e6b3f; }
.circ-badge.ko { color: #a33; }
.circ-dest-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.circ-dest-table th, .circ-dest-table td { padding: 6px 8px; text-align: left;
  border-bottom: 1px solid var(--border, #e4ddd4); }
.circ-dest-table tr.da-confermare { background: #fdf6e3; }
.circ-origine { font-size: 0.7rem; text-transform: uppercase; opacity: 0.7; }
.circ-toolbar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
  padding: 6px; border: 1px solid var(--border, #e4ddd4); border-bottom: none;
  border-radius: 6px 6px 0 0; }
.circ-tool { padding: 4px 8px; font-size: 0.8rem; line-height: 1; cursor: pointer;
  background: transparent; border: 1px solid transparent; border-radius: 4px; }
.circ-tool:hover { border-color: var(--border, #e4ddd4); }
.circ-tool-sep { width: 1px; height: 16px; background: var(--border, #e4ddd4); margin: 0 4px; }
.circ-editor { min-height: 260px; max-height: 420px; overflow-y: auto; padding: 10px 12px;
  border: 1px solid var(--border, #e4ddd4); border-radius: 0 0 6px 6px;
  font-size: 0.9rem; line-height: 1.5; }
.circ-editor:empty::before { content: attr(data-placeholder); opacity: 0.5; }
.circ-editor h3 { font-size: 1.05rem; margin: 0.6em 0 0.3em; }
.circ-editor p { margin: 0 0 0.6em; }
.circ-editor ul, .circ-editor ol { margin: 0 0 0.6em; padding-left: 1.4em; }
