.gallery-block {
  --gallery-head-height: 2rem;
  --gallery-hint-height: 1.25rem;
  --gallery-thumb-height: 72px;
  --gallery-block-height: calc(
    0.4rem + var(--gallery-head-height) + 0.2rem + var(--gallery-hint-height) +
      var(--gallery-thumb-height) + 0.3rem + 5px
  );
  flex-shrink: 0;
  height: var(--gallery-block-height);
  min-height: var(--gallery-block-height);
  max-height: var(--gallery-block-height);
  width: 100%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.65rem calc(0.3rem + 5px);
}

.gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.2rem;
  flex: 0 0 var(--gallery-head-height);
  height: var(--gallery-head-height);
  min-height: var(--gallery-head-height);
  max-height: var(--gallery-head-height);
  overflow: hidden;
  flex-wrap: nowrap;
}

.gallery-head-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  overflow: hidden;
}

.gallery-head-right {
  flex-shrink: 0;
  min-width: 0;
}

.gallery-head-left h2 {
  margin: 0;
}

.gallery-head .pb-toggle-switch__label {
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: lowercase;
  color: var(--text-muted);
  min-width: 0;
  text-align: left;
}

.gallery-head .candidate-filter-bar .gallery-filter-summary {
  margin: 0;
}

.gallery-head .pb-toggle-switch {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
}

.gallery-block h2 {
  margin: 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.gallery-block .hint {
  flex: 0 0 var(--gallery-hint-height);
  height: var(--gallery-hint-height);
  min-height: var(--gallery-hint-height);
  margin: 0;
  overflow: hidden;
  line-height: var(--gallery-hint-height);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.gallery-block .hint[hidden] {
  display: block !important;
  visibility: hidden;
}

.gallery-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.btn-secondary {
  font: inherit;
  font-size: 0.78rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-hover);
}

.btn-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  font: inherit;
  font-size: 0.78rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent-dim);
  color: var(--text);
  cursor: pointer;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent);
  color: var(--bg);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary.is-applied {
  border-color: var(--color-success);
  background: var(--surface-2);
}

@supports (color: color-mix(in srgb, red, blue)) {
  .btn-primary.is-applied {
    background: color-mix(in srgb, var(--color-success) 18%, var(--surface-2));
  }
}

.candidate-filter-bar {
  display: flex;
  align-items: center;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.65rem;
  margin: 0;
  padding: 0;
}

.btn-apply-selection--compact {
  padding: 0.12rem 0.55rem;
  font-size: 0.68rem;
  line-height: 1.15;
  white-space: nowrap;
}

.gallery button.is-deactivated {
  opacity: 0.72;
}

.gallery-deactivated-badge {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  z-index: 2;
  padding: 0.1rem 0.3rem;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface-elevated) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: 3px;
}

.badge-selection {
  color: var(--color-success);
}

.badge-missing-image {
  color: var(--risk-yellow);
}

.hint {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  flex-shrink: 0;
}

.gallery {
  flex: 0 0 var(--gallery-thumb-height);
  height: var(--gallery-thumb-height);
  min-height: var(--gallery-thumb-height);
  max-height: var(--gallery-thumb-height);
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  align-items: flex-start;
  gap: 0.5rem;
  padding-bottom: 0;
}

.gallery button {
  position: relative;
  flex-shrink: 0;
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 0;
  background: var(--surface-2);
  cursor: pointer;
  overflow: hidden;
  width: 96px;
  height: 72px;
  display: flex;
  flex-direction: column;
}

.gallery button img {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  object-fit: cover;
  display: block;
}

.gallery .gallery-credit {
  flex: 0 0 auto;
  display: block;
  width: 100%;
  padding: 0.15rem 0.25rem;
  font-size: 0.58rem;
  line-height: 1.2;
  color: var(--color-on-media);
  background: linear-gradient(0deg, var(--overlay) 0%, color-mix(in srgb, var(--overlay) 82%, transparent) 70%, transparent 100%);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.gallery .gallery-sa-badge {
  position: absolute;
  right: 4px;
  top: 4px;
  z-index: 2;
  font-size: 0.58rem;
  font-weight: 700;
  padding: 0.1rem 0.28rem;
  background: var(--risk-yellow);
  color: var(--color-on-warning);
  border-radius: var(--radius);
  pointer-events: none;
}

.gallery .gallery-storage-badge {
  position: absolute;
  right: 4px;
  bottom: 4px;
  z-index: 2;
  font-size: 0.58rem;
  font-weight: 700;
  padding: 0.1rem 0.28rem;
  border-radius: var(--radius);
  pointer-events: none;
  background: color-mix(in srgb, var(--color-info) 22%, var(--surface));
  color: var(--color-info);
}

.gallery .gallery-storage-badge.storage-local {
  background: color-mix(in srgb, var(--color-success) 22%, var(--surface));
  color: var(--color-success);
}

.column .tier.storage-local {
  color: var(--color-success);
}

.column .tier.storage-hotlink,
.column .tier.storage-remote {
  color: var(--color-info);
}

.gallery button.needs-credit::after {
  content: "!";
  position: absolute;
  left: 4px;
  bottom: 4px;
  z-index: 2;
  font-size: 0.65rem;
  font-weight: 700;
  width: 1rem;
  height: 1rem;
  line-height: 1rem;
  text-align: center;
  background: var(--risk-yellow);
  color: var(--color-on-warning);
  border-radius: var(--radius);
}

.gallery button[aria-current="true"] {
  border-color: var(--accent);
}

.gallery button.is-selected,
.gallery button.is-favorite {
  border-color: var(--color-success);
  box-shadow: 0 0 0 1px var(--color-success);
}

.gallery button.is-gate-failed {
  opacity: 0.72;
  border-color: var(--color-error);
  box-shadow: inset 0 0 0 1px var(--color-error);
}

.gallery button.is-gate-failed img {
  filter: grayscale(0.35);
}

.gallery .rank-badge {
  position: absolute;
  left: 4px;
  top: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  background: var(--overlay);
  color: var(--on-accent);
  padding: 0.1rem 0.3rem;
  border-radius: var(--radius);
}

/* —— Galerie: +‑Tile (Board-URL) —— */

.gallery .gallery-add-tile {
  flex-shrink: 0;
  width: 96px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
  color: var(--muted);
}

.gallery .gallery-add-tile:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-hover);
}

.gallery .gallery-add-tile:disabled,
.gallery .gallery-add-tile.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.gallery-add-tile__icon {
  font-size: 1.5rem;
  font-weight: 300;
  line-height: 1;
}

/* —— Modal: Bild-URL hinzufügen —— */

.board-hint-modal {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--overlay);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  box-sizing: border-box;
}

@supports (color: color-mix(in srgb, red, blue)) {
  .board-hint-modal {
    background: color-mix(in srgb, var(--bg) 82%, transparent);
  }
}

.board-hint-modal[hidden] {
  display: none !important;
}

body.gallery-hint-modal-open {
  overflow: hidden;
}

.board-hint-modal__panel {
  position: relative;
  width: min(100%, 28rem);
  max-height: calc(var(--ui-viewport-h, 100vh) - 2rem);
  overflow: auto;
  padding: 1.25rem 1.25rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px var(--shadow);
}

.board-hint-modal__close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.board-hint-modal__close:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.board-hint-modal__title {
  margin: 0 2rem 0.5rem 0;
  font-size: 1.05rem;
}

.board-hint-modal__legal {
  margin: 0 0 1rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.board-hint-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.board-hint-field label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.82rem;
}

.board-hint-required {
  color: var(--color-error);
}

.board-hint-optional {
  color: var(--muted);
  font-weight: normal;
}

.board-hint-field input[type="url"],
.board-hint-field textarea {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 0.88rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
}

.board-hint-field input[type="url"]:focus,
.board-hint-field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.board-hint-field input[aria-invalid="true"] {
  border-color: var(--color-error);
}

.board-hint-field-error {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--color-error);
}

.board-hint-storage-hint {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--color-text-muted, #9aa3b2);
}

.board-hint-storage-hint--local {
  color: var(--color-success, #3d9a6a);
}

.board-hint-storage-hint--hotlink {
  color: var(--color-text-muted, #9aa3b2);
}

.board-hint-storage-hint--warn {
  color: var(--color-warning, #c9a227);
}

.board-hint-enrich {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.board-hint-enrich[hidden] {
  display: none;
}

.board-hint-enrich__btn {
  align-self: flex-start;
  font-size: 0.85rem;
}

.board-hint-enrich__status {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.35;
}

.board-hint-enrich__status[hidden] {
  display: none;
}

.board-hint-enrich__status--success {
  color: var(--color-success, #3d9a6a);
}

.board-hint-enrich__status--error {
  color: var(--color-danger, #c44);
}

.board-hint-enrich__status--warn {
  color: var(--color-warning, #c9a227);
}

.board-hint-enrich__status--info {
  color: var(--color-text-muted, #9aa3b2);
}

.board-hint-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

/* —— Tabs (URL / Datei) —— */

.board-hint-tabs {
  display: flex;
  gap: 0.25rem;
  margin: 0 0 0.75rem;
  border-bottom: 1px solid var(--border);
}

.board-hint-tab {
  appearance: none;
  border: none;
  background: none;
  padding: 0.45rem 0.7rem;
  font: inherit;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.board-hint-tab:hover {
  color: var(--text);
}

.board-hint-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.board-hint-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius);
}

.board-hint-panel[hidden] {
  display: none;
}

/* —— Dropzone (Datei-Upload) —— */

.board-hint-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 1.5rem 1rem;
  text-align: center;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.board-hint-dropzone:hover,
.board-hint-dropzone:focus-visible,
.board-hint-dropzone.is-dragover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-2));
  color: var(--text);
  outline: none;
}

.board-hint-dropzone__icon {
  font-size: 1.4rem;
  line-height: 1;
}

.board-hint-dropzone__text {
  font-size: 0.85rem;
}

.board-hint-dropzone__link {
  color: var(--accent);
  text-decoration: underline;
}

.board-hint-dropzone__hint {
  font-size: 0.72rem;
  color: var(--muted);
}

.board-hint-file-name {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--text);
  word-break: break-all;
}

/* —— Crop-Editor —— */

.board-hint-crop {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.board-hint-crop[hidden] {
  display: none;
}

.board-hint-crop__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.board-hint-crop__label {
  font-size: 0.82rem;
  color: var(--text);
}

.board-hint-crop__reset {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
}

.board-hint-crop__reset:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.board-hint-crop__viewport {
  position: relative;
  width: 100%;
  max-width: 20rem;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #000;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.board-hint-crop__viewport.is-dragging {
  cursor: grabbing;
}

.board-hint-crop__viewport:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.board-hint-crop__image {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  max-width: none;
  pointer-events: none;
}

.board-hint-crop__grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.25) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.25) 1px, transparent 1px);
  background-size: 33.333% 33.333%;
  opacity: 0;
  transition: opacity 0.15s;
}

.board-hint-crop__viewport:hover .board-hint-crop__grid,
.board-hint-crop__viewport.is-dragging .board-hint-crop__grid,
.board-hint-crop__viewport:focus-visible .board-hint-crop__grid {
  opacity: 1;
}

.board-hint-crop__controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 20rem;
  margin: 0 auto;
  width: 100%;
}

.board-hint-crop__controls button {
  appearance: none;
  width: 1.9rem;
  height: 1.9rem;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.board-hint-crop__controls button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.board-hint-crop__controls input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

.board-hint-crop__note {
  margin: 0;
  font-size: 0.74rem;
  color: var(--muted);
}

/* —— Attribution-Vorschau —— */

.board-hint-attribution {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.board-hint-attribution[hidden] {
  display: none;
}

.board-hint-attribution__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
}

.board-hint-attr-provider {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.board-hint-attr-license {
  font-size: 0.74rem;
  color: var(--muted);
  padding: 0.05rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.board-hint-attribution input[type="text"],
.board-hint-attribution textarea {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 0.84rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.board-hint-attribution input[type="text"]:focus,
.board-hint-attribution textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.preview-stack {
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.preview-detail-row {
  min-width: 0;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  align-items: start;
}

.detail-column {
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.preview-panel {
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  outline: none;
}

.preview-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--color-primary-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: zoom-in;
}

.preview-panel:not(.has-image) .preview-frame {
  cursor: default;
}

.preview-frame img,
.preview-frame .placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.preview-frame img {
  display: block;
}

.preview-panel.fit-contain .preview-frame img {
  object-fit: contain;
}

.preview-panel.fit-cover .preview-frame img {
  object-fit: cover;
}

.preview-frame img[hidden],
.preview-frame .placeholder[hidden] {
  display: none !important;
}

.preview-aspect-toggle {
  flex-shrink: 0;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border);
  background: var(--surface);
}

.preview-aspect-toggle button {
  font: inherit;
  font-size: 0.78rem;
  padding: 0.4rem 0.65rem;
  border: none;
  border-radius: 0;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.preview-aspect-toggle button + button {
  border-left: 1px solid var(--border);
}

.preview-aspect-toggle button:hover {
  background: var(--surface);
  color: var(--accent-hover);
}

.preview-aspect-toggle button[aria-pressed="true"] {
  background: var(--accent-dim);
  color: var(--accent);
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

.placeholder {
  color: var(--muted);
  padding: 1rem;
  text-align: center;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.detail-box {
  min-width: 0;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
}

.detail-box h2 {
  margin: 0;
  padding: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  flex-shrink: 0;
}

.detail-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.detail-box-header h2 {
  flex: 1;
  min-width: 0;
}

.detail-box-header__actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.detail-box-active-toggle {
  margin: 0;
  padding: 0.28rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 4px;
  cursor: pointer;
  line-height: 1.2;
  border: 1px solid transparent;
}

.detail-box-active-toggle--active {
  color: var(--color-success);
  background: color-mix(in srgb, var(--color-success) 10%, transparent);
  border-color: color-mix(in srgb, var(--color-success) 45%, var(--border));
}

.detail-box-active-toggle--inactive {
  color: var(--color-error);
  background: color-mix(in srgb, var(--color-error) 8%, transparent);
  border-color: color-mix(in srgb, var(--color-error) 45%, var(--border));
}

.detail-box-active-toggle:hover:not(:disabled) {
  filter: brightness(0.95);
}

.detail-box-active-toggle:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.detail-box-active-toggle[hidden] {
  display: none !important;
}

.detail-box-remove {
  flex-shrink: 0;
  margin: 0;
  padding: 0.28rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--color-error);
  background: color-mix(in srgb, var(--color-error) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-error) 45%, var(--border));
  border-radius: 4px;
  cursor: pointer;
  line-height: 1.2;
}

@supports not (color: color-mix(in srgb, red, blue)) {
  .detail-box-remove {
    background: color-mix(in srgb, var(--color-error) 8%, transparent);
    border-color: color-mix(in srgb, var(--color-error) 45%, var(--border));
  }
}

.detail-box-remove:hover:not(:disabled) {
  color: var(--on-accent);
  border-color: var(--color-error);
  background: var(--color-error);
}

.detail-box-remove:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.detail-box-remove[hidden] {
  display: none !important;
}

.detail-box-crop {
  flex-shrink: 0;
  margin: 0;
  padding: 0.28rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  line-height: 1.2;
}

.detail-box-crop:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.detail-box-crop:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.detail-box-crop[hidden] {
  display: none !important;
}

.detail-box-storage {
  flex-shrink: 0;
  margin: 0;
  padding: 0.28rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  line-height: 1.2;
}

.detail-box-storage:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.detail-box-storage:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.detail-box-storage[hidden] {
  display: none !important;
}

.board-hint-modal__panel--crop {
  max-width: min(28rem, 96vw);
}

.board-hint-crop--modal {
  display: block;
}

.board-hint-crop--modal[hidden] {
  display: none;
}

.detail-actions {
  padding: 0.5rem 0.75rem 0;
  flex-shrink: 0;
}

.detail-actions[hidden] {
  display: none !important;
}

.bv-link-text-edit {
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
}

.bv-link-text-edit:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.detail-box-body {
  padding: 0.75rem 1rem;
}

.detail-box dl {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 38%) minmax(0, 1fr);
  gap: 0.35rem 0.75rem;
  font-size: 0.86rem;
}

.detail-box dt {
  color: var(--muted);
  font-weight: 500;
  min-width: 0;
  overflow-wrap: anywhere;
}

.detail-box dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.detail-box a {
  overflow-wrap: anywhere;
  word-break: break-word;
  color: var(--color-accent);
}

.detail-box a:hover {
  color: var(--accent-hover);
}

.attribution-block {
  margin: 0.75rem 0 0;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.attribution-heading {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.attribution-sa-hint {
  margin: 0.45rem 0 0;
  padding: 0;
  font-size: calc(0.72rem + 1pt);
  line-height: 1.35;
  color: var(--text);
  background: none;
  border: none;
}

@supports not (color: color-mix(in srgb, red, blue)) {
  .attribution-sa-hint {
    color: var(--text);
  }
}

.attribution {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.attribution dl {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 38%) minmax(0, 1fr);
  gap: 0.35rem 0.75rem;
  font-size: 0.86rem;
}

.attribution dt {
  color: var(--muted);
  font-weight: 500;
}

.attribution dd {
  margin: 0;
}

.attribution.attribution-missing {
  color: var(--risk-yellow);
  font-weight: 500;
}

.attribution a {
  color: var(--color-accent);
}

/* Risiko-Badge in Quellen-Details */
.detail-box .risk-green,
.detail-box .risk-yellow,
.detail-box .risk-red {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.78rem;
  line-height: 1.3;
  text-transform: lowercase;
}

.detail-box .risk-green {
  color: var(--color-success);
  background: color-mix(in srgb, var(--color-success) 22%, transparent);
}

.detail-box .risk-yellow {
  color: var(--color-warning);
  background: color-mix(in srgb, var(--color-warning) 24%, transparent);
}

.detail-box .risk-red {
  color: var(--color-error);
  background: color-mix(in srgb, var(--color-error) 22%, transparent);
}

@supports (color: color-mix(in srgb, red, blue)) {
  .detail-box .risk-green {
    background: color-mix(in srgb, var(--color-success) 22%, transparent);
  }

  .detail-box .risk-yellow {
    background: color-mix(in srgb, var(--color-warning) 24%, transparent);
  }

  .detail-box .risk-red {
    background: color-mix(in srgb, var(--color-error) 22%, transparent);
  }
}

/* —— Vollbild-Overlay —— */

.preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
  background: var(--overlay);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  box-sizing: border-box;
}

@supports (color: color-mix(in srgb, red, blue)) {
  .preview-overlay {
    background: color-mix(in srgb, var(--bg) 88%, transparent);
  }
}

.preview-overlay[hidden] {
  display: none !important;
}

.preview-overlay__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.preview-overlay__close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.preview-overlay__frame {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.preview-overlay__frame.fit-contain {
  flex: 1 1 auto;
  width: min(100%, calc(var(--ui-viewport-h) - 8rem));
  max-height: calc(var(--ui-viewport-h) - 8rem);
}

.preview-overlay__frame.fit-contain img {
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
}

.preview-overlay__frame.fit-cover {
  aspect-ratio: 1;
  flex: 0 1 auto;
  position: relative;
  width: min(100%, calc(var(--ui-viewport-h) - 8rem));
  height: auto;
  max-height: calc(var(--ui-viewport-h) - 8rem);
}

.preview-overlay__frame.fit-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.preview-overlay__controls {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-width: 12rem;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}

.preview-overlay__controls button {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.preview-overlay__controls button + button {
  border-left: 1px solid var(--border);
}

.preview-overlay__controls button:hover {
  background: var(--surface);
  color: var(--accent-hover);
}

.preview-overlay__controls button[aria-pressed="true"] {
  background: var(--accent-dim);
  color: var(--accent);
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

@media (max-width: 880px) {
  .preview-detail-row {
    grid-template-columns: 1fr;
  }

  #candidate-deactivated-label {
    display: none;
  }
}
