:root {
  --bg: #f3f7fb;
  --surface: #ffffff;
  --surface-2: #e9f1f9;
  --text: #14283a;
  --muted: #5b6f84;
  --border: #d5e1ee;
  --primary: #1871b8;
  --primary-dark: #125a93;
  --primary-soft: #e3effa;
  --accent: #66a6df;
  --primary-text: #ffffff;
  --ok: #2f855a;
  --warn: #b7791f;
  --danger: #c53030;
  --yellow: #b8860b;                    /* Füllstand unter 10 % */
  --yellow-soft: rgba(234, 179, 8, .16);
  --red-lvl: #c53030;                   /* Füllstand unter 3 % */
  --red-soft: rgba(197, 48, 48, .14);
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 40, 58, .06), 0 4px 14px rgba(20, 40, 58, .06);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;             /* eingebaute Bedienelemente (z. B. Auswahllisten in Firefox) im dunklen Modus dunkel */
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1a26;
    --surface: #182636;
    --surface-2: #1f3044;
    --text: #e6eef7;
    --muted: #9db0c4;
    --border: #2b3f55;
    --primary: #4da3e8;
    --primary-dark: #2f86cc;
    --primary-soft: #1d3a55;
    --accent: #7fbcec;
    --primary-text: #08192a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
    --yellow: #facc15;
    --yellow-soft: rgba(250, 204, 21, .14);
    --red-lvl: #f87171;
    --red-soft: rgba(248, 113, 113, .16);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding-bottom: calc(64px + var(--safe-bottom));
}
a { color: var(--primary); text-decoration: none; }
h1 { font-size: 1.5rem; margin: 0 0 .35rem; }
h2 { font-size: 1.05rem; margin: 1.25rem 0 .5rem; display: flex; align-items: center; gap: .5rem; }
h3 { font-size: 1rem; margin: .8rem 0 .4rem; }
.count { font-size: .8rem; background: var(--surface-2); color: var(--muted); border-radius: 999px; padding: 0 .55rem; font-weight: 500; }
.muted { color: var(--muted); font-size: .9rem; }
.small { font-size: .82rem; }
.error { color: var(--danger); }
.ok { color: var(--ok); }
code { font-size: .85em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; word-break: break-all; }
pre { background: var(--surface-2); padding: .6rem .8rem; border-radius: 8px; overflow: auto; font-size: .85rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ---------- Kopfzeile und Navigation */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 1rem;
  padding: .5rem 1rem; padding-top: calc(.5rem + env(safe-area-inset-top, 0px));
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .55rem; color: var(--text); font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.brand-icon { width: 34px; height: 34px; border-radius: 9px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text small { font-size: .62rem; letter-spacing: .18em; color: var(--accent); font-weight: 600; }
/* Reiter schrumpfen bei mittlerer Breite; passt es dann noch nicht, scrollt nur die Leiste (nicht die ganze Seite) */
.topnav { display: none; gap: .15rem; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a { padding: .45rem .8rem; border-radius: 8px; color: var(--muted); font-weight: 500; white-space: nowrap; flex: 0 0 auto; }
.topnav a.active { background: var(--primary-soft); color: var(--primary); }
.topnav a:hover { color: var(--primary); }
.userbox { margin-left: auto; display: flex; align-items: center; gap: .5rem; font-size: .88rem; color: var(--muted); white-space: nowrap; }
.userbox .role { font-size: .72rem; background: var(--surface-2); padding: .1rem .45rem; border-radius: 999px; }
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5;
  display: flex; background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
}
.tabbar a { flex: 1; text-align: center; padding: .55rem 0 .5rem; font-size: .72rem; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: .1rem; }
.tabbar a .ic { font-size: 1.25rem; line-height: 1; font-style: normal; }
.tabbar a.active { color: var(--primary); font-weight: 600; }
.tabbar:empty { display: none; }

main { max-width: 760px; margin: 0 auto; padding: 1rem; }
main.wide { max-width: 2200px; }
/* Listen (Objekte, Material) nutzen die ganze Fensterbreite, damit auch viele Spalten ohne Scrollen passen */
main.wide.full { max-width: none; }
/* Formulare und Detailseiten nicht endlos breit ziehen, Listen und Tabellen nutzen die ganze Breite */
main.wide form.box, main.wide .auth { max-width: 1000px; }
.table-wrap { overflow-x: auto; }

/* ---------- Bausteine */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .55rem 1rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: .95rem; cursor: pointer;
  text-align: center; line-height: 1.2;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.small { padding: .32rem .7rem; font-size: .84rem; border-radius: 8px; }
.btn.big { padding: .7rem 1.3rem; font-size: 1.02rem; }
/* iPad/Tablet (Touch, ab Tablet-Breite): auf den Bauteilseiten größere Knöpfe mit mehr Abstand – mind. 44 px hoch */
@media (pointer: coarse) and (min-width: 641px) {
  body.objpage .btn { min-height: 44px; }
  body.objpage .btn.small { padding: .55rem 1rem; font-size: .98rem; border-radius: 10px; min-width: 44px; }
  body.objpage .row, body.objpage .row.tight, body.objpage .pbtns, body.objpage .acts { gap: .6rem; }
  body.objpage .linkbtn { padding: .45rem .5rem; font-size: 1rem; }
  body.objpage .pctable input.pcs { min-height: 40px; }
}
.btn:disabled { opacity: .55; cursor: default; }
/* Datei-Auswahl als Knopf: das echte <input type=file> bleibt im Dokument (nicht display:none), damit iOS-Safari
   die Fotothek/Kamera öffnet; es ist nur unsichtbar. */
.btn.filepick { position: relative; overflow: hidden; }
.btn.filepick input[type=file] { position: absolute; left: 0; top: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 100px; }
.kv .wrap { word-break: break-all; font-size: .85rem; font-weight: 500; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; align-items: center; }
.row.tight { margin-top: .35rem; }
.modelbar { margin-bottom: .7rem; }
/* Autodesk Fusion: Einrichtungsschritte, Zeichnungen auf der Detailseite */
.fusteps { margin: .3rem 0 .6rem 1.2rem; padding: 0; }
.fusteps li { margin: .25rem 0; }
.fusteps code { overflow-wrap: anywhere; }
.fudrawings { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }     /* Material „Rollen von …“: Abstand zur Tabelle darunter */
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .75rem; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.row2 > label, .row3 > label { min-width: 0; }
.box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin: .75rem 0; box-shadow: var(--shadow); }
.box h2 { margin-top: 0; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { padding: .3rem .75rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: inherit; font-size: .84rem; cursor: pointer; }
.chip.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.chips.seg { gap: 0; }
.chips.seg .chip { border-radius: 0; margin-right: -1px; }
.chips.seg .chip:first-child { border-radius: 999px 0 0 999px; }
.chips.seg .chip:last-child { border-radius: 0 999px 999px 0; }
.chips.seg .chip.on { position: relative; z-index: 1; }
.badge { display: inline-block; font-size: .72rem; padding: .12rem .5rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.blue { background: var(--primary-soft); color: var(--primary); }
.badge.green { background: #dff5e8; color: var(--ok); }
.badge.orange { background: #fdf0d8; color: var(--warn); }
.badge.red { background: #fde1e1; color: var(--danger); }
.badge.purple { background: #ece3f8; color: #6b3fa0; }
.badge.teal { background: #d7f3f0; color: #0f766e; }
@media (prefers-color-scheme: dark) {
  .badge.green { background: #1c3b2c; } .badge.orange { background: #3d2f14; } .badge.red { background: #43201f; }
  .badge.purple { background: #34264d; color: #c9abf0; } .badge.teal { background: #143a38; color: #7dd3cc; }
}
/* Druckerkarten: farbige Kante passend zum Status */
.machine.st-green { border-left: 4px solid var(--ok); }
.machine.st-blue { border-left: 4px solid var(--primary); }
.machine.st-orange { border-left: 4px solid var(--warn); }
.machine.st-red { border-left: 4px solid var(--danger); }
.machine.st-purple { border-left: 4px solid #8b5cf6; }
.machine.st-teal { border-left: 4px solid #14b8a6; }

/* ---------- Formulare */
.form label { display: flex; flex-direction: column; gap: .25rem; font-size: .86rem; color: var(--muted); margin: .55rem 0; }
.form label > span.hint { font-size: .75rem; }
.form input, .form select, .form textarea {
  padding: .55rem .65rem; font: inherit; font-size: 16px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); width: 100%; min-width: 0;
}
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.form textarea { min-height: 96px; resize: vertical; }
/* iOS-Safari (iPad/iPhone): Datums- und Auswahlfelder haben eine feste Eigenbreite und zentrierten Text;
   beides abschalten, sonst laufen „Kaufdatum“ und „Angebrochen am“ aus dem Raster. */
.form input[type=date], .form select {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; max-width: 100%; min-width: 0;
  min-height: 2.7rem; text-align: left;
}
.form input[type=date]::-webkit-date-and-time-value { text-align: left; }
.form select { padding-right: 1.8rem; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.form .unit input[type=date] { width: auto; flex: 1; }
.form label.inline { display: inline-flex; flex-direction: row; align-items: center; gap: .45rem; margin: .4rem 1rem .4rem 0; color: var(--text); font-size: .95rem; }
.form label.inline input { width: auto; }
.form .unit { display: flex; align-items: center; gap: .4rem; }
.form .unit input { flex: 1; }
.form .unit span { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 .9rem; }
.form-grid label.wide { grid-column: 1 / -1; }
.cost-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; margin-top: .5rem; }
.cost-preview div { background: var(--surface-2); border-radius: 8px; padding: .5rem .65rem; font-size: .85rem; color: var(--muted); }
.cost-preview strong { display: block; color: var(--text); font-size: 1.05rem; }

/* ---------- Anmeldung */
.auth { max-width: 420px; margin: 2rem auto; }
.auth .logo { display: block; width: 100%; max-width: 340px; margin: 0 auto 1.5rem; }
.auth .box { padding: 1.4rem; }
.auth .links { margin-top: 1rem; text-align: center; font-size: .9rem; }

/* ---------- Übersicht */
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0 .75rem; }
.toolbar input[type=search] { flex: 1 1 220px; min-width: 0; padding: .55rem .7rem; font: inherit; font-size: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); }
/* Suchfeld mit eigenem ×-Knopf (Firefox zeigt keinen), der native WebKit-Knopf wird ausgeblendet */
.searchwrap { position: relative; flex: 1 1 220px; min-width: 0; display: flex; }
.searchwrap input[type=search] { width: 100%; padding-right: 2.4rem; -webkit-appearance: none; appearance: none; }
.searchwrap input[type=search]::-webkit-search-cancel-button, .searchwrap input[type=search]::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.searchwrap .clear { position: absolute; right: .3rem; top: 50%; transform: translateY(-50%); width: 1.9rem; height: 1.9rem; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font: inherit; font-size: 1.35rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.searchwrap .clear:hover { background: var(--surface-2); color: var(--text); }
.toolbar select { padding: .5rem .6rem; font: inherit; font-size: .92rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); max-width: 100%; }
.summary { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin: .25rem 0 .5rem; }

.cards { display: grid; gap: .6rem; }
.card { display: grid; grid-template-columns: 64px 1fr auto; gap: .7rem; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem .75rem; box-shadow: var(--shadow); color: var(--text); }
.card.selected { border-color: var(--primary); background: var(--primary-soft); }
.card .thumb, .table .thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--accent); font-size: 1.4rem; }
.table .thumb { width: 44px; height: 44px; }
.card .num { font-size: .78rem; color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; }
.card .name { font-weight: 600; line-height: 1.25; }
.card .meta { font-size: .82rem; color: var(--muted); margin-top: .15rem; }
.card .side { text-align: right; font-size: .85rem; color: var(--muted); }
.card .side strong { display: block; color: var(--text); font-size: 1rem; }
.card input[type=checkbox] { width: 20px; height: 20px; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: .5rem .6rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { position: sticky; top: 0; background: var(--surface-2); font-weight: 600; font-size: .8rem; color: var(--muted); white-space: nowrap; cursor: pointer; user-select: none; }
.table th.sorted { color: var(--primary); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--primary-soft); }
.table tbody tr.selected { background: var(--primary-soft); }
.table td.num, .table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table td.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; white-space: nowrap; }
.table td.name { font-weight: 600; min-width: 180px; }
.table td.rest { min-width: 110px; }
.table td.serials { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .82rem; white-space: normal; min-width: 170px; max-width: 280px; }
.table td.wrap { white-space: normal; min-width: 160px; font-size: .85rem; color: var(--muted); }
.form label.mixed input, .form label.mixed select, .form label.mixed textarea { border-style: dashed; }
.form fieldset.files { border: 1px solid var(--border); border-radius: 10px; padding: .4rem .8rem .7rem; margin: .55rem 0; min-width: 0; }
.form fieldset.files legend { font-size: .86rem; color: var(--muted); padding: 0 .3rem; }
.form fieldset.files ul.list:empty { display: none; }
.form fieldset.files ul.list { margin: 0 0 .5rem; }
ul.list.files li .grow { flex: 1; min-width: 0; }
ul.list.files li input[data-fsel] { width: 18px; height: 18px; margin-right: .6rem; flex: none; }
ul.list.files li .filedesc-text { display: block; margin-top: .1rem; }
ul.list.files li input.filedesc { display: block; width: 100%; margin-top: .3rem; font-size: .85rem; padding: .3rem .5rem; }
.linkbtn { background: none; border: 0; color: var(--primary); cursor: pointer; font-size: .95rem; padding: 0 .2rem; }
/* Drucker-Übersicht */
.machines { display: flex; flex-wrap: wrap; gap: .75rem; --cols: 1; }
.machine { flex: 1 1 calc((100% - (var(--cols) - 1) * .75rem) / var(--cols) - 1px); min-width: 0; container-type: inline-size; }
.msize { margin-left: auto; }
.msize .chip { padding: .15rem .6rem; font-size: .78rem; }
.machine { margin: 0; }
.machine.offline { opacity: .8; }
.machine-head { display: flex; justify-content: space-between; gap: .5rem; align-items: flex-start; }
.machine-head h2 { margin: 0 0 .15rem; }
.machine-head p { margin: 0; }
.machine-body { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: .8rem; align-items: start; margin-top: .6rem; }
.machine-body > .mbox, .machine-body > .mkv { grid-column: 1 / -1; }
.machine-body > .mbox { margin-top: 0; }
.machine .only-md, .machine .only-lg, .machine .mcam { display: none; }
.machine .only-md-i { display: none; }
.mcam { padding: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #000; cursor: pointer; position: relative; align-self: start; font: inherit; }
.mcam img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.mcam img.nocam, .mcam img:not([src]) { opacity: .25; }
.mcam span { position: absolute; left: .45rem; bottom: .3rem; font-size: .72rem; color: #fff; text-shadow: 0 0 4px #000, 0 0 2px #000; }
@container (min-width: 380px) {
  .machine .only-md { display: block; }
  .machine .only-md-i { display: inline; }
  .machine .mcam { display: block; grid-column: 1 / -1; }
  .machine .mcam img { aspect-ratio: auto; height: 150px; }
}
@container (min-width: 660px) {
  .machine .only-lg { display: block; }
  .machine .mkv.only-lg { display: grid; }
  /* zwei Zeilen: oben Symbol, Status/letzter Druck und Kamera; unten Kennzahlen (unter dem Symbol) und daneben die Box */
  .machine-body { grid-template-columns: 120px minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "thumb info info" "stats stats stats"; }
  .machine-body.has-box { grid-template-areas: "thumb info info" "stats stats box"; }
  .machine-body.has-box.no-stats { grid-template-areas: "thumb info info" "box box box"; }
  .machine-body.has-cam { grid-template-columns: 120px minmax(0, 1fr) clamp(260px, 38%, 560px); grid-template-areas: "thumb info cam" "stats stats stats"; }
  /* mit Kamera: Kamera rechts über zwei Zeilen, die Box darunter über die ganze Breite (vier Slots nebeneinander) */
  .machine-body.has-cam.has-box { grid-template-areas: "thumb info cam" "stats stats cam" "box box box"; }
  .machine-body.has-cam.has-box.no-stats { grid-template-areas: "thumb info cam" "box box box"; }
  .machine-body > .mthumb { grid-area: thumb; width: 120px; height: 120px; }
  .machine-body > .minfo { grid-area: info; }
  .machine-body > .mcam { grid-area: cam; }
  .machine-body > .mkv { grid-area: stats; align-self: start; }
  .machine-body > .mbox { grid-area: box; }
  .machine .mcam img { aspect-ratio: 4 / 3; height: auto; }
}
.mthumb { width: 96px; height: 96px; object-fit: contain; border-radius: 8px; background: var(--surface-2); }
.mthumb.empty { display: flex; align-items: center; justify-content: center; font-size: 2rem; color: var(--accent); }
.mfile { font-weight: 600; overflow-wrap: anywhere; margin-bottom: .3rem; }
.minfo > * + * { margin-top: .45rem; }
.mmsg { color: var(--muted); font-style: italic; overflow-wrap: anywhere; }
.mlast .k, .mkv .k { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.mlast .v { overflow-wrap: anywhere; }
.mkv { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: .35rem .6rem; padding: .45rem .6rem; border-radius: 10px; background: var(--surface-2); }
.mkv b { font-size: .95rem; white-space: nowrap; }
.mtemps { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .9rem; margin-top: .35rem; }
.machine.busy .progress.big i { background: var(--ok); }
.machine-foot { margin-top: .6rem; }
.camimg { display: block; width: 100%; max-height: 70vh; object-fit: contain; border-radius: 8px; background: #000; }
.modal.cam { max-width: 900px; width: calc(100vw - 2rem); }
.tile > span { display: block; }
.cols-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 .8rem; }
.cols-grid label.inline { margin: .3rem 0; }
.table td .sub { display: block; font-weight: 400; font-size: .8rem; color: var(--muted); }
.table input[type=checkbox] { width: 18px; height: 18px; }
.table.compact th, .table.compact td { padding: .4rem .5rem; }
.table.print { font-size: .85rem; }

/* ---------- Detail */
.detail-head { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.detail-head .img { width: 180px; height: 180px; border-radius: var(--radius); object-fit: cover; background: var(--surface-2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--accent); font-size: 2.5rem; cursor: pointer; }
.detail-head .img img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius); }
.detail-head .img { position: relative; }
.detail-head .img .imgauto { position: absolute; right: 6px; bottom: 6px; font-size: .7rem; line-height: 1.4; padding: 0 .45rem; border-radius: 6px; background: rgba(10, 25, 40, .6); color: #fff; pointer-events: none; }
.cadmark { font-size: .85em; margin-left: .15rem; cursor: help; }
.detail-head .titles { flex: 1; min-width: 240px; }
.detail-head .number { font-family: ui-monospace, Menlo, Consolas, monospace; color: var(--muted); font-size: .95rem; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .5rem .9rem; }
.kv div { padding: .45rem .6rem; background: var(--surface-2); border-radius: 8px; }
.kv div span { display: block; font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kv div strong { font-weight: 600; font-size: 1rem; }
.kv div.hl { background: var(--primary-soft); }
.notes { white-space: pre-wrap; background: var(--surface-2); padding: .7rem .8rem; border-radius: 8px; }
.progress { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin-top: .3rem; }
.progress i { display: block; height: 100%; background: var(--ok); border-radius: 4px; }
.progress i.low { background: var(--danger); }
.progress.big { height: 12px; max-width: 360px; }
.progress.big .progress { margin: 0; height: 12px; }
.swatch { background: linear-gradient(135deg, var(--sw, var(--surface-2)) 0 55%, var(--surface-2) 55%) !important; }
.swatch-dot { display: inline-block; width: 22px; height: 22px; border-radius: 50%; background: var(--sw, transparent); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); margin-right: .5rem; vertical-align: -6px; }
/* Farbpunkt und Farbname bleiben in Tabellen immer auf einer Zeile */
.swatch-dot.big { width: 44px; height: 44px; vertical-align: middle; margin-right: 0; }
.form .unit input[type=color], .modal input[type=color] { flex: none; width: 3rem; height: 2.3rem; padding: .15rem; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.spoolfit { display: inline-flex; align-items: center; flex-wrap: wrap; gap: .35rem; padding: .25rem .3rem .25rem .6rem; border: 1px solid var(--accent); border-radius: 999px; font-size: .85rem; background: var(--surface); }
.frbody .frcard .frmeta.frfit { color: var(--text); white-space: normal; overflow: visible; }
.frmeta.frfit b { color: #5fcf8a; }
.spoolfit label.inline { margin: 0 0 0 .3rem; font-size: .85rem; color: var(--muted); }
.spoolfit .clear { border: 0; background: none; color: var(--muted); font-size: 1.1rem; cursor: pointer; padding: 0 .3rem; }
.mslot.click { cursor: pointer; }
.mslot.click:hover, .mslot.click:focus-visible { border-color: var(--accent); outline: none; }
.mslot.off { border-color: #d98a2b; }
.mslot .warn-mark { color: #e0a040; }
.modal.boxslot { width: min(640px, calc(100vw - 2rem)); }
.modal.boxslot .dot, .bs-sum .dot { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; vertical-align: -1px; border: 1px solid var(--border); }
.bs-label { margin: .7rem 0 .35rem; font-size: .9rem; }
.bs-colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(2rem, 1fr)); gap: .4rem; }
.bs-color { position: relative; height: 2rem; border-radius: 6px; border: 1px solid var(--border); cursor: pointer; padding: 0; }
.bs-color.sug::after { content: "★"; position: absolute; right: 2px; top: 0; font-size: .7rem; color: #fff; text-shadow: 0 0 2px #000, 0 0 2px #000; }
.bs-color.on { outline: 3px solid var(--accent); outline-offset: 2px; }
.bs-sum { margin-top: .7rem; }
.modal.slicedlg { width: min(1100px, 100%); }
.sl-agent { display: flex; flex-wrap: wrap; gap: .5rem .8rem; align-items: center; padding: .55rem .75rem; border: 1px solid var(--border); border-radius: 10px; margin-bottom: .6rem; font-size: .92rem; }
.sl-agent .grow { flex: 1 1 280px; min-width: 0; }
.sl-agent .muted.small { margin-top: .2rem; }
.sl-sec { margin: .9rem 0 .35rem; font-weight: 600; }
.sl-top { display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: end; }
.sl-top label { flex: 1 1 320px; min-width: 0; font-size: .9rem; }
.sl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .5rem .7rem; margin-bottom: .5rem; }
.sl-grid label { font-size: .85rem; min-width: 0; }
.sl-grid .modal-input, .sl-top .modal-input { margin-top: .15rem; }
.sl-machines { border: 1px solid var(--border); border-radius: 10px; max-height: 46vh; max-height: 46dvh; overflow-y: auto; }
.sl-m { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1.2fr); gap: .35rem .6rem; align-items: center; padding: .4rem .65rem; border-bottom: 1px solid var(--border); }
.sl-m:last-child { border-bottom: 0; }
.sl-m.on { background: var(--primary-soft); }
.sl-m:not(.on) .sl-mname { grid-column: 1 / -1; }
.sl-mname { display: flex; flex-wrap: wrap; gap: .25rem .45rem; align-items: center; min-width: 0; cursor: pointer; }
.sl-mname input { width: 18px; height: 18px; margin: 0; flex: none; }
.sl-m .sl-sel { padding: .35rem .45rem; font-size: .88rem; min-width: 0; }
.sl-all { margin: .45rem 0 0; font-size: .85rem; color: var(--muted); }
.sl-arr { align-items: end; }
.sl-arr label.chk { margin: 0 0 .55rem; font-size: .88rem; }
.sl-names { font-size: .85rem; margin: 0 0 .4rem; padding-left: 1.2rem; max-height: 10rem; overflow-y: auto; overflow-wrap: anywhere; }
.sl-jobs { list-style: none; margin: 0 0 .6rem; padding: 0; border-top: 1px solid var(--border); }
.sl-job { display: flex; gap: .5rem; align-items: center; justify-content: space-between; padding: .4rem 0; border-bottom: 1px solid var(--border); font-size: .88rem; }
.sl-jname { display: flex; flex-direction: column; gap: .1rem; min-width: 0; overflow-wrap: anywhere; }
.sl-jname .badge { align-self: flex-start; margin-bottom: .1rem; }
@media (max-width: 700px) { .sl-m { grid-template-columns: minmax(0, 1fr); } }
.form .unit label.inl { display: flex; flex-direction: row; align-items: center; gap: .4rem; font-size: .85rem; line-height: 1.25; color: var(--muted); margin: 0; min-width: 0; }
.form .unit label.inl input { width: 18px; height: 18px; padding: 0; flex: none; margin: 0; }
.color-pick { align-items: center; }
.color-pick .modal-input { width: 7rem; margin: 0; }
.chip .swatch-dot { width: 14px; height: 14px; margin-right: .3rem; vertical-align: -2px; }
label.chk { display: flex; align-items: flex-start; gap: .45rem; font-size: .9rem; margin: .3rem 0 .5rem; }
label.chk input { margin-top: .2rem; }
.table td:has(> .swatch-dot) { white-space: nowrap; }
.table td .swatch-dot { flex: none; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem; box-shadow: var(--shadow); }
.tile strong { display: block; font-size: 1.5rem; color: var(--primary); }
.tile span { font-size: .82rem; color: var(--muted); }
ul.list { list-style: none; padding: 0; margin: .5rem 0; }
ul.list li { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .5rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
ul.list li:last-child { border-bottom: 0; }
ul.list li > span:first-child { flex: 1; min-width: 200px; }
.bars .bar-row { display: grid; grid-template-columns: 130px 1fr 40px; gap: .5rem; align-items: center; font-size: .85rem; margin: .25rem 0; }
.bars .bar { height: 12px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.bars .bar i { display: block; height: 100%; background: var(--primary); }

/* ---------- Dialoge und Hinweise */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 25, 40, .5); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 1rem; }
.modal { background: var(--surface); border-radius: 14px; padding: 1.2rem; width: min(440px, 100%); box-shadow: 0 10px 40px rgba(0, 0, 0, .3); max-height: calc(100vh - 2rem); max-height: calc(100dvh - 2rem); overflow-y: auto; }
.modal h3 { margin: 0 0 .5rem; }
.modal p { margin: 0 0 .5rem; white-space: pre-line; }
.modal-input { width: 100%; padding: .55rem .65rem; font: inherit; font-size: 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.modal-actions { justify-content: flex-end; }
#toast { position: fixed; left: 50%; bottom: calc(80px + var(--safe-bottom)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: .6rem 1rem; border-radius: 10px; font-size: .92rem; z-index: 60; max-width: 90vw; box-shadow: var(--shadow); }
#toast.error { background: var(--danger); color: #fff; }
#toast.ok { background: var(--ok); color: #fff; }

.scanbar { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; padding: .6rem .8rem; margin: -.2rem 0 .8rem; background: var(--primary-soft); border-radius: 10px; }
.scanbar .btn.big { flex: 0 0 auto; }
@media (max-width: 599px) { .scanbar .btn.big { flex: 1 1 100%; } }

/* ---------- Scanner */
.scan video { width: 100%; max-height: 60vh; border-radius: var(--radius); background: #000; object-fit: cover; display: block; margin-top: .6rem; }
.scan video.mirror { transform: scaleX(-1); }
.scan .videowrap { position: relative; }
.scan .camswitch { position: absolute; right: .6rem; bottom: .6rem; background: rgba(0, 0, 0, .55); color: #fff; border-color: transparent; }
.scan form { display: flex; gap: .5rem; margin-top: .75rem; }
.scan form input { flex: 1; min-width: 0; padding: .55rem .65rem; font: inherit; font-size: 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }

/* ---------- Etiketten */
.labels-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0 .8rem; }
.labels-setup .lBig { border-top: 1px dashed var(--border); padding-top: .5rem; margin-top: .3rem; }
.labels-setup .lBig[hidden] { display: none; }
.labels-setup .lfree { flex: 1 1 100%; max-width: 520px; }
.labels-setup .lfree input { display: block; width: 100%; margin-top: .2rem; }
ul.list.plabels select { max-width: 100%; }
.labels-sheet { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.labels-sheet .page { background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow); }
.labels-sheet .page img { display: block; width: var(--lw); height: var(--lh); }
.printsend { background: var(--primary-soft); padding: .6rem .8rem; border-radius: 10px; }
.printsend select { padding: .45rem .6rem; font: inherit; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); max-width: 100%; }

/* ---------- Benutzer / Verwaltung */
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin: .5rem 0 1rem; }
.tabs button { padding: .45rem .9rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: inherit; cursor: pointer; }
.tabs button.on { background: var(--primary); border-color: var(--primary); color: var(--primary-text); font-weight: 600; }
.userrow select { padding: .35rem .5rem; font: inherit; font-size: .88rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.tokenbox { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.tokenbox code { font-size: 1rem; padding: .35rem .6rem; user-select: all; -webkit-user-select: all; }

.desktop-only { display: none; }
.mobile-only { display: initial; }
.no-print {}
@media (min-width: 900px) {
  body { padding-bottom: 1rem; }
  .topnav { display: flex; }
  .tabbar { display: none; }
  .desktop-only { display: initial; }
  .mobile-only { display: none; }
  main { padding: 1.25rem 2rem; }
  .table th, .table td { padding: .55rem .8rem; }
}
@media (max-width: 599px) {
  .row2, .row3 { grid-template-columns: minmax(0, 1fr); }
  .detail-head .img { width: 100%; height: 220px; }
}

/* ---------- Druck */
@media print {
  .topbar, .tabbar, .no-print, #toast, .toolbar, .summary { display: none !important; }
  body { background: #fff; color: #000; padding: 0; }
  main { max-width: none; padding: 0; }
  .box { border: 0; box-shadow: none; padding: 0; }
  .table-wrap, .table-wrap.scroll { border: 0; box-shadow: none; overflow: visible; max-height: none !important; }
  .table th { position: static; }
  .labels-sheet { display: block; margin: 0; }
  .labels-sheet .page { border: 0; box-shadow: none; page-break-after: always; break-after: page; width: var(--pw); height: var(--ph); overflow: hidden; margin: 0; display: flex; align-items: center; justify-content: center; }
  .labels-sheet .page:last-child { page-break-after: auto; break-after: auto; }
  .labels-sheet.rot .page img { transform: rotate(90deg); }
  .labels-setup { display: none !important; }
  h1 { font-size: 1.2rem; }
}

/* QIDI Box: Slots des Filamentwechslers */
.mbox { margin-top: .5rem; padding: .5rem .6rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.mbox-head { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; font-size: .9rem; margin-bottom: .4rem; }
.mslots { display: flex; flex-wrap: wrap; gap: .35rem; }
.mslot { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .55rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: .82rem; white-space: nowrap; }
/* schmale Box (z. B. breitere Mac-Schrift): Slot-Zeile bricht um statt über den Rahmen hinauszuragen */
.mbox .mslot { flex-wrap: wrap; row-gap: .05rem; max-width: 100%; min-width: 0; white-space: normal; border-radius: 14px; }
/* Slots der QIDI Box als gleich breite Kacheln: ab 600 px Boxbreite vier nebeneinander (eine Box = eine Reihe), sonst zwei;
   der Text bricht in der Kachel um (Filament, darunter Rolle und Gramm) statt die Reihe zu sprengen */
.mbox { container: mbox / inline-size; }
.mbox .mslots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@container mbox (min-width: 600px) { .mbox .mslots { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@container mbox (max-width: 280px) { .mbox .mslots { grid-template-columns: minmax(0, 1fr); } }
.mbox .mslot .sp { white-space: nowrap; }
.mslot .dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--border); flex: none; }
.mslot.empty { color: var(--muted); border-style: dashed; }
.mslot.loaded { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.mslot.active .dot { animation: slotpulse .8s infinite alternate; }
.mslot .sp { color: var(--primary); font-weight: 600; }
.mslot .sp .g, .mspools .g { color: var(--muted); font-weight: 600; }
.mslot .sp .g.low, .mspools .g.low { color: var(--warn); }
/* Füllstand der Rollen: unter 10 % gelb, unter 3 % rot (Materialliste, Rollen-Seite, Druckerkarten) */
.lvl-warn { color: var(--yellow); font-weight: 600; }
.lvl-crit { color: var(--red-lvl); font-weight: 600; }
.card .side strong.lvl-warn { color: var(--yellow); }
.card .side strong.lvl-crit { color: var(--red-lvl); }
.progress i.lvl-warn { background: var(--yellow); }
.progress i.lvl-crit { background: var(--red-lvl); }
.mslot.lvl-warn { border-color: var(--yellow); background: var(--yellow-soft); color: inherit; font-weight: inherit; }
.mslot.lvl-crit { border-color: var(--red-lvl); background: var(--red-soft); color: inherit; font-weight: inherit; }
.mslot .sp .g.lvl-warn, .mspools .g.lvl-warn { color: var(--yellow); }
.mslot .sp .g.lvl-crit, .mspools .g.lvl-crit { color: var(--red-lvl); }
.mspools .spc { border-radius: 6px; }
.mspools .spc.lvl-warn, .mspools .spc.lvl-crit { padding: 0 .35rem; color: inherit; font-weight: inherit; }
.mspools .spc.lvl-warn { background: var(--yellow-soft); box-shadow: inset 0 0 0 1px var(--yellow); }
.mspools .spc.lvl-crit { background: var(--red-soft); box-shadow: inset 0 0 0 1px var(--red-lvl); }
/* Filamentprüfung beim laufenden Druck: Warnung mit Frage */
/* Kamera-Steuerung (Reolink): Steuerkreuz, Zoom, Tempo, gespeicherte Positionen in der Großansicht */
.ptz { display: flex; flex-wrap: wrap; gap: .8rem 1.4rem; align-items: center; margin: .2rem 0 .6rem; }
.ptz-pad { display: grid; grid-template-columns: repeat(3, 48px); grid-template-rows: repeat(3, 48px); gap: 5px; }
.ptz button { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; min-width: 48px; height: 48px; padding: 0 .7rem;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 1.15rem; cursor: pointer; }
.ptz button:hover { border-color: var(--primary); }
.ptz button:active { background: var(--primary-soft); border-color: var(--primary); }
.ptz button[data-ptz="stop"] { font-size: .95rem; color: var(--muted); }
.ptz-side { display: flex; flex-direction: column; gap: .45rem; flex: 1 1 260px; }
.ptz-side .row2 { max-width: 480px; align-items: end; }
.ptz-side label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--muted); }
.ptz-side select { padding: .45rem .6rem; font: inherit; font-size: .92rem; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); width: 100%; min-width: 0; }
.ptz-side select:disabled { opacity: .6; cursor: not-allowed; }
.ptz-side p { margin: 0; }
/* Kamera-Kachel (Reolink): Bild füllt die Karte, Klick öffnet die Großansicht */
.camcard { display: flex; flex-direction: column; gap: .45rem; }
/* Druckzähler am Bauteil */
.pcount { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.pcount .pbig { display: flex; flex-direction: column; align-items: center; min-width: 5.5rem; padding: .45rem .7rem; border-radius: 10px; background: var(--primary-soft); }
.pcount .pbig strong { font-size: 1.7rem; line-height: 1.1; color: var(--primary); font-variant-numeric: tabular-nums; }
.pcount .pbig span { font-size: .75rem; color: var(--muted); }
.pcount .pinfo { flex: 1 1 12rem; min-width: 0; }
.pcount .pbtns { display: flex; gap: .3rem; }
.pjobs { margin-top: .7rem; box-shadow: none; }
.pjobs .table { font-size: .84rem; }
.pjobs td.name { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pjobs + .linkbtn { margin-top: .4rem; font-size: .85rem; }
/* Sensor-Dialog: abgewiesene Meldungen */
.sensor-rej { margin: .35rem 0; padding: .4rem .6rem; border-left: 3px solid var(--danger); background: var(--surface-2); border-radius: 6px; font-size: .82rem; }
.sensor-rej > div { margin-top: .15rem; }
/* G-Code-Angaben in der Dateiliste: Zieldrucker sichtbar, Rest zum Aufklappen */
.gcmeta { font-size: .84rem; }
.gcmeta summary { cursor: pointer; width: fit-content; }
/* Auftrag: Farbe aus den zugeordneten Drucken an der Position des Bauteils */
.ocolor { display: inline-flex; align-items: center; gap: .3rem; margin-left: .45rem; padding: .02rem .5rem .02rem .35rem; border: 1px solid var(--border);
  border-radius: 999px; font-size: .82rem; white-space: nowrap; vertical-align: 1px; }
/* Teile auf der Platte: gut sichtbar vorn in der Zeile der Druckdatei und im Druck-Dialog */
.gcpcs { display: inline-block; margin-right: .5rem; padding: .08rem .6rem; border-radius: 999px; background: var(--primary); color: var(--primary-text);
  font-weight: 700; font-size: .92rem; line-height: 1.35; white-space: nowrap; vertical-align: 1px; }
.gcmeta .gcrows { display: flex; flex-wrap: wrap; gap: .2rem 1.1rem; margin: .3rem 0 .15rem 1.3rem; font-size: .82rem; }
.gcmeta em { font-style: normal; color: var(--muted); }
/* Dialog „Drucken“ (G-Code an einen Drucker) */
.gcinfo { display: flex; gap: .9rem; align-items: flex-start; margin-bottom: .6rem; }
.gcinfo img { width: 110px; height: 110px; object-fit: contain; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); flex: none; }
.gcinfo > div { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
/* mehrere Artikelnummern je Bauteil */
.artno { display: inline-block; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9em; padding: .05rem .4rem; margin: .1rem .15rem .1rem 0;
  border-radius: 6px; background: var(--primary-soft); border: 1px solid var(--border); }
/* Druckhistorie: Spalte „Bauteil“ */
.jobpart { white-space: nowrap; }
.jobpart .badge { margin-left: .15rem; }
/* Dialog „Kosten aus Drucken“ */
.pctable td.pcfile { max-width: 26rem; }
.pctable td.pcfile strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pctable input.pcs { width: 4.2rem; text-align: right; }
.pctable td, .pcprev td { vertical-align: middle; }
.pcprev { max-width: 44rem; }
#pcPreview { margin-top: .8rem; }
/* feste Größe der Vorschau (Einstellung je Kamera): die Kachel wächst nicht mit, höchstens so breit wie die Seite */
.machines .machine.camcard.cam-s { flex: 0 1 360px; }
.machines .machine.camcard.cam-m { flex: 0 1 540px; }
.machines .machine.camcard.cam-l { flex: 0 1 800px; }
.camcard .camview { display: block; width: 100%; padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: #000; cursor: zoom-in; aspect-ratio: 4 / 3; }
.camcard .camview img { display: block; width: 100%; height: 100%; object-fit: contain; }
.camcard .camview img:not([src]) { visibility: hidden; }
.camcard .camerr { margin: 0; color: var(--danger); }
.fcheck { display: flex; flex-direction: column; gap: .35rem; margin: .45rem 0; padding: .5rem .7rem; border: 1px solid var(--red-lvl); border-radius: 8px; background: var(--red-soft); font-size: .88rem; }
.fcheck .row { align-items: center; }
.fcheck.done { display: block; border-color: var(--border); background: transparent; color: var(--muted); }
.mspools { margin-top: .35rem; }
.msensors { margin-top: .35rem; }
/* Räume: Leiste oben oder unten in der Druckerübersicht (Temperatur, Feuchte, Tiefst-/Höchstwerte von heute) */
.rooms { display: flex; flex-wrap: wrap; gap: .6rem; margin: 0 0 .9rem; }
.room { flex: 1 1 220px; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: .55rem .8rem; cursor: pointer; }
.room:hover, .room:focus-visible { border-color: var(--primary); }
.room.static { cursor: default; }
.room.static:hover { border-color: var(--border); }
.room .rhead { font-size: .9rem; margin-bottom: .15rem; }
.room.multi { flex-basis: 380px; max-width: 580px; }
/* Räume „unten“: Fußleiste fest am unteren Fensterrand, Räume nebeneinander (bei vielen seitlich scrollbar) */
.rooms.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; margin: 0; padding: .5rem 1rem; flex-wrap: nowrap; overflow-x: auto;
  background: var(--bg); border-top: 1px solid var(--border); box-shadow: 0 -6px 16px rgba(0, 0, 0, .12); }
.rooms.bottom .room { flex: 0 0 auto; width: 270px; max-width: none; }
.rooms.bottom .room.multi { width: 460px; }
@media (max-width: 600px) {   /* Handy: Räume im Raster nebeneinander (so viele, wie passen, sonst nächste Reihe) statt seitlich zu scrollen;
                                  Tageswerte und Alter der Meldung stehen auf der Raum-Seite */
  .mview .rooms { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .45rem; }
  .mview .rooms.bottom { padding: .4rem .6rem; overflow-x: hidden; }
  .mview .rooms .room, .mview .rooms .room.multi { width: auto; max-width: none; min-width: 0; padding: .4rem .55rem; }
  .mview .rooms .room.multi { grid-column: span 2; }
  .mview .rooms .rhead { font-size: .8rem; margin-bottom: .1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mview .rooms .rsub { display: none; }
  .mview .rooms .rt { font-size: 1.15rem; }
  .mview .rooms .rh { font-size: .95rem; }
  .mview .rooms .rsens { flex: 1 1 0; min-width: 0; gap: 0 .45rem; }
  .mview .rooms .rsens + .rsens { border-top: 0; padding-top: 0; border-left: 1px dashed var(--border); padding-left: .5rem; margin-left: .5rem; }
  .mview .rooms .rports { flex-wrap: nowrap; }
}
.room .rports { display: flex; flex-wrap: wrap; gap: .35rem 0; }
.room .rsens { flex: 1 1 160px; display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .8rem; }
.room .rsens + .rsens { border-left: 1px dashed var(--border); padding-left: .8rem; margin-left: .8rem; }
@media (max-width: 600px) { .room .rsens + .rsens { border-left: 0; padding-left: 0; margin-left: 0; border-top: 1px dashed var(--border); padding-top: .35rem; } }
.room .rname { flex-basis: 100%; font-size: .78rem; color: var(--muted); }
.room .rt { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.room .rh { font-size: 1.15rem; font-weight: 600; color: var(--primary); }
.room .rsub { flex-basis: 100%; font-size: .75rem; color: var(--muted); }
.room .stale .rt, .room .stale .rh { opacity: .55; }
/* Kältewarnung: Kachel rot, zu kalter Sensor in Rot */
.room.cold { border-color: var(--red-lvl); background: linear-gradient(var(--red-soft), var(--red-soft)), var(--surface); }
.room.cold:hover, .room.cold:focus-visible { border-color: var(--red-lvl); }
.room .rt.coldval { color: var(--red-lvl); }
.room .rcold { font-size: .75rem; font-weight: 700; color: var(--red-lvl); }
.sensor-port { border: 1px solid var(--border); border-radius: 8px; padding: .5rem .7rem; margin: .4rem 0; }
.sensor-port .row { align-items: center; }
.sensor-url { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .78rem; flex: 1 1 320px; margin: 0; }
.sensor-history { margin-top: 1rem; }
.sensor-history h3 { font-size: 1rem; margin: .8rem 0 .3rem; }
.mspools a { font-weight: 600; }
.poslist { margin: .3rem 0 .5rem; }
/* Positionen (Auftrag anlegen/ändern, Sammelauftrag): feste Spalten Bauteil | Menge | ✎ | ✕, mit Auftragsnummer davor */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) auto 2.4rem 2.4rem; gap: .6rem; align-items: center; padding: .4rem .6rem;
  border: 1px solid var(--border); border-radius: 8px; margin-bottom: .35rem; }
.pos.withno { grid-template-columns: 6.8rem minmax(0, 1fr) auto 2.4rem 2.4rem; }
.pos .posno { white-space: nowrap; }
.pos .posname { min-width: 0; overflow-wrap: anywhere; }
.pos > .btn { justify-self: center; min-width: 2.2rem; padding-left: 0; padding-right: 0; }
.form .pos input.posqty { width: 5.5rem; }
@media (max-width: 520px) {
  .pos.withno { grid-template-columns: minmax(0, 1fr) auto 2.4rem 2.4rem; }
  .pos.withno .posno { grid-column: 1 / -1; }
}
.pos.removed { opacity: .55; }
.pos.removed .posname { text-decoration: line-through; }
.form .pos label.inline { display: flex; align-items: center; gap: .35rem; margin: 0; white-space: nowrap; }
td.joborder { white-space: nowrap; }
.table td.actions { min-width: 23rem; }
.table.orders td.mono { font-size: .8rem; white-space: nowrap; }
/* Sammelauftrag: Kopfzeile und Positionen als Gruppe mit Leiste links; Knöpfe überall gleich groß */
.table.orders tr.ohead td { background: var(--surface-2); border-top: 2px solid var(--border); }
.table.orders tr.ohead td:first-child { box-shadow: inset 3px 0 0 var(--accent); font-weight: 700; color: var(--accent); }
.table.orders tr.opos td:first-child { box-shadow: inset 3px 0 0 var(--accent); padding-left: 1.1rem; }
.table.orders tr.opos td { padding-top: .35rem; padding-bottom: .35rem; }
.actions .acts { display: flex; flex-wrap: wrap; gap: .3rem; }
.actions .acts + .acts { margin-top: .35rem; }
.slot-list { display: flex; flex-direction: column; gap: .4rem; margin: .4rem 0 .6rem; }
.slot-row { display: grid; grid-template-columns: 6.5rem 1fr auto; gap: .6rem; align-items: center; padding: .45rem .6rem; border: 1px solid var(--border); border-radius: 8px; }
.slot-row.loaded { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.slot-row .lbl { display: flex; flex-direction: column; gap: .1rem; }
@media (max-width: 560px) { .slot-row { grid-template-columns: 1fr; } }
@keyframes slotpulse { from { opacity: 1; } to { opacity: .3; } }
.detail-head .mbox { margin-top: .6rem; }
.mbox-foot { justify-content: space-between; align-items: center; margin-top: .4rem; }
#toast.warn { background: var(--warn); color: #fff; }
.warn-text { color: var(--warn); }
/* QIDI Box: Heizung an – warm hervorgehoben */
.mbox.heating { border-color: var(--warn); background: linear-gradient(0deg, rgba(183, 121, 31, .10), rgba(183, 121, 31, .10)), var(--surface-2); box-shadow: 0 0 0 2px rgba(183, 121, 31, .18); }
.mbox .heat-on { color: var(--warn); font-weight: 600; }
.heat-badge { animation: heatpulse 1.4s ease-in-out infinite alternate; }
@keyframes heatpulse { from { opacity: 1; } to { opacity: .55; } }
.btn.warm { background: var(--warn); color: #fff; border-color: transparent; }
.btn.warm:hover { filter: brightness(1.08); }

/* PDF-Dialog der installierten App (pdfview.js): Seiten als Bilder, scrollbar, mit Schließen/Teilen/Sichern */
.modal.pdfview { width: min(960px, 100%); height: calc(100vh - 2rem); height: calc(100dvh - 2rem); display: flex; flex-direction: column; padding: .7rem .8rem; }
.modal.pdfview .pdfview-head { flex-wrap: wrap; gap: .4rem; margin-bottom: .5rem; align-items: center; }
.modal.pdfview .pdfview-head h3 { margin: 0; font-size: 1rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdfview-pages { flex: 1; min-height: 0; overflow: auto; background: #6b7785; padding: .6rem; border-radius: 8px; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; }
.pdfview-page { display: block; margin: 0 auto .6rem; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); max-width: 100%; flex: none; }
.pdfview-status { color: #fff; text-align: center; margin: .4rem 0; font-size: .9rem; }
.pdfview-frame { flex: 1; width: 100%; border: 0; background: #fff; border-radius: 4px; }

/* Empfänger der Benachrichtigungen als Chips (Gruppe / Konto / Adresse) mit × zum Entfernen */
.rec { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; min-width: 14rem; }
.rec select { max-width: 18rem; }
.rchips { display: inline-flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.rchip { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .25rem .15rem .6rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: .84rem; white-space: nowrap; }
.rchip .tag { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.rchip button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 1.05rem; line-height: 1; cursor: pointer; padding: 0 .3rem; }
.rchip button:hover { color: var(--danger); }

/* Anmeldeprotokoll, Zwei-Faktor-Dialog */
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
tr.warnrow td { background: rgba(220, 60, 60, .07); }
.center { text-align: center; }
.plug-on { color: var(--warn); font-weight: 600; }
.mloc { color: var(--text); font-weight: 600; }   /* Standort auf Drucker-/Trockner-Karten */
/* Mindestmengen: Warnleiste der Materialliste, markierte Zeilen, Zähler am Menüpunkt, Liste im Dialog */
.alertbar { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .6rem; margin: 0 0 .7rem; padding: .5rem .8rem; border: 1px solid var(--danger); border-radius: var(--radius); background: rgba(197, 48, 48, .08); font-size: .9rem; }
.alertbar .linkbtn { font-weight: 600; padding: 0; }
.table tr.lowrow td { background: rgba(197, 48, 48, .07); }
.lowval { color: var(--danger); font-weight: 600; }
.nowrap { white-space: nowrap; }
.navbadge { display: inline-block; min-width: 1.15rem; margin-left: .3rem; padding: 0 .3rem; border-radius: 999px; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700; line-height: 1.15rem; text-align: center; vertical-align: middle; font-style: normal; }
.tabbar a { position: relative; }
.tabbar a .navbadge { position: absolute; top: .15rem; left: calc(50% + .4rem); margin: 0; }
.alert-list { max-height: 55vh; overflow: auto; margin: .4rem 0 .6rem; border: 1px solid var(--border); border-radius: 8px; }
.alert-list thead th { position: sticky; top: 0; z-index: 1; }
.alert-list input.minval { width: 5.5rem; }
.alert-list select { width: auto; }
/* Listen-Fenster (Mindestmengen, Spulen & Gewichte): Suchzeile und Eingaben wie im Rest der App */
.modal input[type=search] { flex: 1 1 220px; min-width: 0; width: 100%; padding: .55rem .7rem; font: inherit; font-size: 16px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); }
.alert-list input:not([type=checkbox]), .alert-list select { padding: .35rem .5rem; font: inherit; font-size: .9rem; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--text); }
.alert-list input[type=checkbox] { width: 18px; height: 18px; }
/* Listen-Fenster: nutzen die Bildschirmhöhe – die Liste scrollt nur, wenn sie nicht ganz passt (bis herab zu 10rem) */
.modal.listdlg { display: flex; flex-direction: column; }
.modal.listdlg > * { flex: none; }
.modal.listdlg > .alert-list { flex: 1 1 auto; min-height: 10rem; max-height: none; }
/* Spulen & Gewichte: so breit wie der Bildschirm erlaubt (bis 1600px), schmaler → waagerechter Scrollbalken in der Liste */
.modal.specdlg { width: min(1600px, calc(100vw - 2rem)); }
.spec-list input.specnum { width: 5.2rem; }
.spec-list select { min-width: 6.5rem; }
.spec-list td { vertical-align: middle; }
.spec-list td:first-child { min-width: 14rem; }
.spec-list th { white-space: nowrap; }
.spec-list th.nosort { cursor: default; }
/* Historie und Material: Tabelle scrollt selbst (Höhe per fitTable), Kopfzeile bleibt sichtbar */
.table-wrap.scroll { overflow: auto; }
.table-wrap.scroll thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); }
td.jobspool { white-space: nowrap; }
.joblist { display: flex; flex-direction: column; gap: .3rem; max-height: 38vh; overflow: auto; margin: .2rem 0 .7rem; }
.jobpick { display: flex; gap: .5rem; align-items: baseline; font-size: .9rem; line-height: 1.35; }
.jobfilter { margin: .2rem 0 .5rem; align-items: center; }
.jobfilter input[type=date] { width: auto; }
/* Trockner-Karten: kompakter; Trockner-Zeile auf der Druckerkarte über die volle Breite */
.machine.dryer { flex-basis: 300px; }
.machine.dryer .mtemps { margin-top: .5rem; }
.machine-body > .mdryers { grid-column: 1 / -1; }
/* Auswahlliste im Dialog: umbrechende Zeilen statt schmaler <select>-Liste */
.modal.wide { width: min(760px, 100%); }
.modal.xwide { width: min(1200px, 100%); }
/* Helinox: Formular (Teile-Nummer mit Auswahlknopf) und Liste */
.hxpart { align-items: flex-end; }
.hxpart .grow { flex: 1 1 240px; }
.table.helinox td.hmodel a { text-decoration: none; }
/* Einstellungen: Nummernkreis je Zeile (Präfix, Stellen, nächste Nummer, Vorschau) */
.numrange { align-items: end; }
.numrange .numnext { grid-column: 1 / -1; margin: -.3rem 0 .4rem; }
/* Drucke einem Auftrag zuordnen: Tabelle mit fester Kopfzeile, Summenzeile der Auswahl */
.jobtable { max-height: 44vh; overflow: auto; margin: .2rem 0 .5rem; box-shadow: none; }
.jobtable.assigned { max-height: 22vh; margin-bottom: .9rem; }
.jobtable th, .jobtable td { font-size: .86rem; }
.jobtable th.ck, .jobtable td.ck { width: 36px; text-align: center; }
.jobtable td.ck input { width: 18px; height: 18px; }
.jobtable td.jf { min-width: 220px; overflow-wrap: anywhere; }
.jobtable td.cnote { min-width: 170px; font-size: .8rem; }
.jobhead { margin: .3rem 0 .3rem; font-size: .9rem; }
.jobfilter .jobtitle { font-size: .9rem; margin-right: auto; }
.jobfilter .jobsearch { flex: 0 1 260px; width: auto; }
.jobsum { font-size: .9rem; margin: 0 0 .7rem; }
.jobfoot { align-items: center; }
.jobfoot label.inline input { width: 11rem; }
.jobfoot .grow { flex: 1; }
.pick-list { max-height: min(42vh, 360px); overflow: auto; border: 1px solid var(--border); border-radius: 8px; margin: .4rem 0 .6rem; }
.pick { display: flex; gap: .55rem; align-items: flex-start; padding: .45rem .6rem; border-bottom: 1px solid var(--border); cursor: pointer; line-height: 1.35; }
.pick:last-child { border-bottom: 0; }
.pick:hover { background: var(--surface-2); }
.pick input { margin-top: .25rem; flex: none; }
/* Häkchen und Auswahlpunkte in Formularen: Knopf neben dem Text, nicht als seitenbreites Feld (.form label/.form input) */
.form label.chk, .form label.pick { flex-direction: row; color: var(--text); }
.form label.chk { align-items: flex-start; gap: .5rem; font-size: .9rem; margin: .45rem 0; }
.form label.pick { margin: 0; font-size: .92rem; }
.form label.chk input, .form label.pick input { width: 18px; height: 18px; padding: 0; flex: none; margin-top: .12rem; }
/* Druck-Dialog: Slot der QIDI Box je Filament der Datei */
.gcbox { margin: .55rem 0; padding: .5rem .7rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.gcbox > p { margin: 0 0 .35rem; }
.form label.gcslot { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .35rem .7rem; color: var(--text); margin: .35rem 0; }
.form label.gcslot select { width: auto; flex: 1 1 260px; }
.gcslot .dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--border); vertical-align: -2px; }
.mstop { margin: .35rem 0 .1rem; }
.pick:has(input:checked) { background: var(--primary-soft); }
tr.hl td { background: color-mix(in srgb, var(--accent, #3b82f6) 18%, transparent); }

/* CAD-Ablage am Bauteil, Ablage-Explorer, 3D-Ansicht */
.cadpath { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .5rem; }
.cadpath code { flex: 1 1 18rem; min-width: 0; overflow-wrap: anywhere; padding: .35rem .5rem; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); font-size: .85rem; }
.cadmain { margin: .2rem 0 .5rem; align-items: center; }
.cadfiles li { gap: .5rem; }
.cn-list { display: flex; flex-direction: column; gap: .15rem; max-height: min(60vh, 32rem); overflow: auto; margin: .4rem 0; border: 1px solid var(--border); border-radius: 8px; padding: .3rem .6rem; }
.cn-row { align-items: flex-start !important; padding: .3rem 0; border-bottom: 1px solid var(--border); margin: 0 !important; }
.cn-row:last-child { border-bottom: 0; }
.cn-row input { margin-top: .2rem; }
.cadgroup { border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 10px; background: var(--surface-2); padding: .2rem .8rem .1rem; margin: .75rem 0; }
.cadgroup.other { border-left-color: var(--border); }
.cadgroup-head { display: flex; align-items: center; gap: .4rem; padding: .45rem 0 .4rem; border-bottom: 1px solid var(--border); font-size: .95rem; }
.cadgroup-head span:not(.count) { color: var(--muted); font-weight: 400; }
.cadgroup.other .cadgroup-head { color: var(--muted); }
.cadgroup .list.cadfiles { margin: 0; }
.cadgroup .gc-model { display: none; }   /* der Kasten nennt den Drucker schon */
.cadgroup .list.cadfiles > li:last-child { border-bottom: 0; }
.cadfiles .cadname { min-width: 0; overflow-wrap: anywhere; }
.cadbrowser { display: flex; flex-direction: column; height: calc(100vh - 2rem); height: calc(100dvh - 2rem); }
.cadbrowser .crumbs { display: flex; flex-wrap: wrap; gap: .15rem .3rem; align-items: center; margin-bottom: .5rem; font-size: .9rem; }
.cadbrowser .crumb { border: 0; background: none; color: var(--primary); cursor: pointer; padding: .1rem .2rem; font: inherit; border-radius: 4px; text-align: left; }
.cadbrowser .crumb:hover { background: var(--bg); }
.cadbrowser .cbtools { flex-wrap: nowrap; margin-bottom: .5rem; }
.cadbrowser .cbtools .modal-input { flex: 1; }
.cadbrowser .cblist { flex: 1; min-height: 8rem; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: .25rem; }
.cadbrowser .cbrow { display: block; width: 100%; text-align: left; padding: .45rem .55rem; border: 0; border-radius: 6px; background: none; color: var(--text); font: inherit; overflow-wrap: anywhere; }
.cadbrowser .cbrow.dir { cursor: pointer; }
.cadbrowser .cbrow.dir:hover, .cadbrowser .cbrow.dir:focus-visible { background: var(--bg); }
.cadbrowser .cbrow.file { color: var(--muted); }
.cadbrowser .modal-actions { margin-top: .6rem; align-items: center; }
.cadbrowser .cbinfo { margin-right: auto; }
.modal.stlview { width: min(1100px, 100%); height: calc(100vh - 2rem); height: calc(100dvh - 2rem); display: flex; flex-direction: column; padding: .7rem .8rem; }
.stlview .stlhead { align-items: center; flex-wrap: nowrap; margin-bottom: .4rem; }
.stlview .stlhead h3 { margin: 0; font-size: 1rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stlview .grow { flex: 1; }
.stlview .stlstage { position: relative; flex: 1; min-height: 12rem; border-radius: 10px; overflow: hidden; background: radial-gradient(circle at 50% 35%, var(--surface), var(--bg)); border: 1px solid var(--border); }
.stlview .stlstage { touch-action: none; cursor: grab; }
.stlview .stlstage:active { cursor: grabbing; }
.stlview canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stlview .stlmsg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 1rem; text-align: center; color: var(--muted); }
.stlview .stltools { margin-top: .5rem; align-items: center; }
.stlview .stlinfo { margin-left: auto; }
.stlview .stlhelp { margin: .35rem 0 0; }
@media (max-width: 640px) { .stlview .stlhelp { display: none; } .stlview .stlinfo { margin-left: 0; width: 100%; } }

/* Fremdbauteile: Kategorien mit Karten, Galerie mit Großansicht */
.frfilters label.inline { white-space: nowrap; }
.frfilters select { max-width: 22rem; }
.frcat { margin-bottom: 1.2rem; }
.frcat h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
.frgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .6rem; }
.frcard { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; overflow: hidden; }
.frcard:hover { border-color: var(--primary); }
.frcard.warn { border-color: var(--yellow); }
.frcard .frimg { aspect-ratio: 4 / 3; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 2rem; }
.frcard .frimg img { width: 100%; height: 100%; object-fit: contain; }
.frcard .frname { padding: .45rem .55rem 0; font-weight: 600; font-size: .88rem; line-height: 1.25; overflow-wrap: anywhere; }
.frcard .frmeta { padding: .25rem .55rem .5rem; font-size: .76rem; color: var(--muted); margin-top: auto; }
.frissues { border-color: var(--yellow); }
.frsuggest { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: -.2rem 0 .3rem; }
.frissues ul { margin: .2rem 0 .5rem 1.1rem; padding: 0; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .5rem; }
.gthumb { padding: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; aspect-ratio: 1; background: var(--surface-2); cursor: zoom-in; }
.gthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.readme { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .88rem; line-height: 1.45; max-height: 26rem; overflow-y: auto; padding: .6rem .7rem; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); }
.detail-head #frCover { cursor: zoom-in; }
.detail-head #frCover img { object-fit: contain; }
.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(5, 12, 20, .92); display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 94vw; max-height: 88vh; max-height: 88dvh; object-fit: contain; border-radius: 6px; touch-action: pan-y; user-select: none; }
.lightbox.fill img { width: min(94vw, 88vh); height: min(94vw, 88vh); height: min(94vw, 88dvh); width: min(94vw, 88dvh); background: #fff; }
.lightbox .lbbtn { position: absolute; border: 0; background: rgba(255, 255, 255, .14); color: #fff; font-size: 1.6rem; line-height: 1; width: 2.6rem; height: 2.6rem; border-radius: 50%; cursor: pointer; }
.lightbox .lbbtn:hover { background: rgba(255, 255, 255, .28); }
.lightbox .lbclose { top: 1rem; right: 1rem; font-size: 1.2rem; }
.lightbox .lbprev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox .lbnext { right: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox .lbcount { position: absolute; bottom: 1rem; left: 0; right: 0; text-align: center; color: #fff; font-size: .9rem; opacity: .8; }
@media (max-width: 640px) { .frgrid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); } }
.kv strong { overflow-wrap: anywhere; }
/* Dateiauswahl im Mail-Dialog */
.mailfiles { display: flex; flex-direction: column; gap: .15rem; max-height: 14rem; overflow-y: auto; padding: .4rem .5rem; border: 1px solid var(--border); border-radius: 8px; margin-bottom: .3rem; }
.mailfiles label.inline { overflow-wrap: anywhere; }
/* Fremdbauteile: Umschalter Klein/Mittel/Groß und die drei Kartengrößen */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--text); font: inherit; font-size: .88rem; padding: .45rem .75rem; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--primary); color: #fff; }
.frgrid.s { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: .45rem; }
.frgrid.s .frimg { font-size: 1.4rem; }
.frgrid.s .frname { font-size: .76rem; padding: .3rem .4rem 0; }
.frgrid.s .frmeta { font-size: .68rem; padding: .15rem .4rem .35rem; }
.frgrid.l { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .8rem; }
.frgrid.l .frimg { font-size: 3rem; }
.frgrid.l .frname { font-size: 1rem; padding: .6rem .75rem 0; }
.frgrid.l .frmeta { font-size: .82rem; padding: .3rem .75rem .65rem; }
@media (max-width: 640px) {
  .frgrid.s { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .frgrid.l { grid-template-columns: 1fr; }
}
/* Detailseiten auf breiten Bildschirmen: Abschnitte fließen in zwei Spalten, Kopf und Knopfleiste gehen über die volle Breite */
@media screen and (min-width: 1500px) {
  main.wide.cols { max-width: 2400px; column-count: 2; column-gap: 1rem; }
  main.cols > * { break-inside: avoid; }
  main.cols > .row, main.cols > .detail-head, main.cols > h1, main.cols > .summary { column-span: all; }
  main.cols > .box { display: inline-block; width: 100%; }
}
/* Fremdbauteile: Kategorien fließen nebeneinander (kleine Kategorien teilen sich eine Zeile), Karten mit fester Breite je Größe;
   am Handy wieder untereinander mit dehnbaren Spalten */
.frbody { --cw: 170px; --gap: .6rem; --pad: .7rem; display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; }
.frbody.s { --cw: 118px; --gap: .45rem; }
.frbody.l { --cw: 280px; --gap: .8rem; }
/* Rahmen je Kategorie, genau so breit wie seine Kartenspalten (große Kategorien: so viele ganze Spalten, wie in die Seite passen,
   rechnet die App aus); die Breite rechnet Innenabstand und Rand mit ein (box-sizing: border-box) */
.frbody .frcat { width: calc(var(--n) * var(--cw) + (var(--n) - 1) * var(--gap) + 2 * var(--pad) + 2px); max-width: 100%;
  margin: 0; padding: var(--pad); border: 1px solid var(--border); border-radius: var(--radius); background: var(--primary-soft); }
.frbody .frcat h2 { overflow-wrap: anywhere; margin: 0 0 .6rem; padding-bottom: .45rem; border-bottom: 1px solid var(--border); }
.frbody.s .frgrid, .frbody.m .frgrid, .frbody.l .frgrid { grid-template-columns: repeat(auto-fill, var(--cw)); gap: var(--gap); }
@media (max-width: 640px) {
  .frbody { display: block; }
  .frbody .frcat { width: auto; min-width: 0; margin-bottom: .8rem; }
  .frbody.m .frgrid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .frbody.s .frgrid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .frbody.l .frgrid { grid-template-columns: 1fr; }
}
/* Beschreibung unter einer Datei: dezentes Feld, wird beim Überfahren/Bearbeiten zum Eingabefeld */
.cadfiles .cadname { display: flex; flex-direction: column; gap: .2rem; flex: 1; min-width: 0; }
.fnote { width: 100%; max-width: 46rem; font: inherit; font-size: .84rem; padding: .22rem .45rem; margin-left: -.45rem; border: 1px solid transparent;
  border-radius: 6px; background: transparent; color: var(--text); }
.fnote::placeholder { color: var(--muted); opacity: .75; }
.fnote:hover { border-color: var(--border); }
.fnote:focus { outline: none; border-color: var(--primary); background: var(--surface); }
.fnote-text { font-size: .84rem; color: var(--muted); }
@media print { .fnote { border: 0; padding: 0; margin: 0; } .fnote:placeholder-shown { display: none; } }
@media (min-width: 900px) and (max-width: 1350px) {
  .topbar { gap: .6rem; }
  .topnav a { padding: .4rem .5rem; font-size: .92rem; }
  .userbox .role { display: none; }
}
.frcard .frnum { padding: .4rem .55rem 0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .72rem; color: var(--muted); }
.frcard .frnum + .frname { padding-top: .1rem; }
.frgrid.s .frnum { padding: .25rem .4rem 0; font-size: .64rem; }
.frgrid.l .frnum { padding: .55rem .75rem 0; font-size: .8rem; }
/* Gleich hohe Kategorie-Rahmen: Überschrift einzeilig (lange Namen mit „…“), Karten mit fester Höhe (Nummer eine Zeile,
   Name höchstens zwei, Angaben eine) – so sind alle einzeiligen Rahmen gleich hoch und mehrzeilige ein Vielfaches davon */
.frbody .frcat h2 { display: flex; align-items: center; gap: .45rem; white-space: nowrap; }
.frbody .frcat h2 .frcatname { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.frbody .frcat h2 .count { flex: none; }
.frbody .frcard .frnum { height: 1.3em; line-height: 1.3; box-sizing: content-box; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frbody .frcard .frname { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  line-height: 1.25; height: 2.5em; box-sizing: content-box; padding-top: .1rem; padding-bottom: 0; }
.frbody .frcard .frmeta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: .15rem; }
/* Bild im festen 4:3-Feld: darf das Feld nicht aufdehnen (quadratische Vorschaubilder, spät geladene Bilder) */
.frcard .frimg { position: relative; overflow: hidden; min-height: 0; }
.frcard .frimg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
