* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  background: #eeece7;
  overflow: hidden;
}

header.studio-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: #fff;
  border-bottom: 1px solid #d8d3c5;
  flex-shrink: 0;
  flex-wrap: wrap;
}
header.studio-header .brand {
  font-weight: 600;
  color: #6b6157;
  font-size: 0.95rem;
  margin-right: 8px;
}
header.studio-header .spacer { flex: 1; }
header.studio-header a {
  color: #b8860b;
  text-decoration: none;
  font-size: 0.85rem;
  margin-left: 12px;
}
header.studio-header a:hover { text-decoration: underline; }

main.studio-main {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* ===== Formulier links ===== */
.studio-controls {
  width: 380px;
  background: #fff;
  border-right: 1px solid #d8d3c5;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}
.controls-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
.studio-controls section {
  margin-bottom: 24px;
}
.studio-controls h3 {
  font-size: 0.95rem;
  color: #7a5c00;
  margin: 0 0 10px 0;
  border-bottom: 1px solid #f0e8d0;
  padding-bottom: 4px;
}
.studio-controls .field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  gap: 8px;
}
.studio-controls .field-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.contrast-badge {
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 10px;
  background: #eee;
  color: #555;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 62px;
  text-align: center;
}
.contrast-badge.aaa { background: #d6ebd0; color: #2f5a24; }
.contrast-badge.aa  { background: #e6f0d6; color: #4a5f2a; }
.contrast-badge.aa-large { background: #fdf0c2; color: #7a5c00; }
.contrast-badge.fail { background: #f7d4d4; color: #8a2a2a; }
.studio-controls .field label {
  font-size: 0.9rem;
  color: #333;
  flex: 1;
  min-width: 0;
}
.studio-controls .field .hint {
  font-size: 0.75rem;
  color: #8a857c;
  display: block;
  margin-top: 2px;
}
.studio-controls input[type="color"] {
  width: 48px;
  height: 32px;
  border: 1px solid #d8d3c5;
  border-radius: 4px;
  padding: 0;
  cursor: pointer;
  background: none;
}
.studio-controls input[type="text"],
.studio-controls select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #d8d3c5;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.9rem;
  background: #fff;
}
.studio-controls .field select {
  width: auto;
  min-width: 180px;
  max-width: 220px;
}
.studio-controls .full-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 0;
}
.studio-controls .full-field label {
  font-size: 0.9rem;
  color: #333;
}

.controls-actions {
  padding: 12px 20px;
  border-top: 1px solid #e8e3d5;
  background: #faf7f0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.controls-actions button,
.controls-actions label.file-btn {
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid #d8d3c5;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  color: #333;
  text-align: center;
}
.controls-actions button:hover,
.controls-actions label.file-btn:hover { background: #f0ebe0; }
.controls-actions button.primary {
  background: #b8860b;
  color: #fff;
  border-color: #b8860b;
  font-weight: 600;
}
.controls-actions button.primary:hover { background: #a37509; }
.controls-actions button.danger {
  color: #a44;
  border-color: #d9c0c0;
}
.controls-actions button.danger:hover { background: #fff0f0; }
.controls-actions button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.controls-actions input[type="file"] { display: none; }
.status-message {
  text-align: center;
  font-size: 0.85rem;
  color: #6b6157;
  padding: 4px 0;
  min-height: 20px;
}
.status-message.saved { color: #486a3e; font-weight: 600; }
.status-message.error { color: #a44; }

/* ===== Preview rechts ===== */
.studio-preview {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.preview-label {
  padding: 8px 16px;
  background: rgba(255,255,255,0.7);
  border-bottom: 1px solid #d8d3c5;
  font-size: 0.8rem;
  color: #6b6157;
  flex-shrink: 0;
}
#stage {
  flex: 1;
  min-height: 0;
}
.preview-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 8px 16px;
  background: rgba(255,255,255,0.7);
  border-top: 1px solid #d8d3c5;
  font-size: 0.85rem;
  color: #6b6157;
  flex-shrink: 0;
}
.preview-nav button {
  background: #fff;
  border: 1px solid #d8d3c5;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  color: #333;
}
.preview-nav button:hover:not(:disabled) { background: #f0ebe0; }
.preview-nav button:disabled { opacity: 0.4; cursor: not-allowed; }
.preview-nav #slideInput {
  width: 44px;
  text-align: center;
  border: 1px solid #d8d3c5;
  border-radius: 4px;
  padding: 4px 2px;
  font-size: 0.9rem;
  color: #6b6157;
  font-variant-numeric: tabular-nums;
  font-family: inherit;
}
.preview-nav #slideTotal {
  color: #6b6157;
  font-variant-numeric: tabular-nums;
}

/* Tablet + telefoon: panelen onder elkaar, controls-kolom volle breedte. */
@media (max-width: 900px) {
  main.studio-main { flex-direction: column; }
  .studio-controls {
    width: 100%;
    max-height: 55vh;
    border-right: none;
    border-bottom: 1px solid #d8d3c5;
  }
  .studio-preview { min-height: 45vh; }
  header.studio-header a { margin-left: 6px; font-size: 0.8rem; }
}
@media (max-width: 640px) {
  .preview-nav button { padding: 8px 14px; }
  .controls-actions button, .controls-actions label.file-btn {
    padding: 10px 12px;
    font-size: 0.95rem;
  }
}
