[hidden] { display: none !important; }

.cfg-page { height: 100dvh; overflow: hidden; }
.cfg {
  display: grid; grid-template-columns: clamp(380px, 33vw, 500px) 1fr;
  height: 100dvh; padding-top: var(--nav-h);
}

/* Paneel */
.cfg-panel { display: grid; grid-template-rows: auto 1fr auto; min-height: 0; background: var(--panel); border-right: 1px solid var(--line); }
.stepper { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); border-bottom: 1px solid var(--line); }
.stepper button {
  width: 100%; padding: 14px 4px 12px; background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer;
  display: grid; gap: 2px; justify-items: center; color: var(--muted); font-size: 12px; transition: color 0.2s, border-color 0.2s;
}
.stepper i { font-family: var(--mono); font-style: normal; font-size: 11px; }
.stepper button:hover { color: var(--text); }
.stepper button.done i { color: var(--accent); }
.stepper button[aria-current] { color: var(--text); border-bottom-color: var(--accent); }
.stepper button[aria-current] i { color: var(--accent); }

.cfg-scroll { overflow-y: auto; padding: 28px 28px 36px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.step h1 { font-size: 28px; margin-bottom: 8px; }
.step h2 { font-size: 17px; margin: 32px 0 14px; letter-spacing: 0; }
.lead { color: var(--muted); font-size: 15px; margin-bottom: 26px; }

.field { display: grid; gap: 8px; margin-bottom: 20px; }
.field label, .label { font-size: 13px; font-weight: 500; color: #c3cbd6; }
.field small { font-weight: 400; color: var(--muted); margin-left: 6px; }
.input {
  width: 100%; height: 44px; padding: 0 14px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px;
  transition: border-color 0.2s;
}
textarea.input { height: auto; padding: 12px 14px; resize: vertical; }
.input:hover { border-color: #46515f; }
.input:focus { outline: none; border-color: var(--accent); }
.input::placeholder { color: #5d6875; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button, .swatches button, .tabs button, .tools button {
  min-height: 40px; padding: 0 14px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px;
  cursor: pointer; font-size: 14px; color: #c3cbd6; transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.seg button { flex: 1 1 auto; }
.seg--sm button { min-height: 34px; font-size: 13px; padding: 0 10px; }
.seg button:hover, .swatches button:hover, .tabs button:hover, .tools button:hover { border-color: #5a6675; color: var(--text); }
.seg button[aria-pressed='true'], .swatches button[aria-pressed='true'] {
  border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--bg));
}
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatches button { display: inline-flex; align-items: center; gap: 10px; }
.swatches i { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.25); }

.count { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg); width: max-content; }
.count button { width: 44px; height: 42px; background: none; border: 0; cursor: pointer; font-size: 20px; color: var(--text); }
.count button:hover:not(:disabled) { color: var(--accent); }
.count button:disabled { opacity: 0.3; cursor: default; }
.count output { min-width: 44px; text-align: center; font-family: var(--mono); font-size: 17px; }

.pair { display: grid; grid-template-columns: 1fr 112px; gap: 14px; align-items: center; }
.num { display: flex; align-items: center; height: 42px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; padding-right: 12px; }
.num:focus-within { border-color: var(--accent); }
.num input { width: 100%; min-width: 0; height: 100%; background: none; border: 0; padding: 0 6px 0 12px; font-family: var(--mono); font-size: 15px; text-align: right; -moz-appearance: textfield; appearance: textfield; }
.num input:focus { outline: none; }
.num input::-webkit-outer-spin-button, .num input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num span { color: var(--muted); font-family: var(--mono); font-size: 13px; }

input[type='range'] { -webkit-appearance: none; appearance: none; width: 100%; height: 24px; background: none; cursor: pointer; }
input[type='range']::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--line-2); }
input[type='range']::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line-2); }
input[type='range']::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; background: var(--accent); border: 3px solid var(--panel); box-shadow: 0 0 0 1px var(--accent); }
input[type='range']::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 3px solid var(--panel); box-shadow: 0 0 0 1px var(--accent); }

.check { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 22px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.total b { color: var(--text); font-size: 20px; font-weight: 500; }

.note { font-size: 14px; color: #c3cbd6; padding: 12px 14px; border-left: 2px solid var(--insitu); background: color-mix(in srgb, var(--insitu) 7%, transparent); border-radius: 0 8px 8px 0; margin-bottom: 18px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 14px; }

/* Liggersystemen */
.systems { display: grid; gap: 10px; }
.system {
  display: grid; gap: 14px; width: 100%; padding: 16px; text-align: left; background: var(--bg); border: 1px solid var(--line-2);
  border-radius: 12px; cursor: pointer; transition: border-color 0.2s, background 0.2s;
}
.system:hover:not(:disabled) { border-color: #5a6675; }
.system[aria-pressed='true'] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, var(--bg)); }
.system:disabled { cursor: default; opacity: 0.55; }
.system-head { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.code { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; background: var(--panel-2); font-family: var(--mono); font-weight: 500; color: var(--accent); }
.system:disabled .code { color: var(--muted); }
.system-title { display: grid; gap: 2px; min-width: 0; }
.system-title b { font-weight: 600; font-size: 16px; }
.system-title small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.badge { align-self: start; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 8px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); white-space: nowrap; }
.badge--off { grid-column: 2 / -1; justify-self: start; background: var(--panel-2); color: var(--muted); text-transform: none; letter-spacing: 0; }
.system dl { margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.system dt { font-size: 11px; color: var(--muted); }
.system dd { margin: 0; font-family: var(--mono); font-size: 15px; white-space: nowrap; }
.system dd small { font-size: 10.5px; color: var(--muted); }
.bar { height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.3s; }

/* Resultaat */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.stat { background: var(--bg); padding: 12px 14px; display: grid; gap: 2px; }
.stat--wide { grid-column: 1 / -1; }
.stats .stat:last-child:nth-child(even) { grid-column: 1 / -1; }
.stat span { font-size: 12px; color: var(--muted); }
.stat b { font-family: var(--mono); font-weight: 500; font-size: 17px; }
.stat b small { font-size: 12px; color: var(--muted); font-weight: 400; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 12px; font-family: var(--mono); border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.form { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; }
.form > * { grid-column: 1 / -1; }
.form .half { grid-column: span 1; }
.form .field { margin-bottom: 14px; }
.form-error { color: var(--danger); font-size: 14px; margin-bottom: 12px; }

.cfg-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 28px; border-top: 1px solid var(--line); background: var(--panel); }
.cfg-foot span { font-size: 12px; color: var(--muted); }

/* Weergave */
.cfg-view { position: relative; min-width: 0; min-height: 0; background: var(--bg); overflow: hidden; }
.stage { position: absolute; inset: 0; }
.stage canvas { width: 100% !important; height: 100% !important; touch-action: none; }
.view-bar { position: absolute; z-index: 3; inset: 16px 16px auto 16px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; pointer-events: none; }
.tabs, .tools { display: flex; gap: 4px; padding: 4px; border-radius: 12px; border: 1px solid var(--line-2); background: color-mix(in srgb, var(--panel) 80%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); pointer-events: auto; }
.tabs button, .tools button { min-height: 34px; border: 0; background: none; border-radius: 8px; font-size: 13px; padding: 0 12px; }
.tabs button[aria-pressed='true'] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.tools button[aria-pressed='true'] { background: var(--panel-2); color: var(--accent); }

.hud { position: absolute; z-index: 3; left: 16px; bottom: 16px; display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 220px); pointer-events: none; }
.hud span { font-family: var(--mono); font-size: 13px; padding: 7px 11px; border-radius: 8px; border: 1px solid var(--line-2); background: color-mix(in srgb, var(--panel) 80%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.hud small { color: var(--muted); margin-right: 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.legend { position: absolute; z-index: 3; right: 16px; bottom: 16px; list-style: none; margin: 0; padding: 10px 12px; display: grid; gap: 5px; font-size: 12px; color: #c3cbd6; border-radius: 10px; border: 1px solid var(--line-2); background: color-mix(in srgb, var(--panel) 80%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); pointer-events: none; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; }

.section-view { position: absolute; inset: 0; z-index: 2; overflow: auto; padding: 84px 32px 120px; display: grid; gap: 28px; align-content: safe center; background: var(--bg) linear-gradient(var(--bg-2) 1px, transparent 1px) 0 0 / 100% 32px; }
.section-view figure { margin: 0; display: grid; gap: 10px; }
.section-view figure:last-child { max-width: 720px; }
.section-view figcaption { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
svg.sec { width: 100%; height: auto; color: #9aa6b4; }
svg.sec path { vector-effect: non-scaling-stroke; }
svg.sec text { fill: currentColor; stroke: none; font-family: var(--mono); }
.stage-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 32px; color: var(--muted); }

.toast { position: fixed; z-index: 60; left: 50%; bottom: 28px; transform: translate(-50%, 20px); max-width: min(520px, 100% - 32px); padding: 12px 18px; border-radius: 12px; background: var(--text); color: var(--bg); font-size: 14px; opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.print-sheet { display: none; }

@media (max-width: 900px) {
  .cfg-page { height: auto; overflow: visible; }
  .cfg { display: flex; flex-direction: column; height: auto; }
  .cfg-view { order: -1; position: sticky; top: var(--nav-h); height: 42dvh; flex: none; z-index: 5; border-bottom: 1px solid var(--line); }
  .cfg-panel { display: block; border-right: 0; }
  .cfg-scroll { overflow: visible; padding: 24px 16px 28px; }
  .cfg-foot { position: sticky; bottom: 0; padding: 12px 16px; z-index: 6; }
  .view-bar { inset: 8px 8px auto 8px; }
  .tabs button, .tools button { padding: 0 9px; font-size: 12px; }
  .legend, #tReset { display: none; }
  .hud { left: 8px; bottom: 8px; max-width: calc(100% - 16px); }
  .hud span { font-size: 11px; padding: 5px 8px; }
  .hud span:first-child { display: none; }
  .section-view { padding: 64px 16px 56px; }
  .nav-links a { display: none; }
}

@media print {
  @page { margin: 14mm; }
  body, .cfg-page { background: #fff; color: #111; height: auto; overflow: visible; }
  .nav, .cfg, .toast { display: none !important; }
  .print-sheet { display: block; font-size: 11pt; }
  .print-sheet header { display: flex; justify-content: space-between; border-bottom: 1px solid #111; padding-bottom: 6px; margin-bottom: 16px; font-size: 9pt; letter-spacing: 0.08em; }
  .print-sheet h1 { font-size: 22pt; margin-bottom: 4px; }
  .print-sheet h2 { font-size: 11pt; margin: 18px 0 8px; break-after: avoid; }
  .print-sheet img { width: 100%; margin: 14px 0; border-radius: 6px; }
  .print-sheet table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
  .print-sheet th { text-align: left; font-weight: 400; color: #555; }
  .print-sheet th, .print-sheet td { padding: 4px 6px 4px 0; border-bottom: 1px solid #ddd; }
  .print-sheet td { font-family: var(--mono); }
  .print-sheet .detail { max-width: 110mm; }
  .print-sheet svg.sec { color: #333; break-inside: avoid; }
  .print-sheet footer { margin-top: 18px; font-size: 8pt; color: #555; word-break: break-all; }
}
