/* ============================================================================
   RegioSystem Control Panel - Design-System (CP 1.21.47, 20.09.2026)
   ----------------------------------------------------------------------------
   Eine Quelle fuer Farben, Abstaende, Typografie und Bausteine. Ersetzt den
   ersten <style>-Block aus index.php. Die alten Klassennamen (.card, .btn,
   .badge, .tab, .stats-bar, .button ...) bleiben gueltig, damit die noch nicht
   umgebauten Reiter weiter funktionieren - sie bekommen nur das neue Aussehen.
   Reiter werden einzeln auf die neuen Bausteine (.tile, .seg, .field ...)
   umgestellt; der erste ist Fleet.
   Cache: nginx liefert Assets mit "expires max", index.php haengt deshalb
   ?v=<mtime> an. Wer diese Datei aendert, bekommt automatisch eine neue URL.
   ============================================================================ */

:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --border: #e3e8ef;
  --border-strong: #cbd3de;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #e8f0fe;
  --success: #15803d;
  --success-soft: #e7f6ec;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-soft: #fdecec;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --info: #0369a1;
  --info-soft: #e0f2fe;
  --neutral-soft: #eef1f5;

  --radius-s: 6px;
  --radius: 10px;
  --radius-l: 14px;
  --shadow-s: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 8px 24px -16px rgba(15, 23, 42, .18);
  --shadow-l: 0 12px 40px -12px rgba(15, 23, 42, .28);
  --focus: 0 0 0 3px rgba(37, 99, 235, .25);

  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --nav-w: 216px;
  --header-h: 60px;
  --gap: 16px;
}

/* ---------- Basis ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font); font-size: 14px; line-height: 1.5;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, kbd { font-family: var(--mono); font-size: 12.5px; }
h1 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
h1 small { color: var(--muted); font-weight: 400; font-size: 13px; }
h2 { font-size: 17px; font-weight: 650; letter-spacing: -.01em; margin-bottom: 12px; color: var(--text); }
h3 { font-size: 14px; font-weight: 650; color: var(--text); }
p { color: var(--text-2); }
small { color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
::selection { background: var(--primary-soft); }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-s); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-box {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-l); padding: 32px; box-shadow: var(--shadow-l);
}
.login-box .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.login-box h1 { font-size: 18px; }
.login-box input {
  width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-s); font-size: 15px; margin-bottom: 12px; background: #fff; color: var(--text);
}
.login-box input:focus { border-color: var(--primary); box-shadow: var(--focus); outline: none; }
.login-box button {
  width: 100%; height: 42px; background: var(--primary); color: #fff; border: 0;
  border-radius: var(--radius-s); font-size: 15px; font-weight: 600; cursor: pointer;
}
.login-box button:hover { background: var(--primary-hover); }
.error { color: var(--danger); font-size: 13px; margin-bottom: 12px; }

/* ---------- Kopfzeile ---------- */
.cp-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  background: rgba(255, 255, 255, .92); backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.cp-header-in {
  max-width: 1480px; margin: 0 auto; height: 100%; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.35), 0 2px 8px rgba(37, 99, 235, .35);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px; letter-spacing: -.02em;
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.brand-sub { font-size: 12px; color: var(--muted); }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--neutral-soft); color: var(--text-2);
}
.pill-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.header-actions form { display: inline; }

/* ---------- Seitenlayout ---------- */
.container { max-width: 1480px; margin: 0 auto; padding: 20px 24px 60px; }
.msg {
  padding: 12px 14px; background: var(--success-soft); color: var(--success);
  border: 1px solid #bfe3cb; border-radius: var(--radius); margin-bottom: 16px; white-space: pre-wrap;
}

.cp-layout { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); gap: 24px; align-items: start; }
/* min-width:0 auf beiden Spalten: ohne das erzwingt die Reiterleiste ihre
   intrinsische Breite (gemessen 1299px bei 375px Viewport) und die ganze Seite
   scrollt horizontal - das overflow-x:auto der Leiste wird nie wirksam. */
.cp-nav, .cp-main { min-width: 0; }
.cp-nav { position: sticky; top: calc(var(--header-h) + 16px); }
.cp-nav-title { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); padding: 0 12px 8px; }
.tabs-wrap { position: relative; }
.tabs { display: flex; flex-direction: column; gap: 2px; }
.tab {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px 12px; border: 0; border-radius: var(--radius-s); background: transparent;
  color: var(--text-2); font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer;
  position: relative; white-space: nowrap;
}
.tab:hover { background: var(--surface-3); color: var(--text); }
.tab.active { background: var(--surface); color: var(--primary); font-weight: 650; box-shadow: var(--shadow-s); }
.tab.active::before {
  content: ''; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px; border-radius: 3px; background: var(--primary);
}
.cp-main { min-width: 0; }
.tab-content { display: none; }
.tab-content.active { display: block; animation: cp-fade .18s ease-out; }
@keyframes cp-fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* Alte Topbar (falls noch irgendwo referenziert) */
.topbar { display: none; }

/* ---------- Kennzahlen ---------- */
.stats-bar {
  display: grid; gap: 12px; margin-bottom: 20px;
  /* auto-fit statt fester Spaltenzahl: die Leiste passt sich jeder Breite an,
     statt an drei Bruchstellen umzuspringen und eine Karte allein zu lassen. */
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-s); min-width: 0;
}
.stat-card .number { font-size: 26px; font-weight: 750; letter-spacing: -.02em; color: var(--text); line-height: 1.15; }
.stat-card .number small { font-size: 12px !important; color: var(--muted) !important; font-weight: 500; }
.stat-card .label { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat-card.clickable { cursor: pointer; transition: box-shadow .15s, transform .15s, border-color .15s; }
.stat-card.clickable:hover { box-shadow: var(--shadow); transform: translateY(-1px); border-color: var(--border-strong); }
.stat-card.clickable.active-filter { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

/* ---------- Karten ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l);
  padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow-s);
}
.card .card { box-shadow: none; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin-bottom: 2px; }
.card-head .sub { font-size: 13px; color: var(--muted); }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Kacheln (Fleet u.a.) */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--gap); }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0;
}
.tile-head { display: flex; align-items: center; gap: 10px; }
.tile-icon {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-size: 17px;
  background: var(--surface-3); flex: 0 0 auto;
}
.tile-icon.primary { background: var(--primary-soft); }
.tile-icon.danger  { background: var(--danger-soft); }
.tile-icon.success { background: var(--success-soft); }
.tile-icon.warn    { background: var(--warn-soft); }
.tile-icon.info    { background: var(--info-soft); }
.tile-head h3 { font-size: 14px; }
.tile-desc { font-size: 12.5px; color: var(--muted); }
.tile-body { display: flex; flex-direction: column; gap: 8px; }
.tile-foot { margin-top: auto; padding-top: 4px; font-size: 11.5px; color: var(--muted-2); }
.tile.danger { border-color: #f3c4c4; background: linear-gradient(180deg, #fff, #fff8f8); }

/* ---------- Formulare ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label, .label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 11.5px; color: var(--muted); }
input[type=text], input[type=number], input[type=password], input[type=search], input[type=url], select, textarea {
  font: inherit; font-size: 13.5px; color: var(--text); background: #fff;
  border: 1px solid var(--border-strong); border-radius: var(--radius-s);
  height: 36px; padding: 0 10px; width: 100%; max-width: 100%;
}
textarea { height: auto; padding: 8px 10px; min-height: 80px; resize: vertical; }
select { padding-right: 28px; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 9px center; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.input-row { display: flex; gap: 8px; align-items: center; }
.input-row > * { min-width: 0; }
.input-addon { font-size: 12.5px; color: var(--muted); white-space: nowrap; }

/* ---------- Knoepfe ---------- */
.btn, .button, button.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-s); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s, transform .06s;
  text-decoration: none; line-height: 1;
}
.btn:hover, .button:hover { background: var(--surface-2); border-color: #b9c3d1; text-decoration: none; }
.btn:active, .button:active { transform: translateY(1px); }
.btn-primary, .button-primary, .button.button-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover, .button-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.95); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 11.5px; }
.btn-block { width: 100%; }
.btn:disabled, .button:disabled, button:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy::after {
  content: ''; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; color: #fff; opacity: .9;
  animation: cp-spin .7s linear infinite;
}
.btn:not(.btn-primary):not(.btn-danger):not(.btn-success).is-busy::after { color: var(--primary); }
@keyframes cp-spin { to { transform: rotate(360deg); } }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* Segment (An / Aus) */
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-s); overflow: hidden; background: #fff; }
.seg button {
  height: 32px; padding: 0 14px; border: 0; background: transparent; font: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--text-2); cursor: pointer; border-right: 1px solid var(--border);
}
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--surface-2); }
.seg button.on:hover  { background: var(--success-soft); color: var(--success); }
.seg button.off:hover { background: var(--neutral-soft); color: var(--text); }
.seg-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.seg-row .seg-label { font-size: 13px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 8px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650; line-height: 1.6; }
.badge-online, .badge-ok  { background: var(--success-soft); color: var(--success); }
.badge-offline, .badge-broken, .badge-fail { background: var(--danger-soft); color: var(--danger); }
.badge-sleep, .badge-skip { background: var(--neutral-soft); color: var(--muted); }
.badge-idle, .badge-warn  { background: var(--warn-soft); color: var(--warn); }
.badge-working, .badge-info { background: var(--info-soft); color: var(--info); }
.badge-broken { font-weight: 750; }

/* ---------- Tabellen ---------- */
table { width: 100%; border-collapse: collapse; }
.card table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; }
th { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2); white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; color: var(--text); vertical-align: middle; }
tr:hover td { background: var(--surface-2); }
tfoot td { font-weight: 650; background: var(--surface-2); }
.table-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table-wrap table { display: table; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.progress-bar { background: var(--surface-3); border-radius: 4px; height: 8px; width: 120px; display: inline-block; vertical-align: middle; overflow: hidden; }
.progress-fill { background: var(--primary); height: 100%; border-radius: 4px; transition: width .3s; }

/* ---------- Hinweise / Leerzustaende ---------- */
.note { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; font-size: 12.5px; color: var(--text-2); background: var(--surface-2); }
.note-warn { background: var(--warn-soft); border-color: #f1dc9a; color: var(--warn); }
.note-info { background: var(--info-soft); border-color: #b6dff5; color: var(--info); }
.note-danger { background: var(--danger-soft); border-color: #f3c4c4; color: var(--danger); }
.empty { color: var(--muted); font-size: 13px; padding: 14px 0; text-align: center; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; }
.update-box { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.update-box label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }

/* ---------- Fleet: Ergebnis-Panel ---------- */
.fleet-result { border: 1px solid var(--border); border-radius: var(--radius-l); background: var(--surface); overflow: hidden; margin-bottom: 16px; }
.fleet-result-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.fleet-result-head strong { font-size: 13.5px; }
.fleet-result-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.fleet-result-body { max-height: 380px; overflow: auto; }
.fleet-result-body table { display: table; }
.fleet-result-body td { padding: 6px 12px; font-size: 12.5px; }
.fleet-result-body tr.is-fail td { background: #fff8f8; }
.fleet-result-body tr.is-skip td { color: var(--muted); }
.fleet-result-progress { height: 3px; background: var(--surface-3); position: relative; overflow: hidden; }
.fleet-result-progress.is-active::after {
  content: ''; position: absolute; inset: 0; width: 35%; background: var(--primary); border-radius: 3px;
  animation: cp-indeterminate 1.1s ease-in-out infinite;
}
@keyframes cp-indeterminate { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
#fleet-result-text:empty { display: none; }
#fleet-result-text { padding: 12px 16px; font-size: 12px; white-space: pre-wrap; max-height: 300px; overflow: auto; border-top: 1px solid var(--border); }

/* ---------- Toasts ---------- */
.toast-host { position: fixed; right: 20px; bottom: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 40px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius);
  background: #0f172a; color: #fff; box-shadow: var(--shadow-l); font-size: 13px; line-height: 1.4;
  animation: cp-toast-in .18s ease-out; border-left: 4px solid var(--primary);
}
.toast.success { border-left-color: #22c55e; }
.toast.danger  { border-left-color: #ef4444; }
.toast.warn    { border-left-color: #f59e0b; }
.toast strong { display: block; font-weight: 650; }
.toast .toast-x { margin-left: auto; background: transparent; border: 0; color: #cbd5e1; cursor: pointer; font-size: 16px; line-height: 1; }
@keyframes cp-toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Kompatibilitaet fuer noch nicht umgebaute Reiter ---------- */
.mobile-grid-stack { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tools-subtab, .monitor-subtab { border-radius: var(--radius-s); }

/* ============================================================================
   MOBILE - uebernommen aus dem alten Block (Table->Card + Accordion), an die
   neuen Farben angepasst. Die Regeln sind bewusst vollstaendig behalten:
   sie tragen die Mobil-Bedienung aller Tabellen.
   ============================================================================ */
@media (max-width: 1100px) {
  .cp-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .cp-nav { position: static; }
  .cp-nav-title { display: none; }
  .tabs { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; gap: 4px; padding-bottom: 4px; }
  .tab { width: auto; flex: 0 0 auto; padding: 7px 12px; background: var(--surface); border: 1px solid var(--border); }
  .tab.active { border-color: var(--primary); box-shadow: none; }
  .tab.active::before { display: none; }
  .tabs-wrap::after {
    content: ''; position: absolute; top: 0; right: 0; width: 30px; height: 100%; pointer-events: none;
    background: linear-gradient(90deg, rgba(243,245,249,0), rgba(243,245,249,.95)); opacity: 0; transition: opacity .2s;
  }
  .tabs-wrap.is-scrollable::after { opacity: 1; }
}

@media (max-width: 768px) {
  .container { padding: 12px 12px 48px; }
  .cp-header-in { padding: 0 12px; }
  .brand-sub { display: none; }
  .stats-bar { gap: 10px; }
  .stat-card { padding: 12px 14px; }
  .stat-card .number { font-size: 22px; }
  .card { padding: 14px; }
  h2 { font-size: 16px; }
  .modal-dialog, .cp-modal > div { max-width: 92vw !important; padding: 18px !important; }
}

@media (max-width: 600px) {
  .card { padding: 12px; }
  .card table, .card table tbody, .card table tr, .card table td { display: block; width: 100%; }
  .card table { overflow-x: visible; }
  .card table thead { display: none; }
  .card table tr { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px; padding: 10px 12px; background: var(--surface); box-shadow: var(--shadow-s); }
  .card table tr:hover td { background: transparent; }
  .card table td { padding: 5px 0; border: none; border-bottom: 1px dashed var(--border); display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; text-align: right; min-height: 28px; }
  .card table td:last-child { border-bottom: none; }
  .card table td[data-label]::before { content: attr(data-label); font-weight: 600; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .3px; margin-right: 8px; text-align: left; flex-shrink: 0; max-width: 45%; }
  .card table td.mobile-primary, .card table td[data-label="Seite"], .card table td[data-label="Site"], .card table td[data-label="Host"], .card table td[data-label="Domain"] { flex-direction: column; align-items: flex-start; text-align: left; border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 2px; font-size: 15px; font-weight: 600; }
  .card table td.mobile-primary::before, .card table td[data-label="Seite"]::before, .card table td[data-label="Site"]::before, .card table td[data-label="Host"]::before, .card table td[data-label="Domain"]::before { display: none; }
  .card table td.mobile-primary small, .card table td[data-label="Seite"] small { font-weight: 400; color: var(--muted); font-size: 12px; display: inline-block; margin-top: 2px; }
  .card table td.mobile-checkbox { justify-content: flex-start; gap: 6px; }
  .card table td.mobile-checkbox::before { display: none; }
  .card table td[data-label="Status"]::before { display: none; }
  .card table td.mobile-actions, .card table td:last-child:not([data-label]) { justify-content: flex-start; flex-wrap: wrap; gap: 6px; padding-top: 8px; border-top: 1px solid var(--border); margin-top: 4px; border-bottom: none; }
  .card table td.mobile-actions::before { display: none; }
  .card table tr.ignored-header, .card table tr.fw-ignored-header { padding: 0; border: none; background: transparent; box-shadow: none; margin: 12px 0 6px 0; }
  .card table tr.ignored-header td, .card table tr.fw-ignored-header td { padding: 8px 10px; background: var(--surface-3) !important; border-radius: 6px; }
  .stats-bar { gap: 8px; }
  .stat-card { padding: 10px 12px; }
  .stat-card .number { font-size: 20px; }
  #fw-bulk-bar > div, #site-actions > div, .bulk-bar-row { flex-wrap: wrap !important; gap: 6px !important; }
  #fw-bulk-bar button, #site-actions button, #site-actions select, #site-actions input[type=number], .bulk-bar-row button { min-width: 44%; flex: 1; }
  #site-actions #selected-count { width: 100%; }
  .mobile-grid-stack, .tile-grid { grid-template-columns: 1fr !important; }
  .update-box { flex-direction: column; align-items: stretch; gap: 10px; }
  .costs-grid-2 { grid-template-columns: 1fr !important; }
  #ssm-cards-grid { grid-template-columns: 1fr !important; }
  #pinglog-content, #ssm-log-content, #dm-log-content { font-size: 11px; padding: 10px; }
  .card table td .progress-bar { width: 100px; }
  .card table td[data-label="Fortschritt"] { flex-wrap: wrap; gap: 6px; }
  .card table td select { max-width: 55%; }

  /* Accordion: eingeklappt eine Zeile, Tap klappt auf (JS in index.php) */
  .card table tr { position: relative; cursor: pointer; padding-right: 26px; }
  .card table tr:not(.row-expanded):not(.ignored-header):not(.fw-ignored-header):not(.fleet-total-row) { display: flex; flex-direction: row; align-items: center; gap: 8px; padding: 8px 28px 8px 10px; min-height: 44px; margin-bottom: 6px; }
  .card table tr:not(.row-expanded):not(.ignored-header):not(.fw-ignored-header):not(.fleet-total-row) td { display: inline-flex; width: auto; flex: 0 0 auto; padding: 0; border: none; margin: 0; min-height: 0; background: transparent; }
  .card table tr:not(.row-expanded):not(.ignored-header):not(.fw-ignored-header):not(.fleet-total-row) td[data-label]:not([data-label="Seite"]):not([data-label="Site"]):not([data-label="Host"]):not([data-label="Domain"]):not([data-label="Status"]):not([data-label="DNS"]):not([data-label="HTTP"]):not(.mobile-checkbox) { display: none; }
  .card table tr:not(.row-expanded):not(.ignored-header):not(.fw-ignored-header):not(.fleet-total-row) td.mobile-actions { display: none; }
  .card table tr:not(.row-expanded) td[data-label="DNS"]::before, .card table tr:not(.row-expanded) td[data-label="HTTP"]::before { display: none; }
  .card table tr:not(.row-expanded) td[data-label="DNS"], .card table tr:not(.row-expanded) td[data-label="HTTP"] { font-size: 11px; color: var(--muted); padding: 0; flex: 0 0 auto; }
  .card table tr:not(.row-expanded):not(.ignored-header):not(.fw-ignored-header):not(.fleet-total-row) td.mobile-primary, .card table tr:not(.row-expanded) td[data-label="Seite"], .card table tr:not(.row-expanded) td[data-label="Site"], .card table tr:not(.row-expanded) td[data-label="Host"], .card table tr:not(.row-expanded) td[data-label="Domain"] { flex: 1 1 auto; min-width: 0; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-direction: row; align-items: center; text-align: left; }
  .card table tr:not(.row-expanded) td.mobile-primary br, .card table tr:not(.row-expanded) td[data-label="Seite"] br, .card table tr:not(.row-expanded) td[data-label="Site"] br { display: none; }
  .card table tr:not(.row-expanded) td.mobile-primary small, .card table tr:not(.row-expanded) td[data-label="Seite"] small, .card table tr:not(.row-expanded) td[data-label="Site"] small, .card table tr:not(.row-expanded) td[data-label="Host"] small, .card table tr:not(.row-expanded) td[data-label="Domain"] small { display: none; }
  .card table tr:not(.row-expanded) .offline-since { display: none; }
  .card table tr:not(.row-expanded) td.mobile-primary > a[href="#"], .card table tr:not(.row-expanded) td.mobile-primary > button, .card table tr:not(.row-expanded) td[data-label="Seite"] > a[href="#"], .card table tr:not(.row-expanded) td[data-label="Seite"] > button, .card table tr:not(.row-expanded) td[data-label="Site"] > a[href="#"], .card table tr:not(.row-expanded) td[data-label="Site"] > button { display: none; }
  .card table tr:not(.row-expanded) td[data-label="Status"] .badge { padding: 1px 5px; font-size: 14px; line-height: 1; }
  .card table tr:not(.ignored-header):not(.fw-ignored-header):not(.fleet-total-row)::after { content: '▸'; position: absolute; top: 50%; right: 10px; transform: translateY(-50%); color: var(--muted-2); font-size: 13px; pointer-events: none; transition: transform .15s; line-height: 1; }
  .card table tr.row-expanded::after { transform: translateY(-50%) rotate(90deg); color: var(--primary); top: 16px; }
  .card table tr.ignored-header, .card table tr.fw-ignored-header, .card table tr.fleet-total-row { cursor: default; padding-right: 0; }
  /* Fleet-Ergebnis bleibt eine echte Tabelle */
  .fleet-result-body table, .fleet-result-body tbody, .fleet-result-body tr, .fleet-result-body td { display: revert; }
  .fleet-result-body tr { cursor: default; padding: 0; border: 0; margin: 0; box-shadow: none; }
  .fleet-result-body tr::after { display: none; }
  .fleet-result-body thead { display: table-header-group; }
  .fleet-result-body td { border-bottom: 1px solid var(--border); text-align: left; }
  .fleet-result-body td::before { display: none; }
}

@media (max-width: 480px) {
  .stats-bar { gap: 6px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  .stat-card { padding: 10px; }
  .stat-card .number { font-size: 18px; }
  h2 { font-size: 15px; }
  .card { padding: 10px; }
  .btn, button.btn, button:not(.tab):not(.monitor-subtab):not(.toast-x):not(.seg button) { min-height: 40px; }
  .btn-sm { min-height: 34px; }
  .seg button { height: 38px; }
  input[type=checkbox] { width: 20px; height: 20px; }
  select, input[type=text], input[type=password], input[type=file], input[type=number], textarea { font-size: 16px; min-height: 40px; }
  .card h2 .btn, .card h2 button { float: none !important; display: inline-block; margin: 4px 4px 4px 0 !important; }
  .toast-host { right: 10px; left: 10px; bottom: 10px; max-width: none; }
}

/* ============================================================================
   Auswahl-Leiste an der Domain (Chef 21.09.: "muss immer unter der jeweiligen
   Domain kommen und nicht ganz oben - ist bei 1660 Domains bescheuert wenn ich
   dann nach oben scrollen muss").
   Die Leiste ist weiterhin EIN Element (#site-actions) mit allen Knoepfen; sie
   wird per JS in eine Zeile direkt unter der angeklickten Domain gehaengt.
   ============================================================================ */
tr.sel-anchor-row > td { padding: 0 !important; border-bottom: 0 !important; background: transparent !important; }
tr.sel-anchor-row:hover > td { background: transparent !important; }
#site-actions.sel-bar, #fw-bulk-bar.sel-bar {
  margin: 0 0 10px; border: 1px solid var(--primary); border-radius: var(--radius);
  background: var(--primary-soft); box-shadow: var(--shadow-s); padding: 10px 12px;
}
#site-actions.sel-bar .sel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
#site-actions.sel-bar .sel-dom { font-weight: 650; font-size: 13px; color: var(--text); }
#site-actions.sel-bar #selected-count { color: var(--primary); font-weight: 700; font-size: 13px; }
/* Die Zeile darueber (die gewaehlte Domain) markieren, damit der Bezug sichtbar ist. */
tr.is-selected-row > td { background: var(--primary-soft) !important; }
@media (max-width: 600px) {
  tr.sel-anchor-row { display: block; border: 0 !important; padding: 0 !important; box-shadow: none !important; background: transparent !important; cursor: default; margin: 0 0 8px !important; }
  tr.sel-anchor-row::after { display: none !important; }
  tr.sel-anchor-row > td { display: block !important; width: 100% !important; }
  #site-actions.sel-bar { padding: 10px; }
}
#site-actions.sel-bar .sel-context, #fw-bulk-bar.sel-bar .sel-context {
  font-size: 12px; font-weight: 650; color: var(--primary); margin-bottom: 8px;
}

/* ============================================================================
   MOBIL-NACHZUG 21.09. (gemessen bei 375px Viewport, Chef: schau dir die

/* ============================================================================
   MOBIL-NACHZUG 21.09. (gemessen bei 375px Viewport, Chef: "schau dir die
   mobil Darstellung an").
   1) Der Namens-Zelle fehlte das Schrumpfen: die generische Regel
      "tr:not(.row-expanded) td { flex: 0 0 auto }" hat mehr Spezifitaet als die
      spaeter notierte primary-Regel und hat deren "flex: 1 1 auto" ueberschrieben -
      lange Seitennamen schoben die Karte ueber den Bildschirmrand (gemessen
      381px breite Zellen bei 375px Viewport, 86 Zellen im RS-Reiter).
      Darum hier dieselbe :not-Kette, damit die Spezifitaet reicht.
   2) Lange Log-/Fehlertexte ohne Leerzeichen brauchen einen Umbruch, sonst
      diktieren sie die Tabellenbreite (gemessen 969px im Log-Reiter).
   ============================================================================ */
@media (max-width: 600px) {
  .card table tr:not(.row-expanded):not(.ignored-header):not(.fw-ignored-header):not(.fleet-total-row) td.mobile-primary,
  .card table tr:not(.row-expanded):not(.ignored-header):not(.fw-ignored-header):not(.fleet-total-row) td[data-label="Seite"],
  .card table tr:not(.row-expanded):not(.ignored-header):not(.fw-ignored-header):not(.fleet-total-row) td[data-label="Site"],
  .card table tr:not(.row-expanded):not(.ignored-header):not(.fw-ignored-header):not(.fleet-total-row) td[data-label="Host"],
  .card table tr:not(.row-expanded):not(.ignored-header):not(.fw-ignored-header):not(.fleet-total-row) td[data-label="Domain"] {
    flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  }
  .card table tr:not(.row-expanded) td[data-label="Seite"] > a,
  .card table tr:not(.row-expanded) td[data-label="Site"] > a,
  .card table tr:not(.row-expanded) td.mobile-primary > a {
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block;
  }
  .card table td { min-width: 0; overflow-wrap: anywhere; }
  .card table tr.row-expanded td { white-space: normal; }
  #tab-log table td, #tab-log pre, #tab-diag pre { overflow-wrap: anywhere; white-space: pre-wrap; }
  .card-head { flex-wrap: wrap; gap: 8px; }
  .card-head .card-actions { width: 100%; }
}

/* Log-Reiter: die Zeilen tragen keine data-label, deshalb greift die
   Accordion-Zusammenfassung nicht - die Zellen behalten ihre Inhaltsbreite
   (gemessen 976px bei 375px Viewport, 330 Zellen). Dort bleibt es bei der
   Karten-Darstellung mit Umbruch statt Akkordeon. */
@media (max-width: 600px) {
  #tab-log .card table tr { display: block; padding: 10px 12px; cursor: default; }
  #tab-log .card table tr::after { display: none !important; }
  #tab-log .card table td { display: block !important; width: 100% !important; max-width: 100% !important; flex: none !important; white-space: pre-wrap; overflow-wrap: anywhere; text-align: left; }
  #tab-updates .btn, #tab-updates button { max-width: 100%; overflow-wrap: anywhere; }
}

/* Deploy-Knoepfe im Updates-Reiter tragen inline "white-space:nowrap" und
   sind mit ihrem langen Text breiter als das Telefon (gemessen 368px Text
   bei 375px Viewport, Knopf ragte 19px ueber den Rand). Mobil umbrechen. */
@media (max-width: 600px) {
  #tab-updates .btn, #tab-updates button[type="submit"] { white-space: normal !important; max-width: 100%; }
}

/* Lange Domainnamen im Schluessel-Reiter stehen in einem <strong> innerhalb der
   Namenszelle. Die Zelle kuerzt zwar, das Kind selbst war aber weiterhin breiter
   als der Bildschirm (gemessen 416px bei 375px Viewport) - Kuerzung gehoert auf
   das Element, das den Text traegt. */
@media (max-width: 600px) {
  .card table td.mobile-primary > strong,
  .card table td[data-label="Seite"] > strong,
  .card table td[data-label="Site"] > strong,
  .card table td[data-label="Domain"] > strong {
    display: block; max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  }
}

/* Die Auswahl-Leiste haengt in einer Tabellenzelle und hat deren mobile
   Rechtsbuendigkeit geerbt - "Aktionen fuer <Domain>" stand rechts am Rand. */
@media (max-width: 600px) {
  tr.sel-anchor-row > td { text-align: left !important; }
  #site-actions.sel-bar, #fw-bulk-bar.sel-bar { text-align: left; }
}

/* Deploy-Fehler-Badge (Chef 22.09.: "das schau nicht professionell aus!").
   Ursache: die Badge traegt langen Fliesstext ("Lauf 5.8.47 22.09. meldete
   error: HTTP 500") als sichtbaren Inhalt, nicht nur als title-Tooltip. Die
   allgemeine .badge-Regel ist fuer kurze Ein-Wort-Labels gebaut
   (border-radius:999px, inline-flex, line-height:1.6) - bei mehrzeilig
   umbrochenem Text wird daraus ein verzerrter roter Blob statt einer Pille,
   der ueber Nachbarspalten hinausragt. Eigene Klasse statt Inline-Style,
   damit sich das gezielt reparieren laesst. */
.badge-deploy-error {
  display: block; background: #c0392b; color: #fff; font-size: 10.5px;
  font-weight: 600; border-radius: 6px; padding: 3px 7px; line-height: 1.35;
  white-space: normal; max-width: 220px; margin-top: 2px;
}
