/* ============ Partogramme — styles ============ */

:root {
  --teal: #0d9488;
  --teal-dark: #0f766e;
  --teal-soft: #ccfbf1;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --border: #e2e8f0;
  --surface: #ffffff;
  --bg: #f1f5f9;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

h1 { font-size: 1.15rem; margin: 0; }
h2 { font-size: 1rem; margin: 0 0 12px; }
h3 { font-size: 0.85rem; margin: 0 0 10px; color: var(--ink-2); }

/* ---------- barre du haut ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 38px; height: 38px;
  background: var(--teal);
  color: #fff;
  border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 700;
}
.brand p { margin: 2px 0 0; font-size: 0.78rem; color: var(--muted); }

/* ---------- boutons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: none; border-radius: 8px;
  padding: 9px 16px;
  font-size: 0.88rem; font-weight: 600;
  cursor: pointer;
}
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-outline { background: var(--surface); color: var(--ink-2); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--teal); color: var(--teal); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--ink); }
.icon-btn {
  background: none; border: none; cursor: pointer;
  color: #94a3b8; padding: 6px; border-radius: 6px;
  display: inline-grid; place-items: center;
}
.icon-btn:hover { background: var(--bg); color: var(--teal); }
.icon-btn.danger:hover { color: var(--danger); }

/* ---------- onglets ---------- */
.tabs {
  display: flex; gap: 4px;
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.tab {
  appearance: none; background: none; border: none;
  padding: 14px 18px;
  font-size: 0.9rem; font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--teal); border-bottom-color: var(--teal); font-weight: 600; }

/* ---------- mise en page ---------- */
main { padding: 22px 28px 48px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

#tab-suivi.active {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 1000px) {
  #tab-suivi.active { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.suivi-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* ---------- colonne de gauche ---------- */
.field-label {
  display: block;
  font-size: 0.78rem; font-weight: 600;
  color: var(--muted);
  margin: 14px 0 6px;
}
select, input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
}
select:focus, input:focus { outline: 2px solid var(--teal-soft); border-color: var(--teal); }

.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.badge {
  font-size: 0.75rem; font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}
.badge-blood  { background: #fee2e2; color: #b91c1c; }
.badge-neutral{ background: var(--bg); color: var(--ink-2); }
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-amber  { background: #fef3c7; color: #b45309; }

.team { margin-top: 26px; }
.team ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.team li { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  color: #fff;
  display: grid; place-items: center;
  font-size: 0.72rem; font-weight: 700;
  flex-shrink: 0;
}
.team .who { line-height: 1.25; }
.team .who .name { display: block; font-size: 0.85rem; font-weight: 600; }
.team .who .role { display: block; font-size: 0.74rem; color: var(--muted); }

/* ---------- indicateurs ---------- */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi-label { font-size: 0.8rem; color: var(--muted); }
.kpi-value { font-size: 1.7rem; font-weight: 700; }
.kpi-sub { font-size: 0.8rem; color: var(--teal); font-weight: 600; }
.kpi-sub.plain { color: var(--muted); font-weight: 400; }

/* ---------- graphique ---------- */
.chart-head {
  display: flex; justify-content: space-between; align-items: baseline;
  flex-wrap: wrap; gap: 8px;
}
.chart-head h2 { margin: 0; font-size: 1.05rem; }
.chart-hint { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; }
.key-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--teal); display: inline-block; }
.key-label { color: var(--ink-2); font-weight: 600; }
.hint-muted { color: #94a3b8; }

.chart-wrap { position: relative; margin-top: 10px; }
.chart-wrap svg { display: block; width: 100%; height: auto; }
.chart-empty { padding: 48px 0; text-align: center; color: var(--muted); font-size: 0.9rem; }

.tooltip {
  position: absolute;
  pointer-events: none;
  background: #1e293b;
  color: #f8fafc;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.78rem;
  line-height: 1.45;
  max-width: 240px;
  z-index: 5;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
}
.tooltip .t-main { font-weight: 700; font-size: 0.85rem; }
.tooltip .t-sub { color: #cbd5e1; }
.tooltip .t-note { color: #94a3b8; }

/* ---------- tableaux ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.table th {
  text-align: left;
  font-size: 0.76rem; font-weight: 600;
  color: var(--muted);
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
}
.table td { padding: 12px 10px; border-bottom: 1px solid var(--border); }
.table tbody tr:last-child td { border-bottom: none; }
.table .center { text-align: center; }
.table .muted { color: #94a3b8; }
.table .num { font-variant-numeric: tabular-nums; }

.dil-cell { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.dil-bar {
  width: 90px; height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}
.dil-bar span { display: block; height: 100%; background: var(--teal); border-radius: 3px; }

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.75rem; font-weight: 700;
  background: #e0e7ff; color: #4338ca;
}

.exams-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.exams-head h2 { margin: 0; font-size: 1.05rem; }

/* ---------- formulaire d'examen ---------- */
.exam-form { border-top: 1px dashed var(--border); margin-top: 4px; padding-top: 16px; }
.exam-form.hidden, .hidden { display: none !important; }
.exam-form-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.6fr 0.9fr 1.6fr auto;
  gap: 12px;
  align-items: end;
}
@media (max-width: 1200px) { .exam-form-grid { grid-template-columns: 1fr 1fr; } }
.field label {
  display: block;
  font-size: 0.76rem; font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
}
.field.actions { display: flex; gap: 8px; }

/* ---------- onglets liste ---------- */
.list-card { max-width: 1200px; }
.list-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.list-head h2 { margin: 0; font-size: 1.05rem; }
.table .avatar-sm {
  width: 26px; height: 26px; font-size: 0.62rem; border-radius: 50%;
  display: inline-grid; place-items: center; color: #fff; font-weight: 700;
  vertical-align: middle; margin-right: 8px;
}
.empty-state { padding: 28px 0; text-align: center; color: var(--muted); font-size: 0.9rem; }

/* ---------- modale ---------- */
dialog#modal {
  border: none; border-radius: 14px;
  padding: 0;
  width: min(560px, calc(100vw - 40px));
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.3);
}
dialog#modal::backdrop { background: rgba(15, 23, 42, 0.45); }
#modal form { padding: 24px; }
#modal h2 { font-size: 1.1rem; margin-bottom: 18px; }
#modal .field { margin-bottom: 14px; }
#modal .two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checkbox-field { display: flex; align-items: center; gap: 10px; }
.checkbox-field input { width: auto; }
.checkbox-field label { margin: 0; font-size: 0.9rem; font-weight: 500; color: var(--ink-2); }
.form-error {
  background: #fef2f2; color: #b91c1c;
  border-radius: 8px; padding: 10px 12px;
  font-size: 0.84rem;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: #1e293b; color: #f8fafc;
  padding: 11px 20px; border-radius: 10px;
  font-size: 0.88rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.3);
  z-index: 50;
}
.toast.error { background: #b91c1c; }
