/* Design 0.47 „Werkstatt“: Grafit und Werkstattpapier, Blaupausen-Blau als Akzent, Signalgelb nur für die
   Hauptaktion, Maße in Monospace, Schrift Plus Jakarta Sans (SIL OFL 1.1, fonts/PlusJakartaSans-OFL.txt) vom eigenen Server */
@font-face {
  font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("/static/fonts/PlusJakartaSans-latin.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-weight: 200 800; font-display: swap;
  src: url("/static/fonts/PlusJakartaSans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
:root {
  --bg: #f2f0ea;               /* Werkstattpapier */
  --panel: #fffefa;
  --panel-2: #eae7df;          /* Eingabefelder, Unterflächen */
  --text: #17181b;             /* Grafit */
  --muted: #5d5b55;
  --line: #d9d4c9;
  --accent: #2456d3;           /* Blaupause: Auswahl, Fokus, Akzente */
  --accent-soft: color-mix(in srgb, var(--accent) 11%, transparent);
  --accent-text: #ffffff;
  --cta: #ffc21f;              /* Signalgelb: nur die Hauptaktion je Seite */
  --cta-text: #17181b;
  --warn-bg: #fff0c2;
  --err-bg: #fbe0da;
  --ok: #1f8a4c;
  --canvas: #e8e5dd;
  --thumb: #c7c1b4;
  --grid-line: rgba(23, 24, 27, .055);
  --grid-major: rgba(23, 24, 27, .09);
  --float: 0 14px 40px rgba(23, 24, 27, .16), 0 2px 6px rgba(23, 24, 27, .06);   /* nur schwebende Menüs und Dialoge */
  --radius: 8px;
  --radius-sm: 5px;
  --mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111214;
    --panel: #18191c;
    --panel-2: #222429;
    --text: #edebe6;
    --muted: #9c9a93;
    --line: #2c2e33;
    --accent: #7ea4ff;
    --accent-text: #0a1230;
    --cta: #ffc21f;
    --cta-text: #17181b;
    --warn-bg: #3a2f0e;
    --err-bg: #46201a;
    --ok: #4cc47e;
    --canvas: #141518;
    --thumb: #3a3c42;
    --grid-line: rgba(237, 235, 230, .04);
    --grid-major: rgba(237, 235, 230, .075);
    --float: 0 16px 44px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111214;
  --panel: #18191c;
  --panel-2: #222429;
  --text: #edebe6;
  --muted: #9c9a93;
  --line: #2c2e33;
  --accent: #7ea4ff;
  --accent-text: #0a1230;
  --cta: #ffc21f;
  --cta-text: #17181b;
  --warn-bg: #3a2f0e;
  --err-bg: #46201a;
  --ok: #4cc47e;
  --canvas: #141518;
  --thumb: #3a3c42;
  --grid-line: rgba(237, 235, 230, .04);
  --grid-major: rgba(237, 235, 230, .075);
  --float: 0 16px 44px rgba(0, 0, 0, .55);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font: 15px/1.5 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased;
  background: var(--bg); color: var(--text);
  display: grid; grid-template-rows: auto 1fr; overflow: hidden;
}
header { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 10px 16px 6px; }
header h1 { margin: 0; font-size: 1.2rem; }
header .spacer { flex: 1; }
.home { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.home:hover { color: var(--text); border-color: var(--muted); }
.btn-group { display: flex; gap: 0; }
.btn-group > * { border-radius: 0 !important; margin-left: -1px !important; }
.btn-group > :first-child { border-radius: 8px 0 0 8px !important; margin-left: 0 !important; }
.btn-group > :last-child { border-radius: 0 8px 8px 0 !important; }
.layout-switch, .history { display: flex; gap: 4px; }
.layout-switch button.active { border-color: var(--accent); color: var(--text); }

main { display: grid; grid-template-columns: 350px 1fr; gap: 12px; padding: 6px 16px 14px; min-height: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; min-width: 0; }
#controls { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.controls-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 14px 4px; }
h2 { font-size: 0.98rem; margin: 16px 0 6px; }
.hint { color: var(--muted); font-size: 0.82rem; margin: 4px 0 8px; }
.drop { display: flex; align-items: center; justify-content: center; min-height: 64px; border: 2px dashed var(--line); border-radius: 8px; cursor: pointer; color: var(--muted); text-align: center; padding: 8px; }
.drop.over, .drop:hover { border-color: var(--accent); color: var(--text); }
.drop input { display: none; }
.row { margin: 6px 0; }
.row input[type=range] { width: 100%; }
.row label { display: flex; justify-content: space-between; gap: 8px; }
.checks { display: flex; flex-wrap: wrap; gap: 12px; }
.checks label { justify-content: flex-start; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid2 label { display: flex; flex-direction: column; gap: 2px; font-size: 0.85rem; color: var(--muted); }
input[type=number], select { font: inherit; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); width: 100%; }
.inline input[type=number] { width: 60px; }
.result { padding: 10px 14px 10px; border-top: 1px solid var(--line); background: var(--panel); }
.result button { width: 100%; }
.summary { font-variant-numeric: tabular-nums; }
.summary strong { font-size: 1.02rem; }
.summary .warn { display: block; margin-top: 6px; background: var(--warn-bg); padding: 6px 10px; border-radius: 6px; }
.version { color: var(--muted); font-size: 0.72rem; margin: 6px 0 0; text-align: right; }

button { font: inherit; font-weight: 600; padding: 9px 16px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-text); cursor: pointer; margin-top: 10px; transition: background .12s, border-color .12s, color .12s, filter .12s; }
button:not(:disabled):hover { filter: brightness(1.08); }
button:disabled { opacity: 0.4; cursor: default; }
button.ghost { background: var(--panel); color: var(--muted); border: 1px solid var(--line); font-weight: 500; font-size: 0.88rem; height: 30px; padding: 0 10px; margin: 0; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
button.ghost:not(:disabled):hover { color: var(--text); border-color: var(--muted); background: var(--bg); filter: none; }
button.icon { padding: 0 7px; min-width: 30px; justify-content: center; }

/* ---------- Ansichten ---------- */
#views { position: relative; display: flex; min-width: 0; min-height: 0; }
#views[data-layout=column] { flex-direction: column; }
.pane {
  flex: var(--grow, 1) 1 0; min-width: 140px; min-height: 120px;
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
}
.pane-bar { display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--line); }
.pane-bar h2 { margin: 0 auto 0 0; font-size: 0.92rem; white-space: nowrap; }
.toggle { display: flex; align-items: center; gap: 4px; font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.pane-body { position: relative; flex: 1; min-height: 0; background: var(--canvas); touch-action: none; }
.pane-body canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pane-body canvas.grab { cursor: grab; }
.pane-body canvas.grabbing { cursor: grabbing; }
.pane-body canvas.point { cursor: move; }
.pane-body canvas.add { cursor: copy; }
.pane-hint { font-size: 0.75rem; color: var(--muted); padding: 4px 10px; border-top: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gutter { flex: 0 0 10px; cursor: col-resize; position: relative; }
.gutter::after { content: ""; position: absolute; inset: 30% 4px; border-radius: 2px; background: var(--line); }
.gutter:hover::after, .gutter.dragging::after { background: var(--accent); }
#views[data-layout=column] .gutter { cursor: row-resize; }
#views[data-layout=column] .gutter::after { inset: 4px 30%; }
#views.maximized .pane:not(.max), #views.maximized .gutter { display: none; }
.message { position: absolute; z-index: 5; top: 44px; left: 50%; transform: translateX(-50%); max-width: 90%; padding: 8px 14px; border-radius: 8px; background: var(--err-bg); box-shadow: 0 2px 10px rgba(0,0,0,.15); }

@media (max-width: 860px) {
  body { overflow: auto; display: block; }
  main { grid-template-columns: 1fr; padding: 8px 12px; }
  #controls { overflow: visible; }
  #views, #views[data-layout=row] { flex-direction: column; }
  .pane { flex: none; height: 60vh; margin-bottom: 10px; }
  .gutter, .layout-switch { display: none; }
}

/* ---------- Version 0.3 ---------- */

.templates { margin: 10px 0 4px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.templates summary { cursor: pointer; font-weight: 600; font-size: 0.88rem; }
.template-links { display: flex; flex-wrap: wrap; gap: 6px; }
.template-links a { font-size: 0.85rem; color: var(--accent); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; text-decoration: none; }
.template-links a:hover { border-color: var(--accent); }
.scale-info { font-size: 0.86rem; padding: 6px 10px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); }
.scale-info.active { border-color: var(--accent); }
.scale-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.tools { display: flex; gap: 2px; margin-right: 6px; }
.tools button.active, button.ghost.active { border-color: var(--accent); color: var(--text); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.pane-body canvas.select { cursor: crosshair; }
.pane-body canvas.measure { cursor: crosshair; }
.pane-body canvas.label { cursor: pointer; }
.popup {
  position: absolute; z-index: 6; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; box-shadow: 0 6px 24px rgba(0,0,0,.22); display: flex; flex-direction: column; gap: 6px; min-width: 190px;
}
.popup[hidden] { display: none; }
.popup label { font-size: 0.85rem; font-weight: 600; }
.popup-row { display: flex; align-items: center; gap: 6px; }
.popup-row input { width: 110px; }
.popup button { margin: 0; padding: 5px 12px; }

/* ---------- Version 0.4 ---------- */
.project { display: flex; gap: 4px; }
.button-like { display: inline-flex; align-items: center; gap: 4px; height: 30px; cursor: pointer; font-size: 0.88rem; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; white-space: nowrap; }
.button-like:hover { color: var(--text); border-color: var(--muted); background: var(--bg); }
.label-head { display: flex; align-items: center; gap: 2px; }
.info {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 15px; box-sizing: border-box;
  width: 15px; height: 15px; min-width: 15px; padding: 0 1px 0 0; margin: 0 4px; border-radius: 50%; text-indent: 0; letter-spacing: 0; text-align: center;
  border: 1px solid var(--muted); color: var(--muted); background: transparent;
  font: italic 600 10px/1 Georgia, serif; cursor: help; user-select: none; vertical-align: middle;
}
.info:hover, .info:focus { color: var(--accent-text); background: var(--accent); border-color: var(--accent); outline: none; }
.tooltip {
  position: fixed; z-index: 50; max-width: 300px; padding: 8px 11px; border-radius: 8px;
  background: var(--text); color: var(--panel); font-size: 0.82rem; line-height: 1.4;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); pointer-events: none;
}
.tooltip[hidden] { display: none; }
.row label .info { margin-right: auto; }

/* ---------- Version 0.6 ---------- */
/* Scrollleisten im Farbschema */
* { scrollbar-width: thin; scrollbar-color: var(--thumb) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--thumb); border-radius: 6px; border: 2px solid var(--panel); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
::-webkit-scrollbar-corner { background: transparent; }

/* Schieberegler */
input[type=range] { -webkit-appearance: none; appearance: none; background: transparent; height: 20px; accent-color: var(--accent); cursor: pointer; }
input[type=range]:disabled { opacity: 0.45; cursor: default; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--line); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; margin-top: -5px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--accent);
}
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line); }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--panel); }
input[type=range]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=checkbox] { accent-color: var(--accent); }

.theme-switch { display: flex; gap: 4px; }

/* ---------- Version 0.7 ---------- */
/* Projektname */
.project-name { display: flex; flex-direction: column; gap: 2px; font-size: 0.85rem; color: var(--muted); margin-bottom: 8px; }
input[type=text] { font: inherit; font-size: 0.95rem; font-weight: 600; padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); width: 100%; }
input[type=number]:focus, input[type=text]:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }

/* aufklappbare Abschnitte */
details.sec { border-top: 1px solid var(--line); padding: 2px 0 8px; }
details.sec > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px;
  font-weight: 650; font-size: 0.98rem; padding: 9px 0 7px; user-select: none;
}
details.sec > summary::-webkit-details-marker, details.sub > summary::-webkit-details-marker { display: none; }
details.sec > summary::after { content: "▾"; margin-left: auto; color: var(--muted); transition: transform .15s; }
details.sec:not([open]) > summary::after { transform: rotate(-90deg); }
.num { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-size: 0.75rem; font-weight: 700; }
details.sub { margin: 8px 0 2px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: color-mix(in srgb, var(--bg) 55%, transparent); }
details.sub > summary { list-style: none; cursor: pointer; font-size: 0.86rem; font-weight: 600; color: var(--muted); padding: 7px 0; display: flex; align-items: center; gap: 4px; }
details.sub > summary::before { content: "▸"; display: inline-block; width: 12px; transition: transform .15s; }
details.sub[open] > summary::before { transform: rotate(90deg); }
details.sub[open] { padding-bottom: 10px; }
details.sub > summary:hover { color: var(--text); }
.templates { margin: 8px 0 2px; }

/* Häkchen im Farbschema */
input[type=checkbox] {
  -webkit-appearance: none; appearance: none; flex: none; margin: 0; cursor: pointer;
  width: 17px; height: 17px; border: 1.5px solid var(--muted); border-radius: 4px; background: var(--bg);
  display: inline-grid; place-content: center; transition: background .12s, border-color .12s;
}
input[type=checkbox]::after {
  content: ""; width: 9px; height: 5px; border: solid var(--accent-text); border-width: 0 0 2px 2px;
  transform: rotate(-45deg) translate(1px, -1px); opacity: 0;
}
input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:checked::after { opacity: 1; }
input[type=checkbox]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
label.check { display: flex; align-items: center; gap: 7px; color: var(--text); font-size: 0.9rem; cursor: pointer; margin: 4px 0; }
.grid2 label.check { flex-direction: row; color: var(--text); font-size: 0.9rem; }
.cell-bottom { align-self: end; min-height: 33px; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 6px; }

/* Auswahllisten im Farbschema */
select {
  -webkit-appearance: none; appearance: none; cursor: pointer; padding-right: 26px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 52%, calc(100% - 9px) 52%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
select option { background: var(--panel); color: var(--text); }

.input-with-button { display: flex; gap: 4px; }
.input-with-button button { height: auto; }
.pane-body.grip-mode canvas { cursor: ew-resize; }
.pane-body canvas.grip-x { cursor: ew-resize; }
.pane-body canvas.grip-y { cursor: ns-resize; }
@media (max-width: 860px) { .controls-scroll { overflow: visible; } }
.summary { font-size: 0.86rem; }
.summary strong { display: block; font-size: 0.98rem; }
.summary .sub { display: block; color: var(--muted); }
.summary .warn { font-size: 0.82rem; }
.grid2 label { justify-content: flex-end; }
.grid2 label.check { justify-content: flex-start; }

/* ---------- Version 0.7.1: Messvorlagen ---------- */
.template-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; margin: 4px 0 8px; }
.template-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.76rem; padding: 3px 4px; border-bottom: 1px solid var(--line); }
.template-table td { padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.template-table td small { display: block; color: var(--muted); font-size: 0.72rem; }
.template-table a { display: inline-block; font-size: 0.8rem; color: var(--accent); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; text-decoration: none; margin: 1px 2px 1px 0; }
.template-table a:hover { border-color: var(--accent); }
.bambu-note { font-size: 0.8rem; line-height: 1.45; background: color-mix(in srgb, var(--accent) 10%, var(--panel)); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); border-radius: 8px; padding: 8px 10px; margin: 4px 0 8px; }
.parts-select { display: flex; flex-direction: column; gap: 2px; font-size: 0.85rem; color: var(--muted); margin: 4px 0 6px; }
.template-table a.too-big { color: var(--muted); border-style: dashed; text-decoration: line-through; }
.field-row { display: flex; flex-direction: column; gap: 4px; margin: 4px 0 8px; font-size: 0.85rem; color: var(--muted); }
.busy { position: absolute; z-index: 4; top: 10px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 2px 10px rgba(0,0,0,.15); font-size: 0.85rem; white-space: nowrap; }
.busy[hidden] { display: none; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Version 0.9: Grundplatte ---------- */
.segmented { display: flex; margin: 2px 0 10px; }
.segmented button { flex: 1; justify-content: center; border-radius: 0; margin-left: -1px; }
.segmented button:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.segmented button:last-child { border-radius: 0 8px 8px 0; }
.segmented button.active { border-color: var(--accent); color: var(--text); background: color-mix(in srgb, var(--accent) 14%, transparent); position: relative; z-index: 1; }
[data-show][hidden] { display: none !important; }
.download-row { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.download-row button { margin: 0; }
button.secondary { background: var(--panel); color: var(--text); border: 1px solid var(--line); font-weight: 600; }
button.secondary:not(:disabled):hover { border-color: var(--accent); background: var(--bg); filter: none; }
.pane-body canvas.cell { cursor: pointer; }
.pane-body canvas.col-resize { cursor: col-resize; }
.pane-body canvas.row-resize { cursor: row-resize; }
.pane-body #three .busy, #three > .busy { top: 10px; }

/* ---------- Version 0.10: Konten ---------- */
input[type=password], .field input[type=text], .field input:not([type]) { font: inherit; font-size: 0.95rem; padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); width: 100%; }
input[type=password]:focus, .field input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
textarea { font: 0.86rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); width: 100%; resize: vertical; }
.mono, input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.04em; }
button.danger { background: #d4373d; color: #fff; }
button.ghost.danger-text:not(:disabled) { color: #d4373d; }
button.ghost.danger-text:not(:disabled):hover { border-color: #d4373d; color: #d4373d; }

.account { position: relative; }
.account-name { display: inline-block; max-width: 14ch; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 200px; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 26px rgba(0,0,0,.2); display: flex; flex-direction: column; }
.menu-title { font-size: 0.8rem; color: var(--muted); padding: 4px 8px 6px; }
.menu-title strong { color: var(--text); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.menu-item { display: block; text-align: left; font: inherit; font-size: 0.9rem; font-weight: 500; color: var(--text); background: none; border: 0; border-radius: 6px; padding: 7px 8px; margin: 0; cursor: pointer; text-decoration: none; }
.menu-item:hover, .menu-item:focus-visible { background: var(--bg); filter: none; outline: none; }

dialog.modal { width: min(420px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto; padding: 16px 18px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); box-shadow: 0 18px 50px rgba(0,0,0,.3); }
dialog.modal.wide { width: min(640px, calc(100vw - 32px)); }
dialog.modal:has(.print-area) { width: min(900px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(10, 14, 18, .45); }
.modal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.modal-head h2 { margin: 0 auto 0 0; font-size: 1.08rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.modal-actions button { margin: 0; }
.form { display: flex; flex-direction: column; gap: 10px; }
.form p { margin: 0; }
.form > button.primary { margin-top: 2px; }
.form .segmented { margin: 0 0 2px; }
.field { display: flex; flex-direction: column; gap: 3px; font-size: 0.85rem; color: var(--muted); }
.field small { font-size: 0.76rem; line-height: 1.4; }
.form-error { background: var(--err-bg); border-radius: 6px; padding: 6px 10px; font-size: 0.86rem; }
.form-error[hidden] { display: none; }
.form-links { font-size: 0.85rem; text-align: center; }
a { color: var(--accent); }
.code-box { font-size: 1.15rem; font-weight: 700; text-align: center; padding: 12px; border: 2px dashed var(--accent); border-radius: 10px; background: var(--bg); user-select: all; word-break: break-all; }

/* einfache Seiten: Konto, Admin, Rechtstexte */
.landing-head .head-right { display: flex; align-items: center; gap: 8px; }
.doc-main { max-width: 860px; }
.doc-main h1 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); margin: 0 0 14px; }
.doc-main h2 { font-size: 1.08rem; margin: 26px 0 6px; }
.doc-main h3 { font-size: 0.98rem; margin: 18px 0 4px; }
.doc-main p, .doc-main li { line-height: 1.6; }
.doc-main mark.ph { background: var(--warn-bg); color: var(--text); padding: 0 3px; border-radius: 3px; }
.draft-note { background: var(--warn-bg); border-radius: 8px; padding: 8px 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px 16px; margin: 0 0 16px; }
.card > h2:first-child { margin-top: 0; }
.card .form { max-width: 380px; }
.card .form > button { align-self: flex-start; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.stat b { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 0.8rem; }
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table.users { width: 100%; border-collapse: collapse; font-size: 0.86rem; font-variant-numeric: tabular-nums; }
table.users th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.76rem; padding: 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.users td { padding: 6px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
table.users td.actions { display: flex; flex-wrap: wrap; gap: 4px; white-space: normal; }
table.users tr.is-locked td:not(.actions) { opacity: .55; }
.badge { display: inline-block; font-size: 0.7rem; font-weight: 700; padding: 1px 6px; border-radius: 999px; margin-left: 4px; background: color-mix(in srgb, var(--accent) 18%, var(--panel)); color: var(--text); border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--line)); }
.badge.warn { background: var(--warn-bg); border-color: var(--line); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; }
.toolbar input { max-width: 260px; }
.legal-edit textarea { min-height: 300px; }
.legal-edit .scale-actions { align-items: center; }
.saved { color: var(--accent); font-size: 0.85rem; }
.foot-links { margin-bottom: 4px; }
.foot-links a { color: var(--muted); }
.foot-links a:hover { color: var(--text); }
.version a { color: var(--muted); }
.lic-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.lic-table th, .lic-table td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.lic-table th { color: var(--muted); font-size: 0.78rem; font-weight: 600; }
@media (max-width: 600px) { .account-name { max-width: 8ch; } .card { padding: 12px; } }
.scale-actions button:not(.ghost) { margin-top: 0; }
a.button-like { text-decoration: none; }
.toolbar input[type=text] { font-weight: 400; font-size: 0.9rem; }
.doc-main.wide { max-width: 1120px; }
table.users td.actions button { margin: 0; }

/* ---------- Version 0.11: Module ---------- */
.module-note { margin: 6px 0 0; }
.module-note::before { content: "☆ "; color: var(--accent); }
svg.thumb { display: block; }
.thumb-body { stroke: color-mix(in srgb, var(--text) 45%, transparent); fill-opacity: .35; }
.thumb-grid { stroke: color-mix(in srgb, var(--text) 35%, transparent); stroke-dasharray: 3 3; }
.thumb-pocket { fill: var(--panel); stroke: color-mix(in srgb, var(--text) 70%, transparent); }
.thumb-plate { fill: color-mix(in srgb, var(--accent) 22%, var(--panel)); stroke: var(--accent); }
.thumb-cell { fill: var(--canvas); stroke: var(--accent); }
.thumb-cell.merged { fill: color-mix(in srgb, var(--accent) 40%, var(--canvas)); }
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.mod-card { display: flex; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); min-width: 0; }
.mod-card .thumb-wrap { flex: none; width: 84px; height: 84px; display: grid; place-items: center; background: var(--canvas); border-radius: 8px; }
.mod-card .mod-info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.mod-card .mod-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mod-card .mod-meta { color: var(--muted); font-size: 0.8rem; }
.mod-card .mod-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; padding-top: 6px; }
.mod-card .mod-actions .ghost, .mod-card .mod-actions .button-like { height: 26px; font-size: 0.8rem; padding: 0 8px; }
.toolbar .segmented { margin: 0; }

/* ---------- Version 0.12: Grid-Planer ---------- */
.planner-empty p { margin: 4px 0 10px; }
.plan-pick { display: flex; align-items: flex-end; gap: 6px; margin-bottom: 8px; }
.plan-pick .field-row { flex: 1; margin: 0; }
.plan-pick button { margin-bottom: 1px; }
.save-state { min-height: 1em; margin: -4px 0 6px; }
.save-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: -4px 0 6px; }
.save-row .save-state { margin: 0; }
.palette { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow-y: auto; margin: 4px 0; }
.pal-item { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); cursor: grab; user-select: none; }
.pal-item:hover, .pal-item:focus-visible { border-color: var(--muted); outline: none; }
.pal-item.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--bg)); }
.pal-thumb { flex: none; width: 40px; height: 40px; display: grid; place-items: center; }
.pal-text { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.pal-name { font-weight: 600; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-meta { color: var(--muted); font-size: 0.74rem; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.bom td:first-child { white-space: nowrap; }
kbd { font: 600 0.75rem ui-monospace, monospace; padding: 0 4px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--panel); }
.pane-body canvas.add { cursor: copy; }

/* 0.13: Kontextmenü im Grid-Planer */
.ctx-menu { position: fixed; left: 0; top: 0; right: auto; z-index: 60; min-width: 240px; }
.ctx-menu .menu-item { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.ctx-menu .menu-item kbd { font-size: 0.72rem; color: var(--muted); font-weight: 500; }
.ctx-menu .menu-item.menu-danger { color: #d4373d; }

/* 0.14: Lage des Objekts im Behälter */
.place-box { margin: 8px 0 2px; padding-top: 8px; border-top: 1px dashed var(--line); }
.place-row { display: flex; align-items: flex-end; gap: 8px; }
.place-row label { flex: 1; }
.place-row .btn-group { margin-bottom: 1px; }
.pane-body canvas.rotate { cursor: crosshair; }
.pane-body canvas.move { cursor: move; }
.module-pick { max-height: min(55vh, 460px); overflow: auto; width: 100%; }
.module-pick .pal-item { box-sizing: border-box; width: 100%; height: auto; min-height: 0; margin: 0; padding: 6px 8px; text-align: left; justify-content: flex-start; font: inherit; font-weight: 400; color: var(--text); cursor: pointer; }
.module-pick .pal-item:hover { border-color: var(--accent); filter: none; }
.module-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.module-row button { margin: 0; min-width: 0; }
.ctx-menu .menu-item:disabled { opacity: 0.45; cursor: default; background: none; }

/* Mehrere Objekte: Leiste oben links im Foto */
.obj-bar { position: absolute; z-index: 3; top: 8px; left: 8px; max-width: calc(100% - 16px); display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 6px; border-radius: 10px; background: color-mix(in srgb, var(--panel) 62%, transparent);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.obj-bar[hidden] { display: none; }
.obj-item { position: relative; }
.obj-thumb { position: relative; display: block; width: 50px; height: 50px; padding: 1px; margin: 0; border-radius: 8px; border: 2px solid transparent;
  background: color-mix(in srgb, var(--canvas) 80%, transparent); cursor: pointer; opacity: 0.78; }
.obj-thumb canvas { display: block; width: 46px; height: 46px; border-radius: 6px; }
.obj-thumb:hover { opacity: 1; filter: none; }
.obj-item.active .obj-thumb { border-color: var(--accent); opacity: 1; }
.obj-num { position: absolute; left: 2px; bottom: 2px; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px; background: rgba(20,24,28,.75);
  color: #fff; font-size: 0.68rem; font-weight: 700; line-height: 16px; text-align: center; }
.obj-item.active .obj-num { background: var(--accent); }
.obj-warn { position: absolute; right: 2px; bottom: 2px; width: 16px; height: 16px; border-radius: 50%; background: #e5484d; color: #fff;
  font-size: 0.7rem; font-weight: 800; line-height: 16px; text-align: center; }
.obj-item.busy .obj-thumb::after { content: ""; position: absolute; inset: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,.5);
  border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
.obj-del { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; padding: 0; margin: 0; border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel); color: var(--muted); font-size: 0.8rem; line-height: 15px; cursor: pointer; }
.obj-del:hover { color: #d4373d; border-color: #d4373d; filter: none; }
.obj-add { width: 34px; height: 50px; padding: 0; margin: 0; border-radius: 8px; border: 2px dashed color-mix(in srgb, var(--muted) 60%, transparent);
  background: transparent; color: var(--muted); font-size: 1.2rem; cursor: pointer; }
.obj-add:hover { border-color: var(--accent); color: var(--text); filter: none; }
.obj-of { color: var(--muted); font-weight: 500; font-size: 0.85em; }
button.ghost.add-photo { width: 100%; margin: 6px 0 0; justify-content: center; }

/* Werkzeug „Gridfinity Formeinsatz“ (gleiche Seite wie Formeinsatz aus Foto, ohne Foto) */
body:not([data-app=container]) .container-only { display: none !important; }
body[data-app=container] .photo-only { display: none !important; }
.shape-bar { flex-wrap: wrap; gap: 4px; padding: 5px 8px; }
.shape-bar button.ghost { height: 28px; font-size: 0.82rem; }
.pane-body canvas.draw { cursor: crosshair; }
.pane-body canvas.resize { cursor: nwse-resize; }
[data-shape-field][hidden] { display: none; }
.hint.warn { background: var(--warn-bg); color: var(--text); padding: 6px 10px; border-radius: 6px; }
.shape-bar .bar-sep { width: 1px; align-self: stretch; margin: 2px 4px; background: var(--line); }
.obj-bar .bar-title { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 0.66rem; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; }
.pane-body canvas.ew { cursor: ew-resize; }
.pane-body canvas.ns { cursor: ns-resize; }
.pane-body canvas.nesw { cursor: nesw-resize; }

/* Grid-Planer: Teilen & Verbinden */
.split-list { display: flex; flex-direction: column; gap: 8px; margin: 6px 0; }
.split-item { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }
.split-name { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; font-weight: 600; }
.split-name .swatch { flex: none; }
.split-parts { margin-left: auto; font-weight: 500; color: var(--muted); font-size: 0.82rem; white-space: nowrap; }
.split-ctrl { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.split-ctrl select { width: auto; flex: none; padding: 3px 26px 3px 6px; font-size: 0.85rem; }
.split-ctrl .check { margin: 0; font-size: 0.85rem; }
.split-warn { display: flex; flex-direction: column; gap: 4px; }
.split-warn[hidden] { display: none; }
.cut-toggles { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 8px 0 2px; font-size: 0.88rem; }
.cut-toggles .check { margin: 0; }
.cut-swatch { display: inline-block; width: 16px; height: 0; margin-right: 6px; vertical-align: middle; border-top: 3px dashed; }
.cut-swatch.plate { border-color: #e5484d; }
.cut-swatch.bins { border-color: #2f6fdf; border-top-style: dotted; }
/* Filamentverbrauch unter der Zusammenfassung */
.filament { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 6px; font-size: 0.86rem; font-variant-numeric: tabular-nums; }
.filament .fil-val { color: var(--muted); }
.filament .fil-cost { color: var(--text); }
.filament button.fil-set { width: auto; flex: none; margin: 0 0 0 auto; padding: 1px 8px; height: auto; font-size: 0.78rem; font-weight: 500; background: transparent; color: var(--muted); border: 1px dashed var(--line); border-radius: 999px; }
.filament button.fil-set:hover { color: var(--text); border-color: var(--muted); filter: none; }
.bar-row { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; font-size: 0.85rem; color: var(--muted); }
.bar-row[hidden] { display: none; }

/* Hinweis: automatische Maße können abweichen (bewusst sichtbar, nicht im Info-Text) */
.measure-warn { margin: 8px 0 0; padding: 8px 10px; border-radius: 6px; background: var(--warn-bg);
  border-left: 4px solid #e0a100; font-size: 0.84rem; line-height: 1.4; color: var(--text); }
.measure-warn.small { margin: 6px 0 0; padding: 5px 8px; font-size: 0.8rem; }
.measure-warn[hidden] { display: none; }
.grid2.detect-row { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
/* Erkennung läuft: unten im Foto, damit die Objektleiste oben bedienbar bleibt; Text darf umbrechen */
.busy.detect-busy { top: auto; bottom: 12px; white-space: normal; max-width: calc(100% - 24px); width: max-content; border-radius: 14px; }
.busy-cancel { flex: none; width: 22px; height: 22px; padding: 0; margin: 0 0 0 2px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel); color: var(--muted); font-size: 0.75rem; line-height: 1; cursor: pointer; }
.busy-cancel:hover { color: #d4373d; border-color: #d4373d; filter: none; }
.detect-measure { margin-top: 8px; }
/* schmale Spalten: Knöpfe umbrechen statt abschneiden */
.pane-bar { flex-wrap: wrap; row-gap: 4px; }
.pane[data-pane=photo] .pane-bar { gap: 4px; }
.pane[data-pane=photo] { container-type: inline-size; }
@container (max-width: 400px) {
  .pane[data-pane=photo] .pane-bar h2 { display: none; }
  .pane[data-pane=photo] .pane-bar { padding-left: 8px; }
  .pane[data-pane=photo] .pane-bar button.icon { min-width: 28px; padding: 0 5px; }
}

/* Menüleisten über den Ansichten (zweite Zeile unter dem Titel) und ihre Aufklappmenüs */
.menu-bar { gap: 4px; padding: 4px 8px; background: color-mix(in srgb, var(--bg) 45%, var(--panel)); }
.menu-bar button.ghost { height: 28px; font-size: 0.82rem; }
.menu-bar button.ghost.icon { min-width: 28px; padding: 0 6px; justify-content: center; }
.menu-bar [hidden] { display: none !important; }
.menu-bar .bar-sep { width: 1px; align-self: stretch; margin: 2px 3px; background: var(--line); }
.menu-bar .bar-gap { flex: 1; }
.menu-bar .bar-field { display: inline-flex; align-items: center; gap: 4px; font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.menu-bar .bar-field input { width: 68px; height: 28px; padding: 2px 6px; }
.menu-bar .bar-field .label-head { gap: 2px; }
.menu-bar label.check { margin: 0 4px; font-size: 0.82rem; white-space: nowrap; }
.menu-bar .bar-label { font-size: 0.8rem; color: var(--muted); white-space: nowrap; margin-left: 2px; }
.menu-bar .bar-note { flex-basis: 100%; margin: 0 2px 1px; font-size: 0.78rem; }
.menu-bar .dd { display: inline-flex; }
.dd-btn::after { content: "▾"; font-size: 0.72em; margin-left: 2px; opacity: 0.8; }
.dd-panel { position: fixed; z-index: 40; width: max-content; min-width: 240px; max-width: min(380px, calc(100vw - 16px)); overflow-y: auto;
  padding: 10px 12px 12px; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0,0,0,.22); }
.dd-panel[hidden] { display: none; }
.dd-panel.wide { width: min(380px, calc(100vw - 16px)); }
.dd-panel .dd-title { margin: 0 0 6px; font-size: 0.9rem; }
.dd-panel .dd-sub { margin: 12px 0 2px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 0.82rem; color: var(--muted); }
.dd-panel .field-row:first-of-type { margin-top: 0; }
.dd-panel .dd-actions { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.dd-panel .dd-actions button.ghost { justify-content: flex-start; }
.dd-panel details.sub:first-child { margin-top: 0; }
.dd-panel .hint:last-child { margin-bottom: 0; }
.menu-bar button.ghost.add-photo { width: auto; margin: 0; }
.menu-bar .bar-field input#angle { width: 58px; }
.menu-bar > span[data-plate] { display: contents; }

/* Gridfinity Box: Maße an der gewählten Trennwand, über der 3D-Ansicht */
#views > .pane[data-pane=model]:only-of-type { flex: 1; }

/* Box: Textfelder je Beschriftungsleiste */
.label-list { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.label-list label { display: flex; flex-direction: column; gap: 2px; font-size: 0.85rem; color: var(--muted); }

/* Druckliste im Grid-Planer: nur das Fenster drucken */
.print-table td.nr, .print-table th.nr { text-align: right; white-space: nowrap; }
.print-table tfoot td { font-weight: 600; border-top: 2px solid var(--border, #ccc); }
.share-url { width: 100%; font-family: ui-monospace, monospace; font-size: 0.8rem; }
@media print {
  body:has(dialog.modal[open] .print-area) > *:not(dialog) { display: none !important; }
  dialog.modal:has(.print-area) { position: static; box-shadow: none; border: 0; max-width: none; width: 100%; max-height: none; overflow: visible; color: #000; background: #fff; }
  dialog.modal:has(.print-area)::backdrop { display: none; }
  .print-area .modal-actions, .print-area .modal-head button { display: none; }
  .print-area table { font-size: 10pt; }
}
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; min-height: 0; }
.i18n-wait body { visibility: hidden; }
.lang-toggle { min-width: 2.6em; font-weight: 600; }
label[data-holes][hidden] { display: none; }


/* ================================================================== Design 0.38
   Flat Design nach UI/UX Pro Max: klare Flächen ohne Schatten und Verläufe, Farbe statt Rahmen,
   kurze Übergänge (150–200 ms), sichtbarer Fokus, Orange nur für die Hauptaktion. Nur Darstellung. */
:root { --ease: cubic-bezier(.2, .7, .2, 1); }
::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a, button, select, summary, label.check, [role=tab] { cursor: pointer; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; } }

/* Kopfleiste der Werkzeuge */
body > header:not(.landing-head) { gap: 8px; padding: 10px 16px; margin-bottom: 4px; background: var(--panel); border-bottom: 1px solid var(--line); }
header h1 { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; }
.home { width: 34px; height: 34px; border: 0; border-radius: 10px; background: var(--panel-2); color: var(--text); }
.home:hover { background: var(--accent-soft); color: var(--accent); }
.ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ico-sm { width: 16px; height: 16px; }

/* Werkzeugwahl in der Kopfleiste (js/ui.js) */
.tool-switch { position: relative; }
.tool-menu { position: absolute; left: 0; top: calc(100% + 8px); z-index: 45; width: 330px; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--float); display: flex; flex-direction: column; gap: 2px; }
.tool-menu[hidden] { display: none; }
.tool-menu a { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; color: var(--text); text-decoration: none; transition: background .15s var(--ease); }
.tool-menu a:hover, .tool-menu a:focus-visible { background: var(--panel-2); outline: none; }
.tool-menu a[aria-current] { background: var(--accent-soft); }
.tool-menu .tm-ico { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.tool-menu .tm-text { display: flex; flex-direction: column; min-width: 0; }
.tool-menu .tm-text b { font-size: 0.92rem; font-weight: 650; }
.tool-menu .tm-text small { color: var(--muted); font-size: 0.8rem; }
.tool-menu .tm-group { margin: 4px 10px 2px; color: var(--muted); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.tool-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; width: auto; }

/* Knöpfe: Hauptaktion orange, sonst Petrol bzw. getönte Fläche */
button { border-radius: 10px; transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease); }
button:not(:disabled):hover { filter: brightness(1.07); }
.result button, dialog.modal .modal-actions button, .form > button { min-height: 40px; }
button.ghost, .button-like { height: 36px; min-height: 36px; border-radius: 10px; border: 1px solid transparent; background: var(--panel-2); color: var(--text); font-weight: 550; font-size: 0.87rem; gap: 6px; }
button.ghost:not(:disabled):hover, .button-like:hover { background: color-mix(in srgb, var(--text) 8%, var(--panel-2)); border-color: transparent; color: var(--text); }
button.ghost.active, .tools button.active, .layout-switch button.active { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
button.ghost:disabled { background: transparent; }
button.icon { min-width: 36px; }
button.secondary { background: var(--panel-2); border: 1px solid transparent; color: var(--text); }
button.secondary:not(:disabled):hover { background: color-mix(in srgb, var(--text) 8%, var(--panel-2)); border-color: transparent; }
button.cta, .download-row > button:first-child:not(.secondary) { background: var(--cta); color: var(--cta-text); min-height: 46px; font-size: 0.98rem; font-weight: 700; }
button.cta:not(:disabled):hover, .download-row > button:first-child:not(.secondary):not(:disabled):hover { background: color-mix(in srgb, var(--cta) 86%, var(--text)); }
.btn-group { gap: 2px; }
.btn-group > *, .btn-group > :first-child, .btn-group > :last-child { margin-left: 0 !important; border-radius: 10px !important; }
.menu-bar button.ghost, .shape-bar button.ghost { height: 32px; min-height: 32px; font-size: 0.84rem; }
.menu-bar button.ghost.icon { min-width: 32px; }
.lang-toggle { min-width: 40px; }

/* Flächen: keine Schatten, Abgrenzung über Tonstufen */
main { gap: 12px; padding: 8px 16px 16px; grid-template-columns: 370px 1fr; }
@media (max-width: 860px) { main { grid-template-columns: minmax(0, 1fr); padding: 8px 12px; } .pane-bar { flex-wrap: wrap; } }
.panel, .pane { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; }
.pane-bar { padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--line); }
.pane-bar h2 { font-size: 0.92rem; font-weight: 700; }
.menu-bar { background: var(--panel); padding: 6px 10px; }
.gutter::after { background: transparent; }
.gutter:hover::after, .gutter.dragging::after { background: var(--accent); }

/* Bedienhinweise unten in den Ansichten: erst beim Darüberfahren, schwebend über der Fläche */
.pane { position: relative; }
.pane-hint { position: absolute; left: 10px; bottom: 10px; z-index: 3; max-width: calc(100% - 20px); padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); font-size: 0.8rem; opacity: 0; transform: translateY(4px); transition: opacity .2s var(--ease), transform .2s var(--ease); pointer-events: none; }
.pane:hover .pane-hint, .pane:focus-within .pane-hint { opacity: 1; transform: none; }
@media (hover: none) { .pane-hint { display: none; } }

/* Eingabefelder */
input[type=number], input[type=text], input[type=password], select, .field input:not([type]), textarea {
  min-height: 38px; padding: 7px 11px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--panel-2); color: var(--text); font-size: 0.93rem; transition: border-color .15s var(--ease), background .15s var(--ease);
}
input[type=text] { font-weight: 550; }
input[type=number]:hover, input[type=text]:hover, select:hover { border-color: var(--line); }
input[type=number]:focus, input[type=text]:focus, input[type=password]:focus, select:focus, .field input:focus, textarea:focus {
  outline: none; border-color: var(--accent); background: var(--panel); box-shadow: 0 0 0 3px var(--accent-soft);
}
select { background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; padding-right: 30px; }
.grid2 { gap: 12px 10px; }
.grid2 label, .field-row, .project-name, .label-list label, .parts-select, .bar-row { font-size: 0.82rem; font-weight: 550; color: var(--muted); gap: 5px; }
.menu-bar .bar-field input { min-height: 32px; height: 32px; }
input[type=checkbox] { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid color-mix(in srgb, var(--muted) 60%, transparent); background: var(--panel); }
label.check, .grid2 label.check { font-size: 0.92rem; gap: 9px; color: var(--text); }
.info { width: 17px; height: 17px; min-width: 17px; flex-basis: 17px; border: 0; background: var(--panel-2); color: var(--muted); font: 700 11px/1 "Plus Jakarta Sans", system-ui, sans-serif; }

/* Umschalter: Pille, gewählte Möglichkeit als helle Fläche */
.segmented { gap: 2px; padding: 3px; border-radius: 12px; background: var(--panel-2); }
.segmented button, .segmented button:first-child, .segmented button:last-child { margin: 0; border: 0; border-radius: 9px; background: transparent; color: var(--muted); height: 34px; min-height: 34px; }
.segmented button:not(:disabled):hover { background: transparent; color: var(--text); }
.segmented button.active { background: var(--panel); color: var(--text); font-weight: 650; box-shadow: 0 0 0 1px var(--line); }

/* aufklappbare Abschnitte */
.controls-scroll { padding: 6px 18px 10px; }
details.sec { border-top: 1px solid var(--line); padding: 2px 0 14px; }
details.sec > summary { font-size: 0.98rem; font-weight: 700; padding: 13px 0 9px; }
details.sec > summary::after { content: ""; width: 8px; height: 8px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-2px, -2px); transition: transform .2s var(--ease); }
details.sec:not([open]) > summary::after { transform: rotate(-45deg); }
.num { width: 24px; height: 24px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 0.78rem; }
details.sub { border: 0; border-radius: var(--radius-sm); background: var(--panel-2); padding: 0 12px; }
details.sub > summary { color: var(--text); font-weight: 600; font-size: 0.88rem; padding: 9px 0; }
.hint { font-size: 0.84rem; line-height: 1.5; }
.hint.warn, .measure-warn, .summary .warn { border-radius: var(--radius-sm); }
.version, .template-table td small, .pal-meta, .mod-card .mod-meta { font-size: 0.78rem; }

/* Ergebnis: Zusammenfassung als ruhige Karte, darunter die Hauptaktion */
.result { padding: 12px 18px 12px; border-top: 1px solid var(--line); background: var(--panel); }
.summary { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--panel-2); font-size: 0.88rem; }
.summary strong { font-size: 1.02rem; }
.summary .warn { margin: 8px -4px 0; }
.download-row { gap: 8px; margin-top: 10px; }
.module-row { gap: 8px; }
.module-row button { min-height: 38px; font-size: 0.86rem; }

/* schwebende Elemente */
.dd-panel, .menu, .popup, .tooltip, .busy, .message { border-radius: var(--radius); box-shadow: var(--float); }
dialog.modal { border-radius: 16px; box-shadow: var(--float); }
dialog.modal::backdrop { background: rgba(2, 6, 23, .55); }
.card, .mod-card, .pal-item, .split-item { border-radius: var(--radius); box-shadow: none; }
/* Hinweise erst auf Klick: kurze Zeile, Rest aufklappbar */
details.tip { margin: 8px 0 4px; }
details.tip > summary, details.measure-warn > summary { list-style: none; display: flex; align-items: center; gap: 6px; font-size: 0.84rem; font-weight: 600; }
details.tip > summary { color: var(--accent); }
details.tip > summary::-webkit-details-marker, details.measure-warn > summary::-webkit-details-marker { display: none; }
details.tip > summary::after, details.measure-warn > summary::after { content: ""; width: 6px; height: 6px; margin-left: 2px; border: solid currentColor; border-width: 0 1.8px 1.8px 0; transform: rotate(45deg) translateY(-2px); transition: transform .2s var(--ease); }
details.tip[open] > summary::after, details.measure-warn[open] > summary::after { transform: rotate(-135deg) translate(-1px, -1px); }
details.tip > .hint { margin: 6px 0 0; }
details.measure-warn { border-left-width: 3px; }
details.measure-warn[open] > summary { margin-bottom: 4px; }

/* Symbole in Knöpfen und Links statt Emojis */
button > .ico, .button-like > .ico, summary > .ico { vertical-align: -0.2em; margin-right: 2px; }
button.icon > .ico { margin: 0; }
.module-row button { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-inline: 10px; }
/* Logo: drei gedruckte Schichten, die oberste wird gerade gedruckt */
.logo { display: inline-block; width: 26px; height: 26px; border-radius: 7px; background:
  linear-gradient(var(--cta), var(--cta)) 30% 24% / 52% 18% no-repeat,
  linear-gradient(var(--panel), var(--panel)) 0 34% / 100% 2px no-repeat,
  linear-gradient(var(--panel), var(--panel)) 0 66% / 100% 2px no-repeat, var(--accent); }
.home { background: transparent; }
.home .logo { width: 24px; height: 24px; }
.home:hover .logo { filter: brightness(1.1); }
/* Längere Hinweise: erster Satz sichtbar, der Rest auf Klick */
details.tip.more > summary { color: var(--muted); font-weight: 500; line-height: 1.45; display: block; cursor: pointer; }
details.tip.more > summary::after { display: inline-block; margin-left: 6px; color: var(--accent); vertical-align: 1px; }
details.tip.more > summary:hover { color: var(--text); }
details.tip.more > .hint { margin-top: 4px; }
details.tip[hidden] { display: none; }
b > .ico, strong > .ico, span > .ico { vertical-align: -0.2em; margin-right: 4px; }
.fil-ico { color: var(--accent); }
.fil-ico > .ico { margin: 0; }

/* Schubladenschrank */
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.grid3 label { display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; color: var(--muted); }
.segmented.compact { margin: 0; }
.segmented.compact button { min-height: 32px; padding: 0 10px; font-size: 0.84rem; }
.row-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.row-card { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); }
.row-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-head strong { font-size: 0.9rem; margin-right: auto; }
.row-head label.inline { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--muted); }
.row-head label.inline input { width: 64px; }
.row-count { display: inline-flex; align-items: center; gap: 4px; }
.row-n { min-width: 1.4em; text-align: center; font-weight: 700; }
.drawer-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; }
.drawer-card { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); transition: border-color .15s, box-shadow .15s; }
.drawer-card.sel { border-color: #e0a100; box-shadow: 0 0 0 1px #e0a100 inset; }
.drawer-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.drawer-title { font-weight: 700; color: var(--text); white-space: nowrap; text-decoration: none; }
.drawer-info { font-size: 0.78rem; color: var(--muted); }
.grid2.compact { gap: 6px 8px; }
.grid2.compact label, .grid3.compact label { font-size: 0.78rem; }
.grid3.compact { gap: 6px; }
.drawer-card select, .drawer-card input { padding: 7px 8px; font-size: 0.85rem; min-width: 0; }
.row-card input, .row-card select { background: var(--panel); }
.drawer-card input, .drawer-card select { background: var(--panel-2); }
.sec .sub-title { font-size: 0.82rem; font-weight: 700; color: var(--muted); margin: 14px 0 6px; }
.drawer-card label.check.compact { font-size: 0.85rem; gap: 8px; }

/* Formeinsatz: Teil aus der Bibliothek einfügen */
dialog.modal .lib-pick { gap: 10px; max-height: calc(100dvh - 80px); }
dialog.modal:has(.lib-pick) { overflow: hidden; width: min(760px, calc(100vw - 32px)); }
.lib-pick input[type=search] { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); width: 100%; }
.lib-list { flex: 1 1 auto; min-height: 140px; max-height: 420px; overflow: auto; display: flex; flex-direction: column; gap: 12px; padding-right: 2px; }
.lib-group h3 { margin: 0 0 6px; color: var(--muted); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.lib-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; }
.lib-item { display: flex; align-items: center; gap: 10px; min-height: 52px; margin: 0; padding: 6px 8px; text-align: left; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); color: var(--text); font-weight: 400; }
.lib-item:hover { border-color: var(--accent); background: var(--panel); }
.lib-item.sel { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.lib-item[hidden], .lib-group[hidden] { display: none; }
.lib-art { flex: none; width: 46px; height: 36px; }
.lib-art svg { width: 100%; height: 100%; }
.lib-art .art-binbody { fill: color-mix(in srgb, var(--accent) 22%, var(--panel)); stroke: var(--accent); stroke-width: 1.2; }
.lib-art .art-gridline { stroke: var(--accent); stroke-width: 0.6; stroke-dasharray: 3 2; opacity: .5; }
.lib-art .art-hole { fill: var(--canvas); stroke: var(--accent); stroke-width: 0.9; }
.lib-text { display: flex; flex-direction: column; min-width: 0; }
.lib-text b { font-size: 0.88rem; font-weight: 650; }
.lib-text small { color: var(--muted); font-size: 0.76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-opts { padding: 10px 12px; border-radius: 10px; background: var(--panel-2); }
.lib-opts[hidden] { display: none; }
.lib-opts .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.lib-opts .grid2 > label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); }
.lib-opts .grid2 > label[hidden] { display: none; }
.lib-opts .hint { margin: 8px 0 0; }
.lib-opts label.check { margin-top: 6px; }
.lib-opts label.check[hidden] { display: none; }
@media (max-width: 600px), (max-height: 700px) {
  dialog.modal:has(.lib-pick) { overflow: auto; }
  dialog.modal .lib-pick { max-height: none; }
  .lib-list { flex: none; max-height: 45vh; }
}
@media (max-width: 600px) { .lib-opts .grid2 { grid-template-columns: 1fr; } .lib-items { grid-template-columns: 1fr; } }
.lib-opts input:not([type=checkbox]), .lib-opts select { background: var(--panel); }

/* Beschriftung (Formeinsatz) */
.text-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.text-list:empty { display: none; }
.text-row { display: grid; grid-template-columns: minmax(0, 1fr) 64px 72px 36px; gap: 6px; align-items: center; padding: 4px; border-radius: 10px; border: 1px solid transparent; }
.text-row.sel { border-color: var(--cta); background: color-mix(in srgb, var(--cta) 8%, transparent); }
.text-row input, .text-row select { min-width: 0; width: 100%; }
.text-row button { margin: 0; }
.text-opts { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.text-opts .check { margin-top: 8px; }

/* ===================================================================================================
   Werkstatt 0.47: Komponenten-Schicht über allem davor. Grafit auf Werkstattpapier, präzise Kanten,
   Maße in Monospace, Signalgelb nur für die Hauptaktion. Klassennamen bleiben, nur das Aussehen ändert sich.
   =================================================================================================== */
body { font-feature-settings: "ss01", "cv11"; letter-spacing: -0.003em; }
.mono, input[type=number], .summary, .version, .fil-val, .fil-cost, kbd, .num, .badge, .stat b { font-family: var(--mono); font-variant-numeric: tabular-nums; }
input[type=number] { font-size: 0.9rem; letter-spacing: -0.01em; }
::selection { background: color-mix(in srgb, var(--cta) 55%, transparent); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Logo: Gridfinity-Feld (2 × 2) mit gelbem Behälter, wie von oben gesehen */
.logo { position: relative; width: 28px; height: 28px; border-radius: 6px; background:
  linear-gradient(var(--cta), var(--cta)) 3px 3px / 10px 22px no-repeat,
  linear-gradient(var(--bg), var(--bg)) 15px 3px / 10px 10px no-repeat,
  linear-gradient(var(--bg), var(--bg)) 15px 15px / 10px 10px no-repeat, var(--text); }
.home .logo { width: 26px; height: 26px; background-size: 9px 20px, 9px 9px, 9px 9px; background-position: 3px 3px, 14px 3px, 14px 14px; }

/* Kopfleiste der Werkzeuge: schmale Werkbank-Leiste */
body > header:not(.landing-head) { min-height: 54px; padding: 8px 14px; margin-bottom: 0; border-bottom: 1px solid var(--line); background: var(--panel); }
header h1 { font-size: 1rem; font-weight: 750; letter-spacing: -0.015em; }
.home { width: 36px; height: 36px; border-radius: var(--radius); background: transparent; }
.home:hover { background: var(--panel-2); }

/* Knöpfe */
button { border-radius: var(--radius-sm); font-weight: 650; letter-spacing: -0.005em; }
button:not(:disabled):active { transform: translateY(1px); }
button.ghost, .button-like { border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel); font-weight: 600; }
button.ghost:not(:disabled):hover, .button-like:hover { background: var(--panel-2); border-color: color-mix(in srgb, var(--text) 22%, var(--line)); }
button.ghost.active, .tools button.active, .layout-switch button.active { background: var(--text); color: var(--bg); border-color: var(--text); }
button.secondary { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius-sm); }
button.secondary:not(:disabled):hover { background: var(--panel-2); border-color: color-mix(in srgb, var(--text) 22%, var(--line)); }
button.primary, .form > button.primary { background: var(--text); color: var(--bg); }
button.primary.danger, button.danger { background: #c4321f; color: #fff; }
button.cta, .download-row > button:first-child:not(.secondary) {
  border-radius: var(--radius-sm); border: 1.5px solid var(--text); box-shadow: 3px 3px 0 var(--text);
  transition: transform .12s var(--ease), box-shadow .12s var(--ease), background .12s; }
button.cta:not(:disabled):hover, .download-row > button:first-child:not(.secondary):not(:disabled):hover {
  background: var(--cta); filter: none; transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--text); }
button.cta:not(:disabled):active, .download-row > button:first-child:not(.secondary):not(:disabled):active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--text); }
button.cta:disabled, .download-row > button:first-child:not(.secondary):disabled { box-shadow: none; border-color: transparent; }
.btn-group > *, .btn-group > :first-child, .btn-group > :last-child { border-radius: var(--radius-sm) !important; }

/* Eingaben: klare Kante statt getönter Fläche */
input[type=number], input[type=text], input[type=password], input[type=search], select, .field input:not([type]), textarea {
  border: 1px solid var(--line); border-radius: var(--radius-sm); background-color: var(--panel); }
input[type=number]:hover, input[type=text]:hover, input[type=search]:hover, select:hover { border-color: color-mix(in srgb, var(--text) 25%, var(--line)); }
input[type=number]:focus, input[type=text]:focus, input[type=password]:focus, input[type=search]:focus, select:focus, .field input:focus, textarea:focus {
  border-color: var(--accent); background-color: var(--panel); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=checkbox] { border-radius: 4px; }

/* Flächen */
main { gap: 10px; padding: 10px 12px 12px; }
.panel, .pane { border-radius: var(--radius); background: var(--panel); }
.pane-bar h2 { font-size: 0.74rem; font-weight: 750; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.gutter:hover::after, .gutter.dragging::after { background: var(--cta); }

/* Abschnitte im Seitenpanel: nummerierte Arbeitsschritte */
details.sec { border-top: 1px dashed var(--line); }
details.sec > summary { font-weight: 750; letter-spacing: -0.01em; }
.num { width: 22px; height: 22px; border-radius: 4px; background: var(--text); color: var(--bg); font-size: 0.74rem; font-weight: 700; }
details.sec[open] > summary .num { background: var(--cta); color: var(--cta-text); }

/* Segmente */
.segmented { gap: 0; padding: 2px; border-radius: var(--radius-sm); background: var(--panel-2); border: 1px solid var(--line); }
.segmented button, .segmented button:first-child, .segmented button:last-child { border-radius: 3px; border: 0; background: transparent; }
.segmented button.active { background: var(--panel); color: var(--text); border: 0; box-shadow: 0 0 0 1px var(--line); }

/* Zusammenfassung unten im Panel: wie ein Messprotokoll */
.result { background: var(--panel); border-top: 1px solid var(--line); }
.summary { font-size: 0.82rem; line-height: 1.55; }
.summary strong { font-family: "Plus Jakarta Sans", system-ui, sans-serif; font-weight: 750; letter-spacing: -0.01em; }
.summary .warn { border-left: 3px solid var(--cta); border-radius: 3px; font-family: "Plus Jakarta Sans", system-ui, sans-serif; }

/* Menüs und Dialoge */
.tool-menu, .menu, .ctx-menu { border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--float); }
.tool-menu a { border-radius: var(--radius-sm); }
.tool-menu a[aria-current] { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--cta); }
.tool-menu .tm-ico, .tool-links .tm-ico { border-radius: var(--radius-sm); background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.tool-menu .tm-group { font-family: var(--mono); font-weight: 600; letter-spacing: 0.04em; }
dialog.modal { border-radius: 10px; border: 1px solid var(--line); box-shadow: var(--float); padding: 18px 20px 20px; }
dialog.modal::backdrop { background: rgba(17, 18, 20, .45); backdrop-filter: blur(3px); }
.modal-head h2 { font-size: 1.05rem; font-weight: 750; letter-spacing: -0.015em; }
.card { border-radius: var(--radius); }
.badge { border-radius: 3px; padding: 1px 6px; font-weight: 600; letter-spacing: 0.01em; background: var(--panel-2); border-color: var(--line); }
kbd { display: inline-block; min-width: 1.6em; text-align: center; padding: 1px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--panel); color: var(--text); font-size: 0.74rem; line-height: 1.4; }

/* Schmale Scrollbalken */
* { scrollbar-width: thin; scrollbar-color: var(--thumb) transparent; }

/* ---------------------------------------------------------------- Befehlspalette (js/cmdk.js) */
.cmdk-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; min-width: 210px; margin: 0; padding: 0 6px 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel-2); color: var(--muted); font: 500 0.86rem "Plus Jakarta Sans", system-ui, sans-serif; cursor: pointer; }
.cmdk-btn:not(:disabled):hover { color: var(--text); border-color: color-mix(in srgb, var(--text) 25%, var(--line)); filter: none; background: var(--panel-2); }
.cmdk-btn .cmdk-btn-label { flex: 1; text-align: left; }
.cmdk-btn kbd { font-size: 0.7rem; }
body > header:not(.landing-head) .cmdk-btn { min-width: 0; }
@media (max-width: 1280px) { body > header:not(.landing-head) .cmdk-btn .cmdk-btn-label, body > header:not(.landing-head) .cmdk-btn kbd { display: none; } body > header:not(.landing-head) .cmdk-btn { width: 36px; justify-content: center; padding: 0; } }
@media (max-width: 760px) { .cmdk-btn { min-width: 0; width: 36px; justify-content: center; padding: 0; } .cmdk-btn .cmdk-btn-label, .cmdk-btn kbd { display: none; } }

dialog.cmdk { width: min(640px, calc(100vw - 24px)); max-height: min(560px, calc(100vh - 80px)); margin: 10vh auto auto; padding: 0; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); color: var(--text); box-shadow: var(--float); overflow: hidden; }
dialog.cmdk[open] { display: flex; flex-direction: column; animation: cmdk-in .16s var(--ease); }
dialog.cmdk::backdrop { background: rgba(17, 18, 20, .45); backdrop-filter: blur(3px); }
@keyframes cmdk-in { from { opacity: 0; transform: translateY(-6px) scale(.985); } }
.cmdk-search { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.cmdk-search .ico { color: var(--muted); }
.cmdk-search input { flex: 1; min-height: 34px; padding: 0; border: 0 !important; background: transparent !important; box-shadow: none !important; font: 500 1.02rem "Plus Jakarta Sans", system-ui, sans-serif; color: var(--text); outline: none; }
.cmdk-list { flex: 1; overflow-y: auto; padding: 6px; }
.cmdk-group { margin: 8px 10px 4px; color: var(--muted); font: 600 0.7rem var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }
.cmdk-item { display: flex; align-items: center; gap: 12px; width: 100%; margin: 0; padding: 8px 10px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); text-align: left; font-weight: 500; cursor: pointer; }
.cmdk-item:not(:disabled):hover { filter: none; }
.cmdk-item[aria-selected=true] { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--cta); }
.cmdk-ico { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel); color: var(--text); overflow: hidden; }
.cmdk-ico svg.thumb { width: 30px; height: 30px; }
.cmdk-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cmdk-text b { font-size: 0.92rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-text small { color: var(--muted); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-kind { flex: none; color: var(--muted); font: 500 0.72rem var(--mono); }
.cmdk-empty { padding: 28px 16px; color: var(--muted); text-align: center; }
.cmdk-foot { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 8px 16px; border-top: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font-size: 0.76rem; }
.cmdk-foot span { display: inline-flex; align-items: center; gap: 5px; }

/* Tastenkürzel-Übersicht */
.keys-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 28px; }
.keys-grid h3 { grid-column: 1 / -1; margin: 14px 0 4px; color: var(--muted); font: 600 0.72rem var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }
.keys-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 0.88rem; }
.keys-row span:last-child { display: flex; gap: 3px; flex: none; }

/* Kurze Rückmeldung unten (js/cmdk.js toast) */
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 100; transform: translateX(-50%); padding: 10px 16px; border-radius: var(--radius-sm); background: var(--text); color: var(--bg); font-size: 0.88rem; font-weight: 600; box-shadow: var(--float); animation: cmdk-in .18s var(--ease); }

/* Desktop-App: Hinweise nur fürs Web ausblenden */
[data-desktop] [data-web-only] { display: none !important; }
