:root {
  --bg-dark: #0f172a;
  --bg-card: #1e293b;
  --bg-panel: #182234;
  --border-color: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #10b981;
  --success-hover: #059669;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100vh;
  overflow: hidden;
  font-family: var(--font-family);
  background: var(--bg-dark);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  height: 56px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 1500;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-badge {
  background: #dc2626;
  color: #fff;
  font-weight: 800;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
}

/* CAD Menu Bar */
.cad-menubar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.menu-dropdown {
  position: relative;
  display: inline-block;
}

.menu-btn {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.menu-btn:hover, .menu-dropdown:hover .menu-btn {
  background: #334155;
  border-color: #64748b;
  color: #fff;
}

.menu-btn-accent {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

.menu-btn-accent:hover, .menu-dropdown:hover .menu-btn-accent {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #0f172a;
}

.menu-arrow {
  font-size: 9px;
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.menu-dropdown:hover .menu-arrow {
  transform: rotate(180deg);
}

.menu-dropdown-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  min-width: 280px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.75), 0 8px 16px -4px rgba(0, 0, 0, 0.5);
  padding: 6px;
  z-index: 2500;
  backdrop-filter: blur(14px);
  animation: menuFadeIn 0.15s ease-out;
}

@keyframes menuFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.menu-dropdown:hover .menu-dropdown-panel,
.menu-dropdown.open .menu-dropdown-panel {
  display: block;
}

.menu-action-item {
  width: 100%;
  background: transparent;
  border: none;
  color: #f1f5f9;
  padding: 8px 10px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  font-size: 12px;
}

.menu-action-item:hover {
  background: #1e293b;
  color: #38bdf8;
}

.menu-action-item.item-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.menu-action-item .menu-icon {
  font-size: 16px;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}

.menu-action-item .menu-text {
  display: flex;
  flex-direction: column;
}

.menu-action-item .menu-title {
  font-weight: 600;
  line-height: 1.25;
}

.menu-action-item .menu-desc {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 2px;
}

.menu-divider {
  height: 1px;
  background: #334155;
  margin: 4px 6px;
}

/* Header Center: Project Info Pill & Etap */
.header-center {
  display: flex;
  align-items: center;
  gap: 14px;
}

.project-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid #334155;
  padding: 5px 12px;
  border-radius: 20px;
  max-width: 260px;
  overflow: hidden;
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
  flex-shrink: 0;
}

.pill-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill-sub {
  font-size: 10px;
  color: #94a3b8;
  white-space: nowrap;
}

.section-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.section-group select {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  max-width: 260px;
}

.section-btns {
  display: flex;
  align-items: center;
  gap: 3px;
}

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

/* Buttons */
.btn {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary { background: var(--bg-card); color: var(--text-main); border-color: var(--border-color); }
.btn-secondary:hover { background: #334155; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: var(--success-hover); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }

.full-width { width: 100%; margin-bottom: 8px; }

/* Workspace */
.workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.canvas-viewport {
  flex: 1;
  position: relative;
  height: 100%;
  overflow: hidden;
}

/* Floating Polyline Drawing HUD */
.drawing-hud {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(8px);
  border: 1.5px solid #f59e0b;
  border-radius: 10px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  animation: modalIn 0.2s ease-out;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-icon {
  font-size: 20px;
}

.hud-info {
  display: flex;
  flex-direction: column;
}

.hud-title {
  font-size: 12px;
  font-weight: 800;
  color: #f8fafc;
}

.hud-sub {
  font-size: 10px;
  color: #cbd5e1;
}

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

.hud-dist-badge {
  background: #f59e0b;
  color: #000;
  font-weight: 800;
  font-size: 13px;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.hud-points-badge {
  background: #1e293b;
  color: #94a3b8;
  font-weight: 700;
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid #334155;
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Sidebar - Perfectly Sized */
.sidebar {
  width: 385px;
  min-width: 385px;
  max-width: 385px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow: hidden;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: #111827;
  flex-shrink: 0;
}

.tab-btn {
  flex: 1;
  padding: 10px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.tab-btn:hover { color: var(--text-main); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); background: var(--bg-panel); }

.tab-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px;
  display: none;
}
.tab-content.active { display: block; }

.search-box input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 10px;
  outline: none;
}

.section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin: 10px 0 6px 0;
}

.btn-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.btn-grid-4 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

/* Sign Grids - Fits completely without horizontal scroll */
.sign-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  width: 100%;
}

.sign-grid.compact {
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 100%;
  max-height: 440px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

.category-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.cat-pill {
  background: var(--bg-card);
  color: #94a3b8;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.cat-pill:hover {
  background: #1e293b;
  color: #f1f5f9;
  border-color: #475569;
}

.cat-pill.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.4);
}

.signs-counter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10.5px;
  color: #94a3b8;
  margin-top: 6px;
  padding: 3px 4px;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 4px;
  border: 1px solid rgba(51, 65, 85, 0.5);
}

.btn-load-more {
  background: transparent;
  border: 1px solid #3b82f6;
  color: #60a5fa;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s ease;
}

.btn-load-more:hover {
  background: #2563eb;
  color: #ffffff;
}

.sign-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 5px 3px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.sign-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  background: #233147;
}

.sign-card img {
  width: auto;
  height: 48px;
  max-width: 95%;
  object-fit: contain;
  margin-bottom: 4px;
}

.sign-card .sign-label {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* Tool Groups */
.tool-group {
  margin-bottom: 14px;
  border-bottom: 1px solid #233044;
  padding-bottom: 12px;
}

.tool-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
}

.tool-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 6px;
}

.btn-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

/* Center Map Viewport */
.canvas-viewport {
  flex: 1;
  background: #090d16;
  position: relative;
  overflow: hidden;
}

/* Leaflet Custom DivIcon styles */
.custom-sign-icon {
  background: none;
  border: none;
}

.sign-wrapper {
  transform-origin: center center;
  transition: transform 0.1s ease;
  cursor: grab;
  position: relative;
}

.sign-wrapper:active {
  cursor: grabbing;
}

.sign-wrapper.selected-sign {
  outline: 3px solid #3b82f6;
  outline-offset: 4px;
  border-radius: 4px;
  filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.8)) !important;
}

/* Selected badge overlay with delete button */
.sign-wrapper.selected-sign::after {
  content: "✓";
  position: absolute;
  top: -10px;
  right: -10px;
  background: #3b82f6;
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #fff;
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #10b981;
  color: #fff;
  padding: 10px 18px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 999;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* Custom Zusatzschild Generator Card */
.custom-zz-card {
  background: #1e293b;
  border: 1px solid #3b82f6;
  border-radius: 8px;
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.custom-zz-header {
  background: #1e3a8a;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #bfdbfe;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.custom-zz-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#customZzInput {
  width: 100%;
  background: #0f172a;
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 8px 10px;
  color: #f8fafc;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.2s;
}

#customZzInput:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.zz-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.zz-chip {
  background: #334155;
  color: #cbd5e1;
  border: 1px solid #475569;
  border-radius: 4px;
  font-size: 11px;
  padding: 3px 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.zz-chip:hover {
  background: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
}

/* Authentic StVO Zusatzzeichen Plate Preview */
.zz-preview-box {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 0;
  background: #0b1120;
  border-radius: 6px;
  border: 1px dashed #334155;
}

.zz-preview-plate {
  display: inline-block;
  background: #ffffff;
  color: #000000;
  border: 3px solid #000000;
  outline: 1.5px solid #000000;
  outline-offset: -5px;
  border-radius: 6px;
  padding: 6px 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Arial Bold", sans-serif;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  line-height: 1.25;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  max-width: 90%;
  word-break: break-word;
}

.zz-action-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* 2. Custom Haltverbot Kombo (VZ 283 + 1060-31 + Datum/Zeit) */
.custom-combo-card {
  background: #1e293b;
  border: 1px solid #ef4444;
  border-radius: 8px;
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.custom-combo-header {
  background: #7f1d1d;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #fecaca;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.custom-combo-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#customComboDateInput {
  width: 100%;
  background: #0f172a;
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 8px 10px;
  color: #f8fafc;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.2s;
}

#customComboDateInput:focus {
  border-color: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.3);
}

.combo-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.combo-chip {
  background: #334155;
  color: #cbd5e1;
  border: 1px solid #475569;
  border-radius: 4px;
  font-size: 11px;
  padding: 3px 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.combo-chip:hover {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
}

.combo-preview-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
  background: #0b1120;
  border-radius: 6px;
  border: 1px dashed #475569;
}

.combo-preview-sign {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 90px;
  background: #ffffff;
  padding: 2px;
  border-radius: 4px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
  gap: 2px;
}

.combo-img-top {
  width: 100%;
  height: auto;
  display: block;
}

.combo-img-mid {
  width: 100%;
  height: auto;
  display: block;
}

.combo-preview-bottom-plate {
  width: 100%;
  background: #ffffff;
  color: #000000;
  border: 2px solid #000000;
  outline: 1px solid #000000;
  outline-offset: -3px;
  border-radius: 3px;
  padding: 4px 4px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Arial Bold", sans-serif;
  font-size: 9px;
  font-weight: 800;
  text-align: center;
  line-height: 1.15;
  word-break: break-word;
  box-sizing: border-box;
}

.combo-action-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Section Header Controls */
.section-group {
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-icon {
  background: #334155;
  color: #f8fafc;
  border: 1px solid #475569;
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.btn-icon:hover {
  background: #475569;
  border-color: #64748b;
}

.btn-icon-danger:hover {
  background: #dc2626;
  border-color: #ef4444;
}

/* Search Location Geocoding */
.search-location-box {
  position: relative;
  display: flex;
  align-items: center;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 3px 6px;
  gap: 4px;
  transition: width 0.2s ease, border-color 0.2s ease;
  width: 240px;
}

.search-location-box:focus-within {
  border-color: #3b82f6;
  width: 290px;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

#inputGeocode {
  background: transparent;
  border: none;
  outline: none;
  color: #f8fafc;
  font-size: 11px;
  flex: 1;
  min-width: 0;
}

#inputGeocode::placeholder {
  color: #64748b;
}

.btn-clear-search {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.btn-clear-search:hover {
  color: #fff;
}

/* Autocomplete Dropdown */
.geocode-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 340px;
  max-width: 90vw;
  background: #182234;
  border: 1px solid #475569;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 1000;
  overflow: hidden;
  display: none;
  animation: modalIn 0.15s ease-out;
}

.geocode-dropdown.show {
  display: block;
}

.geocode-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  transition: background 0.15s ease;
}

.geocode-item:last-child {
  border-bottom: none;
}

.geocode-item:hover, .geocode-item.active {
  background: #2563eb;
}

.geocode-item:hover .geocode-sub, .geocode-item.active .geocode-sub {
  color: #dbeafe;
}

.geocode-icon {
  font-size: 14px;
  margin-top: 1px;
  flex-shrink: 0;
}

.geocode-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.geocode-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.geocode-sub {
  font-size: 10px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.geocode-status {
  padding: 10px 14px;
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
}

.badge-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.3);
}

/* Dynamic Bauabschnitt Badge Card */
.custom-badge-card {
  background: #1e293b;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.custom-badge-header {
  background: #78350f;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #fde68a;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.custom-badge-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#customBadgeTitle, #customBadgeSubtitle {
  width: 100%;
  background: #0f172a;
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 7px 10px;
  color: #f8fafc;
  font-size: 12px;
  font-weight: 600;
  outline: none;
}

#customBadgeTitle:focus, #customBadgeSubtitle:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25);
}

.badge-preview-box {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 0;
  background: #0b1120;
  border-radius: 6px;
  border: 1px dashed #334155;
}

.badge-preview-plate {
  display: inline-block;
  background: #fffbeb;
  border: 2.5px solid #d97706;
  outline: 1.5px solid #f59e0b;
  outline-offset: -4px;
  border-radius: 6px;
  padding: 6px 14px;
  text-align: center;
  max-width: 90%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.badge-preview-title {
  color: #9a3412;
  font-weight: 800;
  font-size: 13px;
  line-height: 1.2;
}

.badge-preview-sub {
  color: #1e293b;
  font-size: 11px;
  font-weight: 600;
  margin-top: 2px;
  line-height: 1.2;
}

.badge-action-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Legend items */
.legend-card {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.legend-item {
  font-size: 11px;
  line-height: 1.35;
}

.legend-key {
  color: #94a3b8;
  font-weight: 600;
}

.legend-val {
  color: #f8fafc;
  font-weight: 700;
}

/* Modal Dialog */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

.modal-backdrop.open {
  display: flex;
}

.modal-dialog {
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 10px;
  width: 460px;
  max-width: 92vw;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 12px 16px;
  background: #182234;
  border-bottom: 1px solid #334155;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: #f8fafc;
}

.modal-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: #fff;
}

.modal-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-footer {
  padding: 12px 16px;
  background: #182234;
  border-top: 1px solid #334155;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 11px;
  font-weight: 600;
  color: #cbd5e1;
}

.form-group input {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 8px 10px;
  color: #f8fafc;
  font-size: 12px;
  outline: none;
}

.form-group input:focus {
  border-color: #3b82f6;
}

/* Modal Large */
.modal-lg {
  width: 720px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
}

/* Smart Workzone Flow */
.smart-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.step-label {
  font-size: 12px;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 8px;
  display: block;
}

.plan-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.plan-card {
  background: #0f172a;
  border: 2px solid #334155;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  transition: all 0.2s ease;
}

.plan-card:hover {
  border-color: #64748b;
  background: #1e293b;
}

.plan-card input[type="radio"] {
  position: absolute;
  top: 10px;
  right: 10px;
}

.plan-card.active {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
  box-shadow: 0 0 0 1px #f59e0b;
}

.plan-card-icon {
  font-size: 18px;
  line-height: 1;
}

.plan-card-title {
  font-size: 12px;
  font-weight: 700;
  color: #f8fafc;
}

.plan-card-desc {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.3;
}

.plan-tag {
  align-self: flex-start;
  margin-top: 4px;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.tag-blue { background: #1e3a8a; color: #93c5fd; }
.tag-orange { background: #7c2d12; color: #fdba74; }
.tag-purple { background: #581c87; color: #d8b4fe; }
.tag-red { background: #7f1d1d; color: #fca5a5; }
.tag-green { background: #14532d; color: #86efac; }

.smart-params-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.smart-params-row .form-group {
  flex: 1;
}

.smart-params-row select {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 8px 10px;
  color: #f8fafc;
  font-size: 12px;
  outline: none;
}

.input-with-unit {
  display: flex;
  align-items: center;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  overflow: hidden;
}

.input-with-unit input {
  border: none;
  flex: 1;
  padding: 8px 10px;
  background: transparent;
  color: #fff;
  outline: none;
  font-size: 12px;
}

.input-with-unit span {
  padding: 8px 10px;
  font-size: 11px;
  color: #94a3b8;
  background: #1e293b;
  border-left: 1px solid #334155;
}

.smart-calc-box {
  background: #0b1120;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 12px;
}

.calc-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #cbd5e1;
  margin-bottom: 8px;
}

.calc-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.metric-item {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 8px;
  text-align: center;
}

.metric-val {
  font-size: 15px;
  font-weight: 800;
  color: #f59e0b;
}

.metric-label {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 2px;
}

.calc-warnings {
  margin-top: 8px;
  font-size: 11px;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.1);
  border-left: 3px solid #ef4444;
  padding: 6px 10px;
  border-radius: 4px;
  display: none;
}

.status-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}

.status-badge.ok { background: #14532d; color: #86efac; }
.status-badge.warn { background: #78350f; color: #fde68a; }

/* Matrix Table */
.matrix-table-container table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin-top: 6px;
}

.matrix-table-container th, .matrix-table-container td {
  border: 1px solid #334155;
  padding: 6px 8px;
  text-align: center;
}

.matrix-table-container th {
  background: #1e293b;
  color: #f1f5f9;
  font-weight: 700;
}

.matrix-table-container td:first-child {
  text-align: left;
  font-weight: 700;
  background: #1e293b;
  color: #94a3b8;
}

.matrix-table-container td {
  background: #0f172a;
  color: #e2e8f0;
}

/* Phasenfolge list */
.phasenfolge-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
  max-height: 160px;
  overflow-y: auto;
}

.phase-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11px;
}

.phase-row-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #f1f5f9;
}

.phase-state-pill {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}

.phase-state-pill.green { background: #16a34a; color: #fff; }
.phase-state-pill.red { background: #dc2626; color: #fff; }

/* Barrier Choice Grid */
.barrier-choice-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 6px;
}

.barrier-choice-card {
  background: #0f172a;
  border: 2px solid #334155;
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  transition: all 0.2s ease;
}

.barrier-choice-card:hover {
  border-color: #64748b;
  background: #1e293b;
}

.barrier-choice-card input[type="radio"] {
  position: absolute;
  top: 8px;
  right: 8px;
}

.barrier-choice-card.active {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
  box-shadow: 0 0 0 1px #f59e0b;
}

.barrier-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.barrier-card-icon {
  font-size: 16px;
}

.barrier-card-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: #334155;
  color: #cbd5e1;
}

.barrier-card-title {
  font-size: 11px;
  font-weight: 700;
  color: #f8fafc;
}

.barrier-card-sub {
  font-size: 9.5px;
  color: #94a3b8;
  line-height: 1.25;
}

/* Road Working Side Choice Grid */
.workside-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.workside-choice-card {
  background: #0f172a;
  border: 2px solid #334155;
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  transition: all 0.2s ease;
}

.workside-choice-card:hover {
  border-color: #64748b;
  background: #1e293b;
}

.workside-choice-card input[type="radio"] {
  position: absolute;
  top: 8px;
  right: 8px;
}

.workside-choice-card.active {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
  box-shadow: 0 0 0 1px #f59e0b;
}

.workside-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.workside-card-icon {
  font-size: 16px;
}

.workside-badge {
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}

.workside-badge.right {
  background: #78350f;
  color: #fde68a;
}

.workside-badge.left {
  background: #1e3a8a;
  color: #bfdbfe;
}

.workside-card-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #f8fafc;
}

.workside-card-sub {
  font-size: 10px;
  color: #94a3b8;
  line-height: 1.3;
}

/* Floating Area Delete HUD */
.area-delete-hud {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  border: 1.5px solid #ef4444;
  border-radius: 10px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.35);
  animation: modalIn 0.2s ease-out;
}

.area-delete-hud .hud-title {
  color: #f87171;
}

.marker-to-delete {
  outline: 3px solid #ef4444 !important;
  outline-offset: 4px;
  border-radius: 6px;
  filter: drop-shadow(0 0 12px rgba(239, 68, 68, 0.95)) !important;
  opacity: 0.65;
  transition: all 0.15s ease;
}

.btn-danger.active {
  background: #b91c1c !important;
  border-color: #ef4444 !important;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.65);
}

.btn-outline-danger {
  background: transparent;
  color: #f87171;
  border: 1px solid #ef4444;
}

.btn-outline-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: #f87171;
}

/* =============================================================================
   KOMBI-MAST (DIREK KOMBİNASYONU) & STÜCKLISTE STYLES (StVO / RSA 21)
   ============================================================================= */

/* Language Selector Dropdown */
.lang-menu-dropdown {
  position: relative;
}

.lang-menu-dropdown .menu-btn {
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 6px 10px;
  color: #f8fafc;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-menu-dropdown .menu-btn:hover {
  background: #334155;
  border-color: #64748b;
}

.lang-dropdown-panel {
  min-width: 170px !important;
}

/* Kombi-Mast Modal Dialog Layout */
.kombi-modal-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 16px;
}

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

.kombi-left-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kombi-right-panel {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 280px;
}

.kombi-section-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Sign Item Row in Modal */
.kombi-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
  transition: border-color 0.15s ease;
}

.kombi-item-row:hover {
  border-color: #60a5fa;
}

.kombi-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.kombi-rank {
  font-size: 13px;
  font-weight: 800;
  color: #fbbf24;
  width: 20px;
}

.kombi-thumb {
  height: 42px;
  width: auto;
  max-width: 50px;
  object-fit: contain;
  background: #1e293b;
  padding: 2px;
  border-radius: 4px;
}

.kombi-item-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kombi-item-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.3;
}

.kombi-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Visual Pole & Stacked Signs in CAD */
.kombi-stack-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 12px 0;
  padding: 10px 0;
  position: relative;
}

.kombi-stack-box::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 6px;
  background: #64748b;
  border: 1px solid #94a3b8;
  border-radius: 2px;
  z-index: 1;
}

.kombi-stack-img {
  position: relative;
  z-index: 2;
  max-height: 70px;
  max-width: 90%;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.6));
  background: #0f172a;
  border-radius: 4px;
}

/* Pole Hardware Spec Pills */
.kombi-specs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  width: 100%;
}

.kombi-spec-pill {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kombi-spec-pill .spec-label {
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
}

.kombi-spec-pill .spec-val {
  font-size: 12px;
  font-weight: 700;
  color: #f8fafc;
}

/* Validation Alert Box */
.kombi-warn-box {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid #ef4444;
  border-radius: 8px;
  padding: 10px 12px;
  color: #fca5a5;
  font-size: 11.5px;
  line-height: 1.4;
  font-weight: 600;
  margin-bottom: 8px;
}

/* Sign Picker Candidate Grid */
.kombi-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding: 4px;
}

/* Stückliste Modal & Tables */
.stuckliste-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

@media (max-width: 768px) {
  .stuckliste-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stuckliste-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 12px;
  background: #0f172a;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #334155;
}

.stuckliste-table th {
  background: #182234;
  color: #cbd5e1;
  font-weight: 700;
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid #334155;
}

.stuckliste-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #1e293b;
  color: #f1f5f9;
}

.stuckliste-table tr:last-child td {
  border-bottom: none;
}

.stuckliste-table tr:hover td {
  background: #1e293b;
}

.tag-red { background: #7f1d1d; color: #fca5a5; }
.tag-blue { background: #1e3a8a; color: #bfdbfe; }
.tag-green { background: #064e3b; color: #a7f3d0; }
.tag-amber { background: #78350f; color: #fde68a; }

/* Compact Generator Dropdown Container */
.custom-generator-card {
  background: #182234;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
}

.custom-generator-card:hover {
  border-color: #475569;
}

.generator-dropdown-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.generator-dropdown-select {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  background: #0f172a;
  border: 1.5px solid #475569;
  border-radius: 6px;
  color: #fbbf24;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 8px;
  outline: none;
  cursor: pointer;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  transition: all 0.15s ease;
}

.generator-dropdown-select:hover, .generator-dropdown-select:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 8px rgba(96, 165, 250, 0.3);
}

.generator-subpanel {
  animation: modalIn 0.15s ease-out;
}
