/* Schrift liegt im Projekt (vendor/fonts) – keine Anfragen an Google (Datenschutz/DSGVO) */
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-display: swap; font-weight: 400; src: url(vendor/fonts/plus-jakarta-sans-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-display: swap; font-weight: 400; src: url(vendor/fonts/plus-jakarta-sans-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-display: swap; font-weight: 500; src: url(vendor/fonts/plus-jakarta-sans-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-display: swap; font-weight: 500; src: url(vendor/fonts/plus-jakarta-sans-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-display: swap; font-weight: 600; src: url(vendor/fonts/plus-jakarta-sans-latin-ext-600-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-display: swap; font-weight: 600; src: url(vendor/fonts/plus-jakarta-sans-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-display: swap; font-weight: 700; src: url(vendor/fonts/plus-jakarta-sans-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-display: swap; font-weight: 700; src: url(vendor/fonts/plus-jakarta-sans-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-display: swap; font-weight: 800; src: url(vendor/fonts/plus-jakarta-sans-latin-ext-800-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-display: swap; font-weight: 800; src: url(vendor/fonts/plus-jakarta-sans-latin-800-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
/* Beleuchtungsplaner – Mattuschka Paradiesgärten
   Farben laut Brand Guidelines V1.0 (MPG): Moosgrün, Tannengrün + Tertiärfarben */
:root {
  --forest: #054432;      /* Tannengrün – Sekundärfarbe MPG */
  --moss: #006930;        /* Moosgrün – Primärfarbe */
  --moss-dark: #00562a;
  --forest-dark: #03331f;
  --sage: #e7eee8;        /* Seitenhintergrund (Flächenton, aufgehellt) */
  --sage-2: #eef3ef;
  --chip: #dcebdf;
  --paper: #ffffff;
  --sun: #ffda6f;         /* Sonnengelb – Licht */
  --apricot: #f28c5a;     /* Aprikot – 230 V */
  --teal: #009a93;        /* Türkis – Niedervolt */
  --mint: #8ec89a;
  --ink: #10261d;
  --ink-2: #4b5f55;
  --line: #d9e2da;
  --danger: #b3261e;
  --night: #03120c;
  --accent: #009a93;       /* Türkis – Akzentfarbe der Bedienung (MPG Tertiärfarbe) */
  --accent-light: #36c2ba;

  --r-sm: 10px;
  --r: 12px;
  --r-lg: 18px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bar-h: 64px;
  --rail-w: 72px;
  --panel-w: 340px;
  --shadow: 0 8px 28px rgba(5, 68, 50, .16);
  --shadow-soft: 0 1px 2px rgba(16, 38, 29, .04), 0 6px 20px rgba(16, 38, 29, .06);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--sage);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -0.02em; color: var(--forest); }
.muted { color: var(--ink-2); margin: 0; }
.spacer { flex: 1; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.ic { width: 20px; height: 20px; flex: none; }

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

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--paper); color: var(--ink); cursor: pointer; font-weight: 600; font-size: 14.5px;
  transition: background .15s, border-color .15s, box-shadow .15s, color .15s;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: #b9c8bc; box-shadow: 0 1px 3px rgba(16,38,29,.08); }
.btn .ic { width: 18px; height: 18px; }
.btn.primary { background: var(--forest); border-color: var(--forest); color: #fff; font-weight: 700; }
.btn.primary:hover { background: var(--forest-dark); border-color: var(--forest-dark); }
.btn.sun { background: #fff; border-color: #fff; color: var(--forest); font-weight: 700; }
.btn.sun:hover { background: #eef5ef; border-color: #eef5ef; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-text { color: var(--danger); }
.btn.danger-text:hover { border-color: #e6b3ae; }
.btn.ghost-light { background: rgba(255,255,255,.08); border-color: transparent; color: #fff; font-weight: 600; }
.btn.ghost-light:hover { background: rgba(255,255,255,.16); box-shadow: none; }
.btn.ghost-light[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.link { border: 0; background: none; color: var(--moss); min-height: 32px; padding: 0; box-shadow: none; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 13.5px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; pointer-events: none; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: var(--r-sm);
  border: 0; background: transparent; cursor: pointer; color: var(--ink);
}
.icon-btn:hover { background: var(--sage-2); }
.icon-btn.light { color: #fff; }
.icon-btn.light:hover { background: rgba(255,255,255,.12); }
.icon-btn:disabled { opacity: .35; pointer-events: none; }

/* Filter-Chips (wie die Kategorien im AssetHub) */
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 7px 15px;
  cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--ink); transition: background .15s, border-color .15s;
}
.seg button:hover { border-color: #b9c8bc; }
.seg button[aria-pressed="true"] { background: var(--forest); border-color: var(--forest); color: #fff; }

/* ---------- Formulare ---------- */
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.form input:not([type=checkbox]):not([type=range]), .form select, .form textarea, .extras select, .extras input {
  width: 100%; min-height: 44px; padding: 9px 14px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--paper);
  font-size: 15px; color: var(--ink);
}
.form textarea { resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--moss); box-shadow: 0 0 0 3px rgba(0,105,48,.15); }
.form input[type=range] { accent-color: var(--moss); width: 100%; }
.form .check { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--ink); font-weight: 400; }
.form .check input { width: 20px; height: 20px; accent-color: var(--moss); }
.form .opt { display: grid; gap: 6px; }
.form .k, .field-static .k { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.form-error { color: var(--danger); margin: 0; font-size: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-static { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.field-static .k { grid-column: 1 / -1; }

.search { display: flex; align-items: center; gap: 8px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0 14px; min-height: 44px; }
.search:focus-within { border-color: var(--moss); box-shadow: 0 0 0 3px rgba(0,105,48,.12); }
.search input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; font-size: 15px; }
.search .ic { color: var(--ink-2); width: 18px; height: 18px; }
.search.small { min-height: 38px; }

/* ---------- Logo ---------- */
.brand-logo { height: 28px; width: auto; max-width: 360px; object-fit: contain; display: block; flex: none; }
.brand-logo.color { height: 46px; justify-self: start; }

/* ---------- Topbar ---------- */
.topbar {
  height: var(--bar-h); display: flex; align-items: center; gap: 12px;
  padding: 0 20px; padding-left: max(20px, env(safe-area-inset-left));
  background: var(--forest); color: #fff;
  position: sticky; top: 0; z-index: 20;
}
.app-name { font-weight: 600; font-size: 18px; letter-spacing: -0.01em; padding-left: 18px; margin-left: 6px; border-left: 1px solid rgba(255,255,255,.28); line-height: 28px; white-space: nowrap; }
.icon-btn.round { border-radius: 999px; background: rgba(255,255,255,.08); }
.icon-btn.round:hover { background: rgba(255,255,255,.18); }
/* Inhalt der Titelleiste auf Seitenbreite begrenzen (wie der Seiteninhalt) */
.topbar-inner { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 28px; display: flex; align-items: center; gap: 12px; height: 100%; }
.topbar:has(.topbar-inner) { padding: 0; }
.net-wrap { position: relative; margin-right: 4px; }
.net {
  display: inline-flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; color: rgba(255,255,255,.92);
  background: transparent; border: 0; border-radius: 999px; padding: 8px 12px; cursor: pointer;
}
.net:hover, .net[aria-expanded="true"] { background: rgba(255,255,255,.1); }
.net i { width: 9px; height: 9px; border-radius: 50%; background: #5fd08a; animation: net-blink 1.5s steps(1, end) infinite; }
.net.off i { background: var(--sun); }
.net.err i { background: #ff7a6b; }
.net.checking i { background: #cfe0d6; box-shadow: none; }
/* Hartes An/Aus ohne Überblenden */
@keyframes net-blink { 0% { opacity: 1; } 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .net i { animation: net-blink 1.5s steps(1, end) infinite !important; } }

.net-pop {
  position: absolute; right: 0; top: calc(100% + 10px); width: 330px; max-width: calc(100vw - 24px); z-index: 40;
  background: var(--paper); color: var(--ink); border-radius: 16px; padding: 16px 16px 14px;
  box-shadow: 0 16px 40px rgba(3, 18, 12, .25); display: grid; gap: 12px;
}
.net-pop h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.net-pop h3 i { width: 10px; height: 10px; border-radius: 50%; background: #2fae63; flex: none; }
.net-pop h3 i.off { background: #e0a800; }
.net-pop h3 i.err { background: var(--danger); }
.net-pop dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13px; }
.net-pop dt { color: var(--ink-2); }
.net-pop dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.net-pop p { margin: 0; font-size: 12.5px; color: var(--ink-2); }

/* ---------- Login ---------- */
.view { min-height: 100%; }
/* ---------- Anmeldung: im Stil der Titelleiste (Logo | PlanStudio), dezentes Planraster und Lichtpunkte ---------- */
.login {
  position: relative; overflow: hidden; display: grid; place-items: center; min-height: 100%;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  background: radial-gradient(120% 90% at 50% 0%, #0a5a43 0%, var(--forest) 55%, var(--forest-dark) 100%);
  color: #fff;
}
.login::before {             /* Planraster wie im Editor – nach außen ausgeblendet */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.028) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.028) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  background-position: center center;
  -webkit-mask-image: radial-gradient(ellipse 70% 65% at 50% 45%, #000 20%, transparent 80%);
  mask-image: radial-gradient(ellipse 70% 65% at 50% 45%, #000 20%, transparent 80%);
}
.login-deco { position: absolute; inset: 0; pointer-events: none; }
.login-deco .glow { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .55;
  background: radial-gradient(circle, rgba(255,218,111,.55) 0%, rgba(255,218,111,.16) 30%, rgba(255,218,111,0) 70%); }
.login-deco .g1 { width: 340px; height: 340px; left: calc(50% - 560px); top: 14%; }
.login-deco .g2 { width: 260px; height: 260px; right: calc(50% - 540px); top: 56%; opacity: .45; }
.login-deco .g3 { width: 200px; height: 200px; left: calc(50% + 150px); top: -60px; opacity: .3;
  background: radial-gradient(circle, rgba(54,194,186,.55) 0%, rgba(54,194,186,.14) 32%, rgba(54,194,186,0) 70%); }
.login-wrap { position: relative; width: min(440px, 100%); display: grid; gap: 26px; justify-items: center; animation: login-in .5s cubic-bezier(.2,.8,.2,1) both; }
@keyframes login-in { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) { .login-wrap { animation: none; } }
.login-brand { display: flex; align-items: center; gap: 12px; min-height: 40px; }
.login-brand .brand-logo { height: 36px; max-width: 280px; }
.login-brand .app-name { display: block; font-size: 24px; line-height: 36px; font-weight: 700; padding-left: 20px; margin-left: 8px; }
.login-brand .brand-logo[hidden] + .app-name { border-left: 0; padding-left: 0; margin-left: 0; }
.login-card {
  width: 100%; background: var(--paper); color: var(--ink); border-radius: 22px;
  padding: 34px 32px 26px; display: grid; gap: 20px;
  box-shadow: 0 30px 70px rgba(0,0,0,.32), 0 0 0 1px rgba(255,255,255,.06);
}
.login-head { display: grid; gap: 8px; }
.login-card h1 { font-size: 26px; line-height: 1.2; margin: 0; letter-spacing: -0.015em; color: var(--forest); }
.login-lead { margin: 0; color: var(--ink-2); font-size: 15px; }
.login-card .btn.google { min-height: 52px; font-size: 15.5px; border-radius: 14px; gap: 12px; }
.login-note { margin: 0; padding-top: 16px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.login-note svg { width: 16px; height: 16px; flex: none; color: var(--moss); }
.login-foot { margin: 0; font-size: 13px; letter-spacing: .02em; color: rgba(255,255,255,.55); text-align: center; }
@media (max-width: 480px) {
  .login-card { padding: 28px 22px 22px; border-radius: 18px; }
  .login-brand .brand-logo { height: 28px; max-width: 200px; }
  .login-brand .app-name { font-size: 20px; line-height: 28px; padding-left: 14px; margin-left: 4px; }
  .login-deco .g1, .login-deco .g2 { display: none; }
}
.btn.google { background: #fff; color: #1f1f1f; border: 1px solid #c9cfc9; font-weight: 700; gap: 10px; min-height: 50px; }
.btn.google:hover { background: #f4f6f4; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; color: rgba(255,255,255,.85); font-size: 13px; margin-right: 4px; }
.user-chip img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
@media (max-width: 640px) { .user-chip span { display: none; } }

/* ---------- Projektübersicht ---------- */
.projects { max-width: 1240px; margin: 0 auto; padding: 48px 28px 72px; }
.page-title { font-size: 40px; line-height: 1.1; }
.page-sub { margin: 10px 0 26px; color: var(--ink-2); font-size: 15px; }
.search.hero { min-height: 60px; border: 0; border-radius: 16px; padding: 0 20px; box-shadow: var(--shadow-soft); }
.search.hero input { font-size: 16px; }
.search.hero .ic { width: 20px; height: 20px; color: var(--moss); }
.search-note { font-size: 12.5px; color: var(--ink-2); margin: 10px 2px 0; }
.section-head { display: flex; align-items: center; gap: 10px; margin: 34px 0 16px; }
.section-label { font-size: 12.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.count { min-width: 26px; height: 24px; padding: 0 8px; border-radius: 999px; background: var(--chip); color: var(--forest); font-size: 12.5px; font-weight: 700; display: inline-grid; place-items: center; }
.section-head .btn { margin-left: auto; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.plan-card {
  background: var(--paper); border-radius: 16px; overflow: hidden; cursor: pointer;
  box-shadow: var(--shadow-soft); transition: transform .15s, box-shadow .15s; display: flex; flex-direction: column;
}
.plan-card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(16,38,29,.05), 0 12px 28px rgba(16,38,29,.1); }
.plan-card .thumb { aspect-ratio: 16 / 10; background: var(--sage-2) center / cover no-repeat; }
.plan-card .meta { padding: 14px 16px 12px; display: grid; gap: 3px; }
.plan-card .name { font-weight: 700; font-size: 16px; color: var(--forest); }
.plan-card .sub { font-size: 13px; color: var(--ink-2); }
.plan-card .actions { display: flex; gap: 2px; padding: 0 10px 10px; margin-top: auto; }
.plan-card .actions .icon-btn { width: 36px; height: 36px; color: var(--ink-2); }
.plan-card .actions .icon-btn:hover { color: var(--ink); }
.plan-empty { grid-column: 1 / -1; background: var(--paper); border-radius: 16px; padding: 52px 24px; text-align: center; display: grid; gap: 12px; justify-items: center; box-shadow: var(--shadow-soft); }
.plan-empty p { max-width: 44ch; margin: 0; color: var(--ink-2); }

/* ---------- Editor ---------- */
#view-editor { height: 100%; display: flex; flex-direction: column; }
.editor-bar { gap: 8px; }
.plan-title { display: grid; min-width: 0; flex: 0 1 340px; }
.plan-title input {
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  color: #fff; font-weight: 700; font-size: 16px; padding: 2px 6px; min-width: 0;
}
.plan-title input:hover, .plan-title input:focus { border-color: rgba(255,255,255,.3); outline: 0; }
.plan-title span { font-size: 12px; opacity: .7; padding: 0 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grp { display: flex; }
.save-state { font-size: 13px; opacity: .7; white-space: nowrap; }
.save-state.warn { color: var(--sun); opacity: 1; }
.panel-toggle { display: none; }

.editor { flex: 1; display: flex; min-height: 0; position: relative; }

.rail {
  width: var(--rail-w); flex: none; background: var(--paper); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 0;
  padding-left: env(safe-area-inset-left);
}
.tool {
  width: 60px; min-height: 56px; border: 0; border-radius: var(--r); background: transparent; cursor: pointer;
  display: grid; justify-items: center; align-content: center; gap: 3px; color: var(--ink-2);
  font-size: 11px; font-weight: 500;
}
.tool:hover { background: var(--sage-2); color: var(--ink); }
.tool { font-weight: 600; }
.tool[aria-pressed="true"] { background: var(--accent); color: #fff; }
.tool[aria-pressed="true"] .ic { color: #fff; }
.rail-sep { width: 36px; height: 1px; background: var(--line); margin: 6px 0; }

.stage-wrap { flex: 1; position: relative; overflow: hidden; background: #e7ece6; min-width: 0; }
.stage-wrap.night { background: var(--night); }
#stage { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
#stage.panning { cursor: grabbing; }
#stage.crosshair { cursor: crosshair; }
#stage [data-kind="item"], #stage [data-kind="cable"] { cursor: move; }
#stage [data-kind="vertex"], #stage [data-kind="mid"], #stage [data-kind="rot"] { cursor: pointer; }
#stage.crosshair [data-kind] { cursor: crosshair; }
#stage text { font-family: var(--font); pointer-events: none; }

.empty-state {
  position: absolute; inset: 0; margin: auto; width: min(460px, calc(100% - 32px)); height: fit-content;
  background: var(--paper); border-radius: var(--r-lg); padding: 28px; display: grid; gap: 12px; box-shadow: var(--shadow);
}
.empty-state h2 { font-size: 22px; }
.empty-state p { margin: 0; color: var(--ink-2); }
.empty-state .row { margin-top: 6px; }

.hint {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  background: var(--forest); color: #fff; border-radius: 999px; padding: 6px 6px 6px 18px;
  display: flex; align-items: center; gap: 12px; font-size: 14px; box-shadow: var(--shadow);
  max-width: calc(100% - 32px);
}
.hint .txt { padding: 4px 0; }
.hint.solo { padding-right: 18px; }
.hint .btn { min-height: 34px; border-radius: 999px; padding: 0 14px; font-size: 14px; }

.scalebar { position: absolute; left: 16px; bottom: 18px; display: grid; gap: 3px; font-size: 12px; font-weight: 500; color: var(--ink-2); pointer-events: none; }
.scalebar .bar { height: 6px; border: 2px solid currentColor; border-top: 0; }
.stage-wrap.night .scalebar { color: #cfe0d6; }
.scalebar.unset span::after { content: " (Maßstab nicht gesetzt)"; color: var(--apricot); }

.zoombox { position: absolute; right: 16px; bottom: 16px; display: flex; align-items: center; background: var(--paper); border-radius: 14px; padding: 4px; box-shadow: var(--shadow-soft); }
.zoombox .icon-btn { width: 36px; height: 36px; }
.zoom-val { border: 0; background: none; min-width: 58px; font-size: 13px; font-weight: 500; cursor: pointer; height: 36px; border-radius: var(--r-sm); }
.zoom-val:hover { background: var(--sage-2); }

/* ---------- Panel ---------- */
.panel { width: var(--panel-w); flex: none; background: var(--paper); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; padding-right: env(safe-area-inset-right); }
.tabs { display: flex; gap: 2px; margin: 12px 12px 4px; padding: 4px; background: var(--sage-2); border-radius: 12px; }
.tabs button { flex: 1; border: 0; background: none; padding: 8px 4px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink-2); border-radius: 9px; }
.tabs button[aria-selected="true"] { background: var(--paper); color: var(--forest); font-weight: 700; box-shadow: 0 1px 3px rgba(16,38,29,.1); }
.tab-body { flex: 1; overflow-y: auto; padding: 14px; min-height: 0; -webkit-overflow-scrolling: touch; }
#tab-catalog { display: flex; flex-direction: column; gap: 12px; }
#tab-catalog[hidden] { display: none; }
.cat-tools { display: grid; gap: 10px; }
.cat-tools .seg { justify-self: start; }
.cat-list { display: grid; gap: 6px; }
.cat-item {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center;
  padding: 8px 10px; border-radius: var(--r); border: 1px solid var(--line); background: var(--paper);
  cursor: pointer; touch-action: pan-y; user-select: none; -webkit-user-select: none; text-align: left;
}
.cat-item:hover { border-color: #b9c8bc; box-shadow: 0 1px 3px rgba(16,38,29,.06); }
.cat-item[aria-pressed="true"] { border-color: var(--moss); background: #f1f7f1; box-shadow: inset 3px 0 0 var(--moss); }
.cat-item .nm { font-weight: 600; font-size: 14px; line-height: 1.25; }
.cat-item .dt { font-size: 12px; color: var(--ink-2); }
.cat-item .pr { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cat-foot { font-size: 12px; color: var(--ink-2); display: grid; gap: 10px; justify-items: start; margin-top: auto; }
.cat-foot p { margin: 0; }
.sym { width: 40px; height: 40px; display: block; }

.props { display: grid; gap: 16px; }
.props-head { display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: center; }
.props-head .nm { font-weight: 600; }
.props-head .dt { font-size: 13px; color: var(--ink-2); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 14px; background: var(--sage-2); border-radius: var(--r); padding: 12px 14px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.props-empty { color: var(--ink-2); font-size: 14px; display: grid; gap: 8px; padding: 8px 2px; }
.props-empty ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }

.summary { border-top: 1px solid var(--line); padding: 12px 14px; display: grid; grid-template-columns: auto auto auto 1fr; gap: 6px 12px; font-size: 12px; color: var(--ink-2); }
.summary b { display: block; white-space: nowrap; font-size: 15px; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Dialoge ---------- */
.dlg { border: 0; border-radius: 20px; padding: 0; width: min(480px, calc(100% - 24px)); max-height: calc(100% - 24px); color: var(--ink); box-shadow: 0 24px 64px rgba(0,0,0,.25); }
.dlg.small { width: min(400px, calc(100% - 24px)); }
.dlg.wide { width: min(860px, calc(100% - 24px)); }
.dlg.xwide { width: min(1020px, calc(100% - 24px)); }
.dlg::backdrop { background: rgba(3, 18, 12, .5); }
.dlg[open] { display: flex; flex-direction: column; }
.dlg > form { display: flex; flex-direction: column; min-height: 0; }
.dlg header { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 8px; }
.dlg header { padding: 22px 24px 8px; }
.dlg header h2 { font-size: 22px; }
.dlg .form, .dlg .dlg-body { padding: 12px 22px; }
.dlg .dlg-body { overflow-y: auto; display: grid; gap: 16px; }
.dlg footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 20px; flex-wrap: wrap; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); }
.mat-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.mat-table th, .mat-table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.mat-table th { font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--sage-2); }
.mat-table td.num, .mat-table th.num { text-align: right; }
.mat-table td.name { white-space: normal; min-width: 200px; }
.mat-table tr.group td { background: #f6f8f5; font-weight: 600; color: var(--forest); font-size: 13px; }
.mat-table tr.total td { font-weight: 600; border-bottom: 0; }
.mat-table tr.total.big td { font-size: 16px; color: var(--forest); }
.mat-table .extra-del { width: 30px; height: 30px; color: var(--ink-2); }
.mat-empty { padding: 28px; text-align: center; color: var(--ink-2); }
.warn-box { background: #fff4ea; border: 1px solid #f7c5a6; color: #7a3514; border-radius: var(--r); padding: 10px 14px; font-size: 14px; }
.extras h3 { font-size: 16px; margin-bottom: 4px; }
.extras-add { margin-top: 10px; }
.extras-add select { flex: 1; min-width: 200px; }
.extras-add input { width: 100px !important; }

.catman { display: grid; grid-template-columns: 300px 1fr; gap: 0; min-height: 0; overflow: hidden; flex: 1; border-top: 1px solid var(--line); }
.catman-list { border-right: 1px solid var(--line); padding: 14px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.cm-items { display: grid; gap: 4px; }
.cm-item { display: grid; grid-template-columns: 34px 1fr; gap: 8px; align-items: center; text-align: left; border: 1px solid transparent; background: none; border-radius: var(--r-sm); padding: 6px 8px; cursor: pointer; }
.cm-item:hover { background: var(--sage-2); }
.cm-item[aria-pressed="true"] { border-color: var(--moss); background: #f1f7f1; }
.cm-item .sym { width: 34px; height: 34px; }
.cm-item span { font-size: 14px; line-height: 1.25; }
.catman-form { padding: 18px 22px !important; overflow-y: auto; align-content: start; }
.catman-form .preview { display: flex; align-items: center; gap: 12px; }
.catman-form .preview .sym { width: 52px; height: 52px; }

/* ---------- Overlays ---------- */
#drag-ghost { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; width: 44px; height: 44px; margin: -22px 0 0 -22px; filter: drop-shadow(0 6px 12px rgba(0,0,0,.25)); }
#drag-ghost .sym { width: 44px; height: 44px; }
#toast { position: fixed; left: 50%; top: 78px; transform: translate(-50%, -10px); background: var(--forest); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 200; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--danger); }
#busy { position: fixed; inset: 0; background: rgba(3, 18, 12, .45); z-index: 300; display: grid; place-content: center; justify-items: center; gap: 14px; color: #fff; font-weight: 500; }
.spinner { width: 36px; height: 36px; border: 3px solid rgba(255,255,255,.3); border-top-color: var(--accent-light); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .btn.ghost-light .lbl { display: none; }
  .btn.ghost-light { padding: 0 10px; }
  .app-name { display: none; }
  .net span { display: none; }
}
@media (max-width: 640px) {
  .page-title { font-size: 30px; }
  .projects { padding: 28px 16px 56px; }
  .brand-logo { height: 20px; max-width: 220px; }
  .app-name { font-size: 15px; }
  .topbar-inner { padding: 0 16px; }
}
@media (max-width: 900px) {
  .panel-toggle { display: inline-grid; }
  .panel {
    position: absolute; right: 0; top: 0; bottom: 0; z-index: 15; box-shadow: var(--shadow);
    transform: translateX(105%); transition: transform .22s ease;
  }
  .panel.open { transform: none; }
  .save-state { display: none; }
  .btn.sun .lbl { display: none; }
  .btn.sun { padding: 0 12px; }
}
@media (max-width: 640px) {
  :root { --rail-w: 60px; --panel-w: 100%; }
  .tool { width: 52px; font-size: 10px; }
  .grp { display: none; }
  .projects { padding: 20px 14px 48px; }
  .catman { grid-template-columns: 1fr; }
  .catman-list { border-right: 0; border-bottom: 1px solid var(--line); max-height: 40vh; }
  .grid2 { grid-template-columns: 1fr; }
  .scalebar { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: .01ms !important; }
}

/* ---------- Fotos, Links ---------- */
.cat-item .pr { display: flex; align-items: center; gap: 8px; }
img.thumb { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #fff; }
img.thumb.big { width: 56px; height: 56px; margin-left: auto; }
.props-photo { width: 100%; max-height: 180px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: var(--r); }
.shop-link { display: inline-flex; vertical-align: middle; color: var(--moss); margin-left: 4px; }
.shop-link .ic { width: 16px; height: 16px; }
.mat-table tr.internal td { color: var(--ink-2); font-size: 12.5px; border-top: 1px dashed var(--line); }
.muted.small { font-size: 12.5px; margin: 0; }
.hint-inline { font-weight: 400; color: var(--ink-2); font-size: 12px; margin-left: 4px; }
.input-row { display: flex; gap: 8px; align-items: center; }
.input-row input { flex: 1; }
.photo-field, .sym-pick-wrap { display: grid; gap: 8px; }
.photo-field .k, .sym-pick-wrap .k { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.photo-box { width: 100%; max-width: 280px; aspect-ratio: 4 / 3; border: 1px dashed var(--line); border-radius: var(--r); display: grid; place-items: center; background: var(--sage-2); overflow: hidden; }
.photo-box img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.file-btn { cursor: pointer; }

/* ---------- Symbolauswahl ---------- */
.sym-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.sym-pick button { display: grid; justify-items: center; gap: 4px; padding: 8px 4px 6px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; cursor: pointer; font: inherit; }
.sym-pick button:hover { border-color: var(--moss); }
.sym-pick button[aria-pressed="true"] { border-color: var(--moss); background: #f1f7f1; box-shadow: inset 0 0 0 1px var(--moss); }
.sym-pick .sym { width: 48px; height: 48px; }
.sym-pick span { font-size: 11px; line-height: 1.2; text-align: center; color: var(--ink-2); overflow-wrap: anywhere; hyphens: auto; }

/* ---------- Trafo-Auslastung ---------- */
.power { border-top: 1px solid var(--line); padding: 10px 14px 4px; display: grid; gap: 8px; max-height: 38vh; overflow-y: auto; }
.pw-head { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.pw-row { display: grid; gap: 5px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--sage-2); cursor: pointer; }
.pw-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.pw-top b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pw-bar { height: 6px; border-radius: 3px; background: #d6dfd6; overflow: hidden; }
.pw-bar i { display: block; height: 100%; background: var(--moss); border-radius: 3px; }
.pw-row.warn { background: #fff7de; }
.pw-row.warn .pw-bar i { background: #e0a800; }
.pw-row.over { background: #fdecea; box-shadow: inset 3px 0 0 #d9483b; }
.pw-row.over .pw-bar i { background: #d9483b; }
.pw-row.over .pw-top b { color: #b3261e; }
.pw-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.pw-acts .btn { background: #fff; white-space: normal; text-align: left; justify-content: flex-start; max-width: 100%; min-height: 34px; padding: 6px 12px; line-height: 1.25; }
.power { overflow-x: hidden; }
.pw-row { min-width: 0; }
.pw-top span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pw-note { font-size: 12px; color: var(--ink-2); }
.props .pw-row { cursor: default; }

/* ---------- Plankopf ---------- */
.tb-mini { display: grid; gap: 8px; justify-items: start; }
.tb-mini .k { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.tb-mini-prev { width: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.tb-mini-prev svg { width: 100%; height: auto; display: block; }
.tb-edit { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); flex: 1; min-height: 0; overflow: hidden; border-top: 1px solid var(--line); }
.tb-preview-wrap { background: var(--sage-2); padding: 22px; display: grid; align-content: center; gap: 10px; overflow: auto; }
#tb-preview { width: 100%; height: auto; display: block; touch-action: none; filter: drop-shadow(0 4px 14px rgba(5,68,50,.12)); user-select: none; }
.tb-form { padding: 18px 22px !important; overflow-y: auto; align-content: start; }
.tb-more summary { cursor: pointer; font-weight: 500; font-size: 14px; color: var(--moss); padding: 4px 0; }
.tb-more[open] { display: grid; gap: 10px; }
.plan-card .idx { font-size: 12px; font-weight: 600; color: var(--moss); letter-spacing: .02em; }
@media (max-width: 900px) {
  .tb-edit { grid-template-columns: 1fr; overflow-y: auto; }
  .tb-preview-wrap { padding: 14px; }
  .tb-form { overflow: visible; }
}

/* ---------- Grundriss drehen ---------- */
.rot-field { display: grid; gap: 8px; }
.rot-field .k { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.rot-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rot-num { display: inline-flex !important; align-items: center; gap: 4px !important; }
.form .rot-num input:not([type=checkbox]):not([type=range]), .rot-num input { width: 84px; min-height: 36px; padding: 6px 8px; text-align: right; }
.rot-num span { font-weight: 700; color: var(--ink); }

/* Schalter „Gerade Linien“ in der Hinweisleiste */
.ortho-btn[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Umschalter Kabelverlauf eckig / Kurve */
.shape-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: rgba(255,255,255,.1); }
.shape-seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: #fff; font: inherit; font-weight: 600; font-size: 13.5px; padding: 7px 12px; border-radius: 9px; cursor: pointer; }
.shape-seg button[aria-pressed="true"] { background: #fff; color: var(--forest); }
.shape-seg .ic, .shape-field .ic { width: 18px; height: 18px; }
.shape-field { display: grid; gap: 6px; }
.shape-field .k { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.shape-field .seg button { display: inline-flex; align-items: center; gap: 6px; }

/* =========================================================
   Dunkles Design für Menü und Bedienelemente (Nachtansicht)
   ========================================================= */
body.night-ui {
  --paper: #111c17;
  --sage: #0a130f;
  --sage-2: #18251f;
  --chip: #1c3226;
  --ink: #e3ece6;
  --ink-2: #8fa598;
  --line: #22322a;
  --hover-line: #36503f;
  --accent: #f28c5a;       /* Aprikot – Akzent im dunklen Design */
  --shadow: 0 12px 34px rgba(0, 0, 0, .5);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .35);
  color-scheme: dark;
  background: var(--sage);
  --accent-light: #f6a57e;
}
body.night-ui h1, body.night-ui h2, body.night-ui h3 { color: #d6eedd; }

/* Kopfzeile */
body.night-ui .topbar { background: #07130e; box-shadow: inset 0 -1px 0 #18261f; }
body.night-ui .btn.sun { background: var(--sun); border-color: var(--sun); color: #07130e; }
body.night-ui .btn.sun:hover { background: #ffe38e; border-color: #ffe38e; }
body.night-ui .btn.ghost-light { background: rgba(255,255,255,.06); }
body.night-ui .btn.ghost-light:hover { background: rgba(255,255,255,.12); }
body.night-ui .btn.ghost-light[aria-pressed="true"] { background: rgba(242,140,90,.22); border-color: var(--accent-light); color: var(--accent-light); }

/* Buttons & Chips */
body.night-ui .btn { background: #16231d; }
body.night-ui .btn:hover { border-color: var(--hover-line); box-shadow: none; background: #1b2b23; }
body.night-ui .btn.primary { background: var(--moss); border-color: var(--moss); color: #fff; }
body.night-ui .btn.primary:hover { background: #0a7d3c; border-color: #0a7d3c; }
body.night-ui .btn.link { background: none; color: #6fd39a; }
body.night-ui .btn.danger-text { color: #ff8a7d; }
body.night-ui .icon-btn:hover { background: #1b2b23; }
body.night-ui .seg button { background: #16231d; color: var(--ink); }
body.night-ui .seg button:hover { border-color: var(--hover-line); }
body.night-ui .seg button[aria-pressed="true"] { background: var(--moss); border-color: var(--moss); color: #fff; }

/* Werkzeugleiste & Panel */
body.night-ui .rail, body.night-ui .panel { background: #0e1813; border-color: #1a2821; }
body.night-ui .tool:hover { background: #18251f; }
body.night-ui .tool[aria-pressed="true"] { background: rgba(242,140,90,.2); color: var(--accent-light); box-shadow: inset 0 0 0 1px rgba(246,165,126,.4); }
body.night-ui .tool[aria-pressed="true"] .ic { color: var(--accent-light); }
body.night-ui .tabs { background: #16231d; }
body.night-ui .tabs button[aria-selected="true"] { background: #243a2e; color: #fff; box-shadow: none; }
body.night-ui .cat-item { background: #131f19; border-color: var(--line); }
body.night-ui .cat-item:hover { border-color: var(--hover-line); box-shadow: none; }
body.night-ui .cat-item[aria-pressed="true"] { background: rgba(242,140,90,.1); border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
body.night-ui .search { background: #131f19; }
body.night-ui .search:focus-within, body.night-ui .form input:focus, body.night-ui .form select:focus, body.night-ui .form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(242,140,90,.18); }
body.night-ui .form input:not([type=checkbox]):not([type=range]), body.night-ui .form select, body.night-ui .form textarea,
body.night-ui .extras select, body.night-ui .extras input { background: #131f19; }
body.night-ui .form input[type=range], body.night-ui .form .check input { accent-color: var(--accent-light); }
body.night-ui .kv { background: #16231d; }
body.night-ui .warn-box { background: rgba(242,140,90,.1); border-color: rgba(242,140,90,.35); color: #f6b995; }
body.night-ui .summary { border-color: #1a2821; }
body.night-ui .power { border-color: #1a2821; }

/* Trafo-Auslastung */
body.night-ui .pw-row { background: #16231d; }
body.night-ui .pw-bar { background: #26382e; }
body.night-ui .pw-bar i { background: var(--accent); }
body.night-ui .pw-row.warn { background: rgba(224,168,0,.12); }
body.night-ui .pw-row.over { background: rgba(217,72,59,.14); }
body.night-ui .pw-row.over .pw-top b { color: #ff8a7d; }
body.night-ui .pw-acts .btn { background: #1b2b23; }

/* Plan-Bereich: Hinweisleiste, Zoom, Toast */
body.night-ui .hint { background: #152219; box-shadow: 0 10px 30px rgba(0,0,0,.55), inset 0 0 0 1px #24372c; }
body.night-ui .shape-seg { background: rgba(255,255,255,.06); }
body.night-ui .shape-seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
body.night-ui .zoombox { background: #152219; box-shadow: 0 8px 24px rgba(0,0,0,.5), inset 0 0 0 1px #24372c; }
body.night-ui #toast { background: #1d3327; box-shadow: 0 10px 30px rgba(0,0,0,.5); }

/* Dialoge */
body.night-ui .dlg { background: #111c17; box-shadow: 0 30px 80px rgba(0,0,0,.6), inset 0 0 0 1px #22322a; }
body.night-ui .dlg::backdrop { background: rgba(0, 0, 0, .6); }
body.night-ui .mat-table tr.group td { background: #16231d; color: #b9e6c8; }
body.night-ui .mat-table tr.total.big td { color: #b9e6c8; }
body.night-ui .cm-item[aria-pressed="true"], body.night-ui .sym-pick button[aria-pressed="true"] { background: rgba(242,140,90,.1); border-color: var(--accent); }
body.night-ui .sym-pick button { background: #131f19; }
body.night-ui .tb-preview-wrap { background: #0b1511; }
body.night-ui .photo-box { background: #0b1511; }
body.night-ui .net-pop { background: #111c17; box-shadow: 0 16px 40px rgba(0,0,0,.6), inset 0 0 0 1px #22322a; }

/* ---------- Grundriss-Darstellung (KI) ---------- */
.style-field { display: grid; gap: 8px; }
.style-field .k { font-size: 13px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.ai-badge { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; color: #fff; background: var(--accent); border-radius: 999px; padding: 2px 7px; }
#pf-style button.has::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--moss); margin-left: 6px; vertical-align: middle; }
.form .ai-note { font-size: 12.5px; }
#pf-ai-compare { touch-action: none; user-select: none; -webkit-user-select: none; }
#busy span { max-width: 36ch; text-align: center; }

/* ---------- Neuer Plan ---------- */
.new-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 4px; min-height: 0; overflow: auto; }
.new-grid .form { align-content: start; }
.nf-file-row { display: grid; gap: 8px; justify-items: start; }
.nf-file-row .k, #nf-rot-wrap .k { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.nf-file-row .muted { font-weight: 400; }
.nf-preview {
  position: relative; margin: 12px 22px 12px 0; min-height: 300px; border-radius: 16px; overflow: hidden;
  background: var(--sage-2); border: 1.5px dashed var(--line); cursor: pointer;
}
.nf-preview.drop { border-color: var(--moss); background: #e6f1e8; }
.nf-preview img { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); box-shadow: 0 4px 16px rgba(16,38,29,.15); background: #fff; transition: transform .12s; }
.nf-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--ink-2); text-align: center; font-size: 14px; }
.nf-empty .ic { width: 34px; height: 34px; color: var(--moss); }
@media (max-width: 720px) {
  .new-grid { grid-template-columns: 1fr; }
  .nf-preview { margin: 0 22px 12px; min-height: 220px; }
}

/* ---------- PIN ---------- */
.pin-dlg { width: min(340px, calc(100% - 24px)); }
.pin-box { position: relative; padding: 30px 28px 26px; display: grid; justify-items: center; gap: 6px; }
.pin-close { position: absolute; right: 12px; top: 12px; }
.pin-lock { width: 52px; height: 52px; border-radius: 16px; background: var(--chip); color: var(--forest); display: grid; place-items: center; margin-bottom: 6px; }
.pin-lock .ic { width: 26px; height: 26px; }
.pin-box h2 { font-size: 22px; }
.pin-box p { margin: 0 0 8px; }
.pin-dots { display: flex; gap: 14px; margin: 6px 0 18px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--forest); transition: background .12s, transform .12s; }
.pin-dots i.on { background: var(--forest); }
.pin-dots.ok i { background: var(--moss); border-color: var(--moss); }
.pin-dots.err { animation: pin-shake .4s; }
.pin-dots.err i { border-color: var(--danger); background: var(--danger); }
@keyframes pin-shake { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.pin-pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 12px; }
.pin-pad button {
  width: 72px; height: 72px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper);
  font: inherit; font-size: 26px; font-weight: 600; color: var(--ink); cursor: pointer; display: grid; place-items: center;
  transition: background .1s, transform .08s;
}
.pin-pad button:hover { background: var(--sage-2); }
.pin-pad button:active { transform: scale(.94); background: var(--chip); }
.pin-pad button[data-d="back"] { border-color: transparent; }
.pin-pad .ic { width: 26px; height: 26px; }

.form label.btn { display: inline-flex; }
.form input:not([type=checkbox]):not([type=range]), .form select, .form textarea { font-weight: 500; }
.lbl-row { display: flex; justify-content: space-between; gap: 8px; }
.lbl-row b { color: var(--ink); font-variant-numeric: tabular-nums; }
.props .btn.link { white-space: normal; justify-self: start; }

/* ---------- Plan-Tab: Abschnitte ---------- */
.form.pf { gap: 10px; }
.pf-sec { border: 1px solid var(--line); border-radius: 14px; background: var(--paper); overflow: hidden; }
.pf-sec > summary {
  list-style: none; cursor: pointer; padding: 12px 14px; font-weight: 700; font-size: 14px; color: var(--ink);
  display: flex; align-items: center; justify-content: space-between; user-select: none;
}
.pf-sec > summary::-webkit-details-marker { display: none; }
.pf-sec > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: rotate(45deg); transition: transform .15s; margin-right: 4px; }
.pf-sec[open] > summary::after { transform: rotate(-135deg); }
.pf-sec[open] > summary { border-bottom: 1px solid var(--line); }
.pf-body { padding: 12px 14px 14px; display: grid; gap: 12px; }
.pf-field { display: grid; gap: 6px; }
.pf-field .k, .pf-calib .k { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.seg-full { display: grid !important; grid-auto-flow: column; grid-auto-columns: 1fr; }
.seg-full button { padding: 8px 6px; }
.pf-calib { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--sage-2); }
.pf-calib > div { display: grid; gap: 2px; }
.pf-calib #pf-scale { font-weight: 700; font-size: 14px; }
.warn-text { color: #b3261e !important; }
.pf .rot-row { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 6px; }
.pf .rot-row .btn { padding: 0 8px; }
.pf .rot-num input { width: 68px !important; }
.pf .tb-mini { justify-items: stretch; }
.pf .lbl-row.k { font-size: 13px; font-weight: 600; color: var(--ink-2); display: flex; }
body.night-ui .pf-sec { background: #111c17; }
body.night-ui .pf-calib { background: #16231d; }

/* ---------- Arbeitsmodi & Auswahl ---------- */
#stage { cursor: default; }
#stage.space-pan { cursor: grab; }
#stage.panning { cursor: grabbing !important; }
.stage-wrap.mode-plan #stage [data-kind="item"], .stage-wrap.mode-plan #stage [data-kind="cable"],
.stage-wrap.mode-plan #stage [data-kind="vertex"], .stage-wrap.mode-plan #stage [data-kind="mid"], .stage-wrap.mode-plan #stage [data-kind="rot"] { pointer-events: none; }
.stage-wrap.mode-plan #stage [data-kind="sheet"] { cursor: move; }
.stage-wrap.mode-plan::after {
  content: "Plan bearbeiten"; position: absolute; left: 16px; top: 14px; pointer-events: none;
  font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--forest);
  background: var(--accent); color: #fff; border-radius: 999px; padding: 4px 10px;
}
.props-head.multi { grid-template-columns: 40px 1fr; }
.multi-badge { width: 36px; height: 36px; border-radius: 10px; background: var(--forest); color: #fff; display: grid; place-items: center; font-weight: 800; }
.props-empty ul { padding-left: 18px; margin: 8px 0 0; display: grid; gap: 6px; font-size: 13px; color: var(--ink-2); }

/* ---------- Kontextmenü ---------- */
.ctx-menu {
  position: fixed; z-index: 250; min-width: 230px; max-width: 300px; padding: 6px;
  background: var(--paper); border-radius: 14px; box-shadow: 0 14px 40px rgba(5, 30, 20, .22), 0 0 0 1px var(--line);
  display: grid; gap: 1px; font-size: 14px;
}
.ctx-menu[hidden] { display: none; }
.ctx-menu button {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%;
  border: 0; background: none; font: inherit; color: var(--ink); text-align: left;
  padding: 8px 10px; border-radius: 9px; cursor: pointer;
}
.ctx-menu button:hover, .ctx-menu button:focus-visible { background: var(--sage-2); outline: none; }
.ctx-menu button.danger { color: var(--danger); }
.ctx-menu kbd { font: inherit; font-size: 12px; color: var(--ink-2); }
.ctx-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }
.ctx-title { padding: 6px 10px 4px; font-size: 12px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.night-ui .ctx-menu { background: #111c17; box-shadow: 0 16px 44px rgba(0,0,0,.6), 0 0 0 1px #22322a; }
body.night-ui .ctx-menu button:hover { background: #1b2b23; }

/* ---------- Seitenpanel optimiert ---------- */
.panel { overflow: hidden; }
.tab-body { overflow-x: hidden; }
.tab-body > * { min-width: 0; }
.props, .props .form, .props .row { min-width: 0; }
.props .row { flex-wrap: wrap; }
.power { max-height: 32vh; padding-top: 6px; }
.pw-head { display: flex; align-items: center; justify-content: space-between; width: 100%; border: 0; background: none; padding: 6px 0; cursor: default; font: inherit; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.pw-head span { flex: 1; text-align: left; }
.pw-st { text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.pw-st.ok { color: var(--moss); } .pw-st.warn { color: #9a6b00; } .pw-st.bad { color: var(--danger); }
@media (max-height: 760px) { .power { max-height: 26vh; } .summary { padding: 8px 14px; } }
.cat-list { grid-template-columns: minmax(0, 1fr); }
.cat-item { width: 100%; min-width: 0; grid-template-columns: 40px minmax(0, 1fr) auto; font: inherit; color: inherit; }
.cat-item > span { min-width: 0; }
.cat-item .nm { overflow-wrap: anywhere; }
.cat-item .pr { white-space: nowrap; }
.tab-body .search, .tab-body .seg { max-width: 100%; }

/* =========================================================
   Umbau: Reiter Plan/Grundriss, Segment-Schalter, schwebende Bereiche
   ========================================================= */
/* Segment-Schalter wie die Reiter oben (weniger rund) */
.seg { display: inline-flex; flex-wrap: nowrap; gap: 2px; padding: 4px; border-radius: 12px; background: var(--sage-2); }
.seg button { border: 0; background: none; border-radius: 9px; padding: 7px 12px; font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.seg button:hover { border: 0; color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--paper); color: var(--forest); font-weight: 700; box-shadow: 0 1px 3px rgba(16,38,29,.12); border: 0; }
#cat-filter { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; }
body.night-ui .seg { background: #16231d; }
body.night-ui .seg button { background: none; color: var(--ink-2); }
body.night-ui .seg button[aria-pressed="true"] { background: #243a2e; color: #fff; box-shadow: none; }
.cat-foot-hint { margin: 10px 2px 0; font-size: 12px; color: var(--ink-2); }
.cat-item { grid-template-columns: 40px minmax(0, 1fr) auto; }
.cat-item .pr:empty { display: none; }

/* Katalog-Knopf oben (nur Symbol) */
.btn.icon-only { width: 42px; padding: 0; }
.btn.icon-only .ic { width: 20px; height: 20px; }

/* Zurück zum Katalog */
.props-back { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 2px 4px 2px 0; margin-bottom: 4px; color: var(--moss); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; justify-self: start; }
.props-back .ic { width: 16px; height: 16px; }

/* Trafo-Auslastung schwebend links unten im Planbereich */
.stage-wrap .power {
  position: absolute; left: 16px; bottom: 44px; width: 300px; max-width: calc(100% - 32px); max-height: 45%;
  background: var(--paper); border: 0; border-radius: 14px; box-shadow: var(--shadow-soft), 0 0 0 1px var(--line);
  padding: 4px 12px 8px; z-index: 5;
}
body.night-ui .stage-wrap .power { background: #111c17; box-shadow: 0 10px 30px rgba(0,0,0,.5), 0 0 0 1px #22322a; }

/* Werkzeugleiste im Reiter „Plan“ */
.gr-bar {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 6;
  display: flex; align-items: center; gap: 4px; padding: 5px 8px; border-radius: 14px;
  background: var(--paper); box-shadow: var(--shadow-soft), 0 0 0 1px var(--line); white-space: nowrap;
}
.gr-bar .gr-k { font-size: 12px; font-weight: 700; color: var(--ink-2); margin: 0 4px; }
.gr-bar b { min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; }
.gr-bar .icon-btn { width: 36px; height: 36px; }
.gr-sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
body.night-ui .gr-bar { background: #111c17; box-shadow: 0 10px 30px rgba(0,0,0,.5), 0 0 0 1px #22322a; }
.stage-wrap.mode-plan .hint { display: none; }
.stage-wrap.mode-plan .zoombox { bottom: 70px; }

/* Rechtsklick-Untermenü mit Raster */
.ctx-menu button[data-sub].open { background: var(--sage-2); }
.ctx-arrow { font-size: 18px; line-height: 1; color: var(--ink-2); }
.ctx-sub {
  position: fixed; z-index: 251; width: min(460px, calc(100vw - 16px)); max-height: min(70vh, 560px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--paper); border-radius: 16px; padding: 10px; box-shadow: 0 18px 50px rgba(5, 30, 20, .25), 0 0 0 1px var(--line);
}
.ctx-sub[hidden] { display: none; }
.ctx-sub-head { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); padding: 2px 6px 8px; }
.ctx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.ctx-tile {
  display: grid; justify-items: center; align-content: start; gap: 4px; padding: 10px 6px 8px; min-height: 108px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--paper); cursor: pointer; font: inherit; color: var(--ink); text-align: center;
  transition: border-color .12s, background .12s, transform .08s;
}
.ctx-tile:hover { border-color: var(--accent); background: rgba(0,154,147,.06); }
.ctx-tile:active { transform: scale(.97); }
.ctx-tile .sym { width: 42px; height: 42px; }
.ctx-tile .nm { font-size: 12.5px; font-weight: 600; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ctx-tile .dt { font-size: 11px; color: var(--ink-2); line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
body.night-ui .ctx-sub { background: #111c17; box-shadow: 0 18px 50px rgba(0,0,0,.6), 0 0 0 1px #22322a; }
body.night-ui .ctx-tile { background: #131f19; }
.ctx-tile { min-width: 0; }
.ctx-tile .nm, .ctx-tile .dt { overflow-wrap: anywhere; hyphens: auto; max-width: 100%; }
.ctx-tile .nm { font-size: 12px; }

/* ---------- Modus-Schild in beiden Reitern ---------- */
.stage-wrap:not(.mode-plan)::after {
  content: "Platzieren"; position: absolute; left: 16px; top: 14px; pointer-events: none;
  font-size: 12px; font-weight: 700; letter-spacing: .04em; color: #fff; background: var(--accent); border-radius: 999px; padding: 4px 10px;
}
.stage-wrap.mode-plan::after { color: #fff; }

/* ---------- Trafo-Auslastung: oben links, ohne Kartenhintergrund ---------- */
.stage-wrap .power {
  top: 50px; bottom: auto; left: 16px; width: 290px; max-height: 50%;
  background: transparent !important; box-shadow: none !important; border: 0; padding: 0; overflow: visible auto;
}
.stage-wrap .power .pw-head { padding: 2px 2px 6px; text-shadow: 0 0 6px rgba(255,255,255,.9); }
.stage-wrap.night .power .pw-head { text-shadow: 0 0 6px rgba(0,0,0,.8); }
.stage-wrap .power .pw-row { box-shadow: 0 2px 10px rgba(16,38,29,.08); backdrop-filter: blur(6px); background: rgba(238,243,239,.86); }
.stage-wrap .power .pw-row.over { background: rgba(253,236,234,.92); }
.stage-wrap .power .pw-row.warn { background: rgba(255,247,222,.92); }
body.night-ui .stage-wrap .power .pw-row { background: rgba(22,35,29,.86); }

/* ---------- Raster & Lineal ---------- */
.view-tools { position: absolute; left: 16px; bottom: 16px; display: flex; align-items: flex-end; gap: 6px; z-index: 6; }
.view-tools .scalebar { position: static; margin-left: 8px; }
.vt-btn {
  width: 38px; height: 38px; border-radius: 11px; border: 0; display: grid; place-items: center; cursor: pointer;
  background: var(--paper); color: var(--ink-2); box-shadow: var(--shadow-soft), 0 0 0 1px var(--line);
}
.vt-btn:hover { color: var(--ink); }
.vt-btn[aria-pressed="true"] { background: var(--accent); color: #fff; box-shadow: none; }
.vt-btn .ic { width: 20px; height: 20px; }
#btn-snap .snap-slash { display: none; }
#btn-snap[aria-pressed="false"] .snap-slash { display: inline; }
#btn-snap[aria-pressed="false"] { color: var(--danger); }
body.night-ui .vt-btn { background: #152219; box-shadow: 0 0 0 1px #24372c; }
body.night-ui .vt-btn[aria-pressed="true"] { background: var(--accent); color: #fff; }
.grid-pop {
  position: absolute; left: 0; bottom: 48px; width: 270px; padding: 12px 14px; border-radius: 14px; display: grid; gap: 10px;
  background: var(--paper); box-shadow: 0 14px 40px rgba(5, 30, 20, .22), 0 0 0 1px var(--line);
}
.grid-pop[hidden] { display: none; }
.grid-pop .k { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.gp-head { display: flex; align-items: center; justify-content: space-between; }
.gp-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.gp-steps button { border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 6px 0; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink); cursor: pointer; }
.gp-steps button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.grid-pop .check { font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.grid-pop .check input { accent-color: var(--accent); width: 18px; height: 18px; }
body.night-ui .grid-pop { background: #111c17; box-shadow: 0 14px 40px rgba(0,0,0,.6), 0 0 0 1px #22322a; }
body.night-ui .gp-steps button { background: #16231d; }
.switch { position: relative; width: 40px; height: 22px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #c9d4cb; transition: background .15s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }

/* Plankopf-Dialog */
.tb-auto { display: grid; gap: 4px; }
.tb-auto .k { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.tb-auto b { font-weight: 600; padding: 10px 14px; border-radius: 10px; background: var(--sage-2); }
.tb-north { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tb-north .rot-row { display: flex; gap: 6px; align-items: center; }
.tb-north .rot-row.disabled { opacity: .4; pointer-events: none; }

.gr-bar { left: 240px; transform: none; bottom: 16px; }
@media (max-width: 1100px) { .gr-bar { left: auto; right: 16px; bottom: 70px; } }

.stage-wrap.mode-plan #stage [data-kind="bgsize"] { pointer-events: all; }

/* Button-Texte nicht markierbar */
button, .btn, .tool, .seg, .tabs, .vt-btn, .ctx-menu, .gr-bar, .hint, .pw-head, label.btn { -webkit-user-select: none; user-select: none; }
.gr-bar { left: auto !important; right: 196px; }
@media (max-width: 1100px) { .gr-bar { right: 16px; bottom: 70px; } }
.tool span { font-size: 10.5px; letter-spacing: -0.01em; white-space: nowrap; }

/* Dunkles Design: Akzent Aprikot auch für Kacheln, Schalter und Knöpfe */
body.night-ui .ctx-tile:hover { border-color: var(--accent); background: rgba(242,140,90,.08); }
body.night-ui .gp-steps button[aria-pressed="true"], body.night-ui .switch input:checked + span { background: var(--accent); border-color: var(--accent); }
body.night-ui .grid-pop .check input, body.night-ui .form .check input { accent-color: var(--accent); }
body.night-ui .ai-badge { background: var(--accent); color: #1b0f08; }
body.night-ui .ortho-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #1b0f08; }
body.night-ui .stage-wrap::after { color: #1b0f08; }
body.night-ui .vt-btn[aria-pressed="true"] { color: #1b0f08; }
body.night-ui .tool[aria-pressed="true"] { background: rgba(242,140,90,.18); }
body.night-ui .btn.sun { background: var(--accent); border-color: var(--accent); color: #1b0f08; }
body.night-ui .btn.sun:hover { background: #f6a57e; border-color: #f6a57e; }
.plan-handle { opacity: .85; transition: opacity .15s; }
.plan-handle:hover { opacity: 1; }

/* Leiste im Reiter „Plan“ oben rechts im Planbereich */
.gr-bar { top: 14px; bottom: auto !important; right: 16px !important; left: auto !important; transform: none !important; }
.stage-wrap.mode-plan .zoombox { bottom: 16px; }
body.mode-plan-ui #toast { top: 136px; }
.multi-badge.measure { background: var(--accent); }
.multi-badge.measure .ic { width: 22px; height: 22px; }

/* Umschalter in den Eigenschaften (Lichtkegel, Verlauf): volle Breite, gleich breite Hälften */
.shape-field .seg { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
.shape-field .seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.shape-field .seg button .ic { width: 16px; height: 16px; }
body.night-ui .props-back { color: var(--accent); }
/* Hinweisleiste: Text darf umbrechen, die Knöpfe bleiben immer ganz sichtbar */
.hint .txt { white-space: normal; min-width: 0; flex: 1 1 150px; line-height: 1.3; }
.hint > :not(.txt) { flex-shrink: 0; }
.hint { flex-wrap: wrap; row-gap: 6px; border-radius: 24px; left: 16px; right: 16px; transform: none; margin: 0 auto; width: fit-content; }
.tool:disabled { opacity: .3; cursor: not-allowed; }
.stage-wrap .hint { bottom: 68px; max-width: calc(100% - 32px); }

/* Strom: ein leuchtender Punkt fährt langsam die Leitung entlang (nur Ansicht „Platzieren“) */
/* Einrast-Fadenkreuz: springt beim Wechsel auf einen neuen Punkt kurz auf */
.snap-pop { transform-box: fill-box; transform-origin: center; animation: snap-pop .18s cubic-bezier(.2,.9,.3,1.3) both; }
@keyframes snap-pop { from { transform: scale(1.45); opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .snap-pop { animation: none; } }
@keyframes energy-run { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -100; } }
.energy .pulse { animation-name: energy-run; animation-timing-function: linear; animation-iteration-count: infinite; }
.stage-wrap.night .energy { mix-blend-mode: screen; }
@media (prefers-reduced-motion: reduce) { .energy .pulse { animation-name: energy-run !important; animation-iteration-count: infinite !important; } }

/* Werkzeuge mit Fadenkreuz – auch im Reiter „Plan“ keine Hand */
.stage-wrap #stage.crosshair, .stage-wrap.mode-plan #stage.crosshair, .stage-wrap #stage.crosshair [data-kind] { cursor: crosshair !important; }

/* Einmessen: deutlich erkennbarer Modus */
.stage-wrap[data-tool="calib"]::after { content: "Maßstab einmessen · Referenzstrecke anklicken"; background: var(--accent); color: #fff; }
.stage-wrap[data-tool="calib"] { box-shadow: inset 0 0 0 3px var(--accent); }
.stage-wrap[data-tool="calib"] .power, .stage-wrap[data-tool="calib"] .gr-bar { display: none !important; }
.stage-wrap[data-tool="calib"] .hint { box-shadow: 0 10px 30px rgba(0,0,0,.25), 0 0 0 2px var(--accent); }
.stage-wrap[data-tool="measure"]::after { content: "Messen"; }
body.night-ui .stage-wrap[data-tool="calib"]::after { color: #1b0f08; }
.tool span { hyphens: manual; text-align: center; line-height: 1.1; white-space: normal; }
.stage-wrap[data-tool="calib"]::after { content: "Referenzmaß einmessen · Strecke mit bekannter Länge anklicken"; }

/* Kabelfarbe: Farbfelder aus den Markenfarben */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--paper); background: var(--sw); cursor: pointer; box-shadow: 0 0 0 1px var(--line); padding: 0; }
.swatch.std { background: conic-gradient(#009a93 0 25%, #f28c5a 0 50%, #006b66 0 75%, #5f8f6a 0); }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--ink); }
/* Legenden-Dialog */
.lg-form { max-height: min(70vh, 640px); overflow-y: auto; }
.lg-group { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.lg-group > .k { font-size: 13px; font-weight: 700; color: var(--ink); }
.lg-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.lg-checks .check, .lg-group .check { font-size: 13.5px; }
.check.inline { display: inline-flex; font-weight: 700; }
.lg-checks input:disabled + * , .lg-checks label:has(input:disabled) { opacity: .45; }
@media (max-width: 560px) { .lg-checks { grid-template-columns: 1fr; } }

/* Zoom-Auswahl */
.zoombox { position: absolute; }
.zoom-pop {
  position: absolute; right: 0; bottom: calc(100% + 8px); min-width: 190px; padding: 6px; display: grid; gap: 1px;
  background: var(--paper); border-radius: 12px; box-shadow: 0 14px 40px rgba(5, 30, 20, .22), 0 0 0 1px var(--line); z-index: 20;
}
.zoom-pop[hidden] { display: none; }
.zoom-pop button { display: flex; justify-content: space-between; gap: 10px; border: 0; background: none; font: inherit; font-size: 14px; color: var(--ink); padding: 8px 10px; border-radius: 8px; cursor: pointer; text-align: left; }
.zoom-pop button span { color: var(--ink-2); font-size: 12px; }
.zoom-pop button:hover { background: var(--sage-2); }
.zoom-pop button.on { font-weight: 700; color: var(--accent); }
.zoom-pop hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }
body.night-ui .zoom-pop { background: #111c17; box-shadow: 0 14px 40px rgba(0,0,0,.6), 0 0 0 1px #22322a; }
body.night-ui .zoom-pop button:hover { background: #1b2b23; }

/* Bildschirm kalibrieren */
.scr-card-wrap { overflow-x: auto; padding: 4px 0; }
.scr-card { border-radius: 3.2mm; background: linear-gradient(135deg, var(--accent), var(--forest)); color: #fff; display: grid; place-items: end start; padding: 8px 10px; font-size: 12px; font-weight: 600; box-shadow: 0 4px 14px rgba(0,0,0,.15); }
.scr-row { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
.scr-bar { height: 12px; border: 2px solid var(--forest); border-top: 0; position: relative; margin: 14px 0 4px; }
.scr-bar span { position: absolute; left: 0; top: -18px; font-size: 11px; color: var(--ink-2); }
.btn.ai-go { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.btn.ai-go:hover { background: #008880; border-color: #008880; }
.btn.ai-go:disabled { opacity: .5; }
body.night-ui .btn.ai-go { color: #1b0f08; }

/* =========================================================
   Kopfzeile im Planbereich, Ansicht-Werkzeug, einklappbare Seitenleiste, Tablet (iPad)
   ========================================================= */
/* Browser-Zoom per Doppeltippen aus; Eingabefelder am Touchgerät mind. 16 px, sonst zoomt iOS beim Antippen */
html, body { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
@media (pointer: coarse) { input, select, textarea { font-size: 16px !important; } }

/* Alte Modus-Anzeige (Pseudo-Element) durch echte Kopfzeile ersetzt */
.stage-wrap::after, .stage-wrap.mode-plan::after, .stage-wrap[data-tool]::after { content: none !important; display: none !important; }
.stage-top {
  position: absolute; left: 14px; right: 14px; top: 12px; z-index: 6;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; pointer-events: none;
}
.stage-top > * { pointer-events: auto; }
.mode-chip {
  flex: none; font-size: 12px; font-weight: 700; letter-spacing: .03em; color: #fff; background: var(--accent);
  border-radius: 999px; padding: 5px 11px; white-space: nowrap; pointer-events: none;
}
.mode-chip[data-tool="view"] { background: var(--forest); }
body.night-ui .mode-chip { color: #1b0f08; }
body.night-ui .mode-chip[data-tool="view"] { background: #f6c9ae; }
.stage-wrap[data-tool="calib"] .mode-chip { white-space: normal; }

/* Trafo-Auslastung als Zeile neben der Modus-Anzeige */
.stage-top .power {
  position: static !important; width: auto; max-width: 100%; max-height: none; overflow: visible;
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0;
  background: transparent !important; box-shadow: none !important; border: 0;
}
.stage-top .power[hidden] { display: none; }
.stage-top .power .pw-head {
  width: auto; flex: none; gap: 6px; padding: 5px 10px !important; border-radius: 999px; font-size: 11px;
  background: rgba(255,255,255,.88); box-shadow: 0 0 0 1px var(--line); text-shadow: none !important;
}
.stage-top .power .pw-head span { flex: none; }
.stage-top .power .pw-row { padding: 5px 10px; gap: 3px; min-width: 170px; max-width: 320px; border-radius: 12px; }
.stage-top .power .pw-top { font-size: 12px; }
.stage-top .power .pw-bar { height: 4px; }
.stage-top .power .pw-acts { display: flex; flex-wrap: wrap; gap: 6px; }
body.night-ui .stage-top .power .pw-head { background: rgba(17,28,23,.9); box-shadow: 0 0 0 1px #22322a; }

/* Leiste im Reiter „Plan“ in derselben Zeile */
.stage-top .gr-bar { position: static !important; transform: none !important; flex: none; }
.stage-top .gr-bar[hidden] { display: none; }

/* Meldungen unten über der Hinweisleiste statt über der Kopfzeile */
#toast { top: auto !important; bottom: 168px; transform: translate(-50%, 10px); }
#toast.show { transform: translate(-50%, 0); }

/* Ansicht-Werkzeug: nur schauen */
#stage.tool-view, #stage.tool-view * { cursor: grab !important; }
#stage.tool-view.panning, #stage.tool-view.panning * { cursor: grabbing !important; }

/* Hinweisleiste kompakter, damit sie am Tablet in eine Zeile passt */
.hint { gap: 8px; padding: 5px 5px 5px 14px; }
.hint .txt { flex: 0 1 auto; min-width: 90px; }
.hint .btn { padding: 0 12px; }
.hint .shape-seg button { padding: 0 10px; }
@media (max-width: 1300px) {
  .hint { font-size: 13px; }
  .hint .btn, .hint .shape-seg button { min-height: 32px; font-size: 13px; }
  .hint .shape-seg .ic { width: 16px; height: 16px; }
}

/* Seitenleiste: Kopf mit Einklapp-Knopf */
.panel-head { display: flex; align-items: center; gap: 6px; padding: 12px 12px 4px; }
.panel-head .tabs { flex: 1; margin: 0; }
.panel-mini-btn {
  flex: none; width: 34px; height: 34px; border-radius: 10px; border: 0; background: var(--sage-2); color: var(--ink-2);
  display: grid; place-items: center; cursor: pointer;
}
.panel-mini-btn:hover { color: var(--ink); }
.panel-mini-btn .ic { width: 18px; height: 18px; }
body.night-ui .panel-mini-btn { background: #16231d; color: #cfe0d6; }
@media (min-width: 901px) { .panel-toggle { display: inline-grid; } }
.panel-toggle[aria-pressed="true"] { background: rgba(255,255,255,.16); }

/* Eingeklappt: schmale, aufgeräumte Leiste – oben Leuchten/Kabel/Zubehör als Symbole, darunter die Artikel als Kacheln
   (Symbol + Kurzname). Antippen wählt, Ziehen setzt direkt in den Plan. */
.seg-ic { display: none; }
.cat-item .mn { display: none; }
@media (min-width: 901px) { .panel { transition: width .2s ease; } }
.panel.mini { width: 92px; }
.panel.mini .panel-head { justify-content: center; padding: 12px 0 8px; }
.panel.mini .panel-mini-btn { transform: rotate(180deg); width: 40px; height: 40px; border-radius: 12px; }
.panel.mini .tabs, .panel.mini .search, .panel.mini .cat-auto, .panel.mini .cat-foot-hint,
.panel.mini .summary, .panel.mini #tab-props, .panel.mini #tab-plan,
.panel.mini .cat-chips { display: none !important; }
.panel.mini #tab-catalog { display: flex !important; padding: 0 10px 16px; gap: 10px; }
.stage-wrap.mode-plan ~ .panel.mini #tab-catalog { display: none !important; }
.panel.mini .cat-tools { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.panel.mini #cat-filter { display: grid !important; grid-auto-flow: row; grid-template-columns: 1fr; gap: 3px; padding: 4px; border-radius: 14px; width: 100%; }
.panel.mini #cat-filter button { display: grid; justify-items: center; gap: 3px; padding: 8px 0 6px; font-size: 10px; font-weight: 600; letter-spacing: .01em; border-radius: 10px; }
.panel.mini #cat-filter .seg-ic { display: block; width: 20px; height: 20px; }
.panel.mini .cat-list { gap: 6px; }
.panel.mini .cat-item {
  grid-template-columns: 1fr; justify-items: center; align-content: start; gap: 5px;
  padding: 8px 4px 7px; border-radius: 12px; text-align: center;
}
.panel.mini .cat-item > span:not(.mn) { display: none; }
.panel.mini .cat-item .sym { width: 32px; height: 32px; }
.panel.mini .cat-item .mn {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  max-width: 100%; font-size: 10.5px; line-height: 1.22; font-weight: 600; color: var(--ink);
  hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word;
}
.panel.mini .cat-item[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--moss); border-color: var(--moss); background: #f1f7f1; }
body.night-ui .panel.mini .cat-item[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent); border-color: var(--accent); background: rgba(242,140,90,.1); }
.panel.mini .cat-list > .muted { font-size: 11px; text-align: center; }
.stage-top { align-items: flex-start; }
.stage-top .mode-chip { margin-top: 3px; }
.stage-wrap[data-tool="view"] .pw-acts { display: none !important; }
.stage-wrap[data-tool="view"] .pw-row { cursor: default; }

/* ---------- Katalog bearbeiten: feste Fenstergröße, aufgeräumtes Formular ---------- */
#dlg-catalog[open] { display: flex; flex-direction: column; height: min(972px, calc(100dvh - 32px)); }
#dlg-catalog .catman { flex: 1; min-height: 0; }
#dlg-catalog .catman-form { min-height: 0; overflow-y: auto; gap: 12px; }
.price-info { margin: -4px 0 0; font-size: 12px; color: var(--ink-2); opacity: .85; }
.price-info.neg { color: var(--danger); opacity: 1; }
.cm-light-row { align-items: end; }
.cm-light-row .seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.cm-light-row .seg .ic { width: 16px; height: 16px; }
.cm-dim { align-self: center; }
.sym-field { display: grid; gap: 8px; }
.sym-field .k { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.sym-current {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 12px 6px 8px; font: inherit; text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff;
}
.sym-current:hover, .sym-current[aria-expanded="true"] { border-color: var(--moss); }
.sym-current .sym { width: 38px; height: 38px; flex: none; }
.sym-current span { flex: 1; font-size: 14px; }
.sym-current em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--accent); }
.sym-pop { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px; background: var(--sage-2); }
.sym-pop[hidden] { display: none; }
.sym-pop .sym-pick { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
.sym-pop .sym-pick .sym { width: 40px; height: 40px; }
.photo-row { display: flex; align-items: center; gap: 14px; }
.photo-row .photo-box { width: 104px; max-width: none; aspect-ratio: 4 / 3; flex: none; }
.photo-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.cm-del-row { margin-top: 4px; }
body.night-ui .sym-current { background: #131f19; border-color: #24372c; }
body.night-ui .sym-pop { background: #0e1813; border-color: #24372c; }

/* ---------- Artikelfotos: 2 Fotos, Ausschnitt per Ziehen ---------- */
.photo-slots { display: flex; flex-wrap: wrap; gap: 12px; }
.photo-slot { display: grid; gap: 6px; width: 188px; }
.photo-slot .photo-box { width: 188px; max-width: none; aspect-ratio: 4 / 3; }
.photo-box.has { border-style: solid; }
.photo-box.has img { object-fit: cover; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.photo-box.has img.dragging { cursor: grabbing; }
.photo-box.add { cursor: pointer; color: var(--ink-2); font-size: 13px; font-weight: 600; gap: 4px; align-content: center; justify-items: center; }
.photo-box.add:hover { border-color: var(--moss); color: var(--moss); }
.photo-box.add .ic { width: 22px; height: 22px; }
.photo-slot .photo-acts { gap: 6px; }
.photo-slot .photo-acts .btn { padding: 0 10px; }
.props-photos { display: grid; gap: 6px; }
.props-photos.n2 { grid-template-columns: 1fr 1fr; }
.props-photos .props-photo { width: 100%; max-height: none; aspect-ratio: 4 / 3; object-fit: cover; }

/* ---------- Foto-Ausschnitt mit Zoom, Foto ganz ansehen ---------- */
.photo-zoom { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.photo-zoom input { flex: 1; min-width: 0; accent-color: var(--accent); }
.thumb-wrap { display: inline-block; width: 34px; height: 34px; overflow: hidden; border-radius: 6px; border: 1px solid var(--line); background: #fff; cursor: zoom-in; flex: none; }
.thumb-wrap img.thumb { width: 100%; height: 100%; border: 0; border-radius: 0; display: block; }
.props-photo-wrap { overflow: hidden; border: 1px solid var(--line); border-radius: var(--r); aspect-ratio: 4 / 3; background: #fff; cursor: zoom-in; }
.props-photo-wrap .props-photo { width: 100%; height: 100%; border: 0; border-radius: 0; display: block; }
.photo-view { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100dvh; width: 100vw; height: 100dvh; overflow: hidden; }
.photo-view[open] { display: grid; place-items: center; }
.photo-view::backdrop { background: rgba(3, 12, 8, .88); }
.photo-view img { max-width: calc(100vw - 120px); max-height: calc(100dvh - 80px); object-fit: contain; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.5); cursor: zoom-out; background: #fff; }
.pv-btn { position: fixed; width: 46px; height: 46px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: rgba(255,255,255,.14); color: #fff; }
.pv-btn:hover { background: rgba(255,255,255,.26); }
.pv-btn[hidden] { display: none; }
.pv-close { top: 16px; right: 16px; }
.pv-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.pv-next { right: 16px; top: 50%; transform: translateY(-50%); }
.pv-count { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 13px; font-weight: 600; opacity: .8; }
@media (max-width: 640px) { .photo-view img { max-width: calc(100vw - 24px); } }

/* ---------- Leuchten-Kategorien ---------- */
.cat-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-chips[hidden] { display: none; }
.cat-chips button { border: 1px solid var(--line); background: var(--paper); color: var(--ink-2); border-radius: 999px; padding: 4px 11px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.cat-chips button:hover { border-color: var(--moss); color: var(--ink); }
.cat-chips button[aria-pressed="true"] { background: var(--forest); border-color: var(--forest); color: #fff; }
body.night-ui .cat-chips button { background: #131f19; border-color: #24372c; color: #cfe0d6; }
body.night-ui .cat-chips button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #1b0f08; }
.cm-group { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); padding: 10px 8px 2px; }
.cm-group:first-child { padding-top: 2px; }
.sym-def { font-size: 10px; font-weight: 700; color: var(--accent); display: block; }
body.night-ui .cm-group { color: #9fb5a6; }
.sym-pop .sym-pick span { overflow-wrap: normal; word-break: normal; hyphens: auto; }

/* Katalog bearbeiten: Reiter Leuchten/Kabel/Zubehör über die volle Breite */
#cm-filter { display: grid !important; grid-template-columns: repeat(3, 1fr); width: 100%; }
#cm-filter button { text-align: center; }
/* Frühere Katalogstände */

.cm-checks { display: grid; gap: 4px; align-self: center; justify-items: start; }

/* 6.8: Hinweis in Dialogen sichtbar (Popover liegt über offenen Dialogen) */
#toast[popover] { right: auto; margin: 0; border: 0; overflow: visible; color: #fff; }
/* Dimmbar/Unterwasser: nur das Kästchen samt Beschriftung reagiert, nicht die ganze Zeile */
.cm-checks .check { display: inline-flex; width: auto; justify-self: start; cursor: pointer; }
body.night-ui 
/* 6.9: Sicherungen */
#cm-backups .ic { width: 18px; height: 18px; }
#dlg-backups .dlg-body { padding: 0 24px 22px; }
.bk-list { display: grid; gap: 8px; margin-top: 12px; max-height: 60vh; overflow-y: auto; }
.bk-item { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.bk-when { display: flex; align-items: center; gap: 8px; font-size: 14.5px; }
.bk-new { font-size: 11px; font-weight: 700; color: #fff; background: var(--moss); border-radius: 999px; padding: 2px 8px; }
.bk-counts { grid-column: 1; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--ink-2); }
.bk-counts b { color: var(--ink); }
.bk-counts em { font-style: normal; font-weight: 700; margin-left: 2px; }
.bk-counts em.more { color: var(--moss); } .bk-counts em.less { color: var(--danger); }
.bk-item .btn { grid-column: 2; grid-row: 1 / span 2; }
.bk-foot { display: flex; justify-content: flex-end; margin-top: 12px; }
body.night-ui .bk-item { background: #131f19; border-color: #24372c; }
/* Materialliste: Hinweis */
.info-box { background: var(--sage-2); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r); padding: 10px 14px; font-size: 14px; }
body.night-ui .info-box { background: #16231d; border-color: #24372c; color: #cfe0d6; }
/* Helligkeitsfilter */
.lm-chips { align-items: center; }
.lm-chips .lm-k { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); margin-right: 2px; }
.panel.mini .lm-chips { display: none !important; }
/* Trafo-Auslastung am Desktop: unter der Modus-Anzeige, darunter die Meldungen */
@media (min-width: 1301px) {
  .stage-top .power { flex-basis: 100%; flex-direction: column; align-items: flex-start; gap: 6px; }
  .stage-top .power .pw-row { width: 300px; min-width: 0; max-width: 300px; padding: 8px 12px; gap: 5px; }
  .stage-top .power .pw-top { font-size: 12.5px; }
  .stage-top .power .pw-acts .btn { width: 100%; justify-content: center; }
}
#dlg-backups { width: min(600px, calc(100vw - 24px)); }
.bk-when b { white-space: nowrap; }

/* 7.0: Fotoausschnitt frei verschiebbar – freie Flächen weiß */
.photo-box.has, .thumb-wrap, .props-photo-wrap { background: #fff; }
.photo-box.has img, .thumb-wrap img.thumb, .props-photo-wrap .props-photo { background: transparent; }
.photo-acts { flex-wrap: wrap; }

/* Artikel in den Eigenschaften: Karte statt Liste */
.art-pick { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; width: 100%; padding: 8px 12px 8px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); font: inherit; color: var(--ink); text-align: left; cursor: pointer; min-height: 64px; }
.art-pick:hover { border-color: var(--moss); }
.art-pick .ap-img { width: 64px; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: #fff; border: 1px solid var(--line); display: block; }
.art-pick .ap-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.art-pick .ap-sym { width: 48px; height: 48px; display: grid; place-items: center; }
.art-pick .ap-sym .sym { width: 40px; height: 40px; }
.art-pick .ap-txt { display: grid; gap: 2px; min-width: 0; }
.art-pick .ap-txt b { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-pick .ap-txt small { font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-pick .ap-go { font-size: 13px; font-weight: 700; color: var(--moss); }
body.night-ui .art-pick { background: #131f19; border-color: #24372c; color: #e6efe9; }

/* Auswahl-Fenster mit Bildern */
#dlg-pick[open] { display: flex; flex-direction: column; width: min(1100px, calc(100vw - 32px)); height: min(860px, calc(100dvh - 32px)); }
.pk-tools { display: grid; gap: 8px; padding: 0 24px 12px; border-bottom: 1px solid var(--line); }
.pk-tools .search { max-width: 460px; }
.pk-grid { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 24px 24px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.pk-group { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); margin: 16px 2px 8px; }
.pk-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.pk-card { display: flex; flex-direction: column; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); overflow: hidden; cursor: pointer; font: inherit; color: var(--ink); text-align: left; transition: border-color .15s, box-shadow .15s, transform .15s; touch-action: manipulation; }
.pk-card:hover { border-color: var(--moss); box-shadow: 0 8px 24px rgba(16,38,29,.12); transform: translateY(-1px); }
.pk-card:active { transform: scale(.985); }
.pk-card[aria-pressed="true"] { border: 2px solid var(--moss); box-shadow: 0 0 0 3px rgba(62,140,96,.18); }
.pk-img { position: relative; display: block; aspect-ratio: 4 / 3; background: #fff; overflow: hidden; border-bottom: 1px solid var(--line); }
.pk-img img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.pk-sym { position: absolute; inset: 0; display: grid; place-items: center; background: var(--sage-2); }
.pk-sym .sym { width: 64px; height: 64px; }
.pk-badge { position: absolute; left: 8px; top: 8px; width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.92); display: grid; place-items: center; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.pk-badge .sym { width: 24px; height: 24px; }
.pk-body { display: grid; gap: 6px; padding: 10px 12px 12px; }
.pk-nm { font-size: 14.5px; font-weight: 600; line-height: 1.25; overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto; }
.pk-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.pk-tags .tag { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--sage-2); color: var(--ink-2); white-space: nowrap; }
.pk-tags .tag.lm { background: #fff3cf; color: #7a5600; }
.pk-tags .tag.dim { background: #e3f1e8; color: #2d6b47; }
.pk-tags .tag.water { background: #e2eff9; color: #2f7fbf; }
.pk-tags .tag.mains { background: #fde3e0; color: #b3261e; }
.pk-meta { font-size: 12px; color: var(--ink-2); }
.pk-empty { padding: 24px 4px; }
body.night-ui .pk-card { background: #131f19; border-color: #24372c; color: #e6efe9; }
body.night-ui .pk-tools { border-color: #22322a; }
body.night-ui .pk-tags .tag { background: #1c2c24; color: #cfe0d6; }
/* Tablet: großes Fenster, große Ziele, Kacheln etwas schmaler */
@media (max-width: 1300px) {
  #dlg-pick[open] { width: calc(100vw - 24px); height: calc(100dvh - 24px); }
  .pk-cards { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .pk-tools .cat-chips button { padding: 7px 14px; font-size: 13.5px; }
}
@media (max-width: 640px) {
  .pk-cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .pk-tools, .pk-grid { padding-left: 12px; padding-right: 12px; }
}

/* 7.1: Fotos füllen jeden Rahmen exakt (gleiche Darstellung wie im Katalog) */
.photo-box.has, .thumb-wrap, .props-photo-wrap, .pk-img, .art-pick .ap-img { position: relative; overflow: hidden; }
.photo-box.has img, .thumb-wrap img.thumb, .props-photo-wrap .props-photo, .pk-img img {
  position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; display: block; margin: 0;
}
.thumb-wrap { position: relative; }
/* Karten im Auswahl-Fenster: Name, Merkmale und Werte je Reihe auf einer Linie */
.pk-cards { grid-auto-rows: auto; }
.pk-card { display: grid; grid-row: span 4; grid-template-rows: subgrid; row-gap: 0; align-content: start; }
.pk-card .pk-img { grid-row: 1; }
.pk-card .pk-nm { grid-row: 2; padding: 10px 12px 0; align-self: start; }
.pk-card .pk-tags { grid-row: 3; padding: 7px 12px 0; align-self: start; align-content: start; }
.pk-card .pk-meta { grid-row: 4; padding: 6px 12px 12px; align-self: start; }
.pk-card .pk-meta:empty { padding-top: 0; }

/* 7.2: fertig zugeschnittene 4:3-Bilder – immer randlos, ohne Verschiebung */
img[data-cropped] { transform: none !important; object-position: 50% 50% !important; }

/* 7.3: unsichtbare Messung der Fotoausschnitte im Katalog */
.cm-measure { position: absolute; left: -10000px; top: 0; visibility: hidden; pointer-events: none; }

/* 7.6: manuelle Sicherung */
.bk-man { font-size: 11px; font-weight: 700; color: var(--ink-2); background: var(--sage-2); border-radius: 999px; padding: 1px 8px; }
#cm-backup-now { white-space: nowrap; }

/* =========================================================
   7.7 Tablet-Bedienung (body.tab-ui): Werkzeug-Puck, Rad, Karte an der Auswahl, Blatt statt Seitenleiste
   ========================================================= */
.t-seg, .t-more, .t-puck, .t-undo, .t-wheel, .t-ctx, .t-menu { display: none; }
.t-switch[hidden] { display: none !important; }
body.tab-ui .rail, body.tab-ui #btn-night, body.tab-ui #btn-catalog-top, body.tab-ui #btn-export, body.tab-ui #btn-panel, body.tab-ui .panel-toggle { display: none !important; }
body.tab-ui .editor-bar { gap: 8px; }
body.tab-ui .plan-title { flex: 0 1 260px; }

/* Planen / Plan-Layout */
body.tab-ui .t-seg { display: flex; background: rgba(255,255,255,.12); border-radius: 12px; padding: 3px; flex: none; }
.t-seg button { border: 0; background: none; color: #fff; font: inherit; font-size: 14px; font-weight: 700; padding: 8px 14px; border-radius: 9px; opacity: .78; min-height: 38px; cursor: pointer; }
.t-seg button[aria-pressed="true"] { background: #fff; color: var(--forest); opacity: 1; }
body.tab-ui .t-more { display: inline-grid; font-size: 16px; letter-spacing: 1px; font-weight: 800; width: 46px; }

/* Menü */
body.tab-ui .t-menu:not([hidden]) { display: block; position: fixed; right: 12px; top: 64px; width: 300px; background: var(--paper); border-radius: 18px; box-shadow: 0 22px 60px rgba(0,0,0,.28); padding: 8px; z-index: 60; }
.t-menu button { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; font: inherit; font-size: 15px; padding: 12px; border-radius: 12px; color: var(--ink); text-align: left; cursor: pointer; min-height: 48px; }
.t-menu button:active { background: var(--sage-2); }
.t-menu button span { flex: 1; }
.t-menu button em { font-style: normal; font-size: 13px; color: var(--ink-2); }
.t-menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.t-sum { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 8px 8px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.t-sum span { font-size: 11px; color: var(--ink-2); display: grid; }
.t-sum b { font-size: 14px; color: var(--ink); white-space: nowrap; }
body.night-ui .t-menu { background: #111c17; }
body.night-ui .t-menu button { color: #e6efe9; }

/* Seitenleiste als Blatt von rechts */
body.tab-ui .panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(430px, 92vw); z-index: 40; border-left: 0;
  transform: translateX(105%); transition: transform .28s cubic-bezier(.2,.9,.3,1);
  box-shadow: -20px 0 50px rgba(0,0,0,.18); border-radius: 22px 0 0 22px; overflow: hidden;
}
body.tab-ui .panel.open { transform: none; }
body.tab-ui .panel.mini { width: min(430px, 92vw); }
body.tab-ui .panel-mini-btn { transform: rotate(0deg); width: 40px; height: 40px; }

/* Werkzeug-Puck */
body.tab-ui .t-puck {
  display: grid; place-items: center; position: absolute; width: 64px; height: 64px; border-radius: 50%; border: 0; z-index: 32;
  background: var(--forest); color: #fff; cursor: pointer; touch-action: none; padding: 0;
  box-shadow: 0 10px 26px rgba(5,68,50,.45), inset 0 0 0 3px rgba(255,255,255,.18);
  transition: left .25s cubic-bezier(.2,.9,.3,1.2), top .25s cubic-bezier(.2,.9,.3,1.2), transform .15s;
}
.t-puck .ic { width: 28px; height: 28px; }
.t-puck.lift { transform: scale(1.12); transition: transform .15s; box-shadow: 0 18px 40px rgba(5,68,50,.5), inset 0 0 0 3px rgba(255,255,255,.3); }
.t-badge { position: absolute; right: -5px; bottom: -5px; width: 30px; height: 30px; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.t-badge svg { width: 24px; height: 24px; }
body.tab-ui .t-undo {
  display: grid; place-items: center; position: absolute; width: 40px; height: 40px; border-radius: 50%; border: 0; z-index: 31;
  background: var(--paper); color: var(--forest); box-shadow: 0 4px 12px rgba(0,0,0,.18); transition: top .25s, left .25s, opacity .15s; cursor: pointer;
}
.t-undo .ic { width: 20px; height: 20px; }
.t-undo:disabled { opacity: .4; }
body.t-wheel-open .t-undo, .t-undo[hidden] { opacity: 0; pointer-events: none; }
body.night-ui.tab-ui .t-puck { background: var(--accent); color: #1b0f08; }

/* Rad */
body.tab-ui .t-wheel:not([hidden]) { display: block; position: absolute; inset: 0; z-index: 31; }
.t-shade { position: absolute; inset: 0; background: rgba(8,20,15,.18); opacity: 0; transition: opacity .2s; }
.t-wheel.open .t-shade { opacity: 1; }
.t-wi, .t-wo {
  position: absolute; border: 0; padding: 0; display: grid; place-items: center; align-content: center; gap: 1px; cursor: pointer; font: inherit;
  background: var(--paper); color: var(--forest); box-shadow: 0 8px 22px rgba(0,0,0,.18);
  transform: scale(.3); opacity: 0; transition: transform .22s cubic-bezier(.2,.9,.3,1.3), opacity .15s, background .12s;
}
.t-wi { width: 66px; height: 66px; margin: -33px 0 0 -33px; border-radius: 50%; font-size: 10.5px; font-weight: 700; }
.t-wi .ic { width: 24px; height: 24px; }
.t-wo { width: 60px; height: 60px; margin: -30px 0 0 -30px; border-radius: 18px; font-size: 9.5px; font-weight: 800; color: var(--ink-2); }
.t-wo svg { width: 32px; height: 32px; }
.t-wo .ic { width: 26px; height: 26px; color: var(--forest); }
.t-wo span { max-width: 56px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-grid { font-size: 22px; line-height: 1; color: var(--forest); }
.t-wheel.open .t-wi, .t-wheel.open .t-wo { transform: scale(1); opacity: 1; }
.t-wi.on { background: var(--accent); color: #fff; }
.t-wo.on { outline: 3px solid var(--accent); }
.t-wi.hot, .t-wo.hot { transform: scale(1.14) !important; }
.t-wi.hot { background: var(--forest); color: #fff; }
.t-wo.hot { outline: 3px solid var(--forest); }
.t-wlabel { position: absolute; transform: translateX(-50%); font-size: 12px; font-weight: 800; color: #fff; background: var(--forest); border-radius: 999px; padding: 4px 10px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; }
.t-wlabel.show { opacity: 1; }
body.night-ui .t-wi, body.night-ui .t-wo { background: #16231d; color: #e6efe9; }

/* Karte an der Auswahl */
body.tab-ui .t-ctx:not([hidden]) { display: block; position: absolute; z-index: 30; background: var(--paper); border-radius: 18px; box-shadow: 0 16px 40px rgba(0,0,0,.22); padding: 10px; min-width: 300px; max-width: calc(100% - 20px); }
.t-ctx::after { content: ""; position: absolute; left: var(--ax, 50%); bottom: -8px; width: 16px; height: 16px; margin-left: -8px; background: var(--paper); transform: rotate(45deg); box-shadow: 4px 4px 8px rgba(0,0,0,.06); }
.t-ctx.below::after { bottom: auto; top: -8px; box-shadow: -4px -4px 8px rgba(0,0,0,.06); }
.t-ch { display: flex; gap: 10px; align-items: center; padding: 2px 4px 8px; min-width: 0; }
.t-ch .sym, .t-ch > svg { width: 34px; height: 34px; flex: none; }
.t-ch > div { display: grid; min-width: 0; }
.t-ch b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-ch span { font-size: 12px; color: var(--ink-2); }
.t-crow { display: flex; gap: 6px; }
.t-crow button { flex: 1; min-width: 58px; border: 0; background: var(--sage-2); border-radius: 12px; padding: 9px 6px 7px; font: inherit; font-size: 11.5px; font-weight: 700; color: var(--forest); display: grid; justify-items: center; gap: 3px; cursor: pointer; }
.t-crow button .ic { width: 20px; height: 20px; }
.t-crow button.del { color: var(--danger); }
.t-dots { font-size: 15px; line-height: 20px; letter-spacing: 1px; }
body.night-ui .t-ctx, body.night-ui .t-ctx::after { background: #111c17; color: #e6efe9; }
body.night-ui .t-crow button { background: #16231d; color: #e6efe9; }

/* Platz für den Puck: Kopfzeile im Plan, Hinweis */
body.tab-ui .stage-top { left: 14px; right: 14px; }

/* 7.8: Lade-Overlay liegt über offenen Dialogen und sperrt sie währenddessen */
#busy[popover] { inset: 0; width: auto; height: auto; max-width: none; max-height: none; margin: 0; border: 0; padding: 0; overflow: hidden; }

/* 8.9: Modus-Anzeige ohne Text ausblenden; Trafo-Meldung kompakt wie die Auslastung */
.mode-chip[hidden] { display: none !important; }
#toast.small { width: 300px; box-sizing: border-box; max-width: calc(100% - 32px); padding: 8px 12px; border-radius: 12px; font-size: 12.5px; line-height: 1.35; text-align: center; }
/* 8.10: Trafo-Karten so breit wie die Zeile „Trafo-Auslastung“ darüber */
@media (min-width: 1301px) {
  /* eigene Zeile unter der Modus-Anzeige; die leere Restbreite lässt Klicks zum Plan durch */
  .stage-top .power { display: grid; grid-template-columns: min-content; justify-items: stretch; align-items: start; flex-basis: 100%; pointer-events: none; }
  .stage-top .power > * { pointer-events: auto; }
  .stage-top .power .pw-head { white-space: nowrap; justify-self: start; }
  .stage-top .power .pw-row { width: auto; max-width: none; padding: 6px 10px; gap: 4px; }
  .stage-top .power .pw-top { font-size: 11.5px; gap: 6px; }
  .stage-top .power .pw-top span, .stage-top .power .pw-top b { white-space: nowrap; }
  .stage-top .power .pw-acts .btn { white-space: normal; font-size: 11.5px; padding: 5px 8px; min-height: 0; line-height: 1.25; text-align: center; }
  .stage-top .power .pw-note { font-size: 11px; }
}

/* 8.12: „Automatisch verlegen“ schlicht – zarter Akzent statt voller Fläche; Verkabeln beim Trafo */
.btn-auto { background: color-mix(in srgb, var(--accent) 9%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent); color: var(--accent); font-weight: 600; box-shadow: none; }
.btn-auto:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.btn-auto .ic { width: 16px; height: 16px; }
.btn-auto:disabled { opacity: .5; background: transparent; border-color: var(--line); color: var(--ink-2); }
.cat-auto { width: 100%; margin: 10px 0 2px; justify-content: center; }
.hint .btn-auto { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.22); color: #fff; }
.hint .btn-auto:hover { background: rgba(255,255,255,.18); }
.hint .btn-auto:disabled { background: transparent; color: rgba(255,255,255,.55); border-color: rgba(255,255,255,.15); }
.wire-box { display: grid; gap: 8px; margin-top: 12px; }
.wire-box .k { font-size: 12.5px; color: var(--ink-2); }
.wire-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wire-acts .btn { justify-content: center; }
.wire-box .pw-note { font-size: 12px; color: var(--ink-2); }
/* 8.13: Trafo-Auslastung immer in eigener Zeile unter der Modus-Anzeige (auch schmalere Bildschirme) */
.stage-top .power { flex-basis: 100%; pointer-events: none; }
.stage-top .power > * { pointer-events: auto; }

/* 8.15: Katalog-Filter hinter einem Knopf neben der Suche */
.cat-search-row { display: flex; gap: 8px; align-items: stretch; }
.cat-search-row .search { flex: 1; min-width: 0; }
.cat-filter-btn { position: relative; flex: none; width: 38px; height: 38px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--paper); color: var(--ink-2); display: grid; place-items: center; cursor: pointer; }
.cat-filter-btn[hidden] { display: none; }
.cat-filter-btn:hover { border-color: var(--moss); color: var(--ink); }
.cat-filter-btn.on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 8%, var(--paper)); }
.cat-filter-btn[aria-expanded="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.cat-filter-btn .fb-n { position: absolute; top: 2px; right: 2px; min-width: 14px; height: 14px; padding: 0 4px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 9.5px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--paper); }
.cat-filter-btn[aria-expanded="true"] .fb-n { background: #fff; color: var(--accent); }
.cat-filter-btn .fb-n[hidden] { display: none; }
.cat-filters { display: grid; gap: 8px; }
.cat-filters[hidden] { display: none; }
.cat-fsum { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-fsum[hidden] { display: none; }
.cat-fsum button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 9%, transparent); color: var(--accent); border-radius: 999px; padding: 3px 6px 3px 10px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.cat-fsum button span { font-size: 14px; line-height: 1; opacity: .8; }
body.night-ui .cat-filter-btn { background: #131f19; border-color: #24372c; color: #cfe0d6; }
body.night-ui .cat-filter-btn[aria-expanded="true"] { background: var(--accent); border-color: var(--accent); color: #1b0f08; }
body.night-ui .cat-filter-btn .fb-n { color: #1b0f08; box-shadow: 0 0 0 2px #111c17; }
.panel.mini .cat-filter-btn, .panel.mini .cat-fsum, .panel.mini .cat-filters { display: none !important; }

/* 8.16: über vorhandenem Element – Zeiger statt Fadenkreuz */
#stage.over-item, #stage.over-item [data-kind], .stage-wrap #stage.crosshair.over-item, .stage-wrap #stage.crosshair.over-item [data-kind] { cursor: pointer !important; }

/* 8.18: Tablet – Rad mit rollbarem Leuchten-Bogen, flüssiger Puck */
body.tab-ui .t-puck { will-change: left, top, transform; }
body.tab-ui .t-puck.dragging { transition: none !important; }
.t-wheel.instant .t-wi { transition: background .12s; transform: scale(1); opacity: 1; }
@keyframes t-pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(var(--rs, 1)); opacity: var(--op, 1); } }
.t-wheel .t-wo { animation: t-pop .24s cubic-bezier(.2,.9,.3,1.3) backwards; }
.t-wheel.open .t-roll { transform: scale(var(--rs, 1)); transition: background .12s; will-change: left, top, opacity; }
.t-roll.hot { transform: scale(1.14) !important; }
.t-rail-arc { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.t-rail-arc path { fill: none; stroke: var(--forest); stroke-opacity: .12; stroke-width: 72; stroke-linecap: round; }
body.night-ui .t-rail-arc path { stroke: #fff; stroke-opacity: .07; }

/* Tablet: Trafo-Auslastung schlank – Balken, Zahlen klein darunter, Probleme als rotes Symbol */
.power.pw-tab { display: grid; grid-template-columns: auto auto; justify-content: start; align-items: start; gap: 6px 8px; }
.power.pw-tab .pwm-list { display: grid; gap: 6px; padding: 7px 10px 6px; background: color-mix(in srgb, var(--paper) 88%, transparent); border-radius: 12px; box-shadow: 0 4px 14px rgba(5,40,28,.1); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.power.pw-tab .pwm { display: grid; gap: 3px; width: 128px; cursor: pointer; }
.power.pw-tab .pwm-bar { height: 5px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 10%, transparent); overflow: hidden; }
.power.pw-tab .pwm-bar i { display: block; height: 100%; border-radius: 99px; background: var(--moss); transition: width .3s; }
.power.pw-tab .pwm.warn .pwm-bar i { background: #e0a100; }
.power.pw-tab .pwm.over .pwm-bar i { background: var(--danger); }
.power.pw-tab .pwm small { font-size: 9.5px; line-height: 1.1; color: var(--ink-2); font-weight: 600; white-space: nowrap; letter-spacing: .01em; }
.power.pw-tab .pwm.over small { color: var(--danger); }
.power.pw-tab .pwm-alert { grid-column: 1; justify-self: start; width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--danger); color: #fff; font: inherit; font-size: 16px; font-weight: 800; cursor: pointer; box-shadow: 0 4px 12px rgba(180,30,30,.35); display: grid; place-items: center; padding: 0; animation: pwm-pulse 2.4s ease-in-out infinite; }
.power.pw-tab .pwm-alert[aria-expanded="true"] { animation: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 30%, transparent); }
@keyframes pwm-pulse { 0%, 100% { box-shadow: 0 4px 12px rgba(180,30,30,.35); } 50% { box-shadow: 0 0 0 6px rgba(200,40,40,.14), 0 4px 12px rgba(180,30,30,.35); } }
.power.pw-tab .pwm-pop { grid-column: 1 / -1; display: grid; gap: 6px; width: 280px; animation: pwm-in .16s ease-out; }
@keyframes pwm-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.power.pw-tab .pwm-pop .pw-row { width: auto; max-width: none; }
body.night-ui .power.pw-tab .pwm-list { background: rgba(17,28,23,.88); }
body.night-ui .power.pw-tab .pwm-bar { background: rgba(255,255,255,.12); }
body.night-ui .power.pw-tab .pwm small { color: #b9cabf; }
.stage-top .power.pw-tab { display: grid !important; flex-direction: initial; }

/* =========================================================
   8.19 Tablet: aufgeräumte Leiste oben, einklappbarer Maßstab, Vollbild, kein Seitenzoom/-verrutschen
   ========================================================= */
/* nirgends Doppeltipp-Zoom; die Zeichenfläche behält ihre eigene Gestensteuerung */
*, *::before, *::after { touch-action: manipulation; }
#stage, .t-puck, .t-wheel { touch-action: none !important; }
html { overscroll-behavior: none; }
body:has(#view-editor:not([hidden])) { overflow: hidden; overscroll-behavior: none; }

/* Trafo-Anzeige: im Plan-Layout wirklich aus (Fix: war trotz [hidden] sichtbar) */
body .stage-top .power.pw-tab[hidden], body.tab-ui .stage-top .power.pw-tab[hidden] { display: none !important; }

/* Tablet-Leiste oben: alles in einer Reihe – Trafo links, Hinweis/Aktionen rechts */
body.tab-ui .stage-top { top: 10px; flex-wrap: nowrap; align-items: flex-start; }
body.tab-ui .stage-top .power { flex-basis: auto !important; }
body.tab-ui .stage-top .power.pw-tab { display: flex !important; align-items: center; gap: 8px; }
body.tab-ui .power.pw-tab .pwm-list { padding: 6px 10px 5px; }
body.tab-ui .power.pw-tab .pwm-alert { width: 22px; height: 22px; font-size: 12.5px; box-shadow: 0 2px 8px rgba(180,30,30,.3); }
@keyframes pwm-pulse { 0%, 100% { box-shadow: 0 2px 8px rgba(180,30,30,.3); } 50% { box-shadow: 0 0 0 5px rgba(200,40,40,.14), 0 2px 8px rgba(180,30,30,.3); } }
body.tab-ui .power.pw-tab .pwm-pop { display: flex; flex-direction: column; gap: 6px; width: auto; }
body.tab-ui .power.pw-tab .pwm-line { display: flex; align-items: center; gap: 10px; padding: 5px 6px 5px 12px; border-radius: 12px; max-width: none; width: auto; min-width: 0; box-shadow: 0 4px 14px rgba(5,40,28,.12); }
body.tab-ui .power.pw-tab .pwm-line > b { font-size: 12px; color: var(--danger); white-space: nowrap; }
body.tab-ui .power.pw-tab .pwm-line .btn { white-space: nowrap; min-height: 30px; font-size: 12.5px; padding: 0 12px; }
body.tab-ui .power.pw-tab .pwm-line .pw-note { font-size: 11.5px; }
/* Hinweis- und Aktionsleiste am Tablet oben rechts statt über dem Plan */
body.tab-ui .stage-wrap .hint { top: 10px; bottom: auto; left: calc(50% + 61px); right: auto; margin: 0; transform: translateX(-50%); max-width: calc(100% - 28px); flex-wrap: nowrap; z-index: 7; }
body.tab-ui .stage-wrap .hint:not(.solo) .txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 8.67: lange Leisten (z. B. Baum mit Ebenen-Knöpfen im Hochformat) brechen um, statt über den Rand zu laufen */
body.tab-ui .stage-wrap .hint { max-width: calc(100% - 150px); flex-wrap: wrap; justify-content: center; row-gap: 6px; }

body.tab-ui.pw-pop-open .stage-wrap .hint { visibility: hidden; }

/* Plan-Layout am Tablet: Maßstab-Leiste als kleines Symbol, aufklappbar – oben, nicht über dem Plan */
.gr-toggle { display: none; }
body.tab-ui .gr-bar .gr-toggle { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; font: inherit; color: var(--ink); padding: 0 6px 0 4px; min-height: 36px; cursor: pointer; border-radius: 10px; }
body.tab-ui .gr-toggle .ic { width: 20px; height: 20px; color: var(--moss); }
body.tab-ui .gr-toggle b { font-size: 13px; min-width: 0; }
body.tab-ui .gr-toggle .chev { width: 16px; height: 16px; color: var(--ink-2); transition: transform .2s; }
body.tab-ui .gr-bar:not(.collapsed) .gr-toggle .chev { transform: rotate(180deg); }
body.tab-ui .gr-bar:not(.collapsed) .gr-toggle b { display: none; }
body.tab-ui .gr-bar.collapsed > :not(.gr-toggle) { display: none !important; }
body.tab-ui .gr-bar.collapsed { padding: 3px 4px; }
body.tab-ui .gr-bar { flex-wrap: nowrap; }

/* Startseite am Tablet: weniger Leerraum um die Überschrift */
body.tab-ui .projects { padding-top: 18px; }
body.tab-ui .page-title { font-size: 30px; margin: 0; }
body.tab-ui .page-sub { margin: 4px 0 14px; }
body.tab-ui .section-head { margin: 18px 0 12px; }

/* Vollbild-Knopf */
.fs-btn[hidden] { display: none !important; }

/* 8.20: Höhe immer aus der echten Fensterhöhe (iPad nach dem Vollbild) */
html, body { height: var(--app-h, 100%); }
/* Vollbild am iPad: Platz für Uhrzeit/Akku oben und das Schließen-X links oben */
body.is-fs .topbar, body.is-fs .topbar:has(.topbar-inner) { box-sizing: border-box; height: calc(var(--bar-h) + max(env(safe-area-inset-top), 24px)); padding-top: max(env(safe-area-inset-top), 24px); }
body.is-fs .topbar .topbar-inner, body.is-fs .topbar.editor-bar { padding-left: max(80px, env(safe-area-inset-left)); }

/* 8.22: Puck weicht aufgeklappten Menüs aus (translate, unabhängig vom Verschieben per transform) */
body.tab-ui .t-puck { transition: left .25s cubic-bezier(.2,.9,.3,1.2), top .25s cubic-bezier(.2,.9,.3,1.2), transform .15s, translate .28s cubic-bezier(.2,.8,.3,1); }
body.tab-ui .t-undo { transition: top .25s, left .25s, opacity .15s, translate .28s cubic-bezier(.2,.8,.3,1); }
/* Rückgängig beim Kabelziehen/Messen: nimmt den letzten Punkt zurück – kleiner Punkt als Hinweis */
.t-undo.pt::after { content: ''; position: absolute; right: 3px; top: 3px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--paper); }

/* 8.24 Tablet: Hinweisleiste mittig über dem Plan (Planmitte = Blattmitte beim Einpassen);
   bei Platzieren, Kabel und Messen nur die Knöpfe, sonst mit Beschreibung */
body.tab-ui[data-puck="right"] .stage-wrap .hint { left: calc(50% - 61px); }
body.tab-ui .stage-wrap:is([data-tool="place"], [data-tool="cable"], [data-tool="measure"]) .hint:not(.solo) .txt { display: none; }
body.tab-ui .stage-wrap:is([data-tool="place"], [data-tool="cable"], [data-tool="measure"]) .hint:not(.solo) { padding-left: 6px; }
/* Hochformat: unter der Trafo-Anzeige, damit sich nichts überschneidet */
@media (orientation: portrait) { body.tab-ui .stage-wrap .hint { top: 58px; } }
body.tab-ui .stage-wrap[data-tool="calib"] .stage-top .power.pw-tab { display: none !important; }

/* 8.25: Kabelpunkt – Kurve/Ecke; Kabelende ohne Leuchte */
.vtx-pop { position: absolute; z-index: 30; display: flex; align-items: center; gap: 4px; padding: 5px; background: var(--paper); border-radius: 14px; box-shadow: 0 10px 30px rgba(5,40,28,.22), 0 0 0 1px var(--line); animation: pwm-in .14s ease-out; }
.vtx-pop[hidden] { display: none; }
.vtx-pop .vp-k { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); padding: 0 6px 0 8px; }
.vtx-pop button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 13.5px; font-weight: 600; padding: 8px 12px; border-radius: 10px; cursor: pointer; min-height: 38px; }
.vtx-pop button .ic { width: 18px; height: 18px; }
.vtx-pop button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.vtx-pop button.del { color: var(--danger); }
body.night-ui .vtx-pop { background: #16241c; box-shadow: 0 10px 30px rgba(0,0,0,.5), 0 0 0 1px #24372c; }
body.night-ui .vtx-pop button { color: #e5efe9; }
body.night-ui .vtx-pop button[aria-pressed="true"] { color: #1b0f08; }
.tail-box { display: grid; gap: 6px; padding: 12px; border-radius: 12px; background: color-mix(in srgb, var(--danger) 8%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); margin: 4px 0 12px; }
.tail-box b { color: var(--danger); font-size: 13.5px; }
.tail-box span { font-size: 12.5px; color: var(--ink-2); }
.tail-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }

/* 8.26: Materialliste netto/brutto */
.mat-head-r { display: flex; align-items: center; gap: 10px; }
.mat-gross button { min-height: 34px; padding: 0 14px; }

/* 8.29: Plan mit nicht übertragenen Änderungen */
.plan-card .sync-badge { justify-self: start; margin-top: 4px; font-size: 11px; font-weight: 700; color: #8a5a00; background: #fff3d6; border-radius: 999px; padding: 2px 8px; }
body.night-ui .plan-card .sync-badge { color: #ffda6f; background: rgba(255,218,111,.12); }

/* 8.30: Titelleiste – Kunde/Adresse antippbar; Adress-Dialog mit Vorschlägen; Wiederherstellen am Tablet */
#plan-sub { cursor: pointer; text-decoration: underline dotted rgba(255,255,255,.45); text-underline-offset: 3px; }
#plan-sub:hover { text-decoration-color: #fff; }
.addr-dlg { width: min(520px, calc(100vw - 24px)); }
.addr-dlg .dlg-body { display: grid; gap: 12px; }
.addr-field { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0 12px; background: var(--paper); }
.addr-field input { border: 0 !important; outline: none !important; box-shadow: none !important; flex: 1; min-width: 0; padding: 12px 0 !important; background: transparent !important; font-size: 16px; border-radius: 0 !important; }
.addr-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.addr-list { display: grid; gap: 2px; margin-top: -6px; border: 1px solid var(--line); border-radius: 12px; padding: 4px; background: var(--paper); max-height: 280px; overflow-y: auto; }
.addr-list[hidden] { display: none; }
.addr-list button { display: flex; gap: 10px; align-items: flex-start; text-align: left; border: 0; background: transparent; padding: 10px; border-radius: 9px; cursor: pointer; font: inherit; color: var(--ink); }
.addr-list button:hover, .addr-list button:focus-visible { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.addr-list button .ic { width: 18px; height: 18px; color: var(--accent); flex: none; margin-top: 1px; }
.addr-list button span { display: grid; gap: 1px; }
.addr-list button b { font-weight: 600; font-size: 14.5px; }
.addr-list button small { color: var(--ink-2); font-size: 12px; }
.addr-none { padding: 10px; font-size: 13px; color: var(--ink-2); }
.addr-maps { display: inline-flex; align-items: center; gap: 6px; justify-self: start; font-size: 13.5px; font-weight: 600; color: var(--accent); text-decoration: none; }
.addr-maps[hidden] { display: none; }
.addr-maps .ic { width: 16px; height: 16px; }
body.tab-ui .t-redo:disabled { opacity: .3; }

/* 8.33: Maße einer Messung ändern */
.ms-pop { padding: 6px 6px 6px 10px; gap: 8px; }
.ms-pop .ms-f { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.ms-pop .ms-f input { width: 78px; min-height: 36px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 9px; font: inherit; font-size: 15px; font-weight: 700; color: var(--ink); text-align: right; background: var(--paper); }
.ms-pop .ms-f input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.ms-pop .ms-f em { font-style: normal; color: var(--ink-2); }
.ms-pop .ms-x { min-height: 36px; padding: 0 10px; font-size: 18px; color: var(--ink-2); }
body.night-ui .ms-pop .ms-f input { background: #0f1a15; color: #e6efe9; border-color: #2a3d32; }

/* 8.34: Werkzeugrad auch am Desktop (statt Leiste links) + kompakte Leuchten-Übersicht */
body.wheel-ui .rail { display: none !important; }
body.wheel-ui .t-puck { display: grid; place-items: center; position: absolute; z-index: 32; width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--forest); color: #fff; box-shadow: 0 10px 28px rgba(5,68,50,.35), inset 0 0 0 3px rgba(255,255,255,.14); cursor: pointer; transition: left .25s cubic-bezier(.2,.9,.3,1.2), top .25s cubic-bezier(.2,.9,.3,1.2), transform .15s, translate .28s cubic-bezier(.2,.8,.3,1); will-change: left, top, transform; }
body.wheel-ui .t-puck:hover { box-shadow: 0 12px 32px rgba(5,68,50,.45), inset 0 0 0 3px rgba(255,255,255,.22); }
body.wheel-ui .t-puck.dragging { transition: none !important; }
body.night-ui.wheel-ui .t-puck { background: var(--accent); color: #1b0f08; }
body.wheel-ui .t-undo { display: grid; place-items: center; position: absolute; z-index: 32; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--paper); color: var(--ink); box-shadow: 0 4px 14px rgba(5,40,28,.18); cursor: pointer; transition: top .25s, left .25s, opacity .15s, translate .28s cubic-bezier(.2,.8,.3,1); }
body.wheel-ui .t-redo:disabled { opacity: .3; }
body.wheel-ui .t-wheel:not([hidden]) { display: block; position: absolute; inset: 0; z-index: 31; }
body.wheel-ui .t-wi, body.wheel-ui .t-wo { cursor: pointer; }
body.wheel-ui .t-wi:hover { background: color-mix(in srgb, var(--accent) 14%, var(--paper)); }
body.wheel-ui .t-wo:hover { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); }
.t-lgrid { position: absolute; z-index: 2; display: flex; flex-direction: column; background: var(--paper); border-radius: 18px; box-shadow: 0 18px 50px rgba(5,40,28,.25), 0 0 0 1px var(--line); overflow: hidden; animation: pwm-in .18s ease-out; }
.t-lg-h { display: flex; align-items: baseline; justify-content: space-between; padding: 12px 14px 8px; font-weight: 800; font-size: 13px; color: var(--ink); }
.t-lg-h span { font-weight: 600; font-size: 11px; color: var(--ink-2); }
.t-lg-g { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 10px 12px; overflow-y: auto; overscroll-behavior: contain; }
.t-lg-g button { display: grid; justify-items: center; gap: 2px; padding: 8px 4px 7px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); cursor: pointer; font: inherit; color: var(--ink); min-width: 0; }
.t-lg-g button:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--paper)); }
.t-lg-g button.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.t-lg-g button svg { width: 30px; height: 30px; }
.t-lg-g button b { font-size: 11px; font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-lg-g button small { font-size: 10px; color: var(--ink-2); }
body.night-ui .t-lgrid, body.night-ui .t-lg-g button { background: #16231d; color: #e6efe9; }

/* 8.35 */
body.t-wheel-open .t-undo { opacity: 0 !important; pointer-events: none !important; }
body.wheel-ui .t-puck { cursor: grab; }
body.wheel-ui .t-puck.dragging { cursor: grabbing; }
.props-acts { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
.props-acts .btn { justify-content: center; width: 100%; }
.t-lgrid { width: 360px; }
.t-lg-g button { padding: 6px 6px 7px; gap: 3px; }
.t-lg-g .lg-ph { position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: color-mix(in srgb, var(--ink) 5%, var(--paper)); display: grid; place-items: center; margin-bottom: 2px; }
.t-lg-g .lg-ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.t-lg-g .lg-ph .lg-sym { position: absolute; left: 4px; bottom: 4px; width: 22px; height: 22px; display: grid; place-items: center; background: rgba(255,255,255,.9); border-radius: 50%; }
.t-lg-g .lg-ph .lg-sym svg { width: 18px; height: 18px; }
.t-lg-g .lg-nophoto svg { width: 34px; height: 34px; }
body.night-ui .t-lg-g .lg-ph { background: rgba(255,255,255,.05); }

/* 8.36: Messung unter der Maus – Zeiger „verschieben“ */
#stage.over-measure, #stage.over-measure [data-kind], .stage-wrap #stage.crosshair.over-measure, .stage-wrap #stage.crosshair.over-measure [data-kind] { cursor: move !important; }

/* 8.37: Achsen-Pfeile an Messungen */
#stage [data-axis="x"], .stage-wrap #stage.crosshair [data-axis="x"], .stage-wrap #stage.over-measure [data-axis="x"] { cursor: ew-resize !important; }
#stage [data-axis="y"], .stage-wrap #stage.crosshair [data-axis="y"], .stage-wrap #stage.over-measure [data-axis="y"] { cursor: ns-resize !important; }

/* 8.38: Umschalter Werkzeugrad über dem Raster; Bemaßung im Export */
.vt-col { display: flex; flex-direction: column; gap: 6px; }
.ex-meas { display: grid; gap: 6px; }
.ex-meas .k { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.ex-meas .check { padding-left: 2px; }

/* 8.39 */
#form-new .addr-list { margin-top: -4px; max-height: 220px; }
.tb-logo-v { display: flex; align-items: center; gap: 10px; }
.tb-logo-v .k { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.tb-logo-v .seg button:disabled { opacity: .4; cursor: not-allowed; }

/* 8.40: Flächen einfärben (Plan-Layout) */
.stage-wrap.mode-plan[data-tool="cover"] .hint { display: flex; }
.cv-sw { display: inline-flex; gap: 5px; padding: 0 4px; }
.cv-sw button { width: 24px; height: 24px; border-radius: 50%; border: 2px solid rgba(255,255,255,.55); background: var(--c); cursor: pointer; padding: 0; }
.cv-sw button[aria-pressed="true"] { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }

/* 8.41: Farbrad + Pipette bei Flächen; Pipetten-Zeiger */
.cv-wheel { position: relative; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; flex: none;
  background: conic-gradient(from 90deg, #ff4d4d, #ffb84d, #fff04d, #4dff88, #4dd2ff, #6b4dff, #ff4dd8, #ff4d4d); box-shadow: inset 0 0 0 2px rgba(255,255,255,.7); }
.cv-wheel::after { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1.5px #fff; }
.cv-wheel.on { box-shadow: inset 0 0 0 2px #fff, 0 0 0 2px var(--accent); }
.cv-wheel input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; border: 0; padding: 0; }
.cv-pick { width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.5); background: transparent; color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.cv-pick .ic { width: 16px; height: 16px; }
.cv-pick[aria-pressed="true"] { background: #fff; color: var(--forest); }
#stage.picking, #stage.picking * { cursor: crosshair !important; }

/* 8.43: Farbe wählen – Vorschläge statt Standard-Farbfeld */
.cv-pop { position: absolute; z-index: 40; width: 292px; padding: 12px; border-radius: 20px; background: var(--paper); box-shadow: 0 22px 60px rgba(5,40,28,.28), 0 0 0 1px var(--line); display: grid; gap: 10px; animation: pwm-in .16s ease-out; }
.cv-pop[hidden] { display: none; }
.cv-pop.picking { opacity: .35; pointer-events: none; }
.cv-pop.picking .cvp-pick { pointer-events: auto; }
.cvp-head { display: flex; align-items: center; justify-content: space-between; font-size: 13.5px; color: var(--ink); padding: 0 2px; }
.cvp-head button { width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; font-size: 18px; color: var(--ink-2); cursor: pointer; }
.cvp-big { position: relative; height: 64px; border-radius: 14px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); display: flex; align-items: flex-end; justify-content: space-between; padding: 8px; box-sizing: border-box; transition: background .12s; }
.cvp-big input { width: 92px; border: 0; background: rgba(255,255,255,.75); border-radius: 8px; padding: 4px 8px; font: inherit; font-size: 13px; font-weight: 800; letter-spacing: .05em; color: #10261d; text-transform: uppercase; }
.cvp-big.dark input { background: rgba(0,0,0,.35); color: #fff; }
.cvp-pick { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: 99px; background: rgba(255,255,255,.85); color: #10261d; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.cvp-pick .ic { width: 15px; height: 15px; }
.cvp-pick[aria-pressed="true"] { background: var(--accent); color: #fff; }
.cvp-body { display: grid; gap: 6px; max-height: 330px; overflow-y: auto; overscroll-behavior: contain; padding: 0 2px; }
.cvp-k { font-size: 10.5px; font-weight: 800; color: var(--ink-2); text-transform: uppercase; letter-spacing: .07em; margin-top: 4px; }
.cvp-row { display: flex; flex-wrap: wrap; gap: 6px; min-height: 26px; align-items: center; }
.cvp-sw { width: 28px; height: 28px; border-radius: 9px; border: 0; padding: 0; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.1); cursor: pointer; transition: transform .1s; }
.cvp-sw:hover { transform: scale(1.12); }
.cvp-strip { gap: 0; flex-wrap: nowrap; }
.cvp-strip .cvp-sw { flex: 1; border-radius: 0; height: 30px; }
.cvp-strip .cvp-sw:first-child { border-radius: 9px 0 0 9px; } .cvp-strip .cvp-sw:last-child { border-radius: 0 9px 9px 0; }
.cvp-none { font-size: 12px; color: var(--ink-2); }
.cvp-sliders { display: grid; gap: 8px; margin-top: 6px; }
.cvp-sliders label { display: grid; gap: 3px; font-size: 11px; font-weight: 700; color: var(--ink-2); }
.cvp-r { -webkit-appearance: none; appearance: none; width: 100%; height: 12px; border-radius: 99px; outline: none; margin: 0; }
.cvp-r::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 1px rgba(0,0,0,.2), 0 2px 5px rgba(0,0,0,.3); cursor: pointer; }
.cvp-r::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 1px rgba(0,0,0,.2), 0 2px 5px rgba(0,0,0,.3); }
.cvp-rh { background: linear-gradient(to right, #f33, #fd3, #3d5, #3dd, #36f, #d3f, #f33); }
.cvp-rs { background: linear-gradient(to right, var(--a, #888), var(--b, #f00)); }
.cvp-rl { background: linear-gradient(to right, #000, var(--m, #888), #fff); }
#cvp-ok { width: 100%; justify-content: center; min-height: 40px; }
.cv-loupe { position: absolute; z-index: 45; pointer-events: none; display: grid; justify-items: center; gap: 6px; }
.cv-loupe[hidden] { display: none; }
.cv-loupe canvas { width: 132px; height: 132px; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 10px 30px rgba(0,0,0,.35); background: #fff; }
.cv-loupe b { display: inline-flex; align-items: center; gap: 6px; background: #10261d; color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .05em; padding: 4px 10px 4px 6px; border-radius: 99px; }
.cv-loupe b::before { content: ''; width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1.5px #fff; }
body.night-ui .cv-pop { background: #16241c; box-shadow: 0 22px 60px rgba(0,0,0,.5), 0 0 0 1px #2a3d32; }
/* Griffe: Rückmeldung beim Drüberfahren */
#stage [data-kind="cvh"], #stage .grab-handle circle, #stage [data-kind="bgboxmove"] { transition: transform .12s, fill .12s; transform-box: fill-box; transform-origin: center; }
#stage [data-kind="cvh"]:hover, #stage .grab-handle circle:hover, #stage [data-kind="bgboxmove"]:hover { transform: scale(1.35); fill: color-mix(in srgb, var(--accent) 22%, #fff); }
#stage [data-kind="cover"]:hover { stroke: var(--accent); stroke-width: 2px; vector-effect: non-scaling-stroke; }
/* Verschieben-Kreuz am weißen Hintergrund nur beim Drüberfahren */
#stage .bgbox-grip { opacity: 0; pointer-events: none; transition: opacity .15s; }
#stage.over-boxbg .bgbox-grip { opacity: 1; pointer-events: auto; }

.cv-sw .cv-wheel { width: 26px; height: 26px; background: conic-gradient(from 90deg, #ff4d4d, #ffb84d, #fff04d, #4dff88, #4dd2ff, #6b4dff, #ff4dd8, #ff4d4d); border: 0; box-shadow: inset 0 0 0 2px rgba(255,255,255,.7); }
.cv-sw .cv-wheel.on { box-shadow: inset 0 0 0 2px #fff, 0 0 0 2px var(--accent); }
.cvp-row { flex-wrap: wrap; }
.cvp-row #cvp-ok { flex-basis: 100%; justify-content: center; min-height: 38px; }

/* 8.43: Maßstab antippen zum Ändern */
#gr-scale { cursor: text; border-radius: 8px; padding: 2px 6px; }
#gr-scale:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
#gr-scale input { width: 56px; border: 1px solid var(--accent); border-radius: 8px; padding: 2px 6px; font: inherit; font-weight: 800; text-align: center; background: var(--paper); color: var(--ink); }

/* Größen-Anfasser von Legende/Plankopf: Rückmeldung beim Drüberfahren */
#stage .plan-handle > circle + circle { transition: transform .12s; transform-box: fill-box; transform-origin: center; }
#stage .plan-handle:hover > circle + circle { transform: scale(1.3); }

.cv-pop .cvp-row { display: grid; grid-template-columns: repeat(8, 26px); gap: 5px; min-height: 26px; }
.cv-pop .cvp-row .cvp-none { grid-column: 1 / -1; }
.cv-pop .cvp-sw { width: 26px; height: 26px; border-radius: 8px; }
.cv-pop .cvp-strip { display: flex; gap: 0; }
.cv-pop .cvp-strip .cvp-sw { flex: 1; width: auto; }
.cv-pop .cvp-body { max-height: min(420px, 55vh); }

/* 8.44: Umschalter Planen / Layout über dem Werkzeug-Knopf */
.t-mode { display: none; }
:is(body.tab-ui, body.wheel-ui) .t-mode { display: flex; position: absolute; z-index: 32; padding: 0; gap: 0; border-radius: 24px; overflow: hidden; background: var(--paper); box-shadow: 0 6px 20px rgba(5,40,28,.16);
  transition: top .25s, left .25s, opacity .15s, translate .28s cubic-bezier(.2,.8,.3,1); }
:is(body.tab-ui, body.wheel-ui) .t-mode[hidden] { display: none; }
/* kompakt: aktive Seite = Symbol + Name, andere = nur Symbol (48 px); Breiten und Farbe gleiten (Maße setzt renderModeToggle) */
.t-mode .tm-knob { position: absolute; left: 0; top: 0; width: 48px; height: 100%; border-radius: 24px; background: var(--forest); box-shadow: 0 4px 14px rgba(5,68,50,.3);
  transition: left .36s cubic-bezier(.34,1.25,.5,1), width .36s cubic-bezier(.34,1.25,.5,1), background .2s; }
.t-mode button { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: 0; width: 48px; height: 48px; padding: 0; border: 0; border-radius: 24px; background: transparent; color: var(--ink-2);
  font: inherit; font-size: 13.5px; font-weight: 800; cursor: pointer; transition: width .36s cubic-bezier(.34,1.25,.5,1), color .28s; }
.t-mode button .ic { width: 20px; height: 20px; flex: none; }
.t-mode button span { display: none; white-space: nowrap; }
.t-mode button[aria-pressed="true"] { justify-content: flex-start; padding-left: 12px; gap: 8px; color: #fff; }
.t-mode button[aria-pressed="true"] span { display: inline; animation: tm-in .25s ease .08s both; }
.t-mode button:not([aria-pressed="true"]):hover { color: var(--ink); }
@keyframes tm-in { from { opacity: 0; } to { opacity: 1; } }
body.night-ui .t-mode { background: #16241c; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
body.night-ui .t-mode .tm-knob { background: var(--accent); }
body.night-ui .t-mode button[aria-pressed="true"] { color: #1b0f08; }
body.night-ui .t-mode button:not([aria-pressed="true"]) { color: #b3c6ba; }

body.t-wheel-open .t-mode { opacity: 0; pointer-events: none; }

/* 8.46: Plan-Layout wie Planen – normaler Zeiger, nur Greifbares ändert ihn */
.stage-wrap.mode-plan #stage, .stage-wrap.mode-plan #stage.over-plan, .stage-wrap.mode-plan #stage.panning, .stage-wrap.mode-plan #stage.space-pan { cursor: default !important; }
/* Nacht: Symbole im Rad gut sichtbar */
body.night-ui .t-grid, body.night-ui .t-wo .ic, body.night-ui .t-wo svg, body.night-ui .t-wi .ic { color: #eef4f0; }
body.night-ui .t-wo.on .t-grid, body.night-ui .t-wo.on .ic { color: var(--accent); }

/* 8.48: Schieber Rad ⟷ Leiste (Rechtsklick auf Werkzeug-Knopf/Leiste) */
.wm-pop { position: fixed; z-index: 90; display: grid; gap: 8px; padding: 10px 10px 10px; border-radius: 18px; background: var(--paper); box-shadow: 0 16px 44px rgba(5,40,28,.26), 0 0 0 1px var(--line); animation: pwm-in .16s ease-out; }
.wm-pop[hidden] { display: none; }
.wm-k { font-size: 10.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2); padding: 0 4px; }
.wm-switch { position: relative; display: grid; grid-template-columns: 1fr 1fr; width: 212px; padding: 4px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 7%, var(--paper)); }
.wm-knob { position: absolute; top: 4px; left: 4px; width: calc(50% - 4px); height: calc(100% - 8px); border-radius: 99px; background: var(--forest); box-shadow: 0 4px 12px rgba(5,68,50,.3); transition: transform .22s cubic-bezier(.3,.9,.3,1.15); }
.wm-pop[data-v="rail"] .wm-knob { transform: translateX(100%); }
.wm-switch button { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; border: 0; background: transparent; border-radius: 99px; font: inherit; font-size: 13px; font-weight: 700; color: var(--ink-2); cursor: pointer; transition: color .2s; }
.wm-switch button .ic { width: 18px; height: 18px; }
.wm-pop[data-v="wheel"] [data-v="wheel"], .wm-pop[data-v="rail"] [data-v="rail"] { color: #fff; }
body.night-ui .wm-pop { background: #16241c; box-shadow: 0 16px 44px rgba(0,0,0,.5), 0 0 0 1px #2a3d32; }
body.night-ui .wm-knob { background: var(--accent); }
body.night-ui .wm-pop[data-v="wheel"] [data-v="wheel"], body.night-ui .wm-pop[data-v="rail"] [data-v="rail"] { color: #1b0f08; }

/* 8.49: Werkzeugrad – beim Platzieren nur der gewählte Artikel */
#tab-catalog.placing > :not(#cat-place) { display: none !important; }
.cat-place .cp-k { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 2px; }
.cat-place .cp-note { font-size: 12px; color: var(--ink-2); margin: 10px 0 0; }

/* 8.55: Beschriftungen */
.stage-wrap.mode-plan .hint.force:not([hidden]) { display: flex; }
.lbl-edit { position: absolute; z-index: 42; transform: translate(-50%, -50%); min-width: 90px; resize: none; overflow: hidden; border: 2px solid var(--accent); border-radius: 8px; padding: 4px 10px; font-family: Helvetica, Arial, sans-serif; font-weight: 500; line-height: 1.28; text-align: center; color: #10261d; background: rgba(255,255,255,.96); box-shadow: 0 8px 24px rgba(5,40,28,.25); outline: none; }
body.night-ui .lbl-edit { background: #14211b; color: #eef4f0; }

/* Plan-Layout, Leiste eingeklappt: Schnellzugriff */
.plan-mini { display: none; }
.stage-wrap.mode-plan ~ .panel.mini .plan-mini { display: grid; gap: 6px; padding: 0 10px 16px; overflow-y: auto; }
.pm-tile { display: grid; justify-items: center; gap: 4px; padding: 10px 4px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); font: inherit; font-size: 10.5px; font-weight: 700; line-height: 1.2; cursor: pointer; text-align: center; }
.pm-tile .ic { width: 22px; height: 22px; color: var(--forest); }
.pm-tile:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--paper)); }
body.night-ui .pm-tile { background: #16231d; color: #e6efe9; border-color: #2a3d32; }
body.night-ui .pm-tile .ic { color: var(--accent); }
/* Hinweisleiste ohne Beschreibung */
.hint.notxt { padding-left: 6px; }
/* Beschriftung gestalten: schwebende Formatleiste */
.lbl-bar { position: absolute; z-index: 43; display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 16px; background: var(--forest); box-shadow: 0 14px 40px rgba(5,40,28,.3); animation: pwm-in .15s ease-out; }
.lbl-bar[hidden] { display: none; }
.lbl-bar .lb-grp { display: flex; align-items: center; gap: 2px; padding: 2px; border-radius: 11px; background: rgba(255,255,255,.08); }
.lbl-bar button { min-width: 32px; height: 32px; padding: 0 8px; border: 0; border-radius: 9px; background: transparent; color: #fff; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.lbl-bar button:hover { background: rgba(255,255,255,.12); }
.lbl-bar button[aria-pressed="true"] { background: #fff; color: var(--forest); }
.lbl-bar .lf-bold { font-weight: 900; } .lbl-bar .lf-italic { font-style: italic; font-family: Georgia, serif; } .lbl-bar .lf-underline { text-decoration: underline; }
.lbl-bar .lb-size b { min-width: 56px; text-align: center; color: #fff; font-size: 12px; font-weight: 800; }
.lbl-bar .lb-cols { gap: 4px; padding: 4px 6px; }
.lbl-bar .lb-cols button { min-width: 0; width: 22px; height: 22px; padding: 0; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.6); }
.lbl-bar .lb-cols button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--forest), 0 0 0 4px #fff; }
.lbl-bar .lf-ok { background: var(--sun, #ffda6f); color: var(--forest); }
body.night-ui .lbl-bar { background: #16241c; box-shadow: 0 14px 40px rgba(0,0,0,.5), 0 0 0 1px #2a3d32; }
.lbl-edit.bg { background: #fff; border-color: var(--accent); }


/* 8.64: Zeichenplan (ohne Beleuchtung) */
body.kind-draw #power, body.kind-draw #btn-materials, body.kind-draw .cat-auto, body.kind-draw .summary,
body.kind-draw #ex-list, body.kind-draw #ex-prices { display: none !important; }
body.kind-draw label:has(> #ex-list), body.kind-draw label:has(> #ex-prices) { display: none !important; }
.kind-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px 0 10px; margin-left: 4px; border: 0; border-radius: 99px; background: rgba(255,255,255,.14); color: #fff; font: inherit; font-size: 11.5px; font-weight: 800; white-space: nowrap; cursor: pointer; transition: background .15s; flex: none; }
.kind-chip:hover, .kind-chip[aria-expanded="true"] { background: rgba(255,255,255,.24); }
.kind-chip:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; }
.kind-chip[hidden] { display: none; }
.kind-chip .ic { width: 14px; height: 14px; }
.kind-chip .kc-chev { width: 13px; height: 13px; opacity: .75; transition: transform .15s; }
.kind-chip[aria-expanded="true"] .kc-chev { transform: rotate(180deg); }
@media (max-width: 760px) { .kind-chip .kc-l { display: none; } .kind-chip { padding: 0 6px 0 8px; } }
/* 8.67: Planart wählen (Titelleiste) */
.kind-pop { position: fixed; z-index: 400; width: 280px; padding: 6px; border-radius: 16px; background: var(--paper); color: var(--ink); box-shadow: 0 16px 44px rgba(5,68,50,.22), 0 0 0 1px var(--line); }
.kind-pop[hidden] { display: none; }
.kind-pop button { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; border: 0; border-radius: 11px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.kind-pop button:hover:not(:disabled), .kind-pop button:focus-visible { background: var(--sage-2); outline: 0; }
.kind-pop button[aria-checked="true"] { background: var(--chip); }
.kind-pop button:disabled { opacity: .45; cursor: default; }
.kind-pop .kp-ic { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 10px; background: var(--sage); color: var(--moss); }
.kind-pop button[aria-checked="true"] .kp-ic { background: var(--moss); color: #fff; }
.kind-pop .kp-ic .ic { width: 19px; height: 19px; }
.kind-pop .kp-t { display: grid; gap: 1px; flex: 1; min-width: 0; }
.kind-pop .kp-t b { font-size: 13.5px; }
.kind-pop .kp-t small { font-size: 11.5px; color: var(--ink-2); }
.kind-pop .kp-ok { width: 18px; height: 18px; color: var(--moss); visibility: hidden; }
.kind-pop button[aria-checked="true"] .kp-ok { visibility: visible; }
.kind-pop .kp-note { margin: 4px 10px 6px; font-size: 11px; color: var(--ink-2); }
body.night-ui .kind-pop { background: #13211a; color: #d6eedd; box-shadow: 0 16px 44px rgba(0,0,0,.55), 0 0 0 1px #2a3d32; }
body.night-ui .kind-pop button:hover:not(:disabled), body.night-ui .kind-pop button:focus-visible { background: #1b2d24; }
body.night-ui .kind-pop button[aria-checked="true"] { background: #213629; }
body.night-ui .kind-pop .kp-ic { background: #1d3026; color: var(--apricot); }
body.night-ui .kind-pop button[aria-checked="true"] .kp-ic { background: var(--apricot); color: #07130e; }
body.night-ui .kind-pop .kp-ok { color: var(--apricot); }
body.night-ui .kind-pop .kp-t small, body.night-ui .kind-pop .kp-note { color: #9db3a6; }
/* 8.67: Ebenen (nach hinten / nach vorn) in der Hinweisleiste */
.z-seg button { padding-left: 7px; padding-right: 7px; }
.z-seg .ic { width: 17px; height: 17px; margin: 0; }
.nf-kind { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 6px; }
.nf-kind button { display: grid; justify-items: start; align-content: start; gap: 4px; min-height: 96px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.nf-kind button .ic { width: 22px; height: 22px; color: var(--forest); }
.nf-kind button b { font-size: 13.5px; }
.nf-kind button small { font-size: 11.5px; line-height: 1.35; color: var(--ink-2); }
.nf-kind button[aria-checked="true"] { border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--paper)); padding: 11px; }
.nf-kind button[disabled] { opacity: .5; cursor: default; }
@media (max-width: 640px) { .nf-kind { grid-template-columns: 1fr; } .nf-kind button { min-height: 0; } }
.pf-kind { display: grid; gap: 6px; padding: 12px 14px 4px; }
.pf-kind .k { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.dlib { display: grid; gap: 10px; }
.dlib-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.dlib-t { display: grid; justify-items: center; gap: 4px; padding: 10px 4px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); font: inherit; font-size: 11px; font-weight: 700; cursor: pointer; min-height: 64px; }
.dlib-t .ic { width: 28px; height: 28px; color: var(--forest); }
.dlib-t[aria-pressed="true"] { border: 2px solid var(--accent); padding: 9px 3px 7px; }
.panel.mini .dlib-grid { grid-template-columns: 1fr; }
.panel.mini .dlib .cp-k, .panel.mini .dlib .cp-note { display: none; }
.hint .pl-kinds button { display: inline-flex; align-items: center; gap: 5px; }
.hint .pl-kinds button .ic { width: 22px; height: 22px; }
.hint .pl-kinds button span { font-size: 12px; }
@media (max-width: 1400px) { .hint .pl-kinds button span { display: none; } }
.hint .pl-val { min-width: 112px; }
.obj-pop { position: absolute; z-index: 44; display: grid; gap: 10px; min-width: 240px; padding: 14px; border-radius: 16px; background: var(--paper); box-shadow: 0 18px 50px rgba(5,40,28,.28), 0 0 0 1px var(--line); animation: pwm-in .15s ease-out; }
.obj-pop[hidden] { display: none; }
.obj-pop b { font-size: 13.5px; color: var(--ink); }
.obj-pop .op-row { display: flex; align-items: center; gap: 8px; }
.obj-pop .op-end { justify-content: flex-end; }
.obj-pop input { height: 40px; min-width: 0; flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; font: inherit; font-size: 15px; color: var(--ink); background: var(--paper); }
.obj-pop .op-f { display: grid; gap: 4px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
body.night-ui .obj-pop { background: #16241c; box-shadow: 0 18px 50px rgba(0,0,0,.5), 0 0 0 1px #2a3d32; }
body.night-ui .obj-pop input { background: #0f1a15; color: #e6efe9; border-color: #2a3d32; }
.obj-pop .op-dirs { flex-wrap: wrap; gap: 6px; }
.obj-pop .op-dirs .btn { min-width: 44px; justify-content: center; font-size: 15px; }
.obj-pop .op-dirs .btn[aria-pressed="true"] { background: var(--forest); color: #fff; border-color: var(--forest); }
.plan-card .kind-tag { display: inline-flex; align-self: flex-start; margin: 2px 0; padding: 2px 8px; border-radius: 99px; background: color-mix(in srgb, var(--accent) 14%, var(--paper)); color: var(--forest); font-size: 11px; font-weight: 800; }

/* 8.65: Neuer Plan – kompakt, Planart-Kacheln wie im Entwurf, Bild/PDF einfach aufs Fenster ziehen */
#dlg-new.nf-compact { width: min(760px, calc(100vw - 32px)); }
#dlg-new.nf-compact .new-grid { grid-template-columns: 1fr; }
#dlg-new.nf-compact .form { grid-template-columns: 1fr 1fr; column-gap: 14px; }
#dlg-new.nf-compact .form > * { grid-column: 1 / -1; }
#dlg-new.nf-compact .form > label:nth-of-type(1) { grid-column: 1; }
#dlg-new.nf-compact .form > label:nth-of-type(2) { grid-column: 2; }
#dlg-new.nf-compact .form > #nf-list, #dlg-new.nf-compact .form > #nf-maps { grid-column: 2; }
#dlg-new.nf-compact .nf-preview { display: none; margin: 0 22px 12px; min-height: 0; height: 200px; }
#dlg-new.nf-compact:has(#nf-img:not([hidden])) .nf-preview { display: block; }
#dlg-new.nf-compact .nf-empty { display: none; }
#dlg-new.nf-compact.drop { outline: 3px dashed var(--moss); outline-offset: -8px; }
#dlg-new.nf-compact.drop::after { content: 'Bild oder PDF hier loslassen'; position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%); padding: 8px 14px; border-radius: 99px; background: var(--forest); color: #fff; font-size: 13px; font-weight: 700; pointer-events: none; }
#dlg-new.nf-compact .nf-kind { margin: 4px 22px 14px; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.nf-kind button { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-height: 0; padding: 16px; border-radius: 16px; }
.nf-kind button .nk-ic { width: 44px; height: 44px; border-radius: 12px; background: #eef2ef; display: grid; place-items: center; }
.nf-kind button .nk-ic .ic { width: 24px; height: 24px; color: var(--forest); }
.nf-kind button b { font-size: 15px; }
.nf-kind button small { font-size: 12.5px; line-height: 1.45; }
.nf-kind button[aria-checked="true"] { padding: 15px; }
.nf-kind button[aria-checked="true"] .nk-ic { background: color-mix(in srgb, var(--accent) 16%, #fff); }
.nf-kind button[aria-checked="true"] .nk-ic .ic { color: var(--accent); }
@media (max-width: 640px) { #dlg-new.nf-compact .form { grid-template-columns: 1fr; } #dlg-new.nf-compact .form > * { grid-column: 1 / -1 !important; } #dlg-new.nf-compact .nf-kind { grid-template-columns: 1fr; } }
body.night-ui .nf-kind button .nk-ic { background: #1d2c24; }
/* Übersicht: Planart als Symbol in der Ecke des Vorschaubilds */
.plan-card .thumb { position: relative; }
.kind-badge { position: absolute; left: 10px; top: 10px; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.94); color: var(--forest); box-shadow: 0 2px 8px rgba(5,40,28,.18); }
.kind-badge .ic { width: 18px; height: 18px; }
.kind-badge.kb-draw { color: #0b6f8a; }
.kind-badge.kb-water { color: #2f7fbf; }
/* Hinweisleiste: Umschalter an/aus, Flächen-Muster */
.hint .btn.on { background: #fff; color: var(--forest); }
.cv-pats { display: inline-flex; gap: 4px; padding: 3px; border-radius: 99px; background: rgba(255,255,255,.1); }
.cv-pats button { width: 30px; height: 30px; padding: 3px; border: 0; border-radius: 9px; background: transparent; color: #fff; font: inherit; font-weight: 800; cursor: pointer; display: grid; place-items: center; }
.cv-pats button[aria-pressed="true"] { box-shadow: 0 0 0 2px #fff; }
.cv-pats svg { display: block; border-radius: 6px; }
.empty-state.passive { pointer-events: none; }
.empty-state.passive .row, .empty-state.passive button { pointer-events: auto; }

/* 8.66: Katalog mit Bereichen (Beleuchtung · Bewässerung · Grundriss) */
.cm-domain { display: grid !important; grid-template-columns: repeat(3, 1fr); margin: 12px 22px 4px; padding: 4px; border-radius: 14px; background: var(--forest); }
.cm-domain button { min-height: 40px; font-size: 14px; }
.cm-domain button { color: rgba(255,255,255,.8); font-weight: 800; border-radius: 10px; }
.cm-domain button[aria-pressed="true"] { background: #fff; color: var(--forest); }
#cm-filter { display: flex !important; flex-wrap: wrap; gap: 2px; }
#cm-filter button { flex: 1 1 auto; white-space: nowrap; padding-inline: 10px; }
.dlib-t svg:not(.ic) { width: 30px; height: 30px; }
.dlib-t span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.2; }
.hint .pl-preset { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px 0 6px; border-radius: 99px; background: #fff; color: var(--forest); font-size: 12.5px; white-space: nowrap; }
.hint .pl-preset svg { width: 24px; height: 24px; }

/* =========================================================
   8.68: iPhone (body.phone-ui, z. B. iPhone Air 420 × 912 pt) – Touch-Oberfläche wie am iPad,
   für den kleinen Bildschirm verdichtet. Hochformat: Puck unten, Karte/Hinweis oben über die ganze Breite.
   ========================================================= */
.editor, #view-editor { overflow: hidden; }                 /* eingefahrenes Blatt (Seitenleiste) verbreitert die Seite nicht */
body.phone-ui .editor-bar { gap: 4px; padding-right: max(6px, env(safe-area-inset-right)); padding-left: max(6px, env(safe-area-inset-left)); }
body.phone-ui .editor-bar .icon-btn, body.phone-ui .editor-bar .t-more { width: 40px; min-width: 40px; }
body.phone-ui #btn-materials .lbl { display: none; }
body.phone-ui #btn-materials { padding: 0 10px; }
body.phone-ui .plan-title { flex: 1 1 auto; min-width: 0; }
body.phone-ui .plan-title input { font-size: 15px; }
body.phone-ui .kind-chip .kc-l { display: none; }
body.phone-ui .kind-chip { padding: 0 6px 0 8px; }
body.phone-ui .save-state { display: none; }
body.phone-ui .t-menu:not([hidden]) { right: 8px; max-height: calc(var(--app-h, 100dvh) - var(--bar-h) - 16px); overflow-y: auto; overscroll-behavior: contain; }
body.phone-ui .t-menu:not([hidden]) { top: calc(var(--bar-h) + 4px); }
body.phone-ui .view-tools { left: max(10px, env(safe-area-inset-left)); bottom: max(10px, env(safe-area-inset-bottom)); gap: 4px; }
body.phone-ui .zoombox { right: max(10px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom)); }
body.phone-ui .stage-top { left: 8px; right: 8px; top: 8px; }
/* Karte an der Auswahl: oben, volle Breite, ohne Zeiger */
body.phone-ui .t-ctx.dock:not([hidden]) { left: 8px !important; right: 8px; min-width: 0; max-width: none; padding: 8px; }
body.phone-ui .t-ctx.dock::after { display: none; }
body.phone-ui .t-ctx:not(.dock):not([hidden]) { min-width: 0; width: min(420px, calc(100% - 20px)); padding: 8px; z-index: 33; }
body.phone-ui .t-crow { gap: 4px; }
body.phone-ui .t-crow button { min-width: 0; padding: 8px 2px 6px; font-size: 11px; }
/* Hinweis-/Bearbeitungsleiste oben über die ganze Breite */
body.phone-ui .stage-wrap .hint, body.phone-ui[data-puck] .stage-wrap .hint { left: 8px; right: 8px; transform: none; max-width: none; width: auto; margin: 0; justify-content: center; font-size: 13px; }
body.phone-ui .stage-wrap .hint .btn, body.phone-ui .stage-wrap .hint .shape-seg button { min-height: 34px; font-size: 12.5px; }
body.phone-ui .stage-wrap .hint .btn { padding: 0 10px; }
body.phone-ui .hint .pl-kinds button span { display: none; }

@media (orientation: portrait) {
  body.phone-ui .t-seg, body.phone-ui .editor-bar > .grp { display: none !important; }   /* Planen/Layout und Rückgängig sitzen am Puck */
  body.phone-ui .panel { width: 100vw; border-radius: 0; }
  body.phone-ui .panel.mini { width: 100vw; }
  body.phone-ui .scalebar { display: none; }
  body.phone-ui .stage-wrap .hint { top: 52px; }
}
@media (orientation: landscape) {
  body.phone-ui { --bar-h: 52px; }
  body.phone-ui .t-seg button { padding: 6px 11px; min-height: 34px; font-size: 13px; }
  body.phone-ui .plan-title span { display: none; }
  body.phone-ui .stage-wrap .hint { top: 8px; }
  body.phone-ui .t-menu .t-sum { padding: 4px 8px 8px; }
  body.phone-ui .t-menu button { min-height: 42px; padding: 9px 12px; }
}
/* iPhone: Werkzeug-Karte statt Rad */
body.phone-ui .t-dock { position: absolute; left: 8px; right: 8px; display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 22px; background: var(--paper); box-shadow: 0 18px 50px rgba(5,40,28,.28); overflow-y: auto; overscroll-behavior: contain;
  transform: translateY(14px); opacity: 0; transition: transform .2s cubic-bezier(.2,.9,.3,1.1), opacity .15s; }
body.phone-ui .t-wheel.open .t-dock { transform: none; opacity: 1; }
body.phone-ui .t-wheel.instant .t-dock { transition: none; }
body.phone-ui .t-dock .t-wi, body.phone-ui .t-dock .t-wo { position: static; margin: 0; transform: none !important; opacity: 1; transition: background .12s; box-shadow: none; }
body.phone-ui .t-dock-t { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
body.phone-ui .t-dock .t-wi { width: auto; height: 60px; border-radius: 16px; background: var(--sage-2); font-size: 10.5px; }
body.phone-ui .t-dock .t-wi.on { background: var(--accent); color: #fff; }
body.phone-ui .t-dock-h { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); padding: 0 4px; }
body.phone-ui .t-dock-o { display: flex; gap: 6px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding: 3px 3px 5px; margin: -3px -3px 0; scrollbar-width: none; }
body.phone-ui .t-dock-o::-webkit-scrollbar { display: none; }
body.phone-ui .t-dock .t-wo { flex: none; width: 70px; height: 66px; border-radius: 16px; background: var(--sage-2); scroll-snap-align: start; }
body.phone-ui .t-dock .t-wo span { max-width: 64px; }
body.phone-ui .t-dock .t-wo.on { outline: 3px solid var(--accent); outline-offset: -3px; background: #fff; }
body.night-ui.phone-ui .t-dock { background: #111c17; box-shadow: 0 18px 50px rgba(0,0,0,.6); }
body.night-ui.phone-ui .t-dock .t-wi, body.night-ui.phone-ui .t-dock .t-wo { background: #1a2a22; color: #e6efe9; }
body.night-ui.phone-ui .t-dock .t-wi.on { background: var(--accent); color: #1b0f08; }
@media (orientation: landscape) {
  body.phone-ui .t-dock { right: auto; width: min(600px, calc(100% - 16px)); }
  body.phone-ui .t-dock-t { grid-template-columns: repeat(8, 1fr); }
  body.phone-ui .t-dock .t-wi { height: 54px; }
}
/* Meldungen: auf dem iPhone weder über der Bearbeitungsleiste oben noch über Puck/Umschalter */
body.phone-ui #toast { max-width: calc(100% - 24px); text-align: center; }
@media (orientation: portrait) { body.phone-ui #toast { top: auto !important; bottom: calc(238px + env(safe-area-inset-bottom)); } }
@media (orientation: landscape) { body.phone-ui #toast { top: auto !important; bottom: calc(62px + env(safe-area-inset-bottom)); max-width: min(460px, calc(100% - 420px)); } }
/* 8.69: Grundriss (Gartenplan) – Kabel-Einstellungen gehören zur Beleuchtung */
body.kind-draw #tab-plan details[data-sec="cable"] { display: none !important; }

/* =========================================================
   8.70: iPhone/iPad-Feinschliff
   ========================================================= */
/* iPhone: Umschalter Planen | Layout am Puck kompakter */
body.phone-ui .t-mode { border-radius: 19px; }
body.phone-ui .t-mode .tm-knob { border-radius: 19px; }
body.phone-ui .t-mode button { width: 38px; height: 38px; border-radius: 19px; font-size: 13px; }
body.phone-ui .t-mode button .ic { width: 17px; height: 17px; }
body.phone-ui .t-mode button[aria-pressed="true"] { padding-left: 10px; gap: 6px; }
/* iPhone: Planart-Knopf in der Titelleiste gut antippbar */
body.phone-ui .kind-chip { height: 38px; min-width: 52px; padding: 0 8px 0 11px; gap: 4px; justify-content: center; }
body.phone-ui .kind-chip .ic { width: 20px; height: 20px; }
body.phone-ui .kind-chip .kc-chev { width: 15px; height: 15px; }
/* iPhone quer: Umschalter und Rückgängig stehen oben in der Leiste – am Puck nicht doppelt */
@media (orientation: landscape) {
  body.phone-ui:not(.app-fs) .t-mode, body.phone-ui:not(.app-fs) .t-undo, body.phone-ui:not(.app-fs) #t-redo { display: none !important; }   /* Vollbild: Leiste weg → wieder am Puck */
  body.phone-ui { --bar-h: 48px; }
  body.phone-ui .editor-bar .icon-btn, body.phone-ui .editor-bar .t-more { height: 38px; }
  body.phone-ui .kind-chip { height: 34px; }
  body.phone-ui .kind-chip .kc-l { display: inline; }
  body.phone-ui .view-tools .icon-btn, body.phone-ui .view-tools button { width: 36px; height: 36px; }
  body.phone-ui .zoombox { height: 38px; }
  /* Menü zweispaltig – passt ohne Scrollen */
  body.phone-ui .t-menu:not([hidden]) { width: min(560px, calc(100vw - 24px)); display: grid; grid-template-columns: 1fr 1fr; column-gap: 4px; align-content: start; }
  body.phone-ui .t-menu .t-sum, body.phone-ui .t-menu hr { grid-column: 1 / -1; }
}

/* Startseite am iPhone: kompaktes Logo, Abmelden immer sichtbar */
.brand-logo-compact { display: none; height: 38px; width: auto; max-width: 150px; object-fit: contain; flex: none; }
@media (max-width: 640px) {
  body.has-compact-logo .topbar-inner .brand-logo { display: none !important; }
  body.has-compact-logo .topbar-inner .brand-logo-compact { display: block; }
  .topbar-inner { gap: 8px; padding: 0 max(12px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left)); }
  .topbar-inner .brand-logo { max-width: 46vw; flex: 0 1 auto; min-width: 0; }
  .topbar-inner > * { flex-shrink: 0; }
  .topbar-inner .spacer { flex: 1 1 0; min-width: 0; }
  #btn-open-catalog { padding: 0 12px; height: 38px; }
  #btn-logout { width: 40px; height: 40px; }
}

/* Offene Menüs, Popups, Dialoge: Hintergrund steht still, Listen darin scrollen nicht in die Seite durch */
dialog, .t-menu, .kind-pop, .net-pop, .wm-pop, .ctx-menu, .cv-pop, .panel, .t-dock, .t-dock-o, .cm-sym-pop, .vtx-pop, .obj-pop { overscroll-behavior: contain; }
html:has(dialog[open]), html:has(dialog[open]) body,
html.ov-guard:has(#t-menu:not([hidden])) body, html.ov-guard:has(#kind-pop:not([hidden])) body { overflow: hidden; }

/* Vollbild am iPad/iPhone: Titelleiste weg, kleine schwebende Leiste oben rechts (Materialliste · Vollbild beenden · Menü) */
body.app-fs .editor-bar, body.app-fs.is-fs .editor-bar {
  position: fixed; z-index: 70; top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); left: auto;
  width: auto; height: 50px; padding: 0 5px !important; gap: 4px; border-radius: 17px; box-shadow: 0 10px 28px rgba(5,40,28,.32);
}
body.app-fs .editor-bar > :not(#btn-materials):not(#t-fs):not(#t-more) { display: none !important; }
body.app-fs .editor-bar #btn-materials .lbl { display: none; }
body.app-fs .editor-bar #btn-materials { padding: 0 10px; }
body.app-fs .t-menu:not([hidden]) { top: calc(max(8px, env(safe-area-inset-top)) + 56px) !important; }
body.app-fs .stage-wrap .hint { top: 68px; }
body.app-fs .stage-top { max-width: calc(100% - 190px); }

/* 8.71: Details einer Form (Doppelklick) */
.shape-dlg .dlg-body { gap: 14px; }
.sh-sec { display: grid; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.sh-sec:last-child { border-bottom: 0; padding-bottom: 0; }
.sh-sec > .k { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.sh-seg { display: flex; flex-wrap: wrap; }
.sh-seg button { flex: 1 1 auto; }
.sh-sw { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.sh-sw button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; background: var(--c); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.sh-sw button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--accent); }
.sh-own { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.sh-own input { width: 34px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; }
.sh-range { display: grid; gap: 6px; }
.sh-range b { font-weight: 700; color: var(--ink); }
.sh-range input { width: 100%; accent-color: var(--accent); }
.sh-checks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.sh-ro { margin: 0; font-size: 13px; }
body.night-ui .sh-sw button { border-color: #13211a; }
/* 8.72: Leuchten für einen Trafo auswählen – Überlast in der Leiste */
.hint .txt .warn { color: var(--sun); font-weight: 800; }
.wire-acts .btn[data-a="wire-pick"] { grid-column: 1 / -1; }

/* 8.79: Nachtansicht – Zeichnen/Platten/Pflanzen in der Seitenleiste gut lesbar */
body.night-ui .dlib-t { background: #131f19; border-color: #2a3d32; color: #e6efe9; }
body.night-ui .dlib-t:hover { border-color: #3d5a49; }
body.night-ui .dlib-t .ic { color: #cfe8dc; }
body.night-ui .dlib-t svg:not(.ic) { filter: brightness(2.1) saturate(.85); }
body.night-ui .dlib-t[aria-pressed="true"] { background: rgba(242,140,90,.12); border-color: var(--accent); }
/* 8.80: Pflanze – Farbe und Füllung (Doppelklick) */
.obj-pop .pl-sw { margin-top: 4px; }
.obj-pop .pl-sw button { width: 26px; height: 26px; }
.obj-pop .pl-fill { display: flex; margin-top: 4px; }
.obj-pop .pl-fill button { flex: 1 1 auto; font-size: 12px; padding: 6px 8px; }

/* 8.81: Plan auf einem anderen Gerät bearbeitet – hier pausiert */
.remote-lock { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 20px; background: rgba(8, 30, 21, .42); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.remote-lock[hidden] { display: none; }
.rl-card { width: min(440px, 100%); display: grid; gap: 12px; justify-items: start; padding: 24px; border-radius: 20px; background: var(--paper); box-shadow: 0 24px 60px rgba(5,40,28,.35); animation: pwm-in .18s ease-out; }
.rl-ic { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: var(--sage); color: var(--moss); }
.rl-ic .ic { width: 26px; height: 26px; }
.rl-card h2 { margin: 0; font-size: 20px; }
.rl-card p { margin: 0; color: var(--ink-2); line-height: 1.5; }
.rl-card p b { color: var(--ink); }
.rl-own { display: inline-block; margin-top: 6px; color: var(--moss); font-weight: 600; }
.rl-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.rl-acts .btn.primary .ic { width: 18px; height: 18px; }
body.night-ui .rl-card { background: #13211a; color: #e6efe9; box-shadow: 0 24px 60px rgba(0,0,0,.6); }
body.night-ui .rl-card p { color: #b3c6ba; }
body.night-ui .rl-card p b { color: #e6efe9; }
body.night-ui .rl-ic { background: #1d3026; color: var(--apricot); }
