.sws-app {
  color: #172033;
}

.sws-workbench {
  display: grid;
  gap: 0.85rem;
}

.sws-commandbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  align-items: stretch;
  padding: 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 26px rgba(15, 23, 42, 0.08);
}

.sws-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.sws-brand-mark {
  display: inline-grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0f766e, #2563eb);
  color: #ffffff;
  font-weight: 700;
}

.sws-brand h2 {
  margin: 0;
  color: #0f172a;
  font-size: 1.25rem;
  line-height: 1.15;
  letter-spacing: 0;
}

.sws-brand p {
  margin: 0.15rem 0 0;
  color: #64748b;
  font-size: 0.85rem;
  line-height: 1.25;
}

.sws-controls {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(320px, 1.25fr) minmax(210px, 0.7fr) minmax(260px, auto);
  gap: 0.65rem;
  align-items: end;
}

.sws-control {
  min-width: 0;
}

.sws-control .form-control {
  box-sizing: border-box;
  width: 100%;
  min-height: 2.35rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #172033;
}

.sws-control label {
  display: block;
  margin-bottom: 0.25rem;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 650;
  text-transform: uppercase;
}

.sws-control-search {
  position: relative;
}

.sws-control-address {
  position: relative;
}

.sws-mode-toggle {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.25rem;
  padding: 0.22rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}

.sws-mode-toggle button {
  min-height: 2.35rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #475569;
  font-weight: 650;
}

.sws-mode-toggle button.is-active {
  background: #0f766e;
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(15, 118, 110, 0.18);
}

.sws-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  align-items: end;
}

.sws-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.35rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #172033;
  white-space: nowrap;
}

.sws-actions .btn:disabled {
  cursor: progress;
  opacity: 0.78;
}

.sws-actions .btn-primary {
  border-color: #2563eb;
  background: #2563eb;
  color: #ffffff;
}

.sws-actions .btn-outline-secondary {
  border-color: #94a3b8;
  background: #ffffff;
  color: #334155;
}

.sws-results {
  position: absolute;
  z-index: 1200;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  max-height: 18rem;
  overflow-y: auto;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
}

.sws-results:empty,
.sws-results.is-hidden {
  display: none;
}

.sws-result-button,
.sws-result-empty {
  display: block;
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 0;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
  color: #172033;
  text-align: left;
}

.sws-result-button:hover,
.sws-result-button:focus,
.sws-result-button.is-active {
  background: #eef6ff;
}

.sws-result-button.is-active {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: -2px;
}

.sws-result-button strong {
  display: block;
  font-size: 0.95rem;
}

.sws-result-button span,
.sws-result-button small,
.sws-result-empty,
.sws-result-empty strong,
.sws-result-empty span {
  display: block;
}

.sws-result-button span,
.sws-result-button small,
.sws-result-empty span {
  color: #64748b;
  font-size: 0.84rem;
}

.sws-result-button small {
  margin-top: 0.2rem;
  color: #94a3b8;
}

.sws-score-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem 1.1rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  min-width: 0;
  max-width: 100%;
  transition: all 0.3s ease;
}

.sws-share-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.4rem;
}

.sws-score-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  font-size: 1.25rem;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  transition: all 0.3s ease;
}

.sws-score-badge.is-niedrig {
  background: #dcfce7;
  border-color: #bbf7d0;
}

.sws-score-badge.is-mittel {
  background: #fef9c3;
  border-color: #fef08a;
}

.sws-score-badge.is-hoch {
  background: #fee2e2;
  border-color: #fecaca;
}

.sws-score-copy {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.sws-score-label {
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 650;
  text-transform: uppercase;
  line-height: 1.2;
}

.sws-score-caption {
  color: #475569;
  font-size: 0.86rem;
  min-width: 0;
  line-height: 1.25;
}

.sws-score-value {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  line-height: 1;
}

.sws-score-value strong {
  color: #0f172a;
  font-size: clamp(1.8rem, 2.5vw, 2.25rem);
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  margin: 0;
}

.sws-score-value small {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-top: 0.15rem;
  line-height: 1;
}

/* Color thematic states for the score strip */
.sws-score-strip.is-niedrig {
  background: #f0fdf4;
  border-color: #bbf7d0;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.04);
}
.sws-score-strip.is-niedrig .sws-score-label {
  color: #166534;
}
.sws-score-strip.is-niedrig .sws-score-caption {
  color: #14532d;
}
.sws-score-strip.is-niedrig .sws-score-value strong {
  color: #166534;
}
.sws-score-strip.is-niedrig .sws-score-value small {
  color: #16653499;
}

.sws-score-strip.is-mittel {
  background: #fefce8;
  border-color: #fef08a;
  box-shadow: 0 4px 12px rgba(202, 138, 4, 0.04);
}
.sws-score-strip.is-mittel .sws-score-label {
  color: #854d0e;
}
.sws-score-strip.is-mittel .sws-score-caption {
  color: #713f12;
}
.sws-score-strip.is-mittel .sws-score-value strong {
  color: #854d0e;
}
.sws-score-strip.is-mittel .sws-score-value small {
  color: #854d0e99;
}

.sws-score-strip.is-hoch {
  background: #fff5f5;
  border-color: #fecaca;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.04);
}
.sws-score-strip.is-hoch .sws-score-label {
  color: #991b1b;
}
.sws-score-strip.is-hoch .sws-score-caption {
  color: #7f1d1d;
}
.sws-score-strip.is-hoch .sws-score-value strong {
  color: #991b1b;
}
.sws-score-strip.is-hoch .sws-score-value small {
  color: #991b1b99;
}

.sws-status {
  margin: 0;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
}

.sws-status.is-loading {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.sws-status.is-loading::before,
.sws-inline-spinner {
  content: "";
  width: 1rem;
  height: 1rem;
  flex: 0 0 1rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  animation: sws-spin 0.8s linear infinite;
}

.sws-map-shell {
  position: relative;
  min-height: 62vh;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 8px;
  overflow: hidden;
  background: #eef2f7;
}

.sws-map {
  width: 100%;
  height: 62vh;
  min-height: 520px;
}

.sws-map-overlay {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 700;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
  max-width: min(540px, calc(100% - 1.5rem));
}

.sws-map-overlay > span,
.sws-kpi {
  padding: 0.38rem 0.58rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: #334155;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.1);
  font-size: 0.82rem;
}

/* Schicht 4: KPI-Kontext (TODO 1) im Karten-Overlay */
.sws-kpi {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 16rem;
}

.sws-kpi-label {
  display: inline-flex;
  align-items: center;
}

.sws-kpi-info-toggle {
  border: 0;
  background: transparent;
  color: #64748b;
  width: 1.25rem;
  height: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0;
  margin-left: 0.25rem;
  cursor: pointer;
}

.sws-kpi-info-toggle:hover,
.sws-kpi-info-toggle:focus-visible,
.sws-kpi-info-toggle:not(.collapsed) {
  color: var(--bs-primary, #0d6efd);
  background: rgba(13, 110, 253, 0.1);
  outline: none;
}

.sws-kpi-info-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.sws-kpi-kontext {
  margin-top: 0.35rem;
  color: #475569;
  font-size: 0.78rem;
  line-height: 1.35;
}

.sws-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 0.85rem;
}

.sws-panel {
  padding: 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}

.sws-panel-wide {
  grid-column: 1 / -1;
}

.sws-panel h3 {
  margin: 0 0 0.55rem;
  color: #0f172a;
  font-size: 0.95rem;
  letter-spacing: 0;
}

.sws-muted {
  color: #64748b;
  font-size: 0.9rem;
}

.sws-definition-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 0.75rem;
  margin: 0;
}

.sws-definition-list dt {
  color: #64748b;
  font-weight: 650;
}

.sws-definition-list dd {
  margin: 0;
  min-width: 0;
}

.sws-route-list {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.6rem;
}

.sws-score-help {
  margin-top: 0.55rem;
}

.sws-score-guide {
  display: grid;
  gap: 0.55rem;
  padding: 0.65rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.sws-score-guide-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
}

.sws-score-guide-head strong {
  color: #0f172a;
  font-size: 0.9rem;
}

.sws-score-guide-head span {
  color: #64748b;
  font-size: 0.8rem;
  text-align: right;
}

.sws-score-meter {
  height: 0.55rem;
  overflow: hidden;
  border-radius: 999px;
  /* Farbzonen sind an SCHULWEGSAFE_DEFAULTS.scoreMeterReferenceMax (12) in app.js gekoppelt:
     2/12 = 16.7%, 6/12 = 50%. Bei Aenderung dort mitziehen. */
  background: linear-gradient(90deg, #dcfce7 0 16.7%, #fef9c3 16.7% 50%, #fee2e2 50% 100%);
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.sws-score-meter span {
  display: block;
  height: 100%;
  min-width: 0.25rem;
  border-radius: inherit;
  background: #0f766e;
}

.sws-score-meter.is-mittel span {
  background: #ca8a04;
}

.sws-score-meter.is-hoch span {
  background: #dc2626;
}

.sws-score-scale {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
}

.sws-score-scale span,
.sws-score-factors span {
  padding: 0.4rem 0.45rem;
  border-radius: 7px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
}

.sws-score-scale strong,
.sws-score-scale small {
  display: block;
}

.sws-score-scale strong {
  color: #334155;
  font-size: 0.82rem;
}

.sws-score-scale small {
  color: #64748b;
  font-size: 0.74rem;
}

.sws-score-factors {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.sws-score-factors span {
  color: #475569;
  font-size: 0.76rem;
  line-height: 1.2;
}

.sws-route-item {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 0.88rem;
}

.sws-route-item.is-best {
  border-color: rgba(15, 118, 110, 0.35);
  background: #ecfdf5;
}

.sws-recommendations-inline {
  margin-top: 0.6rem;
}

.sws-recommendations-inline.is-empty {
  display: none;
}

.sws-recommendations-inline-title {
  margin-bottom: 0.35rem;
  color: #78350f;
  font-weight: 650;
  font-size: 0.85rem;
}

.sws-recommendation-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sws-recommendation-item {
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #fde68a;
  background: #fffbeb;
  color: #78350f;
  font-size: 0.88rem;
  line-height: 1.4;
}

.sws-popup {
  min-width: 10rem;
}

.leaflet-popup-content-wrapper {
  border-radius: 8px;
}

@media (max-width: 1199px) {
  .sws-controls {
    grid-template-columns: minmax(220px, 1fr) minmax(260px, 1fr);
  }

  .sws-detail-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 767px) {
  .sws-commandbar,
  .sws-panel {
    border-radius: 8px;
  }

  .sws-controls {
    grid-template-columns: 1fr;
  }

  .sws-control-search,
  .sws-control-address,
  .sws-control-mode,
  .sws-actions {
    grid-column: auto;
  }

  .sws-map-shell,
  .sws-map {
    min-height: 390px;
    height: 56vh;
  }

  .sws-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 460px) {
  .sws-controls {
    grid-template-columns: 1fr;
  }

  .sws-control-search,
  .sws-actions {
    grid-column: auto;
  }

  .sws-actions {
    grid-template-columns: 1fr;
  }

  .sws-score-strip {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.75rem;
    padding: 0.75rem 0.9rem;
  }

  .sws-score-guide-head,
  .sws-route-item {
    display: grid;
  }

  .sws-score-guide-head span {
    text-align: left;
  }

  .sws-score-scale {
    grid-template-columns: 1fr;
  }
}

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

/* Custom styling for the details/summary elements inside the scoring guide sidebar */
.sws-score-details {
  border-color: rgba(148, 163, 184, 0.2) !important;
}

.sws-score-details summary {
  font-weight: 500;
  color: #0f766e !important;
  transition: color 0.15s ease-in-out;
  outline: none;
}

.sws-score-details summary:hover {
  color: #115e59 !important;
}

.sws-score-details-content {
  background-color: #ffffff;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.sws-score-details-content ul {
  padding-left: 1rem;
}

.sws-score-details-content li {
  line-height: 1.4;
  margin-bottom: 0.25rem;
  color: #475569;
}

.sws-score-details-content li:last-child {
  margin-bottom: 0;
}

/* Styles for description page cards and layout */
.sws-info-card {
  border-radius: 10px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  background: #ffffff;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sws-info-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
}

.sws-section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background-color: #f0fdfa;
  border-radius: 6px;
}

/* Custom Table in Description Page */
.style-table {
  border-collapse: separate;
  border-spacing: 0;
}

.style-table th:first-child {
  border-top-left-radius: 6px;
}

.style-table th:last-child {
  border-top-right-radius: 6px;
}

.style-table tr:last-child td:first-child {
  border-bottom-left-radius: 6px;
}

.style-table tr:last-child td:last-child {
  border-bottom-right-radius: 6px;
}

.style-table th {
  background-color: #f1f5f9;
  color: #334155;
  font-weight: 600;
  border-bottom: 2px solid #cbd5e1;
}

.style-table td {
  border-bottom: 1px solid #e2e8f0;
}

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


/* Schicht 4: Methodikbox (ausklappbar) */
.sws-methodik-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  cursor: pointer;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  padding: 0;
  text-align: left;
  width: 100%;
}
.sws-methodik-chevron {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.sws-methodik-toggle:not(.collapsed) .sws-methodik-chevron {
  transform: rotate(180deg);
}
