/* Textfassung: Schalter, Kurzhinweis, Freigabe je Aenderung (nur Vorschau, 25.10.2026).
 * Skript texte-freigabe.js. Jonas: "Der Einschalter und alles soll eher ganz klein
 * unten versteckt sitzen, falls waehrend wir testen jemand auf der Seite
 * vorbeischaut, muss es ihm nicht auffallen."
 * Unten links neben dem gelben Pult-Knopf (unten rechts sitzt der Theme-Knopf
 * "nach oben"). Halbtransparent, beim Darueberfahren und mit Fokus deutlich.
 * Kontraste: Nachtblau auf Weiss 17:1, Weiss auf #c4006b 5,9:1, auf #1d6b3a 6,6:1,
 * auf #a01c1c 7,4:1. */
.g-tx-schalter, .g-tx-feld, .g-tx-dialog, .g-tx-toast, .g-tx-marker {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  letter-spacing: 0 !important; text-transform: none !important; text-shadow: none !important;
  box-sizing: border-box;
}
.g-tx-feld *, .g-tx-dialog * { box-sizing: border-box; letter-spacing: 0; text-transform: none; text-shadow: none; }

/* ---------------------------------------------------------- Schalter */
.g-tx-schalter {
  position: fixed; left: var(--g-txs-links, 152px); bottom: var(--g-txs-unten, 20px); z-index: 2147482990;
  display: inline-flex !important; align-items: center; justify-content: center;
  width: 30px !important; height: 30px !important; min-width: 0 !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important;
  border: 1px solid #8995a0 !important; border-radius: 50% !important; background: #fff !important; color: #051c2c !important;
  font-size: 14px !important; font-weight: 700 !important; line-height: 1 !important; cursor: pointer;
  opacity: .42; box-shadow: 0 2px 8px rgba(0, 0, 0, .12); transition: opacity .15s;
}
.g-tx-schalter:is(:hover, :focus-visible, [aria-expanded="true"]) { opacity: 1; }
.g-tx-schalter:focus-visible { outline: 3px solid #051c2c !important; outline-offset: 2px; }
/* Punkt oben rechts: neue Texte oder Marken sind an. */
.g-tx-schalter::after {
  content: ""; position: absolute; top: -2px; right: -2px; width: 9px; height: 9px; border-radius: 50%;
  background: #c4006b; border: 2px solid #fff; display: none;
}
html:is([data-g-texte="neu"], [data-g-marken="an"]) .g-tx-schalter::after { display: block; }
html.g-pult-zielt .g-tx-schalter { display: none !important; }
/* Saesse er auf einem Knopf oder Verweis der Einwilligungsleiste (600 bis 1366 px): weg, bis sie zu ist. */
.g-tx-schalter.g-tx-schalter--weg { visibility: hidden !important; }

/* ------------------------------------------------------------- Feld */
.g-tx-feld {
  position: fixed; left: var(--g-txs-feld-links, 16px); bottom: 62px; z-index: 2147482991;
  width: 300px; max-width: calc(100vw - 32px); max-height: calc(100vh - 80px); overflow: auto;
  padding: 12px 14px 12px; border: 1px solid #d3d9df; border-radius: 10px; background: #fff; color: #1c1c1c;
  font-size: 14px; line-height: 1.4; box-shadow: 0 12px 34px rgba(0, 0, 0, .22);
}
.g-tx-feld[hidden] { display: none !important; }
.g-tx-feld p { margin: 0 0 8px !important; font-size: 14px !important; line-height: 1.4 !important; color: #1c1c1c !important; }
.g-tx-feld .g-tx-feld__titel { font-weight: 700 !important; color: #051c2c !important; }
.g-tx-feld__zeile { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; }
.g-tx-feld__zeile > span:first-child { flex: 1; }
.g-tx-feld kbd { font: 700 11px/1 ui-monospace, monospace; padding: 3px 6px; border-radius: 4px; background: #eef1f4; color: #33404a; }
.g-tx-feld button, .g-tx-dialog button {
  font: 600 14px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  height: auto !important; min-height: 0 !important; margin: 0 !important; box-shadow: none !important; text-decoration: none !important;
}
.g-tx-feld__an {
  min-width: 58px !important; padding: 7px 12px !important; border-radius: 999px !important;
  border: 1px solid #051c2c !important; background: #fff !important; color: #051c2c !important; cursor: pointer;
}
.g-tx-feld__an[aria-pressed="true"] { background: #051c2c !important; color: #fff !important; }
.g-tx-feld__zahl, .g-tx-feld__export {
  display: block; width: 100%; margin: 0 0 8px !important; padding: 8px 10px !important; text-align: left;
  border: 1px solid #d3d9df !important; border-radius: 8px !important; background: #f6f8fa !important; color: #051c2c !important; cursor: pointer;
}
.g-tx-feld__zahl:disabled { cursor: default; color: #55616b !important; }
.g-tx-feld__export { background: #051c2c !important; color: #fff !important; border-color: #051c2c !important; }
.g-tx-feld a.g-tx-feld__alle { display: inline-block; margin: 0 0 8px; color: #051c2c !important; font-weight: 600; text-decoration: underline !important; text-underline-offset: .2em; }
.g-tx-feld .g-tx-feld__ort { font-size: 13px !important; color: #4a5560 !important; margin: 0 !important; }
.g-tx-feld :is(button, a):focus-visible, .g-tx-dialog :is(button, a, input, textarea):focus-visible { outline: 3px solid #c4006b !important; outline-offset: 2px; }

/* ------------------------------------------------------- Kurzhinweis */
.g-tx-toast {
  position: fixed; left: 50%; bottom: 72px; transform: translateX(-50%); z-index: 2147483002;
  max-width: calc(100vw - 32px); padding: 9px 14px; border-radius: 8px; background: #051c2c; color: #fff;
  font-size: 14px; font-weight: 600; line-height: 1.3; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); pointer-events: none;
}
.g-tx-toast[hidden] { display: none !important; }

/* ------------------------------------------------- Marker je Aenderung
 * Nur sichtbar, wenn neue Texte und Marken an sind. Sitzt an der oberen linken
 * Ecke der Stelle (links laeuft nichts aus dem Fenster). Zeichen: ? offen,
 * Haken freigegeben, Kreuz abgelehnt, Stift geaendert (aus CSS, der Text der
 * Stelle bleibt unberuehrt). */
.g-tx-marker { display: none !important; }
html[data-g-marken="an"]:not([data-g-texte="alt"]) .g-tx-marker {
  display: inline-flex !important; align-items: center; justify-content: center;
  position: absolute !important; top: -11px; left: -11px; z-index: 81;
  width: 22px !important; height: 22px !important; min-width: 0 !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important;
  border: 2px solid #fff !important; border-radius: 50% !important; background: #c4006b !important; color: #fff !important;
  font-size: 12px !important; font-weight: 700 !important; line-height: 1 !important; font-style: normal !important;
  cursor: pointer; box-shadow: 0 1px 4px rgba(0, 0, 0, .3) !important; text-decoration: none !important; float: none !important;
}
.g-tx-marker::before { content: "?"; }
.g-tx-marker[data-status="freigegeben"] { background: #1d6b3a !important; }
.g-tx-marker[data-status="freigegeben"]::before { content: "\2713"; }
.g-tx-marker[data-status="abgelehnt"] { background: #a01c1c !important; }
.g-tx-marker[data-status="abgelehnt"]::before { content: "\2715"; }
.g-tx-marker[data-status="geaendert"] { background: #051c2c !important; }
.g-tx-marker[data-status="geaendert"]::before { content: "\270E"; }
.g-tx-marker:focus-visible { outline: 3px solid #051c2c !important; outline-offset: 2px; }
/* Ganze Stelle anklickbar, solange Marken an sind. */
html[data-g-marken="an"]:not([data-g-texte="alt"]) :is(.g-tx--neu, .g-tx-weg)[data-g-tx-zu] { cursor: pointer; }
html[data-g-marken="an"]:not([data-g-texte="alt"]) :is(.g-tx--neu, .g-tx-weg)[data-g-tx-zu].g-tx-gewaehlt { outline: 3px solid #051c2c !important; outline-offset: 3px; }

/* ----------------------------------------------------- Freigabe-Feld */
.g-tx-dialog {
  position: fixed; left: 16px; bottom: 62px; z-index: 2147483001;
  width: 440px; max-width: calc(100vw - 32px); max-height: calc(100vh - 80px); overflow: auto; overscroll-behavior: contain;
  padding: 14px 16px 16px; border: 1px solid #d3d9df; border-radius: 12px; background: #fff; color: #1c1c1c;
  font-size: 14px; line-height: 1.45; box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
}
.g-tx-dialog[hidden] { display: none !important; }
/* Steht die Stelle links (die meisten Texte), sitzt das Feld rechts. */
.g-tx-dialog--rechts { left: auto; right: 16px; }
.g-tx-dialog p { margin: 0 0 8px !important; font-size: 14px !important; line-height: 1.45 !important; color: #1c1c1c !important; }
.g-tx-dialog__kopf { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 10px; }
.g-tx-dialog__kopf h2 { flex: 1; margin: 0 !important; padding: 0 !important; font: 700 16px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important; color: #051c2c !important; }
.g-tx-dialog__kopf h2 span { display: block; font-weight: 400; font-size: 13px; color: #4a5560; }
.g-tx-dialog__zu { width: 32px !important; padding: 6px 0 !important; border: 0 !important; border-radius: 6px !important; background: #eef1f4 !important; color: #051c2c !important; font-size: 18px !important; cursor: pointer; }
.g-tx-dialog__text { margin: 0 0 10px; padding: 8px 10px; border-radius: 8px; background: #f6f8fa; white-space: pre-line; overflow-wrap: anywhere; }
.g-tx-dialog__text--neu { background: #fdeef6; }
.g-tx-dialog__text strong { display: block; margin-bottom: 2px; font-size: 12px; text-transform: uppercase !important; letter-spacing: .06em; color: #4a5560; }
.g-tx-dialog__text--neu strong { color: #8a0049; }
.g-tx-dialog .g-tx-dialog__grund { font-size: 13px !important; color: #4a5560 !important; }
.g-tx-dialog__wahl { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.g-tx-dialog__wahl button {
  flex: 1 1 auto; padding: 9px 12px !important; border-radius: 8px !important; cursor: pointer;
  border: 1px solid #051c2c !important; background: #fff !important; color: #051c2c !important;
}
.g-tx-dialog__wahl button[aria-pressed="true"][data-status="freigegeben"] { background: #1d6b3a !important; border-color: #1d6b3a !important; color: #fff !important; }
.g-tx-dialog__wahl button[aria-pressed="true"][data-status="abgelehnt"] { background: #a01c1c !important; border-color: #a01c1c !important; color: #fff !important; }
.g-tx-dialog__wahl button[aria-pressed="true"][data-status="geaendert"] { background: #051c2c !important; color: #fff !important; }
.g-tx-dialog label { display: block; margin: 0 0 10px; font-weight: 600; font-size: 13px; color: #33404a; }
.g-tx-dialog :is(textarea, input[type="text"]) {
  display: block; width: 100% !important; margin: 4px 0 0 !important; padding: 8px 10px !important;
  border: 1px solid #8995a0 !important; border-radius: 6px !important; background: #fff !important; color: #1c1c1c !important;
  font: 400 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important; height: auto !important; min-height: 0 !important;
}
.g-tx-dialog textarea { resize: vertical; }
.g-tx-dialog__name { font-size: 13px !important; color: #33404a !important; }
.g-tx-dialog__name button, .g-tx-dialog__zurueck { padding: 0 !important; border: 0 !important; background: none !important; color: #051c2c !important; text-decoration: underline !important; cursor: pointer; font-size: 13px !important; font-weight: 600 !important; }
.g-tx-dialog__stand { font-size: 13px !important; color: #33404a !important; }
.g-tx-dialog__aktionen { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.g-tx-dialog__aktionen button { padding: 10px 16px !important; border-radius: 8px !important; cursor: pointer; border: 1px solid #051c2c !important; background: #fff !important; color: #051c2c !important; }
.g-tx-dialog__aktionen .g-tx-dialog__speichern { background: #051c2c !important; color: #fff !important; }
.g-tx-dialog .g-tx-dialog__meldung { margin: 8px 0 0 !important; font-size: 13px !important; color: #8a0049 !important; font-weight: 600; }
.g-tx-dialog .g-tx-dialog__meldung:empty { display: none; }

@media (max-width: 600px) {
  .g-tx-feld { left: 16px; right: 16px; width: auto; }
  .g-tx-dialog { left: 0; right: 0; bottom: 0; width: auto; max-width: none; max-height: 82vh; border-radius: 14px 14px 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) { .g-tx-schalter { transition: none; } }
