:root {
  --bg: #f4f6f9;
  --card-bg: #ffffff;
  --text: #1f2937;
  --text-muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --green: #16a34a;
  --green-bg: #dcfce7;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --grey-bg: #e5e7eb;
  --border: #e5e7eb;
  --sidebar-bg: #111827;
  --sidebar-text: #d1d5db;
  --sidebar-active: #2563eb;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}

.layout { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}
.sidebar .brand {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  padding: 0 20px 20px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar nav { flex: 1; }
.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--sidebar-text);
  text-decoration: none;
  padding: 12px 20px;
  font-size: 14px;
  border-left: 3px solid transparent;
}
.sidebar a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar a.active {
  background: rgba(37,99,235,0.15);
  color: #fff;
  border-left-color: var(--primary);
  font-weight: 600;
}
.sidebar .icon { font-size: 18px; width: 22px; text-align: center; }
.sidebar .logout { margin-top: auto; }

/* ---------- Main content ---------- */
.main { flex: 1; padding: 28px 32px; max-width: 1200px; }
.page-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 22px 0;
}

/* ---------- Cards / KPIs ---------- */
.cards-row { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  flex: 1 1 200px;
  min-width: 200px;
}
.card .card-label { color: var(--text-muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.card .card-value { font-size: 26px; font-weight: 700; margin-top: 6px; }
.card .card-value.positive { color: var(--green); }
.card .card-value.negative { color: var(--red); }

.panel {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  margin-bottom: 24px;
}
.panel h2 {
  font-size: 16px;
  margin: 0 0 16px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover td { background: #f9fafb; }
.amount { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.amount.positive { color: var(--green); font-weight: 600; }
.amount.negative { color: var(--red); font-weight: 600; }
.table-scroll { overflow-x: auto; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.grey { background: var(--grey-bg); color: var(--text-muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--primary-dark); }
.btn.secondary { background: var(--grey-bg); color: var(--text); }
.btn.secondary:hover { background: #d1d5db; }
.btn.danger { background: var(--red); }
.btn-row { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.icon-btn {
  background: none; border: none; cursor: pointer; font-size: 16px;
  padding: 4px 6px; border-radius: 6px; color: var(--text-muted);
}
.icon-btn:hover { background: var(--grey-bg); }

/* ---------- Forms ---------- */
form .field { margin-bottom: 16px; }
form label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-muted); }
form input[type=text], form input[type=number], form input[type=date],
form input[type=password], form select, form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
form .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
form .grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 700px) {
  form .grid-2, form .grid-3 { grid-template-columns: 1fr; }
}

/* ---------- Alerts ---------- */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 18px;
  font-size: 14px;
}
.alert.success { background: var(--green-bg); color: #14532d; }
.alert.error { background: var(--red-bg); color: #7f1d1d; }

/* ---------- Login page ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #111827, #1e3a8a);
}
.login-box {
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  text-align: center;
}
.login-box .emoji { font-size: 42px; margin-bottom: 10px; }
.login-box h1 { font-size: 20px; margin: 0 0 24px 0; }
.login-box .btn { width: 100%; justify-content: center; padding: 12px; margin-top: 8px; }

/* ---------- Mobile ---------- */
@media (max-width: 800px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; overflow-x: auto; padding: 10px 0; }
  .sidebar .brand { display: none; }
  .sidebar nav { display: flex; flex: none; }
  .sidebar a { flex-direction: column; gap: 2px; padding: 8px 14px; font-size: 11px; border-left: none; border-bottom: 3px solid transparent; white-space: nowrap; }
  .sidebar a.active { border-left: none; border-bottom-color: var(--primary); }
  .sidebar .logout { margin-top: 0; }
  .main { padding: 18px 16px; }
  .page-title { font-size: 20px; }
}

/* ---------- Page publique de réservation ---------- */
.public-body { background: var(--bg); }
.public-wrap { max-width: 760px; margin: 0 auto; padding: 24px 20px 60px; }
.public-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 24px;
}
.public-header .brand { font-size: 18px; font-weight: 700; }
.public-main h1 { font-size: 26px; margin-bottom: 6px; }
.public-intro { color: var(--text-muted); margin-bottom: 24px; }

.booking-widget {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.booking-days {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
}
.day-btn {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 56px;
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
}
.day-btn .day-dow { text-transform: uppercase; font-size: 11px; color: var(--text-muted); }
.day-btn .day-num { font-size: 17px; font-weight: 700; }
.day-btn .day-month { font-size: 11px; color: var(--text-muted); }
.day-btn.active { border-color: var(--primary); background: var(--primary); color: #fff; }
.day-btn.active .day-dow, .day-btn.active .day-month { color: rgba(255,255,255,0.85); }

.booking-slots { margin-bottom: 20px; }
.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}
.slot-btn {
  padding: 10px 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 14px;
}
.slot-btn:hover { border-color: var(--primary); color: var(--primary); }

.booking-form {
  border-top: 1px solid var(--border);
  padding-top: 18px;
  margin-top: 4px;
}
.booking-form label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.booking-form input, .booking-form textarea {
  width: 100%;
  margin-top: 4px;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 14px;
  font-family: inherit;
}
.slot-summary { font-weight: 600; margin-bottom: 14px; }
.booking-form-actions { display: flex; gap: 10px; justify-content: flex-end; }
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.muted { color: var(--text-muted); }

@media (max-width: 600px) {
  .slot-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
}
