:root{
  --ink:#0f172a; --muted:#6b7280; --border:#dbe0e6; --bg:#f5f7fb;
  --teal:#6fc1c3; --grid:#cfd8dc;
  --gray:#6b7280; --blue:#3b82f6; --amber:#f59e0b; --green:#16a34a; --red:#ef4444; --slate:#64748b;
}

*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--ink);font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,"Helvetica Neue",Arial}

/* Header */
.topbar{position:sticky;top:0;z-index:10;display:flex;justify-content:space-between;align-items:center;padding:14px 18px;background:#fff;border-bottom:1px solid #e5e7eb}
.topbar h1{margin:0;font-size:18px;font-weight:800}
.cta{display:flex;gap:8px;flex-wrap:wrap}
.btn{border:1px solid #e5e7eb;background:#fff;border-radius:10px;padding:8px 10px;font-weight:600;cursor:pointer}
.btn.primary{background:var(--teal);border-color:var(--teal);color:#fff}

/* Layout */
.wrap{max-width:1100px;margin:16px auto;padding:0 14px}
.calendar{background:#fff;border:1px solid #e5e7eb;border-radius:14px;overflow:hidden}
.month-header{padding:12px 20px;font-size:18px;font-weight:800;text-align:center;background:#f1f5f9;border-bottom:2px solid var(--grid)}

/* Legend */
.legend{display:flex;gap:12px;flex-wrap:wrap;align-items:center;padding:10px 16px;border-bottom:1px solid #eef2f7;background:#fafbff}
.legend-item{display:inline-flex;gap:8px;align-items:center;font-size:13px;color:#334155}
.dot{width:10px;height:10px;border-radius:50%}
.st-brouillon{background:var(--slate)}
.st-emballage{background:var(--blue)}
.st-livraison{background:var(--amber)}
.st-livree{background:var(--green)}
.st-annulee{background:var(--red)}
.st-autre{background:#94a3b8}

/* Grid */
.weekdays{display:grid;grid-template-columns:repeat(7,1fr);background:var(--teal)}
.weekdays div{padding:12px 10px;font-weight:800;color:#fff;text-align:center}
.month{display:grid;grid-template-columns:repeat(7,1fr)}
.cell{min-height:150px;border-right:2px solid var(--grid);border-bottom:2px solid var(--grid);padding:10px 10px 8px;display:flex;flex-direction:column;gap:6px}
.cell:nth-child(7n){border-right:none}
.day{font-size:16px;font-weight:800;color:#7fbfc0}
.cell.muted{background:#f3f4f6}
.cell.muted .day{color:#b6c4c6}

/* Chips (badges) */
.chip{display:inline-block;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:3px 8px;border-radius:999px;font-size:12px;font-weight:700;color:#fff}
.chip.st-brouillon{background:var(--slate)}
.chip.st-emballage{background:var(--blue)}
.chip.st-livraison{background:var(--amber);color:#78350f}
.chip.st-livree{background:var(--green)}
.chip.st-annulee{background:var(--red)}
.chip.st-autre{background:#94a3b8}

/* "+n" indicador */
.more{margin-top:2px;font-size:12px;color:var(--muted);font-weight:700}

/* ===== Modal ===== */
.modal{position:fixed;inset:0;display:none;align-items:center;justify-content:center;z-index:60}
.modal.show{display:flex}
.modal-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.35)}
.modal-card{position:relative;background:#fff;border-radius:14px;box-shadow:0 30px 80px rgba(0,0,0,.25);
  width:min(720px,92vw);max-height:80vh;display:flex;flex-direction:column;border:1px solid #e5e7eb}
.modal-head{display:flex;justify-content:space-between;align-items:center;padding:12px 14px;border-bottom:1px solid #eef2f7}
.modal-title{font-weight:800}
.modal-body{padding:10px 14px;overflow:auto}
.modal-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}
.modal-list li{display:flex;gap:8px;align-items:center;justify-content:space-between;border:1px solid #eef2f7;border-radius:10px;padding:8px 10px}
.modal-list .who{display:flex;gap:8px;align-items:center;min-width:0}
.modal-list .badge{padding:2px 8px;border-radius:999px;font-weight:700;font-size:11px;color:#fff;white-space:nowrap}
.badge.st-brouillon{background:var(--slate)}
.badge.st-emballage{background:var(--blue)}
.badge.st-livraison{background:var(--amber);color:#78350f}
.badge.st-livree{background:var(--green)}
.badge.st-annulee{background:var(--red)}
.badge.st-autre{background:#94a3b8}
.modal-list .name{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:360px}
.modal-list .meta{font-size:12px;color:var(--muted)}
.btn.close{border:1px solid #e5e7eb;background:#fff;border-radius:8px;padding:6px 10px;cursor:pointer}

/* Responsive */
@media (max-width:700px){
  .cell{min-height:120px}
  .day{font-size:14px}
  .legend{gap:8px}
}
