/* ============================================
   Gantt Prototipi Tessuti NICE - Corporate Refined Theme
   Design: profondita', texture, tipografia curata
   ============================================ */

:root {
  /* Palette primaria — blu profondo arricchito */
  --primary: #162d4a;
  --primary-light: #1e4976;
  --primary-lighter: #2b6cb0;
  --primary-surface: #eaf0f8;

  /* Accent — teal-blue professionale */
  --accent: #1a8a7d;
  --accent-light: #2ab8a7;
  --accent-surface: #e6f7f5;
  --accent-glow: rgba(26, 138, 125, 0.15);

  /* Semantici */
  --success: #1b875e;
  --success-surface: #e3f5ed;
  --warning: #c67e1a;
  --warning-surface: #fef3e0;
  --danger: #c53a3a;
  --danger-surface: #fce8e8;
  --info: #2878b5;
  --info-surface: #e3f0fa;

  /* Superfici */
  --bg-main: #f4f6f9;
  --bg-card: #ffffff;
  --bg-sidebar: #111b2b;
  --bg-sidebar-hover: rgba(255,255,255,0.06);
  --bg-sidebar-active: rgba(26, 138, 125, 0.18);

  /* Testo */
  --text-primary: #1a2236;
  --text-secondary: #5a6578;
  --text-muted: #8c95a6;
  --text-inverse: #ffffff;

  /* Bordi */
  --border: #dce1e8;
  --border-light: #e8ecf1;
  --border-subtle: #f0f2f5;

  /* Ombre multi-livello */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.05);
  --shadow-lg: 0 8px 28px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.04);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.14), 0 4px 12px rgba(0,0,0,0.06);

  /* Raggi */
  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Transizioni */
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --transition: all 0.25s var(--ease-out);
  --transition-fast: all 0.15s var(--ease-out);
}

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

html, body { height: 100%; }

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}

/* ============ ANIMAZIONI ============ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(197, 58, 58, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(197, 58, 58, 0); }
}

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ============ LOGIN ============ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(26, 138, 125, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(30, 73, 118, 0.10) 0%, transparent 50%),
    radial-gradient(ellipse at 60% 90%, rgba(22, 45, 74, 0.08) 0%, transparent 50%),
    linear-gradient(145deg, #0f1923 0%, #162d4a 35%, #1e4976 70%, #1a8a7d 100%);
  background-size: 100% 100%, 100% 100%, 100% 100%, 200% 200%;
  animation: gradientShift 12s ease infinite;
  position: relative;
  overflow: hidden;
}

/* Pattern sottile sullo sfondo login */
.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(255,255,255,0.03) 1px, transparent 0);
  background-size: 32px 32px;
  pointer-events: none;
}

.login-container {
  width: 100%;
  max-width: 430px;
  padding: 24px;
  animation: fadeInUp 0.6s var(--ease-out);
  position: relative;
  z-index: 1;
}

.login-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255,255,255,0.1);
  overflow: hidden;
}

.login-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  padding: 36px 28px 32px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Decorazione angolo login header */
.login-header::after {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 100px;
  height: 100px;
  background: rgba(26, 138, 125, 0.2);
  border-radius: 50%;
}

.login-header h1 {
  font-size: 26px;
  font-weight: 700;
  margin: 14px 0 6px;
  letter-spacing: -0.02em;
}

.login-header p {
  font-size: 13px;
  opacity: 0.75;
  margin: 0;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.login-icon {
  width: 68px;
  height: 68px;
  background: rgba(255,255,255,0.12);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.login-body {
  padding: 28px;
}

.login-body .form-control {
  height: 46px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  font-size: 14px;
  padding: 10px 14px;
  transition: var(--transition-fast);
  background: #fafbfc;
}

.login-body .form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: #fff;
}

.login-body .form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.login-combo { font-size: 14px !important; }

.login-btn {
  height: 46px !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  border-radius: var(--radius) !important;
  background: linear-gradient(135deg, var(--accent) 0%, var(--primary-lighter) 100%) !important;
  border: none !important;
  letter-spacing: 0.02em;
  transition: all 0.3s var(--ease-out) !important;
  position: relative;
  overflow: hidden;
}

.login-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(26, 138, 125, 0.35) !important;
}

.login-btn:active:not(:disabled) {
  transform: translateY(0);
}

.login-footer {
  text-align: center;
  padding: 14px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
  font-size: 12px;
}

/* ============ APP LAYOUT ============ */
.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ============ SIDEBAR ============ */
.sidebar {
  width: 264px;
  min-width: 264px;
  background: linear-gradient(180deg, #0e1724 0%, var(--bg-sidebar) 40%, #0f1a28 100%);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  z-index: 100;
  position: relative;
}

/* Linea accent laterale */
.sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(180deg, var(--accent) 0%, transparent 40%, transparent 60%, var(--accent) 100%);
  opacity: 0.2;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-logo {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 2px 8px rgba(26, 138, 125, 0.3);
  flex-shrink: 0;
}

.sidebar-logo svg {
  display: block;
}

.sidebar-title {
  color: white;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.sidebar-menu {
  flex: 1;
  padding: 14px 10px;
  overflow-y: auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  border-radius: var(--radius-sm);
  margin-bottom: 3px;
  transition: var(--transition-fast);
  font-size: 14px;
  font-weight: 450;
  position: relative;
  overflow: hidden;
}

.sidebar-link:hover {
  background: var(--bg-sidebar-hover);
  color: rgba(255,255,255,0.9);
}

.sidebar-link.active {
  background: var(--bg-sidebar-active);
  color: white;
  font-weight: 500;
}

/* Barra indicatore attiva */
.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.sidebar-link svg {
  opacity: 0.7;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.sidebar-link:hover svg,
.sidebar-link.active svg {
  opacity: 1;
}

.badge-notifiche {
  position: absolute;
  right: 12px;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 22px;
  text-align: center;
  animation: pulseGlow 2s ease-in-out infinite;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.15);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--primary-lighter) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(26, 138, 125, 0.25);
}

.user-avatar i {
  font-size: 22px;
  line-height: 1;
}

.user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  color: rgba(255,255,255,0.9);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  color: var(--accent-light);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.btn-logout {
  background: none;
  border: none;
  color: rgba(255,255,255,0.35);
  cursor: pointer;
  padding: 7px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.btn-logout:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.9);
}

/* ============ MAIN CONTENT ============ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-main);
}

.app-header {
  height: 58px;
  min-height: 58px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: relative;
}

/* Accent line sottile sotto header */
.app-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--primary-lighter) 50%, transparent 100%);
  opacity: 0.3;
}

.btn-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 7px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.btn-hamburger:hover {
  background: var(--bg-main);
  color: var(--text-primary);
}

.header-spacer { flex: 1; }

.btn-notifiche {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.btn-notifiche:hover {
  background: var(--bg-main);
  color: var(--text-primary);
}

.badge-header {
  position: absolute;
  top: 1px;
  right: 1px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 9px;
  padding: 0 5px;
  border: 2px solid var(--bg-card);
  animation: pulseGlow 2.5s ease-in-out infinite;
}

.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
  animation: fadeIn 0.35s var(--ease-out);
}

/* ============ CARDS ============ */
.card-panel {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  margin-bottom: 22px;
  border: 1px solid var(--border-subtle);
  position: relative;
  transition: var(--transition);
  animation: fadeInUp 0.4s var(--ease-out);
}

/* Linea accent superiore sulle card */
.card-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--primary-lighter) 100%);
  border-radius: 0 0 3px 3px;
  opacity: 0.5;
}

.card-panel:hover {
  box-shadow: var(--shadow-md);
}

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

.card-panel-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* ============ STATI BADGE ============ */
.stato-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
}

.stato-in-corso {
  background: var(--info-surface);
  color: var(--info);
  border-color: rgba(40, 120, 181, 0.2);
}

.stato-completato {
  background: var(--success-surface);
  color: var(--success);
  border-color: rgba(27, 135, 94, 0.2);
}

.stato-bloccato {
  background: var(--danger-surface);
  color: var(--danger);
  border-color: rgba(197, 58, 58, 0.2);
}

.stato-in-attesa {
  background: #f2f4f7;
  color: var(--text-muted);
  border-color: rgba(140, 149, 166, 0.2);
}

.stato-in-ritardo {
  background: var(--warning-surface);
  color: var(--warning);
  border-color: rgba(198, 126, 26, 0.2);
}

/* ============ TABELLA / GRIGLIA ============ */
.dx-datagrid {
  border-radius: var(--radius) !important;
  overflow: hidden;
}

.dx-datagrid .dx-header-row td {
  font-weight: 600 !important;
  color: var(--primary) !important;
  background: var(--primary-surface) !important;
  font-size: 12.5px !important;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 2px solid var(--border) !important;
}

.dx-datagrid .dx-data-row td {
  font-size: 13.5px;
  padding-top: 10px !important;
  padding-bottom: 10px !important;
  border-bottom: 1px solid var(--border-subtle) !important;
}

.dx-datagrid .dx-data-row:hover td {
  background: var(--accent-surface) !important;
}

/* ============ NOTIFICHE PAGINA ============ */
.notifica-item {
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition-fast);
  cursor: pointer;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  position: relative;
}

.notifica-item:hover {
  background: var(--accent-surface);
}

.notifica-item.non-letta {
  background: #f0f7ff;
  border-left: 3px solid var(--accent);
}

.notifica-dot {
  width: 9px;
  height: 9px;
  background: var(--accent);
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.notifica-dot.letta {
  background: transparent;
  box-shadow: none;
}

/* Notifica EVIDENTE (tipo 'creazione_evidenziata'): segnala al responsabile globale (Ersilia)
   la creazione di un nuovo progetto/prototipo. Deve risaltare nettamente sulle altre: sfondo
   ambra, bordo spesso, testo in grassetto piu' grande. Posizionata DOPO .non-letta cosi' vince
   sui conflitti quando la notifica e' anche non letta. Regola 08-06-2026 (richiesta utente). */
.notifica-item.notifica-evidente {
  background: #fff8e1 !important;
  border-left: 5px solid #f5a623;
  box-shadow: 0 2px 10px rgba(245, 166, 35, 0.18);
}

.notifica-item.notifica-evidente:hover {
  background: #fff3cd !important;
}

.notifica-item.notifica-evidente .notifica-messaggio {
  font-weight: 800;
  font-size: 14.5px;
  color: #8a5a00;
  line-height: 1.4;
}

.notifica-item.notifica-evidente .notifica-dot {
  background: #f5a623;
  box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.28);
}

.notifica-content { flex: 1; }

.notifica-messaggio {
  font-size: 13.5px;
  color: var(--text-primary);
  font-weight: 450;
  line-height: 1.45;
}

.notifica-tempo {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 400;
}

/* ============ GANTT CONTAINER ============ */
.gantt-wrapper {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  position: relative;
  animation: fadeInUp 0.45s var(--ease-out);
}

/* Linea accent superiore gantt */
.gantt-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--primary-lighter) 60%, transparent 100%);
  opacity: 0.4;
  z-index: 1;
}

#gantt-container {
  /* Workflow a 15 fasi (post-shift 06-05-2026): servono ~600px per mostrare tutte
     le righe + header senza scrollbar verticale (15 righe * 32px + header 42px ~= 522px,
     con padding/scrollbar arrotondiamo a 650px+). */
  height: calc(100vh - 320px);
  min-height: 600px;
  max-height: 700px;
}

/* ============ FASE EDITOR ============ */
.fase-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.fase-info-item {
  background: var(--bg-main);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  transition: var(--transition-fast);
}

.fase-info-item:hover {
  border-color: var(--border);
  background: #f8fafb;
}

.fase-info-label {
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.fase-info-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 3px;
  letter-spacing: -0.01em;
}

/* ============ TIMELINE STORICO FASI ============ */
.timeline {
  position: relative;
  padding-left: 28px;
}

/* Linea verticale */
.timeline::before {
  content: '';
  position: absolute;
  left: 13px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px 0;
  position: relative;
  animation: fadeInUp 0.3s var(--ease-out) both;
}

.timeline-item:last-child { padding-bottom: 0; }

/* Ritardo progressivo nell'animazione */
.timeline-item:nth-child(1) { animation-delay: 0s; }
.timeline-item:nth-child(2) { animation-delay: 0.03s; }
.timeline-item:nth-child(3) { animation-delay: 0.06s; }
.timeline-item:nth-child(4) { animation-delay: 0.09s; }
.timeline-item:nth-child(5) { animation-delay: 0.12s; }
.timeline-item:nth-child(6) { animation-delay: 0.15s; }
.timeline-item:nth-child(7) { animation-delay: 0.18s; }
.timeline-item:nth-child(8) { animation-delay: 0.21s; }
.timeline-item:nth-child(9) { animation-delay: 0.24s; }
.timeline-item:nth-child(10) { animation-delay: 0.27s; }
.timeline-item:nth-child(11) { animation-delay: 0.30s; }
.timeline-item:nth-child(12) { animation-delay: 0.33s; }
.timeline-item:nth-child(13) { animation-delay: 0.36s; }

/* Marker (pallino sulla linea) */
.timeline-marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: var(--transition-fast);
}

.timeline-item-completata .timeline-marker {
  background: var(--success);
  box-shadow: 0 2px 8px rgba(27, 135, 94, 0.3);
}

.timeline-item-in-corso .timeline-marker {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.timeline-marker-pulse {
  width: 10px;
  height: 10px;
  background: white;
  border-radius: 50%;
  animation: pulseGlow 2s ease-in-out infinite;
}

.timeline-item-futura .timeline-marker {
  background: var(--bg-main);
  border: 2px solid var(--border);
}

.timeline-marker-num {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Contenuto */
.timeline-content {
  flex: 1;
  min-width: 0;
  padding-top: 3px;
}

.timeline-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.timeline-fase-nome {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.timeline-item-futura .timeline-fase-nome {
  color: var(--text-muted);
  font-weight: 450;
}

.timeline-data {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.timeline-scadenza {
  color: var(--warning);
  font-weight: 600;
}

/* Fase in corso con data prevista gia' passata: indicatore rosso "Scaduta" per massima visibilita' */
.timeline-scaduta {
  color: var(--danger);
  font-weight: 700;
}

.timeline-dettagli {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  align-items: center;
}

.timeline-responsabile {
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
}

.timeline-output {
  font-size: 12.5px;
  color: var(--text-secondary);
  background: var(--bg-main);
  padding: 2px 10px;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1199px) {
  .sidebar { width: 72px; min-width: 72px; }
  .sidebar-title, .sidebar-link span,
  .user-info, .badge-notifiche { display: none; }
  .sidebar-header { justify-content: center; padding: 18px 8px; }
  .sidebar-link { justify-content: center; padding: 12px; }
  .sidebar-link.active::before { display: none; }
  .sidebar-footer { justify-content: center; padding: 14px 8px; }
  .sidebar-user { justify-content: center; }
  .btn-logout { display: none; }
  .page-content { padding: 20px; }
}

@media (max-width: 767px) {
  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    width: 264px;
    min-width: 264px;
    z-index: 1001;
    box-shadow: var(--shadow-xl);
  }
  .sidebar.open { left: 0; }
  .sidebar.open .sidebar-title, .sidebar.open .sidebar-link span,
  .sidebar.open .user-info, .sidebar.open .badge-notifiche,
  .sidebar.open .btn-logout { display: initial; }
  .sidebar.open .sidebar-link.active::before { display: block; }
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(2px);
    z-index: 1000;
  }
  .btn-hamburger { display: block; }
  .page-content { padding: 16px; }
  .fase-info { grid-template-columns: 1fr; }
  .card-panel { padding: 18px; }
}

/* ============ CONFIGURAZIONE TABS ============ */
.config-section { margin-bottom: 22px; }

.config-section h5 {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent);
  letter-spacing: -0.01em;
}

/* ============ ERROR UI ============ */
#blazor-error-ui {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 14px;
  background: var(--warning-surface);
  color: var(--warning);
  text-align: center;
  z-index: 9999;
  font-weight: 500;
  border-top: 2px solid var(--warning);
}

/* ============ FORM LABELS ============ */
.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
  letter-spacing: 0.01em;
}

/* ============ BUTTONS ============ */
.btn-primary-custom {
  background: linear-gradient(135deg, var(--accent) 0%, var(--primary-lighter) 100%);
  color: white;
  border: none;
  padding: 9px 22px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.01em;
}

.btn-primary-custom:hover {
  box-shadow: 0 4px 14px rgba(26, 138, 125, 0.3);
  transform: translateY(-1px);
}

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

.btn-danger-custom {
  background: linear-gradient(135deg, var(--danger) 0%, #a83232 100%);
  color: white;
  border: none;
  padding: 9px 22px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-danger-custom:hover {
  box-shadow: 0 4px 14px rgba(197, 58, 58, 0.3);
  transform: translateY(-1px);
}

/* ============ DEVEXPRESS BLAZOR OVERRIDES ============ */

/* Popup piu' raffinati */
.dxbl-popup-content {
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-xl) !important;
}

.dxbl-popup-header {
  font-weight: 700 !important;
  letter-spacing: -0.01em !important;
}

/* Pulsanti DevExpress */
.dxbl-btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--primary-lighter) 100%) !important;
  border: none !important;
  font-weight: 600 !important;
  letter-spacing: 0.01em;
  transition: var(--transition) !important;
}

.dxbl-btn-primary:hover {
  box-shadow: 0 3px 12px rgba(26, 138, 125, 0.3) !important;
  transform: translateY(-1px);
}

/* Stato DISABILITATO dei pulsanti DevExpress — REGOLA GENERALE.
   Un pulsante disabilitato DEVE essere visibilmente e chiaramente diverso da uno
   abilitato. La regola .dxbl-btn-primary qui sopra forza un gradiente verde con
   !important che restava applicato anche da disabilitato: il bottone sembrava
   cliccabile pur essendo inattivo (bug 08-06-2026, "Crea Progetto" per utenti
   normali). Qui neutralizziamo gradiente/ombre/hover e diamo l'aspetto "grigio
   inattivo" inequivocabile, con cursore not-allowed. Vale per tutti i pulsanti
   DevExpress dell'app. La cella comandi della griglia non e' toccata: usa
   display:none con selettore piu' specifico. */
.dxbl-btn.dxbl-disabled,
.dxbl-btn[disabled],
.dxbl-btn-primary.dxbl-disabled,
.dxbl-btn-primary[disabled] {
  background: #e9ecef !important;
  background-image: none !important;
  color: #9aa0a6 !important;
  border: 1px solid #dee2e6 !important;
  box-shadow: none !important;
  opacity: 0.6 !important;
  cursor: not-allowed !important;
  transform: none !important;
}

.dxbl-btn.dxbl-disabled:hover,
.dxbl-btn[disabled]:hover,
.dxbl-btn-primary.dxbl-disabled:hover,
.dxbl-btn-primary[disabled]:hover {
  background: #e9ecef !important;
  background-image: none !important;
  box-shadow: none !important;
  transform: none !important;
}

/* Tab DevExpress */
.dxbl-tabs .dxbl-tab-active {
  font-weight: 600 !important;
}

/* TextBox/Memo focus */
.dxbl-edit:focus-within {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-glow) !important;
}

/* Grid DevExpress Blazor */
.dxbl-grid {
  border-radius: var(--radius) !important;
  overflow: hidden;
  border: 1px solid var(--border-light) !important;
}

/* WaitIndicator */
.dxbl-wait-indicator-icon {
  color: var(--accent) !important;
}

/* ============ SCROLLBAR PERSONALIZZATA ============ */
.page-content::-webkit-scrollbar {
  width: 6px;
}

.page-content::-webkit-scrollbar-track {
  background: transparent;
}

.page-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.page-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============ ALERT REFINEMENTS ============ */
.alert {
  border-radius: var(--radius-sm) !important;
  font-size: 13.5px;
  border: none !important;
}

.alert-danger {
  background: var(--danger-surface) !important;
  color: var(--danger) !important;
  border-left: 3px solid var(--danger) !important;
}

.alert-success {
  background: var(--success-surface) !important;
  color: var(--success) !important;
  border-left: 3px solid var(--success) !important;
}

.alert-warning {
  background: var(--warning-surface) !important;
  color: var(--warning) !important;
  border-left: 3px solid var(--warning) !important;
}

/* ============ TESTATA PROTOTIPO (pagina dettaglio /gantt/{id}) ============ */
/* Contenitore della testata: card ariosa con miniatura foto + pulsanti file allegati */
.testata-prototipo {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  padding: 20px 24px;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border, #e1e8ed);
  border-left: 4px solid var(--primary, #162d4a);
  border-radius: var(--radius-lg, 14px);
  box-shadow: 0 2px 8px rgba(22, 45, 74, 0.06);
}

.foto-miniatura-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: relative;
  flex-shrink: 0;
}

.foto-miniatura {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border: 2px solid var(--border, #e1e8ed);
  border-radius: var(--radius-sm, 7px);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.foto-miniatura:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 16px rgba(22, 45, 74, 0.18);
}

.foto-placeholder {
  width: 140px;
  height: 140px;
  background: var(--primary-surface, #eaf0f8);
  border: 2px dashed var(--primary-light, #1e4976);
  border-radius: var(--radius-sm, 7px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--primary-light, #1e4976);
  font-size: 0.82rem;
  font-weight: 500;
  gap: 8px;
  user-select: none;
  opacity: 0.75;
}

.foto-placeholder svg {
  opacity: 0.6;
  width: 48px;
  height: 48px;
}

/* Foto slegata dalle fasi (20-05-2026): pulsante carica/sostituisci sotto la miniatura,
   visibile a tecnico assegnato + supervisori + admin/programmatore. */
.btn-foto-upload {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  background: var(--primary-surface, #eaf0f8);
  color: var(--primary, #162d4a);
  border: 1px solid var(--primary-light, #1e4976);
  border-radius: var(--radius-sm, 7px);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.btn-foto-upload:hover {
  background: var(--primary-light, #1e4976);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-foto-upload i {
  font-size: 0.95rem;
}

.foto-feedback {
  font-size: 0.74rem;
  font-weight: 500;
  text-align: center;
  max-width: 160px;
  line-height: 1.25;
}

.foto-feedback-ok { color: #15803d; }
.foto-feedback-err { color: #dc2626; }

/* Cronologia correzioni dato in fasi chiuse (20-05-2026), mostrata nel popup della fase */
.correzioni-cronologia {
  background: #fff8ed;
  border: 1px solid #f3d9a9;
  border-left: 3px solid #e08a1e;
  border-radius: 8px;
  padding: 10px 12px;
}
.correzioni-titolo {
  font-size: 0.8rem;
  font-weight: 700;
  color: #b5710f;
  margin-bottom: 6px;
}
.correzioni-lista {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.correzioni-lista li {
  font-size: 0.82rem;
  border-top: 1px dashed #f0dcb8;
  padding-top: 6px;
}
.correzioni-lista li:first-child {
  border-top: none;
  padding-top: 0;
}
.correzioni-meta {
  font-size: 0.72rem;
  color: #9a7a44;
  margin-bottom: 2px;
}
.correzioni-riga {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.correzioni-campo {
  font-weight: 600;
  color: #6b4e1e;
  margin-right: 4px;
}
.correzioni-vecchio {
  color: #b91c1c;
  text-decoration: line-through;
  opacity: 0.85;
}
.correzioni-nuovo {
  color: #15803d;
  font-weight: 600;
}

.foto-full {
  max-width: 90vw;
  max-height: 80vh;
  border-radius: var(--radius-sm, 7px);
}

/* Pulsante "Scheda costo Excel": verde Excel, ben visibile, con hover animato */
.btn-scheda-costo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #1d6f42 0%, #2a9461 100%);
  color: #ffffff !important;
  border-radius: var(--radius-sm, 7px);
  text-decoration: none !important;
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 6px rgba(29, 111, 66, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

.btn-scheda-costo:hover {
  background: linear-gradient(135deg, #165c34 0%, #1d7c4f 100%);
  color: #ffffff !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(29, 111, 66, 0.35);
}

.btn-scheda-costo svg {
  flex-shrink: 0;
}

/* Placeholder "Scheda costo non disponibile": stesso ingombro del pulsante ma non cliccabile,
   stile coerente con il placeholder foto (tinta primary-surface, dashed, opacity ridotta) */
.btn-scheda-costo-placeholder {
  background: var(--primary-surface, #eaf0f8) !important;
  color: var(--primary-light, #1e4976) !important;
  border: 2px dashed var(--primary-light, #1e4976);
  box-shadow: none !important;
  cursor: default !important;
  opacity: 0.75;
  user-select: none;
  padding: 10px 18px;
}

.btn-scheda-costo-placeholder:hover {
  transform: none !important;
  background: var(--primary-surface, #eaf0f8) !important;
  color: var(--primary-light, #1e4976) !important;
  box-shadow: none !important;
}

/* ============ CAMPI CODICE PROTOTIPO (popup fase 6) ============ */
/* Campi read-only compatti (Tipo, Anno, Tecnico) + unico editabile (Numero NNNN) */
.codice-campo {
  width: 90px;
}

.codice-campo-readonly input {
  background-color: var(--bg-alt, #f8f9fa) !important;
  color: var(--text, #495057) !important;
  font-weight: 600;
  text-align: center;
  cursor: default;
}

.codice-campo-editabile input {
  background-color: #e7f3ff !important;
  font-weight: 700;
  text-align: center;
  border: 2px solid var(--primary-lighter, #2b6cb0) !important;
}

.codice-anteprima {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 1.05rem;
  letter-spacing: 0.5px;
  color: var(--primary, #162d4a);
}

/* ============================================
   ZONA HERO CARD — differenziazione visiva per zona
   (Idea 3 approvata 12-05-2026): ogni zona principale del programma
   ha una hero card all'inizio con illustrazione SVG tematica, titolo,
   descrizione e statistiche. Colori-firma per zona:
   - Progetti = teal (gia' accent)
   - Prototipi (Dashboard) = ambra
   - Gantt = viola
   - Configurazione = grigio
   - Notifiche = blu
   - Statistiche = verde foresta (executive dashboard)
   ============================================ */

:root {
  --zona-progetti: #1a8a7d;
  --zona-progetti-2: #2ab8a7;
  --zona-progetti-bg: #e6f7f5;
  --zona-progetti-tint: #f4faf9;        /* bianco appena tinto teal — sfondo grid */
  --zona-progetti-glow: rgba(26, 138, 125, 0.2);

  --zona-prototipi: #d97706;
  --zona-prototipi-2: #fbbf24;
  --zona-prototipi-bg: #fef3e0;
  --zona-prototipi-tint: #fdfaf3;        /* bianco appena tinto ambra */
  --zona-prototipi-glow: rgba(217, 119, 6, 0.2);

  --zona-gantt: #7c3aed;
  --zona-gantt-2: #a78bfa;
  --zona-gantt-bg: #f3edff;
  --zona-gantt-tint: #faf7fe;            /* bianco appena tinto viola */
  --zona-gantt-glow: rgba(124, 58, 237, 0.2);

  --zona-config: #475569;
  --zona-config-2: #64748b;
  --zona-config-bg: #eef2f6;
  --zona-config-tint: #f7f8fa;           /* bianco appena tinto grigio */
  --zona-config-glow: rgba(71, 85, 105, 0.18);

  --zona-notifiche: #2563eb;
  --zona-notifiche-2: #60a5fa;
  --zona-notifiche-bg: #e3edfd;
  --zona-notifiche-tint: #f5f8fe;        /* bianco appena tinto blu */
  --zona-notifiche-glow: rgba(37, 99, 235, 0.2);

  --zona-statistiche: #15803d;            /* verde foresta, executive dashboard */
  --zona-statistiche-2: #4ade80;
  --zona-statistiche-bg: #e6f6ec;
  --zona-statistiche-tint: #f0faf3;       /* bianco appena tinto verde */
  --zona-statistiche-glow: rgba(21, 128, 61, 0.2);
}

.hero-card {
  position: relative;
  border-radius: var(--radius-xl);
  padding: 28px 34px;
  margin-bottom: 22px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--zone-bg-1, var(--accent-surface)) 0%, var(--bg-card) 65%);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  min-height: 170px;
  animation: fadeInUp 0.4s var(--ease-out);
}

/* Pattern decorativo a puntini */
.hero-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, var(--zone-dots, rgba(26,138,125,0.08)) 1px, transparent 0);
  background-size: 24px 24px;
  pointer-events: none;
  opacity: 0.55;
}

/* Glow radiale angolo */
.hero-card::after {
  content: '';
  position: absolute;
  top: -80px;
  right: -80px;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, var(--zone-glow, rgba(26,138,125,0.18)) 0%, transparent 70%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 28px;
}

.hero-illustration {
  width: 150px;
  height: 150px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-illustration svg {
  width: 100%;
  height: 100%;
  display: block;
}

.hero-text {
  flex: 1;
  min-width: 0;
}

.hero-overline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--zone-color, var(--accent));
  background: var(--bg-card);
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--zone-color, var(--accent));
  margin-bottom: 12px;
}

.hero-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 8px;
}

.hero-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  max-width: 620px;
  margin-bottom: 14px;
  line-height: 1.5;
}

.hero-stats {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hero-stat-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--zone-color, var(--accent));
  letter-spacing: -0.02em;
  line-height: 1;
}

.hero-stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.hero-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* Bottone primario colorato per zona */
.btn-zona {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--zone-color, var(--accent));
  background: var(--zone-color, var(--accent));
  color: #fff;
  text-decoration: none;
  box-shadow: 0 4px 12px var(--zone-glow, rgba(26,138,125,0.3));
  transition: var(--transition-fast);
}

.btn-zona:hover {
  filter: brightness(1.08);
  color: #fff;
}

.btn-zona-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition-fast);
}

.btn-zona-outline:hover {
  border-color: var(--zone-color, var(--accent));
  color: var(--zone-color, var(--accent));
}

/* Set di CSS vars per zona — applicato come modificatore.
   --zone-tint = sfondo "bianco appena sporcato" per le card/griglia della zona. */
.zona-progetti {
  --zone-color: var(--zona-progetti);
  --zone-color-2: var(--zona-progetti-2);
  --zone-bg-1: var(--zona-progetti-bg);
  --zone-tint: var(--zona-progetti-tint);
  --zone-dots: rgba(26, 138, 125, 0.08);
  --zone-glow: var(--zona-progetti-glow);
}

.zona-prototipi {
  --zone-color: var(--zona-prototipi);
  --zone-color-2: var(--zona-prototipi-2);
  --zone-bg-1: var(--zona-prototipi-bg);
  --zone-tint: var(--zona-prototipi-tint);
  --zone-dots: rgba(217, 119, 6, 0.08);
  --zone-glow: var(--zona-prototipi-glow);
}

.zona-gantt {
  --zone-color: var(--zona-gantt);
  --zone-color-2: var(--zona-gantt-2);
  --zone-bg-1: var(--zona-gantt-bg);
  --zone-tint: var(--zona-gantt-tint);
  --zone-dots: rgba(124, 58, 237, 0.08);
  --zone-glow: var(--zona-gantt-glow);
}

.zona-config {
  --zone-color: var(--zona-config);
  --zone-color-2: var(--zona-config-2);
  --zone-bg-1: var(--zona-config-bg);
  --zone-tint: var(--zona-config-tint);
  --zone-dots: rgba(71, 85, 105, 0.08);
  --zone-glow: var(--zona-config-glow);
}

.zona-notifiche {
  --zone-color: var(--zona-notifiche);
  --zone-color-2: var(--zona-notifiche-2);
  --zone-bg-1: var(--zona-notifiche-bg);
  --zone-tint: var(--zona-notifiche-tint);
  --zone-dots: rgba(37, 99, 235, 0.08);
  --zone-glow: var(--zona-notifiche-glow);
}

.zona-statistiche {
  --zone-color: var(--zona-statistiche);
  --zone-color-2: var(--zona-statistiche-2);
  --zone-bg-1: var(--zona-statistiche-bg);
  --zone-tint: var(--zona-statistiche-tint);
  --zone-dots: rgba(21, 128, 61, 0.08);
  --zone-glow: var(--zona-statistiche-glow);
}

/* Card-panel zonata: sfondo tint sottile + top border accent color zona.
   Override del default .card-panel (bianco + top border teal+blu) quando la card
   ha anche una classe modificatore .zona-X. Approvato 12-05-2026. */
.card-panel.zona-progetti,
.card-panel.zona-prototipi,
.card-panel.zona-gantt,
.card-panel.zona-config,
.card-panel.zona-notifiche,
.card-panel.zona-statistiche {
  background: var(--zone-tint, var(--bg-card));
}

.card-panel.zona-progetti::before,
.card-panel.zona-prototipi::before,
.card-panel.zona-gantt::before,
.card-panel.zona-config::before,
.card-panel.zona-notifiche::before,
.card-panel.zona-statistiche::before {
  background: linear-gradient(90deg, var(--zone-color, var(--accent)) 0%, var(--zone-color-2, var(--primary-lighter)) 100%);
  opacity: 0.7;
}

/* Responsive: su mobile l'illustrazione si stacca sotto il testo */
@media (max-width: 768px) {
  .hero-card {
    padding: 20px 22px;
  }
  .hero-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .hero-illustration {
    width: 110px;
    height: 110px;
    align-self: center;
  }
  .hero-title {
    font-size: 22px;
  }
  .hero-stats {
    gap: 18px;
  }
  .hero-stat-num {
    font-size: 18px;
  }
}

/* ============================================
   PANNELLO STATISTICHE — layout grid + KPI cards
   ============================================ */

.stats-section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--zona-statistiche);
  margin: 0 0 16px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stats-section-title i {
  font-size: 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.stats-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.stats-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

@media (max-width: 900px) {
  .stats-grid-2, .stats-grid-3 {
    grid-template-columns: 1fr;
  }
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s var(--ease-out), box-shadow 0.15s var(--ease-out);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-card .kpi-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi-card .kpi-label i {
  font-size: 14px;
  color: var(--zona-statistiche);
}

.kpi-card .kpi-value {
  font-size: 38px;
  font-weight: 800;
  line-height: 1;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.kpi-card .kpi-value.kpi-success { color: var(--zona-statistiche); }
.kpi-card .kpi-value.kpi-warn    { color: #d97706; }
.kpi-card .kpi-value.kpi-danger  { color: #dc2626; }

.kpi-card .kpi-delta {
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.kpi-card .kpi-delta.delta-up   { color: #16a34a; }
.kpi-card .kpi-delta.delta-down { color: #dc2626; }
.kpi-card .kpi-delta.delta-zero { color: var(--text-secondary); }

.kpi-card .kpi-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.kpi-card.kpi-accent::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--zona-statistiche) 0%, var(--zona-statistiche-2) 100%);
}

.kpi-sparkline {
  height: 36px;
  margin-top: 4px;
}

/* Tabellina riepilogativa per scostamenti/motivi blocco/sede */
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.stats-table thead th {
  text-align: left;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

/* Le intestazioni delle colonne numeriche vanno allineate a destra come i dati,
   altrimenti header e valori non risultano incolonnati (header a sinistra, numero
   a destra) e si fatica a capire quale valore appartiene a quale colonna. */
.stats-table thead th.num {
  text-align: right;
}

.stats-table tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

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

.stats-table tbody tr:hover {
  background: var(--zona-statistiche-tint);
}

.stats-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.stats-empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 32px 16px;
  font-size: 14px;
  font-style: italic;
}

.stats-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.stats-filter-bar .filter-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-right: 4px;
}

.stats-combo {
  min-width: 150px;
}

/* Bar chart orizzontale (riusato in piu' sezioni) */
.bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.bar-label {
  flex: 0 0 180px;
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  flex: 1 1 auto;
  background: var(--zona-statistiche-tint);
  border-radius: 4px;
  height: 22px;
  position: relative;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--zona-statistiche) 0%, var(--zona-statistiche-2) 100%);
  border-radius: 4px;
  transition: width 0.3s var(--ease-out);
}

.bar-fill.bar-lenta {
  background: linear-gradient(90deg, #d97706 0%, #fbbf24 100%);
}

.bar-value {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 13px;
  min-width: 36px;
  text-align: right;
}

/* Throughput chart verticale (12 mesi, doppia barra per mese) */
.throughput-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 200px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.thr-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.thr-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  flex: 1;
  width: 100%;
}

.thr-bar {
  flex: 1;
  border-radius: 3px 3px 0 0;
  min-height: 1px;
  transition: height 0.3s var(--ease-out);
}

.thr-creati {
  background: #4ade80;
}

.thr-compl {
  background: #15803d;
}

.thr-label {
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center;
  white-space: nowrap;
}

/* Line chart (tempo medio, trimestri) */
.line-chart-wrap {
  width: 100%;
}

.line-chart-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 600;
}

.line-chart-labels span {
  flex: 1;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Pie chart con legenda laterale */
.pie-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.pie-legend {
  flex: 1;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pie-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.pie-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.pie-label {
  flex: 1;
  color: var(--text-primary);
}

.pie-val {
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.pie-val small {
  color: var(--text-secondary);
  font-weight: 500;
  margin-left: 2px;
}

/* ============================================
   GRID COMMAND COLUMNS — nasconde il pulsante "Clear" placeholder della
   filter row sulle DxGridCommandColumn. DevExpress Blazor 23.2 con
   ShowFilterRow=true renderizza un bottone disabled aria-label="Clear"
   in ogni cella della filter row, anche su quelle delle command column
   dove non ha senso filtrare (non c'e' FieldName).
   SELETTORE MIRATO: nasconde il SOLO bottone "Clear" dentro le celle
   marcate .dxbl-grid-command-cell. display:none collassa solo il bottone,
   non la cella intera — il pulsante azione (matita/cestino) della data
   row resta intatto perche' ha aria-label diverso.
   Fix 12-05-2026 — definitivo dopo vari tentativi con
   FilterRowCellVisible / CssClass / nth-last-child non robusti.
   ============================================ */
/* Triplo selettore: aria-label, classe btn-link disabled, span caption.
   Almeno uno deve matchare in qualunque variante di rendering DevExpress. */
.prototipi-grid .dxbl-grid-command-cell button[aria-label="Clear"],
.prototipi-grid .dxbl-grid-command-cell .dxbl-btn-link.dxbl-disabled,
.prototipi-grid .dxbl-grid-command-cell .dxbl-btn-caption {
  display: none !important;
}

/* Cell template "Nome" colorato col colore-firma della zona.
   Eredita --zone-color dalle classi modificatore .zona-* gia' definite sopra:
   sul <span class="cell-nome-zona zona-progetti"> applica color=teal,
   sul <span class="cell-nome-zona zona-prototipi"> applica color=ambra, ecc.
   Approvato 12-05-2026 per legare visivamente hero card e griglia. */
.cell-nome-zona {
  color: var(--zone-color, var(--accent));
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ============================================================================
   Ricerca cross-prototipo nella pagina /progetti (19-05-2026)
   Casella di ricerca + dropdown dei risultati live con debounce 250ms.
   ============================================================================ */
.ricerca-prototipi {
  max-width: 720px;
}
.ricerca-prototipi .form-control {
  padding-left: 0.85rem;
  font-size: 0.95rem;
}
.ricerca-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1050;
  max-width: 720px;
  max-height: 360px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border, #dee2e6);
  border-radius: 0 0 0.5rem 0.5rem;
  margin-top: -1px;
}
.ricerca-item {
  display: block;
  padding: 0.6rem 0.85rem;
  border: none;
  border-bottom: 1px solid #f0f0f0;
  background: #fff;
  cursor: pointer;
  transition: background 0.12s;
}
.ricerca-item:last-child { border-bottom: none; }
.ricerca-item:hover { background: var(--gym-card-hover, #f5f9f8); }
.ricerca-item-nome {
  font-weight: 600;
  color: var(--gym-dark, #3a3d42);
  font-size: 0.95rem;
}
.ricerca-item-meta { margin-top: 0.15rem; font-size: 0.8rem; }
.codice-pill {
  display: inline-block;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  background: #eef4f3;
  color: var(--gym-accent-dark, #49a89f);
  padding: 0.05rem 0.4rem;
  border-radius: 0.3rem;
  font-weight: 600;
  font-size: 0.78rem;
}
.ricerca-stato-badge {
  flex-shrink: 0;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.ricerca-stato-badge.stato-completato { background: #d4edda; color: #155724; }
.ricerca-stato-badge.stato-in-corso   { background: #fff3cd; color: #856404; }
.ricerca-stato-badge.stato-bloccato   { background: #f8d7da; color: #721c24; }

/* ============================================================================
   Griglia filati nella fase 3 del popup dettaglio (19-05-2026)
   Lista editabile di N filati per prototipo: descrizione, MOQ, prezzo.
   ============================================================================ */
.filati-griglia {
  border: 1px solid var(--border, #dee2e6);
  border-radius: 0.4rem;
  overflow: hidden;
}
.filati-empty {
  padding: 0.9rem;
  text-align: center;
}
.filati-table {
  margin: 0;
}
.filati-table thead {
  background: #f7f8f9;
}
.filati-table thead th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #6c757d;
  border-bottom: 1px solid var(--border, #dee2e6);
}
.filati-form {
  background: #fafbfc !important;
}

/* Riepilogo filati nel popup di revisione della fase 3 gia' chiusa (20-05-2026):
   lista compatta dentro l'alert verde "Completata", una riga per filato con
   descrizione a sinistra e MOQ/prezzo a destra. */
.filati-riepilogo {
  margin-bottom: 0.25rem;
}
.filati-riepilogo-titolo {
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.filati-riepilogo-lista {
  list-style: none;
  margin: 0;
  padding: 0;
}
.filati-riepilogo-lista li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.2rem 0;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.1);
}
.filati-riepilogo-lista li:last-child {
  border-bottom: none;
}
.filati-riepilogo-descr {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}
.filati-riepilogo-valori {
  flex: 0 0 auto;
  white-space: nowrap;
}
