/* ==============================================================
   SipontoHelper - Stile Globale Responsive (Mobile, Tablet, Desktop)
   Ispirato allo stile di SampleAltraAPP (SKE)
   ============================================================== */

:root {
  --primary-color: #0f172a;
  --primary-accent: #2563eb;
  --primary-accent-hover: #1d4ed8;
  --secondary-color: #475569;
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --success-color: #10b981;
  --success-bg: #ecfdf5;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --danger-bg: #fef2f2;
  --header-bg: #0f172a;
  --header-text: #ffffff;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
}

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

html, body {
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
  position: relative;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================
   HEADER & NAVBAR (Desktop & Mobile)
   ========================================== */
.header {
  background-color: var(--header-bg);
  color: var(--header-text);
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header a {
  text-decoration: none;
  color: inherit;
}

/* Header Master: #1c5d7e */
.header.header-master {
  background-color: #1c5d7e;
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Header Slave: Tonalità calda Bordeaux / Prugna scuro (completamente diversa dal blu del Master) */
.header.header-slave {
  background-color: #581c4f;
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  min-width: 0;
  flex: 1;
}

.header-brand a {
  display: flex;
  align-items: center;
  line-height: 1;
  text-decoration: none;
  flex-shrink: 0;
}

/* Scritte dell'header BIANCHE per Master e Slave */
.header .header-logo {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #ffffff !important;
  background: none !important;
  -webkit-text-fill-color: #ffffff !important;
  line-height: 1;
  display: inline-block;
}

.header .nome-cognome-header {
  color: #ffffff !important;
  opacity: 0.95;
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100vw - 110px);
  display: inline-block;
  line-height: 1;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
  height: 100%;
}

.header-right > li {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  margin: 0;
  padding: 0;
}

.header-right a {
  color: #ffffff;
  opacity: 0.9;
  font-size: 0.92rem;
  font-weight: 500;
  transition: opacity 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}

.header-right a:hover,
.header-right a.active {
  color: #ffffff;
  opacity: 1;
  font-weight: 700;
}

.logout-button,
.panel-logout-btn {
  background: #dc2626;
  color: #ffffff;
  border: none;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
  transition: background-color 0.2s;
}

.logout-button:hover,
.panel-logout-btn:hover {
  background-color: #b91c1c;
}

/* ==========================================
   HAMBURGER & MOBILE DRAWER (Offcanvas)
   ========================================== */
.hamburger-header {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 26px;
  height: 18px;
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
  flex-shrink: 0;
}

.hamburger-line {
  height: 2.5px;
  background-color: #ffffff !important;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.container-header-panel {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 1100;
  backdrop-filter: blur(2px);
}

.container-header-panel.show {
  display: block;
}

.header-panel {
  position: fixed;
  top: 0;
  right: -320px;
  width: 290px;
  max-width: 85vw;
  height: 100vh;
  z-index: 1200;
  padding: 24px 20px;
  box-shadow: -5px 0 25px rgba(0,0,0,0.3);
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  color: #ffffff;
}

.header-panel.show {
  right: 0;
}

.header-panel-master {
  background-color: #15465f;
}

.header-panel-slave {
  background-color: #3d1236;
}

.panel-group-badge {
  margin-top: 10px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.panel-group-title {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  margin-top: 4px;
}

.panel-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 1.4rem;
  cursor: pointer;
  opacity: 0.85;
}
.panel-close-btn:hover {
  opacity: 1;
}

.panel-section {
  margin-bottom: 24px;
}

.panel-section-title {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #38bdf8;
  margin-bottom: 12px;
}

.panel-section ul {
  list-style: none;
}

.panel-section li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  color: #e2e8f0;
  text-decoration: none;
  font-size: 0.95rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.panel-section li a:hover {
  color: #38bdf8;
}

.panel-logout {
  margin-top: 30px;
  padding-top: 15px;
  border-top: 1px solid #334155;
}

.panel-logout-btn {
  width: 100%;
  justify-content: center;
  padding: 10px;
}

/* ==========================================
   LAYOUT PRINCIPALE
   ========================================== */
.main-container {
  max-width: 1140px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px;
  flex: 1;
}

.page-header {
  margin-bottom: 24px;
}

.page-title {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==========================================
   CARDS & BOTTONI PRINCIPALI
   ========================================== */
.siponto-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 24px;
  transition: transform 0.15s, box-shadow 0.15s;
}

/* ==========================================
   METRICHE / STATISTICHE
   ========================================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-value {
  font-size: 1.65rem;
  font-weight: 800;
  color: #0f172a;
  margin-top: 4px;
  line-height: 1.1;
}

/* ==========================================
   TABELLE RESPONSIVE
   ========================================== */
.table-wrapper {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  margin-bottom: 24px;
  -webkit-overflow-scrolling: touch;
}

.siponto-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.siponto-table th {
  background-color: #f1f5f9;
  padding: 12px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.siponto-table td {
  padding: 14px 16px;
  font-size: 0.92rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.siponto-table tr:last-child td {
  border-bottom: none;
}

.siponto-table tr:hover {
  background-color: #f8fafc;
}

/* ==========================================
   FORMS & BOTTONI
   ========================================== */
.form-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
  display: block;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid #cbd5e1;
  font-size: 0.95rem;
  color: var(--text-main);
  background-color: #ffffff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-select {
  width: 100%;
  padding: 10px 36px 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid #cbd5e1;
  font-size: 0.95rem;
  color: var(--text-main);
  background-color: #ffffff;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23334155'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-select-sm {
  padding: 6px 32px 6px 10px;
  font-size: 0.85rem;
  background-position: right 10px center;
  background-size: 14px 14px;
}

.form-control:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.btn-primary-action {
  background-color: var(--primary-accent);
  color: #ffffff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.15s;
  text-decoration: none;
}

.btn-primary-action:hover {
  background-color: var(--primary-accent-hover);
  color: #ffffff;
}

.btn-secondary-action {
  background-color: #e2e8f0;
  color: #334155;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.15s;
}

.btn-secondary-action:hover {
  background-color: #cbd5e1;
}

/* Pulsanti Azione Avvisi Configurazione Mancante (Dimensione Uniforme & Mobile Responsive) */
.btn-missing-action {
  min-width: 250px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e293b;
  background-color: #ffc107;
  border: 1px solid #eab308;
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  box-shadow: 0 2px 5px rgba(217, 119, 6, 0.2);
  text-decoration: none;
  transition: all 0.15s ease-in-out;
  white-space: nowrap;
}

.btn-missing-action:hover {
  background-color: #f59e0b;
  color: #0f172a;
  box-shadow: 0 3px 8px rgba(217, 119, 6, 0.3);
}

@media (max-width: 576px) {
  .btn-missing-action {
    width: 100% !important;
    min-width: 100% !important;
    margin-top: 6px;
    white-space: normal;
  }
}

.btn-icon {
  background: none;
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background-color: #f1f5f9;
  color: var(--primary-accent);
  border-color: #cbd5e1;
}

.btn-icon.btn-danger-icon:hover {
  background-color: var(--danger-bg);
  color: var(--danger-color);
  border-color: #fca5a5;
}

/* ==========================================
   BANNER & NOTIFICHE
   ========================================== */
.alert-banner {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.92rem;
  font-weight: 500;
}

.alert-banner.alert-ok {
  background-color: var(--success-bg);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-banner.alert-err {
  background-color: var(--danger-bg);
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* ==========================================
   MODALI / POPUP (Bootstrap 5)
   ========================================== */
.modal-content {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
}
.modal-backdrop {
  z-index: 2040 !important;
}
.modal {
  z-index: 2050 !important;
}
.modal-backdrop + .modal-backdrop {
  display: none !important;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

/* ==========================================
   SLAVE AUTO-SAVE PILL
   ========================================== */
.auto-save-pill {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 30px;
  font-size: 0.86rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 1050;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.auto-save-pill.saving {
  background: #d97706;
}

.auto-save-pill.saved {
  background: #059669;
}

.auto-save-pill.error {
  background: #dc2626;
}

/* ==========================================
   RESPONSIVE DESIGN (MEDIA QUERIES)
   ========================================== */
@media (max-width: 992px) {
  .header-right {
    display: none;
  }
  .hamburger-header {
    display: flex;
  }
}

@media (max-width: 576px) {
  .main-container {
    padding: 14px 10px;
  }
  .page-title {
    font-size: 1.25rem;
  }
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 14px;
  }
  .stat-card {
    padding: 10px 8px;
    border-radius: 8px;
  }
  .stat-label {
    font-size: 0.68rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .stat-value {
    font-size: 1.3rem;
  }
  .siponto-card {
    padding: 14px 10px;
    margin-bottom: 14px;
    border-radius: 10px;
  }
}

/* ==========================================
   REGISTRAZIONE PROCLAMATORI (Stile SampleAPP)
   ========================================== */
.reg-page {
  max-width: 540px;
  margin: 32px auto;
  padding: 0 16px;
}

.reg-card {
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  padding: 28px 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.reg-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 4px;
}

.reg-subtitle {
  font-size: 0.88rem;
  color: #64748b;
  margin-bottom: 24px;
}

.reg-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  margin: 18px 0 10px 0;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 6px;
}

.reg-row {
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
}

.reg-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

.reg-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.reg-input {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 0.92rem;
  color: #0f172a;
  background-color: #ffffff;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}

.reg-input:focus {
  border-color: #2563eb;
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.reg-btn-submit {
  width: 100%;
  background-color: #2563eb;
  color: #ffffff;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  transition: background-color 0.2s, transform 0.1s;
}

.reg-btn-submit:hover {
  background-color: #1d4ed8;
}

.reg-errore {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 14px 16px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.banner-reg-ok {
  background-color: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  padding: 14px 16px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==========================================
   MINIMAL SLAVE UI STYLES & MOBILE FIRST
   ========================================== */
.slave-page-container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Navigatore Mese: Mostra SOLO il mese, pulito e moderno */
.month-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  box-sizing: border-box;
}

.month-nav-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.3px;
  text-transform: capitalize;
  user-select: none;
}

.month-nav-arrow {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #334155;
  text-decoration: none;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.month-nav-arrow:hover {
  background: #1c5d7e;
  color: #ffffff;
  border-color: #1c5d7e;
}

.month-nav-arrow.disabled {
  opacity: 0.25;
  cursor: not-allowed;
  pointer-events: none;
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #94a3b8;
}

/* ==========================================
   RIEPILOGO ATTIVITÀ ESTENDIBILE (ACCORDION)
   ========================================== */
.summary-accordion-container {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.summary-accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #ffffff;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s ease;
  box-sizing: border-box;
}

.summary-accordion-header:hover {
  background-color: #f8fafc;
}

.summary-header-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}

@media (min-width: 768px) {
  .summary-header-left {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }
}

.summary-header-icon {
  color: #581c4f;
  font-size: 1.1rem;
}

.summary-header-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
}

.summary-header-badge {
  background-color: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.summary-toggle-hint {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 500;
}

.summary-chevron {
  color: #64748b;
  font-size: 0.85rem;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.summary-accordion-container.open .summary-chevron {
  transform: rotate(180deg);
}

.summary-accordion-body {
  display: none;
  padding: 0 14px 14px 14px;
  border-top: 1px solid #f1f5f9;
  background-color: #fafbfc;
}

.summary-accordion-container.open .summary-accordion-body {
  display: block;
}

/* ==============================================================
   RIEPILOGO GRUPPO SEMPLIFICATO (4 CARD PULITE TUTTE UGUALI)
   ============================================================== */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 12px;
  margin-top: 12px;
}

.summary-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-height: 102px;
}

.summary-box-progress {
  background: #faf5ff;
  border-color: #e9d5ff;
}

.summary-box-title {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.dot-proc  { background-color: #2563eb; }
.dot-pa    { background-color: #ea580c; }
.dot-pr    { background-color: #166534; }
.dot-tot   { background-color: #10b981; }
.dot-prog  { background-color: #9333ea; }
.dot-irreg { background-color: #f59e0b; }
.dot-warn  { background-color: #dc2626; }

/* Summary Box diviso in 2 righe (Sopra Irregolari, Sotto Inattivi) */
.summary-box-split {
  justify-content: center;
  gap: 0;
  padding: 8px 14px;
}

.summary-split-row {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
}

.summary-split-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  color: #475569;
  white-space: nowrap;
}

.summary-split-num {
  font-size: 1.3rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
}

.summary-split-divider {
  width: 100%;
  height: 1px;
  background-color: #e2e8f0;
  margin: 4px 0;
}

.summary-box-main {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 4px;
}

.summary-box-num {
  font-size: 1.55rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
}

.summary-box-unit {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 600;
  white-space: nowrap;
}

.summary-box-sub {
  font-size: 0.8rem;
  color: #334155;
  font-weight: 600;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin: 4px 0;
}

.summary-progress-bar-fill {
  height: 100%;
  background: #10b981;
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Pulsante discreto Aggiungi Proclamatore (fine pagina) */
.btn-slave-add-person-subtle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  color: #475569;
  border: 1px dashed #cbd5e1;
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-slave-add-person-subtle:hover {
  background: #ffffff;
  color: #0f172a;
  border-color: #94a3b8;
  border-style: solid;
}

/* ==============================================================
   SCHEDE PROCLAMATORI: COMPATTE, SPAZIO-EFFICIENTI E INTUITIVE
   ============================================================== */
.proclamatore-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 5px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: all 0.15s ease;
  width: 100%;
  box-sizing: border-box;
}

.proclamatore-card.is-pending {
  border-left: 5px solid #f59e0b !important;
  background-color: #fffdfa;
}

.proclamatore-card.is-compiled {
  border-left: 5px solid #10b981 !important;
  background-color: #ffffff;
}

.proclamatore-card.is-inactive-card {
  border-left: 5px solid #94a3b8 !important;
  background-color: #f8fafc;
  opacity: 0.85;
}

.badge-inattivo-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  background-color: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

.card-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  width: 100%;
}

.person-fullname {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  line-height: 1.2;
}

.status-symbol {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  user-select: none;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.status-symbol.status-symbol-ok {
  background: #10b981;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.35);
}

.status-symbol.status-symbol-warn {
  background: #f59e0b;
  color: #ffffff;
  font-weight: 900;
  box-shadow: 0 1px 3px rgba(245, 158, 11, 0.3);
}

.status-symbol.status-symbol-inactive {
  background: #e2e8f0;
  color: #64748b;
  font-weight: 800;
}

/* Riga Controlli Tabellare Compatta */
.card-controls-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  flex-wrap: nowrap;
}

.col-part {
  width: 76px;
  flex: 0 0 76px;
}

.col-pa {
  width: 38px;
  flex: 0 0 38px;
}

.col-ore {
  width: 84px;
  flex: 0 0 84px;
}

.col-studi {
  width: 84px;
  flex: 0 0 84px;
}

.col-pioneer-badge {
  width: 120px;
  height: 38px;
  flex: 0 0 120px;
  display: inline-flex;
  box-sizing: border-box;
}

.col-pioneer-badge .role-badge {
  height: 100%;
  width: 100%;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  white-space: nowrap;
}

/* Gruppo SÌ / NO Segmentato Compatto */
.part-toggle-group {
  display: inline-flex;
  align-items: stretch;
  width: 76px;
  height: 38px;
  border-radius: 8px;
  background: #f1f5f9;
  padding: 2px;
  border: 1px solid #cbd5e1;
  box-sizing: border-box;
}

.btn-part-pill {
  border: none;
  background: transparent;
  height: 100%;
  flex: 1;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 6px;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-sizing: border-box;
}

.btn-part-pill:hover {
  color: #1e293b;
}

.btn-part-pill.btn-part-si.selected {
  background: #10b981;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.3);
}

.btn-part-pill.btn-part-no.selected {
  background: #64748b;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(100, 116, 139, 0.25);
}

/* Bottone PA Compatto */
.btn-pa-pill {
  height: 38px;
  width: 38px;
  padding: 0;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.btn-pa-pill:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #334155;
}

.btn-pa-pill.active {
  background: #ffedd5 !important;
  border-color: #fed7aa !important;
  color: #9a3412 !important;
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(249, 115, 22, 0.2);
}

/* Gruppo Input Compatto con Etichetta Integrata (Ore, Studi):
   Dimensioni matematicamente identiche sia per l'etichetta che per il numero */
.compact-input-group {
  display: inline-flex;
  align-items: stretch;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  height: 38px;
  width: 84px;
  min-width: 84px;
  max-width: 84px;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
  cursor: text;
}

.compact-input-group:focus-within {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.col-ore-inactive {
  opacity: 0.45;
  background: #f8fafc !important;
  border-style: dashed !important;
  cursor: not-allowed !important;
}

.col-ore-inactive input {
  cursor: not-allowed !important;
  color: #94a3b8 !important;
}

.compact-input-label {
  width: 38px !important;
  min-width: 38px !important;
  max-width: 38px !important;
  flex: 0 0 38px !important;
  padding: 0 !important;
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  user-select: none;
  background: #f1f5f9;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-right: 1px solid #e2e8f0;
  pointer-events: none;
  box-sizing: border-box;
}

.compact-field-input {
  border: none;
  background: transparent;
  height: 100%;
  width: 44px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  flex: 0 0 44px !important;
  text-align: center;
  font-size: 1.12rem;
  font-weight: 800;
  color: #0f172a;
  padding: 0 !important;
  box-sizing: border-box;
  outline: none;
  -moz-appearance: textfield;
  appearance: textfield;
}

.compact-field-input::-webkit-outer-spin-button,
.compact-field-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Pulsante Note Compatto nel Bordo Destro */
.btn-note-compact {
  height: 28px;
  width: 32px;
  padding: 0;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 7px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  user-select: none;
  flex-shrink: 0;
}

.btn-note-compact:hover {
  background: #f8fafc;
  color: #1e293b;
}

.btn-note-compact.has-note {
  background: #dcfce7 !important;
  border-color: #86efac !important;
  color: #15803d !important;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(22, 163, 74, 0.2);
}

.role-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 5px;
  letter-spacing: 0.2px;
  display: inline-flex;
  align-items: center;
}

.role-badge-pr {
  background-color: #dcfce7 !important;
  color: #166534 !important;
  border: 1px solid #bbf7d0 !important;
}

.role-badge-pa {
  background-color: #ffedd5 !important;
  color: #9a3412 !important;
  border: 1px solid #fed7aa !important;
}

.role-badge-proc {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.note-expand-pane {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 6px;
}

.note-pane-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
}

.btn-close-note {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.btn-close-note:hover {
  color: #ef4444;
}

.field-textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.88rem;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
}

.field-textarea:focus {
  border-color: #2563eb;
  outline: none;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

@media (max-width: 576px) {
  .proclamatore-card {
    padding: 9px 11px;
    margin-bottom: 7px;
  }
  .person-fullname {
    font-size: 1rem;
  }
  .card-controls-row {
    gap: 6px;
  }
  .compact-input-label {
    padding: 0 !important;
    font-size: 0.7rem;
  }
  .compact-field-input {
    font-size: 1.12rem;
  }
}

/* ==============================================================
   PC / DESKTOP (>= 768px): MOSTRA LE COSE UN PO' PIÙ GRANDI MA NON ESAGERATE
   ============================================================== */
@media (min-width: 768px) {
  .proclamatore-card {
    padding: 13px 18px;
    margin-bottom: 10px;
    border-radius: 12px;
  }

  .person-fullname {
    font-size: 1.15rem;
  }

  .status-symbol {
    width: 32px;
    height: 32px;
    font-size: 0.95rem;
  }

  .btn-note-compact {
    height: 34px;
    width: 38px;
    font-size: 0.95rem;
  }

  .card-controls-row {
    gap: 10px;
  }

  .col-part {
    width: 88px;
    min-width: 88px;
    max-width: 88px;
    flex: 0 0 88px;
  }

  .part-toggle-group {
    width: 88px;
    height: 42px;
  }

  .btn-part-pill {
    font-size: 0.9rem;
  }

  .col-pa {
    width: 46px;
    min-width: 46px;
    max-width: 46px;
    flex: 0 0 46px;
  }

  .btn-pa-pill {
    height: 42px;
    width: 46px;
    font-size: 0.88rem;
  }

  .col-ore {
    width: 92px;
    min-width: 92px;
    max-width: 92px;
    flex: 0 0 92px;
  }

  .col-studi {
    width: 92px;
    min-width: 92px;
    max-width: 92px;
    flex: 0 0 92px;
  }

  .compact-input-group {
    height: 42px;
    width: 92px;
    min-width: 92px;
    max-width: 92px;
  }

  .compact-input-label {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
    flex: 0 0 42px !important;
    padding: 0 !important;
    font-size: 0.76rem;
  }

  .compact-field-input {
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    flex: 0 0 48px !important;
    padding: 0 !important;
    font-size: 1.2rem;
  }

  .col-pioneer-badge {
    width: 144px; /* 88 + 46 + 10 gap */
    min-width: 144px;
    max-width: 144px;
    flex: 0 0 144px;
    height: 42px;
  }

  .col-pioneer-badge .role-badge {
    font-size: 0.9rem;
  }
}

/* ==========================================
   BREAKPOINTS: MOBILE (< 768px)
   ========================================== */
@media (max-width: 767px) {
  /* ==============================================================
     OTTIMIZZAZIONE MOBILE & IPHONE (iOS SAFARI)
     Regola d'oro: font-size >= 16px per evitare categoricamente
     lo zoom automatico e lo slittamento orizzontale della videata
     ============================================================== */
  input[type="text"],
  input[type="password"],
  input[type="number"],
  input[type="email"],
  input[type="tel"],
  input[type="search"],
  select,
  textarea,
  .form-control,
  .form-select,
  .reg-input,
  .field-textarea {
    font-size: 16px !important;
  }

  .main-container {
    padding: 12px 10px;
    max-width: 100%;
    overflow-x: hidden;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 1fr;
    gap: 8px;
  }

  .summary-box {
    width: 100%;
    height: 100%;
    min-height: 98px;
    min-width: 0;
    overflow: hidden;
    box-sizing: border-box;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
  }

  .stat-card {
    min-width: 0;
    overflow: hidden;
    padding: 12px 10px;
    border-radius: 10px;
    box-sizing: border-box;
  }

  .stat-label {
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .stat-value {
    font-size: 1.25rem;
    word-break: break-word;
  }
}

/* ==========================================
   PARACADUTE RESPONSIVE: 360px e 320px
   ========================================== */
@media (max-width: 480px) {
  .reg-row {
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
  }
  .reg-card {
    padding: 20px 14px;
  }
}

@media (max-width: 360px) {
  .main-container {
    padding: 10px 6px;
  }
  .siponto-card {
    padding: 12px 8px;
    margin-bottom: 12px;
  }
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-bottom: 10px;
  }
  .stat-card {
    padding: 8px 6px;
  }
  .stat-label {
    font-size: 0.62rem;
  }
  .stat-value {
    font-size: 1.15rem;
  }
  .header .header-logo {
    font-size: 1.15rem;
  }
  .header .nome-cognome-header {
    font-size: 0.82rem;
    max-width: calc(100vw - 90px);
  }
  .month-nav-title {
    font-size: 1.1rem;
  }
  .month-nav-arrow {
    width: 32px;
    height: 32px;
  }
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 1fr;
    gap: 6px;
  }
  .summary-box {
    width: 100%;
    height: 100%;
    min-height: 92px;
    padding: 8px 8px;
  }
  .summary-box-num {
    font-size: 1.15rem;
  }
  .summary-box-sub {
    font-size: 0.72rem;
  }
}

@media (max-width: 320px) {
  .main-container {
    padding: 6px 4px;
  }
  .siponto-card {
    padding: 8px 6px;
    margin-bottom: 8px;
  }
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    margin-bottom: 8px;
  }
  .stat-card {
    padding: 6px 4px;
  }
  .stat-label {
    font-size: 0.56rem;
  }
  .stat-value {
    font-size: 1.05rem;
  }
  .header .header-logo {
    font-size: 1.05rem;
  }
  .header .nome-cognome-header {
    font-size: 0.74rem;
    max-width: calc(100vw - 80px);
  }
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 1fr;
    gap: 5px;
  }
}

/* ============================================================
   Service Years Responsive Styles
   ============================================================ */
.active-year-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  color: #0f172a;
  line-height: 1.3;
}
.active-year-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  letter-spacing: 0.4px;
  border-radius: 6px;
  white-space: nowrap;
}
.active-year-period {
  font-size: 0.92rem;
  color: #475569;
}
.service-year-mobile-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 14px 12px 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.service-year-mobile-card.is-active {
  border-left: 4px solid #10b981;
}
.service-year-mobile-card.is-closed {
  border-left: 4px solid #94a3b8;
}
.service-year-card-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
}
.service-year-card-period {
  font-size: 0.88rem;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 6px;
}
.service-year-card-actions {
  display: flex;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
  margin-top: 4px;
}
.service-year-card-actions .btn {
  flex: 1;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .active-year-title {
    font-size: 1.05rem;
    font-weight: 700;
  }
  .active-year-badge {
    font-size: 0.72rem;
    padding: 3px 8px;
  }
  .active-year-period {
    font-size: 0.84rem;
  }
}

@media (max-width: 576px) {
  .service-years-page-header {
    flex-direction: column;
    align-items: stretch !important;
    gap: 12px !important;
  }
  .service-years-page-header .btn-primary-action {
    width: 100%;
    justify-content: center;
  }
  .service-year-card-actions {
    flex-wrap: wrap;
  }
  .service-year-card-actions .btn {
    flex: 1 1 calc(33.333% - 6px);
    min-width: 80px;
  }
}

/* ============================================================
   MASTER NAV (Riepilogo · Report · Anagrafica · ⚙ · Esci)
   ============================================================ */
.mnav {
  height: 100%;
  display: flex;
  align-items: center;
}
.mnav-list {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
  height: 100%;
}
.mnav-item {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
}
.mnav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.88) !important;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.mnav-link:hover,
.mnav-item.mnav-has-menu:hover > .mnav-link,
.mnav-item.mnav-has-menu:focus-within > .mnav-link {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff !important;
}
.mnav-link.active {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff !important;
  font-weight: 700;
}
.mnav-icon-only {
  padding: 8px 10px;
}
.mnav-icon-only .fa-gear {
  font-size: 1.05rem;
}
.mnav-caret {
  font-size: 0.65rem;
  opacity: 0.8;
  transition: transform 0.2s ease;
}
.mnav-item.mnav-has-menu:hover .mnav-caret,
.mnav-item.mnav-has-menu:focus-within .mnav-caret {
  transform: rotate(180deg);
}

/* Tendina */
.mnav-menu {
  position: absolute;
  top: calc(100% - 8px);
  left: 0;
  min-width: 210px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  padding: 6px;
  display: none;
  z-index: 1050;
}
.mnav-menu-right {
  left: auto;
  right: 0;
}
.mnav-item.mnav-has-menu:hover .mnav-menu,
.mnav-item.mnav-has-menu:focus-within .mnav-menu {
  display: block;
}
.mnav-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: #334155 !important;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.mnav-menu a i {
  width: 16px;
  text-align: center;
  color: #94a3b8;
}
.mnav-menu a:hover {
  background: #f1f5f9;
  color: #1c5d7e !important;
}
.mnav-menu a:hover i {
  color: #1c5d7e;
}
.mnav-menu a.active {
  background: #e0f2fe;
  color: #1c5d7e !important;
  font-weight: 700;
}
.mnav-menu a.active i {
  color: #1c5d7e;
}

/* Esci: discreto */
.mnav-logout {
  margin-left: 8px;
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  height: 28px;
  align-self: center;
}
.mnav-logout form {
  margin: 0;
  display: flex;
  align-items: center;
}
.mnav-logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.mnav-logout-btn:hover {
  background: #dc2626;
  border-color: #dc2626;
}

/* Pannello mobile: voce attiva */
.panel-section li a.active {
  color: #ffffff;
  font-weight: 700;
}
.panel-section li a.active i {
  color: #38bdf8;
}

@media (max-width: 992px) {
  .mnav {
    display: none;
  }
}

/* ==========================================
   MASTER RIEPILOGO & TABELLA SPREADSHEET
   ========================================== */
.master-group-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease;
}

.master-group-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.master-group-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  cursor: pointer;
  background: #ffffff;
  user-select: none;
}

.master-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
}

.master-group-name-wrap {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.master-group-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  background-color: #1c5d7e;
}

.master-group-dot.dot-complete {
  background-color: #10b981;
}

.master-group-dot.dot-pending {
  background-color: #f59e0b;
}

.master-group-dot.dot-empty {
  background-color: #94a3b8;
}

.master-group-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: nowrap;
}

.master-group-status-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.master-group-actions-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.btn-open-group {
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  padding: 5px 11px !important;
  border-radius: 8px !important;
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.compilation-pill {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.compilation-pill.complete {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.compilation-pill.pending {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.compilation-pill.empty {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.master-group-progress {
  width: 72px;
  height: 7px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}

.master-group-progress-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.master-group-chevron {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 0.85rem;
  transition: transform 0.25s ease, background 0.2s ease;
  flex-shrink: 0;
}

.master-group-chevron.open {
  transform: rotate(180deg);
  background: #e2e8f0;
  color: #0f172a;
}

.master-group-body {
  border-top: 1px solid #f1f5f9;
  padding: 16px 18px;
  background: #fafbfd;
}

/* Lista Proclamatori dentro l'Accordion (Colonne Allineate) */
.group-person-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.88rem;
}

.group-person-row:last-child {
  border-bottom: none;
}

.group-person-row:hover {
  background: #f8fafc;
}

.gp-col-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.gp-status-icon {
  width: 18px;
  flex: 0 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.gp-person-name {
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gp-col-metrics {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.gp-col-role {
  width: 52px;
  flex: 0 0 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gp-role-badge {
  width: 44px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  box-sizing: border-box;
}

.gp-col-activity {
  width: 96px;
  flex: 0 0 96px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.gp-metric-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.gp-metric-hours {
  color: #334155;
}

.gp-metric-active {
  color: #059669;
}

.gp-metric-inactive {
  color: #d97706;
}

.gp-col-studies {
  width: 78px;
  flex: 0 0 78px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.gp-studies-text {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  color: #475569;
  white-space: nowrap;
}

.gp-col-note {
  width: 26px;
  flex: 0 0 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gp-note-badge {
  width: 24px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 0.75rem;
}

/* 96px (activity) + 8px (gap) + 78px (studies) + 8px (gap) + 26px (note) = 216px */
.gp-col-pending {
  width: 216px;
  flex: 0 0 216px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.gp-pending-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 5px;
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

@media (min-width: 768px) {
  .master-group-status-wrap {
    min-width: 245px;
    justify-content: flex-start;
  }
}

@media (max-width: 767px) {
  .master-group-header {
    padding: 12px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .master-group-title {
    width: 100%;
    justify-content: space-between;
    font-size: 0.98rem;
  }
  .master-group-meta {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
    margin-top: 0;
    flex-wrap: nowrap;
  }
  .master-group-status-wrap {
    gap: 6px;
    min-width: 0;
  }
  .master-group-actions-wrap {
    gap: 6px;
    margin-left: auto;
  }
  .btn-open-group {
    font-size: 0.76rem !important;
    padding: 4px 9px !important;
  }
  .compilation-pill {
    font-size: 0.74rem;
    padding: 3px 8px;
  }
  .master-group-progress {
    width: 40px;
  }
  .group-person-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 10px 8px;
  }
  .gp-col-metrics {
    width: 100%;
    padding-left: 26px;
    gap: 6px;
  }
  .gp-col-role {
    width: 46px;
    flex: 0 0 46px;
    justify-content: flex-start;
  }
  .gp-col-activity {
    width: 86px;
    flex: 0 0 86px;
  }
  .gp-col-studies {
    width: 70px;
    flex: 0 0 70px;
  }
  .gp-col-note {
    width: 24px;
    flex: 0 0 24px;
  }
  /* 86 + 6 + 70 + 6 + 24 = 192px */
  .gp-col-pending {
    width: 192px;
    flex: 0 0 192px;
  }
}

/* Pulsanti Azione Uniformi per Tabelle Anni di Servizio */
.btn-year-action {
  width: 92px !important;
  min-width: 92px !important;
  max-width: 92px !important;
  height: 32px !important;
  padding: 0 4px !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  white-space: nowrap !important;
  border-radius: 6px !important;
  box-sizing: border-box !important;
  flex-shrink: 0 !important;
}

/* ============================================================
   SEZIONE REPORT (Anno di Servizio · Per Gruppo · Per Proclamatore)
   Design pulito, snello e 100% responsive
   ============================================================ */
.report-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.report-tabs {
  display: flex;
  background: #e2e8f0;
  padding: 4px;
  border-radius: 10px;
  gap: 4px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.report-tab-link {
  flex: 1 1 0;
  min-width: 0;
  padding: 7px 12px;
  border-radius: 7px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  text-align: center;
}

.report-tab-link:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.5);
}

.report-tab-link.active {
  background: #ffffff;
  color: #1c5d7e;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.report-filter-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.report-filter-form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.report-filter-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.report-filter-title {
  font-weight: 700;
  color: #0f172a;
  font-size: 0.98rem;
}

.report-filter-stats {
  font-size: 0.84rem;
}

.report-year-select-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-select-label {
  font-size: 0.84rem;
  color: #475569;
  font-weight: 600;
}

.report-year-select {
  min-width: 220px;
  height: 38px;
  padding: 6px 36px 6px 12px !important;
  font-size: 0.88rem !important;
  font-weight: 600 !important;
  color: #0f172a !important;
  background-color: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 8px !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%231c5d7e'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 18px 18px !important;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all 0.15s ease;
}

.report-year-select:hover {
  border-color: #1c5d7e !important;
}

.report-year-select:focus {
  border-color: #1c5d7e !important;
  box-shadow: 0 0 0 3px rgba(28, 93, 126, 0.15) !important;
  outline: none;
}

.report-search-input {
  height: 38px;
  font-size: 0.88rem !important;
  border-radius: 8px !important;
  border: 1.5px solid #cbd5e1 !important;
  padding: 6px 32px 6px 12px !important;
  color: #0f172a !important;
  background-color: #ffffff !important;
  transition: all 0.15s ease;
}

.report-search-input:focus {
  border-color: #1c5d7e !important;
  box-shadow: 0 0 0 3px rgba(28, 93, 126, 0.15) !important;
  outline: none;
}

.btn-clear-search {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.95rem;
  padding: 2px 6px;
  cursor: pointer;
  z-index: 5;
}

.btn-clear-search:hover {
  color: #0f172a;
}

/* Dropdown Suggerimenti per Ricerca Proclamatore */
.report-search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1050;
  background: #ffffff;
  border: 1.5px solid #1c5d7e;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
  max-height: 260px;
  overflow-y: auto;
  margin-top: 4px;
}

.suggestion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.86rem;
  transition: background-color 0.15s ease;
}

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

.suggestion-item:hover,
.suggestion-item.active {
  background-color: #f0f7ff;
}

.suggestion-name {
  font-weight: 700;
  color: #0f172a;
}

.suggestion-group {
  font-size: 0.74rem;
  color: #64748b;
  margin-left: 6px;
}

.report-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  align-items: end;
}

.report-filter-grid .report-year-select {
  width: 100% !important;
}

.report-table tbody tr.row-inactive td {
  background-color: #fcfcfd;
  color: #64748b;
}

.report-mobile-card.is-inactive-card {
  background-color: #fcfcfd;
  border-left: 3px solid #cbd5e1;
}

.report-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.report-section-title {
  font-size: 1.08rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-section-subtitle {
  font-size: 0.84rem;
  color: #64748b;
  margin: 2px 0 0 0;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.report-table th {
  background: #f8fafc;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 11px 12px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.report-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  color: #1e293b;
}

.report-table tbody tr:hover {
  background-color: #f8fafc;
}

.report-table tbody tr.row-uncompiled td {
  color: #94a3b8;
  background-color: #fcfcfd;
}

.report-table tfoot tr.row-totals td {
  background: #f1f5f9;
  font-weight: 800;
  color: #0f172a;
  border-top: 2px solid #cbd5e1;
  padding: 12px;
}

.report-table tfoot tr.row-averages td {
  background: #f8fafc;
  font-weight: 600;
  color: #475569;
  border-top: 1px solid #e2e8f0;
  font-size: 0.83rem;
  padding: 10px 12px;
}

/* Pillole di stato minimali per i report */
.r-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.r-pill-ok {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.r-pill-warn {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.r-pill-danger {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.r-pill-neutral {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

/* Card Mobile per i Report (< 768px) */
.report-mobile-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.report-mobile-card.is-uncompiled {
  background: #fcfcfd;
  opacity: 0.78;
}

.report-mobile-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

.report-mobile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.report-mobile-cell {
  background: #f8fafc;
  border-radius: 7px;
  padding: 7px 10px;
  min-width: 0;
}

.report-mobile-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.3px;
  display: block;
}

.report-mobile-val {
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
  margin-top: 1px;
}

.report-mobile-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.report-month-compact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 8px;
  transition: all 0.15s ease;
}

.report-month-compact-row:hover {
  background: #f1f5f9;
}

.report-person-banner {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 5px solid #1c5d7e;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

@media (max-width: 767px) {
  .report-top-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .report-tabs {
    width: 100%;
    justify-content: space-between;
  }
  .report-tab-link {
    flex: 1;
    justify-content: center;
    padding: 7px 8px;
    font-size: 0.78rem;
  }
  .report-filter-card {
    padding: 12px 14px;
  }
  .report-filter-form {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .report-filter-info {
    width: 100%;
    justify-content: flex-start;
  }
  .report-year-select-wrap {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .report-year-select {
    width: 100% !important;
    min-width: 0 !important;
  }
  .report-filter-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .report-person-banner {
    padding: 14px;
    flex-direction: column;
    align-items: flex-start;
  }
  .report-mobile-card {
    padding: 10px 12px;
  }
  .report-mobile-cell {
    padding: 6px 8px;
  }
  .report-mobile-val {
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .report-tabs {
    padding: 3px;
    gap: 3px;
  }
  .report-tab-link {
    padding: 6px 4px;
    font-size: 0.74rem;
    gap: 3px;
  }
  .report-tab-link i {
    font-size: 0.76rem;
  }
  .report-mobile-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }
  .report-mobile-cell {
    padding: 5px 4px;
  }
  .report-mobile-label {
    font-size: 0.62rem;
  }
  .report-mobile-val {
    font-size: 0.8rem;
  }
}

