:root {
  --achtergrond: #eef1f4;
  --paneel: rgba(255, 255, 255, 0.92);
  --tekst: #1f2a36;
  --zacht: #66727f;
  --lijn: #d9dee4;
  --accent: #2f6fb3;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  color: var(--tekst);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--achtergrond);
}

#viewer {
  position: fixed;
  inset: 0;
}

#viewer canvas { display: block; }

/* ---------- Paneel ---------- */
#paneel {
  position: fixed;
  top: 16px;
  left: 16px;
  width: 300px;
  max-height: calc(100% - 32px);
  overflow-y: auto;
  background: var(--paneel);
  backdrop-filter: blur(8px);
  border: 1px solid var(--lijn);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(20, 40, 60, 0.12);
  padding: 16px 18px;
}

#paneel header { position: relative; padding-right: 36px; }

h1 { font-size: 1.3rem; margin: 0 0 4px; }
h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--zacht);
  margin: 0 0 8px;
}
.sub { margin: 0; font-size: 0.85rem; color: var(--zacht); }

section {
  border-top: 1px solid var(--lijn);
  margin-top: 14px;
  padding-top: 12px;
}

.sectie-kop {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--lijn);
  background: #fff;
  color: var(--tekst);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.85rem;
}
button:hover { border-color: var(--accent); color: var(--accent); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.mini-knoppen button { padding: 1px 7px; font-size: 0.75rem; }

.paneel-knop {
  position: absolute;
  top: 0;
  right: 0;
  padding: 3px 8px;
}

.knoppen { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

/* ---------- Lagenlijst ---------- */
.lagen { list-style: none; margin: 0; padding: 0; }
.lagen li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.lagen label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  cursor: pointer;
  font-size: 0.95rem;
}
.lagen li.bezig label { color: var(--zacht); }
.lagen li.fout label { color: #b3261e; }

.staal {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex: none;
  border: 1px solid rgba(0, 0, 0, 0.25);
}
.staal.xray { opacity: 0.55; }

.lagen .enkel { padding: 1px 7px; font-size: 0.72rem; }

input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }

.schakel {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.92rem;
  cursor: pointer;
}

.schuif { display: block; font-size: 0.92rem; }
.schuif span { display: block; margin-bottom: 4px; }
.schuif input { width: 100%; accent-color: var(--accent); }

.hulp {
  border-top: 1px solid var(--lijn);
  margin-top: 14px;
  padding-top: 10px;
  font-size: 0.78rem;
  color: var(--zacht);
}
.hulp p { margin: 0; line-height: 1.5; }

/* Ingeklapt paneel */
#paneel.ingeklapt { width: auto; }
#paneel.ingeklapt #paneel-inhoud,
#paneel.ingeklapt .sub { display: none; }

/* ---------- Verdiepingknoppen rechtsboven ---------- */
#verdieping-knoppen {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.verdieping-knop {
  width: 48px;
  height: 48px;
  padding: 0;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 10px;
  background: var(--paneel);
  color: var(--zacht);
  box-shadow: 0 3px 12px rgba(20, 40, 60, 0.12);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.verdieping-knop.aan {
  background: var(--kleur);
  border-color: color-mix(in srgb, var(--kleur) 70%, #000);
  color: #13314f;
}

.verdieping-knop:hover { border-color: var(--accent); }

@media (max-width: 640px) {
  #verdieping-knoppen { top: 10px; right: 10px; }
  .verdieping-knop { width: 44px; height: 44px; }
}

/* ---------- Laadscherm ---------- */
#laden {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--achtergrond);
  transition: opacity 0.4s;
  z-index: 10;
}
#laden.weg { opacity: 0; pointer-events: none; }
#laden p { color: var(--zacht); margin: 0; }

.spinner {
  width: 38px;
  height: 38px;
  border: 3px solid var(--lijn);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: draai 0.9s linear infinite;
}
@keyframes draai { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  #paneel {
    top: auto;
    bottom: 10px;
    left: 10px;
    right: 10px;
    width: auto;
    max-height: 55%;
  }
}
