:root {
  --navy: #101a33;
  --navy-deep: #0b1226;
  --navy-soft: #1b2a4d;
  --gold: #e9a83b;
  --gold-dark: #d18f24;
  --ink: #1e2433;
  --ink-soft: #5a6478;
  --soft-bg: #f4f6fb;
  --white: #ffffff;
  --border: #e3e7f0;
  --green: #1d9e57;
  --red: #cf3b3b;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(16, 26, 51, .10);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "Nunito", "Segoe UI", system-ui, Arial, sans-serif;
  font-size: 16px; line-height: 1.55;
  color: var(--ink); background: var(--soft-bg);
}
h1 { color: var(--navy); font-size: 1.7rem; margin: 26px 0 18px; }
h2 { color: var(--navy); font-size: 1.25rem; margin-bottom: 14px; }
h3 { color: var(--navy); font-size: 1.05rem; margin: 18px 0 10px; }
a { color: var(--navy-soft); }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 18px 50px; }

/* ---------- Barre du haut ---------- */
.topbar { background: var(--navy); color: var(--white); position: sticky; top: 0; z-index: 40; }
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 10px 18px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--white); font-weight: 900; font-size: 1.15rem; }
.topbar .brand img { width: 40px; height: 40px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); }
.whoami { margin-left: auto; font-weight: 700; color: #cdd6ea; }
.role-badge {
  background: var(--gold); color: var(--navy-deep);
  font-size: .75rem; font-weight: 800; padding: 2px 10px;
  border-radius: 999px; margin-left: 8px; vertical-align: middle;
}
.pw-menu { position: relative; }
.pw-menu summary { cursor: pointer; font-weight: 700; color: #cdd6ea; list-style: none; }
.pw-menu[open] summary { color: var(--white); }
.pw-form {
  position: absolute; right: 0; top: 130%; z-index: 50;
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; display: flex; flex-direction: column; gap: 8px; width: 240px;
}
.pw-form input { font: inherit; padding: 9px 10px; border: 1.5px solid var(--border); border-radius: 8px; }
#pw-status { font-size: .85rem; font-weight: 700; color: var(--ink); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 800; font-size: .95rem;
  padding: 10px 18px; border-radius: 999px; border: none; cursor: pointer;
  text-decoration: none; transition: filter .12s ease, transform .1s ease;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.98); }
.btn-gold { background: var(--gold); color: var(--navy-deep); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-outline { background: transparent; color: var(--white); border: 2px solid rgba(255,255,255,.6); }
.btn-outline-dark { background: var(--white); color: var(--navy); border: 1.5px solid var(--navy); }
.btn-small { padding: 6px 12px; font-size: .85rem; }

/* ---------- Panneaux ---------- */
.panel {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; margin-bottom: 26px;
}

/* ---------- Stats ---------- */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.stat-card {
  background: var(--navy); color: var(--white);
  border-radius: var(--radius); padding: 18px; text-align: center;
  display: flex; flex-direction: column; gap: 2px;
}
.stat-num { font-size: 2rem; font-weight: 900; color: var(--gold); }
.stat-label { font-size: .85rem; color: #cdd6ea; font-weight: 700; }

/* ---------- Tableaux ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th {
  text-align: left; padding: 10px 10px; color: var(--ink-soft);
  border-bottom: 2px solid var(--border); font-size: .82rem;
  text-transform: uppercase; letter-spacing: .05em;
}
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table .empty { text-align: center; color: var(--ink-soft); padding: 22px; }
.row-off td { opacity: .45; }
.actions { white-space: nowrap; display: flex; gap: 6px; }
.pill {
  display: inline-block; background: var(--soft-bg);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 1px 9px; font-size: .82rem; font-weight: 700; margin-right: 2px;
}
.besoin { max-width: 260px; color: var(--ink-soft); }

.status { font-weight: 800; white-space: nowrap; }
.st-en_attente { color: #b07714; }
.st-rdv_pris { color: var(--green); }
.st-refuse { color: var(--red); }
.st-annule { color: var(--ink-soft); }
.status-select { font: inherit; font-weight: 700; padding: 5px 8px; border-radius: 8px; border: 1.5px solid var(--border); }

/* ---------- Formulaires ---------- */
.create-box { margin-top: 16px; }
.create-box summary { cursor: pointer; font-weight: 800; color: var(--navy); padding: 6px 0; }
.grid-form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 12px; max-width: 640px; }
.grid-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: .9rem; }
.grid-form input { font: inherit; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--soft-bg); }
.grid-form button { grid-column: 1 / -1; justify-self: start; }
#company-status, #employee-status { grid-column: 1 / -1; font-weight: 700; }

/* ---------- Calendrier ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.cal-hint { font-size: .85rem; color: var(--ink-soft); font-weight: 600; }
.cal-nav { display: flex; align-items: center; gap: 12px; }
.cal-legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: .85rem; font-weight: 700; color: var(--ink-soft); margin-bottom: 12px; }
.lg { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 5px; border: 1px solid var(--border); }
.lg-free { background: var(--white); }
.lg-mine { background: #dff3e8; border-color: var(--green); }
.lg-taken { background: #e8ebf3; }
.lg-blocked { background: #f6dede; border-color: var(--red); }

.cal-scroll { overflow: auto; max-height: 560px; border: 1px solid var(--border); border-radius: 10px; }
.cal-grid {
  display: grid;
  grid-template-columns: 64px repeat(7, minmax(96px, 1fr));
  min-width: 760px;
}
.cal-corner, .cal-day {
  position: sticky; top: 0; z-index: 5;
  background: var(--navy); color: var(--white);
  font-weight: 800; font-size: .85rem; text-align: center;
  padding: 8px 4px;
}
.cal-time {
  font-size: .78rem; font-weight: 700; color: var(--ink-soft);
  text-align: right; padding: 1px 8px 0 0; background: var(--white);
  border-top: 1px solid transparent;
}
.cal-time.cal-hour { border-top: 1px solid var(--border); }
.cal-cell {
  height: 22px; border-left: 1px solid var(--border);
  border-top: 1px dotted #edf0f6; background: var(--white);
  cursor: pointer; font-size: .72rem; font-weight: 700;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  padding: 1px 4px; color: var(--navy);
}
.cal-cell.cal-hour { border-top: 1px solid var(--border); }
.cal-cell:hover { background: #fff4dd; }
.cal-cell.past { background: #f2f3f7; cursor: default; }
.cal-cell.past:hover { background: #f2f3f7; }
.cal-cell.taken { background: #e8ebf3; cursor: default; }
.cal-cell.taken:hover { background: #e8ebf3; }
.cal-cell.blocked { background: #f6dede; }
.cal-cell.mine { background: #dff3e8; }
.cal-cell.mine.st-refuse { background: #f6dede; }
.cal-cell.mine.st-en_attente { background: #fdeec9; }

/* ---------- Modales ---------- */
.modal {
  border: none; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px; width: min(440px, 92vw);
}
.modal::backdrop { background: rgba(11, 18, 38, .55); }
.modal h3 { margin: 0 0 10px; }
.modal-slot { font-weight: 800; color: var(--navy); margin-bottom: 12px; }
.modal form { display: flex; flex-direction: column; gap: 10px; }
.modal label { font-weight: 700; font-size: .9rem; display: flex; flex-direction: column; gap: 4px; }
.modal input, .modal textarea { font: inherit; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--soft-bg); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
#book-status { font-weight: 700; min-height: 1.3em; }

/* ---------- Connexion ---------- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, var(--navy-deep) 0%, var(--navy) 55%, var(--navy-soft) 100%);
  padding: 20px;
}
.login-card {
  background: var(--white); border-radius: 20px; box-shadow: var(--shadow);
  padding: 38px 34px; width: min(400px, 94vw); text-align: center;
}
.login-logo { width: 96px; height: 96px; border-radius: 50%; margin-bottom: 12px; }
.login-card h1 { color: var(--navy); margin-bottom: 2px; }
.login-sub { color: var(--ink-soft); margin-bottom: 18px; }
.login-error {
  background: #f6dede; color: var(--red); font-weight: 700;
  border-radius: 8px; padding: 10px; margin-bottom: 14px; font-size: .9rem;
}
.login-card form { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.login-card label { font-weight: 700; font-size: .9rem; }
.login-card input { font: inherit; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 9px; background: var(--soft-bg); }
.login-card button { margin-top: 12px; }
.login-back { margin-top: 16px; font-size: .9rem; }

/* ---------- Pied de page ---------- */
.pro-footer { text-align: center; color: var(--ink-soft); font-size: .85rem; padding: 18px 0 26px; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .grid-form { grid-template-columns: 1fr; }
  .table { display: block; overflow-x: auto; }
  .whoami { display: none; }
}
