/* ============================================================
   Bridge Medical Group — demo
   Stijl: "clinical control room" — warm papier, diep petrol,
   signaalrood alleen voor trauma/achterstand.
   ============================================================ */

:root {
  --papier: #f4f1ea;
  --papier-2: #ece8de;
  --kaart: #fffdf8;
  --inkt: #182423;
  --inkt-zacht: #5c6b68;
  --lijn: #ddd6c8;
  --petrol: #0d3b38;
  --petrol-2: #135f58;
  --petrol-3: #1b7f74;
  --mint: #e3efe9;
  --rood: #d6453c;
  --rood-zacht: #fbe9e7;
  --amber: #e8a13a;
  --amber-zacht: #fdf3e0;
  --groen: #2e8b57;
  --groen-zacht: #e4f2e9;
  --blauw: #33658a;
  --blauw-zacht: #e6eef4;
  --paars: #7b5ea7;
  --paars-zacht: #efe9f7;
  --radius: 14px;
  --schaduw: 0 1px 2px rgba(24, 36, 35, .06), 0 8px 24px -12px rgba(24, 36, 35, .14);
  --font-display: "Bricolage Grotesque", "Instrument Sans", sans-serif;
  --font-body: "Instrument Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--inkt);
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(27, 127, 116, .07), transparent 60%),
    var(--papier);
}

h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.01em; }
a { color: var(--petrol-2); }

/* ---- Schil ---- */
.shell { display: flex; min-height: 100vh; }
.hoofdkolom { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.inhoud { padding: 26px 30px 10px; flex: 1; }
.voet { padding: 14px 30px 22px; color: var(--inkt-zacht); font-size: 12px; }

/* ---- Sidebar ---- */
.sidebar {
  width: 232px;
  flex-shrink: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,.04), transparent 30%),
    var(--petrol);
  color: #d9e8e2;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex; gap: 11px; align-items: center; justify-content: center;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.09);
}
.brand-logo { display: block; width: 100%; max-width: 106px; height: auto; }
.nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: 9px;
  color: #b9d2c9;
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.is-actief { background: #f4f1ea; color: var(--petrol); font-weight: 600; }
.sidebar-voet {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.09);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.gebruiker { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--petrol-3); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.gebruiker-naam { font-size: 12.5px; line-height: 1.25; color: #e7f1ec; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gebruiker-naam em { font-style: normal; color: #8fb6ab; font-size: 11px; }
.uitloggen { color: #8fb6ab; padding: 6px; border-radius: 8px; }
.uitloggen:hover { background: rgba(255,255,255,.08); color: #fff; }

/* ---- Topbar ---- */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 30px 0;
}
.pagina-titel { margin: 0; font-size: 24px; font-weight: 700; flex: 1; }
.topbar-datum { color: var(--inkt-zacht); font-size: 13px; font-variant-numeric: tabular-nums; }
.menu-knop { display: none; background: none; border: 0; color: var(--inkt); padding: 4px; cursor: pointer; }

/* ---- Flash ---- */
.flash {
  background: var(--groen-zacht); border: 1px solid #bcdcc8; color: #1d5c3a;
  padding: 10px 14px; border-radius: 10px; margin-bottom: 18px; font-weight: 500;
  animation: zweef-in .35s ease both;
}

/* ---- KPI kaarten ---- */
.kpi-rij {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin-bottom: 20px;
}
.kpi {
  background: var(--kaart);
  border: 1px solid var(--lijn);
  border-radius: var(--radius);
  box-shadow: var(--schaduw);
  padding: 16px 18px 14px;
  position: relative;
  overflow: hidden;
  animation: zweef-in .4s ease both;
}
.kpi:nth-child(2) { animation-delay: .05s; }
.kpi:nth-child(3) { animation-delay: .1s; }
.kpi:nth-child(4) { animation-delay: .15s; }
.kpi:nth-child(5) { animation-delay: .2s; }
.kpi::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--petrol-3), transparent 70%);
}
.kpi.k-rood::after { background: linear-gradient(90deg, var(--rood), transparent 70%); }
.kpi.k-amber::after { background: linear-gradient(90deg, var(--amber), transparent 70%); }
.kpi.k-groen::after { background: linear-gradient(90deg, var(--groen), transparent 70%); }
.kpi-label { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--inkt-zacht); font-weight: 600; }
.kpi-waarde {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 800; letter-spacing: -.02em;
  margin: 2px 0 0; line-height: 1.15;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.kpi-vt {
  font-size: 12px; font-weight: 600; letter-spacing: .06em;
  color: var(--inkt-zacht); margin-right: 5px;
  vertical-align: 3px;
}
.kpi-getal-lang { font-size: .78em; }
@media (max-width: 480px) {
  .kpi-waarde { font-size: 24px; }
  .kpi-getal-lang { font-size: .82em; }
}
.kpi-sub { font-size: 12px; color: var(--inkt-zacht); margin-top: 3px; }
.kpi-sub .op { color: var(--groen); font-weight: 600; }
.kpi-sub .neer { color: var(--rood); font-weight: 600; }

/* ---- Kaarten / grid ---- */
.grid { display: grid; gap: 16px; margin-bottom: 18px; }
.grid-2 { grid-template-columns: 3fr 2fr; }
.grid-2b { grid-template-columns: 2fr 3fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.kaart {
  background: var(--kaart);
  border: 1px solid var(--lijn);
  border-radius: var(--radius);
  box-shadow: var(--schaduw);
  padding: 18px 20px;
  min-width: 0;
  animation: zweef-in .45s ease both;
}
.kaart h2 {
  margin: 0 0 4px; font-size: 15.5px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.kaart h2 .puls {
  width: 26px; height: 12px; flex-shrink: 0;
}
.kaart-sub { color: var(--inkt-zacht); font-size: 12px; margin: 0 0 12px; }
.grafiek-houder { position: relative; height: 250px; }
.grafiek-houder.kort { height: 210px; }

/* ---- Tabellen ---- */
.tabel-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table.lijst { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.lijst th {
  text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--inkt-zacht); font-weight: 600;
  padding: 8px 10px; border-bottom: 2px solid var(--lijn);
  white-space: nowrap;
}
table.lijst td {
  padding: 9px 10px; border-bottom: 1px solid #e9e4d8;
  vertical-align: middle;
}
table.lijst tr:hover td { background: #f8f5ee; }
table.lijst td.num, table.lijst th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.lijst .acties { text-align: right; white-space: nowrap; }
.leeg-melding { text-align: center; color: var(--inkt-zacht); padding: 30px 10px !important; }

/* ---- Pills ---- */
.pill {
  display: inline-block; padding: 2.5px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; line-height: 1.5; white-space: nowrap;
}
.pill-groen  { background: var(--groen-zacht);  color: #1d6240; }
.pill-rood   { background: var(--rood-zacht);   color: #a8332c; }
.pill-amber  { background: var(--amber-zacht);  color: #9c6410; }
.pill-petrol { background: var(--mint);         color: var(--petrol-2); }
.pill-blauw  { background: var(--blauw-zacht);  color: var(--blauw); }
.pill-paars  { background: var(--paars-zacht);  color: var(--paars); }
.pill-grijs  { background: #eceae3;             color: #5c6b68; }

/* ---- Knoppen ---- */
.knop {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--petrol-2); color: #fff;
  border: 0; border-radius: 9px;
  padding: 9px 16px; font-size: 13.5px; font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer; text-decoration: none;
  transition: background .15s, transform .1s;
}
.knop:hover { background: var(--petrol-3); }
.knop:active { transform: translateY(1px); }
.knop-licht {
  background: transparent; color: var(--petrol-2);
  border: 1.5px solid var(--petrol-2);
}
.knop-licht:hover { background: var(--mint); }
.knop-rood { background: transparent; border: 0; color: var(--rood); cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.knop-rood:hover { background: var(--rood-zacht); }
.knop-mini { padding: 4px 6px; border-radius: 6px; color: var(--petrol-2); background: transparent; border: 0; cursor: pointer; }
.knop-mini:hover { background: var(--mint); }

/* ---- Werkbalk boven lijsten ---- */
.werkbalk {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  margin-bottom: 16px;
}
.werkbalk .spacer { flex: 1; }
.veld-mini { display: flex; flex-direction: column; gap: 3px; }
.veld-mini label { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--inkt-zacht); font-weight: 600; }

/* ---- Formulieren ---- */
input[type=text], input[type=date], input[type=time], input[type=number],
input[type=password], select, textarea {
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--inkt);
  background: #fff;
  border: 1.5px solid var(--lijn);
  border-radius: 9px;
  padding: 8px 11px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  max-width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--petrol-3);
  box-shadow: 0 0 0 3px rgba(27, 127, 116, .14);
}
textarea { resize: vertical; min-height: 70px; }
.form-grid {
  display: grid; gap: 14px 18px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}
.veld { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.veld label { font-size: 12px; font-weight: 600; color: var(--inkt-zacht); }
.veld-breed { grid-column: 1 / -1; }
.form-sectie {
  grid-column: 1 / -1;
  font-family: var(--font-display);
  font-weight: 700; font-size: 13px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--petrol-2);
  border-bottom: 1px solid var(--lijn);
  padding-bottom: 5px; margin-top: 8px;
  display: flex; align-items: center; gap: 8px;
}
.form-acties { grid-column: 1 / -1; display: flex; gap: 10px; margin-top: 8px; }

/* ---- Login ---- */
.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(900px 480px at 75% -5%, rgba(27,127,116,.16), transparent 55%),
    radial-gradient(700px 420px at 10% 110%, rgba(214,69,60,.07), transparent 55%),
    var(--petrol);
  padding: 20px;
}
.login-omslag { width: 100%; max-width: 400px; }
.login-logo {
  display: block; width: 126px; max-width: 50%; height: auto;
  margin: 0 auto 22px;
  animation: zweef-in .5s ease both;
}
.login-kaart {
  width: 100%;
  background: var(--kaart);
  border-radius: 18px;
  box-shadow: 0 24px 80px -20px rgba(0,0,0,.5);
  padding: 30px 34px 28px;
  animation: zweef-in .5s ease .08s both;
}
.login-kaart h1 { font-size: 21px; margin: 14px 0 2px; }
.login-kaart p.sub { color: var(--inkt-zacht); margin: 0 0 18px; font-size: 13px; }
.login-kaart .veld { margin-bottom: 14px; }
.login-fout {
  background: var(--rood-zacht); color: #a8332c; border: 1px solid #f0c6c2;
  border-radius: 9px; padding: 9px 12px; font-size: 13px; margin-bottom: 14px;
}
.demo-hint {
  margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--lijn);
  font-size: 12px; color: var(--inkt-zacht); text-align: center;
}
.demo-hint code { background: var(--papier-2); padding: 1px 6px; border-radius: 5px; }
.ekg-lijn { margin: 4px 0 0; }

/* ---- AI-adviseur ---- */
.ai-kaart {
  margin-bottom: 18px;
  background:
    radial-gradient(600px 200px at 0% 0%, rgba(27, 127, 116, .10), transparent 60%),
    var(--kaart);
  border-color: #c6dcd2;
}
.ai-kop { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.ai-kop h2 { margin: 0; }
.ai-vonk { color: var(--petrol-3); }
.ai-acties { display: flex; gap: 8px; align-items: center; }
.knop-ai {
  background: linear-gradient(120deg, var(--petrol-2), var(--petrol-3));
  box-shadow: 0 4px 14px -6px rgba(19, 95, 88, .55);
}
.ai-inhoud { font-size: 14px; line-height: 1.55; }
.ai-inhoud p { margin: 0 0 8px; }
.ai-inhoud ul { margin: 4px 0 8px; padding-left: 20px; }
.ai-inhoud li { margin-bottom: 5px; }
.ai-fout { color: var(--rood); font-size: 13px; }
.ai-laden { display: inline-flex; align-items: center; gap: 4px; color: var(--inkt-zacht); font-size: 13px; }
.ai-laden span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--petrol-3);
  animation: ai-stuiter 1.1s ease-in-out infinite;
}
.ai-laden span:nth-child(2) { animation-delay: .15s; }
.ai-laden span:nth-child(3) { animation-delay: .3s; margin-right: 6px; }
@keyframes ai-stuiter {
  0%, 60%, 100% { transform: none; opacity: .45; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ---- AI-chat modal ---- */
body.modal-open { overflow: hidden; }
.modal-achtergrond {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(13, 59, 56, .55);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
}
.modal-achtergrond[hidden] { display: none !important; }
.chat-venster {
  width: 100%; max-width: 460px;
  height: min(640px, 86vh);
  background: var(--kaart);
  border-radius: 18px;
  box-shadow: 0 30px 90px -20px rgba(0, 0, 0, .55);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: zweef-in .25s ease both;
}
.chat-kop {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px;
  background: var(--petrol);
  color: #ecf5f1;
  font-family: var(--font-display); font-weight: 700;
}
.chat-sluit { background: none; border: 0; color: #9fc3b8; font-size: 16px; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.chat-sluit:hover { background: rgba(255,255,255,.1); color: #fff; }
.chat-berichten {
  flex: 1; overflow-y: auto;
  padding: 16px 14px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--papier);
}
.chat-bericht {
  max-width: 86%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13.5px; line-height: 1.5;
  overflow-wrap: break-word;
}
.chat-bericht p { margin: 0 0 6px; }
.chat-bericht p:last-child { margin-bottom: 0; }
.chat-bericht ul { margin: 4px 0; padding-left: 18px; }
.chat-ai {
  align-self: flex-start;
  background: var(--kaart);
  border: 1px solid var(--lijn);
  border-bottom-left-radius: 4px;
}
.chat-gebruiker {
  align-self: flex-end;
  background: var(--petrol-2);
  color: #f0f7f4;
  border-bottom-right-radius: 4px;
}
.chat-invoer {
  display: flex; gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--lijn);
  background: var(--kaart);
}
.chat-invoer input { flex: 1; min-width: 0; }
.chat-invoer .knop { padding: 9px 14px; }
@media (max-width: 600px) {
  .modal-achtergrond { padding: 0; align-items: stretch; }
  .chat-venster { max-width: none; height: 100%; border-radius: 0; }
  .chat-kop { padding-top: max(13px, env(safe-area-inset-top)); }
  .chat-invoer { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}

/* ---- Ambulance-intro op het inlogscherm ---- */
.ambu-baan {
  position: fixed; left: 0; right: 0; top: 50%;
  transform: translateY(-54%);
  pointer-events: none;
  z-index: 30;
  overflow: hidden;
  padding: 40px 0;
}
.ambu {
  width: min(330px, 68vw);
  animation: ambu-rij 2.15s cubic-bezier(.3, .04, .26, 1) .35s both;
  will-change: transform;
}
.ambu-veer { animation: ambu-veer .34s ease-in-out infinite alternate; }
@keyframes ambu-rij {
  from { transform: translateX(calc(-110% - 60px)); }
  to   { transform: translateX(calc(100vw + 35%)); }
}
@keyframes ambu-veer {
  from { transform: translateY(0); }
  to   { transform: translateY(2.5px); }
}
.wiel-spaken {
  animation: wiel-draai .42s linear infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes wiel-draai { to { transform: rotate(360deg); } }
.lamp-rood  { animation: lamp-flits .44s steps(1) infinite; }
.lamp-blauw { animation: lamp-flits .44s steps(1) infinite .22s; }
@keyframes lamp-flits {
  0%, 49%  { opacity: 1; }
  50%, 100% { opacity: .12; }
}

/* De kaart wordt links-naar-rechts onthuld terwijl de ambulance passeert */
.login-intro .login-kaart {
  clip-path: inset(-60px 100% -80px -60px);
  animation: kaart-onthul 1.45s linear .8s forwards;
}
@keyframes kaart-onthul {
  to { clip-path: inset(-60px -60px -80px -60px); }
}
.login-intro .login-logo { animation: zweef-in .45s ease both; }

/* Geen animatie na een mislukte poging of bij verminderde beweging */
.login-direct .ambu-baan { display: none; }
.login-direct .login-kaart { animation: zweef-in .35s ease both; clip-path: none; }
@media (prefers-reduced-motion: reduce) {
  .ambu-baan { display: none; }
  .login-intro .login-kaart { animation: none; clip-path: none; }
}

/* ---- Animaties ---- */
@keyframes zweef-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@keyframes ekg-trek {
  from { stroke-dashoffset: 320; }
  to   { stroke-dashoffset: 0; }
}
.ekg-lijn path {
  stroke-dasharray: 320;
  animation: ekg-trek 2.2s ease-out .2s both;
}

/* ---- Responsief ---- */
@media (max-width: 1100px) {
  .grid-2, .grid-2b, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed; z-index: 50; height: 100vh; left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 0 0 60px rgba(0,0,0,.35);
  }
  .sidebar.open { transform: none; }
  .menu-knop { display: inline-flex; }
  .inhoud { padding: 18px 16px 8px; }
  .topbar { padding: 14px 16px 0; }
  .voet { padding: 12px 16px 18px; }
  .pagina-titel { font-size: 20px; }
}

/* Print: alleen inhoud */
@media print {
  .sidebar, .topbar .menu-knop, .werkbalk .knop, .acties { display: none !important; }
  .inhoud { padding: 0; }
  body { background: #fff; }
}
