/* NetDoc – Arbeitslayout. Grundwerte hier, Design 2026 („Pillen-Look“) am Ende der Datei. Hell/Dunkel automatisch. */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --border: #dde3e8;
  --text: #1c2630;
  --muted: #66727e;
  --primary: #1f5f8b;
  --primary-hover: #184c70;
  --primary-soft: #e3eef6;
  --danger: #b4372f;
  --danger-soft: #fbe9e7;
  --success: #2c7a4b;
  --success-soft: #e5f4ea;
  --warn-soft: #fff4dc;
  --topbar: #16324a;
  --topbar-text: #e6eef5;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 32, 48, .06), 0 1px 1px rgba(16, 32, 48, .04);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f151b; --surface: #172029; --surface-2: #1b2631; --border: #2a3744; --text: #e3e9ef;
    --muted: #8d9aa7; --primary: #5aa3d6; --primary-hover: #77b6e3; --primary-soft: #1c3346;
    --danger: #e0766d; --danger-soft: #3a1f1d; --success: #6cc493; --success-soft: #1b3326;
    --warn-soft: #3a3020; --topbar: #0b1824; --topbar-text: #dbe6f0; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.btn:disabled { opacity: .45; cursor: default; }
html { font-size: 15px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.45;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; margin: 0 0 .2rem; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; font-weight: 650; }
h2.mt { margin-top: 1.4rem; }
.muted { color: var(--muted); }
.small { font-size: .87rem; }
.right { text-align: right; }
.center { text-align: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.prewrap { white-space: pre-wrap; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: .2rem 0; }

/* ---------------------------------------------------------------- Topbar */
.topbar {
  display: flex; align-items: center; gap: 1.5rem; padding: 0 1.25rem; height: 54px;
  background: var(--topbar); color: var(--topbar-text); position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: .5rem; color: #fff; font-weight: 700; font-size: 1.1rem; }
.brand:hover { text-decoration: none; }
.brand svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.mainnav { display: flex; gap: .25rem; }
.mainnav a { color: var(--topbar-text); padding: .45rem .75rem; border-radius: 6px; opacity: .85; }
.mainnav a:hover { background: rgba(255,255,255,.08); text-decoration: none; opacity: 1; }
.mainnav a.active { background: rgba(255,255,255,.14); opacity: 1; }
.topsearch { flex: 1; max-width: 420px; margin-left: auto; }
.topsearch input {
  width: 100%; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.08); color: #fff;
  padding: .45rem .75rem; border-radius: 6px;
}
.topsearch input::placeholder { color: rgba(255,255,255,.55); }
.usermenu { display: flex; align-items: center; gap: .9rem; white-space: nowrap; }
.usermenu a { color: var(--topbar-text); display: flex; flex-direction: column; line-height: 1.1; }
.usermenu small { opacity: .65; font-size: .75rem; }
.usermenu .btn-link { color: var(--topbar-text); opacity: .8; }

/* ---------------------------------------------------------------- Layout */
.container { max-width: 1180px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.container.wide { max-width: none; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.pagehead p { margin: .2rem 0 0; }
.actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.actions form { margin: 0; }
.crumb { font-size: .9rem; display: inline-block; margin-bottom: .25rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.15rem 1.25rem; box-shadow: var(--shadow); }
.card + .card { margin-top: 1.25rem; }
.grid-2 > .card + .card { margin-top: 0; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty h1, .empty h2 { color: var(--text); }
.error-code { font-size: 3rem; font-weight: 700; margin: 0; color: var(--border); }

/* ---------------------------------------------------------------- Auth */
body.auth { display: grid; place-items: center; min-height: 100vh; background: linear-gradient(160deg, var(--topbar), #24557a); }
.auth-box { width: min(400px, calc(100% - 2rem)); background: var(--surface); border-radius: 12px; padding: 2rem; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.auth-box h1 { margin-bottom: .75rem; }

/* ---------------------------------------------------------------- Forms */
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 550; font-size: .92rem; }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 500; align-self: end; padding-bottom: .5rem; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: .5rem .65rem; font-weight: 400;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
textarea { resize: vertical; }
.stack { display: flex; flex-direction: column; gap: .9rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.25rem; }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: .5rem; margin-top: .5rem; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: .75rem 0; }
.hint { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: .7rem .9rem; font-size: .88rem; color: var(--muted); }
.hint strong { color: var(--text); }
form.inline { display: inline; }

.btn {
  display: inline-flex; align-items: center; gap: .35rem; font: inherit; font-weight: 550; cursor: pointer;
  padding: .48rem .95rem; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-small { padding: .25rem .6rem; font-size: .87rem; }
.btn-link { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; }
.btn-link:hover { text-decoration: underline; }

.flash { padding: .7rem 1rem; border-radius: 6px; margin-bottom: 1rem; border: 1px solid transparent; }
.flash-success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.flash-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }

/* ---------------------------------------------------------------- Tags / Badges */
.tag { display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .45rem; border-radius: 99px; background: var(--primary-soft); color: var(--primary); vertical-align: middle; }
.tag-danger { background: var(--danger-soft); color: var(--danger); }
.tag-role-admin { background: var(--warn-soft); color: #8a5a00; }
@media (prefers-color-scheme: dark) { .tag-role-admin { color: #f0c36a; } }
.tag-role-readonly { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

/* ---------------------------------------------------------------- Tabellen */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th, .table td { padding: .6rem .8rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { background: var(--surface-2); font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 650; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table th.num, .table td.num { text-align: right; }
.table th.center, .table td.center { text-align: center; }
tr.inactive td { opacity: .55; }
.card .table { box-shadow: none; }
.filterbar { margin-bottom: .75rem; display: flex; gap: .5rem; flex-wrap: wrap; }
.filterbar input[type=search] { width: min(360px, 100%); }

.matrix-wrap { overflow-x: auto; border-radius: var(--radius); }
.matrix th { text-transform: none; letter-spacing: 0; font-size: .85rem; white-space: nowrap; }
.matrix td:first-child, .matrix th:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 220px; }
.matrix select { padding: .2rem .35rem; min-width: 3.2rem; text-align: center; }
.matrix td.changed { background: var(--warn-soft); }
select.lvl-read { background: var(--primary-soft); }
select.lvl-write { background: var(--success-soft); }

/* ---------------------------------------------------------------- Tabs */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; flex-wrap: wrap; }
.tabs a, .tabs .tab-disabled { padding: .6rem .95rem; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--muted); font-weight: 550; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs .tab-disabled { opacity: .45; cursor: not-allowed; }

/* Standortauswahl oberhalb der Reiter */
.site-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: 0 0 .75rem; }
.site-bar-label { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-right: .25rem; }
.site-pill { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .75rem; border: 1px solid var(--border); border-radius: 99px; color: var(--text); font-weight: 550; font-size: .9rem; background: var(--surface, transparent); }
.site-pill:hover { text-decoration: none; border-color: var(--primary); }
.site-pill.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.site-pill.active .count { background: rgba(255,255,255,.25); color: #fff; }
.site-pill-none:not(.active) { border-style: dashed; color: var(--muted); }
.site-manage { margin-left: auto; }
.site-address { margin: -.4rem 0 .75rem; }
.site-table tr.is-current td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.site-assign, .lex-address { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .75rem; padding: .6rem .75rem; border: 1px dashed var(--border); border-radius: 8px; }
.site-assign select { width: auto; min-width: 0; }
.lex-address > div { flex: 1 1 14rem; min-width: 0; }
.lex-addresses { margin-top: .75rem; }
.lex-addresses .lex-address { margin-top: .5rem; }
.site-target { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.site-target select { width: auto; }
.tag-site { background: transparent; border: 1px solid var(--border); color: var(--muted); font-weight: 500; }

/* ---------------------------------------------------------------- Key/Value */
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- Auswahl (neue Kundendoku) */
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.25rem; }
.choice { display: flex; flex-direction: column; gap: .25rem; padding: 1rem 1.15rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.choice-active { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.choice-disabled { opacity: .55; }

/* ---------------------------------------------------------------- Suche */
.searchbar { display: flex; gap: .5rem; margin-bottom: 1rem; }
.searchbar input { flex: 1; font-size: 1.05rem; }
.result-list { list-style: none; margin: 0; padding: 0; }
.result-list li { padding: .55rem 0; border-bottom: 1px solid var(--border); display: flex; gap: .75rem; align-items: baseline; flex-wrap: wrap; }
.result-list li:last-child { border-bottom: 0; }

/* ---------------------------------------------------------------- Audit */
.audit-list { list-style: none; margin: 0; padding: 0; }
.audit-list.card { padding: 0 1.25rem; }
.audit-entry { padding: .8rem 0; border-bottom: 1px solid var(--border); }
.audit-entry:last-child { border-bottom: 0; }
.audit-head { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
.audit-meta { font-size: .82rem; color: var(--muted); margin-top: .15rem; display: flex; gap: .75rem; flex-wrap: wrap; }
.audit-meta .btn-link { font-size: .82rem; }
.badge { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: .12rem .45rem; border-radius: 4px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge-create, .badge-undelete { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge-update, .badge-access_change, .badge-restore { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.badge-delete, .badge-login_failed { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-secret_view { background: var(--warn-soft); color: #8a5a00; border-color: transparent; }
table.changes { margin-top: .45rem; font-size: .86rem; border-collapse: collapse; }
table.changes th { text-align: left; font-weight: 550; color: var(--muted); padding: .12rem 1rem .12rem 0; vertical-align: top; }
table.changes td { padding: .12rem .4rem; vertical-align: top; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 420px; }
table.changes .old { color: var(--danger); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--danger) 40%, transparent); }
table.changes .new { color: var(--success); }
table.changes .old .muted { text-decoration: none; color: var(--muted); }
table.changes .old:has(.muted) { text-decoration: none; }
table.changes .arrow { color: var(--muted); }
.filters select { min-width: 160px; }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin-top: 1rem; }

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; height: auto; padding: .6rem 1rem; gap: .6rem 1rem; }
  .topsearch { order: 5; max-width: none; flex-basis: 100%; }
  .mainnav { order: 4; flex-basis: 100%; overflow-x: auto; white-space: nowrap; }
  .usermenu { margin-left: auto; }
  .grid-2, .form-grid, .choice-row { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .table { display: block; overflow-x: auto; }
}

/* ================================================================ Etappe (b): Geräte */
.ico { vertical-align: -3px; flex-shrink: 0; }
.with-icon { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.count { display: inline-block; min-width: 1.4em; padding: 0 .4em; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); font-size: .75rem; font-weight: 600; color: var(--muted); text-align: center; }
.mt-section { margin-top: 1.25rem; }
.flash-warning { background: var(--warn-soft); color: #7a5300; border-color: color-mix(in srgb, #c78a00 30%, transparent); }
@media (prefers-color-scheme: dark) { .flash-warning { color: #f0c36a; } }
code { font-family: var(--mono); font-size: .9em; }

.quick-add { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: 1rem; }
.quick-add .btn { gap: .3rem; }
.device-group { padding: 0; overflow: hidden; }
.device-group + .device-group { margin-top: 1rem; }
.group-head { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1.1rem; border-bottom: 1px solid var(--border); }
.group-head h2 { margin: 0; font-size: 1rem; }
.device-table { border: 0; border-radius: 0; box-shadow: none; }
.device-table th:first-child, .device-table td:first-child { padding-left: 1.1rem; }
.device-table td { vertical-align: top; }
.device-table tr.nested td { background: var(--surface-2); }
.device-table tr.nested .name-cell { padding-left: 2.2rem; }
.nest { color: var(--muted); margin-right: .3rem; }
.add-child { margin-left: .6rem; font-size: .8rem; opacity: .75; }
.add-child:hover { opacity: 1; }
.name-cell { white-space: nowrap; }

.secret { display: inline-flex; align-items: center; gap: .2rem; white-space: nowrap; }
.secret-value { letter-spacing: .05em; }
.secret.revealed .secret-value { background: var(--warn-soft); padding: .05rem .35rem; border-radius: 4px; letter-spacing: 0; }
.btn-icon { background: none; border: 1px solid transparent; border-radius: 4px; padding: .05rem .35rem; font: inherit; font-size: .78rem; color: var(--primary); cursor: pointer; }
.btn-icon:hover { border-color: var(--border); background: var(--surface-2); }
.secret-input { display: flex; gap: .25rem; align-items: center; }
.secret-input input { flex: 1; }
.device-form .card + .card { margin-top: 1rem; }
.device-form h2 { margin-bottom: .2rem; }
.extra-rows { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .75rem; }
.extra-row { display: grid; grid-template-columns: 1fr 1.5fr auto auto; gap: .5rem; align-items: center; }
.extra-row label.check { padding: 0; align-self: center; }
.inline-form { margin: 0; }
.inline-label { flex-direction: row; align-items: center; gap: .5rem; }

.class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .75rem; }
.class-tile { display: flex; align-items: center; gap: .7rem; padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.class-tile:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.class-summary { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.class-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .65rem; border: 1px solid var(--border); border-radius: 99px; color: var(--text); background: var(--surface-2); font-size: .9rem; }
.class-chip:hover { border-color: var(--primary); text-decoration: none; }
.device-mini li { display: flex; align-items: center; gap: .4rem; }
details > summary { cursor: pointer; font-weight: 600; }
details.card > summary { list-style: none; }
details[open] > summary { margin-bottom: .6rem; }

#toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--topbar); color: #fff; padding: .6rem 1rem; border-radius: 6px; opacity: 0; transition: .2s; pointer-events: none; z-index: 50; }
#toast.show { opacity: 1; transform: translateX(-50%); }

.classes-layout { display: grid; grid-template-columns: 240px 1fr; gap: 1.25rem; align-items: start; }
.class-nav { display: flex; flex-direction: column; gap: .15rem; padding: .6rem; }
.class-nav a { display: flex; align-items: center; gap: .5rem; padding: .45rem .6rem; border-radius: 6px; color: var(--text); }
.class-nav a .count { margin-left: auto; }
.class-nav a:hover { background: var(--surface-2); text-decoration: none; }
.class-nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.class-nav a.inactive { opacity: .5; }
.new-class { margin-top: .6rem; padding: .3rem .2rem; }
.new-class summary { display: inline-flex; }
.new-class form { margin-top: .6rem; }
h3 { font-size: .95rem; margin: 0 0 .5rem; }
h3.mt { margin-top: 1.3rem; }
.w-num { width: 5.5rem; }
.add-field { border-top: 1px solid var(--border); margin-top: 1.3rem; padding-top: 1rem; }
.add-field-row { display: grid; grid-template-columns: 2fr 1.4fr 1.4fr auto; gap: .75rem; align-items: end; }
@media (max-width: 860px) {
  .classes-layout, .add-field-row, .extra-row { grid-template-columns: 1fr; }
}

table.changes.created .old, table.changes.created .arrow { display: none; }
.add-field-row .btn { white-space: nowrap; }

/* ================================================================ Etappe (c): Import */
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 1.6rem 1rem; text-align: center; background: var(--surface-2); cursor: pointer; font-weight: 500; }
.dropzone:hover { border-color: var(--primary); }
.dropzone input { margin: 0 auto .5rem; }
ol.steps { padding-left: 1.2rem; margin: 0 0 1rem; }
ol.steps li { margin-bottom: .4rem; }
.import-toolbar { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center; padding: .7rem 1rem; margin-bottom: .9rem; position: sticky; top: 54px; z-index: 5; }
.tb-group { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.tb-group label.check { padding: 0; }
.import-table td { vertical-align: top; }
.import-table tr.st-unknown td { opacity: .6; }
.import-table tr.is-selected td { background: color-mix(in srgb, var(--primary-soft) 45%, transparent); }
.import-table tr.is-ambiguous td { background: var(--warn-soft); }
.import-table tr.is-known:not(.is-selected) td { opacity: .65; }
.import-table .name-input { width: 100%; min-width: 150px; padding: .3rem .5rem; }
.import-table .class-select { padding: .3rem .4rem; min-width: 180px; }
.import-table .hints div { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-table .reason { margin-top: .2rem; max-width: 240px; }
.tag-new { background: var(--success-soft); color: var(--success); }
.tag-changed { background: var(--warn-soft); color: #8a5a00; }
.tag-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

.rules-table input:not([type=checkbox]), .rules-table select { width: 100%; padding: .3rem .45rem; }
.rules-table .w-num { width: 5rem; }
.rules-table tr.new-rule td { background: var(--success-soft); }

/* Verwaltungsmenü */
.navmenu { position: relative; }
.navmenu summary { list-style: none; cursor: pointer; color: var(--topbar-text); padding: .45rem .75rem; border-radius: 6px; opacity: .85; font-weight: 400; }
.navmenu summary::-webkit-details-marker { display: none; }
.navmenu summary::after { content: " ▾"; font-size: .8em; }
.navmenu summary:hover, .navmenu[open] summary { background: rgba(255,255,255,.08); opacity: 1; }
.navmenu.active summary { background: rgba(255,255,255,.14); opacity: 1; }
.navmenu-list { position: absolute; top: calc(100% + 6px); left: 0; min-width: 190px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.15); padding: .35rem; z-index: 20; display: flex; flex-direction: column; }
.navmenu-list a { color: var(--text); padding: .5rem .7rem; border-radius: 6px; opacity: 1; }
.navmenu-list a:hover { background: var(--surface-2); text-decoration: none; }

/* ================================================================ Etappe (d): Netzwerkplan */
.netmap-toolbar { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .6rem 1rem; margin-bottom: .8rem; }
.netmap-body { display: grid; grid-template-columns: 1fr 290px; gap: 1rem; align-items: stretch; }
.netmap-canvas { padding: 0; height: 72vh; min-height: 480px; position: relative; overflow: hidden; background: var(--bg); }
.nm-cy { position: absolute; inset: 0; }
.nm-empty { position: absolute; inset: 0; display: grid; place-items: center; }
.netmap-panel h2 { overflow-wrap: anywhere; }
.nm-banner { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.nm-banner form { margin: 0; }
.flash-unifi { background: var(--primary-soft); color: var(--text); border-color: color-mix(in srgb, var(--primary) 25%, transparent); }
.nm-unifi-table { margin: .5rem 0; background: var(--surface); }
.nm-unifi-table td { vertical-align: top; }
.nm-unifi-table .tag-changed { background: var(--warn-soft); color: #7a5300; }
.nm-suggest-list { flex-basis: 100%; }
.nm-suggest-list ul { margin: .4rem 0 0; columns: 2; }
.nm-legend { list-style: none; padding: 0; margin: 0; }
.nm-legend li { display: flex; align-items: center; gap: .6rem; padding: .2rem 0; }
.nm-multi-list { padding-left: 1.1rem; margin: .3rem 0 .8rem; max-height: 14rem; overflow: auto; }
.netmap-toolbar .btn.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }
.ln { display: inline-block; width: 34px; border-top: 2px solid var(--muted); }
.ln-parent { border-top-style: dashed; }
.ln-internet { border-top-style: dotted; }
.print-only { display: none; }
@media (max-width: 960px) { .netmap-body { grid-template-columns: 1fr; } .netmap-canvas { height: 60vh; } }

@media print {
  body { background: #fff; }
  .topbar, .tabs, .site-bar, .pagehead .actions, .netmap-toolbar, .netmap-body, .nm-banner, .flash, .crumb { display: none !important; }
  .container { max-width: none; padding: 0; }
  .print-only { display: block !important; }
  #print-area img { max-width: 100%; max-height: 85vh; display: block; margin: 1rem auto; }
  .pagehead { display: none; }
}

/* ================================================================ Etappe (e): Anhänge */
.upload-form { display: flex; flex-direction: column; gap: .7rem; }
.upload-form p { margin: 0; }
.small-drop { padding: 1rem; }
.upload-meta { display: grid; grid-template-columns: 2fr 1.3fr auto; gap: .75rem; align-items: end; }
.attachment-table td { vertical-align: top; }
.file-cell { overflow-wrap: anywhere; min-width: 220px; }
.file-kind { display: inline-block; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: .08rem .4rem; border-radius: 4px; margin-right: .4rem; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); vertical-align: 1px; }
.kind-pdf { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.kind-bild { background: var(--success-soft); color: var(--success); border-color: transparent; }
.kind-konfiguration { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.kind-archiv { background: var(--warn-soft); color: #8a5a00; border-color: transparent; }
.nowrap { white-space: nowrap; }
.row-menu { display: inline-block; position: relative; }
.row-menu summary { list-style: none; }
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu-panel { position: absolute; right: 0; top: calc(100% + 4px); z-index: 10; width: 280px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.15); padding: .8rem; display: flex; flex-direction: column; gap: .6rem; text-align: left; white-space: normal; }
@media (max-width: 860px) { .upload-meta { grid-template-columns: 1fr; } }
.attachment-table { overflow: visible; }
.attachment-table td.num { white-space: nowrap; }
.attachment-table tbody tr:last-child .row-menu-panel { top: auto; bottom: calc(100% + 4px); }
.row-menu-panel.is-floating { position: fixed; right: auto; bottom: auto; z-index: 40; overflow-y: auto; }

/* ================================================================ Etappe (f): Lexoffice */
.mb { margin-bottom: 1rem; }
.lex-card { margin-bottom: 1rem; }
.lex-input { width: 100%; font-size: 1.05rem; padding: .65rem .8rem; }
.lex-status { margin: .5rem 0; }
.lex-results { list-style: none; margin: 0; padding: 0; }
.lex-item { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .7rem 0; border-top: 1px solid var(--border); }
.lex-item form { margin: 0; }
.lex-action { flex-shrink: 0; }
.lex-manual { margin: 1rem 0 0; padding-top: .8rem; border-top: 1px solid var(--border); }
.compare-table th:first-child { width: 160px; }
.compare-table tr.is-diff td { background: color-mix(in srgb, var(--warn-soft) 55%, transparent); }
.compare-table tbody th { text-transform: none; letter-spacing: 0; font-size: .92rem; color: var(--text); background: transparent; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: var(--surface); }
.seg a { padding: .42rem .8rem; color: var(--muted); font-size: .9rem; }
.seg a + a { border-left: 1px solid var(--border); }
.seg a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.seg a:hover { text-decoration: none; }

/* ================================================================ Etappe (g): Backup */
pre.code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: .6rem .8rem; font-family: var(--mono); font-size: .82rem; overflow-x: auto; white-space: pre; margin: .3rem 0 .8rem; }
.grid-2 > * { min-width: 0; }

/* ================================================================ Netze / VLANs */
.net-table { box-shadow: none; overflow: visible; }
.net-suggest { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .8rem; }
.net-form { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.4fr) 5.5rem; gap: .6rem; align-items: end; margin-top: .6rem; }
.net-form input { width: 100%; min-width: 0; }
.net-form button { grid-column: 1 / -1; justify-self: start; }
@media (max-width: 860px) { .net-form { grid-template-columns: 1fr; } }
.nm-netmode { padding: 0 .3rem; margin: 0; }

/* ================================================================ 2FA */
.qr { width: 220px; height: 220px; background: #fff; padding: 6px; border-radius: 8px; border: 1px solid var(--border); margin: .6rem 0; }
.qr svg { width: 100%; height: 100%; display: block; }
.secret-key { font-size: 1rem; letter-spacing: .05em; word-break: break-all; }
.otp-input { font-size: 1.4rem; letter-spacing: .25em; text-align: center; font-family: var(--mono); }
.recovery-codes { columns: 2; font-size: 1.1rem; line-height: 2; padding-left: 1.6rem; }
@media print { .recovery-codes { columns: 2; } }

/* ================================================================ Zugangsdaten */
.cred-table { box-shadow: none; overflow: visible; margin-top: .3rem; }
.cred-table td { vertical-align: top; }
.cred-form { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: .6rem .9rem; margin-top: .6rem; }
.cred-form input { width: 100%; min-width: 0; }

/* ================================================================ UniFi */
.tag-unifi { background: #e8f1fd; color: #1a5fb4; }
@media (prefers-color-scheme: dark) { .tag-unifi { background: #1c3346; color: #8cc4ff; } }
.unifi-target { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: 8px; }
.unifi-target > div { min-width: 0; overflow-wrap: anywhere; }
.uplink-option { display: flex; gap: .6rem; align-items: flex-start; padding: .7rem 1rem; margin-bottom: .9rem; }
.unifi-suggest-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.unifi-table select { max-width: 100%; }
.unifi-table tr.is-mapped td:first-child { box-shadow: inset 3px 0 0 var(--primary); }

/* ================================================================ Garantie / Server-Eye */
.tag-warn { background: var(--warn-soft); color: #8a5a00; }
@media (prefers-color-scheme: dark) { .tag-warn { color: #f0c36a; } }
.warranty-table td { vertical-align: top; }
.se-system { padding: 0; overflow: visible; }
.se-system + .se-system { margin-top: 1rem; }
.se-head { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; padding: .8rem 1.1rem; border-bottom: 1px solid var(--border); }
.se-head h2 { margin: 0; font-size: 1.05rem; }
.se-body { padding: .8rem 1.1rem; display: grid; gap: .8rem; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
@media (max-width: 860px) { .se-body { grid-template-columns: minmax(0, 1fr); } }
.se-target select { width: 100%; }
.se-fields { width: 100%; border-collapse: collapse; font-size: .92rem; }
.se-fields td { padding: .3rem .4rem; border-top: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
.se-fields tr:first-child td { border-top: 0; }
.se-fields .same { color: var(--muted); }
.se-raw pre { white-space: pre-wrap; max-height: 260px; overflow: auto; }
.se-system.is-skipped { opacity: .6; }
.se-fields td:first-child { white-space: nowrap; width: 1%; }

/* Passwort-Generator */
.pwgen { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .75rem; }
.pwgen-opts summary { cursor: pointer; }
.pwgen-panel { display: flex; flex-wrap: wrap; gap: .3rem .9rem; align-items: center; margin-top: .4rem; }
.pwgen-panel select { width: auto; }
.row-menu-panel .pwgen { margin-top: -.3rem; }
.pwgen-opts[open] { flex-basis: 100%; order: 3; }
.pwgen [data-pwgen-info] { order: 2; }
.pwgen-panel label { flex-direction: row; align-items: center; gap: .35rem; white-space: nowrap; margin: 0; }
.pwgen-panel { padding: .5rem .65rem; border: 1px dashed var(--border); border-radius: 8px; }

/* Checkboxen nie strecken oder wie Textfelder gestalten (Safari zeigt sonst den Haken nicht) */
input[type=checkbox], input[type=radio] { width: auto; min-width: 0; padding: 0; margin: 0; flex: none;
  inline-size: 1.05rem; block-size: 1.05rem; accent-color: var(--primary); border: 0; background: none; }
.cred-form input[type=checkbox] { width: auto; }
/* Optionen des Passwort-Generators als Schalter mit deutlich sichtbarem Zustand */
.pwgen-chip { display: inline-flex; flex-direction: row; align-items: center; gap: .4rem; margin: 0; padding: .3rem .65rem;
  border: 1px solid var(--border); border-radius: 99px; font-size: .85rem; font-weight: 500; cursor: pointer;
  user-select: none; background: var(--surface); color: var(--muted); white-space: nowrap; }
.pwgen-chip:has(input:checked) { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.pwgen-chip input:checked + span { font-weight: 600; }
.pwgen-chip input:not(:checked) + span { text-decoration: line-through; text-decoration-color: var(--muted); }
.pwgen-chip input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.pwgen-len { flex-direction: row; align-items: center; gap: .4rem; }
/* Aufgedeckte Passwörter umbrechen statt die Tabelle zu sprengen */
.secret.revealed { display: inline-flex; flex-wrap: wrap; white-space: normal; max-width: 100%; }
.secret.revealed .secret-value { word-break: break-all; overflow-wrap: anywhere; white-space: normal; max-width: 22rem; }
.cred-table td a { overflow-wrap: anywhere; }
.cred-table td:first-child { min-width: 8rem; }

.tag-admin { background: #3a2a55; color: #f1e8ff; }
@media (prefers-color-scheme: dark) { .tag-admin { background: #d9c8f5; color: #2b1d45; } }
.admin-only-opt { align-items: flex-start; padding: .55rem .7rem; border: 1px dashed var(--border); border-radius: 8px; }
.admin-only-opt input { margin-top: .2rem; }

/* ---------------------------------------------------------------- Monitoring-Berichte */
.text-danger { color: var(--danger); }
.ampel { display: inline-block; width: .85rem; height: .85rem; border-radius: 50%; vertical-align: middle; box-shadow: 0 0 0 2px var(--surface, #fff), 0 0 0 3px var(--border); }
.ampel-green { background: #2E9E4F; }
.ampel-yellow { background: #E3A008; }
.ampel-red { background: #C8312E; }
.report-form { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.report-form label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--muted); }
.report-form select { min-width: 12rem; }
.report-table td { vertical-align: middle; }
.report-table .actions-cell { white-space: nowrap; text-align: right; }
.report-table .actions-cell .btn + .btn { margin-left: .25rem; }
.report-table .actions-cell form { margin-left: .5rem; }
.logo-preview { max-height: 56px; max-width: 220px; padding: .5rem; background: #fff; border: 1px solid var(--border); border-radius: 6px; }
.job-progress { height: .5rem; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: .4rem; }
.job-progress > span { display: block; height: 100%; background: var(--primary); }
.color-input { display: flex; gap: .4rem; align-items: center; }
.color-input input[type=color] { width: 2.6rem; height: 2.2rem; padding: .1rem; flex: none; }
.auto-form { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.auto-form label.check { align-self: center; padding: 0; }
.form-grid input[type=color] { width: 4.5rem; height: 2.4rem; padding: .2rem; cursor: pointer; }
@media (max-width: 700px) {
  .hide-sm { display: none; }
  .report-table .actions-cell { white-space: normal; }
  .report-table .actions-cell .btn { margin: .15rem 0; }
}
.threshold-form { display: flex; flex-direction: column; gap: .8rem; }
.threshold-row { display: flex; align-items: center; gap: .75rem; }
.threshold-row label { display: block; font-weight: 500; line-height: 2.4; }
.num-input { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.num-input input { width: 5.5rem; text-align: right; }

/* Handy: „Verwaltung“ klappt als Liste unter der Leiste auf (sonst vom scrollbaren Menü abgeschnitten) */
@media (max-width: 860px) {
  .mainnav { flex-wrap: wrap; overflow: visible; white-space: normal; }
  .navmenu[open] { flex-basis: 100%; }
  .navmenu-list { position: static; margin-top: .4rem; min-width: 0; box-shadow: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .15rem; }
  .navmenu-list a { padding: .6rem .7rem; }
}

/* ---------------------------------------------------------------- Handy: Tabellen als Karten */
@media (max-width: 860px) {
  .table.stackable { display: block; overflow: visible; }
  .table.stackable thead { display: none; }
  .table.stackable tbody { display: block; }
  .table.stackable tr { display: block; padding: .65rem .85rem; border-bottom: 1px solid var(--border); }
  .table.stackable tr:last-child { border-bottom: 0; }
  .table.stackable tr[hidden] { display: none !important; }
  .table.stackable td { display: block; position: relative; padding: .2rem 0 .2rem min(40%, 11rem); border: 0; text-align: left;
                        min-height: 1.5rem; overflow-wrap: anywhere; white-space: normal; background: none; }
  .table.stackable td::before { content: attr(data-label); position: absolute; left: 0; top: .28rem; width: calc(min(40%, 11rem) - .6rem);
                                color: var(--muted); font-size: .72rem; font-weight: 600; text-transform: uppercase;
                                letter-spacing: .02em; overflow-wrap: normal; }
  .table.stackable td:not([data-label]) { padding-left: 0; }
  .table.stackable td:not([data-label])::before { content: none; }
  .table.stackable td.cell-empty { display: none; }
  .table.stackable td.cell-title { font-size: 1rem; padding-bottom: .35rem; }
  .table.stackable td.num, .table.stackable td.right { text-align: left; }
  .table.stackable td input:not([type=checkbox]):not([type=radio]), .table.stackable td select { width: 100%; min-width: 0; }
  .table.stackable .actions-cell, .table.stackable td:last-child:not([data-label]) { text-align: left; padding-top: .4rem; }
  .table.stackable tr.nested { padding-left: 1.6rem; background: var(--surface-2); }
  .table.stackable tr.nested td { background: none; }
  .table.stackable tr.nested .name-cell { padding-left: 0; }
  .device-table th:first-child, .device-table td:first-child { padding-left: 0; }
  .row-menu-panel { width: min(280px, calc(100vw - 2rem)); }
}

/* Geräteklassen und Formulare: Grid-Spalten dürfen schrumpfen */
.classes-layout { grid-template-columns: 240px minmax(0, 1fr); }
.classes-layout > *, .form-grid > *, .grid-2 > * { min-width: 0; }
@media (max-width: 860px) {
  .classes-layout { grid-template-columns: minmax(0, 1fr); }
  .form-grid, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .class-nav { flex-direction: row; flex-wrap: wrap; gap: .35rem; }
  .class-nav a { border: 1px solid var(--border); padding: .35rem .6rem; font-size: .9rem; }
  .class-nav a .count { margin-left: .2rem; }
  .class-nav .new-class { flex-basis: 100%; margin-top: .3rem; }
  .pwgen-panel label, .pwgen-chip { white-space: normal; }
  .pre, pre.code { white-space: pre-wrap; overflow-wrap: anywhere; }
}

/* Kleine Handys (360 px) */
input[type=file] { max-width: 100%; min-width: 0; }
dl.kv { grid-template-columns: max-content minmax(0, 1fr); }
.searchbar > * { min-width: 0; }
.searchbar input { flex: 1 1 auto; width: auto; }
.searchbar .btn { flex: none; }
@media (max-width: 420px) {
  .table.stackable td { padding-left: 38%; }
  .table.stackable td::before { width: calc(38% - .5rem); }
}
@media (max-width: 860px) { .upload-meta { grid-template-columns: minmax(0, 1fr); } .upload-meta > *, .dropzone { min-width: 0; } }
@media (max-width: 860px) { .secret { flex-wrap: wrap; white-space: normal; max-width: 100%; } }
@media (max-width: 860px) {
  .table.stackable tr:not([hidden]) { display: flex; flex-direction: column; }
  .table.stackable td.cell-title { order: -1; }
}
@media (max-width: 860px) {
  /* Kopfleiste ist auf dem Handy 3-zeilig: nicht mitscrollen, sonst bleibt zu wenig Platz */
  .topbar { position: static; }
  .import-toolbar { position: static; }
  .sticky-actions { display: flex; flex-wrap: wrap; gap: .4rem; padding: .5rem 0; }
  .sticky-actions .btn { padding: .5rem .8rem; font-size: .92rem; }
  .matrix td:first-child, .matrix th:first-child { min-width: 140px; }
}
@media (min-width: 861px) { .classes-layout .table { display: block; overflow-x: auto; } }
.add-field-row { grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr) minmax(0, 1.4fr) auto; }
.add-field-row > * { min-width: 0; }
@media (max-width: 860px) { .add-field-row { grid-template-columns: minmax(0, 1fr); } }
.ssh-option { flex-direction: column; gap: .4rem; }
.ssh-option label.check { align-self: flex-start; padding: 0; align-items: flex-start; }

/* Status */
.plain-list { margin: .4rem 0 0; padding-left: 1.2rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.card-head h2 { margin: 0; }
.nav-alert { display: inline-grid; place-items: center; min-width: 1.15rem; height: 1.15rem; padding: 0 .25rem; border-radius: 99px;
             background: #C8312E; color: #fff; font-size: .72rem; font-weight: 700; line-height: 1; vertical-align: middle; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.report-form label.grow { flex: 1 1 18rem; }
.report-form label.grow input { width: 100%; }

/* Einsätze */
.work-form { display: grid; grid-template-columns: 10rem 9rem minmax(0, 1fr) minmax(0, 1fr); gap: .75rem 1rem; align-items: end; }
.work-form .span-2 { grid-column: span 2; }
.work-form .span-all { grid-column: 1 / -1; }
.work-form label.check { padding-bottom: .55rem; }
@media (max-width: 860px) { .work-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .work-form .span-2 { grid-column: 1 / -1; } }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg a { padding: .35rem .8rem; color: var(--text); font-size: .9rem; }
.seg a + a { border-left: 1px solid var(--border); }
.seg a.active { background: var(--primary); color: #fff; }
.seg a:hover { text-decoration: none; }
.nowrap { white-space: nowrap; }
.pre-line { white-space: pre-line; }
.doc-menu .row-menu-panel { width: 300px; }
.work-mini li { padding: .4rem 0; border-bottom: 1px solid var(--border); }
.work-mini li:last-child { border-bottom: 0; }
.share-box { max-width: 30rem; }
.share-secret { width: 100%; font-size: 1.1rem; }
.narrow { max-width: 42rem; }
.passkey-list li { display: flex; flex-wrap: wrap; gap: .3rem .6rem; align-items: baseline; padding: .4rem 0; border-bottom: 1px solid var(--border); }
.passkey-login { margin-top: 1rem; }
.passkey-login .or { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .85rem; margin-bottom: .8rem; }
.passkey-login .or::before, .passkey-login .or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.btn-block { width: 100%; justify-content: center; }
.stack > label.check { align-self: flex-start; padding-bottom: 0; }
.secret-input { min-width: 0; }
.secret-input input { min-width: 0; width: 100%; }
@media (max-width: 860px) {
  .table.stackable td::before { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* Rechnungswesen */
.muted-row td { color: var(--muted); }
.text-warn { color: #8a5a00; }
@media (prefers-color-scheme: dark) { .text-warn { color: #f0c36a; } }
.review-table input[name^=purpose] { min-width: 14rem; }
.review-table input.w-num { width: 7rem; text-align: right; }
.h-sub { font-size: 1rem; margin: .5rem 0 .25rem; }
.stat-row { display: flex; flex-wrap: wrap; gap: .75rem; margin: .5rem 0 1rem; }
.stat-row .stat { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .5rem .9rem; min-width: 7rem; }
.stat-row .stat strong { display: block; font-size: 1.3rem; }
.stat-row .stat span { color: var(--muted); font-size: .85rem; }
.online-sources { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); gap: .6rem; }
.source-card { border: 1px solid var(--border); border-radius: 10px; padding: .6rem .8rem; align-items: flex-start; }
.source-card.is-off { opacity: .65; }
.value-select { max-width: 100%; }

/* TeamViewer: Verbinden-Button und Online-Punkt */
.btn-tv { display: inline-flex; align-items: center; gap: .4rem; background: #0e8ee9; border-color: #0e8ee9; color: #fff; text-decoration: none; font-weight: 600; }
.btn-tv:hover { background: #0b74c0; border-color: #0b74c0; color: #fff; }
.btn-tv .ico { flex: none; }
.tv-row { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.tv-row .btn-tv { margin-left: .25rem; }
.tv-dot { display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; flex: none; vertical-align: middle; background: var(--border); box-shadow: 0 0 0 2px var(--surface, transparent); }
.tv-dot.is-online { background: #22b357; box-shadow: 0 0 0 3px color-mix(in srgb, #22b357 25%, transparent); }
.tv-dot.is-offline { background: #9aa3ad; }
.tv-dot.is-unknown { background: transparent; border: 1.5px dashed #9aa3ad; }
.tv-chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; font-weight: 600; padding: .12rem .5rem; border-radius: 99px; border: 1px solid #0e8ee9; color: #0e8ee9; text-decoration: none; vertical-align: middle; white-space: nowrap; }
.tv-chip:hover { background: #0e8ee9; color: #fff; }
.tv-chip .tv-dot { width: .5rem; height: .5rem; }
.tv-chip:hover .tv-dot.is-offline, .tv-chip:hover .tv-dot.is-unknown { border-color: #fff; }

/* Übersicht (Startseite) */
.home-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.home-side { display: grid; gap: 1rem; }
@media (max-width: 900px) { .home-grid { grid-template-columns: minmax(0, 1fr); } }
.home-list li { display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; }
.home-list li a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.se-cust { border-top: 1px solid var(--border); padding: .75rem 0 .25rem; }
.se-cust:first-of-type { border-top: 0; padding-top: .25rem; }
.se-cust h3 { font-size: 1rem; margin: 0 0 .4rem; display: flex; align-items: center; gap: .5rem; }
.se-systems { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.se-system { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.se-sensors { list-style: none; margin: .2rem 0 0; padding: 0 0 0 .2rem; display: grid; grid-template-columns: auto minmax(7rem, max-content) minmax(0, 1fr); gap: .25rem .5rem; align-items: baseline; font-size: .92rem; }
.se-sensors li { display: contents; }
.se-dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--danger); display: inline-block; transform: translateY(-1px); }
.se-name { font-weight: 600; }
.se-msg { color: var(--muted); overflow-wrap: anywhere; }
@media (max-width: 600px) { .se-sensors { grid-template-columns: auto minmax(0, 1fr); } .se-msg { grid-column: 2; } }
.se-unmapped-head + .se-cust { border-top: 0; padding-top: .25rem; }
.se-unmapped-head { font-size: .9rem; color: var(--muted); margin: 1rem 0 .2rem; padding-top: .75rem; border-top: 1px solid var(--border); display: flex; gap: .75rem; align-items: baseline; flex-wrap: wrap; }
.se-ok { display: flex; align-items: center; gap: .6rem; padding: .9rem 1rem; border-radius: 8px; background: var(--success-soft); color: var(--success); font-weight: 600; }
.se-ok-dot { width: .7rem; height: .7rem; border-radius: 50%; background: #22b357; box-shadow: 0 0 0 3px color-mix(in srgb, #22b357 25%, transparent); }

/* TI-Lage (gematik) */
.ti-card { margin-bottom: 1rem; }
.ti-summary { display: flex; align-items: center; gap: .6rem; font-weight: 600; margin: 0 0 .75rem; }
.ti-lamp { width: .8rem; height: .8rem; border-radius: 50%; flex: none; background: #9aa3ad; }
.ti-ok .ti-lamp { background: #22b357; box-shadow: 0 0 0 3px color-mix(in srgb, #22b357 25%, transparent); }
.ti-partial .ti-lamp { background: #e5a000; box-shadow: 0 0 0 3px color-mix(in srgb, #e5a000 25%, transparent); }
.ti-full .ti-lamp { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 25%, transparent); }
.ti-maintenance .ti-lamp { background: #3b82c4; }
.ti-apps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.ti-app { display: grid; grid-template-columns: auto 1fr; column-gap: .5rem; align-items: center; padding: .5rem .7rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.ti-app-dot { grid-row: span 2; width: .65rem; height: .65rem; border-radius: 50%; background: #22b357; }
.ti-app-name { font-weight: 600; }
.ti-app-state { font-size: .8rem; color: var(--muted); }
.ti-app.ti-partial { border-color: color-mix(in srgb, #e5a000 55%, var(--border)); background: color-mix(in srgb, #e5a000 10%, var(--surface)); }
.ti-app.ti-partial .ti-app-dot { background: #e5a000; }
.ti-app.ti-full { border-color: color-mix(in srgb, var(--danger) 55%, var(--border)); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }
.ti-app.ti-full .ti-app-dot { background: var(--danger); }
.ti-app.ti-maint { border-color: color-mix(in srgb, #3b82c4 55%, var(--border)); background: color-mix(in srgb, #3b82c4 10%, var(--surface)); }
.ti-app.ti-maint .ti-app-dot { background: #3b82c4; }
.ti-app:not(.ti-ok) .ti-app-state { color: var(--text, inherit); font-weight: 600; }
.ti-details { display: grid; gap: .5rem; margin-top: .9rem; }
.ti-func { padding: .55rem .75rem; border-left: 3px solid #e5a000; background: var(--surface-2); border-radius: 0 6px 6px 0; }
.ti-func.ti-full { border-left-color: var(--danger); }
.ti-func.ti-maint { border-left-color: #3b82c4; }
.ti-causes { margin-top: .75rem; }
.ti-source { margin: .9rem 0 0; }

.se-sensors { grid-template-columns: auto minmax(7rem, max-content) minmax(0, 1fr) auto; }
.se-ack { margin: 0; }
.se-ack .btn-link { color: var(--muted); padding: 0 .2rem; }
.se-ack .btn-link:hover { color: var(--primary); }
.se-ack-info { display: block; font-size: .78rem; }
.se-hidden { margin-top: .9rem; border-top: 1px solid var(--border); padding-top: .6rem; }
.se-hidden > summary { cursor: pointer; }
.se-hidden .se-cust { opacity: .75; }
.se-hidden .se-dot { background: var(--muted); }
@media (max-width: 600px) { .se-sensors { grid-template-columns: auto minmax(0, 1fr) auto; } .se-name { grid-column: 2; } .se-msg { grid-column: 2; } .se-ack { grid-column: 3; grid-row: span 1; } }

/* ================================================================================================
   Design 2026 („Pillen-Look“): helle Fläche mit sanftem Verlauf, anthrazitfarbene und gelbe Pillen,
   große dünne Ziffern, runde Kacheln. Überschreibt die Grundwerte oben; Dunkelmodus automatisch.
   Schrift: Outfit (SIL OFL), lokal unter static/vendor/outfit/ – funktioniert ohne Internet.
   ================================================================================================ */
@font-face { font-family: "Outfit"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url("vendor/outfit/outfit-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Outfit"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url("vendor/outfit/outfit-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --frame: #A2A8B4;
  --shell-bg: linear-gradient(135deg, #E4E5E9 0%, #EEEDE6 45%, #F8EDC4 100%);
  --bg: #EEEDE6;
  --surface: #FFFFFF;
  --surface-2: #F4F3EE;
  --tile: rgba(255, 255, 255, .62);
  --tile-strong: rgba(255, 255, 255, .85);
  --pill: rgba(255, 255, 255, .55);
  --border: #D9D6CC;
  --rule: #BDBDBD;
  --text: #232323;
  --muted: #5B5B5B;
  --primary: #2B2B2B;
  --primary-hover: #000000;
  --on-primary: #FFFFFF;
  --primary-soft: #F8EAB4;
  --accent: #F5CF4E;
  --on-accent: #232323;
  --dark: #2B2B2B;
  --on-dark: #FFFFFF;
  --dark-muted: #BDBDBD;
  --danger: #A8322A;
  --danger-soft: #F9E1DD;
  --success: #24683F;
  --success-soft: #DDF0E2;
  --warn-soft: #FBEFC4;
  --topbar: #2B2B2B;
  --topbar-text: #232323;
  --radius: 24px;
  --shadow: none;
  --font: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --frame: #111111;
    --shell-bg: linear-gradient(135deg, #1F1F21 0%, #232322 50%, #2C281C 100%);
    --bg: #1F1F1F; --surface: #2E2E2E; --surface-2: #343434;
    --tile: rgba(255, 255, 255, .06); --tile-strong: rgba(255, 255, 255, .1); --pill: rgba(255, 255, 255, .08);
    --border: #444444; --rule: #555555; --text: #EDEDED; --muted: #A9A9A9;
    --primary: #F5CF4E; --primary-hover: #FFE08A; --on-primary: #1E1E1E; --primary-soft: #3D3519;
    --accent: #F5CF4E; --on-accent: #1E1E1E;
    --dark: #0F0F0F; --on-dark: #FFFFFF; --dark-muted: #A9A9A9;
    --danger: #F08A80; --danger-soft: #3D2321; --success: #7BD39E; --success-soft: #1D3325; --warn-soft: #3A321C;
    --topbar: #0F0F0F; --topbar-text: #EDEDED; color-scheme: dark;
  }
}

html { font-size: 15px; }
body { font-family: var(--font); background: var(--frame); color: var(--text); line-height: 1.45; letter-spacing: .005em; }
body:not(.auth) { min-height: 100vh; }
h1 { font-size: clamp(2rem, 3.4vw, 3rem); font-weight: 400; letter-spacing: -.025em; line-height: 1.08; margin: 0 0 .3rem; }
h2 { font-size: 1.35rem; font-weight: 400; letter-spacing: -.01em; }
h3 { font-size: 1.05rem; font-weight: 500; }
strong, b { font-weight: 600; }
a { color: var(--text); font-weight: 500; }
a:hover { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.table td a:not(.btn):not(.tv-chip):not(.tag), .card p a:not(.btn), dl.kv a:not(.btn):not(.tv-chip), .home-list a, .result-list a {
  text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 85%, transparent);
  text-decoration-thickness: 2px; text-underline-offset: 3px; }
.muted { color: var(--muted); }
code, .mono, pre.code { font-family: var(--mono); }

/* ---------- Rahmen: abgerundete Fläche mit Verlauf (wie im Entwurf) */
.shell { max-width: 1440px; margin: clamp(0px, 2.4vw, 36px) auto; background: var(--shell-bg); border-radius: 40px;
  box-shadow: 0 40px 80px rgba(40, 44, 60, .25); padding: clamp(14px, 2vw, 28px); min-height: calc(100vh - 2 * clamp(0px, 2.4vw, 36px)); }
.container { max-width: none; padding: 1.6rem .2rem 2rem; }
.container.wide { max-width: none; }

/* ---------- Kopfzeile */
.topbar { position: static; height: auto; padding: 0; gap: .6rem; background: transparent; color: var(--text); flex-wrap: wrap; }
.brand { color: var(--text); font-weight: 400; font-size: 1.6rem; letter-spacing: -.02em; padding: .45rem 1.3rem; border: 1.5px solid var(--muted); border-radius: 999px; gap: .55rem; }
.brand:hover { text-decoration: none; background: var(--pill); }
.brand svg { width: 24px; height: 24px; stroke-width: 1.6; }
.mainnav { gap: 2px; padding: 5px; background: var(--pill); border-radius: 999px; margin-left: auto; align-items: center; }
.mainnav a, .navmenu summary { color: var(--text); padding: .65rem 1.05rem; border-radius: 999px; opacity: 1; font-weight: 400; }
.mainnav a:hover, .navmenu summary:hover, .navmenu[open] summary { background: var(--tile-strong); text-decoration: none; }
.mainnav a.active, .navmenu.active summary { background: var(--dark); color: var(--on-dark); }
.navmenu summary::after { content: ""; display: inline-block; width: .42em; height: .42em; margin-left: .45em; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-.15em) rotate(45deg); }
.navmenu-list { top: calc(100% + 10px); right: 0; left: auto; min-width: 230px; border: 0; border-radius: 22px; padding: .5rem; box-shadow: 0 18px 40px rgba(0,0,0,.18); background: var(--surface); }
.navmenu-list a { border-radius: 999px; padding: .55rem .9rem; }
.navmenu-list a:hover { background: var(--surface-2); }
.topsearch { position: relative; flex: 0 1 260px; max-width: 300px; margin-left: 0; }
.topsearch input { height: 50px; border-radius: 999px; border: 0; background: var(--pill); color: var(--text); padding: 0 1.1rem 0 2.6rem; }
.topsearch input::placeholder { color: var(--muted); }
.topsearch input:focus { background: var(--surface); outline: 2px solid var(--primary); }
.topsearch-ico { position: absolute; left: 1rem; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; pointer-events: none; }
.usermenu { gap: .4rem; }
.usermenu a { flex-direction: row; align-items: center; gap: .55rem; color: var(--text); padding: 4px 14px 4px 4px; border-radius: 999px; background: var(--pill); line-height: 1.1; }
.usermenu a:hover, .usermenu a.active { text-decoration: none; background: var(--tile-strong); }
.usermenu .who { display: flex; flex-direction: column; font-weight: 400; }
.usermenu small { color: var(--muted); opacity: 1; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: inline-grid; place-items: center; font-weight: 500; flex: none; }
.usermenu .btn-link { color: var(--muted); opacity: 1; padding: .5rem .6rem; border-radius: 999px; }
.usermenu .btn-link:hover { color: var(--text); background: var(--pill); text-decoration: none; }
.nav-alert { background: var(--accent); color: var(--on-accent); }

/* ---------- Seitenkopf */
.pagehead { align-items: flex-end; margin-bottom: 1.5rem; gap: 1rem 2rem; }
.pagehead p.muted { font-size: 1.02rem; }
.crumb { color: var(--muted); font-weight: 400; }

/* ---------- Kacheln */
.card { background: var(--tile); border: 0; border-radius: 30px; padding: 1.5rem 1.6rem; box-shadow: none; }
.card + .card { margin-top: 12px; }
.grid-2 { gap: 12px; }
.card-dark { background: var(--dark); color: var(--on-dark); }
.card-dark .muted, .card-dark small { color: var(--dark-muted); }
.card-dark a { color: var(--on-dark); }
.empty { background: var(--tile); border-radius: 30px; }
.hint { background: var(--tile); border: 0; border-radius: 18px; color: var(--muted); }

/* ---------- Formulare */
label { font-weight: 500; }
input, select, textarea { border: 1.5px solid transparent; background: var(--surface); border-radius: 14px; padding: .62rem .9rem; }
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]), select { min-height: 44px; }
select { border-radius: 999px; padding-right: 2rem; }
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]) { border-radius: 999px; }
textarea { border-radius: 18px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: transparent; }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); inline-size: 1.15rem; block-size: 1.15rem; }
.sticky-actions { background: transparent; backdrop-filter: blur(6px); border-radius: 999px; }

/* ---------- Knöpfe: Pillen */
.btn { border-radius: 999px; padding: .62rem 1.2rem; min-height: 44px; border: 1.5px solid transparent; background: var(--tile-strong); color: var(--text); font-weight: 400; justify-content: center; }
.btn:hover { background: var(--surface); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-ghost { background: transparent; border-color: var(--muted); color: var(--text); }
.btn-small { padding: .32rem .85rem; min-height: 34px; font-size: .9rem; }
.btn-link { color: var(--text); font-weight: 500; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.btn-icon { color: var(--text); border-radius: 999px; }

/* ---------- Hinweise */
.flash { border-radius: 20px; padding: .85rem 1.2rem; border: 0; }
.flash-success { color: var(--success); background: var(--success-soft); }
.flash-error { color: var(--danger); background: var(--danger-soft); }
.flash-warning { background: var(--warn-soft); color: #6B4C00; }
.flash-unifi { background: var(--accent); color: var(--on-accent); }
@media (prefers-color-scheme: dark) { .flash-warning { color: #F0C36A; } }

/* ---------- Tags, Zähler */
.tag { border-radius: 999px; padding: .15rem .6rem; font-weight: 500; background: var(--primary-soft); color: var(--text); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }
.tag-new { background: var(--success-soft); color: var(--success); }
.tag-site { border-color: var(--rule); color: var(--muted); }
.count { border: 0; background: var(--surface); color: var(--text); font-weight: 500; border-radius: 999px; padding: 0 .55em; }
.badge { border-radius: 999px; border: 0; padding: .2rem .65rem; font-weight: 500; text-transform: none; letter-spacing: 0; font-size: .78rem; }
.badge-update, .badge-access_change, .badge-restore { background: var(--dark); color: var(--on-dark); }
.badge-secret_view { background: var(--accent); color: var(--on-accent); }

/* ---------- Tabellen: luftig, gepunktete Trennlinien */
.table { background: var(--tile); border: 0; border-radius: 24px; box-shadow: none; overflow: hidden; }
.card .table, .device-group .table { background: transparent; border-radius: 0; }
.table th, .table td { border-bottom: 0; border-top: 1.5px dotted var(--rule); padding: .78rem .9rem; }
.table thead th { border-top: 0; background: transparent; text-transform: none; letter-spacing: 0; font-size: .85rem; font-weight: 400; color: var(--muted); padding-top: 1rem; }
.table tbody tr:hover { background: var(--tile-strong); }
.table th.num, .table td.num { font-variant-numeric: tabular-nums; }
.filterbar input[type=search] { width: min(420px, 100%); padding-left: 1.1rem; }

/* ---------- Reiter und Standort-Pillen */
.tabs { border-bottom: 0; gap: 2px; padding: 5px; background: var(--pill); border-radius: 999px; display: inline-flex; margin-bottom: 1.3rem; max-width: 100%; }
.tabs a, .tabs .tab-disabled { border-bottom: 0; margin-bottom: 0; border-radius: 999px; padding: .55rem 1.05rem; color: var(--text); font-weight: 400; }
.tabs a:hover { background: var(--tile-strong); text-decoration: none; }
.tabs a.active { background: var(--dark); color: var(--on-dark); }
.tabs a.active .count { background: var(--accent); color: var(--on-accent); }
.site-bar-label { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: .9rem; }
.site-pill { border: 1.5px solid var(--muted); background: transparent; font-weight: 400; padding: .45rem 1rem; }
.site-pill:hover { border-color: var(--text); }
.site-pill.active { background: var(--dark); border-color: var(--dark); color: var(--on-dark); }
.site-pill.active .count { background: var(--accent); color: var(--on-accent); }
.seg { border: 0; background: var(--pill); border-radius: 999px; padding: 4px; gap: 2px; }
.seg a { border-radius: 999px; color: var(--text); padding: .45rem .95rem; }
.seg a + a { border-left: 0; }
.seg a.active { background: var(--dark); color: var(--on-dark); }
.netmap-toolbar .btn.is-active { background: var(--dark); color: var(--on-dark); border-color: var(--dark); }

/* ---------- Gerätegruppen, Netzwerkplan, Auswahlkacheln */
.device-group { padding: .5rem .4rem .6rem; }
.group-head { border-bottom: 0; padding: .8rem 1.1rem .4rem; }
.group-head h2 { font-size: 1.25rem; font-weight: 400; }
.device-table tr.nested td { background: transparent; }
.class-tile, .choice, .source-card, .unifi-target, .stat-row .stat { border: 0; border-radius: 22px; background: var(--tile-strong); box-shadow: none; font-weight: 400; }
.class-tile:hover { color: var(--text); background: var(--accent); }
.class-chip { border: 0; background: var(--tile-strong); }
.choice-active { box-shadow: 0 0 0 2px var(--primary); }
.netmap-canvas { border-radius: 30px; background-color: var(--tile); background-image: radial-gradient(color-mix(in srgb, var(--text) 14%, transparent) 1px, transparent 1px); background-size: 18px 18px; }
.netmap-panel { background: var(--dark); color: var(--on-dark); }
.netmap-panel .muted, .netmap-panel small { color: var(--dark-muted); }
.netmap-panel a:not(.btn) { color: var(--on-dark); }
.netmap-panel .btn:not(.btn-primary) { background: rgba(255,255,255,.12); color: var(--on-dark); }
.netmap-panel .btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.netmap-panel select, .netmap-panel input:not([type=checkbox]) { background: var(--surface); color: var(--text); }
@media (prefers-color-scheme: light) { .netmap-panel select, .netmap-panel input:not([type=checkbox]) { background: #FFFFFF; color: #232323; } }
.class-nav { background: var(--pill); }
.class-nav a { border-radius: 999px; }
.class-nav a.active { background: var(--dark); color: var(--on-dark); }
.dropzone { border-color: var(--rule); border-radius: 24px; background: var(--tile); }
.row-menu-panel, .navmenu-list { border-radius: 22px; border: 0; }
.secret.revealed .secret-value { background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: .05rem .5rem; }
.matrix td:first-child, .matrix th:first-child { background: var(--surface-2); }
#toast { background: var(--dark); color: var(--on-dark); border-radius: 999px; padding: .7rem 1.3rem; }
.job-progress > span { background: var(--accent); }

/* ---------- Anmeldung */
body.auth { background: var(--frame); }
.auth-box { background: var(--shell-bg); border-radius: 36px; padding: 2.4rem; box-shadow: 0 40px 80px rgba(40, 44, 60, .3); width: min(460px, calc(100% - 2rem)); }
.auth-box::before { content: "NetDoc"; display: inline-block; font-size: 1.5rem; letter-spacing: -.02em; padding: .35rem 1.2rem; border: 1.5px solid var(--muted); border-radius: 999px; margin-bottom: 1.4rem; }
.auth-box .btn { width: 100%; min-height: 52px; }
.passkey-login .or::before, .passkey-login .or::after { border-top: 1.5px dotted var(--rule); }
[data-passkey-start] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* ---------- Übersicht (Startseite) */
.hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1.5rem 3rem; margin: .4rem 0 1.8rem; }
.hero-main { flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 1.4rem; }
.hero h1 { margin: 0; font-size: clamp(2.3rem, 4.2vw, 3.6rem); }
.kpis { display: flex; flex-wrap: wrap; gap: 1.2rem 2.8rem; align-items: flex-end; }
.kpi { display: flex; flex-direction: column; color: var(--text); }
.kpi:hover { text-decoration: none; }
.kpi-num { font-size: clamp(2.8rem, 5vw, 4.5rem); font-weight: 300; letter-spacing: -.05em; line-height: .95; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: .95rem; padding-left: .15rem; }
.statusbar { display: flex; flex-wrap: wrap; gap: 6px; max-width: 820px; }
.statusbar .seg-item { display: flex; flex-direction: column; gap: .35rem; flex: 1 1 120px; min-width: 0; }
.statusbar .seg-label { font-size: .9rem; padding-left: .5rem; color: var(--text); }
.statusbar .seg-bar { height: 52px; border-radius: 999px; display: flex; align-items: center; padding: 0 1.1rem; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); text-decoration: none; }
.statusbar a.seg-bar:hover { text-decoration: none; filter: brightness(.97); }
.seg-dark { background: var(--dark); color: var(--on-dark) !important; }
.seg-accent { background: var(--accent); color: var(--on-accent) !important; }
.seg-hatch { border: 1.5px solid var(--tile-strong); background: repeating-linear-gradient(-55deg, var(--tile-strong) 0 2px, transparent 2px 13px); }
.seg-outline { border: 1.5px solid var(--muted); }
.dash-grid { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.dash-grid > .card + .card, .dash-side > .card + .card { margin-top: 0; }
.dash-main { grid-column: span 2; }
.dash-side { display: grid; gap: 12px; }
@media (max-width: 1000px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } .dash-main { grid-column: auto; } }
.card-head .round-link { width: 44px; height: 44px; border-radius: 50%; background: var(--surface); display: inline-grid; place-items: center; color: var(--text); flex: none; }
.card-dark .round-link { background: rgba(255,255,255,.12); color: var(--on-dark); }
.round-link svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.round-link:hover { text-decoration: none; background: var(--accent); color: var(--on-accent); }
.big-num { font-size: 2.7rem; font-weight: 300; letter-spacing: -.04em; line-height: 1; }
.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.task-list li { display: flex; align-items: center; gap: .8rem; padding: .55rem 0; }
.task-list .task-ico { flex: none; width: 46px; height: 46px; border-radius: 50%; background: var(--on-dark); color: #232323; display: inline-grid; place-items: center; font-size: .82rem; font-weight: 500; line-height: 1; text-align: center; }
.task-list .task-ico.is-accent { background: var(--accent); color: var(--on-accent); }
.task-list .task-ico.is-dim { background: #444; color: var(--on-dark); }
.task-list .task-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.task-list .task-body a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.task-list .task-body small { font-size: .8rem; }
.recent-list { list-style: none; margin: 0; padding: 0; }
.recent-list li { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; padding: .7rem 0; border-top: 1.5px dotted var(--rule); }
.recent-list li:first-child { border-top: 0; }
.recent-list a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.se-cust { border-top: 1.5px dotted var(--rule); }
.se-dot { background: var(--accent); box-shadow: 0 0 0 2px var(--dark); }
.se-ok { background: var(--accent); color: var(--on-accent); border-radius: 999px; font-weight: 500; }
.se-ok-dot { background: var(--dark); box-shadow: none; }

/* TI-Lage im neuen Look */
.ti-card { background: var(--tile); }
.ti-app { border: 0; border-radius: 999px; background: var(--tile-strong); padding: .55rem 1rem; }
.ti-app-dot { background: var(--dark); }
.ti-app.ti-partial, .ti-app.ti-maint { background: var(--accent); border: 0; color: var(--on-accent); }
.ti-app.ti-partial .ti-app-state, .ti-app.ti-maint .ti-app-state { color: var(--on-accent); }
.ti-app.ti-partial .ti-app-dot, .ti-app.ti-maint .ti-app-dot { background: transparent; border: 1.5px solid currentColor; }
.ti-app.ti-full { background: var(--danger); color: #fff; border: 0; }
.ti-app.ti-full .ti-app-state { color: #fff; }
.ti-app.ti-full .ti-app-dot { background: #fff; }
.ti-func { border-left: 0; border-radius: 18px; background: var(--tile-strong); }
.ti-ok .ti-lamp { background: var(--dark); box-shadow: 0 0 0 3px var(--accent); }

/* ---------- Handy */
@media (max-width: 860px) {
  .shell { margin: 0; border-radius: 0; padding: 12px; min-height: 100vh; box-shadow: none; }
  .topbar { gap: .5rem; }
  .brand { font-size: 1.3rem; padding: .35rem 1rem; }
  .mainnav { margin-left: 0; order: 4; flex-basis: 100%; border-radius: 26px; }
  .topsearch { order: 5; flex-basis: 100%; max-width: none; }
  .usermenu { margin-left: auto; }
  .usermenu .who { display: none; }
  .usermenu a { padding: 4px; }
  .tabs { display: flex; border-radius: 26px; }
  .navmenu-list { border-radius: 22px; }
  .table.stackable tr { border-bottom: 1.5px dotted var(--rule); }
  .table.stackable td { border-top: 0; }
  .card { border-radius: 24px; padding: 1.15rem 1.1rem; }
  .statusbar .seg-item { flex-basis: 40%; }
}
@media print {
  body, .shell { background: #fff; box-shadow: none; margin: 0; padding: 0; border-radius: 0; }
}
.netmap-panel .btn-link, .card-dark .btn-link { color: var(--on-dark); }

/* TeamViewer im Browser (Web-Client): Kontur-Variante des TeamViewer-Knopfs */
.btn-tv-web { display: inline-flex; align-items: center; gap: .4rem; background: transparent; border: 1.5px solid #0e8ee9; color: #0b6fb8; font-weight: 500; text-decoration: none; }
.btn-tv-web:hover { background: #0e8ee9; border-color: #0e8ee9; color: #fff; text-decoration: none; }
.btn-tv-web .ico { flex: none; }
@media (prefers-color-scheme: dark) { .btn-tv-web { color: #6cbcf5; border-color: #6cbcf5; } }
.tv-row .btn-tv-web { margin-left: .25rem; }
.pagehead .actions .btn-tv + .btn-tv-web { margin-left: -.1rem; }
.btn-tv { background: #0e8ee9; border-color: #0e8ee9; color: #fff; }
.btn-tv:hover { background: #0b74c0; border-color: #0b74c0; color: #fff; }

/* ================================================================ Farbschema „Blau“ (#1A4B7E)
   Verwaltung → Einstellungen → Erscheinungsbild. Setzt nur die Akzentfarbe und den Verlauf um;
   dunkle Pillen bleiben anthrazit. Auf Blau steht weiße Schrift. */
:root[data-theme="blau"] {
  --shell-bg: linear-gradient(135deg, #E6E8EC 0%, #E9EDF2 45%, #D3E0EE 100%);
  --accent: #1A4B7E;
  --on-accent: #FFFFFF;
  --primary-soft: #DCE6F1;
  --warn-soft: #FBEFC4;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="blau"] {
    --shell-bg: linear-gradient(135deg, #1F1F21 0%, #212327 50%, #1B2737 100%);
    --accent: #6FA3DA; --on-accent: #0F1B29; --primary: #6FA3DA; --primary-hover: #93BCE6; --on-primary: #0F1B29;
    --primary-soft: #1D3046;
  }
}
/* Stellen, die bisher fest dunkle Schrift auf der Akzentfarbe hatten */
.class-tile:hover { color: var(--on-accent); }

/* Auswahl des Farbschemas */
.theme-choices { display: flex; flex-wrap: wrap; gap: 10px; }
.theme-choice { flex: 0 1 260px; flex-direction: row; align-items: center; gap: .8rem; padding: .8rem 1rem; border-radius: 22px; background: var(--tile-strong); cursor: pointer; font-weight: 400; border: 2px solid transparent; }
.theme-choice:has(input:checked) { border-color: var(--primary); }
.theme-choice > span:last-child { display: flex; flex-direction: column; }
.theme-swatch { display: inline-flex; flex: none; }
.theme-swatch i { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--surface); margin-left: -8px; }
.theme-swatch i:first-child { margin-left: 0; }
.theme-swatch-gelb i:nth-child(1) { background: #F5CF4E; } .theme-swatch-gelb i:nth-child(2) { background: #2B2B2B; } .theme-swatch-gelb i:nth-child(3) { background: #F8EDC4; }
.theme-swatch-blau i:nth-child(1) { background: #1A4B7E; } .theme-swatch-blau i:nth-child(2) { background: #2B2B2B; } .theme-swatch-blau i:nth-child(3) { background: #D3E0EE; }

/* Lageleiste: langer Text bricht um statt abgeschnitten zu werden */
.statusbar .seg-bar { white-space: normal; overflow: visible; text-overflow: clip; height: auto; min-height: 52px; padding-top: .5rem; padding-bottom: .5rem; line-height: 1.2; }

/* WLAN-QR-Code */
.btn-qr { gap: .35rem; margin-left: .35rem; }
.wifi-dialog { border: 0; border-radius: 30px; padding: 0; background: var(--surface); color: var(--text); width: min(380px, calc(100vw - 2rem)); box-shadow: 0 30px 70px rgba(0,0,0,.3); }
.wifi-dialog::backdrop { background: rgba(20, 22, 28, .45); }
.wifi-card { padding: 1.6rem; display: flex; flex-direction: column; align-items: center; text-align: center; gap: .5rem; }
.wifi-ssid { font-size: 1.6rem; margin: 0; overflow-wrap: anywhere; }
.wifi-qr { width: 240px; height: 240px; background: #fff; border-radius: 18px; padding: 10px; }
.wifi-qr svg { width: 100%; height: 100%; display: block; }
.wifi-hint { overflow-wrap: anywhere; }
.wifi-actions { justify-content: center; }
@media print {
  body.print-wifi > *:not(.shell), body.print-wifi .shell > *:not(main), body.print-wifi main > *:not(.wifi-dialog) { display: none !important; }
  body.print-wifi .wifi-dialog { position: static; box-shadow: none; display: block; }
  body.print-wifi .wifi-actions { display: none; }
}

/* „Alle auswählen“-Leiste oben im Online-Abgleich: bleibt beim Scrollen sichtbar */
.select-all-bar { position: sticky; top: .6rem; z-index: 6; padding: .8rem 1.3rem; margin-bottom: 12px; background: var(--tile-strong); backdrop-filter: blur(8px); border-radius: 999px; }
.select-all-bar label.check { padding: 0; align-self: auto; }
@media (max-width: 860px) { .select-all-bar { border-radius: 22px; } }

/* SSH-Terminal */
.ssh-connect { display: flex; flex-wrap: wrap; gap: .8rem 1rem; align-items: flex-end; }
.ssh-connect label { flex: 0 1 auto; }
.ssh-connect label.grow { flex: 1 1 14rem; }
.ssh-connect input, .ssh-connect select { width: 100%; }
.ssh-connect .w-num { width: 6rem; }
.ssh-buttons { display: flex; gap: .5rem; }
.ssh-hostkey { margin-top: 12px; border: 2px solid var(--accent); }
.ssh-hostkey.is-changed { border-color: var(--danger); }
.ssh-hostkey code { font-size: .95rem; overflow-wrap: anywhere; }
.ssh-status { margin: .9rem .4rem .5rem; }
.ssh-term { height: calc(100vh - 420px); min-height: 360px; background: #1e1e1e; border-radius: 24px; padding: 14px; overflow: hidden; }
.ssh-term .xterm { height: 100%; }
@media (max-width: 860px) { .ssh-term { height: 60vh; border-radius: 18px; padding: 8px; } }

/* PatchMon auf der Übersicht */
.pm-card { margin-bottom: 12px; }
.pm-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: .2rem 0 .6rem; }
.pm-stat { display: flex; flex-direction: column; gap: .2rem; padding: .9rem 1.1rem; border-radius: 22px; background: var(--tile-strong); }
.pm-stat.is-warn { background: var(--accent); color: var(--on-accent); }
.pm-stat.is-alert { background: var(--dark); color: var(--on-dark); }
.pm-stat .muted { color: inherit; opacity: .75; }
.pm-num { font-size: 2.3rem; font-weight: 300; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.pm-num small { font-size: 1.1rem; opacity: .7; letter-spacing: 0; }
.pm-top li { align-items: center; }
.pm-open { margin-left: .5rem; }

/* Push-Einstellungen */
.push-window { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .6rem; }
.push-window[disabled] { opacity: .5; }
.push-days { display: flex; flex-wrap: wrap; gap: .35rem; }
.push-times { display: flex; gap: .8rem; flex-wrap: wrap; }
.push-times input { width: 8rem; }
.push-state { margin: 0 0 .6rem; }
.push-diag { margin: .6rem 0 0; font-size: .75rem; }
