/* ── Boussole PRO — styles.css — DS v1.0 ── */
:root {
  /* Fond & surfaces */
  --bg:           #F5F7F6;
  --surface:      #FFFFFF;
  --surface2:     #EAF0ED;
  --surface3:     #DDE7E2;

  /* Bordures */
  --border:       rgba(6,23,45,0.07);
  --border2:      rgba(6,23,45,0.13);

  /* Texte */
  --text:         #06172D;
  --muted:        rgba(6,23,45,.60);
  --muted2:       rgba(6,23,45,.42);

  /* Couleurs principales — vert clinique plus soutenu */
  --primary:        #1b5e42;
  --primary-dim:    rgba(27,94,66,0.10);
  --primary-dark:   #134233;
  --primary-light:  #d0e7dc;
  --accent:         #2C6E7A;
  --accent-dim:     rgba(44,110,122,.09);
  --green:          #16a34a;
  --amber:          #b45309;
  --red:            #dc2626;
  --blue:           #2563eb;
  --teal:           #0f766e;
  --teal-dim:       rgba(15,118,110,.10);

  /* Typography */
  --font-body:    'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono:    'DM Mono', monospace;
  --fs-xs:        11px;
  --fs-sm:        12px;
  --fs-body:      13px;
  --fs-md:        14px;
  --fs-lg:        16px;
  --fs-xl:        20px;

  /* Layout */
  --brand-h:      48px;
  --prof-h:       44px;
  --bandeau-h:    44px;
  --modnav-h:     46px;
  --header-total: 182px;
  --sidebar-w:    240px;
  --radius:       12px;
  --radius-sm:    8px;
  --radius-xs:    6px;
  --shadow:       0 2px 12px rgba(6,23,45,.08);
  --shadow-md:    0 4px 24px rgba(6,23,45,.12);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Brand bar ── */
.brand-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--brand-h);
  background: var(--primary-dark);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
}
.brand-logo {
  font-family: var(--font-mono);
  font-size: 14px; font-weight: 700;
  color: #fff; letter-spacing: .04em;
  text-decoration: none;
  display: flex; align-items: center; gap: 8px;
}
.brand-logo span { color: rgba(255,255,255,.55); font-weight: 400; }
.brand-badge {
  background: rgba(255,255,255,.15);
  color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 99px;
  letter-spacing: .06em; text-transform: uppercase;
}
.brand-right {
  margin-left: auto;
  display: flex; align-items: center; gap: 10px;
}
.brand-practitioner {
  font-size: var(--fs-sm); color: rgba(255,255,255,.75);
}
.btn-brand {
  padding: 5px 14px;
  background: rgba(255,255,255,.15);
  color: #fff; font-size: 12px; font-weight: 600;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius-xs); cursor: pointer;
  transition: background .15s;
}
.btn-brand:hover { background: rgba(255,255,255,.25); }
.btn-logout {
  padding: 5px 12px;
  background: transparent;
  color: rgba(255,255,255,.55); font-size: 12px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--radius-xs); cursor: pointer;
}
.btn-logout:hover { color: #fff; border-color: rgba(255,255,255,.35); }

/* ── Nav bar / Module nav ── */
.nav-bar {
  position: fixed;
  top: calc(var(--brand-h) + var(--prof-h) + var(--bandeau-h));
  left: 0; right: 0; z-index: 96;
  height: var(--modnav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border2);
  display: flex; align-items: center;
  padding: 0 20px;
  gap: 2px;
  box-shadow: 0 1px 8px rgba(6,23,45,.05);
}
.nav-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  font-size: var(--fs-sm); font-weight: 600;
  color: var(--muted); background: transparent;
  border: none; border-radius: var(--radius-sm);
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.nav-tab:hover { background: var(--surface2); color: var(--text); }
.nav-tab.active { background: var(--primary-dim); color: var(--primary); }
.nav-tab .nav-icon { font-size: 14px; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.patient-selector {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: var(--surface2); border-radius: var(--radius-sm);
  font-size: var(--fs-sm); cursor: pointer;
  border: 1px solid var(--border2);
}
.patient-selector .patient-name { font-weight: 600; color: var(--text); }
.patient-selector .patient-hint { color: var(--muted2); }

/* ── Page content (legacy) ── */
.page-content {
  margin-top: var(--header-total);
  padding: 24px 28px;
}
/* ── Main (inside layout) ── */
.main {
  flex: 1;
  padding: 24px 28px;
  min-width: 0;
}
.view { display: none; }
.view.active { display: block; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-title {
  font-size: var(--fs-md); font-weight: 700; color: var(--text);
}
.card-subtitle {
  font-size: var(--fs-sm); color: var(--muted2); margin-top: 2px;
}

/* ── Section title ── */
.section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text);
  margin-bottom: 12px;
}

/* ── Grid layouts ── */
.grid-2 { display: grid; grid-template-columns: 1fr 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: 12px; }

/* ── Stat tile ── */
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 28px; font-weight: 700; color: var(--primary);
  line-height: 1;
}
.stat-label { font-size: var(--fs-sm); color: var(--muted); }

/* ── Patient list ── */
.patient-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer; transition: background .12s;
  border: 1px solid transparent;
}
.patient-row:hover { background: var(--surface2); border-color: var(--border); }
.patient-row.active { background: var(--primary-dim); border-color: rgba(27,94,66,.2); }
.patient-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: var(--primary);
  flex-shrink: 0;
}
.patient-info { flex: 1; min-width: 0; }
.patient-name-row { font-size: var(--fs-md); font-weight: 600; }
.patient-meta { font-size: var(--fs-sm); color: var(--muted2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.patient-status { flex-shrink: 0; display: flex; align-items: center; gap: 6px; }
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block;
}
.status-dot.green { background: var(--green); }
.status-dot.amber { background: var(--amber); }
.status-dot.red   { background: var(--red); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  font-size: var(--fs-body); font-weight: 600; font-family: var(--font-body);
  border-radius: var(--radius-sm); cursor: pointer;
  border: none; transition: all .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border2); }
.btn-secondary:hover { background: var(--surface3); }
.btn-sm { padding: 6px 12px; font-size: var(--fs-sm); }
.btn-danger { background: rgba(220,38,38,.1); color: var(--red); border: 1px solid rgba(220,38,38,.2); }
.btn-danger:hover { background: rgba(220,38,38,.2); }

/* ── Forms ── */
.form-group { margin-bottom: 14px; }
.form-label { font-size: var(--fs-sm); font-weight: 600; color: var(--muted); margin-bottom: 5px; display: block; }
.form-input {
  width: 100%; padding: 9px 12px;
  font-size: var(--fs-body); font-family: var(--font-body);
  border: 1.5px solid var(--border2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  outline: none; transition: border-color .15s;
}
.form-input:focus { border-color: var(--primary); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2306172D' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
textarea.form-input { resize: vertical; min-height: 80px; }

/* ── Questionnaire builder ── */
.q-template-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.q-template-card {
  padding: 14px; border-radius: var(--radius-sm);
  border: 2px solid var(--border2); cursor: pointer;
  transition: all .15s; background: var(--surface);
}
.q-template-card:hover { border-color: var(--primary); background: var(--primary-dim); }
.q-template-card.selected { border-color: var(--primary); background: var(--primary-dim); }
.q-template-icon { font-size: 22px; margin-bottom: 6px; }
.q-template-name { font-size: var(--fs-sm); font-weight: 700; color: var(--text); }
.q-template-count { font-size: 11px; color: var(--muted2); margin-top: 2px; }

/* ── Score ring SVG ── */
.score-ring-wrap { display: flex; align-items: center; justify-content: center; }

/* ── Tags / pills ── */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 600;
}
.tag-green  { background: rgba(22,163,74,.12); color: #166534; }
.tag-amber  { background: rgba(180,83,9,.10);  color: #92400e; }
.tag-red    { background: rgba(220,38,38,.10); color: #991b1b; }
.tag-blue   { background: rgba(37,99,235,.10); color: #1d4ed8; }
.tag-teal   { background: rgba(15,118,110,.10);color: #134e4a; }
.tag-muted  { background: var(--surface2);     color: var(--muted); }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1b5e42; color: #fff;
  padding: 10px 20px; border-radius: 99px;
  font-size: var(--fs-sm); font-weight: 600;
  box-shadow: var(--shadow-md); z-index: 9999;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }

/* ── Modal ── */
.modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(6,23,45,.4); z-index: 200;
  align-items: center; justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--radius);
  padding: 28px; max-width: 560px; width: 94%;
  box-shadow: var(--shadow-md);
}
.modal-title { font-size: var(--fs-lg); font-weight: 700; margin-bottom: 16px; }

/* ── Auth gate ── */
.auth-gate {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}
.auth-card {
  background: var(--surface); border-radius: 18px;
  padding: 40px; width: 100%; max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  text-align: center;
}
.auth-logo {
  font-family: var(--font-mono); font-size: 22px; font-weight: 700;
  color: var(--primary-dark); margin-bottom: 8px;
}
.auth-logo span { color: var(--muted2); font-weight: 400; }
.auth-badge {
  display: inline-block; background: var(--primary-dim); color: var(--primary);
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 99px;
  letter-spacing: .06em; text-transform: uppercase; margin-bottom: 24px;
}
.auth-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.auth-sub { font-size: var(--fs-sm); color: var(--muted); margin-bottom: 24px; }

/* ── Empty state ── */
/* ── Empty state PRO (avec raccourcis patients) ── */
.empty-state-pro { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 60px 24px; }
.esp-icon { font-size: 44px; margin-bottom: 14px; }
.esp-title { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.esp-sub { font-size: 13px; color: var(--muted); max-width: 340px; line-height: 1.6; }

.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--muted2);
}
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state .empty-title { font-size: var(--fs-md); font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.empty-state .empty-sub { font-size: var(--fs-sm); }

/* ── Upload zone ── */
.upload-zone {
  border: 2px dashed var(--border2);
  border-radius: var(--radius); padding: 32px;
  text-align: center; cursor: pointer;
  transition: all .15s;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary); background: var(--primary-dim);
}
.upload-icon { font-size: 32px; margin-bottom: 10px; }
.upload-title { font-size: var(--fs-md); font-weight: 600; margin-bottom: 4px; }
.upload-sub { font-size: var(--fs-sm); color: var(--muted2); }

/* ── Messagerie ── */
.msg-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  align-items: start;
  min-height: calc(100vh - var(--header-total) - 48px);
}
.msg-history-panel,
.msg-compose-panel {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.msg-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.msg-panel-title {
  font-size: 13px; font-weight: 700; color: var(--text);
  letter-spacing: .03em;
}
.msg-count-badge {
  background: var(--primary-dim); color: var(--primary);
  font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 99px;
}
.msg-filter-row {
  display: flex; gap: 4px; padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  overflow-x: auto;
}
.msg-filter {
  padding: 4px 10px;
  font-size: 11px; font-weight: 600;
  color: var(--muted); background: transparent;
  border: 1px solid var(--border2); border-radius: 99px;
  cursor: pointer; white-space: nowrap; transition: all .15s;
}
.msg-filter:hover { background: var(--surface2); color: var(--text); }
.msg-filter.active { background: var(--primary-dim); color: var(--primary); border-color: var(--primary); }
.msg-list {
  max-height: calc(100vh - var(--header-total) - 180px);
  overflow-y: auto;
}
.msg-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: default;
  transition: background .12s;
}
.msg-item:hover { background: var(--surface2); }
.msg-item:last-child { border-bottom: none; }
.msg-item-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 5px;
}
.msg-type-badge {
  font-size: 10px; font-weight: 700; padding: 2px 7px;
  border-radius: 99px; letter-spacing: .04em;
}
.msg-item-date {
  font-size: 10px; color: var(--muted2);
}
.msg-item-subject {
  font-size: 12px; font-weight: 600; color: var(--text);
  margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.msg-item-preview {
  font-size: 11px; color: var(--muted2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 6px;
}
.msg-item-actions {
  display: flex; gap: 4px; justify-content: flex-end;
  margin-top: 6px;
}
.msg-action-btn {
  padding: 2px 8px; font-size: 11px;
  background: transparent; border: 1px solid var(--border2);
  border-radius: var(--radius-xs); cursor: pointer;
  transition: all .12s;
}
.msg-action-btn:hover { background: var(--surface2); }
.msg-action-btn.danger:hover { background: #fee2e2; border-color: var(--red); color: var(--red); }

/* Compose panel */
.msg-compose-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
}
.msg-ctab {
  flex: 1; padding: 12px 16px;
  font-size: 12px; font-weight: 600;
  color: var(--muted); background: transparent;
  border: none; border-bottom: 2px solid transparent;
  cursor: pointer; transition: all .15s;
}
.msg-ctab:hover { background: var(--surface2); color: var(--text); }
.msg-ctab.active { color: var(--primary); border-bottom-color: var(--primary); background: transparent; }
.msg-compose-inner { padding: 18px; }
.tpl-chips {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px;
}
.tpl-chip {
  padding: 5px 11px;
  font-size: 11px; font-weight: 600;
  color: var(--accent); background: var(--accent-dim);
  border: 1px solid transparent; border-radius: 99px;
  cursor: pointer; transition: all .15s;
}
.tpl-chip:hover { border-color: var(--accent); }
.tpl-chip.active { background: var(--accent); color: #fff; }

/* ── Sidebar layout — S350 ── */

/* Profession bar */
.profession-bar {
  position: fixed; top: var(--brand-h); left: 0; right: 0; z-index: 98;
  height: var(--prof-h);
  background: #0e2035;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center;
  padding: 0 20px; gap: 4px; overflow-x: auto;
}
.profession-bar::-webkit-scrollbar { display: none; }
.prof-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 20px;
  border: 1px solid transparent;
  font-size: 12px; font-weight: 600; font-family: var(--font-body);
  cursor: pointer; color: rgba(255,255,255,.55); background: transparent;
  transition: all .15s; white-space: nowrap; flex-shrink: 0;
}
.prof-tab:hover { color: rgba(255,255,255,.85); background: rgba(255,255,255,.07); }
.prof-tab.active { color: #fff; background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.18); }
.prof-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.prof-tab[data-prof="nutri"] .prof-dot { background: #dc2626; }
.prof-tab[data-prof="nutri"].active { border-color: rgba(220,38,38,.5); background: rgba(220,38,38,.18); }
.prof-tab[data-prof="mg"] .prof-dot { background: #2C6E7A; }
.prof-tab[data-prof="mg"].active { border-color: rgba(44,110,122,.5); background: rgba(44,110,122,.18); }
.prof-tab[data-prof="osteo"] .prof-dot { background: #7c3aed; }
.prof-tab[data-prof="osteo"].active { border-color: rgba(124,58,237,.5); background: rgba(124,58,237,.18); }
.prof-tab[data-prof="ide"] .prof-dot { background: #3B82F6; }
.prof-tab[data-prof="ide"].active { border-color: rgba(59,130,246,.5); background: rgba(59,130,246,.18); }
.prof-tab[data-prof="psy"] .prof-dot { background: #D97706; }
.prof-tab[data-prof="psy"].active { border-color: rgba(217,119,6,.5); background: rgba(217,119,6,.18); }
.prof-tab[data-prof="pharma"] .prof-dot { background: #2d6a4f; }
.prof-tab[data-prof="pharma"].active { border-color: rgba(45,106,79,.5); background: rgba(45,106,79,.18); }

/* Metier bandeau */
.metier-bandeau {
  position: fixed; left: 0; right: 0; z-index: 97;
  top: calc(var(--brand-h) + var(--prof-h));
  height: var(--bandeau-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  transition: background .25s ease;
  background: var(--primary-dark);
}
.metier-bandeau-left { display: flex; align-items: center; gap: 10px; }
.metier-bandeau-icon { font-size: 18px; line-height: 1; }
.metier-bandeau-name { font-size: 13px; font-weight: 700; color: #fff; letter-spacing: -.01em; }
.metier-bandeau-sep { height: 18px; width: 1px; background: rgba(255,255,255,.2); }
.metier-bandeau-role { font-size: 10px; font-family: var(--font-mono); color: rgba(255,255,255,.65); letter-spacing: .08em; text-transform: uppercase; }
.metier-bandeau-right { display: flex; align-items: center; gap: 8px; }
.metier-chip { font-size: 10px; font-family: var(--font-mono); color: rgba(255,255,255,.8); background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.2); border-radius: 20px; padding: 2px 9px; letter-spacing: .04em; white-space: nowrap; }
.metier-chip.alert { background: rgba(255,255,255,.22); color: #fff; font-weight: 700; }

/* Flex layout */
.layout {
  display: flex;
  margin-top: var(--header-total);
  min-height: calc(100vh - var(--header-total));
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border2);
  position: sticky;
  top: var(--header-total);
  height: calc(100vh - var(--header-total));
  overflow-y: auto;
  align-self: flex-start;
}
.sidebar-header { padding: 12px 14px 10px; border-bottom: 1px solid var(--border); }
.sidebar-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted2); margin-bottom: 8px; display: block; }
.sidebar-search { background: var(--bg); border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 6px 10px; font-size: 12px; font-family: var(--font-body); color: var(--text); width: 100%; outline: none; }
.sidebar-search:focus { border-color: var(--primary); }
.sidebar-patient { position: relative; border-left: 2px solid transparent; transition: background .12s; }
.sidebar-patient:hover { background: var(--surface2); }
.sidebar-patient.active { background: var(--primary-dim); border-left-color: var(--primary); }
.sp-main { display: flex; align-items: center; gap: 10px; padding: 9px 14px 9px 12px; cursor: pointer; }
.sp-avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; background: var(--primary-dim); color: var(--primary); }
.sp-info { flex: 1; min-width: 0; }
.sp-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-actions { display: none; position: absolute; top: 50%; right: 8px; transform: translateY(-50%); gap: 2px; background: var(--surface2); border-radius: 6px; padding: 2px; }
.sidebar-patient:hover .sp-actions { display: flex; }
.sp-btn { background: none; border: none; cursor: pointer; font-size: 13px; padding: 3px 5px; border-radius: 4px; line-height: 1; transition: background .1s; }
.sp-btn:hover { background: var(--surface3); }
.sp-btn-del:hover { background: rgba(220,38,38,.12); }
.sp-meta { font-size: 10px; color: var(--muted2); margin-top: 1px; }
.sp-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.sp-dot.green { background: var(--green); }
.sp-dot.amber { background: var(--amber); }
.sp-dot.red   { background: var(--red); }
.sidebar-empty { padding: 24px 14px; font-size: 12px; color: var(--muted2); text-align: center; line-height: 1.6; }
.sidebar-add-btn { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 14px; font-size: 12px; font-weight: 600; color: var(--primary); background: none; border: none; border-top: 1px solid var(--border); cursor: pointer; width: 100%; transition: background .12s; font-family: var(--font-body); }
.sidebar-add-btn:hover { background: var(--surface2); }

/* ── Module locking ── */
.view-locked-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 56px 32px; text-align: center; gap: 14px; min-height: 320px;
}
.locked-icon { font-size: 44px; }
.locked-title { font-size: 17px; font-weight: 700; color: var(--text); }
.locked-sub { font-size: 13px; color: var(--muted2); max-width: 420px; line-height: 1.6; }
.locked-access { font-size: 12px; color: var(--muted2); }
.locked-access-label { font-weight: 600; color: var(--text-muted); }
.locked-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 4px; }
.btn-switch-prof {
  padding: 7px 14px; border: 1.5px solid var(--prof-color, #2d6a4f);
  color: var(--prof-color, #2d6a4f); background: none; border-radius: 20px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .14s, color .14s; font-family: var(--font-body);
}
.btn-switch-prof:hover { background: var(--prof-color, #2d6a4f); color: #fff; }
.nav-tab.nav-tab-locked { opacity: 0.45; }
.nav-tab.nav-tab-locked .nav-icon::after { content: '🔒'; font-size: 8px; vertical-align: super; margin-left: 1px; }

/* ── Dropdown "Plus ▾" ── */
.nav-more-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 8px 14px;
  font-size: var(--fs-sm); font-weight: 600;
  color: var(--muted); background: transparent;
  border: none; border-radius: var(--radius-sm);
  cursor: pointer; transition: all .15s; white-space: nowrap;
  margin-left: auto;
}
.nav-more-btn:hover { background: var(--surface2); color: var(--text); }
.nav-more-btn.open { background: var(--surface2); color: var(--text); }
.nav-more-dropdown {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(6,23,45,.12);
  z-index: 200;
  min-width: 200px;
  padding: 6px 0;
  display: none;
}
.nav-more-dropdown.open { display: block; }
.nav-more-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px;
  font-size: 13px; font-weight: 500;
  color: var(--text); cursor: pointer;
  transition: background .1s;
}
.nav-more-item:hover { background: var(--surface2); }
.nav-more-item.active { color: var(--primary); font-weight: 700; }
.nav-more-item .nav-icon { font-size: 15px; width: 20px; text-align: center; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .msg-layout { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .q-template-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px; }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .q-template-grid { grid-template-columns: 1fr; }
  .nav-tab .nav-label { display: none; }
}

/* ── Patients Grid (S353) ── */
.patients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.patient-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s, transform .1s;
}
.patient-card:hover {
  box-shadow: 0 4px 16px rgba(6,23,45,.09);
  border-color: var(--border2);
  transform: translateY(-1px);
}
.patient-card.active {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(27,94,66,.04) 0%, #fff 100%);
}
/* En-tête card patient */
.pc-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.pc-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.pc-info { flex: 1; min-width: 0; }
.pc-name { font-size: 14px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-condition { font-size: 11px; color: var(--muted2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-ring { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
/* Métriques */
.pc-metrics { display: flex; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.pc-metric { display: flex; flex-direction: column; gap: 2px; }
.pc-metric-label { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted2); }
.pc-metric-val { font-size: 12px; font-weight: 600; color: var(--text); }
/* Tags */
.pc-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.ptag { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 20px; white-space: nowrap; }
.ptag-active { background: var(--primary-dim); color: var(--primary); }
.ptag-warn   { background: rgba(180,83,9,.10); color: var(--amber); }
.ptag-ok     { background: rgba(22,163,74,.10); color: var(--green); }
/* Actions */
.pc-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-sm { font-size: 11px; padding: 5px 10px; }

/* ── Template Builder ── */
.builder-header { background: var(--surface); border-radius: 12px; padding: 14px 16px; border: 1px solid var(--border); margin-bottom: 16px; }
.builder-layout  { display: flex; gap: 14px; align-items: flex-start; }

.builder-palette {
  width: 210px; flex-shrink: 0;
  background: var(--surface); border-radius: 12px;
  padding: 14px; border: 1px solid var(--border);
  position: sticky; top: 0;
}
.palette-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 8px;
  border: 1px solid var(--border2); margin-bottom: 7px;
  cursor: grab; background: var(--surface);
  transition: all .13s; user-select: none;
}
.palette-item:hover  { border-color: var(--primary); background: var(--primary-dim); }
.palette-item.dragging { opacity: 0.5; }
.palette-icon { font-size: 16px; flex-shrink: 0; }

.builder-canvas-wrap { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.builder-canvas {
  background: var(--surface); border-radius: 12px;
  border: 2px dashed var(--border2);
  padding: 12px; min-height: 380px;
  transition: border-color .15s;
}
.builder-canvas.drag-active { border-color: var(--primary); background: var(--primary-dim); }

.canvas-empty {
  display: flex; align-items: center; justify-content: center;
  min-height: 200px; color: var(--muted2);
  font-size: 13px; text-align: center; line-height: 1.7;
}

.builder-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--border2); margin-bottom: 5px;
  background: var(--surface); transition: border-color .13s;
}
.builder-item:hover       { border-color: var(--primary); }
.builder-item.bitem-editing { border-color: var(--primary); background: var(--primary-dim); }
.builder-item.bitem-header  { background: var(--surface2); border-style: dashed; }

.drag-handle { cursor: grab; color: var(--muted2); font-size: 17px; flex-shrink: 0; line-height: 1; }
.drag-handle:active { cursor: grabbing; }
.bitem-content { flex: 1; }
.bitem-del {
  background: none; border: none; color: var(--muted2);
  font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px;
  flex-shrink: 0;
}
.bitem-del:hover { color: var(--red); }

.inline-edit {
  padding: 12px 14px; margin-bottom: 6px; margin-top: -1px;
  border-radius: 8px; border: 1px solid var(--primary);
  background: var(--surface);
}
.drop-line {
  height: 3px; background: var(--primary);
  border-radius: 2px; margin: 3px 0;
  animation: dropPulse .4s ease-in-out infinite alternate;
}
@keyframes dropPulse { from { opacity:.5; } to { opacity:1; } }

/* Grille templates — actions */
.q-template-card { position: relative; }
.q-tpl-actions {
  display: flex; gap: 4px; margin-top: 8px;
  flex-wrap: wrap;
}
.q-tpl-btn {
  font-size: 10px; padding: 2px 7px; border-radius: 4px;
  border: 1px solid var(--border2); background: var(--surface);
  color: var(--muted); cursor: pointer; transition: all .12s;
  line-height: 1.6;
}
.q-tpl-btn:hover           { border-color: var(--primary); color: var(--primary); }
.q-tpl-btn.btn-hide        { }
.q-tpl-btn.btn-danger:hover { border-color: var(--red); color: var(--red); }
.q-tpl-hidden { opacity: 0.4; }
.q-tpl-custom-badge {
  font-size: 9px; padding: 1px 5px; border-radius: 3px;
  background: var(--primary-dim); color: var(--primary);
  font-weight: 700; letter-spacing: .04em; display: inline-block;
  margin-bottom: 3px;
}
