:root {
  --bg: #f5f6f8; --panel: #fff; --line: #e3e6eb; --text: #151821; --muted: #6b7385; --soft: #f0f2f5;
  --accent: #ea580c; --accent-soft: #fff1e8; --ok: #16a34a; --warn: #d97706; --bad: #dc2626;
  --radius: 12px; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1115; --panel: #171a21; --line: #272c37; --text: #eceef3; --muted: #8d95a7; --soft: #1e222b; --accent: #f97316; --accent-soft: #2b1b10; color-scheme: dark; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; }
code { background: var(--soft); padding: 1px 6px; border-radius: 6px; font-size: 12px; }
h1 { font-size: 22px; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0 0 12px; }
.brand { display: flex; gap: 10px; align-items: center; font-weight: 700; font-size: 16px; }
.brand img { width: 28px; height: 28px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(360px, 100%); display: flex; flex-direction: column; gap: 14px; }
.err { color: var(--bad); margin: 0; min-height: 1em; }

.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { padding: 9px 12px; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 550; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.side nav a:hover { background: var(--soft); color: var(--text); }
.side nav a.on { background: var(--accent-soft); color: var(--accent); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.badge { background: var(--accent); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; }

.page { padding: 24px 28px 60px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.head .spacer { flex: 1; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }
.stat b { display: block; font-size: 28px; letter-spacing: -0.02em; }
.stat span { color: var(--muted); }
.stat.alert { border-color: var(--accent); background: var(--accent-soft); }

.btn { font: inherit; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; text-decoration: none; font-weight: 550; white-space: nowrap; }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 13px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.tablewrap { overflow-x: auto; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn { margin-left: 4px; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 2px 9px; border-radius: 99px; background: var(--soft); color: var(--muted); }
.pill.ok { color: var(--ok); } .pill.bad { color: var(--bad); } .pill.warn { color: var(--warn); }
.pill .d { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; vertical-align: -2px; margin-right: 6px; }
.speaking { color: var(--ok); font-weight: 700; animation: blink .8s infinite; }
@keyframes blink { 50% { opacity: .4; } }

.devgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.dev { position: relative; border: 1px solid var(--line); border-radius: 10px; padding: 12px; padding-right: 40px; display: flex; flex-direction: column; gap: 4px; }
.dev.off { opacity: .5; }
.dev.talk { border-color: var(--ok); box-shadow: 0 0 0 3px #16a34a22; }
.dev b { font-size: 14px; }

.feed { display: flex; flex-direction: column; max-height: 420px; overflow: auto; }
.feed div { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; }
.feed time { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 60px; }
.feed .emergency { color: var(--bad); font-weight: 700; }

form.stack, .stack { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 5px; font-weight: 550; font-size: 13px; }
label.inline { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
textarea { min-height: 70px; resize: vertical; }
input[type=color] { padding: 2px; height: 36px; width: 60px; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; max-height: 160px; overflow: auto; }
.row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 120px; }
.hint { color: var(--muted); font-size: 12px; font-weight: 400; }
.rule { border: 1px dashed var(--line); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }

dialog { border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(620px, 94vw); background: var(--panel); color: var(--text); }
dialog::backdrop { background: #0007; }
dialog form { padding: 20px; display: flex; flex-direction: column; gap: 12px; max-height: 86vh; overflow: auto; }
dialog .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; position: sticky; bottom: -20px; background: var(--panel); padding: 10px 0; }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 10px; }
.bars div { flex: 1; background: var(--accent); border-radius: 4px 4px 0 0; position: relative; min-height: 2px; }
.bars div span { position: absolute; top: -18px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--muted); }
.bars-x { display: flex; gap: 6px; } .bars-x span { flex: 1; text-align: center; font-size: 10px; color: var(--muted); }

.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 10px; box-shadow: 0 8px 24px #0003; max-width: 360px; }
.toast.bad { background: var(--bad); color: #fff; }
.empty { color: var(--muted); padding: 10px 0; }



/* v0.3: Geräte einrichten */
.main-col { min-width: 0; display: flex; flex-direction: column; }
.adopt { background: var(--accent-soft); border-bottom: 1px solid var(--accent); padding: 10px 28px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; z-index: 5; }
.adopt-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.adopt-row .spacer { flex: 1; }
.pulse-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 #ea580c88; } 100% { box-shadow: 0 0 0 10px #ea580c00; } }
.adopt-info { display: flex; gap: 14px; align-items: center; border: 1px dashed var(--accent); border-radius: 10px; padding: 12px; background: var(--accent-soft); }
.adopt-info .code { display: block; font-size: 28px; letter-spacing: .2em; color: var(--accent); font-variant-numeric: tabular-nums; }
.adopt-info .hint { flex: 1; }

/* v0.4: Zahnrad in Gerätekarten */
.gear { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.gear:hover, .gear:focus-visible { border-color: var(--line); background: var(--soft); color: var(--text); }
.dev.off .gear { opacity: 1; }
.dev.off { opacity: 1; } .dev.off > *:not(.gear) { opacity: .5; }

/* v0.5: Schnelldurchsagen */
.quickbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.qbtn { font: inherit; font-weight: 650; cursor: pointer; border: 1px solid var(--qc); color: var(--text); background: color-mix(in srgb, var(--qc) 14%, var(--panel)); border-radius: 10px; padding: 10px 14px; border-left-width: 4px; }
.qbtn:hover { background: color-mix(in srgb, var(--qc) 24%, var(--panel)); }
.qbtn:disabled { opacity: .5; cursor: default; }
details summary { cursor: pointer; }

/* v0.6: Navigation mit Reitern, Filialen */
.site-pick { gap: 4px; }
.site-pick select { font-weight: 600; }
.badge.warn { background: var(--warn); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; margin: -6px 0 2px; scrollbar-width: thin; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; cursor: pointer; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.banner { display: flex; align-items: center; gap: 16px; justify-content: space-between; border-color: var(--accent); background: var(--accent-soft); flex-wrap: wrap; }
.banner p { margin: 4px 0 0; }
.g5 { grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); }
.stat.link { text-decoration: none; color: inherit; }
.dev.alarm { border-color: var(--bad); box-shadow: 0 0 0 3px #dc262622; }
b.bad, .bad { color: var(--bad); }
.code-sm { font-size: 16px; letter-spacing: .15em; color: var(--accent); font-variant-numeric: tabular-nums; }
code.wrap { display: block; word-break: break-all; padding: 6px 8px; }
ol.steps, ul.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--text); }

/* Suche und Filter */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px; }
.filters input[type=search] { flex: 1 1 240px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: 13px; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 99px; padding: 5px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip .n { color: var(--muted); font-size: 11px; }
.chip .x { border: 0; background: none; color: inherit; cursor: pointer; font-size: 15px; padding: 0 0 0 2px; line-height: 1; }
.chips.big .chip { font-size: 14px; padding: 7px 14px; }

/* Wartung */
.meter { display: inline-block; vertical-align: middle; width: 90px; height: 8px; border-radius: 99px; background: var(--soft); overflow: hidden; margin-right: 6px; }
.meter span { display: block; height: 100%; background: var(--ok); }
.meter span.warn { background: var(--warn); } .meter span.bad { background: var(--bad); }

/* Sensor-Verlauf */
dialog.wide { width: min(760px, 96vw); }
svg.chart { width: 100%; height: auto; background: var(--soft); border-radius: 10px; }
svg.chart .val { fill: none; stroke: var(--accent); stroke-width: 2; }
svg.chart .lim { stroke: var(--bad); stroke-dasharray: 4 4; }
svg.chart .lbl { font-size: 10px; fill: var(--muted); }

/* QR-Klingeln, Filial-Code */
.qr-thumb { width: 64px; height: 64px; border-radius: 6px; background: #fff; display: block; }
.codebox { display: flex; align-items: center; gap: 14px; border: 1px dashed var(--accent); background: var(--accent-soft); border-radius: 10px; padding: 10px 14px; margin: 10px 0; flex-wrap: wrap; }
.codebox b { font-size: 26px; letter-spacing: .18em; color: var(--accent); font-variant-numeric: tabular-nums; }
.linkqr { display: flex; gap: 14px; align-items: flex-start; margin: 10px 0; }
.linkqr img { width: 132px; height: 132px; background: #fff; border-radius: 8px; flex: none; }
table.hours td { padding: 4px 6px; border: 0; }
table.hours input { padding: 5px 8px; }

/* Lageplan */
.planwrap { display: grid; grid-template-columns: 1fr 220px; gap: 14px; margin-top: 12px; }
.plan { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; user-select: none; touch-action: none; }
.plan img { display: block; width: 100%; height: auto; pointer-events: none; }
.mk { position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 4px; background: var(--panel); border: 2px solid var(--ok); border-radius: 99px; padding: 2px 8px 2px 3px; font-size: 12px; font-weight: 600; cursor: grab; box-shadow: 0 2px 8px #0003; white-space: nowrap; z-index: 1; }
.mk .ico { width: 20px; height: 20px; display: grid; place-items: center; font-size: 13px; }
.mk.off, .mk.sleep { border-color: var(--muted); opacity: .8; }
.mk.call, .mk.alarm { border-color: var(--bad); background: #fee2e2; color: #7f1d1d; animation: mkpulse 1s infinite; z-index: 2; }
.mk.speaking { border-color: var(--accent); }
.mk .x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 0 0 0 4px; line-height: 1; }
@keyframes mkpulse { 50% { box-shadow: 0 0 0 10px #dc262600; } 0% { box-shadow: 0 0 0 0 #dc2626aa; } }
.palette { display: flex; flex-direction: column; gap: 8px; }
.pal { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow: auto; }
.pi { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; cursor: grab; display: flex; gap: 6px; align-items: center; font-size: 13px; background: var(--panel); }
.pi.armed { border-color: var(--accent); background: var(--accent-soft); }
.empty-plan { border: 2px dashed var(--line); border-radius: 12px; padding: 30px; text-align: center; color: var(--muted); margin-top: 12px; }

/* Assistent */
.wizsteps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0; flex-wrap: wrap; counter-reset: s; }
.wizsteps li { counter-increment: s; padding: 8px 12px; border-radius: 99px; background: var(--soft); color: var(--muted); font-weight: 600; font-size: 13px; }
.wizsteps li::before { content: counter(s) ". "; }
.wizsteps li.on { background: var(--accent); color: #fff; }
.wizsteps li.done { background: var(--accent-soft); color: var(--accent); cursor: pointer; }
.wizfoot { align-items: center; }
.wizfoot .spacer, .row .spacer { flex: 1; min-width: 0; }
.wizfoot > .btn { flex: 0 0 auto; min-width: 0; }

@media (max-width: 800px) {
  .planwrap { grid-template-columns: 1fr; }
  .linkqr { flex-direction: column; }
}

/* v0.6.1: Listenzeilen mit Knöpfen, Schnelldurchsagen nach Art, Aufnahme */
.listrow { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.listrow:last-child { border-bottom: 0; }
.listrow .lr-text { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }
.listrow .lr-actions { flex: 0 0 auto; display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.listrow.urgent .lr-text b { color: var(--bad); }
.quickbar { flex-direction: column; flex-wrap: nowrap; gap: 12px; }
.qgroup { display: flex; flex-direction: column; gap: 6px; }
.qlabel { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.qlabel .hint { text-transform: none; letter-spacing: 0; font-weight: 400; }
.qbtns { display: flex; flex-wrap: wrap; gap: 8px; }
.qmic { margin-right: 6px; font-size: 12px; }
.rec-cur { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.rec-cur audio { height: 34px; flex: 1 1 200px; }
.rec-box { display: flex; flex-direction: column; gap: 10px; }
.rec-text { margin: 0; padding: 12px 14px; border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 8px; font-size: 16px; }
.rec-ctl > * { flex: 0 0 auto; min-width: 0; }
.rec-meter { height: 8px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.rec-meter span { display: block; height: 100%; width: 0; background: var(--ok); transition: width .05s; }
#rec-prev { width: 100%; }

/* v0.7: Lizenz-Hinweis */
.licbar { padding: 9px 28px; font-size: 13px; border-bottom: 1px solid var(--line); background: var(--soft); }
.licbar.info { background: var(--soft); color: var(--muted); }
.licbar.warn { background: #fef3c7; color: #78350f; border-color: #f59e0b; }
.licbar.bad { background: #fee2e2; color: #7f1d1d; border-color: var(--bad); }
.licbar a { color: inherit; font-weight: 600; margin-left: 6px; }
@media (prefers-color-scheme: dark) { .licbar.warn { background: #3a2a0a; color: #fcd34d; } .licbar.bad { background: #3a1414; color: #fecaca; } }

/* Handy einbinden */
.enroll { display: grid; grid-template-columns: minmax(200px, 300px) 1fr; gap: 20px; align-items: start; }
.enroll-qr svg { width: 100%; height: auto; background: #fff; border-radius: 8px; padding: 8px; }
.enroll p { margin: 0 0 8px; }
@media (max-width: 700px) { .enroll { grid-template-columns: 1fr; } }
.pill.key { background: transparent; padding: 0 2px; }

.enroll-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.pickbtn { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 18px; border: 1px solid var(--line, #e5e7eb); border-radius: 12px; background: var(--panel, #fff); cursor: pointer; font: inherit; color: inherit; }
.pickbtn:hover { border-color: #f97316; box-shadow: 0 0 0 3px #f9731622; }
.pickbtn .ico { font-size: 28px; } .pickbtn b { font-size: 16px; } .pickbtn span:last-child { font-size: 13px; opacity: .75; line-height: 1.4; }
@media (max-width: 600px) { .enroll-pick { grid-template-columns: 1fr; } }
.enroll .row { display: flex; gap: 12px; align-items: center; }
.enroll-qr p { text-align: center; margin-top: 6px; }

.codes { font: 600 17px/1.7 ui-monospace, monospace; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 16px; columns: 2; }

.updbox { border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px 14px; margin: 10px 0; background: #f8fafc; }
.updbox.new { border-color: #f97316; background: #fff7ed; }
.updbox.warn { border-color: #f59e0b; background: #fffbeb; }
.banner.demo .row > .btn { flex: 0 1 auto; white-space: normal; text-align: left; }

/* 1.3: Navigation mit Symbolen, Handy-Seitenleiste, Expertenmodus, Tabellen als Karten */
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.side { width: 232px; overflow-y: auto; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-head .brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side nav a { justify-content: flex-start; gap: 11px; }
.side nav a > span:first-of-type { flex: 1; }
.side nav a .ic { opacity: .85; }
.side nav a.on .ic { opacity: 1; }
.side-links { display: flex; flex-direction: column; gap: 2px; }
.side-links a { padding: 7px 12px; border-radius: 8px; text-decoration: none; color: var(--muted); font-size: 13px; font-weight: 550; }
.side-links a:hover { background: var(--soft); color: var(--text); }
.acct { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; text-decoration: none; border: 1px solid var(--line); }
.acct:hover, .acct.on { background: var(--soft); }
.acct-t { display: flex; flex-direction: column; min-width: 0; }
.acct-t b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; flex: none; }
.foot-links { display: flex; justify-content: space-between; gap: 8px; padding: 0 4px; }
.foot-links a { text-decoration: none; } .foot-links a:hover { text-decoration: underline; }
.iconbtn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); display: grid; place-items: center; cursor: pointer; position: relative; flex: none; }
.iconbtn:hover { background: var(--soft); }
.iconbtn .dot { position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); border: 2px solid var(--panel); }
.side-close, .topbar, .scrim { display: none; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.toolbar input[type=search] { flex: 1 1 260px; max-width: 420px; margin-right: auto; }
.row.tight { align-items: center; }
.row.tight > * { flex: 0 0 auto; min-width: 0; }
.narrow { max-width: 520px; width: 100%; }
table.kv td:first-child { color: var(--muted); white-space: nowrap; width: 1%; padding-right: 16px; }
details > summary { padding: 2px 0; }
details[open] > summary { margin-bottom: 10px; }
.card > h2:last-child, .card > details > summary b { margin: 0; }
.switch { display: inline-flex; flex-direction: row; align-items: center; gap: 9px; font-weight: 550; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .sw { width: 36px; height: 20px; border-radius: 99px; background: var(--line); position: relative; transition: background .15s; flex: none; }
.switch .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #0003; transition: transform .15s; }
.switch input:checked + .sw { background: var(--accent); }
.switch input:checked + .sw::after { transform: translateX(16px); }
.switch input:focus-visible + .sw { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch:has(input:checked) { color: var(--text); }
.page > .head h1 { margin-right: auto; }
.tabs { margin-top: -4px; }

@media (max-width: 900px) {
  .app { display: block; }
  .topbar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 20; background: var(--panel); border-bottom: 1px solid var(--line); padding: 8px 12px; }
  .topbar .brand { min-width: 0; } .topbar .brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side { position: fixed; top: 0; left: 0; bottom: 0; height: 100%; width: min(290px, 86vw); z-index: 40; transform: translateX(-102%); transition: transform .22s ease; box-shadow: 0 0 40px #0004; }
  body.nav-open .side { transform: none; }
  body.nav-open { overflow: hidden; }
  .side-close { display: grid; }
  .scrim { display: block; position: fixed; inset: 0; background: #0006; z-index: 30; }
  .page { padding: 16px 16px 48px; gap: 14px; }
  .adopt, .licbar { padding-left: 16px; padding-right: 16px; }
  .adopt { top: 57px; }
  .card { padding: 14px; }
  h1 { font-size: 20px; }
  .toolbar { justify-content: stretch; }
  .toolbar > .btn { flex: 1 1 auto; justify-content: center; }
  .toolbar input[type=search] { max-width: none; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }

/* Tabellen werden auf schmalen Bildschirmen zu Karten */
@media (max-width: 700px) {
  table.rows thead { display: none; }
  table.rows, table.rows tbody, table.rows tr, table.rows td { display: block; width: 100%; }
  table.rows tr { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
  table.rows td { border: 0; padding: 3px 0; }
  table.rows td.lead { padding-bottom: 6px; font-size: 15px; }
  table.rows td[data-label] { display: flex; gap: 12px; justify-content: space-between; align-items: baseline; }
  table.rows td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; flex: none; }
  table.rows td[data-label]:empty, table.rows td.actions:empty { display: none; }
  table.rows td.actions { text-align: left; white-space: normal; padding-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
  table.rows td.actions .btn { margin: 0; }
  table.rows td.empty { text-align: center; }
  .tablewrap { overflow: visible; }
  .filters > select { flex: 1 1 140px; }
  .head h2 { margin: 0; }
  .feed { max-height: 300px; }
  .devgrid { grid-template-columns: 1fr 1fr; }
  .enroll-pick { grid-template-columns: 1fr; }
  dialog form { padding: 16px; }
  .codebox b { font-size: 22px; }
}
@media (max-width: 420px) { .devgrid { grid-template-columns: 1fr; } }
label.check { align-items: flex-start; }
label.check input { margin-top: 1px; }
label.check > span { display: flex; flex-direction: column; gap: 2px; }
form.stack > .btn, .card > .stack > .btn { align-self: flex-start; }
table.kv { table-layout: fixed; }
table.kv td { overflow-wrap: anywhere; }
table.kv td:first-child { width: 34%; white-space: normal; }
@media (max-width: 700px) { form.stack > .btn { align-self: stretch; justify-content: center; } }
.card.stack > h2 { margin: 0; }
@media (max-width: 700px) {
  .dash-dev { order: 2; }
  .g4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .g4 > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stat b { font-size: 24px; }
}
.head h2 { margin: 0; }
