:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel2: #1c232d;
  --line: #273040;
  --txt: #e6edf3;
  --muted: #8b98a9;
  --brand: #8fbc3d;        /* hijau Milan Ecowood (terang, untuk link/ikon) */
  --btn: #6b9327;          /* hijau Milan (gelap, untuk tombol + teks putih) */
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --info: #38bdf8;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--txt);
  font: 15px/1.55 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--panel2); padding: 1px 5px; border-radius: 4px; font-size: 13px; }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }

.side {
  width: 232px; flex: 0 0 232px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}

.brand { display: flex; gap: 10px; align-items: center; margin-bottom: 22px; }
.brand .dot {
  width: 30px; height: 30px; border-radius: 9px;
  background: transparent;
  flex: 0 0 30px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.brand .dot img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand strong { display: block; font-size: 15px; letter-spacing: .2px; }
.brand small { display: block; color: var(--muted); font-size: 11px; }
.brand.big .dot { width: 38px; height: 38px; flex-basis: 38px; }

.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a {
  color: var(--muted); padding: 9px 11px; border-radius: 9px;
  font-size: 14px; font-weight: 500;
}
.side nav a:hover { background: var(--panel2); color: var(--txt); text-decoration: none; }
.side nav a.on { background: #1e2a3d; color: #cfe1ff; }
.navgroup {
  margin: 14px 0 4px; padding: 0 11px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: #5c6a7d;
}

.logout { margin-top: auto; }
.logout button { width: 100%; }

.main { flex: 1; min-width: 0; padding: 22px 26px 60px; }

.topbar {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.topbar h1 { margin: 0; font-size: 22px; letter-spacing: -.3px; }
.topbar .sub { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.who { display: flex; align-items: center; gap: 9px; }

/* ---------- cards ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.cardhead {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.cardhead h3 { margin: 0; font-size: 15px; }
.headrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid.tight { gap: 10px; margin-bottom: 14px; }
.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.c5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid > .card { margin-bottom: 0; }

.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .lbl { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.stat .val { font-size: 26px; font-weight: 700; letter-spacing: -.5px; }
.stat .val .unit { font-size: 15px; color: var(--muted); font-weight: 500; }
.val.ok { color: var(--ok); }
.val.warn { color: var(--warn); }
.val.info { color: var(--info); }
.val.danger { color: var(--danger); }
.val.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; }

.mini {
  background: var(--panel2); border-radius: 10px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.mini span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.mini b { font-size: 18px; }

/* ---------- timeline ---------- */
.timeline { display: flex; flex-direction: column; gap: 10px; }
.tl {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px;
  background: var(--panel2); border-radius: 10px; padding: 11px 13px;
  border-left: 3px solid var(--line);
}
.tl.done { border-left-color: var(--ok); }
.tl-k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.tl-v { font-size: 19px; font-weight: 700; grid-row: span 2; align-self: center; }
.tl-n { font-size: 12px; color: var(--muted); }

.kpis { list-style: none; margin: 0; padding: 0; }
.kpis li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px;
}
.kpis li:last-child { border-bottom: none; }
.kpis span { color: var(--muted); }

/* ---------- table ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; color: var(--muted); font-weight: 600; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .05em;
  padding: 8px 10px; border-bottom: 1px solid var(--line);
}
.tbl td { padding: 9px 10px; border-bottom: 1px solid #1e242e; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr.off td { opacity: .55; }
.tbl tr:hover td { background: #19202a; }
.tbl .r { text-align: right; }
.tbl .compact td, .tbl .compact th { padding: 6px 8px; font-size: 12.5px; }
.tbl tfoot td { font-weight: 700; border-top: 1px solid var(--line); }
.tbl td small { display: block; font-size: 11px; }
.tbl td.wrap { max-width: 260px; white-space: normal; }
.empty { text-align: center; color: var(--muted); padding: 22px 0; font-size: 13.5px; }

/* ---------- tags & pills ---------- */
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; background: #202836; color: var(--muted);
}
.tag.ok { background: #14321f; color: #6ee7a0; }
.tag.warn { background: #33270f; color: #fbd38d; }
.tag.danger { background: #37181a; color: #fca5a5; }
.tag.info { background: #102c3a; color: #7dd3fc; }
.tag.muted { background: #202836; color: var(--muted); }

.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: var(--panel2); color: var(--muted); font-size: 12px; font-weight: 600;
}
.pill.warn { background: #33270f; color: #fbd38d; }
.pill.ok { background: #14321f; color: #6ee7a0; }

.badge {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  padding: 3px 9px; border-radius: 999px; background: #1e2a3d; color: #9dc0ff;
}
.badge.admin { background: #2b1e3d; color: #c9a9ff; }
.who .nm { font-size: 13.5px; font-weight: 600; }

/* ---------- forms ---------- */
.stack { display: flex; flex-direction: column; gap: 12px; }
label { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; }
label input, label select, label textarea, .tinyinput {
  display: block; width: 100%; margin-top: 5px;
  background: #0f141a; color: var(--txt);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 11px; font: inherit; font-size: 14px;
}
label textarea { resize: vertical; }
label input:focus, label select:focus, label textarea:focus {
  outline: none; border-color: var(--btn); box-shadow: 0 0 0 3px rgba(139,188,61,.18);
}
/* select di luar label (toolbar, filter) */
select {
  background: #0f141a; color: var(--txt);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 7px 10px; font: inherit; font-size: 13px;
}
select:focus { outline: none; border-color: var(--btn); box-shadow: 0 0 0 3px rgba(139,188,61,.18); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.formgrid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.formactions { grid-column: 1 / -1; display: flex; gap: 10px; margin-top: 6px; }
label.check { display: flex; align-items: center; gap: 9px; font-weight: 500; color: var(--txt); }
label.check input { width: auto; margin: 0; }
label.full { grid-column: 1 / -1; }
.tinyinput { width: 88px; display: inline-block; padding: 5px 7px; font-size: 12px; }
.days { display: flex; flex-wrap: wrap; gap: 8px; }
.day {
  display: flex; align-items: center; gap: 7px; background: var(--panel2);
  padding: 7px 11px; border-radius: 9px; color: var(--txt); font-weight: 500; cursor: pointer;
}
.day input { width: auto; margin: 0; }

.toolbar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.toolbar label { min-width: 150px; }
.toolbar.wrap { row-gap: 10px; }
.toolbar .actions { display: flex; gap: 8px; margin-left: auto; }
@media (max-width: 900px) { .toolbar .actions { margin-left: 0; } }


button, .ghost, .primary {
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  border-radius: 9px; padding: 9px 16px; border: 1px solid transparent;
  transition: filter .15s, background .15s;
}
.primary { background: var(--btn); color: #fff; }
.primary:hover { filter: brightness(1.1); }
.primary.alt { background: #0f766e; }
.primary:disabled { background: #1f2937; color: #55606f; cursor: not-allowed; }
.ghost { background: transparent; color: var(--txt); border-color: var(--line); }
.ghost:hover { background: var(--panel2); }
.sm { padding: 6px 12px; font-size: 13px; }
.inline { display: inline-block; }
.nowrap { white-space: nowrap; }

/* ---------- flash / result ---------- */
.flash {
  background: #10233a; border: 1px solid #1d3b5c; color: #a9cdf5;
  padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 13.5px;
}
.flash.err { background: #37181a; border-color: #5b2427; color: #fca5a5; }
.result { padding: 11px 14px; border-radius: 10px; font-size: 13.5px; margin-top: 12px; }
.result.ok { background: #14321f; color: #86efac; }
.result.err { background: #37181a; color: #fca5a5; }

/* ---------- absen page ---------- */
.mapbox {
  position: relative; border-radius: 12px; overflow: hidden;
  background: radial-gradient(circle at 50% 45%, #1b2c17, #0f141a 70%);
  border: 1px solid var(--line);
  min-height: 200px; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 20px;
}
.pulse {
  position: absolute; width: 130px; height: 130px; border-radius: 50%;
  border: 2px solid rgba(139,188,61,.45);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(.55); opacity: .9; }
  100% { transform: scale(1.5); opacity: 0; }
}
.mapbox p { position: relative; margin: 0; font-size: 13.5px; }

.rowline { display: flex; gap: 26px; margin-bottom: 14px; }
.rowline .lbl { display: block; color: var(--muted); font-size: 11.5px; text-transform: uppercase; }
.rowline b { font-size: 22px; }

.selfie {
  border-radius: 12px; overflow: hidden; background: #0f141a;
  border: 1px solid var(--line); aspect-ratio: 4 / 3;
  display: flex; align-items: center; justify-content: center; margin-bottom: 10px;
}
.selfie video, .selfie img { width: 100%; height: 100%; object-fit: cover; }
.btnrow { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.btnrow button { flex: 1; min-width: 130px; }

/* ---------- login ---------- */
body.auth { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.loginwrap { width: 100%; max-width: 400px; }
.logincard {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 26px 24px;
}
.logincard h2 { margin: 16px 0 4px; font-size: 19px; }
.logincard .sub { margin: 0 0 18px; color: var(--muted); font-size: 13.5px; }
.tiny { font-size: 12px; color: var(--muted); margin-top: 14px; }
.muted { color: var(--muted); }
.danger { color: var(--danger); }
.link { font-size: 13px; font-weight: 600; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .c5 { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .formgrid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .side {
    width: 100%; flex: none; height: auto; position: static;
    border-right: none; border-bottom: 1px solid var(--line);
    padding: 12px 14px;
  }
  .brand { margin-bottom: 12px; }
  .side nav { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .side nav a { white-space: nowrap; font-size: 13px; padding: 7px 11px; }
  .navgroup { display: none; }
  .logout { margin-top: 10px; }
  .logout button { width: auto; }
  .main { padding: 16px 14px 50px; }
  .c2, .c3, .c4, .c5 { grid-template-columns: 1fr; }
  .c4.tight, .c5 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .topbar h1 { font-size: 19px; }
  .tbl { display: block; overflow-x: auto; white-space: nowrap; }
  .formgrid { grid-template-columns: 1fr; }
  .two { grid-template-columns: 1fr; }
}

/* ---------- kunjungan proyek ---------- */
.visit-live { border-color: #6b9327; box-shadow: 0 0 0 1px rgba(139,188,61,.25); }
.liveinfo { display: flex; gap: 30px; flex-wrap: wrap; margin-bottom: 16px; }
.liveinfo .lbl { display: block; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; }
.liveinfo b { font-size: 17px; }
.liveinfo small { display: block; font-size: 12px; }

.byproj { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.projcard {
  border: 1px solid var(--line); border-radius: 11px;
  padding: 13px 15px; margin-bottom: 12px; background: var(--panel2);
}
.projcard:last-child { margin-bottom: 0; }
.projhead { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; align-items: baseline; }
.projhead b { font-size: 15px; }
.projmeta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.projcard .tiny { margin: 6px 0 0; }
.projcard .tiny.warn { color: var(--warn); }
.editbox { margin-top: 10px; }
.editbox summary {
  cursor: pointer; font-size: 12.5px; color: var(--brand); font-weight: 600;
  list-style: none; user-select: none;
}
.editbox summary::-webkit-details-marker { display: none; }
.editbox summary::before { content: "▸ "; }
.editbox[open] summary::before { content: "▾ "; }
.editbox .formgrid { margin-top: 12px; }
.actrow { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
button.danger, .ghost.danger { color: #fca5a5; border-color: #5b2427; }

/* ---------- catatan GPS kunjungan ---------- */
.gpsbox {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,.02);
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 2px 0;
}
.gpsrow2 { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.gpsrow2 .lbl {
  color: var(--muted); font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .05em; white-space: nowrap;
}
.gpsrow2 b { font-size: 13px; font-weight: 600; text-align: right; }
.gpsrow2 b.ok { color: var(--brand); }
.gpsrow2 b.warn { color: var(--warn); }
.gpsrow2 b.danger { color: var(--danger); }
.gpsbox .gpsrow { margin: 4px 0 0; border-top: 1px solid var(--line); padding-top: 6px; }

.gpsrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 2px 0 4px; }
.gpsrow .sm { padding: 4px 10px; font-size: 12px; margin: 0; }
.gpsrow.good #gpsText { color: var(--brand); }
.gpsrow.bad #gpsText { color: var(--danger); }
