:root{
  --bg:#f4f8fb;
  --card:#ffffff;
  --grid:#d8e2ee;
  --ink:#0f172a;
  --time:#f0f7fb;
  --accent:#0ea5e9;              /* bleu soin / médical */

  /* Couleurs de base par spécialité (palette soins douce) */
  --kine:#d1fae5;      /* vert menthe */
  --apa:#e0f2fe;       /* bleu très clair */
  --ergo:#fee2e2;      /* rose très pâle */
  --ortho:#bfdbfe;     /* bleu ortho */
  --psycho:#e0e7ff;    /* lavande douce */
  --diet:#fef9c3;      /* jaune nutrition */
  --psychomot:#fef3c7; /* sable chaud */
  --group:#e0f2fe;     /* bleu groupe */
  --autre:#fecaca;     /* corail doux */
  --neuropsy:#fecaca;  /* corail doux */

  /* Entêtes & cellules — version claire (header = couleur pleine, cell = teinte adoucie) */
  --kine-header:      var(--kine);
  --apa-header:       var(--apa);
  --ergo-header:      var(--ergo);
  --ortho-header:     var(--ortho);
  --psycho-header:    var(--psycho);
  --diet-header:      var(--diet);
  --psychomot-header: var(--psychomot);
  --group-header:     var(--group);
  --autre-header:     var(--autre);
  --neuropsy-header:  var(--neuropsy);

  /* cellules sous entêtes (plus léger que header) */
  --kine-cell:      color-mix(in srgb, var(--kine) 26%, transparent);
  --apa-cell:       color-mix(in srgb, var(--apa) 26%, transparent);
  --ergo-cell:      color-mix(in srgb, var(--ergo) 26%, transparent);
  --ortho-cell:     color-mix(in srgb, var(--ortho) 26%, transparent);
  --psycho-cell:    color-mix(in srgb, var(--psycho) 26%, transparent);
  --diet-cell:      color-mix(in srgb, var(--diet) 26%, transparent);
  --psychomot-cell: color-mix(in srgb, var(--psychomot) 22%, transparent);
  --group-cell:     color-mix(in srgb, var(--group) 26%, transparent);
  --autre-cell:     color-mix(in srgb, var(--autre) 26%, transparent);
  --neuropsy-cell:  color-mix(in srgb, var(--neuropsy) 26%, transparent);

  /* Cadres (légèrement bleutés) */
  --frame-bg:     #e5f3f8;
  --frame-border: #bfd9e6;
}

body{
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font:14px/1.5 system-ui,-apple-system,Segoe UI,Roboto;
  -webkit-font-smoothing:antialiased;
  /* 🔒 évite le second scroll horizontal global */
  overflow-x:hidden;
}
.page{
  max-width:1600px;
  margin:22px auto;
  padding:0 16px 40px;
}

.topbar {
    background:#0369a1;
    color:#f9fafb;
    border-radius:14px;

    /* ↓↓↓ DIMINUER LA HAUTEUR ↓↓↓ */
    padding:10px 20px;       /* au lieu de 20px 24px */
    min-height:70px;         /* au lieu de 90px */

    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:20px;
}


/* LOGO + TITRE À GAUCHE */
.topbar-left{
  display:flex;
  flex-direction:row;            /* logo + texte côte à côte */
  align-items:center;            /* centré verticalement */
  gap:16px;
}

/* bloc logo */
.app-logo-wrap{
  display:flex;
  align-items:center;
  justify-content:center;
}

/* taille du logo : tu peux ajuster ici */
.app-logo{
  height:80px;                   /* augmente/diminue cette valeur à ton goût */
  width:auto;
  border-radius:999px;
  box-shadow:0 0 6px rgba(0,0,0,.25);
}

.topbar-left .title{
  font-weight:700;
  font-size:16px;
}
.topbar-left .subtitle{
  font-size:13px;
  opacity:0.9;
}

.topbar-right{
  display:flex;
  align-items:center;
  gap:14px;
  flex-wrap:wrap;
  justify-content:flex-end;
}



.topbar-center{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:4px;
  font-size:14px;
}

.topbar-service-label{
  font-size:12px;
  opacity:0.9;
}

.topbar-service-select{
  padding:4px 10px;
  border-radius:999px;
  border:none;
  font-size:14px;
}

/* petits groupes lisibles à droite */
.topbar-group{
  display:flex;
  align-items:center;
  gap:8px;
  padding:4px 8px;
  border-radius:999px;
  background:rgba(15,23,42,0.18);
}

/* BI - filtres et résumé */
.bi-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.bi-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* BI - mini "graphs" en barres */
.bi-chart {
  margin-top: 1rem;
  border-top: 1px solid #ccc;
  padding-top: 0.5rem;
}

.bi-chart h4 {
  margin: 0 0 0.3rem 0;
  font-size: 0.95rem;
}

.bi-chart-bar-container {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 120px;
}

.bi-chart-bar {
  flex: 1;
  background: #cfe4ff;
  position: relative;
}

.bi-chart-bar span {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translate(-50%, -2px);
  font-size: 0.7rem;
}

.bi-chart-x-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  margin-top: 0.3rem;
}


.save-status{
  font-size:13px;
}

.folder-status{
  font-size:13px;

}
.btn-icon {
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:50%;
  width:40px;
  height:34px;
  padding:0;
  font-size:16px;
  color:#e5e7eb;
  background:rgba(255,255,255,0.05);
  border:1px solid rgba(255,255,255,0.15);
  cursor:pointer;
  transition:background .2s ease, transform .15s ease;
}
#btnSettings i {
  font-size: 20px;   /* tu peux mettre 20px, 24px, 28px… */
}

.btn-icon:hover {
  background:#e5e7eb;
  transform:scale(1.08);
}

.btn-icon i {
  pointer-events:none;
}

.btn.btn-icon span,
.btn.btn-icon::before,
.btn.btn-icon::after{
  pointer-events:none;
}

.badge{
  background:rgba(15,23,42,.85);
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
}
.tabs{
  display:flex;
  gap:8px;
  margin:14px 0;
  flex-wrap:wrap;
}
.tab{
  position:relative;
  border:1px solid var(--grid);
  border-radius:999px;
  padding:7px 14px;
  background:#ffffff;
  cursor:pointer;
  font-weight:500;
  font-size:13px;
}

.tab::after{
  content:'';
  position:absolute;
  left:18%;
  right:18%;
  bottom:-4px;
  height:0;
  border-radius:999px;
  background:var(--accent);
  opacity:0;
  transition:height .15s ease, opacity .15s ease, transform .15s ease;
  transform:translateY(2px);
}

.tab.active{
  background:var(--accent);
  color:#f9fafb;
  border-color:var(--accent);
  box-shadow:0 4px 14px rgba(14,165,233,.35);
}

.tab.active::after{
  height:3px;
  opacity:1;
  transform:translateY(0);
}

.tabpanel{ display:none; }
.tabpanel.active{ display:block; }

.card{
  background:var(--card);
  border:1px solid var(--grid);
  border-radius:14px;
  padding:16px;
  margin-top:16px;
}
.toolbar{
  display:flex;
  gap:10px;
  align-items:center;
  margin:10px 2px 14px;
}

/* 🔧 Planner générique : plus de scroll horizontal par défaut */
.planner{
  overflow-y:auto;
  overflow-x:hidden;
  background:var(--card);
  border:1px solid var(--grid);
  border-radius:16px;
}

.grid{
  display:grid;
  grid-template-columns:110px repeat(8,minmax(150px,1fr));
  border-top:2px solid var(--grid);
  border-left:2px solid var(--grid);
  min-width:1200px;
}
.cell{
  border-right:2px solid var(--grid);
  border-bottom:2px solid var(--grid);
  min-height:64px;
  background:var(--card);
  position:relative;
}
.header{
  position:sticky;
  top:0;
  background:var(--card);
  z-index:3;
}
.time{
  position:sticky;
  left:0;
  background:var(--time);
  z-index:2;
  font-weight:700;
}

.header.time{
  z-index:4;
}

.head{
  padding:10px 12px;
  font-weight:700;
  font-size:13px;
  white-space:nowrap;
}
.slot{
  padding:8px 10px;
  display:flex;
  flex-direction:column;
  gap:6px;
  min-height:20px;
}
.line{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  min-height:20px;
}

/* Entêtes colorées */
.sp-kine.header{background:var(--kine-header)}
.sp-apa.header{background:var(--apa-header)}
.sp-ergo.header{background:var(--ergo-header)}
.sp-ortho.header{background:var(--ortho-header)}
.sp-psycho.header{background:var(--psycho-header)}
.sp-diet.header{background:var(--diet-header)}
.sp-psychomot.header{background:var(--psychomot-header)}
.sp-group.header{background:var(--group-header)}
.sp-autre.header{background:var(--autre-header)}
.sp-neuropsy.header{background:var(--neuropsy-header); color:#1f2933}

/* Pastilles patient sur la trame / planning */
.tag{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:4px 10px;
  border-radius:999px;
  background:linear-gradient(135deg,#f9fafb,#eff6ff);
  color:#0f172a;
  border:1px solid rgba(148,163,184,0.55);
  font-size:12px;
  line-height:1.2;
  cursor:grab;
  box-shadow:0 1px 2px rgba(15,23,42,0.08);
  position:relative;
}
.tag-weight-badge{
  font-size:10px;
  padding:2px 6px;
  border-radius:999px;
  background:rgba(15,23,42,0.06);
  color:#0f172a;
  margin-left:4px;
}


.tag::before{
  content:'';
  width:7px;
  height:7px;
  border-radius:999px;
  background:#0ea5e9;                    /* couleur par défaut */
  box-shadow:0 0 0 3px rgba(14,165,233,0.18);
}

/* état pendant le drag */
.tag.dragging{
  opacity:0.75;
  transform:scale(0.97);
}

/* bouton "×" */
.tag-del{
  width:18px;
  height:18px;
  border-radius:999px;
  border:none;
  background:rgba(148,163,184,0.12);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:11px;
  line-height:1;
  padding:0;
  color:#64748b;
  cursor:pointer;
}
.tag-del:hover{
  background:rgba(148,163,184,0.25);
  color:#0f172a;
}

/* Code couleur selon la lourdeur (tag-weight-1..5) */
.tag-weight-1::before{
  background:#22c55e;
  box-shadow:0 0 0 3px rgba(34,197,94,0.20);
}
.tag-weight-2::before{
  background:#84cc16;
  box-shadow:0 0 0 3px rgba(132,204,22,0.20);
}
.tag-weight-3::before{
  background:#eab308;
  box-shadow:0 0 0 3px rgba(234,179,8,0.22);
}
.tag-weight-4::before{
  background:#f97316;
  box-shadow:0 0 0 3px rgba(249,115,22,0.22);
}
.tag-weight-5::before{
  background:#ef4444;
  box-shadow:0 0 0 3px rgba(239,68,68,0.24);
}


/* Card header & table */
.card-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
  margin-bottom:10px;
}
.card-header h3{
  margin:0 0 4px 0;
}
.card-header .muted{
  margin:0;
  color:#64748b;
  font-size:13px;
}
.btn-group{ display:flex; gap:8px; }

.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0 8px;
}
.table thead th{
  text-align:left;
  padding:8px 10px;
  font-weight:600;
  color:var(--ink);
}
.table td{
  padding:0 6px;
  vertical-align:middle;
}
.table .w-80{ width:80px; }
.table .ta-right{ text-align:right; }
.table .days label{
  margin-right:10px;
  white-space:nowrap;
}
.table input[type="text"],
.table input[type="number"],
.table select{
  width:100%;
  box-sizing:border-box;
  padding:8px 10px;
  border-radius:8px;
  border:1px solid var(--grid);
  background:var(--card);
  color:var(--ink);
}


/* Boutons */
.btn{
  border:1px solid var(--grid);
  border-radius:999px;
  padding:8px 14px;
  background:var(--card);
  color:var(--ink);
  cursor:pointer;
  font-size:13px;
  display:inline-flex;
  align-items:center;
  gap:6px;
}
.btn.primary{
  background:var(--accent);
  color:#f9fafb;
  border-color:var(--accent);
}
.btn.warn{ background:#fef9c3; }
.btn:hover{
  filter:brightness(1.03);
  transform:translateY(-1px);
}
.btn:active{
  transform:translateY(0);
  filter:brightness(0.98);
}
.btn:focus-visible{
  outline:2px solid rgba(14,165,233,.6);
  outline-offset:2px;
}

/* Teinte légère des colonnes */
.slot.sp-kine      { --col: var(--kine-cell); }
.slot.sp-apa       { --col: var(--apa-cell); }
.slot.sp-ergo      { --col: var(--ergo-cell); }
.slot.sp-ortho     { --col: var(--ortho-cell); }
.slot.sp-psycho    { --col: var(--psycho-cell); }
.slot.sp-diet      { --col: var(--diet-cell); }
.slot.sp-psychomot { --col: var(--psychomot-cell); }
.slot.sp-group     { --col: var(--group-cell); }
.slot.sp-autre     { --col: var(--autre-cell); }
.slot.sp-neuropsy  { --col: var(--neuropsy-cell); }

.slot{
  background: linear-gradient(
    0deg,
    color-mix(in srgb, var(--col, transparent) 100%, transparent),
    transparent
  );
}
.slot:hover{
  background: linear-gradient(
    0deg,
    color-mix(in srgb, var(--col, transparent) 120%, transparent),
    transparent
  );
}

/* États */
.slot.overcap{ outline:2px solid #ef4444; }
.slot.conflict{ outline:2px solid #f59e0b; }

/* Modal */
.modal{
  position:fixed;
  inset:0;
  z-index:50;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(15,23,42,.65);
}
.modal-card{
  background:var(--card);
  color:var(--ink);
  border:1px solid var(--grid);
  border-radius:14px;
  min-width:720px;
  max-width:90vw;
  box-shadow:0 24px 60px rgba(15,23,42,.9);
}
.modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 14px;
  border-bottom:1px solid var(--grid);
}
.modal-body{ padding:12px 14px; }
.modal[hidden]{ display:none !important; }

/* transitions globales */
.page, .card, .cell, .tab, .topbar, .tag, .btn{
  transition:
    background-color .18s ease,
    color .18s ease,
    border-color .18s ease,
    box-shadow .18s ease,
    transform .12s ease;
}

/* ===== Patients: cards layout ===== */
.patient-card{
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--grid) 70%, transparent);
  border-radius: 18px;
  padding: 16px;
  margin: 14px 0;
  box-shadow: 0 4px 14px rgba(15,23,42,.08), 0 1px 0 rgba(15,23,42,.06);
}
.patient-header{
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 14px;
  align-items: center;
  margin: -6px -6px 12px;
  padding: 10px;
  border-radius: 14px;
  background:
    linear-gradient(120deg,
      color-mix(in srgb, var(--time) 90%, transparent),
      color-mix(in srgb, var(--accent) 8%, transparent)
    );
  border: 1px solid color-mix(in srgb, var(--grid) 70%, transparent);
}
.patient-avatar{
  width:56px;height:56px;border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  font-weight:800;font-size:18px; letter-spacing:.3px;
  background: radial-gradient(120% 120% at 30% 20%, rgba(255,255,255,.9), rgba(255,255,255,0));
  color: var(--ink);
  border:1px solid color-mix(in srgb, var(--grid) 80%, transparent);
}
.patient-meta{
  display:flex;flex-wrap:wrap;gap:8px 10px;align-items:center;
}
.patient-name{ font-size:18px;font-weight:700; }
.chips{ display:flex;flex-wrap:wrap;gap:8px; }
.chip{
  display:inline-flex; align-items:center; gap:6px;
  padding:6px 10px; border-radius:999px;
  border:1px solid color-mix(in srgb, var(--grid) 70%, transparent);
  background: color-mix(in srgb, var(--time) 85%, transparent);
  font-size:12px;
}

/* chip de spécialité */
.chip-spec.sp-kine      { background: color-mix(in srgb, var(--kine) 40%, transparent); }
.chip-spec.sp-apa       { background: color-mix(in srgb, var(--apa) 40%, transparent); }
.chip-spec.sp-ergo      { background: color-mix(in srgb, var(--ergo) 40%, transparent); }
.chip-spec.sp-ortho     { background: color-mix(in srgb, var(--ortho) 40%, transparent); }
.chip-spec.sp-psycho    { background: color-mix(in srgb, var(--psycho) 40%, transparent); }
.chip-spec.sp-diet      { background: color-mix(in srgb, var(--diet) 40%, transparent); }
.chip-spec.sp-psychomot { background: color-mix(in srgb, var(--psychomot) 40%, transparent); }
.chip-spec.sp-group     { background: color-mix(in srgb, var(--group) 40%, transparent); }
.chip-spec.sp-autre     { background: color-mix(in srgb, var(--autre) 40%, transparent); }
.chip-spec.sp-neuropsy  { background: color-mix(in srgb, var(--neuropsy) 35%, transparent); color:#0f172a; }

.patient-count-badge{
  background:var(--accent);
  color:#f9fafb;
  border-radius:999px;
  padding:7px 12px;
  font-size:12px;
  font-weight:800;
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 2px 8px rgba(15,23,42,.25);
}

/* tableau compact des rdv */
.appt-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  overflow:hidden;
  border-radius:12px;
}
.appt-table thead th{
  text-align:left;
  font-weight:800;
  padding:10px 12px;
  background: color-mix(in srgb, var(--time) 92%, transparent);
  border-bottom:1px solid color-mix(in srgb, var(--grid) 80%, transparent);
}
.appt-table tbody td{
  padding:10px 12px;
  border-bottom:1px solid color-mix(in srgb, var(--grid) 70%, transparent);
}
.appt-table tbody tr:nth-child(odd){
  background: color-mix(in srgb, var(--card) 100%, rgba(15,23,42,.02));
}

/* petit séparateur visuel entre cartes */
.patient-card + .patient-card{ margin-top: 18px; }

/* En-tête Patients plus foncé / gris */
.patient-table-header {
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  border-bottom: 2px solid color-mix(in srgb, var(--ink) 15%, transparent);
}
.patient-table-header th {
  padding: 12px 16px;
  font-weight: 600;
  color: var(--ink);
}

/* === Global section titles & framed surfaces === */
.section-title-main{
  font-size:20px;
  font-weight:800;
  margin:4px 0 10px 2px;
  color:var(--ink);
}
.section-surface{
  background: color-mix(in srgb, var(--ink) 4%, transparent);
  border: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
  border-radius: 14px;
  padding: 10px;
  margin: 8px 0 14px;
}
.section-surface input,
.section-surface select,
.section-surface textarea{
  background: var(--card);
}
.card > .card-header{
  background: color-mix(in srgb, var(--time) 90%, transparent);
  border: 1px solid color-mix(in srgb, var(--grid) 70%, transparent);
  border-radius: 10px;
  padding: 10px;
  margin: -6px -6px 10px;
}
.table thead th,
.appt-table thead th{
  background: color-mix(in srgb, var(--ink) 4%, transparent);
}

/* ==== ENCADREMENTS UNIFORMES ==== */
:where(.card, .patient-card, .planner, .section-surface){
  background: var(--frame-bg) !important;
  border: 2px solid var(--frame-border) !important;
  border-radius: 16px !important;
  box-shadow: 0 6px 18px rgba(15,23,42,.08) !important;
  /* plus d'overflow ici */
}

.card :where(.planner, .section-surface),
.patient-card :where(.planner, .section-surface),
.section-surface .section-surface{
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

/* Trame : card allégée + planner scrollable horizontalement */
#trame .card {
  background: var(--bg) !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
}

/* Le bandeau "Trame hebdomadaire / filtres / jours" */
#trame .card > .card-header {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  margin: 0 0 10px 0 !important;
  padding: 0 0 10px 0 !important;
}

/* La zone qui contient le planner ne rajoute pas de cadre en plus */
#trame .card > .section-surface {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
}

/* 🔧 Planner de TRAME : ici, on autorise le scroll X */
#trame .planner{
  background: var(--frame-bg) !important;
  border: 2px solid var(--frame-border) !important;
  border-radius: 16px !important;
  box-shadow: 0 6px 18px rgba(15,23,42,.08) !important;
  padding: 0 !important;
  overflow-x:auto;
  overflow-y:visible;
}
#trameGrid{
  border-radius: 14px;
  width: max-content;  /* ⬅ prend la largeur de toutes les colonnes */
  min-width: 100%;     /* ⬅ au moins toute la largeur de la carte */
}
#trameGrid {
  margin: 0 auto;
}


/* Commentaires Planning */
.comments{
  margin:10px 2px 14px;
  display:flex;
  align-items:center;
  gap:8px;
}

.comments label{
  font-weight:500;
  white-space:nowrap;
}

.comments input{
  flex:1;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid var(--grid);
  background:var(--card);
  font-size:13px;
}


/* Bandeaux assortis */
.card > .card-header,
.patient-header{
  background: color-mix(in srgb, var(--frame-bg) 75%, transparent) !important;
  border: 1px solid var(--frame-border) !important;
  border-radius: 12px !important;
  margin: -6px -6px 12px !important;
  padding: 10px !important;
}

/* Tableaux dans un cadre */
:where(.planner, .section-surface) .table thead th,
.appt-table thead th{
  background: color-mix(in srgb, var(--frame-bg) 100%, transparent) !important;
  border-bottom: 1px solid var(--frame-border) !important;
  padding: 10px 12px !important;
}
:where(.planner, .section-surface) .table tbody td,
.appt-table tbody td{
  background: transparent !important;
  border-bottom: 1px solid color-mix(in srgb, var(--frame-border) 70%, transparent);
  padding: 8px 10px;
}

/* Champs (toujours blancs) */
.table input[type="text"],
.table input[type="number"],
.table select,
input[type="date"],
input[type="time"]{
  background: #ffffff !important;
  border: 1px solid var(--frame-border) !important;
  color: var(--ink) !important;
  border-radius: 8px !important;
}

/* Boutons de jours TRAME */
#trameDays .btn.active {
  background: var(--accent);
  color: white !important;
  border-color: transparent;
  font-weight: bold;
  box-shadow: 0 0 0 2px rgba(14,165,233,0.35);
  transform: scale(1.05);
  transition: 0.15s ease;
}
#trameDays .btn.is-active-day {
  background: #0ea5e9;
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 0 0 1px rgba(14,165,233,.3);
}
#trameDays .btn.is-active-day:hover {
  filter: brightness(1.05);
}

.summary-row {
  background: rgba(15,23,42,0.03);
}
.summary-row td {
  border-top: 2px solid rgba(15,23,42,0.08);
}

/* ==== Filtres des scénarios dans les entêtes ==== */
.th-filter {
  display: table-cell !important;
  position: relative;
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
  padding-right: 0;
}
.th-filter .th-label {
  font-weight: 600;
  margin-right: 2px;
}
.th-filter .filter-icon {
  display: inline-block;
  font-size: 11px;
  vertical-align: middle;
  pointer-events: none;
}
.th-filter .filter-native {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
}

/* Bouton "Générer les scénarios" en bas à droite */
.prog-actions-bottom {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}
.btn-scenarios {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 600;
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 6px 16px rgba(14,165,233,0.4);
}
.btn-scenarios:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}
/* ========================= */
/*  STYLES DES SOUS-ONGLETS  */
/* ========================= */

.calib-soignant-tab,
.patients-tab {
  background: #ffffff;
  border: 1px solid var(--grid);
  color: var(--ink);
  transition: 0.2s ease;
  font-weight: 500;
}

/* Souris dessus */
.calib-soignant-tab:hover,
.patients-tab:hover {
  filter: brightness(1.05);
}

/* Onglet actif — même style que les onglets principaux */
.calib-soignant-tab.active,
.patients-tab.active {
  background: var(--accent);
  color: #ffffff !important;
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(14,165,233,0.35);
  transform: translateY(-1px);
}
#progPatientName {
  width: 320px;        /* taille plus raisonnable */
  max-width: 50%;      /* évite qu'il devienne trop large */
}
.table-header-with-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 4px;
  margin-bottom: 8px;
}

.table-header-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.card-header.tabs-only {
  padding-bottom: 4px;
  border-bottom: 1px solid #e5e5e5;
}
/* Zone de contenu principale dans "Patients & prescriptions actives"
   -> même couleur que le fond de page, sans cadre marqué */
#patients .card > .section-surface {
  background: var(--bg) !important;   /* même fond que la page */
  border: 0 !important;               /* plus de bordure */
  box-shadow: none !important;        /* plus d'ombre */
  border-radius: 0 !important;        /* se fond dans le card */
  padding: 0 0 12px 0 !important;     /* un peu d'air en bas si tu veux */
}
/* --- Neutraliser le grand encadrement du panneau Patients (Programme) --- */
#patients .card {
    background: var(--bg) !important;
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
}

/* Conserver l'encadrement des cartes patient individuelles */
#patients .patient-card {
    background: var(--frame-bg) !important;
    border: 2px solid var(--frame-border) !important;
    border-radius: 18px !important;
    box-shadow: 0 6px 18px rgba(15,23,42,.08) !important;
    padding: 16px !important;
}

/* Le bandeau interne doit aussi redevenir normal */
#patients .card > .card-header {
    background: transparent !important;
    border: 0 !important;
    margin: 0 !important;
    padding: 0 0 12px 0 !important;
}
/* =========================
   BI – Présentation améliorée
   ========================= */

#bi {
  padding: 1.5rem 2rem 2rem;
}

/* Header : titre + filtres */
.bi-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

.bi-title h2 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
}

.bi-title p {
  margin: 0.3rem 0 0;
  font-size: 0.9rem;
  color: #64748b;
}

.bi-filters {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.bi-filters label {
  display: flex;
  flex-direction: column;
  font-size: 0.75rem;
  color: #64748b;
}

.bi-filters label span {
  margin-bottom: 0.1rem;
}

.bi-filters input[type="date"] {
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  font-size: 0.8rem;
}

.bi-filters button#bi-refresh-btn {
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: none;
  font-size: 0.85rem;
  cursor: pointer;
  background: #0ea5e9;
  color: #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}
.bi-filters button#bi-refresh-btn:hover {
  background: #0284c7;
}

/* KPIs */
.bi-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.bi-kpi-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
  border: 1px solid #e2e8f0;
}

.bi-kpi-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-bottom: 0.3rem;
}

.bi-kpi-value {
  font-size: 1.4rem;
  font-weight: 600;
  color: #0f172a;
}

.bi-kpi-sub {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 0.1rem;
}

/* Sections */
.bi-section {
  margin-top: 1.5rem;
}

.bi-section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.75rem;
}

.bi-section-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.bi-section-header p {
  margin: 0;
  font-size: 0.8rem;
  color: #94a3b8;
}

/* Tableau journalier */
.bi-table-wrapper {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

#bi-daily-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

#bi-daily-table thead {
  background: #f1f5f9;
}

#bi-daily-table th,
#bi-daily-table td {
  padding: 0.55rem 0.7rem;
  text-align: left;
}

#bi-daily-table th {
  font-weight: 600;
  color: #475569;
  border-bottom: 1px solid #e2e8f0;
}

#bi-daily-table th span {
  font-weight: 400;
  font-size: 0.75rem;
  color: #94a3b8;
}

#bi-daily-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

#bi-daily-table tbody tr:hover {
  background: #e0f2fe;
}

/* Grille de graphiques */
.bi-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

/* Cartes graphiques */
.bi-chart {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 0.9rem 1rem 1rem;
}

.bi-chart h4 {
  margin: 0 0 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.bi-chart-subtitle {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-bottom: 0.35rem;
}

/* Barres */
.bi-chart-bar-container {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 110px;
  padding-top: 0.25rem;
}

.bi-chart-bar {
  flex: 0 0 36px;
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(180deg, #38bdf8 0%, #0ea5e9 50%, #0284c7 100%);
  position: relative;
}

.bi-chart-bar span {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translate(-50%, -2px);
  font-size: 0.7rem;
  color: #0f172a;
  white-space: nowrap;
}

.bi-chart-x-labels {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 0.35rem;
  font-size: 0.7rem;
  color: #64748b;
}

.bi-chart-x-labels span {
  flex: 0 0 36px;
  text-align: center;
}

/* Responsive : sur petits écrans, on passe en 2 colonnes de KPI + 1 colonne de graph */
@media (max-width: 1024px) {
  .bi-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .bi-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .bi-charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  #bi {
    padding: 1rem;
  }
  .bi-kpi-grid {
    grid-template-columns: 1fr;
  }
}
.trame-grid-wrapper {
  display: flex;
  justify-content: center;
}
/* === FIX : Trame responsive === */

#trameGrid {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

#trameGrid .row {
  display: contents; /* Important pour que la grille étire vraiment les colonnes */
}

#trameGrid .cell {
  min-width: 0 !important;     /* Supprime la largeur minimale forcée */
  width: auto !important;
}

/* Réduit les colonnes Heures si besoin */
#trameGrid .cell.header.time .head {
  white-space: nowrap;
}

/* Empêche la double marge qui crée le blanc */
#trame .planner {
  overflow-x: auto !important;
}

/* Style grid plus flexible */
#trameGrid {
  display: grid;
  gap: 1px;
}
.login-logo-wrap{
  display:flex;
  justify-content:center;
  margin-bottom:16px;
}
.login-logo{
  height:60px;
  width:auto;
  border-radius:999px;
  opacity:0.9;
  backdrop-filter: blur(4px);
  box-shadow:0 6px 18px rgba(15,23,42,0.25);
  transition:transform .25s ease, opacity .25s ease;
}
.login-logo:hover{
  transform:scale(1.05);
  opacity:1;
}
