/* ── common.css — styles partagés admin + espace ────────────────────────── */
/* Chargé avant admin.css ou espace.css                                      */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { overflow-x: clip; max-width: 100%; }

:root {
  --rose:   #C04060;
  --rose-h: #a8364f;
  --rose-l: #f5e8ec;
  --orange:     #dd9911;
  --warn:       #dd9911;
  --warn-bg:    #f5f2ee;
  --warn-hover: #f5e9d9;
  --warn-fg:    #c05000;
  --ink:    #2a2520;
  --muted:  #7a736e;
  --bg:     #faf8f6;
  --white:  #fff;
  --border: #e5e0da;
  --light:  #f5f0eb;
  --radius: 8px;
  --nav:        #2d2d2d;
  --nav-text:   #fff;
  --nav-active: #fff;
  --font:     Calibri, 'Gill Sans', 'Trebuchet MS', system-ui, sans-serif;
}

/* ── Coins ──────────────────────────────────────────────────────────────────── */
[data-corners="square"] { --radius: 0; }

/* ── Skins ─────────────────────────────────────────────────────────────────── */
/* classique : valeurs par défaut — rien à overrider */

/* pivoine : fond légèrement rosé, rose plus profond */
[data-skin="pivoine"] {
  --rose: #b03060; --rose-h: #8c1e3c; --rose-l: #f5e4ed;
  --bg: #fdf5f7; --nav: #8c1e3c;
}

/* bleu-gris (slug: bleugris) */
[data-skin="bleugris"] {
  --rose: #4e6e8a; --rose-h: #3a5570; --rose-l: #e5edf3;
  --bg: #f3f6f9; --nav: #3a5570;
}

/* ardoise : fond sombre, rose clair, texte blanc */
[data-skin="ardoise"] {
  --rose: #e06080; --rose-h: #c04060; --rose-l: #3a2530;
  --bg: #1e1a18; --white: #1e1a18; --ink: #f0ebe6; --muted: #a09890;
  --border: #3a3530; --light: #2a2520; --nav: #111109;
}
[data-skin="ardoise"] body { background: var(--bg); color: var(--ink); }

/* vert pastel (slug: sauge) */
[data-skin="sauge"] {
  --rose: #4a9070; --rose-h: #357858; --rose-l: #e6f4ee;
  --bg: #f2faf6; --nav: #5a8f74;
}

/* plume : teal/turquoise (couleurs du logo) — nav claire avec texte teal */
[data-skin="plume"] {
  --rose: #1e5a5a; --rose-h: #145050; --rose-l: #e6f2f2;
  --bg: #fafaf9;
  --nav: #eef8f8; --nav-text: #145050; --nav-active: #1e5a5a;
}
[data-skin="plume"] nav {
  border-bottom: 2px solid #b6dede;
}
[data-skin="plume"] .nav-links a.nav-link:hover {
  background: rgba(30,90,90,.09);
}

/* couleurs jmloubet.fr (slug: ivoire) */
[data-skin="ivoire"] {
  --rose: #C04060; --rose-h: #a03050; --rose-l: #faeaee;
  --bg: #FEFCF9; --white: #F5F0EB; --nav: #F5F0EB; --nav-text: #3D3530; --nav-active: #1a1210;
  --border: #d8d2ca; --light: #E4DED7;
}
[data-skin="ivoire"] nav {
  border-bottom: 1px solid var(--border);
}
[data-skin="ivoire"] nav .brand {
  border-right-color: var(--border);
}

/* ── Swatches sélecteur de skin ─────────────────────────────────────────────── */
.skin-swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.skin-swatch {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 6px 8px;
  border-radius: 8px; transition: background .15s; font: inherit;
}
.skin-swatch:hover { background: var(--rose-l); }
.skin-swatch__dot {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--sw-color); border: 2px solid transparent;
  transition: border-color .15s, outline-color .15s;
}
.skin-swatch__label { font-size: 11px; color: var(--muted); font-family: var(--font); white-space: nowrap; }
.skin-swatch--active .skin-swatch__dot {
  border-color: var(--rose); outline: 2px solid var(--rose); outline-offset: 2px;
}
.skin-preview {
  display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px;
}
.skin-preview-chip {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 10px; border-radius: 4px;
  background: var(--light); border: 1px solid var(--border);
  font-size: 11px; color: var(--muted); font-family: var(--font);
  white-space: nowrap;
}
.skin-preview-chip__dot {
  width: 13px; height: 13px; border-radius: 50%; flex-shrink: 0;
}
.corners-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: none; border: 1px solid var(--border); cursor: pointer;
  padding: 8px 18px; border-radius: var(--radius);
  font: inherit; font-size: 15px; color: var(--muted);
  transition: border-color .15s, color .15s, background .15s;
}
.corners-btn:hover { border-color: var(--rose); color: var(--ink); }
.corners-btn--active { border-color: var(--rose); color: var(--rose); background: var(--rose-l); }
.corners-example {
  width: 22px; height: 22px; border: 2px solid currentColor; flex-shrink: 0;
}
.corners-example--rounded { border-radius: 6px; }
.corners-example--square  { border-radius: 0; }

/* ── Nav ───────────────────────────────────────────────────────────────────── */
nav { background: var(--nav); color: var(--nav-text); padding: 0 24px;
      display: flex; align-items: center; flex-wrap: wrap;
      position: sticky; top: 0; z-index: 200; }
nav .brand { font-weight: bold; padding: 14px 20px 14px 0;
             border-right: 1px solid rgba(0,0,0,.12); margin-right: 8px; color: var(--nav-text);
             white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.brand-logo { height: 52px; width: auto; display: inline-block; vertical-align: middle; }
.nav-burger { display: none; }
.nav-links { display: flex; align-items: center; flex: 1; flex-wrap: nowrap; }
.nav-links a.nav-link { color: var(--nav-text); opacity: .75; padding: 14px 14px; font-size: 14px;
                        font-family: var(--font); white-space: nowrap; text-decoration: none;
                        text-transform: uppercase; letter-spacing: .06em;
                        border-bottom: 2px solid transparent; margin-bottom: -2px;
                        transition: background .15s, opacity .15s; }
.nav-links a.nav-link:hover { opacity: 1; color: var(--nav-text); text-decoration: none; background: rgba(255,255,255,.15); }
.nav-links a.nav-link.active { opacity: 1; color: var(--nav-active); text-decoration: none;
                               border-bottom-color: var(--nav-active); }
.nav-links a.nav-link.nav-link-locked { opacity: .45; cursor: not-allowed; pointer-events: none; }
.nav-lock { font-size: 10px; vertical-align: middle; opacity: .7; }

/* ── Tooltip sur lien nav verrouillé ─────────────────────────────────────── */
.nav-locked-wrap { position: relative; display: inline-flex; align-items: stretch; }
.nav-locked-wrap .nav-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  background: #fff;
  color: #24292f;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
  z-index: 500;
  text-align: left;
  pointer-events: none;
}
.nav-locked-wrap .nav-tooltip::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top: none;
  border-bottom-color: #d0d7de;
}
.nav-locked-wrap .nav-tooltip::after {
  content: '';
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top: none;
  border-bottom-color: #fff;
}
.nav-locked-wrap:hover .nav-tooltip { display: block; }
.nav-tooltip-title { font-weight: 600; margin-bottom: 6px; color: #8250df; }
.nav-tooltip-features { list-style: none; padding: 0; margin: 0 0 8px 0; }
.nav-tooltip-features li::before { content: '✓ '; color: #1a7f37; }
.nav-tooltip-plan { font-size: 11px; color: #57606a; border-top: 1px solid #d0d7de; padding-top: 7px; margin-top: 4px; }
.nav-links .spacer { flex: 1; }
.nav-logout { display: inline; }
.nav-link-btn { background: none; border: none; cursor: pointer; font: inherit;
                padding: 14px 14px; color: var(--nav-text); opacity: .75; font-size: 14px;
                font-family: var(--font); text-transform: uppercase; letter-spacing: .06em;
                transition: background .15s, opacity .15s; }
.nav-link-btn:hover { opacity: 1; background: rgba(255,255,255,.15); }

/* ── Nav mobile (≤ 640px) ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
  nav { padding: 0 16px; flex-wrap: nowrap; }
  nav .brand { border-right: none; margin-right: 0; padding: 13px 0; font-size: 13px; flex: 1; }

  .nav-burger {
    display: flex; flex-direction: column; justify-content: center; gap: 5px;
    background: none; border: none; cursor: pointer; padding: 13px 0; margin-left: auto;
  }
  .nav-burger span {
    display: block; width: 22px; height: 2px; background: var(--nav-text); opacity: .7; transition: opacity .2s;
  }
  .nav-burger:hover span, .nav-burger[aria-expanded="true"] span { opacity: 1; }

  .nav-links {
    display: none; flex-direction: column; align-items: stretch;
    position: absolute; top: 100%; left: 0; right: 0; z-index: 200;
    background: var(--nav); border-top: 1px solid rgba(0,0,0,.1);
  }
  .nav-links.open { display: flex; }
  .nav-links a.nav-link, .nav-link-btn {
    padding: 13px 16px; border-bottom: 1px solid rgba(0,0,0,.08);
    width: 100%; text-align: left; font-size: 14px; white-space: normal;
  }
  .nav-links .spacer { display: none; }
  .nav-logout { display: block; }
  #push-bell-btn { text-align: left; padding: 13px 16px; border-bottom: 1px solid rgba(0,0,0,.08); }
}

/* ── Tooltip aide paramètre (?bubble) ─────────────────────────────────────── */
.cfg-tip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: #e8e3de; color: var(--muted);
  font-size: 11px; font-weight: 700; line-height: 1;
  cursor: default; vertical-align: middle; margin-left: 5px;
  position: relative; flex-shrink: 0;
  font-family: var(--font); font-style: normal;
  user-select: none;
}
.cfg-tip::after {
  content: attr(data-tip);
  position: absolute; left: 50%; bottom: calc(100% + 8px);
  transform: translateX(-50%);
  background: #2a2520; color: #fff;
  font-size: 13px; font-weight: 400; line-height: 1.5;
  padding: 10px 14px; border-radius: 6px;
  width: max-content; max-width: 320px;
  white-space: pre-wrap; word-break: break-word;
  pointer-events: none; opacity: 0;
  transition: opacity .15s;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
  text-transform: none; letter-spacing: 0;
}
.cfg-tip::before {
  content: '';
  position: absolute; left: 50%; bottom: calc(100% + 3px);
  transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: #2a2520;
  pointer-events: none; opacity: 0;
  transition: opacity .15s;
  z-index: 9999;
}
.cfg-tip:hover::after,
.cfg-tip:hover::before { opacity: 1; }

.cfg-tip--below::after {
  bottom: auto; top: calc(100% + 8px);
}
.cfg-tip--below::before {
  bottom: auto; top: calc(100% + 3px);
  border-top-color: transparent; border-bottom-color: #2a2520;
}

/* ── Config table (clé : valeur) ──────────────────────────────────────────── */
.cfg-table { width: 100%; border-collapse: collapse; }
.cfg-table td { padding: 4px 0; vertical-align: middle; border-bottom: none; }
.cfg-table td:first-child {
  width: 260px; padding-right: 24px;
  color: var(--muted); white-space: nowrap;
}
.cfg-table td:last-child { padding-right: 0; }
.cfg-table input:not([type="checkbox"]):not([type="radio"]), .cfg-table select { height: 40px; font-size: 13px; }
.cfg-table input[type="text"],
.cfg-table input[type="email"],
.cfg-table input[type="tel"],
.cfg-table input[type="url"],
.cfg-table input[type="password"] { width: 280px; max-width: 100%; text-align: left; }
.cfg-table input[type="number"],
.cfg-table input.cfg-num { width: 280px; max-width: 100%; text-align: right; }
.cfg-table select { width: 280px; max-width: 100%; }
.cfg-table .cfg-wide input { width: 420px; text-align: left; }
.cfg-table .cfg-hint { font-size: 14px; color: var(--muted); }
.cfg-table .cfg-toggle-label { display: inline-block; min-width: 5.5em; }
.cfg-table label { font-size: inherit; color: var(--ink); text-transform: none; letter-spacing: 0; }
@media (max-width: 640px) {
  .cfg-table td:first-child { width: auto; padding-right: 0; white-space: normal; display: block; }
  .cfg-table td:last-child { display: block; padding-top: 2px; }
  .cfg-table input[type="text"],
  .cfg-table input[type="number"],
  .cfg-table input[type="email"],
  .cfg-table input[type="tel"],
  .cfg-table input[type="url"],
  .cfg-table input[type="password"],
  .cfg-table select,
  .cfg-table .cfg-wide input { width: 100%; }
}

/* ── Panneau notifications in-app ────────────────────────────────────────── */
#notif-panel { color: var(--ink); }

/* ── Toast notifications ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed; top: 16px; right: 16px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 22px 36px; border-radius: 8px; font-size: 17px;
  font-family: var(--font); font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  opacity: 0; transform: translateX(20px);
  transition: opacity .2s, transform .2s;
  pointer-events: none; min-width: 320px; max-width: 500px;
}
.toast.toast--in  { opacity: 1; transform: translateX(0); }
.toast.toast--out { opacity: 0; transform: translateX(20px); }
.toast--success { background: #edf7ed; color: #2e7d32; border: 1px solid #c3e6cb; }
.toast--error   { background: #fdecea; color: #c62828; border: 1px solid #ef9a9a; }
.toast--warning { background: #fff3e0; color: #e65100; border: 1px solid #ffb74d; }
.toast--info    { background: #edf7ed; color: #2e7d32; border: 1px solid #c3e6cb; }

@media (max-width: 600px) {
  #toast-container { left: 16px; right: 16px; }
  .toast { min-width: 0; width: 100%; }
}
.cal-month-titlerow { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-nav-inline { background: none; border: none; padding: 4px 10px; cursor: pointer;
                  font-size: 18px; color: var(--ink); transition: color .15s; line-height: 1; }
.cal-nav-inline:hover { color: var(--rose); }
.cal-nav-inline:disabled { opacity: .3; cursor: default; }
.cal-layout { display: grid; grid-template-columns: 270px 500px; grid-template-rows: 300px; gap: 16px; }
.cal-left { display: flex; flex-direction: column; overflow-y: auto; min-width: 0;
            border: 1px solid var(--border); border-left: 3px solid var(--rose);
            background: var(--white); transition: border-left-color .15s; }
.cal-left:hover { border-left-color: var(--rose-h); }
.cal-month { padding: 16px 14px; display: flex; flex-direction: column; flex: 1; }
.cal-month-title { font-size: 19px; font-weight: 600; color: var(--ink); margin-bottom: 12px;
                   text-align: center; font-family: var(--font); }
.cal-week-header { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 4px; }
.cal-week-header span { text-align: center; font-size: 13px; color: var(--muted);
                        font-family: var(--font); text-transform: uppercase; padding: 3px 0; }
.cal-week-header .cal-wk-end { color: var(--rose); }
.cal-grid-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-day { min-height: 58px; border-radius: 0; display: flex; flex-direction: column;
           align-items: center; justify-content: flex-start; padding: 8px 1px 3px;
           font-size: 14px; font-family: var(--font); color: var(--ink); box-sizing: border-box; }
.cal-day--past { color: var(--muted); }
.cal-day--wkend:not(.cal-day--today),
.cal-day--ferie:not(.cal-day--today) { background: var(--rose-l); border-radius: 0; }
.cal-day--today .cal-day-num {
  background: var(--rose); color: #fff; border-radius: 50%;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.cal-day--appt { cursor: pointer; }
.cal-day--week {
  border-top: 1px solid color-mix(in srgb, var(--rose, #a8223e) 45%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--rose, #a8223e) 45%, transparent);
}
.cal-day--week-start {
  border-left: 1px solid color-mix(in srgb, var(--rose, #a8223e) 45%, transparent);
}
.cal-day--week-end {
  border-right: 1px solid color-mix(in srgb, var(--rose, #a8223e) 45%, transparent);
}
/* Jour aujourd'hui garde sa pastille même dans la semaine */
.cal-day--week.cal-day--today .cal-day-num { z-index: 1; position: relative; }
.cal-day-num { font-size: 18px; line-height: 1; margin-bottom: 2px; }
.cal-day-dots { display: flex; gap: 3px; }
.cal-day-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.cal-day-dot--confirmed { background: #4a8c6a; }
.cal-day-dot--pending   { background: var(--warn); }
.cal-day-dot--done      { background: #9a9490; }
.cal-day-dot--cabinet   { background: #3a8a50; }
.cal-day-dot--visio     { background: #4a8fc0; }
.cal-day--past .cal-day-dot { opacity: .55; }
.cal-day-badges { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; margin-top: 1px; }
.cal-day-badge { font-size: 11px; font-weight: 700; line-height: 1;
                 padding: 2px 5px; border-radius: 3px; }
.cal-day-badge--cabinet { background: #d4edda; color: #2d6a4a; }
.cal-day-badge--visio   { background: #d0e8f5; color: #1a5a80; }
.cal-day-badge--pending { background: var(--warn-bg); color: var(--warn-fg); }
.cal-day--past .cal-day-badge { opacity: .55; }
/* Jauges de disponibilité (matin / après-midi) */
.cal-day-toprow { display: flex; align-items: center; gap: 4px; }
.cal-avail-squares { display: flex; flex-direction: column; gap: 2px; }
.cal-avail-squares-row { display: flex; gap: 0; }
.cal-avail-square { width: 7px; height: 7px; border-radius: 0; background: var(--border, #e0dcd4); }
.cal-avail-square--green { background: #3a8a50; }
.cal-avail-square--red   { background: #c0392b; }
.cal-avail-square--gray  { background: var(--border, #e0dcd4); }
.cal-day--past .cal-avail-squares { display: none; }
/* Légende */
.cal-legend { display: flex; flex-direction: column; gap: 8px;
              padding-top: 10px; max-width: 280px; }
.cal-legend-row { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.cal-legend-item { display: flex; align-items: center; gap: 5px; font-size: 15px;
                   color: var(--muted); font-family: var(--font); white-space: nowrap; }
.cal-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
/* Tooltip */
.cal-tooltip { position: fixed; z-index: 500; background: #1e4a78; color: #fff;
               border-radius: 10px; padding: 16px 20px; font-size: 14px; font-family: var(--font);
               line-height: 1.7; pointer-events: none; box-shadow: 0 6px 24px rgba(0,0,0,.25);
               max-width: 340px; white-space: pre-line; }
/* Sidebar */
.cal-sidebar { background: var(--white); border: 1px solid var(--border);
               overflow-y: scroll; box-sizing: border-box; }
.cal-sidebar-title { font-size: 13px; font-weight: 600; color: var(--ink); font-family: var(--font);
                     text-transform: uppercase; letter-spacing: .05em;
                     padding: 14px 16px 10px; border-bottom: 1px solid var(--border); }
.cal-sidebar-item { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.cal-sidebar-item:last-child { border-bottom: none; }
.cal-sidebar-date { font-size: 14px; font-weight: 600; color: var(--ink); font-family: var(--font);
                    margin-bottom: 2px; }
a.cal-sidebar-date { text-decoration: underline; text-decoration-color: var(--muted); cursor: pointer; }
a.cal-sidebar-date:hover { color: var(--rose); text-decoration-color: var(--rose); }
.cal-sidebar-addr { font-size: 13px; color: var(--muted); font-family: var(--font); line-height: 1.4; }
.cal-sidebar-status { display: inline-block; font-weight: 600;
                      padding: 2px 8px; border-radius: 10px; margin-bottom: 5px; }
.cal-sidebar-status--confirmed { background: #e8f3ee; color: #4a8c6a; }
.cal-sidebar-status--pending   { background: #fdf0e3; color: #e08030; }
.cal-sidebar-status--done      { background: var(--light); color: var(--muted); }
.cal-sidebar-item--active { background: var(--rose-l); }
.cal-sidebar-empty { padding: 16px; font-size: 13px; color: var(--muted); font-family: var(--font); margin: 0; }
@media (max-width: 840px) {
  .cal-layout { grid-template-columns: 1fr; grid-template-rows: auto; }
  .cal-sidebar { max-height: 240px; }
  main.appts .cal-sidebar { display: none; }
}

/* ── Onglets modale fiche patient ──────────────────────────────────────────── */
.person-edit-tabs { display:flex; border-bottom:2px solid var(--light); margin:0 20px; gap:0; }
.person-edit-tab  { background:none; border:none; border-bottom:2px solid transparent;
                    margin-bottom:-2px; padding:10px 16px; font-size:15px; font-family:var(--font);
                    color:var(--muted); cursor:pointer; transition:color .15s; }
.person-edit-tab:hover  { color:var(--ink); }
.person-edit-tab.active { color:var(--rose); border-bottom-color:var(--rose); font-weight:600; }
.person-edit-panel[hidden] { display:none; }
