:root {
  --green: #00a86b;
  --green-dark: #058b4a;
  --green-soft: #e9f8f1;
  --sidebar: #07141d;
  --sidebar-deep: #061018;
  --sidebar-mid: #0b1f2a;
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #06121f;
  --muted: #607081;
  --line: #dce3ea;
  --shadow: 0 10px 28px rgba(9, 30, 45, 0.1), 0 2px 8px rgba(9, 30, 45, 0.08);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 214px;
  background:
    radial-gradient(circle at 10% 0%, rgba(0, 168, 107, 0.13), transparent 28%),
    linear-gradient(160deg, var(--sidebar-deep), var(--sidebar-mid) 52%, #031018);
  color: #fff;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-direction: column;
  padding: 26px 18px 28px;
}

.brand {
  display: flex;
  align-items: center;
  height: 58px;
  margin-bottom: 44px;
}

.brand-logo {
  width: 176px;
  height: 78px;
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 8px 18px rgba(0, 168, 107, 0.14));
}

.nav {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.nav-item {
  width: 100%;
  min-width: 0;
  min-height: 55px;
  border-radius: 10px;
  color: #f5f8fa;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  font-size: 13px;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.nav-item svg {
  width: 23px;
  height: 23px;
  color: rgba(255, 255, 255, 0.62);
}

.nav-item.active {
  background: linear-gradient(135deg, #05b763, #079948);
  color: #fff;
  box-shadow: 0 14px 24px rgba(0, 168, 107, 0.24);
}

.nav-item.active svg {
  color: #fff;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(2px);
}

.nav-item.active:hover {
  background: linear-gradient(135deg, #05b763, #079948);
}

.sidebar-bottom {
  margin-top: auto;
  display: grid;
  gap: 20px;
}

.side-card {
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 10px;
  padding: 15px 18px;
  background: rgba(2, 17, 25, 0.45);
  backdrop-filter: blur(10px);
}

.side-line {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 13px;
  color: #fff;
}

.side-line + .side-line {
  margin-top: 12px;
}

.side-line.small {
  font-size: 12px;
  font-weight: 500;
}

.side-line svg {
  width: 17px;
  height: 17px;
  color: rgba(255, 255, 255, 0.7);
}

.side-title {
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 700;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 26px;
  font-size: 13px;
}

.dot {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
}

.high,
.alfamart {
  background: #12bd57;
}

.medium,
.spbu {
  background: #ffc20d;
}

.low,
.others {
  background: #ff513d;
}

.none {
  background: #6e838c;
}

.indomaret {
  background: #7ed957;
}

.apotek {
  background: #ff7c28;
}

.shell {
  min-height: 100vh;
  margin-left: 214px;
  padding: 0 16px 18px;
}

.topbar {
  height: 108px;
  margin: 0 -16px;
  padding: 20px 32px 18px;
  color: #fff;
  background:
    radial-gradient(circle at 95% -15%, rgba(0, 168, 107, 0.12), transparent 34%),
    linear-gradient(180deg, #07151e 0%, #0a1a24 100%);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.topbar h1 {
  margin: 0;
  font-size: 29px;
  line-height: 35px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.topbar p {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 17px;
  font-weight: 500;
}

.header-actions {
  display: flex;
  gap: 13px;
  margin-top: 14px;
}

.control {
  height: 39px;
  border: 1px solid rgba(214, 228, 239, 0.35);
  border-radius: 8px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  background: rgba(0, 0, 0, 0.12);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.control svg {
  width: 18px;
  height: 18px;
}

.filter {
  min-width: 135px;
  justify-content: space-between;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 10px;
  margin-top: -14px;
  position: relative;
  z-index: 4;
}

.kpi-card,
.card {
  background: var(--card);
  border: 1px solid rgba(192, 203, 214, 0.82);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.kpi-card {
  min-height: 131px;
  height: 131px;
  padding: 22px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.kpi-card:hover,
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(9, 30, 45, 0.13), 0 3px 10px rgba(9, 30, 45, 0.08);
}

.kpi-icon {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #eefbf4, #dff4ea);
  color: var(--green-dark);
  display: grid;
  place-items: center;
  flex: 0 0 62px;
}

.kpi-icon svg {
  width: 35px;
  height: 35px;
  stroke-width: 2.4;
}

.kpi-title {
  font-size: 13px;
  font-weight: 600;
  margin: 6px 0 9px;
  white-space: nowrap;
}

.kpi-value,
.kpi-status {
  font-size: 32px;
  line-height: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.kpi-status {
  color: var(--green-dark);
  font-size: 22px;
  white-space: nowrap;
}

.kpi-desc {
  color: #243646;
  font-size: 12px;
  margin-top: 17px;
  font-weight: 500;
  white-space: nowrap;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 25.1fr) minmax(0, 44fr) minmax(0, 30.9fr);
  grid-auto-rows: minmax(188px, auto);
  gap: 13px;
  margin-top: 14px;
}

.card {
  min-width: 0;
  padding: 16px 20px;
  overflow: hidden;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.card h2 {
  margin: 0 0 16px;
  font-size: 16px;
  line-height: 20px;
  font-weight: 800;
}

.chart-wrap {
  position: relative;
}

.bar-wrap {
  height: 205px;
}

.city-card {
  min-height: 277px;
}

.map-card {
  grid-row: span 2;
  min-height: 477px;
  padding: 18px 20px 20px;
  position: relative;
  background: #082035;
  color: #fff;
}

#coverageMap {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: #082035;
}

.map-card h2 {
  position: absolute;
  top: 18px;
  left: 58px;
  z-index: 1001;
  margin: 0;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(4, 21, 34, 0.78);
  backdrop-filter: blur(10px);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.leaflet-container {
  font-family: "Inter", sans-serif;
  background: #082035;
}

.leaflet-tile {
  filter: grayscale(1) saturate(0.08) contrast(0.95) brightness(0.82);
}

.leaflet-control-zoom {
  border: 0 !important;
  box-shadow: var(--shadow);
}

.leaflet-control-zoom a {
  color: #07141d !important;
  font-weight: 800;
}

.zone-label {
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.7);
  font-size: 13px;
}

.marker-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fdf8bf;
  border: 4px solid #fff;
  box-shadow: 0 0 0 2px rgba(0, 168, 107, 0.4), 0 6px 14px rgba(0, 0, 0, 0.35);
}

.map-legend {
  position: absolute;
  left: 20px;
  bottom: 20px;
  z-index: 3;
  width: 180px;
  padding: 12px 13px;
  border-radius: 8px;
  background: rgba(4, 21, 34, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
}

.donut-card {
  min-height: 272px;
}

.donut-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 8px;
  align-items: center;
}

.donut-box {
  width: 190px;
  height: 190px;
  position: relative;
}

.donut-center {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.donut-center strong {
  display: block;
  font-size: 25px;
  line-height: 29px;
}

.donut-center span {
  font-weight: 600;
  font-size: 13px;
}

.donut-legend {
  display: grid;
  gap: 15px;
  font-size: 13px;
}

.donut-legend div {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  align-items: center;
  gap: 10px;
}

.donut-legend b {
  font-weight: 600;
}

.coverage-card,
.district-card {
  min-height: 188px;
}

.coverage-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 20px;
}

.gauge {
  width: 140px;
  height: 102px;
  position: relative;
}

.gauge-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  text-align: center;
}

.gauge-label strong {
  display: block;
  font-size: 29px;
  line-height: 30px;
}

.gauge-label span {
  font-size: 13px;
  font-weight: 500;
}

.coverage-stats {
  display: grid;
  gap: 14px;
  font-size: 12px;
}

.coverage-stats div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.coverage-stats b {
  font-size: 14px;
}

.ranking-head,
.rank-row {
  display: grid;
  grid-template-columns: 1fr 150px 28px;
  align-items: center;
  gap: 12px;
}

.ranking-head {
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 700;
}

.ranking-head span:last-child {
  grid-column: 2 / 4;
  text-align: right;
}

.ranking-list {
  display: grid;
  gap: 10px;
}

.rank-row {
  font-size: 12px;
  font-weight: 500;
}

.rank-row b {
  text-align: right;
  font-size: 12px;
}

.rank-track,
.score {
  height: 8px;
  border-radius: 99px;
  background: #f0f3f5;
  overflow: hidden;
}

.rank-track i,
.score i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #079948, #22a744);
  animation: fillBar 850ms ease forwards;
}

.opportunity-card {
  grid-column: 1 / -1;
  min-height: 246px;
  order: 20;
}

.quality-card,
.undercovered-card,
.source-card {
  min-height: 254px;
  order: 11;
}

.quality-card {
  grid-column: 1 / 2;
}

.undercovered-card {
  grid-column: 2 / 3;
}

.source-card {
  grid-column: 3 / 4;
}

.insight-card,
.action-card {
  min-height: 190px;
  order: 12;
}

.insight-card {
  grid-column: 1 / 3;
}

.action-card {
  grid-column: 3 / 4;
}

.quality-list,
.undercovered-list,
.source-grid {
  display: grid;
  gap: 11px;
}

.quality-row,
.undercovered-row {
  display: grid;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.quality-row {
  grid-template-columns: 90px 1fr 44px;
}

.undercovered-row {
  grid-template-columns: 1fr 118px 36px;
}

.quality-row span,
.undercovered-row span,
.source-grid span {
  color: #273a4c;
  font-weight: 600;
}

.quality-row b,
.undercovered-row b,
.source-grid b {
  color: #06121f;
  font-weight: 800;
}

.quality-track,
.undercovered-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f4;
}

.quality-track i,
.undercovered-track i {
  display: block;
  width: var(--w);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #079948, #22a744);
}

.undercovered-track i {
  background: linear-gradient(90deg, #ffc20d, #ff7c28);
}

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

.source-grid div {
  min-width: 0;
  padding: 10px;
  border: 1px solid #e4e9ef;
  border-radius: 8px;
  background: #fafcfd;
}

.source-grid div:first-child {
  grid-column: 1 / -1;
}

.source-grid span {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
}

.source-grid b {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.insight-grid div {
  min-width: 0;
  min-height: 112px;
  padding: 14px;
  border: 1px solid #e4e9ef;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f9fbfc);
}

.insight-grid span,
.insight-grid small {
  display: block;
  color: #607081;
  font-size: 11px;
  font-weight: 700;
}

.insight-grid b {
  display: block;
  overflow: hidden;
  margin: 16px 0 8px;
  color: #06121f;
  font-size: 20px;
  line-height: 24px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-list {
  display: grid;
  gap: 12px;
}

.action-list div {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  color: #273a4c;
  font-size: 12px;
  font-weight: 600;
}

.action-list svg {
  width: 34px;
  height: 34px;
  padding: 8px;
  border-radius: 10px;
  color: #058b4a;
  background: #e9f8f1;
}

.mini-kpi-grid {
  height: 170px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
}

.mini-kpi {
  min-width: 0;
  height: 132px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border-right: 1px solid #e4e9ef;
  text-align: center;
}

.mini-kpi:last-child {
  border-right: 0;
}

.mini-kpi svg {
  width: 72px;
  height: 72px;
  padding: 18px;
  border-radius: 25px;
  stroke-width: 2.8;
}

.mini-kpi.green svg {
  color: #069a49;
  background: #eaf8ef;
}

.mini-kpi.amber svg {
  color: #e9a600;
  background: #fff8e7;
}

.mini-kpi.red svg {
  color: #ef4d37;
  background: #fff0ed;
}

.mini-kpi.blue svg {
  color: #116ccc;
  background: #eff6ff;
}

.mini-kpi.purple svg {
  color: #9333d6;
  background: #f5ecff;
}

.mini-kpi b {
  font-size: 28px;
  line-height: 30px;
}

.mini-kpi span {
  font-size: 12px;
  font-weight: 500;
}

.table-card {
  grid-column: 1 / 3;
  min-height: 548px;
}

.priority-summary-card {
  grid-column: 3 / 4;
  min-height: 548px;
}

.priority-tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  height: 468px;
}

.priority-tables table {
  height: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 8.4px;
}

thead {
  background: #f1f4f7;
}

th {
  height: 19px;
  text-align: left;
  font-weight: 700;
  padding: 0 2px;
  line-height: 9.5px;
}

td {
  height: 17px;
  border-bottom: 1px solid #e5e9ee;
  font-weight: 500;
  padding: 0 2px;
  line-height: 9.5px;
}

th:first-child,
td:first-child {
  width: 46px;
  text-align: center;
}

th:nth-child(2),
td:nth-child(2) {
  width: 150px;
}

th:nth-child(3),
td:nth-child(3) {
  width: 140px;
}

th:nth-child(4),
td:nth-child(4) {
  width: 260px;
}

td:nth-child(4) {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 7px;
}

.score {
  height: 6px;
}

.priority-tables th:first-child,
.priority-tables td:first-child {
  width: 27px;
}

.priority-tables th:nth-child(2),
.priority-tables td:nth-child(2) {
  width: 118px;
}

.priority-tables th:nth-child(3),
.priority-tables td:nth-child(3) {
  width: 80px;
}

.priority-tables th:nth-child(4),
.priority-tables td:nth-child(4) {
  width: 118px;
}

.priority-tables td:nth-child(4) {
  grid-template-columns: 20px 1fr;
  gap: 4px;
}

.priority-tables th {
  height: 24px;
}

.priority-tables td {
  height: 22px;
  line-height: 10.5px;
}

.priority-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.priority-summary-grid div {
  min-width: 0;
  min-height: 86px;
  padding: 12px;
  border: 1px solid #e4e9ef;
  border-radius: 8px;
  background: #fafcfd;
}

.priority-summary-grid span {
  display: block;
  color: #607081;
  font-size: 10px;
  font-weight: 700;
}

.priority-summary-grid b {
  display: block;
  margin-top: 14px;
  color: #06121f;
  font-size: 24px;
  line-height: 28px;
  font-weight: 800;
}

.priority-subtitle {
  margin-top: 22px !important;
}

.top-city-list {
  display: grid;
  gap: 9px;
}

.top-city-row {
  display: grid;
  grid-template-columns: 1fr 92px 34px;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 700;
}

.top-city-row span {
  min-width: 0;
  overflow: hidden;
  color: #273a4c;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-city-row b {
  text-align: right;
  font-size: 11px;
}

.top-city-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f4;
}

.top-city-track i {
  display: block;
  width: var(--w);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #079948, #22a744);
}

footer {
  padding: 17px 0 0;
  text-align: center;
  color: #223548;
  font-size: 12px;
}

footer span {
  display: inline-block;
  margin: 0 9px;
}

@keyframes fillBar {
  to {
    width: var(--w);
  }
}

@media (max-width: 1440px) {
  .kpi-card {
    padding-inline: 14px;
  }

  .kpi-icon {
    width: 58px;
    height: 58px;
    flex-basis: 58px;
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 25fr) minmax(0, 43.8fr) minmax(0, 31.2fr);
  }
}

@media (max-width: 1280px) {
  .sidebar {
    width: 230px;
  }

  .shell {
    margin-left: 230px;
  }

  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }

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

  .city-card,
  .donut-card {
    order: 1;
  }

  .map-card {
    order: 2;
  }

  .coverage-card,
  .district-card {
    order: 3;
  }

  .table-card,
  .priority-summary-card {
    order: 4;
  }

  .quality-card,
  .undercovered-card,
  .source-card {
    order: 5;
  }

  .insight-card,
  .action-card {
    order: 6;
  }

  .opportunity-card {
    order: 7;
  }

  .map-card,
  .opportunity-card,
  .table-card,
  .quality-card,
  .undercovered-card,
  .source-card,
  .insight-card,
  .action-card,
  .priority-summary-card {
    grid-column: span 2;
  }

  .insight-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .donut-card {
    grid-column: span 1;
  }
}

@media (max-width: 1024px) {
  .sidebar {
    width: 84px;
    padding-inline: 14px;
  }

  .brand {
    justify-content: center;
  }

  .nav-item span,
  .sidebar-bottom {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .shell {
    margin-left: 84px;
  }

  .topbar {
    height: auto;
    gap: 18px;
    flex-direction: column;
  }

  .header-actions {
    margin-top: 0;
    flex-wrap: wrap;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    padding: 12px;
    flex-direction: row;
    align-items: center;
  }

  .brand {
    margin: 0;
    height: auto;
  }

  .brand-logo {
    width: 92px;
    height: 50px;
  }

  .nav {
    margin-left: auto;
    display: flex;
    gap: 8px;
  }

  .nav-item {
    width: 42px;
    min-height: 42px;
  }

  .shell {
    margin-left: 0;
    padding-inline: 12px;
  }

  .topbar {
    margin-inline: -12px;
    padding: 18px 18px 28px;
  }

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

  .control {
    width: 100%;
    justify-content: space-between;
  }

  .header-actions,
  .kpi-grid,
  .dashboard-grid,
  .coverage-body,
  .donut-layout,
  .mini-kpi-grid,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .map-card,
  .opportunity-card,
  .table-card,
  .quality-card,
  .undercovered-card,
  .source-card,
  .insight-card,
  .action-card,
  .priority-summary-card {
    grid-column: auto;
  }

  .map-card {
    min-height: 430px;
  }

  .mini-kpi {
    border-right: 0;
    border-bottom: 1px solid #e4e9ef;
  }

  .table-card {
    overflow-x: auto;
  }

  table {
    min-width: 650px;
  }
}
