/* Planningsluik — vier kwadranten (WBS | tijdlijn / resources | capaciteit), zijpaneel en resourcebeheer.
   Gebruikt de variabelen en tonen uit app.css. */

/* Het planningsscherm gebruikt de volle breedte en hoogte van het venster. */
.inhoud.inhoud-breed, #app.inhoud-breed { max-width: none; padding: 12px 16px 8px; display: flex; flex-direction: column; min-height: 0; }
.planning { display: flex; flex-direction: column; flex: 1; min-height: 0; --pl-rij: 30px; --pl-rij-cap: 36px; --pl-as: 44px; }

.pl-balk { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 10px; }
.pl-balk h1 { font-size: 1.2rem; margin: 0 8px 0 0; }
.pl-balk select { width: auto; max-width: 220px; }
.pl-balk .knop { padding: 5px 10px; }
.pl-periode { color: var(--text-muted); font-size: .88rem; min-width: 130px; }
.pl-balk .melding { margin-left: auto; }

.pl-grid {
  flex: 1; min-height: 420px; height: calc(100vh - 170px);
  display: grid;
  grid-template-columns: var(--pl-links, 360px) 6px minmax(0, 1fr);
  grid-template-rows: var(--pl-boven, 58%) 6px minmax(0, 1fr);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--schaduw);
  overflow: hidden;
}
.pl-kw { min-width: 0; min-height: 0; overflow: hidden; display: flex; }
.pl-lb { grid-area: 1 / 1; } .pl-rb { grid-area: 1 / 3; } .pl-lo { grid-area: 3 / 1; } .pl-ro { grid-area: 3 / 3; }
.pl-splits { background: var(--border); z-index: 3; touch-action: none; }
.pl-splits:hover, .pl-splits.is-actief { background: var(--accent); }
.pl-splits-v { grid-area: 1 / 2 / 4 / 3; cursor: col-resize; }
.pl-splits-h { grid-area: 2 / 1 / 3 / 4; cursor: row-resize; }

.pl-lijf { flex: 1; min-width: 0; overflow: auto; position: relative; overscroll-behavior: contain; }
.pl-lb .pl-lijf, .pl-lo .pl-lijf { overflow-x: hidden; scrollbar-width: none; }
.pl-lb .pl-lijf::-webkit-scrollbar, .pl-lo .pl-lijf::-webkit-scrollbar { display: none; }
.pl-lb .pl-inhoud, .pl-lo .pl-inhoud { padding-bottom: 18px; }

.pl-as {
  position: sticky; top: 0; z-index: 2; height: var(--pl-as);
  background: var(--surface-2); border-bottom: 1px solid var(--border-strong);
  font-size: .76rem; color: var(--text-muted);
}
.pl-kop { display: flex; align-items: center; gap: 8px; padding: 0 10px; font-weight: 600; color: var(--text); font-size: .85rem; }
.pl-kop .hulp { font-weight: 400; font-size: .76rem; margin-left: auto; }
.pl-as-weken, .pl-as-dagen { display: flex; height: 22px; }
.pl-as-week, .pl-as-dag { flex: none; overflow: hidden; white-space: nowrap; padding: 3px 5px; border-right: 1px solid var(--border); position: relative; }
.pl-as-week { font-weight: 600; color: var(--text); border-right-color: var(--border-strong); }
.pl-as-dag.is-weekend { background: var(--neutraal-soft); }
.pl-as-dag.is-vandaag { color: var(--accent); font-weight: 700; }
.pl-as-uur { position: absolute; top: 3px; font-size: .68rem; color: var(--text-muted); transform: translateX(-50%); }

.pl-inhoud { position: relative; }
.pl-achter { position: absolute; inset: 0; pointer-events: none; }
.pl-weekend { position: absolute; top: 0; bottom: 0; background: var(--neutraal-soft); opacity: .55; }
.pl-daglijn { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border); }
.pl-daglijn.is-week { background: var(--border-strong); }
.pl-vandaag { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--err); opacity: .7; }

/* ---------- rijen ---------- */

.pl-rij { height: var(--pl-rij); border-bottom: 1px solid var(--border); position: relative; box-sizing: border-box; }
.pl-lo .pl-rij, .pl-ro .pl-rij { height: var(--pl-rij-cap); }
.pl-br, .pl-lr, .pl-tr, .pl-cr { user-select: none; }
.pl-rij.is-gekozen { background: var(--accent-soft); }
.pl-rij.is-doel { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--accent-soft); }

.pl-br, .pl-lr { display: flex; align-items: center; gap: 6px; padding-right: 8px; white-space: nowrap; cursor: pointer; font-size: .86rem; }
.pl-br:hover, .pl-lr:hover { background: var(--surface-2); }
.pl-klap { flex: none; width: 18px; height: 18px; padding: 0; border: 0; background: none; color: var(--text-muted); cursor: pointer; font-size: .7rem; line-height: 18px; }
.pl-klap:hover { color: var(--accent); }
.pl-klap-leeg { flex: none; width: 18px; }
.pl-code { font-family: var(--mono); font-size: .76rem; color: var(--text-muted); flex: none; }
.pl-naam { overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.pl-meta { flex: none; font-size: .72rem; color: var(--text-muted); }
.pl-meta.is-over { color: var(--err); font-weight: 600; }
.soort-klant { background: var(--surface-2); font-weight: 700; }
.soort-knoop .pl-naam { font-weight: 600; }
.soort-knoop.is-optioneel .pl-naam { font-style: italic; }
.soort-taak, .pl-lr[data-resource] { cursor: grab; touch-action: none; }
.pl-stip { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); }
.pl-stip.s-bezig { background: var(--info); } .pl-stip.s-aftetoetsen { background: var(--warn); }
.pl-stip.s-afgetoetst { background: var(--ok); } .pl-stip.s-vervallen { background: transparent; border: 1px solid var(--border-strong); }
.pl-los { flex: none; font-size: .72rem; padding: 0 7px; border-radius: 10px; border: 1px dashed var(--warn); color: var(--warn); background: var(--warn-soft); cursor: grab; touch-action: none; }
.pl-mini { flex: none; border: 1px solid var(--border-strong); background: var(--surface); color: var(--accent); border-radius: var(--radius-s); font: inherit; font-size: .74rem; padding: 0 6px; cursor: pointer; line-height: 18px; }
.pl-mini:hover { background: var(--accent-soft); border-color: var(--accent); }
.pl-afdeling { background: var(--surface-2); font-weight: 600; cursor: pointer; }
.pl-kleur { flex: none; width: 10px; height: 10px; border-radius: 2px; }
.pl-kleur.toon-ok { background: var(--ok); } .pl-kleur.toon-warn { background: var(--warn); } .pl-kleur.toon-err { background: var(--err); }
.pl-kleur.toon-info { background: var(--info); } .pl-kleur.toon-neutraal { background: var(--neutraal); }
.pl-groepkop { height: 22px; padding: 2px 10px; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); background: var(--surface); border-bottom: 1px solid var(--border); box-sizing: border-box; }

/* ---------- actiebalken ---------- */

.pl-actie {
  position: absolute; top: 4px; height: calc(var(--pl-rij) - 9px); min-width: 8px;
  border-radius: var(--radius-s); border: 1px solid currentColor; font-size: .74rem; line-height: calc(var(--pl-rij) - 11px);
  overflow: hidden; white-space: nowrap; cursor: grab; touch-action: none; user-select: none; box-sizing: border-box; z-index: 1;
}
.pl-actie-tekst { padding: 0 7px; pointer-events: none; }
.pl-actie.is-ongewezen { border-style: dashed; }
.pl-actie.is-conflict { box-shadow: 0 0 0 2px var(--err); }
.pl-actie.s-geannuleerd { opacity: .45; text-decoration: line-through; }
.pl-actie.s-uitgevoerd { opacity: .7; }
.pl-actie.s-bevestigd { border-width: 2px; }
.pl-actie.is-slepend { opacity: .85; z-index: 5; pointer-events: none; box-shadow: var(--schaduw); cursor: grabbing; }
.pl-actie.is-doel { outline: 2px solid var(--accent); outline-offset: 1px; }
.pl-greep { position: absolute; top: 0; bottom: 0; width: 7px; cursor: ew-resize; }
.pl-greep-l { left: 0; } .pl-greep-r { right: 0; }
.pl-som { position: absolute; top: 12px; height: 6px; border-radius: 3px; background: var(--border-strong); opacity: .8; pointer-events: none; }

/* capaciteit: cel met toon en getal, daarboven de balken van de persoon */
.pl-cel { position: absolute; top: 0; bottom: 0; box-sizing: border-box; border-right: 1px solid var(--border); font-size: .68rem; padding: 1px 4px; text-align: right; overflow: hidden; white-space: nowrap; }
.pl-cel.toon-ok, .pl-cel.toon-warn, .pl-cel.toon-err { font-weight: 600; }
.pl-cel.is-weekover { box-shadow: inset 0 -3px 0 var(--err); }
.pl-cel.is-afwezig { background: repeating-linear-gradient(135deg, var(--neutraal-soft) 0 6px, transparent 6px 12px); }
.pl-ro .pl-actie { top: 15px; height: calc(var(--pl-rij-cap) - 19px); line-height: calc(var(--pl-rij-cap) - 21px); font-size: .7rem; }

/* ---------- slepen ---------- */

.planning.is-slepend, .planning.is-slepend * { user-select: none; cursor: grabbing !important; }
.pl-spook {
  position: fixed; z-index: 50; pointer-events: none; transform: translate(12px, 12px);
  background: var(--accent); color: var(--accent-contrast); border-radius: var(--radius-s); padding: 3px 9px; font-size: .8rem; box-shadow: var(--schaduw);
  max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- zijpaneel ---------- */

.pl-zij {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(100vw, 480px); z-index: 30;
  background: var(--surface); border-left: 1px solid var(--border-strong); box-shadow: -4px 0 18px rgba(0, 0, 0, .18);
  display: flex; flex-direction: column;
}
.pl-zij-kop { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.pl-zij-kop h2 { margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-zij-lijf { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 18px; }
.pl-zij-pad { font-size: .78rem; color: var(--text-muted); margin: 0; }
.pl-zij h3 { margin: 0 0 8px; }
.pl-zij .veld-form input, .pl-zij .veld-form select, .pl-zij .veld-form textarea { width: 100%; }
.pl-zij .veld-form textarea { min-height: 80px; }
.pl-vink { display: flex; align-items: center; gap: 6px; font-size: .86rem; color: var(--text); }
.pl-vink input { width: auto; }
.pl-wie { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; }
.pl-wie-groep { grid-column: 1 / -1; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-top: 6px; }
.pl-actielijst { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pl-actielijst button { width: 100%; text-align: left; font: inherit; cursor: pointer; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 6px 10px; color: var(--text); }
.pl-actielijst button:hover { border-color: var(--accent); }
.pl-actielijst small { display: block; color: var(--text-muted); }
.pl-berichten { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pl-bericht { border: 1px solid var(--border); border-left: 3px solid var(--border-strong); border-radius: var(--radius-s); padding: 6px 10px; }
.pl-bericht.k-extern { border-left-color: var(--info); }
.pl-bericht-kop { font-size: .76rem; color: var(--text-muted); margin-bottom: 2px; }

/* ---------- resourcebeheer ---------- */

.resources { max-width: 1100px; margin: 0 auto; }
.res-afdeling > summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.res-afdeling[open] > summary { margin-bottom: 12px; }
.res-tabel { width: 100%; border-collapse: collapse; font-size: .9rem; }
.res-tabel th, .res-tabel td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.res-tabel th { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.res-inactief { opacity: .55; }
.res-regime { border-collapse: collapse; }
.res-regime th, .res-regime td { padding: 3px 4px; font-size: .8rem; text-align: center; }
.res-regime input { width: 56px; text-align: center; }
.res-detail { background: var(--surface-2); border-radius: var(--radius-s); padding: 12px; display: flex; flex-direction: column; gap: 14px; }
.res-rij-knoppen { display: flex; gap: 6px; flex-wrap: wrap; }
