:root {
  --bg: #eef3f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --navy: #0b3a6f;
  --navy-dark: #061a36;
  --accent: #0b3a6f;
  --accent-weak: #dbeafe;
  --ok: #16a34a;
  --ok-weak: #dcfce7;
  --bad: #dc2626;
  --bad-weak: #fee2e2;
  --warn: #ea8a0c;
  --slate-bg: #f1f5f9;
  --shadow: 0 1px 2px #0f172a0a, 0 4px 16px #0f172a0f;
}

* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
[hidden] { display: none !important; }

/* Header */
.top { background: linear-gradient(100deg, var(--navy-dark), var(--navy)); color: #fff; }
.top .btn-line { background: transparent; color: #fff; border-color: #ffffff66; }
.top .btn:not(.btn-line) { background: #fff; color: var(--navy); border-color: #fff; }
.top-in { max-width: 1200px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.narrow .top-in, .narrow main { max-width: 600px; }
.brand b { display: block; font-size: 17px; font-weight: 700; }
.brand span { font-size: 12.5px; color: #bcd3ee; }
main { max-width: 1200px; margin: 0 auto; padding: 16px; }

/* Tombol */
.btn { display: inline-block; padding: 10px 16px; border: 1px solid var(--accent); border-radius: 6px; background: var(--accent); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-line { background: var(--card); color: var(--accent); }
.btn-block { width: 100%; padding: 14px; font-size: 16px; }
.btn-sm { padding: 6px 12px; font-size: 14px; }

/* Kartu */
.card { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.card h2 { margin: 0 0 16px; font-size: 15px; font-weight: 700; color: var(--navy); display: flex; align-items: center; gap: 10px; }
.step { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-weak); color: var(--accent); font-size: 13px; display: inline-grid; place-items: center; }

/* Form */
.field { margin: 0 0 16px; padding: 0; border: 0; }
.field:last-child { margin-bottom: 0; }
.field > label, .field > legend { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; padding: 0; }
.field-label { display: block; font-size: 14px; margin-bottom: 6px; }
.field-label b { font-weight: 600; }
.opt { font-weight: 400; color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
input[type=text], input[type=number], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; font: inherit; color: inherit; background: #fff;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > input { flex: 1; }

.sr { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }

.seg { display: flex; gap: 8px; }
.seg label { flex: 1; position: relative; }
.seg span { display: block; text-align: center; padding: 10px 6px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; font-weight: 500; }
.seg input:checked + span { border-color: var(--accent); background: var(--accent-weak); color: var(--accent); }
.seg input[value=Nyala]:checked + span { border-color: var(--ok); background: var(--ok-weak); color: var(--ok); }
.seg input[value=Mati]:checked + span { border-color: var(--bad); background: var(--bad-weak); color: var(--bad); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }

.photo { display: block; position: relative; border: 1px dashed #b8c1ca; border-radius: 6px; padding: 18px; text-align: center; color: var(--muted); cursor: pointer; background: #fafbfc; font-size: 14px; }
.photo img { display: block; width: 100%; max-height: 240px; object-fit: cover; border-radius: 4px; margin-bottom: 8px; }
.photo:focus-within { outline: 2px solid var(--accent); }

.alert { padding: 12px 14px; border-radius: 6px; margin-bottom: 16px; background: var(--bad-weak); color: var(--bad); }
.done { text-align: center; padding: 40px 20px; }
.done h2 { justify-content: center; font-size: 20px; }
.done p { color: var(--muted); margin: 0 0 24px; }

/* Dashboard */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 16px; }
.stat { color: #fff; border-radius: 10px; display: flex; align-items: center; gap: 14px; min-height: 92px; padding: 14px 18px; }
.stat.navy { background: var(--navy); } .stat.green { background: var(--ok); } .stat.red { background: var(--bad); }
.stat.orange { background: var(--warn); } .stat.blue { background: #2563eb; }
.stat .ic { width: 46px; height: 46px; border-radius: 50%; background: #ffffff2e; display: grid; place-items: center; flex: none; }
.stat .ic svg { width: 22px; height: 22px; }
.stat small { display: block; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; opacity: .95; }
.stat b { display: block; font-size: 32px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 13px; font-weight: 600; opacity: .9; }
.grid2 { display: grid; grid-template-columns: minmax(320px, 1fr) 2fr; gap: 16px; }
.grid2 .card { margin-bottom: 0; }
.grid2 { margin-bottom: 16px; }
.chart { position: relative; height: 260px; }
#map { height: 460px; border-radius: 6px; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.updated { font-size: 13px; color: var(--muted); }

.filters { display: grid; grid-template-columns: 1fr 160px 160px; gap: 8px; margin-bottom: 12px; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
tbody tr:nth-child(even) { background: #f8fafc; }
tbody tr:hover { background: var(--slate-bg); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 8px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid #eceff2; }
th { background: var(--navy); color: #fff !important; font-weight: 600; font-size: 13px; color: var(--muted); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td img { width: 64px; height: 48px; object-fit: cover; border-radius: 4px; display: block; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 13px; font-weight: 500; }
.badge.Nyala { background: var(--ok-weak); color: var(--ok); }
.badge.Mati { background: var(--bad-weak); color: var(--bad); }
.count { font-size: 13px; color: var(--muted); margin-top: 8px; }

.pop { font-size: 13px; line-height: 1.6; min-width: 220px; }
.pop b { font-size: 14px; }
.pop .imgs { display: flex; gap: 4px; margin: 6px 0; }
.pop img { width: 72px; height: 54px; object-fit: cover; border-radius: 4px; }

@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, 1fr); } .grid2 { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .kpis { gap: 10px; }
  .stat { gap: 10px; min-height: 0; padding: 12px; }
  .stat .ic { width: 38px; height: 38px; }
  .stat b { font-size: 26px; }
  .stat small { font-size: 10px; }
  .card { padding: 16px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters input { grid-column: 1 / -1; }
  #map { height: 360px; }
  .grid2 { grid-template-columns: 1fr; }
}
