:root {
  --navy: #0e4466;
  --navy-dark: #082c44;
  --navy-deep: #06283f;
  --cyan: #00a3d7;
  --green: #7fa82e;
  --bg: #eef2f5;
  --card: #ffffff;
  --line: #dde4ea;
  --text: #1c2b36;
  --muted: #677885;
  --ok: #4f7d12;
  --ok-bg: #e9f3d6;
  --warn: #8a5a00;
  --warn-bg: #fdefc8;
  --crit: #b3261e;
  --crit-bg: #fbdcda;
  --info: #00648a;
  --info-bg: #d8f1fa;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(14, 68, 102, .08), 0 2px 8px rgba(14, 68, 102, .05);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  display: flex;
}
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h2 { font-size: 15px; }
h2 small { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 6px; }
h3 { font-size: 13px; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
p { margin: 0 0 12px; }
code { font: 12.5px Consolas, "Cascadia Mono", monospace; background: var(--bg); padding: 2px 5px; border-radius: 4px; word-break: break-all; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.icon { width: 18px; height: 18px; flex: none; }

/* ---------- Seitenleiste ---------- */
.sidebar {
  width: 232px; flex: none; background: var(--navy-deep); color: #c5d6e2;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 20px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 36px; flex: none; }
.brand span { font-size: 12px; line-height: 1.25; color: #9fc3d8; }
.brand b { display: block; font-size: 16px; color: #fff; font-weight: 700; white-space: nowrap; }
.brand b i { font-style: normal; color: var(--cyan); }
.sidebar nav { flex: 1; overflow-y: auto; padding: 4px 10px; }
.sidebar nav a, .nav-logout {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 6px;
  color: #c5d6e2; margin-bottom: 2px;
}
.sidebar nav a:hover, .nav-logout:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: var(--cyan); color: #fff; font-weight: 600; }
.nav-sep { padding: 18px 12px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6f93aa; }
.nav-logout { margin: 10px; }
/* Menue-Knopf: nur auf schmalen Bildschirmen sichtbar (siehe unten). */
.nav-toggle { display: none; align-items: center; justify-content: center; width: 42px; height: 42px; margin-right: 12px; border: 1px solid rgba(255, 255, 255, .22); border-radius: 8px; background: none; color: #fff; cursor: pointer; }
.nav-toggle[aria-expanded=true] { background: var(--cyan); border-color: var(--cyan); }
.nav-toggle .icon { width: 22px; height: 22px; }

/* ---------- Hauptbereich ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--card); border-bottom: 1px solid var(--line); padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 14px; flex: none; }
.tenant-switch { display: flex; align-items: center; gap: 8px; }
.tenant-switch label { color: var(--muted); font-size: 12px; margin: 0; }
.tenant-name { color: var(--muted); }
.user-chip { background: var(--bg); border-radius: 20px; padding: 5px 13px; font-weight: 600; }
.content { padding: 24px 28px 48px; max-width: 1500px; width: 100%; }

/* ---------- Karten und Raster ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; }
.card > h2 { margin-bottom: 14px; }
.card-flush { padding: 0; overflow: hidden; }
.card-pad { padding: 16px 20px 0; }
p.card-pad { padding-bottom: 14px; margin: 0; }
h2.card-pad { margin-bottom: 12px; }
.card-link { display: inline-block; margin-top: 12px; font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid .card { margin-bottom: 0; }
.grid + .card, .grid + form, .card + .grid { margin-top: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card-wide { grid-column: 1 / -1; }

.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.kpi {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 20px;
  color: var(--text); border-left: 4px solid var(--cyan); display: block;
}
.kpi:hover { text-decoration: none; box-shadow: 0 2px 12px rgba(14, 68, 102, .16); }
.kpi-warn { border-left-color: #e8a317; }
.kpi-num { display: block; font-size: 30px; font-weight: 600; line-height: 1.15; color: var(--navy); }
.kpi-lbl { color: var(--muted); }

.empty-state { text-align: center; padding: 56px 24px; }
.empty-state .icon { width: 56px; height: 56px; color: var(--cyan); }
.empty-state h2 { font-size: 19px; margin: 12px 0 8px; }
.empty-state p { max-width: 520px; margin: 0 auto 20px; color: var(--muted); }

/* ---------- Diagramme ---------- */
.donut-wrap { display: flex; align-items: center; gap: 20px; }
.donut { width: 132px; height: 132px; flex: none; }
.donut-num { font-size: 9px; font-weight: 600; text-anchor: middle; fill: var(--navy); }
.donut-lbl { font-size: 3.2px; text-anchor: middle; fill: var(--muted); }
.legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; }
.legend li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.legend li b { margin-left: auto; padding-left: 10px; }
.legend a { color: var(--text); }
.swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; }

.bars { list-style: none; margin: 0; padding: 0; }
.bars li { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 28px; align-items: center; gap: 10px; padding: 5px 0; }
.bars li b { text-align: right; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-label small { color: var(--muted); }
.bar-track { height: 9px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--cyan); border-radius: 5px; min-width: 3px; }
.bar-warn { background: #e8a317; }
.bar-crit { background: #d64545; }
.bars-volumes li { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr); }
.bar-value { color: var(--muted); text-align: right; white-space: nowrap; }

.attention { list-style: none; margin: 0; padding: 0; }
.attention li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.attention li:last-child { border-bottom: 0; }
.attention a { font-weight: 600; display: block; }
.attention span { color: var(--muted); font-size: 12.5px; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; }
.table-scroll { max-height: 330px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
th { font-size: 12px; font-weight: 600; color: var(--muted); background: #f7f9fb; white-space: nowrap; position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: 0; }
.table-hover tbody tr:hover { background: #f5f9fc; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.check { width: 36px; }
td.links a { display: inline-block; margin-right: 10px; }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions form { display: inline; }
.dev-link { font-weight: 600; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; }
.dot-ok { background: #7fa82e; box-shadow: 0 0 0 3px rgba(127, 168, 46, .2); }
.dot-off { background: #b3bec7; }

.badge { display: inline-block; padding: 1px 9px; border-radius: 11px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-crit { background: var(--crit-bg); color: var(--crit); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: #e6ebef; color: #51616d; }

.progress { display: inline-block; width: 90px; height: 7px; background: var(--bg); border-radius: 4px; overflow: hidden; vertical-align: middle; margin-left: 6px; }
.progress span { display: block; height: 100%; background: var(--cyan); }

/* ---------- Formulare und Schaltflaechen ---------- */
input[type=text], input[type=email], input[type=password], input[type=search], input[type=datetime-local], select {
  font: inherit; color: var(--text); padding: 7px 10px; border: 1px solid #c3ced7; border-radius: 6px; background: #fff; min-width: 0;
}
input:focus-visible, select:focus-visible, .btn:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--cyan); outline-offset: 2px;
}
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--cyan); vertical-align: middle; margin: 0; }
label { display: block; margin-bottom: 12px; font-weight: 600; font-size: 13px; }
label input[type=text], label input[type=email], label input[type=password], label input[type=datetime-local], label select { display: block; width: 100%; margin-top: 4px; font-weight: 400; }
label.checkline { font-weight: 400; display: flex; align-items: center; gap: 8px; }
label.inline { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 400; }
label.inline select { display: inline-block; width: auto; margin: 0; }
.form-row { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 12px; }
.form-row label { flex: 1; max-width: 380px; margin: 0; }
.form-stack { max-width: 420px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-weight: 600;
  padding: 7px 14px; border-radius: 6px; border: 1px solid #c3ced7; background: #fff; color: var(--text); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: #f1f5f8; text-decoration: none; }
.btn .icon { width: 15px; height: 15px; }
.btn-primary { background: var(--cyan); border-color: var(--cyan); color: #fff; }
.btn-primary:hover { background: #008fbd; }
.btn-danger { color: var(--crit); border-color: #e6b4b0; }
.btn-danger:hover { background: var(--crit-bg); }
dialog .btn-danger { background: var(--crit); border-color: var(--crit); color: #fff; }
.btn-small { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; padding: 10px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.search { display: flex; gap: 8px; flex: 1; max-width: 520px; }
.search input { flex: 1; }
.group-picker { margin: -4px 0 14px; }
.group-picker select { min-width: 220px; }
.score { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.score b { font-size: 34px; line-height: 1; }
.score span { color: var(--muted, #6b7785); }
.score-ok b { color: #7fa82e; } .score-warn b { color: #e8a317; } .score-crit b { color: #d64545; }
.sec-list { list-style: none; margin: 0; padding: 0; }
.sec-list li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.sec-list li.sec-detail { display: block; border-bottom: 1px solid var(--line); padding-top: 0; }
.sec-list li.sec-bad + li.sec-detail { margin-top: -1px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip { padding: 4px 12px; border-radius: 16px; background: #fff; border: 1px solid var(--line); color: var(--text); font-size: 13px; }
.chip:hover { text-decoration: none; border-color: var(--cyan); }
.chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip small { opacity: .7; margin-left: 2px; }
.chip-label { align-self: center; color: var(--muted); font-size: 13px; margin-right: 2px; }
.chip-link { border-style: dashed; color: var(--info); }
.bulkbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.bulkbar h2 { margin: 0; }
.bulk-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; border-left: 4px solid; }
.flash-ok { background: var(--ok-bg); border-color: var(--green); }
.flash-crit { background: var(--crit-bg); border-color: #d64545; }
.flash-warn { background: var(--warn-bg); border-color: #e8a317; }
.flash-info { background: var(--info-bg); border-color: var(--cyan); }

dialog { border: 0; border-radius: 10px; padding: 24px; width: min(480px, calc(100vw - 32px)); box-shadow: 0 12px 48px rgba(6, 40, 63, .35); color: var(--text); text-align: left; white-space: normal; }
dialog::backdrop { background: rgba(6, 40, 63, .55); }
dialog h2 { font-size: 17px; margin-bottom: 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ---------- Computer-Detailseite ---------- */
.dev-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.backlink { display: inline-block; margin-bottom: 8px; font-size: 13px; }
.dev-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted); }
.dev-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 16px; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--navy); border-bottom-color: var(--cyan); }
.count { background: #e6ebef; border-radius: 10px; padding: 0 7px; font-size: 12px; margin-left: 4px; }

.props { margin: 0; }
.props + .props { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.props > div { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; padding: 4px 0; }
.props dt { color: var(--muted); }
.props dd { margin: 0; overflow-wrap: anywhere; }
.props-row { display: flex; flex-wrap: wrap; gap: 8px 40px; }
.props-row > div { display: block; }
.props-row dt { font-size: 12px; }

.patchbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; position: sticky; bottom: 12px; border: 1px solid var(--line); }
.patchbar label { margin-bottom: 6px; }
.patchbar select { display: inline-block; width: auto; margin: 0 0 0 8px; }
.patchbar-actions { display: flex; align-items: center; gap: 12px; }

.task { border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task summary { display: flex; align-items: center; gap: 12px; padding: 12px 20px; cursor: pointer; flex-wrap: wrap; }
.task summary:hover { background: #f5f9fc; }
.task-name { font-weight: 600; min-width: 190px; }
.task-name small { font-weight: 400; color: var(--muted); }
.task-msg { flex: 1; min-width: 120px; }
.task-meta { font-size: 12.5px; white-space: nowrap; }
.task-body { padding: 0 20px 16px; }
.log { background: var(--navy-deep); color: #d7e6ef; padding: 12px 14px; border-radius: 6px; font: 12.5px/1.5 Consolas, "Cascadia Mono", monospace; max-height: 380px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }

/* Ergebnis je Update (aus dem Protokoll gelesen, siehe inc/tasklog.php) */
.task-result-sum { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.task-results { margin-bottom: 12px; border: 1px solid var(--line); border-radius: 6px; border-collapse: separate; border-spacing: 0; }
.task-results th:first-child, .task-results td:first-child { padding-left: 12px; }
.task-results td:first-child { overflow-wrap: break-word; min-width: 130px; }
.task-results td:nth-child(2) { white-space: nowrap; }

.steps { padding-left: 20px; margin: 0 0 12px; }
.steps li { margin-bottom: 8px; }
.proxy-choice { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.proxy-choice input { flex: 1; min-width: 240px; max-width: 360px; }
.copybox { display: flex; align-items: flex-start; gap: 10px; background: var(--bg); border-radius: 6px; padding: 10px 12px; margin-top: 6px; }
.copybox code { flex: 1; background: none; padding: 0; }
.more summary { cursor: pointer; color: var(--info); font-weight: 600; margin-bottom: 10px; }

/* ---------- Anmeldung ---------- */
.login-body { min-height: 100vh; background: #fff; }
.login-hero {
  flex: 1.35; background: linear-gradient(150deg, #0e4466 0%, #06283f 62%, #041c2d 100%); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; min-width: 0;
}
.hero-art { width: min(560px, 100%); height: auto; }
.login-hero-text { text-align: center; max-width: 480px; margin-top: 8px; }
.login-hero-text h2 { font-size: 26px; font-weight: 600; margin-bottom: 10px; }
.login-hero-text p { color: #a9c8da; font-size: 15px; margin: 0; }
.login-panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 32px; min-width: 340px; }
.login-box { width: 100%; max-width: 340px; }
.login-logo { display: flex; align-items: center; gap: 11px; margin-bottom: 34px; color: var(--navy); font-size: 27px; font-weight: 700; line-height: 1; letter-spacing: -.01em; white-space: nowrap; }
.login-logo img { width: 31px; height: 40px; flex: none; }
.login-logo i { font-style: normal; color: var(--cyan); }
.login-box h1 { font-size: 23px; margin-bottom: 18px; color: var(--navy); }
.login-hint { color: var(--muted); }
.login-box input { padding: 9px 11px; }
.login-box .btn { margin-top: 8px; }
.login-foot { margin-top: 36px; color: var(--muted); font-size: 12px; text-align: center; }
.login-foot img { width: 140px; height: auto; display: block; margin: 0 auto 6px; }

/* ---------- Schmale Bildschirme ---------- */
@media (max-width: 1150px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  body { display: block; }

  /* Menue: schmale Kopfleiste mit Knopf; die Punkte klappen darunter als Liste auf. */
  .sidebar { width: auto; height: auto; position: sticky; top: 0; z-index: 20; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .brand { flex: 1; min-width: 0; padding: 10px 14px; }
  .brand img { width: 30px; height: 30px; }
  .nav-toggle { display: inline-flex; }
  .sidebar nav, .nav-logout { display: none; }
  .sidebar.nav-open nav { display: block; flex: none; width: 100%; padding: 6px 10px 0; max-height: calc(100vh - 130px); border-top: 1px solid rgba(255, 255, 255, .12); }
  .sidebar.nav-open .nav-logout { display: flex; width: calc(100% - 20px); margin: 2px 10px 10px; }
  .sidebar nav a, .nav-logout { padding: 12px; font-size: 15px; }
  .nav-sep { padding-top: 12px; }

  .topbar { padding: 10px 14px; position: static; flex-wrap: wrap; gap: 8px 12px; }
  .topbar h1 { font-size: 18px; flex: 1 1 100%; }
  .topbar-right { flex: 1; min-width: 0; gap: 10px; }
  .tenant-switch { flex: 1; min-width: 0; }
  .tenant-switch select { flex: 1; min-width: 0; }
  .tenant-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .user-chip { max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .content { padding: 14px 12px 40px; }
  .card { padding: 16px; margin-bottom: 14px; }
  .card-flush { padding: 0; }
  .card-pad { padding: 14px 16px 0; }
  .grid, .grid-2 { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .grid + .card, .grid + form, .card + .grid { margin-top: 14px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
  .kpis > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .kpi { padding: 12px 14px; }
  .kpi-num { font-size: 25px; }
  .kpi-lbl { font-size: 13px; }
  .donut { width: 112px; height: 112px; }
  .donut-wrap { gap: 16px; }
  .props > div { grid-template-columns: minmax(0, 1fr); gap: 0; }

  /* Tabellen behalten lesbare Spalten und lassen sich seitlich wischen;
     ein Schatten am Rand zeigt, dass dort noch Spalten folgen. */
  .table-wrap {
    background:
      linear-gradient(to right, #fff 30%, rgba(255, 255, 255, 0)) left / 36px 100% no-repeat local,
      linear-gradient(to left, #fff 30%, rgba(255, 255, 255, 0)) right / 36px 100% no-repeat local,
      radial-gradient(farthest-side at 0 50%, rgba(6, 40, 63, .28), transparent) left / 12px 100% no-repeat scroll,
      radial-gradient(farthest-side at 100% 50%, rgba(6, 40, 63, .28), transparent) right / 12px 100% no-repeat scroll;
  }
  .table-wrap table { min-width: 560px; }
  .table-wrap th { background: rgba(238, 242, 245, .6); }
  th, td { padding: 9px 10px; }
  th:first-child, td:first-child { padding-left: 16px; }
  th:last-child, td:last-child { padding-right: 16px; }

  /* Computerliste: je Computer eine Karte statt einer Tabelle zum Wischen (Beschriftung aus data-label). */
  .cards-wrap { background: none; overflow: visible; }
  table.cards, table.cards tbody { display: block; min-width: 0; }
  table.cards thead { display: none; }
  table.cards tr { display: grid; grid-template-columns: 30px minmax(0, 1fr) 36px; gap: 3px 8px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--line); }
  table.cards tr:last-child { border-bottom: 0; }
  table.cards td { display: block; grid-column: 2; padding: 0; border: 0; white-space: normal; text-align: left; }
  table.cards td.check { grid-column: 1; grid-row: 1 / span 3; width: auto; padding-top: 2px; }
  table.cards td.row-menu-cell { grid-column: 3; grid-row: 1 / span 3; width: auto; text-align: right; }
  table.cards td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: 12.5px; }
  table.cards td br { display: none; }
  table.cards td small { margin-left: 6px; }
  table.cards .dev-link { font-size: 15.5px; }
  table.cards td[colspan] { grid-column: 1 / -1; padding: 8px 0; }
  /* Karten ohne Auswahlkaestchen und Zeilenmenue (Aufgaben): eine Spalte. */
  table.cards-plain tr { grid-template-columns: minmax(0, 1fr); padding: 12px 16px; }
  table.cards-plain td { grid-column: 1; }
  table.cards-plain td:last-child:not(:empty) { margin-top: 6px; }
  table.cards-plain .dev-link { font-weight: 600; }

  /* Ergebnis je Update: Name, darunter das Ergebnis. */
  .table-wrap table.task-results, .task-results tbody, .task-results tr, .task-results td { display: block; min-width: 0; }
  .task-results thead { display: none; }
  .task-results tr { padding: 9px 12px; border-bottom: 1px solid var(--line); }
  .task-results tr:last-child { border-bottom: 0; }
  .task-results td, .task-results td:first-child, .task-results td:last-child { padding: 0; border: 0; white-space: normal; }
  .task-results td:nth-child(2) { font-size: 12.5px; }

  /* Bedienelemente: fingergerecht, Schrift in Eingabefeldern so gross, dass das Handy beim Antippen nicht hineinzoomt. */
  input[type=text], input[type=email], input[type=password], input[type=search], input[type=datetime-local], input[type=time], input[type=date], select { font-size: 16px; padding: 9px 10px; }
  .btn { white-space: normal; text-align: center; padding: 9px 14px; }
  .btn-small { padding: 7px 11px; }
  .chip { padding: 6px 13px; }
  .toolbar { gap: 10px; }
  .search { flex: 1 1 100%; max-width: none; }
  .form-row { flex-wrap: wrap; }
  .form-row label { flex: 1 1 100%; max-width: none; }
  .bulkbar { padding: 12px 16px; }
  .bulkbar .bulk-actions { width: 100%; }
  .bulkbar .bulk-actions .btn { flex: 1 1 calc(50% - 4px); }
  .dialog-actions { flex-wrap: wrap; }
  .dialog-actions .btn { flex: 1 1 auto; }
  dialog { padding: 20px 18px; }
  .copybox { flex-direction: column; }
  .storage-form { grid-template-columns: 1fr 90px; }
  .device-settings label { flex: 1 1 100%; }
  .device-settings select, .device-settings input { width: 100%; min-width: 0; }
  .net-form { grid-template-columns: 1fr; }

  /* Leiste "Updates installieren": steht auf dem Handy am Seitenende statt ueber dem Inhalt zu schweben. */
  .patchbar { position: static; display: block; }
  .patchbar select { display: block; width: 100%; margin: 4px 0 0; }
  .patchbar-actions { flex-direction: column; align-items: stretch; gap: 8px; margin-top: 12px; }

  .dev-actions .btn { flex: 1 1 calc(50% - 4px); }
  .tabs a { padding: 10px 14px; }
  .task summary { padding: 12px 16px; gap: 6px 12px; }
  .task-name { min-width: 0; flex: 1 1 100%; }
  .task-body { padding: 0 16px 14px; }

  .report { padding: 18px 16px; overflow-x: auto; }
  .report-head { flex-wrap: wrap; gap: 12px; }
  .report-kpis { grid-template-columns: repeat(2, 1fr); }

  .login-body { display: block; }
  .login-hero { padding: 24px; }
  .hero-art { width: min(300px, 100%); }
  .login-panel { min-width: 0; padding: 28px 20px 36px; }
}

/* ---------- Netzwerkplan ---------- */
.netmap-wrap { overflow-x: auto; }
.netmap { display: block; width: 100%; min-width: 820px; height: auto; }
.net-line { fill: none; stroke: #b3c1cc; stroke-width: 1.5; }
.net-bus { fill: none; stroke: #8ea3b3; stroke-width: 3; stroke-linecap: round; }
.net-node { cursor: pointer; outline: none; }
.net-static { cursor: default; }
.net-bg { fill: #fff; stroke: var(--navy); stroke-width: 2; }
.net-icon { fill: none; stroke: var(--navy); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
/* Weisser Saum, damit Beschriftungen ueber Leitungen lesbar bleiben. */
.net-name, .net-ip, .net-group { paint-order: stroke; stroke: #fff; stroke-width: 3.5px; stroke-linejoin: round; }
.net-name { font: 600 11px "Segoe UI", system-ui, sans-serif; fill: var(--text); text-anchor: middle; }
.net-ip { font: 10px "Segoe UI", system-ui, sans-serif; fill: var(--muted); text-anchor: middle; }
.net-side { text-anchor: start; }
.net-name.net-side { font-size: 12.5px; }
.net-ip.net-side { font-size: 11px; }
.net-group { font: 600 9.5px "Segoe UI", system-ui, sans-serif; fill: var(--muted); letter-spacing: .05em; text-transform: uppercase; }
.net-node:not(.net-static):hover .net-bg, .net-node:focus-visible .net-bg { fill: var(--info-bg); stroke-width: 3; }
.net-node:not(.net-static):hover .net-name { fill: var(--info); }
.net-ok .net-bg { stroke: var(--ok); } .net-ok .net-dot { fill: var(--ok); }
.net-off .net-bg { stroke: #9aa8b3; } .net-off .net-icon { stroke: #677885; } .net-off .net-dot { fill: #9aa8b3; }
.net-warn .net-bg { stroke: #e8a317; } .net-warn .net-dot { fill: #e8a317; }
.net-other .net-bg { stroke: #c5d0d9; } .net-other .net-icon { stroke: #677885; }
.net-missing .net-bg { stroke: #c5d0d9; stroke-dasharray: 4 3; } .net-missing .net-icon { stroke: #9aa8b3; }
.net-dot { stroke: #fff; stroke-width: 1.5; }
.net-legend { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 4px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 13px; }
.net-legend li { display: flex; align-items: center; gap: 7px; }
.net-legend .swatch { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.net-dialog { width: min(560px, calc(100vw - 32px)); }
.net-dialog .props { margin: 12px 0 4px; }
.net-form { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.net-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; }
.net-form p, .net-form .dialog-actions { grid-column: 1 / -1; margin: 0; }
.net-form .dialog-actions { flex-wrap: wrap; margin-top: 6px; }

/* ---------- Sortierbare Tabellen ---------- */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover, th.sortable:focus-visible { color: var(--info); outline: none; }
th.sortable::after { content: " \2195"; opacity: .3; font-size: 11px; }
th.sortable[aria-sort="ascending"]::after { content: " \25B2"; opacity: 1; color: var(--cyan); }
th.sortable[aria-sort="descending"]::after { content: " \25BC"; opacity: 1; color: var(--cyan); }

/* ---------- Anklickbare Computer-Zahlen ---------- */
.count-link { background: none; border: 0; padding: 0 2px; margin: 0; font: inherit; font-weight: 600; color: var(--info); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.count-link:hover { color: var(--navy); }
.device-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.device-list li { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; font-weight: 400; }
.device-list li:first-child { border-top: 0; }

/* ---------- Kontextmenue der Computerliste ---------- */
.ctx-menu { position: fixed; z-index: 50; min-width: 220px; padding: 5px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 34px rgba(6, 40, 63, .22); font-size: 13.5px; }
.ctx-menu[hidden] { display: none; }
.ctx-title { padding: 5px 10px 7px; font-weight: 600; color: var(--navy); border-bottom: 1px solid var(--line); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.ctx-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.ctx-menu [role=menuitem], .ctx-parent { display: flex; align-items: center; gap: 9px; width: 100%; padding: 5px 10px; border: 0; border-radius: 5px; background: none; font: inherit; color: var(--text); text-align: left; text-decoration: none; white-space: nowrap; cursor: pointer; }
.ctx-menu [role=menuitem][hidden] { display: none; }
.ctx-menu [role=menuitem]:hover, .ctx-menu [role=menuitem]:focus, .ctx-sub:hover > .ctx-parent, .ctx-parent:focus { background: var(--info-bg); color: var(--navy); outline: none; text-decoration: none; }
.ctx-menu .icon { width: 16px; height: 16px; flex: none; color: var(--info); }
.ctx-arrow { margin-left: auto; padding-left: 18px; color: var(--muted); font-size: 11px; }
.ctx-sub { position: relative; }
.ctx-submenu { display: none; position: absolute; left: calc(100% - 2px); top: -6px; min-width: 210px; padding: 5px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 34px rgba(6, 40, 63, .22); }
.ctx-sub:hover > .ctx-submenu, .ctx-sub:focus-within > .ctx-submenu { display: block; }
/* Zu nah am rechten Rand: Untermenues nach links aufklappen. */
.ctx-menu.ctx-flip .ctx-submenu { left: auto; right: calc(100% - 2px); }
.ctx-menu.ctx-up .ctx-submenu { top: auto; bottom: -6px; }
.ctx-menu .ctx-danger, .ctx-menu .ctx-danger .icon { color: var(--crit); }
.ctx-menu .ctx-danger:hover, .ctx-menu .ctx-danger:focus { background: var(--crit-bg); color: var(--crit); }
.row-menu-cell { width: 36px; padding-left: 0 !important; }
.row-menu { display: inline-flex; padding: 4px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.row-menu:hover, .row-menu:focus-visible { background: var(--info-bg); color: var(--navy); outline: none; }
.row-menu .icon { width: 18px; height: 18px; }

/* ---------- Aktualisieren-Knopf in der Kopfzeile ---------- */
.topbar-refresh { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--navy); cursor: pointer; }
.topbar-refresh:hover, .topbar-refresh:focus-visible { background: var(--info-bg); border-color: var(--cyan); outline: none; }
.topbar-refresh .icon { width: 18px; height: 18px; margin: 0; }
.topbar-refresh.spinning .icon { animation: topbar-spin .7s linear infinite; }
@keyframes topbar-spin { to { transform: rotate(360deg); } }

/* ---------- Software verteilen ---------- */
details.card.more > summary { font-size: 15px; margin-bottom: 0; }
details.card.more[open] > summary { margin-bottom: 14px; }
.device-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 18px; margin: 4px 0 16px; padding: 12px 14px; background: var(--bg); border-radius: 6px; max-height: 260px; overflow-y: auto; }
.device-pick label { margin: 0; }
.package-pick { max-height: 200px; }
.package-admin { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.package-table td { padding-top: 5px; padding-bottom: 5px; }
.package-table input[type=text] { margin: 0; }

/* ---------- Zwei-Faktor-Einrichtung, Freigabe neuer Computer ---------- */
.twofa-setup { display: grid; grid-template-columns: minmax(240px, 320px) minmax(240px, 360px); gap: 28px; align-items: start; }
.twofa-setup svg { display: block; border: 1px solid var(--line); border-radius: 8px; }
@media (max-width: 760px) { .twofa-setup { grid-template-columns: 1fr; } }
.pending-card { border-left: 4px solid #e8a317; }

/* ---------- Automatisierung, Computer-Einstellungen ---------- */
.day-pick { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: -6px 0 12px; }
.day-pick label { margin: 0; }
.device-settings { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 18px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.device-settings label { margin: 0; }
.device-settings select, .device-settings input { width: auto; min-width: 190px; }

/* ---------- Bericht (druckbar) ---------- */
.report { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px 36px; max-width: 1050px; }
.report-head { display: flex; align-items: center; gap: 22px; padding-bottom: 18px; border-bottom: 2px solid var(--navy); margin-bottom: 20px; }
.report-head img { height: 34px; }
.report-head h2 { font-size: 21px; color: var(--navy); }
.report-head p { margin: 2px 0 0; color: var(--muted); }
.report-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 8px; }
.report-kpis div { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; color: var(--muted); font-size: 13px; }
.report-kpis b { display: block; font-size: 24px; color: var(--navy); }
.report h3 { margin-top: 26px; }
.report table { width: 100%; border-collapse: collapse; font-size: 13px; }
.report th, .report td { text-align: left; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.report th { color: var(--muted); font-weight: 600; }
.report .num { text-align: right; }
.report-foot { margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
@media print {
  .sidebar, .topbar, .no-print, .flash { display: none !important; }
  body { display: block; background: #fff; }
  .main, .content { margin: 0 !important; padding: 0 !important; }
  .report { box-shadow: none; padding: 0; max-width: none; }
  .report tr { break-inside: avoid; }
  .badge { border: 1px solid currentColor; }
}

/* ---------- Speicherziel ---------- */
.storage-form { display: grid; grid-template-columns: 2fr 90px 1.4fr 1.6fr 1.6fr; gap: 12px 16px; align-items: end; margin-bottom: 8px; }
.storage-form label { margin: 0; }
@media (max-width: 1100px) { .storage-form { grid-template-columns: 1fr 1fr; } }

/* ---------- Lizenz ---------- */
.license-plans { align-items: stretch; max-width: 860px; margin-left: auto; margin-right: auto; }
.license-plan { display: flex; flex-direction: column; border: 2px solid var(--line); cursor: pointer; transition: border-color .15s; }
.license-plan:hover { border-color: #9fd9ee; }
.license-plan.is-selected { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0, 163, 215, .15); }
.license-price { font-size: 28px; font-weight: 600; color: var(--navy); margin: 6px 0 10px; }
.license-price span { font-size: 13px; font-weight: 400; color: var(--muted); }
.license-points { list-style: none; padding: 0; margin: 0 0 16px; flex: 1; }
.license-points li { padding: 4px 0 4px 22px; position: relative; }
.license-points li::before { content: "\2713"; position: absolute; left: 0; color: var(--ok); font-weight: 700; }
.license-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; margin: 0 0 14px; }
.license-facts dt { color: var(--muted); font-size: 12.5px; }
.license-facts dd { margin: 0; }
dialog .license-facts { grid-template-columns: 1fr; }
.license-expired { border-left: 4px solid #e8a317; }
.license-sync { max-width: 280px; white-space: normal; margin-top: 4px; }
@media (max-width: 900px) { .license-plans { grid-template-columns: 1fr; } .license-facts { grid-template-columns: 1fr; } }
.license-bill { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; max-width: 640px; margin-bottom: 14px; }
.license-bill label { margin: 0 0 8px; }
.license-bill-wide { grid-column: 1 / -1; }
@media (max-width: 600px) { .license-bill { grid-template-columns: 1fr; } }

/* ---------- Alle Mandanten: viele Spalten, deshalb umbrechende Spaltenkoepfe statt Querrollen ---------- */
.overview-table th { white-space: normal; vertical-align: bottom; line-height: 1.25; }
.overview-table th.num { max-width: 110px; }
.overview-table td.row-actions { width: 1%; }

.release ul { margin: 6px 0 0; padding-left: 20px; }
.release li { margin: 3px 0; }
.release h2 .badge { vertical-align: 2px; margin-right: 4px; }
