:root{
  --bg-main:#020617;
  --bg-card:#020617;
  --text-main:#e5e7eb;
  --text-muted:#9ca3af;
  --accent:#3b82f6;
  --accent-soft:rgba(59,130,246,0.18);
  --accent-strong:#2563eb;
  --border-subtle:#1f2937;
  --danger:#ef4444;
  --success:#22c55e;
  --radius-lg:16px;
  --shadow-soft:0 18px 40px rgba(0,0,0,.55);
  --font-main:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  --sidebar-width:380px;
  --sidebar-width-md:320px;
  --sidebar-height-mobile:340px;
}

*{box-sizing:border-box;}
html,body{margin:0;padding:0;height:100%;}

body{
  font-family:var(--font-main);
  background:radial-gradient(circle at top,#111827 0,#020617 55%);
  color:var(--text-main);
}

/* LOGIN */

.login-body{
  display:flex;
  align-items:center;
  justify-content:center;
}

.login-page-shell{
  width:100vw;
  height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
}

.login-card{
  width:380px;
  background:var(--bg-card);
  border-radius:var(--radius-lg);
  border:1px solid var(--border-subtle);
  box-shadow:var(--shadow-soft);
  padding:18px 20px 16px;
}

.login-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.auth-tabs{
  display:flex;
  gap:6px;
  margin:8px 0 12px;
}
.auth-tab{
  flex:1;
  border:1px solid var(--border-subtle);
  background:#0f172a;
  color:var(--text-muted);
  padding:8px;
  border-radius:999px;
  cursor:pointer;
  font-weight:600;
}
.auth-tab.active{
  background:linear-gradient(135deg,#2563eb,#4f46e5);
  color:#fff;
  box-shadow:0 10px 20px rgba(37,99,235,.4);
}
.auth-form{margin:0;}

.login-logo{
  display:flex;
  align-items:center;
  gap:8px;
}

.login-logo-icon{
  width:32px;
  height:32px;
  border-radius:999px;
  background:radial-gradient(circle at 30% 20%,#93c5fd,#1d4ed8);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:800;
  font-size:18px;
}

.login-logo-text{
  display:flex;
  flex-direction:column;
  font-size:12px;
}

.login-title{
  margin:10px 0 4px;
  font-size:20px;
}

.login-sub{
  margin:0 0 12px;
  font-size:13px;
  color:var(--text-muted);
}

.field-label{
  font-size:12px;
  margin-bottom:3px;
  display:block;
}

.field-input{
  width:100%;
  padding:7px 10px;
  border-radius:999px;
  border:1px solid var(--border-subtle);
  background:#020617;
  color:var(--text-main);
  font-size:13px;
  outline:none;
  margin-bottom:8px;
}

.field-input::placeholder{color:var(--text-muted);}

.field-input:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 1px var(--accent-soft);
}

.btn-primary{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:8px 10px;
  border-radius:999px;
  border:none;
  background:linear-gradient(135deg,#2563eb,#4f46e5);
  color:#fff;
  font-size:14px;
  cursor:pointer;
  box-shadow:0 10px 25px rgba(37,99,235,.5);
}

.btn-primary:hover{
  filter:brightness(1.06);
}

.w-full{width:100%;}

.login-hint{
  margin-top:6px;
  font-size:11px;
  color:var(--text-muted);
}

.login-hint code{
  background:#0f172a;
  border-radius:4px;
  padding:1px 4px;
}

.login-error{
  color:var(--danger);
  font-size:12px;
  min-height:14px;
}

.alert{
  padding:8px 10px;
  border:1px solid var(--border-subtle);
  border-radius:10px;
  background:#0b1120;
  font-size:12px;
  color:var(--text-main);
  margin-bottom:8px;
}
.alert-success{border-color:rgba(34,197,94,.5);color:#bbf7d0;background:rgba(22,163,74,.08);}
.alert-warning{border-color:rgba(249,115,22,.5);color:#fdba74;background:rgba(249,115,22,.08);}
.alert-danger{border-color:rgba(239,68,68,.6);color:#fecdd3;background:rgba(239,68,68,.08);}

.auth-row{
  display:flex;
  align-items:center;
  gap:8px;
  margin-top:4px;
}

.btn-link{
  background:none;
  border:none;
  color:var(--accent);
  cursor:pointer;
  font-size:12px;
  padding:4px 6px;
  text-decoration:none;
}
.btn-link:hover{
  color:#60a5fa;
}

/* APP-SHELL / DASHBOARD */

.app-shell{
  display:flex;
  height:100vh;
  width:100vw;
}

.sidebar{
  width:var(--sidebar-width);
  background:#020617;
  border-right:1px solid var(--border-subtle);
  padding:14px 16px;
  display:flex;
  flex-direction:column;
}

.map-wrapper{
  flex:1;
  padding:10px;
  position:relative;
}
.mobile-overlay{
  display:none;
}
.mobile-toggle,
.mobile-close{
  display:none;
}

#map{
  width:100%;
  height:100%;
  border-radius:16px;
  box-shadow:var(--shadow-soft);
}

/* HEADER / LOGO */

.sidebar-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
}

.logo{
  display:flex;
  align-items:center;
  gap:8px;
}

.logo-icon{
  width:30px;
  height:30px;
  border-radius:999px;
  background:radial-gradient(circle at 30% 20%,#93c5fd,#1d4ed8);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:800;
}

.logo-text span:first-child{
  font-size:11px;
  letter-spacing:.12em;
  text-transform:uppercase;
  color:var(--text-muted);
}

.logo-text span:last-child{
  font-size:14px;
  font-weight:600;
}

.user-mini{
  text-align:right;
  font-size:12px;
}

.badge-role{
  font-size:11px;
  padding:2px 8px;
  border-radius:999px;
  border:1px solid var(--border-subtle);
  color:var(--text-muted);
}

/* SIDEBAR SECTIONS */

.sidebar-section{
  margin-top:10px;
}

.sidebar-section--header-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}

.section-title{
  font-size:11px;
  letter-spacing:.12em;
  text-transform:uppercase;
  color:var(--text-muted);
  margin-bottom:4px;
}

/* Suche */

.search-container{
  position:relative;
}

.search-input{
  width:100%;
  padding:7px 10px 7px 27px;
  border-radius:999px;
  border:1px solid var(--border-subtle);
  background:#020617;
  color:var(--text-main);
  font-size:13px;
}

.search-icon{
  position:absolute;
  top:50%;
  left:8px;
  transform:translateY(-50%);
  font-size:12px;
  color:var(--text-muted);
}

.search-suggestions{
  position:absolute;
  top:32px;
  left:0;
  right:0;
  background:#020617;
  border-radius:12px;
  border:1px solid var(--border-subtle);
  max-height:240px;
  overflow-y:auto;
  z-index:9999;
  display:none;
}

.suggestion-item{
  padding:8px 10px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  font-size:13px;
  cursor:pointer;
}

.suggestion-item:hover,
.suggestion-item.active{
  background:#0b1120;
}

.suggestion-type{
  font-size:11px;
  color:var(--text-muted);
  padding:2px 6px;
  border-radius:999px;
  border:1px solid var(--border-subtle);
  text-transform:uppercase;
}

.suggestion-empty{
  padding:8px 10px;
  font-size:12px;
  color:var(--text-muted);
}

/* Bundesländer-Chips */

.pill-row{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}

.pill{
  padding:4px 8px;
  border-radius:999px;
  border:1px solid var(--border-subtle);
  background:#020617;
  color:var(--text-muted);
  font-size:11px;
  cursor:pointer;
}

.pill.active{
  border-color:var(--accent);
  color:var(--accent);
  background:var(--accent-soft);
}

/* Tabs + Actions */

.tabs{
  display:flex;
  gap:4px;
  background:#020617;
  border-radius:999px;
  border:1px solid var(--border-subtle);
  padding:3px;
}

.tab{
  flex:1;
  text-align:center;
  font-size:12px;
  padding:4px 0;
  border-radius:999px;
  color:var(--text-muted);
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:4px;
}

.tab.active{
  background:linear-gradient(135deg,#2563eb,#4f46e5);
  color:#fff;
  box-shadow:0 10px 20px rgba(37,99,235,.4);
}

.tab-count{
  font-size:11px;
}

.sidebar-actions{
  display:flex;
  gap:4px;
}

/* Buttons */

.btn-icon{
  width:30px;
  height:30px;
  border-radius:999px;
  border:1px solid var(--border-subtle);
  background:#020617;
  color:var(--text-muted);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  font-size:14px;
}

.btn-icon:hover{
  border-color:var(--accent);
  color:var(--accent);
}

.btn-icon-delete{
  border:none;
  background:transparent;
  color:var(--text-muted);
  cursor:pointer;
  padding:2px;
  border-radius:999px;
}

.btn-icon-delete:hover{
  color:var(--danger);
  background:#0b1120;
}

.btn-sm{
  border-radius:999px;
  border:1px solid var(--border-subtle);
  background:#020617;
  color:var(--text-muted);
  padding:4px 8px;
  font-size:11px;
  cursor:pointer;
}

.btn-sm:hover{
  border-color:var(--accent);
  color:var(--accent);
}

.btn-ghost{
  border-radius:999px;
  border:1px solid var(--border-subtle);
  background:#020617;
  color:var(--text-muted);
  padding:4px 10px;
  font-size:11px;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  gap:6px;
}

.btn-ghost:hover{
  border-color:var(--accent);
  color:var(--accent);
}

/* Listen */

.sidebar-content{
  flex:1;
  margin-top:8px;
  overflow-y:auto;
  font-size:12px;
  padding-right:4px;
}

.list-container{ font-size:12px; }

.group-header{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.12em;
  color:var(--text-muted);
  margin:8px 0 4px;
}

.item-card{
  background:#020617;
  border-radius:12px;
  border:1px solid var(--border-subtle);
  padding:8px 9px;
  margin-bottom:6px;
  cursor:pointer;
  transition:background .15s,border-color .15s,transform .08s;
}

.item-card:hover{
  background:#0b1120;
  border-color:var(--accent);
  transform:translateY(-1px);
}

.item-card.active{
  border-color:var(--accent-strong);
  box-shadow:0 0 0 1px var(--accent-soft);
}

.item-title-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:6px;
}

.item-title{
  font-size:13px;
  font-weight:500;
}

.item-sub{
  font-size:11px;
  color:var(--text-muted);
  margin-top:2px;
}

.item-meta-row{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:11px;
  color:var(--text-muted);
  margin-top:4px;
}

.badge-type{
  font-size:11px;
  padding:2px 6px;
  border-radius:999px;
  border:1px solid var(--border-subtle);
  text-transform:uppercase;
}

.badge-type.company{
  border-color:#38bdf8;
  color:#38bdf8;
}

.badge-type.employee{
  border-color:#a855f7;
  color:#a855f7;
}

.badge-own{
  font-size:10px;
  padding:1px 6px;
  border-radius:999px;
  border:1px solid rgba(34,197,94,.5);
  color:#bbf7d0;
  background:rgba(22,163,74,.1);
}

.indicator-dot{
  width:9px;
  height:9px;
  border-radius:50%;
  display:inline-block;
}

.indicator-dot.green{
  background:var(--success);
  box-shadow:0 0 0 3px rgba(34,197,94,.25);
}

.indicator-dot.red{
  background:var(--danger);
  box-shadow:0 0 0 3px rgba(239,68,68,.25);
}

/* Footer */

.sidebar-footer{
  display:flex;
  justify-content:space-between;
  align-items:center;
  font-size:11px;
  padding-top:6px;
  border-top:1px solid var(--border-subtle);
}

.sidebar-footer-left{
  display:flex;
  align-items:center;
  gap:6px;
}

.dot{
  width:8px;
  height:8px;
  border-radius:999px;
  display:inline-block;
}

.dot-online{ background:var(--success); }

/* Marker / Map */

.marker-company,
.marker-employee{
  border-radius:999px;
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow:0 0 0 2px rgba(15,23,42,.9);
}

.marker-company{
  width:24px;
  height:24px;
  background:radial-gradient(circle at 30% 20%,#38bdf8,#0ea5e9);
}
.marker-company-stale{
  background:radial-gradient(circle at 30% 20%,#f59e0b,#f97316);
}

.marker-employee{
  width:22px;
  height:22px;
  background:radial-gradient(circle at 30% 20%,#a855f7,#7c3aed);
}

.marker-employee-nearest{
  background:radial-gradient(circle at 30% 20%,#22c55e,#16a34a)!important;
}

.marker-employee-radius-active{
  background:radial-gradient(circle at 30% 20%,#fb923c,#ea580c)!important;
  box-shadow:0 0 0 3px rgba(249,115,22,.55),0 0 24px rgba(249,115,22,.35);
  transform:scale(1.06);
}
/*Suggestions */
.suggestion-box {
  position: absolute;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  width: 100%;
  z-index: 9999;
  display: none;
  max-height: 200px;
  overflow-y: auto;
}

.suggestion-item {
  padding: 8px 12px;
  cursor: pointer;
  color: #cbd5e1;
}

.suggestion-item:hover {
  background: #334155;
}

.city-suggestions{
  position:absolute;
  background:#0f172a;
  border:1px solid #334155;
  border-radius:8px;
  box-shadow:0 10px 25px rgba(0,0,0,0.45);
  z-index:9999;
  display:none;
  max-height:220px;
  overflow-y:auto;
}

.city-suggestion-row{
  padding:8px 10px;
  cursor:pointer;
  display:flex;
  justify-content:space-between;
  align-items:center;
  font-size:13px;
  color:#e5e7eb;
}

.city-suggestion-row:hover{
  background:#1e293b;
}


/* Mitarbeiter Zuordnung */

.marker-employee-own{
  box-shadow:0 0 0 2px rgba(168,85,247,.5);
}

.marker-employee-other{
  opacity:0.45;
  filter:grayscale(0.7);
  box-shadow:0 0 0 2px rgba(15,23,42,.9);
}

.marker-company svg,
.marker-employee svg{
  width:16px;
  height:16px;
  fill:#020617;
}

/* Map-Overlay (Legende & Auswahl) */

.map-overlay{
  position:absolute;
  top:12px;
  right:12px;
  display:flex;
  flex-direction:column;
  gap:8px;
  z-index:500;
  pointer-events:none;
}

.map-overlay .panel{
  background:rgba(2,6,23,.92);
  border-radius:12px;
  border:1px solid var(--border-subtle);
  padding:8px 10px;
  font-size:11px;
  min-width:210px;
  pointer-events:auto;
}

.map-overlay h4{
  margin:0 0 6px;
  font-size:12px;
}

.legend-row{
  display:flex;
  flex-wrap:wrap;
  gap:6px 10px;
}

.legend-item{
  display:flex;
  align-items:center;
  gap:6px;
}

.legend-swatch{
  width:12px;
  height:12px;
  border-radius:4px;
  border:1px solid var(--border-subtle);
}

.legend-state-own{
  background:var(--accent-soft);
  border-color:var(--accent);
}

.legend-company{
  background:radial-gradient(circle at 30% 20%,#38bdf8,#0ea5e9);
}

.legend-employee{
  background:radial-gradient(circle at 30% 20%,#a855f7,#7c3aed);
}

.legend-nearest{
  background:radial-gradient(circle at 30% 20%,#22c55e,#16a34a);
}

.selection-content{
  font-size:11px;
  color:var(--text-muted);
}

.selection-content .selection-highlight{
  color:#e5e7eb;
  font-weight:500;
}

.nearest-extra-block {
  margin-top: 0.75rem;
  font-size: 0.85rem;
}

.nearest-dropdown {
  background: rgba(15,23,42,0.7);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  border: 1px solid rgba(148,163,184,0.35);
}

.nearest-dropdown summary {
  cursor: pointer;
  list-style: none;
  font-weight: 500;
  color: #e5e7eb;
}

.nearest-dropdown summary::-webkit-details-marker {
  display: none;
}

.nearest-dropdown summary::after {
  content: "▼";
  font-size: 0.7rem;
  float: right;
  opacity: 0.7;
}

.nearest-dropdown[open] summary::after {
  content: "▲";
}

.nearest-list {
  margin: 0.4rem 0 0;
  padding-left: 0.8rem;
  list-style: none;
}

.nearest-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.15rem 0;
  color: #cbd5f5;
}

.nearest-list li strong {
  color: #e5e7eb;
}


.selection-distance{
  margin-top:4px;
}

/* Dialoge */

/* Inline-Toast f�r Hinweise */
.toast-stack{
  position:fixed;
  left:50%;
  top:12px;
  transform:translateX(-50%);
  display:flex;
  flex-direction:column;
  gap:8px;
  z-index:12000;
  pointer-events:none;
}

.toast{
  pointer-events:auto;
  min-width:240px;
  max-width:320px;
  display:flex;
  gap:10px;
  align-items:flex-start;
  padding:10px 12px;
  background:rgba(2,6,23,.96);
  border:1px solid var(--border-subtle);
  border-left:3px solid var(--accent);
  border-radius:12px;
  box-shadow:var(--shadow-soft);
  opacity:0;
  transform:translateY(10px);
  transition:opacity .18s ease,transform .18s ease;
}

.toast.show{
  opacity:1;
  transform:translateY(0);
}

.toast-warning{
  border-left-color:#f97316;
}

.toast-icon{
  color:#f97316;
  margin-top:2px;
}

.toast-title{
  font-size:13px;
  font-weight:600;
}

.toast-text{
  font-size:12px;
  color:var(--text-main);
}

.selection-warning-pulse{
  animation:selectionPulse .85s ease;
  border-color:#f97316!important;
  box-shadow:0 0 0 1px rgba(249,115,22,.4),0 12px 30px rgba(0,0,0,.35);
}

@keyframes selectionPulse{
  0%{transform:scale(1);}
  50%{transform:scale(1.01);}
  100%{transform:scale(1);}
}

.dialog-backdrop{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.8);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:9999;
}

.dialog{
  width:420px;
  max-width:90vw;
  max-height:90vh;
  background:#020617;
  border-radius:16px;
  border:1px solid var(--border-subtle);
  box-shadow:var(--shadow-soft);
  display:flex;
  flex-direction:column;
}

.dialog-header{
  padding:10px 12px 6px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom:1px solid var(--border-subtle);
}

.dialog-selection-details{ width:min(760px,92vw); }
.dialog-header h2{
  margin:0;
  font-size:14px;
}

.dialog-close{
  border:none;
  background:transparent;
  color:var(--text-muted);
  cursor:pointer;
  padding:4px;
  border-radius:999px;
}

.dialog-close:hover{
  background:#0b1120;
  color:var(--accent);
}

.dialog-body{
  padding:10px 12px;
  overflow-y:auto;
  font-size:12px;
}

.dialog-footer{
  padding:8px 12px 10px;
  border-top:1px solid var(--border-subtle);
  display:flex;
  justify-content:flex-end;
  gap:8px;
}

.dialog-text{
  font-size:12px;
  margin:0 0 8px;
}

.dialog-text.text-muted{
  color:var(--text-muted);
}

/* Bundesländer-Auswahl im Dialog */

.dialog-state-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(150px,1fr));
  gap:6px;
}

.dialog-state-item{
  border-radius:10px;
  border:1px solid var(--border-subtle);
  padding:4px 6px;
  display:flex;
  align-items:center;
  gap:6px;
  font-size:12px;
  cursor:pointer;
}

.dialog-state-item input{
  margin:0;
}

.dialog-state-item.active{
  border-color:var(--accent);
  background:var(--accent-soft);
}

/* Formulare in Dialogen */

.form-row{
  margin-bottom:6px;
}

.form-row-inline{
  display:flex;
  align-items:center;
  gap:6px;
}

.form-separator{
  border:none;
  border-top:1px solid var(--border-subtle);
  margin:8px 0;
}

/* Firmendetail-Dialog */

.contact-block{
  border-radius:10px;
  border:1px solid var(--border-subtle);
  padding:6px 8px;
  margin-bottom:8px;
  background:#020617;
}

.contact-block-title{
  font-size:13px;
  font-weight:500;
  margin-bottom:4px;
}

.contact-row{
  font-size:12px;
  color:var(--text-muted);
  margin-bottom:2px;
}

.text-muted{
  color:var(--text-muted);
}

/* Responsive */

/* Responsive */

@media(max-width:1200px){
  .sidebar{
    width:var(--sidebar-width-md);
  }
}

@media(max-width:960px){
  .sidebar{
    width:100%;
  }
}

/* Mobile Sidebar als Overlay + Vollbild-Karte */
@media(max-width:900px){
  .app-shell{
    flex-direction:column;
    min-height:100vh;
    height:auto;
  }
  .sidebar{
    position:fixed;
    top:max(16px, env(safe-area-inset-top, 16px));
    left:0;
    bottom:auto;
    height:calc(100vh - 48px);
    height:calc(100dvh - 48px);
    max-height:calc(100dvh - 48px - env(safe-area-inset-bottom, 0px));
    width:min(90vw,420px);
    max-width:100%;
    border-right:1px solid var(--border-subtle);
    border-bottom:none;
    padding:14px 14px 16px;
    z-index:1100;
    background:#020617;
    transform:translateX(-105%);
    transition:transform .2s ease,box-shadow .2s ease;
    overflow-y:auto;
    box-shadow:0 10px 25px rgba(0,0,0,0.35);
    display:flex;
    flex-direction:column;
    padding-bottom:calc(16px + env(safe-area-inset-bottom, 12px));
    scroll-padding-bottom:calc(16px + env(safe-area-inset-bottom, 12px));
    border-top-right-radius:14px;
    border-bottom-right-radius:14px;
  }
  body.sidebar-open .sidebar{
    transform:translateX(0);
    box-shadow:0 18px 45px rgba(0,0,0,0.45);
  }
  .mobile-overlay{
    display:none;
    position:fixed;
    inset:0;
    background:rgba(0,0,0,0.55);
    z-index:1000;
  }
  body.sidebar-open .mobile-overlay{
    display:block;
  }
  .mobile-toggle{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:46px;
    height:46px;
    border-radius:12px;
    border:1px solid var(--border-subtle);
    background:#020617;
    color:var(--text-main);
    position:fixed;
    top:12px;
    right:12px;
    z-index:1200;
    box-shadow:0 10px 25px rgba(0,0,0,0.35);
    cursor:pointer;
    opacity:0.98;
  }
  .mobile-close{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:34px;
    height:34px;
    border-radius:10px;
    border:1px solid var(--border-subtle);
    background:#0b1120;
    color:var(--text-main);
    margin-left:8px;
    cursor:pointer;
  }
  .sidebar-header{
    gap:8px;
  }
  .sidebar-content{
    max-height:none;
  }
  .sidebar-section{
    margin-top:8px;
  }
  .map-wrapper{
    padding:0;
    height:auto;
  }
  #map{
    width:100%;
    height:100vh;
    border-radius:0;
  }
  .map-overlay{
    top:58px;
    right:10px;
    left:10px;
    gap:6px;
  }
  .map-overlay .panel{
    min-width:auto;
  }
  .sidebar-footer{
    position:sticky;
    bottom:0;
    padding-bottom:calc(10px + env(safe-area-inset-bottom, 12px));
    padding-top:10px;
    background:#020617;
    margin-top:auto;
  }
}

@media(max-width:640px){
  body{
    font-size:14px;
  }
  .sidebar{
    padding:10px 12px;
  }
  .sidebar-header{
    align-items:flex-start;
  }
  .sidebar-footer{
    flex-direction:column;
    align-items:flex-start;
    gap:6px;
  }
  .tabs{
    font-size:12px;
  }
  .auth-tabs,
  .section-title{
    font-size:11px;
  }
  .btn-primary,
  .btn-ghost,
  .btn-sm{
    font-size:12px;
  }
  .dialog{
    width:100%;
    max-width:100%;
    border-radius:12px;
  }
  .dialog-body{
    max-height:65vh;
  }
}

/* =========================================================
   Einstellungen / Settings-Panel (Sidebar)
   ========================================================= */

.settings-panel{
  margin-top:6px;
  border-radius:12px;
  border:1px solid var(--border-subtle);
  background:#020617;
  padding:6px 8px;
  display:flex;
  flex-direction:column;
  gap:6px;
}

.settings-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding:4px 0;
}

.settings-label{
  flex:1;
  min-width:0;
}

.settings-title{
  font-size:12px;
}

.settings-sub{
  font-size:11px;
  color:var(--text-muted);
}

/* Toggle-Switch */

.toggle{
  position:relative;
  width:36px;
  height:20px;
  border-radius:999px;
  border:1px solid var(--border-subtle);
  background:#020617;
  cursor:pointer;
  padding:0;
  display:flex;
  align-items:center;
  transition:background .15s,border-color .15s;
}

.toggle-thumb{
  width:14px;
  height:14px;
  border-radius:999px;
  background:#6b7280;
  margin-left:3px;
  transition:margin .15s,background .15s;
}

.toggle.on{
  background:rgba(34,197,94,.15);
  border-color:#22c55e;
}

.toggle.on .toggle-thumb{
  margin-left:17px;
  background:#22c55e;
}

.toggle-compact{
  width:32px;
  height:18px;
}

.toggle-compact .toggle-thumb{
  width:12px;
  height:12px;
}

.toggle-compact.on .toggle-thumb{
  margin-left:15px;
}

.radius-toggle-inline{
  display:flex;
  align-items:center;
  gap:6px;
  font-size:11px;
  color:var(--text-muted);
}

.radius-label{
  color:var(--text-muted);
}

.radius-popup-row{
  margin-top:6px;
  display:flex;
  align-items:center;
  gap:8px;
}
/* Warn-Toggle für Bearbeitungsmodus (rot/orange) */
.toggle.toggle-danger.on{
  background:rgba(249,115,22,.15);
  border-color:#f97316;
}

.toggle.toggle-danger.on .toggle-thumb{
  background:#f97316;
}

/* Bearbeitungsmodus-Banner + Hervorhebung */

.edit-mode-banner{
  display:none;
  margin-top:8px;
  margin-bottom:4px;
  padding:6px 8px;
  border-radius:10px;
  border:1px solid rgba(248,113,22,.6);
  background:rgba(15,23,42,.98);
  color:#fed7aa;
  font-size:11px;
  align-items:flex-start;
  gap:6px;
}

/* Banner NUR anzeigen, wenn Bearbeitungsmodus aktiv */
body.edit-mode-active .edit-mode-banner{
  display:flex;
}


.edit-mode-banner i{
  color:#fdba74;
  margin-top:2px;
}

/* wenn aktiv: Sidebar optisch deutlich markieren */
body.edit-mode-active .sidebar{
  border-color:#f97316;
  box-shadow:0 0 0 1px rgba(249,115,22,.4) inset;
}

body.edit-mode-active .sidebar-header{
  color:#fed7aa;
}

body.edit-mode-active .sidebar .section-title{
  color:#fdba74;
}


.company-detail-header{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:flex-start;
  margin-bottom:12px;
}
.detail-title{
  font-size:18px;
  font-weight:700;
}
.detail-sub{
  color:#94a3b8;
  font-size:12px;
  line-height:1.4;
  margin-top:2px;
}
.detail-badges{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  justify-content:flex-end;
}
.company-details-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:12px;
}
.detail-card{
  background:rgba(15,23,42,0.9);
  border:1px solid rgba(148,163,184,0.2);
  border-radius:10px;
  padding:10px 12px;
  box-shadow:0 10px 30px rgba(0,0,0,0.25);
}
.detail-card-title{
  font-weight:700;
  margin-bottom:6px;
  font-size:13px;
}
.detail-kv{
  display:flex;
  justify-content:space-between;
  font-size:12px;
  color:#94a3b8;
  padding:4px 0;
  border-bottom:1px solid rgba(148,163,184,0.1);
}
.detail-kv:last-child{
  border-bottom:none;
}
.detail-kv strong{
  color:#e2e8f0;
  font-weight:600;
}
.detail-card-notes .detail-notes{
  white-space:pre-wrap;
  color:#e2e8f0;
  font-size:12px;
}
