/* ============================================
   GESTIONE RISPARMI - POLIZIA DI STATO
   Design System & Styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Variables ── */
:root {
  --bg-primary: #080e1a;
  --bg-secondary: #0f172a;
  --bg-card: rgba(15, 23, 42, 0.8);
  --bg-card-hover: rgba(20, 30, 55, 0.9);
  --bg-glass: rgba(15, 23, 42, 0.6);
  --bg-input: rgba(15, 23, 42, 0.5);
  --bg-sidebar: rgba(8, 14, 26, 0.95);
  
  --gold: #c9a84c;
  --gold-light: #e0c872;
  --gold-dim: rgba(201, 168, 76, 0.15);
  --gold-glow: rgba(201, 168, 76, 0.3);
  
  --blue-accent: #3b82f6;
  --blue-dim: rgba(59, 130, 246, 0.15);
  
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.15);
  --green-glow: rgba(34, 197, 94, 0.3);
  
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.15);
  --red-glow: rgba(239, 68, 68, 0.3);
  
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --border: rgba(148, 163, 184, 0.1);
  --border-gold: rgba(201, 168, 76, 0.3);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-gold: 0 4px 20px rgba(201, 168, 76, 0.2);
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
  
  --sidebar-width: 260px;
}

/* ── Reset ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse 80% 60% at 10% 10%, rgba(201, 168, 76, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 90% 90%, rgba(59, 130, 246, 0.03) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

a { color: var(--gold); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--gold-light); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ============================================
   AUTH PAGES (Login, Register, PIN)
   ============================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}

.auth-bg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: 
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(201, 168, 76, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(59, 130, 246, 0.05) 0%, transparent 50%),
    var(--bg-primary);
  z-index: 0;
}

.auth-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  animation: fadeSlideUp 0.6s ease;
}

.auth-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-lg);
}

.auth-header {
  text-align: center;
  margin-bottom: 36px;
}

.auth-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  box-shadow: var(--shadow-gold);
  animation: pulseGlow 3s ease-in-out infinite;
}

.auth-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.auth-header p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ── Form Elements ── */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
  outline: none;
}

.form-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
  background: rgba(15, 23, 42, 0.7);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn:hover::after { opacity: 1; }

.btn-primary {
  background: linear-gradient(135deg, var(--gold), #b8953e);
  color: #0a0a0a;
  width: 100%;
  box-shadow: var(--shadow-gold);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(201, 168, 76, 0.35);
}

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

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--gold);
  background: var(--gold-dim);
}

.btn-success {
  background: linear-gradient(135deg, var(--green), #16a34a);
  color: white;
}

.btn-danger {
  background: linear-gradient(135deg, var(--red), #dc2626);
  color: white;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  font-size: 1rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ── PIN Input ── */
.pin-container {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 30px 0;
}

.pin-digit {
  width: 56px;
  height: 64px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--gold);
  outline: none;
  transition: all var(--transition-fast);
  -moz-appearance: textfield;
}

.pin-digit::-webkit-inner-spin-button,
.pin-digit::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

.pin-digit:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
  transform: translateY(-2px);
}

.pin-digit.filled {
  border-color: var(--gold);
  background: var(--gold-dim);
}

/* ── Auth Links ── */
.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.auth-footer a {
  color: var(--gold);
  font-weight: 600;
}

/* ============================================
   APP LAYOUT (Sidebar + Content)
   ============================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition-normal);
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: var(--shadow-gold);
  flex-shrink: 0;
}

.sidebar-brand-text h2 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.sidebar-brand-text span {
  font-size: 0.7rem;
  color: var(--gold);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  text-decoration: none;
  position: relative;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(201, 168, 76, 0.08);
}

.nav-link.active {
  color: var(--gold);
  background: var(--gold-dim);
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--gold);
  border-radius: 0 3px 3px 0;
}

.nav-link .nav-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 8px;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.user-info:hover {
  background: rgba(148, 163, 184, 0.08);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-dim), var(--blue-dim));
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--gold);
  flex-shrink: 0;
}

.user-details {
  overflow: hidden;
}

.user-details .name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-details .role {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px;
  position: relative;
  z-index: 1;
}

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

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ── Mobile menu toggle ── */
.mobile-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  width: 44px;
  height: 44px;
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--gold);
  font-size: 1.2rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.mobile-toggle:hover {
  background: var(--gold-dim);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

/* ============================================
   DASHBOARD CARDS
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card.saldo::before { background: linear-gradient(90deg, var(--gold), var(--gold-light)); }
.stat-card.entrate::before { background: linear-gradient(90deg, var(--green), #4ade80); }
.stat-card.uscite::before { background: linear-gradient(90deg, var(--red), #f87171); }

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-gold);
}

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

.stat-card-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.stat-card.saldo .stat-card-icon { background: var(--gold-dim); color: var(--gold); }
.stat-card.entrate .stat-card-icon { background: var(--green-dim); color: var(--green); }
.stat-card.uscite .stat-card-icon { background: var(--red-dim); color: var(--red); }

.stat-card-value {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card.saldo .stat-card-value { color: var(--gold); }
.stat-card.entrate .stat-card-value { color: var(--green); }
.stat-card.uscite .stat-card-value { color: var(--red); }

.stat-card-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============================================
   PANELS / SECTIONS
   ============================================ */
.panel {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.panel-header h2 {
  font-size: 1rem;
  font-weight: 700;
}

.panel-body {
  padding: 24px;
}

.panel-body.no-pad {
  padding: 0;
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 14px 20px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(0,0,0,0.2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 14px 20px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tr:hover td {
  background: rgba(201, 168, 76, 0.03);
}

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

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-entrata {
  background: var(--green-dim);
  color: var(--green);
}

.badge-uscita {
  background: var(--red-dim);
  color: var(--red);
}

.amount-positive { color: var(--green); font-weight: 600; }
.amount-negative { color: var(--red); font-weight: 600; }

.badge-in_attesa {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

.badge-approvato {
  background: var(--green-dim);
  color: var(--green);
}

.badge-rifiutato {
  background: var(--red-dim);
  color: var(--red);
}

/* ── Rimborso detail card ── */
.rimborso-card {
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  transition: all var(--transition-fast);
  background: rgba(0,0,0,0.1);
}

.rimborso-card:hover {
  border-color: var(--border-gold);
  background: rgba(201, 168, 76, 0.03);
}

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

.rimborso-card-body {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.rimborso-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.rimborso-admin-note {
  margin-top: 8px;
  padding: 10px 14px;
  background: var(--bg-input);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.rimborso-admin-note strong {
  color: var(--gold);
}

/* ============================================
   FILTERS
   ============================================ */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-group label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-input {
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  outline: none;
  transition: all var(--transition-fast);
  min-width: 140px;
}

.filter-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}

select.filter-input {
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.95);
  transition: transform var(--transition-normal);
  box-shadow: var(--shadow-lg);
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

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

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--red-dim);
  color: var(--red);
}

.modal-body {
  padding: 24px;
}

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

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight 0.3s ease;
  box-shadow: var(--shadow-md);
  max-width: 400px;
  border: 1px solid;
}

.toast-success {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.3);
  color: var(--green);
}

.toast-error {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--red);
}

.toast-info {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.3);
  color: var(--blue-accent);
}

/* ============================================
   CHART
   ============================================ */
.chart-container {
  padding: 24px;
  height: 280px;
  position: relative;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 200px;
  padding: 0 10px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.chart-bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.chart-bars-pair {
  display: flex;
  gap: 4px;
  align-items: flex-end;
  height: 180px;
}

.chart-bar {
  width: 24px;
  min-height: 4px;
  border-radius: 4px 4px 0 0;
  transition: height var(--transition-slow);
}

.chart-bar.entrata { background: linear-gradient(to top, var(--green-dim), var(--green)); }
.chart-bar.uscita { background: linear-gradient(to top, var(--red-dim), var(--red)); }

.chart-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding-top: 16px;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.chart-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.chart-legend-dot.entrata { background: var(--green); }
.chart-legend-dot.uscita { background: var(--red); }

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
}

.pagination button {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pagination button:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--gold);
}

.pagination button.active {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: var(--gold);
}

.pagination button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pagination-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 8px;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.85rem;
}

/* ============================================
   PROFILE PAGE
   ============================================ */
.profile-card {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 32px;
}

.profile-avatar-lg {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-dim), var(--blue-dim));
  border: 3px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--gold);
  flex-shrink: 0;
}

.profile-info h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.profile-info .email {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.profile-info .role-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 6px;
}

.role-badge.admin { background: var(--gold-dim); color: var(--gold); }
.role-badge.utente { background: var(--blue-dim); color: var(--blue-accent); }

/* ============================================
   LOADING SPINNER
   ============================================ */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 40px auto;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 14, 26, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  z-index: 10;
}

/* ============================================
   ADMIN SECTION
   ============================================ */
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.user-select-card {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-select-card:hover {
  border-color: var(--gold);
  background: var(--gold-dim);
}

.user-select-card.selected {
  border-color: var(--gold);
  background: var(--gold-dim);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100px); }
  to { opacity: 1; transform: translateX(0); }
}

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

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 4px 20px rgba(201, 168, 76, 0.2); }
  50% { box-shadow: 0 4px 30px rgba(201, 168, 76, 0.4); }
}

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

.animate-in {
  animation: fadeSlideUp 0.4s ease both;
}

.animate-in-delay-1 { animation-delay: 0.1s; }
.animate-in-delay-2 { animation-delay: 0.2s; }
.animate-in-delay-3 { animation-delay: 0.3s; }
.animate-in-delay-4 { animation-delay: 0.4s; }

/* ============================================
   MOBILE BOTTOM NAV 
   ============================================ */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-sidebar);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
}

.bottom-nav-items {
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--transition-fast);
  border-radius: var(--radius-sm);
}

.bottom-nav-item .nav-icon {
  font-size: 1.2rem;
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
  color: var(--gold);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .mobile-toggle {
    display: flex;
  }
  
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .sidebar-overlay.open {
    display: block;
  }
  
  .main-content {
    margin-left: 0;
    padding: 80px 16px 100px;
  }
  
  .bottom-nav {
    display: block;
  }
  
  .auth-card {
    padding: 28px 24px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .stat-card {
    padding: 18px;
  }
  
  .stat-card-value {
    font-size: 1.4rem;
  }
  
  .filters-bar {
    flex-direction: column;
    gap: 10px;
  }

  .filter-input {
    width: 100%;
    min-width: unset;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }

  .page-header h1 {
    font-size: 1.3rem;
  }

  .profile-card {
    flex-direction: column;
    text-align: center;
  }

  .modal {
    margin: 10px;
    max-height: 85vh;
  }

  .panel-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  td, th {
    padding: 10px 14px;
    font-size: 0.8rem;
  }

  .chart-bar {
    width: 16px;
  }
}

@media (max-width: 480px) {
  .pin-container {
    gap: 8px;
  }

  .pin-digit {
    width: 48px;
    height: 56px;
    font-size: 1.2rem;
  }
}

/* ============================================
   UTILITIES
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-gold { color: var(--gold); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-12 { gap: 12px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }
