:root {
  color-scheme: light;
  --bg: #eef1ec;
  --surface: #fbfcf8;
  --surface-2: #f4f6f1;
  --ink: #17201c;
  --muted: #66736d;
  --line: #d8ded7;
  --brand: #004488;
  --brand-soft: #e1f5fe;
  --ok: #146c52;
  --ok-soft: #dceee7;
  --blue: #225f91;
  --blue-soft: #deebf5;
  --red: #a43d3d;
  --red-soft: #f5dfdf;
  --amber: #87621a;
  --amber-soft: #f4ead1;
  --shadow: 0 20px 60px rgba(21, 30, 26, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

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

button,
select,
input,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) 360px;
  gap: 1px;
  height: 100vh;
  background: var(--line);
}

.conversation,
.workpanel {
  min-width: 0;
  background: var(--surface);
}

h1,
h2,
p {
  margin: 0;
}

.eyebrow,
.safety-box span {
  color: var(--muted);
}

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  outline: none;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 68, 136, 0.14);
}

textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 68, 136, 0.14);
}

.icon-button,
.composer button {
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 750;
}

.panel-section h2 {
  font-size: 14px;
}

.conversation {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  height: 100vh;
  min-height: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 82px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.logo-mark {
  display: grid;
  flex: 0 0 auto;
  width: 104px;
  height: 48px;
  place-items: center;
  border-radius: 6px;
  background: var(--brand);
}

.logo-mark img {
  width: 82px;
  height: auto;
  display: block;
}

.eyebrow {
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar h1 {
  font-size: 20px;
  line-height: 1.12;
  font-weight: 850;
}

.tagline {
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.25;
}

.actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  min-width: 72px;
  min-height: 36px;
  padding: 0 12px;
  background: var(--surface-2);
  color: var(--ink);
  white-space: nowrap;
}

#exportPdfBtn {
  min-width: 112px;
}

.process-flow {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.process-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  align-items: center;
  gap: 14px;
}

.process-step {
  position: relative;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 58px;
  color: var(--muted);
}

.process-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 28px;
  left: calc(100% + 1px);
  width: 13px;
  height: 3px;
  border-radius: 99px;
  background: var(--line);
}

.process-step.done:not(:last-child)::after,
.process-step.active:not(:last-child)::after {
  background: var(--brand);
}

.process-step span {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: white;
  font-size: 20px;
  font-weight: 850;
}

.process-step p {
  min-width: 0;
  font-size: 18px;
  font-weight: 850;
  line-height: 1.18;
}

.process-step.active {
  color: var(--brand);
}

.process-step.active span {
  border-color: var(--brand);
  background: var(--brand);
  color: white;
}

.process-step.done {
  color: var(--brand);
}

.process-step.done span {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
}

.message {
  display: grid;
  gap: 8px;
  max-width: min(760px, 92%);
}

.message.user {
  align-self: flex-end;
}

.message.assistant {
  align-self: flex-start;
}

.bubble {
  padding: 14px 16px;
  border-radius: 8px;
  line-height: 1.52;
  box-shadow: 0 10px 28px rgba(21, 30, 26, 0.06);
}

.user .bubble {
  background: var(--brand);
  color: white;
}

.assistant .bubble {
  border: 1px solid var(--line);
  background: white;
  max-width: 68ch;
  line-height: 1.65;
  padding: 18px 22px;
  overflow-wrap: anywhere;
}

.assistant .bubble p + p {
  margin-top: 0.9em;
}

.assistant .bubble > br {
  display: block;
  content: "";
  margin-top: 0.9em;
}

.thought-bubble {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 178px;
  border-style: dashed;
  background: var(--surface-2);
  color: var(--muted);
}

.thought-label {
  font-size: 14px;
  font-weight: 750;
}

.typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: var(--brand);
  animation: dotPulse 1s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes dotPulse {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.speaker {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.message.user .speaker {
  justify-self: end;
}

.bubble strong {
  font-weight: 850;
}

.bubble h3,
.bubble h4,
.bubble h5,
.bubble h6 {
  margin: 12px 0 7px;
  color: var(--ink);
  font-weight: 850;
  line-height: 1.22;
}

.bubble h3 {
  font-size: 18px;
}

.bubble h4 {
  font-size: 16px;
}

.bubble h5 {
  font-size: 15px;
}

.bubble h6 {
  font-size: 15px;
}

.bubble h3:first-child,
.bubble h4:first-child,
.bubble h5:first-child,
.bubble h6:first-child {
  margin-top: 0;
}

.bubble .sources-heading {
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
  font-weight: 700;
}

.bubble ul,
.bubble ol {
  margin: 8px 0 0 20px;
  padding: 0;
}

.bubble .sources-list {
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
  line-height: 1.42;
}

.bubble .sources-list strong {
  font-style: italic;
}

.bubble li {
  margin: 4px 0;
}

.composer {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 18px 24px 22px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.composer textarea {
  min-height: 76px;
  max-height: 180px;
  resize: vertical;
  padding: 13px 14px;
  line-height: 1.45;
}

.composer-actions {
  display: flex;
  gap: 8px;
  align-self: end;
}

.composer button {
  min-height: 52px;
  background: var(--brand);
  color: white;
}

.composer button[type="submit"] {
  min-width: 88px;
  padding: 0 18px;
}

.mic-button {
  display: inline-grid;
  width: 52px;
  place-items: center;
  border: 1px solid var(--line);
  background: white;
  color: var(--brand);
}

.mic-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mic-button.recording {
  border-color: var(--red);
  background: var(--red-soft);
  color: var(--red);
  box-shadow: 0 0 0 4px rgba(164, 61, 61, 0.12);
}

.mic-button.unsupported {
  color: var(--muted);
}

.workpanel {
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
  padding: 22px;
}

.panel-section {
  padding: 0 0 22px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.panel-section:last-child {
  border-bottom: 0;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.safety-box {
  display: grid;
  gap: 6px;
  padding: 13px;
  border-radius: 8px;
  background: var(--amber-soft);
  color: var(--amber);
  line-height: 1.4;
}

.safety-box.acuut {
  background: var(--red-soft);
  color: var(--red);
}

.safety-box.niet-acuut {
  background: var(--ok-soft);
  color: var(--ok);
}

.check-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.dot {
  flex: 0 0 9px;
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: #c2c9c2;
}

.check-item.on {
  color: var(--brand);
}

.check-item.on .dot {
  background: var(--brand);
}

.expert-notes {
  display: grid;
  gap: 9px;
}

.expert-note {
  display: grid;
  gap: 5px;
  padding: 11px;
  border-left: 3px solid var(--brand);
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 13px;
  line-height: 1.45;
}

.expert-note[data-perspective="inhoudelijk"] {
  border-left-color: var(--brand);
}

.expert-note[data-perspective="maatwerk"] {
  border-left-color: var(--blue);
}

.expert-note[data-perspective="veiligheid"] {
  border-left-color: var(--red);
}

.expert-note[data-perspective="integratie"] {
  border-left-color: var(--amber);
}

.note-title {
  color: var(--brand);
  font-weight: 850;
}

.expert-note[data-perspective="maatwerk"] .note-title {
  color: var(--blue);
}

.expert-note[data-perspective="veiligheid"] .note-title {
  color: var(--red);
}

.expert-note[data-perspective="integratie"] .note-title {
  color: var(--amber);
}

.question-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 22px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.empty {
  color: var(--muted);
  font-size: 13px;
}

.admin-fab {
  position: sticky;
  bottom: 14px;
  display: grid;
  width: 44px;
  height: 44px;
  margin-left: auto;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: white;
  box-shadow: 0 12px 28px rgba(21, 30, 26, 0.18);
  cursor: pointer;
}

.admin-fab svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(23, 32, 28, 0.42);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  display: grid;
  gap: 14px;
  width: min(720px, 100%);
  max-height: min(780px, calc(100vh - 48px));
  overflow-y: auto;
  padding: 22px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.modal-header h2 {
  font-size: 22px;
}

.modal-close {
  display: grid;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.modal-intro {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.provider-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.provider-form label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.provider-form label:nth-child(n + 3),
.provider-status,
.modal-actions {
  grid-column: 1 / -1;
}

.provider-form input,
.provider-form select,
.provider-form textarea {
  padding: 10px 11px;
  font-weight: 500;
  line-height: 1.4;
}

.provider-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.provider-status.success {
  color: var(--ok);
}

.provider-status.error {
  color: var(--red);
}

.modal-actions {
  display: flex;
  justify-content: end;
  gap: 8px;
}

.primary-button,
.secondary-button {
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  background: var(--brand);
  color: white;
}

.secondary-button {
  background: var(--surface-2);
  color: var(--ink);
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: minmax(360px, 1fr);
  }

  .workpanel {
    display: block;
    position: static;
    max-height: none;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: grid;
    height: 100vh;
    min-height: 100vh;
  }

  .conversation {
    height: 100vh;
    min-height: 0;
  }

  .topbar,
  .process-flow,
  .composer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .brand-block {
    gap: 10px;
  }

  .logo-mark {
    width: 76px;
    height: 40px;
  }

  .logo-mark img {
    width: 62px;
  }

  .topbar h1 {
    font-size: 17px;
  }

  .tagline {
    font-size: 12px;
  }

  .process-flow {
    padding-top: 14px;
    padding-bottom: 14px;
    overflow-x: auto;
  }

  .process-steps {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
    min-width: 480px;
    gap: 10px;
  }

  .process-step {
    grid-template-columns: 40px minmax(0, 1fr);
    min-height: 48px;
    gap: 9px;
  }

  .process-step:not(:last-child)::after {
    top: 23px;
    width: 9px;
  }

  .process-step span {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  .process-step p {
    font-size: 14px;
  }

  .messages {
    padding: 16px;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .composer-actions {
    display: grid;
    grid-template-columns: 52px 1fr;
  }

  .composer button {
    width: 100%;
  }

  .modal-backdrop {
    padding: 12px;
  }

  .provider-form {
    grid-template-columns: 1fr;
  }
}
