/* Deltamed — stile minimale, coerente col template Agentico */
:root {
  --navy: #0c1f3f;
  --accent: #3b82f6;
  --bg: #f1f4f9;
  --surface: #ffffff;
  --border: #d4dae7;
  --text: #1e293b;
  --muted: #64748b;
  --green: #16a34a;
  --amber: #e8a020;
}
* { box-sizing: border-box; }
body {
  font-family: -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  font-size: 14px;
}
.topbar {
  background: var(--navy);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.topbar .brand { font-weight: 800; letter-spacing: 0.5px; }
.topbar a { color: #cbd5e1; text-decoration: none; font-size: 13px; margin-left: 16px; }
.container { max-width: 1100px; margin: 0 auto; padding: 24px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 18px;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; }
th { background: var(--bg); font-weight: 700; }
.slot-mine { background: #dbeafe; border-left: 3px solid var(--accent); }
.slot-occupied { background: #e5e7eb; color: var(--muted); font-style: italic; }
.slot-free { background: #f8fafc; }
.slot-pending { background: #fef3c7; border-left: 3px solid var(--amber); }
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 7px 14px;
  border-radius: 5px;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
}
.btn.danger { background: #dc2626; }
.btn.secondary { background: var(--muted); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 700; }
.badge.pending { background: #fef3c7; color: #92400e; }
.badge.confirmed { background: #dcfce7; color: var(--green); }
.form-row { margin-bottom: 12px; }
label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 4px; color: var(--muted); }
input, select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 5px; width: 100%; font-size: 13px; }
.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 13px; }
.alert.error { background: #fee2e2; color: #b91c1c; }
.alert.success { background: #dcfce7; color: #166534; }

/* Popup di conferma prenotazione al tocco sulla griglia */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5);
  z-index: 100; align-items: center; justify-content: center; padding: 16px;
}
.modal-box {
  background: #fff; border-radius: 10px; padding: 22px; width: 100%; max-width: 340px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.modal-detail-row {
  display: flex; justify-content: space-between; padding: 7px 0;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
.modal-detail-row span { color: var(--muted); }

/* Griglia oraria (vista giorno/settimana) */
.grid-table { table-layout: fixed; }
.grid-table th, .grid-table td { border: 1px solid var(--border); padding: 3px 6px; vertical-align: top; font-size: 11.5px; }
.grid-table thead th { position: sticky; top: 0; background: var(--navy); color: #fff; z-index: 1; text-align: center; }
.grid-time-col {
  width: 56px; min-width: 56px; text-align: right; color: var(--muted); font-size: 11px;
  background: var(--bg); white-space: nowrap;
  position: sticky; left: 0; z-index: 2; /* resta visibile scorrendo orizzontalmente su mobile */
}
thead .grid-time-col { z-index: 3; background: var(--navy); color: #fff; } /* sopra sia a colonne che righe sticky */
.slot-free-cell { background: #fff; height: 22px; cursor: pointer; }
.slot-free-cell:hover { background: #dbeafe; }
.slot-free-cell.slot-past { cursor: default; background: #f8fafc; }
.slot-free-cell.slot-past:hover { background: #f8fafc; }
.grid-table .slot-mine { background: #dbeafe; border-left: 3px solid var(--accent); }
.grid-table .slot-occupied { background: #e5e7eb; color: var(--muted); font-style: italic; text-align: center; }
.grid-table .slot-pending { background: #fef3c7; border-left: 3px solid var(--amber); }

/* --- Mobile (telefono, viewport stretto) --- */
@media (max-width: 640px) {
  .container { padding: 12px; }
  .card { padding: 14px; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px 16px; }
  .topbar span { display: flex; flex-wrap: wrap; gap: 4px 12px; }
  .topbar a { margin-left: 4px; }
  .btn { padding: 9px 14px; } /* tap target più comodo col dito */
  .grid-table th, .grid-table td { font-size: 10.5px; padding: 2px 4px; }
  .grid-table td[rowspan] { min-width: 78px; } /* la cella prenotata resta leggibile anche stretta */
  h3 { font-size: 15px; }
}
