:root {
  --bg-page: #f4f7f6;
  --bg-card: #ffffff;
  --primary: #1b5e20;
  --primary-hover: #2e7d32;
  --accent: #0277bd;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --warn-bg: #fff8e1;
  --warn-text: #b45309;
}

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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
}

/* 3D Globe Overlay */
.globe-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(circle at center, #081229 0%, #020617 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.7s ease, visibility 0.7s ease;
}

.globe-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#globe-container {
  width: 100vw;
  height: 100vh;
  cursor: grab;
}

.globe-hud {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 14px;
  padding: 1.4rem 2.2rem;
  text-align: center;
  color: #f8fafc;
  max-width: 620px;
  width: 90%;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.55);
}

.hud-tag {
  display: inline-block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.4);
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  margin-bottom: 0.4rem;
}

.globe-hud h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
  color: #ffffff;
}

.globe-hud p {
  font-size: 0.92rem;
  color: #cbd5e1;
  margin-bottom: 1rem;
}

.hud-btn {
  background: #16a34a;
  color: #ffffff;
  border: none;
  padding: 0.75rem 1.6rem;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s;
}

.hud-btn:hover {
  background: #22c55e;
  transform: translateY(-2px);
}

.hud-hint {
  display: block;
  margin-top: 0.6rem;
  font-size: 0.75rem;
  color: #94a3b8;
}

/* Header */
.app-header {
  background: var(--primary);
  color: #fff;
  padding: 0.85rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.brand h1 {
  font-size: 1.35rem;
  display: inline-block;
  margin-right: 0.75rem;
}

.brand .subtitle {
  font-size: 0.85rem;
  opacity: 0.9;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.globe-toggle-btn {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.globe-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

.status-badge {
  font-size: 0.75rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-weight: 600;
}

.status-live {
  background: #22c55e;
  color: #fff;
}

.status-mock {
  background: #f59e0b;
  color: #fff;
}

.app-container {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.25rem;
  padding: 1.25rem;
  max-width: 1600px;
  margin: 0 auto;
}

.side-panel {
  background: var(--bg-card);
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 1.1rem;
  height: fit-content;
}

.panel-section {
  margin-bottom: 1.25rem;
}

.panel-section h2 {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.35rem;
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.preset-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0.4rem 0.65rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}

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

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.form-group {
  margin-bottom: 0.75rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--text-main);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.88rem;
}

.primary-btn {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.7rem;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 0.4rem;
}

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

.main-content {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.map-card {
  background: var(--bg-card);
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
  height: 310px;
}

#map {
  width: 100%;
  height: 100%;
}

.state-banner {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 600;
  text-align: center;
}

.error-banner {
  background: #fee2e2;
  color: #b91c1c;
}

.hidden {
  display: none !important;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.1rem;
}

.card {
  background: var(--bg-card);
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.card-header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.6rem;
}

.card-header h3 {
  font-size: 1.05rem;
  color: var(--primary);
}

.illustrative-tag {
  display: inline-block;
  font-size: 0.72rem;
  background: var(--warn-bg);
  color: var(--warn-text);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
}

.highlight-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.metric-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  padding: 0.6rem;
  border-radius: 6px;
  text-align: center;
}

.metric-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.metric-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}

.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.spec-table td {
  padding: 0.35rem 0.2rem;
  border-bottom: 1px solid #f1f5f9;
}

.spec-table td:last-child {
  font-weight: 600;
  text-align: right;
}

.advisory-note {
  font-size: 0.8rem;
  background: #f8fafc;
  border-left: 3px solid var(--accent);
  padding: 0.55rem;
  color: var(--text-main);
}

.sliders-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: #f8fafc;
  padding: 0.7rem;
  border-radius: 6px;
}

.slider-group label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
}

.slider-group input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}

.rotation-section h4 {
  font-size: 0.85rem;
  margin-bottom: 0.45rem;
}

.rotation-list {
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.84rem;
}

.rotation-item-title {
  font-weight: 700;
  color: var(--primary);
}

.rotation-score {
  font-size: 0.75rem;
  background: #e2e8f0;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  margin-left: 0.35rem;
}

.rotation-reason {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.confidence-badge {
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

.confidence-high {
  background: #dcfce7;
  color: #166534;
}

.confidence-medium {
  background: #fef3c7;
  color: #92400e;
}

.confidence-low {
  background: #fee2e2;
  color: #991b1b;
}

.yield-main {
  text-align: center;
  padding: 1.2rem 0.5rem;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.yield-number {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary);
}

.yield-unit {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 600;
}

.limitations-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 0.82rem;
}

.limitations-box strong {
  display: block;
  margin-bottom: 0.25rem;
  color: #92400e;
}

.charts-section {
  background: var(--bg-card);
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 1.1rem;
}

.section-title-row h2 {
  font-size: 1.05rem;
  color: var(--primary);
  margin-bottom: 0.9rem;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.chart-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  background: #fcfcfc;
}

.chart-card h4 {
  font-size: 0.84rem;
  margin-bottom: 0.5rem;
  color: var(--text-main);
  text-align: center;
}

@media (max-width: 1150px) {
  .app-container {
    grid-template-columns: 1fr;
  }
  .cards-grid,
  .charts-grid {
    grid-template-columns: 1fr;
  }
}
