/* Torsia Web — Torsiedraad (huisstijl van de Torsia-familie): stalenblauwe band, document centraal, één draad
   (Torsia: #3B82C4 / #5B9BD8) enkel op het actieve pad. Licht, donker en systeem (data-theme op <html>). */

@font-face { font-family: Barlow; font-weight: 400; font-style: normal; font-display: swap; src: url(../fonts/barlow-400.woff2) format("woff2"); }
@font-face { font-family: Barlow; font-weight: 500; font-style: normal; font-display: swap; src: url(../fonts/barlow-500.woff2) format("woff2"); }
@font-face { font-family: Barlow; font-weight: 600; font-style: normal; font-display: swap; src: url(../fonts/barlow-600.woff2) format("woff2"); }

:root {
  --ground:#E9EDF2; --well:#DCE2E9; --surface:#FFFFFF; --raised:#F4F6F9;
  --band:#3E5A7E; --band-2:#4C6A90; --band-rule:#5A779C; --band-ink:#FFFFFF; --band-muted:#D3DDE9;
  --ink:#16202B; --muted:#4A5767; --rule:#DCE2E9; --control:#C3CCD6; --rule-soft:#E6EAEF;
  --paper:#FFFFFF; --view:#F1F4F7;
  --model:#C9D2DC; --model-side:#9AA7B6; --model-top:#DCE3EA; --model-line:#3F4B59;
  --ok-bg:#E2F3EA; --ok-ink:#14532D; --warn-bg:#FFF4DB; --warn-ink:#7A4B00; --info-bg:#E5ECF6; --info-ink:#1E3A5F;
  --err-ink:#B42318;
  --strand:#3B82C4;
  --radius:6px; --radius-panel:8px; --strand-width:2px;
  color-scheme:light;
}
@media (prefers-color-scheme:dark) { :root:not([data-theme="light"]) {
  --ground:#14181D; --well:#0F1317; --surface:#1B2027; --raised:#20262E;
  --band:#1E2B39; --band-2:#2A3A4C; --band-rule:#33465B; --band-ink:#F1F5F9; --band-muted:#AFBDCC;
  --ink:#E8EDF2; --muted:#A9B5C2; --rule:#2A323C; --control:#3D4856; --rule-soft:#242B34;
  --view:#181D23;
  --model:#7D8A99; --model-side:#5C6876; --model-top:#9AA6B3; --model-line:#D9E0E7;
  --ok-bg:#16301F; --ok-ink:#8FD9AE; --warn-bg:#33270F; --warn-ink:#F2C46B; --info-bg:#1A2A3D; --info-ink:#A9C7EA;
  --err-ink:#F97066;
  --strand:#5B9BD8;
  color-scheme:dark;
} }
:root[data-theme="dark"] {
  --ground:#14181D; --well:#0F1317; --surface:#1B2027; --raised:#20262E;
  --band:#1E2B39; --band-2:#2A3A4C; --band-rule:#33465B; --band-ink:#F1F5F9; --band-muted:#AFBDCC;
  --ink:#E8EDF2; --muted:#A9B5C2; --rule:#2A323C; --control:#3D4856; --rule-soft:#242B34;
  --view:#181D23;
  --model:#7D8A99; --model-side:#5C6876; --model-top:#9AA6B3; --model-line:#D9E0E7;
  --ok-bg:#16301F; --ok-ink:#8FD9AE; --warn-bg:#33270F; --warn-ink:#F2C46B; --info-bg:#1A2A3D; --info-ink:#A9C7EA;
  --err-ink:#F97066;
  --strand:#5B9BD8;
  color-scheme:dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ground); color: var(--ink);
  font: 13px/18px Barlow, "Helvetica Neue", system-ui, sans-serif; font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); overflow: hidden;
}
::selection { background: color-mix(in srgb, var(--strand) 28%, transparent); }
:focus-visible { outline: var(--strand-width) solid var(--strand); outline-offset: 2px; }
button { font: inherit; color: inherit; cursor: pointer; }
svg.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.l { width: 22px; height: 22px; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- band (lint) */
.band { background: var(--band); color: var(--band-ink); user-select: none; -webkit-user-select: none; min-width: 0; }
.band-top { display: flex; align-items: flex-end; gap: 22px; height: 34px; padding: 0 12px; }
.brand { display: flex; align-items: center; gap: 8px; height: 34px; font-weight: 600; font-size: 15px; }
.brand img { width: 22px; height: 22px; }
.brand small { font-weight: 400; color: var(--band-muted); font-size: 13px; }
.tabs { display: flex; gap: 22px; height: 34px; align-items: flex-end; font-weight: 500; color: var(--band-muted); }
.tabs span { padding: 0 2px 6px; }
.tabs span[aria-selected="true"] { color: var(--band-ink); box-shadow: inset 0 calc(-1 * var(--strand-width)) 0 var(--strand); }
.band-top .spacer { flex: 1; }
.band-top .doc { color: var(--band-muted); padding-bottom: 7px; max-width: 40vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.groups { display: flex; border-top: 1px solid var(--band-rule); overflow-x: auto; scrollbar-width: none; }
.groups::-webkit-scrollbar { display: none; }
.group { display: flex; flex-direction: column; padding: 4px 8px 2px; border-right: 1px solid var(--band-rule); flex: none; }
.group .items { display: flex; gap: 2px; align-items: flex-start; flex: 1; }
.group .label { font-size: 11px; line-height: 16px; color: var(--band-muted); text-align: center; padding-top: 1px; }
.stack { display: flex; flex-direction: column; gap: 1px; }
.band button { background: none; border: 0; border-radius: var(--radius); color: var(--band-ink); font-weight: 500; }
.band button:hover:not(:disabled) { background: var(--band-2); }
.band button:disabled { opacity: .45; cursor: default; }
.band button[aria-pressed="true"] { background: var(--band-2); box-shadow: inset 0 calc(-1 * var(--strand-width)) 0 var(--strand); }
.big { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 52px; height: 58px; padding: 5px 6px 3px; font-size: 12px; line-height: 14px; }
.small { display: flex; align-items: center; gap: 6px; height: 19px; padding: 0 8px 0 5px; font-size: 12px; white-space: nowrap; }
.seg { display: flex; gap: 1px; }
.seg .small { padding: 0 7px; }

/* ---------------------------------------------------------------- werkruimte */
.workspace { display: flex; min-height: 0; min-width: 0; position: relative; }
.dock { width: 300px; flex: none; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--rule); min-width: 0; }
.dock-title { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 6px 0 10px; background: var(--ground); border-bottom: 1px solid var(--rule); font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.dock-title .spacer { flex: 1; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border: 0; border-radius: var(--radius); background: none; color: var(--muted); padding: 0; }
.icon-btn:hover { background: var(--raised); color: var(--ink); }
.dock .search { margin: 8px; }
.field { height: 28px; width: 100%; border: 1px solid var(--control); border-radius: var(--radius); padding: 0 8px; background: var(--surface); color: var(--ink); font: inherit; }
.field:focus { border-color: var(--strand); outline: 0; }
.tree { position: relative; flex: 1; overflow: auto; outline: none; }
.tree .rows { position: relative; }
.row { position: absolute; left: 0; right: 0; height: 24px; display: flex; align-items: center; gap: 2px; padding-right: 8px; white-space: nowrap; cursor: default; }
.row:hover { background: var(--raised); }
.row[aria-current="true"] { background: var(--well); font-weight: 600; }
.row[aria-current="true"]::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--strand-width); background: var(--strand); }
.row .twisty { width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); border: 0; background: none; padding: 0; flex: none; }
.row .twisty svg { width: 12px; height: 12px; transition: transform .12s; }
.row[aria-expanded="true"] .twisty svg { transform: rotate(90deg); }
.row .eye { width: 22px; height: 22px; border: 0; background: none; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; padding: 0; flex: none; border-radius: 4px; }
.row .eye:hover { color: var(--ink); background: var(--well); }
.row.off .name { color: var(--muted); opacity: .6; }
.row .name { overflow: hidden; text-overflow: ellipsis; }
.dock .empty-note { padding: 12px; color: var(--muted); }

.view { position: relative; flex: 1; min-width: 0; background: var(--view); overflow: hidden; touch-action: none; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; }

/* ViewCube rechtsboven, met pijlen en Home */
.cube { position: absolute; top: 10px; right: 10px; width: 150px; height: 150px; user-select: none; -webkit-user-select: none; }
.cube canvas { position: absolute; inset: 18px; width: 114px; height: 114px; }
.cube button { position: absolute; width: 18px; height: 18px; border: 0; border-radius: 4px; padding: 0; background: none; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s; }
.cube:hover button, .cube button:focus-visible { opacity: 1; }
.cube button:hover { color: var(--ink); background: color-mix(in srgb, var(--surface) 80%, transparent); }
.cube button svg { width: 14px; height: 14px; }
.cube .home { left: 0; top: 0; }
.cube .rot-l { left: 0; top: 66px; } .cube .rot-r { right: 0; top: 66px; }
.cube .rot-u { top: 0; left: 66px; } .cube .rot-d { bottom: 0; left: 66px; }
.cube .roll-l { right: 18px; top: 0; } .cube .roll-r { right: 0; top: 0; }

/* panelen in het beeld (zoals het snedepaneel van Torsia) */
.hud { position: absolute; background: color-mix(in srgb, var(--surface) 94%, transparent); border: 1px solid var(--rule); border-radius: var(--radius-panel); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.sections { right: 12px; top: 168px; width: 268px; padding: 10px 12px 12px; }
.sections h2 { margin: 0 0 8px; font-size: 13px; font-weight: 600; display: flex; align-items: center; }
.sections h2 .spacer { flex: 1; }
.axis { display: grid; grid-template-columns: 34px 1fr 26px; align-items: center; gap: 6px; margin: 6px 0; }
.axis .tag { height: 22px; border: 1px solid var(--control); border-radius: 4px; background: var(--surface); font-weight: 600; font-size: 12px; padding: 0; }
.axis .tag[aria-pressed="true"] { border-color: var(--strand); box-shadow: inset 0 calc(-1 * var(--strand-width)) 0 var(--strand); }
.axis input[type=range] { width: 100%; accent-color: var(--strand); }
.axis .val { grid-column: 2; font-size: 12px; color: var(--muted); margin-top: -4px; }
.axis .flip { width: 26px; height: 22px; }
.axis.off input, .axis.off .val { opacity: .4; }
.check { display: flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--muted); }
.check input { accent-color: var(--strand); margin: 0; }

.hud.hint { left: 12px; bottom: 12px; padding: 6px 10px; color: var(--muted); font-size: 12px; max-width: min(520px, 70%); pointer-events: none; }

/* lege toestand */
.empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; }
.empty .card { width: min(560px, 100%); text-align: center; }
.empty img { width: 96px; height: 96px; }
.empty h1 { margin: 10px 0 2px; font-size: 32px; line-height: 38px; font-weight: 600; }
.empty p { margin: 0 0 18px; color: var(--muted); font-size: 15px; line-height: 22px; }
.drop { border: 1.5px dashed var(--control); border-radius: var(--radius-panel); padding: 26px 20px 22px; background: color-mix(in srgb, var(--surface) 60%, transparent); }
.drop.over { border-color: var(--strand); background: color-mix(in srgb, var(--strand) 8%, var(--surface)); }
.drop .formats { margin-top: 12px; color: var(--muted); font-size: 13px; }
.btn { height: 32px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--control); background: var(--surface); color: var(--ink); font-weight: 500; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; }
.btn.primary { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.btn.primary:hover { filter: brightness(1.15); }
.privacy { margin-top: 14px; }

/* laden en meldingen */
.busy { left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(360px, 80%); padding: 16px 18px; }
.busy .what { font-weight: 600; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 4px; border-radius: 2px; background: var(--well); overflow: hidden; }
.bar > div { height: 100%; width: 0; background: var(--strand); transition: width .2s; }
.bar.indeterminate > div { width: 30%; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.busy .phase { margin-top: 6px; color: var(--muted); font-size: 12px; }
.toast { left: 50%; bottom: 16px; transform: translateX(-50%); padding: 8px 12px; max-width: min(640px, 90%); }
.toast.error { color: var(--err-ink); }

.chip { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 4px; font-size: 12px; font-weight: 500; }
.chip.info { background: var(--info-bg); color: var(--info-ink); }
.chip.ok { background: var(--ok-bg); color: var(--ok-ink); }
.chip.warn { background: var(--warn-bg); color: var(--warn-ink); }

/* ---------------------------------------------------------------- statusbalk */
.status { height: 28px; display: flex; align-items: center; gap: 14px; padding: 0 12px; border-top: 1px solid var(--rule); background: var(--ground); color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; }
.status .spacer { flex: 1; }
.status .sel { color: var(--ink); overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 760px) {
  .dock { position: absolute; z-index: 5; top: 0; bottom: 0; left: 0; width: min(300px, 85vw); box-shadow: 0 0 0 1px var(--rule); }
  .brand small, .band-top .doc { display: none; }
  .sections { right: 8px; left: 8px; width: auto; top: auto; bottom: 8px; }
  .hud.hint { display: none; }
  .cube { top: 6px; right: 6px; }
}

/* keuzemenu onder een knop van het lint */
.menu { position: fixed; z-index: 20; min-width: 168px; padding: 4px; display: flex; flex-direction: column; }
.menu button { text-align: left; border: 0; background: none; border-radius: 4px; height: 26px; padding: 0 10px; color: var(--ink); font-size: 13px; white-space: pre; }
.menu button:hover, .menu button:focus-visible { background: var(--well); outline: none; }

/* ---------------------------------------------------------------- aanmelden */
.login { display: flex; align-items: center; justify-content: center; padding: 24px; overflow: auto; background: var(--view); }
.login-card { width: min(360px, 100%); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-panel); padding: 28px 28px 24px; }
.login-card img { width: 72px; height: 72px; align-self: center; }
.login-card h1 { margin: 8px 0 2px; font-size: 32px; line-height: 38px; font-weight: 600; text-align: center; }
.login-card p { margin: 0 0 18px; color: var(--muted); font-size: 15px; line-height: 22px; text-align: center; }
.login-card label { font-size: 13px; font-weight: 500; color: var(--muted); margin: 0 0 4px; }
.login-card .field { height: 36px; font-size: 15px; margin-bottom: 14px; }
.login-card .btn { height: 38px; justify-content: center; margin-top: 4px; font-size: 15px; }
.login-card .btn:disabled { opacity: .6; cursor: default; }
.login-error { color: var(--err-ink); font-size: 13px; line-height: 18px; margin: -4px 0 12px; }
.login-card .privacy { text-align: center; margin-top: 16px; }
.login-card .chip { height: auto; min-height: 20px; padding: 3px 8px; white-space: normal; text-align: center; line-height: 16px; }

/* aangemelde gebruiker in de band */
.account { display: flex; align-items: center; gap: 4px; padding-bottom: 4px; color: var(--band-muted); white-space: nowrap; }
.account .who { max-width: 22vw; overflow: hidden; text-overflow: ellipsis; padding-right: 4px; }
.account button { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; font-size: 12px; }
@media (max-width: 760px) { .account .who { display: none; } }
