/* =========================================================
   Agenda : noir, blanc, un accent bleu.
   Verre coloré (transparence opaque) dans le menu latéral.
   Aucune ombre portée.
   ========================================================= */

:root {
  --bg: #fff;
  --fg: #000;
  --fg-2: rgba(0, 0, 0, 0.64);
  --fg-3: rgba(0, 0, 0, 0.56);
  --line: rgba(0, 0, 0, 0.08);
  --line-2: rgba(0, 0, 0, 0.16);
  --hover: rgba(0, 0, 0, 0.045);
  --press: rgba(0, 0, 0, 0.08);
  --accent: #1f5eff;
  --accent-hover: #1850e0;
  --accent-soft: rgba(31, 94, 255, 0.1);
  --green: #16a05a;
  --danger: #c8151b;
  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 18px;
  --top-h: 64px;
  --sb-w: 272px;
  --gutter: 64px;
  --t: 0.12s ease;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, p {
  margin: 0;
}

a {
  color: var(--accent);
  text-underline-offset: 2px;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.muted {
  color: var(--fg-2);
}

.small {
  font-size: 13px;
}

.ic {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Boutons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: #fff;
  color: var(--fg);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--t), border-color var(--t), color var(--t);
}

.btn:hover {
  background: var(--hover);
}

.btn:active {
  background: var(--press);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn .ic {
  width: 18px;
  height: 18px;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #a90f14;
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
}

.btn-danger-text {
  color: var(--danger);
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
  height: 46px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  transition: background-color var(--t);
}

.icon-btn:hover {
  background: var(--hover);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.icon-btn-sm {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
}

.icon-btn-sm .ic {
  width: 18px;
  height: 18px;
}

/* ---------- Champs ---------- */

input:not([type]),
input[type='text'],
input[type='email'],
input[type='password'],
input[type='date'],
input[type='time'],
input[type='number'],
select,
textarea {
  height: 38px;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: #fff;
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  transition: border-color var(--t);
}

textarea {
  width: 100%;
  height: auto;
  min-height: 84px;
  padding: 10px 12px;
  resize: vertical;
}

select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  cursor: pointer;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(31, 94, 255, 0.3);
  outline-offset: 0;
}

input[type='checkbox'],
input[type='radio'] {
  accent-color: var(--accent);
  width: 17px;
  height: 17px;
  margin: 0;
}

input[type='color'] {
  width: 38px;
  height: 38px;
  flex: none;
  padding: 4px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
}

input[type='color']::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type='color']::-webkit-color-swatch {
  border: 0;
  border-radius: 6px;
}

.num {
  width: 72px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span {
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
}

.field small {
  font-size: 12px;
  color: var(--fg-2);
}

.check,
.radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* =========================================================
   Pages de connexion
   ========================================================= */

body.auth {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

.auth-glass,
.side-glass {
  --g1: #1f5eff;
  --g2: #16a05a;
  --g3: #3a9bff;
  overflow: hidden;
}

.auth-glass {
  position: fixed;
  inset: 0 45% 0 0;
  z-index: 0;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(56px);
  opacity: 0.5;
}

.auth-glass .b1 { width: 46vw; height: 46vw; max-width: 560px; max-height: 560px; left: -12vw; top: -8vw; background: var(--g1); }
.auth-glass .b2 { width: 34vw; height: 34vw; max-width: 420px; max-height: 420px; right: -6vw; top: 34%; background: var(--g2); }
.auth-glass .b3 { width: 30vw; height: 30vw; max-width: 380px; max-height: 380px; left: 12%; bottom: -10vw; background: var(--g3); }

.auth-wrap {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}

.auth-side {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: 48px 56px;
  background: rgba(255, 255, 255, 0.34);
  -webkit-backdrop-filter: blur(40px) saturate(1.4);
  backdrop-filter: blur(40px) saturate(1.4);
  border-right: 1px solid var(--line);
}

.brand {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.auth-tagline {
  max-width: 13ch;
  font-size: clamp(34px, 4.4vw, 60px);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -0.02em;
}

.auth-main {
  display: grid;
  place-items: center;
  padding: 48px 24px;
  background: #fff;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: min(380px, 100%);
}

.auth-form h1 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.auth-form input {
  height: 46px;
  font-size: 15px;
}

.auth-switch {
  font-size: 14px;
  color: var(--fg-2);
}

.auth-switch a {
  font-weight: 700;
}

.form-error {
  padding: 10px 14px;
  border-radius: var(--radius);
  background: rgba(200, 21, 27, 0.08);
  color: var(--danger);
  font-weight: 600;
  font-size: 14px;
}

.join-cal {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 16px;
}

.swatch {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 4px;
  border-radius: 5px;
}

@media (max-width: 800px) {
  .auth-glass { inset: 0 0 auto 0; height: 260px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { padding: 28px 24px 36px; border-right: 0; border-bottom: 1px solid var(--line); gap: 28px; }
  .auth-tagline { font-size: 32px; }
  .auth-main { place-items: start center; padding: 32px 16px 48px; }
}

/* =========================================================
   Application
   ========================================================= */

body.app {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.shell {
  display: grid;
  grid-template-columns: var(--sb-w) minmax(0, 1fr);
  grid-template-rows: var(--top-h) minmax(0, 1fr);
  height: 100%;
}

.shell.sidebar-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.shell.sidebar-collapsed .sidebar,
.shell.sidebar-collapsed .side-glass {
  visibility: hidden;
}

.main {
  grid-row: 2;
  grid-column: 2;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  outline: none;
}

.boot-error {
  padding: 32px;
  font-weight: 700;
}

/* ---------- Barre du haut ---------- */

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 0 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  min-width: 0;
}

.topbar .brand {
  margin: 0 20px 0 6px;
}

.arrows {
  display: flex;
}

.period {
  flex: 1;
  min-width: 0;
  margin-left: 6px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-2);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.3);
}

.live.is-on .live-dot {
  background: var(--green);
}

.break {
  display: none;
}

.seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
}

.seg button {
  height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: background-color var(--t), color var(--t);
}

.seg button:hover {
  background: var(--hover);
}

.seg button[aria-pressed='true'] {
  background: #000;
  color: #fff;
}

.seg .short {
  display: none;
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.07);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.avatar.sm {
  width: 24px;
  height: 24px;
  font-size: 10px;
}

.avatar.lg {
  width: 42px;
  height: 42px;
  font-size: 15px;
}

.avatar-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.avatar-btn:hover .avatar {
  background: rgba(0, 0, 0, 0.12);
}

/* ---------- Menu latéral en verre coloré ---------- */

.side-glass {
  grid-row: 2;
  grid-column: 1;
  position: relative;
  z-index: 0;
  background: #fff;
}

.side-glass .blob {
  opacity: 0.5;
  filter: blur(46px);
}

.side-glass .b1 { width: 250px; height: 250px; left: -90px; top: 30px; background: var(--g1); }
.side-glass .b2 { width: 220px; height: 220px; right: -110px; top: 44%; background: var(--g2); }
.side-glass .b3 { width: 240px; height: 240px; left: -20px; bottom: -110px; background: var(--g3); }

.sidebar {
  grid-row: 2;
  grid-column: 1;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-height: 0;
  padding: 16px 12px 20px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.36);
  -webkit-backdrop-filter: blur(28px) saturate(1.5);
  backdrop-filter: blur(28px) saturate(1.5);
  border-right: 1px solid var(--line);
}

.btn-create {
  align-self: flex-start;
  height: 48px;
  padding: 0 22px 0 16px;
  border-radius: 14px;
  font-size: 15px;
}

.btn-create .ic {
  width: 22px;
  height: 22px;
}

.mini-head {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 2px 6px 8px;
}

.mini-title {
  flex: 1;
  font-size: 14px;
  font-weight: 800;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 2px;
  text-align: center;
}

.mini-dow {
  height: 26px;
  line-height: 26px;
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-3);
}

.mini-day {
  justify-self: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--t);
}

.mini-day:hover {
  background: rgba(0, 0, 0, 0.07);
}

.mini-day.is-other {
  color: var(--fg-3);
}

.mini-day.in-range {
  background: rgba(31, 94, 255, 0.14);
}

.mini-day.is-sel {
  background: #000;
  color: #fff;
}

.mini-day.is-today {
  background: var(--accent);
  color: #fff;
}

.cal-group {
  display: flex;
  flex-direction: column;
}

.cal-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  padding: 0 2px 4px 8px;
}

.cal-group-head h2 {
  font-size: 14px;
  font-weight: 800;
}

.cal-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cal-list .muted {
  padding: 6px 8px;
}

.cal-item {
  display: flex;
  align-items: center;
  border-radius: var(--radius);
  transition: background-color var(--t);
}

.cal-item:hover {
  background: rgba(255, 255, 255, 0.55);
}

.cal-check {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 8px;
  cursor: pointer;
}

.cal-check input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.cal-check .box {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: none;
  border: 2px solid var(--c);
  border-radius: 5px;
  transition: background-color var(--t);
}

.cal-check .box .ic {
  width: 14px;
  height: 14px;
  stroke: #fff;
  stroke-width: 3;
  opacity: 0;
}

.cal-check input:checked + .box {
  background: var(--c);
}

.cal-check input:checked + .box .ic {
  opacity: 1;
}

.cal-check input:focus-visible + .box {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.cal-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cal-name {
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cal-text small {
  font-size: 12px;
  color: var(--fg-2);
}

.sb-settings {
  align-self: flex-start;
  margin-top: auto;
}

.scrim {
  display: none;
}

/* ---------- Événements (commun) ---------- */

.ev {
  --c: var(--accent);
  position: absolute;
  z-index: 2;
  overflow: hidden;
  padding: 3px 7px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border: 1px solid color-mix(in srgb, var(--c) 42%, transparent);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.05);
  background: color-mix(in srgb, var(--c) 17%, rgba(255, 255, 255, 0.62));
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: var(--fg);
  font-size: 12px;
  line-height: 1.3;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: background-color var(--t);
}

.ev:hover {
  background: color-mix(in srgb, var(--c) 27%, rgba(255, 255, 255, 0.62));
}

.ev:focus-visible {
  z-index: 4;
  outline-offset: 1px;
}

.ev.is-past {
  background: color-mix(in srgb, var(--c) 9%, rgba(255, 255, 255, 0.7));
  border-color: color-mix(in srgb, var(--c) 26%, transparent);
}

.ev.is-locked {
  cursor: not-allowed;
  background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgba(0, 0, 0, 0.06) 6px 8px);
}

.ev-line {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.ev-title {
  overflow: hidden;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ev-time {
  color: var(--fg-2);
  font-size: 11.5px;
  white-space: nowrap;
}

.ev-loc {
  overflow: hidden;
  color: var(--fg-2);
  font-size: 11.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ev-lock,
.ev-rec {
  display: inline-flex;
  flex: none;
}

.ev-lock .ic,
.ev-rec .ic {
  width: 12px;
  height: 12px;
  stroke-width: 2.2;
}

.ev-rec {
  margin-left: auto;
  color: var(--fg-2);
}

.ev-resize {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 8px;
  cursor: ns-resize;
}

.ev-draft {
  z-index: 5;
  pointer-events: none;
  border: 1.5px solid var(--c);
  background: color-mix(in srgb, var(--c) 26%, rgba(255, 255, 255, 0.7));
}

.ev-ghost {
  z-index: 6;
  pointer-events: none;
  border: 1.5px solid var(--c);
  background: color-mix(in srgb, var(--c) 30%, rgba(255, 255, 255, 0.7));
}

.is-dragging-src {
  opacity: 0.35;
}

body.is-dragging,
body.is-dragging * {
  user-select: none;
  -webkit-user-select: none;
}

body.drag-move,
body.drag-move * {
  cursor: grabbing !important;
}

body.drag-resize,
body.drag-resize * {
  cursor: ns-resize !important;
}

body.drag-create,
body.drag-create * {
  cursor: row-resize !important;
}

.is-drop {
  background: color-mix(in srgb, var(--c) 13%, transparent) !important;
}

/* ---------- Vue semaine / jour ---------- */

.wk {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.wk-top {
  flex: none;
  border-bottom: 1px solid var(--line-2);
  /* Même réserve que la barre de défilement de la grille : colonnes alignées. */
  overflow-y: hidden;
  scrollbar-gutter: stable;
}

.wk-head {
  display: grid;
  grid-template-columns: var(--gutter) repeat(var(--n), minmax(0, 1fr));
}

.wk-corner {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 0 8px 6px 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-3);
}

.wk-dh {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 0 8px;
}

.wk-dow {
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-2);
}

.wk-num {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color var(--t);
}

.wk-num:hover {
  background: var(--hover);
}

.wk-dh.is-past .wk-num {
  color: var(--fg-2);
}

.wk-dh.is-today .wk-dow {
  color: var(--accent);
}

.wk-dh.is-today .wk-num {
  background: var(--accent);
  color: #fff;
}

.wk-allday {
  display: grid;
  grid-template-columns: var(--gutter) minmax(0, 1fr);
}

.wk-ad-label {
  align-items: center;
  padding-bottom: 0;
  text-align: right;
  line-height: 1.1;
}

.wk-ad-scroll {
  max-height: 110px;
  overflow-y: auto;
}

.wk-ad-area {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  min-height: 30px;
}

.wk-ad-cell {
  grid-row: 1;
  border-left: 1px solid var(--line);
  cursor: pointer;
}

.wk-ad-items {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.wk-ad-items .ev {
  pointer-events: auto;
}

.ev-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
}

.ev-bar.cont-l {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.ev-bar.cont-r {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.wk-scroll {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.wk-body {
  position: relative;
  display: grid;
  grid-template-columns: var(--gutter) minmax(0, 1fr);
}

.wk-gutter {
  position: relative;
}

.wk-gutter span {
  position: absolute;
  right: 10px;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-3);
  white-space: nowrap;
}

.wk-cols {
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(var(--hour-h) - 1px),
    var(--line) calc(var(--hour-h) - 1px),
    var(--line) var(--hour-h)
  );
}

.wk-col {
  position: relative;
  border-left: 1px solid var(--line);
  cursor: default;
}

.wk-col.is-today {
  background: rgba(31, 94, 255, 0.03);
}

.ev-timed .ev-time {
  margin-top: 1px;
}

.ev-timed.is-compact {
  display: flex;
  align-items: center;
  padding-top: 0;
  padding-bottom: 0;
}

.ev-timed.is-compact .ev-line {
  gap: 6px;
  width: 100%;
}

.ev-timed.is-compact .ev-time {
  margin: 0;
}

.now-line {
  position: absolute;
  left: -1px;
  right: 0;
  z-index: 3;
  height: 2px;
  background: var(--accent);
  pointer-events: none;
}

.now-line::before {
  content: '';
  position: absolute;
  left: -5px;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- Vue mois ---------- */

.mo {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.mo-head {
  display: grid;
  flex: none;
  overflow-y: hidden;
  scrollbar-gutter: stable;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  border-bottom: 1px solid var(--line-2);
}

.mo-head div {
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-2);
}

.mo-body {
  display: grid;
  flex: 1;
  grid-template-rows: repeat(var(--weeks), minmax(80px, 1fr));
  min-height: 0;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.mo-row {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.mo-cells {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
}

.mo-cell {
  padding: 4px 6px;
  border-left: 1px solid var(--line);
  cursor: pointer;
}

.mo-cell:first-child {
  border-left: 0;
}

.mo-cell.is-other {
  background: rgba(0, 0, 0, 0.02);
}

.mo-num {
  height: 24px;
  min-width: 24px;
  padding: 0 7px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color var(--t);
}

.mo-num:hover {
  background: var(--hover);
}

.mo-cell.is-other .mo-num {
  color: var(--fg-3);
}

.mo-cell.is-today .mo-num {
  background: var(--accent);
  color: #fff;
}

.mo-items {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.mo-items > * {
  pointer-events: auto;
}

.ev-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 20px;
  padding: 0 6px;
  border-color: transparent;
  border-radius: 6px;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.ev-chip:hover,
.ev-chip.is-past {
  border-color: transparent;
  background: var(--hover);
}

.ev-chip.is-past {
  background: transparent;
}

.ev-chip.is-past .ev-title {
  color: var(--fg-2);
}

.ev-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--c);
}

.ev-chip .ev-title {
  font-weight: 600;
}

.mo .ev-bar {
  height: 20px;
}

.mo-more {
  position: absolute;
  height: 20px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-2);
  text-align: left;
  cursor: pointer;
}

.mo-more:hover {
  background: var(--hover);
  color: var(--fg);
}

/* ---------- Mois sur mobile ---------- */

.mm {
  height: 100%;
  overflow-y: auto;
  padding: 8px 16px 32px;
}

.mm-head,
.mm-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
}

.mm-head span {
  padding: 6px 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-3);
}

.mm-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

.mm-day.is-other {
  color: var(--fg-3);
}

.mm-day.is-today {
  color: var(--accent);
}

.mm-day.is-sel {
  background: #000;
  color: #fff;
}

.mm-dots {
  display: flex;
  gap: 3px;
  height: 5px;
}

.mm-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.mm-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
}

.mm-title {
  margin-bottom: 4px;
  font-size: 17px;
  font-weight: 800;
}

.ev-row {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
}

.ev-when {
  width: 96px;
  flex: none;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--fg-2);
}

.ev-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ev-row .ev-title {
  display: flex;
  gap: 6px;
  align-items: center;
  white-space: normal;
}

.empty {
  padding: 16px 0;
  color: var(--fg-2);
}

/* =========================================================
   Fenêtres
   ========================================================= */

#layer {
  position: relative;
  z-index: 100;
}

.dlg-wrap {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.dlg-wrap.is-modal {
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.26);
}

.dlg {
  display: flex;
  flex-direction: column;
  width: min(460px, 100%);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  background: #fff;
  outline: none;
}

.is-pop .dlg {
  position: absolute;
  width: 380px;
  max-height: calc(100vh - 24px);
  background: rgba(255, 255, 255, 0.84);
  -webkit-backdrop-filter: blur(26px) saturate(1.5);
  backdrop-filter: blur(26px) saturate(1.5);
}

.dlg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 14px 6px 24px;
}

.dlg-head h2 {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.dlg-body {
  padding: 8px 24px 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.dlg-foot,
.dlg-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.dlg-foot {
  padding: 4px 24px 22px;
}

.dlg-actions {
  padding-top: 6px;
}

.dlg-text {
  font-size: 15px;
}

.dlg-small {
  width: min(420px, 100%);
}

.radio-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.radio-list .radio {
  padding: 8px 4px;
  font-size: 15px;
}

/* ---------- Détail d'un événement ---------- */

.dlg-detail .dlg-body {
  padding: 10px 18px 20px 20px;
}

.det-tools {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
  margin: 0 -8px 4px 0;
}

.det-head {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.det-sw {
  width: 16px;
  height: 16px;
  margin-top: 7px;
  border-radius: 5px;
}

.det-title {
  font-size: 21px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.det-when {
  margin-top: 4px;
  color: var(--fg-2);
}

.det-rec {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 13px;
  color: var(--fg-2);
}

.det-rec .ic {
  width: 15px;
  height: 15px;
}

.det-lock {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.05);
  font-size: 14px;
  font-weight: 600;
}

.det-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.det-list > li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  font-size: 14px;
}

.det-list > li > .ic {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  color: var(--fg-2);
}

.det-list a {
  overflow-wrap: anywhere;
}

.det-desc {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: 0;
}

.people {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.people li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.det-meta {
  margin-top: 16px;
  font-size: 12px;
  color: var(--fg-3);
}

/* ---------- Éditeur ---------- */

.dlg-editor {
  width: min(680px, 100%);
}

/* Création depuis la grille : l'éditeur flotte à côté de l'aperçu, sans voile. */
.is-pop .dlg.dlg-editor {
  width: 540px;
  background: rgba(255, 255, 255, 0.95);
  max-height: calc(100vh - 24px);
}

.editor {
  display: flex;
  flex-direction: column;
}

.ed-title {
  width: 100%;
  height: auto !important;
  padding: 6px 0 10px !important;
  border: 0 !important;
  border-bottom: 1px solid var(--line-2) !important;
  border-radius: 0 !important;
  font-size: 22px !important;
  font-weight: 700;
}

.ed-title:focus {
  outline: none;
  border-bottom: 2px solid var(--accent) !important;
  padding-bottom: 9px !important;
}

.ed-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 10px 0;
}

.ed-row > .ic {
  margin-top: 9px;
  color: var(--fg-2);
}

.ed-row > select,
.ed-row > textarea {
  width: 100%;
}

.ed-when {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.ed-dt {
  display: flex;
  gap: 6px;
}

.ed-sep {
  color: var(--fg-2);
}

.editor.is-allday .ed-time {
  display: none;
}

.ed-tz,
.ed-error {
  flex-basis: 100%;
  font-size: 12px;
}

.ed-tz {
  color: var(--fg-3);
}

.ed-error {
  color: var(--danger);
  font-weight: 700;
}

.ed-rec-wrap > select {
  width: 100%;
}

.ed-rec {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.03);
}

.inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
}

.weekdays {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wd {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: #fff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: background-color var(--t), color var(--t);
}

.wd[aria-pressed='true'] {
  border-color: #000;
  background: #000;
  color: #fff;
}

.ends {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
}

.ends legend {
  margin-bottom: 4px;
  padding: 0;
  font-size: 13px;
  font-weight: 700;
}

.ends .radio {
  flex-wrap: wrap;
  min-height: 38px;
}

.ed-type {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.ed-type select {
  flex: 1;
  min-width: 160px;
}

.ed-newtype {
  display: flex;
  flex-basis: 100%;
  gap: 8px;
}

.ed-newtype input[type='text'] {
  flex: 1;
}

.ed-ic-sw {
  width: 18px;
  height: 18px;
  margin: 4px 0 0 2px;
  border-radius: 50%;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.sw {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.sw input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.sw span {
  display: block;
  width: 26px;
  height: 26px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--c, #ccc);
  outline: 1px solid color-mix(in srgb, var(--c, #999) 55%, transparent);
}

.sw input:checked + span {
  outline: 2px solid #000;
}

.sw input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sw em {
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  color: var(--fg-2);
}

.ed-people {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ed-label {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-2);
}

.chips,
.day-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px 0 6px;
  border: 1px solid var(--line-2);
  border-radius: 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--t), border-color var(--t);
}

.day-toggles .chip {
  padding: 0 14px;
}

.chip input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.chip:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.chip:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ed-loc {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ed-loc input {
  width: 100%;
}

.ed-map {
  align-self: flex-start;
  font-size: 13px;
  font-weight: 700;
}

.ed-foot {
  position: sticky;
  bottom: -22px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px -24px -22px;
  padding: 14px 24px 22px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.spacer {
  flex: 1;
}

/* ---------- Paramètres d'agenda, réglages ---------- */

.sect {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.sect:first-child {
  padding-top: 4px;
  border-top: 0;
}

.sect h3 {
  font-size: 15px;
  font-weight: 800;
}

.sect-danger {
  padding-bottom: 0;
}

.sect-danger .btn {
  align-self: flex-start;
  margin-left: -12px;
}

.dlg-cal,
.dlg-settings {
  width: min(560px, 100%);
}

.cal-ro {
  display: flex;
  align-items: center;
  font-weight: 700;
}

.share-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.share-row input {
  flex: 1 1 220px;
  font-size: 13px;
}

.members,
.types {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.members li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
}

.member-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.member-main small {
  overflow: hidden;
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tag {
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.06);
  font-size: 12px;
  font-weight: 700;
}

.types li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.types li input:not([type='color']) {
  flex: 1;
}

.type-add {
  display: flex;
  gap: 8px;
}

.type-add input:not([type='color']) {
  flex: 1;
}

/* ---------- Menu du compte ---------- */

.dlg-menu {
  width: 270px !important;
}

.dlg-menu .dlg-body {
  padding: 14px 10px 10px;
}

.acct {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  padding: 0 6px 14px;
  border-bottom: 1px solid var(--line);
}

.acct > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.acct small {
  overflow: hidden;
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 42px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--t);
}

.menu-item:hover {
  background: var(--hover);
}

/* ---------- Notifications ---------- */

.toasts {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: min(440px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 12px;
  background: #000;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  pointer-events: auto;
}

.toast-btn {
  flex: none;
  padding: 4px 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #9db9ff;
  font-weight: 800;
  cursor: pointer;
}

.toast-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* =========================================================
   Écrans étroits (mobile)
   ========================================================= */

@media (max-width: 719px) {
  :root {
    --gutter: 46px;
  }

  .shell,
  .shell.sidebar-collapsed {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .main {
    grid-column: 1;
  }

  .topbar {
    flex-wrap: wrap;
    row-gap: 4px;
    padding: 8px 10px;
  }

  .topbar .brand,
  .live-text,
  .hide-sm {
    display: none;
  }

  .period {
    order: 1;
    font-size: 18px;
  }

  .live {
    order: 2;
    margin: 0 4px;
  }

  .avatar-btn {
    order: 3;
  }

  .break {
    display: block;
    order: 4;
    flex-basis: 100%;
    height: 0;
  }

  .topbar [data-today] {
    order: 5;
  }

  .arrows {
    order: 6;
  }

  .seg {
    order: 7;
    margin-left: auto;
  }

  .seg button {
    padding: 0 12px;
  }

  .seg .full {
    display: none;
  }

  .seg .short {
    display: inline;
  }

  .sidebar,
  .side-glass,
  .shell.sidebar-collapsed .sidebar,
  .shell.sidebar-collapsed .side-glass {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    width: min(300px, 86vw);
    visibility: hidden;
    transform: translateX(-102%);
    transition: transform 0.18s ease, visibility 0s linear 0.18s;
  }

  .side-glass {
    z-index: 59;
  }

  .shell.sidebar-open .sidebar,
  .shell.sidebar-open .side-glass {
    visibility: visible;
    transform: none;
    transition: transform 0.18s ease;
  }

  .shell.sidebar-open .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(0, 0, 0, 0.26);
  }

  .wk-num {
    width: 34px;
    height: 34px;
    font-size: 18px;
  }

  .wk-dh {
    padding: 6px 0;
  }

  .wk-ad-label {
    font-size: 10px;
  }

  .dlg-wrap.is-modal {
    align-items: end;
    padding: 0;
  }

  .dlg,
  .is-pop .dlg {
    position: static;
    width: 100% !important;
    max-height: 92vh;
    max-height: 92dvh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .dlg-editor {
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    border: 0 !important;
  }

  .dlg-body {
    padding: 8px 16px 20px;
  }

  .dlg-head {
    padding: 12px 8px 4px 16px;
  }

  .dlg-foot {
    padding: 4px 16px 20px;
  }

  .ed-foot {
    margin: 8px -16px -20px;
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
    bottom: -20px;
  }

  .ed-dt input[type='date'] {
    width: 150px;
  }

  .grid2 {
    grid-template-columns: 1fr;
  }

  .toasts {
    left: 16px;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
  }
}

/* ---------- Mouvement réduit ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
}
