:root {
  --bg: #fff4e8;
  --surface: #ffffff;
  --surface-2: #fff8f1;
  --text: #24160e;
  --muted: #7a5c49;
  --line: #f2d4bc;
  --accent: #f36c13;
  --accent-2: #c2410c;
  --warning: #a16207;
  --shadow: 0 16px 38px rgba(154, 69, 15, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100vh;
  overflow: auto;
  padding: 18px;
  background: linear-gradient(180deg, #fff 0%, #fff7ef 100%);
  border-right: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 2;
}

.brand-panel {
  padding: 2px 2px 4px;
  width: 100%;
}

.logo-stack {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0 10px;
  margin-bottom: 16px;
}

.logo-stack img:first-child {
  height: 55px;
  width: auto;
}

.logo-stack img:last-child {
  height: 55px;
  width: auto;
}}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.05;
}

.subtitle {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
}

.control-panel,
.stats-grid,
.list-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.control-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #55301d;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 0 10px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(243, 108, 19, 0.16);
}

input:disabled,
select:disabled {
  background: #f4e7dc;
  color: #8a6b58;
  cursor: not-allowed;
}

.key-row,
.button-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  padding: 0 14px;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.95);
}

#clearButton {
  background: #7c4a2d;
}

.location-button {
  width: 100%;
  background: #1d4ed8;
}

.location-status {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.leaflet-control.locate-control {
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 7px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.13);
}

.locate-control button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  min-height: 30px;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: #1d4ed8;
  padding: 0;
  font-size: 17px;
  line-height: 1;
}

.locate-control button:hover {
  background: #eff6ff;
  filter: none;
}

.user-location-dot {
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: #1d4ed8;
  box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.45), 0 4px 12px rgba(15, 23, 42, 0.32);
}

.hint {
  color: var(--muted);
  font-size: 12px;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 118px;
  gap: 10px;
}

.full-field {
  grid-column: 1 / -1;
}

.leaflet-control-layers {
  border: 1px solid rgba(15, 23, 42, 0.14) !important;
  border-radius: 7px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.13);
  font-family: inherit;
  font-size: 12px;
}

.leaflet-control-layers-toggle {
  width: 30px !important;
  height: 30px !important;
  background-size: 17px 17px !important;
}

.leaflet-control-layers-expanded {
  padding: 7px 9px 8px;
  max-width: 156px;
}

.leaflet-control-layers-expanded label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  margin: 0;
  color: #1f2937;
  font-size: 12px;
  font-weight: 650;
}

.leaflet-control-layers-selector {
  width: 14px;
  height: 14px;
  min-height: 14px;
  margin: 0;
  padding: 0;
}

.leaflet-top.leaflet-right {
  top: 10px;
  right: 10px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
}

.stats-grid div {
  display: grid;
  gap: 2px;
  padding: 12px 10px;
  border-right: 1px solid var(--line);
}

.stats-grid div:last-child {
  border-right: 0;
}

.stats-grid span {
  font-size: 22px;
  font-weight: 850;
}

.stats-grid small,
.list-heading span {
  color: var(--muted);
  font-size: 12px;
}

.list-panel {
  min-height: 220px;
  overflow: hidden;
}

.list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.list-heading h2 {
  font-size: 15px;
}

.feature-list {
  display: grid;
  max-height: 34vh;
  overflow: auto;
}

.feature-item {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 72px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--text);
  padding: 11px 14px;
  text-align: left;
}

.feature-item:hover,
.feature-item.active {
  background: #fff1e5;
}

.feature-title {
  font-weight: 850;
  line-height: 1.25;
}

.feature-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.map-stage {
  position: relative;
  min-height: 100vh;
}

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

.map-message {
  position: absolute;
  inset: auto 22px 22px auto;
  display: grid;
  gap: 4px;
  max-width: min(380px, calc(100vw - 44px));
  border: 1px solid rgba(243, 108, 19, 0.25);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  color: var(--muted);
}

.map-message strong {
  color: var(--text);
}

.map-message.hidden {
  display: none;
}

.map-polygon-control {
  position: absolute;
  z-index: 500;
  top: 14px;
  left: 14px;
  width: min(280px, calc(100% - 92px));
  border: 1px solid rgba(242, 212, 188, 0.95);
  border-radius: 8px;
  background: rgba(255, 248, 241, 0.96);
  box-shadow: 0 10px 24px rgba(154, 69, 15, 0.16);
  padding: 10px 12px;
}

.map-polygon-control label {
  gap: 6px;
}

.map-polygon-control select {
  min-height: 36px;
}

.popup {
  min-width: 220px;
}

.popup h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.popup dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 12px;
  margin: 0;
  font-size: 12px;
}

.popup dt {
  color: var(--muted);
}

.popup dd {
  margin: 0;
  font-weight: 700;
}

/* ===== Branding SIGAP SE ===== */

.app-title {
  margin: 10px 0 4px;
  font-size: 46px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  color: #005BAC;
  letter-spacing: 1px;
}

.app-subtitle {
  margin: 0 0 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: #f36c13;
  line-height: 1.4;
}

.subtitle {
  margin-top: 6px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

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

  .sidebar {
    height: auto;
    max-height: 34svh;
    gap: 8px;
    padding: 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand-panel {
    padding: 0;
  }

  .logo-stack {
    gap: 6px;
    margin-bottom: 6px;
    max-width: 180px;
  }

  .logo-stack img {
    border-radius: 6px;
    padding: 4px;
  }

  .eyebrow {
    font-size: 10px;
    margin-bottom: 2px;
  }

  h1 {
    font-size: 24px;
  }

  .subtitle {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.3;
  }

  .control-panel {
    gap: 8px;
    padding: 10px;
    border-radius: 7px;
  }

  .control-grid {
    grid-template-columns: minmax(0, 1fr) 104px;
    gap: 8px;
  }

  label {
    gap: 5px;
    font-size: 11px;
  }

  input,
  select {
    min-height: 34px;
    border-radius: 6px;
    padding: 0 9px;
    font-size: 12px;
  }

  .button-row {
    gap: 7px;
  }

  button {
    min-height: 34px;
    border-radius: 6px;
    padding: 0 11px;
    font-size: 12px;
  }

  .location-status {
    min-height: 14px;
    font-size: 10px;
  }

  .stats-grid div {
    padding: 8px;
  }

  .stats-grid span {
    font-size: 17px;
  }

  .stats-grid small,
  .list-heading span {
    font-size: 10px;
  }

  .list-panel {
    min-height: 120px;
  }

  .list-heading {
    padding: 9px 10px;
  }

  .list-heading h2 {
    font-size: 13px;
  }

  .feature-item {
    min-height: 54px;
    padding: 8px 10px;
  }

  .feature-title {
    font-size: 12px;
  }

  .feature-meta {
    font-size: 10px;
  }

  .map-stage,
  #map {
    min-height: 66svh;
    height: 66svh;
  }

  .map-polygon-control {
    top: 8px;
    left: 8px;
    width: min(210px, calc(100% - 70px));
    padding: 7px 8px;
    border-radius: 7px;
  }

  .map-polygon-control label {
    font-size: 11px;
  }

  .map-polygon-control select {
    min-height: 32px;
    font-size: 12px;
  }

  .leaflet-control-layers-toggle,
  .locate-control button {
    width: 28px !important;
    height: 28px !important;
    min-height: 28px;
  }

  .feature-list {
    max-height: 16svh;
  }
}
