*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --primary: #0d6e6e;
  --primary-dark: #0a5555;
  --accent: #2563eb;
  --warn: #d97706;
  --danger: #dc2626;
  --ok: #059669;
  --border: #e2e8f0;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(15, 23, 42, .08);
  --focus: 0 0 0 3px rgba(13, 110, 110, .35);
}

html { scroll-behavior: smooth; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--primary);
  color: #fff;
  padding: .5rem 1rem;
  z-index: 999;
}
.skip-link:focus { left: 0; }

/* Header */
.hdr {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.hdr-in {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.logo-mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: .85rem;
  font-weight: 800;
}
.logo-sub { font-size: .65rem; color: var(--muted); font-weight: 500; letter-spacing: .04em; }
nav { display: flex; gap: .25rem; margin-left: auto; flex-wrap: wrap; }
nav a {
  padding: .35rem .7rem;
  font-size: .88rem;
  color: var(--muted);
  border-radius: 6px;
  text-decoration: none;
}
nav a:hover, nav a.active { color: var(--primary); background: #ecfdf5; text-decoration: none; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.1rem;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; color: #fff; }
.btn-ghost { background: transparent; color: var(--primary); border: 1.5px solid var(--border); }
.btn-ghost:hover { border-color: var(--primary); text-decoration: none; }

/* Banner demo */
.demo-banner {
  background: #fef3c7;
  border-bottom: 1px solid #fcd34d;
  padding: .55rem 1.25rem;
  text-align: center;
  font-size: .82rem;
  color: #92400e;
}

/* Hero */
.hero {
  background: linear-gradient(160deg, #0a4f4f 0%, #0d6e6e 40%, #1e40af 100%);
  color: #fff;
  padding: 3.5rem 1.25rem 4rem;
}
.hero-in {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: center;
}
.hero h1 { font-size: clamp(1.8rem, 3vw, 2.6rem); line-height: 1.2; margin-bottom: 1rem; }
.hero-lead { font-size: 1.05rem; opacity: .92; margin-bottom: 1.5rem; max-width: 34rem; }
.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; }
.hero .btn-primary { background: #fff; color: var(--primary); }
.hero .btn-ghost { border-color: rgba(255,255,255,.4); color: #fff; }
.hero-card {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius);
  padding: 1.5rem;
  backdrop-filter: blur(8px);
}
.hero-card h2 { font-size: 1rem; margin-bottom: .75rem; }
.hero-stat { display: flex; justify-content: space-between; padding: .45rem 0; border-bottom: 1px solid rgba(255,255,255,.15); font-size: .88rem; }
.hero-stat:last-child { border: none; }
.hero-stat strong { color: #fcd34d; }

/* Sections */
.section { padding: 3.5rem 1.25rem; }
.section-in { max-width: 1200px; margin: 0 auto; }
.section h2 { font-size: 1.6rem; margin-bottom: .5rem; }
.section-sub { color: var(--muted); margin-bottom: 2rem; max-width: 40rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.card h3 { font-size: .95rem; margin-bottom: .4rem; }
.card p { font-size: .85rem; color: var(--muted); }
.card-icon {
  width: 40px; height: 40px;
  border-radius: 8px;
  display: grid; place-items: center;
  margin-bottom: .75rem;
  font-size: 1.1rem;
}
.card-icon.teal { background: #ccfbf1; }
.card-icon.blue { background: #dbeafe; }
.card-icon.amber { background: #fef3c7; }
.card-icon.rose { background: #ffe4e6; }

.principle {
  background: #ecfdf5;
  border-left: 4px solid var(--primary);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 2rem 0;
  font-size: .92rem;
}

/* Demo app shell */
.app-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.5rem;
}
.sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  height: fit-content;
  position: sticky;
  top: 76px;
}
.sidebar a {
  display: block;
  padding: .5rem .65rem;
  border-radius: 6px;
  color: var(--muted);
  font-size: .85rem;
  text-decoration: none;
  margin-bottom: .15rem;
}
.sidebar a:hover, .sidebar a.active { background: #ecfdf5; color: var(--primary); text-decoration: none; }
.main-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  min-height: 420px;
}

/* Form wizard */
.steps { display: flex; gap: .5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.step-dot {
  padding: .3rem .65rem;
  border-radius: 999px;
  font-size: .75rem;
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
}
.step-dot.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.step-dot.done { background: #ecfdf5; color: var(--ok); border-color: #6ee7b7; }

.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .35rem; }
.form-group .hint { font-size: .78rem; color: var(--muted); margin-top: .25rem; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: .55rem .75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  font-size: .9rem;
}
.form-group textarea { min-height: 100px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; gap: .75rem; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }

.alert {
  padding: .85rem 1rem;
  border-radius: 8px;
  font-size: .88rem;
  margin-bottom: 1rem;
}
.alert-warn { background: #fef3c7; border: 1px solid #fcd34d; color: #92400e; }
.alert-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.alert-ok { background: #ecfdf5; border: 1px solid #6ee7b7; color: #065f46; }

/* Dashboard */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.kpi {
  background: var(--bg);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}
.kpi-val { font-size: 1.75rem; font-weight: 800; color: var(--primary); }
.kpi-lbl { font-size: .75rem; color: var(--muted); margin-top: .2rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th, td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--bg); font-weight: 600; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
.badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
}
.badge-open { background: #dbeafe; color: #1d4ed8; }
.badge-progress { background: #fef3c7; color: #b45309; }
.badge-closed { background: #d1fae5; color: #047857; }
.badge-high { background: #fee2e2; color: #b91c1c; }

.hidden { display: none !important; }

/* ── Maquettes ── */
.mock-layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.25rem;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.25rem;
  align-items: start;
}
.mock-nav {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem;
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
}
.mock-nav h2 {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  padding: .5rem .65rem .25rem;
}
.mock-nav button {
  display: block;
  width: 100%;
  text-align: left;
  padding: .45rem .65rem;
  border: none;
  background: transparent;
  border-radius: 6px;
  font: inherit;
  font-size: .82rem;
  color: var(--muted);
  cursor: pointer;
}
.mock-nav button:hover,
.mock-nav button.active {
  background: #ecfdf5;
  color: var(--primary);
}
.mock-nav button .mock-tag {
  display: block;
  font-size: .68rem;
  color: var(--muted);
  margin-top: .1rem;
}
.mock-stage {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.mock-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: .82rem;
}
.mock-toolbar label { font-weight: 600; color: var(--muted); }
.mock-toolbar select {
  padding: .35rem .6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  font-size: .82rem;
}
.mock-meta {
  margin-left: auto;
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.mock-screen { display: none; padding: 1.25rem; }
.mock-screen.active { display: block; }
.mock-screen-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.mock-screen-header h1 { font-size: 1.25rem; }
.mock-ref {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--primary);
  background: #ecfdf5;
  padding: .2rem .55rem;
  border-radius: 999px;
  display: inline-block;
  margin-bottom: .35rem;
}
.mock-sub { color: var(--muted); font-size: .85rem; margin-top: .25rem; }

/* Tabs dossier incident */
.tabs {
  display: flex;
  gap: .25rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.tab {
  padding: .5rem .85rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: default;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab.disabled { opacity: .45; }

/* Timeline chronologie */
.timeline {
  position: relative;
  padding-left: 1.5rem;
  border-left: 2px solid var(--border);
  margin: 1rem 0;
}
.timeline-item {
  position: relative;
  padding-bottom: 1.1rem;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.65rem;
  top: .35rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px var(--primary);
}
.timeline-time {
  font-size: .75rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: .15rem;
}
.timeline-body { font-size: .88rem; }
.timeline-source {
  font-size: .72rem;
  color: var(--muted);
  margin-top: .2rem;
}

/* Grille ALARM */
.alarm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem;
  margin: 1rem 0;
}
.alarm-cat {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .85rem;
  background: var(--bg);
}
.alarm-cat h4 {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted);
  margin-bottom: .5rem;
}
.alarm-cat ul {
  list-style: none;
  font-size: .82rem;
}
.alarm-cat li {
  padding: .25rem 0;
  display: flex;
  align-items: flex-start;
  gap: .35rem;
}
.alarm-cat li::before {
  content: "○";
  color: var(--primary);
  font-size: .7rem;
  margin-top: .15rem;
}
.alarm-cat li.checked::before { content: "●"; }
.alarm-cat li.checked { font-weight: 600; color: var(--text); }

/* Barrières */
.barrier-list { display: flex; flex-direction: column; gap: .5rem; margin: 1rem 0; }
.barrier {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .75rem;
  align-items: center;
  padding: .65rem .85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .85rem;
}
.barrier-ok { border-left: 3px solid var(--ok); }
.barrier-fail { border-left: 3px solid var(--danger); }
.barrier-miss { border-left: 3px solid var(--warn); }

/* Recommandations */
.reco-list { display: flex; flex-direction: column; gap: .75rem; }
.reco {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  background: #fafafa;
}
.reco-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin-bottom: .5rem;
}
.reco-actions { display: flex; gap: .5rem; margin-top: .75rem; flex-wrap: wrap; }
.btn-sm {
  padding: .35rem .7rem;
  font-size: .78rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: default;
  font-weight: 600;
}
.btn-sm-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-sm-ghost { color: var(--muted); }

/* Actions détaillées */
.action-detail {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: .75rem;
}
.action-detail header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .65rem;
}
.action-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: .8rem;
  color: var(--muted);
}
.progress-bar {
  height: 6px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  margin-top: .75rem;
}
.progress-bar span {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
}

/* Source tags */
.source-tag {
  display: inline-block;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: .15rem .45rem;
  border-radius: 4px;
}
.source-fact { background: #dbeafe; color: #1d4ed8; }
.source-reported { background: #fef3c7; color: #92400e; }
.source-patient { background: #fce7f3; color: #9d174d; }
.source-hypothesis { background: #f3e8ff; color: #6b21a8; }
.source-proposal { background: #ecfdf5; color: #047857; }

/* Heatmap mock */
.heatmap-wrap { overflow-x: auto; margin: 1rem 0; }
.heatmap {
  display: grid;
  grid-template-columns: 80px repeat(8, 1fr);
  gap: 2px;
  font-size: .68rem;
  min-width: 520px;
}
.heatmap .hm-label {
  padding: .35rem;
  color: var(--muted);
  font-weight: 600;
  display: flex;
  align-items: center;
}
.heatmap .hm-head {
  text-align: center;
  padding: .35rem .2rem;
  color: var(--muted);
  font-weight: 600;
}
.heatmap .hm-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
  min-height: 32px;
}
.hm-0 { background: #e2e8f0; color: var(--muted); }
.hm-1 { background: #99f6e4; color: #065f46; }
.hm-2 { background: #2dd4bf; }
.hm-3 { background: #0d9488; }
.hm-4 { background: #0f766e; }
.hm-masked { background: repeating-linear-gradient(45deg, #f1f5f9, #f1f5f9 4px, #e2e8f0 4px, #e2e8f0 8px); color: var(--muted); font-size: .6rem; }

/* Portail patient */
.patient-shell {
  max-width: 520px;
  margin: 0 auto;
  border: 2px solid #fce7f3;
  border-radius: var(--radius);
  overflow: hidden;
}
.patient-header {
  background: linear-gradient(135deg, #831843, #be185d);
  color: #fff;
  padding: 1.25rem;
  text-align: center;
}
.patient-body { padding: 1.25rem; background: #fff; }
.patient-warning {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: .85rem;
  border-radius: 8px;
  font-size: .85rem;
  margin-bottom: 1rem;
}

/* Saisie vocale */
.voice-panel {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  background: var(--bg);
}
.voice-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 1.75rem;
  cursor: default;
  margin: 0 auto 1rem;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 16px rgba(13, 110, 110, .35);
}
.voice-transcript {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  font-size: .88rem;
  margin-top: 1rem;
}
.voice-transcript .uncertain {
  background: #fef3c7;
  padding: 0 .15rem;
  border-radius: 2px;
}

/* Split layout */
.split-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.split-sidebar {
  background: var(--bg);
  border-radius: 8px;
  padding: 1rem;
  font-size: .85rem;
}
.split-sidebar dt {
  font-weight: 700;
  font-size: .72rem;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: .65rem;
}
.split-sidebar dt:first-child { margin-top: 0; }
.split-sidebar dd { margin: .15rem 0 0; }

/* Admin table compact */
.compact-table td, .compact-table th { padding: .45rem .6rem; font-size: .8rem; }

@media (max-width: 900px) {
  .mock-layout { grid-template-columns: 1fr; }
  .mock-nav { position: static; max-height: none; }
  .split-2 { grid-template-columns: 1fr; }
}

.footer {
  background: var(--text);
  color: #94a3b8;
  padding: 2rem 1.25rem;
  font-size: .82rem;
}
.footer-in { max-width: 1200px; margin: 0 auto; }
.footer strong { color: #e2e8f0; }

@media (max-width: 768px) {
  .hero-in { grid-template-columns: 1fr; }
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .form-row { grid-template-columns: 1fr; }
  nav { display: none; }
}
