:root {
  --bg: #f5f6fa;
  --card: #fff;
  --text: #1f2433;
  --muted: #6b7185;
  --line: #e4e6ee;
  --primary: #0f766e;
  --primary-soft: #e6f4f2;
  --danger: #c2410c;
  --warn: #b45309;
  --ok: #15803d;
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
button, input, select, textarea { font: inherit; }

.app { display: flex; min-height: 100vh; }
.sidebar { width: 230px; background: #12302d; color: #d7e7e4; display: flex; flex-direction: column; flex-shrink: 0; }
.brand { font-weight: 700; font-size: 20px; padding: 20px; display: flex; align-items: center; gap: 10px; color: #fff; }
.logo { background: #2dd4bf; color: #12302d; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; }
#nav a { display: flex; justify-content: space-between; align-items: center; padding: 10px 20px; color: inherit; text-decoration: none; border-left: 3px solid transparent; }
#nav a:hover { background: rgba(255,255,255,.05); }
#nav a.active { background: rgba(255,255,255,.08); border-left-color: #2dd4bf; color: #fff; font-weight: 600; }
.badge { background: #f97316; color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; font-weight: 600; }
.sidebar-foot { margin-top: auto; padding: 16px 20px; }
.link { background: none; border: 0; color: #9fbdb8; cursor: pointer; padding: 0; text-decoration: underline; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 14px 24px; background: var(--card); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 19px; margin: 0; flex: 1; }
.who { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.burger { display: none; background: none; border: 0; font-size: 20px; cursor: pointer; }
#view { padding: 24px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.card h3 { margin: 0 0 12px; font-size: 15px; }
.grid { display: grid; gap: 18px; }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g2 { grid-template-columns: 1fr 1fr; }
.stat .v { font-size: 26px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

.btn { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; cursor: pointer; color: var(--text); white-space: nowrap; }
.btn:hover { border-color: #c5c9d6; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.ok { color: var(--ok); }
.btn.sm { padding: 3px 8px; font-size: 12px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.week-label { font-weight: 600; min-width: 190px; text-align: center; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.muted { color: var(--muted); }
.right { text-align: right; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.pill.pending { background: #fef3c7; color: var(--warn); }
.pill.approved { background: #dcfce7; color: var(--ok); }
.pill.refused { background: #ffedd5; color: var(--danger); }
.pill.draft { background: #eef0f5; color: var(--muted); }

.avatar { width: 30px; height: 30px; border-radius: 50%; color: #fff; display: inline-grid; place-items: center; font-weight: 700; font-size: 12px; flex-shrink: 0; }
.person { display: flex; align-items: center; gap: 10px; }
.person small { display: block; color: var(--muted); }

/* Schedule grid */
.sched-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.sched { min-width: 980px; table-layout: fixed; }
.sched th, .sched td { border-right: 1px solid var(--line); padding: 6px; }
.sched th:first-child, .sched td:first-child { width: 200px; }
.sched th.today { background: var(--primary-soft); color: var(--primary); }
.sched td.cell { height: 64px; vertical-align: top; position: relative; cursor: pointer; }
.sched td.cell:hover { background: #fafbfd; }
.sched td.cell.drop { background: var(--primary-soft); }
.sched td.cell.unavail { background: repeating-linear-gradient(45deg, #fff, #fff 6px, #f2f3f7 6px, #f2f3f7 12px); }
.sched td.cell .add { position: absolute; right: 4px; bottom: 2px; color: var(--muted); opacity: 0; font-size: 16px; }
.sched td.cell:hover .add { opacity: 1; }
.sched tfoot td { font-size: 12px; color: var(--muted); background: #fafbfd; }
.shift { background: color-mix(in srgb, var(--c) 18%, white); border-left: 4px solid var(--c); border-radius: 6px; padding: 4px 6px; margin-bottom: 4px; font-size: 12px; font-weight: 600; cursor: grab; }
.shift small { display: block; font-weight: 400; color: var(--muted); }
.shift.draft { border-style: dashed; border-left-style: solid; opacity: .75; background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 12%, white), color-mix(in srgb, var(--c) 12%, white) 5px, white 5px, white 9px); }
.shift.conflict { outline: 2px solid var(--danger); }
.leave-tag { background: #fde68a; color: #78350f; border-radius: 6px; padding: 4px 6px; font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.open-row td:first-child { font-weight: 600; color: var(--warn); }
.hours { font-size: 12px; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 10px; flex-wrap: wrap; }

.bar { height: 10px; background: #eef0f5; border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; background: var(--primary); }

.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; }

.msg { padding: 12px 0; border-bottom: 1px solid var(--line); }
.msg .meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }

.clock { text-align: center; padding: 30px; }
.clock .time { font-size: 48px; font-weight: 700; font-variant-numeric: tabular-nums; }
.clock .btn { font-size: 16px; padding: 12px 28px; margin-top: 14px; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal.hidden, .toast.hidden { display: none; }
.modal-card { background: #fff; border-radius: 12px; width: 100%; max-width: 480px; max-height: 90vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 17px; }
.x { background: none; border: 0; font-size: 24px; cursor: pointer; color: var(--muted); }
#modalForm { padding: 18px 20px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.modal-actions .left { margin-right: auto; }
.warn-box { background: #fff7ed; color: var(--danger); border-radius: 8px; padding: 8px 10px; font-size: 13px; margin-bottom: 12px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1f2433; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 60; }

.avail-row { display: grid; grid-template-columns: 110px 110px 1fr 1fr; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }

@media (max-width: 900px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .burger { display: block; }
  .g4 { grid-template-columns: 1fr 1fr; }
  .g2 { grid-template-columns: 1fr; }
  #view { padding: 14px; }
  .who label { display: none; }
}

/* Connexion / chargement */
.hidden { display: none !important; }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: #12302d; }
.auth-card { background: #fff; border-radius: 14px; padding: 28px; width: 100%; max-width: 400px; }
.auth-card h2 { margin: 4px 0 6px; font-size: 20px; }
.auth-card .btn.primary { width: 100%; padding: 10px; margin-top: 6px; }
.brand.dark { color: var(--text); padding: 0 0 8px; }
.who .name { color: var(--text); font-weight: 600; }
.pw-box { background: var(--primary-soft); border-radius: 8px; padding: 12px; font-family: ui-monospace, Menlo, monospace; font-size: 15px; margin: 10px 0; user-select: all; }
