/* Reportverwaltung und Report-Editor */
.rtm-verwaltung { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(280px, 1.2fr); gap: 1rem; align-items: start; }
.rtm-dateibaum { background: var(--flaeche); border: 1px solid var(--rand); border-radius: 8px; padding: .4rem; max-height: calc(100vh - 16rem); overflow: auto; }
.rtm-dateibaum summary { font-weight: 600; padding: .25rem .3rem; cursor: pointer; }
.rtm-dateibaum ul { list-style: none; margin: 0 0 .4rem; padding: 0 0 0 .8rem; }
.rtm-dateibaum li button { width: 100%; text-align: left; border: 0; background: none; padding: .15rem .4rem; border-radius: 4px; color: var(--text); min-height: 0; font-size: .88rem; }
.rtm-dateibaum li button:hover { background: var(--hell); }
.rtm-dateibaum li button[aria-selected="true"] { background: var(--akzent); color: var(--akzent-text); }
.rtm-dateiinfo .knoepfe.links { flex-wrap: wrap; }

main:has(.rtm-editor) { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.rtm-editor { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--grund); outline: none; }
.rtm-kopf { display: flex; flex-wrap: wrap; align-items: end; gap: .4rem 1.2rem; padding: .3rem .8rem 0; background: var(--flaeche); border-bottom: 1px solid var(--rand); }
.rtm-titel { font-size: .95rem; padding-bottom: .3rem; }
.rtm-geaendert { color: var(--fehler); }
.rtm-reiter { margin: 0; display: flex; gap: 2px; }
.rtm-reiter button { border: 1px solid var(--rand); border-bottom: 0; border-radius: 6px 6px 0 0; background: var(--grund); padding: .25rem .9rem; min-height: 0; color: var(--text); }
.rtm-reiter button[aria-current] { background: var(--hell); font-weight: 600; box-shadow: inset 0 3px 0 var(--gold); }
.rtm-leisten { background: var(--hell); border-bottom: 1px solid var(--rand); }
.rtm-leiste { display: flex; flex-wrap: wrap; gap: .3rem; padding: .2rem .5rem; align-items: center; }
.rtm-gruppe { display: flex; align-items: center; gap: 1px; padding: 0 .35rem; border-right: 1px solid var(--rand); }
.rtm-gruppe:last-child { border-right: 0; }
.rtm-gruppe button { min-width: 28px; min-height: 28px; padding: 0 .3rem; border: 1px solid transparent; background: none; border-radius: 4px; color: var(--text); font-size: .95rem; line-height: 1; }
.rtm-gruppe button:hover:not(:disabled) { border-color: var(--rand); background: var(--flaeche); }
.rtm-gruppe button[aria-pressed="true"] { background: var(--akzent); color: var(--akzent-text); }
.rtm-gruppe button:disabled { opacity: .35; }
.rtm-gruppe select, .rtm-gruppe input { min-height: 28px; padding: 0 .3rem; font-size: .85rem; }
.rtm-gruppe input[type=number] { width: 4.5rem; }
.rtm-gruppe input[type=color] { width: 32px; padding: 1px; }
.rtm-fsBold span { font-weight: 700; }
.rtm-fsItalic span { font-style: italic; }
.rtm-fsUnderline span { text-decoration: underline; }
.rtm-inhalt { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.rtm-status { flex: none; font-size: .78rem; color: var(--leise); padding: .15rem .8rem; background: var(--flaeche); border-top: 1px solid var(--rand); min-height: 1.4rem; }

.rtm-entwurf { flex: 1; min-height: 0; display: grid; grid-template-columns: 230px minmax(0, 1fr) 290px; }
.rtm-seitenleiste, .rtm-inspektor { overflow: auto; background: var(--flaeche); padding: .5rem; font-size: .85rem; }
.rtm-seitenleiste { border-right: 1px solid var(--rand); }
.rtm-inspektor { border-left: 1px solid var(--rand); }
.rtm-inspektor h2 { font-size: 1rem; margin-bottom: .4rem; }
.rtm-inspektor h3 { font-size: .9rem; margin: .8rem 0 .3rem; }
.rtm-inspektor label { display: flex; flex-direction: column; gap: .1rem; margin-bottom: .35rem; }
.rtm-inspektor label.haken { flex-direction: row; align-items: center; gap: .4rem; }
.rtm-inspektor :is(input, select, textarea) { font-size: .85rem; min-height: 28px; padding: .1rem .3rem; width: 100%; }
.rtm-inspektor input[type=checkbox] { width: auto; min-height: 0; }
.rtm-inspektor input[type=color] { width: 60px; padding: 1px; }
.rtm-inspektor fieldset { border: 1px solid var(--rand); border-radius: 4px; padding: .2rem .4rem; margin: 0 0 .35rem; }
.rtm-inspektor fieldset .paar { display: flex; flex-wrap: wrap; gap: 0 .6rem; }
.rtm-inspektor .paar { display: flex; gap: .3rem; }
.rtm-inspektor .paar button { min-height: 24px; padding: 0 .35rem; }
.rtm-lage { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .5rem; }
.rtm-rohangaben summary, .rtm-baender summary { cursor: pointer; font-weight: 600; margin: .6rem 0 .3rem; }
.rtm-roh label { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto; align-items: center; gap: .2rem; margin: 0 0 2px !important; }
.rtm-roh span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .75rem; color: var(--leise); }
.rtm-roh input { font-family: ui-monospace, Consolas, monospace; font-size: .75rem !important; min-height: 24px !important; }
.rtm-roh button.klein { min-height: 24px; padding: 0 .35rem; }
.rtm-baender ul { list-style: none; padding: 0; margin: 0 0 .4rem; }
.rtm-baum, .rtm-baum ul { font-size: .8rem; }
.rtm-baum ul { list-style: none; margin: 0; padding-left: .7rem; }
.rtm-baum > ul { padding-left: 0; }
.rtm-baum button { border: 0; background: none; padding: 0 .3rem; min-height: 0; text-align: left; color: var(--text); border-radius: 3px; white-space: nowrap; }
.rtm-baum button.gewaehlt { background: var(--akzent); color: var(--akzent-text); }
.rtm-baum summary, .rtm-feldliste summary { font-weight: 600; cursor: pointer; margin-bottom: .2rem; }
.rtm-feldliste { margin-top: .8rem; }
.rtm-feldliste select { width: 100%; font-size: .8rem; min-height: 28px; }
.rtm-felder { list-style: none; margin: .3rem 0; padding: 0; max-height: 40vh; overflow: auto; border: 1px solid var(--rand); border-radius: 4px; }
.rtm-felder li { padding: .1rem .4rem; cursor: grab; font-size: .8rem; border-bottom: 1px solid var(--hell); }
.rtm-felder li:hover { background: var(--hell); }

/* Arbeitsfläche: immer Papierfarben, unabhängig vom Farbschema */
.rtm-arbeitsflaeche { overflow: auto; padding: 1rem 1.5rem 3rem; background: #8a96a3; }
.rtm-blatt { width: max-content; color: #000; }
.rtm-unterkopf { background: #fff4d6; color: #14263a; padding: .2rem .5rem; margin-bottom: .3rem; font-size: .8rem; }
.rtm-unterkopf button { min-height: 0; padding: 0 .4rem; }
.rtm-lineal { position: relative; height: 5mm; background: #f3f3f3; border-bottom: 1px solid #999; font: 7pt/1 Arial, sans-serif; color: #333; }
.rtm-lineal span { position: absolute; bottom: 0; border-left: 1px solid #777; }
.rtm-lineal span.lang { height: 3.5mm; padding-left: 1px; }
.rtm-lineal span.kurz { height: 1.4mm; }
.rtm-bandkopf { background: #d7dee6; color: #1d2d3d; font: 600 7.5pt/1.6 Arial, sans-serif; padding: 0 .8mm; border-top: 1px solid #9aa7b4; cursor: default; user-select: none; }
.rtm-bandkopf.gewaehlt { background: #0d3b66; color: #fff; }
.rtm-band { position: relative; overflow: hidden; background: #fff; }
.rtm-band.entwurf { background-color: #fff; background-image: linear-gradient(#eef1f4 1px, transparent 1px), linear-gradient(90deg, #eef1f4 1px, transparent 1px); background-size: 5mm 5mm; overflow: visible; user-select: none; }
.rtm-band.einfuegen { cursor: crosshair; }
.rtm-bandgriff { height: 4px; background: #9aa7b4; cursor: ns-resize; }
.rtm-bandgriff:hover { background: #0d3b66; }

.rtm-el { position: absolute; overflow: hidden; line-height: 1.15; display: flex; }
.rtm-text span { flex: 0 1 auto; min-width: 0; }
.rtm-linie { overflow: visible; }
.rtm-linie svg { width: 100%; height: 100%; overflow: visible; }
.rtm-haken { align-items: center; justify-content: center; font-size: 10pt; }
.rtm-platz { border: 1px dashed #8a96a3; background: repeating-linear-gradient(45deg, #f6f8fa, #f6f8fa 4px, #e9edf1 4px, #e9edf1 8px); font: 7pt/1.2 Arial, sans-serif; color: #44505c; padding: .3mm; }
.rtm-platz.rtm-leer { border: 0; background: none; }
.entwurf .rtm-region { outline: 1px dotted #9aa7b4; }
.entwurf .waehlbar { cursor: move; }
.entwurf .waehlbar:hover { outline: 1px solid #5d8fc2; }
.entwurf .gewaehlt { outline: 1px solid #0d3b66; background-color: rgb(13 59 102 / 6%); }
.entwurf .rtm-unsichtbar { opacity: .35; }
.rtm-griffe { position: absolute; pointer-events: none; outline: 1px dashed #0d3b66; z-index: 5; }
.rtm-griffe .griff { position: absolute; width: 7px; height: 7px; background: #fff; border: 1px solid #0d3b66; pointer-events: auto; }
.griff.nw { left: -4px; top: -4px; cursor: nwse-resize; }
.griff.n { left: calc(50% - 4px); top: -4px; cursor: ns-resize; }
.griff.ne { right: -4px; top: -4px; cursor: nesw-resize; }
.griff.e { right: -4px; top: calc(50% - 4px); cursor: ew-resize; }
.griff.se { right: -4px; bottom: -4px; cursor: nwse-resize; }
.griff.s { left: calc(50% - 4px); bottom: -4px; cursor: ns-resize; }
.griff.sw { left: -4px; bottom: -4px; cursor: nesw-resize; }
.griff.w { left: -4px; top: calc(50% - 4px); cursor: ew-resize; }
.rtm-lasso { position: absolute; border: 1px dashed #0d3b66; background: rgb(13 59 102 / 8%); z-index: 6; }

.rtm-vorschau { flex: 1; min-height: 0; overflow: auto; padding: .8rem; }
.rtm-seiten { display: flex; flex-direction: column; align-items: center; gap: 6mm; padding: 4mm 0 10mm; }
.rtm-seite { position: relative; background: #fff; color: #000; box-shadow: 0 2px 10px rgb(0 0 0 / 30%); overflow: hidden; flex: none; }
.rtm-koerper { position: absolute; }
.rtm-koerper > .rtm-band { position: absolute; background-color: transparent; }
.rtm-unter > .rtm-band { position: absolute; left: 0; background-color: transparent; }
.rtm-messen { position: absolute; left: -10000px; top: 0; visibility: hidden; }
.rtm-messen > .rtm-band { position: relative; }
.rtm-daten { overflow: auto; padding: 1rem 1.2rem; }
.rtm-daten details { margin: .2rem 0; }
.rtm-daten summary { cursor: pointer; }

@media (max-width: 1100px) {
  .rtm-entwurf { grid-template-columns: 190px minmax(0, 1fr) 240px; }
  .rtm-verwaltung { grid-template-columns: 1fr; }
}
@media print {
  body.rtm-druckt main:has(.rtm-editor) { display: block; overflow: visible; }
  body.rtm-druckt :is(.rtm-editor, .rtm-inhalt, .rtm-vorschau) { display: block; overflow: visible; padding: 0; }
  body.rtm-druckt .rtm-seiten { display: block; zoom: 1 !important; padding: 0; }
  body.rtm-druckt .rtm-seite { box-shadow: none; break-after: page; margin: 0; }
  body.rtm-druckt .rtm-seite:last-child { break-after: auto; }
  body.rtm-druckt .karte { display: none; }
}

/* Reportexplorer */
main:has(.rtm-explorer) { display: flex; flex-direction: column; }
.rtm-explorer { flex: 1; min-height: 0; display: flex; flex-direction: column; outline: none; }
.rtm-explorerflaeche { flex: 1; min-height: 18rem; display: grid; grid-template-columns: minmax(190px, 270px) minmax(0, 1fr); border: 1px solid var(--rand); border-radius: 6px; overflow: hidden; background: var(--flaeche); }
.rtm-ordnerbaum { overflow: auto; border-right: 1px solid var(--rand); padding: .3rem; font-size: .88rem; }
.rtm-ordnerbaum ul { list-style: none; margin: 0; padding-left: 1rem; }
.rtm-ordnerbaum > ul { padding-left: 0; }
.rtm-knoten { display: flex; align-items: center; }
.rtm-auf { width: 1.2rem; flex: none; border: 0; background: none; padding: 0; min-height: 0; color: var(--leise); }
.rtm-ordner { border: 0; background: none; padding: .1rem .35rem; min-height: 0; text-align: left; color: var(--text); border-radius: 3px; white-space: nowrap; }
.rtm-ordner:hover { background: var(--hell); }
[aria-selected="true"] > .rtm-knoten > .rtm-ordner { background: var(--akzent); color: var(--akzent-text); }
[aria-selected="true"] > .rtm-knoten > .rtm-ordner .info { color: inherit; }
.rtm-dateiliste { overflow: auto; }
.rtm-dateien { width: 100%; border-collapse: collapse; font-size: .86rem; }
.rtm-dateien th { position: sticky; top: 0; background: var(--hell); text-align: left; font-weight: 600; padding: .25rem .5rem; border-bottom: 1px solid var(--rand); }
.rtm-dateien td { padding: .15rem .5rem; white-space: nowrap; cursor: default; user-select: none; }
.rtm-dateien .zahl { text-align: right; }
.rtm-dateien tbody tr:hover { background: var(--hell); }
.rtm-dateien tbody tr[aria-selected="true"] { background: var(--akzent); color: var(--akzent-text); }
.rtm-dateien tr.ausgeschnitten { opacity: .5; }
.rtm-standard { font-style: italic; opacity: .8; }
.rtm-explorerstatus { margin: .3rem 0 0; font-size: .8rem; color: var(--leise); }
.rtm-explorerstatus.warnung { color: var(--fehler); font-weight: 600; }
.rtm-kontext { position: fixed; z-index: 100; min-width: 14rem; background: var(--flaeche); border: 1px solid var(--rand); border-radius: 6px; box-shadow: 0 6px 18px rgb(0 0 0 / 25%); padding: .25rem; display: flex; flex-direction: column; }
.rtm-kontext button { border: 0; background: none; text-align: left; padding: .3rem .6rem; min-height: 0; border-radius: 4px; color: var(--text); font-size: .88rem; }
.rtm-kontext button:hover:not(:disabled), .rtm-kontext button:focus-visible { background: var(--hell); }
.rtm-kontext button:disabled { opacity: .45; }
.rtm-kontext hr { border: 0; border-top: 1px solid var(--rand); margin: .2rem 0; width: 100%; }
dialog.rtm-auswahlfenster { max-width: min(520px, 92vw); }
.rtm-auswahlfenster fieldset { border: 1px solid var(--rand); border-radius: 6px; margin: 0 0 .7rem; padding: .3rem .7rem .5rem; display: flex; flex-direction: column; gap: .15rem; }
.rtm-auswahlfenster legend { color: var(--akzent); font-weight: 600; padding: 0 .3rem; }
.rtm-auswahlfenster label.gesperrt { opacity: .5; }
dialog.rtm-infofenster { max-width: min(760px, 94vw); max-height: 85vh; overflow: auto; }
.rtm-bandfeld { display: flex; flex-direction: column; font-size: .78rem; gap: .1rem; }
.rtm-bandfeld select { min-height: 28px; font-size: .86rem; }
