:root {
  /* 🌞 LIGHT MODE (NEU STANDARD) */
  --bg: #eef2f7;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --border: #dbe2ea;
  --text: #0f172a;
  --muted: #64748b;

  --accent: #3f97cb;
  --accent-2: #537EFF24;
  --danger: #ef4444;

  --shadow: 0 6px 20px rgba(0,0,0,0.08);
  --radius: 18px;
  --hover: rgba(0,0,0,0.05);

  --success: #22c55e;
}

body.dark {
  --bg: #0b1220;
  --panel: #111a2b;
  --panel-2: #0f1726;
  --border: #24324a;
  --text: #e7edf7;
  --muted: #93a4bd;

  --shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
}

body {
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.25s ease;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 24px 18px;
  overflow-y: auto;
  overflow-x: hidden;
}

.brand {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-left {
  display: flex;
  gap: 12px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #16324d, #0d2238);
  color: var(--accent);
  font-size: 20px;
}

.brand-title {
  font-size: 24px;
  font-weight: 700;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 13px;

  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-toggle-btn {
  color: var(--text);   /* statt weiß */
  background: var(--panel-2);
  border: 1px solid var(--border);
  top: 20px;
  left: 35px;
  width: 30px;
  height: 30px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: background 0.2s ease, transform 0.2s ease;
  flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
  background: rgba(0,0,0,0.05);
}

.nav {
  display: grid;
  gap: 10px;
  margin-bottom: 28px;
}

.nav-item {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  text-align: left;
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 17px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(0,0,0,0.04);
}

.nav-btn {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  text-align: left;
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 17px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.nav-btn:hover {
  background: rgba(0,0,0,0.05);
}

.nav-btn.active {
  background: rgba(83, 126, 255, 0.14);
  border: 1px solid rgba(117, 156, 255, 0.35);
}

.sidebar-section {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.sidebar-section h3 {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar input {
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--muted);
}

.status {
  font-weight: 700;
}

.status.connected {
  color: var(--success);
}

.status.disconnected {
  color: #f59e0b;
}

.main {
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.topbar h1 {
  margin: 0;
  font-size: 34px;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  gap: 12px;
}

.btn {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--text);
  padding: 10px 16px;
  cursor: pointer;
}

.btn:hover {
  filter: brightness(1.1);
}

.btn.secondary {
  background: var(--panel-2);
}

.btn.danger {
  background: rgba(239,68,68,0.18);
  border-color: rgba(239,68,68,0.35);
  color: #ef4444;
}

.btn.primary {
  background: linear-gradient(135deg, #1f8f68, #166b50);
  border-color: #2aa579;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 18px;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 8px;
}

.stat-small {
  color: var(--muted);
  font-size: 14px;
}

.content-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  padding: 18px;
}

.large-panel {
  min-width: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-header h2 {
  margin: 0;
  font-size: 18px;
}

.badge {
  background: #15304c;
  color: #9fd2ff;
  border: 1px solid #244567;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.topic-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
}

.topic-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
}

.topic-name {
  font-weight: 600;
  word-break: break-word;
  margin-bottom: 6px;
}

.topic-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.empty-state {
  color: var(--muted);
  padding: 20px 0;
}

.table-wrap {
  overflow: auto;
  max-height: 520px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  position: sticky;
  top: 0;
  background: var(--panel);
  color: var(--muted);
  text-align: left;
  font-size: 13px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 12px;
  border-bottom: 1px solid rgba(36, 50, 74, 0.6);
  vertical-align: top;
}

.message-row {
  cursor: pointer;
}

.message-row:hover {
  background: rgba(0,0,0,0.05);
}

.message-row.selected {
  background: rgba(35, 196, 131, 0.12);
}

.topic-cell {
  color: #b48cff;
  word-break: break-word;
}

code {
  color: #b7f7cf;
  font-family: Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 24px;
}

.details-panel {
  padding: 18px;
}

#detailsBox {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  color: var(--text);
  min-height: 220px;
  max-height: 420px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.form-label {
  display: block;
  margin: 10px 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.full-width {
  width: 100%;
  margin-top: 12px;
}

.config-message {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  min-height: 18px;
}

.button-group-vertical {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.details-sections {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

#detailsBox,
.details-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  min-width: 0;
}

.details-card.full-width {
  grid-column: 1 / -1;
}

.details-card h3 {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--text);
}

.compact-card {
  padding: 14px 16px;
}

.details-meta {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 14px;
  opacity: 0.9;
}

.decoded-data-empty {
  color: var(--muted);
}

.decoded-row {
  display: grid;
  grid-template-columns: 1fr auto;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.decoded-key {
  opacity: 0.7;
}

.decoded-value {
  font-weight: 500;
}

.value-true {
  color: #4ade80;
}

.value-false {
  color: #f87171;
}

#detailsDevice {
  font-weight: 600;
  color: #e5e7eb;
}

.full-width-card {
  grid-column: 1 / -1;
}

#deviceRow,
#devEuiRssiRow {
  display: none;
}

#dashboardGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.dashboard-topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  margin: 0 0 18px;
  padding: 14px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 16px;
}

.dashboard-title-wrap {
  display: flex;
  flex-direction: column;

    min-width: 0;   /* 👈 NEU hinzufügen */
    flex: 1;        /* 👈 NEU hinzufügen */
}

.entity-filter-dropdown {
  position: relative;
}

.entity-filter-btn {
  border: 1px solid rgba(117, 156, 255, 0.35);
  background: rgba(83, 126, 255, 0.14);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
}

.entity-filter-btn:hover {
  background: rgba(0,0,0,0.05);
}

.entity-filter-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--panel-2);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  padding: 10px;
  display: none;
  z-index: 1001;
}

.entity-filter-dropdown.open .entity-filter-menu {
  display: block;
}

.entity-filter-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  color: var(--text);
  cursor: pointer;
}

.entity-filter-option input {
  width: 16px;
  height: 16px;
  margin: 0;
}

/* 🟢 CONNECTED */
.dashboard-connection-dot.connected {
    background: var(--success);
    animation: pulseDot 1.5s infinite;
}

.dashboard-device-card {
  background: var(--panel);
  border: 1px solid rgba(120, 150, 255, 0.18);
  border-radius: 16px;
  overflow: visible;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.dashboard-device-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  position: relative;
  background: var(--panel);
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.dashboard-device-card.via-lorawan .dashboard-device-header {
  background: linear-gradient(90deg, #3f97cb 0%, #3a8fc2 100%);
  color: #fff;
}

.dashboard-device-card.via-zigbee .dashboard-device-header {
  background: linear-gradient(90deg, #3a4255 0%, #4b5568 100%);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-right: 56px;
}

.dashboard-device-card.via-default .dashboard-device-header {
  background: linear-gradient(90deg, #4b5f86 0%, #5b6f96 100%);
  color: #fff;
}

.dashboard-device-icon {
  font-size: 28px;
  line-height: 1;
}

.dashboard-device-header-text {
  display: flex;
  flex-direction: column;
}

.dashboard-device-name {
  font-size: 16px;
  font-weight: 700;
}

.dashboard-device-subtitle {
  font-size: 12px;
  opacity: 0.9;
  margin-top: 2px;
}

.dashboard-device-body {
  padding: 14px 18px 16px;
  background: var(--panel);
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
}

.dashboard-entity-row-block {
  padding: 10px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.dashboard-entity-row-block:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.dashboard-entity-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text);
}

.dashboard-control-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.dashboard-control-row:last-child {
  margin-bottom: 0;
}

.dashboard-label {
  color: var(--text);
  font-size: 15px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.dashboard-range {
  width: 100%;
  max-width: 140px;
  cursor: pointer;
}

.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}

.switch input {
  display: none;
}

.slider {
  position: absolute;
  inset: 0;
  background: #6b7280;
  border-radius: 999px;
  transition: 0.2s ease;
  cursor: pointer;
}

.slider:before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s ease;
}

.switch input:checked + .slider {
  background: var(--accent);
}

.switch input:checked + .slider:before {
  transform: translateX(22px);
}

.effect-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
}

.effect-dropdown {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  z-index: 5;
}

.effect-selected {
  background: var(--panel-2);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 12px;
  padding: 8px 12px;
  min-height: 36px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.effect-selected::after {
  content: "▾";
  font-size: 12px;
  opacity: 0.8;
  margin-left: 10px;
  flex-shrink: 0;
}

.effect-selected-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.effect-dropdown.open {
  z-index: 40;
}

.effect-dropdown.open .effect-selected {
  border-color: rgba(117, 156, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.effect-dropdown.open .effect-selected::after {
  content: "▴";
}

.effect-options {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: var(--panel-2);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  display: none;
  padding: 6px 0;
}

.effect-dropdown.open .effect-options {
  display: block;
}

.effect-option {
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.effect-option:hover {
  background: rgba(0,0,0,0.05);
}

.effect-option.active {
  background: rgba(59, 130, 246, 0.22);
}

.app.sidebar-collapsed {
  grid-template-columns: 1fr;
}

.app.sidebar-collapsed .sidebar {
  position: fixed;
  left: -280px;
  top: 0;
  bottom: 0;
  width: 280px;
  min-width: 280px;
  overflow: hidden;
  z-index: 1200;
}

.app.sidebar-collapsed .brand {
  min-height: auto;
  padding: 0;
  margin: 0;
  justify-content: center;
}

.app.sidebar-collapsed .brand-left,
.app.sidebar-collapsed .brand-text,
.app.sidebar-collapsed .sidebar-section,
.app.sidebar-collapsed .connection-box,
.app.sidebar-collapsed .nav,
.app.sidebar-collapsed .brand-icon {
  display: none !important;
}

.app.sidebar-collapsed .sidebar-toggle-btn {
  position: fixed;
  top: 20px;
  left: 35px;
  width: 30px;
  height: 30px;
  border-radius: 5px;
  z-index: 1300;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  margin: 0;
}

.muted {
  opacity: 0.6;
}

@media (max-width: 1200px) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .app.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .app.sidebar-collapsed .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    width: 280px;
    min-width: 280px;
    padding: 0;
    overflow: hidden;
    border: none;
    background: transparent;
  }

  .app.sidebar-collapsed .sidebar-toggle-btn {
    position: fixed;
    top: 40px;
    left: 20px;
    width: 30px;
    height: 30px;
    border-radius: 5px;
    z-index: 1300;
    background: var(--panel);
    color: var(--text);
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    margin: 0;
  }

  .app.sidebar-collapsed #dashboardView .dashboard-topbar,
  .app.sidebar-collapsed #liveMonitorView .topbar,
  .app.sidebar-collapsed #settingsView .topbar {
    padding-left: 72px;
  }

  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
  }

  .details-sections {
    grid-template-columns: 1fr;
  }

  .main {
    padding: 20px 16px 24px;
  }

  .dashboard-topbar {
    margin: 0 -16px 18px;
    padding: 14px 16px 14px 72px;
  }

  .dashboard-topbar .topbar-actions {
    display: none;
  }

  .dashboard-topbar h1 {
    font-size: 30px;
  }

  .dashboard-topbar .subtitle {
    font-size: 15px;
  }

  #dashboardGrid {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-range {
    width: 150px;
  }

  .dashboard-control-row {
    gap: 10px;
  }

  .effect-row {
    gap: 10px;
  }

  .effect-selected {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 14px;
  }
}

.color-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.dashboard-color-input {
  width: 56px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 10px;
  background: var(--panel-2);
  cursor: pointer;
  overflow: hidden;
}

.dashboard-color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.dashboard-color-input::-webkit-color-swatch {
  border: none;
  border-radius: 8px;
}

.dashboard-color-input::-moz-color-swatch {
  border: none;
  border-radius: 8px;
}

.color-temp-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.dashboard-color-temp-range {
  width: 150px;
}

.color-temp-value {
  min-width: 58px;
  text-align: right;
  font-size: 13px;
  color: var(--muted);
}

@media (max-width: 900px) {
  .dashboard-color-temp-range {
    width: 120px;
  }

  .color-temp-value {
    min-width: 52px;
    font-size: 12px;
  }
}

.climate-entity-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.climate-temp-range {
  width: 150px;
}

@media (max-width: 900px) {
  .climate-stat-value {
    font-size: 16px;
  }

  .climate-temp-range {
    width: 120px;
  }
}

.climate-entity-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.climate-current-line {
  color: var(--muted);
  font-size: 14px;
}

.climate-current-line strong {
  color: var(--text);
  font-size: 20px;
  margin-left: 6px;
}

.climate-target-panel {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
}

.climate-target-label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.climate-target-value {
  font-size: 34px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}

.climate-adjust-row {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 14px;
}

.climate-adjust-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: var(--panel-2);
  color: var(--text);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.climate-adjust-btn:hover {
  background: var(--hover);
}

.climate-mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.climate-mode-btn {
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 14px;
}

.climate-mode-btn:hover {
  border-color: rgba(117, 156, 255, 0.4);
}

.climate-mode-btn.active {
  background: rgba(83, 126, 255, 0.18);
  border-color: rgba(117, 156, 255, 0.5);
}

.climate-temp-range {
  width: 150px;
}

@media (max-width: 900px) {
  .climate-target-value {
    font-size: 28px;
  }

  .climate-adjust-btn {
    width: 40px;
    height: 40px;
    font-size: 24px;
  }

  .climate-temp-range {
    width: 120px;
  }
}

.climate-target-value-btn {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: inherit;
}

.climate-target-value-btn:hover .climate-target-value {
  opacity: 0.9;
}

.climate-inline-slider-wrap {
  position: relative;
  width: 100%;
  max-width: 320px;
  margin: 8px auto 0; /* näher an Zahl */
}

.climate-slider-bubble.hidden {
  opacity: 0;
}

.climate-slider-bubble {
  position: absolute;
  top: -32px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e88e5;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.2s ease;
  transform: translateX(-50%);
}

.climate-slider-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #1e88e5;
}

.cover-entity-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cover-status-line {
  color: var(--muted);
  font-size: 14px;
}

.cover-status-line strong {
  color: var(--text);
  margin-left: 6px;
  text-transform: uppercase;
}

.cover-buttons-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.cover-action-btn {
  border: 1px solid rgba(117, 156, 255, 0.35);
  background: rgba(83, 126, 255, 0.14);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
}

.cover-action-btn:hover {
  background: rgba(0,0,0,0.05);
}

.cover-action-btn.secondary {
  background: var(--panel-2);
  border-color: rgba(148, 163, 184, 0.22);
}

.cover-position-range[disabled] {
  opacity: 0.85;
  cursor: default;
}

.lock-entity-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lock-status-line {
  color: var(--muted);
  font-size: 14px;
}

.lock-status-line strong {
  margin-left: 6px;
  color: var(--text);
}

.lock-status-line strong.lock-unlocked {
  color: #f59e0b;
}

.lock-status-line strong.lock-locked {
  color: #4ade80;
}

.lock-buttons-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.lock-action-btn {
  border: 1px solid rgba(117, 156, 255, 0.35);
  background: rgba(83, 126, 255, 0.14);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
}

.lock-action-btn:hover {
  background: rgba(0,0,0,0.05);
}

.lock-action-btn.active {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.16);
}

.disabled-like {
  opacity: 0.72;
}

.humidifier-device-class-line {
  color: var(--muted);
  font-size: 13px;
  margin-top: -4px;
}

.humidifier-slider-wrap {
  position: relative;
  width: 100%;
  max-width: 320px;
  margin: 8px auto 0;
}

.humidifier-slider-bubble {
  position: absolute;
  top: -32px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e88e5;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 10;
  transform: translateX(-50%);
}

.humidifier-slider-bubble.hidden {
  opacity: 0;
}

.humidifier-slider-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #1e88e5;
}

.humidifier-entity-block .climate-current-line {
  margin-bottom: 10px;
}

.cover-status-line strong {
  margin-left: 6px;
  text-transform: uppercase;
}

.cover-status-line strong.closed {
  color: #4ade80;
}

.cover-status-line strong.open {
  color: #f87171;
}

.lawn-mower-entity-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lawn-mower-status-line {
  color: var(--muted);
  font-size: 14px;
}

.lawn-mower-status-line strong {
  margin-left: 6px;
  color: var(--text);
}

.lawn-mower-status-line strong.mower-mowing {
  color: #4ade80;
}

.lawn-mower-status-line strong.mower-paused {
  color: #f59e0b;
}

.lawn-mower-status-line strong.mower-docked {
  color: #60a5fa;
}

.lawn-mower-buttons-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.lawn-mower-action-btn {
  border: 1px solid rgba(117, 156, 255, 0.35);
  background: rgba(83, 126, 255, 0.14);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
}

.lawn-mower-action-btn:hover {
  background: rgba(0,0,0,0.05);
}

.lawn-mower-action-btn.secondary {
  background: var(--panel-2);
  border-color: rgba(148, 163, 184, 0.22);
}

.entity-filter-actions {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 6px;
}

.entity-filter-actions button {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  font-size: 13px;
}

.entity-filter-actions button:hover {
  background: var(--hover);
}

.update-btn {
  margin-left: 8px;
  padding: 2px 6px;
  font-size: 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}

.update-btn:hover {
  filter: brightness(1.08);
}

.hidden {
  display: none;
}

.sensor-row-line {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.sensor-name-wrap {
    display: flex;
    align-items: center;
    gap: 6px;

    flex: 1;
    min-width: 0;
}

.sensor-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sensor-value {
    margin-left: auto;
    white-space: nowrap;
    text-align: right;
}

.sensor-row-line strong {
    white-space: nowrap;
}

.dashboard-device-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.main-icon {
  font-size: 26px;
  line-height: 1;
}

.sub-icons {
  display: flex;
  gap: 4px;
  font-size: 12px;
  opacity: 0.8;
  margin-top: 2px;
}

#dashboardGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.dashboard-device-card {
  min-width: 0;
}

.sensor-value.ok {
  color: #4ade80; /* grün */
}

.sensor-value.danger {
  color: #f87171; /* rot */
}

.button-entity-action {
  margin-left: auto;
  padding: 6px 12px;
  border-radius: 8px;
  background: #1d4ed8;
  border: 1px solid #60a5fa;
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
}

.button-inline-action {
  margin-left: auto;
  padding: 6px 12px;
}

.dashboard-slider-wrap {
  position: relative;
  width: 100%;
}

.dashboard-slider-bubble {
  position: absolute;
  top: -32px;
  transform: translateX(-50%);
  background: #1e88e5;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 10;
  transform: translateX(-50%);
}

.dashboard-slider-bubble.hidden {
  opacity: 0;
}

.dashboard-slider-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #1e88e5;
}

.number-slider-wrap {
  flex: 1;
  justify-content: flex-end;
}

.number-slider-wrap .dashboard-slider-wrap {
  max-width: 220px;
}

.number-slider-wrap .dashboard-range {
  width: 100%;
}

.number-control {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: flex-end;
  min-width: 0;
}

.number-control .dashboard-slider-wrap {
  width: 180px;
}

.number-input {
  width: 82px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 8px;
  text-align: right;
}

.number-unit {
  color: var(--muted);
  white-space: nowrap;
}

.dashboard-slider-wrap {
  position: relative;
  width: 100%;
  max-width: 160px;
  flex: 1 1 auto;
  min-width: 0;
}

.dashboard-slider-wrap .dashboard-range {
  width: 100%;
}

@media (max-width: 900px) {
  .dashboard-slider-wrap {
    width: 150px;
    flex-basis: 150px;
  }
}

.climate-target-panel .dashboard-slider-wrap {
  margin: 8px auto 0;
  width: 90%;
  flex: 0 0 auto;
}

.text-input {
  width: 180px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  text-align: right;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.text-input:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.25);
}

.app.sidebar-collapsed .dashboard-topbar,
.app.sidebar-collapsed #liveMonitorView .topbar {
  padding-left: 54px;
}

.app:not(.sidebar-collapsed) .sidebar-toggle-btn {
  position: sticky;
  top: 0;
  z-index: 10;
}

.live-filter input {
  width: 520px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.app.sidebar-collapsed .dashboard-topbar,
.app.sidebar-collapsed #liveMonitorView > .topbar,
.app.sidebar-collapsed #settingsView > .topbar {
  padding-left: 54px;
}

.prefix-add-row input {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.prefix-row {
  display: flex;
  justify-content: space-between;
  align-items: center; /* 👈 wichtig */
  gap: 12px;
  padding: 8px 0;
}

.prefix-actions {
  display: flex;
  gap: 8px;
}

.prefix-actions .btn {
  min-width: 90px;
  padding: 6px 10px;
  font-size: 13px;
}

#settingsView {
  display: flex;
  justify-content: center;
}

#settingsView .panel {
  width: 100%;
  max-width: 820px;
}

#settingsView {
  align-items: flex-start;
}

.zigbee-badge {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: grid;
  place-items: center;
}

.zigbee-badge img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.45));
}

#settingsView .card.panel + .card.panel {
  margin-top: 18px;
}

.custom-dashboard-add-device {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.custom-dashboard-add-device select {
  flex: 1;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 10px;
}

.custom-dashboard-device-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.custom-dashboard-device-card {
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: var(--panel-2);
  border-radius: 12px;
  padding: 10px;
}

.custom-dashboard-device-card summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.custom-dashboard-device-card summary span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.custom-dashboard-entities {
  margin-top: 10px;
  padding: 10px 0 0 14px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  display: grid;
  gap: 8px;
}

.small-btn {
  padding: 5px 9px;
  font-size: 12px;
  border-radius: 8px;
}

.dashboard-config-block {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: var(--panel-2);
  border-radius: 14px;
  padding: 12px;
  margin-top: 12px;
}

.dashboard-config-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.dashboard-config-block[open] .dashboard-config-header {
  margin-bottom: 12px;
}

.nav-dashboard-group {
  display: grid;
  gap: 6px;
}

.nav-dashboard-list {
  display: none;
  padding-left: 12px;
  margin-top: -4px;
}

.nav-dashboard-item {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  text-align: left;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  cursor: pointer;
  opacity: 0.85;
}

.nav-dashboard-item:hover,
.nav-dashboard-item.active {
  background: rgba(0,0,0,0.06);
  opacity: 1;
  color: var(--text);
}

.slider-minmax {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 3px;
  opacity: 0.75;
}

.dashboard-device-card[draggable="true"] {
  cursor: grab;
}

.dashboard-device-card[draggable="true"]:active {
  cursor: grabbing;
}

.dashboard-device-card.dragging {
  opacity: 0.45;
  transform: scale(0.98);
}

.drag-handle {
  font-size: 18px;
  opacity: 0.75;
  cursor: grab;
  user-select: none;
}

.dashboard-device-card.dragging .drag-handle {
  cursor: grabbing;
}

.drag-handle {
  font-size: 18px;
  opacity: 0.8;
  cursor: grab;
  user-select: none;
  padding: 4px 6px;
}

.dashboard-device-card.dragging {
  opacity: 0.45;
}

.dashboard-device-card.drag-over {
  outline: 2px dashed rgba(96, 165, 250, 0.9);
  outline-offset: 4px;
}

.custom-dashboard-add-device {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.custom-dashboard-add-device select {
  flex: 1 1 260px;
  min-width: 220px;
}

.custom-dashboard-add-device .btn {
  flex: 0 0 auto;
}

.sensor-name-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.sensor-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rename-btn {
  flex-shrink: 0;
}

.custom-entity-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.custom-entity-actions small {
  white-space: nowrap;
}

.rename-btn {
  flex-shrink: 0;
}

.custom-entity-name-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.custom-entity-name-wrap > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-device-name-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.custom-device-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.custom-device-left {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.custom-device-name-wrap strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.broker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.settings-broker-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;   /* 👉 mittig */
  max-width: 420px;
  margin: 0 auto;            /* 👉 Block selbst mittig */
}

.settings-broker-buttons .btn {
  flex: 1;
  max-width: 200px;          /* 👉 verhindert dass sie zu breit werden */
}

.broker-grid input {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 12px;
  outline: none;
}

.broker-grid input:focus {
  border-color: #3b82f6;
}

.broker-grid .form-label {
  display: block;
  margin-bottom: 6px;
}

.live-filter {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-filter #liveFilterInput {
  width: 420px;
}

.live-limit-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.live-limit-inline #liveMessageLimitInput {
  width: 78px;
  flex: 0 0 78px;
  height: 32px;
  padding: 0 8px;
}

.live-limit-label {
  white-space: nowrap;
  font-size: 13px;
  color: var(--muted);
}

.dashboard-connection-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;

    display: inline-block;
    margin-left: 10px;

    position: relative;
}

/* 🔴 DISCONNECTED */
.dashboard-connection-dot.disconnected {
    background: #ff4d4f;
    box-shadow: 0 0 6px rgba(255, 77, 79, 0.6);
}


/* 🟢 Ring */
.dashboard-connection-dot.connected::after {
    content: '';
    position: absolute;

    top: 50%;
    left: 50%;

    width: 20px;
    height: 20px;

    transform: translate(-50%, -50%);

    border-radius: 50%;
    border: 1px solid rgba(34, 197, 94, 0.45);
}

/* 🟢 Pulsieren */
@keyframes pulseDot {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

.global-status {
    position: fixed;
    top: 10px;
    right: 20px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-toggle-btn {
    width: 38px;
    height: 38px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: var(--panel);
    color: var(--text);

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 18px;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.theme-toggle-btn:hover {
    background: var(--hover);
    transform: translateY(-1px);
}

.dashboard-tabs {
    display: flex;
    gap: 6px;
    align-items: flex-end;

    margin-top: 6px;
    padding-bottom: 2px;

    flex-wrap: wrap;   /* 👈 NEU hinzufügen */
}

/* BASIS TAB */
.dashboard-tab {
    position: relative;

    border: 1px solid rgba(148, 163, 184, 0.25);

    font-size: 14px;

    padding: 10px 16px;
    border-radius: 12px 12px 0 0;

    cursor: pointer;
    transition: all 0.2s ease;

    display: flex;
    align-items: center;
    gap: 8px;

    flex-shrink: 0;      /* 👈 NEU */
    white-space: nowrap; /* 👈 NEU */
}

.dashboard-tab {
    background: var(--panel-2);
    color: var(--muted);
}

.dashboard-tab:hover {
    background: rgba(0,0,0,0.05);
    color: var(--text);
}

.dashboard-tab.active {
    background: var(--accent-2);
    color: var(--text);

    border-top: 1px solid #94a3b8;
    border-left: 1px solid #94a3b8;
    border-right: 1px solid #94a3b8;
    border-bottom: 3px solid #111827;

    z-index: 2;
}

.icon-btn {
    width: 36px;
    height: 36px;
    padding: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 32px;
    border-radius: 10px;
}

.icon-btn:hover {
  background: rgba(0,0,0,0.05);
}
.dashboard-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;   /* 👈 NEU */
}

#loginBtn {
  background: none;
  border: none;
  box-shadow: none;

  color: #cfd8e3; /* grau */
  font-size: 18px;

  cursor: pointer;
  padding: 6px;
}

/* Hover */
#loginBtn:hover {
  color: #ffffff;
}

#loginBtn.logged-in {
  color: #22c55e;
}

#loginBtn.logged-in:hover {
  color: #c41717;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);

  display: flex;
  align-items: center;
  justify-content: center;

  z-index: 2000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  width: 90%;
  max-width: 360px;

  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-content input {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px;

  width: 100%;
  height: 48px;
  font-size: 15px;
  padding: 0 14px;
  margin-bottom: 12px;
}

.hidden-auth {
  display: none !important;
}

.app.no-sidebar {
  grid-template-columns: 1fr;
}

.app.no-sidebar .sidebar {
  display: none;
}

.no-sidebar .main {
  width: 100% !important;
  margin-left: 0 !important;
}

.main {
  flex: 1;   /* 🔥 DAS IST DER KEY */
}

.custom-dashboard-device-card.drag-over,
.dashboard-config-block.drag-over,
.custom-entity-row.drag-over,
.dashboard-entity-row-block.drag-over {
    outline: 2px dashed var(--accent);
    outline-offset: 2px;
    background: rgba(255,255,255,0.04);
}

.custom-dashboard-device-card.dragging,
.dashboard-config-block.dragging,
.custom-entity-row.dragging,
.dashboard-entity-row-block.dragging {
    opacity: 0.5;
}

.custom-entity-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 6px 8px;
    box-sizing: border-box;
}

.custom-entity-row input[type="checkbox"] {
    margin: 0;
    flex-shrink: 0;
}

.custom-entity-main {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.custom-entity-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-entity-type {
    margin-left: auto;
    opacity: 0.7;
    flex-shrink: 0;
}

.custom-entity-drag-handle {
    cursor: grab;
    user-select: none;
    flex-shrink: 0;
}

.sensor-entity-block.drag-over {
    outline: 2px dashed var(--accent);
    outline-offset: 2px;
}

.sensor-entity-block.dragging {
    opacity: 0.45;
}

.entity-group {
    margin-bottom: 14px;
    padding: 10px;
    border-radius: 10px;
    background: rgba(0,0,0,0.05);
    display: contents;
}

.entity-group-title {
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 13px;
    opacity: 0.7;
}

.entity-select-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    cursor: pointer;
}

.entity-select-row:hover {
    background: rgba(0,0,0,0.06);
    border-radius: 6px;
}

.empty {
    padding: 10px;
    opacity: 0.6;
}

#entitySelectList {
    max-height: 400px;
    overflow-y: auto;
    padding: 4px;

    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 6px;
}

.entity-row-compact {
    display: grid;
    grid-template-columns: 24px 1fr;
    align-items: center;
    gap: 10px;

    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;

    width: auto;       /* 🔥 WICHTIG */
    min-width: 0;      /* 🔥 WICHTIG */
}

.entity-row-compact:hover {
    background: rgba(0,0,0,0.08);
}

.entity-name {
    font-size: 14px;
}

.entity-device {
    font-size: 12px;
    opacity: 0.6;
}

.empty {
    padding: 10px;
    opacity: 0.6;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
}

.dashboard-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-right-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 20px; /* 🔥 MAGIE */
}

#entitySelectModal .modal-content {
    width: 700px;
    max-width: 95vw;
}

.entity-name small,
.entity-device small {
    display: block;
    font-size: 11px;
    text-align: left;
    opacity: 0.85;
    margin-top: 2px;
    line-height: 1.2;
}

.modal-actions {
    display: flex;
    justify-content: center; /* 👈 mittig */
    gap: 40px;
    margin-top: 24px;
}

.btn-primary {
    background-color: #3b82f6; /* schönes Blau */
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
}

.btn-primary:hover {
    background-color: #2563eb;
}

.logic-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid #e5e7eb;
}

.logic-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.logic-row select {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    font-size: 14px;
}

.logic-operator {
    font-weight: bold;
    font-size: 16px;
    padding: 0 6px;
    color: #374151;
}

.logic-target {
    background: #eef2ff;
    border: 1px solid #c7d2fe;
}

.btn-primary {
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 14px;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #f3f4f6;
    cursor: pointer;
}

.btn-icon:hover {
    background: #e5e7eb;
}

.logout-btn {
  z-index: 2000;
  position: fixed;
  top: 0px;
  right: 0px; /* 🔥 neben Burger */

  width: 32px;
  height: 32px;

  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.7;
}

.logout-btn:hover {
  opacity: 1;
  color: #ef4444;
}