/* ========================================================
   LOCATIONS PAGE STYLES (Tabs: Tabelle, Baum, Karte)
   ======================================================== */
.locations-main,
.devices-main {
  padding: 18px 24px 36px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
/* Header Action Row */
.locations-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.locations-header-left {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}
.locations-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-white);
  letter-spacing: -0.2px;
}
.locations-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn-secondary {
  background: var(--bg-button);
  border: 1px solid var(--border-control);
  color: var(--text-soft);
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}
.btn-secondary:hover {
  background: var(--c-navy-780);
  color: var(--text-white);
}
.btn-secondary:disabled,
.btn-secondary[disabled] {
  background: var(--bg-raised) !important;
  border: 1px solid var(--c-navy-780) !important;
  color: var(--text-dim);
  opacity: 1;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-secondary:disabled i,
.btn-secondary[disabled] i {
  color: var(--c-slate-530);
}
.btn-primary {
  background: var(--c-cyan-730);
  border: none;
  color: var(--c-white);
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}
.btn-primary:hover {
  background: var(--c-cyan-670);
}
/* View Mode Tabs (Tabellenansicht, Baumansicht, Kartenansicht) inline neben "Standorte" */
.view-mode-tabs {
  display: flex;
  align-items: center;
  gap: 20px;
  border-bottom: none;
  padding-bottom: 0;
  margin-top: 0;
  transform: translateY(4px);
}
.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  padding: 4px 4px 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  text-decoration: none;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: color 0.2s;
  white-space: nowrap;
}
.tab-text-short {
  display: none;
}
.tab-text-full {
  display: inline;
}
.tab-btn:hover {
  color: var(--c-white);
}
.tab-btn.active {
  color: var(--c-cyan-630);
}
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2.5px;
  background: var(--c-cyan-630);
  border-radius: 2px;
  box-shadow: 0 0 8px var(--c-cyan-630-a600);
}
/* Toolbar & Filter Bar */
.toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.toolbar-icon-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.search-input-wrapper i {
  position: absolute;
  left: 10px;
  font-size: 12px;
  color: var(--c-slate-530);
  pointer-events: none;
}
.search-input-wrapper input {
  background: var(--bg-input);
  border: 1px solid var(--border-control);
  color: var(--text-white);
  padding: 6px 12px 6px 30px;
  border-radius: 6px;
  font-size: 12.5px;
  width: 170px;
  outline: none;
  transition: border-color 0.2s;
}
.search-input-wrapper input:focus {
  border-color: var(--c-cyan-630);
}
.toolbar-btn {
  background: var(--bg-button);
  border: 1px solid var(--border-control);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}
.toolbar-btn:hover {
  background: var(--c-navy-780);
  color: var(--text-white);
}
/* Toolbar Right Pagination */
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--c-slate-350);
}
.pagination-info {
  display: flex;
  align-items: center;
  gap: 6px;
}
.select-compact {
  background: var(--bg-input);
  border: 1px solid var(--border-control);
  color: var(--text-strong);
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}
.page-btn {
  background: transparent;
  border: none;
  color: var(--c-slate-350);
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
}
.page-btn:hover:not(:disabled) {
  background: var(--c-white-a080);
  color: var(--c-white);
}
.page-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.page-current {
  background: var(--c-cyan-730);
  color: var(--c-white);
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 12px;
}
.page-total {
  color: var(--c-slate-350);
  font-size: 12px;
  margin-right: 2px;
}
/* Data Table Card */
.header-row th {
  background: var(--bg-raised);
  color: var(--text-secondary);
  padding: 10px 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  user-select: none;
  cursor: pointer;
}
.filter-row th {
  background: var(--bg-input);
  padding: 6px 10px 8px;
  border-bottom: 1px solid var(--border-color);
}
.col-filter {
  width: 100%;
  background: var(--bg-field);
  border: 1px solid var(--border-subtle);
  color: var(--text-white);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11.5px;
  outline: none;
}
.col-filter:focus {
  border-color: var(--c-cyan-630);
}
.date-filter-box {
  position: relative;
  display: flex;
  align-items: center;
}
.date-filter-box i {
  position: absolute;
  right: 8px;
  color: var(--c-slate-530);
  font-size: 11px;
  pointer-events: none;
}
.table-footer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-raised);
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-muted);
}
.footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
/* ========================================================
   BAUMANSICHT (Tree View - Screenshot 2 + Interactive Hierarchy)
   ======================================================== */
.tree-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tree-toolbar-card,
.devices-toolbar-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: 0 2px 10px var(--c-black-a250);
}
.tree-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tree-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tree-toggle-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tree-toggle-btn {
  background: var(--c-cyan-730-a080);
  border: 1px solid var(--c-cyan-730);
  color: var(--c-cyan-510);
  padding: 5px 12px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}
.tree-toggle-btn:hover {
  background: var(--c-cyan-730-a220);
  color: var(--c-white);
}
.tree-toggle-btn:disabled,
.tree-toggle-btn[disabled] {
  opacity: 0.35;
  border-color: var(--c-navy-770b);
  color: var(--c-slate-530);
  background: var(--c-navy-870-a400);
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}
.tree-mode-switch {
  display: inline-flex;
  background: var(--bg-surface-dark);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}
.tree-mode-pill {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.tree-mode-pill.active {
  background: var(--c-cyan-730);
  color: var(--c-white);
}
.tree-count-badge {
  background: var(--c-cyan-730-a080);
  border: 1px solid var(--c-cyan-730);
  color: var(--c-slate-160);
  font-size: 11.5px;
  padding: 4px 11px;
  border-radius: 5px;
}
.tree-list {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 4px 20px var(--c-black-a400);
  max-height: calc(100vh - 255px);
  overflow-y: auto;
}
.tree-list::-webkit-scrollbar {
  width: 9px;
}
.tree-list::-webkit-scrollbar-track {
  background: var(--bg-surface-dark);
}
.tree-list::-webkit-scrollbar-thumb {
  background: var(--c-slate-530);
  border-radius: 5px;
  border: 2px solid var(--c-navy-900);
}
/* Parent Group Header in Grouped Tree Mode */
.tree-parent-group {
  border: 1px solid var(--c-white-a060);
  border-radius: 6px;
  background: var(--bg-raised);
  flex-shrink: 0;
}
.tree-parent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
  border-radius: 6px;
}
.tree-parent-header:hover {
  background: var(--bg-item-hover);
}
.tree-parent-left {
  display: flex;
  align-items: center;
  gap: 11px;
}
.tree-parent-chevron {
  color: var(--c-cyan-510);
  font-size: 12px;
  width: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: transform 0.18s ease;
}
.tree-parent-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-white);
}
.tree-parent-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tree-meta-pill {
  background: var(--c-navy-800);
  border: 1px solid var(--c-navy-730);
  color: var(--c-slate-160);
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 4px;
}
.tree-meta-pill.devices-pill {
  background: var(--c-cyan-730);
  border-color: var(--c-cyan-730);
  color: var(--c-white);
}
.tree-children-container {
  display: flex;
  flex-direction: column;
  padding: 4px 10px 8px 22px;
  background: var(--bg-input);
  border-top: 1px solid var(--c-white-a050);
  border-radius: 0 0 6px 6px;
  gap: 2px;
  flex-shrink: 0;
}
.tree-parent-group.collapsed .tree-children-container {
  display: none !important;
}
/* Individual Location Row */
.tree-node-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border-radius: 6px;
  transition: background 0.15s;
  cursor: pointer;
  flex-shrink: 0;
  border: none;
  background: transparent;
}
.tree-node-row:hover {
  background: var(--c-navy-830);
}
.tree-node-left {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  min-width: 0;
  flex: 1;
}
.tree-node-pin {
  color: var(--c-cyan-510);
  font-size: 17px;
  margin-top: 3px;
}
.tree-node-pin.is-room-level {
  color: var(--c-teal-610);
  font-size: 15px;
}
.tree-node-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  min-width: 0;
  flex: 1;
}
.tree-node-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}
.tree-node-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-white);
  flex: 1;
  min-width: 0;
  line-height: 1.35;
  word-break: break-word;
}
.tree-node-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.tree-city-pill {
  background: var(--c-navy-830);
  border: 1px solid var(--c-navy-690);
  color: var(--text-secondary);
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 4px;
}
.tree-dev-badge {
  background: var(--c-cyan-730-a180);
  border: 1px solid var(--c-cyan-730);
  color: var(--c-cyan-510);
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 4px;
}
.tree-node-address {
  font-size: 11.5px;
  color: var(--c-slate-350);
  line-height: 1.35;
  margin-top: 2px;
  word-break: break-word;
}
.tree-node-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0.18;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
  margin-left: auto;
}
.tree-node-row:hover .tree-node-actions,
.tree-node-row:focus-within .tree-node-actions {
  opacity: 1;
}
.tree-action-btn {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}
.tree-action-btn.add { color: var(--c-cyan-510); }
.tree-action-btn.edit { color: var(--c-cyan-510); }
.tree-action-btn.delete { color: var(--c-red-400); }
.tree-action-btn:hover {
  background: var(--c-white-a080);
}
/* ========================================================
   KARTENANSICHT IN STANDORTE (Dashboard Map-Card Box)
   ======================================================== */
.locations-dashboard-map-card {
  height: calc(100vh - 195px);
  min-height: 580px;
}
#locationsMap {
  flex: 1;
  width: 100%;
  min-height: 480px;
  height: 100%;
  background-color: var(--c-navy-930);
}
/* ========================================================
   NEUEN STANDORT ERSTELLEN (POPUP MODAL & 50%/50% BOXEN)
   ======================================================== */
.new-location-modal-card {
  width: min(1240px, 95vw) !important;
  max-width: 1240px !important;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--c-navy-900);
  border: 1px solid var(--c-navy-780);
}
.new-location-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--c-navy-870);
  border-bottom: 1px solid var(--c-white-a080);
}
.new-location-modal-header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.new-location-modal-body {
  padding: 20px;
  overflow-y: auto;
}
.btn-create-location-static,
.btn-create-location-static:disabled,
.btn-create-location-static[disabled] {
  background: var(--c-teal-610);
  color: var(--c-white);
  font-weight: 600;
  border: 1px solid var(--c-teal-610);
  padding: 7px 16px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: not-allowed;
  pointer-events: none;
  user-select: none;
  opacity: 0.45;
}
.new-location-grid {
  display: grid;
  grid-template-columns: 1fr 1fr; /* Exakt 50% / 50% Boxen */
  gap: 20px;
  align-items: stretch;
}
@media (max-width: 1020px) {
  .new-location-grid {
    grid-template-columns: 1fr;
  }
}
.new-location-left-col,
.new-location-right-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.new-loc-card {
  background: var(--bg-raised);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 18px 20px 22px;
  box-shadow: 0 4px 18px var(--c-black-a350);
}
.new-loc-geo-card {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.new-loc-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-white);
  margin: 0 0 16px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.new-loc-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}
@media (max-width: 680px) {
  .new-loc-row-2col {
    grid-template-columns: 1fr;
  }
}
.new-loc-field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.new-loc-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  width: 100%;
  box-sizing: border-box;
}
.new-loc-field:last-child {
  margin-bottom: 0;
}
.new-loc-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--c-slate-160);
  margin: 0 0 4px 0;
  line-height: 1.3;
}
/* Etwas dunklere Input-Felder für klaren Kontrast auf den 50/50 Boxen */
.new-loc-input,
.new-loc-select,
.new-loc-textarea {
  width: 100%;
  background: var(--bg-field);
  border: 1px solid var(--c-navy-760b);
  border-radius: 5px;
  color: var(--c-slate-40);
  font-size: 13px;
  font-family: inherit;
  padding: 10px 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}
.new-loc-input::placeholder,
.new-loc-textarea::placeholder {
  color: var(--c-slate-380);
}
.new-loc-input:focus,
.new-loc-select:focus,
.new-loc-textarea:focus {
  border-color: var(--c-cyan-510);
  box-shadow: 0 0 0 2px var(--c-cyan-510-a150);
}
.new-loc-textarea {
  min-height: 74px;
  resize: vertical;
}
.new-loc-select-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.new-loc-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  cursor: pointer;
  color: var(--c-slate-160);
}
.new-loc-select option {
  background: var(--bg-field);
  color: var(--text-strong);
}
.new-loc-select-caret {
  position: absolute;
  right: 14px;
  color: var(--c-cyan-510);
  font-size: 12px;
  pointer-events: none;
}
.new-loc-field-hint {
  margin: 2px 0 0 2px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--c-slate-350);
}
.new-loc-address-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
/* Geolocation Card */
.new-loc-map-wrapper {
  position: relative;
  width: 100%;
  height: 255px;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-dark);
}
.new-loc-map-canvas {
  width: 100%;
  height: 100%;
}
.new-loc-map-mode-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  background: var(--c-navy-870-a920);
  border: 1px solid var(--c-navy-730);
  border-radius: 5px;
  padding: 2px;
  gap: 2px;
  z-index: 5;
}
.new-loc-map-mode-btn {
  background: transparent;
  border: none;
  color: var(--c-slate-350);
  width: 28px;
  height: 26px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12.5px;
  transition: all 0.15s;
}
.new-loc-map-mode-btn:hover {
  color: var(--c-white);
}
.new-loc-map-mode-btn.active {
  background: var(--c-cyan-730);
  color: var(--c-white);
}
.new-loc-input-suffix-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.new-loc-input-suffix-wrap .new-loc-input {
  padding-right: 30px;
}
.new-loc-input-suffix {
  position: absolute;
  right: 12px;
  color: var(--c-slate-160);
  font-size: 13.5px;
  pointer-events: none;
}
.new-loc-geo-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  margin-top: 16px;
}
.new-loc-geo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  background: var(--c-navy-850);
  border: 1px solid var(--c-navy-740);
  color: var(--c-slate-40);
  white-space: nowrap;
  flex: 1 1 auto;
  box-shadow: 0 1px 4px var(--c-black-a250);
}
.new-loc-geo-btn i {
  color: var(--c-cyan-510);
  font-size: 13px;
  transition: color 0.18s ease;
}
.new-loc-geo-btn:hover {
  background: var(--c-navy-800b);
  border-color: var(--c-cyan-510);
  color: var(--c-white);
  box-shadow: 0 2px 8px var(--c-cyan-510-a250);
}
.new-loc-geo-btn:hover i {
  color: var(--c-cyan-390);
}
.new-loc-geo-btn:active {
  transform: translateY(1px);
}
.new-loc-geo-btn.muted {
  background: var(--c-navy-850);
  border: 1px solid var(--c-navy-740);
  color: var(--c-slate-40);
}
.new-loc-geo-btn.muted i {
  color: var(--c-cyan-510);
}
.new-loc-geo-btn.muted:hover {
  border-color: var(--c-cyan-510);
  color: var(--c-white);
  background: var(--c-navy-800b);
}
.new-loc-geo-btn.muted:hover i {
  color: var(--c-cyan-390);
}
.new-loc-geo-btn.primary-outline {
  border: 1px solid var(--c-teal-610);
  color: var(--c-teal-610);
  background: var(--c-teal-610-a080);
}
.new-loc-geo-btn.primary-outline i {
  color: var(--c-teal-610);
}
.new-loc-geo-btn.primary-outline:hover {
  background: var(--c-teal-610-a180);
  color: var(--c-green-480);
  border-color: var(--c-green-480);
}
.new-loc-geo-btn.primary-outline:hover i {
  color: var(--c-green-480);
}
/* ========================================================
   STANDORT-DETAILS POPUP MODAL (Modernes Redesign)
   ======================================================== */
.location-detail-modal-card {
  width: min(1240px, 95vw) !important;
  max-width: 1240px !important;
  height: min(840px, 92vh);
  min-height: 650px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}
.location-detail-modal-card .detail-tab-pane {
  flex: 1;
  min-height: 520px;
  box-sizing: border-box;
}
.location-detail-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: none;
}
.location-detail-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.btn-detail-back {
  background: var(--bg-button);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}
.btn-detail-back:hover {
  background: var(--bg-item-hover);
  color: var(--text-white);
  border-color: var(--border-hover);
}
.location-detail-title {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-white);
  letter-spacing: -0.2px;
  margin: 0;
}
.location-detail-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn-detail-action {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  background: transparent;
}
.btn-detail-action.outline {
  border: 1px solid var(--c-cyan-730);
  color: var(--c-cyan-510);
}
.btn-detail-action.outline:hover {
  background: var(--c-cyan-510-a120);
  color: var(--c-cyan-390);
  border-color: var(--c-cyan-390);
}
.btn-detail-action.btn-detail-delete {
  background: var(--c-red-650);
  border: 1px solid var(--c-red-580);
  color: var(--c-white);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-detail-action.btn-detail-delete:hover {
  background: var(--c-red-690);
  border-color: var(--c-red-650);
  color: var(--c-white);
}
.btn-detail-action.btn-detail-delete .material-icons {
  font-size: 16px;
  color: var(--c-white);
}
.btn-card-edit {
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 4px;
  color: var(--c-cyan-390);
  transition: all 0.15s ease;
}
.btn-card-edit:hover {
  background: var(--c-cyan-510-a150);
  color: var(--c-cyan-510);
}
.btn-detail-action .material-icons {
  font-size: 16px;
}
/* Sub-Tabs */
.location-detail-subtabs {
  display: flex;
  gap: 20px;
  padding: 4px 20px 0;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--c-white-a080);
  /* Schmale Bildschirme: Reiter einzeilig, seitlich wischbar statt umbrechen/abschneiden */
  overflow-x: auto;
  scrollbar-width: none;
}
.location-detail-subtabs::-webkit-scrollbar {
  display: none;
}
.location-detail-subtabs .detail-subtab {
  white-space: nowrap;
  flex-shrink: 0;
}
.detail-subtab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 4px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: color 0.15s;
}
.detail-subtab .material-icons {
  font-size: 16px;
}
.detail-subtab:hover {
  color: var(--text-hover);
}
.detail-subtab.active {
  color: var(--accent-strong);
}
.detail-subtab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2.5px;
  background: var(--c-cyan-510);
  border-radius: 2px 2px 0 0;
}
/* Card titles with icons & edit icons */
.new-loc-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: nowrap;
  margin-bottom: 14px;
}
.new-loc-card-title-row .new-loc-card-title {
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.btn-add-subloc {
  background: var(--c-cyan-730);
  border: none;
  color: var(--c-white);
  width: 30px;
  height: 30px;
  min-width: 30px;
  padding: 0;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px var(--c-cyan-730-a250);
  flex-shrink: 0;
}
.btn-add-subloc:hover {
  background: var(--c-cyan-670);
  box-shadow: 0 4px 10px var(--c-cyan-730-a350);
}
.btn-add-subloc .material-icons {
  font-size: 19px;
  color: var(--c-white);
  line-height: 1;
}
.detail-fixphrase-link-icon {
  position: absolute;
  right: 10px;
  font-size: 16px;
  color: var(--c-cyan-510);
  cursor: pointer;
  transition: color 0.15s;
}
.detail-fixphrase-link-icon:hover {
  color: var(--c-cyan-390);
}
/* Unterstandorte Empty State */
.unterstandorte-empty-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px 16px;
  background: var(--bg-field);
  border: 1px dashed var(--border-subtle);
  border-radius: 6px;
  margin-top: 10px;
}
.unterstandorte-empty-text {
  font-size: 12px;
  color: var(--c-slate-160);
  max-width: 380px;
  line-height: 1.5;
  margin: 0;
}
/* Metadaten Grid */
.metadaten-grid {
  display: flex;
  align-items: flex-start;
  gap: 28px;
  flex-wrap: nowrap;
}
.meta-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  white-space: nowrap;
}
.meta-label {
  font-size: 11px;
  color: var(--c-slate-380);
  font-weight: 500;
  white-space: nowrap;
}
.meta-value {
  font-size: 12px;
  color: var(--text-main);
  font-weight: 500;
  white-space: nowrap;
  word-break: normal;
}
/* Interaktiver grüner Standort-Pin auf der Karte */
.new-loc-pin-marker {
  cursor: grab;
  user-select: none;
  transform-origin: bottom center;
  transition: transform 0.15s ease-out;
}
.new-loc-pin-marker:hover {
  transform: scale(1.15);
}
.new-loc-pin-marker:active {
  cursor: grabbing;
}
/* ========================================================
   LOCATION DETAIL MODAL - HISTORY TAB
   ======================================================== */
.location-history-wrapper {
  padding: 16px 20px 24px;
}
.history-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.history-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.1px;
  margin: 0;
}
.history-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}
.history-action-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.history-action-btn:hover {
  transform: scale(1.15);
  opacity: 0.9;
}
.history-table-card {
  background: var(--bg-field);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  overflow: hidden;
}
.history-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.history-table th {
  padding: 12px 18px;
  font-size: 12px;
  font-weight: 500;
  color: var(--c-slate-350);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-soft);
}
.history-table td {
  padding: 13px 18px;
  font-size: 12.5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--c-white-a040);
  vertical-align: middle;
}
.history-table tbody tr:hover td {
  background: var(--c-white-a020);
}
.history-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 12px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.history-badge.created {
  background: var(--c-teal-610);
  color: var(--c-cyan-900);
}
.history-view-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--c-cyan-510);
  padding: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, transform 0.15s;
}
.history-view-btn:hover {
  color: var(--c-cyan-390);
  transform: scale(1.2);
}
/* ========================================================
   TREE VIEW - 3-LEVEL HIERARCHY STYLES
   ======================================================== */
.tree-node-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin-bottom: 2px;
}
/* Keine zersplitterten separaten Borders mehr auf den Kind-Wrappern */
.tree-node-wrapper.level-2,
.tree-node-wrapper.level-3 {
  margin-left: 0;
  border-left: none;
  padding-left: 0;
  margin-top: 0;
}
.tree-node-row.has-children {
  background: transparent;
  border: none;
}
.tree-node-row.has-children:hover {
  background: var(--c-navy-830);
  border: none;
}
.tree-chevron-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--c-slate-350);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  transition: color 0.15s, transform 0.2s ease;
  flex-shrink: 0;
}
.tree-chevron-btn:hover {
  color: var(--c-cyan-510);
}
.tree-node-chevron {
  font-size: 11px;
  transition: transform 0.2s ease;
}
.tree-node-wrapper.expanded > .tree-node-row .tree-node-chevron {
  transform: rotate(90deg);
  color: var(--c-cyan-510);
}
.tree-node-leaf-indent {
  display: inline-block;
  width: 18px;
  flex-shrink: 0;
}
.tree-subloc-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--c-cyan-510-a120);
  color: var(--c-cyan-510);
  border: 1px solid var(--c-cyan-510-a320);
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 7px;
}
.tree-subloc-pill i {
  font-size: 9px;
}
/* Kinder-Container: Beherbergt die Unterstandorte */
.tree-node-children {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-left: 23px; /* Exakt zentriert unter dem Chevron-Button (14px Padding + 9px Chevron-Mitte) */
  padding-left: 14px;
  margin-top: 2px;
  margin-bottom: 2px;
  position: relative;
}
.tree-node-children > .tree-node-wrapper {
  position: relative;
}
/* Horizontale Abzweiger (90-Grad-Wendung zum Kindknoten) - Solide Farbe ohne Alpha-Blending-Punkte */
.tree-node-children > .tree-node-wrapper::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 18px;
  width: 12px;
  height: 1px;
  background: var(--c-slate-450);
  transition: background 0.15s ease;
  z-index: 1;
}
/* Vertikale Führungslinie für alle Kindknoten - Exakte Naht ohne Überlappungspunkte */
.tree-node-children > .tree-node-wrapper::after {
  content: '';
  position: absolute;
  left: -14px;
  top: 0;
  bottom: -2px;
  width: 1px;
  background: var(--c-slate-450);
  transition: background 0.15s ease;
}
/* Erster Kindknoten: Reicht nahtlos nach oben zum Eltern-Knoten */
.tree-node-children > .tree-node-wrapper:first-child::after {
  top: -6px;
}
/* Letzter Kindknoten: Endet EXAKT an der 90-Grad-Abzweigung (kein Überhang, kein Punkt) */
.tree-node-children > .tree-node-wrapper:last-child::after {
  top: 0;
  bottom: auto;
  height: 19px; /* Reicht von top: 0 bis exakt top: 19px (Abzweiger bei 18px) */
}
/* Einziger Kindknoten (erster und letzter zugleich) */
.tree-node-children > .tree-node-wrapper:first-child:last-child::after {
  top: -6px;
  height: 25px; /* Reicht von top: -6px bis exakt top: 19px */
  bottom: auto;
}
/* Interaktives Aufleuchten beim Hovern über den Zweig oder die Zeile */
.tree-node-children > .tree-node-wrapper:hover::before,
.tree-node-children > .tree-node-wrapper:hover::after,
.tree-node-children:hover > .tree-node-wrapper::before,
.tree-node-children:hover > .tree-node-wrapper::after {
  background: var(--c-cyan-510);
}
.tree-node-wrapper.collapsed > .tree-node-children {
  display: none;
}
/* ========================================================
   LOCATION DETAIL MODAL - UNTERSTANDORTE POPULATED BOX
   ======================================================== */
.unterstandorte-populated-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 4px;
}
.unterstandorte-populated-box::-webkit-scrollbar {
  width: 5px;
}
.unterstandorte-populated-box::-webkit-scrollbar-track {
  background: var(--c-navy-900);
  border-radius: 4px;
}
.unterstandorte-populated-box::-webkit-scrollbar-thumb {
  background: var(--c-navy-780);
  border-radius: 4px;
}
.unterstandorte-populated-box::-webkit-scrollbar-thumb:hover {
  background: var(--c-cyan-730);
}
.subloc-card-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-field);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.subloc-card-item:hover {
  background: var(--bg-selected);
  border-color: var(--accent-strong);
}
.subloc-card-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.subloc-pin-icon {
  font-size: 18px;
  color: var(--c-cyan-510);
  flex-shrink: 0;
}
.subloc-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.subloc-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  width: 100%;
}
.subloc-card-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
.subloc-card-level-badge {
  font-size: 10px;
  background: var(--c-cyan-510-a120);
  color: var(--c-cyan-510);
  border-radius: 4px;
  padding: 1px 6px;
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
}
.subloc-card-sub {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  width: 100%;
}
.subloc-card-sub > span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.btn-subloc-open {
  background: transparent;
  border: none;
  color: var(--c-slate-530);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  flex-shrink: 0;
  transition: color 0.15s;
}
.subloc-card-item:hover .btn-subloc-open {
  color: var(--c-cyan-510);
}
/* ========================================================
   LOCATION DETAIL MODAL - ADRESSE DISPLAY GRID (ORIGINAL-DESIGN)
   ======================================================== */
.detail-address-grid {
  display: flex;
  align-items: flex-start;
  gap: 36px;
  padding: 6px 0 8px;
  flex-wrap: nowrap;
}
.detail-address-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  white-space: nowrap;
}
.detail-address-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}
.detail-address-value {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-white);
  white-space: nowrap;
}
/* ========================================================
   RESPONSIVE BREAKPOINTS (TABLET & MOBILE)
   ======================================================== */
@media (max-width: 800px) {
  .locations-header-left {
    gap: 14px;
  }
  .view-mode-tabs {
    gap: 12px;
  }
  .tab-text-full {
    display: none;
  }
  .tab-text-short {
    display: inline;
  }
}
@media (max-width: 768px) {
  /* ========================================================
     MODALS / POPUPS MOBIL: Keine abgeschnittenen Kanten mehr!
     ======================================================== */
  .device-modal-backdrop {
    padding: 10px;
    box-sizing: border-box;
  }

  .device-modal-card,
  .location-detail-modal-card,
  .new-location-modal-card,
  .new-type-modal-card {
    width: 95vw !important;
    max-width: 95vw !important;
    min-width: 0;
    min-height: auto !important;
    height: auto !important;
    max-height: 92vh;
    box-sizing: border-box;
    overflow: hidden;
    margin: auto;
  }

  .device-modal-header,
  .location-detail-modal-header,
  .new-type-modal-header,
  .new-location-modal-header {
    padding: 12px 14px !important;
    flex-wrap: wrap;
    gap: 10px !important;
    box-sizing: border-box;
    width: 100%;
  }

  .location-detail-title,
  .device-modal-title {
    max-width: 100%;
    word-break: break-word;
    font-size: 16px !important;
    line-height: 1.3;
  }

  .location-detail-header-left {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
  }

  .location-detail-header-right {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-left: auto;
  }

  .new-location-modal-header-right {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px !important;
  }

  .location-detail-subtabs {
    display: flex;
    align-items: center;
    gap: 20px !important;
    padding: 8px 16px 0 !important;
    margin-bottom: 14px !important;
    border-bottom: 1px solid var(--c-white-a080) !important;
    overflow: visible !important;
    overflow-x: visible !important;
    overflow-y: visible;
    box-sizing: border-box;
    width: 100%;
  }

  .detail-subtab {
    padding: 8px 6px 12px !important;
    font-size: 13px;
    gap: 7px;
  }

  .new-location-modal-body,
  .new-type-modal-body,
  .location-detail-modal-card .detail-tab-pane {
    padding: 12px 14px !important;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    min-height: auto;
  }

  .new-location-grid,
  .dt-grid-2col {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .new-location-left-col,
  .new-location-right-col,
  .dt-detail-main-col {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    gap: 12px;
    box-sizing: border-box;
  }

  .new-loc-card,
  .new-type-form-card {
    padding: 14px 16px !important;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }

  .new-loc-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px 0 !important;
    font-size: 14px !important;
  }

  .new-loc-card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 8px;
    margin-bottom: 16px !important;
  }

  .new-loc-card-title-row .new-loc-card-title {
    margin: 0 !important;
    white-space: nowrap;
    font-size: 14px;
  }

  .btn-add-subloc {
    width: 30px;
    height: 30px;
    min-width: 30px;
    margin-left: auto;
    flex-shrink: 0;
  }

  .new-loc-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px !important;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  .new-loc-field:last-child {
    margin-bottom: 0 !important;
  }

  .new-loc-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--c-slate-160) !important;
    margin: 0 0 4px 0 !important;
    line-height: 1.3;
  }

  .new-loc-field-group,
  .dt-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px !important;
    margin-bottom: 14px !important;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  .new-loc-field-group:last-child,
  .dt-field-group:last-child {
    margin-bottom: 0 !important;
  }

  .new-loc-field-hint {
    margin: 6px 0 0 2px !important;
    font-size: 11px !important;
    line-height: 1.4;
    color: var(--c-slate-350) !important;
  }

  .new-loc-input,
  .new-loc-select,
  .new-loc-textarea,
  .readonly-input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .new-loc-row-2col,
  .new-type-row-2col {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    margin-bottom: 14px;
  }

  /* Adresse & Metadaten: 2 Spalten Grid statt überbreitem Einzeiler */
  .detail-address-grid,
  .metadaten-grid {
    display: grid;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px 14px;
    width: 100%;
    box-sizing: border-box;
    padding: 4px 0;
  }

  .detail-address-item,
  .meta-item {
    white-space: normal;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
  }

  .detail-address-label,
  .detail-address-value,
  .meta-label,
  .meta-value {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  /* Baumansicht auf Mobilgeräten: Mehr Platz, kompaktere Zeilen, keine abgeschnittenen Ränder */
  .tree-list {
    padding: 8px 6px;
    overflow-x: hidden;
    box-sizing: border-box;
    max-height: calc(100vh - 210px);
  }

  .tree-node-row {
    padding: 8px 10px;
    background: var(--c-navy-860c) !important;
    border: 1px solid var(--c-white-a060) !important;
    border-radius: 6px;
    margin-bottom: 5px;
    width: 100%;
    box-sizing: border-box;
  }

  .tree-node-row:hover {
    background: var(--c-blue-840) !important;
  }

  .tree-node-left {
    gap: 8px;
    width: 100%;
    min-width: 0;
  }

  .tree-node-info {
    width: 100%;
    min-width: 0;
    gap: 2px;
  }

  .tree-node-top-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
  }

  .tree-node-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-white);
    line-height: 1.3;
    word-break: break-word;
    flex: 1;
    min-width: 0;
  }

  .tree-node-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    opacity: 1;
    flex-shrink: 0;
    margin-left: auto;
  }

  .tree-action-btn {
    width: 24px;
    height: 24px;
    font-size: 11.5px;
  }

  .tree-node-meta-row {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 3px;
  }

  .tree-city-pill,
  .tree-subloc-pill,
  .tree-dev-badge {
    font-size: 10px;
    padding: 1.5px 6px;
    line-height: 1.2;
    box-sizing: border-box;
  }

  .tree-node-address {
    font-size: 11px;
    color: var(--c-slate-350);
    line-height: 1.3;
    word-break: break-word;
    margin-top: 2px;
  }

  .tree-node-children {
    margin-left: 10px;
    padding-left: 8px;
  }

  .tree-node-children > .tree-node-wrapper::before {
    left: -8px;
    width: 6px;
    top: 16px;
  }

  .tree-node-children > .tree-node-wrapper::after {
    left: -8px;
  }

  .tree-node-children > .tree-node-wrapper:last-child::after {
    height: 17px !important;
  }

  .tree-node-children > .tree-node-wrapper:first-child:last-child::after {
    height: 23px !important;
  }

  .tree-node-leaf-indent {
    width: 14px;
  }

  /* Geolocation Action Buttons auf Mobil (nicht abgeschnitten) */
  .new-loc-geo-actions-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    flex-wrap: nowrap;
    margin-top: 14px !important;
  }

  #locationDetailModal #btnDetailUseMyPosition {
    display: none;
  }

  .new-loc-geo-btn {
    flex: 1 1 50%;
    min-width: 0;
    padding: 8px 6px;
    font-size: 11.5px;
    font-weight: 500;
    background: var(--c-navy-850) !important;
    border: 1px solid var(--c-navy-740) !important;
    color: var(--c-slate-40) !important;
    white-space: nowrap;
    box-sizing: border-box;
    box-shadow: 0 1px 4px var(--c-black-a250) !important;
  }
  .new-loc-geo-btn i {
    color: var(--c-cyan-510) !important;
    font-size: 13px;
  }
  .new-loc-geo-btn:hover {
    background: var(--c-navy-800b) !important;
    border-color: var(--c-cyan-510) !important;
    color: var(--c-white) !important;
  }

  .new-loc-geo-btn span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .locations-header-bar {
    flex-wrap: wrap;
    gap: 10px;
  }

  /* Header-Actions auf Mobil: Volle Breite, Aktualisieren nur als Icon, restliche Buttons nutzen die restliche Breite */
  .locations-header-actions {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px !important;
  }

  .locations-header-actions #btnRefresh,
  .locations-header-actions #btnRefreshDevices,
  .locations-header-actions #btnRefreshLists,
  .locations-header-actions #btnRefreshTypes,
  .locations-header-actions #btnTopRefresh {
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
  }

  .locations-header-actions #btnRefresh span,
  .locations-header-actions #btnRefreshDevices span,
  .locations-header-actions #btnRefreshLists span,
  .locations-header-actions #btnRefreshTypes span,
  .locations-header-actions #btnTopRefresh span {
    display: none;
  }

  .locations-header-actions #btnRefresh i,
  .locations-header-actions #btnRefreshDevices i,
  .locations-header-actions #btnRefreshLists i,
  .locations-header-actions #btnRefreshTypes i,
  .locations-header-actions #btnTopRefresh i {
    margin: 0;
    font-size: 14px;
  }

  /* Bei Gerätelisten (oder wenn Aktualisieren der einzige Button ist): rechtsbündig */
  .locations-header-actions #btnRefreshLists,
  .locations-header-actions > button:only-child {
    margin-left: auto;
  }

  .locations-header-actions .btn-primary {
    max-width: 50%;
    width: auto;
    flex: 0 1 auto;
    margin-left: auto;
    min-width: 0;
    height: 36px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    font-size: 13px;
  }

  .locations-header-actions #btnCsvImport {
    max-width: 50%;
    width: auto;
    flex: 0 1 auto;
    min-width: 0;
    height: 36px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    font-size: 13px;
  }

  .locations-header-actions .btn-primary span,
  .locations-header-actions #btnCsvImport span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Mobile Toolbar: 2 Zeilen Layout (spart eine Zeile Platz)
     Zeile 1: Suchfeld (links, volle Breite ausnutzend) & Filter löschen (rechts)
     Zeile 2: Icon-Buttons (linksbündig) & Blätter-Funktion (rechtsbündig)
     Oben: Dropdown für Seitengröße komplett ausgeblendet (bleibt unten im Footer)
  */
  .devices-toolbar-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 10px;
    align-items: center;
  }

  .toolbar-left,
  .toolbar-right {
    display: contents;
  }

  /* Zeile 1 links: Suchfeld nutzt die gesamte Breite bis zum Filter-löschen-Button */
  .search-input-wrapper {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    min-width: 0;
  }

  .search-input-wrapper input {
    width: 100%;
  }

  /* Zeile 1 rechts: Filter löschen Button */
  .toolbar-btn.filter-clear-btn {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    white-space: nowrap;
    flex-shrink: 0;
    margin: 0;
  }

  /* Zeile 2 links: Die Icon-Buttons wieder linksbündig */
  .toolbar-icon-group {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: auto;
    margin: 0;
  }

  .toolbar-btn:not(.filter-clear-btn) span,
  .toolbar-btn-teal span {
    display: none;
  }

  .toolbar-btn:not(.filter-clear-btn),
  .toolbar-btn-teal {
    padding: 0 !important;
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .toolbar-btn:not(.filter-clear-btn) i,
  .toolbar-btn-teal i {
    font-size: 14px;
    margin: 0;
  }

  /* Oben: Dropdown für Seitengröße und Infozeile komplett ausblenden */
  .toolbar-right .pagination-info {
    display: none;
  }

  /* Zeile 2 rechts: Blätter-Funktion rechts neben die Icon-Buttons in Zeile 2 */
  .toolbar-right .pagination-controls {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    align-items: center;
    justify-self: end;
    gap: 6px;
    width: auto;
    margin: 0;
    padding: 0;
    border: none;
  }

  .toolbar-right .pagination-controls .page-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }

  /* Oben: Erste- und Letzte-Seite-Buttons ausblenden (nur < und > anzeigen) */
  .toolbar-right .pagination-controls .page-btn:first-child,
  .toolbar-right .pagination-controls .page-btn:last-child {
    display: none;
  }

  /* Auf Geräte-Seite: Zwischenablage ganz oben über der Suche (Zeile 1) und horizontal zentriert */
  body[data-page="devices"] .toolbar-center.clipboard-inline,
  .devices-toolbar-card:has(.toolbar-center) .toolbar-center.clipboard-inline {
    grid-column: 1 / -1;
    grid-row: 1 !important;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 0 4px 0;
    padding: 2px 0 8px 0;
    border-bottom: 1px solid var(--c-white-a070);
    border-left: none;
    border-right: none;
    border-top: none;
  }

  body[data-page="devices"] .search-input-wrapper,
  .devices-toolbar-card:has(.toolbar-center) .search-input-wrapper {
    grid-row: 2 !important;
  }

  body[data-page="devices"] .toolbar-btn.filter-clear-btn,
  .devices-toolbar-card:has(.toolbar-center) .toolbar-btn.filter-clear-btn {
    grid-row: 2 !important;
  }

  body[data-page="devices"] .toolbar-icon-group,
  .devices-toolbar-card:has(.toolbar-center) .toolbar-icon-group {
    grid-row: 3 !important;
  }

  body[data-page="devices"] .toolbar-right .pagination-controls,
  .devices-toolbar-card:has(.toolbar-center) .toolbar-right .pagination-controls {
    grid-row: 3 !important;
  }

  /* Unten (Footer): Vollständige Leiste mit Blättern oben und Zeige-Leiste darunter */
  .table-footer-bar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px 12px;
  }

  .table-footer-bar .pagination-controls {
    order: 1;
    width: 100%;
    justify-content: center;
    gap: 8px;
  }

  .table-footer-bar .footer-left {
    order: 2;
    display: flex;
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }

  /* Blätter-Pfeile als klickbare Buttons mit Highlight bei aktiven Pfeilen */
  .page-btn {
    width: 38px;
    height: 36px;
    font-size: 13.5px;
    background: var(--c-navy-830d);
    border: 1px solid var(--c-navy-760b);
    border-radius: 6px;
    color: var(--c-slate-160);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
  }

  .page-btn:not(:disabled) {
    background: var(--c-navy-850);
    border: 1px solid var(--c-navy-730);
    color: var(--c-slate-160);
    box-shadow: none;
  }

  .page-btn:not(:disabled):hover {
    background: var(--c-navy-800);
    border-color: var(--c-navy-650);
    color: var(--c-white);
  }

  .page-btn:disabled {
    background: var(--c-navy-880);
    border-color: var(--c-navy-830d);
    color: var(--c-navy-650);
    opacity: 0.35;
    cursor: default;
    box-shadow: none;
  }

  /* Seitenzahl dazwischen ist reiner Text ohne Button-Hintergrund */
  .page-current {
    background: transparent;
    color: var(--c-white);
    font-size: 14px;
    font-weight: 700;
    min-width: auto;
    height: auto;
    padding: 0 4px;
    border-radius: 0;
  }

  .page-total {
    font-size: 13px;
    color: var(--c-slate-350);
    margin-right: 2px;
  }
}
@media (max-width: 640px) {
  .locations-main,
  .devices-main {
    padding: 12px 14px 28px;
  }
  .metadaten-grid {
    grid-template-columns: 1fr;
  }
}


/* ========================================================
   LIGHT MODE OVERRIDES (locations.css)
   ======================================================== */

html[data-theme="light"] .btn-secondary {
  background: var(--c-white);
  border: 1px solid var(--c-slate-160);
}

html[data-theme="light"] .btn-secondary:hover {
  background: var(--c-slate-40);
}

html[data-theme="light"] .btn-secondary:disabled,
html[data-theme="light"] .btn-secondary[disabled] {
  background: var(--c-slate-20) !important;
  border: 1px solid var(--c-slate-90) !important;
}

html[data-theme="light"] .tab-btn {
  color: var(--c-slate-530);
}

html[data-theme="light"] .tab-btn:hover,
html[data-theme="light"] .tab-btn.active {
  color: var(--c-cyan-730);
}

html[data-theme="light"] .search-input-wrapper input,
html[data-theme="light"] .select-compact {
  background: var(--c-white);
  border: 1px solid var(--c-slate-160);
}

html[data-theme="light"] .toolbar-btn {
  background: var(--c-white);
  border: 1px solid var(--c-slate-160);
  color: var(--c-navy-730);
}

html[data-theme="light"] .toolbar-btn:hover {
  background: var(--c-slate-40);
  color: var(--c-blue-890);
}

html[data-theme="light"] .tree-toolbar-card,
html[data-theme="light"] .devices-toolbar-card,
html[data-theme="light"] .tree-list {
  background: var(--c-white);
  border: 1px solid var(--c-slate-90);
  box-shadow: 0 1px 4px var(--c-blue-890-a060);
}

html[data-theme="light"] .header-row th {
  background: var(--c-slate-20);
  color: var(--c-navy-730);
  border-bottom: 1px solid var(--c-slate-90);
}

html[data-theme="light"] .filter-row th {
  background: var(--c-white);
  border-bottom: 1px solid var(--c-slate-90);
}

html[data-theme="light"] .col-filter {
  border: 1px solid var(--c-slate-160);
  color: var(--c-blue-890);
}

html[data-theme="light"] .page-btn:not(:disabled) {
  background: var(--c-white);
  border: 1px solid var(--c-slate-160);
  color: var(--c-navy-730);
}

html[data-theme="light"] .page-btn:not(:disabled):hover {
  background: var(--c-slate-40);
  border-color: var(--c-slate-350);
  color: var(--c-blue-890);
}

html[data-theme="light"] .page-btn:disabled {
  background: var(--c-slate-20);
  border-color: var(--c-slate-90);
  color: var(--c-slate-160);
}

html[data-theme="light"] .page-current {
  color: var(--c-blue-890);
}

/* Tree View (Baumansicht) in Light Mode */

html[data-theme="light"] .tree-mode-pill {
  color: var(--c-slate-530);
}

html[data-theme="light"] .tree-count-badge {
  border-color: var(--c-cyan-730);
  color: var(--c-cyan-730);
}

html[data-theme="light"] .tree-parent-group {
  border: 1px solid var(--c-slate-90);
}

html[data-theme="light"] .tree-meta-pill:not(.devices-pill) {
  background: var(--c-white);
  border: 1px solid var(--c-slate-160);
  color: var(--c-navy-730);
}

html[data-theme="light"] .tree-children-container {
  border-top: 1px solid var(--c-slate-90);
}

html[data-theme="light"] .tree-node-row {
  background: var(--c-white) !important;
  border: 1px solid var(--c-slate-90) !important;
}

html[data-theme="light"] .tree-node-row:hover,
html[data-theme="light"] .tree-node-row.has-children:hover {
  background: var(--c-blue-30) !important;
}

html[data-theme="light"] .tree-node-name {
  color: var(--c-blue-890) !important;
}

html[data-theme="light"] .tree-city-pill {
  background: var(--c-slate-40);
  border: 1px solid var(--c-slate-160);
}

html[data-theme="light"] .tree-node-address {
  color: var(--c-slate-530) !important;
}

html[data-theme="light"] .tree-list::-webkit-scrollbar-track {
  background: var(--c-slate-40);
}

/* Modals & Popups (Standort-Details & Neuer Standort) in Light Mode */
html[data-theme="light"] .new-location-modal-card,
html[data-theme="light"] .location-detail-modal-card {
  background: var(--c-white);
  border: 1px solid var(--c-slate-160);
  box-shadow: 0 20px 50px var(--c-blue-890-a180);
}

html[data-theme="light"] .new-location-modal-header,
html[data-theme="light"] .location-detail-modal-header {
  background: var(--c-white);
  border-bottom: 1px solid var(--c-slate-90);
}

html[data-theme="light"] .location-detail-subtabs {
  background: var(--c-white);
  border-bottom: 1px solid var(--c-slate-90);
}

html[data-theme="light"] .detail-subtab {
  color: var(--c-slate-530);
}

html[data-theme="light"] .detail-subtab:hover,
html[data-theme="light"] .detail-subtab.active {
  color: var(--c-cyan-730);
}

html[data-theme="light"] .new-loc-card {
  box-shadow: 0 1px 3px var(--c-blue-890-a040);
}

html[data-theme="light"] .new-loc-label {
  color: var(--c-navy-730) !important;
}

html[data-theme="light"] .new-loc-input,
html[data-theme="light"] .new-loc-select,
html[data-theme="light"] .new-loc-textarea {
  border: 1px solid var(--c-slate-160);
  color: var(--c-blue-890);
}

html[data-theme="light"] .new-loc-map-mode-btn:not(.active) {
  color: var(--c-navy-650);
}

html[data-theme="light"] .new-loc-geo-btn,
html[data-theme="light"] .new-loc-geo-btn.muted {
  background: var(--c-white) !important;
  border: 1px solid var(--c-slate-160) !important;
  color: var(--c-blue-890) !important;
  box-shadow: 0 1px 2px var(--c-blue-890-a050) !important;
}

html[data-theme="light"] .new-loc-geo-btn:hover,
html[data-theme="light"] .new-loc-geo-btn.muted:hover {
  background: var(--c-blue-30) !important;
  border-color: var(--c-cyan-730) !important;
  color: var(--c-cyan-730) !important;
}

html[data-theme="light"] .unterstandorte-empty-text {
  color: var(--c-slate-530);
}

html[data-theme="light"] .history-table th {
  background: var(--c-slate-20);
  color: var(--c-navy-650);
  border-bottom: 1px solid var(--c-slate-90);
}

html[data-theme="light"] .history-table td {
  border-bottom: 1px solid var(--c-slate-40);
}
