/* --------------------------------------------------------------- thema ---
   Alle kleuren staan hier. Donkere modus is één set overrides, geen tweede
   stylesheet. De lettergrootte hangt aan --schaal: die vermenigvuldigt de
   basis, en omdat verder alles in rem staat schaalt het hele scherm mee.     */

:root {
  --schaal: 1;

  --bg:      #ffffff;
  --paneel:  #ffffff;
  --zacht:   #fafafa;
  --line:    #e4e4e7;
  --line-2:  #f1f1f3;
  --ink:     #18181b;
  --mut:     #6b6b74;
  --faint:   #9b9ba4;
  --markeer: rgba(24, 24, 27, .06);

  --goed-bg: #ecfdf5; --goed-ink: #065f46;
  --let-bg:  #fffbeb; --let-ink:  #78350f;
  --stuk-bg: #fef2f2; --stuk-ink: #991b1b;

  font-size: calc(16px * var(--schaal));
}

[data-thema="donker"] {
  --bg:      #0e0e11;
  --paneel:  #161619;
  --zacht:   #121215;
  --line:    #2b2b32;
  --line-2:  #232329;
  --ink:     #e9e9ec;
  --mut:     #a0a0aa;
  --faint:   #6e6e79;
  --markeer: rgba(255, 255, 255, .08);

  --goed-bg: #052e22; --goed-ink: #6ee7b7;
  --let-bg:  #2e2205; --let-ink:  #fcd34d;
  --stuk-bg: #340d0d; --stuk-ink: #fca5a5;
}

@media (prefers-color-scheme: dark) {
  [data-thema="auto"] {
    --bg:      #0e0e11;
    --paneel:  #161619;
    --zacht:   #121215;
    --line:    #2b2b32;
    --line-2:  #232329;
    --ink:     #e9e9ec;
    --mut:     #a0a0aa;
    --faint:   #6e6e79;
    --markeer: rgba(255, 255, 255, .08);

    --goed-bg: #052e22; --goed-ink: #6ee7b7;
    --let-bg:  #2e2205; --let-ink:  #fcd34d;
    --stuk-bg: #340d0d; --stuk-ink: #fca5a5;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: .8125rem;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; }

.eyebrow {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0;
}

/* ----------------------------------------------------------- navigatie --- */

.nav { display: flex; border-bottom: 1px solid var(--line); background: var(--paneel); }
.nav a {
  padding: .625rem 1rem;
  font-size: .8125rem;
  color: var(--mut);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current] { color: var(--ink); border-bottom-color: var(--ink); }

header {
  position: sticky; top: 0; z-index: 30;
  background: var(--paneel);
  border-bottom: 1px solid var(--line);
}

.bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; padding: .625rem 1rem; }
.period { font-size: 1.0625rem; font-variant-numeric: tabular-nums; text-transform: capitalize; }

/* ---------------------------------------------------------- besturing --- */

button.ui, select.ui, a.ui {
  height: 1.875rem;
  min-width: 1.875rem;
  border: 1px solid var(--line);
  background: var(--paneel);
  color: var(--mut);
  font: inherit;
  font-size: .8125rem;
  padding: 0 .625rem;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color .12s, color .12s, background .12s;
}
button.ui:hover, a.ui:hover, select.ui:hover { border-color: var(--faint); color: var(--ink); }
button.ui:disabled { opacity: .45; cursor: default; }

button.primary {
  background: var(--ink); color: var(--bg); border: 0;
  height: 2rem; padding: 0 1rem; border-radius: 4px;
  font: inherit; font-size: .8125rem; cursor: pointer;
}
button.primary:hover { opacity: .85; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.seg { display: flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.seg button {
  height: 1.875rem; border: 0; background: var(--paneel);
  font: inherit; font-size: .8125rem; padding: 0 .75rem; color: var(--mut); cursor: pointer;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* De lettergrootteknoppen tonen hun eigen effect: de min staat klein gezet,
   de plus groot. Dat scheelt uitleg. */
.tekstmaat { display: flex; align-items: center; gap: .25rem; }
.tekstmaat button { line-height: 1; }
.tekstmaat button:first-child { font-size: .6875rem; }
.tekstmaat button:last-child  { font-size: .9375rem; }

/* ----------------------------------------------------------- legenda --- */

.legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: .375rem 1.25rem;
  padding: .5rem 1rem; border-top: 1px solid var(--line-2);
}
.legend .groep { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem .875rem; }
.legend .kop { font-size: .6875rem; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }

.lg {
  display: flex; align-items: center; gap: .4375rem;
  font: inherit; font-size: .75rem; color: var(--mut);
  background: none; border: 0; padding: 0; cursor: pointer;
}
.lg:hover { color: var(--ink); }
.lg .sw { width: .625rem; height: .625rem; flex: 0 0 .625rem; border-radius: 2px; }
.lg.off { color: var(--faint); text-decoration: line-through; }

/* -------------------------------------------------------- weekrooster --- */

.scroll { overflow-x: auto; }
.grid { display: grid; min-width: max-content; }

.hd {
  padding: .375rem .5rem; text-align: center;
  border-bottom: 1px solid var(--line); border-right: 1px solid var(--line);
  background: var(--paneel);
}
.hd.we { background: var(--zacht); }
.hd .wd { font-size: .625rem; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.hd .dn { font-size: .8125rem; color: var(--mut); font-variant-numeric: tabular-nums; }
.hd.today .dn {
  color: var(--bg); background: var(--ink);
  display: inline-block; min-width: 1.375rem; border-radius: 999px; padding: 0 .25rem;
}

.rowhd {
  position: sticky; left: 0; z-index: 10; background: var(--paneel);
  display: flex; align-items: center; gap: .625rem; padding: .5rem .75rem;
  border-bottom: 1px solid var(--line); border-right: 1px solid var(--line);
}
.spine { width: 3px; height: 2.125rem; flex: 0 0 3px; border-radius: 2px; }
.rowname { font-size: .8125rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter { display: block; width: 3.875rem; height: 3px; background: var(--line-2); border-radius: 2px; overflow: hidden; }
.meter i { display: block; height: 100%; }
.hrs { font-size: .6875rem; color: var(--faint); font-variant-numeric: tabular-nums; }

.cell {
  min-height: 4.75rem; padding: .1875rem;
  border-bottom: 1px solid var(--line); border-right: 1px solid var(--line);
}
.cell.we { background: var(--zacht); }
.cell.drop { background: var(--markeer); box-shadow: inset 0 0 0 1px var(--ink); }

.ev {
  position: relative; margin-bottom: .1875rem; padding: .25rem .375rem .3125rem .625rem;
  border-radius: 3px; cursor: grab; user-select: none;
}
.ev:active { cursor: grabbing; }
.ev .acc { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: 3px 0 0 3px; }
.ev .t { font-size: .6875rem; font-variant-numeric: tabular-nums; opacity: .82; }
.ev .s { font-size: .75rem; font-weight: 500; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev .w { font-size: .6875rem; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev.bezig { opacity: .5; }
.ev.mislukt { box-shadow: 0 0 0 2px #dc2626; }

/* ------------------------------------------------------- maandkalender ---
   Weken als rijen, weekdagen als kolommen. Geen monteursrijen: op maandniveau
   gaat het om de dag als geheel, en de kleur zegt wie er zit.                */

.maand { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid var(--line); }

.maand .kop {
  padding: .375rem .5rem; text-align: center;
  font-size: .6875rem; letter-spacing: .12em; text-transform: uppercase; color: var(--faint);
  border-bottom: 1px solid var(--line); border-right: 1px solid var(--line);
  background: var(--paneel);
}

.dag {
  min-height: 7rem; padding: .25rem;
  border-bottom: 1px solid var(--line); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: .125rem;
}
.dag.we { background: var(--zacht); }
.dag.buiten { opacity: .4; }
.dag.drop { background: var(--markeer); box-shadow: inset 0 0 0 1px var(--ink); }

.dagnr {
  align-self: flex-start;
  font-size: .75rem; font-variant-numeric: tabular-nums; color: var(--mut);
  padding: .0625rem .3125rem; border-radius: 999px; margin-bottom: .125rem;
}
.dag.vandaag .dagnr { background: var(--ink); color: var(--bg); font-weight: 500; }

/* Chips in plaats van blokken: op maandniveau wil je scannen, niet lezen. */
.chip {
  display: flex; align-items: center; gap: .375rem;
  padding: .125rem .3125rem; border-radius: 3px;
  font-size: .6875rem; line-height: 1.35;
  cursor: grab; user-select: none;
  white-space: nowrap; overflow: hidden;
}
.chip:active { cursor: grabbing; }
.chip .punt { width: .5rem; height: .5rem; flex: 0 0 .5rem; border-radius: 2px; }
.chip .tijd { font-variant-numeric: tabular-nums; opacity: .8; flex: 0 0 auto; }
.chip .naam { overflow: hidden; text-overflow: ellipsis; }
.chip.mislukt { box-shadow: 0 0 0 2px #dc2626; }
.chip.bezig { opacity: .5; }

.meer {
  align-self: flex-start; background: none; border: 0; padding: .0625rem .3125rem;
  font: inherit; font-size: .6875rem; color: var(--mut); cursor: pointer;
}
.meer:hover { color: var(--ink); text-decoration: underline; }

/* ------------------------------------------------------------- overig --- */

.tip { font-size: .75rem; color: var(--faint); padding: .625rem 1rem 1.5rem; margin: 0; }
.leeg { padding: 4rem 1rem; text-align: center; font-size: .8125rem; color: var(--mut); }

.pane { max-width: 48rem; padding: 1.5rem 1rem 4rem; }
.melding { font-size: .8125rem; padding: .5rem .875rem; margin: 1rem 0 0; border-left: 2px solid; border-radius: 0 3px 3px 0; }
.melding.goed { border-color: #059669; background: var(--goed-bg); color: var(--goed-ink); }
.melding.fout { border-color: #dc2626; background: var(--stuk-bg); color: var(--stuk-ink); }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
@media (min-width: 40rem) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--paneel); padding: .625rem .875rem; }
.stat .l { font-size: .6875rem; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.stat .v { font-size: 1.125rem; font-variant-numeric: tabular-nums; margin-top: .125rem; }

ul.rows { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: var(--paneel); }
ul.rows li { display: flex; align-items: center; gap: .625rem; padding: .5rem .875rem; border-bottom: 1px solid var(--line-2); font-size: .8125rem; }
ul.rows li:last-child { border-bottom: 0; }
ul.rows .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pill { font-size: .6875rem; padding: .125rem .375rem; height: fit-content; white-space: nowrap; border-radius: 3px; }
.pill.ok { background: var(--goed-bg); color: var(--goed-ink); }
.pill.warn { background: var(--let-bg); color: var(--let-ink); }
.pill.fail { background: var(--stuk-bg); color: var(--stuk-ink); }
.pill.skip { background: var(--line-2); color: var(--mut); }

h2.sec { font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin: 2.125rem 0 .25rem; font-weight: 600; }
p.hint { font-size: .8125rem; color: var(--mut); margin: 0 0 .75rem; }
code { font-size: .75rem; background: var(--line-2); padding: .0625rem .25rem; border-radius: 3px; }

input[type="color"] { width: 2.125rem; height: 1.625rem; padding: 2px; border: 1px solid var(--line); background: var(--paneel); border-radius: 3px; cursor: pointer; }
input[type="checkbox"] { accent-color: var(--ink); width: 1rem; height: 1rem; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* --------------------------------------------------------- detailpaneel ---
   Rechts op een breed scherm, van onderen op een telefoon. Geen modaal dialoog
   met een donkere waas: je wilt het rooster ernaast kunnen blijven zien.      */

.overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0, 0, 0, .18);
  opacity: 0; pointer-events: none;
  transition: opacity .15s;
}
.overlay.open { opacity: 1; pointer-events: auto; }

.paneel {
  position: fixed; z-index: 50;
  background: var(--paneel);
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  transition: transform .18s ease-out;
}

@media (min-width: 45rem) {
  .paneel {
    top: 0; right: 0; bottom: 0; width: min(24rem, 92vw);
    transform: translateX(101%);
  }
  .paneel.open { transform: none; }
}

@media (max-width: 44.99rem) {
  .paneel {
    left: 0; right: 0; bottom: 0; max-height: 82vh;
    border-left: 0; border-top: 1px solid var(--line);
    border-radius: 12px 12px 0 0;
    transform: translateY(101%);
  }
  .paneel.open { transform: none; }
}

.paneel .kop {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: 1rem 1rem .75rem;
  border-bottom: 1px solid var(--line-2);
}
.paneel .kop h2 { margin: 0; font-size: 1rem; font-weight: 500; line-height: 1.3; }
.paneel .sluit {
  margin-left: auto; background: none; border: 0; cursor: pointer;
  color: var(--faint); font: inherit; font-size: 1.125rem; line-height: 1; padding: .125rem .25rem;
}
.paneel .sluit:hover { color: var(--ink); }

.paneel .body { padding: .875rem 1rem 1.25rem; overflow-y: auto; }

.paneel dl { display: grid; grid-template-columns: 6.25rem 1fr; gap: .5rem .75rem; margin: 0; }
.paneel dt { font-size: .75rem; color: var(--faint); }
.paneel dd { margin: 0; font-size: .8125rem; overflow-wrap: anywhere; }

.paneel .vlag {
  display: inline-flex; align-items: center; gap: .375rem;
  font-size: .75rem; padding: .125rem .375rem; border-radius: 3px;
}
.paneel .vlag .punt { width: .5rem; height: .5rem; border-radius: 2px; flex: 0 0 .5rem; }

.paneel .notitie {
  white-space: pre-wrap; font-size: .8125rem; color: var(--mut);
  background: var(--zacht); border: 1px solid var(--line-2);
  padding: .625rem; border-radius: 4px; margin: .75rem 0 0;
}

.paneel .acties { display: grid; gap: .5rem; margin-top: 1.25rem; }
.paneel .acties label { font-size: .75rem; color: var(--faint); display: block; margin-bottom: .25rem; }
.paneel select, .paneel input[type="date"] {
  width: 100%; height: 2.125rem;
  border: 1px solid var(--line); background: var(--paneel); color: var(--ink);
  padding: 0 .5rem; font: inherit; font-size: .8125rem; border-radius: 4px;
}
