:root {
  --bg-sidebar: #121214;
  --bg-sidebar-hover: #1e1e22;
  --bg-sidebar-active: #27272a;
  --bg-canvas: #f4f4f5;
  --bg-card: #ffffff;
  --bg-card-subtle: #f8f8f9;
  --border-color: #e4e4e7;
  --border-color-dark: #27272a;
  --text-primary: #09090b;
  --text-secondary: #71717a;
  --text-muted: #a1a1aa;
  --text-sidebar: #d4d4d8;
  --text-sidebar-muted: #71717a;

  --brand-red: #b91c1c;
  --brand-red-hover: #991b1b;
  --badge-red-bg: #fee2e2;
  --badge-red-text: #b91c1c;
  --badge-green-bg: #d1fae5;
  --badge-green-text: #047857;
  --badge-gray-bg: #f4f4f5;
  --badge-gray-text: #52525b;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-full: 9999px;
  --focus-ring: 0 0 0 3px rgba(185, 28, 28, 0.35);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-canvas: #0d0d0e;
    --bg-card: #18181b;
    --bg-card-subtle: #1f1f23;
    --border-color: #2a2a2e;
    --border-color-dark: #3a3a3f;
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --badge-red-bg: #3f1616;
    --badge-red-text: #fca5a5;
    --badge-green-bg: #0f3d2e;
    --badge-green-text: #6ee7b7;
    --badge-gray-bg: #27272a;
    --badge-gray-text: #d4d4d8;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; }
a { color: var(--brand-red); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 4px; font-weight: 700; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

/* ===== App shell ===== */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px; flex: 0 0 250px; background: var(--bg-sidebar); color: var(--text-sidebar);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 40;
  transition: transform .18s ease-in-out;
}
.sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 22px 20px 18px; border-bottom: 1px solid var(--border-color-dark); }
.sidebar__mark { width: 20px; height: 20px; flex: 0 0 auto; background: var(--brand-red); border-radius: 4px; position: relative; }
.sidebar__mark::after { content: ""; position: absolute; inset: 5px; background: var(--bg-sidebar); border-radius: 50%; }
.sidebar__title { margin: 0; font-size: 1.0625rem; font-weight: 700; letter-spacing: .02em; color: #ffffff; }
.sidebar__subtitle { margin: 2px 0 0; font-size: 0.6875rem; color: var(--text-sidebar-muted); }
.sidebar__nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.sidebar__nav-label {
  font-size: 0.6875rem; font-weight: 500; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-sidebar-muted); padding: 14px 10px 6px; margin: 0;
}
.sidebar__link {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; margin: 1px 0; border-radius: var(--radius-sm);
  color: var(--text-sidebar); font-size: 0.8125rem; font-weight: 500;
  border-left: 3px solid transparent; transition: background .15s ease-in-out, color .15s ease-in-out;
}
.sidebar__link:hover { background: var(--bg-sidebar-hover); color: #ffffff; text-decoration: none; }
.sidebar__link.is-active { background: var(--bg-sidebar-active); color: #ffffff; border-left-color: var(--brand-red); }
.sidebar__profile { display: flex; align-items: center; gap: 10px; padding: 14px 18px 18px; border-top: 1px solid var(--border-color-dark); }
.sidebar__avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--bg-sidebar-active); color: #fff; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 600;
}
.sidebar__profile-name { margin: 0 0 4px; font-size: 0.8125rem; color: #ffffff; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__profile-info { min-width: 0; flex: 1; }
.sidebar__logout { background: none; border: none; padding: 0; font-size: 0.75rem; color: var(--text-sidebar-muted); cursor: pointer; text-decoration: underline; }
.sidebar__logout:hover { color: #ffffff; }

.menu-toggle { display: none; }
.scrim { display: none; }

/* Das hidden-Attribut ist ein semantisches Signal (auch fuer
   Screenreader) und muss IMMER Vorrang vor Komponenten-Styles haben.
   Author-Styles wie ".btn, button { display: inline-flex }" ueberschreiben
   sonst grundsaetzlich die native UA-Regel "[hidden]{display:none}" -
   dieser Fall ist bereits mehrfach aufgetreten (u.a. bei Buttons mit
   dynamisch gesetztem hidden-Attribut), daher hier einmal global und
   bewusst mit !important geloest statt Selektor fuer Selektor.
   ===================================================================== */
[hidden] { display: none !important; }

.content { flex: 1; min-width: 0; padding: 28px 36px 60px; max-width: 1320px; }
.sub { color: var(--text-secondary); margin: 0 0 20px; font-size: 0.8125rem; max-width: 62ch; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 4px; }

/* ===== Buttons ===== */
.btn, button, .button {
  display: inline-flex; align-items: center; gap: 7px; font-size: 0.8125rem; font-weight: 600;
  padding: 9px 15px; border-radius: var(--radius-sm); border: 1px solid var(--border-color);
  background: var(--bg-card); color: var(--text-primary); cursor: pointer; white-space: nowrap;
  transition: all .15s ease-in-out; text-decoration: none;
}
.btn:hover, button:hover, .button:hover { background: var(--bg-card-subtle); text-decoration: none; }
.btn:active, button:active, .button:active { transform: scale(0.98); }
.btn--primary, button[type="submit"], .button {
  background: var(--brand-red); border-color: var(--brand-red); color: #fff;
}
.btn--primary:hover, button[type="submit"]:hover, .button:hover { background: var(--brand-red-hover); border-color: var(--brand-red-hover); }
.btn--dashed { background: transparent; border: 1.5px dashed var(--border-color-dark); color: var(--text-secondary); }
.btn--dashed:hover { background: var(--bg-card-subtle); color: var(--text-primary); }
.btn--icon { padding: 8px; }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--ghost:hover { background: var(--bg-card-subtle); }

/* ===== Metrics (dashboard) ===== */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin: 20px 0; }
.metric-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 16px 18px; }
.metric-card .label { display: block; font-size: 0.6875rem; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 8px; }
.metric-card .value { display: block; font-size: 1.75rem; font-weight: 700; }

/* ---- Uebersicht/Dashboard: "Aufmerksamkeit erforderlich" ---- */
.attention-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-bottom: 8px; }
.attention-card { background: var(--bg-card); border: 1px solid var(--badge-red-text); border-radius: var(--radius-md); padding: 14px 16px; }
.attention-card__header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.attention-card__header h3 { margin: 0; font-size: 0.875rem; font-weight: 600; }
.attention-card__list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.attention-card__list li { font-size: 0.8125rem; }
.attention-card__list a { color: var(--text-primary); }
.attention-card__more { display: inline-block; margin-top: 8px; font-size: 0.75rem; color: var(--brand-red); }

/* ---- Uebersicht/Dashboard: zuletzt bearbeitet (zweispaltig) ---- */
.activity-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 4px; }
.activity-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.activity-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 0.8125rem; }
.activity-list__meta { color: var(--text-muted); font-size: 0.75rem; white-space: nowrap; }

/* ---- Uebersicht/Dashboard: Bereiche-Navigation (zentrale Anlaufstelle) ---- */
.hub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 4px; }
.hub-card {
  display: flex; align-items: flex-start; gap: 12px; background: var(--bg-card);
  border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 16px;
  color: var(--text-primary); text-decoration: none; transition: border-color .15s ease-in-out, transform .1s ease-in-out;
}
.hub-card:hover { border-color: var(--brand-red); text-decoration: none; }
.hub-card:active { transform: scale(0.99); }
.hub-card svg { flex: 0 0 auto; color: var(--brand-red); margin-top: 2px; }
.hub-card h3 { margin: 0 0 3px; font-size: 0.9375rem; font-weight: 600; }
.hub-card p { margin: 0; font-size: 0.75rem; color: var(--text-secondary); line-height: 1.4; }

/* ===== Generic panel / table / kv-grid (artists, certificates pages) ===== */
.panel { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 20px 22px; margin-bottom: 20px; }

.data-table { width: 100%; border-collapse: collapse; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); overflow: hidden; }
.data-table th, .data-table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border-color); font-size: 0.8125rem; }
.data-table th { font-size: 0.6875rem; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-card-subtle); }

.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 20px; margin: 0; }
.kv-grid dt { font-size: 0.6875rem; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.kv-grid dd { margin: 3px 0 0; font-size: 0.8125rem; }

.alias-card { border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 14px 16px; margin-bottom: 12px; }

.inline-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; align-items: center; }
.inline-form input[type="text"] { padding: 8px 10px; border: 1px solid var(--border-color); border-radius: var(--radius-sm); background: var(--bg-canvas); color: var(--text-primary); }

.mono { font-family: var(--font-mono); }
.hint { font-size: 0.75rem; color: var(--text-secondary); }

/* ===== Badges & status pills ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 0.6875rem; font-weight: 500;
  padding: 0.25rem 0.625rem; border-radius: var(--radius-full); white-space: nowrap;
  background: var(--badge-green-bg); color: var(--badge-green-text);
}
.badge--red { background: var(--badge-red-bg); color: var(--badge-red-text); }
.badge--green { background: var(--badge-green-bg); color: var(--badge-green-text); }
.badge--gray { background: var(--badge-gray-bg); color: var(--badge-gray-text); }

.status { display: inline-flex; align-items: center; padding: 0.25rem 0.625rem; border-radius: var(--radius-full); font-size: 0.6875rem; font-weight: 500; background: var(--badge-gray-bg); color: var(--badge-gray-text); }
.status-gueltig, .status-verkauft, .status-im_bestand { background: var(--badge-green-bg); color: var(--badge-green-text); }
.status-reserviert, .status-ausgestellt { background: var(--badge-red-bg); color: var(--badge-red-text); }
.status-gesperrt { background: var(--badge-red-bg); color: var(--badge-red-text); }
.status-archiviert { background: var(--badge-gray-bg); color: var(--badge-gray-text); }

/* ===== Filter bar (Kunstwerke) ===== */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 16px 0; border-bottom: 1px solid var(--border-color); margin-bottom: 16px; }
.filter-bar__search { position: relative; flex: 1 1 240px; min-width: 200px; max-width: 360px; display: flex; align-items: center; }
.filter-bar__search svg { position: absolute; left: 11px; color: var(--text-muted); pointer-events: none; }
.filter-bar__search input {
  width: 100%; padding: 8px 12px 8px 34px; border-radius: var(--radius-sm); border: 1px solid var(--border-color);
  background: var(--bg-card); color: var(--text-primary); font-size: 0.8125rem;
}
.filter-bar__search input::placeholder { color: var(--text-muted); }
.filter-bar select {
  padding: 8px 30px 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-color);
  background: var(--bg-card) url('data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%2216%22 height=%2216%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%2371717a%22 stroke-width=%222%22><path d=%22M6 9l6 6 6-6%22/></svg>') no-repeat right 8px center;
  color: var(--text-primary); font-size: 0.8125rem; appearance: none; cursor: pointer;
}
.filter-bar__count { margin-left: auto; font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }

/* ===== Master / detail split ===== */
.master-detail { display: flex; gap: 20px; align-items: flex-start; }
.master-list { width: 350px; flex: 0 0 350px; max-height: calc(100vh - 260px); min-height: 200px; overflow-y: auto; }
.master-list__item {
  display: flex; gap: 12px; width: 100%; text-align: left; background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); padding: 10px; margin-bottom: 8px; cursor: pointer; transition: all .15s ease-in-out;
}
.master-list__item:hover { border-color: var(--border-color-dark); }
.master-list__item.is-active { border-color: var(--brand-red); box-shadow: 0 0 0 1px var(--brand-red); }
.master-list__thumb { width: 92px; height: 68px; border-radius: var(--radius-sm); flex: 0 0 auto; background-size: cover; background-position: center; }
.master-list__body { min-width: 0; flex: 1; }
.master-list__title { margin: 0 0 2px; font-size: 0.875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.master-list__meta { margin: 0 0 8px; font-size: 0.75rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.master-list__footer { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }

.detail-panel { flex: 1; min-width: 0; max-height: calc(100vh - 260px); overflow-y: auto; padding-right: 4px; }
.detail-panel__empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 260px; color: var(--text-muted); gap: 10px; padding: 40px; }
.detail-panel__empty svg { color: var(--border-color-dark); }
.detail-panel__empty p { margin: 0; font-size: 0.8125rem; max-width: 32ch; }

.detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.detail-header__title { margin: 0 0 4px; font-size: 1.125rem; font-weight: 700; }
.detail-header__meta { margin: 0; font-size: 0.8125rem; color: var(--text-secondary); }
.detail-header__thumb { width: 96px; height: 96px; border-radius: var(--radius-md); flex: 0 0 auto; background-size: cover; background-position: center; border: 1px solid var(--border-color); }
.detail-header__row { display: flex; gap: 16px; align-items: flex-start; width: 100%; }

.section-label { font-size: 0.6875rem; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin: 26px 0 10px; }
.section-label:first-of-type { margin-top: 0; }

.meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 24px; }
.meta-grid__item { border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }
.meta-grid__key { margin: 0 0 3px; font-size: 0.6875rem; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.meta-grid__value { margin: 0; font-size: 0.8125rem; }
.meta-grid__value--masked { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); }

.card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 16px 18px; margin-bottom: 12px; }
.card__header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card__header h3 { margin: 0; font-size: 1rem; font-weight: 600; }

.instance-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border-color); flex-wrap: wrap; }
.instance-row:last-child { border-bottom: none; }
.instance-row__main { display: flex; flex-direction: column; gap: 2px; }
.instance-row__type { font-size: 0.8125rem; font-weight: 500; }
.instance-row__location { font-size: 0.75rem; color: var(--text-secondary); }
.instance-row__right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.cert-preview { border-top: 1px dashed var(--border-color); margin-top: 10px; padding-top: 10px; flex: 0 0 100%; }
.cert-preview__id { font-family: var(--font-mono); font-size: 0.875rem; font-weight: 600; }
.cert-preview__row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; font-size: 0.8125rem; }
.cert-preview__label { color: var(--text-secondary); }

.mini-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 8px; flex: 0 0 100%; }
.mini-form[hidden] { display: none; }
.mini-form select, .mini-form input { padding: 6px 9px; border: 1px solid var(--border-color); border-radius: var(--radius-sm); background: var(--bg-canvas); color: var(--text-primary); font-size: 0.75rem; }

.stepper { display: flex; align-items: center; margin: 12px 0 4px; }
.stepper__step { display: flex; flex-direction: column; align-items: center; gap: 5px; flex: 1; position: relative; }
.stepper__node { width: 18px; height: 18px; border-radius: 50%; background: var(--bg-card-subtle); border: 1px solid var(--border-color-dark); display: flex; align-items: center; justify-content: center; font-size: 0.5625rem; color: var(--text-muted); }
.stepper__step.is-done .stepper__node { background: var(--badge-green-text); border-color: var(--badge-green-text); color: #fff; }
.stepper__step.is-current .stepper__node { background: var(--brand-red); border-color: var(--brand-red); color: #fff; }
.stepper__label { font-size: 0.625rem; color: var(--text-secondary); text-align: center; }
.stepper__step:not(:last-child)::after { content: ""; position: absolute; top: 8px; left: calc(50% + 13px); width: calc(100% - 26px); height: 1px; background: var(--border-color-dark); }
.stepper__step.is-done:not(:last-child)::after { background: var(--badge-green-text); }

/* ===== Modal ===== */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(9, 9, 11, 0.55); z-index: 100; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.is-open { display: flex; }
.modal { background: var(--bg-card); border-radius: var(--radius-md); border: 1px solid var(--border-color); width: 100%; max-width: 440px; max-height: 90vh; overflow-y: auto; padding: 22px 24px; }
.modal__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal__header h2 { margin: 0; font-size: 1.125rem; font-weight: 600; }
.form-field { margin-bottom: 14px; }
.form-field label { display: block; font-size: 0.75rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 5px; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%; padding: 8px 11px; border-radius: var(--radius-sm); border: 1px solid var(--border-color);
  background: var(--bg-canvas); color: var(--text-primary); font-size: 0.8125rem; font-family: inherit;
}
.form-field textarea { resize: vertical; min-height: 90px; }
.form-field__error { display: none; font-size: 0.75rem; color: var(--brand-red); margin-top: 5px; }
.form-field.has-error input, .form-field.has-error select, .form-field.has-error textarea { border-color: var(--brand-red); }
.form-field.has-error .form-field__error { display: block; }
.modal__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ===== Full-page create form (Kunstwerk erfassen) ===== */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 4px 20px; }
.form-grid[hidden] { display: none; }
.form-grid--dims { grid-template-columns: repeat(4, 1fr); }
.form-field--wide { grid-column: 1 / -1; }
.checkbox-field { display: flex; align-items: center; gap: 8px; font-size: 0.8125rem; color: var(--text-secondary); margin-top: 4px; }
.checkbox-field input { width: auto; }
.role-checkboxes { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.role-checkboxes .checkbox-field { margin-top: 0; }
.process-subfields { border-top: 1px solid var(--border-color); margin-top: 12px; padding-top: 4px; }
.status-breakdown { display: flex; flex-wrap: wrap; gap: 6px; }
.input-with-button { display: flex; gap: 6px; }
.input-with-button input { flex: 1; }
.input-with-button .btn { white-space: nowrap; }
.asset-list { list-style: none; margin: 0 0 4px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.asset-list li { display: flex; align-items: center; gap: 8px; font-size: 0.8125rem; }

.asset-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin-bottom: 4px; }
.asset-gallery__item { position: relative; display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 8px; background: var(--bg-card-subtle); }
.asset-gallery__thumb { width: 100%; aspect-ratio: 1; border-radius: var(--radius-sm); background-size: cover; background-position: center; background-color: var(--bg-canvas); }
.asset-gallery__thumb--doc { display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.asset-gallery__thumb--placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  border: 1px dashed var(--border-color-dark); background: var(--bg-canvas); color: var(--text-secondary);
  cursor: pointer; font-size: 0.625rem; font-weight: 500; text-align: center; padding: 6px;
}
.asset-gallery__thumb--placeholder:hover { color: var(--brand-red); border-color: var(--brand-red); }
.asset-gallery__filename { font-size: 0.6875rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-gallery__item [data-delete-asset] { position: absolute; top: 6px; right: 6px; background: var(--bg-card); box-shadow: 0 1px 3px rgba(0,0,0,0.15); padding: 5px; }
.asset-gallery__item [data-delete-asset]:hover { color: var(--brand-red); }

/* Dokumentenliste (beliebig viele Uploads je Kunstwerk): eine Zeile je
   Original-Dokument mit Thumbnail, Hauptbild-Kennzeichnung und
   Download-Links fuer alle automatisch erzeugten Formate. */
.doc-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px; }
.doc-card {
  position: relative; display: flex; align-items: flex-start; gap: 12px;
  border: 1px solid var(--border-color); border-radius: var(--radius-md);
  padding: 10px; background: var(--bg-card-subtle);
}
.doc-card > .asset-gallery__thumb { width: 72px; height: 72px; flex: 0 0 auto; aspect-ratio: unset; }
.doc-card__body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; padding-right: 30px; }
.doc-card__title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.doc-card__set-primary { font-size: 0.6875rem; padding: 3px 8px; }
.doc-card__downloads { display: flex; flex-wrap: wrap; gap: 3px 6px; font-size: 0.6875rem; color: var(--text-muted); }
.doc-card__downloads a { color: var(--brand-red); text-decoration: none; }
.doc-card__downloads a:hover { text-decoration: underline; }
.doc-card > [data-delete-asset] { position: absolute; top: 10px; right: 10px; background: var(--bg-card); box-shadow: 0 1px 3px rgba(0,0,0,0.15); padding: 5px; }
.doc-card > [data-delete-asset]:hover { color: var(--brand-red); }
.section-label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 26px 0 10px; }
.section-label-row .section-label { margin: 0; }
.section-label-row:first-of-type { margin-top: 0; }
.form-actions {
  position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 10px;
  background: var(--bg-canvas); padding: 16px 0; margin-top: 4px; border-top: 1px solid var(--border-color);
}
@media (max-width: 700px) {
  .form-grid--dims { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Public validation portal ===== */
/* Eigene, etwas festlichere Optik fuer die kundenseitigen Portalseiten
   (Validierungsportal, Anmeldung) statt des schlichten Admin-Grau: ein
   ruhiger, markenfarbener Verlauf im Hintergrund, eine Karte mit
   spuerbarerem Schatten und farbigem Abschluss oben. */
.portal-body {
  background: radial-gradient(ellipse at top, #2b3444 0%, #14171e 62%, #0b0d12 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px; font-family: var(--font-sans); color: var(--text-primary);
}
.portal-card {
  background: var(--bg-card); border-radius: 18px; padding: 36px 32px 32px; max-width: 380px; width: 100%;
  text-align: center; border: 1px solid var(--border-color); position: relative; overflow: hidden;
  box-shadow: 0 20px 50px -12px rgba(0,0,0,0.45);
}
.portal-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px;
  background: linear-gradient(90deg, var(--brand-red) 0%, #7c1414 100%);
}
.portal-logo { display: block; height: 34px; margin: 4px auto 22px; }
.portal-footer { margin-top: 26px; text-align: center; font-size: 0.6875rem; color: #9a9da5; letter-spacing: 0.02em; }
.portal-footer a { color: #c9cbd1; }
/* Die "valid"-Ansicht zeigt zusaetzlich Bild + zwei Datenblöcke zum
   Abgleich mit dem physischen Werk und braucht dafuer mehr Platz als
   das schmale Eingabeformular. */
.portal-card--wide { max-width: 480px; text-align: left; }
.portal-card--wide .verify-badge { display: block; text-align: center; margin-left: auto; margin-right: auto; width: fit-content; }
.portal-card--wide h1, .portal-card--wide > .sub { text-align: center; }

.verify-badge { display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px; border-radius: var(--radius-full); font-size: 0.8125rem; font-weight: 700; margin-bottom: 18px; letter-spacing: 0.01em; }
.verify-badge.valid { background: var(--badge-green-bg); color: var(--badge-green-text); }
.verify-badge.invalid { background: var(--badge-red-bg); color: var(--badge-red-text); }
.verify-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.verify-image { display: block; width: 100%; max-height: 260px; object-fit: contain; background: var(--bg-canvas); border-radius: 12px; margin-bottom: 18px; padding: 10px; }
.verify-hint { font-size: 0.8125rem; color: var(--text-secondary); text-align: center; margin: 4px 0 22px; line-height: 1.5; }
.verify-section-title {
  font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--brand-red);
  margin: 24px 0 10px; padding-top: 16px; border-top: 1px solid var(--border-color);
}
.verify-section-title:first-of-type { margin-top: 4px; padding-top: 0; border-top: none; }

.verify-form { text-align: left; margin-top: 20px; }
.verify-form__title { font-size: 1.25rem; margin-bottom: 6px; }
.verify-form__submit { width: 100%; justify-content: center; margin-top: 4px; }

/* ---- Anmeldung/Ersteinrichtung: dieselbe zentrierte Karten-Optik wie
   das Validierungsportal (.portal-body/.portal-card), ergaenzt um ein
   zentriertes Markenzeichen und Fehlermeldungen. ---- */
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 18px; }
.login-brand__mark { width: 30px; height: 30px; background: var(--brand-red); border-radius: 7px; position: relative; }
.login-brand__mark::after { content: ""; position: absolute; inset: 7px; background: var(--bg-card); border-radius: 50%; }
.login-brand__name { margin: 0; font-size: 0.8125rem; font-weight: 700; letter-spacing: .08em; color: var(--text-muted); }

.login-error { background: var(--badge-red-bg); color: var(--badge-red-text); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 0.8125rem; margin: 0 0 4px; }
.login-error-list { background: var(--badge-red-bg); color: var(--badge-red-text); border-radius: var(--radius-sm); padding: 10px 14px 10px 30px; font-size: 0.8125rem; margin: 0 0 4px; }
.login-error-list li { margin: 2px 0; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 980px) {
  .meta-grid { grid-template-columns: 1fr; }
  .master-detail { flex-direction: column; }
  .master-list { width: 100%; flex: 0 0 auto; max-height: 280px; }
  .detail-panel { max-height: none; }
}
@media (max-width: 760px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); }
  .sidebar.is-open { transform: translateX(0); }
  .menu-toggle {
    display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: var(--radius-sm);
    border: 1px solid var(--border-color); background: var(--bg-card); color: var(--text-primary); cursor: pointer;
    padding: 0; flex: 0 0 auto;
  }
  .menu-toggle svg { flex-shrink: 0; }
  .mobile-bar { display: flex; align-items: center; gap: 12px; margin: -18px -18px 20px; padding: 14px 18px; border-bottom: 1px solid var(--border-color); background: var(--bg-canvas); }
  .mobile-bar__title { font-size: 0.9375rem; font-weight: 700; }
  .scrim.is-open { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 30; }
  .content { padding: 18px; }
}
@media (min-width: 761px) { .mobile-bar { display: none; } }
