/* Draw2Weld – Web-Oberfläche
 *
 * Gestaltung nach docs/design/Design_System.md („Apple-Niveau“): ruhige Flächen, Glass-Materialien mit
 * backdrop-filter, große Titel, Pill-Buttons, Segmented Control, iOS-Schalter, inset-gruppierte Listen.
 * Keine externen Ressourcen (Systemschriften, Symbole als Inline-SVG). Farben ausschließlich als Tokens auf :root;
 * Dunkelmodus über prefers-color-scheme (Override per data-theme="light|dark" auf <html> möglich).
 *
 * Abweichungen von den Design-Tokens nur wegen Kontrast ≥ 4,5:1 (Abnahmekriterium, nachgerechnet in
 * tests/test_web_static.py::test_css_text_contrast_in_real_contexts – auch auf getönten/gewählten Zeilen, in der
 * Seitenleiste und auf schwebenden Flächen über der Zeichnung): Sekundärtext hell #636366 (wie der 3D-Viewer) statt
 * #6e6e73, dunkel #aeaeb2 statt #a1a1a6; Textvarianten der Statusfarben (-text) dunkler bzw. heller; Hover der
 * Primärfläche dunkler (#0066cc – Weiß auf #0077ed erreicht nur 4,3:1); Primärflächen im Dunkelmodus mit #0071e3
 * (Weiß auf #0a84ff erreicht nur 3,7:1). Schwebende Bedienelemente über der Zeichnung nutzen das dichtere Material
 * --glass-float: Die Zeichnungsseite ist auch im Dunkelmodus weiß, darüber wäre dunkles Glas (66 %) nur noch mittelgrau.
 */

:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --bg-elevated: #ffffff;
  --bg-grouped: #f2f2f7;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.88);
  --glass-float: rgba(255, 255, 255, 0.9);
  --glass-sidebar: rgba(242, 242, 247, 0.8);
  --glass-border: rgba(0, 0, 0, 0.06);
  --label: #1d1d1f;
  --label-2: #636366;
  --label-3: #86868b;
  --separator: rgba(60, 60, 67, 0.12);
  --separator-strong: rgba(60, 60, 67, 0.3);
  --fill: rgba(120, 120, 128, 0.12);
  --fill-2: rgba(120, 120, 128, 0.2);
  --fill-hover: rgba(120, 120, 128, 0.08);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-fill: #0071e3;
  --accent-fill-hover: #0066cc;
  --accent-text: #0058b0;
  --accent-tint: rgba(0, 113, 227, 0.12);
  --accent-tint-hover: rgba(0, 113, 227, 0.16);
  --on-accent: #ffffff;
  --focus: #0071e3;
  --focus-ring: rgba(0, 113, 227, 0.4);
  --green: #34c759;
  --green-text: #19692d;
  --green-tint: rgba(52, 199, 89, 0.15);
  --orange: #ff9f0a;
  --orange-text: #9c4400;
  --orange-tint: rgba(255, 159, 10, 0.15);
  --red: #ff3b30;
  --red-text: #b80010;
  --red-tint: rgba(255, 59, 48, 0.12);
  --red-fill: #d70015;
  --red-fill-hover: #c20012;
  --gray: #8e8e93;
  --gray-text: #56565b;
  --gray-tint: rgba(142, 142, 147, 0.15);
  --purple: #af52de;
  --purple-text: #7f3aa0;
  /* KI-Kennzeichen, KI-Evidenz und Einträge des KI-Vorschlags (docs/19 §11.1: KI immer erkennbar) */
  --ai: #5856d6;
  --ai-text: #4a40c4;
  --ai-tint: rgba(88, 86, 214, 0.14);
  --ai-fill: #5856d6;
  --thumb: #ffffff;
  --switch-off: #e9e9eb;
  --switch-on: #34c759;
  --knob: #ffffff;
  --knob-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 3px 1px rgba(0, 0, 0, 0.06);
  --mark-bg: #ffe066;
  --mark-text: #1d1d1f;
  --scrim: rgba(0, 0, 0, 0.3);
  --dialog-backdrop: rgba(0, 0, 0, 0.32);
  --glyph-a: #2997ff;
  --glyph-b: #0062d1;
  --glyph-weld: #ffcc4d;
  --glyph-shadow: rgba(0, 0, 0, 0.16);
  --cat-weld: #0071e3;
  --cat-check: #ff9f0a;
  --cat-issue: #ff3b30;
  --cat-noweld: #8e8e93;
  --cat-info: #af52de;
  --auto-weldnote: #0071e3;
  --auto-balloon: #34c759;
  --auto-view: #8e8e93;
  --auto-cover: #ff3b30;
  --canvas: #e3e3e8;
  --page: #ffffff;
  --page-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 10px 30px rgba(0, 0, 0, 0.12);
  --mk-text: #1d1d1f;
  --mk-textbox: rgba(255, 255, 255, 0.9);
  --pin-ring: #ffffff;
  --handle-fill: #ffffff;
  --handle-stroke: #0071e3;
  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 18px;
  --radius-xl: 24px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 1px rgba(0, 0, 0, 0.03);
  --shadow-2: 0 8px 30px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.06);
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --t-fast: 200ms;
  --t: 250ms;
  --t-slow: 350ms;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI Variable Text", "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  --sidebar-w: 300px;
  --toolbar-h: 52px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000;
    --bg-elevated: #1c1c1e;
    --bg-grouped: #111113;
    --glass: rgba(30, 30, 32, 0.66);
    --glass-strong: rgba(36, 36, 38, 0.9);
    --glass-float: rgba(28, 28, 30, 0.94);
    --glass-sidebar: rgba(28, 28, 30, 0.74);
    --glass-border: rgba(255, 255, 255, 0.08);
    --label: #f5f5f7;
    --label-2: #aeaeb2;
    --label-3: #6e6e73;
    --separator: rgba(84, 84, 88, 0.36);
    --separator-strong: rgba(84, 84, 88, 0.7);
    --fill: rgba(120, 120, 128, 0.24);
    --fill-2: rgba(120, 120, 128, 0.36);
    --fill-hover: rgba(120, 120, 128, 0.16);
    --accent: #0a84ff;
    --accent-hover: #409cff;
    --accent-fill: #0071e3;
    --accent-fill-hover: #0066cc;
    --accent-text: #5eaeff;
    --accent-tint: rgba(10, 132, 255, 0.18);
    --accent-tint-hover: rgba(10, 132, 255, 0.26);
    --focus: #409cff;
    --focus-ring: rgba(10, 132, 255, 0.45);
    --green: #30d158;
    --green-text: #30d158;
    --green-tint: rgba(48, 209, 88, 0.16);
    --orange: #ff9f0a;
    --orange-text: #ffb340;
    --orange-tint: rgba(255, 159, 10, 0.16);
    --red: #ff453a;
    --red-text: #ff8a82;
    --red-tint: rgba(255, 69, 58, 0.16);
    --red-fill: #d70015;
    --red-fill-hover: #e5001a;
    --gray-text: #c7c7cc;
    --gray-tint: rgba(142, 142, 147, 0.22);
    --purple: #bf5af2;
    --purple-text: #d68cf7;
    --ai: #5e5ce6;
    --ai-text: #a5a3ff;
    --ai-tint: rgba(94, 92, 230, 0.24);
    --ai-fill: #5856d6;
    --thumb: #636366;
    --switch-off: rgba(120, 120, 128, 0.32);
    --switch-on: #30d158;
    --mark-bg: #d9a400;
    --mark-text: #000000;
    --scrim: rgba(0, 0, 0, 0.5);
    --dialog-backdrop: rgba(0, 0, 0, 0.55);
    --glyph-shadow: rgba(0, 0, 0, 0.5);
    --canvas: #1c1c1e;
    --page-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 10px 30px rgba(0, 0, 0, 0.5);
    --handle-stroke: #0a84ff;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-2: 0 8px 30px rgba(0, 0, 0, 0.6);
    --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --bg-elevated: #1c1c1e;
  --bg-grouped: #111113;
  --glass: rgba(30, 30, 32, 0.66);
  --glass-strong: rgba(36, 36, 38, 0.9);
  --glass-float: rgba(28, 28, 30, 0.94);
  --glass-sidebar: rgba(28, 28, 30, 0.74);
  --glass-border: rgba(255, 255, 255, 0.08);
  --label: #f5f5f7;
  --label-2: #aeaeb2;
  --label-3: #6e6e73;
  --separator: rgba(84, 84, 88, 0.36);
  --separator-strong: rgba(84, 84, 88, 0.7);
  --fill: rgba(120, 120, 128, 0.24);
  --fill-2: rgba(120, 120, 128, 0.36);
  --fill-hover: rgba(120, 120, 128, 0.16);
  --accent: #0a84ff;
  --accent-hover: #409cff;
  --accent-fill: #0071e3;
  --accent-fill-hover: #0066cc;
  --accent-text: #5eaeff;
  --accent-tint: rgba(10, 132, 255, 0.18);
  --accent-tint-hover: rgba(10, 132, 255, 0.26);
  --focus: #409cff;
  --focus-ring: rgba(10, 132, 255, 0.45);
  --green: #30d158;
  --green-text: #30d158;
  --green-tint: rgba(48, 209, 88, 0.16);
  --orange: #ff9f0a;
  --orange-text: #ffb340;
  --orange-tint: rgba(255, 159, 10, 0.16);
  --red: #ff453a;
  --red-text: #ff8a82;
  --red-tint: rgba(255, 69, 58, 0.16);
  --red-fill: #d70015;
  --red-fill-hover: #e5001a;
  --gray-text: #c7c7cc;
  --gray-tint: rgba(142, 142, 147, 0.22);
  --purple: #bf5af2;
  --purple-text: #d68cf7;
  --ai: #5e5ce6;
  --ai-text: #a5a3ff;
  --ai-tint: rgba(94, 92, 230, 0.24);
  --ai-fill: #5856d6;
  --thumb: #636366;
  --switch-off: rgba(120, 120, 128, 0.32);
  --switch-on: #30d158;
  --mark-bg: #d9a400;
  --mark-text: #000000;
  --scrim: rgba(0, 0, 0, 0.5);
  --dialog-backdrop: rgba(0, 0, 0, 0.55);
  --glyph-shadow: rgba(0, 0, 0, 0.5);
  --canvas: #1c1c1e;
  --page-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 10px 30px rgba(0, 0, 0, 0.5);
  --handle-stroke: #0a84ff;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-2: 0 8px 30px rgba(0, 0, 0, 0.6);
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

/* ============================================================================================ Grundlagen */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--label);
  font: 15px/22px var(--font); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3, h4, h5, h6, p { margin: 0; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0;
}
.mono { font-family: var(--mono); font-size: 0.93em; }
.muted { color: var(--label-2); }
.caption, .fine { font-size: 12px; line-height: 16px; color: var(--label-2); }
.footnote { font-size: 13px; line-height: 18px; color: var(--label-2); }
.spacer { flex: 1 1 auto; }
.ic { flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.skip-link {
  position: fixed; left: 12px; top: -80px; z-index: 200; padding: 10px 16px; border-radius: 999px;
  background: var(--accent-fill); color: var(--on-accent); font-weight: 600;
  transition: top var(--t-fast) var(--ease);
}
.skip-link:focus { top: 12px; text-decoration: none; box-shadow: var(--shadow-2); }
noscript p { margin: 16px; padding: 12px 16px; border-radius: var(--radius-m); background: var(--bg-elevated); }

/* ============================================================================================ App-Rahmen */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); height: 100vh; height: 100dvh; }
.sidebar {
  position: relative; z-index: 30; display: flex; flex-direction: column; min-height: 0; min-width: 0;
  background: var(--glass-sidebar);
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  border-right: 1px solid var(--separator);
  padding-top: env(safe-area-inset-top);
}
.scrim {
  position: fixed; inset: 0; z-index: 25; background: var(--scrim);
  animation: fade-in var(--t) var(--ease);
}
.main {
  position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0;
  overflow-x: hidden; overflow-y: auto; outline: none; overscroll-behavior: contain;
}
.toolbar {
  position: sticky; top: 0; z-index: 20; flex: none; display: flex; align-items: center; gap: 8px;
  height: var(--toolbar-h); padding: 0 16px 0 24px;
  background: var(--glass); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-fast) var(--ease);
}
.toolbar.is-scrolled { border-bottom-color: var(--separator); }
.toolbar .tb-sidebar { display: none; }
.tb-title {
  flex: 1 1 auto; min-width: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; opacity: 0; transform: translateY(4px);
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.tb-title.is-visible { opacity: 1; transform: none; }
.tb-actions { flex: none; display: flex; align-items: center; gap: 8px; }
.content { flex: 1 0 auto; display: flex; flex-direction: column; min-width: 0; }
.view { flex: 1 0 auto; width: 100%; max-width: 1180px; margin: 0 auto; padding: 4px 32px 56px; min-width: 0; outline: none; }

/* ============================================================================================ Seitenleiste */
.sb-top { display: grid; gap: 12px; padding: 18px 16px 10px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.glyph { width: 34px; height: 34px; flex: none; filter: drop-shadow(0 1px 2px var(--glyph-shadow)); }
.glyph-stop-a { stop-color: var(--glyph-a); }
.glyph-stop-b { stop-color: var(--glyph-b); }
.glyph-line { fill: none; stroke: var(--on-accent); stroke-width: 2.4; stroke-linecap: round; }
.glyph-weld { fill: none; stroke: var(--glyph-weld); stroke-width: 2.6; stroke-linecap: round; }
.brand-text { flex: 1 1 auto; min-width: 0; display: grid; }
.brand-title { font: 700 20px/24px var(--font-display); letter-spacing: -0.3px; }
.brand-version { font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .sb-close { display: none; }
.server-pill {
  justify-self: start; display: inline-flex; align-items: center; gap: 7px; max-width: 100%; height: 24px; padding: 0 10px;
  border-radius: 999px; background: var(--fill); color: var(--label-2); font-size: 12px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.server-pill .dot { width: 7px; height: 7px; background: var(--gray); }
.server-pill[data-state="ok"] .dot { background: var(--green); }
.server-pill[data-state="down"] { background: var(--red-tint); color: var(--red-text); }
.server-pill[data-state="down"] .dot { background: var(--red); }
.btn-block { width: 100%; }
.search-field { position: relative; }
.search-field > .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--label-2); pointer-events: none; }
.search-field input[type="search"] { height: 34px; padding-left: 32px; font-size: 14px; }
.sb-section { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.sb-section-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px 4px 20px; }
.sb-heading { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--label-2); }
.job-list {
  list-style: none; margin: 0; padding: 2px 10px 10px; flex: 1 1 auto; min-height: 0; overflow-y: auto;
  display: grid; align-content: start; gap: 2px; overscroll-behavior: contain;
}
.job-item { position: relative; min-width: 0; }
.job-select {
  display: grid; gap: 3px; width: 100%; min-width: 0; padding: 9px 40px 9px 10px; border: 0; border-radius: 10px;
  background: transparent; text-align: left; cursor: pointer;
  transition: background-color var(--t-fast) var(--ease);
}
.job-item:hover .job-select { background: var(--fill-hover); }
.job-item.is-selected .job-select { background: var(--accent-tint); }
.job-select:focus-visible { outline-offset: -2px; }
.job-row1 { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.job-name { flex: 1 1 auto; min-width: 0; font-size: 14px; line-height: 19px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-date { flex: none; font-size: 12px; line-height: 16px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.job-row2 { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; min-width: 0; }
.job-idline { font: 11.5px/15px var(--mono); color: var(--label-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-extra { font-size: 12px; line-height: 16px; color: var(--label-2); white-space: nowrap; }
.fmt-chip {
  display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 5px; background: var(--fill);
  color: var(--gray-text); font-size: 11px; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap;
}
.job-delete { position: absolute; top: 7px; right: 6px; opacity: 0; transition: opacity var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease); }
.job-item:hover .job-delete, .job-item:focus-within .job-delete { opacity: 1; }
.job-item:hover .job-delete:disabled, .job-item:focus-within .job-delete:disabled { opacity: 0.35; }
.job-delete:hover:not(:disabled) { color: var(--red-text); background: var(--red-tint); }
.sb-empty { padding: 14px 20px; font-size: 13px; line-height: 18px; color: var(--label-2); }
.sb-status { padding: 0 20px 8px; font-size: 12px; line-height: 16px; color: var(--label-2); overflow-wrap: anywhere; }
.sb-status:empty { display: none; }
.sb-status.is-error { color: var(--red-text); font-weight: 600; }
.sb-status.is-ok { color: var(--green-text); }
.sb-foot {
  flex: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--separator);
}
.sb-link {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--label-2); font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.sb-link:hover { background: var(--fill-hover); color: var(--label); text-decoration: none; }

/* ============================================================================================ Bedienelemente */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; max-width: 100%; padding: 0 16px;
  border: 0; border-radius: 999px; background: var(--accent-tint); color: var(--accent-text);
  font-size: 14px; font-weight: 600; line-height: 1; white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
}
.btn:hover:not(:disabled) { background: var(--accent-tint-hover); text-decoration: none; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.4; cursor: default; }
.btn-primary { background: var(--accent-fill); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-fill-hover); }
.btn-secondary { background: var(--accent-tint); color: var(--accent-text); }
.btn-gray { background: var(--fill); color: var(--label); }
.btn-gray:hover:not(:disabled) { background: var(--fill-2); }
.btn-plain { background: transparent; color: var(--accent-text); padding: 0 10px; }
.btn-plain:hover:not(:disabled) { background: var(--fill-hover); }
.btn-destructive { background: var(--red-tint); color: var(--red-text); }
.btn-destructive:hover:not(:disabled) { background: var(--red-tint); color: var(--red-fill); }
.btn-danger { background: var(--red-fill); color: var(--on-accent); }
.btn-danger:hover:not(:disabled) { background: var(--red-fill-hover); }
.btn-sm { height: 28px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 40px; padding: 0 22px; font-size: 15px; }
.btn-icon { width: 34px; padding: 0; }
.btn-sm.btn-icon { width: 28px; }
.btn-wrap { white-space: normal; height: auto; min-height: 34px; padding-top: 8px; padding-bottom: 8px; line-height: 1.3; text-align: left; border-radius: 18px; }
.icon-btn {
  display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--label-2); cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
}
.icon-btn:hover:not(:disabled) { background: var(--fill-hover); color: var(--label); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.link-btn {
  border: 0; background: none; padding: 0; color: var(--accent-text); cursor: pointer; font-size: inherit; font-weight: 500;
  text-decoration: none;
}
.link-btn:hover { text-decoration: underline; text-underline-offset: 2px; }

input[type="text"], input[type="search"], input[type="number"], input[type="password"], select, textarea {
  width: 100%; min-width: 0; height: 36px; padding: 0 12px; border: 0; border-radius: 10px;
  background-color: var(--fill); color: var(--label); font-size: 15px;
  transition: box-shadow var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
textarea { height: auto; min-height: 76px; padding: 8px 12px; line-height: 20px; resize: vertical; }
select {
  -webkit-appearance: none; appearance: none; padding-right: 34px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--label-2) 50%), linear-gradient(135deg, var(--label-2) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
input::placeholder, textarea::placeholder { color: var(--label-2); opacity: 1; }
input:focus, select:focus, textarea:focus { outline: none; }
input[type="text"]:focus-visible, input[type="search"]:focus-visible, input[type="number"]:focus-visible, input[type="password"]:focus-visible, select:focus-visible, textarea:focus-visible {
  box-shadow: 0 0 0 1px var(--focus), 0 0 0 4px var(--focus-ring);
}
select:disabled, input:disabled, textarea:disabled { opacity: 0.5; cursor: default; }
input[aria-invalid="true"] { box-shadow: inset 0 0 0 1.5px var(--red); }
input[aria-invalid="true"]:focus-visible { box-shadow: 0 0 0 1px var(--red), 0 0 0 4px var(--red-tint); }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
.hint { font-size: 13px; line-height: 18px; color: var(--label-2); }
.is-error { color: var(--red-text); }

/* iOS-Schalter: Eingabe unsichtbar, aber fokussierbar; Darstellung über den Folge-Span */
.switch-input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.switch {
  position: relative; flex: none; width: 51px; height: 31px; border-radius: 16px; background: var(--switch-off);
  transition: background-color var(--t-fast) var(--ease);
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: var(--knob); box-shadow: var(--knob-shadow); transition: transform var(--t-fast) var(--ease);
}
.switch-input:checked + .switch { background: var(--switch-on); }
.switch-input:checked + .switch::after { transform: translateX(20px); }
.switch-input:focus-visible + .switch { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch-input:disabled + .switch { opacity: 0.45; }
.row-switch:has(.switch-input:disabled) { cursor: default; }
.row-switch:has(.switch-input:disabled) .row-text { opacity: 0.55; }
.switch.sm { width: 42px; height: 26px; }
.switch.sm::after { width: 22px; height: 22px; }
.switch-input:checked + .switch.sm::after { transform: translateX(16px); }

/* Segmented Control (Pill, gleitender Thumb) */
.segmented {
  position: relative; display: inline-flex; align-items: stretch; max-width: 100%; padding: 2px; border-radius: 999px;
  background: var(--fill); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; vertical-align: middle;
}
.segmented::-webkit-scrollbar { display: none; }
.seg {
  position: relative; z-index: 1; flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; color: var(--label);
  font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.seg:hover { background: var(--fill-hover); }
.seg[aria-selected="true"]:hover { background: transparent; }
/* Fokusring am Rand des Segments (innen läge er im Dunkelmodus auf dem grauen Thumb mit nur ~2:1) */
.seg:focus-visible { outline-offset: 0; }
.seg .count {
  min-width: 18px; height: 18px; padding: 0 6px; border-radius: 9px; background: var(--fill); color: var(--label-2);
  font-size: 11px; font-weight: 600; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums;
}
.seg-thumb {
  position: absolute; z-index: 0; top: 2px; bottom: 2px; left: 0; width: 0; border-radius: 999px; background: var(--thumb);
  box-shadow: var(--shadow-1), 0 0 0 0.5px var(--glass-border);
  transition: transform var(--t-fast) var(--ease), width var(--t-fast) var(--ease);
}
.segmented.is-init .seg-thumb { transition: none; }
.segmented.no-thumb .seg-thumb { display: none; }
.segmented.no-thumb .seg[aria-selected="true"], .segmented .seg[aria-checked="true"] { background: var(--thumb); box-shadow: var(--shadow-1); }
.segmented.sm .seg { height: 26px; padding: 0 12px; font-size: 12.5px; }
.tabset > .seg-panels { margin-top: 14px; }

/* Abzeichen, Punkte, Chips */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap; background: var(--gray-tint); color: var(--gray-text);
}
.badge .dot { width: 6px; height: 6px; }
.badge .ic { width: 13px; height: 13px; }
.badge.tone-good { background: var(--green-tint); color: var(--green-text); }
.badge.tone-warn { background: var(--orange-tint); color: var(--orange-text); }
.badge.tone-bad { background: var(--red-tint); color: var(--red-text); }
.badge.tone-accent { background: var(--accent-tint); color: var(--accent-text); }
.badge.tone-good > .dot, .dot.tone-good { background: var(--green); }
.badge.tone-warn > .dot, .dot.tone-warn { background: var(--orange); }
.badge.tone-bad > .dot, .dot.tone-bad { background: var(--red); }
.badge.tone-accent > .dot, .dot.tone-accent { background: var(--accent); }
.badge.tone-neutral > .dot, .dot.tone-neutral { background: var(--gray); }
.badge.kind { background: var(--fill); color: var(--gray-text); font-weight: 500; }
.badge.kind.tone-bad { background: var(--red-tint); color: var(--red-text); }
.badge.is-running .dot { animation: pulse 1.2s ease-in-out infinite; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--gray); }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 0; border-radius: 999px;
  background: var(--fill); color: var(--label); font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.chip:hover:not(:disabled) { background: var(--fill-2); }
.chip[aria-pressed="true"] { background: var(--accent-fill); color: var(--on-accent); }
.chip:disabled { opacity: 0.4; cursor: default; }
.chip .n { color: var(--label-2); font-variant-numeric: tabular-nums; }
/* Zähler: auf der dunkleren Hover-Fläche bzw. der Akzentfläche volle Textfarbe (keine Deckkraft – Kontrast ≥ 4,5:1) */
.chip:hover:not(:disabled) .n { color: var(--label); }
.chip[aria-pressed="true"] .n, .chip[aria-pressed="true"]:hover .n { color: inherit; }
.tag {
  display: inline-flex; align-items: center; min-height: 24px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px;
  font-family: var(--mono); background: var(--fill); overflow-wrap: anywhere;
}

/* ============================================================================================ Karten, Gruppen, Kennzahlen */
.card { background: var(--bg-elevated); border-radius: var(--radius-l); box-shadow: var(--shadow-1); padding: 20px 24px; min-width: 0; }
.card-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 14px; }
.card-head h3 { font: 600 17px/22px var(--font); }
.card-head .muted { font-size: 13px; }
.card > * + * { margin-top: 14px; }
.card > .card-head + * { margin-top: 0; }
.group-title { margin: 28px 0 8px 16px; font-size: 13px; line-height: 18px; font-weight: 400; color: var(--label-2); text-transform: uppercase; letter-spacing: 0.02em; }
.group { margin: 0; padding: 0; border: 0; min-width: 0; background: var(--bg-elevated); border-radius: var(--radius-m); box-shadow: var(--shadow-1); overflow: hidden; }
.row { position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 16px; min-width: 0; }
.group > .row ~ .row::before, .group-list > li + li::before {
  content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 1px solid var(--separator);
}
.row-label { flex: 1 1 auto; min-width: 0; font-size: 15px; }
.row-optional { margin-left: 4px; font-size: 13px; color: var(--label-2); }
.row-select, .row-input { flex: 0 1 300px; width: auto; }
.row-text { flex: 1 1 auto; min-width: 0; display: grid; gap: 1px; font-size: 15px; line-height: 20px; }
.row-text small { font-size: 13px; line-height: 18px; color: var(--label-2); }
.row-switch { cursor: pointer; }
.row-hint { padding: 0 16px 10px; margin-top: -4px; font-size: 13px; line-height: 18px; color: var(--label-2); min-width: 0; overflow-wrap: anywhere; }
.row-hint:empty { display: none; }
.row-hint .disclosure { margin-top: 6px; }
.row-value { flex: none; max-width: 60%; color: var(--label-2); text-align: right; overflow-wrap: anywhere; }
.row .row-ic {
  flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px;
  background: var(--accent-tint); color: var(--accent-text);
}
.group-list { list-style: none; margin: 0; padding: 0; background: var(--bg-elevated); border-radius: var(--radius-m); box-shadow: var(--shadow-1); overflow: hidden; }
.group-list:empty { display: none; }
.group-list > li { position: relative; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 12px; }
.kpi { padding: 14px 16px 16px; border-radius: var(--radius-l); background: var(--bg-elevated); box-shadow: var(--shadow-1); min-width: 0; }
.kpi .k { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; line-height: 18px; color: var(--label-2); }
.kpi .k-text { min-width: 0; overflow-wrap: anywhere; }
.kpi .v { margin-top: 4px; font: 600 28px/34px var(--font-display); letter-spacing: -0.3px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .x { margin-top: 2px; font-size: 12px; line-height: 16px; color: var(--label-2); overflow-wrap: anywhere; }
.kpi.tone-good .v { color: var(--green-text); }
.kpi.tone-warn .v { color: var(--orange-text); }
.kpi.tone-bad .v { color: var(--red-text); }
.kpi .v.split { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 20px; line-height: 28px; }
.kpi .v.split span { display: inline-flex; align-items: center; gap: 6px; }
.kpis.kpis-8 { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.kpis.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis.compact .kpi { padding: 12px 14px 14px; }
.card .kpi { background: var(--bg-grouped); box-shadow: none; }
.kpis.compact .kpi .v { font-size: 24px; line-height: 30px; }

/* Hinweiskästen */
.callout {
  display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; padding: 12px 14px; border-radius: var(--radius-m);
  background: var(--fill); font-size: 14px; line-height: 20px;
}
.callout > .ic { margin-top: 1px; color: var(--label-2); }
.callout-title { display: block; font-weight: 600; }
.callout-body { min-width: 0; overflow-wrap: anywhere; }
.callout-body > * + * { margin-top: 6px; }
.callout ul { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 3px; }
.callout.tone-warn { background: var(--orange-tint); }
.callout.tone-warn > .ic { color: var(--orange-text); }
.callout.tone-bad { background: var(--red-tint); }
.callout.tone-bad > .ic { color: var(--red-text); }
.callout.tone-good { background: var(--green-tint); }
.callout.tone-good > .ic { color: var(--green-text); }
.callout.tone-info { background: var(--accent-tint); }
.callout.tone-info > .ic { color: var(--accent-text); }
.callout.is-prominent { box-shadow: inset 0 0 0 1.5px var(--red); }
.callout .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* Fortschritt, Spinner, Statuszeilen */
.progress { height: 4px; border-radius: 2px; background: var(--fill); overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--accent); border-radius: 2px; transition: width var(--t-fast) var(--ease); }
.progress.is-indeterminate .progress-bar { width: 30%; animation: indeterminate 1.4s var(--ease) infinite; }
.spinner {
  display: inline-block; width: 18px; height: 18px; flex: none; border-radius: 50%;
  border: 2px solid var(--fill-2); border-top-color: var(--label-2); animation: spin 0.8s linear infinite;
}
.spinner.lg { width: 28px; height: 28px; border-width: 2.5px; }
.status-line { margin-top: 12px; min-height: 22px; font-size: 14px; line-height: 20px; color: var(--label-2); overflow-wrap: anywhere; }
.status-line:empty { display: none; }
.status-line.is-error { color: var(--red-text); font-weight: 600; }
.status-line.is-ok { color: var(--green-text); }
.run-state { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.run-state strong { font-size: 15px; }
.loading-block { display: flex; align-items: center; gap: 10px; padding: 20px 4px; color: var(--label-2); font-size: 14px; }

/* Hinweise (Toasts): Glass-Pill unten mittig */
.toasts {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 150; display: grid; justify-items: center;
  gap: 8px; width: max-content; max-width: calc(100vw - 32px); transform: translateX(-50%); pointer-events: none;
}
.toast {
  display: inline-flex; align-items: center; gap: 10px; max-width: 100%; min-height: 44px; padding: 10px 18px 10px 14px;
  border-radius: 999px; background: var(--glass-strong);
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow-2), 0 0 0 0.5px var(--glass-border); color: var(--label); font-size: 14px; font-weight: 500; line-height: 20px;
  opacity: 0; transform: translateY(12px) scale(0.98); pointer-events: auto;
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
}
.toast span { overflow-wrap: anywhere; }
.toast.is-in { opacity: 1; transform: none; }
.toast .ic { color: var(--accent); }
.toast.tone-good .ic { color: var(--green); }
.toast.tone-warn .ic { color: var(--orange); }
.toast.tone-bad .ic { color: var(--red); }

details > summary { cursor: pointer; }
details.disclosure > summary {
  display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; color: var(--label-2); list-style: none;
}
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before {
  content: ""; width: 6px; height: 6px; margin: 0 4px 0 2px; border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform var(--t-fast) var(--ease);
}
details.disclosure[open] > summary::before { transform: rotate(45deg); }
details.disclosure > summary:hover { color: var(--label); }
.disclosure-body { margin-top: 10px; }
.plain-list { margin: 0; padding-left: 18px; display: grid; gap: 3px; }
.plain-list li { overflow-wrap: anywhere; }
.warn-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.warn-list li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 8px; overflow-wrap: anywhere; }
.warn-list li .ic { margin-top: 2px; color: var(--orange-text); }
.section-title { margin: 0 0 8px; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--label-2); text-transform: uppercase; letter-spacing: 0.05em; }

/* ============================================================================================ Neuer Auftrag */
.page-head { display: grid; gap: 6px; padding: 18px 0 20px; min-width: 0; container: pagehead / inline-size; }
.large-title { font: 700 34px/41px var(--font-display); letter-spacing: -0.4px; outline: none; overflow-wrap: anywhere; min-width: 0; }
.title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; min-width: 0; }
.subtitle { font-size: 15px; line-height: 22px; color: var(--label-2); max-width: 72ch; overflow-wrap: anywhere; }
.meta-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 13px; line-height: 18px; color: var(--label-2); }
.meta-line .mono { font-size: 12.5px; }
.new-form { display: grid; min-width: 0; }
.new-form > .group-title:first-of-type { margin-top: 28px; }
.dropzone {
  display: grid; justify-items: center; gap: 8px; padding: 40px 24px 32px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--separator-strong); border-radius: var(--radius-xl); background: var(--bg-elevated);
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.dropzone:hover { border-color: var(--label-3); }
.dropzone.is-over { border-color: var(--accent); background: var(--accent-tint); transform: scale(1.01); }
.dropzone.is-busy { opacity: 0.6; cursor: progress; }
.dz-icon { color: var(--accent); margin-bottom: 4px; }
.dz-title { font: 600 20px/25px var(--font-display); }
.dz-or { font-size: 13px; color: var(--label-2); }
.dz-hint { margin-top: 6px; max-width: 58ch; font-size: 13px; line-height: 18px; color: var(--label-2); }
.dz-formats { font-size: 13px; }
.file-list { margin-top: 16px; }
.file-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: start; gap: 12px; padding: 10px 8px 10px 14px; }
.file-row.is-bad { background: var(--red-tint); }
.file-ic {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--accent-tint);
  color: var(--accent-text);
}
.file-row.is-bad .file-ic { background: var(--red-tint); color: var(--red-text); }
.file-main { min-width: 0; display: grid; gap: 4px; }
.file-name { font-weight: 600; font-size: 15px; line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13px; color: var(--label-2); }
.file-note { font-size: 13px; line-height: 18px; color: var(--label-2); overflow-wrap: anywhere; }
.file-note.is-bad { color: var(--red-text); font-weight: 600; }
.file-note.is-warn { color: var(--orange-text); }
.file-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 10px 16px 0; font-size: 13px; color: var(--label-2); }
.file-summary .is-bad { color: var(--red-text); font-weight: 600; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 28px; }
.form-actions .btn-primary { min-width: 180px; }
.new-form .progress { margin-top: 16px; }
.cell-assumptions { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--label-2); display: grid; gap: 2px; }
.formats-box { display: grid; gap: 18px; }
.fmt-group h4 { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--label-2); display: flex; align-items: center; gap: 8px; text-transform: uppercase; letter-spacing: 0.03em; }
.fmt-list { list-style: none; margin: 0; padding: 0; background: var(--bg-elevated); border-radius: var(--radius-m); box-shadow: var(--shadow-1); overflow: hidden; }
.fmt-item { position: relative; display: grid; gap: 2px; padding: 10px 16px; font-size: 14px; line-height: 20px; }
.fmt-item + .fmt-item::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 1px solid var(--separator); }
.fmt-item .exts { font-family: var(--mono); font-size: 12px; color: var(--label-2); }
.fmt-item .note { font-size: 13px; color: var(--label-2); }

/* ============================================================================================ Auftragsansicht */
.empty-state { display: grid; justify-items: center; gap: 10px; padding: 72px 24px 48px; text-align: center; }
.empty-state > .ic { color: var(--label-3); }
.empty-state h2 { margin-top: 6px; font: 700 28px/34px var(--font-display); letter-spacing: -0.3px; outline: none; }
.empty-state p { color: var(--label-2); max-width: 54ch; }
.empty-state .btn { margin-top: 10px; }
.steps { margin: 28px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; text-align: left; max-width: 620px; counter-reset: step; }
.steps li {
  position: relative; padding: 14px 16px 14px 56px; border-radius: var(--radius-m); background: var(--bg-elevated);
  box-shadow: var(--shadow-1); font-size: 14px; line-height: 20px; counter-increment: step;
}
.steps li::before {
  content: counter(step); position: absolute; left: 16px; top: 13px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--accent-tint); color: var(--accent-text);
}
.detail-tabs { margin: 0 0 22px; }
.section-panel { min-width: 0; outline: none; }
.section-panel > * + * { margin-top: 20px; }
.h-section { margin: 32px 0 12px; font: 600 22px/28px var(--font-display); letter-spacing: -0.2px; }
.section-panel > .h-section:first-child { margin-top: 0; }
.section-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; min-width: 0; }
.section-bar .select-pill { width: auto; max-width: 100%; height: 32px; border-radius: 999px; font-size: 14px; font-weight: 500; }
.placeholder { display: grid; justify-items: center; gap: 10px; padding: 56px 24px; text-align: center; color: var(--label-2); }
.placeholder > .ic { color: var(--label-3); }
.placeholder strong { color: var(--label); font-size: 17px; }
.run-card { display: grid; gap: 14px; }
.job-message { font-size: 14px; line-height: 20px; color: var(--label-2); overflow-wrap: anywhere; }
.toolbar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.toolbar-label { font-size: 13px; font-weight: 600; color: var(--label-2); }
.kv { display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: 14px; line-height: 20px; }
.kv dt { color: var(--label-2); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.kv + .kv, .kv + .joints, .joints + .kv { margin-top: 10px; }
.wm-row { cursor: default; }
.wm-row .row-text strong { font-weight: 600; }
.wm-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* Tabellen: keine vertikalen Linien, Zeilen 44 px */
.table-wrap { overflow: auto; max-width: 100%; border-radius: var(--radius-m); background: var(--bg-elevated); box-shadow: var(--shadow-1); }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; line-height: 20px; font-variant-numeric: tabular-nums; }
table.data th {
  position: sticky; top: 0; z-index: 1; height: 36px; padding: 0 12px; text-align: left; white-space: nowrap;
  font-size: 12px; font-weight: 600; color: var(--label-2); background: var(--bg-elevated); border-bottom: 1px solid var(--separator);
}
table.data td { height: 44px; padding: 8px 12px; border-bottom: 1px solid var(--separator); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; }
table.data .sub { display: block; font-size: 12px; line-height: 16px; color: var(--label-2); }
table.data .fname { font-weight: 600; overflow-wrap: anywhere; }
table.inputs { min-width: 640px; }
table.inputs td { vertical-align: top; }
table.inputs td:first-child { min-width: 180px; }

/* Nahttabelle + Detail */
.seam-browser { container-type: inline-size; min-width: 0; }
.sb-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.sb-filters .sb-q { flex: 1 1 220px; max-width: 360px; height: 32px; font-size: 14px; }
.sb-count { font-size: 13px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.sb-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 14px; align-items: start; }
@container (min-width: 1000px) {
  .sb-body { grid-template-columns: minmax(0, 1fr) 360px; }
  .sb-body .seam-detail { position: sticky; top: calc(var(--toolbar-h) + 12px); max-height: calc(100vh - 90px); overflow: auto; }
}
.sb-table { max-height: min(60vh, 680px); }
/* Hinweise des Schweißauftrags (weld_job.json „warnings“) über der Nahttabelle, aufklappbar */
details.job-notes { margin: 2px 0 14px; }
details.job-notes .plain-list { font-size: 14px; }
table.seams { min-width: 640px; }
table.seams td { white-space: nowrap; padding: 6px 10px; }
@container (max-width: 1249.98px) { table.seams .col-parts { display: none; } }
@container (min-width: 1250px) { table.seams { min-width: 860px; } }
table.seams tbody tr { cursor: pointer; transition: background-color var(--t-fast) var(--ease); }
table.seams tbody tr:hover { background: var(--fill-hover); }
table.seams tbody tr.is-selected { background: var(--accent-tint); }
table.seams th { padding: 0; }
.th-btn {
  width: 100%; height: 36px; display: flex; align-items: center; gap: 4px; padding: 0 10px; border: 0; background: none;
  font-size: 12px; font-weight: 600; color: inherit; cursor: pointer; text-align: left; white-space: nowrap;
}
th.num .th-btn { justify-content: flex-end; }
.th-btn:hover { color: var(--label); }
.sort { width: 8px; font-size: 9px; color: var(--accent-text); }
th[aria-sort="ascending"] .sort::after { content: "\25B2"; }
th[aria-sort="descending"] .sort::after { content: "\25BC"; }
.sb-id { border: 0; background: none; padding: 0; font: 600 13px var(--mono); color: var(--label); cursor: pointer; }
table.seams td.cell-parts { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.cell-flex { display: inline-flex; align-items: center; gap: 6px; }
.wflag { color: var(--orange-text); display: inline-flex; }
tr.empty-row td { padding: 20px 12px; text-align: center; color: var(--label-2); white-space: normal; cursor: default; }
.seam-detail { border-radius: var(--radius-l); background: var(--bg-elevated); box-shadow: var(--shadow-1); padding: 16px 18px 18px; min-width: 0; }
.seam-detail.is-empty { display: flex; gap: 10px; align-items: center; color: var(--label-2); font-size: 14px; }
.sd-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.sd-title { font: 600 17px/22px var(--mono); }
.sd-sec { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--separator); }
.joints { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.joint { padding: 6px; border-radius: 10px; background: var(--fill); text-align: center; }
.joint .k { display: block; font-size: 11px; color: var(--label-2); }
.joint .v { display: block; font-weight: 600; font-variant-numeric: tabular-nums; }

/* 3D-Viewer */
.viewer-card { position: relative; border-radius: var(--radius-l); overflow: hidden; background: var(--bg-elevated); box-shadow: var(--shadow-2); }
.viewer-frame { display: block; width: 100%; height: min(78vh, calc(100vh - 250px)); min-height: 440px; border: 0; background: var(--bg-grouped); }

/* Dateien + Übergabe */
.file-dl-row .row-text { font-size: 15px; }
.file-dl-row .row-text small { overflow-wrap: anywhere; }
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; flex: none; max-width: 60%; }
.transfer-state { display: flex; flex-wrap: wrap; gap: 6px; }
.transfer-card .group { margin-top: 14px; }
.receipt-list { margin: 0; padding-left: 18px; font-size: 13px; display: grid; gap: 3px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label { font-size: 13px; font-weight: 600; color: var(--label-2); }

/* ============================================================================================ JSON-Ansicht */
.jv { border-radius: var(--radius-l); background: var(--bg-elevated); box-shadow: var(--shadow-1); min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.jv-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--separator); }
.jv-search { flex: 1 1 260px; display: flex; align-items: center; gap: 4px; min-width: 0; }
.jv-search > .ic { color: var(--label-2); margin: 0 2px 0 4px; }
.jv-search input { flex: 1 1 auto; height: 30px; font-size: 14px; }
.jv-count { min-width: 8ch; font-size: 12px; color: var(--label-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.jv-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.jv-actions .btn[aria-pressed="true"] { background: var(--accent-fill); color: var(--on-accent); }
.jv-body { min-width: 0; }
.jv-tree { font: 12.5px/1.65 var(--mono); max-height: 70vh; min-height: 180px; overflow: auto; padding: 8px 0 14px; }
.jv-node { outline: none; }
.jv-row { display: flex; align-items: baseline; padding: 0 14px 0 8px; white-space: nowrap; border-radius: 6px; cursor: default; }
.jv-node[aria-expanded] > .jv-row { cursor: pointer; }
.jv-row:hover { background: var(--fill-hover); }
.jv-node:focus-visible > .jv-row { outline: 2px solid var(--focus); outline-offset: -2px; }
.jv-node.is-focus > .jv-row { background: var(--fill-hover); }
.jv-node.is-current > .jv-row { background: var(--accent-tint); }
.jv-caret { position: relative; display: inline-block; width: 16px; height: 1em; flex: none; }
.jv-caret::before {
  content: ""; position: absolute; left: 4px; top: 50%; width: 5px; height: 5px; margin-top: -3px;
  border-right: 1.5px solid var(--label-2); border-bottom: 1.5px solid var(--label-2); transform: rotate(-45deg); transition: transform var(--t-fast) var(--ease);
}
.jv-node[aria-expanded="true"] > .jv-row > .jv-caret::before { transform: rotate(45deg); margin-top: -4px; }
.jv-caret.is-leaf::before { display: none; }
.jv-node.has-match > .jv-row > .jv-caret::after {
  content: ""; position: absolute; right: -1px; top: 50%; width: 5px; height: 5px; margin-top: -8px; border-radius: 50%; background: var(--mark-bg);
}
.jv-children { margin-left: 11px; padding-left: 8px; border-left: 1px solid var(--separator); }
.jv-key { color: var(--accent-text); }
.jv-idx { color: var(--label-2); }
.jv-colon { color: var(--label-2); white-space: pre; }
.jv-rootname { color: var(--label-2); font-weight: 600; }
.jv-string { color: var(--green-text); }
.jv-number { color: var(--orange-text); }
.jv-boolean { color: var(--purple-text); }
.jv-null { color: var(--purple-text); font-style: italic; }
.jv-inline { color: var(--label); }
.jv-sum { color: var(--label-2); }
.jv-prev { margin-left: 10px; color: var(--label-2); }
.jv-full { margin-left: 6px; border: 0; background: none; padding: 0; color: var(--accent-text); cursor: pointer; font: inherit; font-size: 12px; }
.jv-more {
  display: block; margin: 2px 0 4px 18px; padding: 2px 10px; border: 0; border-radius: 999px; background: var(--fill);
  color: var(--accent-text); cursor: pointer; font: inherit; font-size: 12px;
}
.jv-more:hover { background: var(--fill-2); }
mark { background: var(--mark-bg); color: var(--mark-text); border-radius: 3px; padding: 0 1px; }
.jv-raw { margin: 0; padding: 12px 16px; font: 12px/1.6 var(--mono); max-height: 70vh; min-height: 180px; overflow: auto; white-space: pre; tab-size: 2; }
.jv-raw-more { padding: 8px 12px; border-top: 1px solid var(--separator); }
.jv-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 8px 12px; border-top: 1px solid var(--separator);
  font-size: 12px; color: var(--label-2);
}
.jv-path { flex: 1 1 200px; min-width: 0; font: 12px var(--mono); color: var(--label); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jv-note { color: var(--green-text); font-weight: 600; }
.jv-note.is-warn { color: var(--orange-text); }

/* ============================================================================================ Menüs, Popover, Dialoge */
.pop-wrap { position: relative; display: inline-flex; }
.popover {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; min-width: 240px; max-width: min(360px, calc(100vw - 24px));
  padding: 6px; border-radius: 14px; background: var(--glass-float);
  -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  box-shadow: var(--shadow-pop), 0 0 0 0.5px var(--glass-border); animation: pop-in var(--t-fast) var(--ease);
}
.popover.up { top: auto; bottom: calc(100% + 8px); }
/* Ausrichtung am linken Rand des Auslösers, wenn rechtsbündig kein Platz ist (schmale Bildschirme, popover() misst) */
.popover.align-start { right: auto; left: 0; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 6px 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--label); font-size: 14px; text-align: left; text-decoration: none; cursor: pointer;
}
.menu-item:hover, .menu-item:focus { background: var(--accent-fill); color: var(--on-accent); outline: none; text-decoration: none; }
.menu-item .ic { color: inherit; }
.menu-item small { display: block; font-size: 12px; color: var(--label-2); }
.menu-item:hover small, .menu-item:focus small { color: inherit; }
/* Auswahlmenüs (menuitemradio): Tastenkürzel und Häkchen rechtsbündig */
.menu-item .mi-end { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; padding-left: 12px; }
.menu-item .mi-check { visibility: hidden; }
.menu-item[aria-checked="true"] .mi-check { visibility: visible; }
.menu-item:hover kbd, .menu-item:focus kbd { background: transparent; color: inherit; box-shadow: inset 0 0 0 1px currentColor; }
.menu-sep { height: 1px; margin: 6px 8px; background: var(--separator); }
.menu-label { padding: 6px 10px 2px; font-size: 12px; font-weight: 600; color: var(--label-2); }
.pop-panel { display: grid; gap: 10px; padding: 8px 10px 10px; }
.pop-panel .row { padding: 4px 0; min-height: 40px; flex-wrap: nowrap; }   /* Schalter bleibt neben dem Text (auch mobil) */
.pop-panel .row-text { font-size: 14px; }

/* Dialoge deckend statt Glas: backdrop-filter machte den Dialog zum Bezugsrahmen für position: fixed – Passwort-Manager
   (1Password) hängen ihr Menü fensterfüllend-fix in den modalen Dialog, es lag dann verschoben und erzeugte Scrollbalken */
dialog {
  padding: 0; border: 0; color: var(--label); background: var(--bg-elevated);
  box-shadow: var(--shadow-pop);
}
dialog[open] { animation: dialog-in var(--t) var(--ease); }
dialog::backdrop { background: var(--dialog-backdrop); }
/* Anmelden/Pflicht-Passwortänderung: Seite vollständig verdecken (nach Ablauf der Sitzung steht sie noch im DOM) */
dialog.auth-dialog::backdrop { background: var(--bg); }
.alert-dialog { width: min(440px, calc(100vw - 32px)); border-radius: var(--radius-l); }
.dialog-form { padding: 24px 24px 20px; display: grid; gap: 10px; }
.dialog-form h2 { font: 600 17px/22px var(--font); }
.dialog-form p { font-size: 14px; line-height: 20px; color: var(--label-2); overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sheet { width: min(760px, calc(100vw - 32px)); max-height: min(82vh, 780px); border-radius: var(--radius-xl); }
dialog.sheet[open] { display: flex; flex-direction: column; }
.sheet-head { flex: none; display: flex; align-items: center; gap: 12px; padding: 18px 20px 14px 24px; border-bottom: 1px solid var(--separator); }
.sheet-head h2 { flex: 1 1 auto; font: 600 17px/22px var(--font); }
.sheet-body { flex: 1 1 auto; min-height: 0; padding: 18px 24px 24px; overflow: auto; background: var(--bg-grouped); }

/* ============================================================================================ Anmeldung und Konten */
/* ADR-013: Anmelden und Passwort ändern als modale Dialoge, Kontobereich in den Einstellungen, Kontenverwaltung als Sheet */
.auth-form { gap: 6px; }
.auth-form .caption { margin-bottom: 6px; }
.auth-label { margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--label-2); }
.auth-input { width: 100%; }
.account-line { padding: 2px 10px 6px; font-size: 13px; line-height: 18px; color: var(--label-2); overflow-wrap: anywhere; }
.account-line strong { color: var(--label); font-weight: 600; }
.accounts-sheet { width: min(980px, calc(100vw - 32px)); }
table.accounts { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; line-height: 20px; }
table.accounts th { padding: 6px 10px; border-bottom: 1px solid var(--separator); text-align: left; font-size: 12px; font-weight: 600; color: var(--label-2); }
table.accounts td { padding: 8px 10px; border-bottom: 1px solid var(--separator); vertical-align: top; overflow-wrap: anywhere; }
table.accounts tbody tr:last-child td { border-bottom: 0; }
table.accounts td.acc-short { white-space: nowrap; }
div.acc-actions { display: flex; flex-wrap: wrap; gap: 6px; min-width: 220px; }
.acc-reset { display: flex; flex-wrap: wrap; gap: 6px; flex-basis: 100%; }
.acc-reset[hidden] { display: none; }
.acc-reset .auth-input { flex: 1 1 180px; width: auto; }
.acc-new { flex: none; display: grid; gap: 6px; padding: 14px 24px 18px; border-top: 1px solid var(--separator); }
.acc-new-title { font: 600 15px/20px var(--font); }
.acc-new-fields { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 12px; align-items: center; }
.acc-new-fields .auth-label { margin-top: 0; }
.acc-new-admin { grid-column: 1 / -1; padding: 4px 0; }

/* ============================================================================================ Zeichnungsviewer */
/* Bereich „Zeichnung“ füllt die Höhe unter der Toolbar (kein Seiten-Scrollen, das Mausrad gehört der Zeichnung) */
.detail.is-canvas-mode { display: flex; flex-direction: column; max-width: none; height: calc(100vh - var(--toolbar-h)); height: calc(100dvh - var(--toolbar-h)); padding-bottom: 20px; }
.detail.is-canvas-mode > .detail-inner { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.detail.is-canvas-mode .page-head { padding: 8px 0 14px; }
.detail.is-canvas-mode .detail-tabs { margin-bottom: 14px; }
.detail.is-canvas-mode .seg-panels { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.section-panel.is-canvas:not([hidden]) { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
/* Kopf im Canvas-Modus kompakt (Zeichnung und 3D bekommen die Höhe): ohne Metazeile, Schrittanzeige in einer Zeile –
   nur der aktuelle Schritt mit Namen, die übrigen als Punkt (Name bleibt für Screenreader) */
.detail.is-canvas-mode .meta-line { display: none; }
.detail.is-canvas-mode .step:not(.is-current):not(.is-active):not(.is-error) .step-text {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.detail.is-canvas-mode .step:not(.is-current):not(.is-active):not(.is-error) .step-btn { padding: 4px; }
.detail.is-canvas-mode .stepper { flex: 0 1 auto; }             /* „Nächster Schritt“ passt daneben in dieselbe Zeile */
/* 3D-Viewer im Canvas-Modus: Rahmen füllt die freie Höhe (Inspektor mit Nahtdetails in voller Höhe) */
.section-panel.is-canvas > * + * { margin-top: 12px; }
.section-panel.is-canvas > .viewer-card { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 360px; }
.section-panel.is-canvas .viewer-frame { flex: 1 1 auto; height: auto; min-height: 0; }
.section-panel.is-canvas > .viewer-note { flex: none; margin-top: 8px; }
.dv-select-bar { flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; min-width: 0; }
.dv-picker { flex: 1 1 auto; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; min-width: 0; }
.dv-picker > .ic { color: var(--accent-text); }
.dv-actions, .dv-actions-inner { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.dv-actions:empty { display: none; }
.dv-select-bar .select-pill { width: auto; max-width: min(100%, 420px); height: 32px; border-radius: 999px; font-size: 14px; font-weight: 600; }
.dv-drawing-name { font-weight: 600; overflow-wrap: anywhere; }
.dv-host { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.section-panel.is-canvas > .dv-host { margin-top: 12px; }
.dv { --insp: 0px; flex: 1 1 auto; display: flex; flex-direction: column; gap: 10px; min-height: 0; min-width: 0; }
.dv.has-inspector { --insp: calc(var(--insp-w, 300px) + 24px); }   /* Inspektorbreite (ziehbar) + Abstände */
.dv-head { flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; min-width: 0; }
.dv-layers { display: flex; align-items: center; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 1px; }
.dv-layers::-webkit-scrollbar { display: none; }
.layer-pill {
  --c: var(--gray); flex: none; display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 12px 0 10px; border: 0;
  border-radius: 999px; background: var(--fill); color: var(--label-2); font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.layer-pill[aria-pressed="true"] { background: var(--bg-elevated); color: var(--label); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--separator); }
.layer-pill .swatch { width: 12px; height: 12px; border-radius: 3px; border: 2px solid var(--c); transition: opacity var(--t-fast) var(--ease); }
.layer-pill.lp-WELD_NOTE { --c: var(--auto-weldnote); }
.layer-pill.lp-WELD_NOTE .swatch, .layer-pill.lp-VIEW .swatch { border-style: dashed; }
.layer-pill.lp-BALLOON { --c: var(--auto-balloon); }
.layer-pill.lp-BALLOON .swatch { border-radius: 50%; }
.layer-pill.lp-VIEW { --c: var(--auto-view); }
.layer-pill.lp-COVER { --c: var(--auto-cover); }
.layer-pill.lp-COVER .swatch { background: repeating-linear-gradient(45deg, var(--c) 0 1.5px, transparent 1.5px 4px); }
.layer-pill.lp-USER { --c: var(--cat-weld); }
.layer-pill.lp-USER .swatch { background: var(--c); border-radius: 50%; }
.layer-pill.lp-AI { --c: var(--ai); }
.layer-pill.lp-AI .swatch { background: var(--ai-tint); }
.layer-pill[aria-pressed="false"] .swatch { opacity: 0.35; }
.layer-pill .n { font-variant-numeric: tabular-nums; color: var(--label-2); }
.dv-save { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; font-size: 13px; color: var(--label-2); white-space: nowrap; }
.dv-save .spinner { width: 14px; height: 14px; border-width: 1.5px; }
.dv-save[data-state="saved"] .ic { color: var(--green); }
.dv-save[data-state="error"], .dv-save[data-state="conflict"], .dv-save[data-state="offline"] { color: var(--red-text); font-weight: 600; }
.dv-body { position: relative; flex: 1 1 auto; min-height: 0; display: flex; }
.dv-canvas {
  position: relative; flex: 1 1 auto; min-width: 0; min-height: 440px; border-radius: var(--radius-l); overflow: hidden;
  background: var(--canvas); box-shadow: inset 0 0 0 1px var(--separator);
}
.dv-viewport {
  position: absolute; inset: 0; overflow: hidden; touch-action: none; -webkit-user-select: none; user-select: none;
  outline: none; cursor: default; -webkit-touch-callout: none;
}
/* Fokusring der Zeichenfläche als Ebene über der Seite: ein inset-Schatten am Element selbst läge unter der Bühne und
   verschwände, sobald die gezoomte Seite die Fläche füllt */
.dv-viewport::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-l); pointer-events: none; }
.dv-viewport:focus-visible::after { box-shadow: inset 0 0 0 2px var(--focus), inset 0 0 0 5px var(--focus-ring); }
.dv-stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; background: var(--page); box-shadow: var(--page-shadow); }
.dv-stage.is-moving { will-change: transform; }
.dv-page, .dv-tile { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; -webkit-user-drag: none; user-select: none; }
.dv-tiles { position: absolute; inset: 0; pointer-events: none; }
.dv-tile { opacity: 0; transition: opacity 150ms var(--ease); }
.dv-tile.is-loaded { opacity: 1; }
.dv-overlay { position: absolute; left: 0; top: 0; overflow: visible; --u: 1px; }
.dv-overlay * { pointer-events: none; }
.dv[data-tool="hand"] .dv-viewport, .dv-viewport.is-space { cursor: grab; }
.dv-viewport.is-panning { cursor: grabbing; }
.dv[data-tool="RECT"] .dv-viewport, .dv[data-tool="ELLIPSE"] .dv-viewport, .dv[data-tool="HIGHLIGHT"] .dv-viewport,
.dv[data-tool="ARROW"] .dv-viewport, .dv[data-tool="LINE"] .dv-viewport, .dv[data-tool="PEN"] .dv-viewport,
.dv[data-tool="PIN"] .dv-viewport { cursor: crosshair; }
.dv[data-tool="TEXT"] .dv-viewport { cursor: text; }
.dv[data-tool="select"] .dv-overlay .hit { pointer-events: stroke; cursor: move; }
.dv[data-tool="select"] .dv-overlay .mk.shape-HIGHLIGHT .shape,
.dv[data-tool="select"] .dv-overlay .mk.shape-TEXT .shape,
.dv[data-tool="select"] .dv-overlay .mk .pin-body,
.dv[data-tool="select"] .dv-overlay .mk.is-selected .shape { pointer-events: all; cursor: move; }
.dv[data-tool="select"] .dv-overlay .auto .hit { cursor: pointer; }
.dv[data-tool="select"] .dv-overlay .auto.t-WELD_NOTE .shape,
.dv[data-tool="select"] .dv-overlay .auto.t-BALLOON .shape { pointer-events: all; cursor: pointer; }
.dv[data-tool="select"] .dv-overlay .handle, .dv[data-tool="select"] .dv-overlay .handle-hit { pointer-events: all; }
.dv[data-tool="select"] .dv-overlay .ai-ev .hit, .dv[data-tool="select"] .dv-overlay .ai-ev .shape { pointer-events: all; cursor: pointer; }
.dv-overlay .is-off { display: none; }
/* Eigene Markierungen: Kategoriefarbe über --c (eigene Farbe als geprüfte CSS-Variable am Element) */
.mk { --c: var(--cat-info); }
.mk.cat-WELD, .cat-dot.cat-WELD { --c: var(--cat-weld); }
.mk.cat-CHECK, .cat-dot.cat-CHECK { --c: var(--cat-check); }
.mk.cat-ISSUE, .cat-dot.cat-ISSUE { --c: var(--cat-issue); }
.mk.cat-NO_WELD, .cat-dot.cat-NO_WELD { --c: var(--cat-noweld); }
.mk.cat-INFO, .cat-dot.cat-INFO { --c: var(--cat-info); }
.mk .shape { fill: none; stroke: var(--c); stroke-width: calc(var(--u) * 2); stroke-linecap: round; stroke-linejoin: round; }
.mk .hit { fill: none; stroke: transparent; stroke-width: calc(var(--u) * 12); stroke-linecap: round; stroke-linejoin: round; }
.mk.shape-HIGHLIGHT .shape { fill: var(--c); fill-opacity: 0.25; stroke: none; }
.mk.shape-TEXT .shape { fill: var(--mk-textbox); }
/* Texte der TEXT-Markierungen als HTML über dem SVG (Seitenpunkte = CSS-px der Bühne; Schrift 10 pt, Zeile 12 pt) */
.dv-texts { position: absolute; inset: 0; pointer-events: none; }
.dv-texts.is-off { display: none; }
.mk-textbox {
  position: absolute; padding: 3px; overflow: hidden; color: var(--mk-text); font: 10px/12px var(--font);
  white-space: pre-wrap; overflow-wrap: anywhere; text-align: left;
}
.mk-textbox.is-done { opacity: 0.5; }
.mk.is-done .shape { opacity: 0.5; }
.mk.is-selected .shape { stroke-width: calc(var(--u) * 3); }
.mk.shape-HIGHLIGHT.is-selected .shape { stroke: var(--c); stroke-width: calc(var(--u) * 1.5); }
.mk .pin-body { fill: var(--c); stroke: var(--pin-ring); stroke-width: 1.5; }
.mk .pin-dot { fill: var(--pin-ring); }
.mk.is-selected .pin-body { stroke-width: 2.5; }
.mk.draft .shape { stroke-dasharray: calc(var(--u) * 5) calc(var(--u) * 3); }
.mk.draft.shape-HIGHLIGHT .shape { stroke-dasharray: none; }
.ah-WELD { fill: var(--cat-weld); }
.ah-CHECK { fill: var(--cat-check); }
.ah-ISSUE { fill: var(--cat-issue); }
.ah-NO_WELD { fill: var(--cat-noweld); }
.ah-INFO { fill: var(--cat-info); }
/* Automatische Markierungen: Vertragsfarben, gestrichelt bzw. schraffiert */
.auto .shape { stroke-width: calc(var(--u) * 1.5); }
.auto .hit { fill: none; stroke: transparent; stroke-width: calc(var(--u) * 10); }
.auto.t-WELD_NOTE .shape { fill: var(--auto-weldnote); fill-opacity: 0.06; stroke: var(--auto-weldnote); stroke-dasharray: calc(var(--u) * 6) calc(var(--u) * 4); }
.auto.t-BALLOON .shape { fill: var(--auto-balloon); fill-opacity: 0.08; stroke: var(--auto-balloon); }
.auto.t-VIEW .shape { fill: none; stroke: var(--auto-view); stroke-dasharray: calc(var(--u) * 9) calc(var(--u) * 5); }
.auto.t-COVER .shape { stroke: var(--auto-cover); }
.auto.is-selected .shape { stroke-width: calc(var(--u) * 3); }
/* Ebene „KI-Evidenz“ (UI-KI-13): Rahmen in Indigo (Herkunft KI); entschieden gestrichelt, widerlegt rot, gewählt kräftig */
.ai-ev .shape { fill: var(--ai); fill-opacity: 0.08; stroke: var(--ai); stroke-width: calc(var(--u) * 1.5); }
.ai-ev .hit { fill: none; stroke: transparent; stroke-width: calc(var(--u) * 10); }
.ai-ev.is-decided .shape { fill-opacity: 0; stroke-dasharray: calc(var(--u) * 4) calc(var(--u) * 3); }
.ai-ev.is-refuted .shape { stroke: var(--red); }
.ai-ev.is-selected .shape { stroke-width: calc(var(--u) * 3); fill-opacity: 0.18; }
.hatch-bg { fill: var(--auto-cover); fill-opacity: 0.07; }
.hatch-line { stroke: var(--auto-cover); stroke-width: 1.2; stroke-opacity: 0.8; }
.sel-box { fill: none; stroke: var(--handle-stroke); stroke-width: var(--u); stroke-dasharray: calc(var(--u) * 4) calc(var(--u) * 3); }
.handle { fill: var(--handle-fill); stroke: var(--handle-stroke); stroke-width: calc(var(--u) * 1.5); }
/* Unsichtbare, größere Trefferfläche je Anfasser (Finger/Stift: 36 px, Maus: 18 px – setzt app.js) */
.handle-hit { fill: transparent; stroke: none; }
.dv-overlay [data-handle="nw"], .dv-overlay [data-handle="se"] { cursor: nwse-resize; }
.dv-overlay [data-handle="ne"], .dv-overlay [data-handle="sw"] { cursor: nesw-resize; }
.dv-overlay [data-handle="n"], .dv-overlay [data-handle="s"] { cursor: ns-resize; }
.dv-overlay [data-handle="e"], .dv-overlay [data-handle="w"] { cursor: ew-resize; }
.dv-overlay [data-handle="p0"], .dv-overlay [data-handle="p1"] { cursor: crosshair; }
/* Schwebende Bedienleisten (dichtes Glas: bleibt über weißer Zeichnung und dunklem Inhalt lesbar) */
.dv-float {
  position: absolute; z-index: 5; display: flex; align-items: center; gap: 2px; max-width: calc(100% - var(--insp) - 24px);
  padding: 4px; border-radius: 999px; background: var(--glass-float);
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow-2), 0 0 0 0.5px var(--glass-border); overflow-x: auto; scrollbar-width: none;
}
.dv-float::-webkit-scrollbar { display: none; }
.dv-float > * { flex: none; }
.dv-tools { top: 12px; left: calc((100% - var(--insp)) / 2); transform: translateX(-50%); }
.dv-nav { bottom: 12px; left: calc((100% - var(--insp)) / 2); transform: translateX(-50%); white-space: nowrap; }
.tool {
  flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--label); cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.tool:hover:not(:disabled) { background: var(--fill-hover); }
.tool:active:not(:disabled) { transform: scale(0.94); }
.tool[aria-pressed="true"] { background: var(--accent-fill); color: var(--on-accent); }
.tool:disabled { opacity: 0.35; cursor: default; }
.tool:focus-visible { outline-offset: -2px; }
/* gedrücktes Werkzeug: Akzentring wäre auf der Akzentfläche unsichtbar – weißer Ring innen */
.tool[aria-pressed="true"]:focus-visible { outline: 2px solid var(--on-accent); outline-offset: -5px; }
.tool-sep { flex: none; width: 1px; height: 22px; margin: 0 5px; background: var(--separator); }
/* Sammelknöpfe bei wenig Platz (Stufen setzt app.js nach Messung): Form bzw. Kategorie als Menü */
.tool.menu-btn { width: 44px; border-radius: 999px; grid-auto-flow: column; gap: 1px; }
.tool.menu-btn .mi-icon { display: inline-grid; place-items: center; }
.tool.menu-btn.is-active { background: var(--accent-fill); color: var(--on-accent); }
.tool.menu-btn.is-active:focus-visible { outline: 2px solid var(--on-accent); outline-offset: -5px; }
.tool.menu-btn .ic-chev { width: 9px; height: 9px; stroke-width: 2.2; opacity: 0.7; }
.tool.cat-menu-btn .cat-dot { box-shadow: 0 0 0 2px var(--bg-elevated), 0 0 0 3.5px var(--c); }
.popover.dv-menu { top: 58px; right: auto; left: calc((100% - var(--insp)) / 2); transform: translateX(-50%); z-index: 9; min-width: 220px; animation: none; }
.dv-menu .menu-item .cat-dot { width: 12px; height: 12px; }
/* hervorgehobener Eintrag (Akzentfläche): Farbpunkt mit hellem Ring, sonst verschwände „Schweißnaht“ (Blau auf Blau) */
.dv-menu .menu-item:hover .cat-dot, .dv-menu .menu-item:focus .cat-dot { box-shadow: 0 0 0 1.5px var(--on-accent); }
.cat-group { flex: none; display: inline-flex; align-items: center; gap: 0; }
.cat-btn {
  flex: none; display: inline-grid; place-items: center; width: 30px; height: 34px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; cursor: pointer;
}
.cat-dot { --c: var(--cat-info); display: inline-block; flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--c); transition: box-shadow var(--t-fast) var(--ease); }
.cat-btn[aria-checked="true"] .cat-dot { box-shadow: 0 0 0 2px var(--bg-elevated), 0 0 0 4px var(--c); }
.cat-btn:focus-visible { outline-offset: -3px; }
.cat-current { flex: none; padding: 0 8px 0 4px; font-size: 12.5px; font-weight: 500; color: var(--label-2); white-space: nowrap; }
.dv-nav .icon-btn { width: 30px; height: 30px; color: var(--label); }
input.dv-page-input { width: 46px; height: 28px; padding: 0 4px; border-radius: 8px; text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; }
.dv-page-total { font-size: 13px; color: var(--label-2); padding: 0 6px 0 4px; font-variant-numeric: tabular-nums; }
.dv-zoom { min-width: 58px; font-size: 13px; font-weight: 500; text-align: center; font-variant-numeric: tabular-nums; }
.dv-nav .btn { height: 28px; padding: 0 10px; font-size: 12.5px; }
.dv-nav .dv-fit .ic { display: none; }
/* Seitenübersicht (Miniaturen) über der Seitenleiste; zentriert über left/right + margin auto (transform bleibt frei für die Animation) */
.dv-thumbs {
  position: absolute; bottom: 60px; left: 12px; right: calc(var(--insp) + 12px); z-index: 8; max-width: 600px; margin: 0 auto;
  max-height: calc(100% - 132px); display: flex; flex-direction: column; padding: 6px 4px 4px; border-radius: 16px;
  background: var(--glass-float); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  box-shadow: var(--shadow-pop), 0 0 0 0.5px var(--glass-border); animation: pop-up-in var(--t-fast) var(--ease);
}
.dv-thumb-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 8px 8px; overscroll-behavior: contain; }
.dv-thumb-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 6px; }
.dv-thumb {
  display: grid; justify-items: center; gap: 6px; width: 100%; padding: 8px 6px 6px; border: 0; border-radius: 12px;
  background: transparent; color: var(--label); cursor: pointer; transition: background-color var(--t-fast) var(--ease);
}
.dv-thumb:hover { background: var(--fill-hover); }
.dv-thumb:focus-visible { outline-offset: -2px; }
.dv-thumb-frame { display: grid; place-items: center; width: 112px; height: 112px; }
.dv-thumb img { display: block; max-width: 100%; height: auto; border-radius: 2px; background: var(--page); box-shadow: var(--shadow-1), 0 0 0 0.5px var(--separator); }
.dv-thumb[aria-current="page"] img { box-shadow: 0 0 0 2px var(--bg-elevated), 0 0 0 4.5px var(--accent); }
.dv-thumb-n { font-size: 12px; line-height: 16px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.dv-thumb[aria-current="page"] .dv-thumb-n { color: var(--accent-text); font-weight: 600; }
.dv-thumb.is-error img { visibility: hidden; }
.dv-thumb.is-error .dv-thumb-frame { border-radius: 6px; background: var(--fill); }
.dv-thumb-more { display: flex; margin: 10px auto 2px; }
.dv-banner { position: absolute; top: 60px; left: calc((100% - var(--insp)) / 2); z-index: 6; width: min(560px, calc(100% - var(--insp) - 24px)); transform: translateX(-50%); }
.dv-banner .callout {
  background: var(--glass-float); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow-2), 0 0 0 0.5px var(--glass-border);
}
.dv-banner .callout.tone-bad { box-shadow: var(--shadow-2), inset 0 0 0 1.5px var(--red); }
.dv-banner .callout.tone-warn { box-shadow: var(--shadow-2), inset 0 0 0 1.5px var(--orange); }
.dv-loading { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; pointer-events: none; }
.dv-loading .spinner { width: 28px; height: 28px; border-width: 2.5px; }
/* Inspektor (Glass, rechts; mobil als Sheet unten) */
.dv-inspector {
  position: absolute; top: 12px; right: 12px; bottom: 12px; z-index: 7; width: var(--insp-w, 300px); display: flex; flex-direction: column;
  border-radius: var(--radius-l); background: var(--glass-float);
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow-2), 0 0 0 0.5px var(--glass-border); overflow: hidden;
}
.dvi-head { flex: none; display: flex; align-items: center; gap: 6px; padding: 10px 8px 6px 16px; }
.dvi-sheet-toggle { display: none; }
.token-list { display: contents; }
.dvi-title { flex: 1 1 auto; min-width: 0; font: 600 15px/20px var(--font); }
.dvi-title .n { color: var(--label-2); font-weight: 500; font-variant-numeric: tabular-nums; }
.dvi-filters { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; padding: 0 12px 8px; }
.dvi-filters select { height: 28px; padding: 0 26px 0 10px; font-size: 12.5px; border-radius: 8px; background-position: calc(100% - 14px) 52%, calc(100% - 9px) 52%; }
.dvi-filters select:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
.dvi-scroll { flex: 1 1 auto; min-height: 90px; overflow-y: auto; padding: 0 8px 10px; overscroll-behavior: contain; }
.dvi-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.dvi-item {
  display: grid; grid-template-columns: 12px 16px minmax(0, 1fr); align-items: center; gap: 8px; width: 100%; min-height: 40px;
  padding: 5px 8px; border: 0; border-radius: 10px; background: transparent; text-align: left; cursor: pointer; color: var(--label);
  transition: background-color var(--t-fast) var(--ease);
}
.dvi-item:hover { background: var(--fill-hover); }
.dvi-item.is-selected { background: var(--accent-tint); }
.dvi-item:focus-visible { outline-offset: -2px; }
.dvi-item .cat-dot { width: 10px; height: 10px; }
.dvi-item .ic { color: var(--label-2); }
.dvi-main { display: grid; min-width: 0; }
.dvi-t { font-size: 13px; line-height: 18px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dvi-s { font-size: 12px; line-height: 16px; color: var(--label-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dvi-empty { padding: 10px 8px; font-size: 13px; line-height: 18px; color: var(--label-2); }
.dvi-more { margin: 6px 8px 0; }
.dvi-auto { margin-top: 10px; display: grid; gap: 4px; }
.dvi-auto > details > summary { padding: 6px 8px; border-radius: 8px; font-size: 12.5px; }
.dvi-auto > details > summary:hover { background: var(--fill-hover); }
.dvi-auto .swatch-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.dvi-auto .t-WELD_NOTE { --c: var(--auto-weldnote); }
.dvi-auto .t-BALLOON { --c: var(--auto-balloon); }
.dvi-auto .t-VIEW { --c: var(--auto-view); }
.dvi-auto .t-COVER { --c: var(--auto-cover); }
.dvi-detail {
  flex: 0 1 auto; max-height: 64%; overflow-x: hidden; overflow-y: auto; display: grid; align-content: start; gap: 12px;
  padding: 12px 16px 16px; border-top: 1px solid var(--separator); overscroll-behavior: contain;
}
.dvi-detail > * { min-width: 0; }
.dvi-detail.is-empty { flex: none; color: var(--label-2); font-size: 13px; line-height: 18px; }
/* Vergrößerbar wie im 3D-Viewer: mit Auswahl teilt eine Trennlinie Liste | Detail (--dvi-list = Anteil der Liste an der
   Inspektorhöhe, Standard 30 %: das Detail bekommt den größeren Teil); „Details maximieren“ (D) blendet Filter und Liste
   aus; der linke Rand ändert die Breite (--insp-w, 280 px bis 60 % der Viewerbreite) */
.dv-inspector.has-detail .dvi-scroll { flex: 0 1 var(--dvi-list, 30%); min-height: 60px; }
.dv-inspector.has-detail .dvi-detail { flex: 1 1 0; max-height: none; min-height: 120px; border-top: 0; }
.dv-inspector.is-max .dvi-filters, .dv-inspector.is-max .dvi-scroll, .dv-inspector.is-max .dvi-split { display: none; }
.dv-inspector.is-max .dvi-detail { flex: 1 1 auto; border-top: 1px solid var(--separator); }
.dvi-split {
  flex: none; display: grid; place-items: center; height: 14px; margin: 0 12px; border-top: 1px solid var(--separator);
  cursor: ns-resize; touch-action: none; border-radius: 0 0 6px 6px;
}
.dvi-split[hidden] { display: none; }
.dvi-split .grip { width: 36px; height: 4px; border-radius: 2px; background: var(--separator-strong); transition: background-color var(--t-fast) var(--ease); }
.dvi-split:hover .grip, .dvi-split:focus-visible .grip, .dvi-split.is-drag .grip { background: var(--label-3); }
.dvi-resize { position: absolute; top: 0; bottom: 0; left: 0; z-index: 2; width: 10px; cursor: ew-resize; touch-action: none; }
.dvi-resize::after {
  content: ""; position: absolute; top: 50%; left: 3px; width: 3px; height: 40px; margin-top: -20px; border-radius: 2px;
  background: var(--separator-strong); opacity: 0; transition: opacity var(--t-fast) var(--ease);
}
.dvi-resize:hover::after, .dvi-resize:focus-visible::after, .dvi-resize.is-drag::after { opacity: 1; }
.dvi-max[disabled] { opacity: 0.35; cursor: default; }
.dv.is-compact .dvi-resize, .dv.is-compact .dvi-wide, .dv.is-compact .dvi-split { display: none; }
.dv.is-compact .dv-inspector.has-detail .dvi-scroll { flex: 1 1 auto; min-height: 90px; }
.dv.is-compact .dv-inspector.has-detail .dvi-detail { flex: 0 1 auto; max-height: 64%; border-top: 1px solid var(--separator); }
.dv.is-compact .dv-inspector.is-max { height: 92%; max-height: 92%; }   /* wie das Sheet des 3D-Viewers (maximiert 92 %) */
.dv.is-compact .dv-inspector.is-max .dvi-detail { max-height: none; }
/* Legende im leeren Detailbereich: Kategoriefarben der eigenen Markierungen + Darstellung der automatischen Erkennung */
.dvi-legend > summary { font-size: 13px; }
.dvi-legend-body { display: grid; gap: 8px; margin-top: 10px; }
.dvi-legend ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.dvi-legend li { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; line-height: 18px; color: var(--label); }
.dvi-legend .cat-dot { width: 10px; height: 10px; }
.lg-swatch { --c: var(--gray); flex: none; width: 14px; height: 10px; border-radius: 2px; border: 1.5px solid var(--c); }
.lg-swatch.t-WELD_NOTE { --c: var(--auto-weldnote); border-style: dashed; }
.lg-swatch.t-BALLOON { --c: var(--auto-balloon); width: 11px; height: 11px; border-radius: 50%; }
.lg-swatch.t-VIEW { --c: var(--auto-view); border-style: dashed; }
.lg-swatch.t-COVER { --c: var(--auto-cover); background: repeating-linear-gradient(45deg, var(--c) 0 1.5px, transparent 1.5px 4px); }
.dvi-dhead { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dvi-dhead strong { font-size: 15px; line-height: 20px; }
.dvi-dtitle { font: 600 17px/22px var(--font); overflow-wrap: anywhere; }
.dvi-field { display: grid; gap: 6px; min-width: 0; }
.dvi-label { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--label-2); }
.dvi-field textarea { font-size: 14px; min-height: 64px; }
.dvi-field input[type="text"] { height: 32px; font-size: 14px; }
.dvi-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.dvi-cat {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px 0 8px; border: 0; border-radius: 999px;
  background: var(--fill); color: var(--label); font-size: 12.5px; font-weight: 500; cursor: pointer;
}
.dvi-cat .cat-dot { width: 10px; height: 10px; }
.dvi-cat[aria-checked="true"] { background: var(--bg-elevated); box-shadow: var(--shadow-1), inset 0 0 0 1.5px var(--c); }
.dvi-cat.cat-WELD { --c: var(--cat-weld); }
.dvi-cat.cat-CHECK { --c: var(--cat-check); }
.dvi-cat.cat-ISSUE { --c: var(--cat-issue); }
.dvi-cat.cat-NO_WELD { --c: var(--cat-noweld); }
.dvi-cat.cat-INFO { --c: var(--cat-info); }
.dvi-meta { font-size: 12px; line-height: 16px; color: var(--label-2); overflow-wrap: anywhere; }
.dvi-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dvi-kv { grid-template-columns: fit-content(42%) minmax(0, 1fr); font-size: 13px; line-height: 18px; gap: 4px 12px; }
.dvi-kv dt { min-width: 0; overflow-wrap: anywhere; -webkit-hyphens: auto; hyphens: auto; }   /* keine waagerechte Scrollleiste */
.tokens {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 34px; padding: 3px 6px; border-radius: 10px;
  background: var(--fill); transition: box-shadow var(--t-fast) var(--ease);
}
.tokens:focus-within { box-shadow: 0 0 0 1px var(--focus), 0 0 0 4px var(--focus-ring); }
.token {
  display: inline-flex; align-items: center; gap: 2px; height: 24px; max-width: 100%; padding: 0 2px 0 9px; border-radius: 999px;
  background: var(--bg-elevated); box-shadow: var(--shadow-1); font: 12px/1 var(--mono); overflow-wrap: anywhere;
}
.token button {
  display: inline-grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--label-2); cursor: pointer;
}
.token button:hover { background: var(--fill); color: var(--label); }
.tokens input[type="text"] { flex: 1 1 80px; width: auto; min-width: 70px; height: 26px; padding: 0 4px; background: transparent; font-size: 13px; }
.tokens input[type="text"]:focus-visible { box-shadow: none; }
.dvi-keys { font-size: 12px; line-height: 17px; color: var(--label-2); }
.dvi-keys kbd, .dv kbd { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 5px; background: var(--fill); font: 600 11px/18px var(--font); text-align: center; color: var(--label); }
.dvi-settings { padding: 8px 16px 12px; border-top: 1px solid var(--separator); display: grid; gap: 6px; }
.dvi-settings input[type="text"] { height: 30px; font-size: 13px; }
.dv-state { display: grid; justify-items: center; gap: 12px; padding: 64px 24px; text-align: center; color: var(--label-2); border-radius: var(--radius-l); background: var(--bg-elevated); box-shadow: var(--shadow-1); }
.dv-state strong { color: var(--label); font-size: 17px; line-height: 22px; }
.dv-state > .ic { color: var(--label-3); }

/* Bereich „Nähte“: Schweiß- und Freigabeprozess (Kette mit Status je Schritt) und Schweißangaben aus der Zeichnung
   (interpretiert und geprüft, „Zeigen“ springt in die Zeichnung) – aufklappbar, Zustand bleibt beim Neuaufbau */
.proc-panel, .wn-panel { margin: 12px 0; padding: 12px 16px; border-radius: var(--radius-m); background: var(--bg-elevated); box-shadow: var(--shadow-1); }
.proc-panel > summary, .wn-panel > summary { flex-wrap: wrap; row-gap: 2px; }
.proc-title, .wn-title { font: 600 15px/20px var(--font); color: var(--label); }
.proc-head, .wn-tally { min-width: 0; font-weight: 400; overflow-wrap: anywhere; }
.wn-panel > summary .n { color: var(--label-2); font-variant-numeric: tabular-nums; }
.proc-list { list-style: none; margin: 12px 0 10px; padding: 0; display: grid; gap: 8px; }
.proc-step { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; align-items: start; }
.proc-dot { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--fill); color: var(--label-2); }
.proc-dot .ic { width: 13px; height: 13px; stroke-width: 2.2; }
.proc-step.is-done .proc-dot { background: var(--green-tint); color: var(--green-text); }
.proc-step.is-todo .proc-dot { background: var(--accent-tint); color: var(--accent-text); }
.proc-step.is-warn .proc-dot { background: var(--orange-tint); color: var(--orange-text); }
.proc-step.is-block .proc-dot { background: var(--red-tint); color: var(--red-text); }
.proc-text { display: grid; min-width: 0; }
.proc-label { font-size: 13.5px; line-height: 19px; font-weight: 600; }
.proc-step.is-skip .proc-label { color: var(--label-2); font-weight: 500; }
.proc-note { font-size: 12.5px; line-height: 17px; color: var(--label-2); overflow-wrap: anywhere; }
.wn-body { display: grid; gap: 8px; margin-top: 10px; }
.wn-body .table-wrap { box-shadow: none; background: transparent; }
table.wn-table { min-width: 620px; font-size: 13px; line-height: 18px; }
table.wn-table td { height: auto; vertical-align: top; }
table.wn-table td.num { white-space: nowrap; text-align: left; }
.wn-label { font-weight: 600; }
.wn-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.wn-check { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 6px; align-items: start; }
.wn-check .ic { width: 13px; height: 13px; margin-top: 2.5px; }
.wn-check.tone-ok .ic { color: var(--green-text); }
.wn-check.tone-warn .ic { color: var(--orange-text); }
.wn-check.tone-info .ic { color: var(--label-2); }

/* ============================================================================================ Führung: Pfad, Schritte, Einführung */
/* Pfad (Brotkrumen) über dem Titel: Aufträge › Auftrag › Bereich – jeder Teil ist ein Rückweg */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; min-width: 0; font-size: 13px; line-height: 18px; color: var(--label-2); }
.crumb-btn {
  max-width: 42ch; padding: 2px 6px; border: 0; border-radius: 6px; background: none; color: var(--accent-text); font: inherit;
  cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: background-color var(--t-fast) var(--ease);
}
.crumb-btn:hover { background: var(--fill-hover); }
.crumb-btn:first-child { padding-left: 0; }
.crumb-sep { display: inline-flex; color: var(--label-3); }
.crumb-current { padding: 2px 6px; color: var(--label-2); white-space: nowrap; }

/* Schrittanzeige: 1 Dateien hochladen → 2 Ergebnis prüfen → 3 Zeichnung prüfen und markieren → 4 Exportieren/Freigeben.
   Die vier Schritte stehen immer in EINER Zeile nebeneinander: Verbindungslinien dehnen sich (nach erledigten Schritten
   grün), Beschriftungen kürzen sich erst, wenn der Platz nicht reicht. „Nächster Schritt“ steht rechts daneben, solange
   die Schritte ungekürzt Platz haben – die Flex-Basis der Schrittanzeige ist ihre Inhaltsbreite –, sonst darunter. */
.step-slot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; margin-top: 8px; min-width: 0; }
.step-slot:empty { display: none; }
.stepper { flex: 1 1 auto; min-width: 0; }
.stepper-list { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: nowrap; align-items: center; }
.step { display: flex; flex: 0 1 auto; align-items: center; min-width: 0; }
.step:not(:last-child) { flex: 1 1 auto; }
.step:not(:last-child)::after {   /* width statt flex-basis: zählt so auch in der Inhaltsbreite (sonst kürzt sich das Label) */
  content: ""; flex: 1 1 auto; width: 24px; min-width: 12px; height: 2px; margin: 0 8px; border-radius: 1px;
  background: var(--separator-strong);
}
.step.is-done:not(:last-child)::after { background: var(--green); }
.step-btn {
  display: inline-flex; align-items: center; gap: 8px; min-width: 0; min-height: 36px; padding: 4px 12px 4px 4px; border: 0;
  border-radius: 999px; background: transparent; color: var(--label); font: inherit; text-align: left;
  transition: background-color var(--t-fast) var(--ease);
}
button.step-btn { cursor: pointer; }
button.step-btn:hover { background: var(--fill-hover); }
.step-dot {
  flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--fill);
  color: var(--label-2); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.step-dot .ic { width: 13px; height: 13px; stroke-width: 2.2; }
.step-text { display: grid; min-width: 0; }
.step-label { font-size: 13px; line-height: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-note { max-width: 24ch; font-size: 12px; line-height: 16px; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step.is-done .step-dot { background: var(--green-tint); color: var(--green-text); }
.step.is-current .step-btn, .step.is-active .step-btn { background: var(--accent-tint); }
.step.is-current .step-dot, .step.is-active .step-dot { background: var(--accent-fill); color: var(--on-accent); }
.step.is-current .step-label, .step.is-active .step-label { color: var(--accent-text); }
.step.is-active .step-dot { animation: pulse 1.6s ease-in-out infinite; }
.step.is-error .step-btn { background: var(--red-tint); }
.step.is-error .step-dot { background: var(--red-fill); color: var(--on-accent); }
.step.is-error .step-label { color: var(--red-text); }
.step.is-skip .step-label { color: var(--label-2); font-weight: 500; }
.step-short { display: none; }
/* Kopf schmaler als die vier Schritte mit vollen Namen (z. B. 1024 px mit Seitenleiste): Kurznamen „Hochladen · Prüfen ·
   Zeichnung · Freigabe“, Zusatzzeile nur am aktuellen Schritt – die vier Schritte bleiben benannt nebeneinander statt
   gekürzt („…“) oder umbrochen; der volle Name bleibt für Screenreader (wie .sr-only) */
@container pagehead (max-width: 959.98px) {
  .step-long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .step-short { display: inline; }
  .step:not(.is-current):not(.is-active):not(.is-error) .step-note { display: none; }
}
.step-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }
.step-hint { font-size: 13px; line-height: 18px; color: var(--label-2); }
.new-steps { margin-top: 10px; }
.detail.is-canvas-mode .step-note, .detail.is-canvas-mode .step-hint { display: none; }
.detail.is-canvas-mode .step-slot { margin-top: 4px; }

/* Einführung beim ersten Start (ausblendbar, gemerkt) */
.intro-card { margin-bottom: 8px; }
.intro-head { display: flex; align-items: center; gap: 8px; }
.intro-head h3 { flex: 1 1 auto; font: 600 17px/22px var(--font); }
.intro-steps { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; counter-reset: intro; }
.intro-steps li {
  position: relative; display: grid; align-content: start; gap: 4px; padding: 12px 12px 12px 48px; border-radius: var(--radius-m);
  background: var(--bg-grouped); color: var(--label-2); font-size: 13px; line-height: 18px; counter-increment: intro;
}
.intro-steps li::before {
  content: counter(intro); position: absolute; left: 12px; top: 11px; display: grid; place-items: center; width: 26px; height: 26px;
  border-radius: 50%; background: var(--accent-tint); color: var(--accent-text); font-size: 13px; font-weight: 700;
}
.intro-steps strong { color: var(--label); font-size: 14px; line-height: 19px; }
.intro-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Leerzustände und Fehler: nächster Schritt bzw. Rückweg, Handlungsempfehlung */
.placeholder-actions, .empty-actions, .dv-state-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 4px; }
.empty-state .empty-actions .btn { margin-top: 0; }
.advice { font-size: 13.5px; line-height: 19px; font-weight: 500; }
.viewer-hint:empty { display: none; }

/* ============================================================================================ Mouseover-Erklärungen */
/* Eine Erklärung (role=tooltip) aus dem Glossar: dichtes Glas, max. 320 px, über bzw. neben dem Element – nie darauf */
.tip {
  position: fixed; left: 0; top: 0; z-index: 190; display: grid; gap: 8px; width: max-content;
  max-width: min(320px, calc(100vw - 16px)); padding: 10px 12px; border-radius: 12px; background: var(--glass-float);
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow-pop), 0 0 0 0.5px var(--glass-border); color: var(--label); font-size: 13px; line-height: 18px;
  text-align: left; white-space: normal; overflow-wrap: anywhere; animation: tip-in var(--t-fast) var(--ease);
}
.tip-body { display: grid; gap: 3px; }
.tip-title { font-weight: 600; }
.tip-extra { font-size: 12px; line-height: 16px; color: var(--label-2); }
.tip-foot { display: flex; align-items: center; gap: 10px; }
.tip-more {
  display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: var(--accent-text);
  font: 600 12.5px/18px var(--font); cursor: pointer;
}
.tip-more:hover { text-decoration: underline; text-underline-offset: 2px; }
.tip-key { margin-left: auto; font-size: 11.5px; color: var(--label-2); white-space: nowrap; }
/* Begriffe mit Erklärung: dezent gepunktet unterstrichen (nur Beschriftungen, nicht Schaltflächen/Abzeichen) */
.tips-on dt[data-term], .tips-on dt[data-term-kind], .tips-on .kpi .k[data-term] .k-text, .tips-on .kpi .k[data-term-kind] .k-text,
.tips-on .row-label[data-term], .tips-on .row-text > span[data-term], .tips-on .row-label > span[data-term] {
  text-decoration: underline dotted var(--label-3); text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.tips-on dt[data-term], .tips-on dt[data-term-kind], .tips-on .kpi .k[data-term], .tips-on .kpi .k[data-term-kind],
.tips-on span.badge[data-term], .tips-on span.badge[data-term-kind], .tips-on th[data-term] { cursor: help; }
/* Beschriftungen mit Begriff sind bei eingeschalteten Erklärungen Tab-Stopps (focusTerm): Fokusring eng anliegend */
[data-term-focus]:focus-visible { outline-offset: 1px; border-radius: 4px; }

/* ============================================================================================ Einstellungen, Begriffe, Tastenkürzel */
.settings-pop { width: min(340px, calc(100vw - 24px)); }
.settings-pop .menu-item { font: inherit; font-size: 14px; }
.settings-pop .pop-panel { gap: 4px; }
.sheet-tools { flex: none; display: grid; gap: 10px; padding: 12px 24px; border-bottom: 1px solid var(--separator); }
.sheet-tools input[type="search"] { height: 36px; padding-left: 32px; }
.glossary-cats { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 1px; }
.glossary-cats::-webkit-scrollbar { display: none; }
.glossary-cats .chip { flex: none; }
.glossary-body, .keys-body { display: grid; align-content: start; gap: 20px; }
.gl-cat { margin: 0 0 8px 4px; font: 600 12px/16px var(--font); color: var(--label-2); text-transform: uppercase; letter-spacing: 0.05em; }
.gl-list { background: var(--bg-elevated); border-radius: var(--radius-m); box-shadow: var(--shadow-1); overflow: hidden; }
.gl-term { position: relative; }
.gl-term + .gl-term::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 1px solid var(--separator); }
.gl-term > summary {
  position: relative; display: grid; gap: 2px; padding: 10px 40px 10px 16px; list-style: none; cursor: pointer;
  transition: background-color var(--t-fast) var(--ease);
}
.gl-term > summary::-webkit-details-marker { display: none; }
.gl-term > summary::after {
  content: ""; position: absolute; right: 18px; top: 18px; width: 6px; height: 6px; border-right: 1.6px solid var(--label-2);
  border-bottom: 1.6px solid var(--label-2); transform: rotate(45deg); transition: transform var(--t-fast) var(--ease);
}
.gl-term[open] > summary::after { transform: rotate(225deg); top: 21px; }
.gl-term > summary:hover { background: var(--fill-hover); }
.gl-term > summary:focus-visible { outline-offset: -2px; }
.gl-term.is-target > summary { background: var(--fill); }
.gl-label { font-size: 14.5px; line-height: 20px; font-weight: 600; }
.gl-short { font-size: 13px; line-height: 18px; color: var(--label-2); }
.gl-body { display: grid; gap: 8px; padding: 0 16px 14px; font-size: 14px; line-height: 20px; }
.gl-aliases { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.gl-foot { padding: 0 4px; }
.keys-list {
  display: grid; grid-template-columns: minmax(130px, max-content) minmax(0, 1fr); gap: 8px 16px; margin: 0; padding: 14px 16px;
  border-radius: var(--radius-m); background: var(--bg-elevated); box-shadow: var(--shadow-1); font-size: 14px; line-height: 20px;
}
.keys-list dt, .keys-list dd { margin: 0; }
.keys-list kbd {
  display: inline-block; min-width: 22px; padding: 0 7px; border-radius: 6px; background: var(--fill); box-shadow: inset 0 -1px 0 var(--separator);
  color: var(--label); font: 600 12px/22px var(--font); text-align: center; white-space: nowrap;
}

/* ============================================================================================ Nahtdetail, Abzeichen, Zeichnung */
.badge-wrap { height: auto; min-height: 22px; padding: 3px 9px; line-height: 16px; white-space: normal; text-align: left; }
.badge-sm { height: 18px; padding: 0 7px; font-size: 11px; }
.sd-sub { margin: 12px 0 6px; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--label-2); }
.sd-sec > .sd-sub:first-of-type { margin-top: 2px; }
.sd-stack { display: inline-grid; justify-items: start; gap: 4px; min-width: 0; }
.sd-stack small { font-size: 12px; line-height: 16px; color: var(--label-2); overflow-wrap: anywhere; }
.sd-passes { margin-top: 10px; }
.sd-passes .table-wrap { margin-top: 8px; box-shadow: none; background: var(--bg-grouped); }
table.passes { min-width: 540px; font-size: 12.5px; }
table.passes th { height: 30px; padding: 0 8px; }
table.passes td { height: 32px; padding: 4px 8px; }
table.passes th.num { text-align: right; }
.sd-head .sd-wide .btn-label { display: inline; }
/* Nahtdetail: feste Spaltenaufteilung über alle Gruppen (Werte fluchten), lange Bezeichnungen umbrechen statt die Werte
   zu quetschen; im schmalen Bereich Bezeichnung über dem Wert */
.seam-detail .kv { grid-template-columns: minmax(110px, 38%) minmax(0, 1fr); }
.seam-detail .kv dt { -webkit-hyphens: auto; hyphens: auto; overflow-wrap: break-word; }
@container (max-width: 520px) {
  .seam-detail .kv { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .seam-detail .kv dt { margin-top: 8px; font-size: 12.5px; line-height: 17px; }
  .seam-detail .kv dt:first-child { margin-top: 0; }
}
/* Detail vergrößern: breiter neben der Tabelle, Werte bekommen Platz (Nutzerwunsch „zu gedrängt“) */
@container (min-width: 1000px) {
  .sb-body.is-wide { grid-template-columns: minmax(0, 1fr) minmax(460px, 54%); }
}
.sb-body.is-wide .seam-detail .kv { grid-template-columns: minmax(170px, 34%) minmax(0, 1fr); }
.sd-symbol.is-assumed { color: var(--orange-text); font-weight: 600; }
.dv-conv {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0; padding: 3px 10px; border-radius: 999px;
  background: var(--orange-tint); color: var(--orange-text); font-size: 12.5px; line-height: 16px;
}
.dv-conv small { font-size: inherit; color: inherit; }
.share-pop { min-width: 300px; }
@keyframes tip-in { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }

/* ============================================================================================ Prüfen und Freigeben */
/* Prüfstand und Sammelaktionen über der Nahttabelle; Fortschrittsbalken grün (geprüft), Rest grau */
.title-badge { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sb-review {
  display: grid; gap: 10px; margin-bottom: 14px; padding: 12px 14px; border-radius: var(--radius-m);
  background: var(--bg-elevated); box-shadow: var(--shadow-1);
}
.sb-progress { display: grid; gap: 6px; }
.sb-progress-text { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 14px; line-height: 20px; }
.rv-progress { height: 6px; border-radius: 3px; }
.rv-progress .progress-bar { background: var(--green); border-radius: 3px; }
.sb-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
/* Telefonbreite: Rasterzeilen dürfen schmaler als ihr Inhalt werden, lange Beschriftungen der Sammelaktionen brechen um
   (sonst lief „Automatisch bestätigte ohne Warnung übernehmen (n)“ samt Fortschrittsbalken über den Kartenrand) */
.sb-review > * { min-width: 0; }
.sb-bulk .btn { white-space: normal; height: auto; min-height: 28px; padding-top: 5px; padding-bottom: 5px; line-height: 1.3; text-align: left; }
.sb-bulk-n { font-size: 13px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.sb-rchips { gap: 6px; }
.sb-rchips .toolbar-label { margin-right: 2px; }
table.seams th.col-check, table.seams td.col-check { width: 40px; padding: 0 2px 0 10px; }
.sb-check-hit { display: inline-grid; place-items: center; min-width: 28px; min-height: 28px; cursor: pointer; }
.sb-check, .rv-check { width: 18px; height: 18px; margin: 0; accent-color: var(--accent-fill); cursor: pointer; }
.sb-check:disabled, .rv-check:disabled { cursor: default; }
/* Nahtdetail: Leiste der Prüfentscheidung, Gründe des Status, Herleitung, Vergleich vorher/nachher */
.rv-bar { display: grid; gap: 10px; margin-top: 12px; padding: 12px; border-radius: var(--radius-m); background: var(--bg-grouped); }
.rv-state { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.rv-hint-line { flex: 1 1 200px; min-width: 0; }
.rv-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sd-why { margin-top: 12px; padding: 12px 14px; border-radius: var(--radius-m); background: var(--fill); }
.sd-why.tone-warn { background: var(--orange-tint); }
.sd-why.tone-good { background: var(--green-tint); }
.sd-why .section-title { color: var(--label); }
.why-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; line-height: 20px; }
.why-list li { overflow-wrap: anywhere; }
.why-list li > strong { margin-right: 6px; }
.why-list .badge { margin-left: 6px; vertical-align: 1px; }
.trace { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tr-step { padding: 10px 12px; border-radius: var(--radius-m); background: var(--bg-grouped); min-width: 0; }
.tr-head { display: flex; align-items: flex-start; gap: 10px; }
.tr-n {
  flex: none; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%;
  background: var(--accent-tint); color: var(--accent-text); font-size: 12px; font-weight: 700;
}
.tr-main { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }
.tr-title { font-size: 14px; line-height: 20px; font-weight: 600; }
.tr-res { font-size: 13.5px; line-height: 19px; overflow-wrap: anywhere; }
.tr-more { margin: 8px 0 0 32px; }
.tr-body { display: grid; gap: 10px; font-size: 13px; line-height: 18px; }
.tr-basis { overflow-wrap: anywhere; }
.tr-kv { width: 100%; border-collapse: collapse; font-size: 12.5px; line-height: 17px; font-variant-numeric: tabular-nums; }
.tr-kv caption { padding-bottom: 4px; text-align: left; font-size: 12px; font-weight: 600; color: var(--label-2); }
.tr-kv th, .tr-kv td { padding: 3px 8px 3px 0; text-align: left; vertical-align: top; border-top: 1px solid var(--separator); overflow-wrap: anywhere; }
.tr-kv th { width: 42%; font: 500 12px/17px var(--mono); color: var(--label-2); }
.tr-list ul { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 2px; }
.tr-list.is-warn strong { color: var(--orange-text); }
.rv-cmp { margin-top: 12px; display: grid; gap: 6px; }
table.cmp { font-size: 13px; }
table.cmp th, table.cmp td { height: 32px; padding: 4px 10px; }
table.cmp tbody th { position: static; height: auto; font-size: 13px; font-weight: 500; color: var(--label-2); white-space: normal; background: none; }
table.cmp tr.is-changed td:last-child { color: var(--accent-text); font-weight: 600; }
.rv-links { margin-top: 8px; }
/* Prüfdialog (Sheet mit Formular): Quittierungen, Felder, Vorschau vorher/nachher */
.review-sheet { width: min(640px, calc(100vw - 32px)); }
.review-form { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.review-titles { flex: 1 1 auto; display: grid; gap: 2px; min-width: 0; }
.review-titles .caption { overflow-wrap: anywhere; }
/* Zeilen in Inhaltshöhe: sonst schrumpfen Kinder mit overflow (Schaltergruppe, Listen) im scrollenden Sheet auf 0 */
.review-body { display: grid; align-content: start; grid-auto-rows: max-content; gap: 14px; }
.sheet-foot { flex: none; display: grid; gap: 4px; padding: 10px 24px 16px; border-top: 1px solid var(--separator); }
.sheet-foot .status-line { margin-top: 0; }
.sheet-foot .dialog-actions { margin-top: 4px; }
.rv-field { display: grid; gap: 6px; min-width: 0; }
.rv-label { font-size: 13px; font-weight: 600; color: var(--label-2); }
.rv-hint { font-size: 12.5px; line-height: 17px; color: var(--label-2); }
.rv-derived { font-family: var(--mono); }
.rv-grid, .rv-inter { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rv-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rv-cmp-col {
  display: grid; gap: 4px; min-width: 0; padding: 10px 12px; border-radius: var(--radius-m);
  background: var(--bg-elevated); box-shadow: var(--shadow-1); overflow-wrap: anywhere;
}
.rv-cmp-k { font-size: 12px; font-weight: 600; color: var(--label-2); }
.rv-after { color: var(--accent-text); font-weight: 600; }
.rv-group { display: grid; gap: 8px; }
.rv-group-title { font: 600 14px/20px var(--font); }
.rv-summary { font-weight: 600; }
.rv-ids { max-height: 120px; overflow: auto; padding: 8px 12px; border-radius: var(--radius-s); background: var(--bg-elevated); overflow-wrap: anywhere; }
.ack-list { list-style: none; margin: 0; padding: 0; background: var(--bg-elevated); border-radius: var(--radius-m); box-shadow: var(--shadow-1); overflow: hidden; }
.ack-item { position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr); align-items: start; gap: 10px; padding: 10px 14px; }
.ack-item + .ack-item::before { content: ""; position: absolute; top: 0; left: 48px; right: 0; border-top: 1px solid var(--separator); }
.ack-item .rv-check { margin-top: 2px; }
.ack-item.is-new { background: var(--orange-tint); }
.ack-text { display: grid; gap: 2px; min-width: 0; font-size: 14px; line-height: 20px; overflow-wrap: anywhere; cursor: pointer; }
.ack-short, .ack-reason { font-size: 13px; line-height: 18px; }
.ack-short, .ack-code { color: var(--label-2); }
.ack-code { font-size: 11.5px; }
.ack-done { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--green-text); }
.review-body .group.rv-switches { box-shadow: var(--shadow-1); }
/* Freigabe (Bereich „Dateien“) und Prüfstand (Übersicht) */
.card.release-card, .card.review-card { display: grid; gap: 12px; }
.card.release-card > * + *, .card.review-card > * + * { margin-top: 0; }
.card.release-card > .card-head, .card.review-card > .card-head { margin-bottom: 0; align-items: center; }
.rv-progress-text { font-size: 14px; line-height: 20px; }
.rv-release-done, .rv-release-open { display: grid; gap: 10px; }
.release-card .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
/* Annahmen des Auftrags (job.assumptions) */
details.assumptions-card > summary { flex-wrap: wrap; font-size: 15px; font-weight: 600; color: var(--label); }
details.assumptions-card > summary .muted { font-size: 13px; font-weight: 400; }
.asm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.asm-item { display: grid; gap: 3px; min-width: 0; padding: 10px 12px; border-radius: var(--radius-m); background: var(--bg-grouped); font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
.asm-item .chips { gap: 4px; }
details.job-assumptions .asm-item { background: var(--bg-elevated); box-shadow: var(--shadow-1); }
/* Prüfprotokoll (Audit) */
.audit-sheet { width: min(760px, calc(100vw - 32px)); }
.audit-body { display: grid; align-content: start; grid-auto-rows: max-content; gap: 12px; }
.audit-list { list-style: none; margin: 0; padding: 0; background: var(--bg-elevated); border-radius: var(--radius-m); box-shadow: var(--shadow-1); overflow: hidden; }
.audit-item { position: relative; display: grid; gap: 4px; padding: 10px 16px; font-size: 14px; line-height: 20px; }
.audit-item + .audit-item::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 1px solid var(--separator); }
.audit-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.audit-change, .audit-comment { overflow-wrap: anywhere; }
.audit-change { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 16px; font-size: 13.5px; line-height: 19px; }
.audit-change strong { font-weight: 600; }
.audit-comment { color: var(--label-2); font-style: italic; }
.audit-ack { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
/* JSON: Umschalter übernommene Fassung / Original (Automatik) */
.jv-version { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 12px; }

/* ============================================================================================ KI-Vorbereitung */
/* docs/19 §11: KI immer erkennbar (Kennzeichen „KI“ in Indigo, eigene Farbe – nicht Status-, nicht Markierungsfarbe),
   Evidenz vor Wert, keine Vorauswahl. Indigo nur für Herkunft KI, nie für Zustand oder Wirkung. */
.ai-mark {
  display: inline-flex; align-items: center; justify-content: center; flex: none; height: 18px; padding: 0 6px;
  border-radius: 5px; background: var(--ai-tint); color: var(--ai-text); font: 700 11px/18px var(--font); letter-spacing: 0.02em;
}
.ai-mark.is-open { background: transparent; box-shadow: inset 0 0 0 1px var(--ai-text); }   /* KI-Eintrag nicht übernommen */
.cell-flex { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ai-row-title { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
/* Freigabedialog: KI-Vorprüfung (UI-KI-16) – Hinweise, keine Bedingung */
.ai-precheck { display: grid; gap: 8px; }
.ai-precheck-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.ai-precheck-head .rv-group-title { margin: 0; }
.ai-precheck .caption, .ai-precheck-sum, .ai-precheck-none { margin: 0; overflow-wrap: anywhere; }
.ai-findings { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ai-finding {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 8px; padding: 8px 10px;
  border-radius: var(--radius-s); background: var(--bg-elevated); font-size: 14px; line-height: 20px;
}
.ai-finding-body { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.ai-finding-body p { margin: 0; }
/* Dateien: ZIP „KI-Evidenz beilegen“ (UI-KI-19) – Kästchen statt Symbol, Beschriftung als Zielfläche */
.ai-zip-row .row-ic { background: var(--ai-tint); }
.ai-zip-evidence { width: 18px; height: 18px; margin: 0; accent-color: var(--ai-fill); cursor: pointer; }
.ai-zip-row .row-text { cursor: pointer; }
/* Seitenpanel „Frage stellen“ (UI-KI-15): rechts angedockt, volle Höhe; schmal wie ein Blatt über die ganze Breite */
dialog.ai-ask-sheet { width: min(520px, calc(100vw - 32px)); height: calc(100dvh - 32px); max-height: calc(100dvh - 32px); margin: 16px 16px 16px auto; }
.ai-ask-body { display: grid; align-content: start; grid-auto-rows: max-content; gap: 12px; }
.ai-ask-body textarea { width: 100%; min-height: 96px; resize: vertical; }
.ai-ask-context { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.ai-ask-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; overflow-wrap: anywhere; }
.chip-x {
  display: inline-grid; place-items: center; width: 24px; height: 24px; margin: -4px -6px -4px 0; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--label-2); cursor: pointer;
}
.chip-x:hover { background: var(--fill); color: var(--label); }
.ai-ask-send { display: flex; align-items: center; gap: 8px; }
.ai-ask-count { font-variant-numeric: tabular-nums; }
.ai-answer { display: grid; gap: 10px; padding: 12px 14px; border-radius: var(--radius-m); background: var(--bg-elevated); box-shadow: var(--shadow-1); }
.ai-answer-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.ai-answer-text { margin: 0; overflow-wrap: anywhere; font-size: 15px; line-height: 22px; }
.ai-answer-cites ul, .ai-answer-warn { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
.ai-answer-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.ai-answer-actions .caption { flex: 1 1 100%; margin: 0; }
.ai-ask-btn .ai-mark { margin-right: 2px; }
@media (max-width: 559.98px) {
  dialog.ai-ask-sheet { width: calc(100vw - 16px); margin: 8px; height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); }
}
/* Blatt „KI-Bericht“, „Revisionsvergleich“, „WPS-Vorschläge“ (UI-KI-12, M9, M10): Stand und Ergebnis oben, Start unten */
.ai-task-sheet { width: min(720px, calc(100vw - 32px)); }
.ai-task-body { display: grid; align-content: start; grid-auto-rows: max-content; gap: 16px; }
.ai-task-state { display: grid; gap: 10px; }
.ai-task-form { display: grid; gap: 12px; padding-top: 12px; border-top: 1px solid var(--separator); }
.ai-task-form fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.ai-task-start { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.ai-task-why { margin: 0; }
.ai-result { display: grid; gap: 10px; padding: 12px 14px; border-radius: var(--radius-m); background: var(--bg-elevated); box-shadow: var(--shadow-1); }
.ai-result h4 { margin: 0 0 2px; font: 600 14px/20px var(--font); }
.ai-result .caption, .ai-result p { margin: 0; overflow-wrap: anywhere; }
.ai-md { display: grid; gap: 8px; font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
.ai-answer-text.ai-md { font-size: 15px; line-height: 22px; }
.ai-md p, .ai-md h4 { margin: 0; }
.ai-md h4 { font-size: inherit; font-weight: 600; }
.ai-md ul, .ai-md ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.ai-md code { padding: 0 4px; border-radius: 4px; background: var(--fill); font-size: 0.92em; }
.ai-result-list { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; line-height: 20px; }
.ai-result-list > li { overflow-wrap: anywhere; }
.ai-more { padding-top: 2px; }
/* Nahtdetail: Herkunft KI (UI-KI-14) */
.sd-ai { display: grid; gap: 6px; margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-s); background: var(--bg-elevated); box-shadow: inset 0 0 0 1px var(--separator); }
.sd-ai-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.sd-ai .caption { margin: 0; overflow-wrap: anywhere; }
.row-required { font-size: 12px; font-weight: 500; color: var(--label-2); }
.ai-status-body { display: grid; gap: 6px; padding: 4px 14px 10px; font-size: 13px; line-height: 18px; }
.ai-status-line { overflow-wrap: anywhere; }
.ai-status-kv { margin: 0; }
.ai-slot:empty { display: none; }
.card.ai-card { display: grid; gap: 12px; }
.card.ai-card > * + * { margin-top: 0; }
.card.ai-card > .card-head { margin-bottom: 0; align-items: center; gap: 8px; }
.ai-card .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ai-card-text { font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
.ai-progress { height: 6px; border-radius: 3px; }
.ai-progress .progress-bar { background: var(--ai); border-radius: 3px; transition: width var(--t) var(--ease); }
.detail-tabs .seg.seg-ai .ic { color: var(--ai-text); }
/* Laufprotokoll (Sheet) */
.ai-log-sheet { width: min(720px, calc(100vw - 32px)); }
.ai-log-body { display: grid; align-content: start; grid-auto-rows: max-content; gap: 12px; }
.ai-phases { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ai-phase {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 6px 10px;
  border-radius: var(--radius-s); background: var(--bg-elevated); font-size: 14px; line-height: 20px;
}
table.ai-sessions { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 18px; font-variant-numeric: tabular-nums; }
table.ai-sessions th, table.ai-sessions td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--separator); }
table.ai-sessions th { font-size: 12px; font-weight: 600; color: var(--label-2); }
table.ai-sessions td.num { text-align: right; }
/* Bereich „KI-Vorschlag“: Liste mit Evidenz links vom Wert, Gegenprüfung als drei Symbole, Konfidenz, Status */
.ai-head { display: grid; gap: 10px; margin-bottom: 4px; }
.ai-head > .card-head { margin-bottom: 0; align-items: center; gap: 8px; }
.ai-counts { font-size: 14px; line-height: 20px; font-variant-numeric: tabular-nums; }
.ai-downloads { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ai-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0 10px; }
.ai-toolbar .chips { gap: 6px; }
.ai-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.ai-bulk .btn { white-space: normal; height: auto; min-height: 28px; padding-top: 5px; padding-bottom: 5px; line-height: 1.3; }
.ai-bulk-why { font-size: 13px; color: var(--red-text); }
.ai-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ai-row { background: var(--bg-elevated); border-radius: var(--radius-m); box-shadow: var(--shadow-1); min-width: 0; }
.ai-row.is-selected { box-shadow: var(--shadow-1), inset 0 0 0 2px var(--accent); }
.ai-row.is-refuted { box-shadow: var(--shadow-1), inset 0 0 0 1.5px var(--red); }
.ai-row.is-refuted.is-selected { box-shadow: var(--shadow-1), inset 0 0 0 2px var(--accent); }
.ai-row-main { display: grid; grid-template-columns: 32px 132px minmax(0, 1fr) auto; align-items: start; gap: 12px; padding: 12px 14px; }
.ai-row-main > .sb-check-hit { margin-top: 2px; }
.ai-ev { margin: 0; width: 132px; display: grid; gap: 4px; min-width: 0; }
.ai-ev img {
  display: block; width: 132px; height: 88px; object-fit: contain; border-radius: var(--radius-s); background: var(--page);
  box-shadow: inset 0 0 0 1px var(--separator);
}
.ai-ev figcaption { font: 500 12px/16px var(--mono); color: var(--label); overflow-wrap: anywhere; }
.ai-ev.is-empty { height: 88px; place-items: center; border: 1px dashed var(--separator-strong); border-radius: var(--radius-s); }
.ai-ev-none { font-size: 12px; color: var(--label-2); text-align: center; }
.ai-ev.is-big, .ai-ev.is-big img { width: 240px; }
.ai-ev.is-big img { height: 160px; }
.ai-ev-all { display: flex; flex-wrap: wrap; gap: 10px; }
.ai-body { min-width: 0; display: grid; gap: 6px; }
.ai-title {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 2px 4px; margin: -2px -4px; border: 0; border-radius: 6px;
  background: none; color: var(--label); font: 600 15px/21px var(--font); text-align: left; cursor: pointer; overflow-wrap: anywhere;
}
.ai-title:hover { background: var(--fill-hover); }
.ai-title:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ai-id { font-size: 12px; font-weight: 500; color: var(--label-2); }
.ai-value { min-width: 0; }
.ai-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; line-height: 18px; color: var(--label-2); }
.ai-where { overflow-wrap: anywhere; }
.ai-dry { font-size: 13px; line-height: 18px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.ai-meta { display: grid; justify-items: end; align-content: start; gap: 6px; }
.ai-votes { display: inline-flex; gap: 4px; }
.ai-vote {
  display: inline-flex; align-items: center; gap: 3px; height: 24px; padding: 0 7px; border-radius: 12px;
  background: var(--fill); color: var(--gray-text); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.ai-vote.tone-good { background: var(--green-tint); color: var(--green-text); }
.ai-vote.tone-warn { background: var(--orange-tint); color: var(--orange-text); }
.ai-vote.tone-bad { background: var(--red-tint); color: var(--red-text); }
.ai-vote-lens { font-weight: 600; }
.ai-conf { display: inline-flex; align-items: baseline; gap: 6px; font-size: 12px; color: var(--label-2); }
.ai-conf strong { font-size: 17px; line-height: 22px; color: var(--label); font-variant-numeric: tabular-nums; }
.ai-state { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.ai-cosigned { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--green-text); }
.ai-detail { display: grid; gap: 12px; padding: 0 14px 14px 58px; }
.ai-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.ai-vote-list, .ai-check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; line-height: 19px; }
.ai-check-list li { display: flex; align-items: flex-start; gap: 6px; }
.ai-check-list .is-pass .ic { color: var(--green-text); }
.ai-check-list .is-fail .ic { color: var(--red-text); }
.ai-check-list .is-na .ic { color: var(--label-2); }
.ai-reason { display: block; color: var(--label-2); font-size: 12.5px; line-height: 17px; overflow-wrap: anywhere; }
.ai-decision { font-size: 13px; line-height: 18px; color: var(--label-2); overflow-wrap: anywhere; }
.ai-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* Dialoge der Übernahme: Kurzfassung mit Evidenz, erwartete Wirkung, Felder */
.ai-sum { display: grid; grid-template-columns: 132px minmax(0, 1fr); align-items: start; gap: 12px; }
.ai-effect { padding: 10px 12px; border-radius: var(--radius-m); background: var(--ai-tint); font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
.ai-flag-label { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.ai-bulk-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13.5px; line-height: 19px; overflow-wrap: anywhere; }

/* ============================================================================================ Animationen */
@keyframes pulse { 50% { opacity: 0.25; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes indeterminate { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes pop-up-in { from { opacity: 0; transform: translateY(4px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes dialog-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view.is-entering { animation: view-in var(--t) var(--ease); }

/* ============================================================================================ Fallback ohne backdrop-filter */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .sidebar, .toolbar, .toast, .popover, dialog, .dv-float, .dv-thumbs, .dv-inspector, .dv-banner .callout, .tip { background: var(--bg-elevated); }
}
/* Systemeinstellung „Transparenz reduzieren“ bzw. „Kontrast erhöhen“: deckende Flächen statt Glas (wie im 3D-Viewer) */
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .sidebar, .toolbar, .toast, .popover, dialog, .dv-float, .dv-thumbs, .dv-inspector, .dv-banner .callout, .tip {
    background: var(--bg-elevated); -webkit-backdrop-filter: none; backdrop-filter: none;
  }
}
@media (prefers-contrast: more) {
  :root { --label-2: #48484a; --separator: rgba(60, 60, 67, 0.36); --separator-strong: rgba(60, 60, 67, 0.6); --fill: rgba(120, 120, 128, 0.2); }
}
@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --label-2: #d1d1d6; --separator: rgba(84, 84, 88, 0.7); --separator-strong: rgba(84, 84, 88, 0.95); --fill: rgba(120, 120, 128, 0.36); }
}
@media (prefers-contrast: more) {
  :root[data-theme="dark"] { --label-2: #d1d1d6; --separator: rgba(84, 84, 88, 0.7); --separator-strong: rgba(84, 84, 88, 0.95); --fill: rgba(120, 120, 128, 0.36); }
}

/* ============================================================================================ Zeichnungsviewer kompakt */
/* Zeichenfläche schmaler als 900 px (Tablet hochkant, kleine Fenster, Telefon – app.js misst und setzt .is-compact):
   Inspektor als Sheet unten statt Seitenleiste, die Zeichnung behält die ganze Breite */
.dv.is-compact { --insp: 0px; }
.dv.is-compact .dv-inspector { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 58%; }
.dv.is-compact .dv-inspector.is-collapsed .dvi-filters, .dv.is-compact .dv-inspector.is-collapsed .dvi-scroll,
.dv.is-compact .dv-inspector.is-collapsed .dvi-detail, .dv.is-compact .dv-inspector.is-collapsed .dvi-settings { display: none; }
.dv.is-compact.has-inspector .dv-nav { bottom: 68px; }
.dv.is-compact.has-inspector .dv-thumbs { bottom: 116px; max-height: calc(100% - 188px); }
.dv.is-compact .dvi-sheet-toggle { display: inline-grid; }
/* Seiten-/Zoomleiste kompakt, wenn sie sonst nicht passt (app.js misst) */
.dv-nav.is-compact .dv-actual { display: none; }
.dv-nav.is-compact .dv-fit { width: 30px; padding: 0; justify-content: center; }
.dv-nav.is-compact .dv-fit .ic { display: inline-block; }
.dv-nav.is-compact .dv-fit .btn-label { display: none; }
.dv-nav.is-compact .tool-sep { margin: 0 3px; }
.dv-nav.is-compact input.dv-page-input { width: 40px; }
.dv-nav.is-compact .dv-page-total { padding: 0 4px 0 2px; }
.dv-nav.is-compact .dv-zoom { min-width: 44px; }
/* Telefon mit 44-px-Zielen: ohne „−“/„+“ (Zoomen per Zwei-Finger-Geste, Strg+Mausrad oder Tasten + −) */
.dv-nav.is-mini .dv-zoom-btn { display: none; }

/* ============================================================================================ Responsiv */
@media (max-width: 1023.98px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; width: min(340px, 88vw); background: var(--glass-strong);
    transform: translateX(-104%); visibility: hidden; box-shadow: var(--shadow-pop);
  }
  .app.sidebar-open .sidebar { transform: none; visibility: visible; }
  /* Bewegung nur beim Öffnen/Schließen (Klasse setzt app.js), nicht beim Überschreiten der Breite von 1024 px */
  .app.sb-anim .sidebar { transition: transform var(--t-slow) var(--ease), visibility 0s linear var(--t-slow); }
  .app.sb-anim.sidebar-open .sidebar { transition: transform var(--t-slow) var(--ease), visibility 0s; }
  .toolbar .tb-sidebar, .sidebar .sb-close { display: inline-grid; }
  .toolbar { padding-left: 12px; }
  .view { padding: 4px 24px 48px; }
}
@media (max-width: 759.98px) {
  /* KI-Vorschlag: Evidenz kleiner, Gegenprüfung und Status unter den Wert */
  .ai-row-main { grid-template-columns: 32px 96px minmax(0, 1fr); }
  .ai-ev, .ai-ev img { width: 96px; }
  .ai-ev img { height: 72px; }
  .ai-meta { grid-column: 2 / -1; justify-items: start; grid-auto-flow: column; justify-content: start; flex-wrap: wrap; }
  .ai-detail { padding-left: 14px; }
  .ai-sum { grid-template-columns: 96px minmax(0, 1fr); }
}
@media (max-width: 759.98px) {
  .dv-actions .btn-label { display: none; }
  .dv-actions .btn { padding: 0 10px; }
  .dv-nav .dv-actual { display: none; }
  .dv-nav .dv-fit { width: 30px; padding: 0; justify-content: center; }
  .dv-nav .dv-fit .ic { display: inline-block; }
  .dv-nav .dv-fit .btn-label { display: none; }
  .dv-nav .tool-sep { margin: 0 3px; }
  input.dv-page-input { width: 40px; }
  .dv-page-total { padding: 0 4px 0 2px; }
  .dv-zoom { min-width: 44px; }
  .dv-canvas { min-height: 480px; }
  .kpis, .kpis.kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row-select, .row-input { flex-basis: 50%; }
}
@media (max-width: 599.98px) {
  .acc-new-fields { grid-template-columns: minmax(0, 1fr); }
  body { font-size: 15px; }
  .sidebar { width: 100vw; }
  .view { padding: 0 16px 40px; }
  .toolbar { padding: 0 8px 0 8px; }
  .tb-actions .btn-label { display: none; }
  .tb-actions .btn { padding: 0 10px; }
  .large-title { font-size: 28px; line-height: 34px; }
  .page-head { padding: 12px 0 16px; }
  .card { padding: 16px; }
  .kpi .v { font-size: 24px; line-height: 30px; }
  .row { flex-wrap: wrap; }
  .row-select, .row-input { flex: 1 1 100%; }
  .row-actions { max-width: 100%; }
  .row.file-dl-row, .row.wm-row { display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: start; gap: 8px 12px; }
  .row.file-dl-row .row-actions, .row.wm-row .wm-actions { grid-column: 2; justify-content: flex-start; max-width: none; }
  .kv { grid-template-columns: minmax(96px, max-content) minmax(0, 1fr); gap: 4px 10px; }
  .dropzone { padding: 28px 16px 24px; }
  .form-actions .btn-primary { flex: 1 1 auto; }
  .jv-tree, .jv-raw { max-height: 62vh; }
  .viewer-frame { min-height: 380px; height: 64vh; }
  .dv-canvas { min-height: 440px; }
  .detail.is-canvas-mode .meta-line { display: none; }
  .detail.is-canvas-mode .page-head { padding: 6px 0 10px; }
  .toasts { bottom: calc(16px + env(safe-area-inset-bottom)); }
  /* sechs Bereiche passen nicht nebeneinander: übrige Segmente nur als Symbol (Name bleibt für Screenreader
     erhalten), das gewählte mit Beschriftung – statt verdeckter Segmente hinter horizontalem Scrollen */
  .detail-tabs .seg { padding: 0 12px; }
  .detail-tabs .seg:not([aria-selected="true"]) .seg-label {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
}
@media (max-width: 379.98px) {
  /* sehr schmale Telefone (z. B. 360 px): Seiten-/Zoomleiste ohne Trenner und Abstände, damit sie ohne Scrollen passt */
  .dv-nav { gap: 0; }
  .dv-nav .tool-sep { display: none; }
  .dv-zoom { min-width: 40px; }
}
@media (max-width: 759.98px) {
  /* Schrittanzeige kompakt: nur der aktuelle Schritt mit Namen, die übrigen als Punkt (Name bleibt für Screenreader) */
  .step:not(.is-current):not(.is-active):not(.is-error) .step-text {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  .step:not(.is-current):not(.is-active):not(.is-error) .step-btn { padding: 4px; }
  .step:not(:last-child)::after { width: 8px; min-width: 8px; margin: 0 4px; }
  .sd-head .sd-wide .btn-label { display: none; }
  .keys-list { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .keys-list dd { margin-bottom: 8px; }
  .sheet-tools { padding: 10px 16px; }
}
@media (max-width: 599.98px) {
  .detail.is-canvas-mode .step-slot, .detail.is-canvas-mode .crumbs { display: none; }
  .rv-grid, .rv-inter, .rv-compare { grid-template-columns: minmax(0, 1fr); }
  .sheet-foot { padding: 10px 16px 14px; }
  .tr-more { margin-left: 0; }
  .crumb-btn { max-width: 22ch; }
  /* Telefon: Schritte in einer Zeile (der aktuelle Schritt verkürzt sich), Hinweis steckt im Knopf */
  .step, .step:not(:last-child) { flex: none; }
  .step.is-current, .step.is-active, .step.is-error { flex: 0 1 auto; }
  .step-note { max-width: 18ch; }
  .step-hint { display: none; }
}
@media (hover: none) {
  .job-delete { opacity: 1; }
  .job-delete:disabled { opacity: 0.35; }
}
/* Grober Zeiger (Finger, Stift, Handschuh): Bedienelemente mindestens 44 × 44 px (Abnahmekriterium Mobil) */
@media (pointer: coarse) {
  .btn, .btn-sm, .btn-lg, .dv-nav .btn { height: 44px; min-width: 44px; }
  .ai-title, .ai-flag-label, .ai-zip-row .row-text { min-height: 44px; }
  .ai-zip-evidence { width: 22px; height: 22px; }
  .chip-x { width: 44px; height: 44px; margin: -12px -14px -12px -6px; }
  .ai-bulk .btn { min-height: 44px; }
  .sb-bulk .btn { min-height: 44px; }
  .detail-tabs .seg { min-width: 44px; }
  input.dv-page-input, .dv-nav.is-compact input.dv-page-input { width: 44px; }
  .dv-nav.is-compact .dv-fit { width: 44px; }
  .btn-icon, .btn-sm.btn-icon { width: 44px; }
  .icon-btn, .dv-nav .icon-btn { width: 44px; height: 44px; }
  .job-select { padding-right: 52px; }
  .job-delete { top: 50%; right: 4px; transform: translateY(-50%); }
  .tool { width: 44px; height: 44px; }
  .tool.menu-btn { width: 54px; }
  .dv-tools .tool-sep { margin: 0 3px; }
  .cat-btn { width: 36px; height: 44px; }
  .seg, .segmented.sm .seg { height: 44px; }
  .chip, .layer-pill, .dvi-cat { height: 44px; }
  .dvi-item { min-height: 48px; }
  .menu-item { min-height: 44px; }
  .th-btn { height: 44px; }
  .link-btn, .sb-link { display: inline-flex; align-items: center; min-height: 44px; }
  details.disclosure > summary { min-height: 44px; }
  .sb-check-hit { min-width: 44px; min-height: 44px; }
  .sb-check, .rv-check { width: 22px; height: 22px; }
  .ack-item { min-height: 44px; }
  .jv-more { min-height: 44px; }
  .token { height: 36px; }
  .token button { width: 32px; height: 32px; }
  input[type="text"], input[type="search"], input[type="number"], input[type="password"], select, textarea { min-height: 44px; }
  input.dv-page-input { height: 44px; }
  .step-btn, .crumb-btn, .tip-more, .gl-term > summary { min-height: 44px; }
  .crumb-btn { display: inline-flex; align-items: center; }
  .dv-thumbs { bottom: 72px; }
  .dv-banner, .popover.dv-menu { top: 68px; }
  /* höhere Leisten: Abstände zum Sheet (Kopf 60 px) und zur Seitenleiste (52 px) mitwachsen lassen */
  .dv.is-compact.has-inspector .dv-nav { bottom: 76px; }
  .dv.is-compact.has-inspector .dv-thumbs { bottom: 136px; max-height: calc(100% - 214px); }
}
@media (pointer: coarse) and (max-width: 759.98px) {
  input.dv-page-input { width: 44px; }
  .dv-nav .dv-fit { width: 44px; }
}
.dz-tap { display: none; }
@media (hover: none) and (pointer: coarse) {
  /* Telefon/Tablet: kein Ziehen und Ablegen – die Fläche lädt zum Antippen ein */
  .dz-drag, .dz-or { display: none; }
  .dz-tap { display: inline; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important; scroll-behavior: auto !important;
  }
  .spinner, .progress.is-indeterminate .progress-bar {
    animation-duration: 2.4s !important; animation-iteration-count: infinite !important;
  }
}
@media print {
  body { height: auto; overflow: visible; }
  .app { display: block; height: auto; }
  .sidebar, .toolbar, .scrim, .toasts, .jv-toolbar, .jv-foot, .dv-float, .dv-thumbs, .dv-inspector, .detail-tabs, .tip, .step-slot, .crumbs,
  .intro-card { display: none !important; }
  .main { overflow: visible; }
  .card, .kpi, .group, .table-wrap { box-shadow: none; border: 1px solid var(--separator); }
}
