/* Brainrack Cockpit: Lavendel (licht) en Nachtpaars (donker). Geen externe bronnen, systeemlettertype. */

:root {
  color-scheme: light;
  --bg: #F1EEF8;
  --rail: #FFFFFF;
  --lijst: #F8F6FC;
  --blok: #FFFFFF;
  --lijn: #E2DCEF;
  --ink: #2A2240;
  --zacht: #6E6687;
  --acc: #7A5BD0;
  --accz: #EEE8FB;
  --wacht: #E9EEFF;
  --wachtl: #C9D3F5;
  --wachtt: #3F5BC4;
  --bezig: #F0A64A;
  --klaar: #4FB38F;
  --rust: #A9ADC4;
  --mislukt: #E06A6A;
  --op-acc: #FFFFFF;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1E2033;
    --rail: #24273D;
    --lijst: #272A42;
    --blok: #2D3150;
    --lijn: #3A3E5E;
    --ink: #ECEBFA;
    --zacht: #A3A6C6;
    --acc: #9C8CF0;
    --accz: #38365E;
    --wacht: #3A2F5E;
    --wachtl: #5D4A94;
    --wachtt: #D8CCFF;
    --op-acc: #1E2033;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1E2033;
  --rail: #24273D;
  --lijst: #272A42;
  --blok: #2D3150;
  --lijn: #3A3E5E;
  --ink: #ECEBFA;
  --zacht: #A3A6C6;
  --acc: #9C8CF0;
  --accz: #38365E;
  --wacht: #3A2F5E;
  --wachtl: #5D4A94;
  --wachtt: #D8CCFF;
  --op-acc: #1E2033;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.4 var(--font);
  -webkit-text-size-adjust: 100%;
}
h1, h2, p { margin: 0; }
h2 { margin-bottom: 8px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--zacht); font-weight: 600; }
button { font: inherit; color: inherit; cursor: pointer; }
.zacht { color: var(--zacht); }
.klein { font-size: 12px; }
.fout { color: var(--mislukt); }

/* knoppen */
.primair, .secundair, .pil, .link {
  border: 1px solid transparent; border-radius: 9px; padding: 8px 14px; background: none;
}
.primair { background: var(--acc); color: var(--op-acc); font-weight: 600; }
.secundair { background: var(--blok); border-color: var(--lijn); }
.pil { padding: 3px 10px; border-radius: 12px; background: var(--accz); color: var(--acc); font-size: 12px; border: 0; }
.link { color: var(--acc); padding: 4px 0; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
button:disabled { opacity: .6; cursor: default; }

/* lampjes */
.lamp { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; flex: none; vertical-align: middle; background: var(--rust); }
.lamp.bezig { background: var(--bezig); box-shadow: 0 0 0 3px rgba(240, 166, 74, .22); }
.lamp.klaar { background: var(--klaar); }
.lamp.rust { background: var(--rust); }
.lamp.mislukt { background: var(--mislukt); }

/* inloggen */
.inlog { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 20px; }
.inlogkaart { width: 100%; max-width: 360px; background: var(--blok); border: 1px solid var(--lijn); border-radius: 14px; padding: 26px; display: flex; flex-direction: column; gap: 14px; }
.inlogkaart h1 { font-size: 20px; }
.inlogicoon { border-radius: 12px; }
.inlogkaart label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--zacht); }
input[type="email"], input[type="text"], input[type="datetime-local"], textarea {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--bg); border: 1px solid var(--lijn); border-radius: 9px; padding: 9px 11px; width: 100%;
}
.inlogkaart #code { letter-spacing: .3em; text-align: center; }

/* eenmalige vraag over Face ID */
.vraagbalk { position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); z-index: 35; width: min(94vw, 460px); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; background: var(--blok); border: 1px solid var(--lijn); border-radius: 12px; padding: 12px 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
.vraagbalk span { flex: 1 1 100%; }

/* meldingen */
.verbinding { position: fixed; top: 0; left: 0; right: 0; z-index: 30; text-align: center; padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px; background: var(--bezig); color: #2A2240; font-weight: 600; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 40; max-width: min(92vw, 420px); background: var(--ink); color: var(--bg); padding: 9px 15px; border-radius: 10px; font-size: 13px; box-shadow: 0 6px 18px rgba(0, 0, 0, .2); }

/* de Cockpit, bureau: balk | Digiwerkers | midden | Alex */
.app {
  height: 100%; display: grid; overflow: hidden;
  grid-template-columns: 76px 250px minmax(0, 1fr) 320px;
  grid-template-areas: "rail lijst midden alex";
}
.telkop, .tabs, .alexknop { display: none; }

.rail { grid-area: rail; background: var(--rail); border-right: 1px solid var(--lijn); display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 14px; overflow-y: auto; }
.profielen { display: flex; flex-direction: column; gap: 8px; }
.profiel { width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--accz); color: var(--acc); font-weight: 700; font-size: 12px; }
.profiel.actief { background: var(--acc); color: var(--op-acc); }
.items { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 0 6px; }
.item { border: 0; background: none; border-radius: 9px; padding: 6px 0; font-size: 10.5px; color: var(--zacht); display: flex; flex-direction: column; align-items: center; gap: 1px; }
.item i { font-style: normal; font-size: 17px; line-height: 1.2; }
.item.actief { background: var(--accz); color: var(--acc); font-weight: 600; }

.lijst { grid-area: lijst; background: var(--lijst); border-right: 1px solid var(--lijn); padding: 14px 12px; overflow-y: auto; min-height: 0; }
.lijstkop { display: flex; justify-content: space-between; align-items: baseline; }
.lijstknoppen { display: flex; gap: 6px; margin: 2px 0 10px; flex-wrap: wrap; }
.groep { margin: 12px 0 3px; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--zacht); }
.dwr { width: 100%; display: flex; align-items: center; gap: 8px; text-align: left; padding: 7px 8px; border-radius: 9px; border: 1px solid transparent; background: none; }
.dwr .tekst { flex: 1; min-width: 0; }
.dwr b { font-weight: 500; display: block; }
.dwr small { display: block; color: var(--zacht); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dwr.gekozen { background: var(--blok); border-color: var(--lijn); }

.midden { grid-area: midden; padding: 14px; overflow-y: auto; min-width: 0; min-height: 0; }
.weergave { display: flex; flex-direction: column; gap: 10px; }
.panel { background: var(--blok); border: 1px solid var(--lijn); border-radius: 10px; }
.blok { padding: 12px 14px; }
.meters { display: flex; flex-wrap: wrap; gap: 8px 28px; padding: 10px 14px; }
.meter { font-size: 11px; color: var(--zacht); text-transform: uppercase; letter-spacing: .05em; }
.meter b { display: block; font-size: 17px; color: var(--ink); text-transform: none; letter-spacing: 0; font-weight: 600; }
.meter.w b { color: var(--wachtt); }
.rij { display: flex; gap: 10px; align-items: flex-start; }
.rij > section { flex: 1 1 0; min-width: 0; }
.regels { list-style: none; margin: 0; padding: 0; }
.regels li { padding: 3px 0; display: flex; gap: 8px; align-items: baseline; }
.regels .tijd { color: var(--zacht); font-variant-numeric: tabular-nums; flex: none; min-width: 3.2em; }
.regels .wie { font-weight: 600; }
.leeg { color: var(--zacht); }

.wacht { background: var(--wacht); border-color: var(--wachtl); }
.wacht h2 { color: var(--wachtt); }
.voorstel { padding: 10px 0; border-top: 1px solid var(--wachtl); }
.voorstel:first-child { border-top: 0; padding-top: 0; }
.voorstel h3 { margin: 0 0 3px; font-size: 14px; color: var(--wachtt); }
.voorstel p { color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.knoppen { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.knoppen button { padding: 6px 12px; border-radius: 9px; border: 1px solid var(--wachtl); background: var(--blok); color: var(--wachtt); font-size: 13px; }
.knoppen button.eerste { background: var(--wachtt); border-color: var(--wachtt); color: var(--wacht); font-weight: 600; }
.tijdkeuze { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.tijdkeuze input { flex: 1 1 180px; width: auto; }

.dw-rij { display: flex; gap: 8px; margin-bottom: 8px; }
.dw-rij .k { color: var(--zacht); min-width: 90px; flex: none; }
.dw-lijst { margin: 8px 0 0; padding: 0; list-style: none; }
.dw-lijst li { padding: 3px 0; }
.dw-kop { margin: 14px 0 4px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--zacht); font-weight: 600; }
.keuzes { display: flex; gap: 18px; flex-wrap: wrap; }
.keuzes label { display: flex; gap: 6px; align-items: center; }
.blok .secundair { margin-top: 8px; }

/* Alex */
.alex { grid-area: alex; background: var(--rail); border-left: 1px solid var(--lijn); padding: 14px; display: flex; flex-direction: column; min-height: 0; }
.alexkop { display: flex; flex-direction: column; gap: 1px; position: relative; }
.sluit { display: none; }
.gesprek { flex: 1; overflow-y: auto; margin: 10px 0; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.bubbel { background: var(--accz); border-radius: 10px; padding: 8px 10px; max-width: 92%; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubbel.ik { align-self: flex-end; background: var(--bg); border: 1px solid var(--lijn); }
.bubbel.denkt { color: var(--zacht); font-style: italic; }
.alexinvoer { display: flex; flex-direction: column; gap: 6px; }
.alexinvoer textarea { resize: none; }
.alexinvoer .primair { align-self: flex-end; }

/* deelschermen op bureau */
.app[data-sectie="chat"] { grid-template-columns: 76px minmax(0, 1fr); grid-template-areas: "rail alex"; }
.app[data-sectie="chat"] .lijst, .app[data-sectie="chat"] .midden { display: none; }
.app[data-sectie="digiwerkers"] { grid-template-columns: 76px 250px minmax(0, 1fr); grid-template-areas: "rail lijst midden"; }
.app[data-sectie="taken"], .app[data-sectie="skills"], .app[data-sectie="instellingen"] { grid-template-columns: 76px minmax(0, 1fr); grid-template-areas: "rail midden"; }
.app[data-sectie="digiwerkers"] .alex, .app[data-sectie="taken"] .alex, .app[data-sectie="skills"] .alex, .app[data-sectie="instellingen"] .alex,
.app[data-sectie="taken"] .lijst, .app[data-sectie="skills"] .lijst, .app[data-sectie="instellingen"] .lijst { display: none; }
.app[data-sectie="chat"] .gesprek { max-width: 760px; width: 100%; margin-left: auto; margin-right: auto; }
.app[data-sectie="chat"] .alexinvoer { max-width: 760px; width: 100%; margin: 0 auto; }

@media (max-width: 1100px) and (min-width: 701px) {
  .app { grid-template-columns: 76px 220px minmax(0, 1fr) 260px; }
  .app[data-sectie="chat"] { grid-template-columns: 76px minmax(0, 1fr); }
  .app[data-sectie="digiwerkers"] { grid-template-columns: 76px 220px minmax(0, 1fr); }
  .app[data-sectie="taken"], .app[data-sectie="skills"], .app[data-sectie="instellingen"] { grid-template-columns: 76px minmax(0, 1fr); }
}

/* telefoon */
@media (max-width: 700px) {
  html, body { height: auto; }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  .app, .app[data-sectie] { display: block; height: auto; overflow: visible; }
  .rail { display: none; }
  .telkop { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 10; background: var(--rail); border-bottom: 1px solid var(--lijn); padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px; }
  .telkop .profiel { width: 30px; height: 30px; font-size: 11px; }
  .telkop b { font-size: 16px; }
  .telkop .tijd { margin-left: auto; font-size: 12px; }
  .midden { padding: 12px 14px; overflow: visible; }
  .lijst { border-right: 0; padding: 12px 14px; overflow: visible; }
  .app[data-sectie="cockpit"] .lijst, .app[data-sectie="chat"] .lijst, .app[data-sectie="taken"] .lijst, .app[data-sectie="skills"] .lijst, .app[data-sectie="instellingen"] .lijst,
  .app[data-sectie="chat"] .midden { display: none; }
  .app[data-sectie="digiwerkers"] .lijst { display: block; }
  .rij { display: contents; }
  #v-cockpit { display: flex; flex-direction: column; }
  #b-wacht { order: -1; }
  #meters { scrollbar-width: none; order: -2; flex-wrap: nowrap; overflow-x: auto; gap: 8px; padding: 0; background: none; border: 0; }
  #meters::-webkit-scrollbar { display: none; }
  #meters .meter { flex: none; background: var(--blok); border: 1px solid var(--lijn); border-radius: 14px; padding: 4px 10px; font-size: 11px; text-transform: none; letter-spacing: 0; }
  #meters .meter b { display: inline; font-size: 12px; margin-left: 4px; }
  #meters .meter.w { background: var(--wacht); border-color: var(--wachtl); color: var(--wachtt); }
  #meters .meter.w b { color: var(--wachtt); }
  .knoppen button { padding: 9px 14px; }

  .alex, .app[data-sectie] .alex { position: fixed; left: 0; right: 0; bottom: 0; top: 18%; z-index: 25; border-left: 0; border-top: 1px solid var(--lijn); border-radius: 16px 16px 0 0; padding: 14px 14px calc(14px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -10px 30px rgba(0, 0, 0, .2); display: none; }
  .app.alexopen .alex { display: flex; }
  .app[data-sectie="chat"] .alex { display: flex; top: 0; bottom: calc(58px + env(safe-area-inset-bottom, 0px)); border-radius: 0; box-shadow: none; padding-top: calc(14px + env(safe-area-inset-top, 0px)); z-index: 5; }
  .app[data-sectie="chat"] .gesprek, .app[data-sectie="chat"] .alexinvoer { max-width: none; }
  .sluit { display: block; position: absolute; top: -4px; right: 0; border: 0; background: none; font-size: 26px; line-height: 1; color: var(--zacht); padding: 4px 8px; }
  .app[data-sectie="chat"] .sluit { display: none; }
  .alexknop { display: flex; position: fixed; right: 14px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--acc); color: var(--op-acc); font-weight: 700; font-size: 18px; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(0, 0, 0, .22); z-index: 12; }
  .app.alexopen .alexknop, .app[data-sectie="chat"] .alexknop { display: none; }
  .tabs { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--rail); border-top: 1px solid var(--lijn); padding: 6px 0 calc(8px + env(safe-area-inset-bottom, 0px)); justify-content: space-around; }
  .tabs button { border: 0; background: none; color: var(--zacht); font-size: 11px; display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 64px; }
  .tabs button i { font-style: normal; font-size: 19px; line-height: 1.2; }
  .tabs button.actief { color: var(--acc); font-weight: 600; }
  .toast { bottom: calc(132px + env(safe-area-inset-bottom, 0px)); }
}
