/* ============================================================
   Carnet+ — Feuille de styles
   Plateforme de gestion de cabinet médical
   ============================================================ */

/* ---- Tokens ---- */
:root {
  --green:      #13b98a;
  --green-2:    #0d9488;
  --green-text: #0e9f6e;
  --green-hover:#0c8a70;
  --green-soft: #eafaf1;
  --green-soft-border: #d7f5e6;
  --focus:      #10b981;

  --bg:     #f6f8f9;
  --panel:  #fbfcfc;
  --white:  #fff;
  --ink:    #0f1729;
  --muted:  #64748b;
  --muted-2:#94a3b8;
  --muted-3:#9aa7b4;
  --slate:  #475569;

  --border:  #eef1f2;
  --border-2:#e6eaec;
  --border-3:#f1f4f5;
  --field:   #fafbfb;

  --blue:  #5b6ef5;
  --cyan:  #0ea5e9;
  --purple:#8b5cf6;
  --amber: #f59e0b;
  --pink:  #ec4899;
  --emerald:#10b981;

  --amber-bg:#fff7ed; --amber-border:#fde3c2; --amber-ink:#9a5b0a; --amber-ink-2:#ea8a12;
  --red:#e5484d; --red-bg:#fff5f5; --red-border:#fde3e3;

  --r-sm:10px; --r-md:13px; --r-lg:16px; --r-xl:20px;
  --sh-card:0 1px 3px rgba(16,24,40,.04);
  --sh-form:0 8px 30px rgba(16,24,40,.05);
  --sh-btn: 0 8px 20px rgba(13,148,136,.28);
  --sh-banner:0 12px 28px rgba(13,148,136,.22);
}

/* ---- Reset ---- */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green-text); text-decoration: none; }
a:hover { color: var(--green-hover); }
input, select, textarea, button { font-family: inherit; }
input::placeholder, textarea::placeholder { color: var(--muted-3); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--focus) !important;
  box-shadow: 0 0 0 3px rgba(16,185,129,.14);
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d7dde2; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

@keyframes cpfade  { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes cptoast { from { opacity: 0; transform: translate(-50%,10px); } to { opacity: 1; transform: translate(-50%,0); } }
.fade { animation: cpfade .25s ease; }

/* ---- Typography ---- */
.h1 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 5px; }
.subtitle { color: var(--muted); font-size: 15px; margin: 0 0 22px; }
.section-title { font-size: 17px; font-weight: 800; }

/* ---- Layout helpers ---- */
.container    { max-width: 1180px; }
.container-sm { max-width: 900px; }
.container-md { max-width: 1000px; }
.container-lg { max-width: 1100px; }
.container-xs { max-width: 820px; }
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.col    { display: flex; flex-direction: column; }
.row    { display: flex; align-items: center; }
.between{ display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.gap-10 { gap: 10px; } .gap-14 { gap: 14px; }
.mb-16 { margin-bottom: 16px; } .mb-20 { margin-bottom: 20px; } .mb-22 { margin-bottom: 22px; }

/* ---- Buttons ---- */
.btn {
  border: none; border-radius: var(--r-md); cursor: pointer;
  font-weight: 700; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn--primary { padding: 13px 20px; background: linear-gradient(135deg,var(--green),var(--green-2)); color: #fff; box-shadow: 0 6px 16px rgba(13,148,136,.25); }
.btn--block   { width: 100%; padding: 15px; box-shadow: var(--sh-btn); }
.btn--ghost   { padding: 13px 22px; background: #fff; color: var(--slate); border: 1px solid var(--border); font-weight: 600; }
.btn--soft    { padding: 10px 16px; background: var(--green-soft); color: var(--green-text); border: 1px solid var(--green-soft-border); font-size: 13px; }
.btn--sm      { padding: 8px 14px; font-size: 13px; }
.btn--pill    { padding: 7px 13px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn--disabled{ background: #f7f9fa; color: var(--muted-2); border: 1px solid var(--border); padding: 10px 16px; font-size: 13px; }
.btn--icon    { width: 44px; height: 44px; padding: 0; }
.btn--purple  { padding: 12px 18px; background: linear-gradient(135deg,#8b5cf6,#7c3aed); color: #fff; box-shadow: 0 6px 16px rgba(124,58,237,.25); }

/* ---- Cards ---- */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--sh-card); }
.card--pad { padding: 22px; border-radius: 18px; }
.card--flush { overflow: hidden; padding: 0; }

/* ---- Forms ---- */
.label { display: block; font-size: 12px; font-weight: 700; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.input, .select {
  width: 100%; min-width: 0; border: 1px solid var(--border-2); border-radius: 11px;
  padding: 12px 13px; font-size: 14.5px; background: var(--field); color: var(--ink);
}
.input:disabled { background: var(--border-3); color: var(--muted); cursor: not-allowed; }
/* min-width:0 protège tout <select> d'options longues qui forceraient sa
   colonne de grille à s'élargir (les éléments de grille/flex ont un
   min-width:auto par défaut, calé sur le contenu le plus large). L'ellipsis
   tronque proprement plutôt que de laisser déborder. */
.select { text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
.input-group { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border-2); border-radius: 12px; padding: 0 14px; background: var(--field); }
.input-group input { flex: 1; border: none; background: transparent; padding: 13px 0; font-size: 15px; color: var(--ink); }
.input-group input:focus { box-shadow: none; }
.form-error { color: var(--red); font-size: 13px; font-weight: 600; margin: 8px 0 0; }
.password-toggle { border: none; background: transparent; cursor: pointer; color: var(--muted-3); display: flex; align-items: center; justify-content: center; padding: 2px; flex: none; }
.password-toggle:hover { color: var(--muted); }
.password-field { position: relative; }
.password-field .input { padding-right: 42px; }
.password-field .password-toggle { position: absolute; top: 50%; right: 10px; transform: translateY(-50%); }

/* ---- Avatar / badge / chip ---- */
.avatar { border-radius: 12px; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.avatar-40 { width: 40px; height: 40px; } .avatar-42 { width: 42px; height: 42px; }
.avatar-44 { width: 44px; height: 44px; } .avatar-46 { width: 46px; height: 46px; font-size: 14px; }
.avatar-48 { width: 48px; height: 48px; border-radius: 14px; }
.avatar-round { border-radius: 50%; }
.badge { font-weight: 700; font-size: 12px; padding: 5px 12px; border-radius: 20px; }
.badge--green { background: var(--green-soft); color: var(--green-text); }
.badge--amber { background: var(--amber-bg); color: var(--amber-ink-2); }
.badge--muted { background: #f1f5f7; color: var(--slate); font-weight: 600; }
.badge--blue  { background: #eef2ff; color: var(--blue); }
.badge--soon  { background: #f1f5f7; color: var(--muted-2); font-weight: 700; font-size: 11px; padding: 4px 10px; }
.chip { background: #f1f5f7; color: var(--slate); font-weight: 600; font-size: 12px; padding: 5px 11px; border-radius: 20px; }

/* ---- Toast ---- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 13px 22px; border-radius: var(--r-md);
  font-weight: 600; font-size: 14px; z-index: 90;
  box-shadow: 0 12px 30px rgba(15,23,41,.3); animation: cptoast .25s ease;
}

/* ============================================================
   AUTH
   ============================================================ */
.auth { display: flex; min-height: 100vh; }
.auth__brand {
  flex: 1; position: relative; overflow: hidden; min-width: 0; color: #fff;
  background: linear-gradient(150deg,#16b981 0%,#0e9e83 48%,#0c8a8c 100%);
  padding: 56px 60px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth__blob { position: absolute; border-radius: 50%; background: rgba(255,255,255,.08); }
.auth__brand h1 { font-size: 56px; line-height: 1.03; font-weight: 800; letter-spacing: -.03em; margin: 0 0 22px; }
.auth__brand p  { font-size: 18px; line-height: 1.55; color: rgba(255,255,255,.86); max-width: 440px; margin: 0; }
.auth__pill { display: flex; align-items: center; gap: 9px; background: rgba(255,255,255,.13); padding: 11px 17px; border-radius: 12px; font-weight: 600; font-size: 14px; }
.auth__form { flex: 1; background: var(--panel); display: flex; align-items: center; justify-content: center; padding: 40px 30px; overflow: auto; min-width: 0; }
.auth__inner { width: 100%; max-width: 452px; }
.logo-mark { border-radius: 15px; background: rgba(255,255,255,.16); display: flex; align-items: center; justify-content: center; }
.brand-accent { color: #bff5da; }
.divider { display: flex; align-items: center; gap: 14px; margin: 24px 0; color: var(--muted-3); font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.divider span { flex: 1; height: 1px; background: var(--border-2); }
.type-card { text-align: left; background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; cursor: pointer; transition: .15s; box-shadow: var(--sh-card); }
.type-card:hover { border-color: var(--green-soft-border); transform: translateY(-2px); }
.type-icon { width: 46px; height: 46px; border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app { display: flex; height: 100vh; overflow: hidden; background: var(--bg); }
.sidebar {
  width: 262px; flex: none; background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; height: 100vh;
  transition: margin-left .28s ease; overflow: hidden;
}
.app.sidebar-closed .sidebar { margin-left: -262px; }
.sidebar__head { padding: 22px 22px 18px; border-bottom: 1px solid #f2f5f6; display: flex; align-items: center; gap: 11px; }
.sidebar__logo { font-size: 21px; font-weight: 800; color: var(--green-text); letter-spacing: -.02em; }
.sidebar__nav { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 4px; }
.sidebar__foot { padding: 14px; border-top: 1px solid #f2f5f6; }
.hamburger { border: none; background: transparent; cursor: pointer; color: #334155; padding: 6px; border-radius: 9px; flex: none; display: flex; }
.hamburger:hover { background: #f1f5f7; }
.hamburger--float {
  position: fixed; top: 20px; left: 18px; z-index: 40;
  border: 1px solid var(--border-2); background: #fff; width: 40px; height: 40px;
  border-radius: 11px; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(16,24,40,.08); display: none;
}
.app.sidebar-closed .hamburger--float { display: flex; }
.hamburger--float:hover { background: var(--panel); }

.nav-link {
  display: flex; align-items: center; gap: 13px; padding: 11px 14px; border-radius: 12px;
  font-weight: 600; font-size: 14.5px; cursor: pointer; text-decoration: none;
  color: var(--slate); transition: background .15s, color .15s;
}
.nav-link:hover { background: #f6f8f9; color: var(--slate); }
.nav-link.active { background: var(--green-soft-border); color: var(--green-text); }

/* demo switcher (à ne pas reproduire en prod) */
.demo-label { font-size: 11px; font-weight: 800; letter-spacing: .06em; color: var(--muted-3); margin: 2px 4px 8px; }
.demo-switch { display: flex; gap: 5px; background: #f1f5f7; border-radius: 12px; padding: 4px; margin-bottom: 14px; }
.demo-pill { flex: 1; padding: 8px; border-radius: 9px; border: none; cursor: pointer; font-weight: 700; font-size: 13px; transition: .15s; background: transparent; color: var(--muted); }
.demo-pill.active { background: #fff; color: var(--green-text); box-shadow: 0 1px 3px rgba(16,24,40,.12); }
.user-row { display: flex; align-items: center; gap: 11px; padding: 8px; border-radius: 12px; }
.user-row .name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-row .mail { color: var(--muted-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { border: none; background: transparent; cursor: pointer; color: var(--muted-2); padding: 6px; border-radius: 8px; flex: none; }
.icon-btn:hover { background: #f1f5f7; }

.main { flex: 1; overflow-y: auto; height: 100vh; padding: 32px 40px 48px; min-width: 0; position: relative; transition: padding-left .28s ease; }
.app.sidebar-closed .main { padding-left: 76px; }

/* ---- Stat cards ---- */
.stat { background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; display: flex; align-items: center; gap: 14px; box-shadow: var(--sh-card); }
.stat .num { font-size: 26px; font-weight: 800; line-height: 1; }
.stat .lbl { color: var(--muted); font-size: 13px; margin-top: 3px; }

/* ---- Banner (traitements / profil) ---- */
.banner { background: linear-gradient(120deg,#12b886 0%,var(--green-2) 100%); border-radius: var(--r-xl); color: #fff; box-shadow: var(--sh-banner); }
.banner--treat { padding: 24px 28px; margin-bottom: 22px; }
.treat-card { background: rgba(255,255,255,.14); border-radius: 14px; padding: 14px 16px; }
.progress { height: 6px; border-radius: 6px; background: rgba(255,255,255,.25); overflow: hidden; }
.progress > span { display: block; height: 100%; background: #fff; border-radius: 6px; }
.ring { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; }
.ring > span { width: 40px; height: 40px; border-radius: 50%; background: var(--green-2); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; }

/* ---- Quick action tiles ---- */
.tile { text-align: left; background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; cursor: pointer; box-shadow: var(--sh-card); }
.tile__icon { width: 44px; height: 44px; border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.tile .t { font-weight: 700; font-size: 15px; }
.action-tile { border: 1px solid var(--border); border-radius: 14px; padding: 18px; cursor: pointer; }
.action-tile .t { font-weight: 700; font-size: 15px; margin-top: 12px; }
.action-tile .d { color: var(--muted); font-size: 12.5px; }

/* ---- List rows ---- */
.list-row { display: flex; align-items: center; gap: 15px; padding: 16px 20px; border-bottom: 1px solid #f4f6f7; }
.list-row:last-child { border-bottom: none; }
.mini-row { display: flex; align-items: center; gap: 13px; border: 1px solid var(--border-3); border-radius: var(--r-md); padding: 13px 15px; }

/* ---- Info banners ---- */
.notice { display: flex; gap: 10px; background: var(--amber-bg); border: 1px solid var(--amber-border); border-radius: 14px; padding: 14px 17px; align-items: center; }
.notice .t { font-weight: 700; font-size: 14.5px; color: var(--amber-ink); }
.notice .d { color: #b47016; font-size: 13px; }

/* ---- Tabs (carnet) ---- */
.tabs { display: flex; gap: 6px; background: #f1f5f7; border-radius: 12px; padding: 5px; width: fit-content; margin-bottom: 20px; }
.tab { display: flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: var(--r-sm); font-weight: 600; font-size: 14px; cursor: pointer; border: none; background: transparent; color: var(--muted); }
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(16,24,40,.1); }

/* ---- Messages ---- */
.msg-grid { display: grid; grid-template-columns: 320px 1fr; gap: 16px; flex: 1; min-height: 0; }
.conv-item { display: flex; align-items: center; gap: 12px; padding: 11px; border-radius: 12px; cursor: pointer; transition: .12s; }
.conv-item:hover { background: #f6f8f9; }
.conv-item.active { background: var(--green-soft); }
.conv-item.disabled { opacity: .45; }
.conv-item .name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item .sub  { color: var(--muted-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unread { background: var(--emerald); color: #fff; font-weight: 800; font-size: 11px; min-width: 20px; height: 20px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex: none; }
.msg-row { display: flex; }
.msg-row.me { justify-content: flex-end; }
.bubble { max-width: 70%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.45; background: #f1f5f7; color: var(--ink); border-bottom-left-radius: 4px; }
.bubble.me { background: linear-gradient(135deg,var(--green),var(--green-2)); color: #fff; border-bottom-right-radius: 4px; border-bottom-left-radius: 16px; }
.bubble .at { font-size: 10.5px; opacity: .6; margin-top: 4px; text-align: right; }

/* ---- Empty state ---- */
.empty { text-align: center; padding: 50px 0; color: var(--muted-2); }

/* ---- Modal ---- */
.modal__backdrop { position: fixed; inset: 0; background: rgba(15,23,41,.5); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
.modal { background: #fff; border-radius: var(--r-xl); padding: 26px; width: 100%; max-width: 440px; box-shadow: 0 24px 60px rgba(15,23,41,.28); animation: cpfade .2s ease; }
.modal__close { border: none; background: #f1f5f7; width: 34px; height: 34px; border-radius: var(--r-sm); cursor: pointer; color: var(--muted); font-size: 18px; }
.mode-opt { display: flex; align-items: center; gap: 14px; padding: 13px 15px; border-radius: 14px; cursor: pointer; border: 2px solid #eceff1; background: #fff; transition: .15s; }
.mode-opt.sel { }
.mode-opt.disabled { opacity: .55; cursor: not-allowed; }
.mode-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #cbd5e1; display: flex; align-items: center; justify-content: center; }
.mode-tag { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex: none; font-weight: 800; }

/* ---- Ordonnance ---- */
.med-row { display: flex; gap: 10px; align-items: flex-end; }
.med-row .num { width: 28px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--muted-2); font-weight: 800; flex: none; }
.med-input { width: 100%; border: 1px solid var(--border-2); border-radius: var(--r-sm); padding: 11px 12px; font-size: 14px; background: var(--field); }
.med-label { display: block; font-size: 11.5px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.trash { width: 44px; height: 44px; border: 1px solid var(--red-border); background: var(--red-bg); border-radius: var(--r-sm); cursor: pointer; color: var(--red); display: flex; align-items: center; justify-content: center; flex: none; }
.add-dashed { margin-top: 14px; border: 1.5px dashed #cfd8dd; background: var(--field); color: var(--green-text); font-weight: 700; font-size: 13.5px; padding: 11px; border-radius: 11px; cursor: pointer; width: 100%; display: flex; align-items: center; justify-content: center; gap: 7px; }
.ord-preview { background: #fff; border: 1px solid var(--green-soft-border); border-radius: var(--r-lg); padding: 26px; margin-top: 20px; animation: cpfade .3s ease; box-shadow: 0 8px 24px rgba(16,24,40,.06); }
.select-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px; cursor: pointer; border: 2px solid #eceff1; background: #fff; transition: .15s; }
.select-row.sel { border-color: var(--focus); background: var(--green-soft); }

/* ---- Calendar ---- */
.week-day { flex: 1; text-align: center; padding: 14px 4px; border-radius: 14px; cursor: pointer; border: 2px solid #eceff1; background: #fff; transition: .15s; }
.week-day.sel { border-color: var(--focus); background: var(--green-soft); }
.week-day .d { font-size: 12px; font-weight: 700; color: var(--muted-2); letter-spacing: .04em; }
.week-day .n { font-size: 22px; font-weight: 800; margin-top: 4px; }
.cal-nav { width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--border); background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }

.modal--soon { max-width: 400px; text-align: center; position: relative; padding-top: 34px; }
.soon-ic { width: 66px; height: 66px; border-radius: 20px; background: var(--green-soft); border: 1px solid var(--green-soft-border); display: flex; align-items: center; justify-content: center; margin: 0 auto 18px; }

/* ---- Évaluations ---- */
.stars { display: flex; align-items: center; gap: 5px; }
.star-btn { border: none; background: transparent; cursor: pointer; padding: 1px; display: flex; line-height: 0; transition: transform .12s; }
.star-btn:hover { transform: scale(1.18); }
.rate-scale { color: var(--muted); font-size: 14px; font-weight: 700; }
.eval-comment { width: 100%; border: 1px solid var(--border-2); border-radius: 12px; padding: 13px 14px; font-size: 14px; line-height: 1.5; background: var(--field); color: var(--ink); resize: vertical; min-height: 82px; }

.hidden { display: none !important; }
