* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f5f7fb;
  color: #1f2937;
  height: 100%;
}

body {
  min-height: 100vh;
}

.app-shell {
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: 100vh;
  gap: 16px;
  padding: 16px;
}

.sidebar,
.main-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.08);
  padding: 16px;
}

h1,
h2,
h3 {
  margin-top: 0;
  margin-bottom: 10px;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 15px;
}

.muted,
.small-note,
.note {
  color: #6b7280;
  font-size: 13px;
}

.field-label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  margin-top: 10px;
  font-weight: 600;
}

.field-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
}

.btn {
  margin-top: 14px;
  width: 100%;
  border: none;
  background: #1d4ed8;
  color: #fff;
  padding: 11px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

.btn:hover {
  background: #1e40af;
}

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.card {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
}

.card-label {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 8px;
}

.card-value {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
}

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

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  display: inline-block;
}

.legend-dot.rest-area {
  background: #dc2626;
}

.legend-dot.non-rest-area {
  background: #2563eb;
}

.map-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

#map {
  width: 100%;
  height: 520px;
  min-height: 520px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  background: #e5e7eb;
}

.charts-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.chart-card {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
}

.chart-card canvas {
  width: 100% !important;
  height: 260px !important;
}

.notice {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  padding: 12px;
  border-radius: 10px;
  font-size: 14px;
}

.hidden {
  display: none;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
  color: #374151;
}

.check-row input {
  margin-top: 2px;
}

/* Popup */
.leaflet-popup-content {
  min-width: 260px;
  line-height: 1.45;
  margin: 12px 14px;
}

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

.popup-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.popup-sub {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 8px;
}

.popup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin: 10px 0;
}

.popup-label {
  font-size: 11px;
  color: #6b7280;
}

.popup-value {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
}

.popup-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.popup-links a {
  font-size: 12px;
  text-decoration: none;
  color: #1d4ed8;
  font-weight: 600;
}

/* =========================
   FIX KHUSUS LEAFLET
   ========================= */

.leaflet-container {
  width: 100%;
  height: 100%;
  background: #dfe7ef;
  font: inherit;
}

.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
  position: absolute;
  left: 0;
  top: 0;
}

.leaflet-tile {
  width: 256px !important;
  height: 256px !important;
  max-width: none !important;
  max-height: none !important;
}

.leaflet-container img,
.leaflet-container svg,
.leaflet-container canvas {
  max-width: none !important;
  max-height: none !important;
}

.leaflet-tile-container img {
  width: 256px !important;
  height: 256px !important;
}

.leaflet-control-container .leaflet-top,
.leaflet-control-container .leaflet-bottom {
  z-index: 800;
}

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

  #map {
    width: 100%;
    min-height: 520px;
    height: 520px;
    border-radius: 14px;
  }

  .cards {
    grid-template-columns: 1fr 1fr;
  }
}