* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --primary: #1a3a5c;
  --primary-hover: #24527f;
  --accent: #b8860b;
  --text: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --danger: #b91c1c;
  --success: #15803d;
  --warning: #b45309;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
}

.sidebar {
  width: 220px;
  background: var(--primary);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  position: fixed;
  height: 100vh;
}

.brand {
  padding: 0 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 16px;
}
.brand-title { font-size: 18px; font-weight: 600; }
.brand-sub { font-size: 13px; color: var(--accent); margin-top: 2px; }

nav { flex: 1; display: flex; flex-direction: column; }
.nav-btn {
  background: transparent;
  border: none;
  color: #cbd5e1;
  text-align: left;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.nav-btn:hover { background: rgba(255,255,255,0.05); color: #fff; }
.nav-btn.active {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border-left-color: var(--accent);
}

.sidebar-footer {
  padding: 16px 20px;
  font-size: 12px;
  color: #94a3b8;
  border-top: 1px solid rgba(255,255,255,0.1);
}

main {
  margin-left: 220px;
  flex: 1;
  padding: 28px 32px;
  max-width: calc(100% - 220px);
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.page-header h1 { font-size: 22px; font-weight: 600; color: var(--primary); }

.btn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s;
}
.btn:hover { background: var(--primary-hover); }
.btn-secondary {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}
.btn-secondary:hover { background: var(--primary); color: #fff; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #991b1b; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon {
  background: transparent;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 16px;
}

.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
}
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 28px; font-weight: 600; color: var(--primary); margin-top: 4px; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
th {
  text-align: left;
  padding: 10px 12px;
  background: #f9fafb;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.search-bar input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-grid .full { grid-column: 1 / -1; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
}
.field textarea { resize: vertical; min-height: 60px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: #fff;
  border-radius: 8px;
  width: 600px;
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 { font-size: 16px; color: var(--primary); }
#modal-body { padding: 20px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.badge-aperta { background: #dbeafe; color: #1e40af; }
.badge-sospesa { background: #fef3c7; color: #92400e; }
.badge-chiusa { background: #e5e7eb; color: #4b5563; }
.badge-udienza { background: #fee2e2; color: #991b1b; }
.badge-termine { background: #fef3c7; color: #92400e; }
.badge-appuntamento { background: #dbeafe; color: #1e40af; }
.badge-altro { background: #e5e7eb; color: #4b5563; }

.scadenza-urgente { background: #fef2f2 !important; }
.scadenza-oggi { background: #fffbeb !important; }
.scadenza-completata { opacity: 0.55; text-decoration: line-through; }

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--primary);
  color: #fff;
  padding: 10px 18px;
  border-radius: 4px;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.toast.hidden { display: none; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

.row-actions { display: flex; gap: 6px; }
.hidden { display: none !important; }

.calc-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 14px;
  margin-bottom: 16px;
}
.calc-title {
  font-weight: 600;
  color: var(--primary);
  font-size: 13px;
  margin-bottom: 10px;
}
.calc-title small { font-weight: 400; color: var(--text-muted); }
.calc-box .field label small { color: var(--text-muted); font-weight: 400; }

.tratt-scritta-toggle {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}
.tratt-scritta-toggle input { margin-top: 2px; }
.tratt-scritta-toggle small { color: var(--text-muted); font-weight: 400; }
.tratt-scritta-info {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  padding-left: 6px;
  font-style: italic;
}

.badge-tratt-scritta {
  background: #ede9fe;
  color: #5b21b6;
  margin-left: 4px;
  font-size: 10px;
}
.badge-notifica { background: #fce7f3; color: #9d174d; }
.badge-notifica-giudice {
  background: #fee2e2;
  color: #991b1b;
  margin-left: 4px;
  font-size: 10px;
  font-weight: 700;
}
.badge-notifica-prudenziale {
  background: #fef3c7;
  color: #92400e;
  margin-left: 4px;
  font-size: 10px;
  font-weight: 600;
}

/* Stati pratiche da avviare */
.badge-pending-in-attesa-mandato { background: #e0e7ff; color: #3730a3; }
.badge-pending-documenti-in-arrivo { background: #fef3c7; color: #92400e; }
.badge-pending-pronta-per-avvio { background: #d1fae5; color: #065f46; }

/* Priorità */
.badge-pri-alta { background: #fee2e2; color: #991b1b; font-weight: 700; }
.badge-pri-media { background: #fef3c7; color: #92400e; }
.badge-pri-bassa { background: #e5e7eb; color: #4b5563; }

/* Cose da fare */
.cosa-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 6px;
}
.cosa-row.cosa-scaduta { background: #fef2f2; border-color: #fca5a5; }
.cosa-row.cosa-oggi { background: #fffbeb; border-color: #fcd34d; }
.cosa-row.cosa-fatta { opacity: 0.55; }
.cosa-row.cosa-fatta .cosa-titolo { text-decoration: line-through; }
.cosa-check input { width: 18px; height: 18px; cursor: pointer; }
.cosa-titolo { font-weight: 500; font-size: 14px; color: var(--text); }
.cosa-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
  align-items: center;
}
.cosa-actions { display: flex; gap: 4px; }

/* === VOCALI === */
.btn-voc-rec {
  display: block;
  width: 100%;
  padding: 18px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 8px;
}
.btn-voc-rec:hover { background: var(--primary-hover); }
.btn-voc-rec.rec-active {
  background: var(--danger);
  animation: pulse-rec 1.2s infinite;
}
@keyframes pulse-rec {
  0%, 100% { box-shadow: 0 0 0 0 rgba(185, 28, 28, 0.6); }
  50% { box-shadow: 0 0 0 14px rgba(185, 28, 28, 0); }
}

.vocale-card {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-left: 4px solid var(--danger);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.vocale-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}
.vocale-actions { display: flex; gap: 4px; }
.vocale-card audio { display: block; }

/* Idee e appunti */
.idea-card {
  background: #fefce8;
  border: 1px solid #fde68a;
  border-left: 4px solid #eab308;
  border-radius: 4px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.idea-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
  gap: 10px;
}
.idea-meta {
  flex: 1;
  font-size: 13px;
  line-height: 1.5;
}
.idea-text {
  white-space: pre-wrap;
  font-size: 14px;
  color: var(--text);
  line-height: 1.55;
}

/* === AGENDA === */
.agenda-filters {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
}
.agenda-filters label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.agenda-month {
  margin-bottom: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.agenda-month-title {
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 500;
  text-transform: capitalize;
  letter-spacing: 0.5px;
}
.agenda-items { }

.agenda-item {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.agenda-item:last-child { border-bottom: none; }
.agenda-item.scaduta { background: #fef2f2; }
.agenda-item.oggi { background: #fffbeb; }
.agenda-item.urgente { background: #fff7ed; }
.agenda-item.prossima { background: #fefce8; }
.agenda-item.agenda-done { opacity: 0.55; }
.agenda-item.agenda-done .agenda-title span:last-child { text-decoration: line-through; }

.agenda-date {
  text-align: center;
  padding: 6px;
  background: #f3f4f6;
  border-radius: 4px;
  min-width: 60px;
}
.agenda-day {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}
.agenda-dow {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
}

.agenda-body { min-width: 0; }
.agenda-title {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 14px;
  margin-bottom: 4px;
}
.agenda-title strong { color: var(--primary); }

.agenda-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.agenda-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  font-style: italic;
  padding-left: 8px;
  border-left: 2px solid var(--border);
}

.agenda-right {
  text-align: right;
  min-width: 110px;
}
.agenda-gg {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.agenda-item.scaduta .agenda-gg { color: var(--danger); }
.agenda-item.oggi .agenda-gg { color: var(--warning); }
.agenda-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* === DETTAGLIO SCADENZA === */
.detail-info {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 0;
}
.detail-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.detail-row:last-child { border-bottom: none; }
.detail-label {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.detail-value { color: var(--text); }

.allegato-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 6px;
}
.allegato-icon { font-size: 22px; }
.allegato-info { flex: 1; min-width: 0; }
.allegato-nome {
  font-weight: 500;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.allegato-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.allegato-actions { display: flex; gap: 4px; }

.upload-box {
  margin-top: 10px;
  padding: 18px;
  background: #f0f9ff;
  border: 2px dashed #7dd3fc;
  border-radius: 6px;
  text-align: center;
  transition: all 0.15s;
}
.upload-box.drag-over {
  background: #dbeafe;
  border-color: var(--primary);
  border-style: solid;
  transform: scale(1.01);
}
.upload-box.drag-over * { pointer-events: none; }

.form-allegati {
  margin-top: 16px;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.cliente-slot {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
  align-items: stretch;
}
.cliente-slot select {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
}
.cliente-slot button {
  flex-shrink: 0;
  min-width: 32px;
}

/* === CALCOLATORE TERMINI === */
.calc-topbar {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.calc-btnrow {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.calc-results-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.calc-results-table th {
  background: #f9fafb;
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  border-bottom: 1px solid var(--border);
}
.calc-results-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.calc-results-table tr:last-child td { border-bottom: none; }
.calc-info {
  display: inline-block;
  cursor: help;
  margin-left: 4px;
  font-size: 12px;
}

/* === LOGIN === */
.login-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #1a3a5c 0%, #24527f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.login-box {
  background: #fff;
  padding: 32px 28px;
  border-radius: 10px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-title { font-size: 22px; font-weight: 600; color: var(--primary); }
.login-sub { color: var(--accent); font-size: 15px; margin-top: 2px; }
.login-form .field { margin-bottom: 14px; }
.login-form label { display: block; font-size: 12px; font-weight: 500; color: var(--text-muted); margin-bottom: 4px; }
.login-form input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
}
.login-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
  margin: 6px 0;
}
.login-btn {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 500;
}

/* === STAMPA === */
@media print {
  .sidebar, .no-print, .hamburger, .sidebar-overlay { display: none !important; }
  main { margin-left: 0 !important; padding: 0 !important; max-width: 100% !important; }
  body { background: #fff; font-size: 11px; }
  .page-header { border-bottom: 2px solid #000; }
  .agenda-month-title { background: #fff !important; color: #000 !important; border-bottom: 1px solid #000; }
  .agenda-item { page-break-inside: avoid; }
  .agenda-day { color: #000; }
}

/* === HAMBURGER E OVERLAY (nascosti su desktop) === */
.hamburger {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 90;
  background: var(--primary);
  color: #fff;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 85;
}
.sidebar-overlay.open { display: block; }

/* === MOBILE (≤ 768px) === */
@media (max-width: 768px) {
  body { font-size: 15px; }

  /* Hamburger visibile, sidebar scorrevole */
  .hamburger { display: block; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 88;
    width: 260px;
    box-shadow: 2px 0 12px rgba(0,0,0,0.2);
  }
  .sidebar.open { transform: translateX(0); }

  /* Main content full width */
  main {
    margin-left: 0 !important;
    max-width: 100% !important;
    padding: 60px 14px 20px !important; /* spazio in alto per hamburger */
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .page-header h1 { font-size: 20px; }
  .page-header .btn { width: 100%; padding: 12px; font-size: 15px; }

  /* Bottoni più grandi per il touch */
  .btn { padding: 12px 18px; font-size: 14px; min-height: 44px; }
  .btn-sm { padding: 8px 12px; font-size: 13px; min-height: 36px; }
  .btn-icon { width: 44px; height: 44px; font-size: 24px; }

  /* Card più leggere */
  .card { padding: 14px; }
  .stat-card { padding: 12px; }
  .stat-value { font-size: 22px; }

  /* Form a colonna singola */
  .form-grid { grid-template-columns: 1fr !important; }
  .field input, .field select, .field textarea {
    padding: 12px 10px;
    font-size: 15px; /* evita zoom iOS su focus */
  }

  /* Tabelle → layout a "card" verticale */
  table { display: block; width: 100%; border: none; background: transparent; }
  thead { display: none; }
  tbody, tr { display: block; width: 100%; }
  tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 10px;
    padding: 10px;
  }
  tr:hover td { background: transparent; }
  td {
    display: block;
    padding: 4px 0;
    border-bottom: none;
    font-size: 14px;
  }
  td:first-child { font-size: 16px; font-weight: 600; color: var(--primary); margin-bottom: 4px; }
  td.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
  }
  td.row-actions .btn { flex: 1; min-width: 44%; }

  /* Barra ricerca */
  .search-bar { flex-direction: column; }
  .search-bar input, .search-bar select { width: 100%; }

  /* Modale a tutto schermo */
  .modal {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
  .modal-overlay { align-items: flex-start; }
  #modal-body { padding: 14px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }

  /* Agenda */
  .agenda-item {
    grid-template-columns: 56px 1fr;
    gap: 10px;
  }
  .agenda-right {
    grid-column: 1 / -1;
    text-align: left;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .agenda-actions { justify-content: flex-start; }
  .agenda-day { font-size: 20px; }

  /* Dettaglio */
  .detail-row { grid-template-columns: 1fr; gap: 2px; }
  .detail-label { font-size: 11px; }

  /* Calcolatore */
  .calc-topbar { flex-direction: column; align-items: stretch; }
  .calc-btnrow { flex-direction: column; }
  .calc-btnrow .btn { width: 100%; }
  .calc-results-table { display: table; } /* la tabella risultati resta normale ma dentro scroll orizzontale */
  .calc-results-table thead { display: table-header-group; }
  .calc-results-table tbody { display: table-row-group; }
  .calc-results-table tr { display: table-row; background: transparent; border: none; padding: 0; margin: 0; }
  .calc-results-table td { display: table-cell; border-bottom: 1px solid var(--border); padding: 10px 8px; }
  .calc-results-table td:first-child { font-size: 13px; color: var(--text); font-weight: 600; }

  /* Cose da fare: ridotto */
  .cosa-row { grid-template-columns: 24px 1fr; padding: 8px 10px; }
  .cosa-actions { grid-column: 1 / -1; padding-top: 6px; }

  /* Idee */
  .idea-header { flex-direction: column; gap: 6px; }
  .idea-header .row-actions { width: 100%; }

  /* Clienti slot */
  .cliente-slot { flex-direction: row; }

  /* Upload box */
  .upload-box { padding: 14px; }
}

/* === SMARTPHONE STRETTI (≤ 400px) === */
@media (max-width: 400px) {
  main { padding: 58px 10px 16px !important; }
  .stat-value { font-size: 20px; }
  .page-header h1 { font-size: 18px; }
  .agenda-item { grid-template-columns: 48px 1fr; gap: 8px; }
}
