/* ===== CSS Variables - Light Theme (default) ===== */
:root {
  /* Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-hover: #f1f5f9;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --border-color: #e2e8f0;
  --border-light: #f1f5f9;

  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: #dbeafe;

  --success: #22c55e;
  --success-light: #dcfce7;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  /* Spacing */
  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  /* Transitions */
  --transition: 150ms ease;
  --transition-slow: 300ms ease;
}

/* ===== Dark Theme ===== */
[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-card: #1e293b;
  --bg-hover: #334155;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;

  --border-color: #334155;
  --border-light: #1e293b;

  --accent: #60a5fa;
  --accent-hover: #3b82f6;
  --accent-light: #1e3a5f;

  --success-light: #14532d;
  --warning-light: #713f12;
  --danger-light: #7f1d1d;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.4), 0 1px 2px -1px rgb(0 0 0 / 0.4);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  transition: background-color var(--transition-slow), color var(--transition-slow);
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.25;
}

h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

/* ===== Layout ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ===== Header ===== */
.header {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-icon {
  width: 2.5rem;
  height: 2.5rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ===== Theme Toggle ===== */
.theme-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  color: var(--text-secondary);
}

.theme-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.theme-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* ===== Navigation Tabs ===== */
.nav-tabs {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 60px;
  z-index: 99;
}

.tabs-wrapper {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

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

.tab-btn.active {
  background: var(--accent-light);
  color: var(--accent);
}

.tab-icon {
  font-size: 1.125rem;
}

.tab-text {
  white-space: nowrap;
}

/* ===== Tab Content ===== */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ===== Tab Header ===== */
.tab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.tab-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.tab-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ===== Main Content ===== */
.main {
  padding: 2rem 0;
}

/* ===== Stats Grid ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-value.success { color: var(--success); }
.stat-value.warning { color: var(--warning); }
.stat-value.danger { color: var(--danger); }

/* ===== Vehicles Grid ===== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.vehicles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

/* ===== Vehicle Card ===== */
.vehicle-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all var(--transition);
  cursor: pointer;
}

.vehicle-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--accent);
}

/* Vehicle Card Warning State (expiring soon - within 30 days) */
.vehicle-card.expiring {
  border-color: var(--warning);
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--warning-light) 100%);
}

.vehicle-card.expiring:hover {
  border-color: var(--warning);
}

/* Vehicle Card Danger State (expired) */
.vehicle-card.expired {
  border-color: var(--danger);
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--danger-light) 100%);
}

.vehicle-card.expired:hover {
  border-color: var(--danger);
}

/* Expiry badge */
.vehicle-expiry-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  margin-top: 0.25rem;
}

.vehicle-expiry-badge.warning {
  background: var(--warning-light);
  color: var(--warning);
}

.vehicle-expiry-badge.danger {
  background: var(--danger-light);
  color: var(--danger);
}

.vehicle-expiry-badge.ok {
  background: var(--success-light);
  color: var(--success);
}

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

.vehicle-header-content {
  flex: 1;
  min-width: 0;
}

.vehicle-icon {
  font-size: 2rem;
  line-height: 1;
  margin-left: 0.75rem;
  flex-shrink: 0;
}

.vehicle-name {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.vehicle-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.vehicle-body {
  padding: 1.25rem;
}

.vehicle-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.vehicle-stat {
  text-align: center;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-radius: var(--radius);
}

.vehicle-stat-value {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--accent);
}

.vehicle-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.vehicle-stat-date {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

.vehicle-stat-date.expired {
  color: var(--danger);
  font-weight: 600;
}

.vehicle-stat-date.expiring {
  color: var(--warning);
  font-weight: 600;
}

.vehicle-total {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--accent-light);
  border-radius: var(--radius);
  text-align: center;
}

.vehicle-total-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.vehicle-total-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
  padding: 1rem;
}

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

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform var(--transition);
}

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

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

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius);
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  max-height: calc(90vh - 140px);
}

/* ===== Vehicle Detail ===== */
.detail-section {
  margin-bottom: 1.5rem;
}

.detail-section:last-child {
  margin-bottom: 0;
}

.detail-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-light);
}

.detail-row:last-child {
  border-bottom: none;
}

/* ===== Maintenance List ===== */
.maintenance-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.maintenance-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem;
  transition: all var(--transition);
}

.maintenance-item:hover {
  border-color: var(--accent);
}

.maintenance-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.maintenance-date {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.maintenance-cost {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-light);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}

.maintenance-km {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.maintenance-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

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

.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
  color: var(--text-primary);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: all var(--transition);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

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

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

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.empty-state-text {
  font-size: 1rem;
}

/* ===== Loading ===== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===== Toast Notifications ===== */
.toast-container {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  min-width: 250px;
}

.toast-success {
  background: var(--success);
  color: white;
}

.toast-error {
  background: var(--danger);
  color: white;
}

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

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .vehicles-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .modal {
    margin: 0.5rem;
    max-height: calc(100vh - 1rem);
  }

  .header-content {
    flex-wrap: wrap;
    gap: 0.75rem;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }

  .tabs-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tab-btn {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
  }
}

/* ===== Mamma Section Styles ===== */
.mamma-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.summary-header {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  padding: 1rem 1.25rem;
  color: white;
}

.summary-header h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.summary-body {
  padding: 1.25rem;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-light);
}

.summary-row:last-child {
  border-bottom: none;
}

.summary-row span {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.summary-row strong {
  font-weight: 600;
  color: var(--text-primary);
}

.summary-row strong.highlight {
  color: var(--accent);
  font-size: 1.125rem;
}

/* ===== Mamma Sections Layout ===== */
.mamma-sections {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.mamma-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.mamma-section .section-header {
  margin-bottom: 1rem;
}

.mamma-section .section-title {
  font-size: 1rem;
}

/* ===== Transactions List ===== */
.transactions-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 500px;
  overflow-y: auto;
}

.transaction-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem;
  transition: all var(--transition);
}

.transaction-item:hover {
  border-color: var(--accent);
}

.transaction-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.transaction-date {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.transaction-amount {
  font-size: 0.9375rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}

.transaction-amount.expense {
  color: var(--danger);
  background: var(--danger-light);
}

.transaction-amount.payment {
  color: var(--success);
  background: var(--success-light);
}

.transaction-category {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}

.transaction-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.transaction-actions {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
}

.transaction-recurring {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--accent);
  margin-top: 0.5rem;
}

/* ===== Form Help Text ===== */
.form-help {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ===== Icon Selector ===== */
.icon-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

.icon-option {
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  border: 2px solid transparent;
  background: var(--bg-card);
}

.icon-option:hover {
  background: var(--bg-hover);
  transform: scale(1.1);
}

.icon-option.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}

/* ===== Italian License Plate ===== */
.license-plate {
  display: inline-flex;
  align-items: stretch;
  background: #f0f0f0;
  border: 2px solid #1a1a1a;
  border-radius: 4px;
  font-family: 'Arial Black', 'Helvetica Neue', sans-serif;
  font-weight: 900;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  height: 28px;
  margin-top: 0.5rem;
}

.license-plate-left {
  background: linear-gradient(180deg, #003399 0%, #002266 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2px 4px;
  min-width: 20px;
}

.license-plate-stars {
  font-size: 6px;
  color: #ffcc00;
  line-height: 1;
  letter-spacing: -1px;
}

.license-plate-country {
  font-size: 9px;
  color: white;
  font-weight: 700;
  line-height: 1;
  margin-top: 1px;
}

.license-plate-text {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  font-size: 16px;
  letter-spacing: 2px;
  color: #1a1a1a;
  background: #f0f0f0;
  text-transform: uppercase;
}

.license-plate-right {
  background: linear-gradient(180deg, #003399 0%, #002266 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 4px;
  min-width: 20px;
}

.license-plate-year {
  width: 14px;
  height: 14px;
  border: 1.5px solid #ffcc00;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6px;
  color: #ffcc00;
  font-weight: 700;
}

/* ===== Checkbox styling ===== */
.form-label input[type="checkbox"] {
  margin-right: 0.5rem;
  width: 1rem;
  height: 1rem;
}

/* ===== Responsive for Mamma Sections ===== */
@media (max-width: 900px) {
  .mamma-sections {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .summary-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .summary-row strong {
    font-size: 1rem;
  }
}

/* ===== Archived/Sold Vehicles Section ===== */
.archived-vehicles-section {
  margin-top: 2rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  overflow: hidden;
}

.archived-vehicles-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  cursor: pointer;
  background: var(--bg-tertiary);
  transition: background var(--transition);
}

.archived-vehicles-header:hover {
  background: var(--bg-hover);
}

.archived-vehicles-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.archived-vehicles-title .section-title {
  margin: 0;
  font-size: 1rem;
}

.archived-icon {
  font-size: 1.25rem;
}

.archived-count {
  background: var(--accent);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
}

.archived-chevron {
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: transform var(--transition);
}

.archived-vehicles-header.expanded .archived-chevron {
  transform: rotate(180deg);
}

.archived-vehicles-content {
  padding: 1.25rem;
  border-top: 1px solid var(--border-color);
}

/* Archived Vehicle Card Styling */
.vehicle-card.archived {
  opacity: 0.75;
  border-color: var(--border-color);
  background: var(--bg-tertiary);
}

.vehicle-card.archived:hover {
  opacity: 1;
  border-color: var(--text-muted);
}

.vehicle-card.archived .vehicle-icon {
  filter: grayscale(50%);
}

.vehicle-card.archived .vehicle-total {
  background: var(--bg-secondary);
}

.vehicle-card.archived .vehicle-total-value {
  color: var(--text-secondary);
}

/* ===== Additional Button Styles ===== */
.btn-warning {
  background: var(--warning);
  color: white;
}

.btn-warning:hover {
  background: #d97706;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #16a34a;
}

/* ===== Current Month Card (Mamma) ===== */
.current-month-card {
  background: var(--bg-card);
  border: 2px solid var(--accent);
  border-radius: var(--radius-xl);
  margin-bottom: 2rem;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.current-month-card.paid {
  border-color: var(--success);
}

.current-month-header {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.current-month-card.paid .current-month-header {
  background: linear-gradient(135deg, var(--success), #16a34a);
}

.current-month-header h3 {
  margin: 0;
  color: white;
  font-size: 1.25rem;
  font-weight: 600;
}

.current-month-badge {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
}

.current-month-body {
  padding: 1.5rem;
}

.month-calc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border-light);
}

.month-calc-row:last-child {
  border-bottom: none;
}

.month-calc-row span {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

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

.month-calc-value.positive {
  color: var(--success);
}

.month-calc-value.negative {
  color: var(--danger);
}

.month-calc-row.subtotal {
  background: var(--bg-secondary);
  margin: 0.5rem -1.5rem;
  padding: 0.75rem 1.5rem;
  border-bottom: none;
}

.month-calc-row.subtotal span,
.month-calc-row.subtotal .month-calc-value {
  font-weight: 600;
}

.month-calc-divider {
  height: 1px;
  background: var(--border-color);
  margin: 0.75rem 0;
}

.month-calc-row.balance-row {
  opacity: 0.8;
}

.month-calc-row.total-row {
  background: var(--accent-light);
  margin: 0.75rem -1.5rem -1.5rem;
  padding: 1rem 1.5rem;
  border-bottom: none;
}

.month-calc-row.total-row span {
  color: var(--text-primary);
}

.month-calc-value.total {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
}

.month-calc-value.total.danger {
  color: var(--danger);
}

.month-calc-value.total.success {
  color: var(--success);
}

.current-month-card.paid .month-calc-row.total-row {
  background: var(--success-light);
}

.current-month-card.paid .month-calc-value.total {
  color: var(--success);
}

/* ===== Mamma Stats Small Grid ===== */
.mamma-stats-small {
  margin-bottom: 2rem;
}

/* ===== Deduction Status Indicators ===== */
.deduction-active {
  color: var(--success);
  font-size: 0.75rem;
  font-weight: 500;
}

.deduction-expired {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: line-through;
}

/* ===== Responsive for Current Month Card ===== */
@media (max-width: 480px) {
  .current-month-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .current-month-body {
    padding: 1rem;
  }

  .month-calc-row.subtotal {
    margin: 0.5rem -1rem;
    padding: 0.75rem 1rem;
  }

  .month-calc-row.total-row {
    margin: 0.75rem -1rem -1rem;
    padding: 1rem;
  }

  .month-calc-value.total {
    font-size: 1.125rem;
  }
}

/* ===== Documents Styles ===== */

/* File Upload Area */
.file-upload-area {
  position: relative;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  transition: all var(--transition);
  cursor: pointer;
}

.file-upload-area:hover,
.file-upload-area.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.file-upload-area .file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.file-upload-icon {
  font-size: 2.5rem;
}

.file-upload-text {
  font-weight: 500;
  color: var(--text-primary);
}

.file-upload-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.file-upload-preview {
  padding: 0.75rem 1rem;
  background: var(--accent-light);
  border-radius: var(--radius);
}

.file-preview-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 150px;
  overflow-y: auto;
}

.file-preview-item {
  font-size: 0.875rem;
  color: var(--text-primary);
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border-light);
}

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

.file-preview-item .file-size {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.file-preview-total {
  font-weight: 600;
  color: var(--accent);
  padding-top: 0.5rem;
  margin-top: 0.25rem;
  border-top: 1px solid var(--accent);
  font-size: 0.875rem;
}

.file-preview-clear {
  margin-top: 0.75rem;
  width: 100%;
  padding: 0.5rem;
  background: none;
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.875rem;
}

.file-preview-clear:hover {
  background: var(--danger);
  color: white;
}

/* Documents Summary in Vehicle Modal */
.docs-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius);
}

.docs-summary-info {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.docs-summary-count {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.docs-summary-label {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.docs-summary-actions {
  display: flex;
  gap: 0.5rem;
}

/* Maintenance Docs Badge */
.maintenance-docs {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.5rem;
  padding: 0.25rem 0.5rem;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
}

/* Documents Browser */
.docs-section {
  margin-bottom: 1rem;
}

.docs-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Document Categories */
.docs-categories {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.docs-category {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}

.docs-category.has-docs {
  border-color: var(--accent);
}

.docs-category-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  cursor: pointer;
  transition: background var(--transition);
}

.docs-category-header:hover {
  background: var(--bg-hover);
}

.docs-category-icon {
  font-size: 1rem;
}

.docs-category-name {
  flex: 1;
  font-weight: 500;
  color: var(--text-primary);
}

.docs-category-count {
  background: var(--accent);
  color: white;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  min-width: 1.25rem;
  text-align: center;
}

.docs-category.has-docs .docs-category-count {
  background: var(--accent);
}

.docs-category:not(.has-docs) .docs-category-count {
  background: var(--text-muted);
}

.docs-maintenance:not(.has-docs) .docs-category-count {
  background: var(--text-muted);
}

.docs-category-chevron {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform var(--transition);
}

.docs-category-content {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-light);
}

.docs-empty {
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
  padding: 0.5rem;
}

.docs-add-btn {
  margin-top: 0.75rem;
  width: 100%;
}

/* Document List */
.docs-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.doc-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  transition: border-color var(--transition);
}

.doc-item:hover {
  border-color: var(--accent);
}

.doc-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

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

.doc-name {
  display: block;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-meta {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

.doc-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.doc-actions .btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

/* Maintenance Documents in Browser */
.docs-maintenances {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.docs-maintenance {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}

.docs-maintenance-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  cursor: pointer;
  transition: background var(--transition);
}

.docs-maintenance-header:hover {
  background: var(--bg-hover);
}

.docs-maintenance-date {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.docs-maintenance-desc {
  flex: 1;
  color: var(--text-secondary);
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Responsive Documents */
@media (max-width: 480px) {
  .docs-summary {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .docs-summary-actions {
    width: 100%;
    justify-content: center;
  }

  .doc-item {
    flex-wrap: wrap;
  }

  .doc-info {
    width: calc(100% - 2.5rem);
  }

  .doc-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 0.5rem;
  }
}

/* ========================================
   BATTERY MANAGEMENT STYLES
   ======================================== */

/* Battery Card in Grid */
.battery-card .vehicle-body {
  position: relative;
}

.battery-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.battery-preview-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.battery-preview-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  font-size: 0.875rem;
}

.battery-preview-name {
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  margin-right: 0.5rem;
}

.battery-preview-health {
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-sm);
}

.battery-preview-health.good {
  background: var(--success-light);
  color: var(--success);
}

.battery-preview-health.warning {
  background: var(--warning-light);
  color: var(--warning);
}

.battery-preview-health.danger {
  background: var(--danger-light);
  color: var(--danger);
}

.battery-preview-more {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding-top: 0.25rem;
}

.battery-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.battery-plate-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.battery-health-badge {
  font-size: 0.875rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.battery-health-badge.good {
  background: var(--success);
  color: white;
}

.battery-health-badge.warning {
  background: var(--warning);
  color: white;
}

.battery-health-badge.danger {
  background: var(--danger);
  color: white;
}

/* Battery Card States */
.vehicle-card.battery-good {
  border-color: var(--success);
}

.vehicle-card.battery-warning {
  border-color: var(--warning);
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--warning-light) 100%);
}

.vehicle-card.battery-danger {
  border-color: var(--danger);
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--danger-light) 100%);
}

/* Battery Modal */
.battery-modal-actions {
  margin-bottom: 1.5rem;
}

.batteries-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.batteries-list.replaced {
  opacity: 0.7;
}

/* Battery Card Full (in modal) */
.battery-card-full {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.battery-card-full.replaced {
  opacity: 0.6;
  background: var(--bg-tertiary);
}

.battery-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
}

.battery-card-info {
  flex: 1;
}

.battery-card-name {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 0.25rem 0;
}

.battery-card-meta {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.battery-card-meta strong {
  color: var(--accent);
}

/* Battery Health Indicator */
.battery-health-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  text-align: center;
}

.battery-health-indicator.good {
  background: var(--success-light);
}

.battery-health-indicator.warning {
  background: var(--warning-light);
}

.battery-health-indicator.danger {
  background: var(--danger-light);
}

.battery-health-indicator .health-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.battery-health-indicator.good .health-value {
  color: var(--success);
}

.battery-health-indicator.warning .health-value {
  color: var(--warning);
}

.battery-health-indicator.danger .health-value {
  color: var(--danger);
}

.battery-health-indicator .health-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* Battery Chart */
.battery-chart-container {
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  height: 180px;
}

/* Battery Actions */
.battery-card-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
}

/* Measurements Section */
.battery-measurements-section {
  padding: 0;
}

.measurements-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  background: var(--bg-tertiary);
  transition: background var(--transition);
}

.measurements-title:hover {
  background: var(--bg-hover);
}

.measurements-chevron {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform var(--transition);
}

.measurements-content {
  padding: 1rem 1.25rem;
}

.measurements-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 1rem;
}

.measurements-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.measurement-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}

.measurement-main {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.measurement-date {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.measurement-cca {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.9375rem;
}

.measurement-health {
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-sm);
}

.measurement-health.good {
  background: var(--success-light);
  color: var(--success);
}

.measurement-health.warning {
  background: var(--warning-light);
  color: var(--warning);
}

.measurement-health.danger {
  background: var(--danger-light);
  color: var(--danger);
}

.measurement-notes {
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-style: italic;
}

.measurement-actions {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.5rem;
}

/* Replaced Batteries Section */
.replaced-batteries-section {
  margin-top: 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.replaced-batteries-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  cursor: pointer;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background var(--transition);
}

.replaced-batteries-header:hover {
  background: var(--bg-hover);
}

.replaced-chevron {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform var(--transition);
}

.replaced-batteries-content {
  padding: 1rem;
  background: var(--bg-secondary);
}

/* Replace Battery Modal */
.replace-battery-info {
  background: var(--warning-light);
  color: var(--text-primary);
  padding: 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.replace-battery-info p {
  margin: 0;
}

/* Responsive Battery Styles */
@media (max-width: 768px) {
  .battery-card-header {
    flex-direction: column;
    gap: 1rem;
  }

  .battery-health-indicator {
    width: 100%;
    flex-direction: row;
    justify-content: center;
    gap: 0.5rem;
  }

  .battery-health-indicator .health-value {
    font-size: 1.25rem;
  }

  .battery-card-actions {
    justify-content: center;
  }

  .measurement-main {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  .battery-preview-item {
    font-size: 0.8125rem;
  }

  .battery-card-name {
    font-size: 1rem;
  }

  .battery-card-meta {
    font-size: 0.75rem;
  }
}

/* CCA Calculator */
.btn-calc {
  background: var(--primary);
  border: none;
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  font-size: 0.875rem;
  cursor: pointer;
  margin-left: 0.5rem;
  vertical-align: middle;
  transition: transform 0.15s, background 0.15s;
}

.btn-calc:hover {
  background: var(--primary-hover);
  transform: scale(1.1);
}

.cca-calculator {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.calc-header {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.75rem;
}

.calc-header span {
  font-weight: 600;
  color: var(--text);
}

.calc-header small {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: monospace;
}

.calc-result {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-top: 0.75rem;
}

.calc-result span {
  color: var(--text-muted);
}

.calc-result strong {
  font-size: 1.25rem;
  color: var(--primary);
  flex: 1;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
}
