/* ==========================================================================
   csv.giit.ch - styles for the editor and the text pages
   Light theme, dark theme by system setting or by choice.
   ========================================================================== */

:root {
    --bg: #f3f4f7;
    --flaeche: #ffffff;
    --flaeche-2: #f7f8fa;
    --text: #1a1d26;
    --leise: #5d6475;
    --linie: #e1e3ea;
    --linie-stark: #c9ccd6;
    --marke: #1a7f52;
    --marke-hell: #e3f3ea;
    --marke-text: #ffffff;
    --gefahr: #c62f2f;
    --ai-an: #1f9d55;
    --ai-warte: #f2b632;
    --fehler-bg: #fdecec;
    --auswahl: #1a73e8;
    --buehne: #e8eaef;
    --karo-a: #ffffff;
    --karo-b: #e6e8ee;
    --raster: rgba(26, 115, 232, 0.16);
    --raster-stark: rgba(26, 115, 232, 0.34);
    --schatten: 0 1px 2px rgba(20, 22, 40, 0.06), 0 10px 30px -16px rgba(20, 22, 40, 0.28);
    --code-bg: #fbfbfd;
    --c-tag: #7a3dd8;
    --c-attr: #b25b00;
    --c-wert: #0b7a4b;
    --c-punkt: #8a8fa0;
    --c-komm: #8a8fa0;
    --c-ent: #c2185b;
    --c-sonder: #2b6cb0;
    --mark-sel: rgba(26, 115, 232, 0.14);
    --mark-err: rgba(198, 47, 47, 0.16);
    --r: 10px;
    --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
    color-scheme: light dark;
}
/* Dark theme: by system setting while no choice has been made
   (no data-theme), or fixed with data-theme="dark". */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0f1116;
        --flaeche: #171a21;
        --flaeche-2: #1c2029;
        --text: #e9ebf1;
        --leise: #9ba2b4;
        --linie: #282c37;
        --linie-stark: #3a3f4d;
        --marke: #4fd39a;
        --marke-hell: #173327;
        --marke-text: #0a1020;
        --gefahr: #ff6b6b;
        --ai-an: #3ccf7e;
        --ai-warte: #f2b632;
        --fehler-bg: #3a1c1f;
        --auswahl: #5aa2ff;
        --buehne: #0b0d11;
        --karo-a: #2a2e38;
        --karo-b: #22262f;
        --raster: rgba(90, 162, 255, 0.18);
        --raster-stark: rgba(90, 162, 255, 0.36);
        --schatten: 0 1px 2px rgba(0, 0, 0, 0.35), 0 14px 36px -18px rgba(0, 0, 0, 0.8);
        --code-bg: #12151b;
        --c-tag: #c39bff;
        --c-attr: #ffb86b;
        --c-wert: #6fdca5;
        --c-punkt: #7d8394;
        --c-komm: #6d7385;
        --c-ent: #ff7fb0;
        --c-sonder: #7cb7ff;
        --mark-sel: rgba(90, 162, 255, 0.2);
        --mark-err: rgba(255, 107, 107, 0.22);
    }
}
:root[data-theme="dark"] {
    --bg: #0f1116;
    --flaeche: #171a21;
    --flaeche-2: #1c2029;
    --text: #e9ebf1;
    --leise: #9ba2b4;
    --linie: #282c37;
    --linie-stark: #3a3f4d;
    --marke: #4fd39a;
    --marke-hell: #173327;
    --marke-text: #0a1020;
    --gefahr: #ff6b6b;
    --ai-an: #3ccf7e;
    --ai-warte: #f2b632;
    --fehler-bg: #3a1c1f;
    --auswahl: #5aa2ff;
    --buehne: #0b0d11;
    --karo-a: #2a2e38;
    --karo-b: #22262f;
    --raster: rgba(90, 162, 255, 0.18);
    --raster-stark: rgba(90, 162, 255, 0.36);
    --schatten: 0 1px 2px rgba(0, 0, 0, 0.35), 0 14px 36px -18px rgba(0, 0, 0, 0.8);
    --code-bg: #12151b;
    --c-tag: #c39bff;
    --c-attr: #ffb86b;
    --c-wert: #6fdca5;
    --c-punkt: #7d8394;
    --c-komm: #6d7385;
    --c-ent: #ff7fb0;
    --c-sonder: #7cb7ff;
    --mark-sel: rgba(90, 162, 255, 0.2);
    --mark-err: rgba(255, 107, 107, 0.22);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--marke); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.leise { color: var(--leise); }
:focus-visible { outline: 2px solid var(--auswahl); outline-offset: 1px; }

/* ---------- Buttons and fields ---------- */

.knopf {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 34px; padding: 0 12px;
    background: var(--flaeche); border: 1px solid var(--linie-stark); border-radius: 8px;
    cursor: pointer; white-space: nowrap; font-weight: 500;
    transition: background .12s, border-color .12s;
}
.knopf:hover { background: var(--flaeche-2); border-color: var(--leise); }
.knopf.haupt { background: var(--marke); border-color: var(--marke); color: var(--marke-text); font-weight: 600; }
.knopf.haupt:hover { filter: brightness(1.08); }
.knopf.klein { height: 28px; padding: 0 9px; font-size: 13px; border-radius: 7px; }
.knopf.an { background: var(--marke-hell); border-color: var(--marke); color: var(--marke); }
.knopf.gefahr { color: var(--gefahr); }
.knopf.symbol { width: 34px; padding: 0; font-weight: 700; }
.knopf.mit-symbol { padding: 0 11px 0 9px; }
.knopf:disabled, .wz:disabled { opacity: .4; cursor: not-allowed; }
.knopf:disabled:hover { background: var(--flaeche); border-color: var(--linie-stark); }
.knopf svg, .wz svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
select.knopf { padding-right: 6px; }

input:not([type=checkbox]):not([type=color]):not([type=range]), select:not(.knopf), textarea {
    width: 100%; min-width: 0; height: 30px; padding: 4px 8px;
    background: var(--flaeche); border: 1px solid var(--linie-stark); border-radius: 7px;
}
textarea { height: auto; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--auswahl); box-shadow: 0 0 0 3px var(--mark-sel); }
input[type=color] { width: 34px; height: 30px; padding: 2px; border: 1px solid var(--linie-stark); border-radius: 7px; background: var(--flaeche); cursor: pointer; }

/* ---------- Header ---------- */

.kopf {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 9px 16px; background: var(--flaeche); border-bottom: 1px solid var(--linie);
    position: relative; z-index: 3;
}
.marke { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); margin-right: auto; }
.marke h1 { font-size: 17px; margin: 0; font-weight: 750; letter-spacing: -0.01em; }
.marke h1 span { color: var(--leise); font-weight: 500; }
.leiste { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.schema { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--linie-stark); border-radius: 8px; background: var(--flaeche); }
.schema button {
    width: 28px; height: 28px; display: inline-grid; place-items: center; padding: 0;
    border: 0; border-radius: 6px; background: transparent; color: var(--leise); cursor: pointer;
}
.schema button:hover { color: var(--text); background: var(--flaeche-2); }
.schema button[aria-checked="true"] { background: var(--marke-hell); color: var(--marke); }
.schema svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.trenn { width: 1px; height: 22px; background: var(--linie); margin: 0 4px; }

/* The open drawing (opens "My drawings") and the "New" menu */
.datei-knopf { max-width: 240px; min-width: 0; padding-right: 7px; }
.datei-titel { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.datei-knopf svg { flex: none; }
.knopf svg.pfeil { width: 14px; height: 14px; flex: none; opacity: .6; }
.menue-anker { position: relative; display: inline-flex; }
.menue {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; display: grid; gap: 2px;
    width: min(310px, calc(100vw - 24px)); padding: 6px;
    background: var(--flaeche); border: 1px solid var(--linie-stark); border-radius: 12px; box-shadow: var(--schatten);
}
.menue[hidden] { display: none; }
.menue button {
    display: grid; gap: 1px; padding: 8px 10px; text-align: left;
    border: 0; border-radius: 8px; background: none; cursor: pointer;
}
.menue button:hover, .menue button:focus-visible { background: var(--flaeche-2); outline: none; }
.menue b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menue button span { font-size: 12.5px; color: var(--leise); }
#new-restart { margin-top: 4px; border-top: 1px solid var(--linie); border-radius: 0 0 8px 8px; padding-top: 10px; }

/* ---------- Work area ---------- */

.ansichten { display: none; }
.arbeit {
    --code-fr: 1fr;
    --view-fr: 1fr;
    display: grid;
    grid-template-columns: minmax(0, var(--code-fr)) 6px minmax(0, var(--view-fr)) 290px;
    height: calc(100vh - 53px);
    height: calc(100dvh - 53px);
    min-height: 520px;
}
.pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--flaeche); }
.pane-kopf {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    min-height: 44px; padding: 6px 10px; border-bottom: 1px solid var(--linie);
}
.pane-kopf .rechts { margin-left: auto; display: flex; gap: 6px; }

.splitter { background: var(--linie); cursor: col-resize; position: relative; touch-action: none; }
.splitter::after { content: ""; position: absolute; inset: 50% 1px auto; height: 36px; transform: translateY(-50%); border-left: 2px dotted var(--leise); left: 2px; opacity: .6; }
.splitter:hover, .splitter:focus-visible { background: var(--linie-stark); }

/* ---------- Code ---------- */

.fehler { padding: 8px 12px; background: var(--fehler-bg); color: var(--text); border-bottom: 1px solid var(--linie); font-size: 13px; }
.fehler b { color: var(--gefahr); }
.editor { position: relative; flex: 1; display: flex; min-height: 0; background: var(--code-bg); overflow: hidden; }
.gutter {
    flex: none; width: 46px; overflow: hidden; padding: 10px 8px 10px 0; text-align: right;
    font: 13px/20px var(--mono); color: var(--c-punkt); border-right: 1px solid var(--linie); user-select: none;
}
#gutter { white-space: pre; will-change: transform; }
.code-feld { position: relative; flex: 1; min-width: 0; overflow: hidden; }
.schicht, #code {
    margin: 0; padding: 10px 14px; border: 0;
    font: 13px/20px var(--mono); tab-size: 2; white-space: pre; letter-spacing: 0;
    font-variant-ligatures: none;
}
.schicht { position: absolute; inset: 0 auto auto 0; min-width: 100%; pointer-events: none; will-change: transform; overflow: visible; }
.marks { color: transparent; }
.marks mark { color: transparent; border-radius: 3px; }
.marks mark.sel { background: var(--mark-sel); box-shadow: 0 0 0 1px var(--mark-sel); }
.marks mark.err { background: var(--mark-err); }
#code {
    position: absolute; inset: 0; width: 100%; height: 100%; resize: none; outline: none;
    background: transparent; color: transparent; caret-color: var(--marke);
    overflow: auto; border-radius: 0; box-shadow: none !important;
}
.zeilen-band { position: absolute; left: 0; right: 0; top: 0; height: 20px; background: var(--mark-sel); opacity: 0.45; pointer-events: none; will-change: transform; }
.code-feld:focus-within .zeilen-band { opacity: 1; }
#code::selection { background: rgba(26, 115, 232, 0.28); color: transparent; }
.hl { color: var(--text); }
.hl .k { color: var(--c-tag); }
.hl .a { color: var(--c-attr); }
.hl .s { color: var(--c-wert); }
.hl .p { color: var(--c-punkt); }
.hl .c { color: var(--c-komm); font-style: italic; }
.hl .e { color: var(--c-ent); }
.hl .d { color: var(--c-sonder); }

/* ---------- Tools ---------- */

.werkzeuge { justify-content: space-between; gap: 6px 8px; padding: 6px 8px; }
.gruppe { display: flex; align-items: center; gap: 2px; }
.werkzeuge .trenn { margin: 0 3px; }
.wz {
    width: 30px; height: 30px; display: inline-grid; place-items: center;
    border: 1px solid transparent; border-radius: 7px; background: transparent; cursor: pointer; color: var(--text);
}
.wz:hover { background: var(--flaeche-2); border-color: var(--linie); }
.wz[aria-pressed="true"] { background: var(--marke-hell); border-color: var(--marke); color: var(--marke); }
/* ---------- Stage ---------- */

.buehne {
    position: relative; flex: 1; overflow: hidden; background: var(--buehne);
    touch-action: none; outline: none; cursor: default; user-select: none;
}
.veraltet-hinweis {
    position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: none;
    padding: 4px 12px; border-radius: 99px; background: var(--fehler-bg); color: var(--gefahr); font-size: 12px; font-weight: 600;
    box-shadow: var(--schatten);
}
.buehne.veraltet .veraltet-hinweis { display: block; }

/* ---------- Properties ---------- */

.inspector { border-left: 1px solid var(--linie); }
.reiter { gap: 4px; padding: 6px; }
.reiter button, .ansichten button {
    flex: 1; height: 30px; border: 0; border-radius: 7px; background: transparent; cursor: pointer; font-weight: 600; color: var(--leise);
}
.inspector .reiter { flex-wrap: nowrap; gap: 2px; padding: 6px 4px; }
.inspector .reiter button { flex: 1 1 auto; min-width: 0; padding: 0 6px; font-size: 12.5px; white-space: nowrap; }
.reiter button[aria-selected="true"], .ansichten button[aria-selected="true"] { background: var(--flaeche-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--linie); }
.inspector-body { flex: 1; overflow: auto; padding: 4px 14px 18px; }
.inspector-body h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--leise); margin: 18px 0 8px; font-weight: 700; }
.inspector-body h3 code { text-transform: none; letter-spacing: 0; font: 12px var(--mono); color: var(--c-tag); margin-left: 4px; }
.pfad { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; padding-top: 10px; font: 12px var(--mono); color: var(--leise); }
.pfad button { border: 0; background: none; padding: 1px 3px; border-radius: 4px; color: var(--marke); cursor: pointer; font: inherit; }
.pfad button:hover { background: var(--marke-hell); }
.pfad b { color: var(--text); }
.hinweis { font-size: 12.5px; color: var(--leise); margin: 8px 0; }
.feld { display: grid; grid-template-rows: subgrid; grid-row: span 2; gap: 3px; font-size: 12.5px; min-width: 0; }
.feld > span:first-child { align-self: end; color: var(--leise); font-weight: 500; }
.feld small { font-weight: 400; opacity: .8; }
label.feld + label.feld { margin-top: 0; }
.inspector-body > .feld { margin-top: 10px; grid-template-rows: auto auto; }
.zeile3 { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; gap: 3px 10px; margin-top: 10px; }
.geo { display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: auto auto; gap: 3px 6px; }
.geo input { padding: 4px 5px !important; font-variant-numeric: tabular-nums; }
.knopfreihe { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.knopfreihe .knopf { flex: 1 1 auto; }
.knopfreihe.zwei { display: grid; grid-template-columns: 1fr 1fr; }
.vorgaben { display: grid; grid-template-columns: auto 34px 1fr; align-items: center; gap: 8px 10px; font-size: 12.5px; color: var(--leise); }
.vorgaben input[type=number] { grid-column: 2 / -1; max-width: 120px; }
.mit-keine { display: flex; align-items: center; gap: 6px; min-height: 30px; }
.kasten { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; cursor: pointer; white-space: nowrap; }


/* ---------- Dialogs, messages ---------- */

.dialog {
    width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0;
    border: 1px solid var(--linie); border-radius: 14px; background: var(--flaeche); color: var(--text); box-shadow: var(--schatten);
}
.dialog { overflow: auto; }
.dialog::backdrop { background: rgba(10, 12, 18, 0.45); }
.dialog-kopf { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--linie); margin: 0; }
.dialog-kopf h2 { margin: 0; font-size: 17px; }
.schliessen { width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; font-size: 16px; }
.schliessen:hover { background: var(--flaeche-2); }
.dialog-inhalt { padding: 16px 18px 18px; }
.ex-zeile { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; gap: 3px 12px; margin-bottom: 14px; }
.ex-zeile.vier { grid-template-columns: repeat(4, 1fr); }
.ex-text { width: 100%; height: 240px !important; font: 12px/1.5 var(--mono) !important; white-space: pre; background: var(--code-bg) !important; }
.dialog[data-raster="true"] .nur-text { display: none; }
.dialog[data-raster="false"] .nur-bild { display: none; }
.dialog-fuss { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.dialog-fuss .leise { margin-right: auto; }
.dialog.frage { width: min(440px, calc(100vw - 32px)); }

/* My drawings */
.dialog.dateien { width: min(900px, calc(100vw - 32px)); }
.dateien-leiste { display: flex; gap: 8px; margin-bottom: 14px; }
.dateien-leiste input { flex: 1; height: 34px !important; }
.datei-raster {
    list-style: none; margin: 0 0 12px; padding: 0;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px;
}
.datei-karte {
    display: flex; flex-direction: column; min-width: 0; overflow: hidden; cursor: pointer;
    border: 1px solid var(--linie); border-radius: 12px; background: var(--flaeche);
    transition: border-color .12s, box-shadow .12s;
}
.datei-karte:hover { border-color: var(--linie-stark); box-shadow: var(--schatten); }
.datei-karte.aktuell { border-color: var(--marke); box-shadow: 0 0 0 1px var(--marke); }
.datei-oeffnen { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.datei-oeffnen:focus-visible { outline-offset: -2px; }
.datei-bild {
    display: grid; place-items: center; aspect-ratio: 4 / 3; padding: 12px;
    background-color: var(--karo-a);
    background-image: linear-gradient(45deg, var(--karo-b) 25%, transparent 25%, transparent 75%, var(--karo-b) 75%),
                      linear-gradient(45deg, var(--karo-b) 25%, transparent 25%, transparent 75%, var(--karo-b) 75%);
    background-size: 12px 12px; background-position: 0 0, 6px 6px;
    border-bottom: 1px solid var(--linie);
}
.datei-bild img { width: 100%; height: 100%; object-fit: contain; }
.datei-bild.kaputt img { display: none; }
.datei-bild.kaputt::after { content: "The code has an error"; font-size: 12px; color: var(--gefahr); }
.datei-text { display: grid; padding: 8px 10px 0; min-width: 0; }
.datei-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.datei-info { font-size: 12px; }
.datei-karte.aktuell .datei-info { color: var(--marke); font-weight: 600; }
input.datei-umbenennen { height: 26px !important; font-weight: 600; }
.datei-knoepfe { display: flex; gap: 2px; padding: 4px 6px 6px; }
.datei-knoepfe .ek { display: inline-block; width: 28px; height: 28px; line-height: 28px; border-radius: 7px; }
.datei-knoepfe .ek:hover { background: var(--flaeche-2); }
.datei-knoepfe .ek.gefahr { margin-left: auto; }
.datei-leer { grid-column: 1 / -1; text-align: center; padding: 24px 0; }

/* AI Assistant: change the open drawing or make a new one */
.ai-ziel { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 6px; padding: 0; border: 0; }
.ai-ziel legend { padding: 0; margin-bottom: 6px; font-weight: 600; }
.ai-ziel label {
    display: flex; align-items: flex-start; gap: 8px; padding: 9px 11px; cursor: pointer;
    border: 1px solid var(--linie-stark); border-radius: 10px;
}
.ai-ziel label:has(:checked) { border-color: var(--marke); background: var(--marke-hell); }
.ai-ziel input { flex: none; width: auto !important; height: auto !important; margin: 3px 0 0; accent-color: var(--marke); }
.ai-ziel b { display: block; overflow-wrap: anywhere; }
.ai-ziel small { display: block; color: var(--leise); font-size: 12.5px; }
.frage #ask-text { margin: 0; }

.ai-einfuegen { display: grid; gap: 4px; margin: 4px 0 12px; }
.ai-einfuegen textarea { font: 12px var(--mono); min-height: 44px; }

/* Notice in a tab that was opened by an AI link */
.empfang { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(10, 12, 18, 0.5); }
.empfang[hidden] { display: none; }
.empfang-box { max-width: 420px; padding: 24px; text-align: center; background: var(--flaeche); border-radius: 14px; box-shadow: var(--schatten); }
.empfang-box h2 { margin: 12px 0 6px; font-size: 19px; }
.empfang-box p { margin: 0 0 16px; color: var(--leise); }
.empfang-knoepfe { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.empfang-knoepfe [hidden] { display: none; }

.kuerzel dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 0; }
.kuerzel dt { white-space: nowrap; }
.kuerzel dd { margin: 0; color: var(--leise); }
kbd {
    display: inline-block; min-width: 22px; padding: 1px 6px; text-align: center;
    border: 1px solid var(--linie-stark); border-bottom-width: 2px; border-radius: 5px; background: var(--flaeche-2); font: 12px var(--mono);
}

.toast {
    position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
    padding: 9px 16px; border-radius: 10px; background: var(--text); color: var(--bg); font-weight: 500; box-shadow: var(--schatten);
    transition: opacity .18s, transform .18s; z-index: 20; max-width: calc(100vw - 32px);
}
.toast.zeigen { opacity: 1; transform: translate(-50%, 0); }
.ablage-hinweis {
    position: fixed; inset: 0; display: none; place-items: center; z-index: 30; pointer-events: none;
    background: rgba(26, 127, 82, 0.12); border: 3px dashed var(--marke);
}
.ablage-hinweis span { padding: 14px 22px; border-radius: 12px; background: var(--flaeche); font-size: 18px; font-weight: 700; box-shadow: var(--schatten); }
body.ablegen .ablage-hinweis { display: grid; }

/* ---------- Text section below the editor ---------- */

.seite { max-width: 980px; margin: 0 auto; padding: 48px 16px 24px; font-size: 16px; line-height: 1.65; }
.text-abschnitt { margin-bottom: 44px; }
.text-abschnitt h2 { font-size: 26px; line-height: 1.2; letter-spacing: -0.015em; margin: 0 0 14px; }
.text-abschnitt h3 { font-size: 17px; margin: 0 0 6px; }
.text-abschnitt p { margin: 0 0 12px; }
.einstieg p { font-size: 17px; color: var(--leise); max-width: 760px; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.kachel { padding: 18px 20px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 14px; }
.kachel p { color: var(--leise); margin: 0; font-size: 15px; }
.schritte { padding-left: 22px; margin: 0; }
.schritte li { margin-bottom: 8px; }
.fragen details { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 12px; padding: 0 18px; margin-bottom: 8px; }
.fragen summary { cursor: pointer; font-weight: 600; padding: 13px 0; }
.fragen details p { color: var(--leise); margin: 0 0 14px; }
/* German interface: hidden for the moment until its texts are there (i18n.js). */
html.uebersetzen :is(.kopf, .ansichten, #work, dialog) { visibility: hidden; }
.ai-knopf { position: relative; }
/* An AI is connected: the button lights up green with a check mark; waiting for the key: a yellow dot. */
.knopf.ai-knopf[data-ai="an"], .knopf.ai-knopf[data-ai="an"]:hover { color: var(--ai-an); border-color: var(--ai-an); background: color-mix(in srgb, var(--ai-an) 14%, var(--flaeche)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ai-an) 22%, transparent); }
.ai-knopf[data-ai="an"]::after { content: "✓"; position: absolute; top: -7px; right: -7px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--ai-an); color: #fff; font-size: 11px; font-weight: 700; line-height: 1; box-shadow: 0 0 0 2px var(--flaeche); }
.ai-knopf[data-ai="warte"]::after { content: ""; position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--ai-warte); box-shadow: 0 0 0 2px var(--flaeche); }
.ai-status { list-style: none; margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--linie); border-radius: 12px; font-size: 14px; color: var(--leise); }
.ai-status li { display: flex; gap: 8px; align-items: baseline; }
.ai-status li + li { margin-top: 4px; }
.ai-status li::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--linie-stark); transform: translateY(-1px); }
.ai-status li[data-ai] { color: var(--text); }
.ai-status li[data-ai="an"]::before { background: var(--ai-an); }
.ai-status li[data-ai="warte"]::before { background: var(--ai-warte); }
.ai-remote { margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--marke); border-radius: 12px; background: var(--mark-sel); }
.ai-remote p { margin: 0; }
.ai-remote details { margin-top: 8px; font-size: 14px; }
.ai-remote summary { cursor: pointer; }
.ai-remote-prompt { margin: 6px 0 0; padding: 8px 10px; max-height: 160px; overflow: auto; white-space: pre-wrap; font: 12px/1.45 var(--mono); background: var(--flaeche); border: 1px solid var(--linie); border-radius: 8px; }
.ai-prompt-text { width: 100%; margin: 4px 0 10px; font: 12px/1.45 var(--mono); resize: vertical; }
.beispiel { margin: 0 0 14px; padding: 14px 16px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 12px; overflow-x: auto; font-size: 13px; line-height: 1.5; }
.beispiel code { background: none; padding: 0; white-space: pre; }
.text-abschnitt h3 + p { margin-top: 0; }
.text-abschnitt p + h3, .beispiel + h3 { margin-top: 22px; }
.fuss {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px;
    max-width: 980px; margin: 0 auto; padding: 22px 16px 34px; border-top: 1px solid var(--linie); color: var(--leise); font-size: 14px;
}
.fuss nav { display: flex; gap: 18px; }
.fuss a { color: var(--leise); }
.fuss a:hover { color: var(--marke); }

/* Legal pages */
.recht { max-width: 760px; margin: 0 auto; padding: 36px 16px 20px; font-size: 16px; line-height: 1.65; }
.recht h1 { font-size: 30px; margin: 0 0 4px; letter-spacing: -0.02em; }
.recht h2 { font-size: 19px; margin: 30px 0 8px; }
.recht .stand { color: var(--leise); margin: 0 0 22px; }
.recht address { font-style: normal; margin-bottom: 10px; }
.recht ul { padding-left: 20px; }
.zurueck { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 18px; text-decoration: none; font-weight: 600; }

/* ---------- Medium width: narrower properties ---------- */

@media (max-width: 1180px) {
    .arbeit { grid-template-columns: minmax(0, var(--code-fr)) 6px minmax(0, var(--view-fr)) 250px; }
}

/* ---------- Narrow: one view at a time ---------- */

@media (max-width: 860px) {
    .kopf { padding: 8px 12px; gap: 8px; }
    .marke h1 span { display: none; }
    .leiste.datei .trenn, #btn-download { display: none; }
    .marke h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .leiste { gap: 4px; }
    .leiste.datei { order: 1; flex-wrap: nowrap; }
    .leiste.aus { order: 2; width: 100%; flex-wrap: nowrap; }
    .leiste.aus #btn-export { margin-left: auto; }
    #btn-undo, #btn-redo, #btn-new { width: 34px; padding: 0; }
    #btn-undo .txt, #btn-redo .txt, #btn-new .txt { display: none; }
    .datei-knopf { max-width: 42vw; }
    .menue { position: fixed; top: 52px; left: 12px; right: 12px; width: auto; }
    .leiste.datei { flex: 1; min-width: 0; }
    .dateien-leiste { flex-wrap: wrap; }
    .dateien-leiste input { flex-basis: 100%; }
    .dateien-leiste .knopf { flex: 1; }
    .datei-raster { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
    .ai-ziel { grid-template-columns: 1fr; }
    .ansichten { display: flex; gap: 4px; padding: 6px 12px; background: var(--flaeche); border-bottom: 1px solid var(--linie); }
    .arbeit { display: block; height: calc(100dvh - 148px); min-height: 440px; }
    .hinweiszeile {
        top: 8px; right: 8px; bottom: auto; left: 8px; padding: 4px 9px; border-radius: 8px;
        background: var(--flaeche); border: 1px solid var(--linie); text-shadow: none; font-size: 12px;
    }
    .veraltet-hinweis { top: 46px; }
    .buehne .zoom { left: 8px; right: 8px; bottom: 8px; justify-content: center; }
    .ex-text { height: 140px !important; }
    .dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
    .dialog-inhalt { padding: 14px 14px 0; }
    .dialog-fuss { position: sticky; bottom: 0; padding: 10px 0 14px; background: var(--flaeche); display: grid; grid-template-columns: 1fr 1fr; }
    .dialog-fuss .leise:empty { display: none; }
    .dialog-fuss .leise, .dialog-fuss .haupt:last-child { grid-column: 1 / -1; }
    .arbeit > .pane, .splitter { display: none; height: 100%; }
    .arbeit[data-show="code"] .code-pane,
    .arbeit[data-show="tabelle"] .tabellen-pane,
    .arbeit[data-show="eigenschaften"] .inspector { display: flex; }
    .inspector { border-left: 0; }
    .werkzeuge { justify-content: flex-start; }
    .seite { padding-top: 32px; }
    .text-abschnitt h2 { font-size: 22px; }
    .ex-zeile.vier { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto auto auto; }
}
@media (max-width: 480px) {
    #btn-open { display: none; }
    .ex-zeile { grid-template-columns: 1fr; grid-template-rows: auto auto auto auto; }
    .kuerzel dl { grid-template-columns: 1fr; gap: 2px; }
    .kuerzel dd { margin-bottom: 8px; }
}

/* ==========================================================================
   CSV editor
   ========================================================================== */

/* Code: columns in colors, separators and quotes muted, the header row bold */
.hl .h { font-weight: 700; }
.hl .f0 { color: var(--text); }
.hl .f1 { color: var(--c-tag); }
.hl .f2 { color: var(--c-wert); }
.hl .f3 { color: var(--c-attr); }
.hl .f4 { color: var(--c-sonder); }
.hl .f5 { color: var(--c-ent); }
.hl .p { color: var(--c-punkt); font-weight: 700; }
.hl .p.tab { background: var(--mark-sel); border-radius: 2px; }
.hl .q { color: var(--c-punkt); }
.schicht, #code { tab-size: 4; }
.marks { padding: 0; inset: 0; width: 100%; height: 100%; overflow: hidden; }
.marks .band, .marks .zeilen-band { position: absolute; left: 0; right: 0; height: 20px; pointer-events: none; }
.marks .band.err { background: var(--mark-err); }
.marks .band.warn { background: rgba(214, 158, 46, .18); }
.marks .zeilen-band { background: var(--mark-sel); opacity: 1; }
.marks .feld-mark { position: absolute; height: 20px; border-radius: 3px; background: var(--mark-sel); box-shadow: inset 0 0 0 1.5px var(--auswahl); }
.marks .feld-mark.zeile { right: 0; }

/* Problems above the code */
.probleme { display: grid; gap: 2px; max-height: 30%; overflow: auto; padding: 6px 10px; }
.probleme .pr-kopf { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.probleme .pr-kopf button { margin-left: auto; }
.probleme ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 1px; }
.probleme li button {
    display: flex; gap: 8px; width: 100%; padding: 3px 6px; border: 0; border-radius: 6px; background: none;
    text-align: left; cursor: pointer; font-size: 12.5px; color: var(--text);
}
.probleme li button:hover { background: rgba(127, 127, 127, .14); }
.probleme .zeile-nr { flex: none; min-width: 52px; color: var(--leise); font-variant-numeric: tabular-nums; }
.probleme .err .art { color: var(--gefahr); }
.probleme .art { flex: none; font-weight: 700; width: 14px; text-align: center; color: #b7791f; }
.fehler.nur-warnungen { background: var(--flaeche-2); }

/* Table toolbar */
.werkzeuge { flex-wrap: wrap; }
.filter-gruppe { gap: 6px; flex: 1 1 320px; min-width: 0; }
.filter-gruppe input { flex: 1 1 140px; min-width: 90px; }
.filter-gruppe select { flex: 0 1 150px; min-width: 80px; }
#view-info { white-space: nowrap; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.sortierung { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--leise); margin-right: 6px; }
.sortierung b { color: var(--text); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The table */
.buehne.tabelle { touch-action: auto; user-select: none; background: var(--flaeche); }
.raster { position: absolute; inset: 0; overflow: auto; outline: none; font-size: 13px; overscroll-behavior: contain; }
.raster:focus-visible { box-shadow: inset 0 0 0 2px var(--auswahl); }
.raster-flaeche { position: relative; min-width: 100%; }
.raster-kopf { position: sticky; top: 0; z-index: 3; display: flex; height: 30px; background: var(--flaeche-2); border-bottom: 1px solid var(--linie-stark); }
.raster-zeilen { position: absolute; left: 0; right: 0; top: 30px; }
.zr { position: absolute; left: 0; display: flex; height: 26px; }
.ecke, .nr {
    position: sticky; left: 0; z-index: 2; flex: none; width: 58px; padding: 0 8px; text-align: right;
    background: var(--flaeche-2); border-right: 1px solid var(--linie-stark); color: var(--leise);
    font-size: 11.5px; font-variant-numeric: tabular-nums; cursor: pointer;
}
.ecke { display: block; border-bottom: 0; }
.nr { line-height: 26px; border-bottom: 1px solid var(--linie); }
.zr.zeile-an .nr { background: var(--marke-hell); color: var(--marke); font-weight: 700; }
.zr.neu .nr { color: var(--marke); font-size: 14px; }
.kz {
    position: relative; flex: none; display: flex; align-items: center; gap: 5px; padding: 0 22px 0 7px; overflow: hidden;
    border-right: 1px solid var(--linie); cursor: pointer; white-space: nowrap;
}
.kz small { flex: none; color: var(--leise); font-size: 10.5px; font-weight: 600; }
.kz b { overflow: hidden; text-overflow: ellipsis; font-weight: 650; }
.kz em { color: var(--leise); font-weight: 400; }
.kz.spalte-an { background: var(--marke-hell); }
.kz.spalte-an small { color: var(--marke); }
.kz.a { box-shadow: inset 0 0 0 2px var(--auswahl); }
.kz.leer { cursor: default; }
.sortieren {
    position: absolute; right: 4px; top: 6px; width: 17px; height: 17px; padding: 0; border: 0; border-radius: 4px;
    background: transparent; color: var(--leise); font-size: 10px; line-height: 17px; cursor: pointer; opacity: .55;
}
.kz:hover .sortieren, .sortieren.an { opacity: 1; }
.sortieren.an { color: var(--marke); background: var(--flaeche); }
.ziehen { position: absolute; right: -3px; top: 0; bottom: 0; width: 7px; cursor: col-resize; z-index: 1; }
.z {
    flex: none; height: 26px; padding: 0 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    line-height: 25px; border-right: 1px solid var(--linie); border-bottom: 1px solid var(--linie); cursor: cell;
}
.z.zahl { text-align: right; font-variant-numeric: tabular-nums; }
.z.leer { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--flaeche-2) 6px 7px); }
.z.fehlt { background: color-mix(in srgb, #d69e2e 12%, transparent); }
.z.b { background: var(--mark-sel); }
.z.a { box-shadow: inset 0 0 0 2px var(--auswahl); background: var(--flaeche); }
.z.b.a { background: var(--mark-sel); }
.z .nl { color: var(--leise); font-style: normal; padding: 0 2px; }
.zelle-feld {
    position: absolute; z-index: 4; min-height: 26px; padding: 3px 7px !important; resize: none;
    font: 13px/18px system-ui, -apple-system, "Segoe UI", Roboto, sans-serif !important; border-radius: 0 !important;
    border: 2px solid var(--auswahl) !important; box-shadow: var(--schatten) !important; white-space: pre; overflow: hidden;
}
.leer-hinweis { position: absolute; left: 50%; top: 110px; transform: translateX(-50%); width: min(420px, 90%); margin: 0; padding: 12px 16px; text-align: center; color: var(--leise); background: var(--flaeche); border: 1px dashed var(--linie-stark); border-radius: 10px; pointer-events: none; }

/* Side panel */
.doc-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding-top: 10px; }
.doc-form .knopf, .einfuege-gitter.eins .knopf { white-space: normal; height: auto; min-height: 28px; padding-top: 4px; padding-bottom: 4px; line-height: 1.25; text-align: left; }
.doc-form .zeile2 { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.doc-form .zeile2.unten { align-items: end; }
.doc-form select, .doc-form input:not([type=checkbox]) { min-width: 0; width: 100%; }
.doc-form .feld { grid-row: auto; grid-template-rows: auto auto; }
.doc-form .kasten { font-size: 13px; white-space: normal; align-items: flex-start; gap: 7px; }
.doc-form .kasten input { flex: none; width: 16px; height: 16px; margin-top: 2px; accent-color: var(--marke); }
.doc-form .unter { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--leise); font-weight: 700; margin: 10px 0 0; }
.doc-info { padding: 10px 12px; border: 1px solid var(--linie); border-radius: var(--r); background: var(--flaeche-2); font-size: 12.5px; color: var(--leise); }
.spalten-info { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; margin: 8px 0 0; font-size: 13px; }
.spalten-info dt { color: var(--leise); }
.spalten-info dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.haeufig { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: 13px; }
.haeufig li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 8px; border-radius: 6px; background: var(--flaeche-2); }
.haeufig span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.haeufig b { color: var(--leise); font-weight: 600; font-variant-numeric: tabular-nums; }
.einfuege-gruppe h3 { margin-top: 16px !important; }
.einfuege-gitter { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; }
.einfuege-gitter.eins { grid-template-columns: 1fr; }
.einfuege-gitter .knopf { height: 30px; padding: 0 8px; justify-content: flex-start; font-size: 12.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }

/* My documents: the first rows as the picture */
.datei-bild.dok { background: var(--buehne); padding: 12px 10px 0; place-items: stretch; overflow: hidden; }
.mini-tabelle { display: grid; align-content: start; gap: 1px; height: 100%; padding: 6px; overflow: hidden; background: #ffffff; color: #222222; box-shadow: 0 1px 4px rgba(0, 0, 0, .2); font: 8px/1.5 system-ui, sans-serif; }
.mz { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; border-bottom: 1px solid #e3e6ec; }
.mz span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mz.kopfzeile { font-weight: 700; color: #1a7f52; }

/* Export */
.dialog[data-format="xlsx"] .nur-csv, .dialog[data-format="json"] .nur-csv, .dialog[data-format="md"] .nur-csv, .dialog[data-format="html"] .nur-csv { display: none; }
.dialog[data-format="tsv"] .nur-sep { visibility: hidden; }

/* Save to server */
.sync-felder { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; gap: 3px 12px; margin: 14px 0 10px; }
.sync-wahl { display: flex; align-items: flex-start; gap: 8px; white-space: normal; margin: 6px 0; font-size: 13.5px; }
.sync-wahl input { margin-top: 3px; accent-color: var(--marke); }
.sync-hilfe { margin-top: 10px; border: 1px solid var(--linie); border-radius: 10px; padding: 0 12px; }
.sync-hilfe summary { cursor: pointer; padding: 9px 0; font-weight: 600; }
.code-beispiel { margin: 0 0 10px; padding: 10px; overflow: auto; background: var(--code-bg); border: 1px solid var(--linie); border-radius: 8px; font: 11.5px/1.5 var(--mono); }
#btn-sync.an { color: var(--marke); border-color: var(--marke); background: var(--marke-hell); }

/* Embedded in another website: only the editor */
.eingebettet .seite, .eingebettet .fuss, .eingebettet .marke h1 span { display: none; }
.eingebettet .arbeit { height: calc(100vh - 53px); height: calc(100dvh - 53px); min-height: 320px; }
.eingebettet body { overflow: hidden; }

@media (max-width: 860px) {
    .arbeit[data-show="tabelle"] .tabellen-pane { display: flex; }
    .sync-felder { grid-template-columns: 1fr; grid-template-rows: auto auto auto auto; }
    .eingebettet .arbeit { height: calc(100dvh - 148px); }
    .filter-gruppe { flex-basis: 100%; }
}
@media (max-width: 480px) {
    #btn-ai { width: 34px; padding: 0; }
    #btn-ai .txt { display: none; }
}
.inspector .knopfreihe.zwei { grid-template-columns: repeat(2, minmax(0, 1fr)); }
