/* ── 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:      40px;
  --nav-h:        48px;
  --header-total: 88px;
  --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 ── */
.nav-bar {
  position: fixed; top: var(--brand-h); left: 0; right: 0; z-index: 99;
  height: var(--nav-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 ── */
.page-content {
  margin-top: var(--header-total);
  padding: 24px 28px;
  max-width: 1280px;
}
.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 {
  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); }

/* ── Responsive ── */
@media (max-width: 900px) {
  .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; }
}
