html, body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#map {
  position: absolute;
  inset: 0;
}

#panel {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1000;
  width: 300px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  padding: 14px 16px;
}

#panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

#panel-header h1 {
  font-size: 16px;
  margin: 0;
}

#panel-toggle {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #f4f4f4;
  color: #2c3e6b;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

#panel.collapsed #panel-body {
  display: none;
}

@media (max-width: 600px) {
  #panel {
    left: 12px;
    right: 12px;
    width: auto;
  }
}

#search-box {
  position: relative;
  margin-bottom: 8px;
}

#search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  font-size: 13px;
  border: 1px solid #ccc;
  border-radius: 5px;
}

#search-suggestions {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 1001;
  background: white;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  max-height: 180px;
  overflow-y: auto;
}

#search-suggestions.hidden {
  display: none;
}

.suggestion {
  padding: 6px 8px;
  font-size: 12px;
  cursor: pointer;
}

.suggestion:hover {
  background: #f0f2f8;
}

#progress-container {
  margin-bottom: 10px;
}

#progress-container.hidden {
  display: none;
}

#progress-bar-track {
  position: relative;
  height: 7px;
  border-radius: 4px;
  background: #eee;
  overflow: hidden;
}

#progress-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  border-radius: 4px;
  background: #2c3e6b;
  transition: width 0.2s ease;
}

#progress-bar-fill.indeterminate {
  width: 30%;
  animation: progress-indeterminate 1.1s ease-in-out infinite;
}

@keyframes progress-indeterminate {
  0% {
    left: -30%;
  }
  100% {
    left: 100%;
  }
}

#progress-label {
  font-size: 11px;
  color: #666;
  margin-top: 3px;
}

#load-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid #eee;
}

#load-controls label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  gap: 3px;
  color: #333;
}

#load-controls select {
  padding: 5px 6px;
  font-size: 13px;
  border: 1px solid #ccc;
  border-radius: 5px;
}

#load-controls button {
  padding: 8px;
  border: none;
  border-radius: 6px;
  background: #2c3e6b;
  color: white;
  font-size: 13px;
  cursor: pointer;
}

details {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

details:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

details > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: #2c3e6b;
  padding: 2px 0;
  user-select: none;
}

details > summary::marker {
  color: #2c3e6b;
}

details[open] > summary {
  margin-bottom: 8px;
}

#edit-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#edit-controls label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  gap: 3px;
  color: #333;
}

#edit-controls input {
  padding: 5px 6px;
  font-size: 13px;
  border: 1px solid #ccc;
  border-radius: 5px;
}

#edit-controls button {
  padding: 8px;
  border: none;
  border-radius: 6px;
  background: #2c3e6b;
  color: white;
  font-size: 13px;
  cursor: pointer;
}

#edit-controls button.secondary {
  background: #f4f4f4;
  color: #333;
  border: 1px solid #ccc;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}

.tab {
  flex: 1;
  padding: 6px 4px;
  font-size: 12px;
  border: 1px solid #ccc;
  background: #f4f4f4;
  border-radius: 6px;
  cursor: pointer;
}

.tab.active {
  background: #2c3e6b;
  color: white;
  border-color: #2c3e6b;
}

.preset-row {
  display: flex;
  gap: 4px;
}

.preset-row .preset {
  flex: 1;
  margin-top: 0;
  padding: 6px 4px;
  font-size: 12px;
  border: 1px solid #ccc;
  background: #f4f4f4;
  color: #333;
  border-radius: 6px;
  cursor: pointer;
}

.preset-row .preset:hover {
  background: #e8eaf0;
}

.hint {
  font-size: 12px;
  color: #666;
  margin: 4px 0;
}

.field {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 8px;
  color: #333;
}

.mode-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mode-controls.hidden {
  display: none;
}

.mode-controls label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  gap: 3px;
  color: #333;
}

.mode-controls input,
.mode-controls select {
  padding: 5px 6px;
  font-size: 13px;
  border: 1px solid #ccc;
  border-radius: 5px;
}

.mode-controls button {
  margin-top: 4px;
  padding: 8px;
  border: none;
  border-radius: 6px;
  background: #2c3e6b;
  color: white;
  font-size: 13px;
  cursor: pointer;
}

.mode-controls button:disabled,
#load-controls button:disabled,
#edit-controls button:disabled,
#export-controls button:disabled {
  opacity: 0.6;
  cursor: default;
}

.result {
  font-size: 12px;
  color: #444;
  min-height: 16px;
}

#legend {
  margin-top: 12px;
  border-top: 1px solid #eee;
  padding-top: 10px;
  font-size: 11px;
  color: #444;
}

#legend.hidden {
  display: none;
}

.legend-shadow {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  display: inline-block;
  margin-right: 2px;
}

.swatch.shadow {
  background: #12182e;
}

.swatch.lit {
  background: #fff4d6;
  margin-left: 8px;
}

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

.legend-sunhours .gradient {
  flex: 1;
  height: 10px;
  border-radius: 4px;
  background: linear-gradient(to right, #202236, #5c3428, #d6812a, #ffe296);
}

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

#export-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#export-controls label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  gap: 3px;
  color: #333;
}

#export-controls select {
  padding: 5px 6px;
  font-size: 13px;
  border: 1px solid #ccc;
  border-radius: 5px;
}

#export-controls button {
  padding: 8px;
  border: none;
  border-radius: 6px;
  background: #2c3e6b;
  color: white;
  font-size: 13px;
  cursor: pointer;
}

#export-controls button.secondary {
  background: #f4f4f4;
  color: #333;
  border: 1px solid #ccc;
}

.legend-potential .gradient {
  flex: 1;
  height: 10px;
  border-radius: 4px;
  background: linear-gradient(to right, #14143c, #78145a, #e65a28, #ffdc3c);
}

#trend-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#trend-controls button {
  padding: 8px;
  border: none;
  border-radius: 6px;
  background: #2c3e6b;
  color: white;
  font-size: 13px;
  cursor: pointer;
}

#trend-controls button:disabled {
  opacity: 0.6;
  cursor: default;
}

#trend-chart svg {
  width: 100%;
  height: auto;
  display: block;
}
