/* Editor: 3 Spalten 240px | 1fr | 420px */
body.is-editor .main { width: min(1800px, calc(100% - 32px)); padding-top: 14px; }
.editor-top { position: sticky; top: 72px; z-index: 800; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 14px; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.editor-top .title-input { flex: 1 1 220px; min-width: 160px; max-width: 420px; padding: 7px 10px; color: var(--navy); font-size: 18px; font-weight: 700; border-color: transparent; background: transparent; }
.editor-top .title-input:hover { border-color: var(--border); }
.editor-top .title-input:focus { background: #fff; }
.editor-top select { width: auto; padding: 8px 10px; }
.editor-top .spacer { flex: 1; }
.editor-top .group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.editor-sparten { margin-bottom: 14px; padding: 10px 14px; background: #fff; border: 1px solid var(--border); border-radius: 8px; }
.editor-sparten .sparten-bar { align-items: center; }
.sparte-chip { display: inline-flex; align-items: center; border: 2px solid var(--border); border-radius: 5px; background: #fff; overflow: hidden; }
.sparte-chip:hover { border-color: var(--teal); }
.sparte-chip .name { padding: 7px 4px 7px 12px; color: var(--navy); background: none; border: 0; font-weight: 700; font-size: 14px; }
.sparte-chip .act { padding: 7px 6px; color: var(--muted); background: none; border: 0; font-size: 14px; }
.sparte-chip .act:hover { color: var(--teal-dark); background: var(--teal-light); }
.sparte-chip .act.del:hover { color: var(--danger); background: var(--danger-bg); }
.sparte-chip.active { border-color: var(--navy); background: var(--navy); }
.sparte-chip.active .name { color: #fff; }
.sparte-chip.active .act { color: var(--pale-blue); }
.editor-grid { display: grid; grid-template-columns: 240px minmax(0,1fr) 420px; gap: 14px; align-items: start; }
.panel { background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.panel-head { padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--navy); font-weight: 700; font-size: 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.filmstrip-panel { position: sticky; top: 160px; max-height: calc(100vh - 176px); display: flex; flex-direction: column; }
.filmstrip { overflow-y: auto; padding: 8px; flex: 1; outline: none; }
.film-group { margin: 10px 4px 6px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.film-item { position: relative; display: grid; grid-template-columns: 18px 1fr; gap: 6px; padding: 6px; margin-bottom: 6px; border: 2px solid transparent; border-radius: 6px; cursor: pointer; background: #fff; }
.film-item:hover { background: var(--teal-light); }
.film-item[aria-selected=true] { border-color: var(--teal); background: var(--teal-light); }
.film-item.disabled .film-thumb { opacity: .4; filter: grayscale(.7); }
.film-item.readonly .film-thumb { opacity: .75; }
.film-item.dragging { opacity: .4; }
.film-item.drop-before::before, .film-item.drop-after::after { content: ""; position: absolute; left: 0; right: 0; height: 3px; background: var(--teal); border-radius: 2px; }
.film-item.drop-before::before { top: -5px; }
.film-item.drop-after::after { bottom: -5px; }
.film-side { display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 2px; }
.film-side input { width: 14px; height: 14px; padding: 0; }
.film-grip { color: var(--muted); cursor: grab; font-size: 13px; line-height: 1; user-select: none; }
.film-main { min-width: 0; }
.film-thumb { width: 100%; aspect-ratio: 16/9; object-fit: contain; background: var(--bg); border: 1px solid var(--border); border-radius: 3px; display: block; }
.film-meta { display: flex; align-items: center; gap: 5px; margin-top: 4px; font-size: 12px; color: var(--text); }
.film-meta .num { min-width: 18px; color: var(--muted); font-weight: 700; }
.film-meta .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.film-meta .ico { font-size: 12px; color: var(--muted); }
.film-menu { padding: 0 4px; color: var(--muted); background: none; border: 0; border-radius: 3px; }
.film-menu:hover { background: #fff; color: var(--navy); }
.ctx-menu { position: fixed; z-index: 1700; min-width: 210px; padding: 4px; background: #fff; border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow); }
.ctx-menu button { display: block; width: 100%; padding: 8px 12px; text-align: left; color: var(--text); background: none; border: 0; border-radius: 4px; font-size: 13px; }
.ctx-menu button:hover { background: var(--teal-light); }
.preview-panel { position: sticky; top: 160px; }
.preview-stage { padding: 14px; background: var(--bg); overflow: auto; max-height: calc(100vh - 260px); text-align: center; }
.preview-stage img { max-width: 100%; border: 1px solid var(--border); background: #fff; box-shadow: var(--shadow); transition: opacity .2s; }
.preview-stage.zoom img { max-width: none; width: 1400px; }
.preview-stage.loading img { opacity: .4; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; }
.badge-base { color: var(--navy); background: var(--pale-blue); }
.badge-stale { color: var(--warning); background: var(--warning-bg); }
.badge-fresh { color: var(--success); background: var(--success-bg); }
.preview-tools { display: flex; gap: 6px; align-items: center; }
.fields-panel { position: sticky; top: 160px; max-height: calc(100vh - 176px); display: flex; flex-direction: column; }
.fields-body { overflow-y: auto; padding: 4px 14px 16px; }
.fsec { margin-top: 14px; }
.fsec-title { margin: 0 0 8px; padding-bottom: 6px; border-bottom: 2px solid var(--teal); color: var(--navy); font-size: 13px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.fsec-title .btn-link { font-size: 12px; font-weight: 600; }
.fgroup { margin-bottom: 14px; }
.fgroup > label { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.fgroup .req { color: var(--danger); }
.fgroup .help { margin-top: 3px; color: var(--muted); font-size: 12px; }
.fgroup.ro input, .fgroup.ro textarea, .fgroup.ro select { background: var(--bg); color: var(--muted); }
.fgroup .lock { font-size: 12px; color: var(--muted); }
.fgroup .counter { margin-top: 3px; color: var(--muted); font-size: 11px; text-align: right; }
.fgroup .counter.over { color: var(--danger); font-weight: 700; }
.computed-val { padding: 9px 12px; background: var(--bg); border: 1px dashed var(--border); border-radius: 4px; color: var(--muted); font-size: 13px; }
.img-field { display: flex; gap: 10px; align-items: center; }
.img-field .thumb { width: 96px; aspect-ratio: 16/9; object-fit: cover; border: 1px solid var(--border); border-radius: 4px; background: var(--bg); flex: 0 0 auto; display: grid; place-items: center; color: var(--muted); font-size: 11px; }
.img-field .thumb-logo { object-fit: contain; padding: 6px; background-color: #fff; background-image: linear-gradient(45deg, #eef1f4 25%, transparent 25%, transparent 75%, #eef1f4 75%), linear-gradient(45deg, #eef1f4 25%, transparent 25%, transparent 75%, #eef1f4 75%); background-size: 12px 12px; background-position: 0 0, 6px 6px; }
.img-field .btns { display: flex; flex-direction: column; gap: 6px; }
.tbl-edit { overflow-x: auto; }
.tbl-edit table { min-width: 0; font-size: 12px; table-layout: fixed; }
.tbl-edit th.rownum, .tbl-edit th.rowact { background: var(--teal); }
.tbl-edit th { padding: 7px 8px; font-size: 12px; }
.tbl-edit td { padding: 3px; }
.tbl-edit textarea { min-height: 44px; padding: 6px 7px; font-size: 12px; border-color: transparent; background: transparent; resize: vertical; }
.tbl-edit textarea:hover { background: var(--bg); }
.tbl-edit textarea:focus { background: #fff; }
.tbl-edit .rowact { width: 78px; text-align: center; white-space: nowrap; background: var(--bg); }
.tbl-edit .rowact button { width: 22px; height: 24px; padding: 0; color: var(--muted); background: none; border: 0; border-radius: 3px; }
.tbl-edit .rowact button:hover:not(:disabled) { background: #fff; color: var(--navy); }
.tbl-edit .rownum { width: 28px; text-align: center; color: var(--muted); font-weight: 700; background: var(--bg); }
.tbl-edit tr.over td { background: var(--warning-bg); }
.overflow-hint { margin-top: 6px; padding: 6px 9px; border-radius: 4px; background: var(--warning-bg); color: #6b4500; font-size: 12px; }
.list-item { padding: 10px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); }
.list-item .li-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.list-item .sub { margin-bottom: 6px; }
.list-item .sub label { font-size: 12px; font-weight: 600; }
.person-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.empty-fields { padding: 24px 6px; color: var(--muted); text-align: center; font-size: 13px; }
/* Image picker */
.picker { display: grid; grid-template-columns: 210px minmax(0,1fr) 260px; gap: 16px; min-height: 420px; }
.picker-cats { overflow-y: auto; max-height: 520px; border-right: 1px solid var(--border); padding-right: 8px; }
.picker-cats button { display: flex; width: 100%; justify-content: space-between; gap: 8px; padding: 7px 10px; color: var(--text); background: none; border: 0; border-radius: 4px; text-align: left; font-size: 13px; }
.picker-cats button:hover { background: var(--teal-light); }
.picker-cats button[aria-current=true] { color: var(--navy); background: var(--teal-light); font-weight: 700; }
.picker-cats .count { color: var(--muted); font-size: 11px; }
.picker-main { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; overflow-y: auto; max-height: 400px; padding: 2px; align-content: start; grid-auto-rows: max-content; }
.pimg { padding: 0; background: var(--bg); border: 2px solid transparent; border-radius: 4px; overflow: hidden; text-align: left; }
.pimg img { display: block; width: 100%; height: 100px; object-fit: cover; }
.pimg:hover { border-color: var(--pale-blue); }
.pimg[aria-pressed=true] { border-color: var(--teal); box-shadow: var(--shadow); }
.pimg span { display: block; padding: 3px 6px; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-side { display: flex; flex-direction: column; gap: 10px; }
.picker-side img { width: 100%; border-radius: 4px; border: 1px solid var(--border); background: var(--bg); min-height: 120px; object-fit: contain; }
.recent { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.recent button { flex: 0 0 64px; padding: 0; border: 2px solid transparent; border-radius: 4px; background: var(--bg); }
.recent img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.recent-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.sentinel { height: 1px; grid-column: 1 / -1; }
.mobile-tabs { display: none; }
@media (max-width: 1400px) { .editor-grid { grid-template-columns: 210px minmax(0,1fr) 380px; } }
@media (max-width: 1000px) {
  .editor-grid { grid-template-columns: 1fr; }
  .mobile-tabs { display: flex; margin-bottom: 10px; }
  .filmstrip-panel, .preview-panel, .fields-panel { position: static; max-height: none; }
  .filmstrip { display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden; padding: 8px; }
  .film-group { display: none; }
  .film-item { flex: 0 0 150px; margin-bottom: 0; }
  .editor-grid[data-tab=preview] .fields-panel { display: none; }
  .editor-grid[data-tab=fields] .preview-panel { display: none; }
  .picker { grid-template-columns: 1fr; }
  .picker-cats { max-height: 130px; border-right: 0; border-bottom: 1px solid var(--border); }
  .editor-top, .editor-sparten { position: static; }
}
@media (max-width: 780px) {
  .editor-top .title-input { max-width: none; flex-basis: 100%; }
  body.is-editor .main { width: calc(100% - 20px); }
}

button.save-indicator { padding: 4px 8px; background: none; border: 0; text-align: left; cursor: default; }
button.save-indicator[data-state=error], button.save-indicator[data-state=conflict] { cursor: pointer; text-decoration: underline; }
.sparte-chip .act { font-size: 16px; line-height: 1; min-width: 26px; }
.editor-grid > * { min-width: 0; }
