:root {
  /* ── Proxmox-inspired Design Tokens ── */
  --bg:               #e8e9ea;   /* Hellgrauer Hintergrund wie PVE */
  --bg-sub:           #f4f4f4;
  --main-bg:          #e8e9ea;
  --header-height:    42px;      /* Kompakter Toolbar wie PVE */
  --footer-height:    28px;
  --card-bg:          #ffffff;
  --card-border:      #d0d3d8;

  --main-fg:          #333333;
  --muted-fg:         #7a8290;

  --primary:          #2d7dd2;   /* Steel Blue */
  --menu-border:      #d0d3d8;

  /* Header ist immer dunkel – wie der PVE-Toolbar */
  --header-bg:        #1d2228;
  --header-text:      #dde3ec;

  /* Sidebar ist immer dunkel – wie PVE */
  --sidebar-bg:       #252e3e;
  --sidebar-fg:       #c4cdd8;
  --sidebar-hover:    #35455a;
  --sidebar-hover-fg: #ffffff;

  --hover-bg:         #eceef2;
  --link-color:       #2d7dd2;
  --hover-text:       #1a5fa8;
  --container-head:   #8898b0;
  --status-running:   #2ea043;
  --status-stopped:   #cc3633;
  --footer-bg:        #1d2228;

  --modal-bg:         #ffffff;
  --modal-overlay:    rgba(0, 0, 0, 0.5);

  --input-bg:         #ffffff;
  --input-border:     #c0c5cc;
}

/* --- DARK MODE --- */
[data-theme="dark"] {
  --bg:               #1a1e27;
  --bg-sub:           #212730;
  --main-bg:          #1a1e27;
  --card-bg:          #242b38;
  --card-border:      #36404e;

  --main-fg:          #c8d2dc;
  --muted-fg:         #7a8898;

  --primary:          #5a9eff;   /* Helles Blau im Dunkelmodus */
  --menu-border:      #36404e;

  --header-bg:        #111318;
  --header-text:      #dde3ec;
  --sidebar-bg:       #18202c;
  --sidebar-fg:       #b8c4d0;
  --sidebar-hover:    #28384c;
  --sidebar-hover-fg: #e8eef4;
  --hover-bg:         #202838;
  --link-color:       #5a9eff;
  --hover-text:       #89baff;
  --container-head:   #7a8ea2;
  --status-running:   #3cb654;
  --status-stopped:   #dd4444;
  --footer-bg:        #111318;

  --modal-bg:         #2a3040;
  --modal-overlay:    rgba(0, 0, 0, 0.75);

  --input-bg:         #1a1e27;
  --input-border:     #36404e;
}

/* Globale Anwendung */
body {
    background-color: var(--bg);
    color: var(--main-fg);
    transition: background-color 0.3s, color 0.3s;
}

/* === Basislayout === */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: "Segoe UI", Arial, sans-serif;
  background-color: var(--main-bg);
  color: var(--main-fg);
    transition: background-color 0.3s ease, color 0.3s ease;
    font-size: 0.88em;
}

/* 1. Grundlayout und Hintergrund fixen (gegen weiße Lücken) */
body, #body-flex {
  background-color: var(--bg);
    margin: 0;
    height: 100vh;
    overflow: hidden; /* Scrollbars nur in den Bereichen, wo nötig */
}

#main-content {
  overflow-y: auto;
  max-height: calc(100vh - var(--header-height, 60px) - var(--footer-height, 50px));
  padding-bottom: 16px;
}

/* Hide chrome when not authenticated (Logo bleibt sichtbar) */
body.unauth #footer,
body.unauth #instance-sidebar,
body.unauth #sub-sidebar {
  display: none !important;
}
body.unauth .header-actions,
body.unauth .user-menu {
  display: none !important;
}
body.unauth #main-content {
  margin: 0;
  padding: 32px 16px;
  max-height: none;
  overflow: visible;
}

.resource-card .btn-action { padding: 6px 10px; }

/* === Firewall UI Modernization === */
.fw-container {
  max-width: 960px;
  border-top: 3px solid var(--primary);
}

.fw-header-info {
  background: var(--bg-sub);
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--card-border);
}

.fw-toggle-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

#fw-enabled {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.fw-toggle-title {
  font-weight: 600;
  font-size: 1rem;
}

.fw-toggle-status {
  color: var(--muted-fg);
  font-size: 0.85em;
}

.fw-warning-box {
  max-width: 45%;
  text-align: right;
  border-left: 2px solid var(--card-border);
  padding-left: 15px;
}

.fw-warning-title {
  color: var(--status-stopped);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.fw-warning-text {
  color: var(--muted-fg);
  font-size: 0.82rem;
  line-height: 1.3;
}

.fw-rows-container {
  margin-bottom: 20px;
}

.firewall-rule-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  padding: 8px;
  background: var(--bg-sub);
  border-radius: 6px;
  border: 1px solid var(--card-border);
}

.fw-col-action {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 130px;
}

.fw-status-icon {
  font-size: 1.1em;
}

.fw-col-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fw-col-port { width: 110px; }
.fw-col-source { flex: 1; }

.fw-source-controls {
  display: flex;
  gap: 6px;
  width: 100%;
}

.fw-label {
  color: var(--muted-fg);
  font-size: 0.75rem;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Specific Input & Select Overrides for Firewall Rules */
.firewall-rule-row input,
.firewall-rule-row select,
.fw-container select {
  background: var(--input-bg);
  color: var(--main-fg);
  border: 1px solid var(--input-border);
  padding: 5px 8px;
  border-radius: 4px;
  box-sizing: border-box;
  width: 100%;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.firewall-rule-row input:focus,
.firewall-rule-row select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(45, 125, 210, 0.15);
}

.fw-footer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 15px;
  border-top: 1px solid var(--menu-border);
}

.fw-button-group {
  display: flex;
  gap: 10px;
}

.fw-save-btn {
  font-weight: 700;
  padding: 6px 20px;
}

.fw-message-area {
  margin-top: 15px;
  text-align: center;
  font-weight: 500;
}

.rule-remove {
  padding: 4px 8px;
  min-width: unset;
}

/* Preset select styling (small control next to source) */
.rule-source-preset {
  padding: 5px 8px;
  border-radius: 4px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--main-fg);
}

/* Make select a bit narrower and aligned */
.fw-col-source .rule-source-preset { width: 160px; }
.fw-col-source .rule-source { min-width: 0; }

@media (max-width: 720px) {
  .fw-container {
    max-width: none;
    padding: 12px;
  }

  .fw-header-info {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 10px;
  }

  .fw-toggle-area {
    width: 100%;
  }

  .fw-warning-box {
    max-width: none;
    text-align: left;
    border-left: none;
    border-top: 1px solid var(--card-border);
    padding-left: 0;
    padding-top: 12px;
  }

  .fw-rows-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .firewall-rule-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-items: stretch;
    padding: 12px;
    margin-bottom: 0;
  }

  .fw-col-action,
  .fw-col-meta,
  .fw-col-port,
  .fw-col-source {
    min-width: 0;
    width: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .fw-col-action {
    grid-column: 1 / -1;
  }

  .fw-status-icon {
    align-self: flex-start;
    margin-top: 8px;
  }

  .fw-source-controls {
    flex-direction: column;
  }

  .fw-col-source .rule-source-preset {
    width: 100%;
  }

  .rule-remove {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 40px;
    justify-content: center;
  }

  .fw-footer-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .fw-button-group {
    flex-direction: column;
    width: 100%;
  }

  .fw-footer-actions > button,
  .fw-button-group > button {
    width: 100%;
  }

  .fw-save-btn {
    padding: 10px 16px;
  }

  .fw-message-area {
    text-align: left;
  }
}

@media (max-width: 520px) {
  .firewall-rule-row {
    grid-template-columns: 1fr;
  }

  .fw-col-action {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 10px;
  }

  .fw-col-action .rule-action {
    grid-column: 2;
  }

  .fw-label {
    font-size: 0.72rem;
  }
}
/* === Links === */
a {
    color: var(--link-color);
    transition: color 0.3s ease;
    text-decoration: none;
}
a:hover, a:focus {
    color: var(--hover-text);
    text-decoration: underline;
}

/* === Globale Button-Styles (Proxmox-Stil) === */
button, .btn {
  background: var(--primary);
  color: #fff;
  border: 1px solid rgba(0,0,0,0.2);
  padding: 4px 10px;
  border-radius: 3px;
  font-size: 0.86em;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.14s, opacity 0.14s;
  outline: none;
  margin: 0 3px 0 0;
  display: inline-block;
  line-height: 1.3;
  min-width: 58px;
}

button:hover,
button:focus,
.btn:hover,
.btn:focus {
  filter: brightness(1.1);
  border-color: rgba(0,0,0,0.28);
}

button:disabled,
.btn:disabled {
  background: #c4c9d9;
  color: #eef1f7;
  cursor: not-allowed;
  opacity: 0.7;
}

button.danger,
.btn.danger {
  background: #dc3545;
  color: #fff;
}
button.danger:hover,
.btn.danger:hover {
  background: #b72a37;
}

/* Alternative für Cancel/Secondary-Button */
button.secondary,
.btn.secondary {
  background: var(--hover-bg);
  color: var(--main-fg);
  border-color: var(--card-border);
  font-weight: 400;
}
button.secondary:hover,
.btn.secondary:hover {
  filter: brightness(0.95);
  background: var(--card-border);
}

/* Upload progress bar */
.upload-progress {
  position: relative;
  height: 18px;
  background: var(--card-border);
  border-radius: 8px;
  overflow: hidden;
  margin: 0 0 12px 0;
}
.upload-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #22c55e);
  width: 0%;
  transition: width 0.2s ease;
}
.upload-progress-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85em;
  color: #0b1220;
  text-shadow: 0 1px 2px #ffffffaa;
}
[data-theme="dark"] .upload-progress-text {
  color: #e6edf3;
  text-shadow: 0 1px 2px #00000088;
}

/* ── Images-Seite ──────────────────────────────────────────────── */
.images-upload-card,
.images-table-card,
.images-remote-card {
  padding: 14px;
  margin-bottom: 14px;
}

.images-upload-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 10px;
}

.images-form-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--muted-fg);
}
.images-form-label input:not([type="file"]),
.images-form-label select {
  padding: 4px 8px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  background: var(--input-bg);
  color: var(--main-fg);
  font-size: 0.88rem;
  min-width: 120px;
}
.images-form-label input[type="file"] {
  color: var(--main-fg);
  font-size: 0.85rem;
  max-width: 260px;
}

.images-form-actions {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  padding-bottom: 1px;
}

.images-remote-hint {
  margin: 4px 0 10px;
  color: var(--muted-fg);
  font-size: 0.85rem;
}

.images-remote-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 10px;
}

.images-remote-limit {
  color: var(--muted-fg);
  font-size: 0.85rem;
  align-self: flex-end;
  padding-bottom: 4px;
}

.images-arch-badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-sub);
  color: var(--muted-fg);
  border: 1px solid var(--card-border);
  margin-left: 5px;
  vertical-align: middle;
}

.images-dl-cell {
  text-align: right;
  white-space: nowrap;
}
.images-dl-cell-inner {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}
.images-dl-cell .alias-input {
  width: 140px;
  padding: 4px 8px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  background: var(--input-bg);
  color: var(--main-fg);
  font-size: 0.85rem;
}


/* === Dark Mode Button === */
.dark-mode-toggle {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s ease;
}

/* === Notification Boxen === */
.notif {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #323232;
    color: #fff;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.notif.show {
    opacity: 1;
}

.notif.error {
    background-color: #c0392b;
}

.notif.success {
    background-color: #27ae60;
}

/* === Utility Klassen === */
.hidden {
    display: none;
}

/* === Layout Container === */
#layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: var(--main-bg);
    color: var(--main-fg);
    min-height: 100vh;
}

/* === Header === */
header#header {
    background: var(--header-bg);
    color: var(--header-text);
    padding: 0 12px;
    height: var(--header-height, 42px);
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(0,0,0,0.45);
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
    z-index: 10;
}
.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.header-inner h1 {
    margin: 0;
    letter-spacing: 2px;
}
.header-inner h1 span {
    font-weight: 400;
    color: var(--primary);
}
.logo h1 {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 1.0rem;
  margin: 0;
}

.logo .mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.logo .wordmark {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.logo .wordmark .title { font-weight: 700; }
.logo .wordmark .subtitle { font-weight: 500; color: var(--muted-fg); font-size: 0.78rem; }
.user-info {
    background: #2224;
    padding: 0.2em 1em;
    border-radius: 1em;
}

/* === Hauptbereich mit Sidebar und Main === */
#body-flex {
    display: flex;
    flex: 1;
  min-height: 0;
  align-items: stretch;
    gap: 0; /* ÄNDERUNG: Von 8px auf 0 setzen, um den schwarzen Streifen zu entfernen */
}

/* === Sidebar === */
nav#instance-sidebar {
    background: var(--sidebar-bg);
    color: var(--sidebar-fg);
    width: 200px;
    min-width: 140px;
    max-width: 250px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(0,0,0,0.3);
    box-shadow: none;
  min-height: 0;
  align-self: stretch;
    overflow-y: auto;
    padding: 6px 5px;
}

/* Alle Listen in der Sidebar: Kein Padding, keine Aufzählungszeichen */
#instance-sidebar ul {
    margin: 0 0 1.6em 0;
    padding-left: 0;
    list-style: none !important; /* Entfernt die weißen Punkte auf UL-Ebene */
}

/* NEU: Explizit auch für die Listenelemente selbst deaktivieren */
#instance-sidebar li {
    list-style: none !important; /* Entfernt die weißen Punkte auf LI-Ebene */
    list-style-type: none !important;
    margin-bottom: 2px;
}

/* Überschriften der Sektionen (z.B. "Storage", "System") */
#instance-sidebar li strong {
    color: var(--container-head);
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 0.4em;
    font-size: 0.78rem;
    text-transform: uppercase;
    font-weight: 600;
    padding-left: 10px; /* Einrückung passend zu den Links */
}

/* Listenelemente für sauberen Abstand */
#instance-sidebar ul li {
    margin-bottom: 2px;
}

/* Alle Links in der Sidebar (Instanzen, Health Check, etc.) */
#instance-sidebar a {
    color: var(--sidebar-fg);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.45em;
    font-size: 0.92rem;
    padding: 4px 8px;
    border-radius: 3px;
    transition: background 0.1s;
}

/* Hover & Active State für alle Links */
#instance-sidebar a:hover,
#instance-sidebar a.active {
  background: var(--sidebar-hover);
  color: var(--sidebar-hover-fg);
}

.sidebar-header-node {
  margin-top: 10px;
  margin-bottom: 5px;
  color: var(--sidebar-fg);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.sidebar-header-node .sidebar-hostname {
  color: var(--sidebar-fg);
}

.sidebar-header-node .sidebar-hostip {
  font-size: 0.82rem;
  color: var(--muted-fg);
}

/* Farbige Status-Punkte */
#instance-sidebar .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0; /* Verhindert, dass der Punkt bei langem Text schrumpft */
}

/* Pools-Links in Sidebar */
.sidebar-section h4 {
  color: var(--container-head);
  margin: 1em 0 0.5em 0;
  font-size: 0.82rem;
  letter-spacing: 1px;
}

.sidebar-section ul {
  list-style: none;
  padding-left: 0.3em;
  margin-bottom: 1.6em;
}

.sidebar-section a.pool-link {
  color: var(--sidebar-fg);
  text-decoration: none;
  display: block;
  padding: 0.45em 1.1em 0.45em 0.4em;
  margin-bottom: 2px;
  transition: background 0.13s, color 0.13s;
}

.sidebar-section a.pool-link:hover,
.sidebar-section a.pool-link.active {
  background: var(--primary);
  color: #fff;
}

/* Kompaktere Container/VM-Einträge */
#instance-sidebar ul li {
    margin-bottom: 4px; /* weniger Abstand zwischen Einträgen */
}

#instance-sidebar a,
#instance-sidebar ul li a.instance-link {
    padding: 0.1em 0.4em;
    line-height: 1.15;
    display: flex;
    align-items: center;
    gap: 0.4em;
    font-size: 0.92rem;
}

#instance-sidebar ul li a .status-dot,
#instance-sidebar ul li a.instance-link .status-dot {
    width: 0.45em;
    height: 0.45em;
    margin-right: 0.4em;
}
#instance-sidebar ul li {
    padding: 0 0.15em; /* etwas horizontale Polsterung, optional */
}
/* Falls du noch kompakter willst, verringere margin-bottom weiter (z.B. 2px) */
#instance-sidebar.compact ul li { margin-bottom: 2px; }

/* Kleinere Status-Dots */
#instance-sidebar ul li a.instance-link .status-dot {
    width: 0.5em;
    height: 0.5em;
    margin-right: 0;
    box-shadow: none;
}


/* Status-Punkte */
.status-dot {
    display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:8px;
    /* Keine Hintergrundfarbe hier mit !important setzen */
}
.status-dot.dot-running { background-color:#28a745 !important; }
.status-dot.dot-stopped { background-color:#dc3545 !important; }
.status-dot.dot-error  { background-color:#f59e0b !important; }

/* === Sub-Sidebar === */
#sub-sidebar {
	background: var(--sidebar-bg);
    color: var(--sidebar-fg);
    width: 150px; /* schmaler */
    min-width: 140px;
    max-width: 150px;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 8px #0001;
  min-height: 0;
  align-self: stretch;
  flex-shrink: 0;
    overflow-y: auto;
    display: none;
    text-align: left; /* Text linksbündig */
}

#sub-sidebar ul {
    list-style: none;
    padding-left: 0.5em;
    margin: 0;
    text-align: left; /* Text linksbündig */
}

#sub-sidebar li {
    /* Keine Rechtsausrichtung */
    text-align: left;
}

/* Klickbare Links in Subsidebar */
#sub-sidebar a {
    color: var(--sidebar-fg);
    text-decoration: none;
    display: block;
    padding: 0.3em 0.6em;
    margin-bottom: 0.4em;
}

#sub-sidebar a:hover,
#sub-sidebar a.active {
    background: var(--primary);
    color: #fff;
    cursor: pointer;
}

/* 2. Sub-Sidebar Styling */
#sub-sidebar {
  width: 175px;
  background-color: var(--sidebar-bg);
  border-right: 1px solid rgba(0,0,0,0.3);
  display: none;
  flex-direction: column;
  min-height: 0;
  align-self: stretch;
  flex-shrink: 0;
  box-sizing: border-box;
  padding-top: 4px;
  transition: width 0.2s ease;
}

#sub-sidebar.is-visible {
    display: flex;
}

/* 3. Überschrift in der Sub-Sidebar */
#sub-sidebar h3 {
  color: var(--sidebar-fg);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 20px;
  margin-bottom: 10px;
  margin-top: 0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 4. Die Navigationsliste */
#sub-sidebar .subnav {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
}

#sub-sidebar .subnav li {
    margin: 0;
    width: 100%;
}

/* 5. Die Links (Buttons) */
.sub-nav-link {
  display: block;
  padding: 5px 12px;
  color: var(--sidebar-fg);
  text-decoration: none;
  font-size: 0.86rem;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background 0.1s;
}

/* Hover-Effekt */
.sub-nav-link:hover {
  background-color: var(--sidebar-hover);
  color: var(--sidebar-hover-fg);
}

/* Aktiver Zustand (ausgewählter Tab) */
.sub-nav-link.active {
  background-color: var(--sidebar-hover);
  color: var(--sidebar-hover-fg);
  border-left-color: var(--primary); /* Der blaue Akzent-Balken links */
  font-weight: 500;
}

/* === Main Content Bereich === */
main#main-content {
    flex: 1;
    padding: 10px 14px;
  background: var(--main-bg);
  min-height: 0;
    overflow: auto;
    box-sizing: border-box;
}

main h2 {
    margin-top: 0;
}

/* 6. Hauptinhalt anpassen, damit er direkt anschließt */
#main-content {
  flex: 1;
  background-color: var(--bg);
  overflow-y: auto;
  padding: 10px 14px;
}

/* === Footer === */
footer#footer {
    background: var(--footer-bg);
    color: #aab4c0;
    text-align: center;
    padding: 5px 0;
    font-size: 0.8em;
    letter-spacing: 0.5px;
    border-top: 1px solid rgba(0,0,0,0.4);
    box-shadow: none;
}

/* === Kontextmenü === */
#context-menu {
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    cursor: default;
    user-select: none;
}
.context-item {
    padding: 2px 4px;
    cursor: pointer;
}
.context-item:hover {
    background-color: var(--primary);
    color: white;
}

/* === Custom Alert === */
#custom-alert {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 5px;
    font-weight: bold;
    color: white;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 10000;
}

#custom-alert.show {
    opacity: 1;
    pointer-events: auto;
}

#custom-alert.success {
    background-color: #4caf50;
}

#custom-alert.error {
    background-color: #f44336;
}

#custom-alert.info {
    background-color: #2196f3;
}

#custom-alert.warning {
    background-color: #ff9800;
}

.modal.hidden {
  display: none !important;
}

/* === Modal NetworkTab === */

.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--modal-bg);
  z-index: 1100;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, visibility 0.2s;
  font-size: 0.94em;
}
.modal:not(.hidden) {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

/* Modal Inhalt */
.modal-content {
  background: var(--card-bg);
  color: var(--main-fg);
  border-radius: 6px;
  padding: 16px 18px 12px 18px;
  width: 330px;
  min-width: 0;
  box-shadow: 0 2px 18px rgba(50,60,100,0.11);
  font-family: inherit;
  font-size: 0.97em;
}

/* Überschrift */
.modal-content h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.09em;
  font-weight: 500;
  color: var(--main-fg);
  letter-spacing: 0.5px;
}

/* Formularfelder */
.modal-content form div {
  margin-bottom: 9px;
}

.modal-content label {
  display: block;
  margin-bottom: 2px;
  font-size: 0.98em;
  color: #475169;
  font-weight: 400;
}

.modal-content input[type="text"],
.modal-content select {
  width: 100%;
  padding: 5px 7px;
  font-size: 0.96em;
  border: 1px solid var(--menu-border);
  border-radius: 3px;
  background: var(--bg-sub);
  color: var(--main-fg);
  box-sizing: border-box;
  outline: none;
  transition: border 0.2s;
}

.modal-content input[type="text"]:focus,
.modal-content select:focus {
  border-color: var(--primary);
}

/* Button-Reihe */
.modal-content .button-row,
.modal-content [style*="text-align:right"] {
  margin-top: 11px !important;
  text-align: right;
}

/* Buttons */
.modal-content button {
  padding: 5px 13px;
  font-size: 0.95em;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  margin-left: 4px;
  margin-right: 0;
  background: var(--primary);
  color: #fff;
  transition: background 0.2s;
}

.modal-content .wizard-steps .wizard-step {
  background: transparent;
  color: var(--muted-fg);
  border: 1px solid transparent;
  border-bottom: none;
  margin-left: 0;
  padding: 4px 10px;
  border-radius: 4px 4px 0 0;
  box-shadow: none;
  min-width: 0;
}

.modal-content .wizard-steps .wizard-step:hover:not(.current) {
  background: var(--hover-bg);
  color: var(--main-fg);
  border-color: var(--menu-border);
}

.modal-content .wizard-steps .wizard-step.current {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.modal-content .wizard-steps .wizard-step.done {
  background: transparent;
  color: var(--muted-fg);
  border-color: transparent;
}

.modal-content .wizard-steps .wizard-step.done:hover {
  background: var(--hover-bg);
  color: var(--main-fg);
  border-color: var(--menu-border);
}

#modal-cancel-btn {
  background: #e5e8f0;
  color: #444;
}
#modal-cancel-btn:hover {
  background: #d0d6e3;
  color: #111;
}
#modal-save-btn {
  background: var(--primary);
  color: #fff;
}
#modal-save-btn:hover {
  background: #4863c6;
}

/* Netzwerk-Tabelle schöner machen */
#network-table {
  width: 100%;
  border-collapse: collapse;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

#network-table thead th {
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  padding: 10px;
  border-bottom: 2px solid var(--menu-border);
  text-align: left;
  font-weight: 500;
}

#network-table tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--menu-border);
}

/* Hover-Effekt */
#network-table tbody tr:hover {
  background: var(--hover-bg);
}

/* Ausgewählte Zeile grau markieren */
#network-table tbody tr.selected {
  background: #e2e6ea;      /* helles Grau */
}

/* Optional: Zebra-Streifen */
#network-table tbody tr:nth-child(even) {
  background: #fafafa;
}

/* === Info-Tabelle in der Übersicht === */
.instance-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--menu-border);
}

.instance-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--main-fg);
}

.instance-actions-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.instance-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.instance-action-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--menu-border);
  border-top-color: var(--main-fg);
  border-radius: 50%;
  animation: proggerlxc-spin 0.8s linear infinite;
}

.instance-actions-bar.is-loading .btn-action {
  opacity: 0.7;
  cursor: not-allowed;
}

.action-separator {
  width: 1px;
  height: 26px;
  background: var(--menu-border);
  flex: 0 0 1px;
}

/* Action-Buttons – gedämpfte Ghost-Variante */
.btn-action {
  padding: 4px 12px;
  min-width: 0;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.45;
  border-radius: 3px;
  background: var(--card-bg);
  color: var(--main-fg);
  border: 1px solid var(--card-border);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.btn-action.btn-success {
  color: #2d8040;
  border-color: #3a9950;
}
.btn-action.btn-success:hover {
  background: #e8f5ec;
  border-color: #2d8040;
}

.btn-action.btn-danger {
  color: #a03030;
  border-color: #b84040;
}
.btn-action.btn-danger:hover {
  background: #faeaea;
  border-color: #a03030;
}

.btn-action.btn-warning {
  color: #8a6018;
  border-color: #b08030;
}
.btn-action.btn-warning:hover {
  background: #fdf4e0;
  border-color: #8a6018;
}

.btn-action.btn-secondary {
  color: var(--muted-fg);
  border-color: var(--card-border);
}
.btn-action.btn-secondary:hover {
  background: var(--hover-bg);
  color: var(--main-fg);
}

[data-theme="dark"] .btn-action {
  background: transparent;
  border-color: #3a4858;
  color: var(--main-fg);
}
[data-theme="dark"] .btn-action.btn-success {
  color: #68c47d;
  border-color: #3d6e4a;
}
[data-theme="dark"] .btn-action.btn-success:hover {
  background: #192d22;
  border-color: #4d8a5c;
}
[data-theme="dark"] .btn-action.btn-danger {
  color: #c46868;
  border-color: #6e3d3d;
}
[data-theme="dark"] .btn-action.btn-danger:hover {
  background: #2d1919;
  border-color: #8a4d4d;
}
[data-theme="dark"] .btn-action.btn-warning {
  color: #c4a050;
  border-color: #6e5830;
}
[data-theme="dark"] .btn-action.btn-warning:hover {
  background: #2a2010;
  border-color: #8a7040;
}
[data-theme="dark"] .btn-action.btn-secondary {
  color: var(--muted-fg);
  border-color: #3a4858;
}
[data-theme="dark"] .btn-action.btn-secondary:hover {
  background: var(--hover-bg);
  color: var(--main-fg);
}

@keyframes proggerlxc-spin {
  to { transform: rotate(360deg); }
}

/* Kleine Screens: Header stapeln, Actions bleiben rechts */
@media (max-width: 720px) {
  .instance-header { align-items: flex-start; }
  .instance-actions-bar { justify-content: flex-end; }
  .action-separator { display: none; }
}

.info-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: none;
  font-size: 0.92em;
}

.table-scroll {
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--card-border);
  border-radius: 8px;
}

.table-scroll .info-table {
  border: none;
  margin: 0;
}

.group-block {
  border: 1px solid var(--card-border);
  box-shadow: 0 4px 14px rgba(0,0,0,0.06);
  border-radius: 10px;
}

.tab-toggle {
  display: inline-flex;
  gap: 6px;
  background: var(--bg-sub);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  margin: 6px 0 12px;
}

.tab-toggle .tab-btn {
  border: none;
  background: transparent;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--main-fg);
  font-weight: 600;
  box-shadow: none;
}

.tab-toggle .tab-btn.active {
  background: var(--primary);
  color: #fff;
}

.tab-panel {
  display: none;
}

.tab-panel.show {
  display: block;
}

.info-table tbody tr {
  border-bottom: 1px solid var(--menu-border);
}

.info-table tbody tr:last-child {
  border-bottom: none;
}

/* === System: Changelog Modal === */
.changelog-modal {
  max-width: 920px;
}

.changelog-loading {
  color: var(--muted-fg);
  font-size: 0.95em;
}

.changelog-error {
  padding: 10px 12px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--main-fg);
  border-radius: 8px;
}

.changelog-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 820px) {
  .changelog-grid {
    grid-template-columns: 1fr;
  }
}

.changelog-card {
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  border-radius: 10px;
  padding: 12px;
}

.changelog-card h4 {
  margin: 0 0 10px 0;
}

.changelog-kv {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 6px 10px;
  font-size: 0.92em;
}

.changelog-kv .k {
  color: var(--muted-fg);
}

.changelog-kv .v {
  color: var(--main-fg);
  overflow: hidden;
  text-overflow: ellipsis;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.changelog-commits-wrap {
  margin-top: 10px;
}

.changelog-subhead {
  color: var(--muted-fg);
  font-size: 0.9em;
  margin-bottom: 6px;
}

.changelog-commits {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
}

.changelog-commits li {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid var(--menu-border);
  border-radius: 8px;
  background: var(--bg-sub);
}

.changelog-commits .cl-sha {
  color: var(--muted-fg);
}

.changelog-commits .cl-msg {
  color: var(--main-fg);
}

.changelog-empty {
  color: var(--muted-fg);
  font-size: 0.92em;
}

.changelog-hint {
  margin-top: 10px;
  color: var(--muted-fg);
  font-size: 0.92em;
}

.info-table tbody tr:hover {
  background: var(--hover-bg);
}

.info-label {
  padding: 6px 10px;
  font-weight: 500;
  color: var(--muted-fg);
  text-align: left;
  width: 140px;
  vertical-align: middle;
  white-space: nowrap;
  font-size: 0.93rem;
}

.info-label .info-icon {
  margin-right: 5px;
  font-size: 1em;
  opacity: 0.7;
}

.info-value {
  padding: 6px 10px;
  color: var(--main-fg);
  text-align: left;
  font-weight: 400;
  vertical-align: middle;
  font-size: 0.93rem;
}

/* Status-Badge in der Tabelle hervorheben */
.info-value .status-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 2px;
  font-size: 0.78em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-badge.running {
  background: var(--status-running);
  color: #fff;
}

.status-badge.stopped {
  background: var(--status-stopped);
  color: #fff;
}

.status-badge.error {
  background: #f59e0b;
  color: #fff;
}

/* Responsivität: Auf kleinen Bildschirmen Labels über Werten stapeln */
@media (max-width: 600px) {
  .info-table {
    font-size: 0.9em;
  }
  .info-label, .info-value {
    display: block;
    width: 100%;
    padding: 8px 12px;
    text-align: left;
  }
  .info-table tbody tr {
    display: block;
    border-bottom: 1px solid var(--menu-border);
    margin-bottom: 8px;
  }
  .info-table tbody tr:last-child {
    margin-bottom: 0;
  }
}

/* Übersicht-Layout responsiv */
.overview-data {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
  margin: 8px 0 10px;
}

.overview-data-block {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 3px;
  padding: 8px 10px;
}

.overview-data-block h4,
.overview-graph-block h4 {
  margin: 0 0 6px 0;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-fg);
  border-bottom: 1px solid var(--menu-border);
  padding-bottom: 4px;
}

.bar-canvas {
  width: 100%;
  height: 24px; /* Bar-Höhe über CSS, JS liest nur aus */
  display: block;
}

.overview-graphs-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 10px;
}

.overview-graph-block {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 3px;
  padding: 8px 10px;
}

.graph-canvas {
  width: 100%;
  height: 240px; /* Diagrammhöhe über CSS definieren */
  display: block;
}

/* Kleinere Screens */
@media (max-width: 680px) {
  .graph-canvas { height: 200px; }
}

/* === Responsive === */
@media (max-width: 900px) {
    #body-flex {
        flex-direction: column;
    }
    nav#instance-sidebar {
        width: 100%;
        min-width: 0;
        max-width: none;
        flex-direction: row;
        overflow-x: auto;
        box-shadow: none;
        padding: 0.5em 0.5em;
    }
    #instance-sidebar ul {
        display: flex;
        flex-direction: row;
        margin-bottom: 1em;
        padding-left: 0;
    }
    #instance-sidebar li {
        margin: 0 0.6em 0 0;
    }
    #instance-sidebar a {
        border-radius: 5px;
    }
    main#main-content {
        padding: 1em 0.7em;
    }
    .overview-graphs-row {
        flex-direction: column;
        gap: 16px;
    }
    .overview-graph-block {
        min-width: 0;
        max-width: none;
        padding: 8px 6px 5px 8px;
    }
}

/* Responsive: Modal-Content für kleine Bildschirme */
@media (max-width: 600px) {
  .modal-content {
    width: 95vw;
    min-width: unset;
    padding: 10px 3vw 8px 3vw;
    font-size: 1em;
  }
}

/* Schlanke Balken für Ressourcen */
.bar-canvas {
  width: 100%;
  height: 16px;        /* gewünschte dünne Höhe */
}

/* === Ressourcen-Tab Layout === */
.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.resource-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 3px;
  padding: 12px;
  box-shadow: none;
}

.resource-card h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.1em;
  font-weight: 500;
  border-bottom: 1px solid var(--menu-border);
  padding-bottom: 8px;
}

.resource-card h3 .fas {
  margin-right: 8px;
  color: var(--primary);
}

.resource-card .bar-canvas {
  height: 20px;
  margin-bottom: 8px;
}

/* Verbesserte Styles für die Ressourcen-Seite */
.resources-grid .actions-card {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(0,0,0,0.02), transparent);
  border: 1px solid var(--card-border);
  border-radius: 6px;
}

/* Compact toolbar and toggles */
.resource-actions label { color: var(--muted-fg); font-size: 0.9em; }
.resource-actions input[type="checkbox"] { width: 16px; height: 16px; }

/* Collapsible cards support */
.resource-card.collapsed .bar-canvas,
.resource-card.collapsed canvas,
.resource-card.collapsed .resource-details { display: none !important; }
.resource-card .btn-icon { background: transparent; border: 0; cursor: pointer; }
.resource-card .btn-icon svg { display: block; }

.resource-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.resource-actions .btn {
  min-width: 92px;
  padding: 6px 12px;
}

.card-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-header-flex h3 {
  margin: 0;
  font-size: 1.02rem;
}

.resource-card { /* etwas größere Rundung und Innenabstand */
  border-radius: 8px;
  padding: 14px;
}

@media (max-width: 720px) {
  .resources-grid {
    grid-template-columns: 1fr;
  }
  .resources-grid .actions-card {
    flex-direction: column;
    align-items: stretch;
  }
  .resource-actions { justify-content: flex-start; flex-wrap: wrap; }
}

.resource-details {
  display: flex;
  justify-content: space-between;
  font-size: 0.9em;
  color: #667;
}

body.dark .resource-details {
  color: #bbb;
}

.resource-details.large-text {
    font-size: 1.2em;
    padding-top: 10px;
}

.resource-details b {
  color: var(--main-fg);
  font-weight: 600;
}

.network-card .resource-details {
  flex-direction: column;
  gap: 10px;
}

.net-interface {
  line-height: 1.4;
}

.net-interface strong {
  color: var(--main-fg);
}

.net-ips {
  font-size: 0.9em;
  font-family: 'Fira Mono', monospace;
  padding-left: 10px;
  color: #889;
}

body.dark .net-ips {
    color: #aaa;
}

/* === Sub-Sidebar Sichtbarkeit === */
#sub-sidebar.is-visible {
    display: flex !important;
}

/* Header Styles */
#header {
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-bottom: 1px solid rgba(0,0,0,0.45);
}
#header .logo {
  font-weight: 600;
  color: var(--header-text);
  text-decoration: none;
}
#header .logo:hover { text-decoration: underline; }

/* Kleinere Buttons */
.btn.small, button.small {
  padding: 2px 8px;
  font-size: 0.76rem;
  line-height: 1.25;
}

/* === Konsolen-Status-Overlay === */
.console-state-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: 3px;
  pointer-events: all;
}
.console-state-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: #c9d1d9;
  text-align: center;
  padding: 24px;
}
.console-state-message {
  font-size: 15px;
  opacity: 0.92;
  line-height: 1.5;
}

/* === Konsolen-Tab Layout === */
.console-mode-switcher {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
  flex-wrap: wrap;
}

.console-status-info {
  margin-left: auto;
  font-size: 12px;
  opacity: 0.75;
}

.console-terminal-container {
  width: 100%;
  height: 72vh;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 4px;
  overflow: hidden;
}

.console-terminal-container .terminal {
  width: 100% !important;
  height: 100% !important;
}

.console-terminal-container .xterm {
  width: 100% !important;
  height: 100% !important;
}

.console-terminal-container .xterm-viewport {
  width: 100% !important;
  scrollbar-width: thin;
}

.console-terminal-container .xterm-rows {
  padding: 0;
}

.console-gui-container {
  display: none;
  width: 100%;
  height: 72vh;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 4px;
}

.console-gui-hint {
  padding: 10px;
  opacity: 0.85;
  font-size: 13px;
  line-height: 1.5;
}

.console-connection-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
}

.console-connection-grid label {
  font-size: 12px;
  opacity: 0.8;
  white-space: nowrap;
}

.console-connection-grid input,
.console-connection-grid select {
  min-width: 0;
}

.console-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 10px;
}

.console-footer-info {
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.7;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* Mobile Optimierungen für Konsolen-Tab */
@media (max-width: 720px) {
  .console-mode-switcher {
    width: 100%;
  }

  .console-status-info {
    margin-left: 0;
    width: 100%;
    text-align: left;
  }

  .console-connection-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .console-connection-grid label {
    margin-top: 8px;
    font-weight: 600;
  }

  .console-connection-grid label:first-child {
    margin-top: 0;
  }

  .console-connection-grid input,
  .console-connection-grid select {
    width: 100%;
  }

  .console-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .console-actions button {
    width: 100%;
  }

  .console-terminal-container,
  .console-gui-container {
    height: 55vh;
  }

  .console-footer-info {
    flex-direction: column;
    align-items: flex-start;
  }

  .console-footer-info button {
    align-self: stretch;
    width: 100%;
  }

  /* === Mobile Sidebar: Horizontal-Scroll-Leisten === */

  /* Gesamtlayout: Spalten-Richtung */
  #body-flex {
    flex-direction: column;
    overflow: hidden;
  }

  /* Haupt-Sidebar: Horizontale Scroll-Leiste */
  nav#instance-sidebar {
    width: 100%;
    min-width: unset;
    max-width: unset;
    height: auto;
    min-height: unset;
    align-self: auto;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 6px;
    border-right: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.3);
    /* Smooth-Scroll für Touch */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--sidebar-hover) transparent;
    /* Inhalte nicht umbrechen */
    white-space: nowrap;
  }

  /* Abschnitts-Überschriften ausblenden (kein Platz in Horizontalleiste) */
  #instance-sidebar li strong,
  #instance-sidebar .sidebar-header-node {
    display: none;
  }

  /* UL-Elemente inline */
  #instance-sidebar ul {
    display: inline-flex;
    flex-direction: row;
    gap: 2px;
    margin: 0;
    padding: 0;
  }

  #instance-sidebar li {
    padding: 0;
    margin: 0;
  }

  /* Instanz-Links als kompakte Chips */
  #instance-sidebar a,
  #instance-sidebar ul li a.instance-link {
    padding: 5px 10px;
    font-size: 0.85rem;
    min-height: 32px;
    border-radius: 4px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
  }

  /* Status-Dots etwas größer für bessere Erkennbarkeit */
  #instance-sidebar ul li a .status-dot,
  #instance-sidebar ul li a.instance-link .status-dot {
    width: 7px;
    height: 7px;
    flex-shrink: 0;
  }

  /* Sub-Sidebar: Zweite horizontale Scroll-Leiste */
  #sub-sidebar {
    width: 100%;
    min-width: unset;
    max-width: unset;
    height: auto;
    min-height: unset;
    align-self: auto;
    flex-direction: row;
    flex-shrink: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 6px;
    border-right: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.3);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--sidebar-hover) transparent;
  }

  /* Instanzname-Überschrift in Sub-Sidebar ausblenden */
  #sub-sidebar h3 {
    display: none;
  }

  /* Navliste horizontal */
  #sub-sidebar .subnav {
    display: inline-flex;
    flex-direction: row;
    gap: 0;
    width: auto;
  }

  #sub-sidebar .subnav li {
    width: auto;
  }

  /* Tab-Links in Sub-Sidebar */
  .sub-nav-link {
    padding: 8px 14px;
    font-size: 0.85rem;
    border-left: none;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
  }

  .sub-nav-link:hover {
    border-bottom-color: var(--sidebar-hover-fg);
  }

  .sub-nav-link.active {
    border-left: none;
    border-bottom-color: var(--primary);
  }

  /* Main Content: volle Breite */
  main#main-content {
    width: 100%;
    padding: 8px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
  }
}
