:root {
  color-scheme: light;
  font-family: "Segoe UI", Arial, sans-serif;
  background: #edf2f7;
  color: #172033;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #172033;
  color: #f8fafc;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #0f766e;
  color: #fff;
  font-weight: 700;
}

.brand h1,
.toolbar h2,
.panel h2 {
  margin: 0;
}

.brand h1 {
  font-size: 24px;
}

.brand p,
.toolbar p,
.status-text {
  margin: 4px 0 0;
  color: #a8b3c7;
}

.panel {
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  padding-top: 18px;
}

.panel h2 {
  font-size: 15px;
  margin-bottom: 12px;
}

.panel label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: #172033;
}

.download-grid,
.coordinate-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 8px;
  margin-top: 12px;
}

.download-grid label,
.coordinate-grid label {
  margin: 0;
  font-size: 12px;
}

.download-grid input,
.download-grid select,
.coordinate-grid input {
  min-height: 36px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.segmented.vertical {
  grid-template-columns: 1fr;
}

.segmented.bands {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tab,
.step-button,
.primary-button {
  min-height: 40px;
  border: 0;
  background: #fff;
  color: #172033;
  cursor: pointer;
}

.segmented .tab {
  border-radius: 0;
}

.tab:hover,
.step-button:hover {
  background: #dbeafe;
}

.tab.active {
  background: #0f766e;
  color: #fff;
  font-weight: 700;
}

.primary-button {
  margin-top: 12px;
  border-radius: 6px;
  background: #0f766e;
  color: #fff;
  font-weight: 700;
}

.secondary-button {
  min-height: 36px;
  margin-top: 8px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
}

.secondary-button:hover {
  background: rgba(255, 255, 255, 0.16);
}

.full-width {
  width: 100%;
}

.workspace {
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.toolbar h2 {
  font-size: 24px;
}

.badge {
  min-width: 110px;
  min-height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 6px;
  font-weight: 700;
}

.map-frame {
  background: #fff;
  border: 1px solid #cbd5e1;
  padding: 12px;
  overflow: hidden;
  position: relative;
}

.map-layout {
  position: relative;
  display: grid;
  grid-template-columns: 52px minmax(0, min(100%, calc((100vh - 290px) * 2))) 116px;
  gap: 16px;
  align-items: stretch;
  justify-content: center;
}

#mapCanvas {
  grid-column: 2;
  width: 100%;
  max-height: calc(100vh - 290px);
  aspect-ratio: 2 / 1;
  border: 1px solid #111827;
  display: block;
  background: #001264;
}

#legendCanvas {
  grid-column: 3;
  width: 108px;
  max-height: calc(100vh - 290px);
  height: 100%;
  display: block;
}

.axis-label {
  position: absolute;
  left: 0;
  width: 46px;
  text-align: right;
  font-size: clamp(13px, 1vw, 19px);
  transform: translateY(-50%);
}

.lat.north { top: 17%; }
.lat.mid-north { top: 34%; }
.lat.equator { top: 50%; }
.lat.mid-south { top: 67%; }
.lat.south { top: 84%; }

.lon-labels {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin: 7px 94px 0 52px;
  font-size: clamp(13px, 1vw, 19px);
  text-align: center;
}

.utc-panel {
  display: grid;
  grid-template-columns: 56px 36px minmax(0, 1fr) 36px;
  align-items: stretch;
  min-height: 44px;
  border: 1px solid #cbd5e1;
  background: #fff;
}

.utc-panel strong {
  display: grid;
  place-items: center;
  border-right: 1px solid #cbd5e1;
}

.utc-buttons {
  display: grid;
  grid-template-columns: repeat(24, minmax(28px, 1fr));
}

.utc-buttons .tab {
  min-width: 0;
  padding: 0;
  border-left: 1px solid #eef2f7;
}

.step-button {
  border-left: 1px solid #cbd5e1;
  border-right: 1px solid #cbd5e1;
  font-weight: 700;
}

.footer {
  display: grid;
  gap: 8px;
  text-align: center;
  font-size: 14px;
}

.footer div {
  min-height: 28px;
  border: 1px solid #cbd5e1;
  background: #fff;
  padding: 5px 10px;
}

.map-frame::after {
  content: "Berechnung laeuft...";
  position: absolute;
  right: 18px;
  top: 18px;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  color: #172033;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.is-loading .map-frame::after {
  opacity: 1;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }
}
