:root {
  --blu: #003366;
  --blu-light: #1a5276;
  --verde: #1e8449;
  --grigio: #6c757d;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f7fa;
  padding-bottom: 80px;
}

/* ── HEADER ── */
.app-header {
  background: var(--blu);
  color: white;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-header .logo { font-size: 1.4rem; font-weight: 800; letter-spacing: 1px; }
.app-header .mese-label { font-size: 0.9rem; opacity: .85; }

/* ── BOTTOM NAV (mobile) ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid #dee2e6;
  display: flex;
  z-index: 1000;
}
.bottom-nav a {
  flex: 1;
  text-align: center;
  padding: 8px 4px 4px;
  color: var(--grigio);
  text-decoration: none;
  font-size: 0.65rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.bottom-nav a .icon { font-size: 1.5rem; line-height: 1; }
.bottom-nav a.active { color: var(--blu); }
@media (min-width: 768px) { .bottom-nav { display: none; } }

/* ── SIDEBAR (desktop) ── */
.sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--blu);
  position: fixed;
  top: 0;
  left: 0;
  padding-top: 70px;
  display: none;
}
@media (min-width: 768px) {
  .sidebar { display: block; }
  body { padding-left: 220px; padding-bottom: 0; }
  .app-header { left: 220px; }
}
.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,.8);
  padding: 12px 20px;
  text-decoration: none;
  font-size: 0.95rem;
  transition: background .15s;
}
.sidebar a:hover, .sidebar a.active { background: rgba(255,255,255,.15); color: white; }
.sidebar a .icon { font-size: 1.2rem; }

/* ── CARDS ── */
.card-totale {
  background: linear-gradient(135deg, var(--blu), var(--blu-light));
  color: white;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
}
.card-totale .label { font-size: 0.8rem; opacity: .8; text-transform: uppercase; letter-spacing: .5px; }
.card-totale .value { font-size: 2rem; font-weight: 700; }
.card-totale.verde { background: linear-gradient(135deg, var(--verde), #27ae60); }

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  margin-bottom: 12px;
}
.stat-card .label { font-size: 0.75rem; color: var(--grigio); text-transform: uppercase; letter-spacing: .5px; }
.stat-card .value { font-size: 1.3rem; font-weight: 600; color: #212529; }

/* ── VOCE LIST ITEM ── */
.voce-item {
  background: white;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
  position: relative;
}
.voce-item .data-badge {
  display: inline-block;
  background: var(--blu);
  color: white;
  border-radius: 8px;
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.voce-item .percorso { font-size: 0.95rem; font-weight: 500; margin-bottom: 4px; }
.voce-item .dettagli { font-size: 0.8rem; color: var(--grigio); }
.voce-item .importo { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-weight: 700; color: var(--verde); }

/* ── FORM ── */
.form-card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
  margin-bottom: 20px;
}
.form-control, .form-select {
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 1rem;
  border: 1.5px solid #dee2e6;
}
.form-control:focus, .form-select:focus {
  border-color: var(--blu);
  box-shadow: 0 0 0 3px rgba(0,51,102,.1);
}
.btn-primary {
  background: var(--blu);
  border-color: var(--blu);
  border-radius: 10px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
}
.btn-primary:hover { background: var(--blu-light); border-color: var(--blu-light); }
.btn-success { border-radius: 10px; padding: 12px 24px; font-size: 1rem; font-weight: 600; }

/* ── INDENNITA RADIO ── */
.indennita-option {
  border: 2px solid #dee2e6;
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all .15s;
  margin-bottom: 8px;
}
.indennita-option:has(input:checked) {
  border-color: var(--blu);
  background: #f0f4ff;
}
.indennita-option .importo-badge {
  float: right;
  background: var(--verde);
  color: white;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* ── MEMO VOCALE ── */
.record-btn {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: #dc3545;
  border: none;
  color: white;
  font-size: 2.5rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(220,53,69,.4);
  transition: transform .1s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.record-btn:active { transform: scale(.95); }
.record-btn.recording {
  animation: pulse-red 1s infinite;
  background: #c82333;
}
@keyframes pulse-red {
  0%, 100% { box-shadow: 0 4px 16px rgba(220,53,69,.4); }
  50% { box-shadow: 0 4px 32px rgba(220,53,69,.8); }
}

/* ── OFFLINE BANNER ── */
#offline-banner {
  display: none;
  background: #fd7e14;
  color: white;
  text-align: center;
  padding: 8px;
  font-size: 0.85rem;
}
#sync-badge {
  display: none;
  position: fixed;
  bottom: 90px;
  right: 16px;
  background: #fd7e14;
  color: white;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 0.8rem;
  z-index: 999;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

/* ── TABLE ── */
.table-responsive { border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.table { background: white; margin: 0; }
.table thead th { background: var(--blu); color: white; border: none; font-weight: 600; font-size: 0.8rem; }
.table tbody tr:hover { background: #f8f9ff; }

/* ── MONTH NAV ── */
.month-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.month-nav .month-label { font-size: 1.2rem; font-weight: 700; color: var(--blu); }
.month-nav .btn-nav {
  background: white;
  border: 2px solid var(--blu);
  color: var(--blu);
  border-radius: 8px;
  padding: 6px 14px;
  text-decoration: none;
  font-weight: 600;
}
.month-nav .btn-nav:hover { background: var(--blu); color: white; }

/* ── PAGE HEADER ── */
.page-header {
  padding: 20px 16px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.page-title { font-size: 1.3rem; font-weight: 700; color: #212529; margin: 0; }

/* ── UTILITIES ── */
.container-main { padding: 0 16px; max-width: 800px; margin: 0 auto; }
@media (min-width: 768px) { .container-main { padding: 0 24px; } }
