/* ============================================================
   openTMS — APP-SHELL (Sidebar, Dashboard, Aufgabenrahmen)
   Tokens aus css/design.css. Markup: views/layout.html, views/modules.html,
   js/ui.js (renderDashboard), js/dashboard-pulse.js.
   ============================================================ */

/* ---------- Sidebar: beschriftet, fest, 232 px ---------- */
#sidebar { width: 232px !important; overflow: visible !important; background: var(--otms-bg) !important; border-right: 1px solid var(--otms-line) !important; box-shadow: none !important; }
#sidebar:hover { width: 232px !important; }
#sidebar > div { overflow-y: auto; }
#sidebar .otms-sb-brand { display: flex; flex-direction: column; padding: 26px 22px 18px; text-decoration: none; }
#sidebar .otms-sb-brand .brand-word { font: 700 24px/1 var(--otms-f-display); color: var(--otms-ink); }
#sidebar .otms-sb-brand svg { width: 86px; height: 18px; fill: none; stroke: var(--otms-accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; margin-top: 2px; }
#sidebar nav { padding: 0 12px; }
#sidebar nav .otms-nav { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--otms-r); background: none; border: 0; color: var(--otms-ink); font: 500 15px/1.2 var(--otms-f-body); text-align: left; cursor: pointer; }
#sidebar nav .otms-nav:hover { background: var(--otms-tint); }
#sidebar nav .otms-nav.nav-active { background: var(--otms-tint) !important; color: var(--otms-ink) !important; font-weight: 600; box-shadow: inset 3px 0 0 var(--otms-accent); }
#sidebar nav .otms-nav .otms-icon { color: var(--otms-ink-soft); }
#sidebar nav .otms-nav.nav-active .otms-icon, #sidebar nav .otms-nav:hover .otms-icon { color: var(--otms-ink); }
#sidebar nav .otms-nav__badge { margin-left: auto; font: 500 13px/1 var(--otms-f-mono); color: var(--otms-accent); }
#sidebar nav .otms-nav__badge.hidden { display: none; }
#sidebar nav .otms-nav--primary { margin-top: 6px; }
#sidebar .otms-sb-group { margin: 14px 12px 4px; padding-top: 12px; border-top: 1px solid var(--otms-line); }
#sidebar #user-menu { border-top: 1px solid var(--otms-line) !important; padding: 14px 22px 18px !important; }
#sidebar #user-menu .otms-user { display: grid; gap: 4px; }
#sidebar #user-menu .otms-user b { font-weight: 600; }
#sidebar #user-menu .otms-user button { background: none; border: 0; padding: 0; font: inherit; color: var(--otms-ink-soft); text-decoration: underline; text-decoration-color: var(--otms-line-strong); text-underline-offset: 3px; cursor: pointer; text-align: left; }
#user-dropdown-menu { background: var(--otms-surface) !important; border: 1px solid var(--otms-line) !important; }
@media (min-width: 768px) { .app-main-shell { margin-left: 232px !important; padding-top: 32px !important; } }

/* ---------- Mobile ---------- */
#mobile-header { background: var(--otms-bg) !important; border-bottom: 1px solid var(--otms-line) !important; box-shadow: none !important; }
#mobile-bottom-nav { background: var(--otms-bg) !important; border-top: 1px solid var(--otms-line-strong) !important; }
#mobile-bottom-nav button { font: 600 11px/1 var(--otms-f-display); letter-spacing: .08em; text-transform: uppercase; color: var(--otms-ink-soft) !important; }
#mobile-bottom-nav button.nav-active, #mobile-bottom-nav button.nav-active i { color: var(--otms-ink) !important; }
#mobile-menu { background: var(--otms-bg) !important; box-shadow: none !important; border-left: 1px solid var(--otms-line); }

/* ---------- Dashboard ---------- */
#view-dashboard { max-width: 1160px; }
.otms-dash-head { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr; border: 1px solid var(--otms-line); background: var(--otms-surface); margin-bottom: 28px; }
.otms-dash-head .otms-field { border: 0; border-right: 1px solid var(--otms-line); border-radius: 0; padding: 12px 16px 14px; background: transparent; }
.otms-dash-head .otms-field:last-child { border-right: 0; }
.otms-dash-head .otms-field b { display: block; font: 600 26px/1.1 var(--otms-f-display); }
.otms-dash-head .otms-field--pulse { position: relative; overflow: hidden; }
.otms-dash-head .otms-field--pulse canvas { position: absolute; right: 12px; bottom: 6px; width: 120px; height: 30px; opacity: .9; }
.otms-dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
.otms-today { border: 1px solid var(--otms-line); background: var(--otms-surface); padding: 26px 28px 28px; margin-bottom: 28px; }
.otms-today__top { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.otms-today h2 { font-size: clamp(1.9rem, 3.4vw, 2.8rem); line-height: 1; margin: 0 0 8px; }
.otms-today__sub { color: var(--otms-ink-soft); margin: 0 0 16px; max-width: 60ch; }
#today-tasks-container { display: grid; }
#today-tasks-container > * { border-top: 1px solid var(--otms-line); }
#today-tasks-container > *:last-child { border-bottom: 1px solid var(--otms-line); }
.otms-today__cta { margin-top: 20px; }
.otms-side { display: grid; gap: 28px; }
.otms-side .otms-box { border: 1px solid var(--otms-line); background: var(--otms-surface); }
.otms-box__head { display: flex; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--otms-line); }
.otms-box__body { padding: 18px 16px 20px; }
.otms-box__num { font: 600 44px/1 var(--otms-f-display); }
.otms-table td:nth-child(1) { width: 30px; font: 500 14px/1 var(--otms-f-mono); color: var(--otms-ink-soft); }
.otms-table td:nth-child(2) { font-weight: 500; }
.otms-table td:nth-child(2) span { display: inline-flex; align-items: center; gap: 10px; }
.otms-table td:nth-child(3) { font: 500 13px/1 var(--otms-f-mono); color: var(--otms-ink-soft); white-space: nowrap; }
.otms-table td:nth-child(4) { width: 34%; }
.otms-table td:nth-child(5) { font: 500 15px/1 var(--otms-f-mono); text-align: right; width: 52px; }
.otms-table td:nth-child(6) { text-align: right; width: 72px; }
.otms-table .otms-table__go { background: none; border: 0; padding: 4px 0; font: 600 12px/1 var(--otms-f-display); letter-spacing: .12em; text-transform: uppercase; color: var(--otms-ink-soft); cursor: pointer; }
.otms-table tr:hover .otms-table__go { color: var(--otms-ink); text-decoration: underline; text-underline-offset: 3px; }
.otms-table tr[data-module-id] { cursor: pointer; }
@media (max-width: 1100px) { .otms-dash-grid { grid-template-columns: minmax(0, 1fr); } .otms-dash-head { grid-template-columns: 1fr 1fr; } .otms-dash-head .otms-field:nth-child(2) { border-right: 0; } .otms-dash-head .otms-field:nth-child(-n+2) { border-bottom: 1px solid var(--otms-line); } }
@media (max-width: 640px) { .otms-table td:nth-child(3), .otms-table td:nth-child(6) { display: none; } .otms-table td:nth-child(4) { width: 30%; } .otms-today { padding: 20px 16px; } }

/* ---------- Modul-Startseiten (Trainings-/Simulationsmodus-Wahl) ---------- */
.module-card, [data-ui-action="select-muster-mode"], [data-ui-action^="select-"][data-mode] { border-width: 1px !important; }

/* ---------- Aufgabenrahmen: Frage links, Korrekturrand rechts ---------- */
.otms-qframe { border: 1px solid var(--otms-line); background: var(--otms-surface); }
.otms-qframe .otms-task__body { padding: clamp(18px, 3vw, 30px); }

/* Sticky Modul-Header (Zurück · Aufgabe x/y · Timer) */
[id$="-header"].sticky { background: var(--otms-bg) !important; border: 0 !important; border-bottom: 1px solid var(--otms-line-strong) !important; border-radius: 0 !important; padding: 10px 0 !important; }
[id$="-timer-display"] { border: 1px solid var(--otms-line-strong) !important; background: transparent !important; }
[id$="-timer-text"] { font-family: var(--otms-f-mono) !important; color: var(--otms-ink) !important; }

/* ---------- Einstellungen: Paletten-Wahl ---------- */
.otms-palettes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.otms-palette { display: grid; gap: 4px; padding: 10px; border: 1px solid var(--otms-line); border-radius: var(--otms-r); background: var(--otms-surface); text-align: left; cursor: pointer; font: inherit; color: var(--otms-ink); }
.otms-palette b { font: 600 15px/1.2 var(--otms-f-display); }
.otms-palette > span:last-child { font-size: 12px; color: var(--otms-ink-soft); }
.otms-palette.is-active { border-color: var(--otms-ink); box-shadow: inset 0 0 0 1px var(--otms-ink); }
.otms-palette__swatch { display: grid; grid-template-columns: repeat(4, 1fr); height: 26px; border: 1px solid var(--otms-line); margin-bottom: 4px; }
.otms-palette__swatch::before { content: ""; background: var(--a); } .otms-palette__swatch::after { content: ""; background: var(--b); }
.otms-palette__swatch { background: linear-gradient(90deg, var(--a) 0 25%, var(--b) 25% 50%, var(--c) 50% 75%, var(--d) 75%); }
.otms-palette__swatch::before, .otms-palette__swatch::after { display: none; }
@media (max-width: 560px) { .otms-palettes { grid-template-columns: 1fr; } }

/* ---------- Antwortoptionen aller Module (.option-btn) ---------- */
.otms-options, #mednat-options-grid, #diagramme-options-grid, #muster-options-grid { display: grid; gap: 0 !important; }
#mednat-options-grid, #diagramme-options-grid, #text-questions-container .space-y-2 { --tw-space-y-reverse: 0; }
.option-btn:not(.otms-opt) { display: grid !important; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: start; width: 100%; padding: 12px 8px !important; border: 0 !important; border-top: 1px solid var(--otms-line) !important; border-radius: 0 !important; background: transparent !important; text-align: left; margin: 0 !important; }
.option-btn:not(.otms-opt):last-child { border-bottom: 1px solid var(--otms-line) !important; }
.option-btn:not(.otms-opt):hover:not([disabled]) { background: var(--otms-tint) !important; }
.option-btn:not(.otms-opt) > span:first-child { width: 32px; height: 32px; display: grid; place-items: center; border: 1.5px solid var(--otms-line-strong); border-radius: var(--otms-r) !important; background: var(--otms-surface) !important; color: var(--otms-ink) !important; font: 600 15px/1 var(--otms-f-display); padding: 0 !important; }
.option-btn.correct { background: var(--otms-ok-tint) !important; }
.option-btn.correct > span:first-child { background: var(--otms-ok) !important; border-color: var(--otms-ok); color: #fff !important; }
.option-btn.wrong { background: var(--otms-danger-tint) !important; }
.option-btn.wrong > span:first-child { background: var(--otms-danger) !important; border-color: var(--otms-danger); color: #fff !important; }
.option-btn.wrong > span:last-child { text-decoration: line-through; text-decoration-color: var(--otms-danger); text-decoration-thickness: 2px; }
.option-btn[disabled] { cursor: default; }

/* Erklärungsblöcke unter der Aufgabe (Module ohne eigenen Korrekturrand): gleiche Korrektur-Typografie */
[id$="-explanation-container"]:not(#mednat-explanation-container) { border: 0 !important; border-top: 1px solid var(--otms-line-strong) !important; border-radius: 0 !important; background: transparent !important; padding: 18px 0 0 !important; margin-top: 18px !important; box-shadow: none !important; }
[id$="-explanation-container"] h3, [id$="-explanation-container"] h4 { font: 700 20px/1.15 var(--otms-f-display) !important; color: var(--otms-ink) !important; letter-spacing: 0 !important; text-transform: none !important; margin-bottom: 10px !important; }
[id$="-explanation-text"] { font-style: normal !important; color: var(--otms-ink) !important; line-height: 1.6; }

/* Entwickler-Upload-Blöcke (JSON laden) nie an Endnutzer:innen */
[id$="-upload-container"] { display: none !important; }

/* ---------- Prüfungsmodus / Generalprobe: Antwortbogen-Ovale ---------- */
[class*="exam-opt-"] { display: grid !important; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; align-items: start; width: 100%; padding: 10px 8px !important; border: 0 !important; border-top: 1px solid var(--otms-line) !important; border-radius: 0 !important; background: transparent !important; text-align: left; margin: 0 !important; }
[class*="exam-opt-"]:last-child { border-bottom: 1px solid var(--otms-line) !important; }
[class*="exam-opt-"]:hover { background: var(--otms-tint) !important; }
[class*="exam-opt-"] > span:first-child { width: 30px; height: 20px; display: grid; place-items: center; border: 1.5px solid var(--otms-line-strong); border-radius: 50% !important; background: var(--otms-surface) !important; color: var(--otms-ink-soft) !important; font: 600 11px/1 var(--otms-f-mono); padding: 0 !important; margin-top: 2px; }
[class*="exam-opt-"][class*=" bg-"] > span:first-child { background: var(--otms-pencil) !important; border-color: var(--otms-pencil); color: transparent !important; box-shadow: 0 0 0 .5px var(--otms-pencil); }
[class*="exam-opt-"][class*=" bg-"] { background: var(--otms-tint) !important; }
[id$="-exam-sheet"] > * { border: 1px solid var(--otms-line) !important; border-radius: 0 !important; box-shadow: none !important; background: var(--otms-surface) !important; }

/* Sidebar: hidden-Utility respektieren (Supporter-Eintrag) */
#sidebar nav .otms-nav.hidden { display: none; }

/* Cookie-Banner: neutrale Fläche statt Akzentfarbe (design.css mappt .bg-slate-900 auf den Akzent) */
#cookie-banner { background: var(--otms-surface) !important; color: var(--otms-ink) !important; border-top: 1px solid var(--otms-line-strong) !important; box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08) !important; }
#cookie-banner h3 { font-family: var(--otms-f-display); font-weight: 700; font-size: 20px; letter-spacing: 0.01em; }
#cookie-banner p, #cookie-banner .text-slate-300 { color: var(--otms-ink-soft) !important; }
#cookie-banner a { color: var(--otms-ink) !important; text-decoration-color: var(--otms-line-strong); }
#cookie-banner button { border-radius: 0 !important; font-family: var(--otms-f-display); font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; font-size: 13px !important; min-height: 40px; }
#cookie-banner #cookie-choice-customize { background: transparent !important; color: var(--otms-ink) !important; border: 1px solid var(--otms-line-strong) !important; }
#cookie-banner #cookie-choice-essential { background: transparent !important; color: var(--otms-ink) !important; border: 1px solid var(--otms-line-strong) !important; }
#cookie-banner #cookie-choice-all { background: var(--otms-ink) !important; color: var(--otms-bg) !important; border: 1px solid var(--otms-ink) !important; }

/* ---- Aufgabentext: Tabellen und Kontext-Kasten (TMS.richText) ---- */
.otms-qtable-wrap { overflow-x: auto; margin: 12px 0; max-width: 100%; }
.otms-qtable { border-collapse: collapse; width: auto; max-width: 100%; font-family: var(--otms-f-body); font-size: 0.95em; line-height: 1.35; color: var(--otms-ink); background: var(--otms-surface); }
.otms-qtable th, .otms-qtable td { border: 1px solid var(--otms-line-strong); padding: 6px 10px; text-align: left; vertical-align: top; white-space: nowrap; }
.otms-qtable th { background: var(--otms-bg-2); font-weight: 600; }
.otms-qtable td.num { text-align: right; font-variant-numeric: tabular-nums; }
.otms-quant__stem .otms-qtable, .otms-task__stem .otms-qtable { font-family: var(--otms-f-body); font-size: 0.95em; }
/* Zahlen in Tabellenzellen behalten die Tabellenschrift; Formelsatz nur fuer Brueche/Indizes */
.otms-qtable .mx { font-family: inherit; font-size: inherit; }
.otms-qtable td.num .mx, .otms-qtable td.num { font-variant-numeric: tabular-nums; }
.otms-qtable tbody tr:nth-child(even) td { background: var(--otms-bg); }
.otms-context { margin: 0 0 14px; padding: 10px 14px; border-left: 3px solid var(--otms-line-strong); background: var(--otms-bg-2); color: var(--otms-ink); border-radius: 0 var(--otms-r) var(--otms-r) 0; font-size: 0.95em; line-height: 1.5; }
.otms-context strong { color: var(--otms-ink); font-weight: 600; }

/* ============================================================
   TOASTS + ANTWORTBOGEN  (js/ui.js showNotification, js/answer-sheet.js)
   Ergänzt die Token-Schicht aus css/design.css um zwei semantische Farben,
   die dort fehlen: eine lesbare Warnfarbe (das reine --otms-warn erreicht auf
   hellen Flächen keine 4,5:1) und eine eigene Info-Farbe (in OP-Grün dunkel
   ist --otms-accent bernstein und damit nicht von der Warnung zu trennen).
   Reihenfolge = Reihenfolge der Paletten-Blöcke in css/design.css.
   ============================================================ */
:root, html[data-palette="antwortbogen"] { --otms-warn-text: #7F5D06; --otms-info: #2B5AA0; --otms-info-tint: #E9EFF9; --otms-sheet-w: 236px; --otms-sheet-h: 0px; --otms-sheet-top: 24px; }
html.dark, html.dark[data-palette="antwortbogen"] { --otms-warn-text: #E0B84A; --otms-info: #9DB9F2; --otms-info-tint: #1F2637; }
html[data-palette="op-gruen"] { --otms-warn-text: #8A5A00; --otms-info: #1F5FA0; --otms-info-tint: #E6EEF8; }
html.dark[data-palette="op-gruen"] { --otms-warn-text: #FFB224; --otms-info: #9CD0FF; --otms-info-tint: #0E3A44; }
html[data-palette="koenigsblau"] { --otms-warn-text: #7A6100; --otms-info: #1E3A9F; --otms-info-tint: #EDF1FC; }
html.dark[data-palette="koenigsblau"] { --otms-warn-text: #E0B84A; --otms-info: #8FA6FF; --otms-info-tint: #1B2660; }

/* ---- Toast: eine Komponente für alle Meldungen (Stapel oben rechts) ---- */
.otms-toasts { position: fixed; top: calc(var(--app-mobile-top-offset, 0px) + 12px); right: 12px; z-index: 9999; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; width: min(400px, calc(100vw - 24px)); pointer-events: none; }
@media (min-width: 768px) { .otms-toasts { top: 20px; right: 24px; } }
.otms-toast { width: 100%; display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px 16px; border: 1px solid var(--otms-line-strong); border-left: 4px solid var(--otms-info); border-radius: var(--otms-r); background: var(--otms-surface); color: var(--otms-ink); font: 500 14px/1.45 var(--otms-f-body); box-shadow: 0 4px 14px rgba(0, 0, 0, .10); pointer-events: auto; opacity: 0; transform: translateX(110%); transition: transform .26s ease, opacity .26s ease; }
.otms-toast.is-in { opacity: 1; transform: translateX(0); }
.otms-toast.is-out { opacity: 0; transform: translateX(110%); }
.otms-toast__icon { display: grid; place-items: center; margin-top: 1px; color: var(--otms-info); }
.otms-toast__icon svg { width: 20px; height: 20px; }
.otms-toast__text { min-width: 0; overflow-wrap: anywhere; }
.otms-toast--success { border-left-color: var(--otms-ok-text); } .otms-toast--success .otms-toast__icon { color: var(--otms-ok-text); }
.otms-toast--error   { border-left-color: var(--otms-danger-text); } .otms-toast--error .otms-toast__icon { color: var(--otms-danger-text); }
.otms-toast--warning { border-left-color: var(--otms-warn-text); } .otms-toast--warning .otms-toast__icon { color: var(--otms-warn-text); }
.otms-toast--info    { border-left-color: var(--otms-info); } .otms-toast--info .otms-toast__icon { color: var(--otms-info); }
@media (prefers-reduced-motion: reduce) {
    .otms-toast { transition: none; transform: none; opacity: 1; }
    .otms-toast.is-out { opacity: 0; }
}

/* ---- Gelb/Bernstein-Hinweise: lesbare Schrift auf der hellen Warnfläche ----
   design.css zieht alle amber/yellow/orange-Flächen auf --otms-warn-tint; die
   Schrift darauf (text-amber-*, text-white) blieb hell und war kaum lesbar. */
[class*="text-amber-"], [class*="text-orange-"], [class*="text-yellow-"] { color: var(--otms-warn-text) !important; }
[class*="bg-amber-"].text-white, [class*="bg-yellow-"].text-white, [class*="bg-orange-"].text-white,
[class*="bg-amber-"] .text-white, [class*="bg-yellow-"] .text-white, [class*="bg-orange-"] .text-white { color: var(--otms-warn-text) !important; }

/* ---- Antwortbogen (js/answer-sheet.js) ----
   Breit: feste Spalte rechts, der Aufgabenspalte wird derselbe Platz genommen.
   Schmal: Schublade am unteren Rand, die den Inhalt nie überdeckt. */
.otms-sheetpanel { display: none; z-index: 40; border: 1px solid var(--otms-line-strong); background: var(--otms-surface); color: var(--otms-ink-soft); font: 500 11.5px/1 var(--otms-f-mono); }
.otms-sheetpanel.is-visible { display: flex; flex-direction: column; }
.otms-sheetpanel__head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--otms-line); background: var(--otms-bg-2); }
.otms-sheetpanel__title { font: 600 11px/1.2 var(--otms-f-display); letter-spacing: .14em; text-transform: uppercase; color: var(--otms-ink); }
.otms-sheetpanel__count { margin-left: auto; font: 500 12px/1 var(--otms-f-mono); color: var(--otms-ink-soft); font-variant-numeric: tabular-nums; }
.otms-sheetpanel__btn { background: none; border: 0; padding: 2px 0; font: 600 10.5px/1.2 var(--otms-f-display); letter-spacing: .1em; text-transform: uppercase; color: var(--otms-ink-soft); cursor: pointer; }
.otms-sheetpanel__btn:hover { color: var(--otms-ink); text-decoration: underline; text-underline-offset: 3px; }
.otms-sheetpanel__body { position: relative; overflow-y: auto; padding: 8px 10px 10px; }
.otms-sheetpanel__row { display: grid; grid-template-columns: 24px repeat(5, minmax(0, 1fr)); align-items: center; gap: 4px; padding: 2px 4px; border-radius: var(--otms-r); cursor: pointer; }
.otms-sheetpanel__row > span:first-child { color: var(--otms-ink-soft); font-variant-numeric: tabular-nums; }
.otms-sheetpanel__row:hover { background: var(--otms-bg-2); }
.otms-sheetpanel__row .otms-oval { width: 100%; max-width: 22px; height: 14px; font-size: 8px; justify-self: center; }
.otms-sheetpanel__row.is-current { background: var(--otms-tint); box-shadow: inset 3px 0 0 var(--otms-accent); }
.otms-sheetpanel__row.is-current > span:first-child { color: var(--otms-ink); font-weight: 700; }
.otms-sheetpanel__row:focus-visible { outline: 2px solid var(--otms-focus); outline-offset: 1px; }
/* Breite Ansicht: Seitenspalte */
.otms-sheetpanel.is-side { position: fixed; right: 16px; top: var(--otms-sheet-top, 24px); width: var(--otms-sheet-w, 236px); max-height: calc(100vh - var(--otms-sheet-top, 24px) - 24px); }
.otms-sheetpanel.is-side .otms-sheetpanel__toggle { display: none; }
html.otms-sheet-side #main-content.app-main-shell { padding-right: calc(var(--otms-sheet-w, 236px) + 40px) !important; }
/* Schmale Ansicht: Schublade unten, eingeklappt nur die Kopfzeile */
.otms-sheetpanel.is-drawer { position: fixed; left: 0; right: 0; bottom: calc(var(--app-mobile-bottom-offset, 0px) + env(safe-area-inset-bottom, 0px)); width: auto; border-left: 0; border-right: 0; border-bottom: 0; }
.otms-sheetpanel.is-drawer .otms-sheetpanel__head { cursor: pointer; }
.otms-sheetpanel.is-drawer .otms-sheetpanel__body { max-height: 0; padding-top: 0; padding-bottom: 0; overflow: hidden; transition: max-height .22s ease; }
.otms-sheetpanel.is-drawer.is-open .otms-sheetpanel__body { max-height: min(42vh, 320px); padding-top: 8px; padding-bottom: 10px; overflow-y: auto; }
.otms-sheetpanel.is-drawer .otms-sheetpanel__row { grid-template-columns: 26px repeat(5, minmax(0, 1fr)); height: 26px; }
html.otms-sheet-drawer #main-content.app-main-shell { padding-bottom: calc(var(--app-mobile-bottom-offset, 0px) + env(safe-area-inset-bottom, 0px) + var(--otms-sheet-h, 0px) + 16px) !important; }
/* Ausgeblendet: nur noch der Schalter, damit der Bogen zurückgeholt werden kann */
.otms-sheetpanel.is-collapsed { right: 16px; left: auto; top: auto; bottom: calc(var(--app-mobile-bottom-offset, 0px) + env(safe-area-inset-bottom, 0px) + 12px); position: fixed; width: auto; border: 1px solid var(--otms-line-strong); }
.otms-sheetpanel.is-collapsed .otms-sheetpanel__body, .otms-sheetpanel.is-collapsed .otms-sheetpanel__title, .otms-sheetpanel.is-collapsed .otms-sheetpanel__count, .otms-sheetpanel.is-collapsed .otms-sheetpanel__toggle { display: none; }
.otms-sheetpanel.is-collapsed .otms-sheetpanel__head { background: var(--otms-surface); border-bottom: 0; padding: 8px 12px; cursor: default; }
@media (prefers-reduced-motion: reduce) { .otms-sheetpanel.is-drawer .otms-sheetpanel__body { transition: none; } }
/* Schalter in der Generalprobe-Leiste (Markup: views/modules.html) */
#sim-floating-bar .otms-simbar { grid-template-columns: auto minmax(0, 1fr) auto auto; }
.otms-simbar__sheet { background: none; border: 0; padding: 0; font: 600 12px/1 var(--otms-f-display); letter-spacing: .1em; text-transform: uppercase; color: var(--otms-ink-soft); cursor: pointer; }
.otms-simbar__sheet:hover { color: var(--otms-ink); }
.otms-simbar__sheet.hidden { display: none; }
@media (max-width: 760px) {
    #sim-floating-bar .otms-simbar { grid-template-columns: auto minmax(0, 1fr) auto; }
    .otms-simbar__step { grid-column: 1; grid-row: 1; }
    .otms-simbar__dots { grid-column: 2; grid-row: 1; overflow: hidden; }
    .otms-simbar__abort { grid-column: 3; grid-row: 1; }
    .otms-simbar__sheet { grid-column: 1 / -1; grid-row: 2; justify-self: start; font-size: 11px; letter-spacing: .06em; }
    .otms-simbar__label { grid-row: 3; }
}
.otms-qtable--rows tbody tr:nth-child(even) td { background: var(--otms-surface); }
.otms-qtable--rows th[scope="row"] { white-space: nowrap; }
/* Aufgaben-Tabellen sollen wie Daten aussehen, nicht wie Dashboard-Spaltenkoepfe */
.otms-quant__stem .otms-qtable th, .otms-task__stem .otms-qtable th, .otms-xsheet__stem .otms-qtable th, .otms-qtable th {
    font-family: var(--otms-f-body); font-size: 0.95em; font-weight: 600; letter-spacing: 0;
    text-transform: none; color: var(--otms-ink); background: var(--otms-bg-2); padding: 6px 10px;
}
.otms-quant__stem .otms-qtable th, .otms-quant__stem .otms-qtable td,
.otms-task__stem .otms-qtable th, .otms-task__stem .otms-qtable td {
    border: 1px solid var(--otms-line-strong) !important;
}

/* Generalprobe-Leiste: Platz fuer den Inhalt darunter.
   css/app-modules.css setzt dafuer padding-top auf #main-content; das
   !important der Shell-Regel oben (.app-main-shell) wuerde das schlucken —
   deshalb dieselbe Regel hier mit gleicher Gewichtung und gleichem Wert. */
@media (min-width: 768px) {
    html:has(#sim-floating-bar:not(.hidden)) .app-main-shell { padding-top: calc(var(--otms-simbar-h, 52px) + 8px) !important; }
}
