/* ==========================================================
   🎨 STUDIO LEGALE - HUB OPERATIVO
   Modern UI Theme with animations
   ========================================================== */

:root {
  --bg-primary: #0b1426;
  --bg-secondary: #0f1d36;
  --bg-tertiary: #15264a;
  --bg-glass: rgba(255, 255, 255, 0.08);
  --bg-glass-strong: rgba(255, 255, 255, 0.12);
  --bg-card: rgba(255, 255, 255, 0.05);

  --accent-primary: #4f9cff;
  --accent-secondary: #0066ff;
  --accent-tertiary: #00c6ff;
  --accent-gradient: linear-gradient(135deg, #4f9cff 0%, #0066ff 100%);
  --accent-gradient-soft: linear-gradient(135deg, rgba(79, 156, 255, 0.2), rgba(0, 102, 255, 0.15));

  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.15);
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.15);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.15);

  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.85);
  --text-muted: rgba(255, 255, 255, 0.6);
  --text-faint: rgba(255, 255, 255, 0.4);

  --border-light: rgba(255, 255, 255, 0.1);
  --border-medium: rgba(255, 255, 255, 0.18);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 32px rgba(79, 156, 255, 0.3);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ============= RESET ============= */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  background-image:
    radial-gradient(at 0% 0%, rgba(0, 198, 255, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(79, 156, 255, 0.12) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(0, 102, 255, 0.1) 0px, transparent 50%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============= GLASS CONTAINER ============= */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.hub-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.hub-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-medium);
}

/* ============= BUTTONS ============= */
.hub-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.75rem 1.4rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
  position: relative;
  overflow: hidden;
}
.hub-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
  opacity: 0;
  transition: opacity var(--transition-base);
}
.hub-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 102, 255, 0.45);
}
.hub-btn:hover::before { opacity: 1; }
.hub-btn:active { transform: translateY(0); }

.hub-btn-secondary {
  background: var(--bg-glass);
  border: 1px solid var(--border-medium);
  box-shadow: none;
}
.hub-btn-secondary:hover {
  background: var(--bg-glass-strong);
  border-color: var(--accent-primary);
  box-shadow: 0 4px 12px rgba(79, 156, 255, 0.2);
}

.hub-btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}
.hub-btn-danger:hover { box-shadow: 0 8px 20px rgba(239, 68, 68, 0.45); }

.hub-btn-success {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.hub-btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  box-shadow: none;
}
.hub-btn-ghost:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
}

.hub-btn-icon {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
}

/* ============= INPUT FIELDS ============= */
.hub-field {
  width: 100%;
  padding: 0.85rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: #1a2233;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  outline: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.hub-field::placeholder { color: #98a1ae; }
.hub-field:focus {
  border-color: var(--accent-primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(79, 156, 255, 0.25);
}
.hub-field:disabled,
.hub-field[readonly] {
  background: #eef0f4;
  color: #6b7280;
  cursor: not-allowed;
}
/* Per i select, override del colore opzioni */
select.hub-field option {
  color: #1a2233;
  background: #ffffff;
}

.hub-field-icon {
  position: relative;
}
/* Icona "decorativa" SOLO se è figlia diretta (non quella dentro un button) */
.hub-field-icon > i {
  position: absolute;
  top: 50%;
  left: 1rem;
  transform: translateY(-50%);
  color: #98a1ae;
  pointer-events: none;
  transition: color var(--transition-base);
  z-index: 2;
  font-size: 0.95rem;
}
.hub-field-icon input { padding-left: 2.8rem; }
.hub-field-icon input:focus ~ i { color: var(--accent-primary); }

label.hub-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

/* ============= BADGES ============= */
.hub-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
  text-transform: capitalize;
}
.hub-badge-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(34, 197, 94, 0.3); }
.hub-badge-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(251, 191, 36, 0.3); }
.hub-badge-danger  { background: var(--danger-bg);  color: var(--danger);  border: 1px solid rgba(239, 68, 68, 0.3); }
.hub-badge-info    { background: var(--info-bg);    color: var(--info);    border: 1px solid rgba(59, 130, 246, 0.3); }
.hub-badge-neutral { background: var(--bg-glass);   color: var(--text-secondary); border: 1px solid var(--border-light); }

/* ============= TOAST NOTIFICATIONS ============= */
.toast-stack {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  max-width: 420px;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 320px;
  padding: 16px 18px;
  background: rgba(15, 29, 54, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}
.toast::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--accent-primary);
}
.toast.toast-success::before { background: var(--success); }
.toast.toast-error::before   { background: var(--danger); }
.toast.toast-warning::before { background: var(--warning); }
.toast.toast-info::before    { background: var(--info); }
.toast .toast-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-glass-strong);
  font-size: 18px;
}
.toast.toast-success .toast-icon { background: var(--success-bg); color: var(--success); }
.toast.toast-error   .toast-icon { background: var(--danger-bg);  color: var(--danger);  }
.toast.toast-warning .toast-icon { background: var(--warning-bg); color: var(--warning); }
.toast.toast-info    .toast-icon { background: var(--info-bg);    color: var(--info); }
.toast .toast-body { flex: 1; min-width: 0; }
.toast .toast-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 2px;
}
.toast .toast-msg {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}
.toast .toast-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  transition: color var(--transition-base);
}
.toast .toast-close:hover { color: var(--text-primary); }
.toast.toast-out { animation: toastOut 0.3s cubic-bezier(0.4, 0, 0.6, 1) forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(120%); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(120%); }
}

/* ============= MODAL ============= */
.hub-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
  animation: fadeIn 0.3s ease;
}
.hub-modal-overlay.show { display: flex; }
.hub-modal {
  background: rgba(15, 29, 54, 0.98);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.8rem;
  animation: modalIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  color: var(--text-primary);
}
.hub-modal h2, .hub-modal h3 {
  margin: 0 0 1rem 0;
  color: var(--text-primary);
}
.hub-modal-close {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-light);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
}
.hub-modal-close:hover {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger);
}

/* ============= CONFIRM DIALOG ============= */
.confirm-dialog .confirm-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: var(--danger-bg);
  color: var(--danger);
  animation: pulseSoft 2s ease-in-out infinite;
}
.confirm-dialog h3 { text-align: center; }
.confirm-dialog p {
  text-align: center;
  color: var(--text-secondary);
  margin: 0.5rem 0 1.6rem;
}
.confirm-dialog .confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ============= ANIMATIONS ============= */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.85) translateY(40px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes pulseSoft {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  50%      { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes drawCheck {
  0%   { stroke-dashoffset: 50; }
  100% { stroke-dashoffset: 0; }
}
@keyframes drawX {
  0%   { stroke-dashoffset: 50; }
  100% { stroke-dashoffset: 0; }
}

/* ============= UTILITY ANIMATIONS ============= */
.fade-in   { animation: fadeIn 0.4s ease; }
.scale-in  { animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.slide-up  { animation: slideUp 0.4s ease; }
.float     { animation: float 3s ease-in-out infinite; }

/* ============= LOADER ============= */
.hub-spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid var(--border-light);
  border-top-color: var(--accent-primary);
  animation: spin 0.8s linear infinite;
}
.hub-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 20, 38, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99998;
}
.hub-loading-overlay.show { display: flex; }

/* ============= SUCCESS / ERROR LOTTIE-LIKE ANIMATIONS ============= */
.svg-check, .svg-cross, .svg-warn {
  width: 80px;
  height: 80px;
}
.svg-check circle,
.svg-cross circle,
.svg-warn  circle {
  fill: none;
  stroke-width: 4;
  stroke-dasharray: 230;
  stroke-dashoffset: 230;
  animation: drawCircle 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}
.svg-check circle { stroke: #22c55e; }
.svg-cross circle { stroke: #ef4444; }
.svg-warn  circle { stroke: #fbbf24; }

.svg-check path,
.svg-cross path,
.svg-warn  path {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: drawPath 0.4s cubic-bezier(0.65, 0, 0.45, 1) 0.5s forwards;
}
.svg-check path { stroke: #22c55e; }
.svg-cross path { stroke: #ef4444; }
.svg-warn  path { stroke: #fbbf24; }

@keyframes drawCircle {
  to { stroke-dashoffset: 0; }
}
@keyframes drawPath {
  to { stroke-dashoffset: 0; }
}

/* ============= TABLES ============= */
.hub-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-glass);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-light);
}
.hub-table thead th {
  background: var(--bg-glass-strong);
  color: var(--text-primary);
  text-align: left;
  padding: 1rem;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-light);
}
.hub-table tbody td {
  padding: 1rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition-fast);
}
.hub-table tbody tr:last-child td { border-bottom: none; }
.hub-table tbody tr:hover td { background: rgba(255,255,255,0.04); }

/* ============= ACTION ICON BUTTONS ============= */
.hub-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-glass);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  font-size: 0.9rem;
}
.hub-icon-btn:hover {
  background: var(--bg-glass-strong);
  color: var(--text-primary);
  transform: translateY(-2px);
}
.hub-icon-btn.action-edit:hover { color: var(--info); border-color: var(--info); }
.hub-icon-btn.action-view:hover { color: var(--accent-primary); border-color: var(--accent-primary); }
.hub-icon-btn.action-delete:hover { color: var(--danger); border-color: var(--danger); }
.hub-icon-btn.action-add:hover { color: var(--success); border-color: var(--success); }

/* ============= TOPBAR ============= */
.hub-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: rgba(15, 29, 54, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 1.5rem;
}
.hub-topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}
.hub-topbar-brand .logo-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--accent-secondary);
  box-shadow: var(--shadow-glow);
  overflow: hidden;
  padding: 4px;
}
.hub-topbar-brand .logo-mark img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
.hub-topbar-brand .brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.hub-topbar-brand .brand-name {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
}
.hub-topbar-brand .brand-tag {
  font-size: 0.7rem;
  color: var(--text-muted);
}
.hub-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hub-topbar-action {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-glass);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  font-size: 1.05rem;
  transition: all var(--transition-base);
}
.hub-topbar-action:hover {
  background: var(--bg-glass-strong);
  color: var(--text-primary);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}
.hub-topbar-action .badge-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-secondary);
}
.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.4rem 0.8rem 0.4rem 0.4rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  cursor: pointer;
  color: var(--text-primary);
  transition: all var(--transition-base);
}
.user-menu-trigger:hover {
  background: var(--bg-glass-strong);
  border-color: var(--accent-primary);
}
.user-menu-trigger .user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}
.user-menu-trigger .user-name {
  font-size: 0.85rem;
  font-weight: 600;
}

/* ============= SIDEBAR ============= */
.hub-sidebar {
  position: fixed;
  top: 0;
  right: -340px;
  width: 320px;
  height: 100vh;
  background: rgba(11, 20, 38, 0.98);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-left: 1px solid var(--border-light);
  padding: 1.5rem;
  z-index: 999;
  overflow-y: auto;
  transition: right var(--transition-base);
  box-shadow: -16px 0 40px rgba(0,0,0,0.5);
}
.hub-sidebar.open { right: 0; }
.hub-sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}
.hub-sidebar-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}
.hub-sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}
.hub-sidebar-title {
  font-size: 1.1rem;
  font-weight: 700;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  margin-bottom: 4px;
  transition: all var(--transition-base);
}
.nav-link i {
  width: 22px;
  font-size: 1rem;
  text-align: center;
  color: var(--text-muted);
}
.nav-link:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
}
.nav-link:hover i { color: var(--accent-primary); }
.nav-link.active {
  background: var(--accent-gradient-soft);
  color: var(--text-primary);
  border: 1px solid rgba(79, 156, 255, 0.3);
}
.nav-link.active i { color: var(--accent-primary); }
.nav-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin: 1.4rem 0 0.6rem;
  padding: 0 1rem;
}

/* ============= PAGE CONTAINER ============= */
.hub-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}
.hub-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.hub-page-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.hub-page-title i {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-gradient-soft);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
.hub-page-subtitle {
  color: var(--text-muted);
  margin-top: 0.25rem;
  font-size: 0.95rem;
}

/* ============= PAGINATION ============= */
.hub-pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}
.hub-pagination a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 0.6rem;
  background: var(--bg-glass);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all var(--transition-base);
}
.hub-pagination a:hover {
  background: var(--bg-glass-strong);
  color: var(--text-primary);
  transform: translateY(-2px);
}
.hub-pagination a.active {
  background: var(--accent-gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
}

/* ============= STATUS DOT ============= */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  margin-right: 6px;
  animation: pulseDot 1.6s ease-in-out infinite;
}

/* ============= DROPDOWN ============= */
.hub-dropdown {
  position: relative;
  display: inline-block;
}
.hub-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 180px;
  background: rgba(15, 29, 54, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 6px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: all var(--transition-base);
  z-index: 100;
}
.hub-dropdown.open .hub-dropdown-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.hub-dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.6rem 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}
.hub-dropdown-menu a i { width: 16px; }
.hub-dropdown-menu a:hover { background: var(--bg-glass); color: var(--text-primary); }
.hub-dropdown-menu a.danger:hover { background: var(--danger-bg); color: var(--danger); }

/* ============= STATS / KPI CARD ============= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.kpi-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.kpi-card .kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-bottom: 0.8rem;
  background: var(--accent-gradient-soft);
  color: var(--accent-primary);
}
.kpi-card.kpi-success .kpi-icon { background: var(--success-bg); color: var(--success); }
.kpi-card.kpi-warning .kpi-icon { background: var(--warning-bg); color: var(--warning); }
.kpi-card.kpi-danger  .kpi-icon { background: var(--danger-bg);  color: var(--danger); }
.kpi-card .kpi-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.kpi-card .kpi-value {
  font-size: 2rem;
  font-weight: 700;
  margin-top: 4px;
  color: var(--text-primary);
}
/* ---- KPI card CLICCABILI (delega card-link) ------------------------------- */
a.kpi-card,
a.kpi-card:hover,
a.kpi-card:focus {
  text-decoration: none;
  color: inherit;
  display: block;
}
a.kpi-card {
  cursor: pointer;
}
/* Affordance: freccina in alto a destra che si accende su hover/focus */
a.kpi-card.kpi-link::after {
  content: "\f054"; /* fa-chevron-right */
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free";
  font-weight: 900;
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.45;
  transition: opacity var(--transition-base), transform var(--transition-base);
}
a.kpi-card.kpi-link:hover::after,
a.kpi-card.kpi-link:focus-visible::after {
  opacity: 1;
  transform: translateX(3px);
}
/* Focus visibile da tastiera (accessibilità obbligatoria) */
a.kpi-card:focus-visible {
  outline: 3px solid var(--accent-primary);
  outline-offset: 3px;
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}
/* Il contenitore calendario, quando raggiunto via ancora, non mostra outline */
.calendar-shell:focus {
  outline: none;
}

/* ============= SCROLLBAR ============= */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* ============= SELECTION ============= */
::selection { background: rgba(79, 156, 255, 0.4); color: #fff; }

/* ============= LINKS ============= */
a { color: var(--accent-primary); text-decoration: none; }
a:hover { color: var(--accent-tertiary); }

/* ============= MOBILE RESPONSIVE ============= */
@media (max-width: 768px) {
  body { font-size: 14px; }
  .hub-container { padding: 0 1rem 2rem; }
  .hub-topbar { padding: 0.75rem 1rem; }
  .hub-topbar-brand .brand-text { display: none; }
  .hub-page-title { font-size: 1.4rem; }
  .hub-page-title i { width: 38px; height: 38px; font-size: 1rem; }
  .toast-stack { left: 12px; right: 12px; max-width: none; top: 12px; }
  .toast { min-width: 0; width: 100%; }
  .hub-modal { padding: 1.4rem; }
  .hub-sidebar { width: 86%; right: -100%; }
  .hub-table { font-size: 0.85rem; }
  .hub-table thead th, .hub-table tbody td { padding: 0.7rem 0.6rem; }
}
@media (max-width: 480px) {
  .hub-page-header { flex-direction: column; align-items: stretch; }
  .kpi-card .kpi-value { font-size: 1.6rem; }
  .user-menu-trigger .user-name { display: none; }
  .hub-topbar-actions { gap: 4px; }
}

/* ============= LEGACY OVERRIDES (per supportare le pagine esistenti) ============= */
.success-msg {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.3);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.3s ease;
}
.success-msg::before { content: '\f058'; font-family: 'Font Awesome 6 Free'; font-weight: 900; }

.error-msg, .errore {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.3s ease;
}
.error-msg::before, .errore::before {
  content: '\f06a';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
}
