:root {
  --ground: #F1F3EF;
  --surface: #FFFFFF;
  --ink: #1E2622;
  --ink-muted: #5C665F;
  --line: #DEE3DD;
  --accent: #2B6357;
  --accent-soft: #E1EDE8;
  --st-futur: #51617D;
  --st-futur-bg: #E8EAF1;
  --st-eu-lieu: #A9791F;
  --st-eu-lieu-bg: #F3EAD4;
  --st-encode: #3C7A50;
  --st-encode-bg: #DEECE1;
  --st-annule: #A04B3C;
  --st-annule-bg: #F2E0DA;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--ground);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.page { max-width: 1100px; margin: 0 auto; padding: 24px clamp(16px, 4vw, 40px) 60px; }

h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; margin: 0; }

a { color: inherit; }

.topnav { display: flex; gap: 22px; padding: 10px 0 22px; }
.tn-item {
  font-size: 14.5px; font-weight: 500; color: var(--ink-muted); text-decoration: none;
  padding-bottom: 4px; border-bottom: 2px solid transparent;
}
.tn-item.on { color: var(--ink); border-bottom-color: var(--accent); }

.app-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.app-header h2 { font-size: 24px; }

.view-tabs { display: flex; gap: 4px; background: var(--ground); border-radius: 9px; padding: 3px; }
.view-tab {
  font-size: 13px; font-weight: 500; color: var(--ink-muted); text-decoration: none;
  padding: 6px 14px; border-radius: 7px;
}
.view-tab.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(30,38,34,0.08); }

.btn {
  font-family: inherit; font-size: 14px; font-weight: 500; border-radius: 8px;
  padding: 9px 16px; border: 1px solid transparent; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #234F45; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--ground); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }

.week-nav { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.nav-arrow {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-muted); text-decoration: none;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 15px;
}
.nav-arrow:hover { background: var(--ground); }

.rdv-list { display: flex; flex-direction: column; gap: 6px; }
.rdv-row {
  display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
.rdv-row.libre { background: #EDF6EF; border-color: transparent; }
.rdv-row.domicile { background: #F4EFF8; border-color: transparent; }
.rdv-time { font-variant-numeric: tabular-nums; font-size: 14px; color: var(--ink-muted); width: 52px; flex-shrink: 0; }
.rdv-name { font-weight: 500; flex: 1; min-width: 0; }
.rdv-tag { font-size: 12px; color: var(--ink-muted); background: var(--ground); border-radius: 6px; padding: 2px 8px; white-space: nowrap; }

.status-pill {
  font-size: 12.5px; font-weight: 500; border-radius: 20px; padding: 5px 10px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer;
}
.status-pill.st-futur { background: var(--st-futur-bg); color: var(--st-futur); border-color: transparent; }
.status-pill.st-eu-lieu { background: var(--st-eu-lieu-bg); color: var(--st-eu-lieu); border-color: transparent; }
.status-pill.st-encode { background: var(--st-encode-bg); color: var(--st-encode); border-color: transparent; }
.status-pill.st-annulee { background: var(--st-annule-bg); color: var(--st-annule); border-color: transparent; }

.week-grid { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: 14px; min-width: 480px; }
.week-col { display: flex; flex-direction: column; gap: 6px; }
.week-col .wh { font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-muted); padding: 4px 0 8px; text-align: center; }
.week-scroll { overflow-x: auto; padding-bottom: 4px; }

.slot { border-radius: 8px; padding: 9px 10px; font-size: 13px; font-weight: 500; display: flex; align-items: baseline; gap: 5px 7px; flex-wrap: wrap; border: 1px solid transparent; }
.slot .mt { font-variant-numeric: tabular-nums; font-weight: 600; flex-shrink: 0; }
.slot-libre { background: #DEEBE0; color: #2F6B45; }
.slot-pris { background: var(--ground); color: var(--ink-muted); border: 1px dashed var(--line); }
.slot-domicile { background: #EAE1F0; color: #6E4A87; }

.patient-list { display: flex; flex-direction: column; gap: 6px; }
.patient-row { display: flex; align-items: center; gap: 14px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.p-name { font-weight: 500; flex: 1; min-width: 0; text-decoration: none; color: inherit; }
.status-encours { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.status-cloture { background: var(--ground); color: var(--ink-muted); border-color: transparent; }

.fiche-grid { display: grid; grid-template-columns: 1.1fr 1.4fr; gap: 28px; }
.field-list { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 2px; }
.field .k { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
.field .v { font-size: 14.5px; }

.notes-box { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--ground); font-size: 14px; white-space: pre-wrap; }

form.stack { display: flex; flex-direction: column; gap: 14px; max-width: 480px; }
form.stack label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-muted); }
form.stack input, form.stack select, form.stack textarea {
  font-family: inherit; font-size: 14px; color: var(--ink); border: 1px solid var(--line);
  border-radius: 7px; padding: 8px 10px; background: var(--surface);
}

/* --- vue mois --- */
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.month-grid .mh { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-muted); text-align: center; padding-bottom: 4px; }
.mcell { border: 1px solid var(--line); border-radius: 8px; padding: 6px 7px 8px; min-height: 88px; display: flex; flex-direction: column; gap: 4px; background: var(--surface); }
.mcell.off { background: var(--ground); border-color: transparent; }
.mcell .mnum { font-size: 12px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.mcell.today .mnum { color: var(--accent); font-weight: 600; }
.mlines { display: flex; flex-direction: column; gap: 3px; }
.mline { font-size: 11px; line-height: 1.3; display: flex; align-items: baseline; gap: 5px; white-space: nowrap; overflow: hidden; text-decoration: none; color: inherit; }
.mline .mt { font-variant-numeric: tabular-nums; flex-shrink: 0; }
.mline .mn { overflow: hidden; text-overflow: ellipsis; }
.mline.libre { color: #2F6B45; font-weight: 600; }
.mline.dom { color: #6E4A87; font-weight: 600; }
.mline.pris { color: var(--ink-muted); font-weight: 400; }

/* --- mode encodage / interprète --- */
.encode-list { display: flex; flex-direction: column; gap: 6px; }
.encode-row { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.e-day { font-size: 12.5px; color: var(--ink-muted); width: 140px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.e-name { font-weight: 500; flex: 1; min-width: 120px; text-decoration: none; color: inherit; }
.e-info { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--ink-muted); }
.e-nn-select { font-family: inherit; font-size: 12.5px; color: var(--ink); border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; background: var(--accent-soft); }

.finder { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--ground); }
.finder .lbl { font-size: 13px; color: var(--ink-muted); }
.finder select { font-family: inherit; font-size: 13.5px; color: var(--ink); border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; background: var(--surface); }

.interp-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.interp-dot.necessaire { background: var(--st-eu-lieu); }
.interp-dot.confirme { background: var(--st-encode); }
