/* === Design tokens (Rijkshuisstijl VWS) === */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #e8eef5;
  --border: #d1dbe6;
  --text: #0a1929;
  --muted: #5a6b80;
  --primary: #154273;         /* Rijksblauw */
  --primary-hover: #0b2e57;
  --accent: #01689b;          /* Rijkslintblauw */
  --accent-alt: #e17000;      /* Rijksoranje */
  --danger: #c0392b;
  --shadow: 0 1px 3px rgba(0, 40, 100, 0.08), 0 4px 12px rgba(0, 40, 100, 0.06);
  --radius: 10px;
  --radius-sm: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--primary); }

/* === Layout === */
.app-header {
  background: var(--surface);
  color: var(--text);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 4px solid var(--accent);   /* Rijkslint */
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.header-logo {
  height: 48px;
  width: auto;
  display: block;
}
.app-header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--primary);
}
.app-header .nav-btn {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
}
.app-header .nav-btn:hover { background: var(--surface-2); }

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 24px;
}
.container.narrow { max-width: 560px; }

/* === Login page (neutral — no organisation identity) === */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2b3648 0%, #4c5867 100%);
  padding: 24px;
}
.login-card {
  background: var(--surface);
  padding: 36px 32px;
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0,0,0,0.18);
  width: 100%;
  max-width: 420px;
}
.login-card h1 {
  margin: 0 0 6px 0;
  font-size: 22px;
  color: var(--text);
}
.login-card p { color: var(--muted); margin: 0 0 22px 0; font-size: 14px; }

/* === Scenario picker === */
.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 12px;
}
.scenario-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.scenario-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--primary);
}
.scenario-card .badge {
  display: inline-block;
  background: var(--surface-2);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 99px;
  align-self: flex-start;
}
.scenario-card h3 { margin: 4px 0 0 0; font-size: 17px; color: var(--text); }
.scenario-card p { color: var(--muted); margin: 0; font-size: 14px; }

/* === Forms === */
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
input[type="text"], input[type="password"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 66, 115, 0.18);
}
textarea {
  min-height: 110px;
  resize: vertical;
  font-family: inherit;
}
.field { margin-bottom: 14px; }

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 18px;
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s ease;
}
.btn:hover:not(:disabled) { background: var(--primary-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.secondary {
  background: var(--surface);
  color: var(--primary);
  border: 1px solid var(--border);
}
.btn.secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn.accent { background: var(--accent); }
.btn.accent:hover:not(:disabled) { background: #014e75; }
.btn.danger-link {
  background: transparent;
  color: var(--danger);
  border: none;
  padding: 4px 8px;
  font-weight: 500;
  cursor: pointer;
}
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* === Chat / message UI === */
.chat-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 500px;
}
.chat-messages {
  flex: 1;
  padding: 18px;
  overflow-y: auto;
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f9fbfd;
}
.msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 15px;
}
.msg.user { align-self: flex-end; background: var(--primary); color: white; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--surface-2); color: var(--text); border-bottom-left-radius: 4px; }
.msg.system { align-self: center; background: transparent; color: var(--muted); font-style: italic; font-size: 13px; }
.msg.error { align-self: center; background: #fde2e0; color: var(--danger); }

/* Markdown rendered inside assistant bubbles */
.msg.assistant p { margin: 0 0 8px 0; }
.msg.assistant p:last-child { margin-bottom: 0; }
.msg.assistant h2, .msg.assistant h3, .msg.assistant h4, .msg.assistant h5, .msg.assistant h6 {
  margin: 10px 0 6px 0;
  color: var(--primary);
  font-weight: 600;
}
.msg.assistant h2 { font-size: 1.05em; }
.msg.assistant h3 { font-size: 1.02em; }
.msg.assistant h4, .msg.assistant h5, .msg.assistant h6 { font-size: 1em; }
.msg.assistant ul, .msg.assistant ol { margin: 4px 0 8px 0; padding-left: 22px; }
.msg.assistant li { margin: 2px 0; }
.msg.assistant code {
  background: rgba(21, 66, 115, 0.10);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.92em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.msg.assistant strong { font-weight: 700; }
.msg.assistant a { color: var(--primary); text-decoration: underline; }

.chat-input {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.chat-input textarea {
  flex: 1;
  min-height: 44px;
  max-height: 160px;
  resize: none;
  margin: 0;
}

/* === Wizard stepper === */
.stepper {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.step {
  flex: 1;
  min-width: 110px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}
.step.active { background: var(--primary); color: white; border-color: var(--primary); }
.step.done { background: var(--accent); color: white; border-color: var(--accent); }

/* === Section card === */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.card h2 { margin-top: 0; font-size: 18px; color: var(--primary); }
.card .helper { color: var(--muted); font-size: 14px; margin-top: -4px; margin-bottom: 14px; }

/* === Alerts === */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 14px;
}
.alert.error { background: #fde2e0; color: var(--danger); border: 1px solid #f5b4ad; }
.alert.info  { background: var(--surface-2); color: var(--primary); border: 1px solid var(--border); }

/* === Loading dots === */
.thinking::after {
  content: "▊";
  display: inline-block;
  animation: blink 1s steps(2,start) infinite;
}

/* === Gesprek scenario — ready-to-proceed notice === */
.gesprek-ready-notice {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.gesprek-ready-notice p {
  margin: 0;
  flex: 1;
  min-width: 200px;
  font-size: 14px;
  color: var(--text);
}

/* === Jaarplan scenario — ready-to-proceed notice === */
.jaarplan-ready-notice {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.jaarplan-ready-notice p {
  margin: 0;
  flex: 1;
  min-width: 200px;
  font-size: 14px;
  color: var(--text);
}

/* === Privacy warning (scenario 4) === */
.privacy-warning {
  border-left: 4px solid #e67e00;
  background: #fff8ee;
  padding: 14px 18px;
}
.privacy-warning-content {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.privacy-warning-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}
.privacy-warning p {
  margin: 4px 0 0 0;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}
.privacy-warning strong {
  font-size: 14px;
  color: #a05000;
}

/* === Image tool card (scenario 5) === */
.image-tool-card {
  background: linear-gradient(135deg, #fef9f0 0%, #fff8ee 100%);
  border: 1px solid var(--border);
}
.image-tool-card h3 {
  color: var(--accent);
}

/* === Gesprek scenario — preparation summary panel === */
.prep-summary-panel {
  margin-bottom: 16px;
  padding: 0;
  overflow: hidden;
}
.prep-summary-toggle {
  width: 100%;
  background: var(--surface-2);
  border: none;
  padding: 12px 16px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  color: var(--accent);
  gap: 10px;
}
.prep-summary-toggle:hover { background: var(--border); }
.prep-summary-chevron { font-size: 12px; flex-shrink: 0; }
.prep-summary-body { padding: 16px; border-top: 1px solid var(--border); }
.prep-summary-content {
  max-width: 100%;
  background: transparent !important;
  color: var(--text) !important;
  padding: 0 !important;
  border-radius: 0 !important;
  font-size: 14px;
  align-self: unset !important;
}
@keyframes blink { to { visibility: hidden; } }

/* === Mobile === */
@media (max-width: 600px) {
  .container { padding: 18px 14px; }
  .app-header { padding: 10px 14px; }
  .app-header h1 { font-size: 15px; }
  .header-logo { height: 34px; }
}

/* === Privacy notice === */
.privacy-notice {
  background: #fff4d6;
  border: 1px solid #f0d78a;
  border-left: 4px solid var(--accent-alt);
  color: #4a2b00;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 16px;
}
.login-card .privacy-notice { margin-bottom: 18px; }

/* === Extra (presentation) tile === */
.scenario-card.extra {
  background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary) 100%);
  color: white;
  border-color: transparent;
}
.scenario-card.extra h3,
.scenario-card.extra p { color: white; }
.scenario-card.extra .badge {
  background: rgba(255, 255, 255, 0.18);
  color: white;
}
.scenario-card.extra:hover { border-color: var(--accent-alt); }

/* === Attachments (upload chips) === */
.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px 0 12px;
}
.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  color: var(--primary);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}
.attachment-chip svg { flex-shrink: 0; }
.attachment-chip .chip-name {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-chip .remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0 2px;
  font-size: 14px;
  line-height: 1;
}
.attachment-chip .remove:hover { color: var(--danger); }
.upload-btn {
  background: var(--surface);
  color: var(--primary);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
}
.upload-btn:hover:not(:disabled) { background: var(--surface-2); }
.upload-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* === Instructions block on each scenario === */
.instructions-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
}
.instructions-card h2 {
  margin: 0 0 6px 0;
  font-size: 15px;
  color: var(--primary);
}
.instructions-card h3 {
  margin: 14px 0 4px 0;
  font-size: 14px;
  color: var(--primary);
  font-weight: 700;
}
.instructions-card h4 {
  margin: 8px 0 4px 0;
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
}
.instructions-card p,
.instructions-card ul,
.instructions-card ol {
  margin: 4px 0;
  font-size: 14px;
  color: var(--text);
}
.instructions-card ul,
.instructions-card ol { padding-left: 22px; }
.instructions-card li { margin: 2px 0; }
.instructions-card blockquote {
  border-left: 3px solid var(--border);
  margin: 6px 0;
  padding: 4px 12px;
  color: var(--muted);
  font-style: italic;
  font-size: 13.5px;
}
.instructions-card .placeholder {
  color: var(--muted);
  font-style: italic;
}

/* === Presentation viewer === */
.pdf-viewer {
  width: 100%;
  height: calc(100vh - 160px);
  min-height: 500px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.pdf-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 10px;
  flex-wrap: wrap;
}
.pdf-actions-top {
  justify-content: flex-start;
  margin-top: 0;
  margin-bottom: 12px;
}

/* === AI test 1: vignette picker & probe chips === */
.vignette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.vignette-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.vignette-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}
.vignette-card.selected {
  border-color: var(--primary);
  background: var(--surface-2);
  box-shadow: 0 0 0 2px rgba(21, 66, 115, 0.15);
}
.vignette-card.custom {
  border-style: dashed;
}
.vignette-card.custom:not(.selected) {
  background: transparent;
}
.vignette-card h4 {
  margin: 0 0 6px 0;
  font-size: 15px;
  color: var(--primary);
}
.vignette-card p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}
.vignette-tag {
  display: inline-block;
  background: var(--surface-2);
  color: var(--primary);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 8px;
}
.vignette-dimension-note {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 10px 0;
}
.vignette-dimension-note strong { color: var(--primary); }

/* Eigen vignet: form layout */
.custom-vignette-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  margin-bottom: 16px;
}
.custom-vignette-form .field-hint {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
}
.custom-persoon-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 700px) {
  .custom-persoon-row { grid-template-columns: 1fr; }
}

.vignette-profiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.profile-card h4 {
  margin: 0 0 6px 0;
  font-size: 14px;
  color: var(--primary);
}
.profile-card p {
  margin: 0;
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.5;
}

.probe-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 10px;
}
.probe-label {
  font-size: 13px;
  color: var(--muted);
  margin-right: 4px;
}
.probe-chip {
  background: var(--surface-2);
  color: var(--primary);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 5px 12px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.probe-chip:hover {
  background: var(--border);
  border-color: var(--primary);
}

@media (max-width: 600px) {
  .vignette-profiles { grid-template-columns: 1fr; }
}
