/* Inhaltseditor: Arbeitsoberfläche auf Basis der Design-Tokens der App (vendor/app/www/css/tokens.css). */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--c-bg); color: var(--c-text); }
body { margin: 0; font-family: var(--font-body); font-size: 15px; line-height: 1.5; background: var(--c-bg); color: var(--c-text); }
h1, h2, h3 { font-family: var(--font-display); color: var(--c-ink); margin: 0 0 var(--space-2); line-height: 1.25; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.12rem; }
h3 { font-size: 0.95rem; }
a { color: var(--c-primary); }
.muted { color: var(--c-muted); }
.mono { font-family: var(--font-mono); font-size: 0.86em; word-break: break-all; }
.row { display: flex; gap: var(--space-2); align-items: center; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.stack.small { gap: var(--space-1); margin: var(--space-2) 0; }
.plain { list-style: none; padding: 0; margin: 0; }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-4); background: var(--c-surface-solid); border-bottom: 1px solid var(--c-line); }
.brand { font-family: var(--font-display); font-weight: 700; color: var(--c-ink); text-decoration: none; margin-right: auto; }
.who { color: var(--c-muted); font-size: 0.9rem; }
.page { padding: var(--space-4); max-width: 1680px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--space-4); }

.card { background: var(--c-surface-solid); border: 1px solid var(--c-line); border-radius: var(--radius-lg); padding: var(--space-4); box-shadow: var(--shadow-sm); }
.card.info { background: var(--c-surface-sunken); }
.card.ok { border-color: var(--c-success); }
.card.fail { border-color: var(--c-danger); }

.btn { font: inherit; font-size: 0.92rem; padding: 0.45em 0.9em; border-radius: var(--radius-md); border: 1px solid var(--c-line-strong); background: var(--c-surface-solid); color: var(--c-text); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 0.3em; min-height: 36px; }
.btn:hover:not(:disabled) { border-color: var(--c-primary); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
.btn.primary { background: var(--c-primary-fill, var(--c-primary)); color: var(--c-on-primary); border-color: transparent; }
.btn.danger { color: var(--c-danger-text); border-color: var(--c-danger); }
.btn.small { font-size: 0.85rem; padding: 0.25em 0.65em; min-height: 30px; }
.btn.tiny { font-size: 0.8rem; padding: 0 0.45em; min-height: 26px; min-width: 26px; justify-content: center; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.badge { display: inline-block; font-size: 0.78rem; padding: 0.1em 0.6em; border-radius: var(--radius-pill); background: var(--c-neutral-soft); color: var(--c-text); white-space: nowrap; }
.state-draft, .state-returned { background: var(--c-warning-soft); }
.state-submitted { background: var(--c-primary-soft); }
.state-merged, .pipe-success { background: var(--c-success-soft); color: var(--c-success-text); }
.state-closed, .pipe-failed, .pipe-canceled { background: var(--c-danger-soft); color: var(--c-danger-text); }
.badge.locked { background: var(--c-accent-soft); color: var(--c-accent-text); }

.banner { border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); margin: var(--space-2) 0; background: var(--c-neutral-soft); }
.banner.info { background: var(--c-primary-soft); }
.banner.warning { background: var(--c-warning-soft); }
.banner.error { background: var(--c-danger-soft); color: var(--c-danger-text); }
.banner.success { background: var(--c-success-soft); color: var(--c-success-text); }
.banner ul { margin: var(--space-1) 0; padding-left: 1.2em; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: var(--space-2); border-bottom: 1px solid var(--c-line); vertical-align: top; }
.diff-table td { font-size: 0.88rem; white-space: pre-wrap; word-break: break-word; }
.diff-table tr.added td:last-child { background: var(--c-success-soft); }
.diff-table tr.removed td:nth-child(2) { background: var(--c-danger-soft); }
.diff-table tr.changed td:last-child { background: var(--c-warning-soft); }
.diff-img { max-width: 320px; max-height: 240px; background: #fff; border: 1px solid var(--c-line); }
pre.json { max-height: 420px; overflow: auto; background: var(--c-surface-sunken); padding: var(--space-2); border-radius: var(--radius-sm); font-size: 0.82rem; }

.change-head .meta { margin-top: var(--space-1); }
.change-head .actions { justify-content: flex-end; }
.notes summary { cursor: pointer; margin-top: var(--space-2); }

.workspace { display: grid; grid-template-columns: 270px minmax(0, 1fr) minmax(320px, 0.8fr); gap: var(--space-4); align-items: start; }
.sidebar { position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow: auto; background: var(--c-surface-solid); border: 1px solid var(--c-line); border-radius: var(--radius-lg); padding: var(--space-3); font-size: 0.92rem; }
.sidebar h2 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--c-muted); margin: var(--space-3) 0 var(--space-1); }
.sidebar h3 { font-size: 0.8rem; color: var(--c-muted); margin: var(--space-2) 0 0; }
.tree { list-style: none; padding: 0; margin: 0; }
.tree.sub { padding-left: var(--space-3); border-left: 2px solid var(--c-line); margin-left: var(--space-1); }
.tree li { display: block; margin: 0.1em 0; }
.tree .dot, .tree .lock { margin-left: 0.25em; }
.tree a { text-decoration: none; color: var(--c-text); padding: 0.15em 0.3em; border-radius: var(--radius-xs); }
.tree li.active > a { background: var(--c-primary-soft); color: var(--c-ink); font-weight: 600; }
.tree .dot { color: var(--c-warning); font-size: 0.7rem; }
.tree .lock { font-size: 0.75rem; }

.editor { min-width: 0; }
.preview-pane { position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow: auto; background: var(--c-surface-solid); border: 1px solid var(--c-line); border-radius: var(--radius-lg); padding: var(--space-3); }
.preview-head { margin-bottom: var(--space-2); }
.preview-frame { width: 100%; min-height: 300px; border: 1px solid var(--c-line); border-radius: var(--radius-md); background: var(--c-bg); }

/* Formulare */
.form { display: flex; flex-direction: column; gap: var(--space-3); }
.field { display: flex; flex-direction: column; gap: 0.25em; position: relative; }
.field-label { font-weight: 600; font-size: 0.88rem; color: var(--c-ink); }
.req { color: var(--c-danger); }
.hint { font-size: 0.8rem; color: var(--c-muted); }
input[type="text"], input[type="number"], input:not([type]), select, textarea { font: inherit; font-size: 0.95rem; padding: 0.4em 0.55em; border: 1px solid var(--c-line-strong); border-radius: var(--radius-sm); background: var(--c-surface-solid); color: var(--c-text); width: 100%; max-width: 100%; }
textarea { resize: vertical; min-height: 2.6em; }
input[type="checkbox"] { width: 1.1em; height: 1.1em; }
.field > input[type="checkbox"] { align-self: flex-start; }
.check { display: inline-flex; gap: 0.3em; align-items: center; font-size: 0.9rem; }
fieldset.group { border: 1px solid var(--c-line); border-radius: var(--radius-md); padding: var(--space-3); margin: 0; display: flex; flex-direction: column; gap: var(--space-3); }
fieldset.group > legend { font-weight: 700; font-size: 0.9rem; padding: 0 0.3em; color: var(--c-ink); }
fieldset.readonly { border: 0; padding: 0; margin: 0; }
.object { display: flex; flex-direction: column; gap: var(--space-3); }
.array { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.array-item { border: 1px solid var(--c-line); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); background: var(--c-surface-sunken); }
.array-item > summary { cursor: pointer; display: flex; justify-content: space-between; gap: var(--space-2); align-items: center; }
.array-item[open] > summary { margin-bottom: var(--space-2); }
.array-item .item-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.array-item.primitive { display: flex; gap: var(--space-2); align-items: flex-end; background: transparent; border: 0; padding: 0; }
.array-item.primitive > .field { flex: 1; }
.item-tools { display: inline-flex; gap: 0.2em; flex-shrink: 0; }
.remove-field { position: absolute; right: 0; top: 0; }
.variant { display: flex; flex-direction: column; gap: var(--space-2); }
.variant-select { max-width: 280px; font-weight: 600; }
.add-field { max-width: 280px; color: var(--c-muted); }
.widget { display: flex; flex-direction: column; gap: 0.25em; }
.widget.asset { gap: var(--space-2); }
.asset-thumb img { max-width: 180px; max-height: 120px; background: #fff; border: 1px solid var(--c-line); border-radius: var(--radius-sm); }
.has-error > input, .has-error > textarea, .has-error > select, .has-error > .row > input { border-color: var(--c-danger); }
.field-error { color: var(--c-danger-text); font-size: 0.82rem; }
.const { font-family: var(--font-mono); color: var(--c-muted); }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--space-3); margin: var(--space-3) 0; }
.thumb { margin: 0; border: 1px solid var(--c-line); border-radius: var(--radius-md); padding: var(--space-2); background: var(--c-surface-sunken); }
.thumb img { width: 100%; height: 90px; object-fit: contain; background: #fff; border-radius: var(--radius-xs); }
.thumb figcaption { display: flex; flex-direction: column; font-size: 0.8rem; margin-top: var(--space-1); }
.audio-icon { height: 90px; display: grid; place-items: center; font-size: 2rem; }

.issue-file { margin-top: var(--space-2); }
.issue-file ul { margin: var(--space-1) 0; }
.issue-file li.error { color: var(--c-danger-text); }
.steps li { padding: 0.1em 0; }

.dialog { border: 1px solid var(--c-line); border-radius: var(--radius-lg); padding: var(--space-4); background: var(--c-surface-solid); color: var(--c-text); width: min(520px, 92vw); }
.dialog::backdrop { background: var(--c-scrim, rgba(0,0,0,0.4)); }
.toasts { position: fixed; bottom: var(--space-4); right: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); z-index: 50; }
.toast { background: var(--c-surface-solid); border: 1px solid var(--c-line-strong); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); box-shadow: var(--shadow-md); max-width: 420px; }
.toast-error { border-color: var(--c-danger); color: var(--c-danger-text); }
.toast-warning { border-color: var(--c-warning); }

@media (max-width: 1200px) {
  .workspace { grid-template-columns: 240px minmax(0, 1fr); }
  .preview-pane { grid-column: 1 / -1; position: static; max-height: none; }
}
@media (max-width: 760px) {
  .workspace { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
  .page { padding: var(--space-2); }
}
