:root {
  --bmw-blue: #002A4B;
  --bmw-accent: #00A3E0;
  --bmw-red: #E31C23;
  --bmw-silver: #8B9BB4;

  --bg-page: #F3F5F8;
  --surface: #FFFFFF;
  --surface-hover: #F0F2F5;
  --surface-active: #E8EBF0;

  --text-primary: #0A0A0A;
  --text-secondary: #4A6A8A;
  --text-inverse: #FFFFFF;
  --icon-color: #002A4B;

  --border-light: rgba(0, 0, 0, 0.07);
  --border-medium: rgba(0, 0, 0, 0.12);
  --border-hover: rgba(0, 102, 177, 0.25);
  --border-focus: rgba(0, 102, 177, 0.4);

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;

  --shadow-card: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.05);
  --shadow-elevated: 0 4px 16px rgba(0,0,0,0.08), 0 8px 32px rgba(0,0,0,0.06);
  --shadow-modal: 0 8px 40px rgba(0,0,0,0.15);

  --transition-fast: 200ms ease;
  --transition-normal: 250ms ease;
  --transition-spring: 0.35s cubic-bezier(0.16, 1, 0.3, 1);

  --bmw-gradient: linear-gradient(135deg, #003A70 0%, #0066B1 55%, #00A3E0 100%);
}

.material-symbols-outlined {
  color: var(--icon-color);
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ===== TIPOGRAFIA ===== */

.h1-hero {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text-inverse);
}

.h1-page {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.25;
  color: var(--text-inverse);
}

.h2-section {
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.subtitle {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin-top: 0.35rem;
  letter-spacing: 0.01em;
}

.label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 0.35rem;
}

.body {
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.7;
  color: var(--text-primary);
}

.caption {
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--text-secondary);
}

.code-value {
  font-family: 'JetBrains Mono', 'Cascadia Code', 'Consolas', monospace;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

/* ===== BOTTONI ===== */

.btn .material-symbols-outlined {
  color: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-normal);
  line-height: 1.2;
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
  min-height: 44px;
}

.btn:active {
  transform: scale(0.97);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 102, 177, 0.25);
}

.btn-primary {
  background: var(--bmw-blue);
  color: var(--text-inverse);
}

.btn-primary:hover {
  background: #005094;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 102, 177, 0.3);
}

.btn-secondary {
  background: var(--surface);
  color: var(--bmw-blue);
  border: 1.5px solid var(--bmw-blue);
}

.btn-secondary:hover {
  background: #E6F1FB;
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 0.4rem 0.7rem;
}

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

.btn-danger {
  background: var(--bmw-red);
  color: var(--text-inverse);
}

.btn-danger:hover {
  background: #C62828;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(227, 28, 35, 0.3);
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-page);
  color: var(--icon-color);
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: all var(--transition-normal);
}

.btn-icon:hover {
  background: var(--surface-hover);
  color: var(--icon-color);
  border-color: var(--border-medium);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  font-size: 0.8rem;
  padding: 0.4rem 0.8rem;
  min-height: 36px;
}

/* ===== FORM ELEMENTI ===== */

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  background: var(--surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  transition: all var(--transition-normal);
  min-height: 44px;
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
  border-color: rgba(0, 0, 0, 0.2);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--bmw-blue);
  box-shadow: 0 0 0 3px rgba(0, 102, 177, 0.12);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230066B1' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.1rem;
  padding-right: 2.75rem;
  cursor: pointer;
}

select option {
  background: var(--surface);
  color: var(--text-primary);
}

/* ===== MODAL ===== */

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  animation: fadeIn var(--transition-normal);
}

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

.modal-content {
  background: var(--surface);
  margin: 6vh auto;
  padding: 2.5rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  scrollbar-gutter: stable;
  box-shadow: var(--shadow-modal);
  position: relative;
  animation: slideIn var(--transition-spring);
}

.modal-content::-webkit-scrollbar {
  display: none;
}

.modal-content {
  scrollbar-width: none;
}

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

.modal-wide {
  max-width: 1100px;
  width: 95%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 2rem;
}

.modal-medium {
  max-width: 800px;
  width: 95%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 2rem;
}

.modal-bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  max-height: 92vh;
  margin: 0;
  padding: 2rem 1.5rem;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  animation: slideUp var(--transition-spring);
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.close-modal {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  color: var(--icon-color);
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  transition: all var(--transition-normal);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-page);
  border: 1px solid var(--border-light);
}

.close-modal:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
  transform: scale(1.05);
}

.modal h2 {
  margin-bottom: 1.5rem;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ===== BADGE ===== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  white-space: nowrap;
  line-height: 1.4;
}

.badge-tagliando    { background: #3b82f6; color: #fff; }
.badge-revisione    { background: #10b981; color: #fff; }
.badge-riparazione  { background: #ef4444; color: #fff; }
.badge-manutenzione { background: #f59e0b; color: #fff; }
.badge-altro        { background: #8b5cf6; color: #fff; }
.badge-bollo        { background: #f97316; color: #fff; }
.badge-assicurazione { background: #06b6d4; color: #fff; }
.badge-acquisto     { background: #eab308; color: #fff; }
.badge-passaggio    { background: #d946ef; color: #fff; }

.badge-elettronica      { background: #3b82f6; color: #fff; }
.badge-illuminazione    { background: #eab308; color: #fff; }
.badge-esterni          { background: #10b981; color: #fff; }
.badge-interni          { background: #a855f7; color: #fff; }
.badge-centralina       { background: #ec4899; color: #fff; }
.badge-meccanica        { background: #64748b; color: #fff; }
.badge-multimedia       { background: #06b6d4; color: #fff; }
.badge-gpl              { background: #22c55e; color: #fff; }
.badge-raffreddamento   { background: #0ea5e9; color: #fff; }

.badge-da-valutare           { background: #f1f5f9; color: #64748b; }
.badge-da-fare               { background: #fef3c7; color: #92400e; }
.badge-problema-persistente  { background: #fee2e2; color: #991b1b; }
.badge-ordinato              { background: #e0f2fe; color: #075985; }
.badge-in-corso              { background: #f3e8ff; color: #6b21a8; }
.badge-migliorato            { background: #ecfccb; color: #3f6212; }
.badge-sostituito            { background: #d1fae5; color: #065f46; }
.badge-completato            { background: #bbf7d0; color: #14532d; }
.badge-abbandonato           { background: #f1f5f9; color: #64748b; text-decoration: line-through; }

.badge-led      { background: #bbf7d0; color: #14532d; }
.badge-alogena  { background: #fef3c7; color: #92400e; }

.color-dot {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid currentColor;
}

.amp-5  { background: #fef3c7; color: #92400e; }
.amp-10 { background: #fee2e2; color: #991b1b; }
.amp-15 { background: #dbeafe; color: #1e40af; }
.amp-20 { background: #fef3c7; color: #854d0e; }
.amp-30 { background: #d1fae5; color: #065f46; }
.amp-40 { background: #fed7aa; color: #7c2d12; }
.amp-50 { background: #fee2e2; color: #991b1b; }



/* ===== TABELLA DATI ===== */

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.data-table thead {
  background: var(--bg-page);
}

.data-table th {
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.data-table td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}

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

.data-table tbody tr:hover {
  background: var(--surface-hover);
}

.data-table tbody tr:nth-child(even) {
  background: var(--bg-page);
}

.data-table tbody tr:nth-child(even):hover {
  background: var(--surface-hover);
}

/* ===== CARD GENERICA ===== */

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
  transform: translateZ(0);
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-card), 0 0 0 2px rgba(0, 102, 177, 0.04);
}

.card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
}

.card-actions-left {
  display: flex;
  gap: 0.5rem;
}

.btn-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  border: none;
  transition: all var(--transition-normal);
  white-space: nowrap;
  line-height: 1.3;
  min-height: 44px;
}

.btn-card-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  flex: none;
  border-radius: 50%;
  min-height: 40px;
}

.btn-card-icon .material-symbols-outlined {
  font-size: 1.25rem;
  color: inherit;
}

.btn-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 102, 177, 0.25);
}

.btn-card-edit {
  background: transparent;
  color: var(--bmw-blue);
}

.btn-card-edit:hover {
  background: rgba(0, 102, 177, 0.08);
  color: var(--bmw-blue);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 102, 177, 0.2);
}

.btn-card-delete {
  background: transparent;
  color: var(--bmw-red);
}

.btn-card-delete:hover {
  background: rgba(227, 28, 35, 0.08);
  color: var(--bmw-red);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(227, 28, 35, 0.25);
}

.btn-card-link {
  background: transparent;
  color: var(--text-secondary);
}

.btn-card-link:hover {
  background: var(--bg-page);
  color: var(--text-secondary);
  transform: translateY(-1px);
}

/* ===== EXPENSE CARD ===== */

.expense-card,
.intervento-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
  transform: translateZ(0);
}

.expense-card:hover,
.intervento-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-card), 0 0 0 2px rgba(0, 102, 177, 0.04);
}

.expense-card.interactive {
  cursor: pointer;
}

.expense-card.interactive:hover {
  transform: translateY(-2px);
  border-color: var(--bmw-accent);
}

.intervento-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.intervento-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  flex: 1;
}

.intervento-card-price {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--bmw-blue);
  white-space: nowrap;
}

.intervento-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.intervento-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.intervento-card-meta .material-symbols-outlined {
  font-size: 1.1rem;
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 20;
}

.intervento-card-notes {
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: rgba(0,0,0,0.02);
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--border-light);
  line-height: 1.5;
}

/* ===== CARD SPESA CON CHECKBOX ===== */

.spesa-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all var(--transition-normal);
  cursor: default;
}

.spesa-card:hover {
  border-color: var(--border-hover);
}

.spesa-card.selected {
  border-color: var(--bmw-blue);
  box-shadow: 0 0 0 2px rgba(0, 102, 177, 0.1), var(--shadow-card);
}

.spesa-card-checkbox {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  accent-color: var(--bmw-blue);
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spesa-card-checkbox input[type="checkbox"] {
  width: 22px;
  height: 22px;
  cursor: pointer;
  accent-color: var(--bmw-blue);
}

.spesa-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.75rem;
}

.spesa-card-tipo {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.spesa-card-desc {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spesa-card-date {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.spesa-card-amount {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

/* ===== CARD VERTICALE (Altro) ===== */

.altro-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
  color: inherit;
}

.altro-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-elevated);
}

.altro-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 102, 177, 0.1);
  color: var(--icon-color);
  flex-shrink: 0;
}

.altro-card-icon .material-symbols-outlined {
  font-size: 1.5rem;
}

.altro-card-body {
  flex: 1;
  min-width: 0;
}

.altro-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.altro-card-sub {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.altro-card-arrow {
  color: var(--icon-color);
  flex-shrink: 0;
}

/* ===== MULTI-SELECT DROPDOWN ===== */

.multi-select {
  position: relative;
  margin-bottom: 1.25rem;
  min-width: 0;
}

.multi-select-trigger {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  width: 100%;
  max-width: 360px;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-medium);
  background: var(--surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: clamp(0.82rem, 1.4vw, 0.95rem);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-normal);
  min-height: 44px;
  text-align: left;
}

.multi-select-trigger:hover {
  border-color: var(--bmw-blue);
}

.multi-select-trigger .label {
  flex: 1;
  white-space: nowrap;
}

.multi-select-trigger .count-badge {
  display: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bmw-blue);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.multi-select.has-selection .multi-select-trigger .count-badge {
  display: inline-flex;
}

.multi-select-trigger .chevron {
  font-size: 1rem;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
}

.multi-select.open .multi-select-trigger .chevron {
  transform: rotate(180deg);
}

.multi-select-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  max-width: 360px;
  max-height: 280px;
  overflow-y: auto;
  background: #ffffff;
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal);
  z-index: 100;
  padding: 0.4rem 0;
}

.multi-select.open .multi-select-dropdown {
  display: block;
}

.multi-select-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1rem;
  cursor: pointer;
  transition: background var(--transition-fast);
  min-height: 40px;
  -webkit-user-select: none;
  user-select: none;
}

.multi-select-option:hover {
  background: var(--surface-hover);
}

.multi-select-option input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--bmw-blue);
  cursor: pointer;
  flex-shrink: 0;
}

.multi-select-option .option-label {
  font-size: clamp(0.82rem, 1.4vw, 0.95rem);
  font-weight: 500;
  color: var(--text-primary);
}

.multi-select-option.selected {
  background: rgba(0, 102, 177, 0.06);
}

/* ===== HERO SECTION ===== */

.hero-section {
  background: var(--bmw-blue);
  position: relative;
  overflow: hidden;
  color: var(--text-inverse);
}

.hero-section-home::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 55px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 55' preserveAspectRatio='none'%3E%3Cpath d='M0,25 C360,55 1080,55 1440,25 L1440,55 L0,55 Z' fill='%23F3F5F8'/%3E%3C/svg%3E") no-repeat;
  background-size: 100% 100%;
  pointer-events: none;
  z-index: 1;
}

.hero-section .hero-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 2rem;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.6rem;
}

.hero-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 0.6rem;
}

.hero-page-name {
  font-size: 1.3rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.9;
}

.hero-total {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.hero-section-home .hero-content {
  flex-wrap: wrap;
  padding: 3rem 1.5rem 6rem;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  align-content: flex-start;
  gap: 2rem;
  min-height: 320px;
}

.hero-section-home .hero-model-name {
  flex: 0 0 100%;
}

.hero-section-home .hero-text {
  flex: 0 0 calc(35% - 1rem);
  min-width: 0;
  position: relative;
  z-index: 3;
}

.hero-section-home .hero-image {
  flex: 0 0 calc(65% - 1rem);
  height: 397px;
  background-image: url('../images/bmw.png');
  background-size: contain;
  background-position: right center;
  background-repeat: no-repeat;
}

.hero-model-name {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 1rem;
  color: var(--text-inverse);
}

.hero-vehicle-data {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.hero-vehicle-data span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 500;
}

.hero-vehicle-data span .material-symbols-outlined {
  font-size: 1rem;
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}

.hero-vehicle-data span:nth-child(1) .material-symbols-outlined { color: #81C4FF; }
.hero-vehicle-data span:nth-child(2) .material-symbols-outlined { color: #A8A9AD; }
.hero-vehicle-data span:nth-child(3) .material-symbols-outlined { color: #E7222E; }
.hero-vehicle-data span:nth-child(4) .material-symbols-outlined { color: #FF6A00; }

.hero-total-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.hero-total-display {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hero-total-display .label {
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0;
}

.hero-total-display .total-value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.hero-actions {
  display: flex;
  width: 100%;
  gap: 0.5rem;
}

.hero-actions .btn {
  flex: 1;
  padding: 0.45rem 1rem;
  font-size: 0.82rem;
  min-height: 36px;
}

.hero-actions .btn-primary {
  background: var(--text-inverse);
  color: var(--bmw-blue);
  border: none;
  font-weight: 700;
}

.hero-actions .btn-primary:hover {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.hero-actions .btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-inverse);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.hero-actions .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

/* ===== WIDGET HOME ===== */

.home-widget {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-card);
}

.home-widget-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.home-widget-header .material-symbols-outlined {
  font-size: 1.3rem;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}

/* ===== EVENT LIST ===== */

.event-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-light);
}

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

.event-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--bg-page);
  flex-shrink: 0;
}

.event-date-day {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.event-date-month {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.event-info {
  flex: 1;
  min-width: 0;
}

.event-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.event-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ===== PARCHEGGIO WIDGET ===== */

.parking-status {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.parking-address {
  font-size: 0.9rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.parking-address .material-symbols-outlined {
  font-size: 1.1rem;
}

.parking-none {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ===== STATI ===== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
  gap: 0.75rem;
}

.empty-state .material-symbols-outlined {
  font-size: 3rem;
  color: var(--text-secondary);
  opacity: 0.4;
}

.empty-state p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 360px;
}

.error-state {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(227, 28, 35, 0.06);
  border: 1px solid rgba(227, 28, 35, 0.2);
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-md);
  text-align: left;
}

.error-state .material-symbols-outlined {
  font-size: 1.3rem;
  color: var(--bmw-red);
  flex-shrink: 0;
}

.error-state h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--bmw-red);
  margin-bottom: 0.2rem;
}

.error-state p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ===== DATA SECTIONS (dati-veicolo) ===== */

.data-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.data-block {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-card);
}

.data-block h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
}

.data-item {
  background: var(--bg-page);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.data-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.data-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.optional-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.optional-list li {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-page);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-primary);
}

.optional-list li:hover {
  background: var(--surface-hover);
}

.optional-code {
  font-family: 'JetBrains Mono', 'Cascadia Code', 'Consolas', monospace;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--bmw-blue);
  white-space: nowrap;
}

.optional-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-left: auto;
}

.quote-block {
  font-family: 'JetBrains Mono', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-page);
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--bmw-accent);
  white-space: pre-wrap;
  overflow-x: auto;
}

/* ===== MODAL SPLIT (informazioni) ===== */

.modal-split-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  flex: 1;
  min-height: 0;
}

.modal-image-container {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-page);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.modal-image-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.modal-scroll-area {
  overflow-y: auto;
  scrollbar-width: none;
}

.modal-scroll-area::-webkit-scrollbar {
  display: none;
}

/* ===== NOTE LAYOUT ===== */

.note-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.note-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  border: none;
  transition: all var(--transition-normal);
  background: var(--bmw-blue);
  color: white;
  min-height: 44px;
}

.note-add-btn:hover {
  background: #005094;
  transform: translateY(-1px);
}

.note-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.note-list-item {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.note-list-item:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.note-list-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.note-list-preview {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-list-date {
  font-size: 0.75rem;
  color: var(--text-secondary);
  opacity: 0.7;
}

.note-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.note-viewer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.3);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.note-viewer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.note-viewer {
  position: fixed;
  top: 5vh;
  right: 2vw;
  width: 46%;
  max-width: 620px;
  height: 90vh;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  z-index: 950;
  padding: 2rem;
  overflow-y: auto;
  transform: translateX(120%);
  transition: transform var(--transition-spring);
  border: 1px solid var(--border-light);
}

.note-viewer.open {
  transform: translateX(0);
}

.note-viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.note-viewer-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-primary);
}

.note-viewer-date {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.note-viewer-content {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-primary);
}

.note-textarea {
  width: 100%;
  min-height: 200px;
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  background: var(--surface);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  resize: vertical;
  transition: border-color var(--transition-normal);
}

.note-textarea:focus {
  outline: none;
  border-color: var(--bmw-blue);
  box-shadow: 0 0 0 3px rgba(0, 102, 177, 0.12);
}

.note-preview {
  padding: 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  min-height: 200px;
}

/* ===== MARKDOWN ===== */

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  color: var(--text-primary);
  margin: 1.25rem 0 0.5rem;
  line-height: 1.3;
}

.markdown-body h1 { font-size: 1.4rem; font-weight: 700; }
.markdown-body h2 { font-size: 1.2rem; font-weight: 600; }
.markdown-body h3 { font-size: 1.05rem; font-weight: 600; }

.markdown-body p {
  margin-bottom: 0.75rem;
  line-height: 1.7;
}

.markdown-body ul,
.markdown-body ol {
  margin: 0.5rem 0 0.75rem 1.5rem;
  line-height: 1.6;
}

.markdown-body code {
  font-family: 'JetBrains Mono', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.85em;
  background: rgba(0,0,0,0.05);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.markdown-body pre {
  background: var(--bg-page);
  padding: 1rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 0.75rem 0;
}

.markdown-body pre code {
  background: none;
  padding: 0;
}

.markdown-body blockquote {
  border-left: 3px solid var(--bmw-accent);
  padding: 0.5rem 1rem;
  margin: 0.75rem 0;
  color: var(--text-secondary);
  background: var(--bg-page);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.markdown-body img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: 0.75rem 0;
}

.markdown-body a {
  color: var(--bmw-blue);
  text-decoration: underline;
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 1.25rem 0;
}

/* ===== UTILITY ===== */

.flex-row { display: flex; flex-wrap: wrap; }
.gap-4  { gap: 0.25rem; }
.gap-8  { gap: 0.5rem; }
.gap-10 { gap: 0.625rem; }
.gap-12 { gap: 0.75rem; }
.gap-16 { gap: 1rem; }
.gap-24 { gap: 1.5rem; }
.flex-1 { flex: 1; }
.flex-none { flex: none; }
.min-w-140 { min-width: 140px; }
.min-w-180 { min-width: 180px; }
.min-w-200 { min-width: 200px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.font-mono { font-family: 'JetBrains Mono', 'Cascadia Code', 'Consolas', monospace; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.flex-shrink-0 { flex-shrink: 0; }
.fusibile-num { font-weight: 700; color: var(--bmw-blue); font-size: 1.1rem; width: 15%; }
.btn-sm-icon { padding: 0.3rem 0.6rem; font-size: 0.75rem; min-height: auto; }

.input-search {
  width: 100%;
  padding: 0.7rem 0.85rem;
  padding-left: 2.3rem;
  border-radius: var(--radius-md);
  background: var(--bg-page);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color var(--transition-normal);
  min-height: 44px;
}

.input-search:focus {
  outline: none;
  border-color: var(--bmw-blue);
  box-shadow: 0 0 0 3px rgba(0, 102, 177, 0.12);
}

.search-icon-wrap {
  position: relative;
}

.search-icon-wrap .search-icon {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 1.1rem;
  pointer-events: none;
}

/* ===== KEYFRAMES ===== */

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
