/* Wecare — composants partagés par l'application et le design system. */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
.icon { width: 1.25em; height: 1.25em; flex: none; display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--blue-600); outline-offset: 2px; }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 49px; padding: 0 26px;
  border-radius: var(--r-pill); border: 1px solid transparent;
  font-size: var(--fs-lg); font-weight: 600; white-space: nowrap; text-decoration: none;
  transition: background-color .15s, border-color .15s, color .15s, transform .12s;
}
.btn:active { transform: scale(.98); }
.btn--sm { min-height: 39px; padding: 0 18px; font-size: var(--fs-md); }
.btn--primary { background: var(--grad); color: #fff; }
.btn--primary:hover { background: var(--blue-600); }
.btn--secondary { background: var(--surface); border-color: var(--line); }
.btn--secondary:hover { background: var(--blue-50); border-color: var(--sky-line); }
.btn--ghost { color: var(--blue-700); }
.btn--ghost:hover { background: var(--blue-50); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #A51C26; }
.btn[disabled] { background: var(--line); color: var(--ink-3); border-color: transparent; cursor: not-allowed; }
.btn--secondary[disabled] { background: none; border-color: var(--line); }
.btn.is-loading { pointer-events: none; }
.btn.is-loading::before {
  content: ''; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
.icon-btn {
  width: 48px; height: 48px; flex: none;
  display: inline-grid; place-items: center;
  border-radius: 50%; background: var(--surface-2); color: var(--ink-2);
  position: relative;
}
.icon-btn:hover { background: var(--blue-100); color: var(--blue-700); }
.icon-btn--sm { width: 40px; height: 40px; font-size: var(--fs-sm); }
.icon-btn--plain { background: none; }
.dot-alert { position: absolute; top: 9px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface-2); box-sizing: content-box; }

/* Champs */
.field { display: grid; gap: 6px; }
.main h1:focus { outline: 0; }
.field > label, .label { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.input {
  width: 100%; min-height: 49px; padding: 10px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--ink-3); }
.input:hover { border-color: var(--sky-line); }
.input:focus { outline: 0; border-color: var(--blue-600); box-shadow: 0 0 0 3px var(--blue-100); }
.input[disabled] { background: var(--surface-2); color: var(--ink-3); border-color: var(--line); cursor: not-allowed; }
.input.is-error { border-color: var(--danger); }
.input.is-error:focus { box-shadow: 0 0 0 3px var(--danger-bg); }
textarea.input { min-height: 88px; resize: vertical; }
.field__error { display: flex; gap: 6px; align-items: center; font-size: var(--fs-sm); color: var(--danger); }
.search { position: relative; }
.search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search .input { padding-left: 42px; border-radius: var(--r-pill); }
select.input { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23626A88' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.check { display: inline-flex; align-items: center; gap: var(--s-2); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--blue-600); }

/* Bascules */
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: var(--r-pill); }
.seg button { min-height: 33px; padding: 0 16px; border-radius: var(--r-pill); font-weight: 600; font-size: var(--fs-md); color: var(--ink); }
.seg button:hover { color: var(--blue-600); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); }

.tabs { display: flex; gap: var(--s-6); box-shadow: inset 0 -1px var(--line); overflow-x: auto; overflow-y: hidden; }
.tabs button { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 600; color: var(--ink-3); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--blue-700); border-color: var(--blue-600); }
.tabs .count { font-size: var(--fs-xs); background: var(--surface-2); color: var(--ink-3); border-radius: var(--r-pill); padding: 0 7px; }

.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 39px; padding: 0 16px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); font-weight: 600; font-size: var(--fs-md); color: var(--ink); white-space: nowrap; }
.chip:hover { border-color: var(--sky-line); }
.chip[aria-pressed="true"] { background: var(--sky-fill); border-color: var(--sky-line); color: var(--blue-600); }

/* Pastilles de statut */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px; border-radius: var(--r-sm); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); }
.badge .icon { width: 14px; height: 14px; }
.badge--booked { background: var(--blue-100); color: var(--blue-700); }
.badge--arrived, .badge--done, .badge--actif { background: var(--success-bg); color: var(--success); }
.badge--inconsult, .badge--nouveau { background: var(--blue-100); color: var(--blue-700); }
.badge--rappeler { background: var(--warning-bg); color: var(--warning); }
.badge--urgent, .badge--absent { background: var(--danger-bg); color: var(--danger); }

/* Avatars */
.avatar { width: 48px; height: 48px; flex: none; display: inline-grid; place-items: center; border-radius: 50%; font-size: var(--fs-md); font-weight: 600; background: var(--blue-100); color: var(--blue-600); }
.avatar--sm { width: 32px; height: 32px; font-size: 12px; }
.avatar--lg { width: 72px; height: 72px; font-size: var(--fs-xl); }

/* Rendez-vous : carte blanche posée sur le fond, sans contour */
.evt {
  --lift: 0 1px 3px rgba(41, 63, 109, .14), 0 8px 20px -8px rgba(41, 63, 109, .34);
  container-type: inline-size;
  display: flex; flex-direction: column; justify-content: space-between; gap: 6px; width: 100%; min-width: 0; overflow: hidden;
  padding: 12px 14px; text-align: left;
  background: var(--surface); border-radius: var(--r-md); box-shadow: var(--lift);
  transition: box-shadow .18s ease, transform .18s ease;
}
.evt:hover { --lift: 0 2px 4px rgba(41, 63, 109, .14), 0 14px 26px -10px rgba(41, 63, 109, .46); transform: translateY(-2px); z-index: 3; }
.evt:active { transform: translateY(0); }
.evt:focus-visible { z-index: 4; }
.evt__top { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; min-height: 24px; }
.evt__main { display: grid; gap: 1px; min-width: 0; }
.evt__motif { padding-left: 17px; font-size: var(--fs-xs); line-height: 16px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.evt__who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.evt__dot { width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--t-line); }
.evt__name { font-size: var(--fs-md); line-height: 20px; font-weight: 600; color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.evt__meta { font-size: var(--fs-md); line-height: 20px; font-weight: 600; color: var(--blue-600); white-space: nowrap; }
.evt__pill { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; flex: none; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.evt__pill .icon { width: 14px; height: 14px; }
.evt__pill--arrived { background: #DFF7E8; color: var(--success); }
.evt__pill--inconsult { background: var(--grad); color: #fff; }
.evt__pill--done, .evt__pill--cancelled { background: var(--surface); color: var(--ink-3); }
.evt__pill--absent { background: #FFE9E9; color: var(--danger); }
.evt__pill--urgent { background: var(--danger); color: #fff; }
.evt__flag { width: 16px; height: 16px; flex: none; color: var(--ink); }
@container (max-width: 170px) {
  .evt__pill { width: 24px; padding: 0; justify-content: center; }
  .evt__pill span { display: none; }
}
@container (max-width: 116px) {
  .evt__end { display: none; }
}
.evt--xs { flex-direction: row; align-items: center; justify-content: flex-start; gap: 6px; padding: 0 10px; border-radius: 10px; }
.evt--xs .evt__name { flex: 1; font-weight: 500; }
.evt.is-urgent .evt__flag { color: var(--danger); }
.evt.is-done, .evt.is-cancelled, .evt.is-absent { background: #F1F4FB; box-shadow: none; }
.evt.is-done .evt__name, .evt.is-absent .evt__name, .evt.is-cancelled .evt__name { font-weight: 500; color: var(--ink-2); }
.evt.is-done .evt__meta, .evt.is-absent .evt__meta, .evt.is-cancelled .evt__meta { color: var(--ink-2); }
.evt.is-done:hover, .evt.is-cancelled:hover, .evt.is-absent:hover { background: var(--surface); box-shadow: var(--lift); }
.evt.is-cancelled .evt__name { text-decoration: line-through; }
.evt.is-absent .evt__flag { color: var(--danger); }
.evt.is-selected, .evt.is-selected:hover { background: url(../assets/wecare-motif.svg) right top / 130px auto no-repeat, var(--grad); }
.evt--xs.is-selected, .evt--xs.is-selected:hover { background-size: 72px auto, auto; }
.evt.is-selected .evt__name, .evt.is-selected .evt__motif, .evt.is-selected .evt__meta, .evt.is-selected .evt__flag { color: #fff; text-decoration: none; }
.evt.is-selected .evt__dot { background: #fff; }
.evt.is-selected .evt__pill { background: rgba(255, 255, 255, .24); color: #fff; }
.evt.is-changed { animation: changed .7s ease; }
.evt.is-movable { cursor: grab; }
.evt.is-dragging { opacity: .35; }
body.is-moving, body.is-moving * { cursor: grabbing !important; user-select: none; }

/* Créneaux */
.slot { min-height: 44px; min-width: 76px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: var(--fs-md); }
.slot:hover { border-color: var(--sky-line); background: var(--sky-fill); color: var(--blue-600); }
.slot.is-selected { background: var(--grad); border-color: transparent; color: #fff; }
.slot.is-suggested { border-color: var(--blue-600); color: var(--blue-700); }
.slot[disabled] { background: var(--surface-2); border-color: var(--line); color: var(--ink-3); text-decoration: line-through; font-weight: 500; cursor: not-allowed; }

/* Étapes */
.steps { display: flex; gap: var(--s-2); }
.steps li { flex: 1; min-width: 0; display: grid; gap: var(--s-2); font-size: var(--fs-sm); font-weight: 600; color: var(--ink-3); }
.steps li::before { content: ''; height: 6px; border-radius: var(--r-pill); background: var(--line); }
.steps li.is-done::before, .steps li.is-current::before { background: var(--blue-600); }
.steps li.is-current { color: var(--blue-700); }
.steps li.is-done { color: var(--ink-2); }

/* Messages */
.banner { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); border: 1px solid; }
.banner > .icon { margin-top: 1px; }
.banner strong { display: block; font-weight: 600; }
.banner p { font-size: var(--fs-sm); color: var(--ink-2); }
.banner--danger { background: var(--danger-bg); border-color: var(--danger-line); }
.banner--danger > .icon { color: var(--danger); }
.banner--warning { background: var(--warning-bg); border-color: var(--warning-line); }
.banner--warning > .icon { color: var(--warning); }
.banner--success { background: var(--success-bg); border-color: var(--success-line); }
.banner--success > .icon { color: var(--success); }
.banner--info { background: var(--blue-50); border-color: var(--blue-200); }
.banner--info > .icon { color: var(--blue-700); }

.toast { animation: popIn .2s ease-out; display: inline-flex; align-items: center; gap: var(--s-3); min-height: 49px; padding: 8px 8px 8px 20px; border-radius: var(--r-pill); background: var(--ink); color: #fff; font-weight: 500; box-shadow: var(--shadow-lg); }
.toast button { min-height: 32px; padding: 0 12px; border-radius: var(--r-pill); font-weight: 600; color: var(--blue-200); }
.toast button:hover { background: rgba(255, 255, 255, .12); }

/* États de page */
.state { display: grid; justify-items: center; gap: var(--s-2); max-width: 400px; margin: auto; padding: var(--s-8) var(--s-5); text-align: center; }
.state__icon { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: var(--blue-50); color: var(--blue-700); font-size: 20px; margin-bottom: var(--s-2); }
.state--error .state__icon { background: var(--danger-bg); color: var(--danger); }
.state h2 { font-size: var(--fs-lg); font-weight: 600; }
.state p { color: var(--ink-2); }
.state .btn { margin-top: var(--s-3); }

.sk { display: block; border-radius: var(--r-sm); background: var(--line); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes changed {
  0% { box-shadow: 0 0 0 0 rgba(26, 91, 238, .45); transform: scale(1); }
  35% { box-shadow: 0 0 0 6px rgba(26, 91, 238, .16); transform: scale(1.02); }
  100% { box-shadow: 0 0 0 0 rgba(26, 91, 238, 0); transform: scale(1); }
}
@keyframes popIn { from { opacity: 0; transform: translateY(6px) scale(.97); } }
@keyframes sheetIn { from { transform: translateY(100%); } }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes ping { 0% { transform: scale(1); opacity: .5; } 80%, 100% { transform: scale(3); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Fenêtres et éléments de l'agenda */
.bk-back { display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 20px 0 6px; margin-bottom: 14px; border-radius: var(--r-pill); background: var(--surface); box-shadow: 0 8px 20px -14px rgba(41, 63, 109, .5); font-size: var(--fs-md); font-weight: 600; color: var(--ink); transition: color .15s, box-shadow .15s; }
.bk-back__i { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--grad); color: #fff; transition: transform .15s; }
.bk-back__i .icon { width: 16px; height: 16px; }
.bk-back > .icon { width: 16px; height: 16px; color: var(--blue-600); }
.bk-back:hover { color: var(--blue-600); box-shadow: 0 12px 24px -14px rgba(41, 63, 109, .6); }
.bk-back:hover .bk-back__i { transform: translateX(-2px); }
.promo { position: relative; flex: none; margin: auto 12px 12px; padding: 10px 84px 10px 14px; border-radius: var(--r-md); color: #fff; background: url(../assets/wecare-motif.svg) right top / 130px auto no-repeat, var(--blue-600); }
.promo[hidden] { display: none; }
.promo b { display: block; font-size: var(--fs-md); font-weight: 600; line-height: 20px; white-space: nowrap; }
.promo p { font-size: var(--fs-md); font-weight: 500; line-height: 18px; }
.promo__cta { position: absolute; right: 12px; bottom: 12px; height: 32px; padding: 0 14px; border-radius: var(--r-pill); background: #fff; color: var(--blue-600); font-size: var(--fs-sm); font-weight: 600; }
.promo__cta:hover { background: var(--blue-50); }
.promo__close { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; color: #fff; }
.promo__close:hover { background: rgba(255, 255, 255, .2); }
.promo__close .icon { width: 14px; height: 14px; }
.drop { position: absolute; left: 6px; right: 6px; z-index: 6; padding: 10px 12px; border-radius: var(--r-md); background: var(--grad); box-shadow: 0 14px 26px -10px rgba(26, 91, 238, .6); color: #fff; font-size: var(--fs-md); font-weight: 600; pointer-events: none; }
.drop.is-bad { background: #FFE9E9; box-shadow: none; color: var(--danger); }
.evt-stack { position: absolute; left: 6px; right: 6px; display: flex; flex-direction: column; gap: 3px; }
.evt-stack .evt { flex: 0 1 26px; min-height: 0; height: auto; width: 100%; padding: 0 8px; border-radius: 8px; font-size: var(--fs-xs); container-type: normal; }
.evt-stack .evt__meta { display: none; }
.evt-stack .evt__name { line-height: 16px; }
.evt-stack__free { flex: none; height: 18px; padding: 0 8px; border-radius: 6px; text-align: left; font-size: var(--fs-xs); font-weight: 600; color: var(--blue-600); }
.evt-stack__free:hover { background: var(--blue-50); }
.evt-stack .evt__flag { width: 14px; height: 14px; flex: none; }
.pop { animation: popIn .16s ease-out; transform-origin: top left; position: fixed; z-index: 40; max-height: calc(100dvh / var(--ui, 1) - 24px); overflow-y: auto; background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-lg); border: 1px solid var(--line); outline: 0; }
/* Recherche rapide */
.scrim { position: fixed; inset: 0; z-index: 39; background: rgba(41, 63, 109, .3); }
.find { top: 96px; width: 620px; max-height: none; overflow: hidden; border-radius: 20px; }
.find__bar { display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.find__bar > .icon { width: 22px; height: 22px; flex: none; color: var(--blue-600); }
.find__input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; font-size: var(--fs-lg); color: var(--ink); }
.find__input::placeholder { color: var(--ink-3); }
.find kbd { padding: 3px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); font: inherit; font-size: 12px; color: var(--ink-3); }
.find__list { max-height: calc(100dvh / var(--ui, 1) - 220px); overflow-y: auto; padding: 8px; }
.find__label { padding: 10px 12px 4px; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-3); }
.find__row { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 12px; border-radius: 12px; text-align: left; }
.find__row:hover, .find__row.is-active { background: var(--blue-50); }
.find__mark { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--blue-100); color: var(--blue-600); }
.find__mark .icon { width: 16px; height: 16px; }
.find__txt { flex: 1; min-width: 0; }
.find__txt b { display: block; font-size: var(--fs-md); font-weight: 600; line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.find__txt small { display: block; font-size: var(--fs-xs); line-height: 17px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.find__none { padding: 32px 16px; text-align: center; color: var(--ink-3); }
.confirm { top: 200px; width: 480px; padding: 24px; border-radius: 20px; }
.confirm h2 { font-size: var(--fs-xl); font-weight: 600; }
.confirm > p { margin-top: 4px; color: var(--ink-2); }
.confirm__move { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 14px 16px; border-radius: 12px; background: var(--blue-50); font-size: var(--fs-md); color: var(--ink-2); }
.confirm__move > span, .confirm__move b { flex: 1; min-width: 0; }
.confirm__move b { font-weight: 600; color: var(--blue-600); }
.confirm__move .icon { width: 18px; height: 18px; flex: none; color: var(--blue-600); }
.confirm__cta { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.sms { top: 72px; width: 780px; border-radius: 20px; }
.sms__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.sms__head h2 { font-size: var(--fs-xl); font-weight: 600; }
.sms__head .round { width: 32px; height: 32px; font-size: 14px; }
.sms__body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.sms__form { display: grid; gap: 18px; align-content: start; padding: 22px 24px; }
.sms__preview { display: grid; gap: 12px; justify-items: start; align-content: start; padding: 22px 24px; background: var(--blue-50); }
.sms__label { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.sms__bubble { max-width: 100%; padding: 12px 14px; border-radius: 16px 16px 16px 4px; background: var(--blue-600); color: #fff; font-size: var(--fs-md); line-height: 20px; overflow-wrap: anywhere; }
.sms__hint { font-size: var(--fs-sm); color: var(--ink-3); }
.sms__hint b { font-weight: 700; color: var(--ink); }
.sms__foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--line); }
.sms__foot .sms__hint { margin-right: auto; }
.seg--count button { display: inline-flex; align-items: center; gap: 6px; }
.seg__n { min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: var(--r-pill); background: var(--blue-100); font-size: var(--fs-xs); font-weight: 700; color: var(--blue-600); }
.seg__n.is-urgent { background: #FFE9E9; color: var(--danger); }
.seg__n.is-zero { background: var(--surface-2); color: var(--ink-3); }
