/* Satz-Assistent (Chat, Satz-Anpassungen, Export-Prüfung). Nur geladen, wenn scribigo_satz_agent_enabled an ist. */
.sg-sac { margin: 16px 0 8px; border: 1px solid var(--sg-satz-border, #d9dde3); border-radius: 10px; background: #fff; overflow: hidden; }
.sg-sac-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 14px; border: 0; background: #f6f7f9; color: var(--sg-satz-text, #1f2a37); font: inherit; text-align: left; cursor: pointer; }
.sg-sac-head:hover, .sg-sac-head:focus-visible { background: #eef1f5; }
.sg-sac-dot { width: 8px; height: 8px; border-radius: 50%; background: #2e7d5b; flex: none; }
.sg-sac-count { min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--sg-satz-text, #1f2a37); color: #fff; font-size: 12px; line-height: 20px; text-align: center; }
.sg-sac-toggle { margin-left: auto; font-size: 13px; color: var(--sg-satz-muted, #4b5563); }
.sg-sac-sub { margin: 8px 14px 0; font-size: 13px; color: var(--sg-satz-muted, #4b5563); }
.sg-sac-tabs { display: flex; gap: 4px; margin: 10px 14px 0; border-bottom: 1px solid #e5e7eb; }
.sg-sac-tab { padding: 6px 10px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--sg-satz-muted, #4b5563); font: inherit; font-size: 14px; cursor: pointer; }
.sg-sac-tab.is-active { border-bottom-color: var(--sg-satz-text, #1f2a37); color: var(--sg-satz-text, #1f2a37); font-weight: 600; }
.sg-sac-chat, .sg-sac-ov { padding: 10px 14px 14px; }
.sg-sac-msgs { max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.sg-sac-msg { max-width: 88%; margin: 0; padding: 8px 11px; border-radius: 10px; font-size: 14px; line-height: 1.45; }
.sg-sac-msg.is-assistant { align-self: flex-start; background: #f3f4f6; color: var(--sg-satz-text, #1f2a37); }
.sg-sac-msg.is-user { align-self: flex-end; background: var(--sg-satz-text, #1f2a37); color: #fff; }
.sg-sac-msg.is-busy { opacity: .7; font-style: italic; }
.sg-sac-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.sg-sac-acts, .sg-sac-handover { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.sg-sac-undo, .sg-sac-ov-remove, .sg-sac-goto { padding: 3px 9px; border: 1px solid #c5cad3; border-radius: 6px; background: #fff; color: var(--sg-satz-text, #1f2a37); font: inherit; font-size: 12px; cursor: pointer; }
.sg-sac-undo:disabled, .sg-sac-ov-remove:disabled { opacity: .6; cursor: default; }
.sg-sac-handover-text { display: block; width: 100%; padding: 6px 8px; border-radius: 6px; background: #fff; color: var(--sg-satz-text, #1f2a37); font-size: 12px; white-space: pre-wrap; }
.sg-sac-form { display: flex; gap: 8px; margin-top: 8px; align-items: flex-end; }
.sg-sac-input { flex: 1; min-height: 44px; resize: vertical; padding: 8px 10px; border: 1px solid #c5cad3; border-radius: 8px; font: inherit; font-size: 14px; }
.sg-sac-note { margin: 6px 0 0; font-size: 13px; color: var(--sg-satz-muted, #4b5563); }
.sg-sac-note.is-error { color: #b42318; }
.sg-sac-hint, .sg-sac-empty { margin: 0 0 8px; font-size: 13px; color: var(--sg-satz-muted, #4b5563); }
.sg-sac-ov-list { list-style: none; margin: 0; padding: 0; }
.sg-sac-ov-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid #f0f1f3; font-size: 14px; }
.sg-sac-gate-title { margin: 0 0 10px; font-size: 20px; }
.sg-sac-gate-card h4 { margin: 14px 0 6px; font-size: 15px; }
.sg-sac-chk-list, .sg-sac-rep ul { margin: 0; padding-left: 0; list-style: none; }
.sg-sac-chk { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; margin-bottom: 4px; border-radius: 6px; font-size: 14px; }
.sg-sac-chk.is-blocker { background: #fdecea; }
.sg-sac-chk.is-hint { background: #fff7e6; }
.sg-sac-rep li { padding: 3px 0; font-size: 14px; }
.sg-sac-rep.is-fixed h4 { color: #2e7d5b; }
.sg-sac-rep.is-ignored h4 { color: var(--sg-satz-muted, #4b5563); }
.sg-sac-rep.is-open h4 { color: #b45309; }
.sg-sac-sum { font-weight: 600; }
.sg-sac-ba { font-size: 14px; color: var(--sg-satz-muted, #4b5563); }
.sg-sac-busy { font-style: italic; }
@media (max-width: 600px) { .sg-sac-msg { max-width: 100%; } }
/* Command-Card: automatische Übergabe an den regulären Agenten (Auftrag, Status, Ergebnis). */
.sg-sac-cc { --sac-cc: #046bd2; margin-top: 8px; padding: 8px 10px 10px; border: 1px solid color-mix(in srgb, var(--sac-cc) 35%, #fff); border-left: 4px solid var(--sac-cc); border-radius: 8px; background: #fff; color: var(--sg-satz-text, #1f2a37); font-size: 13px; }
.sg-sac-cc[data-status="confirm"], .sg-sac-cc[data-status="busy"] { --sac-cc: #b45309; }
.sg-sac-cc[data-status="done"] { --sac-cc: #2e7d5b; }
.sg-sac-cc[data-status="error"], .sg-sac-cc[data-status="noagent"] { --sac-cc: #b42318; }
.sg-sac-cc[data-status="idle"] { --sac-cc: #6b7280; }
.sg-sac-cc-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.sg-sac-cc-icon { color: var(--sac-cc); }
.sg-sac-cc-pill { margin-left: auto; padding: 1px 8px; border-radius: 10px; background: color-mix(in srgb, var(--sac-cc) 12%, #fff); color: var(--sac-cc); font-size: 12px; white-space: nowrap; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.sg-sac-cc-row { display: grid; grid-template-columns: 72px 1fr; gap: 6px; padding: 2px 0; }
.sg-sac-cc-k { color: var(--sg-satz-muted, #4b5563); }
.sg-sac-cc-cmd { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; background: #f6f7f9; padding: 3px 6px; border-radius: 4px; }
.sg-sac-cc-v { overflow-wrap: anywhere; }
.sg-sac-cc-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.sg-sac-cc-btn { padding: 3px 9px; border: 1px solid #c5cad3; border-radius: 6px; background: #fff; color: var(--sg-satz-text, #1f2a37); font: inherit; font-size: 12px; cursor: pointer; }


/*
 * Dock am rechten Rand (Lars 25.10. 21:36 / 21:38).
 * Befund vorher: #agentSatzContent ist eine Spalte mit fester Höhe (100 %) und overflow: clip. Der Assistent
 * hing als Flex-Kind unter den Schritten, ohne Höhenbegrenzung (Verlauf fest 340 px). Aufgeklappt lag er mit
 * Eingabe und Senden unter dem sichtbaren Bereich und wurde abgeschnitten.
 * Jetzt: Root wird zur Zeile [Satz-Panel | Dock]. Das Dock hat die volle Höhe des Satz-Bereichs
 * (Viewport minus Kopf und Werkzeugleiste), Kopf und Eingabe sind fest, nur Verlauf/Liste/Bericht scrollen.
 */
#agentSatzContent:has(> .sg-sac),
.scribigo-satz-root:has(> .sg-sac) { flex-direction: row; align-items: stretch; }
#agentSatzContent:has(> .sg-sac) > .scribigo-satz-panel,
.scribigo-satz-root:has(> .sg-sac) > .scribigo-satz-panel { flex: 1 1 auto; min-width: 0; min-height: 0; }
.sg-sac { --sac-w: 360px; --sac-foot: 0px; position: relative; box-sizing: border-box; flex: 0 0 var(--sac-w); width: var(--sac-w); max-width: 50%; min-width: 0; height: calc(100% - var(--sac-foot)); min-height: 0; margin: 0 0 var(--sac-foot) 0; display: flex; flex-direction: column; border: 0; border-left: 1px solid var(--sg-satz-border, #d9dde3); border-radius: 0; background: #fff; overflow: hidden; font: 14px/1.45 system-ui, sans-serif; color: var(--sg-satz-text, #1f2a37); }
.sg-sac > .sg-sac-head, .sg-sac > .sg-sac-sub, .sg-sac > .sg-sac-tabs { flex: 0 0 auto; }
.sg-sac-head { border-bottom: 1px solid #eef0f3; }
.sg-sac > .sg-sac-chat { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding: 8px 12px 10px; }
.sg-sac > .sg-sac-ov, .sg-sac > .sg-sac-gate { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.sg-sac-chat > .sg-sac-msgs { flex: 1 1 auto; min-height: 3rem; max-height: none; overscroll-behavior: contain; }
.sg-sac-chat > .sg-sac-note, .sg-sac-chat > .sg-sac-form { flex: 0 0 auto; }
.sg-sac-input { min-height: 40px; max-height: min(30dvh, 160px); }
.sg-sac-msg { max-width: 92%; }
/* Breite ziehen (320 bis 420 px) */
.sg-sac-resize { position: absolute; left: -3px; top: 0; bottom: 0; width: 7px; cursor: col-resize; z-index: 2; touch-action: none; }
.sg-sac-resize:hover, .sg-sac-resize.is-dragging, .sg-sac-resize:focus-visible { background: color-mix(in srgb, var(--sg-satz-primary, #046bd2) 35%, transparent); outline: none; }
/* Eingeklappt: schmaler Streifen am rechten Rand */
.sg-sac.is-collapsed { flex: 0 0 40px; width: 40px; }
.sg-sac.is-collapsed .sg-sac-resize { display: none; }
.sg-sac.is-collapsed .sg-sac-head { flex: 1 1 auto; flex-direction: row; justify-content: flex-start; align-items: center; gap: 10px; padding: 14px 0; width: 100%; border-bottom: 0; writing-mode: vertical-rl; }
.sg-sac.is-collapsed .sg-sac-head .sg-sac-toggle { display: none; }
.sg-sac.is-collapsed .sg-sac-count { writing-mode: horizontal-tb; }
/* Export-Prüfung und Bericht im Dock, Knöpfe bleiben unten sichtbar */
.sg-sac-gate { padding: 0; }
.sg-sac-gate-card { min-height: 100%; box-sizing: border-box; display: flex; flex-direction: column; padding: 14px 14px 0; background: #fff; color: var(--sg-satz-text, #1f2a37); }
.sg-sac-gate-title { font-size: 17px; }
.sg-sac-gate-actions { position: sticky; bottom: 0; margin: auto -14px 0; padding: 10px 14px 12px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; background: #fff; border-top: 1px solid #eef0f3; }
.sg-sac-chk { align-items: flex-start; }
@media (max-height: 640px) {
    .sg-sac > .sg-sac-sub { display: none; }
    .sg-sac-head { padding: 7px 12px; }
    .sg-sac-input[rows] { height: 38px; }
}
/* Schmale Fenster (unter ca. 900 px) oder schmaler Satz-Bereich (unter 600 px, Klasse per ResizeObserver):
   Bottom-Sheet in der Spalte, nie über den unteren Rand hinaus und ohne die Schritt-Navigation zu verdecken. */
.sg-sac-narrow:has(> .sg-sac) { flex-direction: column !important; }
.sg-sac-narrow > .scribigo-satz-panel { min-height: min(9rem, 35%); }
.sg-sac-narrow > .sg-sac { flex: 0 1 auto; width: auto; max-width: none; height: auto; margin-bottom: var(--sac-foot); max-height: min(calc(58% - var(--sac-foot)), 32rem); border-left: 0; border-top: 1px solid var(--sg-satz-border, #d9dde3); border-radius: 14px 14px 0 0; box-shadow: 0 -6px 18px rgba(17, 24, 39, .08); }
.sg-sac-narrow > .sg-sac.is-open { min-height: min(15rem, 45%); }
.sg-sac-narrow > .sg-sac .sg-sac-resize { display: none; }
.sg-sac-narrow > .sg-sac.is-collapsed { flex: 0 0 auto; width: auto; }
.sg-sac-narrow > .sg-sac.is-collapsed .sg-sac-head { writing-mode: horizontal-tb; flex-direction: row; padding: 10px 14px; }
.sg-sac-narrow > .sg-sac.is-collapsed .sg-sac-head .sg-sac-toggle { display: inline; }
.sg-sac-narrow > .sg-sac > .sg-sac-sub { display: none; }
/* Sehr wenig Höhe (Zoom, Querformat): Verlauf darf bis 0 schrumpfen, Eingabe und Senden bleiben sichtbar. */
.sg-sac > .sg-sac-chat > .sg-sac-msgs { min-height: 0; }
@media (max-height: 520px) {
    .sg-sac-narrow > .sg-sac { max-height: 74%; }
    .sg-sac-narrow > .sg-sac.is-open { min-height: min(11rem, 60%); }
    .sg-sac-narrow > .scribigo-satz-panel { min-height: min(7rem, 26%); }
    .sg-sac > .sg-sac-tabs { margin-bottom: 0; }
    .sg-sac-tab { padding-top: 4px; padding-bottom: 4px; }
    .sg-sac-chat > .sg-sac-note { display: none; }
}
@media (max-height: 360px) {
    .sg-sac-narrow > .sg-sac { max-height: 80%; }
    .sg-sac-narrow > .sg-sac.is-open { min-height: min(10rem, 78%); }
    .sg-sac-head { padding: 4px 12px; }
    .sg-sac > .sg-sac-chat { padding: 4px 10px 6px; }
    .sg-sac-input { min-height: 34px; }
}

/*
 * Lars 25.10. 22:08: Eingabe wächst automatisch (JS autogrow), Scrollbalken nur bei Überlauf.
 * Senden = exakt der Primary-Stil der Panel-Buttons (.scribigo-satz-panel .ast-button aus scribigo-satz-panel.css):
 * das Dock ist Geschwister des Panels, daher greift jener Selektor hier nicht und das Theme setzte den Knopf.
 * Kopf: Theme-Hover (button:hover color #fff) machte den Titel weiß auf hellgrau; Farben jetzt explizit (AA).
 */
.sg-sac .sg-sac-input { resize: none; overflow-y: hidden; line-height: 1.4; box-sizing: border-box; }
.sg-sac .ast-button,
#agentSatzContent .sg-sac .ast-button {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
    padding: 0.55rem 1rem; border-radius: var(--sg-chrome-radius-sm, 6px);
    font-size: 0.88rem; font-weight: 500; font-synthesis: none; letter-spacing: normal; line-height: 1.2;
    cursor: pointer; background: var(--sg-chrome-primary, var(--ast-global-color-0, #046bd2));
    border: 1px solid var(--sg-chrome-primary, var(--ast-global-color-0, #046bd2)); color: #fff;
    text-transform: none; text-decoration: none; box-shadow: none; min-height: 0; width: auto;
}
.sg-sac .ast-button:hover:not(:disabled),
#agentSatzContent .sg-sac .ast-button:hover:not(:disabled) {
    background: var(--sg-chrome-primary, var(--ast-global-color-0, #046bd2));
    border-color: var(--sg-chrome-primary, var(--ast-global-color-0, #046bd2)); color: #fff; filter: brightness(0.95);
}
.sg-sac .ast-button:focus-visible { outline: 2px solid var(--sg-chrome-primary, var(--ast-global-color-0, #046bd2)); outline-offset: 2px; color: #fff; }
.sg-sac .ast-button:disabled { opacity: 0.55; cursor: not-allowed; }
.sg-sac .sg-sac-form .sg-sac-send { flex: 0 0 auto; align-self: flex-end; }

.sg-sac button.sg-sac-head,
#agentSatzContent .sg-sac button.sg-sac-head { background: #f6f7f9; color: #1f2a37; border-color: transparent; box-shadow: none; text-transform: none; letter-spacing: normal; }
.sg-sac button.sg-sac-head:hover,
.sg-sac button.sg-sac-head:focus,
.sg-sac button.sg-sac-head:focus-visible,
.sg-sac button.sg-sac-head:active,
#agentSatzContent .sg-sac button.sg-sac-head:hover,
#agentSatzContent .sg-sac button.sg-sac-head:focus-visible { background: #e6ebf1 !important; color: #1f2a37 !important; }
.sg-sac button.sg-sac-head:focus-visible { outline: 2px solid #1f2a37; outline-offset: -2px; }
.sg-sac button.sg-sac-head strong, .sg-sac button.sg-sac-head .sg-sac-toggle { color: inherit; }
.sg-sac button.sg-sac-head .sg-sac-toggle { color: #374151; }
.sg-sac.is-collapsed button.sg-sac-head:hover, .sg-sac.is-collapsed button.sg-sac-head:focus-visible { background: #e6ebf1 !important; color: #1f2a37 !important; }
.sg-sac button.sg-sac-tab:hover, .sg-sac button.sg-sac-tab:focus-visible { background: #eef1f5; color: #1f2a37; }
.sg-sac button.sg-sac-undo:hover:not(:disabled), .sg-sac button.sg-sac-ov-remove:hover:not(:disabled),
.sg-sac button.sg-sac-undo:focus-visible, .sg-sac button.sg-sac-ov-remove:focus-visible { background: #eef1f5; color: #1f2a37; border-color: #8b93a1; }

/* Wirkung je Antwort und Vorschau-Status (Lars 25.10. 22:05) */
.sg-sac-verify { display: inline-block; margin-top: 6px; padding: 1px 8px; border-radius: 10px; font-size: 12px; line-height: 18px; background: #fff7e6; color: #8a4b00; border: 1px solid #f3d19c; }
.sg-sac-verify.is-updating { background: #eef4ff; color: #1d4ed8; border-color: #c7d7fe; }
.sg-sac-verify.is-shown { background: #ecf8f1; color: #1d6b47; border-color: #b7e2c8; }
.sg-sac-verify.is-failed { background: #fdecec; color: #a01e14; border-color: #f5c2bf; }
.sg-sac-verify.is-undone { background: #f3f4f6; color: #374151; border-color: #d1d5db; }
.sg-sac-prev { display: flex; align-items: center; gap: 8px; margin: 6px 0 0; font-size: 13px; color: #1d4ed8; }
.sg-sac-spin { width: 12px; height: 12px; border: 2px solid #c7d7fe; border-top-color: #1d4ed8; border-radius: 50%; animation: sg-sac-spin 0.9s linear infinite; flex: none; }
@keyframes sg-sac-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .sg-sac-spin { animation: none; } }
.sg-sac-ov-main { display: flex; flex-direction: column; min-width: 0; }
.sg-sac-ov-at { font-size: 12px; color: #4b5563; }
.sg-sac .ast-button.ast-outline,
#agentSatzContent .sg-sac .ast-button.ast-outline {
    background: var(--sg-chrome-card, #fff);
    border: 1px solid var(--sg-chrome-hairline, color-mix(in srgb, var(--ast-global-color-0, #046bd2) 16%, var(--ast-global-color-5, #f9f4ee)));
    color: var(--sg-chrome-primary-fg, var(--ast-global-color-2, #2c3f42));
}
.sg-sac .ast-button.ast-outline:hover:not(:disabled),
#agentSatzContent .sg-sac .ast-button.ast-outline:hover:not(:disabled) {
    background: var(--sg-chrome-card, #fff);
    border-color: var(--sg-chrome-primary, var(--ast-global-color-0, #046bd2));
    color: var(--sg-chrome-primary, var(--ast-global-color-0, #046bd2));
    filter: none;
}
.sg-sac .ast-button.ast-outline:focus-visible { color: var(--sg-chrome-primary-fg, var(--ast-global-color-2, #2c3f42)); }

/*
 * Mobile-Modus (Lars 25.10. 23:17): unter 900 px kein Bottom-Sheet mehr. Unter dem Wizard-Kopf ein Umschalter
 * Buchsatz | Satz-Assistent (Klasse sg-sac-mobile + data-sac-mode per JS). Der Assistent nutzt die volle Fläche,
 * Schrift 16 px (kein Zoom beim Fokus), Touch-Ziele mind. 44 px, Eingabe über der Tastatur (--sac-kb aus visualViewport).
 * Desktop-Dock (ab 900 px) unverändert.
 */
.sg-sac-mobile:has(> .sg-sac) { flex-direction: column !important; align-items: stretch; }
.sg-sac-narrow.sg-sac-mobile > .scribigo-satz-panel { flex: 1 1 auto; min-height: 0; }
.sg-sac-narrow.sg-sac-mobile > .sg-sac,
.sg-sac-narrow.sg-sac-mobile > .sg-sac.is-open {
    order: -1; flex: 0 0 auto; width: auto; max-width: none; height: auto; min-height: 0; max-height: none;
    margin: 0; border: 0; border-bottom: 1px solid var(--sg-satz-border, #d9dde3); border-radius: 0; box-shadow: none;
    font-size: 16px; line-height: 1.5;
}
.sg-sac-mobile[data-sac-mode="agent"] > .scribigo-satz-panel { display: none !important; }
/* R5: Mit fixer Fußzeile bleibt das Panel als Platzhalter stehen, nur sein Inhalt weicht. Der Assistent endet an der Oberkante der Fußzeile. */
.sg-satz-foot-fixed.sg-sac-mobile[data-sac-mode="agent"] > .scribigo-satz-panel { display: flex !important; flex: 0 0 auto !important; min-height: 0 !important; height: auto !important; padding: 0 !important; margin: 0 !important; border: 0 !important; background: transparent; overflow: visible; }
.sg-satz-foot-fixed.sg-sac-mobile[data-sac-mode="agent"] > .scribigo-satz-panel > :not(#sgSatzWizardNav) { display: none !important; }
.sg-sac-narrow.sg-sac-mobile[data-sac-mode="agent"] > .sg-sac,
.sg-sac-narrow.sg-sac-mobile[data-sac-mode="agent"] > .sg-sac.is-open { flex: 1 1 auto; min-height: 0; border-bottom: 0; padding-bottom: var(--sac-kb, 0px); }
.sg-sac.is-mobile .sg-sac-resize,
.sg-sac.is-mobile > .sg-sac-head,
.sg-sac.is-mobile > .sg-sac-sub { display: none !important; }
.sg-sac-seg { flex: 0 0 auto; display: flex; gap: 6px; padding: 6px 10px; background: #f6f7f9; }
.sg-sac .sg-sac-seg-btn,
#agentSatzContent .sg-sac .sg-sac-seg-btn {
    flex: 1 1 0; min-width: 0; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 0 10px; border: 1px solid #c5cad3; border-radius: 8px; background: #fff; color: #1f2a37; box-shadow: none;
    font: inherit; font-size: 16px; font-weight: 600; line-height: 1.2; text-transform: none; letter-spacing: normal; cursor: pointer;
}
.sg-sac .sg-sac-seg-btn > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-sac .sg-sac-seg-btn:hover, .sg-sac .sg-sac-seg-btn:focus { background: #eef1f5 !important; color: #1f2a37 !important; }
.sg-sac .sg-sac-seg-btn.is-active,
.sg-sac .sg-sac-seg-btn.is-active:hover,
.sg-sac .sg-sac-seg-btn.is-active:focus { background: #1f2a37 !important; border-color: #1f2a37; color: #fff !important; }
.sg-sac .sg-sac-seg-btn:focus-visible { outline: 2px solid var(--sg-satz-primary, #046bd2); outline-offset: 2px; }
.sg-sac .sg-sac-seg-btn.is-active .sg-sac-count { background: #fff; color: #1f2a37; }
.sg-sac.is-mobile > .sg-sac-tabs { margin: 2px 10px 0; }
.sg-sac.is-mobile .sg-sac-tab { flex: 1 1 0; min-height: 44px; padding: 0 8px; font-size: 16px; }
.sg-sac.is-mobile > .sg-sac-chat { padding: 8px 12px 10px; }
.sg-sac.is-mobile .sg-sac-msg { max-width: 100%; font-size: 16px; line-height: 1.5; }
.sg-sac.is-mobile .sg-sac-input { min-height: 44px; font-size: 16px; line-height: 1.4; }
.sg-sac.is-mobile .ast-button,
#agentSatzContent .sg-sac.is-mobile .ast-button { min-height: 44px; font-size: 16px; }
.sg-sac.is-mobile .sg-sac-undo, .sg-sac.is-mobile .sg-sac-ov-remove, .sg-sac.is-mobile .sg-sac-goto, .sg-sac.is-mobile .sg-sac-cc-btn {
    min-height: 44px; min-width: 44px; padding: 0 14px; font-size: 15px;
}
.sg-sac.is-mobile .sg-sac-verify, .sg-sac.is-mobile .sg-sac-note, .sg-sac.is-mobile .sg-sac-hint, .sg-sac.is-mobile .sg-sac-empty, .sg-sac.is-mobile .sg-sac-prev { font-size: 14px; }
.sg-sac.is-mobile > .sg-sac-ov { padding: 10px 12px 14px; }
.sg-sac.is-mobile .sg-sac-ov-item { align-items: flex-start; padding: 8px 0; font-size: 16px; }
.sg-sac.is-mobile .sg-sac-ov-main { flex: 1 1 auto; overflow-wrap: anywhere; }
.sg-sac.is-mobile .sg-sac-gate-card { padding: 14px 12px 0; }
.sg-sac.is-mobile .sg-sac-gate-title { font-size: 19px; }
.sg-sac.is-mobile .sg-sac-chk, .sg-sac.is-mobile .sg-sac-rep li, .sg-sac.is-mobile .sg-sac-sum, .sg-sac.is-mobile .sg-sac-ba { font-size: 16px; overflow-wrap: anywhere; }
.sg-sac.is-mobile .sg-sac-chk { flex-wrap: wrap; }
.sg-sac.is-mobile .sg-sac-gate-actions { margin: auto -12px 0; padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px)); }
.sg-sac.is-mobile .sg-sac-gate-actions .ast-button { flex: 1 1 10rem; }
.sg-sac.is-mobile .sg-sac-cc-row { grid-template-columns: minmax(0, 1fr); }
.sg-sac.is-mobile .sg-sac-cc-pill { max-width: 60%; }
.sg-sac.is-mobile .sg-sac-form { padding-bottom: env(safe-area-inset-bottom, 0px); }
/* Tastatur offen: Wizard-Schritte ausblenden, damit Verlauf und Eingabe Platz haben. */
html.sg-sac-kb-open #scribigo-agent-chat[data-preview-tab="satz"] #agentPreviewToolbar .toolbar-group-satz { display: none !important; }
/* Querformat mit Tastatur: Umschalter und Reiter weichen, Verlauf und Eingabe bleiben sichtbar. */
@media (max-height: 500px) {
    html.sg-sac-kb-open .sg-sac.is-mobile > .sg-sac-seg,
    html.sg-sac-kb-open .sg-sac.is-mobile > .sg-sac-tabs { display: none; }
    .sg-sac.is-mobile .sg-sac-seg { padding-top: 4px; padding-bottom: 4px; }
}
@media (max-height: 500px) {
    /* Querformat: im Assistenten weichen die Wizard-Schritte, damit der Verlauf lesbar bleibt (Buchsatz-Ansicht: unverändert). */
    #scribigo-agent-chat[data-preview-tab="satz"]:has(#agentSatzContent.sg-sac-mobile[data-sac-mode="agent"]) #agentPreviewToolbar .toolbar-group-satz { display: none !important; }
}
/* R6: ein Knopf zur Liste der Satzanpassungen statt Rückgängig je Änderung */
.sg-sac-show-changes { margin-top: 6px; padding: 4px 10px; border: 1px solid #cfd5dd; border-radius: 8px; background: #fff; color: var(--sg-satz-text, #1f2a37); font: inherit; font-size: 13px; cursor: pointer; min-height: 32px; }
.sg-sac-show-changes:hover, .sg-sac-show-changes:focus-visible { background: #eef1f5; }
.sg-sac-ov-item.is-focus { background: #fff8e1; box-shadow: inset 3px 0 0 #e0a800; }
@media (max-width: 899.98px) { .sg-sac-show-changes { min-height: 44px; } }
/* R6: welche Einstellung eine Anpassung überstimmt / überholte Einstellungsänderung */
.sg-sac-ov-over { display: block; font-size: 12px; color: #5b6573; margin-top: 2px; }
.sg-sac-ov-item.is-superseded .sg-sac-ov-text { color: #7a838f; text-decoration: line-through; text-decoration-thickness: 1px; }
.sg-sac-ov-over.is-note { color: #8a5a00; }
.sg-sac-ov-remove { white-space: nowrap; flex-shrink: 0; }
.sg-sac-ov-main { min-width: 0; }
