/* File selection is an interface state, not a processing/success state.
   Existing lists and previews are authoritative after inputs clear themselves.
   Never style media, timeline clips, imported pages or user-authored content. */
html[data-color-mode] {
  --file-selection-line:var(--brand-primary,#F92376);
  --file-selection-fill:var(--brand-soft,rgba(249,35,118,.11));
  --file-selection-detail:var(--brand-link,#FF3B8A);
}

html[data-color-mode] body :is(
  #video-drop.has-file,
  #image-drop.has-file,
  #image-upload.has-file,
  #audio-upload.has-file,
  #metadata-upload.has-file,
  .video-selected-file,
  .cc-source:not(.cc-source-missing),
  .cc-stage:has(.cc-source:not(.cc-source-missing)) > .cc-drop,
  .su-upload-box:has(+ [data-support-upload-list] .su-upload-item),
  .su-upload-item,
  .ac-asset-editor:has([data-ac-asset-preview] > img),
  .an-upload:has([data-an-asset] option:checked:not([value=""])),
  .ax-dialog select[name="asset_id"]:has(option:checked:not([value=""])),
  .pz-asset:has(> input.pz-input[placeholder]:not(:placeholder-shown):valid),
  .pz-image-card:has(input.pz-input[aria-label="Endereço da imagem substituta"]:not(:placeholder-shown):valid),
  .pg-image-actions[data-brand-file-selected="true"],
  .ax-dialog input[type="file"][data-brand-file-selected="true"],
  .rs-dialog input[type="file"][data-brand-file-selected="true"]
):not(:disabled):not([aria-disabled="true"]):not([aria-invalid="true"]):not(.error):not(.is-error):not(.has-error):not([data-status="failed"]):not(:has(> input:disabled)):not(:has(> input[aria-invalid="true"])) {
  border-color:var(--file-selection-line)!important;
  border-style:solid!important;
  background-color:var(--file-selection-fill)!important;
  background-image:none!important;
  box-shadow:inset 0 0 0 1px var(--file-selection-line)!important;
}

/* A complete outline for rows/inspector controls that originally had only a
   bottom divider or no border. Insets do not change layout or crop thumbnails. */
html[data-color-mode] body :is(
  .pg-image-actions[data-brand-file-selected="true"]
):not([aria-disabled="true"]):not(.error):not(.has-error) {
  outline:1px solid var(--file-selection-line);
  outline-offset:-1px;
  border-radius:8px;
}

/* Pink details; the filename and ordinary helper text keep their normal,
   theme-aware foreground. Actual image/video pixels are never filtered. */
html[data-color-mode] body :is(#video-drop,#image-drop,#image-upload,#audio-upload,#metadata-upload).has-file:not(:has(> input:disabled)) :is(.upload-icon,.media-upload-icon,.upload-icon > svg,.media-upload-icon > svg),
html[data-color-mode] body .cc-source:not(.cc-source-missing) .cc-source-code,
html[data-color-mode] body .su-upload-box:has(+ [data-support-upload-list] .su-upload-item) .su-upload-label > svg {
  color:var(--file-selection-detail)!important;
}

/* Keep keyboard focus distinguishable from the persistent selected outline. */
html[data-color-mode] body :is(.upload-card,.media-upload,.ve-import,.cc-drop,.su-upload-box,.ac-asset-editor,.an-upload,.pg-image-actions):focus-within {
  outline:2px solid var(--brand-focus,var(--brand-primary,#F92376));
  outline-offset:4px;
}

/* Forced-colors users still see the selected boundary without a color wash. */
@media(forced-colors:active) {
  html[data-color-mode] {--file-selection-line:Highlight;--file-selection-fill:Canvas;--file-selection-detail:LinkText}
}
