/* ==========================================================================
   DESIGN SYSTEM & VARIABLES (DARK THEME ULTRA-COMPACT COCKPIT)
   ========================================================================== */
:root {
  --bg-primary: #07090e;
  --bg-secondary: #0d121c;
  --bg-card: rgba(16, 22, 34, 0.85);
  --bg-card-subtle: rgba(22, 30, 46, 0.6);
  --bg-pill: rgba(255, 255, 255, 0.04);
  --bg-pill-hover: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(99, 102, 241, 0.4);
  
  /* Brand Accents */
  --accent-primary: #6366f1;
  --accent-primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  --accent-success: #10b981;
  --accent-success-soft: rgba(16, 185, 129, 0.12);
  --accent-warning: #f59e0b;
  --accent-warning-soft: rgba(245, 158, 11, 0.14);
  --accent-danger: #ef4444;
  --accent-cyan: #06b6d4;

  /* Typography */
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Text colors */
  --text-main: #f8fafc;
  --text-muted: #cbd5e1;
  --text-dim: #94a3b8;

  /* Spacing & Radii */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  
  --shadow-card: 0 8px 24px -6px rgba(0, 0, 0, 0.6), 0 0 1px 1px rgba(255, 255, 255, 0.04);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 20% 10%, rgba(99, 102, 241, 0.09) 0%, transparent 45%),
    radial-gradient(circle at 80% 90%, rgba(16, 185, 129, 0.05) 0%, transparent 45%);
  background-attachment: fixed;
}

.app-container {
  width: 100%;
  max-width: 520px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 12px 14px 80px 14px;
  position: relative;
  transition: max-width 0.25s ease;
}

@media (min-width: 820px) {
  .app-container {
    max-width: 1060px;
  }
}

@media (min-width: 1200px) {
  .app-container {
    max-width: 1180px;
  }
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 2px 8px 2px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-right-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.year-toggle-pill {
  display: flex;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 2px;
}

.year-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s;
}

.year-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

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

@keyframes pulseLive {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.brand-name {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #ffffff;
}

.tool-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tool-btn:active {
  transform: scale(0.92);
}

.tool-btn.rotating svg {
  animation: spin 0.8s linear infinite;
}

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

/* ==========================================================================
   MONTH NAVIGATOR BAR (Frecce < Mese >)
   ========================================================================== */
.month-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 6px 8px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-card);
  position: relative;
}

.nav-arrow-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-arrow-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
}

.nav-arrow-btn:active {
  transform: scale(0.92);
}

.month-title-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  cursor: pointer;
  padding: 3px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  user-select: none;
}

.month-title-wrap:hover {
  background: rgba(255, 255, 255, 0.06);
}

.month-title-interactive {
  display: flex;
  align-items: center;
  gap: 6px;
}

.month-chevron-svg {
  color: var(--text-dim);
  transition: transform 0.2s ease;
}

.month-title-wrap.active .month-chevron-svg {
  transform: rotate(180deg);
  color: var(--accent-primary);
}

.month-big-name {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #ffffff;
}

.year-sub-name {
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #818cf8;
}

/* Month Picker Popover */
.month-picker-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 16px);
  max-width: 360px;
  background: #111624;
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.05);
  padding: 12px;
  z-index: 95;
  animation: slideModal 0.18s ease-out;
}

.month-picker-popover.hidden {
  display: none;
}

.picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.picker-title {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.close-mini-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.close-mini-btn:hover {
  color: #ffffff;
}

.months-grid-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.month-pick-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-main);
  padding: 8px 4px;
  font-size: 0.76rem;
  font-weight: 700;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.month-pick-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.month-pick-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.45);
}


/* ==========================================================================
   COCKPIT BAR (Hero Card Bilancio Finale + Griglia 2x2 Pilastri)
   ========================================================================== */
.cockpit-bar {
  display: grid;
  grid-template-columns: 1.1fr 1.3fr;
  gap: 10px;
  margin-bottom: 12px;
}

/* 1. HERO CARD BILANCIO FINALE */
.cockpit-hero {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(15, 23, 42, 0.7) 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}

.cockpit-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #10b981, #38bdf8);
}

.hero-header-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.hero-badge {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.cockpit-hero-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.cockpit-hero-amount-wrap {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: 6px 0;
}

.hero-currency {
  font-size: 1.15rem;
  font-weight: 700;
  color: #34d399;
}

.hero-amount-val {
  font-size: 1.85rem;
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
  color: #ffffff;
  text-shadow: 0 0 25px rgba(16, 185, 129, 0.35);
}

.hero-formula-box {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-xs);
  padding: 5px 8px;
}

.cockpit-formula-text {
  font-size: 0.72rem;
  color: #cbd5e1;
  font-family: var(--font-mono);
  line-height: 1.35;
  display: block;
}

/* 2. GRIGLIA 2x2 I 4 PILASTRI DEL MESE */
.cockpit-grid-4 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cockpit-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  transition: all 0.15s ease;
}

.cockpit-kpi-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.045);
}

.cockpit-kpi-card.in-card {
  border-color: rgba(16, 185, 129, 0.2);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.03) 0%, rgba(255, 255, 255, 0.02) 100%);
}

.cockpit-kpi-card.out-card {
  border-color: rgba(245, 158, 11, 0.2);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.03) 0%, rgba(255, 255, 255, 0.02) 100%);
}

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

.kpi-card-label {
  font-size: 0.70rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.kpi-card-label.in { color: #34d399; }
.kpi-card-label.out { color: #fbbf24; }

.kpi-card-value {
  font-size: 0.95rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #ffffff;
  letter-spacing: -0.01em;
  margin: 1px 0;
}

.kpi-card-value.cyan { color: #38bdf8; }
.kpi-card-value.warn { color: var(--accent-warning); }
.kpi-card-value.in { color: #10b981; }
.kpi-card-value.out { color: #f87171; }

.kpi-card-sub {
  font-size: 0.68rem;
  color: var(--text-dim);
  font-weight: 600;
}

.kpi-card-sub.in { color: #34d399; }
.kpi-card-sub.out { color: #fbbf24; }

.mini-edit-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 1px 4px;
  font-size: 0.7rem;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s;
}

.mini-edit-btn:active {
  background: rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   NAVIGATION SEGMENTS (TABS)
   ========================================================================== */
.nav-segment {
  display: flex;
  background: rgba(16, 22, 34, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 4px;
  margin-bottom: 12px;
}

.segment-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 7px 4px;
  border-radius: var(--radius-xs);
  font-size: 0.74rem;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.segment-btn.active {
  background: rgba(99, 102, 241, 0.2);
  color: #ffffff;
  border: 1px solid rgba(99, 102, 241, 0.35);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   VIEW PANELS
   ========================================================================== */
.view-panel {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.view-panel.active {
  display: flex;
}

/* ==========================================================================
   PANEL BOX & HEAD
   ========================================================================== */
.panel-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-card);
}

.urgent-box {
  border-color: rgba(245, 158, 11, 0.3);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.05) 0%, rgba(16, 22, 34, 0.85) 100%);
}

.box-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.box-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.box-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #ffffff;
}

.box-note {
  font-size: 0.76rem;
  color: var(--text-dim);
}

.status-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-indicator.alert {
  background: var(--accent-warning);
  box-shadow: 0 0 8px var(--accent-warning);
}

.status-indicator.in {
  background: var(--accent-income);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.status-indicator.out {
  background: var(--accent-expense);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.badge-mini {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.badge-mini.alert {
  background: var(--accent-warning-soft);
  color: var(--accent-warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-mini.info {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
}

/* ==========================================================================
   PENDING GRID (Spese Aperte ad Ottobre - Tessere Tap-To-Pay rapide)
   ========================================================================== */
.pending-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pending-card {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.pending-card:hover {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.45);
}

.pending-card:active {
  transform: scale(0.97);
}

.pending-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pending-card-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pending-card-desc {
  font-size: 0.78rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pending-card-amount {
  font-size: 0.85rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #fbbf24;
}

.pending-check-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.pending-card:hover .pending-check-btn {
  border-color: var(--accent-success);
}

.pending-card.income-card {
  border-color: rgba(16, 185, 129, 0.35);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
}

.pending-card.income-card:hover {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.6);
}

.pending-card.income-card .pending-card-amount {
  color: #34d399;
}

.pending-card.income-card .pending-check-btn {
  border-color: rgba(16, 185, 129, 0.4);
}

.pending-card.income-card:hover .pending-check-btn {
  border-color: #34d399;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.pending-badge-tag {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 2px;
  width: fit-content;
}

.pending-badge-tag.in {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.pending-badge-tag.out {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.pending-empty-msg {
  grid-column: 1 / -1;
  text-align: center;
  padding: 14px;
  font-size: 0.78rem;
  color: var(--accent-success);
  background: var(--accent-success-soft);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

/* ==========================================================================
   IN-OUT DUAL GRID (Riepilogo Compatto Ingressi vs Uscite Entrambi Ceccabili)
   ========================================================================== */
.in-out-dual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.dual-col {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px;
  display: flex;
  flex-direction: column;
}

.col-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 6px;
}

.col-title {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.col-total {
  font-size: 0.80rem;
  font-weight: 800;
  font-family: var(--font-mono);
}

.col-total.in {
  color: var(--accent-success);
}

.col-total.out {
  color: #f1f5f9;
}

.compact-pill-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 520px;
  min-height: 180px;
  overflow-y: auto;
}

/* Barra di ricerca rapida uscite nel CashFlow */
.cf-search-box {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 6px;
}

.cf-search-box .search-icon {
  position: absolute;
  left: 8px;
  color: var(--text-dim);
  pointer-events: none;
}

.cf-search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 6px 24px 6px 26px;
  color: #ffffff;
  font-size: 0.75rem;
  font-family: var(--font-main);
  outline: none;
  transition: all 0.18s ease;
}

.cf-search-input::placeholder {
  color: var(--text-dim);
  font-size: 0.72rem;
}

.cf-search-input:focus {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.12);
}

.cf-search-box .clear-search-btn {
  position: absolute;
  right: 6px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  padding: 1px 4px;
}

.cf-search-box .clear-search-btn:hover {
  color: #ffffff;
}

/* Scrollbar sottile */
.compact-pill-list::-webkit-scrollbar {
  width: 3px;
}
.compact-pill-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.pill-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 6px;
  background: var(--bg-pill);
  border-radius: var(--radius-xs);
  font-size: 0.72rem;
  border: 1px solid rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill-row:hover {
  background: var(--bg-pill-hover);
  border-color: rgba(255, 255, 255, 0.1);
}

.pill-row:active {
  transform: scale(0.97);
}

.pill-row.pending-item {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.05);
}

.pill-row.pending-item.in-item {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.06);
}

.pill-left {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  flex: 1;
  min-width: 0;
}

.pill-check {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.pill-check.checked {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.5);
}

.pill-check.unchecked {
  background: transparent;
  color: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
}

.pill-row:hover .pill-check.unchecked {
  border-color: rgba(255, 255, 255, 0.5);
}

.pill-check.unchecked.in-check {
  border-color: rgba(16, 185, 129, 0.35);
}

.pill-row:hover .pill-check.unchecked.in-check {
  border-color: rgba(16, 185, 129, 0.7);
}

.pill-name {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill-val {
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  flex-shrink: 0;
}

.pill-val.in {
  color: var(--accent-success);
}

.pill-val.out {
  color: #cbd5e1;
}

/* ==========================================================================
   QUICK MIC STRIP
   ========================================================================== */
.quick-mic-strip {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.mic-strip-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-md);
  color: #c7d2fe;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.2s ease;
}

.mic-strip-btn:active {
  transform: scale(0.98);
  background: rgba(99, 102, 241, 0.25);
}

.mic-strip-btn.listening {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fca5a5;
  animation: pulseMic 1.5s infinite;
}

@keyframes pulseMic {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

.mic-icon-circle {
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-bubble {
  background: rgba(16, 22, 34, 0.95);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.76rem;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.voice-bubble.hidden {
  display: none;
}

.listening-pulse {
  width: 7px;
  height: 7px;
  background: var(--accent-danger);
  border-radius: 50%;
  animation: pulseLive 1s infinite;
}

/* ==========================================================================
   MOVIMENTI & NOVEMBRE LISTS (High-density)
   ========================================================================== */
.movimenti-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 190px;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-dim);
  pointer-events: none;
}

.mov-search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 30px 8px 32px;
  color: #ffffff;
  font-size: 0.8rem;
  font-family: var(--font-main);
  outline: none;
  transition: all 0.2s ease;
}

.mov-search-input:focus {
  border-color: var(--accent-primary);
  background: rgba(255, 255, 255, 0.07);
}

.clear-search-btn {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  padding: 2px 4px;
}

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

.clear-search-btn.hidden {
  display: none;
}

.mov-filter-select {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  color: #ffffff;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-family: var(--font-main);
  outline: none;
  cursor: pointer;
  max-width: 180px;
}

.mov-filter-select:focus {
  border-color: var(--accent-primary);
}

.movimenti-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--text-dim);
  margin-bottom: 8px;
  padding: 0 2px;
}

.mov-counter-lbl {
  font-weight: 600;
}

.mov-filtered-sum {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-muted);
}

.dense-mov-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dense-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.dense-row:hover {
  background: rgba(28, 38, 58, 0.6);
}

.dense-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.dense-desc {
  font-size: 0.78rem;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.dense-sub {
  font-size: 0.74rem;
  color: var(--text-dim);
}

.dense-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.dense-val {
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.dense-val.exp {
  color: #f87171;
}

.dense-val.inc {
  color: var(--accent-success);
}

.dense-badge {
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.add-mini-btn {
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
}

/* ==========================================================================
   FLOATING ACTION BUTTON (FAB)
   ========================================================================== */
.floating-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent-primary-gradient);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
  cursor: pointer;
  z-index: 90;
  transition: transform 0.2s ease;
}

.floating-fab:active {
  transform: scale(0.92);
}

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  padding: 14px;
}

@media (min-width: 600px) {
  .modal-backdrop {
    align-items: center;
  }
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background: #111622;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8);
  animation: slideModal 0.22s ease-out;
}

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

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

.modal-head h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
}

.close-x {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

.form-fld {
  margin-bottom: 12px;
}

.form-row {
  display: flex;
  gap: 10px;
}

.flex-1 {
  flex: 1;
}

.modal-lbl {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.modal-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 6px;
  margin-bottom: 14px;
  line-height: 1.35;
}

.num-input, .text-input, .date-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: #ffffff;
  font-size: 0.9rem;
  font-family: var(--font-main);
  outline: none;
  transition: border-color 0.2s;
}

.num-input:focus, .text-input:focus, .date-input:focus {
  border-color: var(--accent-primary);
  background: rgba(255, 255, 255, 0.08);
}

.dense-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 130px;
  overflow-y: auto;
  padding: 4px 0;
}

.dense-chips::-webkit-scrollbar {
  width: 3px;
}
.dense-chips::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
}

.cat-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.cat-chip.selected {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
}

.method-toggles {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.toggle-pill {
  position: relative;
  cursor: pointer;
}

.toggle-pill input {
  position: absolute;
  opacity: 0;
}

.toggle-pill span {
  display: block;
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  padding: 8px 4px;
  border-radius: var(--radius-xs);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s;
}

.toggle-pill input:checked + span {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-primary);
  color: #ffffff;
}

.btn-action {
  width: 100%;
  background: var(--accent-primary-gradient);
  border: none;
  color: #ffffff;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
  transition: transform 0.15s;
}

.btn-action:active {
  transform: scale(0.98);
}

.btn-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

/* ==========================================================================
   MODAL TABS & CASHFLOW INSERIMENTO
   ========================================================================== */
.modal-type-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.type-tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.type-tab-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

.type-tab-btn.active {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.45);
  color: #38bdf8;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.25);
}

.modal-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.cf-slot-info-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  margin-bottom: 14px;
  transition: all 0.2s ease;
}

.cf-slot-info-card.full {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.45);
}

.cf-slot-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.cf-slot-icon {
  font-size: 1.15rem;
}

.cf-slot-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #38bdf8;
}

.cf-slot-info-card.full .cf-slot-title {
  color: #f87171;
}

.cf-slot-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 1px;
}

.cf-slot-bar-wrap {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.cf-slot-bar {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.cf-slot-bar.full {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.cf-warning-callout {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  font-size: 0.76rem;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  margin-bottom: 14px;
  line-height: 1.4;
}

/* Pulsante eliminazione riga nel CashFlow Mese */
.pill-right-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-del-cf {
  background: transparent;
  border: none;
  color: var(--text-dim);
  opacity: 0.25;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
}

.btn-edit-cf {
  background: transparent;
  border: none;
  color: var(--text-dim);
  opacity: 0.25;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
}

.pill-row:hover .btn-del-cf,
.pill-row:hover .btn-edit-cf,
.pending-card:hover .btn-edit-cf {
  opacity: 0.75;
}

.btn-del-cf:hover {
  opacity: 1 !important;
  color: #f87171 !important;
  background: rgba(239, 68, 68, 0.18);
  transform: scale(1.1);
}

.btn-edit-cf:hover {
  opacity: 1 !important;
  color: #38bdf8 !important;
  background: rgba(56, 189, 248, 0.18);
  transform: scale(1.1);
}

.modal-actions-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.btn-secondary {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 11px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.btn-secondary:active {
  transform: scale(0.98);
}

/* ==========================================================================
   TOAST SHELF
   ========================================================================== */
.toast-shelf {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 200;
  pointer-events: none;
}

.toast-item {
  background: rgba(17, 24, 39, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  animation: slideToast 0.2s ease-out;
}

@keyframes slideToast {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.skeleton-text {
  text-align: center;
  padding: 16px;
  font-size: 0.74rem;
  color: var(--text-dim);
}

/* ==========================================================================
   PANORAMICA ANNUALE (12 MESI) & TABELLA
   ========================================================================== */
.annual-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.kpi-mini-card {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.kpi-mini-card.invest-card {
  background: rgba(167, 139, 250, 0.07);
  border: 1px solid rgba(167, 139, 250, 0.35);
}

.kpi-lbl.invest {
  color: #c4b5fd;
}

.kpi-val.invest {
  color: #a78bfa;
}

.kpi-sub.invest {
  color: #93c5fd;
}

.kpi-mini-card.hero-savings-card {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(6, 182, 212, 0.08) 100%);
  border: 1px solid rgba(16, 185, 129, 0.45);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.12);
}

.kpi-lbl-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}

.kpi-lbl.highlight {
  color: #6ee7b7;
}

.kpi-val.highlight {
  color: #34d399;
}

.kpi-sub {
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-top: 3px;
  font-family: var(--font-main);
  font-weight: 500;
}

.real-savings-badge {
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  font-size: 0.74rem;
  font-weight: 700;
  font-family: var(--font-mono);
  display: inline-block;
}

.real-savings-badge.pos {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.real-savings-badge.neg {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.legend-dot.invest {
  background: #a78bfa;
}

.active-dot-tag {
  font-size: 0.68rem;
  color: #818cf8;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-left: 4px;
}

.pill-tag-invest {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(167, 139, 250, 0.2);
  color: #c4b5fd;
  border: 1px solid rgba(167, 139, 250, 0.4);
  flex-shrink: 0;
  letter-spacing: 0.03em;
  margin-left: 5px;
}

.kpi-lbl {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 3px;
}

.kpi-val {
  font-size: 0.88rem;
  font-weight: 800;
  font-family: var(--font-mono);
}

.kpi-val.in { color: var(--accent-success); }
.kpi-val.out { color: #f87171; }
.kpi-val.net { color: #38bdf8; }

/* Annual 12-Month SVG Bar Chart */
.annual-chart-box {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 12px;
}

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

.chart-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chart-title {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #ffffff;
}

.chart-sub {
  font-size: 0.68rem;
  color: var(--text-dim);
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.legend-dot.in {
  background: #10b981;
}

.legend-dot.out {
  background: #f87171;
}

.annual-svg-wrapper {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-xs);
  background: rgba(0, 0, 0, 0.2);
  padding: 8px 4px 4px 4px;
}

.annual-svg-wrapper svg {
  display: block;
  width: 100%;
  min-width: 600px;
  height: auto;
}

.chart-month-group {
  transition: opacity 0.15s ease;
}

.chart-month-group:hover rect:not([fill="transparent"]):not([fill*="rgba"]) {
  filter: brightness(1.2);
}

.chart-month-group:hover text {
  fill: #38bdf8 !important;
}

.table-responsive-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.15);
}

.table-responsive-wrapper::-webkit-scrollbar {
  height: 4px;
}
.table-responsive-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
}

.annual-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  text-align: left;
}

.annual-table th {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.annual-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  white-space: nowrap;
  font-family: var(--font-mono);
  font-weight: 600;
}

.annual-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.annual-table tr.active-month-row td {
  background: rgba(99, 102, 241, 0.14);
}

.annual-table tr.active-month-row td:first-child {
  border-left: 2px solid var(--accent-primary);
}

.month-cell-name {
  font-family: var(--font-main);
  font-weight: 700;
  color: #ffffff;
}

.net-badge {
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.74rem;
  font-weight: 800;
}

.net-badge.pos {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.net-badge.neg {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.jump-month-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-main);
  transition: all 0.15s;
}

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

/* ==========================================================================
   DASHBOARD PATRIMONIALE & ANALITICA FLUSSI
   ========================================================================== */
.networth-box {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.85) 0%, rgba(30, 41, 59, 0.65) 100%);
  border: 1px solid rgba(56, 189, 248, 0.25);
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  margin-bottom: 12px;
}

.networth-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #38bdf8, #818cf8, #34d399);
}

.nw-hero-row {
  margin-bottom: 14px;
}

.nw-hero-tag {
  font-size: 0.70rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #38bdf8;
  display: inline-block;
  margin-bottom: 4px;
}

.nw-hero-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.03em;
  margin: 0 0 4px 0;
}

.nw-amount-wrap {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 4px 0 10px 0;
}

.nw-sym {
  font-size: 1.5rem;
  font-weight: 700;
  color: #38bdf8;
}

.nw-val-huge {
  font-size: 2.5rem;
  font-weight: 900;
  font-family: var(--font-mono);
  color: #ffffff;
  letter-spacing: -0.02em;
  text-shadow: 0 0 30px rgba(56, 189, 248, 0.35);
}

.nw-breakdown-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nw-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.ing-live-pill {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  letter-spacing: 0.04em;
}

.ing-live-pill.offline {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.25);
}

.nw-ing-subdetail {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: #94a3b8;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.nw-ing-sub-lbl {
  color: #38bdf8;
  font-weight: 600;
}

.pending-badge-inline {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

/* Secondary Patrimonio Card (Sotto, in secondo piano) */
.nw-secondary-patrimonio-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-top: 6px;
}

.nw-sec-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.nw-sec-title {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #94a3b8;
  text-transform: uppercase;
}

.nw-sec-amount {
  font-size: 1.15rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #e2e8f0;
}

.nw-pill {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  padding: 3px 10px;
  font-size: 0.76rem;
  color: #cbd5e1;
}

.nw-pill strong {
  color: #ffffff;
  font-family: var(--font-mono);
}

/* Bicolor Vector Icon System */
.bicolor-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.bicolor-icon-wrap svg {
  width: 17px;
  height: 17px;
  stroke-width: 2.2;
}

.bicolor-icon-wrap.cyan {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
}

.bicolor-icon-wrap.emerald {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.bicolor-icon-wrap.violet {
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #a78bfa;
}

.bicolor-icon-wrap.amber {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.bicolor-icon-wrap.rose {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #fb7185;
}

/* Secondary Net Worth Info (TFR e Totale Complessivo) */
.nw-secondary-total {
  font-size: 0.78rem;
  color: #cbd5e1;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nw-secondary-total strong {
  color: #ffffff;
  font-family: var(--font-mono);
}

.nw-sec-dot {
  color: rgba(255, 255, 255, 0.25);
  font-weight: 700;
}

/* 5 Asset Cards (Fluide e senza tagli) */
.assets-grid-5 {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

@media (max-width: 980px) {
  .assets-grid-5 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .assets-grid-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.asset-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  min-width: 0;
  overflow: hidden;
}

.asset-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.asset-card.locked-card {
  border-color: rgba(244, 63, 94, 0.25);
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.04) 0%, rgba(255, 255, 255, 0.02) 100%);
}

.asset-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  min-width: 0;
}

.asset-label-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
}

.asset-label {
  font-size: 0.70rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.asset-badge-locked {
  font-size: 0.60rem;
  font-weight: 800;
  text-transform: uppercase;
  background: rgba(244, 63, 94, 0.2);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.35);
  padding: 1px 4px;
  border-radius: 3px;
  flex-shrink: 0;
}

.asset-edit-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xs);
  color: var(--text-dim);
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
  margin-left: auto;
  flex-shrink: 0;
}

.asset-edit-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

.asset-val {
  font-size: clamp(0.92rem, 1.2vw, 1.08rem);
  font-weight: 800;
  font-family: var(--font-mono);
  color: #ffffff;
  margin: 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asset-val.cyan { color: #38bdf8; }
.asset-val.violet { color: #a78bfa; }
.asset-val.emerald { color: #34d399; }
.asset-val.amber { color: #fbbf24; }
.asset-val.rose { color: #fb7185; }

.asset-sub {
  font-size: 0.70rem;
  color: var(--text-dim);
}

/* ==========================================================================
   BARRA SELEZIONE PERIODO (Controller Principale con Combo in Evidenza)
   ========================================================================== */
.period-control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}

.period-selectors-card {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 16px rgba(56, 189, 248, 0.12);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.period-sel-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.period-badge-lbl {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.period-badge-lbl.da {
  background: rgba(56, 189, 248, 0.16);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.32);
}

.period-badge-lbl.a {
  background: rgba(167, 139, 250, 0.16);
  color: #c084fc;
  border: 1px solid rgba(167, 139, 250, 0.32);
}

.period-arrow-divider {
  display: flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.35);
}

.select-styled-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.period-select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(8, 12, 20, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  padding: 7px 32px 7px 12px;
  border-radius: var(--radius-xs);
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  min-width: 155px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.period-select:hover {
  background: rgba(15, 23, 42, 1);
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.period-select:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.4);
}

.select-arrow-svg {
  position: absolute;
  right: 10px;
  pointer-events: none;
  color: #94a3b8;
  transition: transform 0.2s ease;
}

.period-select:focus + .select-arrow-svg {
  color: #38bdf8;
  transform: rotate(180deg);
}

.period-presets-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.period-quick-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.dash-quick-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 5px 11px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dash-quick-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

.dash-quick-btn.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.9), rgba(79, 70, 229, 0.95));
  border-color: #818cf8;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}

.dash-count-pill {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  font-size: 0.74rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* 4 KPI del Periodo */
.period-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.period-kpi-card {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
}

.period-kpi-lbl {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 3px;
}

.period-kpi-val {
  font-size: 1.15rem;
  font-weight: 900;
  font-family: var(--font-mono);
  margin: 2px 0;
}

.period-kpi-val.in { color: #10b981; }
.period-kpi-val.out { color: #f87171; }
.period-kpi-val.net { color: #38bdf8; }
.period-kpi-val.rate { color: #a78bfa; }

.period-kpi-sub {
  font-size: 0.74rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* Nav segment tabs con icone SVG */
.tab-svg {
  flex-shrink: 0;
  opacity: 0.8;
  transition: opacity 0.15s ease;
}

.segment-btn.active .tab-svg {
  opacity: 1;
}

/* Category Card Lists (Compatte, non-invasive e con scroll elegante) */
.dash-dual-grid {
  margin-top: 10px;
}

.cat-card-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 2px 2px 2px 0;
  max-height: 480px;
  overflow-y: auto;
}

.cat-card-list::-webkit-scrollbar {
  width: 4px;
}

.cat-card-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
}

.cat-card-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

.cat-card-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

.cat-budget-row {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: all 0.15s ease;
  min-height: 38px;
}

.cat-budget-row:hover {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.14);
}

.cat-budget-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cat-budget-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: nowrap;
}

.cat-name {
  font-weight: 700;
  font-size: 0.81rem;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-name.in {
  color: #ffffff;
}

.cat-budget-figures {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-shrink: 0;
}

.cat-figure-total {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.84rem;
  color: #f87171;
}

.cat-figure-total.in {
  color: #10b981;
}

.cat-figure-avg {
  font-family: var(--font-mono);
  font-size: 0.69rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* Micro-Barra di avanzamento ultra-sottile (2px hairline) non invasiva */
.cat-progress-track {
  height: 2px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 1px;
  overflow: hidden;
  width: 100%;
  margin-top: 2px;
}

.cat-progress-bar {
  height: 100%;
  border-radius: 1px;
  transition: width 0.3s ease;
}

.cat-progress-bar.ok {
  background: #10b981;
}

.cat-progress-bar.warn {
  background: #f59e0b;
}

.cat-progress-bar.over {
  background: #ef4444;
}

.cat-progress-bar.in {
  background: #10b981;
}

.cat-share-pill {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.22);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.budget-status-pill {
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.67rem;
  font-weight: 700;
  font-family: var(--font-mono);
  display: inline-block;
  white-space: nowrap;
  flex-shrink: 0;
}

.budget-status-pill.ok {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.budget-status-pill.warn {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.budget-status-pill.over {
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ==========================================================================
   RESPONSIVE DESIGN (Smartphone & Tablet)
   ========================================================================== */
@media (max-width: 860px) {
  .period-kpi-grid {
    grid-template-columns: 1fr 1fr;
  }
  .in-out-dual-grid {
    grid-template-columns: 1fr;
  }
  .btn-del-cf,
  .btn-edit-cf {
    opacity: 0.65;
  }
}

@media (max-width: 680px) {
  .cockpit-bar {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
  }

  .cockpit-hero {
    padding: 12px 14px;
    border-radius: var(--radius-md);
  }

  .hero-amount-val {
    font-size: 1.65rem;
  }

  .cockpit-grid-4 {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .cockpit-kpi-card {
    padding: 8px 10px;
  }

  .kpi-card-value {
    font-size: 0.88rem;
  }

  .annual-kpi-row {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .hero-savings-card {
    grid-column: span 2;
  }

  .assets-grid-5 {
    grid-template-columns: 1fr 1fr;
  }

  .period-kpi-grid {
    grid-template-columns: 1fr 1fr;
  }

  .nw-val-huge {
    font-size: 2rem;
  }
}

/* ==========================================================================
   DESKTOP 1920x1080 / HIGH-RES OPTIMIZATION: ZERO DOUBLE-SCROLL ON CASHFLOW
   ========================================================================== */
@media (min-width: 1024px) {
  .app-container {
    max-width: 1320px;
    padding: 8px 18px 12px 18px;
  }
}

@media (min-width: 1024px) and (min-height: 640px) {
  body[data-active-view="cashflow"],
  body:has(#view-cashflow.active) {
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
  }

  body[data-active-view="cashflow"] .app-container,
  body:has(#view-cashflow.active) .app-container {
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    padding: 8px 20px 8px 20px;
  }

  #view-cashflow.active {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: hidden;
  }

  /* Header & Navigation Bar compatte */
  .app-header {
    padding: 2px 2px 4px 2px;
    flex-shrink: 0;
  }

  .nav-segment {
    margin-bottom: 4px;
    flex-shrink: 0;
    padding: 3px;
  }

  .segment-btn {
    padding: 5px 12px;
    font-size: 0.74rem;
  }

  /* Month Navigator Bar compatto */
  .month-nav-bar {
    margin-bottom: 2px;
    flex-shrink: 0;
  }

  .month-big-name {
    font-size: 0.95rem;
  }

  .month-title-wrap {
    padding: 2px 10px;
  }

  .nav-arrow-btn {
    width: 28px;
    height: 28px;
  }

  /* Cockpit Bar: Hero + 4 Pilastri compatti e bilanciati */
  .cockpit-bar {
    grid-template-columns: 1fr 1.25fr;
    gap: 8px;
    margin-bottom: 2px;
    flex-shrink: 0;
  }

  .cockpit-hero {
    padding: 7px 12px;
  }

  .cockpit-hero-amount-wrap {
    margin: 1px 0;
  }

  .hero-currency {
    font-size: 1.05rem;
  }

  .hero-amount-val {
    font-size: 1.55rem;
  }

  .hero-formula-box {
    padding: 3px 6px;
  }

  .cockpit-formula-text {
    font-size: 0.68rem;
  }

  .cockpit-grid-4 {
    gap: 6px;
  }

  .cockpit-kpi-card {
    padding: 5px 8px;
  }

  .kpi-card-header {
    margin-bottom: 2px;
  }

  .kpi-card-label {
    font-size: 0.66rem;
  }

  .kpi-card-value {
    font-size: 0.88rem;
  }

  .kpi-card-sub {
    font-size: 0.64rem;
  }

  /* Sezione Voci Aperte: Singola riga orizzontale su 1080p */
  #urgent-pending-section {
    padding: 6px 10px;
    margin-bottom: 0;
    flex-shrink: 0;
  }

  #urgent-pending-section .box-head {
    margin-bottom: 4px;
  }

  .pending-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 6px;
  }

  .pending-card {
    padding: 4px 8px;
    gap: 6px;
  }

  .pending-badge-tag {
    font-size: 0.62rem;
    padding: 1px 4px;
  }

  .pending-card-desc {
    font-size: 0.72rem;
  }

  .pending-card-amount {
    font-size: 0.78rem;
  }

  .pending-check-btn {
    width: 24px;
    height: 24px;
    font-size: 0.78rem;
  }

  /* Sezione Riepilogo Entrate & Uscite: Occupa tutto lo spazio rimanente */
  #in-out-full-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 8px 10px;
    margin-bottom: 0;
    overflow: hidden;
  }

  #in-out-full-section .box-head {
    margin-bottom: 4px;
    flex-shrink: 0;
  }

  .in-out-dual-grid {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .dual-col {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 6px 8px;
    overflow: hidden;
  }

  .col-head {
    flex-shrink: 0;
    margin-bottom: 4px;
    padding-bottom: 4px;
  }

  .cf-search-box {
    flex-shrink: 0;
    margin-bottom: 4px;
  }

  .cf-search-input {
    padding: 4px 22px 4px 24px;
    font-size: 0.72rem;
  }

  /* ELENCO PILASTRI CASHFLOW: Unico contenitore con scroll interno fluido */
  .compact-pill-list {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    padding-right: 3px;
  }

  .pill-row {
    padding: 4px 7px;
    font-size: 0.74rem;
  }

  /* Striscia Microfono Vocale compatta */
  .quick-mic-strip {
    flex-shrink: 0;
    margin-top: 2px;
  }

  .mic-strip-btn {
    padding: 5px 10px;
    font-size: 0.74rem;
  }

  .mic-icon-circle {
    width: 20px;
    height: 20px;
  }
}

/* ==========================================================================
   SINCRONIZZAZIONE BANCA (ENABLE BANKING / ING)
   ========================================================================== */
.bank-sync-btn {
  position: relative;
}

.bank-nav-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: all 0.25s ease;
}

.bank-nav-dot.connected {
  background: var(--accent-success);
  box-shadow: 0 0 8px var(--accent-success);
}

.bank-head-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-status-pill {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.badge-status-pill.connected {
  background: var(--accent-success-soft);
  color: var(--accent-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-status-pill.disconnected {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-dim);
  border: 1px solid var(--border-subtle);
}

.bank-sync-modal-card {
  max-width: 660px;
  width: 95%;
}

.bank-section-box {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bank-auth-callout {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: rgba(56, 189, 248, 0.06);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-md);
  padding: 16px;
}

.bank-callout-icon {
  font-size: 1.8rem;
}

.bank-callout-text h4 {
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 4px;
}

.bank-callout-text p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.btn-bank-connect {
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 700;
  padding: 12px 20px;
}

.bank-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@media (max-width: 580px) {
  .bank-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.bank-kpi-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bank-kpi-card.highlight-card {
  background: rgba(16, 185, 129, 0.05);
  border-color: rgba(16, 185, 129, 0.3);
}

.bank-kpi-card.warning-card {
  background: rgba(245, 158, 11, 0.05);
  border-color: rgba(245, 158, 11, 0.3);
}

.bank-kpi-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.bank-kpi-val {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
}

.text-cyan { color: var(--accent-cyan); }
.text-emerald { color: var(--accent-success); }
.text-amber { color: var(--accent-warning); }

.bank-kpi-sub {
  font-size: 0.68rem;
  color: var(--text-dim);
}

.bank-controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}

.bank-tab-pill {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 2px;
}

.bank-subtab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s;
}

.bank-subtab.active {
  background: var(--accent-primary);
  color: #ffffff;
}

.btn-sm-ghost {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-sm-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.bank-pane-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.8rem;
}

.select-all-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-muted);
}

.bank-tx-scroll-list {
  max-height: 290px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 0;
}

.bank-tx-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.bank-tx-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.bank-tx-row.already-imported {
  opacity: 0.55;
}

.bank-tx-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  min-width: 65px;
}

.bank-tx-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.bank-tx-desc {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bank-tx-cat-select {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  outline: none;
  max-width: 160px;
}

.bank-tx-amount {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  text-align: right;
  min-width: 75px;
}

.bank-tx-amount.expense { color: #f87171; }
.bank-tx-amount.income { color: var(--accent-success); }

.bank-pending-alert-box {
  display: flex;
  gap: 12px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.bank-pending-alert-box strong {
  color: #fbbf24;
  display: block;
  margin-bottom: 4px;
}

.bank-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 6px;
}

.bank-account-info-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* Box Contatore Scadenza Consenso PSD2 */
.bank-countdown-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  gap: 12px;
}

.bank-countdown-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bank-countdown-icon {
  font-size: 1.25rem;
}

.bank-countdown-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.bank-countdown-val {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-success);
}

.bank-countdown-val.warning {
  color: #fbbf24;
}

.bank-countdown-val.danger {
  color: #ef4444;
}

.btn-sm-renew {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-sm-renew:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #ffffff;
}

/* Badge e banner per rimborsi / anticipi pareggiati (Netto 0) */
.bank-offset-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  font-weight: 600;
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.12);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: var(--radius-xs);
  padding: 2px 7px;
  margin-top: 3px;
  width: fit-content;
}

.bank-offset-callout {
  background: rgba(167, 139, 250, 0.08);
  border: 1px solid rgba(167, 139, 250, 0.25);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.78rem;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  line-height: 1.4;
}

.bank-offset-callout strong {
  color: #a78bfa;
}

/* Badge e banner per movimenti già presenti nei Movimenti */
.bank-imported-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  font-weight: 600;
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: var(--radius-xs);
  padding: 2px 7px;
  margin-top: 3px;
  width: fit-content;
}

.bank-imported-callout {
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.78rem;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  line-height: 1.4;
}

.bank-imported-callout strong {
  color: #34d399;
}

.bank-tx-row.already-imported-row {
  opacity: 0.58;
  background: rgba(15, 23, 42, 0.35);
}

.bank-tx-row.already-imported-row:hover {
  opacity: 0.95;
}

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

.spin-icon {
  animation: spin 0.8s linear infinite;
}

.bank-sync-ca-row {
  margin: 8px 0 4px 0;
}

.btn-sync-ca {
  width: 100%;
  background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
}

.btn-sync-ca:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.4);
  background: linear-gradient(135deg, #38bdf8 0%, #1d4ed8 100%);
}

/* ==========================================================================
   BANK CATEGORY PICKER & SEARCHABLE POPOVER
   ========================================================================== */

.bank-cat-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
  font-size: 0.74rem;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
  max-width: 210px;
  text-align: left;
}

.bank-cat-picker-btn:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.2);
}

.bank-cat-picker-btn.active-picker {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}

.cat-btn-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  color: #ffffff;
}

.cat-btn-parent {
  font-size: 0.64rem;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 4px;
  border-radius: 3px;
  white-space: nowrap;
}

.cat-btn-arrow {
  color: #64748b;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.bank-cat-picker-btn:hover .cat-btn-arrow {
  color: #38bdf8;
}

/* POPOVER CONTAINER */
.bank-cat-popover {
  position: fixed;
  width: 330px;
  max-width: 92vw;
  background: #0b1324;
  border: 1px solid rgba(56, 189, 248, 0.35);
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: popoverFadeIn 0.12s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popoverFadeIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.bank-cat-popover.hidden {
  display: none !important;
}

/* Header & Search Bar */
.popover-search-header {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.7);
}

.popover-search-box {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 5px 9px;
  transition: border-color 0.15s;
}

.popover-search-box:focus-within {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.popover-search-box svg {
  color: #64748b;
  flex-shrink: 0;
}

.popover-search-input {
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-size: 0.78rem;
  width: 100%;
}

.popover-search-input::placeholder {
  color: #64748b;
}

.popover-clear-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}

.popover-clear-btn:hover {
  color: #ffffff;
}

/* Scelte Rapide (Quick Chips) */
.popover-chips-section {
  padding: 6px 10px 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.015);
}

.popover-chips-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
}

.popover-chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.popover-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
}

.popover-chip:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.5);
  color: #38bdf8;
  transform: translateY(-1px);
}

/* List Header */
.popover-list-header {
  padding: 5px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.popover-count-label {
  font-size: 0.65rem;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
}

/* Options Scroll List */
.popover-options-list {
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 0;
  display: flex;
  flex-direction: column;
}

.popover-options-list::-webkit-scrollbar {
  width: 5px;
}

.popover-options-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

.popover-options-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.popover-option-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.1s ease;
  user-select: none;
  font-size: 0.74rem;
}

.popover-option-item:hover,
.popover-option-item.highlighted {
  background: rgba(56, 189, 248, 0.14);
}

.popover-option-item.selected {
  background: rgba(56, 189, 248, 0.2);
}

.popover-opt-main {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.popover-opt-check {
  color: #38bdf8;
  font-weight: bold;
  font-size: 0.75rem;
  width: 14px;
  flex-shrink: 0;
  display: inline-block;
}

.popover-opt-name {
  color: #f1f5f9;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.popover-opt-name mark {
  background: rgba(56, 189, 248, 0.35);
  color: #ffffff;
  padding: 0 1px;
  border-radius: 2px;
}

.popover-opt-parent {
  font-size: 0.63rem;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 5px;
  border-radius: 3px;
  flex-shrink: 0;
}

.popover-opt-parent mark {
  background: rgba(56, 189, 248, 0.35);
  color: #ffffff;
  padding: 0 1px;
  border-radius: 2px;
}

.popover-empty-notice {
  padding: 16px;
  text-align: center;
  color: #64748b;
  font-size: 0.72rem;
}

/* ==========================================================================
   PIN LOCK SCREEN (SECURITY GATE)
   ========================================================================== */
.pin-lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(8, 12, 20, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.pin-lock-overlay.hidden {
  display: none !important;
}

.pin-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.98) 0%, rgba(30, 41, 59, 0.90) 100%);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 24px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(56, 189, 248, 0.15);
  padding: 32px 24px 24px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.pin-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #38bdf8, #818cf8, #34d399);
}

.pin-shield-icon {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.2);
}

.pin-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 4px 0;
  letter-spacing: 0.02em;
}

.pin-subtitle {
  font-size: 0.78rem;
  color: #94a3b8;
  margin: 0 0 20px 0;
}

.pin-dots-container {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
}

.pin-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pin-dot.filled {
  background: #38bdf8;
  border-color: #38bdf8;
  transform: scale(1.15);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.7);
}

.pin-error-msg {
  color: #f87171;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 12px;
  animation: shakePin 0.4s ease;
}

@keyframes shakePin {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.pin-key {
  aspect-ratio: 1;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.pin-key:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

.pin-key:active {
  transform: scale(0.92);
  background: #38bdf8;
  color: #080c14;
}

.pin-key.action {
  font-size: 1rem;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.02);
}

.pin-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
}

.pin-remember-lbl {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: #94a3b8;
  cursor: pointer;
}

.pin-remember-lbl input {
  accent-color: #38bdf8;
}


