/* nl-clips studio — aanvullingen op bb-ui/studio.css. Portrait-first:
   video's zijn standaard 9:16; liggende video's krijgen dezelfde
   kaarthoogte met een 16:9-beeld erin. */
:root {
  --clip-portrait: 9 / 16;
  --clip-landscape: 16 / 9;
}

/* Lege toestand van de mediabibliotheek. */
.empty-state { justify-items: start; }
.empty-state__frames { display: flex; gap: var(--space-1); align-items: end; }
.empty-state__frames span { display: block; width: 36px; aspect-ratio: var(--clip-portrait); background: var(--card); }
.empty-state__frames span:nth-child(2) { width: 44px; background: var(--accent); }
.empty-state__frames span:nth-child(3) { width: 64px; aspect-ratio: var(--clip-landscape); }

/* ---------- Uploaden ---------- */
.dropzone {
  display: grid; justify-items: center; gap: var(--space-1); text-align: center;
  padding: var(--space-3) var(--space-2); border: var(--border-thin) dashed var(--on-panel);
}
.dropzone.is-over { background: var(--paper); border-style: solid; }
.dropzone p { max-width: none; }
.dropzone .button { justify-self: center; }
.upload-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-1); }
.upload-list:empty { display: none; }
.upload-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px var(--space-2); align-items: center; padding: 10px 12px; background: var(--paper); }
.upload-row .progress { grid-column: 1 / -1; }
.upload-row__name { overflow-wrap: anywhere; font-weight: 700; }
.upload-row__state { font-family: var(--font-mono); font-size: 13px; text-transform: uppercase; }
.upload-row--error { background: #ffeef0; color: #7a0019; }
.import summary { cursor: pointer; }
.import[open] summary { margin-bottom: var(--space-2); }

/* ---------- Mediabibliotheek: portrait-first raster ---------- */
.media-grid { list-style: none; margin: 0; padding: 12px 16px 32px; display: grid; gap: 14px 12px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.media-card__link { display: grid; gap: 6px; color: inherit; text-decoration: none; }
.media-card__link:hover .media-card__title { text-decoration: underline; text-decoration-thickness: 2px; }
.media-card__frame {
  position: relative; display: block; aspect-ratio: var(--clip-portrait); overflow: hidden;
  background: var(--surface-deep);
}
.media-card__frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* Liggend: zelfde kaarthoogte, het 16:9-beeld gecentreerd erin. */
.media-card__frame--wide img { object-fit: contain; }
.media-card__placeholder { position: absolute; inset: 30% 30%; border: var(--border-thin) solid var(--card); opacity: .5; }
.media-card__duration, .media-card__status { position: absolute; z-index: 1; }
.media-card__duration {
  right: 5px; bottom: 5px; padding: 1px 4px; background: rgb(0 0 0 / 70%); color: #fff;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 700;
}
.media-card__status { left: 6px; top: 6px; }
.media-card__progress { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; height: 3px; }
.media-card__title { font-weight: 700; font-size: 13px; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.media-card__meta { color: var(--muted); font-size: 11.5px; }

/* ---------- Bibliotheek: navigator | overzicht ---------- */
.lib { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: calc(100vh - var(--bar)); }
.lib__nav { position: sticky; top: var(--bar); height: calc(100vh - var(--bar)); overflow: auto; background: var(--panel); border-right: 1px solid var(--line); padding: 10px 0 24px; }
.lib__main { min-width: 0; position: relative; }
.lib__main.is-drop::after { content: "Laat los om te uploaden"; position: absolute; inset: 8px; z-index: 20; display: grid; place-content: center; border: 2px dashed var(--on-panel); background: rgb(238 241 249 / 92%); font-weight: 900; font-size: 16px; color: var(--on-panel); pointer-events: none; }
.lib__head { position: sticky; top: var(--bar); z-index: 10; background: var(--paper); border-bottom: 1px solid var(--line); padding: 8px 16px; display: grid; gap: 6px; }
.lib__more { padding: 0 16px 32px; }
.lib__empty { padding: 32px 16px; }
.toolbar__title { display: flex; align-items: baseline; gap: 6px; margin-right: 6px; font-size: 17px !important; white-space: nowrap; }
.count { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.searchbox { display: flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 8px; background: #fff; border: 1px solid var(--line-strong); }
.searchbox:focus-within { border-color: var(--on-panel); box-shadow: 0 0 0 2px var(--select); }
.searchbox .ic { color: var(--muted); }
.toolbar .searchbox input { flex: 1; min-width: 0; border: 0; padding: 0; min-height: 30px; outline: none; background: none; }
.searchbox input[aria-invalid=true] { color: #7a0019; }
.seg__link { display: inline-grid; place-content: center; width: 34px; min-height: 30px; color: var(--on-panel); }
.seg__link + .seg__link { border-left: 1px solid var(--line-strong); }
.seg__link[aria-current] { background: var(--on-panel); color: var(--panel); }
.navlist { display: grid; gap: 1px; padding: 0 6px 10px; }
.navlist a { display: flex; align-items: center; padding: 5px 8px; color: var(--surface-deep); text-decoration: none; font-size: 13px; }
.navlist a span { margin-left: auto; color: var(--muted); font: 500 11px/1 var(--font-mono); }
.navlist a:hover { background: var(--soft); }
.navlist a[aria-current] { background: var(--soft); font-weight: 700; box-shadow: inset 3px 0 0 var(--on-panel); }
.facets__search { padding: 0 12px 8px; }
.facets__search input { width: 100%; min-height: 28px; padding: 0 8px; font: inherit; font-size: 12.5px; border: 1px solid var(--line); background: var(--paper); }
.facet { border-top: 1px solid var(--line); }
.facet > summary { list-style: none; display: flex; align-items: center; gap: 6px; padding: 8px 12px; cursor: pointer; font: 700 10.5px/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.facet > summary::-webkit-details-marker { display: none; }
.facet > summary::before { content: "▸"; font-size: 9px; transition: transform .15s; }
.facet[open] > summary::before { transform: rotate(90deg); }
.facet__key { font-size: 10.5px; text-transform: none; opacity: .75; }
.facet__n { margin-left: auto; font-weight: 500; }
.facet ul { list-style: none; margin: 0; padding: 0 6px 8px; }
.facet__val { display: flex; align-items: center; gap: 8px; padding: 4px 6px; color: var(--surface-deep); text-decoration: none; font-size: 13px; }
.facet__val:hover { background: var(--soft); }
.facet__box { width: 13px; height: 13px; border: 1.5px solid var(--line-strong); flex: none; }
.facet__val[aria-current] { font-weight: 700; }
.facet__val[aria-current] .facet__box { background: var(--on-panel); border-color: var(--on-panel); box-shadow: inset 0 0 0 2px #fff; }
.facet__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.facet__count { color: var(--muted); font: 500 11px/1 var(--font-mono); }
.facet__more { margin: -4px 0 8px 32px; padding: 0; border: 0; background: none; color: var(--on-panel); font-size: 12.5px; font-weight: 700; cursor: pointer; }
.bulkbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 10px; background: var(--select); font-size: 12.5px; }
.bulkbar input, .bulkbar select { font: inherit; font-size: 13px; min-height: 26px; padding: 0 6px; border: 1px solid var(--line-strong); background: #fff; }
.bulkbar strong { margin-right: 6px; }
.media-table-wrap { padding: 0 0 32px; overflow-x: clip; }
.media-table th { position: sticky; top: calc(var(--bar) + 49px); z-index: 5; background: var(--paper); }
.media-table td { padding-block: 4px; }
.media-table tr.is-selected td { background: var(--select); }
.media-table__sel { width: 34px; }
.media-table__sel input { accent-color: var(--on-panel); }
.media-table__title { display: flex; align-items: center; gap: 10px; color: inherit; font-weight: 700; text-decoration: none; }
.media-table__title:hover span:last-child { text-decoration: underline; }
.media-thumb { position: relative; flex: none; width: 22px; height: 38px; background: var(--surface-deep); overflow: hidden; margin-inline: 11px; }
.media-thumb--wide { width: 44px; height: 25px; margin-inline: 0; }
.media-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.dot--ok { background: #1c9a4a; }
.empty-state__frames span { width: 28px; }
.empty-state__frames span:nth-child(2) { width: 34px; }
.empty-state__frames span:nth-child(3) { width: 50px; }
@media (max-width: 760px) { .lib { grid-template-columns: 1fr; } .lib__nav { position: static; height: auto; max-height: 40vh; } }

/* ---------- Uploadpaneel ---------- */
.drawer .dropzone { padding: 24px 12px; }
.drawer .dropzone .ic { width: 28px; height: 28px; color: var(--muted); }
.upload-row { padding: 6px 8px; font-size: 13px; }

/* ---------- Item: editor (speler en tijdlijn blijven staan, het transcript scrolt) ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--space-2); align-items: start; }
.editor__stage { position: sticky; top: calc(var(--bar) + 8px); display: grid; gap: 8px; min-width: 0; }
.editor__side { position: sticky; top: calc(var(--bar) + 8px); height: max(420px, calc(100vh - 200px)); display: flex; flex-direction: column; min-height: 0; }
.editor__player { display: grid; justify-items: center; background: #000; }
.editor__player .clip-player--portrait { width: auto; height: min(46vh, 540px); }
.editor__player .clip-player--landscape { width: auto; height: min(38vh, 440px); max-width: 100%; }
.editor__player .clip-player--square { width: auto; height: min(42vh, 480px); }
.editor__player .rendition-switch { justify-self: stretch; padding: 6px 8px; background: var(--panel); grid-template-columns: auto minmax(0, 240px); align-items: center; gap: 8px; display: grid; }
.side-tabs { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.side-tabs [role=tab] { flex: 1; height: 36px; border: 0; background: none; font: 700 11.5px/1 var(--font-mono); text-transform: uppercase; letter-spacing: .02em; color: var(--muted); cursor: pointer; }
.side-tabs [role=tab][aria-selected=true] { color: var(--surface-deep); box-shadow: inset 0 -3px 0 var(--on-panel); }
.side-pane { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.side-pane--scroll { overflow: auto; padding: 10px 12px; }
.side-pane__tools { display: flex; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); flex: none; }
.side-pane__tools input { flex: 1; min-width: 0; min-height: 26px; padding: 0 8px; font: inherit; font-size: 12.5px; border: 1px solid var(--line); background: var(--paper); }
.side-pane__msg { padding: 12px; }
.side-pane__foot { padding: 6px 10px; border-top: 1px solid var(--line); flex: none; }
.editor__side .transcript__list { max-height: none; flex: 1; overflow-y: auto; border-top: 0; padding: 4px 0; gap: 0; }
.editor__side .cue { padding: 4px 10px; font-size: 13px; }
.selbar { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; align-items: end; padding: 10px 12px; background: var(--panel); box-shadow: 0 0 0 1px var(--line); }
.selbar__fields { display: flex; gap: 8px; }
.selbar__fields .field { width: 120px; }
.selbar__fields input { font-family: var(--font-mono); font-size: 13px !important; }
.selbar__actions { justify-content: flex-end; }
.selbar__hint { grid-column: 1 / -1; margin: 0; }
.selbar__menu .menu__panel, .menu__panel--form { width: 360px; padding: 12px; top: auto; bottom: calc(100% + 4px); }
.selbar__menu { height: auto; }
.form-grid--tight { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }
.timeline { gap: 6px; padding: 8px 10px; background: var(--panel); box-shadow: 0 0 0 1px var(--line); }
.timeline__track { height: 40px; }
.timeline__track--wave { height: 60px; }
.timeline__controls { gap: 4px; }
.timeline__controls .button { min-width: 32px; }
.marker { padding: 5px 8px; font-size: 13px; border-left-width: 4px; }
.asset-node__row { padding: 4px 0; font-size: 13px; }
.job { padding: 6px 10px; }
@media (max-width: 1100px) {
  .editor { grid-template-columns: 1fr; }
  .editor__stage, .editor__side { position: static; }
  .editor__side { height: 460px; }
}

/* ---------- Item: speler naast gegevens (oud) ---------- */
.item-layout { display: grid; gap: var(--space-3); align-items: start; grid-template-columns: minmax(260px, 380px) minmax(0, 1fr); }
.item-layout--landscape { grid-template-columns: minmax(0, 1.3fr) minmax(320px, 1fr); }
.item-layout > * { min-width: 0; }
@media (max-width: 900px) { .item-layout, .item-layout--landscape { grid-template-columns: 1fr; } }
.item-player { position: sticky; top: var(--space-2); }
@media (max-width: 900px) { .item-player { position: static; } }
.clip-player { position: relative; background: #000; width: 100%; overflow: hidden; }
/* Staand: hoogte begrenzen en de breedte laten meeschalen (geen zwarte randen). */
.clip-player--portrait { aspect-ratio: var(--clip-portrait); width: min(100%, calc(78vh * 9 / 16)); margin-inline: auto; }
.clip-player--landscape { aspect-ratio: var(--clip-landscape); }
.clip-player--square { aspect-ratio: 1; }
.clip-player video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; }
.clip-player__empty { position: absolute; inset: 0; display: grid; place-content: center; gap: var(--space-1); padding: var(--space-2); text-align: center; color: var(--ink); background: var(--surface-deep); }
.clip-player__empty img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: .35; }
.clip-player__empty p { position: relative; }
.rendition-switch select { max-width: 280px; }

.jobs { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-1); }
.job { display: grid; gap: 6px; padding: 10px 12px; background: var(--paper); }
.job__error { color: #7a0019; overflow-wrap: anywhere; }

.media-card { position: relative; }
.media-card__select { position: absolute; z-index: 3; top: 5px; left: 5px; display: grid; place-items: center; width: 24px; height: 24px; background: rgb(255 255 255 / 90%); cursor: pointer; opacity: 0; transition: opacity .1s; }
.media-card:hover .media-card__select, .media-card.is-selected .media-card__select, .media-card__select:focus-within, html:not(.js) .media-card__select { opacity: 1; }
.media-card__select input { width: 15px; height: 15px; margin: 0; accent-color: var(--on-panel); }
.media-card.is-selected .media-card__frame { outline: 2px solid var(--on-panel); outline-offset: 2px; }
.media-card__status { left: auto; right: 5px; top: 5px; }

/* ---------- Tags (chips) ---------- */
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: stretch; background: var(--card); color: var(--on-card); font-size: 12.5px; font-weight: 700; }
.chip__key { padding: 2px 5px; background: var(--on-card); color: var(--card); font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; display: grid; align-items: center; }
.chip__value { padding: 2px 7px; }
.chip--suggested { background: var(--paper); outline: 2px dashed var(--on-card); outline-offset: -2px; }
.chip form { display: flex; }
.chip__btn { border: 0; background: transparent; color: inherit; font: inherit; padding: 0 6px; cursor: pointer; min-width: 22px; }
.chip__btn:hover { background: var(--on-card); color: var(--card); }
.tag-admin summary { cursor: pointer; font-size: 12.5px; }
.tag-admin[open] { display: grid; gap: 6px; }
.tag-admin input { font: inherit; font-size: 13px; padding: 2px 8px; border: 1px solid var(--line-strong); min-height: 28px; }

/* ---------- Collecties ---------- */
.pick-list, .order-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pick, .order-item { display: grid; grid-template-columns: auto 34px minmax(0, 1fr) auto; gap: var(--space-2); align-items: center; padding: 4px 8px; background: var(--paper); font-size: 13px; }
.pick { grid-template-columns: 34px minmax(0, 1fr) auto; }
.pick__thumb { display: block; width: 34px; aspect-ratio: var(--clip-portrait); background: var(--surface-deep); overflow: hidden; position: relative; }
.pick__thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pick__thumb--wide img { object-fit: contain; }
.order-item__num { font-family: var(--font-mono); font-weight: 700; min-width: 2ch; text-align: right; }
.order-item__title { overflow-wrap: anywhere; }
.order-item__actions { display: flex; gap: 4px; }
.order-item[draggable="true"] { cursor: grab; }
.order-item.is-dragging { opacity: .5; outline: var(--border-thin) dashed var(--on-panel); }

.code-block { margin: 0; padding: 10px 12px; font-size: 12px !important; background: var(--surface-deep); color: var(--ink); font-family: var(--font-mono); font-size: 13px; overflow-x: auto; white-space: pre; }

/* ---------- Tijdlijneditor ---------- */
.timeline { display: grid; gap: var(--space-1); }
.timeline__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-1); flex-wrap: wrap; }
.timeline__track {
  position: relative; height: 48px; background: var(--surface-deep); cursor: pointer; touch-action: none;
  border: var(--border-thin) solid var(--surface-deep); user-select: none;
}
.timeline__track--wave { height: 72px; }
/* Golfvorm (zelf getekend uit de piekwaarden) en stiltes. */
.timeline__wave { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.timeline__silence {
  position: absolute; top: 0; bottom: 0; pointer-events: none;
  background: repeating-linear-gradient(135deg, rgb(255 255 255 / 16%) 0 4px, transparent 4px 9px);
}
/* Filmstrip-voorbeeld bij het aanwijzen. */
.timeline__thumb { position: absolute; bottom: calc(100% + 8px); transform: translateX(-50%); z-index: 4; pointer-events: none; background: #000; border: 2px solid var(--ink); display: grid; }
.timeline__thumb-img { display: block; background-repeat: no-repeat; }
.timeline__thumb-time { font-size: 11px; color: #fff; text-align: center; padding: 1px 0; }
/* Huidige inkorting: het gedeelte dat gepubliceerd wordt. */
.timeline__cut { position: absolute; top: 0; bottom: 0; background: rgb(255 255 255 / 14%); border-inline: 2px dashed rgb(255 255 255 / 55%); pointer-events: none; }
/* Selectie (in- en uitpunt). */
.timeline__sel { position: absolute; top: 8px; bottom: 8px; background: var(--accent); opacity: .55; pointer-events: none; }
.timeline__handle {
  position: absolute; top: -4px; bottom: -4px; width: 14px; margin-left: -7px; padding: 0; border: 0; border-radius: 0;
  background: var(--accent); cursor: ew-resize; z-index: 2;
}
.timeline__handle::after { content: ""; position: absolute; inset: 10px 5px; background: var(--on-accent); opacity: .6; }
.timeline__handle:focus-visible { outline: var(--border-thin) solid var(--ink); outline-offset: 2px; }
.timeline__playhead { position: absolute; top: -6px; bottom: -6px; width: 2px; margin-left: -1px; background: var(--live); pointer-events: none; z-index: 3; }
.timeline__marker { position: absolute; bottom: 0; width: 3px; height: 14px; margin-left: -1px; background: var(--ink); pointer-events: none; }
.timeline__marker--chapter { height: 100%; opacity: .7; }
.timeline__marker--quote { background: var(--card); }
.timeline__marker.is-suggested { opacity: .45; }
.timeline__controls .button { min-width: 44px; }
.timeline__sep { flex: 0 0 var(--space-1); }
kbd { font-family: var(--font-mono); font-size: .85em; padding: 0 4px; border: 1px solid currentColor; }
.edit-form details > summary { cursor: pointer; font-weight: 700; }

/* ---------- Markers ---------- */
.markers { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.marker { display: flex; flex-wrap: wrap; align-items: center; gap: 6px var(--space-1); padding: 8px 10px; background: var(--paper); border-left: 6px solid var(--card); }
.marker--chapter { border-left-color: var(--on-panel); }
.marker--highlight { border-left-color: var(--live); }
.marker--suggested { border-left-style: dashed; }
.marker__time { background: none; border: 0; padding: 0; color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.marker__label { flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; }
.marker__actions { display: flex; gap: 6px; }

/* ---------- Versieboom ---------- */
.asset-tree { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.asset-tree .asset-tree { margin-left: 18px; padding-left: 12px; border-left: 2px solid var(--card); margin-top: 4px; }
.asset-node__row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 0; }
.asset-node__actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.asset-node--old > .asset-node__row { opacity: .6; }
.dropzone--small { flex-direction: row; padding: var(--space-1) var(--space-2); gap: var(--space-1); }

/* ---------- Transcript ---------- */
.transcript__list { list-style: none; margin: 0; padding: 0; max-height: 48vh; overflow-y: auto; display: grid; gap: 2px; border-top: 2px solid var(--card); }
.cue { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 10px; padding: 6px 4px; line-height: 1.45; }
.cue.is-current { background: var(--accent); color: var(--on-accent); }
.cue.is-match .cue__text { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.cue[hidden] { display: none; }
.cue__time { background: none; border: 0; padding: 0; color: inherit; font-size: 12px; font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; align-self: start; padding-top: 3px; }
.cue__text { overflow-wrap: anywhere; }
.timeline__track--wave .timeline__sel { opacity: .3; }
