/* KUKANILEA Online-Editor -- Arbeitsflaeche.
 *
 * Tokens, Kopf, Landing, FAQ, Karussell, Meldungen und Palette kommen aus
 * assets/lib/kukanilea-datei-oberflaeche/basis.css.
 *
 * Workspace-Vertrag (.claude/rules/webtool-workspace-contract.md):
 *   LANDING  Erklaerung, Ablage, FAQ, Fuss
 *   ARBEIT   kompakter Kopf, Leiste, Buehne + angedockter Inspector
 * Der Zustand steht am Wurzelelement: html[data-oe-modus="arbeit"].
 * Ausgeblendet wird nach Stellung, nicht nach Klassennamen.
 */

.ok-haken { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 15px; cursor: pointer; }
.ok-haken input { width: 20px; height: 20px; accent-color: var(--akzent); }

/* Zwei Arbeitsmodi: "arbeit" (PDF-Seiten) und "text" (CSV/JSON/Markdown/TXT). */
html:not([data-oe-modus="arbeit"]) #oeArbeit, html:not([data-oe-modus="text"]) #oeText { display: none; }
html[data-oe-modus], html[data-oe-modus] body { height: 100%; overflow: hidden; }
html[data-oe-modus] body { display: flex; flex-direction: column; }
html[data-oe-modus] #main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
html[data-oe-modus="arbeit"] #main > :not(#oeArbeit), html[data-oe-modus="text"] #main > :not(#oeText), html[data-oe-modus] .or-fuss { display: none; }
html[data-oe-modus] .re-kopf { min-height: 52px; padding-top: 4px; padding-bottom: 4px; }

/* Text: Feld links, Pruefung und Vorschau rechts (unter 960 px untereinander) */
.oe-text-flaeche { flex: 1; min-height: 0; }
.oe-text-flaeche textarea { min-height: 0; }
.oe-text-seite { display: flex; flex-direction: column; min-height: 0; }
.oe-text-flaeche.nur-text .oe-text-seite { border-top: 1px solid var(--linie); }
.oe-text-flaeche.nur-text { grid-template-rows: minmax(0, 1fr) auto; }
.oe-text-flaeche.nur-text .or-editor-vorschau { display: none; }
.oe-text-fuss { margin: 0; padding: 4px clamp(10px, 2vw, 20px); border-top: 1px solid var(--linie); }

.oe-arbeit { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.oe-leiste { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px clamp(10px, 2vw, 20px); border-bottom: 1px solid var(--linie); background: var(--flaeche); }
.oe-datei { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; }
.oe-datei strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oe-zaehler { color: var(--mut); font-size: 14px; white-space: nowrap; }
.oe-gruppe { display: flex; gap: 6px; align-items: center; }
.oe-ansichten .btn[aria-selected="true"] { background: var(--akzent-weich); color: var(--akzent); border-color: var(--akzent); }

/* Raster: Buehne + angedockter Inspector (kein Abstand, keine Karte) */
.oe-flaeche { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 340px; }
@media (min-width: 960px) and (max-width: 1279.98px) { .oe-flaeche { grid-template-columns: minmax(0, 1fr) minmax(320px, 340px); } }
.oe-buehne { min-height: 0; overflow: auto; background: var(--bg); padding: 16px; display: flex; flex-direction: column; }
.oe-buehne:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--fokus); }
.oe-inspektor { min-height: 0; overflow: auto; border-left: 1px solid var(--linie); background: var(--flaeche); }
.oe-inspektor:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--fokus); }
.oe-werkzeug { padding: 14px 16px; border-bottom: 1px solid var(--linie); display: grid; gap: 8px; }
.oe-werkzeug h2 { margin: 0; font-size: 15px; letter-spacing: .02em; }
.oe-klein { margin: 0; font-size: 14px; color: var(--mut); }
.oe-knoepfe { display: flex; flex-wrap: wrap; gap: 6px; }
.oe-rechts { justify-content: flex-end; }
.oe-feld { display: grid; gap: 4px; font-size: 14px; font-weight: 600; }
.oe-feld input, .oe-feld select { min-height: 44px; padding: 0 10px; border: 1px solid var(--linie-2); border-radius: 10px; background: var(--flaeche); color: var(--ink); font: 15px var(--sans); }
.oe-wahl { border: 0; margin: 0; padding: 0; display: grid; }
.oe-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.oe-chips .btn[aria-pressed="true"] { background: var(--akzent-weich); border-color: var(--akzent); color: var(--akzent); }
.oe-hinzu { position: relative; }
.oe-quellen { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.oe-quellen li { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.oe-quellen li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oe-pad { width: 100%; height: 110px; border: 1px dashed var(--linie-2); border-radius: 10px; background: #fff; touch-action: none; cursor: crosshair; }

/* Seitenuebersicht */
.oe-seiten { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; align-content: start; }
.oe-kachel { position: relative; display: grid; gap: 6px; padding: 8px; border: 2px solid transparent; border-radius: 12px; background: var(--flaeche); box-shadow: var(--schatten); cursor: pointer; touch-action: pan-y; user-select: none; }
.oe-kachel[data-ausgewaehlt="true"] { border-color: var(--akzent); background: var(--akzent-weich); }
.oe-kachel:focus-visible { outline: 3px solid var(--fokus); outline-offset: 2px; }
.oe-kachel.ist-ziel { box-shadow: -4px 0 0 var(--akzent), var(--schatten); }
.oe-kachel.wird-gezogen { opacity: .45; }
.oe-auswahl { display: block; width: 100%; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; border-radius: 6px; }
.oe-auswahl:focus-visible { outline: 3px solid var(--fokus); outline-offset: 3px; }
.oe-bild { aspect-ratio: 1 / 1.2; display: grid; place-items: center; overflow: hidden; background: var(--flaeche-2); border-radius: 6px; }
.oe-bild canvas { max-width: 100%; max-height: 100%; box-shadow: 0 1px 3px rgba(0,0,0,.2); background: #fff; transition: transform .15s; }
.oe-kachel-fuss { display: flex; align-items: center; justify-content: space-between; gap: 4px; font-size: 13px; color: var(--mut); }
.oe-kachel-fuss .oe-mini { display: flex; gap: 2px; }
.oe-mini .btn { min-width: 36px; min-height: 36px; padding: 0; }
.oe-marke-hinweis { position: absolute; top: 12px; right: 12px; font: 700 11px var(--sans); background: var(--akzent); color: var(--akzent-text); border-radius: 999px; padding: 3px 7px; }
@media (pointer: coarse) { .oe-mini .btn { min-width: 44px; min-height: 44px; } }

/* Einzelseite mit Marken */
.oe-einzel { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.oe-einzel-leiste { display: flex; align-items: center; gap: 10px; }
.oe-blatt { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; }
.oe-blatt canvas { max-width: 100%; max-height: 100%; width: auto; height: auto; background: #fff; box-shadow: var(--schatten); display: block; }
.oe-marken { position: absolute; pointer-events: none; }
.oe-marke { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; cursor: grab; touch-action: none; border: 2px dashed transparent; border-radius: 6px; padding: 2px; }
.oe-marke:hover, .oe-marke:focus-visible { border-color: var(--akzent); outline: none; }
.oe-marke-text { font: 800 1em var(--sans); white-space: nowrap; letter-spacing: .02em; }
.oe-marke-text.mit-rahmen { border: .12em solid currentColor; padding: .15em .3em; }
.oe-marke img { display: block; width: 100%; height: auto; }
.oe-marke-weg { position: absolute; top: -18px; right: -18px; width: 36px; height: 36px; min-height: 36px; padding: 0; border-radius: 50%; }
.oe-fuss { margin: 12px 0 0; font-size: 13px; color: var(--mut); text-align: center; }
.oe-fuss a { color: var(--mut); }

.oe-daumen { display: none; }
.oe-dialog { padding: 18px 20px; display: grid; gap: 10px; }
.oe-dialog h2 { margin: 0; font-size: 18px; }
.oe-dialog-label { font-weight: 700; }
dialog#oePasswort .or-palette-eingabe { border: 1px solid var(--linie-2); border-radius: 10px; }

/* Unter 960 px: Buehne voll, Daumenleiste unten, Werkzeug als Blatt */
@media (max-width: 959.98px) {
  .oe-flaeche { grid-template-columns: minmax(0, 1fr); }
  .oe-buehne { padding: 10px 10px calc(var(--daumen-h, 64px) + 10px); }
  .oe-inspektor { position: fixed; left: 0; right: 0; bottom: var(--daumen-h, 64px); max-height: 42dvh; border-left: 0; border-top: 1px solid var(--linie); box-shadow: 0 -8px 24px -12px rgba(0,0,0,.35); z-index: 30; display: none; }
  .oe-inspektor.ist-offen { display: block; }
  .oe-inspektor .oe-werkzeug { display: none; }
  .oe-inspektor .oe-werkzeug.ist-aktiv { display: grid; border-bottom: 0; }
  .oe-daumen { position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--flaeche); border-top: 1px solid var(--linie); }
  .oe-daumen .btn { padding: 0 4px; font-size: 13px; }
  .oe-daumen .btn[aria-expanded="true"] { background: var(--akzent-weich); color: var(--akzent); border-color: var(--akzent); }
  .oe-seiten { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
  .oe-leiste { gap: 6px; }
  .oe-datei { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) { .oe-bild canvas { transition: none; } }
@media (max-width: 959.98px) {
  .oe-text-flaeche:not(.nur-text) { grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
  .oe-text-flaeche.nur-text { grid-template-rows: minmax(0, 1fr) auto; }
}
.oe-md { padding: 14px 18px; max-width: 72ch; line-height: 1.6; }
.oe-md :where(h1, h2, h3) { line-height: 1.25; margin: 1em 0 .4em; }
.oe-md :where(pre, code) { font-family: var(--mono); font-size: 14px; background: var(--flaeche-2); border-radius: 6px; }
.oe-md pre { padding: 10px 12px; overflow: auto; }
.oe-md blockquote { margin: 0; padding-left: 12px; border-left: 3px solid var(--linie-2); color: var(--mut); }
.oe-md table { border-collapse: collapse; } .oe-md :where(th, td) { border: 1px solid var(--linie); padding: 4px 8px; }
.oe-weiter { margin: 0; padding: 8px 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 14px; color: var(--mut); border-bottom: 1px solid var(--linie); background: var(--flaeche-2); }
.oe-weiter[hidden] { display: none; }
