*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --font-sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --bg: #0c2e40;
  --surface: #fff;
  --border: #d0d5dd;
  --text: #1a1d21;
  --muted: #5c6570;
  --accent: #1b5e4b;
  --accent-hover: #144a3c;
  --brand-blue: #0066cc;
  --brand-blue-dark: #004a94;
  --brand-blue-light: #e8f2fc;
  --danger: #b42318;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

html,
body {
  margin: 0;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 100vh;
  max-width: none;
  margin: 0;
  padding: 0.5rem 0.75rem;
  overflow: hidden;
  color: var(--text);
}

.app__header {
  flex-shrink: 0;
  margin-bottom: 0.5rem;
  color: #e8eef2;
}

.bmflipbook-trial-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-bottom: 0.5rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.35;
  color: #5c4a00;
  background: #fff3cd;
  border: 1px solid #e6c200;
  border-radius: var(--radius);
}

.bmflipbook-trial-banner[hidden] {
  display: none !important;
}

.bmflipbook-trial-banner__label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.75rem;
}

.bmflipbook-trial-banner__link {
  color: #0c2e40;
  font-weight: 600;
  text-decoration: underline;
}

.bmflipbook-trial-banner__link:hover {
  color: var(--brand-blue);
}

.bmflipbook-invite-banner {
  color: #0c3d4a;
  background: #d4edf5;
  border-color: #7eb8cc;
}

.bmflipbook-invite-banner__dismiss {
  margin-left: auto;
  flex-shrink: 0;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #0c3d4a;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid #7eb8cc;
  border-radius: 4px;
  cursor: pointer;
}

.bmflipbook-invite-banner__dismiss:hover {
  background: #fff;
}

.bmflipbook-invite-banner--load-error {
  color: #5d2e00;
  background: #fff3e0;
  border-color: #ffb74d;
}

.bmflipbook-invite-banner__error {
  display: block;
  margin-top: 0.45rem;
  font-weight: 600;
  color: #bf360c;
}

.app__header-top {
  display: grid;
  grid-template-columns: var(--sidebar-left-w, 240px) minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
}

.app__brand {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  flex-shrink: 0;
  min-width: 0;
  min-height: 4.25rem;
  padding: 0.35rem 0.25rem;
  grid-column: 1;
  overflow: hidden;
}

.app__brand-watermark {
  position: absolute;
  inset: 0.15rem 0.25rem;
  z-index: 0;
  background: url("/wp-content/uploads/2026/05/daumenkino-ganft.jpg")
    center / contain no-repeat;
  opacity: 0.38;
  pointer-events: none;
}

.app__brand-mark,
.app__brand-text {
  position: relative;
  z-index: 1;
}

.app__brand-mark {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  position: relative;
}

.app__logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}

.app__logo-placeholder {
  display: none;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--brand-blue-light);
  color: var(--brand-blue-dark);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.app__brand-mark--placeholder .app__logo {
  display: none;
}

.app__brand-mark--placeholder .app__logo-placeholder {
  display: flex;
}

.app__brand-text h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  letter-spacing: 0.02em;
}

.app__file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-width: 0;
  align-items: center;
  grid-column: 2;
}

.app__project-load {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.app__meta {
  margin: 0;
  font-size: 0.8rem;
  color: rgba(232, 238, 242, 0.75);
}

.app__meta[hidden] {
  display: none;
}

/* ---- Network sync UI ---- */
.header-divider {
  width: 1px;
  height: 1.4rem;
  background: rgba(255, 255, 255, 0.2);
  margin: 0 0.15rem;
}
.sync-status {
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  white-space: nowrap;
  min-height: 1.35rem;
  line-height: 1.35rem;
  vertical-align: middle;
}
.sync-status--saved {
  color: #b8f0d8;
}
.sync-status--saving {
  color: #ffd97a;
  box-shadow: 0 0 0 1px rgba(255, 217, 122, 0.45);
}
.sync-status--error {
  color: #ffb3b3;
}
.sync-status--conflict {
  color: #ffb3b3;
  font-weight: 600;
}
.sync-status__dirty {
  color: #f5c842;
  font-weight: 600;
}
.sync-status__pending {
  color: #8ec8ff;
  font-weight: 600;
}
.sync-status--connected {
  color: #b8f0d8;
}

/* Statuszeile: ℹ + Tutorial in derselben Farbe wie Online/Editor */
:root {
  --sync-status-fg: #b8f0d8;
  --sync-status-fg-hover: #d4f5e4;
}
.sync-status__users {
  color: inherit;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.15rem;
  max-width: min(42vw, 28rem);
}

.sync-status__presence-list {
  font-weight: 600;
}

.sync-status__presence-you {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sync-status__presence-sep {
  font-weight: 400;
}

.sync-status__presence-name {
  font-weight: 600;
}

.sync-status__presence-owner {
  font-weight: 600;
}
.sync-status--loading {
  color: #ffd97a;
}

/* ---- Load project dialog (above online-admin overlay at 200000) ---- */
.load-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 210000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
}
.load-dialog {
  position: relative;
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem 1.75rem;
  min-width: 320px;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}
.load-dialog__title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  color: #1a1d21;
}
.load-dialog__text {
  margin: 0 0 1.1rem;
  font-size: 0.88rem;
  color: #5c6570;
}
.load-dialog__actions {
  display: flex;
  gap: 0.6rem;
}
.load-dialog__btn {
  flex: 1;
  padding: 0.55rem 0.75rem;
  font-size: 0.85rem;
  border-radius: 5px;
  cursor: pointer;
}
.load-dialog__close {
  position: absolute;
  top: 0.5rem;
  right: 0.65rem;
  border: none;
  background: none;
  font-size: 1.3rem;
  color: #999;
  cursor: pointer;
  line-height: 1;
  padding: 0.15rem 0.3rem;
}
.load-dialog__close:hover {
  color: #333;
}

.load-dialog--missing-pdf {
  max-width: 520px;
}

.load-dialog__filename-label {
  margin: 0.75rem 0 0.25rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #5c6570;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.load-dialog__filename {
  margin: 0 0 1rem;
  padding: 0.55rem 0.65rem;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
  color: #1a1d21;
  background: #f4f6f8;
  border: 1px solid #d8dde3;
  border-radius: 6px;
}

.load-dialog__meta {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  color: #5c6570;
}

.load-dialog__text--warn {
  color: #8a3b12;
  background: #fff8e6;
  border: 1px solid #e6c200;
  border-radius: 6px;
  padding: 0.45rem 0.55rem;
}

.load-dialog__actions--stack {
  flex-direction: column;
}

.load-dialog__btn--primary {
  background: var(--brand-blue, #3399cc);
  color: #fff;
  border: 1px solid var(--brand-blue, #3399cc);
}

.load-dialog__btn--primary:hover {
  filter: brightness(1.05);
}

.bg-lib__list {
  list-style: none;
  margin: 0.75rem 0 1rem;
  padding: 0;
  max-height: min(40vh, 16rem);
  overflow-y: auto;
  border: 1px solid var(--border, #d0d8df);
  border-radius: 6px;
}

.bg-lib__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border, #e4eaef);
}

.bg-lib__item:last-child {
  border-bottom: none;
}

.bg-lib__item.is-active {
  background: rgba(45, 130, 90, 0.08);
}

.bg-lib__meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.bg-lib__name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text, #1e2a26);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bg-lib__file {
  font-size: 0.72rem;
  color: #6a7570;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bg-lib__actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 0 0 auto;
}

.bg-lib__badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: #1b5e4b;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: rgba(45, 130, 90, 0.15);
}

.bg-lib__activate {
  padding: 0.25rem 0.5rem !important;
  font-size: 0.75rem !important;
}

.bg-lib__remove {
  padding: 0.15rem 0.4rem !important;
  font-size: 1rem !important;
  line-height: 1;
  min-width: 1.6rem;
}

.bg-lib__empty {
  padding: 0.75rem;
  font-size: 0.82rem;
  color: #6a7570;
}

/* Share dialog */
.share-dialog__section {
  margin-bottom: 1rem;
}
.share-dialog__hint {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  color: #555;
  line-height: 1.35;
}
.share-dialog__heading {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #555;
}
.share-dialog__editor-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.6rem;
}
.share-dialog__editor {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.5rem;
  background: #f3f6f5;
  border-radius: 4px;
}
.share-dialog__editor-name {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 500;
}
.share-dialog__copy-btn,
.share-dialog__revoke-btn {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.15rem 0.3rem;
  border-radius: 3px;
  line-height: 1;
}
.share-dialog__copy-btn:hover {
  background: rgba(0, 0, 0, 0.08);
}
.share-dialog__revoke-btn {
  color: #c0392b;
  font-weight: 700;
}
.share-dialog__revoke-btn:hover {
  background: rgba(192, 57, 43, 0.1);
}
.share-dialog__empty {
  font-size: 0.82rem;
  color: #999;
  padding: 0.3rem 0;
}
.share-dialog__invite {
  display: flex;
  gap: 0.4rem;
}
.share-dialog__input {
  flex: 1;
  padding: 0.4rem 0.55rem;
  font-size: 0.85rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
}
.share-dialog__input--wide {
  flex: 3;
}
.share-dialog__viewer-row {
  display: flex;
  gap: 0.4rem;
}

/* Viewer mode */
.sync-status--viewer {
  color: #7f8c8d;
  font-weight: 600;
}
.is-viewer-mode .tool-btn {
  opacity: 0.4;
  pointer-events: none;
}

/* Timeline collapse */
.timeline__collapse-btn {
  width: 1rem;
  height: 1rem;
  padding: 0;
  border-radius: 3px;
  background: #9aa3a0;
  border: 1px solid #8a9390;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  margin-left: 0.3rem;
}
.timeline__collapse-btn:hover {
  background: #6e7875;
  border-color: #5e6865;
}
.timeline.is-collapsed {
  display: none;
}
.timeline-expand-floating {
  position: absolute;
  bottom: 0.4rem;
  right: 0.4rem;
  z-index: 20;
  width: 1.3rem;
  height: 1.3rem;
  padding: 0;
  border-radius: 3px;
  background: var(--brand-blue);
  border: 1px solid var(--brand-blue-dark);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 1px 4px rgba(0, 102, 204, 0.35);
}
.timeline-expand-floating:hover {
  background: var(--brand-blue-dark);
  border-color: #003d7a;
}
.timeline-expand-floating.is-visible {
  display: flex;
}

.bar-plan-sort-floating {
  position: absolute;
  right: 2.1rem;
  bottom: 0.4rem;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 1.3rem;
  padding: 0 0.45rem;
  border-radius: 3px;
  border: 1px solid #8fa99f;
  background: rgba(255, 255, 255, 0.95);
  color: #264f3f;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.bar-plan-sort-floating.is-visible {
  display: inline-flex;
}

.bar-plan-sort-floating:hover {
  background: #f2f8f5;
  border-color: #6f9385;
}

.bar-plan-sort-floating.is-start {
  color: #0f3f68;
  border-color: #7093b6;
}
.bar-plan-sort-floating.is-group {
  color: #2a6f97;
  border-color: #5a8fb0;
}

.app__memory {
  margin: 0.5rem 0 0;
  padding: 0.5rem 0.65rem;
  width: 100%;
  box-sizing: border-box;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--text);
}

.app__memory[hidden] {
  display: none !important;
}

.app__memory-title {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #aab4b0;
}

.app__memory-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #fff;
  background: var(--brand-blue);
  border-radius: 4px;
  vertical-align: middle;
}

.app__memory-list {
  margin: 0;
  padding-left: 1.1rem;
  color: #aab4b0;
}

.app__memory-list li {
  margin: 0.12rem 0;
}

.app__memory-list li.app__memory-list__item--warn {
  color: #f5b8b8;
  font-weight: 600;
}

.app__memory-hint {
  margin: 0.4rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
}

.app__header-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  min-width: 0;
  margin-left: 0.25rem;
}

.app__header-status-row {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  min-width: 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--sync-status-fg);
}

.app__project-json-name {
  display: block;
  max-width: min(42vw, 22rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
  line-height: 1.35;
  font-weight: 600;
  color: var(--sync-status-fg);
  text-align: right;
}

.app__project-json-name[hidden] {
  display: none !important;
}

.app__header-trailing {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}

.app__edition-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--sync-status-fg);
  white-space: nowrap;
  margin: 0 0.15rem 0 0.35rem;
}

.app__edition-badge[hidden] {
  display: none !important;
}

.app__edition-badge a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.app__edition-badge a:hover {
  color: var(--sync-status-fg-hover);
}

.app.is-header-collapsed > .app__header {
  display: none;
}

/* .btn setzt color:#fff — explizit Status-Grün für ℹ */
.btn.btn--info-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.35rem;
  min-width: 0;
  height: auto;
  font-size: inherit;
  font-weight: 400;
  background: transparent !important;
  border: none !important;
  border-radius: 5px;
  color: var(--sync-status-fg) !important;
  cursor: pointer;
  transition: color 0.15s;
}
.btn.btn--info-outline svg {
  width: 12px;
  height: 12px;
  display: block;
}
.btn.btn--info-outline:hover {
  background: transparent !important;
  color: var(--sync-status-fg-hover) !important;
}
.btn.btn--info-outline.is-active {
  color: var(--sync-status-fg-hover) !important;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.app__tutorial-link {
  display: inline-flex;
  align-items: center;
  font-size: inherit;
  font-weight: 400;
  line-height: inherit;
  color: var(--sync-status-fg);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
}

.app__tutorial-link:hover {
  color: var(--sync-status-fg-hover);
  text-decoration: underline;
}

.app__logout-link {
  display: inline-flex;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: inherit;
  font-weight: 400;
  line-height: inherit;
  color: var(--sync-status-fg);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.15s;
}

.app__logout-link:hover {
  color: var(--sync-status-fg-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn--master-admin {
  display: inline-flex;
  align-items: center;
  border: 1px solid #ff8a80;
  border-radius: 6px;
  background: linear-gradient(180deg, #e53935 0%, #c62828 100%);
  color: #fff !important;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(198, 40, 40, 0.45);
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}

.btn--master-admin:hover {
  background: linear-gradient(180deg, #ef5350 0%, #d32f2f 100%);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12), 0 3px 12px rgba(229, 57, 53, 0.55);
  text-decoration: none;
  color: #fff !important;
}

.btn--master-admin:active {
  transform: translateY(1px);
}

#btnOnlineProjectAdmin[hidden],
#btnLayerAdmin[hidden],
#btnOwnerIdentify[hidden],
#btnAccessLogout[hidden] {
  display: none !important;
}

.app__body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--sidebar-left-w, 240px) minmax(0, 1fr) 0;
  grid-template-areas: "sidebar-left main sidebar-right";
  gap: 0.75rem;
  align-items: stretch;
}

.app__body--has-right {
  grid-template-columns: var(--sidebar-left-w, 240px) minmax(0, 1fr) var(--sidebar-right-w, 240px);
}

.sidebar--left {
  grid-area: sidebar-left;
}

.sidebar--left > .panel {
  position: relative;
  z-index: 1;
}

.sidebar--right {
  grid-area: sidebar-right;
}

.sidebar--right[hidden] {
  display: none !important;
}

/* Rechte Sidebar: gleiche Breite wie links; offenes Panel nutzt die volle Höhe */
.sidebar--right:not([hidden]) {
  align-self: stretch;
}

.sidebar--right:not([hidden]) > .panel.is-open {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.sidebar--right:not([hidden]) > .panel.is-open > .panel__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar--right:not([hidden]) .element-catalog__list {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
}

.sidebar--left > .panel.is-open.panel--layers > .panel__body,
.sidebar--right:not([hidden]) > .panel.is-open.panel--layers > .panel__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar--left > .panel.is-open.panel--layers,
.sidebar--right:not([hidden]) > .panel.is-open.panel--layers {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.sidebar--left > .panel.is-open.panel--layers .layer-list,
.sidebar--right:not([hidden]) > .panel.is-open.panel--layers .layer-list {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
}

@media (max-width: 900px) {
  .app__header-top {
    grid-template-columns: 1fr;
  }

  .app__brand,
  .app__file-actions {
    grid-column: 1;
  }

  .app__body {
    grid-template-columns: 1fr;
    grid-template-areas:
      "sidebar-left"
      "sidebar-right"
      "main";
    overflow-y: auto;
  }

  html,
  body {
    overflow: auto;
  }

  .app {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* === SIDEBAR AUTOHIDE (sidebar-edge-reveal.js) — remove with module to undo === */
.sidebar-autohide__edge {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 50px; /* default; JS sets SIDEBAR_AUTOHIDE_EDGE_PX inline */
  z-index: 40;
  pointer-events: none;
  display: none;
}

.sidebar-autohide__edge.is-active {
  display: block;
  pointer-events: auto;
}

.sidebar-autohide__edge--left {
  left: 0;
}

.sidebar-autohide__edge--right {
  right: 0;
}

.panel__sidebar-pin {
  flex-shrink: 0;
  margin: 0;
  padding: 0.15rem 0.2rem;
  border: none;
  border-radius: 2px;
  background: transparent;
  font: inherit;
  font-size: 0.75rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.panel__sidebar-pin:hover {
  color: var(--brand-blue-dark);
  background: rgba(0, 0, 0, 0.05);
}

.panel__sidebar-pin.is-pinned {
  color: var(--accent, #1b5e4b);
}

.panel__sidebar-pin:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.app__body--left-autohide {
  --sidebar-left-w: 0px;
}

.app__body--right-autohide {
  --sidebar-right-w: 0px;
}

.sidebar.sidebar--autohide {
  position: fixed;
  top: 0;
  bottom: 0;
  width: min(280px, 85vw);
  z-index: 45;
  margin: 0;
  padding: 0.5rem;
  background: var(--surface, #fff);
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease;
}

.sidebar.sidebar--left.sidebar--autohide {
  left: 0;
  transform: translateX(-105%);
}

.sidebar.sidebar--right.sidebar--autohide {
  right: 0;
  left: auto;
  transform: translateX(105%);
}

.sidebar.sidebar--autohide.is-autohide-revealed {
  transform: translateX(0);
}

@media (max-width: 900px) {
  .sidebar-autohide__edge.is-active {
    display: none;
  }

  .app__body--left-autohide {
    --sidebar-left-w: 240px;
  }

  .app__body--right-autohide {
    --sidebar-right-w: 240px;
  }

  .sidebar.sidebar--autohide {
    position: relative;
    width: auto;
    transform: none;
    box-shadow: none;
    padding: 0;
  }
}
/* === END SIDEBAR AUTOHIDE === */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  box-shadow: var(--shadow);
  color: var(--text);
}

.panel[hidden] {
  display: none !important;
}

.panel--hint .panel__body {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
}

.panel--hint .panel__body p {
  margin: 0 0 0.5rem;
}

.panel--hint .panel__body p:last-child {
  margin-bottom: 0;
}

.panel__drag-handle {
  flex-shrink: 0;
  display: inline-block;
  margin-right: 0.25rem;
  cursor: grab;
  user-select: none;
  vertical-align: middle;
}

.panel__drag-handle--dots {
  width: 11px;
  height: 18px;
  opacity: 0.75;
  background-image: radial-gradient(
    circle,
    var(--brand-blue-dark) 1.8px,
    transparent 2px
  );
  background-size: 5.6px 5.6px;
  background-repeat: repeat;
}

.panel__toggle:hover .panel__drag-handle--dots {
  opacity: 1;
  background-image: radial-gradient(
    circle,
    var(--brand-blue) 1.9px,
    transparent 2px
  );
}

.panel__drag-handle:active {
  cursor: grabbing;
}

.panel__toggle-label {
  flex: 1;
  min-width: 0;
}

.panel__dock-btn {
  flex-shrink: 0;
  margin: 0;
  padding: 0.15rem 0.25rem;
  border: none;
  border-radius: 2px;
  background: transparent;
  font: inherit;
  font-size: 0.85rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.panel__dock-btn:hover {
  color: var(--brand-blue-dark);
  background: rgba(0, 0, 0, 0.05);
}

.panel__dock-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.panel.is-dragging {
  opacity: 0.55;
}

.panel.is-drag-over > .panel__toggle {
  outline: 2px dashed var(--brand-blue);
  outline-offset: -2px;
}

.panel__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  width: 100%;
  margin: 0;
  padding: 0.65rem 0.85rem;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  user-select: none;
}

.panel__toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.panel__toggle::after {
  content: "";
  flex-shrink: 0;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2.5px solid currentColor;
  border-bottom: 2.5px solid currentColor;
  transform: rotate(-135deg);
  margin-top: 0.2rem;
  transition: transform 0.15s ease;
  opacity: 0.8;
  pointer-events: none;
}

.panel:not(.is-open) > .panel__toggle::after {
  transform: rotate(45deg);
  margin-top: 0;
}

.panel:not(.is-open) > .panel__body {
  display: none;
}

.panel__body {
  padding: 0 0.85rem 0.85rem;
}

.panel__body > :first-child {
  margin-top: 0;
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}

.btn--delete-layer {
  background: #b0b6b3;
  border-color: #9aa09d;
  color: #fff;
}

.btn--delete-layer:hover:not(:disabled) {
  background: #912018;
  border-color: #7a1b14;
}

.btn--delete-layer:disabled {
  opacity: 0.45;
}


.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
}

.btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--secondary {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--border);
}

.btn--secondary:hover:not(:disabled) {
  background: #f8faf9;
}

.btn--danger {
  background: var(--bg);
  border-color: var(--bg);
  color: #fff;
}

.btn--danger:hover:not(:disabled) {
  background: #0a2533;
}

.btn--block {
  width: 100%;
  margin-top: 0.5rem;
}

.btn--small {
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
}

.layer-panel__action-btn {
  min-width: 1.75rem;
  padding-inline: 0.45rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  justify-content: center;
}

#btnLayerSets.layer-panel__action-btn {
  min-width: auto;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding-inline: 0.4rem;
}

.layer-sets-dialog {
  width: min(28rem, calc(100vw - 2rem));
  max-width: 100%;
  padding: 0;
  border: 1px solid var(--border, #c5ced6);
  border-radius: 10px;
  background: #fff;
  color: var(--text, #1a1d21);
  box-shadow: 0 12px 40px rgba(12, 46, 64, 0.22);
}

.layer-sets-dialog::backdrop {
  background: rgba(12, 46, 64, 0.45);
}

.layer-sets-dialog__form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.1rem 1.2rem 1rem;
}

.layer-sets-dialog__header {
  margin: 0;
}

.layer-sets-dialog__title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}

.layer-sets-dialog__lead {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--muted, #5c6570);
}

.layer-sets-dialog__body {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.layer-sets-dialog__label {
  font-size: 0.82rem;
  font-weight: 600;
}

.layer-sets-dialog__select {
  width: 100%;
  box-sizing: border-box;
  padding: 0.4rem 0.55rem;
  font: inherit;
  font-size: 0.9rem;
  border: 1px solid var(--border, #c5ced6);
  border-radius: 6px;
  background: #fff;
}

.layer-sets-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.layer-sets-dialog__actions .btn--small {
  padding: 0.28rem 0.55rem;
  font-size: 0.78rem;
  line-height: 1.2;
}

.layer-sets-dialog__hint {
  min-height: 1.1rem;
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: var(--muted, #5c6570);
}

.layer-sets-dialog__hint.is-error {
  color: var(--danger, #b42318);
}

.layer-sets-dialog__footer {
  display: flex;
  justify-content: flex-end;
  margin: 0;
  padding: 0;
}
.btn--outline {
  background: transparent;
  border: 1px solid var(--brand-blue);
  color: var(--brand-blue);
}
.btn--outline:hover {
  background: var(--brand-blue-light);
}
#btnSyncShare.btn {
  padding: 0.45rem 0.55rem;
  min-height: 2.1rem;
  min-width: 2.1rem;
}

.btn--owner-identify {
  background: transparent;
  border: 1px solid #b8f0d8;
  color: #b8f0d8;
  font-size: 0.55rem;
  line-height: 1.1;
  text-align: center;
  white-space: normal;
  max-width: 4.5em;
  min-height: 2.1rem;
  padding: 0.15rem 0.4rem;
}
.btn--owner-identify:hover {
  background: rgba(184, 240, 216, 0.1);
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.1rem;
}

.selection-outline-layer {
  pointer-events: none;
}

.selection-outline-layer__item {
  visibility: visible;
  opacity: 1;
}

.selection-outline-layer__outline {
  fill: none;
  pointer-events: none;
}

.selection-outline-layer__item:not(.is-primary) .selection-outline-layer__outline {
  stroke: #2a7a64;
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
}

.selection-outline-layer__item.is-primary .selection-outline-layer__outline {
  stroke: var(--accent, #1b5e4b);
  stroke-width: 2;
  stroke-dasharray: 6 4;
}

.selection-outline-layer__corner {
  fill: var(--accent, #1b5e4b);
  stroke: #fff;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
  visibility: visible;
  opacity: 1;
}

.selection-outline-layer__outline.is-locked {
  stroke: #6b7280;
}

.resize-handle-layer {
  pointer-events: none;
}

.resize-handle-layer__outline {
  stroke: var(--accent);
  stroke-width: 1;
  stroke-dasharray: 4 3;
  pointer-events: none;
}

.resize-handle {
  fill: #fff;
  stroke: var(--accent);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  pointer-events: all;
}

.resize-handle-layer.is-locked-display,
.polygon-edit-layer.is-locked-display,
.rotation-handle-layer.is-locked-display,
.symbol-crop-handle-layer.is-locked-display {
  pointer-events: none;
}

.resize-handle-layer.is-locked-display .resize-handle,
.polygon-edit-layer.is-locked-display .polygon-edit__vertex,
.rotation-handle-layer.is-locked-display .rotation-handle,
.symbol-crop-handle-layer.is-locked-display .symbol-crop-handle {
  fill: #c62828;
  stroke: #8e1b1b;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  cursor: not-allowed;
}

.polygon-edit-layer.is-locked-display .polygon-edit__vertex.is-selected {
  fill: #c62828;
  stroke: #5c1010;
}

.rotation-handle-layer.is-locked-display .rotation-handle-layer__stem {
  stroke: #c62828;
}

.polygon-edit-layer {
  pointer-events: none;
}

.polygon-edit__vertex {
  fill: #fff;
  stroke: var(--accent);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  pointer-events: all;
  cursor: move;
}

.polygon-edit__vertex.is-selected {
  fill: var(--accent);
  stroke: #fff;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.polygon-edit__edge {
  stroke: transparent;
  stroke-width: 14;
  pointer-events: stroke;
  cursor: crosshair;
}

.polygon-edit-layer.is-add-point-mode .polygon-edit__edge {
  stroke: rgba(27, 94, 75, 0.25);
}

.stage__overlay.is-polygon-tool,
.stage__overlay.is-polyline-tool {
  cursor: crosshair;
}

kbd {
  font-size: 0.85em;
  padding: 0.1em 0.35em;
  border-radius: 3px;
  background: #eee;
  border: 1px solid #ccc;
}

.tool-element-controls {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border, #d8dee4);
}

.tool-element-controls .stack-actions {
  margin-bottom: 0;
}

.polygon-point-actions {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.polygon-point-actions .btn.is-active {
  background: var(--accent, #1b5e4b);
  color: #fff;
  border-color: var(--accent, #1b5e4b);
}

.stack-actions {
  margin-bottom: 0.5rem;
}

.stack-actions__row {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
}

.stack-actions__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text, #333);
  cursor: pointer;
  transition: background 0.12s;
}
.stack-actions__btn:hover:not(:disabled) {
  background: #e8ebed;
}
.stack-actions__btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.tool-btn {
  padding: 0.2rem;
  font-size: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface);
  cursor: pointer;
  line-height: 1;
  width: 2.1rem;
  height: 2.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.tool-btn[data-tool="symbol"] {
  font-size: 1.65rem;
}

.tool-btn:hover {
  border-color: var(--accent);
}

.tool-btn.is-active,
.btn.is-active {
  background: var(--bg);
  color: #fff;
  border-color: var(--bg);
}

.tool-btn--hide-plan:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.tool-btn--hide-plan.is-active {
  background: #5a6b64;
  color: #fff;
  border-color: #5a6b64;
}

.tool-btn--hide-plan .tool-btn__icon {
  width: 16px;
  height: 16px;
}

.field {
  display: grid;
  gap: 0.25rem;
  margin-bottom: 0.55rem;
  font-size: 0.8rem;
}

.field-row--colors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.field-row--colors .field {
  margin-bottom: 0;
}

.field span {
  color: var(--muted);
}

.field input[type="color"] {
  width: 100%;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
}

.field--checkbox {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-direction: row;
}

.field--radio {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-direction: row;
  margin-bottom: 0.35rem;
}

.field--compact {
  margin-bottom: 0;
}

.field--compact input[type="number"] {
  width: 100%;
  padding: 0.35rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.85rem;
}

.field__textarea {
  width: 100%;
  min-height: 4.5rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: inherit;
  line-height: 1.4;
  resize: vertical;
}

.field__textarea:disabled {
  opacity: 0.55;
  background: #f4f6f8;
}

.element-info-field.is-active .field__textarea {
  border: 2px solid var(--danger);
  box-shadow: 0 0 0 1px rgba(180, 35, 24, 0.12);
}

.element-info-field.is-active .field__textarea:focus {
  outline: none;
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.18);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.week-validity__modes {
  border: none;
  margin: 0 0 0.5rem;
  padding: 0;
}

.week-validity__range {
  margin-top: 0.35rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.week-validity__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.week-validity__preview {
  margin: 0.45rem 0 0;
  font-size: 0.75rem;
  color: var(--accent);
  line-height: 1.35;
}

.panel__hint--tight {
  margin-top: -0.35rem;
  margin-bottom: 0.45rem;
}

.panel__weeks {
  margin: 0 0 0.55rem;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
}

.layer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
  max-height: min(40vh, 18rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  min-height: 0;
}

.layer-item {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem 0.2rem 0.2rem 0.1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  font-family: "Consolas", "SF Mono", "Menlo", ui-monospace, monospace;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
  line-height: 1.35;
}

.layer-item__drag-handle {
  flex-shrink: 0;
  display: inline-block;
  cursor: grab;
  user-select: none;
  touch-action: none;
  margin-left: 0;
}

.layer-item__drag-handle--dots {
  width: 9px;
  height: 14px;
  opacity: 0.55;
  background-image: radial-gradient(
    circle,
    var(--brand-blue-dark) 1.35px,
    transparent 1.55px
  );
  background-size: 4.5px 4.5px;
  background-repeat: repeat;
}

.layer-item:hover .layer-item__drag-handle--dots {
  opacity: 0.95;
}

.layer-item__drag-handle:active {
  cursor: grabbing;
}

.layer-item.is-dragging {
  opacity: 0.5;
}

.layer-item.is-drag-over {
  outline: 2px dashed var(--brand-blue);
  outline-offset: -2px;
}

.layer-item:hover {
  background: rgba(0, 0, 0, 0.035);
}

.layer-item.is-active-layer {
  background: rgba(27, 94, 75, 0.08);
  font-weight: 700;
  box-shadow: inset 2px 0 0 var(--accent);
}

.layer-item--read-only {
  opacity: 0.52;
  filter: grayscale(0.35);
}

.layer-item--read-only.is-active-layer {
  opacity: 0.68;
}

.layer-item--read-only .layer-item__label {
  color: #6b7280;
}

.layer-item.is-element-layer:not(.is-active-layer) {
  font-weight: 600;
}

.layer-item.is-active-layer.is-element-layer {
  border-left: 3px solid var(--element-layer-accent, var(--accent));
  box-shadow: none;
  padding-left: 0;
}

.layer-item input[type="checkbox"] {
  flex-shrink: 0;
  cursor: pointer;
  width: 13px;
  height: 13px;
  margin: 0;
}

.layer-item__solo {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  padding: 0;
  margin: 0;
  border: 1px solid rgba(0, 0, 0, 0.28);
  border-radius: 3px;
  background: #fff;
  color: rgba(0, 0, 0, 0.45);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.layer-item__solo:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.layer-item__solo.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Nur Termin-Freeze (ohne Solo). */
.layer-item__solo.is-frozen {
  background: #ef6c00;
  border-color: #ef6c00;
  color: #fff;
}

.layer-item__solo.is-frozen:hover:not(:disabled) {
  border-color: #e65100;
  color: #fff;
}

/* Solo + Termin-Freeze. */
.layer-item__solo.is-frozen.is-active {
  background: #c62828;
  border-color: #c62828;
  color: #fff;
}

.layer-item__solo.is-frozen.is-active:hover:not(:disabled) {
  border-color: #b71c1c;
  color: #fff;
}

.layer-item__solo:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.layer-item__solo:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.layer-item--solo-dimmed {
  opacity: 0.55;
}

.layer-item--solo-active .layer-item__label {
  font-weight: 600;
}

.layer-item__swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.25);
  padding: 0;
  margin: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.layer-item__swatch:hover:not(:disabled) {
  box-shadow: 0 0 0 2px rgba(27, 94, 75, 0.35);
}

.layer-item__swatch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.color-picker-portal {
  position: fixed;
  inset: 0;
  z-index: 15000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: transparent;
  pointer-events: none;
}

.color-picker-portal__input {
  width: min(72vw, 16rem);
  height: 3.25rem;
  padding: 0.25rem;
  border: 2px solid var(--accent, #1b5e4b);
  border-radius: 8px;
  cursor: pointer;
  background: #fff;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.2);
  pointer-events: auto;
}

.app-toast {
  position: fixed;
  left: 50%;
  top: 42%;
  bottom: auto;
  z-index: 12000;
  contain: layout style paint;
  scroll-margin: 0;
  max-width: min(88vw, 20rem);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  background: rgba(26, 29, 33, 0.88);
  color: #fff;
  font-size: 0.8rem;
  line-height: 1.3;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, calc(-50% + 6px));
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.app-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.layer-item__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-item__rename-btn {
  flex-shrink: 0;
  width: 1.2rem;
  height: 1.2rem;
  padding: 0;
  border: none;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.1s;
}

.layer-item:hover .layer-item__rename-btn,
.layer-item.is-active-layer .layer-item__rename-btn {
  opacity: 0.6;
}

.layer-item__rename-btn:hover {
  opacity: 1 !important;
  color: var(--accent);
}

.layer-item__rename-input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-weight: inherit;
  padding: 0.1rem 0.25rem;
  border: 1px solid var(--accent);
  border-radius: 2px;
  background: #fff;
}

.layer-item--adding {
  cursor: default;
  background: rgba(27, 94, 75, 0.06);
}

.layer-item--adding .layer-item__add-input {
  width: 100%;
}

.layer-item__badge {
  flex-shrink: 0;
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.1rem 0.3rem;
  border-radius: 2px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.layer-item__badge--element {
  color: var(--muted);
  border-color: var(--muted);
}

.stage__layer-stack {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.35rem;
  z-index: 2;
  width: max-content;
  max-width: min(32rem, calc(100% - 1rem));
  pointer-events: none;
}

.stage__selection-count {
  flex: 0 0 auto;
  width: max-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  padding: 0;
  background: none;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  pointer-events: none;
  text-shadow:
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000,
    0 0 3px #000;
}

.stage__selection-count[hidden] {
  display: none !important;
}

.stage__layer {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  box-sizing: border-box;
  flex: 0 0 10.5rem;
  width: 10.5rem;
  min-width: 10.5rem;
  max-width: 10.5rem;
  min-height: 1.7rem;
  height: 1.7rem;
  padding: 0.2rem 0.45rem;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.1;
  border: none;
  border-radius: 4px;
  box-shadow: none;
  outline: none;
  pointer-events: none;
  background: rgba(28, 32, 36, 0.38);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.stage__layer--active {
  background: rgba(27, 94, 75, 0.38);
  pointer-events: auto;
  cursor: pointer;
}

.stage__layer--active:hover {
  background: rgba(27, 94, 75, 0.55);
}

.stage__layer--element {
  background: rgba(40, 48, 58, 0.4);
  pointer-events: auto;
  cursor: pointer;
}

.stage__layer--element:hover {
  background: rgba(40, 48, 58, 0.58);
}

.stage__layer--element.is-perma {
  background: rgba(110, 78, 36, 0.42);
}

.stage__layer--element.is-perma:hover {
  background: rgba(110, 78, 36, 0.58);
}

.stage__layer-tag {
  flex-shrink: 0;
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  opacity: 0.85;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.stage__layer-tag--perma {
  opacity: 1;
  color: #ffd89a;
  letter-spacing: 0.04em;
}

.stage__layer-hide-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  margin-left: 0.08rem;
  padding: 0;
  border: none;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
}

.stage__layer-hide-btn svg {
  width: 11px;
  height: 11px;
}

.stage__layer-hide-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
}

.stage__layer-hide-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 1px;
}

.stage__layer-hide-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.stage__layer-swatch {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  border: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}

#stageLayerLabel,
#stageElementLayerLabel {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
  max-width: none;
}

.workspace {
  grid-area: main;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.stage__viewport {
  position: relative;
  background: #e8eaed;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  contain: paint;
  isolation: isolate;
  box-shadow: var(--shadow);
  flex: 1;
  min-height: 0;
  touch-action: none;
}

.stage__viewport.is-pan-ready,
.stage__viewport.is-space-pan,
.stage__viewport.is-pan-tool {
  cursor: grab;
}

.stage__viewport.is-panning {
  cursor: grabbing;
}

.stage__viewport.is-space-pan .stage__overlay.is-interactive,
.stage__viewport.is-pan-tool .stage__overlay.is-interactive {
  pointer-events: none;
}

.stage__transform {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  /* Kein permanentes will-change: bei großen Plänen (~6k px) erzeugt Zoom
     riesige Compositor-Layer, die Header/Sidebars als dunkle Balken übermalen. */
}

.stage-inline-text-edit {
  position: absolute;
  z-index: 40;
  margin: 0;
  padding: 6px;
  border: 2px solid var(--accent, #c62828);
  border-radius: 2px;
  resize: none;
  overflow: hidden;
  box-sizing: border-box;
  outline: none;
  pointer-events: auto;
}

.stage-inline-text-edit[hidden] {
  display: none !important;
}

.stage__viewport.is-empty::after {
  content: "PDF laden, um den Lageplan anzuzeigen";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.95rem;
  pointer-events: none;
}

.stage__viewport.is-plan-loading::after {
  display: none;
}

.stage__plan-loading {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(232, 234, 237, 0.82);
  pointer-events: auto;
}

.stage__plan-loading[hidden] {
  display: none !important;
}

.stage__plan-loading-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  padding: 1.75rem 2.25rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 32px rgba(12, 46, 64, 0.18);
  border: 1px solid rgba(12, 46, 64, 0.12);
  max-width: min(90%, 22rem);
}

.stage__plan-spinner {
  width: 3.5rem;
  height: 3.5rem;
  border: 5px solid rgba(12, 46, 64, 0.14);
  border-top-color: var(--accent, #0c2e40);
  border-radius: 50%;
  animation: stage-plan-spin 0.85s linear infinite;
}

.stage__plan-loading-text {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #1a1d21;
  text-align: center;
  line-height: 1.35;
}

@keyframes stage-plan-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- Floating controls (View switch + Zoom) ---- */
.stage__floating-controls {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0.15rem 0.25rem;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 5px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.13);
  pointer-events: auto;
}

.stage__snap-hint {
  position: absolute;
  left: 0.5rem;
  bottom: 0.5rem;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.35rem 0.55rem;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(27, 94, 75, 0.35);
  border-radius: 5px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.12);
  pointer-events: none;
  font-size: 0.72rem;
  line-height: 1.25;
  color: #1b5e4b;
}
.stage__snap-hint[hidden] {
  display: none !important;
}
.stage__snap-hint.is-snap-off {
  border-color: rgba(180, 35, 24, 0.4);
  color: #8e1b1b;
}
.stage__snap-hint-status {
  font-weight: 700;
}
.stage__snap-hint-detail {
  opacity: 0.85;
}

.overlay-snap-indicator {
  pointer-events: none;
}
.overlay-snap-indicator__ring {
  fill: rgba(255, 255, 255, 0.35);
  stroke: #ef6c00;
}
.overlay-snap-indicator__cross {
  stroke: #ef6c00;
  stroke-linecap: round;
}
.stage__view-btn {
  padding: 0.15rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--border, #bbb);
  background: #fff;
  color: var(--text, #444);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  line-height: 1.3;
}
.stage__view-btn:first-child {
  border-radius: 3px 0 0 3px;
}
.stage__view-btn:nth-child(2) {
  border-radius: 0 3px 3px 0;
  border-left: none;
}
.stage__view-btn.is-active {
  background: var(--bg, #0c2e40);
  color: #fff;
  border-color: var(--bg, #0c2e40);
}
.stage__view-btn:hover:not(.is-active) {
  background: #e8ebed;
}
.stage__controls-sep {
  width: 1px;
  height: 16px;
  margin: 0 0.35rem;
  background: var(--border, #ccc);
}
.stage__coupling-toggle {
  padding: 0.15rem 0.45rem;
  margin: 0 3px 0 0;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.3;
  border: 1px solid var(--border, #bbb);
  border-radius: 3px;
  background: #fff;
  color: var(--text, #444);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.stage__coupling-toggle:hover {
  background: #e8ebed;
}
.stage__coupling-toggle.is-active {
  background: var(--bg, #0c2e40);
  color: #fff;
  border-color: var(--bg, #0c2e40);
}
.stage__milestone-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.7rem;
  height: 1.55rem;
  padding: 0 0.35rem;
  border: 1px solid var(--border, #bbb);
  border-radius: 3px;
  background: #fff;
  color: #1a3a5c;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
}
.stage__milestone-btn:hover {
  background: #e8ebed;
}
.stage__milestone-btn.is-active {
  background: #1a3a5c;
  color: #fff;
  border-color: #1a3a5c;
}
.stage__milestone-btn.is-violated {
  color: #c62828;
  border-color: #c62828;
  background: #ffebee;
}
.stage__milestone-btn.is-violated.is-active {
  background: #c62828;
  color: #fff;
}
.stage__schedule-group-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.7rem;
  height: 1.55rem;
  padding: 0 0.35rem;
  border: 1px solid var(--border, #bbb);
  border-radius: 3px;
  background: #fff;
  color: #1a3a5c;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}
.stage__schedule-group-btn:hover {
  background: #e8ebed;
}
.stage__zoom-btn {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border, #bbb);
  border-radius: 3px;
  background: #fff;
  color: var(--text, #333);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  line-height: 1;
  margin: 0 1px;
}
.stage__zoom-btn:hover {
  background: #e8ebed;
}
.stage__zoom-btn:active {
  background: #d4d8dc;
}
.stage__header-toggle {
  width: 22px;
  height: 22px;
  margin: 0 1px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border, #bbb);
  border-radius: 3px;
  background: #fff;
  color: var(--text, #333);
  cursor: pointer;
  transition: background 0.15s;
  line-height: 1;
  flex-shrink: 0;
}
.stage__header-toggle:hover {
  background: #e8ebed;
}
.stage__header-toggle:active {
  background: #d4d8dc;
}
.app.is-header-collapsed .stage__header-toggle-icon--collapse {
  display: none;
}
.app.is-header-collapsed .stage__header-toggle-icon--expand {
  display: block !important;
}
.app:not(.is-header-collapsed) .stage__header-toggle-icon--expand {
  display: none !important;
}
.stage__zoom-level {
  font-size: 0.68rem;
  font-weight: 600;
  min-width: 2.5em;
  text-align: center;
  color: var(--text, #444);
  user-select: none;
}

/* ---- Balkenplan / Bauzeitplan ---- */
.bar-plan {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border, #d0d4d8);
  border-radius: var(--radius, 4px);
}
.bar-plan__header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #fff;
  border-bottom: 2px solid var(--border, #d0d4d8);
  overflow: visible;
}

.bar-plan__milestone-bar {
  position: relative;
  height: 1.35rem;
  border-bottom: 1px solid var(--border, #d0d4d8);
  background: #f7f9fb;
  overflow: visible;
}
.bar-plan__milestone-diamond {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  border: none;
  background: transparent;
  color: #1a3a5c;
  font-size: 1.7rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  z-index: 2;
}
.bar-plan__milestone-diamond.is-selected {
  color: #0d47a1;
}
.bar-plan__milestone-diamond.is-violated {
  color: #c62828;
}

.bar-plan__milestone-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
.bar-plan__milestone-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 1px solid rgba(26, 58, 92, 0.45);
  transform: translateX(-50%);
}
.bar-plan__milestone-line.is-selected {
  border-left-width: 2px;
  border-left-color: rgba(13, 71, 161, 0.75);
}
.bar-plan__milestone-line.is-violated {
  border-left-width: 2px;
  border-left-color: #c62828;
  border-left-style: dashed;
}

.bar-plan__row.is-milestone-violated .bar-plan__cell--filled {
  outline: 2px solid rgba(198, 40, 40, 0.55);
  outline-offset: -1px;
}

.bar-plan__ms-connectors {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}
.bar-plan__ms-connector {
  position: absolute;
  top: 3px;
  height: 10px;
  box-sizing: border-box;
}
.bar-plan__ms-connector-h {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  border-top: 2px solid var(--ms-link-color, rgba(26, 58, 92, 0.7));
}
.bar-plan__ms-connector-cap {
  position: absolute;
  top: 0;
  width: 0;
  height: 8px;
  border-left: 2px solid var(--ms-link-color, rgba(26, 58, 92, 0.7));
}
.bar-plan__ms-connector.has-cap-start .bar-plan__ms-connector-cap {
  left: 0;
}
.bar-plan__ms-connector.has-cap-end .bar-plan__ms-connector-cap {
  right: 0;
}
.bar-plan__ms-connector.is-violated .bar-plan__ms-connector-h {
  border-top-style: dashed;
}
.bar-plan__ms-connector.is-violated .bar-plan__ms-connector-cap {
  border-left-style: dashed;
}

.bar-plan__header-track {
  position: relative;
}

.bar-plan__row--header-grid {
  min-height: 2.35rem;
  cursor: default;
  border-bottom: none;
}

.bar-plan__row--header-grid:hover {
  background: transparent;
}

.bar-plan__cell--grid {
  position: relative;
  min-height: 2.35rem;
  border-left: 1px solid transparent;
}

.bar-plan__cell--grid.has-grid-line {
  border-left-color: rgba(0, 0, 0, 0.18);
}

.bar-plan__cell--lead-in {
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.02) 3px,
    rgba(0, 0, 0, 0.02) 6px
  );
  pointer-events: none;
}

.bar-plan__body {
  position: relative;
}

/* Volle Grid-Breite (nicht Viewport), damit die Linie mit horizontal scrollt. */
.bar-plan__playhead-layer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  pointer-events: none;
  z-index: 8;
}

.bar-plan__coupling-layer {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 6;
  overflow: visible;
}

.bar-plan__coupling-svg {
  display: block;
  overflow: visible;
}

.bar-plan__coupling-path {
  pointer-events: none;
}

.bar-plan__playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #c62828;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 8;
}

/* Heutiges Kalenderdatum (unabhängig vom Zeitschieber). */
.bar-plan__today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #1565c0;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 7;
}

.bar-plan__today[hidden] {
  display: none !important;
}

.bar-plan__header-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.bar-plan__header-tick {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.bar-plan__header-tick--period {
  top: 0.12rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.44);
}

.bar-plan__header-tick--kw {
  bottom: 0.1rem;
  font-size: 0.58rem;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.38);
}
.bar-plan__group-header {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted, #888);
  background: #f0f1f3;
  border-top: 1px solid var(--border, #d0d4d8);
}
.bar-plan__group-swatch {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
}
.bar-plan__row {
  display: grid;
  align-items: end;
  position: relative;
  min-height: 28px;
  border-bottom: 1px solid #eee;
  cursor: default;
  transition: background 0.1s;
}
.bar-plan__row--selectable .bar-plan__cell--filled {
  cursor: pointer;
}
.bar-plan__row--draggable .bar-plan__cell--filled {
  touch-action: none;
  cursor: grab;
}
.bar-plan__row--dates-locked .bar-plan__cell--filled {
  cursor: pointer;
}
.bar-plan__row--draggable .bar-plan__cell--bar-start {
  cursor: ew-resize;
}
.bar-plan__row--draggable .bar-plan__cell--bar-end {
  cursor: ew-resize;
}
.bar-plan__row.is-bar-dragging .bar-plan__cell--filled {
  cursor: grabbing;
}
.bar-plan__row.is-bar-trimming .bar-plan__cell--filled {
  cursor: ew-resize;
}
.bar-plan__body--dragging {
  user-select: none;
}
.bar-plan__row:hover {
  background: #f5f8f7;
}
.bar-plan__row.is-selected {
  background: #e4f0eb;
}
.bar-plan__row.is-group-mate {
  background: #eef3f8;
  box-shadow: inset 3px 0 0 #2a6f97;
}
.bar-plan__row.is-remembered {
  box-shadow: inset 3px 0 0 #c45c1a;
}
.bar-plan__row.is-remembered.is-selected {
  background: #f5ebe3;
}
.bar-plan__row.is-remembered .bar-plan__cell--filled {
  outline: 1px dashed rgba(196, 92, 26, 0.55);
  outline-offset: -1px;
}
.bar-plan__label-text {
  overflow: visible;
  text-overflow: clip;
  line-height: 1.15;
}
.bar-plan__schedule {
  position: absolute;
  left: 4px;
  top: auto;
  bottom: 0;
  height: 14px;
  line-height: 14px;
  right: auto;
  z-index: 4;
  max-width: calc(100% - 8px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.58rem;
  color: #444;
  pointer-events: none;
}
.bar-plan__row--header {
  cursor: default;
  min-height: 16px;
  align-items: stretch;
  font-weight: 600;
  font-size: 0.6rem;
  color: var(--muted, #888);
  border-bottom: none;
}
.bar-plan__row--header:hover {
  background: transparent;
}
.bar-plan__label {
  position: absolute;
  top: 1px;
  bottom: auto;
  display: flex;
  align-items: flex-start;
  font-size: 0.62rem;
  color: #222;
  white-space: nowrap;
  overflow: visible;
  pointer-events: none;
  z-index: 3;
}
.bar-plan__label.is-locked::after {
  content: none;
}
.bar-plan__lock-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.25rem;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.75;
  pointer-events: auto;
  vertical-align: top;
}
.bar-plan__lock-btn:hover {
  opacity: 1;
}
.bar-plan__cell {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  position: relative;
  z-index: 2;
}
.bar-plan__cell--week {
  font-size: 0.6rem;
  color: var(--muted, #aaa);
  border-right: 1px solid #f0f0f0;
}
.bar-plan__cell--data {
  position: relative;
  height: 14px;
  min-height: 14px;
  align-self: end;
  border-right: 1px solid #f0f0f0;
}
.bar-plan__cell--filled {
  z-index: 2;
}
.bar-plan__cell--bar-start {
  border-top-left-radius: 2px;
  border-bottom-left-radius: 2px;
}
.bar-plan__cell--bar-end {
  border-top-right-radius: 2px;
  border-bottom-right-radius: 2px;
}

.stage__inner {
  position: relative;
  display: block;
  line-height: 0;
  overflow: hidden;
  contain: paint;
}

#planCanvas {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  vertical-align: top;
  pointer-events: none;
  background: #fff;
}

.stage__viewport.is-shape-transfer {
  cursor: crosshair;
}

.stage__viewport.is-georef-realign #planCanvas {
  pointer-events: auto;
  cursor: crosshair;
}

.panel__divider {
  border: none;
  border-top: 1px solid var(--border, #d8dde3);
  margin: 0.75rem 0;
}

.georef-banner[hidden] {
  display: none !important;
}

.georef-banner {
  position: absolute;
  top: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: min(96%, 42rem);
  padding: 0.65rem 0.9rem;
  background: var(--brand-blue);
  border: 2px solid var(--brand-blue-dark);
  border-radius: var(--radius);
  box-shadow:
    0 4px 16px rgba(0, 74, 148, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.12) inset;
  pointer-events: auto;
  color: #fff;
}

.stage-remark-quick[hidden] {
  display: none !important;
}

.stage-remark-quick {
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  bottom: 0.5rem;
  z-index: 15;
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  max-width: min(36rem, calc(100% - 1rem));
  margin-inline: auto;
  padding: 0.45rem 0.7rem;
  background: rgba(255, 250, 235, 0.94);
  border: 1px solid rgba(180, 140, 40, 0.45);
  border-radius: var(--radius, 6px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  pointer-events: none;
  color: #3a3420;
}

.stage-remark-quick__label {
  flex: 0 0 auto;
  margin-top: 0.05rem;
  padding: 0.05rem 0.35rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8a6a12;
  background: rgba(180, 140, 40, 0.15);
  border-radius: 3px;
}

.stage-remark-quick__text {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 4.6em;
  overflow: hidden;
}

.stage-mittelbedarf[hidden] {
  display: none !important;
}

.stage-mittelbedarf {
  position: absolute;
  left: 0.5rem;
  bottom: 0.5rem;
  z-index: 16;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.55rem;
  max-width: min(22rem, calc(100% - 1rem));
  padding: 0.4rem 0.65rem;
  background: rgba(27, 94, 75, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius, 6px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  pointer-events: none;
  color: #fff;
}

.stage-mittelbedarf__label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.85;
}

.stage-mittelbedarf__value {
  font-size: 0.95rem;
  font-weight: 700;
}

.stage-mittelbedarf__meta {
  flex: 1 1 100%;
  font-size: 0.72rem;
  opacity: 0.88;
}

.element-cost-fields {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border, #d8dde3);
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.element-cost-fields .field,
.element-cost-fields input[type="number"] {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.element-cost-fields input[type="number"] {
  width: 100%;
}

.element-cost-stages {
  margin-top: 0.45rem;
  max-width: 100%;
  min-width: 0;
}

.element-cost-stages .field__label,
.element-cost-stages > span.field__label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.element-cost-stages__list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.35rem;
  max-width: 100%;
  min-width: 0;
}

.element-cost-stage-header {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0.35rem;
  max-width: 100%;
  min-width: 0;
  font-size: 0.7rem;
  color: var(--muted, #6a737c);
  padding: 0.1rem 0 0;
}

.element-cost-stage-header__week {
  flex: 0 0 auto;
  width: 3.4rem;
  max-width: 3.4rem;
}

.element-cost-stage-header__amount {
  flex: 1 1 auto;
  min-width: 0;
}

.element-cost-stage-header__actions {
  flex: 0 0 auto;
  width: 1.85rem;
}

.element-cost-stage-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  min-width: 0;
  padding: 0.2rem 0;
  border-bottom: 1px solid var(--border, #e4eaef);
}

.element-cost-stage-row .field {
  margin: 0;
  min-width: 0;
}

.element-cost-stage-row .field--week {
  flex: 0 0 auto;
  width: 3.4rem;
  max-width: 3.4rem;
}

.element-cost-stage-row .field--amount {
  flex: 1 1 auto;
  min-width: 0;
}

.element-cost-stage-row .field span {
  font-size: 0.7rem;
  white-space: nowrap;
}

.element-cost-stage-row .field input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 0.3rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.85rem;
}

.element-cost-stage-row .field--week input {
  /* ~3 digits; hide spinner so the narrow field stays usable */
  appearance: textfield;
  -moz-appearance: textfield;
  text-align: center;
  padding-left: 0.2rem;
  padding-right: 0.2rem;
}

.element-cost-stage-row .field--week input::-webkit-outer-spin-button,
.element-cost-stage-row .field--week input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.element-cost-stage-row__actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  padding-bottom: 0;
}

.element-cost-stage-row__remove {
  min-width: 1.85rem;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  flex-shrink: 0;
}

.georef-banner__text {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.4;
  flex: 1;
  color: #fff;
}

.georef-banner .btn--secondary {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.65);
  color: #fff;
}

.georef-banner .btn--secondary:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: #fff;
  color: #fff;
}

.stage__overlay .georef-marker {
  pointer-events: none;
}

.georef-marker__ring {
  fill: rgba(0, 102, 204, 0.22);
  stroke: var(--brand-blue);
  stroke-width: 2;
}

.georef-marker.is-active .georef-marker__ring {
  fill: rgba(0, 74, 148, 0.35);
  stroke: var(--brand-blue-dark);
  stroke-width: 2.5;
}

.georef-marker__dot {
  fill: var(--brand-blue);
  stroke: #fff;
  stroke-width: 1.5;
}

.georef-marker.is-active .georef-marker__dot {
  fill: var(--brand-blue-dark);
}

.georef-marker__label {
  font-size: 13px;
  font-weight: 600;
  fill: #1a1d21;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 3px;
  stroke-linejoin: round;
}

.stage__overlay {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

.stage__overlay.is-interactive {
  pointer-events: auto;
  cursor: crosshair;
}

.stage__overlay .overlay-el {
  pointer-events: none;
  cursor: default;
}

.stage__overlay .marquee-select {
  pointer-events: none;
}

.stage__overlay .overlay-el > *:not(.overlay-el__geom-hit):not(.overlay-el__hit) {
  pointer-events: none;
}

.stage__overlay .overlay-el__geom-hit,
.stage__overlay .overlay-el__hit {
  pointer-events: all;
  cursor: pointer;
}

.stage__overlay .overlay-el.overlay-el--text {
  pointer-events: none;
}

.stage__overlay .overlay-el.overlay-el--text:not(.is-selected) .overlay-el__geom-hit,
.stage__overlay .overlay-el.overlay-el--text:not(.is-selected) .overlay-el__hit {
  pointer-events: none;
}

.stage__overlay .overlay-el.overlay-el--text.is-selected {
  outline: none;
}

.stage__overlay .overlay-el.is-selected {
  outline: none;
}

.stage__overlay .overlay-el.is-selected.is-locked {
  outline: none;
}

/* Schloss-Symbol am Cursor über fixierten Elementen */
:root {
  --cursor-locked: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'%3E%3Cpath fill='%231a1d21' d='M17 9h-1V7a4 4 0 0 0-8 0v2H7a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-8a2 2 0 0 0-2-2zm-3-2a2 2 0 0 1 4 0v2h-4V7zm5 12H7v-8h12v8z'/%3E%3C/svg%3E")
      10 2,
    not-allowed;
}

.stage__overlay.is-cursor-locked,
.stage__overlay .overlay-el.is-locked .overlay-el__geom-hit,
.stage__overlay .overlay-el.is-locked .overlay-el__hit {
  cursor: var(--cursor-locked);
}

/* Nur Anzeige: Klicks gehen durch, außer wenn ausgewählt */
.stage__overlay .overlay-el.is-display-only:not(.is-selected) {
  pointer-events: none;
}

.stage__overlay .overlay-el.is-display-only:not(.is-selected) .overlay-el__geom-hit,
.stage__overlay .overlay-el.is-display-only:not(.is-selected) .overlay-el__hit {
  pointer-events: none;
}

.stage__overlay .overlay-el.overlay-el--week-context {
  pointer-events: none;
}

.stage__overlay .overlay-el.overlay-el--week-context path,
.stage__overlay .overlay-el.overlay-el--week-context line,
.stage__overlay .overlay-el.overlay-el--week-context rect,
.stage__overlay .overlay-el.overlay-el--week-context circle,
.stage__overlay .overlay-el.overlay-el--week-context polyline,
.stage__overlay .overlay-el.overlay-el--week-context polygon {
  pointer-events: none;
}

.stage__overlay .overlay-el.overlay-el--pinned-offweek {
  pointer-events: none;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.35));
}

.stage__overlay .overlay-el.overlay-el--pinned-offweek path,
.stage__overlay .overlay-el.overlay-el--pinned-offweek line,
.stage__overlay .overlay-el.overlay-el--pinned-offweek rect,
.stage__overlay .overlay-el.overlay-el--pinned-offweek circle,
.stage__overlay .overlay-el.overlay-el--pinned-offweek polyline,
.stage__overlay .overlay-el.overlay-el--pinned-offweek polygon {
  pointer-events: none;
}

.stage__overlay .overlay-el__pinned-arrow {
  pointer-events: none;
}

.stage__overlay .overlay-el__pinned-arrow text {
  pointer-events: none;
  user-select: none;
}

.stage__overlay .overlay-el__remark-badge {
  cursor: pointer;
}

.stage__overlay .overlay-el__remark-badge text {
  pointer-events: none;
  user-select: none;
}

.stage__overlay .overlay-el__measures-plan-label {
  pointer-events: none;
}

.stage__overlay .overlay-el__measures-plan-label--interactive {
  pointer-events: auto;
}

.stage__overlay .overlay-el__measures-plan-label-hit {
  cursor: move;
}

.stage__overlay .overlay-el__measures-plan-label-handle {
  fill: #ffffff;
  stroke: #2d825a;
  stroke-width: 1.5;
  cursor: move;
  pointer-events: none;
}

.stage__overlay .overlay-el__measures-plan-label-text {
  font-weight: 600;
  pointer-events: none;
  user-select: none;
}

.stage__overlay .overlay-el__segment-lengths {
  pointer-events: none;
}

.stage__overlay .overlay-el__segment-length-label {
  fill: #1a1a1a;
  stroke: #ffffff;
  stroke-width: 3px;
  paint-order: stroke fill;
  font-weight: 600;
  pointer-events: none;
  user-select: none;
}

.stage__overlay .overlay-el__info-plan-label--interactive {
  pointer-events: auto;
}

.stage__overlay .overlay-el__info-plan-label-hit {
  cursor: move;
}

.stage__overlay .overlay-el__info-plan-label-handle {
  fill: #ffffff;
  stroke: #2d825a;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  cursor: move;
  pointer-events: none;
}

.stage__overlay .overlay-el__info-plan-label-text {
  fill: #1a1a1a;
  pointer-events: none;
  user-select: none;
  paint-order: stroke fill;
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 3px;
  stroke-linejoin: round;
}

/* Automatischer Kontrast je nach Element-/Füllfarbe */
.stage__overlay .overlay-el__info-plan-label-text.is-on-dark {
  fill: #ffffff;
  stroke: rgba(0, 0, 0, 0.55);
}

.stage__overlay .overlay-el__info-plan-label-text.is-on-light {
  fill: #1a1a1a;
  stroke: rgba(255, 255, 255, 0.85);
}

.stage__overlay .overlay-el__schedule-plan-label {
  pointer-events: none;
}

.stage__overlay .overlay-el__schedule-plan-label--interactive {
  pointer-events: auto;
}

.stage__overlay .overlay-el__schedule-plan-label-hit {
  cursor: move;
}

.stage__overlay .overlay-el__schedule-plan-label-handle {
  fill: #ffffff;
  stroke: #2d825a;
  stroke-width: 1.5;
  cursor: move;
  pointer-events: none;
}

.stage__overlay .overlay-el__schedule-plan-label-text {
  fill: #000000;
  pointer-events: none;
  user-select: none;
  paint-order: stroke fill;
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.stage__overlay .overlay-el.is-remembered-canvas {
  outline: 2px dashed #c45c1a;
  outline-offset: 2px;
}

.stage__overlay .overlay-el.is-remembered-offweek {
  opacity: 0.72;
}

.remember-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.45rem;
  padding: 0.35rem 0.45rem;
  background: rgba(196, 92, 26, 0.08);
  border: 1px solid rgba(196, 92, 26, 0.28);
  border-radius: 4px;
}

.remember-bar__count {
  flex: 1 1 auto;
  font-size: 0.78rem;
  font-weight: 600;
  color: #9a4a14;
  font-variant-numeric: tabular-nums;
}

.remember-bar__hint {
  margin-top: -0.15rem;
}

.remember-bar__hint kbd {
  font-size: 0.72em;
  padding: 0.05em 0.3em;
  border: 1px solid var(--border, #ccc);
  border-radius: 3px;
  background: #f5f5f5;
}

.stage__overlay .overlay-el__symbol-missing-label {
  font-size: 11px;
  fill: #b42318;
  pointer-events: none;
  user-select: none;
}

.symbol-element-panel__warn {
  color: var(--danger);
}

.symbol-rotation-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

.symbol-rotation-controls output {
  min-width: 2.75rem;
  font-variant-numeric: tabular-nums;
}

.symbol-rotation-input {
  width: 4.5rem;
  padding: 0.2rem 0.35rem;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: inherit;
}

.rotation-handle-layer__stem {
  stroke: #1b5e4b;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.rotation-handle-layer .rotation-handle {
  fill: #fff;
  stroke: #1b5e4b;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  pointer-events: all;
}

.rotation-handle-layer .rotation-handle:active {
  cursor: grabbing;
}

.symbol-crop-handle-layer {
  pointer-events: none;
}

.symbol-crop-handle {
  fill: #fff7ed;
  stroke: #c2410c;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  pointer-events: all;
}

.symbol-crop-handle:active {
  fill: #ffedd5;
}

#stylePanel.is-hidden-for-symbol .panel__body {
  opacity: 0.45;
  pointer-events: none;
}

.text-style-fields[hidden],
#shapeStyleFields[hidden] {
  display: none !important;
}

.style-family-footer {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.style-family-panel {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.style-family-panel[hidden] {
  display: none !important;
}

.style-family-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 9rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.style-family-list:empty::after {
  content: "Noch keine Stil-Familien";
  display: block;
  padding: 0.55rem 0.65rem;
  font-size: 0.78rem;
  color: var(--muted, #6a7570);
}

.style-family-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  width: 100%;
  margin: 0;
  padding: 0.4rem 0.55rem;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  font: inherit;
  font-size: 0.8rem;
  text-align: left;
  color: var(--text);
  cursor: pointer;
}

.style-family-list__item:last-child {
  border-bottom: none;
}

.style-family-list__item:hover {
  background: rgba(0, 102, 204, 0.06);
}

.style-family-list__item.is-active {
  background: var(--brand-blue-light, rgba(0, 102, 204, 0.12));
  color: var(--brand-blue-dark, #004a99);
  font-weight: 600;
}

.style-family-list__count {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted, #6a7570);
  font-variant-numeric: tabular-nums;
}

.style-family-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

#btnStyleFamilyAddMembers.is-active {
  background: var(--brand-blue, #0066cc);
  color: #fff;
  border-color: var(--brand-blue, #0066cc);
}

.stage__overlay .overlay-el.is-style-family-canvas {
  outline: 2px dashed #2a6f97;
  outline-offset: 2px;
}

.stage__overlay .overlay-el.is-style-family-offweek {
  opacity: 0.72;
}

.stage__viewport.is-style-family-pick {
  cursor: copy;
}

.text-style-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.text-style-toggle {
  min-width: 2rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font: inherit;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
}

.text-style-toggle:hover {
  border-color: var(--brand-blue);
  color: var(--brand-blue-dark);
}

.text-style-toggle.is-active {
  border-color: var(--brand-blue);
  background: var(--brand-blue-light);
  color: var(--brand-blue-dark);
}

.text-style-toggle__u {
  text-decoration: underline;
}

.field__label-block {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.stage__overlay .overlay-el__text {
  pointer-events: none;
}

.stage__overlay .overlay-el__text {
  pointer-events: none;
}

.stage__overlay .overlay-el__hit {
  pointer-events: all;
}

.stage__viewport.is-info-mode
  .stage__overlay
  .overlay-el.has-info:not(.is-locked)
  .overlay-el__geom-hit,
.stage__viewport.is-info-mode
  .stage__overlay
  .overlay-el.has-info:not(.is-locked)
  .overlay-el__hit {
  cursor: help;
}

.info-tooltip {
  position: fixed;
  z-index: 30;
  max-width: min(360px, calc(100vw - 24px));
  padding: 0.55rem 0.75rem;
  background: rgba(26, 29, 33, 0.94);
  color: #fff;
  font-size: 0.85rem;
  line-height: 1.45;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
  pointer-events: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.access-tooltip {
  z-index: 10050;
  background: rgba(110, 36, 36, 0.95);
  font-weight: 600;
  white-space: nowrap;
}

.info-mode-indicator {
  position: absolute;
  bottom: 0.65rem;
  right: 0.65rem;
  padding: 0.3rem 0.65rem;
  background: rgba(27, 94, 75, 0.92);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 6px;
  pointer-events: none;
  z-index: 2;
}

.panel__meta {
  margin: 0 0 0.55rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.panel__hint,
.panel__selection {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.panel__selection {
  font-weight: 500;
  color: var(--text);
}

.panel__weeks {
  color: var(--accent);
}

.stage__time {
  position: absolute;
  top: 0.65rem;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  padding: 0.4rem 0.9rem;
  background: rgba(44, 62, 80, 0.55);
  color: #fff;
  border-radius: 6px;
  pointer-events: none;
  z-index: 2;
}

.stage__kw {
  display: block;
  font-size: 1.2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stage__sub {
  display: none;
}

.stage__preset-range-hint {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #2563eb;
  margin-top: 0.15rem;
}

.timeline {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.timeline__block {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
  position: relative;
}

.timeline__block--element {
  padding-top: 0.65rem;
  border-top: 1px dashed var(--border);
}

.timeline__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.timeline__header-start {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
  flex-shrink: 0;
}

.timeline__label {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
}

.timeline__week-controls {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}

.timeline__week-controls--lead {
  margin-right: 0;
}

.timeline__display-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin: 0;
}

.timeline__display-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: rgba(0, 0, 0, 0.55);
  white-space: nowrap;
}

.timeline__display-label-text {
  font-weight: 600;
}

.timeline__display-select {
  font-size: 0.72rem;
  padding: 0.12rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: inherit;
  max-width: 9.5rem;
}

/* TIME_VIEWPORT — Zoom/Pan (rückbaubar) */
.timeline__viewport-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.15rem;
}

.timeline__viewport-zoom-label {
  min-width: 2.1rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: rgba(0, 0, 0, 0.65);
}

.timeline__viewport-reset {
  margin-left: 0.15rem;
  padding: 0.1rem 0.4rem;
  font-size: 0.68rem;
  line-height: 1.2;
}

.timeline__track-canvas {
  position: relative;
  width: 100%;
  min-width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  min-height: inherit;
}

.timeline__track-wrap--element .timeline__track-canvas {
  align-items: stretch;
  height: 100%;
}

body.time-viewport-zoomed .timeline__track-wrap[data-time-viewport-scroll] {
  /* Terminplan oben: mitlaufen, aber keine eigene Scrollleiste */
  overflow-x: hidden;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
}

body.time-viewport-zoomed .timeline__track-wrap--element[data-time-viewport-scroll] {
  /* Elementterminplan: Scrollleiste unten, ohne die Außenhöhe zu vergrößern */
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  /* Platz für die Leiste innerhalb der bestehenden min-height (kein Wachsen) */
  padding-bottom: 0;
  box-sizing: border-box;
}

/* Balken/Griffe sitzen oberhalb der Scrollleisten-Zone */
body.time-viewport-zoomed .timeline__track-wrap--element .timeline__track-canvas {
  padding-bottom: 14px;
  box-sizing: border-box;
}

body.time-viewport-zoomed .timeline__track-wrap--element .family-timeline,
body.time-viewport-zoomed .timeline__track-wrap--element .family-timeline__track {
  /* Höhe der Spur behalten — sonst kollabiert die Marker-Positionierung */
  min-height: 3.85rem;
  height: 100%;
  box-sizing: border-box;
}

body.time-viewport-zoomed .timeline__track-wrap--element .family-timeline__bar,
body.time-viewport-zoomed .timeline__track-wrap--element .family-timeline__context-bar {
  /* etwas nach oben, klar über der Scrollleiste (Marker bewusst nicht hier) */
  top: calc(50% - 5px);
}

body.time-viewport-zoomed .timeline__track-canvas[data-time-viewport-canvas] {
  width: calc(100% * var(--time-viewport-zoom, 1));
  min-width: calc(100% * var(--time-viewport-zoom, 1));
}

body.time-viewport-zoomed .bar-plan {
  /* horizontal + vertical scroll; scrollLeft sync via JS */
}

body.time-viewport-zoomed .bar-plan__header-track,
body.time-viewport-zoomed .bar-plan__row,
body.time-viewport-zoomed .bar-plan__group-header {
  box-sizing: border-box;
}

.timeline__week-btn {
  width: 1rem;
  height: 1rem;
  padding: 0;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  border-radius: 3px;
  background: #9aa3a0;
  border-color: #8a9390;
  color: #fff;
}

.timeline__week-btn:hover:not(:disabled) {
  background: #6e7875;
  border-color: #5e6865;
}

.timeline__week-btn:disabled {
  background: #c8cdcb;
  border-color: #c8cdcb;
  opacity: 0.6;
}

/* Terminplan-Slider und Elementterminplan immer gleiche Spurbreite */
.timeline__track-wrap {
  position: relative;
  min-height: 3.5rem;
  display: flex;
  align-items: center;
}

.timeline__track-wrap--element {
  min-height: 3.85rem;
  overflow: visible;
  align-items: stretch;
}

.timeline__track-wrap--element .family-timeline,
.timeline__track-wrap--element .family-timeline__track {
  min-height: 3.85rem;
}

.timeline__track-wrap--element .family-timeline {
  height: 100%;
}

.timeline__watermarks {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.timeline__watermarks * {
  pointer-events: none;
}

.timeline-wm__tick {
  position: absolute;
  top: 0;
  bottom: 0;
  transform: translateX(-50%);
  width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

[data-timeline-watermarks="labels"] .timeline-wm__tick--terminplan {
  justify-content: flex-start;
}

[data-timeline-watermarks="lines"] .timeline-wm__tick--element {
  justify-content: flex-end;
}

.timeline-wm__line {
  position: absolute;
  top: 0.35rem;
  bottom: 0.35rem;
  left: 0;
  width: 1px;
  background: rgba(0, 0, 0, 0.2);
}

.timeline-wm__label {
  position: relative;
  z-index: 1;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  color: rgba(0, 0, 0, 0.44);
  white-space: nowrap;
  padding-top: 0.05rem;
}

[data-timeline-watermarks="lines"] .timeline-wm__label,
[data-timeline-watermarks="lines"] .timeline-wm__kw {
  display: none;
}

.timeline-wm__week-num {
  position: relative;
  z-index: 1;
  margin-top: auto;
  font-size: 0.52rem;
  font-weight: 500;
  line-height: 1.1;
  color: rgba(0, 0, 0, 0.34);
  white-space: nowrap;
  padding-bottom: 0.12rem;
  font-variant-numeric: tabular-nums;
}

.timeline-wm__week-num.is-plot-point {
  color: #1b7a3d;
  font-weight: 700;
}

.timeline-wm__plot-mark {
  position: absolute;
  bottom: 0.02rem;
  left: 50%;
  transform: translateX(-50%);
  width: 2.5px;
  height: 2.5px;
  border-radius: 50%;
  background: #1b7a3d;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85);
  z-index: 2;
}

.timeline-wm__tick--terminplan.is-plot-point .timeline-wm__week-num {
  padding-bottom: 0.22rem;
}

.stage__kw-badge.is-plot-point {
  box-shadow:
    0 0 0 2px #1b7a3d,
    0 1px 5px rgba(0, 0, 0, 0.2);
}

.stage__kw-badge.is-plot-point .stage__kw {
  color: #fff;
}

.timeline__out.is-plot-point {
  color: #1b7a3d;
}

.timeline-wm__kw {
  position: relative;
  z-index: 1;
  font-size: 0.58rem;
  font-weight: 500;
  line-height: 1.1;
  color: rgba(0, 0, 0, 0.38);
  white-space: nowrap;
  padding-bottom: 0.1rem;
}

.timeline-wm__date {
  position: relative;
  z-index: 1;
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.15;
  color: rgba(0, 0, 0, 0.36);
  white-space: nowrap;
  margin-bottom: 0.06rem;
}

.timeline__track-input {
  display: block;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  position: relative;
  z-index: 1;
  background: transparent;
}

/* Lead-in: Slider nur über dem Bauwochen-Bereich der gemeinsamen Zeitskala */
.timeline__track-input.is-lead-in-aligned {
  position: absolute;
  left: var(--timeline-cal-left, 0%);
  width: var(--timeline-cal-width, 100%);
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
}

.timeline__track-input:focus {
  outline: none;
}

.timeline__range-overlay {
  position: absolute;
  top: 0.4rem;
  bottom: 0.4rem;
  background: rgba(37, 99, 235, 0.18);
  border: 1.5px solid rgba(37, 99, 235, 0.5);
  border-radius: 3px;
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.15s;
}

.timeline__range-badge {
  position: absolute;
  top: -1.4rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.68rem;
  font-weight: 600;
  color: #1d4ed8;
  white-space: nowrap;
  pointer-events: none;
}

.panel__family {
  margin: -0.25rem 0 0.55rem;
  font-size: 0.75rem;
  color: var(--accent);
  line-height: 1.4;
}

.panel__family a {
  color: inherit;
  font-weight: 600;
}

.element-search {
  margin-bottom: 0.65rem;
}

.element-search__field {
  margin-bottom: 0.45rem;
}

.element-search__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}

.element-search__status {
  flex: 1 1 auto;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  min-width: 4.5rem;
}

.element-catalog__list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: min(42vh, 16rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  margin-top: 0.35rem;
}

.element-catalog__row {
  display: flex;
  align-items: stretch;
  gap: 0.25rem;
}

.element-catalog__empty {
  margin: 0.35rem 0 0;
}

.element-catalog__item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--text);
}

.element-catalog__actions {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1.55rem 1.55rem;
  grid-template-rows: 1fr 1fr;
  gap: 0.2rem;
  align-self: stretch;
}

.element-catalog__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.element-catalog__action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.element-catalog__remark:hover:not(:disabled) {
  border-color: var(--brand-blue);
  background: var(--brand-blue-light);
  color: var(--brand-blue-dark);
}

.element-catalog__remark.has-remark {
  border-color: var(--danger);
  background: rgba(180, 35, 24, 0.08);
  color: var(--danger);
}

.element-catalog__remark.has-remark:hover:not(:disabled) {
  border-color: var(--danger);
  background: rgba(180, 35, 24, 0.14);
  color: var(--danger);
}

.element-catalog__delete:hover:not(:disabled) {
  border-color: #c0392b;
  background: rgba(192, 57, 43, 0.08);
  color: #c0392b;
}

.element-catalog__bzp:hover:not(:disabled) {
  border-color: var(--brand-blue);
  background: var(--brand-blue-light);
  color: var(--brand-blue-dark);
}

.element-catalog__bzp.is-hidden-in-bzp {
  border-color: #8a6d3b;
  background: rgba(138, 109, 59, 0.12);
  color: #6b5328;
  opacity: 0.85;
}

.element-catalog__bzp.is-hidden-in-bzp:hover:not(:disabled) {
  background: rgba(138, 109, 59, 0.2);
}

.element-catalog__placeholder {
  opacity: 0.35;
}

.element-catalog__row:has(.element-catalog__item.is-selected) .element-catalog__delete,
.element-catalog__row:has(.element-catalog__item.is-selected) .element-catalog__remark:not(.has-remark),
.element-catalog__row:has(.element-catalog__item.is-selected) .element-catalog__bzp:not(.is-hidden-in-bzp):not(:disabled) {
  border-color: var(--brand-blue);
}

.element-catalog__item:hover {
  border-color: var(--brand-blue);
  background: var(--brand-blue-light);
}

.element-catalog__item.is-selected {
  border-color: var(--brand-blue);
  background: var(--brand-blue-light);
  box-shadow: inset 0 0 0 1px rgba(0, 102, 204, 0.25);
}

.element-catalog__item.is-hidden-on-plan {
  color: #7a8480;
  background: #f3f5f4;
  border-style: dashed;
}

.element-catalog__item.is-hidden-on-plan .element-catalog__label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.element-catalog__hidden-icon {
  flex: 0 0 auto;
  display: inline-flex;
  color: #6a7570;
  opacity: 0.9;
}

.element-catalog__item.is-hidden-on-plan.is-selected {
  background: rgba(90, 107, 100, 0.12);
  border-color: #5a6b64;
  box-shadow: inset 0 0 0 1px rgba(90, 107, 100, 0.25);
}

.element-catalog__item.has-remark {
  border-color: rgba(180, 35, 24, 0.45);
  background: rgba(180, 35, 24, 0.06);
  color: var(--danger);
}

.element-catalog__item.has-remark .element-catalog__label {
  color: var(--danger);
}

.element-catalog__item.has-remark .element-catalog__meta {
  color: rgba(180, 35, 24, 0.75);
}

.element-catalog__item.has-remark:hover {
  border-color: var(--danger);
  background: rgba(180, 35, 24, 0.1);
}

.element-catalog__item.has-remark.is-selected {
  border-color: var(--danger);
  background: rgba(180, 35, 24, 0.12);
  box-shadow: inset 0 0 0 1px rgba(180, 35, 24, 0.28);
}

.element-catalog__label {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.25;
  word-break: break-word;
}

.element-catalog__meta {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.2;
}

/* Notiz / Frage zum Vorgang (ABC-Liste) */
.remark-dialog {
  width: min(420px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

.remark-dialog::backdrop {
  background: rgba(26, 29, 33, 0.45);
}

.remark-dialog__form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
  padding: 1.1rem 1.25rem 1.15rem;
}

.remark-dialog__header {
  margin: 0;
}

.remark-dialog__title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}

.remark-dialog__lead {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

.remark-dialog__element {
  margin: 0.45rem 0 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.remark-dialog__field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.remark-dialog__label {
  font-size: 0.8rem;
  font-weight: 600;
}

.remark-dialog__input {
  width: 100%;
  min-height: 7.5rem;
  resize: vertical;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  line-height: 1.4;
  color: var(--text);
  background: #fff;
}

.remark-dialog__input:focus {
  outline: 2px solid rgba(0, 102, 204, 0.35);
  border-color: var(--brand-blue);
}

.remark-dialog__input:disabled {
  opacity: 0.7;
  background: #f5f5f5;
}

.remark-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 0.15rem 0 0;
  padding: 0;
  list-style: none;
}

.remark-dialog__actions-spacer {
  flex: 1 1 auto;
  min-width: 0.5rem;
}

.family-timeline {
  min-width: 0;
}

.family-timeline__track {
  position: relative;
  height: 3.35rem;
  touch-action: none;
  cursor: default;
  overflow: visible;
}

.family-timeline__coupling-strip {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1.35rem;
  z-index: 6;
  pointer-events: none;
  overflow: visible;
}

.family-timeline__bar-caption-wrap {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}

.family-timeline__bar-caption {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  color: #1e2a26;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.family-timeline__pin-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid rgba(88, 96, 92, 0.35);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.85);
  color: #8a9590;
  cursor: pointer;
  pointer-events: auto;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.family-timeline__pin-btn:hover {
  color: #1e2a26;
  background: #e8ecea;
  border-color: #1e2a26;
}

.family-timeline__pin-btn.is-pinned {
  color: #d44;
  background: rgba(221, 68, 68, 0.1);
  border-color: #d44;
}

.family-timeline__pin-btn.is-pinned:hover {
  color: #a22;
  background: rgba(170, 34, 34, 0.15);
  border-color: #a22;
}

.family-timeline__bar-caption.is-placeholder {
  font-weight: 500;
  color: #8a9590;
  letter-spacing: 0.12em;
}

.family-timeline__track.is-dragging {
  cursor: grabbing;
}

.family-timeline__rail {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.45rem;
  height: 0.45rem;
  background: #e8ecea;
  border-radius: 4px;
  border: 1px solid var(--border);
  overflow: visible;
}

.family-timeline__context {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.family-timeline__context-bar {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 1.35rem;
  min-width: 8px;
  box-sizing: border-box;
  background: rgba(118, 126, 122, 0.28);
  border: 1px solid rgba(88, 96, 92, 0.35);
  border-radius: 4px;
  pointer-events: auto;
  cursor: pointer;
}

.family-timeline__context-bar:hover {
  filter: brightness(1.08);
  z-index: 5;
}

.family-timeline__context-bar--multi-selected {
  height: 1.25rem;
  z-index: 2;
  border-width: 2px;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.family-timeline__context-bar--multi-selected:hover {
  filter: brightness(1.06);
  z-index: 5;
}

.family-timeline__context-bar--multi-selected.family-timeline__context-bar--is-active {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85);
  z-index: 4;
}

.family-timeline__context-bar--pinned {
  height: 1.35rem;
  z-index: 7;
  border-width: 2px;
  border-style: solid;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.55);
  overflow: visible;
}

.family-timeline__context-bar--pinned:hover {
  filter: brightness(1.1);
  z-index: 8;
}

.family-timeline__context-bar--ghost:not(.family-timeline__context-bar--pinned) {
  height: 0.72rem;
  top: calc(50% + 0.55rem);
  transform: translateY(-50%);
  background: rgba(118, 126, 122, 0.12);
  border: 1.5px dashed rgba(88, 96, 92, 0.55);
  border-radius: 3px;
  opacity: 0.85;
  z-index: 1;
  box-shadow: none;
}

.family-timeline__context-bar--ghost.family-timeline__context-bar--pinned {
  border-style: dashed;
  opacity: 0.78;
}

.family-timeline__context-bar--ghost:hover {
  opacity: 1;
  filter: none;
  z-index: 6;
}

.family-timeline__ghost-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.family-timeline__ghost-dot {
  position: absolute;
  bottom: 0.15rem;
  transform: translateX(-50%);
  width: 9px;
  height: 9px;
  margin: 0;
  padding: 0;
  border: 1.5px solid #fff;
  border-radius: 50%;
  background: var(--ghost-dot-color, #6b7280);
  box-shadow: 0 0 0 1px rgba(40, 48, 44, 0.35);
  cursor: pointer;
  pointer-events: auto;
}

.family-timeline__ghost-dot:hover {
  transform: translateX(-50%) scale(1.2);
}

.family-timeline__bar.is-ghost .family-timeline__bar-body {
  opacity: 0.45;
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 3px,
    rgba(255, 255, 255, 0.35) 3px,
    rgba(255, 255, 255, 0.35) 6px
  );
}

.family-timeline__bar.is-ghost .family-timeline__handle {
  opacity: 0.7;
  border-style: dashed;
}

.family-timeline__pinned-label {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 3px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  pointer-events: auto;
  z-index: 6;
}

.family-timeline__pinned-label-text {
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.2;
  color: #1e2a26;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.family-timeline__bar.is-multi-primary {
  z-index: 6;
  pointer-events: none;
}

.family-timeline__bar.is-multi-primary .family-timeline__bar-body,
.family-timeline__bar.is-multi-primary .family-timeline__handle {
  pointer-events: auto;
}

.family-timeline__bar.is-multi-primary .family-timeline__bar-body {
  cursor: grab;
}

.family-timeline__track.is-dragging .family-timeline__bar.is-multi-primary .family-timeline__bar-body {
  cursor: grabbing;
}

/* Bei Ketten-/Mehrfachauswahl Text ausblenden, Pin am Primärbalken behalten */
.family-timeline__bar.is-multi-primary .family-timeline__bar-caption {
  display: none;
}

.family-timeline__bar.is-multi-primary .family-timeline__bar-caption-wrap {
  display: flex;
}

.family-timeline__today {
  position: absolute;
  top: 50%;
  bottom: auto;
  left: 0;
  width: 1px;
  height: 2.15rem;
  margin-left: 0;
  transform: translate(-50%, -50%);
  background: #1565c0;
  border-radius: 0;
  pointer-events: none;
  z-index: 7;
  box-shadow: none;
}

.family-timeline__today[hidden] {
  display: none !important;
}

.family-timeline__marker {
  position: absolute;
  top: 50%;
  bottom: auto;
  left: 0;
  width: 2px;
  height: 2.15rem;
  margin-left: 0;
  transform: translate(-50%, -50%);
  /* Terminschieber: rot gestrichelt (wie Bauzeitplan-Playhead, gestrichelt) */
  background: repeating-linear-gradient(
    to bottom,
    #c62828 0 3px,
    transparent 3px 6px
  );
  border-radius: 1px;
  pointer-events: none;
  z-index: 8;
  box-shadow: none;
}

/* Zoom: gleicher Vertikalversatz wie die Balken */
body.time-viewport-zoomed .timeline__track-wrap--element .family-timeline__today,
body.time-viewport-zoomed .timeline__track-wrap--element .family-timeline__marker {
  top: calc(50% - 5px);
  bottom: auto;
  height: 2.15rem;
  transform: translate(-50%, -50%);
}

.family-timeline__bar {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 1.35rem;
  z-index: 2;
  min-width: 8px;
  overflow: visible;
  box-sizing: border-box;
}

.family-timeline__dates-lock {
  position: absolute;
  left: 50%;
  top: -0.55rem;
  z-index: 12;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  padding: 0;
  border: 1.5px solid #fff;
  border-radius: 999px;
  background: #1a1a1a;
  color: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  transform: translate(-50%, -100%);
  cursor: pointer;
  line-height: 0;
}

.family-timeline__dates-lock:hover {
  background: #333;
  color: #fff;
}

.family-timeline__dates-lock:focus-visible {
  outline: 2px solid var(--accent, #0c2e40);
  outline-offset: 2px;
}

.family-timeline__context-bar.is-dates-locked,
.family-timeline__bar.is-dates-locked {
  overflow: visible;
}

.family-timeline__bar-body {
  display: block;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  background: rgba(27, 94, 75, 0.55);
  border: 2px solid var(--accent);
  border-radius: 4px;
  cursor: grab;
}

.family-timeline__track.is-dragging .family-timeline__bar-body {
  cursor: grabbing;
}

.family-timeline__handle {
  position: absolute;
  top: 50%;
  z-index: 9;
  width: 12px;
  height: 1.35rem;
  margin: 0;
  padding: 0;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--accent);
  background: var(--accent);
  cursor: ew-resize;
  border-radius: 3px;
  transform: translate(-50%, -50%);
}

.family-timeline__kw-drag-label {
  position: absolute;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  z-index: 6;
  padding: 0.28rem 0.65rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: #fff;
  background: var(--accent, #0c2e40);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  white-space: nowrap;
}

.family-timeline__duration-drag-label {
  z-index: 5;
}

.family-timeline__bar-caption-wrap.is-duration-drag-hidden {
  visibility: hidden;
}

.family-timeline__handle--start {
  left: 0;
}

.family-timeline__handle--end {
  left: 100%;
}

.family-timeline__handle:hover {
  filter: brightness(1.08);
}

.family-timeline__track.is-range-locked .family-timeline__bar-body,
.family-timeline__track.is-range-locked .family-timeline__handle {
  cursor: not-allowed;
}

.family-timeline__track.is-range-locked .family-timeline__bar-body {
  opacity: 0.72;
}

.family-timeline__track.is-range-locked .family-timeline__handle:disabled {
  opacity: 0.65;
}

.family-timeline__coupling {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.family-timeline__coupling-point {
  position: absolute;
  bottom: 0;
  transform: translateX(-50%);
  width: 18px;
  height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: ew-resize;
  pointer-events: auto;
  color: #111;
}

.family-timeline__coupling-point.is-locked {
  cursor: not-allowed;
  opacity: 0.72;
}

.family-timeline__coupling-point.is-active {
  z-index: 7;
}

.family-timeline__coupling-point.is-active .family-timeline__coupling-icon {
  /* gleiche Größe wie inaktiv — nur Ringfarbe/Kontrast, kein dickerer Schatten */
  box-shadow: 0 0 0 1px #fff, 0 0 0 2px #111, 0 1px 5px rgba(0, 0, 0, 0.2);
  outline: 1px solid #111;
  outline-offset: 1px;
}

.family-timeline__coupling-icon {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translate(-50%, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.05rem;
  height: 1.05rem;
  min-width: 1.05rem;
  min-height: 1.05rem;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 1px #fff, 0 0 0 2px #111, 0 1px 5px rgba(0, 0, 0, 0.2);
  color: #111;
  box-sizing: border-box;
}

.family-timeline__coupling-stem {
  position: absolute;
  left: 50%;
  bottom: -0.32rem;
  width: 2px;
  height: 0.32rem;
  transform: translateX(-50%);
  background: #111;
  border-radius: 1px;
  pointer-events: none;
}

.family-timeline__track.is-dragging-coupling .family-timeline__coupling-point {
  cursor: grabbing;
}

.family-timeline__context-bar--coupling-active {
  z-index: 4;
  border-style: solid !important;
}

.family-timeline__coupled-end.is-emphasized {
  width: 12px;
  height: 12px;
  margin-top: -6px;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #111;
}

.family-timeline__handle.is-coupling-highlight {
  width: 14px;
  height: 1.55rem;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #111 !important;
  z-index: 5;
}

.family-timeline__handle.is-coupled:not(:disabled) {
  cursor: ew-resize;
}

.family-timeline__handle.is-coupled:disabled {
  cursor: not-allowed;
}

.family-timeline__coupled-end {
  position: absolute;
  top: 50%;
  z-index: 3;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-radius: 999px;
  background: var(--end-fill-color, #888888);
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px #111;
  pointer-events: none;
}

.family-timeline__coupled-end--start {
  transform: translateX(-50%);
}

.family-timeline__coupled-end--end {
  transform: translateX(-50%);
}

.timeline__coupling-btn {
  margin-left: auto;
  padding: 0.22rem 0.65rem;
  border: 1px solid #c62828;
  border-radius: 4px;
  background: rgba(198, 40, 40, 0.08);
  color: #c62828;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.timeline__coupling-btn:hover {
  background: rgba(198, 40, 40, 0.16);
  color: #b71c1c;
}

.element-kw-dialog {
  border: none;
  border-radius: 10px;
  padding: 0;
  max-width: min(96vw, 32rem);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}

.element-kw-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.element-kw-dialog__form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.1rem 1.2rem 0.9rem;
}

.element-kw-dialog__title {
  margin: 0;
  font-size: 1.05rem;
}

.element-kw-dialog__lead {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--muted, #5a6b64);
}

.element-kw-dialog__week-range {
  display: flex;
  flex-wrap: nowrap;
  gap: 1.25rem;
  align-items: flex-end;
}

.element-kw-dialog__pair {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.65rem;
  align-items: flex-end;
}

.element-kw-dialog__range-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.82rem;
  color: var(--muted, #5a6b64);
}

.element-kw-dialog__range-field input {
  width: 4.5rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border, #c5d0cb);
  border-radius: 6px;
  font-size: 0.95rem;
}

.element-kw-dialog__range-field--year input {
  width: 5.25rem;
}

.element-kw-dialog__hint {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--muted, #5a6b64);
}

.element-kw-dialog__error {
  margin: 0;
  font-size: 0.82rem;
  color: #a11;
}

.element-kw-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
}

.coupling-dialog {
  border: none;
  border-radius: 10px;
  padding: 0;
  max-width: min(92vw, 28rem);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}

.coupling-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.coupling-dialog__form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.1rem 1.2rem 0.75rem;
}

.coupling-manage-dialog__inner {
  display: flex;
  flex-direction: column;
}

.coupling-dialog__title {
  margin: 0;
  font-size: 1.15rem;
}

.coupling-dialog__lead {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: #334;
}

.coupling-dialog__status {
  margin: 0.55rem 0 0;
  padding: 0.45rem 0.55rem;
  font-size: 0.82rem;
  line-height: 1.4;
  color: #1b3a2f;
  background: #eef6f2;
  border: 1px solid #c5ddd2;
  border-radius: 6px;
}

.coupling-dialog__status[hidden] {
  display: none;
}

.coupling-dialog__list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 50vh;
  overflow: auto;
}

.coupling-dialog__group-note {
  margin: 0;
  padding: 0.35rem 0.55rem 0.35rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #333;
  border-left: 4px solid var(--coupling-color, #e65100);
  background: color-mix(in srgb, var(--coupling-color, #e65100) 12%, #fff);
  border-radius: 0 6px 6px 0;
}

.coupling-dialog__element {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 6px;
  border-left-width: 4px;
  border-left-color: rgba(0, 0, 0, 0.18);
}

.coupling-dialog__element--new {
  border-left-color: #2e7d32;
  background: #f7fbf7;
}

.coupling-dialog__element--coupled {
  border-left-color: #e65100;
  background: #fff8f3;
}

.coupling-dialog__element--partial {
  border-left-color: #f9a825;
  background: #fffdf5;
}

.coupling-dialog__legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  padding: 0 0.25rem;
  font-weight: 600;
}

.coupling-dialog__legend-title {
  min-width: 0;
}

.coupling-dialog__badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  border: 1px solid transparent;
}

.coupling-dialog__badge--new {
  color: #1b5e20;
  background: #e8f5e9;
  border-color: #a5d6a7;
}

.coupling-dialog__badge--coupled {
  color: #bf360c;
  background: #fbe9e7;
  border-color: #ffab91;
}

.coupling-dialog__badge--partial {
  color: #e65100;
  background: #fff3e0;
  border-color: #ffcc80;
}

.coupling-dialog__edges {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.25rem;
  padding-left: 0.15rem;
}

.coupling-dialog__option {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.2rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.coupling-dialog__swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.coupling-dialog__option--free .coupling-dialog__swatch {
  border-style: dashed;
}

.coupling-dialog__option--coupled {
  padding: 0.2rem 0.35rem;
  margin-left: 0.1rem;
  border-radius: 4px;
  background: color-mix(in srgb, var(--coupling-color, #e65100) 14%, #fff);
  border-left: 3px solid var(--coupling-color, #e65100);
  cursor: default;
}

.coupling-dialog__option--coupled .coupling-dialog__option-text {
  font-weight: 600;
  color: #333;
}

.coupling-dialog__option--linked-group {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--coupling-color, #e65100) 35%, transparent);
}

.coupling-dialog__option input:disabled {
  accent-color: var(--coupling-color, #e65100);
}

.coupling-dialog__option--free:has(input:disabled) {
  opacity: 0.55;
  cursor: not-allowed;
}

.coupling-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
}

.coupling-dialog__actions button {
  padding: 0.35rem 0.85rem;
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  background: #fff;
  cursor: pointer;
}

.coupling-dialog__actions #couplingDialogCreate {
  background: var(--accent, #0c2e40);
  border-color: var(--accent, #0c2e40);
  color: #fff;
  font-weight: 600;
}

.coupling-dialog__actions.coupling-manage__actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: stretch;
  gap: 0.5rem;
  width: 100%;
  box-sizing: border-box;
  padding: 0 1.2rem 1rem;
}

.coupling-dialog__actions.coupling-manage__actions button {
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.02);
  font-size: 0.88rem;
  line-height: 1.35;
  text-align: center;
}

.coupling-dialog__actions.coupling-manage__actions button[type="submit"] {
  color: inherit;
}

.coupling-dialog__actions.coupling-manage__actions button[type="submit"]:hover {
  background: rgba(0, 0, 0, 0.05);
}

.coupling-dialog__actions.coupling-manage__actions .coupling-manage__disconnect-all {
  background: #fff !important;
  border-color: #b71c1c !important;
  color: #b71c1c !important;
  font-weight: 600;
}

.coupling-dialog__actions.coupling-manage__actions .coupling-manage__disconnect-all:hover {
  background: rgba(183, 28, 28, 0.06) !important;
}

.coupling-manage__list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 45vh;
  overflow: auto;
}

.coupling-manage__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.02);
}

.coupling-manage__label {
  font-size: 0.88rem;
  line-height: 1.35;
}

.coupling-manage__disconnect {
  flex-shrink: 0;
  padding: 0.25rem 0.6rem;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 4px;
  background: #fff;
  font-size: 0.82rem;
  cursor: pointer;
}

.coupling-manage__disconnect:hover {
  background: rgba(0, 0, 0, 0.04);
}

.coupling-end-shift-bar[hidden] {
  display: none !important;
}

.coupling-end-shift-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
  padding: 0.3rem 0.5rem;
  border-radius: 5px;
  background: rgba(12, 46, 64, 0.06);
  border: 1px solid rgba(12, 46, 64, 0.16);
}

.coupling-end-shift-bar__text {
  font-size: 0.78rem;
  line-height: 1.25;
  color: var(--accent, #0c2e40);
  font-weight: 600;
}

.coupling-end-shift-bar__actions {
  display: flex;
  gap: 0.45rem;
  flex-shrink: 0;
}

.coupling-end-shift-bar__actions button {
  padding: 0.22rem 0.55rem;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  background: #fff;
  cursor: pointer;
  font-size: 0.78rem;
}

.coupling-end-shift-bar__apply {
  background: var(--accent, #0c2e40) !important;
  border-color: var(--accent, #0c2e40) !important;
  color: #fff !important;
  font-weight: 600;
}

.family-timeline__handle.is-end-shift-editable {
  cursor: ew-resize !important;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #111 !important;
}

.family-timeline__track.is-coupling-end-shift .family-timeline__handle.is-end-shift-editable {
  opacity: 1;
}

.coupling-manage__disconnect-all {
  background: #fff !important;
  border-color: #b71c1c !important;
  color: #b71c1c !important;
  font-weight: 600;
}

.coupling-manage__confirm-text {
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
  line-height: 1.45;
}

.coupling-manage__confirm-actions {
  margin-top: 0;
}

.timeline__out--element {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  max-width: 62%;
  color: var(--text, #1e2a26);
}

.timeline__out-range {
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: right;
  color: inherit;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-meta--info {
  display: inline-block;
  max-width: min(14rem, 38vw);
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  color: #1e2a26;
  font-weight: 600;
}

.timeline-meta__sep--info {
  flex-shrink: 0;
}

.timeline-meta__sep {
  color: #9aa8a2;
  font-weight: 400;
}

.timeline-meta--dates {
  color: #1b5e4b;
  font-weight: 600;
}

.timeline-meta--kw {
  color: #2d4a6f;
  font-weight: 600;
}

.timeline-meta--duration {
  color: #6b4e18;
  font-weight: 600;
}

#timeSlider:disabled {
  opacity: 0.4;
}

.timeline__scrub-date {
  position: absolute;
  top: 50%;
  bottom: auto;
  transform: translate(-50%, calc(-100% - 14px));
  z-index: 30;
  padding: 0.28rem 0.65rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: var(--accent, #0c2e40);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  white-space: nowrap;
}

/* Außerhalb der Track-Clip-Box: über Header (Raster/KW/Zoom/Anzeige) */
.timeline__block > .timeline__scrub-date {
  top: auto;
  z-index: 40;
  transform: translate(-50%, -100%);
}

.timeline__track-wrap .timeline__scrub-date.family-timeline__kw-drag-label {
  top: 50%;
  bottom: auto;
  transform: translate(-50%, calc(-100% - 14px));
}

.timeline__out.is-scrub-hidden {
  visibility: hidden;
}

.timeline__out {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  text-align: right;
  flex: 1 1 auto;
  min-width: 0;
}

/* Druck-Dialog */
.print-dialog {
  width: min(560px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

.print-dialog::backdrop {
  background: rgba(26, 29, 33, 0.45);
}

.print-dialog__form {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 1.1rem 1.25rem 1.25rem;
}

.print-dialog__header {
  margin-bottom: 0.85rem;
}

.print-dialog__title {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
}

.print-dialog__lead {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}

.print-dialog__fieldset {
  margin: 0 0 1rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.print-dialog__legend {
  padding: 0 0.25rem;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.print-dialog__radio {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  margin: 0.55rem 0 0;
  font-size: 0.9rem;
  line-height: 1.4;
  cursor: pointer;
}

.print-dialog__radio--inline {
  display: inline-flex;
  margin-right: 1rem;
}

.print-dialog__radio input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.print-dialog__week-range {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-top: 0.65rem;
  align-items: flex-end;
}

.print-dialog__range-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.print-dialog__range-field input {
  width: 5rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
}

.print-dialog__range-field--year input {
  width: 5.5rem;
}

.print-dialog__hint {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.print-dialog__watermark-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
  font-size: 0.85rem;
}

.print-dialog__watermark-label {
  color: var(--muted);
  font-size: 0.8rem;
}

.print-dialog__watermark-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: inherit;
}

.print-dialog__fieldset .print-dialog__hint {
  margin-top: 0.45rem;
}

.print-dialog__presets {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0 0 0.85rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.print-dialog__preset-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.print-dialog__preset-select {
  width: 100%;
  box-sizing: border-box;
  padding: 0.4rem 0.55rem;
  font: inherit;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.print-dialog__preset-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.print-dialog__preset-actions .btn--small {
  padding: 0.28rem 0.55rem;
  font-size: 0.78rem;
  line-height: 1.2;
}

.print-dialog__week-pick {
  margin-top: 0.55rem;
}

.print-dialog__week-plot {
  margin-top: 0.55rem;
}

.print-dialog__week-checks {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 12rem;
  overflow-y: auto;
}

.print-dialog__week-check {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  font-size: 0.85rem;
  cursor: pointer;
}

.print-dialog__week-check--plot {
  cursor: default;
  color: #1b7a3d;
  font-weight: 600;
}

.print-dialog__week-plot kbd {
  font-size: 0.8em;
  padding: 0.05em 0.35em;
  border: 1px solid var(--border, #ccc);
  border-radius: 3px;
  background: #f5f5f5;
}

.print-dialog__error {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.85rem;
  color: var(--danger);
  background: #fef3f2;
  border-radius: 6px;
}

.print-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

/* Ausschnitt-Markierung (nach Druck-Dialog) */
body.is-print-crop-selecting .stage__viewport {
  cursor: crosshair;
}

.print-crop-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  touch-action: none;
}

.print-crop-overlay__shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.print-crop-overlay__selection {
  position: absolute;
  box-sizing: border-box;
  border: 2px dashed #fff;
  outline: 9999px solid rgba(26, 29, 33, 0.42);
  outline-offset: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.print-crop-overlay__toolbar {
  position: absolute;
  left: 50%;
  bottom: 0.75rem;
  transform: translateX(-50%);
  z-index: 41;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem 1rem;
  max-width: calc(100% - 1.5rem);
  padding: 0.55rem 0.85rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  pointer-events: auto;
}

.print-crop-overlay__hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.print-crop-overlay__actions {
  display: flex;
  gap: 0.45rem;
}

.print-only {
  display: none;
}

.print-sheet__meta {
  font-size: 10pt;
  color: #333;
  text-align: right;
}

/* Druck — Ausschnitt (Vorschau im #printRoot) */
.print-sheet--crop {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  min-height: 0;
}

.print-page-break {
  display: block;
  width: 100%;
  height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  visibility: hidden;
  break-after: page;
  page-break-after: always;
}

.print-page {
  box-sizing: border-box;
  width: 100%;
  overflow: hidden;
}

.print-sheet__created {
  font-size: 8pt;
  font-weight: 500;
  color: #6b6b6b;
  line-height: 1.35;
}

.print-sheet--crop .print-sheet__header--compact {
  flex-shrink: 0;
  margin-bottom: 4mm;
}

.print-sheet__header--terminplan-only {
  display: block;
}

.print-sheet__footer--crop {
  display: block;
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 3mm;
  width: 100%;
}

.print-sheet__footer-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4mm;
  width: 100%;
  flex-wrap: nowrap;
  white-space: nowrap;
  line-height: 1.15;
}

.print-sheet__footer-line .print-sheet__title--branded {
  flex-shrink: 0;
  font-size: 9pt;
}

.print-sheet__footer-line .print-sheet__title-logo {
  height: 0.95em;
}

.print-sheet__footer-rest {
  flex: 1 1 auto;
  min-width: 0;
  text-align: right;
  font-size: 7.5pt;
  font-weight: 500;
  color: #6b6b6b;
  white-space: nowrap;
}

.print-sheet__kw-banner {
  position: absolute;
  top: 0.4rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  width: auto;
  max-width: calc(100% - 1.2rem);
  box-sizing: border-box;
  text-align: center;
  padding: 0.2rem 0.55rem;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border-radius: 4px;
  pointer-events: none;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.print-sheet__kw-banner-kw {
  display: block;
  font-size: clamp(9pt, 2.1vw, 18pt);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  line-height: 1.15;
  white-space: nowrap;
}

.print-sheet__kw-banner-sub {
  display: block;
  margin-top: 0.15rem;
  font-size: 8pt;
  font-weight: 500;
  opacity: 0.92;
  line-height: 1.25;
}

.print-sheet__header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 4mm;
}

.print-sheet__terminplan {
  width: 100%;
}

.print-sheet__terminplan-label {
  font-size: 7pt;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 1mm;
}

.print-sheet__terminplan-track {
  position: relative;
  width: 100%;
  height: 12mm;
  min-height: 12mm;
}

.print-sheet__terminplan-rail {
  position: relative;
  height: 100%;
  border: 1px solid rgba(0, 0, 0, 0.22);
  border-radius: 3px;
  background: rgba(248, 250, 249, 0.42);
  overflow: hidden;
}

.print-sheet__terminplan-rail .timeline__watermarks {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.print-sheet__terminplan-week-band {
  position: absolute;
  top: 0;
  bottom: 0;
  transform: translateX(-50%);
  box-sizing: border-box;
  background: rgba(27, 94, 75, 0.2);
  border-left: 2px solid #1b5e4b;
  border-right: 2px solid #1b5e4b;
  z-index: 1;
  pointer-events: none;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.print-sheet__terminplan-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  transform: translateX(-50%);
  background: #1b5e4b;
  border-radius: 1px;
  z-index: 3;
  pointer-events: none;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.print-sheet__terminplan .timeline-wm__label {
  font-size: 6pt;
}

.print-sheet__terminplan .timeline-wm__week-num {
  font-size: 5pt;
  padding-bottom: 0.5mm;
}

.print-sheet__terminplan .timeline-wm__line {
  top: 0.2rem;
  bottom: 0.2rem;
}

.print-sheet__crop {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Ausschnitt: Größe kommt als mm vom JS (Seitenverhältnis), kein CSS-aspect-ratio-Contain */
.print-crop-plan {
  position: relative;
  box-sizing: border-box;
  display: block;
  line-height: 0;
  overflow: hidden;
  background: #fff;
}

.print-crop-plan img.print-crop-plan__composite {
  display: block;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center;
}

/* Druck */
@media print {
  @page {
    size: A4 landscape;
    margin: 8mm;
  }

  html,
  html.bmflipbook-canvas-root,
  body,
  body.bmflipbook-canvas,
  .app {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  body.bmflipbook-canvas {
    background: #fff !important;
  }

  body.print-use-print-root > *:not(.print-page) {
    display: none !important;
  }

  .print-dialog {
    display: none !important;
  }

  /* #printRoot must be a direct body child (not inside .app) — display:none on .app hides all descendants */
  body.print-use-print-root .app {
    display: none !important;
  }

  body.print-use-print-root #printRoot,
  body.print-use-print-root #printRoot[hidden] {
    display: contents !important;
    visibility: visible !important;
    position: static;
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: visible;
  }

  body:not(.print-use-print-root) .print-only {
    display: none !important;
  }

  body.print-use-print-root .print-sheet {
    box-sizing: border-box;
    width: 100%;
    padding: 0;
    overflow: hidden;
    page-break-inside: avoid;
    break-inside: avoid-page;
  }

  body.print-use-print-root > .print-page {
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: 194mm;
    min-height: 194mm;
    max-height: 194mm;
    overflow: hidden;
    page-break-after: always !important;
    break-after: page !important;
    page-break-inside: avoid;
    break-inside: avoid-page;
  }

  body.print-use-print-root > .print-page.is-last-print-page {
    page-break-after: avoid !important;
    break-after: avoid !important;
  }

  body.print-use-print-root > .print-page + .print-page {
    page-break-before: always !important;
    break-before: page !important;
  }

  body.print-use-print-root .print-page {
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: 194mm;
    min-height: 194mm;
    max-height: 194mm;
    overflow: hidden;
    page-break-after: always !important;
    break-after: page !important;
    page-break-inside: avoid;
    break-inside: avoid-page;
  }

  body.print-use-print-root .print-page.is-last-print-page {
    page-break-after: avoid !important;
    break-after: avoid !important;
  }

  body.print-use-print-root .print-sheet--crop {
    display: flex !important;
    flex-direction: column;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    padding: 0;
    overflow: hidden;
    page-break-after: avoid !important;
    break-after: avoid !important;
    page-break-inside: avoid;
    break-inside: avoid-page;
  }

  body.print-use-print-root .print-page-break {
    display: none !important;
  }

  body.print-use-print-root .print-page + .print-page {
    page-break-before: always !important;
    break-before: page !important;
  }

  body.print-use-print-root .print-sheet__header--compact {
    flex-shrink: 0;
    margin-bottom: 4mm;
  }

  body.print-use-print-root .print-sheet__plan {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: none;
    max-width: 100%;
  }

  body.print-use-print-root .print-sheet__plan .stage__viewport {
    position: relative;
    flex: none;
    min-height: 0;
    max-height: 100%;
    border: none;
    box-shadow: none;
    overflow: visible;
    page-break-inside: avoid;
  }

  body.print-use-print-root .print-sheet__plan .stage__transform {
    position: absolute;
    top: 0;
    left: 0;
  }

  body.print-use-print-root .print-sheet--full-page .print-sheet__footer {
    flex-shrink: 0;
    margin-top: 4mm;
  }

  .app__header .app__file-actions,
  .sidebar,
  .timeline,
  .app__meta {
    display: none !important;
  }

  .app__body {
    display: block;
  }

  .stage__viewport {
    flex: none;
    height: auto;
    min-height: 420px;
    border: none;
    box-shadow: none;
    page-break-inside: avoid;
    overflow: visible;
  }

  body:not(.print-use-print-root) .stage__transform {
    transform: none !important;
  }

  .stage__kw-badge,
  .stage__time.stage__kw-badge {
    display: none !important;
    visibility: hidden !important;
  }

  body.print-use-print-root .print-sheet__plan .stage__viewport {
    width: auto;
    max-width: 100%;
  }

  .print-sheet .stage__viewport {
    min-height: 0;
    max-height: none;
  }

  .print-sheet .stage__inner {
    margin: 0 auto;
  }

  .print-sheet .stage__overlay .overlay-el.is-selected {
    outline: none;
  }

  .print-page > .print-sheet--crop {
    page-break-after: avoid !important;
    break-after: avoid !important;
  }

  .print-sheet--crop {
    width: 100%;
    padding: 0;
    overflow: hidden;
    page-break-inside: avoid;
    break-inside: avoid-page;
  }

  .print-page-break {
    page-break-after: always !important;
    break-after: page !important;
  }

  .print-sheet--crop .print-sheet__header--compact {
    break-after: avoid;
    page-break-after: avoid;
  }

  .print-sheet__terminplan-track {
    height: 11mm;
    min-height: 11mm;
  }

  .print-sheet__terminplan-week-band,
  .print-sheet__terminplan-marker {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .print-sheet__terminplan-rail {
    background: rgba(248, 250, 249, 0.38);
  }

  .print-sheet--crop .print-sheet__crop {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-height: 178mm;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .print-sheet__kw-banner {
    top: 1mm;
    padding: 0.6mm 1.8mm;
  }

  .print-sheet__kw-banner-kw {
    font-size: 11pt;
  }

  body.print-use-print-root .print-sheet__footer--crop {
    flex-shrink: 0;
    margin-top: auto;
    padding-top: 2mm;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body.print-use-print-root .print-sheet--crop .print-sheet__crop {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-height: none;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .print-sheet--crop .print-crop-plan {
    position: relative;
    box-sizing: border-box;
    display: block;
    line-height: 0;
    overflow: hidden;
    background: #fff;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .print-sheet--crop .print-crop-plan img.print-crop-plan__composite {
    display: block;
    max-width: 100%;
    height: auto;
    object-fit: contain;
    object-position: center;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  body.print-use-print-root:has(.print-sheet--crop) #printRoot {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  body.print-use-print-root #printRoot {
    break-after: avoid;
    page-break-after: avoid;
  }
}

/* Bildschirm-Vorschau in #printRoot (nicht für @media print) */
@media screen {
  body.print-use-print-root .app {
    display: none !important;
  }

  body.print-use-print-root .print-only,
  body.print-use-print-root #printRoot,
  body.print-use-print-root #printRoot[hidden] {
    display: block !important;
    visibility: visible !important;
    position: static;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: visible;
  }

  body.print-use-print-root .print-page {
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: 194mm;
    min-height: 194mm;
    max-height: 194mm;
    overflow: hidden;
  }

  body.print-use-print-root .print-sheet--crop {
    display: flex !important;
    flex-direction: column;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    padding: 0;
    overflow: hidden;
  }

  body.print-use-print-root .print-sheet--crop .print-sheet__crop {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .print-sheet {
    padding: 12mm;
  }

  .print-sheet:not(:last-child) {
    page-break-after: always;
  }

  .print-sheet--crop:not(:last-child) {
    page-break-after: always;
  }
}

.print-sheet__header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8mm;
  font-size: 11pt;
}

.print-sheet__title {
  font-weight: 700;
  font-size: 14pt;
}

.print-sheet__title--branded {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 14pt;
  font-weight: 500;
  line-height: 1.2;
  color: #6b6b6b;
}

.print-sheet__title-logo {
  height: 1em;
  width: auto;
  max-height: 1em;
  object-fit: contain;
  flex-shrink: 0;
}

.print-sheet__title-text {
  font-weight: 500;
  color: #6b6b6b;
}

.print-sheet__plan {
  border: 1px solid #ccc;
  max-width: 100%;
}

.print-sheet__legend {
  margin-top: 6mm;
  font-size: 9pt;
}

.print-sheet__footer {
  margin-top: 8mm;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12mm;
  font-size: 9pt;
}

.print-sheet__sign-line {
  margin-top: 12mm;
  border-top: 1px solid #000;
  padding-top: 2mm;
}

/* ---- Mobile gate (smartphone UA): always in app.css so layout works on canvas ---- */
html.bmfb-smartphone body.bmflipbook-canvas > *:not(#mobileGate),
body.bmflipbook-canvas.is-mobile-gate > *:not(#mobileGate) {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

html.bmfb-smartphone body.bmflipbook-canvas .mobile-gate,
body.bmflipbook-canvas.is-mobile-gate .mobile-gate {
  display: flex !important;
  flex-direction: column !important;
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147483646 !important;
  overflow: hidden !important;
  background: #0c2e40 !important;
  color: #e0e8ed !important;
}

.mobile-gate {
  display: none;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  min-height: 100%;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-sans);
}

.mobile-gate__header {
  flex-shrink: 0;
  padding: max(0.85rem, env(safe-area-inset-top)) 1.25rem 0.85rem;
  background: #0c2e40;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  position: sticky;
  top: 0;
  z-index: 2;
}

.mobile-gate__header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 720px;
  margin: 0 auto;
}

.mobile-gate__logo {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
}

.mobile-gate__header-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.mobile-gate__product-name {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.02em;
  color: #fff;
}

.mobile-gate__byline {
  font-size: 0.88rem;
  font-weight: 300;
  line-height: 1.35;
  color: #9cb0bc;
}

.mobile-gate__brand-word {
  display: inline;
  margin-left: 0.2em;
  color: inherit;
  font-weight: 300;
}

.mobile-gate__reg {
  font-size: 0.55em;
  font-weight: 300;
  line-height: 0;
  vertical-align: super;
  margin-left: 0.2em;
  color: #9cb0bc;
}

.mobile-gate__body {
  flex: 1 1 auto;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 1.15rem 1.25rem max(2rem, env(safe-area-inset-bottom));
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overflow-wrap: anywhere;
  word-wrap: break-word;
}

.mobile-gate__page-title {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.3;
  color: #fff;
}

.mobile-gate__content {
  color: #cdd8df;
  font-size: 15px;
  line-height: 1.55;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-wrap: break-word;
}

.mobile-gate__content img,
.mobile-gate__content iframe,
.mobile-gate__content video {
  max-width: 100%;
  height: auto;
}

.mobile-gate__content p,
.mobile-gate__content li,
.mobile-gate__content span,
.mobile-gate__content div {
  font-size: 15px;
}

.mobile-gate__content p,
.mobile-gate__content li {
  color: #cdd8df;
  margin: 0 0 0.75rem;
}

.mobile-gate__content h2,
.mobile-gate__content h3 {
  color: #fff;
  margin: 0.5rem 0 0.35rem;
}

.mobile-gate__content a {
  color: #7bc49a;
}

.mobile-gate__section {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.mobile-gate__section h2 {
  margin: 0;
  font-size: 1.1rem;
  color: #fff;
}

.mobile-gate__note {
  margin: 0;
  color: #9cb0bc;
  font-size: 0.9rem;
}

.mobile-gate .bmflipbook-access-divider {
  margin: 0.25rem 0;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.mobile-gate__card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.1rem 1.15rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
}

.mobile-gate__field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.mobile-gate__field label {
  display: block;
  margin: 0;
  font-weight: 600;
  font-size: 15px;
  color: #cdd8df;
}

.mobile-gate__field input[type="text"] {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid #d0d8df;
  border-radius: 6px;
  font-size: 1rem;
  box-sizing: border-box;
  background: #fff;
  color: #1a1d21;
}

.mobile-gate__field input::placeholder {
  color: #5c6570;
}

.mobile-gate__actions {
  display: block;
  width: 100%;
  margin: 0;
}

.mobile-gate__actions .btn {
  display: flex;
  width: 100%;
  max-width: 100%;
  margin: 0;
  box-sizing: border-box;
}

.mobile-gate .bmflipbook-access-feedback,
.mobile-gate__hint,
.mobile-gate__legal a {
  font-size: 15px;
}

.mobile-gate .bmflipbook-access-feedback {
  margin: 0;
  min-height: 1.25rem;
}

.mobile-gate .bmflipbook-access-feedback.is-error {
  color: #f87171;
}

.mobile-gate .bmflipbook-access-feedback.is-success {
  color: #a8e4bf;
}

.mobile-gate__legal {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
  padding: 1.15rem 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.mobile-gate__legal a {
  color: #8a9aa6;
  text-decoration: none;
  line-height: 1.4;
}

.mobile-gate__legal a:hover {
  color: #9cb0bc;
  text-decoration: underline;
}

.mobile-gate__hint {
  margin: 0;
  color: #9cb0bc;
  line-height: 1.45;
}

.mobile-gate .btn-primary {
  background: #3399cc;
  color: #fff;
  border: none;
  font-weight: 600;
}

.mobile-gate .btn-primary:hover:not(:disabled) {
  background: #51b7ea;
}

.mobile-gate .btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #e0e8ed;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.network-guide-dialog__list {
  margin: 0.5rem 0 0;
  padding-left: 1.15rem;
  font-size: 0.88rem;
  color: #5c6570;
}

.network-guide-dialog__list li {
  margin-bottom: 0.45rem;
}

.network-guide-dialog__list code {
  font-size: 0.82em;
}

.network-guide-dialog__intro code {
  font-size: 0.85em;
}

/* Layer-Verwaltung (Netzwerk) */
#btnLayerAdmin {
  white-space: nowrap;
}

.layer-panel__code-input {
  flex: 1;
  min-width: 5.5rem;
  max-width: 100%;
  margin-right: auto;
  padding: 0.35rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--brand-blue, #0c2e40);
  background: #fff;
  border: 1px solid rgba(12, 46, 64, 0.22);
  border-radius: 6px;
  box-sizing: border-box;
}

.layer-panel__code-input::placeholder {
  font-weight: 500;
  font-style: italic;
  color: #5a6570;
}

.layer-panel__code-input--prompt {
  font-style: italic;
  font-weight: 500;
}

.layer-panel__code-input--unlocked {
  font-style: normal;
  font-weight: 600;
}

.layer-panel__code-input--viewer {
  cursor: default;
  font-style: normal;
  background: rgba(12, 46, 64, 0.1);
  border-color: transparent;
}

.layer-panel__code-input:focus {
  outline: 2px solid rgba(27, 94, 75, 0.45);
  outline-offset: 1px;
}

.panel__head:has(#layerPanelCodeInput:not([hidden])) {
  flex-wrap: wrap;
}

.layer-panel__head--restricted .btn--small {
  display: none !important;
}

.layer-admin-dialog {
  width: min(640px, calc(100vw - 2rem));
  max-height: min(85vh, 720px);
  overflow: auto;
}

.layer-admin-dialog__intro {
  margin-bottom: 0.75rem;
}

.layer-admin-dialog__toggle {
  margin-bottom: 0.75rem;
}

.layer-admin-table-wrap.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.layer-admin-table-wrap {
  overflow-x: auto;
  margin-bottom: 0.5rem;
}

.layer-admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.layer-admin-table th,
.layer-admin-table td {
  padding: 0.4rem 0.35rem;
  border-bottom: 1px solid var(--border, #dde3e8);
  text-align: left;
  vertical-align: middle;
}

.layer-admin-table__name {
  font-weight: 600;
  white-space: nowrap;
}

.layer-admin-table__input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--border, #ccd4da);
  border-radius: 4px;
  font: inherit;
}

.layer-admin-table__input--code {
  max-width: 5.5rem;
  font-family: Consolas, Monaco, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.layer-code-dialog {
  width: min(400px, calc(100vw - 2rem));
}

.layer-code-dialog__input {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 0.65rem;
  font-family: Consolas, Monaco, monospace;
  font-size: 1.25rem;
  letter-spacing: 0.2em;
  text-align: center;
  text-transform: uppercase;
}

.layer-code-dialog__remember {
  margin-bottom: 0.75rem;
}

/* ---- Meilenstein-Dialog + Katalog-Flag ---- */
.milestone-dialog {
  width: min(420px, 94vw);
  max-height: min(80vh, 640px);
  padding: 0;
  border: 1px solid var(--border, #c5cad0);
  border-radius: 6px;
  margin: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}
.milestone-dialog::backdrop {
  background: rgba(0, 0, 0, 0.18);
}
.milestone-dialog__form {
  display: flex;
  flex-direction: column;
  max-height: min(80vh, 640px);
}
.milestone-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border, #d0d4d8);
}
.milestone-dialog__title {
  margin: 0;
  font-size: 1rem;
}
.milestone-dialog__close {
  border: none;
  background: transparent;
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
}
.milestone-dialog__body {
  padding: 0.75rem 0.85rem;
  overflow: auto;
  flex: 1;
  min-height: 0;
}
.milestone-dialog__check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  margin-bottom: 0.65rem;
}
.milestone-dialog__toolbar {
  margin-bottom: 0.65rem;
}
.milestone-dialog__list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}
.milestone-dialog__item-row {
  display: flex;
  align-items: stretch;
  gap: 0.2rem;
}
.milestone-dialog__item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  border: 1px solid var(--border, #d0d4d8);
  border-radius: 4px;
  background: #fff;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  font-size: 0.82rem;
}
.milestone-dialog__item-diamond {
  flex-shrink: 0;
  color: #1a3a5c;
  font-size: 0.95rem;
  line-height: 1;
}
.milestone-dialog__item.is-selected .milestone-dialog__item-diamond {
  color: #0d47a1;
}
.milestone-dialog__item.is-violated .milestone-dialog__item-diamond {
  color: #c62828;
}
.milestone-dialog__item-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.milestone-dialog__item.is-selected {
  border-color: #1a3a5c;
  background: #eef3f8;
}
.milestone-dialog__item.is-violated {
  border-color: #c62828;
  color: #b71c1c;
}
.milestone-dialog__item-remove {
  flex: 0 0 auto;
  border: 1px solid var(--border, #d0d4d8);
  border-radius: 4px;
  background: #fff;
  color: #666;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 0.45rem;
  min-width: 1.75rem;
}
.milestone-dialog__item-remove:hover {
  color: #b71c1c;
  border-color: #c62828;
  background: #ffebee;
}
.milestone-dialog__detail {
  border-top: 1px solid var(--border, #d0d4d8);
  padding-top: 0.65rem;
}
.milestone-dialog__field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}
.milestone-dialog__rule-def-row {
  display: flex;
  align-items: flex-end;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
}
.milestone-dialog__field--template {
  flex: 1 1 auto;
  min-width: 0;
  margin-bottom: 0;
}
.milestone-dialog__field--weeks {
  flex: 0 0 auto;
  max-width: 6rem;
  margin-bottom: 0;
}
.milestone-dialog__meta,
.milestone-dialog__subtitle,
.milestone-dialog__preview,
.milestone-dialog__hint,
.milestone-dialog__selected-element {
  font-size: 0.8rem;
  margin: 0 0 0.5rem;
}
.milestone-dialog__selected-element {
  font-weight: 600;
  color: #1a3a5c;
}
.milestone-dialog__selected-element.is-empty {
  font-weight: 400;
  color: #666;
}
.milestone-dialog__subtitle {
  font-size: 0.85rem;
  font-weight: 600;
}
.milestone-dialog__rules {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.65rem;
  margin-bottom: 0.65rem;
}
.milestone-dialog__rule {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.35rem 0.45rem;
  border-radius: 4px;
  background: #f5f7f9;
  font-size: 0.78rem;
}
.milestone-dialog__rule.is-violated {
  background: #ffebee;
  color: #b71c1c;
}
.milestone-dialog__rule-remove {
  border: none;
  background: transparent;
  cursor: pointer;
  color: #666;
  font-size: 1rem;
  line-height: 1;
}
.milestone-dialog__add-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}
.milestone-dialog__footer {
  display: flex;
  justify-content: flex-end;
  margin: 0;
  padding: 0.55rem 0.85rem;
  border-top: 1px solid var(--border, #d0d4d8);
}
.element-catalog__milestone-flag {
  color: #c62828;
  font-size: 0.75rem;
  margin-right: 0.2rem;
}
.element-catalog__milestone-count {
  font-size: 0.75rem;
  color: #c62828;
  font-weight: 600;
  margin-left: 0.35rem;
}

.stage__overlay .overlay-el.is-schedule-group-canvas {
  outline: 2px dashed #5a7d9a;
  outline-offset: 2px;
}

.schedule-group-dialog {
  width: min(400px, 94vw);
  max-height: min(80vh, 560px);
  padding: 0;
  border: 1px solid var(--border, #c5cad0);
  border-radius: 6px;
  margin: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}
.schedule-group-dialog::backdrop {
  background: rgba(0, 0, 0, 0.18);
}
.schedule-group-dialog__form {
  display: flex;
  flex-direction: column;
  max-height: min(80vh, 560px);
}
.schedule-group-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border, #d0d4d8);
}
.schedule-group-dialog__title {
  margin: 0;
  font-size: 1rem;
}
.schedule-group-dialog__close {
  border: none;
  background: transparent;
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  color: #666;
}
.schedule-group-dialog__body {
  padding: 0.75rem 0.85rem;
  overflow: auto;
}
.schedule-group-dialog__field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}
.schedule-group-dialog__check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  margin-bottom: 0.65rem;
}
.schedule-group-dialog__subtitle {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 0 0.4rem;
}
.schedule-group-dialog__members {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.65rem;
}
.schedule-group-dialog__member {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.3rem 0.4rem;
  border-radius: 4px;
  background: #f5f7f9;
  font-size: 0.78rem;
}
.schedule-group-dialog__member-remove {
  border: none;
  background: transparent;
  cursor: pointer;
  color: #666;
  font-size: 1rem;
  line-height: 1;
}
.schedule-group-dialog__member-remove:hover {
  color: #b71c1c;
}
.schedule-group-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}
.schedule-group-dialog__hint {
  font-size: 0.78rem;
  color: #666;
  margin: 0;
}
.schedule-group-dialog__footer {
  display: flex;
  justify-content: flex-end;
  margin: 0;
  padding: 0.55rem 0.85rem;
  border-top: 1px solid var(--border, #d0d4d8);
}
.bar-plan__group-header--schedule {
  background: #e8eef4;
  color: #1a3a5c;
}
