:root {
  --bg: #eef0f3;
  --stage: #e6e8ec;
  --stage-dot: #d3d7dc;
  --panel: #ffffff;
  --panel-2: #f7f8fa;
  --surface: #ffffff;
  --hover: #f1f3f5;
  --hover-2: #f8f9fa;
  --field: #f4f5f7;
  --preview: #faf8f3;
  --overlay: rgba(255, 255, 255, 0.96);
  --tip-bg: #2b3036;
  --chip-bg: #eef1f5;
  --chip-fg: #44505e;
  --line: #e3e6ea;
  --line-soft: #f1f3f5;
  --line-strong: #cfd4da;
  --switch-off: #ced4da;
  --text: #1d2433;
  --muted: #5f6b7a;
  --primary: #1f4aa8;
  --primary-hover: #183c8a;
  --primary-text: #1f4aa8;
  --primary-weak: #e8eefb;
  --primary-line: #9fb3e6;
  --focus: #4c8dff;
  --ok: #237535;
  --ok-weak: #e6f4ea;
  --warn: #a35200;
  --warn-weak: #fff4e5;
  --bad: #c92a2a;
  --bad-weak: #fdecec;
  --st-good: #2f9e44;
  --st-warn: #f59f00;
  --st-bad: #e03131;
  --teal: #0c8599;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 16px rgba(16, 24, 40, 0.08);
  --topbar: 56px;
  --act: 70px;
  --lib: 268px;
  --right: 330px;
  --ui-zoom: 1;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}

/* ---------- Darstellung: Kontrast, dunkle Oberfläche, Farben ----------
   Gesetzt von js/boot.js als Attribute am <html>-Element. */
:root[data-contrast='high'] {
  --bg: #ffffff;
  --stage: #f0f0f0;
  --stage-dot: #b0b0b0;
  --panel: #ffffff;
  --panel-2: #ffffff;
  --surface: #ffffff;
  --hover: #e4e4e4;
  --hover-2: #ededed;
  --field: #ffffff;
  --preview: #ffffff;
  --overlay: #ffffff;
  --tip-bg: #000000;
  --chip-bg: #ffffff;
  --chip-fg: #000000;
  --line: #1a1a1a;
  --line-soft: #6b6b6b;
  --line-strong: #000000;
  --switch-off: #6b6b6b;
  --text: #000000;
  --muted: #1f1f1f;
  --primary: #0033a0;
  --primary-hover: #00226b;
  --primary-text: #0033a0;
  --primary-weak: #dce6ff;
  --primary-line: #0033a0;
  --focus: #000000;
  --ok: #0a5c1a;
  --warn: #7a3d00;
  --bad: #9e0000;
  --shadow: 0 0 0 1.5px #000;
}
:root[data-contrast='dark'] {
  --bg: #15181d;
  --stage: #1b1f25;
  --stage-dot: #2c323b;
  --panel: #20242b;
  --panel-2: #1a1e24;
  --surface: #262b33;
  --hover: #323844;
  --hover-2: #2b313a;
  --field: #2b313a;
  --preview: #f3efe6;
  --overlay: rgba(32, 36, 43, 0.97);
  --tip-bg: #3a414c;
  --chip-bg: #323844;
  --chip-fg: #c9d1db;
  --line: #353b45;
  --line-soft: #2d333c;
  --line-strong: #4b525d;
  --switch-off: #59606b;
  --text: #e9ecf1;
  --muted: #a9b2be;
  --primary: #3d6fdc;
  --primary-hover: #5481e6;
  --primary-text: #9db8ff;
  --primary-weak: #26324d;
  --primary-line: #4d6aa8;
  --focus: #8fb0ff;
  --ok: #69c584;
  --ok-weak: #1f3326;
  --warn: #f0a94a;
  --warn-weak: #3a2c17;
  --bad: #ff8a8a;
  --bad-weak: #3d1f22;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}
:root[data-colors='cvd'] {
  --st-good: #1f6fb2;
  --st-warn: #e69f00;
  --st-bad: #8e1b4f;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

svg use {
  pointer-events: none;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -40px;
  z-index: 100;
  background: var(--primary);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
}
.skip-link:focus {
  top: 8px;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ---------- Buttons ---------- */
.icon-btn,
.btn,
.tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.icon-btn svg,
.btn svg,
.tool svg,
.menu svg,
.activity svg,
.mobile-bar svg,
.check-row svg,
.lens-card svg,
.sub-head svg,
.need svg,
.mini-row svg,
.search svg,
.cat-head svg,
.phase-bar svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.icon-btn {
  width: 38px;
  height: 38px;
  flex: none;
}
.icon-btn.small {
  width: 30px;
  height: 30px;
}
.icon-btn.small svg {
  width: 16px;
  height: 16px;
}
.icon-btn:hover,
.btn.ghost:hover,
.tool:hover {
  background: var(--hover);
}
.icon-btn:disabled,
.btn:disabled {
  opacity: 0.4;
  cursor: default;
  background: transparent;
}
.icon-btn.danger {
  color: var(--bad);
}
.btn {
  height: 36px;
  padding: 0 12px;
  font-weight: 600;
  white-space: nowrap;
}
.btn.primary {
  background: var(--primary);
  color: #fff;
}
.btn.primary:hover {
  background: var(--primary-hover);
}
.btn.outline {
  border-color: var(--line-strong);
  background: var(--surface);
}
.btn.outline:hover {
  background: var(--hover-2);
}
.btn.danger {
  background: var(--bad);
  color: #fff;
}
.btn.small {
  height: 30px;
  padding: 0 10px;
  font-size: 13px;
}
.btn.small svg {
  width: 16px;
  height: 16px;
}
.btn.block {
  width: 100%;
}
.btn.text-danger {
  color: var(--bad);
}

/* ---------- Kopfzeile ---------- */
.topbar {
  height: var(--topbar);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 30;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding-right: 4px;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  white-space: nowrap;
}
.brand-text strong {
  font-size: 15px;
}
.brand-text span {
  font-size: 11.5px;
  color: var(--muted);
}
.plan-name {
  flex: 0 1 320px;
  min-width: 80px;
}
.plan-name input {
  width: 100%;
  height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 10px;
  background: var(--field);
  font-weight: 600;
}
.plan-name input:hover {
  border-color: var(--line-strong);
}
.plan-name input:focus {
  background: var(--surface);
  border-color: var(--primary-text);
  outline: none;
}
.tb-group {
  display: flex;
  align-items: center;
  gap: 2px;
}
.tb-spacer {
  flex: 1 1 auto;
}
#btn-file .chev-sm {
  width: 14px;
  height: 14px;
  margin-left: -2px;
  color: var(--muted);
}
#btn-file[aria-expanded='true'] {
  background: var(--primary-weak);
  color: var(--primary-text);
}
.phone-only-icon {
  display: none !important;
}
#btn-right[aria-expanded='false'] {
  color: var(--muted);
}
#btn-right[aria-expanded='true'] {
  color: var(--primary-text);
}
.phone-only {
  display: none !important;
}

.menu {
  position: absolute;
  top: calc(var(--topbar) - 6px);
  right: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 10px 30px rgba(16, 24, 40, 0.14);
  padding: 6px;
  display: flex;
  flex-direction: column;
  min-width: 240px;
  z-index: 50;
}
.menu[hidden] {
  display: none;
}
.menu hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 4px 6px;
}
.menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.menu button[hidden] {
  display: none;
}
.menu button:hover {
  background: var(--hover);
}
.menu button svg {
  color: var(--muted);
}

/* ---------- Layout ---------- */
.workspace {
  display: grid;
  grid-template-columns: calc(var(--act) + var(--lib)) minmax(0, 1fr) var(--right);
  height: calc(100% - var(--topbar));
  transition: grid-template-columns 0.22s ease;
}
.workspace.no-left {
  grid-template-columns: var(--act) minmax(0, 1fr) var(--right);
}
.workspace.no-right {
  grid-template-columns: calc(var(--act) + var(--lib)) minmax(0, 1fr) 0;
}
.workspace.no-left.no-right {
  grid-template-columns: var(--act) minmax(0, 1fr) 0;
}
.panel {
  background: var(--panel);
  min-width: 0;
}
@media (prefers-reduced-motion: reduce) {
  .workspace,
  .panel-left,
  .panel-right {
    transition: none !important;
  }
}

/* Linke Seite: Reiterleiste + Bibliothek */
.panel-left {
  display: flex;
  border-right: 1px solid var(--line);
  overflow: hidden;
}
.activity {
  width: var(--act);
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 6px;
  background: var(--panel-2);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.activity button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: 0;
  background: transparent;
  padding: 9px 2px 7px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.15;
  cursor: pointer;
  position: relative;
  text-align: center;
  hyphens: manual;
}
.activity button svg {
  width: 21px;
  height: 21px;
}
.activity button:hover {
  background: var(--hover);
  color: var(--text);
}
.activity button[aria-selected='true'] {
  background: var(--primary-weak);
  color: var(--primary-text);
}
.workspace.no-left .activity button[aria-selected='true'] {
  background: transparent;
  color: var(--muted);
}
.activity .count {
  position: absolute;
  top: 4px;
  right: 6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  font-weight: 700;
}
.lib {
  flex: 1;
  min-width: var(--lib);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}
@media (min-width: 901px) {
  .workspace.no-left .lib {
    visibility: hidden;
    transition: visibility 0s linear 0.22s;
  }
}
.lib-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 6px 8px 16px;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
}
.lib-head h2 {
  margin: 0;
  font-size: 16px;
}
.lib-head .icon-btn {
  color: var(--muted);
}
.tab-body {
  padding: 2px 12px 16px;
  flex: 1;
}
.tab-body[hidden] {
  display: none;
}
.intro {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0 2px 12px;
}

/* ---------- Katalog ---------- */
.search {
  position: sticky;
  top: 52px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  margin-bottom: 8px;
  color: var(--muted);
}
.search:focus-within {
  border-color: var(--primary-text);
  box-shadow: 0 0 0 3px rgba(31, 74, 168, 0.12);
}
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  height: 100%;
}
.cat {
  margin-bottom: 4px;
}
.cat-head {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 8px 4px 6px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}
.cat-head:hover {
  color: var(--text);
}
.cat-head svg {
  width: 14px;
  height: 14px;
  transition: transform 0.15s;
}
.cat-head[aria-expanded='false'] svg {
  transform: rotate(-90deg);
}
.cat-head .n {
  margin-left: auto;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.cat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.cat-grid[hidden] {
  display: none;
}
.cat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 4px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  text-align: center;
  position: relative;
  min-height: 78px;
  touch-action: manipulation;
}
.cat-item:hover {
  border-color: var(--primary-text);
  background: var(--primary-weak);
}
.cat-item .thumb {
  width: 100%;
  height: 38px;
  overflow: visible;
}
.cat-item .name {
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.15;
}
.cat-item .badge {
  position: absolute;
  top: 3px;
  right: 3px;
  font-size: 10px;
  font-weight: 700;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--hover);
  color: var(--muted);
}
.cat-item .badge.full {
  background: var(--ok-weak);
  color: var(--ok);
}
.cat-item .badge.over {
  background: var(--warn-weak);
  color: var(--warn);
}
.cat-note,
.empty-note {
  font-size: 12px;
  color: var(--muted);
  margin: 10px 4px 0;
}

/* ---------- Anordnungen ---------- */
.preset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  margin-bottom: 8px;
  background: var(--surface);
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 10px;
  align-items: start;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.preset:hover {
  border-color: var(--primary-text);
  background: var(--primary-weak);
}
.preset .pv {
  width: 70px;
  height: 70px;
  background: var(--preview);
  border-radius: 8px;
  border: 1px solid var(--line);
}
.preset h3 {
  margin: 0 0 2px;
  font-size: 13px;
}
.preset .persons {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary-text);
  background: var(--primary-weak);
  border-radius: 99px;
  padding: 0 7px;
  margin-bottom: 3px;
}
.preset p {
  margin: 0;
  font-size: 11.5px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Objektliste ---------- */
.obj-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.obj-list,
.learner-list,
.phase-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.obj-list li button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}
.obj-list li button:hover {
  background: var(--hover);
}
.obj-list li button[aria-current='true'] {
  background: var(--primary-weak);
  color: var(--primary-text);
  font-weight: 600;
}
.obj-list .meta {
  margin-left: auto;
  display: flex;
  gap: 4px;
  color: var(--muted);
}
.obj-list .meta svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}
.obj-list .warn {
  color: var(--bad);
}
.obj-group {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 12px 8px 4px;
}

/* ---------- Lernende ---------- */
.add-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}
.add-row input {
  flex: 1;
  min-width: 0;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 10px;
}
.add-row input:focus {
  border-color: var(--primary-text);
  outline: 2px solid rgba(31, 74, 168, 0.18);
}
.link-btn {
  border: 0;
  background: transparent;
  color: var(--primary-text);
  font-weight: 600;
  font-size: 12.5px;
  padding: 2px 0;
  cursor: pointer;
}
.link-btn:hover {
  text-decoration: underline;
}
.summary-box {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 10px 0;
}
.learner-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px;
  border-radius: 9px;
  border: 1px solid transparent;
}
.learner-list li:hover {
  background: var(--hover-2);
}
.learner-list li.placing {
  border-color: var(--primary-text);
  background: var(--primary-weak);
}
.learner-list li.active {
  background: var(--primary-weak);
}
.avatar {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.avatar.unplaced {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--line-strong);
}
.l-main {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0;
  cursor: pointer;
}
.l-main strong {
  display: block;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.l-main small {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11.5px;
}
.needs {
  display: inline-flex;
  gap: 3px;
}
.need {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--chip-bg);
  color: var(--chip-fg);
}
.need svg {
  width: 14px;
  height: 14px;
}
.need.st0 {
  background: var(--ok-weak);
  color: var(--ok);
}
.need.st1 {
  background: var(--warn-weak);
  color: var(--warn);
}
.need.st2 {
  background: var(--bad-weak);
  color: var(--bad);
}
.need-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.need-toggle {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.need-toggle small {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-size: 11.5px;
}
.need-toggle input {
  margin-top: 2px;
  accent-color: var(--primary-text);
}
.need-toggle:has(input:checked) {
  border-color: var(--primary-text);
  background: var(--primary-weak);
}
.chip-select {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.chip-select label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 99px;
  padding: 3px 10px 3px 6px;
  font-size: 12.5px;
  cursor: pointer;
}
.chip-select label:has(input:checked) {
  border-color: var(--primary-text);
  background: var(--primary-weak);
  color: var(--primary-text);
  font-weight: 600;
}
.chip-select input {
  accent-color: var(--primary-text);
  margin: 0;
}
.privacy {
  display: flex;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted);
  background: var(--panel-2);
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 12px;
}
.privacy svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

/* ---------- Phasen ---------- */
.phase-list li {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 8px;
  background: var(--surface);
  overflow: hidden;
}
.phase-list li.active {
  border-color: var(--primary-text);
  box-shadow: inset 3px 0 0 var(--primary);
}
.ph-main {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 8px;
  text-align: left;
  cursor: pointer;
}
.ph-main .pv {
  width: 58px;
  height: 58px;
  border-radius: 7px;
  background: var(--preview);
  border: 1px solid var(--line);
}
.ph-main strong {
  display: block;
  font-size: 13px;
}
.ph-main small {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
}
.ph-no {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  margin-right: 5px;
  vertical-align: 1px;
}
.ph-tools {
  display: flex;
  gap: 2px;
  padding: 0 6px 6px 76px;
}
.ph-rebuild {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: -2px 0 8px 22px;
  padding-left: 10px;
  border-left: 2px dashed #b9a7f5;
  font-size: 11.5px;
  color: #5f3dc4;
}
.ph-rebuild > svg {
  width: 15px;
  height: 15px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ph-rebuild button {
  margin-left: auto;
  color: #5f3dc4;
}

/* ---------- Bühne ---------- */
.stage {
  position: relative;
  overflow: hidden;
  container: stage / inline-size;
  background: var(--stage);
  background-image: radial-gradient(var(--stage-dot) 1px, transparent 1px);
  background-size: 18px 18px;
}
#plan {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
  outline: none;
}
#plan:focus-visible {
  box-shadow: inset 0 0 0 3px var(--focus);
}
#plan.measuring,
#plan.placing {
  cursor: crosshair;
}
#plan .obj {
  cursor: move;
}
#plan .obj.locked {
  cursor: default;
}
#plan.measuring .obj,
#plan.placing .obj {
  cursor: crosshair;
}

.tool-rail {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  max-width: calc(100% - 20px);
}
.rail-group {
  display: flex;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 4px;
  gap: 2px;
}
.lens-group {
  position: relative;
}
.tool {
  flex-direction: column;
  gap: 2px;
  padding: 5px 8px 4px;
  min-width: 56px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.tool svg {
  width: 19px;
  height: 19px;
}
.tool[aria-pressed='true'],
.tool[aria-expanded='true'] {
  background: var(--primary-weak);
  color: var(--primary-text);
}
.lens-group .tool[aria-pressed='true'] {
  background: var(--primary);
  color: #fff;
}

.popover {
  position: absolute;
  z-index: 7;
  width: 310px;
  max-width: calc(100% - 16px);
  max-height: calc(100% - 80px);
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 8px 28px rgba(16, 24, 40, 0.16);
  padding: 6px 8px 8px;
}
.popover[hidden] {
  display: none;
}
.pop-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 8px 10px 4px;
}
.popover .switch-row {
  margin-bottom: 2px;
  border-color: transparent;
  padding: 6px 10px;
}
.popover .switch-row:hover {
  border-color: var(--line);
}
.pop-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-weight: 600;
}
.pop-row > span:first-child {
  flex: 1;
}
.pop-row .unit {
  color: var(--muted);
  font-weight: 400;
}
.seg {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
}
.seg button {
  border: 0;
  background: var(--surface);
  padding: 4px 9px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.seg button + button {
  border-left: 1px solid var(--line-strong);
}
.seg button[aria-pressed='true'] {
  background: var(--primary);
  color: #fff;
}
.pop-note {
  margin: 4px 10px 2px;
  font-size: 11.5px;
  color: var(--muted);
}
@media (pointer: coarse) {
  .pop-note {
    display: none;
  }
}

.zoom {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 4px;
  gap: 2px;
}

/* Phasen-Umschalter oben rechts */
.phase-bar {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 4px;
  max-width: 300px;
}
.phase-bar[hidden] {
  display: none;
}
.phase-bar .icon-btn {
  width: 32px;
  height: 36px;
}
.ph-name {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 2px 8px;
  cursor: pointer;
  line-height: 1.2;
}
.ph-name:hover {
  background: var(--hover);
}
.ph-name small {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--primary-text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ph-name span {
  font-weight: 600;
  font-size: 13px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 5;
  background: var(--overlay);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0;
  font-size: 12px;
  max-width: min(340px, calc(100% - 80px));
  max-height: calc(100% - 90px);
  overflow-y: auto;
}
.legend-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 7px 12px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius);
}
.legend-head:hover {
  color: var(--text);
}
.legend-head .chev {
  width: 14px;
  height: 14px;
  margin-left: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.15s;
}
.legend.collapsed .legend-head .chev {
  transform: rotate(180deg);
}
.legend-body {
  padding: 0 12px 8px;
}
.legend-body[hidden] {
  display: none;
}
.legend[hidden] {
  display: none;
}
.legend .row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 3px 0;
}
.legend .row > span:last-child {
  min-width: 0;
}
.stage.has-legend .sel-bar {
  left: auto;
  right: 66px;
  transform: none;
}
@container stage (max-width: 700px) {
  .stage.has-legend .sel-bar {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
  .stage.has-sel .legend {
    display: none;
  }
}
.legend .sw {
  width: 16px;
  height: 12px;
  border-radius: 3px;
  flex: none;
  border: 1px solid rgba(0, 0, 0, 0.15);
}
.legend .sw.round {
  width: 13px;
  height: 13px;
  border-radius: 50%;
}
.legend .sw.line {
  height: 0;
  border: 0;
  border-top: 3px dashed currentColor;
  border-radius: 0;
}
.legend .sw.cone {
  border: 0;
  border-radius: 0;
  background: linear-gradient(90deg, rgba(47, 158, 68, 0.15), rgba(47, 158, 68, 0.55));
  clip-path: polygon(0 50%, 100% 0, 100% 100%);
}
.legend strong {
  display: block;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 2px 0 2px;
}

.stage-hint {
  position: absolute;
  left: 50%;
  top: 74px;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--tip-bg);
  color: #fff;
  border-radius: 99px;
  padding: 7px 8px 7px 14px;
  font-size: 12.5px;
  box-shadow: var(--shadow);
  white-space: nowrap;
  max-width: calc(100% - 24px);
  overflow: hidden;
  text-overflow: ellipsis;
}
.stage-hint[hidden] {
  display: none;
}
.stage-hint .x {
  border: 0;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border-radius: 99px;
  padding: 2px 9px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
}

.sel-bar {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  gap: 2px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 4px;
}
.sel-bar[hidden],
.sel-bar .icon-btn[hidden] {
  display: none;
}
.icon-btn.toggle-btn[aria-pressed='true'] {
  background: var(--primary-weak);
  color: var(--primary-text);
}

/* ---------- Rechte Seite: Details & Prüfen ---------- */
.panel-right {
  border-left: 1px solid var(--line);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding-bottom: 24px;
}
@media (min-width: 901px) {
  .panel-right > * {
    min-width: calc(var(--right) - 2px);
  }
  .workspace.no-right .panel-right {
    visibility: hidden;
    border-width: 0;
    transition: visibility 0s linear 0.22s;
  }
}
.right-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 10px;
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.right-head .grab {
  display: none;
}
.right-tabs.seg {
  display: flex;
  flex: 1;
  border-radius: 9px;
}
.right-tabs button {
  flex: 1;
  padding: 7px 10px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.tab-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--bad);
  color: #fff;
  font-size: 10.5px;
  line-height: 18px;
}
.tab-badge[hidden] {
  display: none;
}
#props,
#checks {
  padding: 14px 16px 6px;
}
#props[hidden],
#checks[hidden] {
  display: none;
}
.sec-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  font-size: 15px;
}
.sec-title .thumb {
  width: 38px;
  height: 38px;
  flex: none;
  overflow: visible;
}
.sec-title small {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-size: 12px;
}
.sub-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 16px 0 6px;
}
.desc {
  font-size: 12.5px;
  color: var(--muted);
  margin: -2px 0 10px;
}
.tip {
  font-size: 12px;
  color: var(--muted);
  margin: 14px 0 0;
  display: flex;
  gap: 6px;
}
.tip svg {
  width: 15px;
  height: 15px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  margin-top: 1px;
}
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.field-grid.two {
  grid-template-columns: 1fr 1fr;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.field + .field {
  margin-top: 8px;
}
.field[hidden] {
  display: none;
}
.field-grid .field + .field {
  margin-top: 0;
}
.field input[type='number'],
.field input[type='text'],
.field select,
.field textarea {
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 8px;
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  width: 100%;
  min-width: 0;
}
.field textarea {
  height: auto;
  min-height: 140px;
  padding: 8px;
  resize: vertical;
  line-height: 1.5;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary-text);
  outline: 2px solid rgba(31, 74, 168, 0.18);
}
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line-strong);
  cursor: pointer;
}
.swatch[aria-pressed='true'] {
  box-shadow: 0 0 0 2px var(--primary);
}
.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  cursor: pointer;
  font-weight: 500;
}
.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary-text);
  flex: none;
}
.toggle small {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
}
.toggle > span {
  flex: 1;
  min-width: 0;
}
.lens-card .toggle {
  align-items: flex-start;
  margin-top: 8px;
}
.lens-card .toggle input {
  margin-top: 1px;
}
details.more {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
details.more > summary {
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 4px 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
details.more > summary::-webkit-details-marker {
  display: none;
}
details.more > summary::before {
  content: '';
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s;
  margin: 0 3px 0 1px;
}
details.more[open] > summary::before {
  transform: rotate(45deg);
}
details.more[open] > summary {
  margin-bottom: 6px;
}

/* Kurz-Prüfung am ausgewählten Objekt */
.mini-checks {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mini-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 9px;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
}
.mini-row:hover {
  border-color: var(--line-strong);
  background: var(--hover-2);
}
.mini-row.on {
  border-color: var(--primary-line);
  background: var(--primary-weak);
}
.mini-row .sg {
  margin: 1px 0 0;
}
.mini-row .txt {
  flex: 1;
  min-width: 0;
  font-size: 13px;
}
.mini-row .txt b {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.mini-row .txt small {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 6px;
  cursor: pointer;
  background: var(--surface);
}
.switch-row:hover {
  border-color: var(--line-strong);
}
.switch-row svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--primary-text);
  flex: none;
}
.switch-row .lbl {
  flex: 1;
  font-weight: 600;
}
.switch-row .lbl small {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-size: 11.5px;
}
.switch {
  appearance: none;
  -webkit-appearance: none;
  width: 38px;
  height: 22px;
  border-radius: 99px;
  background: var(--switch-off);
  position: relative;
  cursor: pointer;
  flex: none;
  transition: background 0.15s;
  margin: 0;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s;
}
.switch:checked {
  background: var(--primary);
}
.switch:checked::after {
  transform: translateX(16px);
}
.stat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.stat-table td {
  padding: 5px 2px;
  border-bottom: 1px solid var(--line-soft);
}
.stat-table td:last-child {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stat-table td small {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 400;
}
.stat-table .best {
  color: #e8a400;
}
.zone-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 7px;
  vertical-align: -1px;
  border: 1px solid rgba(0, 0, 0, 0.2);
}
.stat-table tr.total td {
  border-top: 1.5px solid var(--line-strong);
  font-weight: 700;
}
.stat-table tr.grp td {
  text-align: left;
  font-weight: 600;
  border-bottom: 0;
  padding-bottom: 0;
}
.stat-table tr.sub td:first-child {
  padding-left: 16px;
}
.pill {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 700;
}
.pill.ok {
  background: var(--ok-weak);
  color: var(--ok);
}
.pill.warn {
  background: var(--warn-weak);
  color: var(--warn);
}
.pill.bad {
  background: var(--bad-weak);
  color: var(--bad);
}
.pill.info {
  background: var(--primary-weak);
  color: var(--primary-text);
}
.check-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 7px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--line-soft);
}
.check-row svg {
  margin-top: 1px;
}
.check-row.ok svg {
  color: var(--ok);
}
.check-row.warn svg {
  color: var(--warn);
}
.check-row.bad svg {
  color: var(--bad);
}
.check-row .txt {
  flex: 1;
}
.check-row .txt small {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
}
.check-row .btn {
  margin-top: 4px;
}
.callout {
  font-size: 12px;
  color: var(--muted);
  background: var(--hover-2);
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 10px;
}
.kbd {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  background: var(--hover);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0 5px;
}
.sub-block {
  margin-top: 12px;
  padding: 10px;
  border-radius: 8px;
  background: var(--hover-2);
}
.sub-block .desc {
  margin: 4px 0 0;
}
.sub-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 13px;
}
.sub-head svg {
  width: 16px;
  height: 16px;
  color: var(--primary-text);
}
.sg {
  width: 17px;
  height: 17px;
  flex: none;
  vertical-align: -4px;
  margin-right: 6px;
  overflow: visible;
}
.legend .row .sg {
  margin-right: 0;
}
.seat-sum {
  display: flex;
  align-items: center;
  font-weight: 600;
  margin: 0 0 4px;
}

/* Prüfen: Karten = Prüfansichten */
.checks-intro {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0 0 10px;
}
.lens-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 8px;
}
.lens-card.on {
  border-color: var(--primary-line);
  box-shadow: 0 0 0 1px var(--primary-line), 0 4px 14px rgba(31, 74, 168, 0.1);
}
.lens-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius);
}
.lens-head:hover .lens-title {
  color: var(--primary-text);
}
.lens-ic {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--panel-2);
  color: var(--primary-text);
}
.lens-ic svg {
  width: 19px;
  height: 19px;
}
.lens-card.on .lens-ic {
  background: var(--primary);
  color: #fff;
}
.lens-title {
  flex: 1;
  min-width: 0;
  font-weight: 600;
}
.lens-title small {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-size: 11.5px;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
  background: var(--switch-off);
}
.dot.l0 {
  background: var(--st-good);
}
.dot.l1 {
  background: var(--st-warn);
}
.dot.l2 {
  background: var(--st-bad);
}
.lens-state {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--primary-text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.lens-body {
  padding: 2px 12px 12px;
  border-top: 1px solid var(--line-soft);
}
.lens-body > .stat-table:first-child,
.lens-body > .check-row:first-child {
  margin-top: 4px;
}
.issue-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}
.issue-list li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 6px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
}
.issue-list li button {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
  flex: 1;
}
.issue-list li button:hover strong {
  color: var(--primary-text);
}
.issue-list small {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
}
.steps {
  margin: 6px 0 0;
  padding-left: 20px;
  font-size: 12.5px;
}
.steps li {
  padding: 2px 0;
}

/* ---------- Dialog ---------- */
dialog {
  border: 0;
  border-radius: 14px;
  padding: 0;
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  box-shadow: 0 20px 60px rgba(16, 24, 40, 0.3);
  color: var(--text);
}
dialog::backdrop {
  background: rgba(20, 26, 36, 0.45);
}
.dlg-inner {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 24px);
}
.dlg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 10px 20px;
  border-bottom: 1px solid var(--line);
}
.dlg-head h2 {
  margin: 0;
  font-size: 17px;
}
.dlg-body {
  padding: 16px 20px;
  overflow-y: auto;
}
.dlg-body h3 {
  font-size: 14px;
  margin: 18px 0 6px;
}
.dlg-body h3:first-child {
  margin-top: 0;
}
.dlg-body p,
.dlg-body li {
  font-size: 13.5px;
}
.dlg-body ul {
  padding-left: 18px;
  margin: 6px 0;
}
.dlg-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.dlg-foot:empty {
  display: none;
}
.plans-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
}
.plans-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}
.plans-list .p-name {
  flex: 1;
  min-width: 0;
}
.plans-list .p-name strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.plans-list .p-name small {
  color: var(--muted);
}
.share-box {
  display: flex;
  gap: 6px;
}
.share-box input {
  flex: 1;
  min-width: 0;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 12.5px;
}
.area-hint {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 6px;
}
.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 4px 0 6px;
}
.help-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
}
.help-card strong {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 3px;
}
.help-card svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--primary);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.help-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px !important;
}
.dlg-body details {
  border-top: 1px solid var(--line);
  padding: 8px 0;
}
.dlg-body details summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: var(--tip-bg);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 200;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
body.has-sel .toast {
  bottom: 84px;
}

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(20, 26, 36, 0.35);
  z-index: 39;
}
.scrim[hidden] {
  display: none;
}

.only-mobile {
  display: none !important;
}

#print-sheet {
  display: none;
}

/* ---------- Einfach | Profi ---------- */
:root[data-level='einfach'] .pro-only {
  display: none !important;
}
:root[data-level='profi'] .simple-only {
  display: none !important;
}
.level-seg {
  flex: none;
}
.level-seg button {
  padding: 6px 11px;
  font-size: 13px;
}
.seg button[aria-checked='true'] {
  background: var(--primary);
  color: #fff;
}
.kbd-hint {
  margin-left: auto;
  padding-left: 16px;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- Auswahlleiste: Schnellaktionen ---------- */
.sb {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 38px;
  height: 38px;
  padding: 0 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.1;
}
.sb svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.sb span {
  display: none;
}
.sb:hover {
  background: var(--hover);
}
.sb:disabled {
  opacity: 0.4;
  cursor: default;
  background: transparent;
}
.sb.danger {
  color: var(--bad);
}
.sb[hidden] {
  display: none;
}
.sb.toggle-btn[aria-pressed='true'] {
  background: var(--primary-weak);
  color: var(--primary-text);
}
.sel-bar.labeled .sb {
  min-width: 56px;
  height: 50px;
  padding: 4px 8px;
}
.sel-bar.labeled .sb span {
  display: block;
}

/* ---------- Kontextmenü ---------- */
.ctx-menu {
  position: fixed;
  z-index: 120;
  min-width: 250px;
  max-width: min(340px, calc((100vw - 16px) / var(--ui-zoom)));
  max-height: calc((100dvh - 16px) / var(--ui-zoom));
  overflow-y: auto;
  zoom: var(--ui-zoom);
}
.ctx-menu button.danger,
.ctx-menu button.danger svg {
  color: var(--bad);
}
.ctx-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 6px 12px 4px;
}
.ctx-row {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px 2px 12px;
}
.ctx-row-label {
  font-size: 12px;
  color: var(--muted);
  flex: 1;
  min-width: 64px;
}
.ctx-menu .ctx-row button {
  padding: 0;
  width: 32px;
  height: 32px;
  justify-content: center;
}
.ctx-menu .ctx-row button svg {
  color: var(--text);
}

/* ---------- Befehlssuche ---------- */
.palette {
  width: min(620px, calc((100vw - 24px) / var(--ui-zoom)));
  margin-top: 10vh;
  padding: 0;
  overflow: hidden;
  background: var(--surface);
  color: var(--text);
}
.palette[open] {
  display: flex;
  flex-direction: column;
  max-height: calc((80dvh) / var(--ui-zoom));
}
.pal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.pal-head svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  flex: none;
}
.pal-head input {
  flex: 1;
  border: 0;
  font-size: 16px;
  outline: none;
  background: transparent;
  color: var(--text);
  min-width: 0;
}
.pal-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
}
.pal-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.pal-list li svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.pal-list li[aria-selected='true'] {
  background: var(--primary-weak);
}
.pal-list li[aria-selected='true'] svg {
  stroke: var(--primary-text);
}
.pal-list li:hover {
  background: var(--hover);
}
.pal-label {
  flex: 1;
  min-width: 0;
}
.pal-label small {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.pal-empty {
  color: var(--muted);
  cursor: default !important;
}

/* ---------- Katalog: Bausteine ---------- */
.cat-note.top {
  margin: 0 4px 10px;
}
.badge-demo {
  font-size: 10px;
  font-weight: 700;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--ok-weak);
  color: var(--ok);
}
.cat-grid.blocks {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.cat-item.block {
  min-height: 112px;
  padding: 8px 6px;
}
.cat-item.block .thumb {
  height: 52px;
}
.cat-item.block small {
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.2;
}
.cat-item.add {
  border-style: dashed;
  justify-content: center;
  color: var(--primary-text);
}
.cat-item.add svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* ---------- Anordnungen: Filter und eigene Vorlagen ---------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0 0 10px;
}
.chip {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 99px;
  padding: 4px 11px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.chip:hover {
  border-color: var(--primary-text);
}
.chip[aria-pressed='true'],
.chip[aria-checked='true'] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.preset-wrap {
  position: relative;
}
.preset-more {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--surface);
}
.preset .seats {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin-left: 6px;
}

/* ---------- Details: genaues Arbeiten ---------- */
.tool-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: fit-content;
}
.tool-row .sep {
  width: 1px;
  height: 22px;
  background: var(--line);
  margin: 0 4px;
}
.gap-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 6px;
  margin-top: 8px;
}
.gap-row .field {
  flex: 1 1 140px;
}

/* ---------- Prüfen als Fragen ---------- */
.check-summary {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius);
  margin-bottom: 10px;
  background: var(--ok-weak);
  color: var(--ok);
}
.check-summary.warn {
  background: var(--warn-weak);
  color: var(--warn);
}
.check-summary.bad {
  background: var(--bad-weak);
  color: var(--bad);
}
.check-summary svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.check-summary strong {
  display: block;
  color: var(--text);
}
.check-summary small {
  color: var(--muted);
  font-size: 12px;
}
.answer {
  font-size: 13.5px;
  margin: 8px 0 4px;
}
.help-tips {
  margin: 4px 0 6px;
  padding-left: 18px;
  font-size: 12.5px;
  color: var(--muted);
}
.dot {
  width: 17px;
  height: 17px;
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 17px;
  text-align: center;
}

/* ---------- Dialoge: Reiter, Auswahlkarten ---------- */
.dlg-tabs.seg {
  display: flex;
  width: 100%;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.dlg-tabs button {
  flex: 1 1 auto;
  padding: 7px 10px;
}
.dlg-tabs button[aria-selected='true'] {
  background: var(--primary);
  color: #fff;
}
.spanel[hidden] {
  display: none;
}
.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.choice {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 9px 10px;
  cursor: pointer;
}
.choice:has(input:checked) {
  border-color: var(--primary-text);
  background: var(--primary-weak);
  box-shadow: inset 0 0 0 1px var(--primary-text);
}
.choice input {
  margin-top: 3px;
  accent-color: var(--primary);
}
.choice strong {
  display: block;
  font-size: 13.5px;
}
.choice small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.text-seg button {
  padding: 6px 14px;
  font-size: 13px;
}
.field small.def {
  font-weight: 400;
  font-size: 11px;
}
.field-grid.rules {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.inline-ask {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 6px;
  margin: 8px 0;
  padding: 10px;
  border: 1px solid var(--primary-line);
  border-radius: var(--radius);
  background: var(--primary-weak);
}
.inline-ask .field {
  flex: 1 1 200px;
}
.inline-fields {
  display: flex !important;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.inline-fields input {
  width: 80px;
  height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 0 6px;
  background: var(--surface);
}
.toggle select {
  margin-top: 4px;
  height: 32px;
  max-width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
}
.btn-row.wrap {
  flex-wrap: wrap;
}

/* ---------- Startauswahl ---------- */
.task-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.task {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  text-align: left;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  padding: 14px;
  cursor: pointer;
}
.task:hover {
  border-color: var(--primary-text);
  background: var(--primary-weak);
}
.task > svg {
  width: 28px;
  height: 28px;
  padding: 6px;
  box-sizing: content-box;
  border-radius: 10px;
  background: var(--primary-weak);
  fill: none;
  stroke: var(--primary-text);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.task strong {
  display: block;
  font-size: 14.5px;
  margin-bottom: 2px;
}
.task small {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.35;
}
.task.cont {
  grid-column: 1 / -1;
  border-color: var(--primary-line);
}
.start-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.start-opt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
}
.start-opt small {
  font-weight: 400;
  color: var(--muted);
  font-size: 12px;
  flex-basis: 100%;
}
.start-foot .link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.start-foot .link-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

/* ---------- Assistent ---------- */
.wiz-steps {
  display: flex;
  gap: 4px;
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  counter-reset: none;
}
.wiz-steps li {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  padding-bottom: 6px;
  border-bottom: 3px solid var(--line);
}
.wiz-steps li span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--hover);
  font-size: 12px;
  flex: none;
}
.wiz-steps li.done {
  color: var(--text);
  border-color: var(--primary-line);
}
.wiz-steps li[aria-current='step'] {
  color: var(--primary-text);
  border-color: var(--primary);
}
.wiz-steps li[aria-current='step'] span,
.wiz-steps li.done span {
  background: var(--primary);
  color: #fff;
}
.stepper {
  display: flex;
  align-items: center;
  gap: 6px;
}
.stepper input {
  width: 76px;
  height: 38px;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}
.stepper .icon-btn {
  border: 1px solid var(--line-strong);
}
.wiz-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.wiz-card {
  position: relative;
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  align-items: center;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 8px;
  cursor: pointer;
}
.wiz-card:hover {
  border-color: var(--primary-text);
}
.wiz-card[aria-pressed='true'] {
  border-color: var(--primary);
  background: var(--primary-weak);
  box-shadow: inset 0 0 0 1px var(--primary);
}
.wiz-card .pv {
  width: 64px;
  height: 64px;
  background: var(--preview);
  border-radius: 8px;
}
.wiz-card strong {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.wiz-no {
  position: absolute;
  top: -7px;
  left: -7px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 12.5px;
  box-shadow: 0 0 0 2px var(--surface);
}
.wiz-add {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.wiz-add .field {
  flex: 1;
}
.wiz-add textarea {
  min-height: 64px !important;
}
.wiz-learners {
  list-style: none;
  padding: 0;
  margin: 10px 0 4px;
  max-height: 260px;
  overflow-y: auto;
}
.wiz-learners li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line-soft);
}
.wiz-learners li strong {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.need-btns {
  display: flex;
  gap: 2px;
}
.need-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.need-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.need-btn[aria-pressed='true'] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.wiz-results {
  list-style: none;
  padding: 0;
  margin: 8px 0;
}
.wiz-results li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}
.wiz-results .sg {
  width: 20px;
  height: 20px;
  flex: none;
  margin-top: 1px;
}
.wiz-results strong {
  display: block;
  font-size: 13.5px;
}
.wiz-results small {
  color: var(--muted);
  font-size: 12.5px;
}

/* ---------- Drucken: Für wen? ---------- */
.who-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.who {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
}
.who input {
  margin-top: 3px;
  accent-color: var(--primary);
}
.who > svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--primary-text);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
  margin-top: 1px;
}
.who strong {
  display: block;
  font-size: 13.5px;
}
.who small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.who:has(input:checked) {
  border-color: var(--primary-text);
  background: var(--primary-weak);
  box-shadow: inset 0 0 0 1px var(--primary-text);
}
.who.dis {
  opacity: 0.55;
  cursor: not-allowed;
}
.who-opts {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.who-opts[hidden] {
  display: none;
}
.who-opts textarea {
  min-height: 60px !important;
}

/* ---------- Tastenkürzel, Verlauf, Bibliothek ---------- */
.keys-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 20px;
}
table.keys {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
table.keys td {
  padding: 4px 0;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
table.keys td:last-child {
  text-align: right;
  white-space: nowrap;
  padding-left: 10px;
}
.history {
  list-style: none;
  padding: 0;
  margin: 8px 0;
}
.history li {
  border-bottom: 1px solid var(--line-soft);
}
.history li > span,
.history li button {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 7px 4px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-size: 13px;
}
.history li button:hover {
  background: var(--hover);
}
.history svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.history small {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
}
.history .now span {
  font-weight: 700;
  color: var(--ok);
  cursor: default;
}
.history .now svg {
  stroke: var(--ok);
}
.history.redo button {
  color: var(--muted);
}
.lib-list {
  list-style: none;
  padding: 0;
  margin: 6px 0;
}
.lib-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line-soft);
}
.lib-list .thumb {
  width: 54px;
  height: 36px;
  flex: none;
  background: var(--preview);
  border-radius: 6px;
}
.lib-list .p-name {
  flex: 1;
  min-width: 0;
}
.lib-list .p-name small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.furn-edit {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 16px;
  align-items: start;
}
.furn-prev {
  background: var(--preview);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  height: 200px;
  display: grid;
  place-items: center;
  padding: 16px;
}
.furn-prev svg {
  width: 100%;
  height: 100%;
}

/* ---------- Mittlere Breiten ---------- */
@media (max-width: 1280px) {
  :root {
    --lib: 248px;
    --right: 300px;
  }
  .cat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 1080px) {
  .brand-text {
    display: none;
  }
  #btn-file span,
  #btn-share span {
    display: none;
  }
  #btn-file,
  #btn-share {
    padding: 0 9px;
  }
}
/* Beschriftungen der Werkzeuge nur, wenn die Bühne breit genug ist */
@container stage (max-width: 760px) {
  .tool span {
    display: none;
  }
  .tool {
    min-width: 40px;
    padding: 8px;
  }
}
@container stage (max-width: 620px) {
  .phase-bar {
    top: 62px;
  }
}

/* ---------- Tablet hochkant / Smartphone ---------- */
@media (max-width: 900px) {
  :root {
    --topbar: 52px;
  }
  .only-mobile {
    display: inline-flex !important;
  }
  .hide-mobile {
    display: none !important;
  }
  .topbar {
    padding: 0 8px;
    gap: 6px;
  }
  .brand img {
    width: 28px;
    height: 28px;
  }
  .plan-name {
    flex: 1 1 auto;
  }
  .tb-spacer {
    display: none;
  }
  .workspace {
    display: block;
    height: calc(100% - (var(--topbar) + 58px) * var(--ui-zoom) - env(safe-area-inset-bottom));
    position: relative;
  }
  .stage {
    position: absolute;
    inset: 0;
  }
  .panel-left {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(380px, calc(92vw / var(--ui-zoom)));
    z-index: 40;
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow);
  }
  .panel-left.open {
    transform: none;
  }
  .lib {
    min-width: 0;
  }
  .panel-right {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(400px, calc(92vw / var(--ui-zoom)));
    z-index: 40;
    border-left: 0;
    transform: translateX(102%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow);
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
  .panel-right.open {
    transform: none;
  }
  .right-head {
    padding: 8px 8px 8px 12px;
  }
  .mobile-bar {
    display: flex !important;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(58px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface);
    border-top: 1px solid var(--line);
    z-index: 30;
  }
  .mobile-bar button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 0;
    background: transparent;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    min-width: 0;
  }
  .mobile-bar button svg {
    width: 21px;
    height: 21px;
  }
  .mobile-bar button:active {
    color: var(--primary-text);
  }
  .toast {
    bottom: calc(70px + env(safe-area-inset-bottom));
  }
  body.has-sel .toast {
    bottom: calc(130px + env(safe-area-inset-bottom));
  }
  .tool-rail {
    top: 8px;
    left: 8px;
    gap: 6px;
  }
  .tool {
    min-width: 38px;
    padding: 7px;
  }
  .zoom {
    right: 8px;
    bottom: 8px;
  }
  .legend {
    left: 8px;
    bottom: 8px;
    font-size: 11.5px;
    max-width: calc(100% - 70px);
  }
  .sel-bar {
    bottom: 8px;
  }
  .stage.has-sel .legend {
    display: none;
  }
  .cat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .search {
    top: 52px;
  }
}

@media (max-width: 600px) {
  .hide-phone {
    display: none !important;
  }
  .phone-only-icon {
    display: inline-block !important;
  }
  #btn-file .chev-sm {
    display: none;
  }
  #btn-file {
    width: 38px;
    padding: 0;
  }
  .menu .phone-only {
    display: flex !important;
  }
  .menu {
    right: 8px;
  }
  .topbar {
    gap: 2px;
    padding: 0 6px;
  }
  .brand {
    padding-right: 2px;
  }
  /* Eigenschaften als Blatt von unten, am Kopf nach unten wischen schließt */
  .panel-right {
    top: auto;
    left: 0;
    width: auto;
    max-height: 80dvh;
    border-radius: 16px 16px 0 0;
    transform: translateY(102%);
    box-shadow: 0 -8px 30px rgba(16, 24, 40, 0.2);
  }
  .right-head {
    padding-top: 16px;
    touch-action: none;
    border-radius: 16px 16px 0 0;
  }
  .right-head .grab {
    display: block;
    position: absolute;
    top: 6px;
    left: 50%;
    width: 40px;
    height: 4px;
    margin-left: -20px;
    border-radius: 4px;
    background: var(--line-strong);
  }
  /* Werkzeugleiste in einer Zeile, bei Bedarf seitlich wischbar */
  .tool-rail {
    flex-wrap: nowrap;
    overflow-x: auto;
    right: 0;
    left: 0;
    top: 0;
    max-width: none;
    padding: 6px 8px 10px;
    scrollbar-width: none;
  }
  .tool-rail::-webkit-scrollbar {
    display: none;
  }
  .rail-group {
    flex: none;
    padding: 3px;
  }
  .tool {
    min-width: 34px;
    padding: 6px;
  }
  .phase-bar {
    top: 58px;
    right: 8px;
  }
  .legend {
    max-width: calc(100% - 72px);
  }
  .help-grid,
  .task-grid,
  .who-grid,
  .choice-grid,
  .wiz-cards,
  .keys-grid,
  .field-grid.rules,
  .furn-edit {
    grid-template-columns: 1fr;
  }
  .task {
    padding: 11px;
  }
  .furn-prev {
    height: 140px;
  }
  .wiz-learners li {
    flex-wrap: wrap;
  }
  .wiz-learners li strong {
    flex-basis: calc(100% - 40px);
  }
  .wiz-steps li {
    font-size: 0;
  }
  .wiz-steps li span {
    font-size: 12px;
  }
  .wiz-steps li[aria-current='step'] {
    font-size: 12px;
  }
}

@media (max-width: 420px) {
  .cat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .icon-btn {
    width: 36px;
    height: 36px;
  }
}

/* ---------- Barrierefreiheit (Darstellung) ----------
   Schriftgröße: Bedienelemente werden mit „zoom“ vergrößert, der Plan
   selbst nicht (seine Marken skaliert js/boot.js → markScale). */
.topbar,
.panel-left,
.panel-right,
.tool-rail,
.zoom,
.phase-bar,
.legend,
.stage-hint,
.sel-bar,
.popover,
dialog,
.toast,
.mobile-bar {
  zoom: var(--ui-zoom);
}
@media (min-width: 901px) {
  .workspace {
    height: calc(100% - var(--topbar) * var(--ui-zoom));
    grid-template-columns: calc((var(--act) + var(--lib)) * var(--ui-zoom)) minmax(0, 1fr) calc(var(--right) * var(--ui-zoom));
  }
  .workspace.no-left {
    grid-template-columns: calc(var(--act) * var(--ui-zoom)) minmax(0, 1fr) calc(var(--right) * var(--ui-zoom));
  }
  .workspace.no-right {
    grid-template-columns: calc((var(--act) + var(--lib)) * var(--ui-zoom)) minmax(0, 1fr) 0;
  }
  .workspace.no-left.no-right {
    grid-template-columns: calc(var(--act) * var(--ui-zoom)) minmax(0, 1fr) 0;
  }
}
dialog {
  width: min(560px, calc((100vw - 24px) / var(--ui-zoom)));
  max-height: calc((100dvh - 24px) / var(--ui-zoom));
}
.dlg-inner {
  max-height: calc((100dvh - 24px) / var(--ui-zoom));
}

/* Große Schaltflächen (mind. 44 × 44 Pixel) */
:root[data-targets='large'] .icon-btn {
  width: 44px;
  height: 44px;
}
:root[data-targets='large'] .icon-btn.small {
  width: 40px;
  height: 40px;
}
:root[data-targets='large'] .btn {
  height: 44px;
  padding: 0 15px;
}
:root[data-targets='large'] .btn.small {
  height: 40px;
}
:root[data-targets='large'] .tool {
  min-width: 62px;
  padding: 9px 10px 7px;
}
:root[data-targets='large'] .sb {
  min-width: 48px;
  height: 48px;
}
:root[data-targets='large'] .sel-bar.labeled .sb {
  min-width: 64px;
  height: 56px;
}
:root[data-targets='large'] .seg button,
:root[data-targets='large'] .chip {
  min-height: 40px;
  padding: 8px 14px;
}
:root[data-targets='large'] .menu button,
:root[data-targets='large'] .pal-list li {
  min-height: 46px;
}
:root[data-targets='large'] .cat-head,
:root[data-targets='large'] .lens-head,
:root[data-targets='large'] .mini-row,
:root[data-targets='large'] .obj-list li button {
  min-height: 46px;
}
:root[data-targets='large'] .activity button {
  padding: 12px 2px 10px;
}
:root[data-targets='large'] .switch {
  width: 48px;
  height: 28px;
}
:root[data-targets='large'] .switch::after {
  width: 22px;
  height: 22px;
}
:root[data-targets='large'] .switch:checked::after {
  transform: translateX(20px);
}
:root[data-targets='large'] .need-btn {
  width: 40px;
  height: 40px;
}
:root[data-targets='large'] .field input[type='number'],
:root[data-targets='large'] .field input[type='text'],
:root[data-targets='large'] .field select {
  height: 42px;
}

/* Deutlicher Fokusrahmen */
:root[data-focus='strong'] :focus-visible {
  outline: 4px solid #000;
  outline-offset: 2px;
  box-shadow: 0 0 0 7px #ffd400;
}
:root[data-focus='strong'][data-contrast='dark'] :focus-visible {
  outline-color: #ffd400;
  box-shadow: 0 0 0 7px #000;
}
:root[data-focus='strong'] #plan:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 4px #000, inset 0 0 0 8px #ffd400;
}

/* Bewegungen reduzieren */
:root[data-motion='reduce'] *,
:root[data-motion='reduce'] *::before,
:root[data-motion='reduce'] *::after {
  transition: none !important;
  animation: none !important;
  scroll-behavior: auto !important;
}

/* Hoher Kontrast: klare Rahmen, unterstrichene Links */
:root[data-contrast='high'] .btn.outline,
:root[data-contrast='high'] .seg,
:root[data-contrast='high'] .search,
:root[data-contrast='high'] .cat-item,
:root[data-contrast='high'] .preset,
:root[data-contrast='high'] .lens-card,
:root[data-contrast='high'] .rail-group,
:root[data-contrast='high'] .sel-bar,
:root[data-contrast='high'] .zoom,
:root[data-contrast='high'] .legend,
:root[data-contrast='high'] .phase-bar,
:root[data-contrast='high'] .menu,
:root[data-contrast='high'] .task,
:root[data-contrast='high'] .who,
:root[data-contrast='high'] .choice,
:root[data-contrast='high'] .chip,
:root[data-contrast='high'] .wiz-card,
:root[data-contrast='high'] .plan-name input,
:root[data-contrast='high'] .field input,
:root[data-contrast='high'] .field select,
:root[data-contrast='high'] .field textarea {
  border: 2px solid #000;
}
:root[data-contrast='high'] .link-btn {
  text-decoration: underline;
}
:root[data-contrast='high'] .pill,
:root[data-contrast='high'] .cat-item .badge {
  border: 1.5px solid currentColor;
}
:root[data-contrast='high'] .tool[aria-pressed='true'],
:root[data-contrast='high'] .activity button[aria-selected='true'] {
  outline: 2px solid #000;
}
:root[data-contrast='high'] dialog {
  border: 3px solid #000;
}
:root[data-contrast='high'] .stage {
  background-image: none;
}

/* Dunkle Oberfläche: Vorschaubilder der Möbel auf hellem Grund */
:root[data-contrast='dark'] .cat-item .thumb,
:root[data-contrast='dark'] .sec-title .thumb {
  background: #f3efe6;
  border-radius: 6px;
}
:root[data-contrast='dark'] .toast {
  background: #e9ecf1;
  color: #15181d;
}

/* ---------- Druck ---------- */
@media print {
  @page {
    size: A4 portrait;
    margin: 12mm;
  }
  html,
  body {
    height: auto;
    overflow: visible;
    background: #fff;
  }
  body > *:not(#print-sheet) {
    display: none !important;
  }
  #print-sheet {
    display: block !important;
    font-family: var(--font);
    color: #000;
  }
  #print-sheet h1 {
    font-size: 18pt;
    margin: 0 0 2mm;
  }
  #print-sheet h2 {
    font-size: 12pt;
    margin: 4mm 0 2mm;
  }
  #print-sheet .sub {
    font-size: 10pt;
    color: #444;
    margin-bottom: 4mm;
  }
  #print-sheet .plan svg {
    width: 100%;
    height: auto;
    max-height: 138mm;
  }
  #print-sheet .plan.big svg {
    max-height: 225mm;
  }
  #print-sheet .names {
    font-size: 12pt;
    line-height: 1.6;
    margin-top: 4mm;
  }
  #print-sheet .note {
    font-size: 10.5pt;
    border-left: 1mm solid #999;
    padding-left: 3mm;
    margin-top: 4mm;
  }
  #print-sheet ol.big {
    font-size: 12pt;
    line-height: 1.5;
  }
  #print-sheet table {
    border-collapse: collapse;
    font-size: 9.5pt;
    width: 100%;
  }
  #print-sheet td,
  #print-sheet th {
    border-bottom: 0.3mm solid #ccc;
    padding: 1.2mm 2mm;
    text-align: left;
    vertical-align: top;
  }
  #print-sheet .cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6mm;
    margin-top: 4mm;
    align-items: start;
  }
  #print-sheet tr,
  #print-sheet li {
    break-inside: avoid;
  }
  #print-sheet .page-break {
    break-before: page;
  }
  #print-sheet ol {
    font-size: 10pt;
    margin: 0;
    padding-left: 6mm;
  }
  #print-sheet .foot {
    font-size: 8pt;
    color: #666;
    margin-top: 4mm;
  }
}
