:root {
  --c1: #d9ed92;
  --c2: #b5e48c;
  --c3: #99d98c;
  --c4: #76c893;
  --c5: #52b69a;
  --c6: #34a0a4;
  --c7: #168aad;
  --c8: #1a759f;
  --c9: #1e6091;
  --c10: #184e77;
  --c11: #ff0000;
  --bg: #f7faf7;
  --ink: #0f172a;
  --muted: #475569;
  --card: #ffffff;
  --border: #e2e8f0;
  --focus: #1a759f;
  --trans: rgba(217, 237, 146, 0.3);
  --foot: rgba(183, 194, 161, 0.3);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font: 14px/1.55 system-ui, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

header {
  position: sticky;
  top: 0;
  background: linear-gradient(90deg, var(--c2), var(--c4));
  color: var(--c8);
  padding: 14px 16px;
  z-index: 10;
}

.header-center {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1rem;
}

header h1 {
  margin: 0;
  font-size: 22px;
}

header p {
  margin: 4px 0 0 0;
  opacity: .95;
}

main {
  max-width: 1200px;
  margin: 20px auto 96px;
  padding: 0 16px;
}

nav.steps {
  position: sticky;
  top: 30px;
  background: var(--trans);
  border: 1px solid var(--border);
  backdrop-filter: blur(1px);
  border-radius: 999px;
  box-shadow: 1px 3px 6px #888888;
  padding: 8px;
  display: flex;
  gap: 29px;
  flex-wrap: wrap;
  z-index: 5;
}

.stepchip {
  padding: 6px 12px;
  margin-left: 20px;
  border-radius: 999px;
  border: 1px solid var(--border);
  box-shadow: 1px 2px 6px var(--c3);
  background: #fff;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease-in-out;
}

.stepchip:hover {
  transform: translateY(-2px);
  background-color: var(--c1);
  box-shadow: 1px 4px 8px var(--c3);
}

.stepchip.active {
  background: var(--c2);
  border-color: var(--c3);
  font-weight: 700;
}

.container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 14px;
  margin-bottom: 40px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}

h2 {
  margin: 0 0 8px;
}

fieldset {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 12px;
  margin: 0 0 12px;
}

legend {
  padding: 0 6px;
  font-weight: 700;
  color: var(--c10);
}

label {
  display: block;
  margin: .55rem 0 .25rem;
  font-weight: 600;
}

input[type="text"],
input[type="number"],
input[type="datetime-local"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.row > * {
  flex: 1 1 240px;
}

.hint {
  font-size: .9rem;
  color: var(--muted);
  margin-top: 2px;
}

.chipset {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff;
}

.chip input {
  accent-color: var(--c7);
}

.toolbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  text-align: center;
  background: var(--foot);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(6px);
  padding: 10px 12px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  z-index: 20;
}

button {
  border: 1px solid var(--border);
  background: linear-gradient(#fff, #f7faf7);
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}

button.primary {
  background: linear-gradient(var(--c3), var(--c2));
  border-color: var(--c3);
}

.danger {
  color: #b91c1c;
}

.ok {
  color: #0f766e;
  font-weight: 600;
}

.pill {
  display: inline-block;
  background: var(--c1);
  border: 1px solid var(--c3);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .85rem;
}

.required::after {
  content: " *";
  color: #b91c1c;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.item .title {
  font-weight: 700;
}

.item .meta {
  color: var(--muted);
  font-size: .9rem;
}

.actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.tag {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  margin-right: 6px;
}

.preview {
  background: linear-gradient(180deg, #fff, #f8fffb);
  border: 1px solid var(--c3);
  border-radius: 12px;
  padding: 12px;
}

.kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0 6px;
}

.notice {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  padding: 10px;
  border-radius: 10px;
}

#toTopBtn {
  display: none;
  position: fixed;
  bottom: 60px;
  right: 30px;
  z-index: 99;
  font-size: 18px;
  outline: none;
  background: var(--c7);
  color: white;
  cursor: pointer;
  padding: 15px;
  border-radius: 50%;
  box-shadow: 1px 2px 6px var(--c3);
}

#toTopBtn:hover {
  background: var(--c8);
}

@media print {
  nav.steps,
  .toolbar {
    display: none;
  }
  body {
    background: #fff;
  }
  .card {
    box-shadow: none;
    break-inside: avoid;
  }
}

:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.abcde {
  background: linear-gradient(180deg, #fff, #f8fffb);
  border: 1px solid var(--c11);
  border-radius: 12px;
  padding: 12px;
}

#s1_airway, #s1_ademfrequentie, #s1_adempatroon, #s1_ademdiepte, #s1_huidskleur, #s1_huidskleur, #s1_circulation, #s1_disability, #s1_exposure {
  width: 240px;
  font-size: 11px;
}

.row-abcde {
  gap: 40px;
}

.row-abcde > * {
  flex-basis: auto;
  flex-grow: 0;
}

.alert {
  color: #b91c1c;
  font-style: italic;
  font-size: 11px;
}

.klachten {
  color: #34a0a4;
}

/* Modal styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal[hidden] {
  display: none;
}

.modal-content {
  background: var(--card);
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  color: var(--c8);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  width: 30px;
  height: 30px;
}

.modal-close:hover {
  color: var(--ink);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-body label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.modal-body input,
.modal-body textarea,
.modal-body select {
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
}

.modal-body textarea {
  min-height: 80px;
  resize: vertical;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.modal-footer button {
  padding: 0.5rem 1rem;
}

.error-message {
  color: #dc2626;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Gradient achtergronden voor fieldsets in stap 1 */
.fieldset-client {
  background: linear-gradient(135deg, rgba(217, 237, 146, 0.15), rgba(181, 228, 140, 0.1));
  border-color: var(--c1);
}

.fieldset-aanmelding {
  background: linear-gradient(135deg, rgba(153, 217, 140, 0.15), rgba(118, 200, 147, 0.1));
  border-color: var(--c3);
}

.fieldset-baseline {
  background: linear-gradient(135deg, rgba(82, 182, 154, 0.15), rgba(52, 160, 164, 0.1));
  border-color: var(--c5);
}

.fieldset-risicos {
  background: linear-gradient(135deg, rgba(22, 138, 173, 0.15), rgba(26, 117, 159, 0.1));
  border-color: var(--c7);
}

.fieldset-betrokkenen {
  background: linear-gradient(135deg, rgba(30, 96, 145, 0.15), rgba(24, 78, 119, 0.1));
  border-color: var(--c9);
}

/* Gradient achtergronden voor fieldsets in stap 2 */
.fieldset-anamnese {
  background: linear-gradient(135deg, rgba(181, 228, 140, 0.15), rgba(153, 217, 140, 0.1));
  border-color: var(--c2);
}

.fieldset-vitale {
  background: linear-gradient(135deg, rgba(118, 200, 147, 0.15), rgba(82, 182, 154, 0.1));
  border-color: var(--c4);
}

.fieldset-meetinstrumenten {
  background: linear-gradient(135deg, rgba(52, 160, 164, 0.15), rgba(22, 138, 173, 0.1));
  border-color: var(--c6);
}

.fieldset-lab {
  background: linear-gradient(135deg, rgba(26, 117, 159, 0.15), rgba(30, 96, 145, 0.1));
  border-color: var(--c8);
}

/* Gradient achtergronden voor fieldsets in stap 3 */
.fieldset-diagnose {
  background: linear-gradient(135deg, rgba(153, 217, 140, 0.15), rgba(118, 200, 147, 0.1));
  border-color: var(--c3);
}

/* Gradient achtergronden voor fieldsets in stap 4 */
.fieldset-doelen {
  background: linear-gradient(135deg, rgba(82, 182, 154, 0.15), rgba(52, 160, 164, 0.1));
  border-color: var(--c5);
}

/* Gradient achtergronden voor fieldsets in stap 5 */
.fieldset-interventies {
  background: linear-gradient(135deg, rgba(22, 138, 173, 0.15), rgba(26, 117, 159, 0.1));
  border-color: var(--c7);
}

/* Gradient achtergronden voor fieldsets in stap 6 */
.fieldset-evaluatie {
  background: linear-gradient(135deg, rgba(30, 96, 145, 0.15), rgba(24, 78, 119, 0.1));
  border-color: var(--c9);
}

.fieldset-sbar {
  background: linear-gradient(135deg, rgba(217, 237, 146, 0.1), rgba(181, 228, 140, 0.08));
  border-color: var(--c2);
}

.fieldset-opmerkingen {
  background: linear-gradient(135deg, rgba(118, 200, 147, 0.1), rgba(82, 182, 154, 0.08));
  border-color: var(--c4);
}

/* Gender toggle switch styles */
.gender-toggle-container {
  flex: 0 0 auto;
  min-width: 150px;
}

.gender-toggle {
  position: relative;
  display: inline-flex;
  background: var(--border);
  border-radius: 20px;
  padding: 2px;
  width: 120px;
  height: 34px;
  margin-top: 4px;
}

.gender-toggle input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.gender-toggle label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: color 0.3s;
  font-weight: 500;
  color: var(--muted);
  font-size: 13px;
}

.toggle-slider {
  position: absolute;
  width: calc(50% - 2px);
  height: calc(100% - 4px);
  background: white;
  border-radius: 18px;
  top: 2px;
  left: 2px;
  transition: transform 0.3s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#gender-vrouw:checked ~ .toggle-slider {
  transform: translateX(calc(100% + 2px));
}

#gender-man:checked ~ .toggle-label-man,
#gender-vrouw:checked ~ .toggle-label-vrouw {
  color: var(--c7);
  font-weight: 600;
}

/* Initialen container met titel prefix */
.initialen-container {
  display: flex;
  align-items: center;
  gap: 2px;
}

.titel-prefix {
  font-weight: 600;
  color: var(--c7);
  font-size: 13px;
  min-width: 60px;
}

.initialen-container input {
  flex: 1;
}

/* Compactere input velden voor specifieke elementen */
.compact-field {
  max-width: 200px;
}

.compact-field-small {
  max-width: 120px;
}

.compact-field-medium {
  max-width: 250px;
}

/* Specifieke veld breedtes en flex behavior */
#s1_leeftijd {
  max-width: 90px;
  font-size: 12px;
}

#s1_taal {
  max-width: 140px;
  font-size: 12px;
}

#s1_initialen {
  max-width: 200px;
  font-size: 12px;
}

#s1_setting {
  max-width: 170px;
}

#s1_datumtijd {
  max-width: 200px;
}

/* Aangepaste flex voor parent containers van compacte velden */
.field-compact {
  flex: 0 0 auto;
}

.field-compact-small {
  flex: 0 0 auto;
  min-width: 120px;
}

.field-compact-medium {
  flex: 0 0 auto;
  min-width: 180px;
}

/* Bibliotheek modal styles */
.modal-large .modal-content {
  max-width: 800px;
  width: 90vw;
}

.bibliotheek-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.casuslijst {
  max-height: 400px;
  overflow-y: auto;
}

.casus-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.casus-item:hover {
  background-color: var(--background-secondary);
  border-color: var(--primary-color);
}

.casus-item.empty {
  text-align: center;
  color: var(--text-muted);
  cursor: default;
  font-style: italic;
}

.casus-item.empty:hover {
  background-color: transparent;
  border-color: var(--border-color);
}

.casus-info {
  flex: 1;
}

.casus-titel {
  font-weight: bold;
  margin-bottom: 0.25rem;
}

.casus-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.casus-actions {
  display: flex;
  gap: 0.5rem;
}

.casus-actions button {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border: 1px solid var(--border-color);
  background: white;
  border-radius: 4px;
  cursor: pointer;
}

.casus-actions button:hover {
  background-color: var(--background-secondary);
}

.casus-actions .delete-btn {
  color: var(--danger-color);
  border-color: var(--danger-color);
}

.casus-actions .delete-btn:hover {
  background-color: var(--danger-color);
  color: white;
}

/* Suggestion styles */
.suggestions-container {
  margin-bottom: 1rem;
  padding: 1rem;
  background-color: var(--background-secondary);
  border: 1px solid var(--primary-color);
  border-radius: 8px;
}

.suggestion-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  transition: all 0.2s ease;
}

.suggestion-item:hover {
  border-color: var(--primary-color);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.suggestion-item:last-child {
  margin-bottom: 0;
}

.suggestion-content {
  flex: 1;
  margin-right: 1rem;
}

.suggestion-content strong {
  color: var(--primary-color);
  display: block;
  margin-bottom: 0.25rem;
}

.suggestion-rationale {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
  line-height: 1.4;
}

.suggestion-confidence {
  font-size: 0.75rem;
  font-weight: bold;
  color: var(--success-color);
}

.suggestion-add-btn {
  padding: 0.5rem 1rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: bold;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}

.suggestion-add-btn:hover {
  background-color: var(--primary-hover);
}

/* Warning styles */
.warnings-container {
  margin-bottom: 1rem;
  padding: 1rem;
  background-color: #fff8f8;
  border: 1px solid var(--danger-color);
  border-radius: 8px;
}

.warning-item {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  background: white;
  border: 1px solid #ffcdd2;
  border-radius: 6px;
  gap: 0.75rem;
}

.warning-item:last-of-type {
  margin-bottom: 0;
}

.warning-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.warning-text {
  flex: 1;
  font-weight: bold;
  color: var(--danger-color);
}

.warning-value {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: normal;
}

.warning-hint {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  font-style: italic;
  color: var(--text-muted);
  text-align: center;
}