:root {
  --brand: #0b3d91;
  --brand-2: #1565d8;
  --accent: #ffc20e;
  --offline: #e5484d;
  --do3: #f59e0b;
  --ok: #12a150;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e6eaf2;
  --bg: #f3f6fb;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .06);
  --sidebar-w: 248px;
  --bs-primary: #1565d8;
  --bs-primary-rgb: 21, 101, 216;
  --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-color: #0f172a;
  --bs-border-color: #e6eaf2;
}

body { background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
.min-w-0 { min-width: 0; }
a { color: var(--brand-2); }

/* ---------- shell ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1030;
  background: linear-gradient(180deg, #0b3d91 0%, #082c6b 100%);
  color: #fff; display: flex; flex-direction: column; padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; padding: 4px 8px 18px; }
.brand small { display: block; font-size: .72rem; opacity: .7; font-weight: 400; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: #fff; color: #0b3d91; font-size: 1.15rem; overflow: hidden;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.login-logo { display: block; width: 100%; max-width: 340px; height: auto; margin: 0 auto 28px; mix-blend-mode: multiply; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: rgba(255, 255, 255, .78); text-decoration: none; font-weight: 500; font-size: .93rem;
  transition: background .15s, color .15s;
}
.side-nav a i { font-size: 1.1rem; width: 20px; text-align: center; }
.side-nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.side-nav a.active { background: rgba(255, 255, 255, .16); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.side-nav.light a { color: var(--ink); }
.side-nav.light a:hover { background: var(--bg); color: var(--ink); }
.side-nav.light a.active { background: #e8f0fe; color: var(--brand); box-shadow: inset 3px 0 0 var(--brand-2); }
.side-user {
  margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 10px;
  border-radius: 12px; background: rgba(255, 255, 255, .08);
}
.side-user a { color: #fff; }
.side-user small { opacity: .7; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--accent); color: #0b3d91; font-weight: 700; font-size: .85rem;
}
.btn-icon { border: 0; background: transparent; color: inherit; font-size: 1.25rem; padding: 4px 8px; border-radius: 8px; line-height: 1; }
.btn-icon:hover { background: rgba(255, 255, 255, .12); }
.sidebar .btn-icon { color: #fff; }

.topbar { display: none; }
.bottom-nav { display: none; }
.content { margin-left: var(--sidebar-w); padding: 28px 32px 40px; max-width: 1600px; }

@media (max-width: 991.98px) {
  .sidebar { display: none; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 1020;
    background: linear-gradient(90deg, #0b3d91, #1565d8); color: #fff; padding: 10px 14px;
    padding-top: calc(10px + env(safe-area-inset-top));
  }
  .topbar .brand { padding: 0; }
  .topbar .btn-icon { color: #fff; font-size: 1.6rem; }
  .content { margin-left: 0; padding: 16px 14px calc(90px + env(safe-area-inset-bottom)); }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
    background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(15, 23, 42, .06);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; align-items: flex-end;
  }
  .bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    color: var(--muted); text-decoration: none; font-size: .68rem; font-weight: 500; padding: 4px 0;
  }
  .bottom-nav a i { font-size: 1.3rem; }
  .bottom-nav a.active { color: var(--brand-2); }
  .bottom-nav a.fab {
    flex: none; width: 58px; height: 58px; margin: -26px 6px 0; border-radius: 50%;
    background: linear-gradient(135deg, #1565d8, #0b3d91); color: #fff; justify-content: center;
    box-shadow: 0 6px 18px rgba(21, 101, 216, .45); border: 4px solid var(--bg);
  }
  .bottom-nav a.fab i { font-size: 1.6rem; }
}

/* ---------- page ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 1.45rem; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.page-head p { color: var(--muted); margin: 2px 0 0; font-size: .9rem; }
@media (max-width: 575.98px) { .page-head h1 { font-size: 1.2rem; } }

.card, .panel { border: 0; border-radius: var(--radius); box-shadow: var(--shadow); background: var(--card); }
.panel { padding: 18px; }
.panel-title { font-size: .95rem; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-title i { color: var(--brand-2); }

.btn { border-radius: 10px; font-weight: 500; }
.btn-primary { background: var(--brand-2); border-color: var(--brand-2); }
.btn-primary:hover { background: var(--brand); border-color: var(--brand); }
.btn-offline { background: var(--offline); color: #fff; border: 0; }
.btn-offline:hover { background: #c93338; color: #fff; }
.btn-do3 { background: var(--do3); color: #fff; border: 0; }
.btn-do3:hover { background: #d98500; color: #fff; }
.btn-soft { background: #eef3fb; color: var(--brand); border: 0; }
.btn-soft:hover { background: #e1eafa; color: var(--brand); }
.form-control, .form-select { border-radius: 10px; border-color: #dbe2ee; }
.form-control:focus, .form-select:focus { border-color: #8db4f0; box-shadow: 0 0 0 .2rem rgba(21, 101, 216, .15); }
.form-label { font-weight: 500; font-size: .85rem; color: #334155; margin-bottom: 4px; }

/* ---------- hero & stats ---------- */
.hero {
  border-radius: 18px; padding: 22px 24px; color: #fff; margin-bottom: 18px; position: relative; overflow: hidden;
  background: radial-gradient(circle at 85% -20%, rgba(255, 194, 14, .35), transparent 45%), linear-gradient(120deg, #0b3d91, #1565d8);
}
.hero h1 { font-size: 1.4rem; font-weight: 700; margin: 0 0 4px; }
.hero p { margin: 0; opacity: .85; }
.hero .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.hero .btn { box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.hero .btn-light { color: var(--brand); }

.stat { padding: 16px 18px; height: 100%; display: flex; flex-direction: column; gap: 6px; }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-label { color: var(--muted); font-size: .8rem; font-weight: 500; }
.stat-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 1.15rem; }
.stat-num { font-size: 1.75rem; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.stat-num small { font-size: .9rem; color: var(--muted); font-weight: 500; }
.stat-sub { font-size: .78rem; color: var(--muted); }
.ic-offline { background: #fde8e8; color: var(--offline); }
.ic-do3 { background: #fff3db; color: #d98500; }
.ic-ok { background: #e2f6ea; color: var(--ok); }
.ic-brand { background: #e8f0fe; color: var(--brand-2); }

.progress-thin { height: 8px; border-radius: 99px; background: #edf1f7; overflow: hidden; }
.progress-thin > span { display: block; height: 100%; border-radius: 99px; background: var(--brand-2); transition: width .6s; }
.progress-thin.offline > span { background: var(--offline); }
.progress-thin.do3 > span { background: var(--do3); }

.hbar { display: grid; grid-template-columns: minmax(110px, 1fr) 2fr auto; gap: 10px; align-items: center; font-size: .82rem; padding: 5px 0; }
.hbar a { color: var(--ink); text-decoration: none; }
.hbar a:hover { color: var(--brand-2); }
.hbar .track { height: 10px; background: #edf1f7; border-radius: 99px; overflow: hidden; display: flex; }
.hbar .track span.o { background: var(--offline); }
.hbar .track span.d { background: var(--do3); }
.hbar .num { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 54px; text-align: right; }
.legend { display: flex; gap: 12px; font-size: .75rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

/* ---------- badges & chips ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.pill-offline { background: #fde8e8; color: #c93338; }
.pill-do3 { background: #fff3db; color: #b46d00; }
.pill-ok { background: #e2f6ea; color: #0b7a3b; }
.pill-muted { background: #eef1f6; color: #64748b; }
.pill-bad { background: #fde8e8; color: #c93338; }
.pill-online { background: #e2f6ea; color: #0b7a3b; }

/* ---------- tables ---------- */
.table-wrap { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto; max-height: calc(100vh - 230px); }
.table-modern { margin: 0; font-size: .85rem; }
.table-modern thead th {
  position: sticky; top: 0; z-index: 1; background: #f8fafd; color: #475569; font-weight: 600;
  font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--line); white-space: nowrap; padding: 11px 12px;
}
.table-modern td { padding: 10px 12px; border-color: #f0f3f8; white-space: nowrap; vertical-align: middle; }
.table-modern td.wrap { white-space: normal; min-width: 220px; }
.table-modern tbody tr:hover { background: #f8fbff; }
.table-modern .idcell { font-variant-numeric: tabular-nums; font-weight: 600; }
.table-modern .sub { color: var(--muted); font-size: .76rem; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px !important; }
.empty i { font-size: 2rem; display: block; margin-bottom: 6px; opacity: .5; }

.filters { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; margin-bottom: 14px; }
.search { position: relative; }
.search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 36px; }

.seg { display: inline-flex; background: #e9eef6; border-radius: 12px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg a { padding: 7px 14px; border-radius: 9px; text-decoration: none; color: #475569; font-weight: 500; font-size: .87rem; }
.seg a.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15, 23, 42, .1); }
.seg-count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 99px; background: var(--offline); color: #fff; font-size: .72rem; font-weight: 700; text-align: center; line-height: 18px; }

.pagination .page-link { border-radius: 8px !important; margin: 0 2px; border: 0; color: #475569; }
.pagination .page-item.active .page-link { background: var(--brand-2); color: #fff; }

/* mobile list cards (rekap & target) */
.mlist { display: none; }
@media (max-width: 767.98px) {
  .table-wrap.has-mlist { display: none; }
  .mlist { display: flex; flex-direction: column; gap: 10px; }
}
.mcard { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; display: block; color: var(--ink); text-decoration: none; }
.mcard:hover { color: var(--ink); }
.mcard .row1 { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.mcard .name { font-weight: 600; }
.mcard .meta { color: var(--muted); font-size: .8rem; margin-top: 2px; }
.mcard .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mcard .act { margin-top: 10px; }

/* ---------- survey form ---------- */
.step { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px; }
.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.step-num { width: 30px; height: 30px; border-radius: 50%; background: #e8f0fe; color: var(--brand-2); font-weight: 700; display: grid; place-items: center; font-size: .9rem; flex: none; }
.step-head h2 { font-size: 1rem; font-weight: 600; margin: 0; }
.step-head .ms-auto { font-size: .82rem; }

.kat { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.kat input { display: none; }
.kat label {
  border: 2px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; display: flex; align-items: center; gap: 10px;
  font-weight: 600; transition: all .15s; background: #fff;
}
.kat label small { display: block; font-weight: 400; color: var(--muted); font-size: .74rem; }
.kat label i { font-size: 1.4rem; }
.kat #k1 + label i { color: var(--offline); }
.kat #k2 + label i { color: var(--do3); }
.kat #k1:checked + label { border-color: var(--offline); background: #fff6f6; }
.kat #k2:checked + label { border-color: var(--do3); background: #fffaf0; }

.lookup .form-control { font-size: 1.15rem; font-weight: 600; letter-spacing: .02em; }
.pel-card { border: 1px dashed #c9d6ea; border-radius: 12px; padding: 12px 14px; background: #f8fbff; margin-top: 12px; }
.pel-card .nm { font-weight: 700; }
.pel-card .ad { color: var(--muted); font-size: .85rem; }
.pel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px 14px; margin-top: 10px; font-size: .8rem; }
.pel-grid div span { display: block; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .03em; }

.qgroup { margin-bottom: 16px; }
.qgroup > .q { font-weight: 600; font-size: .9rem; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 99px; border: 1.5px solid #d6deea;
  background: #fff; cursor: pointer; font-size: .88rem; font-weight: 500; user-select: none; transition: all .12s;
}
.chip span::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #cbd5e1; }
.chip input:checked + span { border-color: var(--brand-2); background: #e8f0fe; color: var(--brand); }
.chip input:checked + span::before { background: var(--brand-2); }
.chip.good input:checked + span { border-color: var(--ok); background: #e9f8ef; color: #0b7a3b; }
.chip.good input:checked + span::before { background: var(--ok); }
.chip.bad input:checked + span { border-color: var(--offline); background: #fdeeee; color: #c93338; }
.chip.bad input:checked + span::before { background: var(--offline); }
.chip input:focus-visible + span { outline: 2px solid #8db4f0; outline-offset: 2px; }

.gps-box { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: #f8fafd; border: 1px solid var(--line); }
.gps-box i.bi-geo-alt-fill { font-size: 1.5rem; color: var(--offline); }
.foto-thumb { width: 92px; height: 92px; object-fit: cover; border-radius: 10px; box-shadow: var(--shadow); }
.dropzone { border: 2px dashed #c9d6ea; border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); cursor: pointer; display: block; background: #fbfcfe; }
.dropzone i { font-size: 1.8rem; color: var(--brand-2); display: block; }
.dropzone input { display: none; }
.preview { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.peta { height: 260px; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); z-index: 0; }
.peta-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; font-size: .82rem; color: var(--muted); }
.peta-bar .legend { display: inline-flex; align-items: center; gap: 5px; }
.peta-bar .dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 2px #fff, 0 0 0 3px #cbd5e1; }
.dot-pel { background: #e5484d; }
.dot-me { background: #1565d8; }
.foto-modal { overflow: hidden; }
.foto-modal img { display: block; width: 100%; min-height: 240px; max-height: 80vh; object-fit: contain; background: #0f172a; }
.foto-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .85); color: #0f172a; font-size: 1.2rem; display: grid; place-items: center; box-shadow: var(--shadow); }
.foto-nav.prev { left: 10px; }
.foto-nav.next { right: 10px; }
.foto-nav[hidden] { display: none; }
.foto-slots { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 767.98px) { .foto-slots { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.foto-shot { position: relative; display: block; aspect-ratio: 3 / 4; border: 2px dashed #c9d6ea; border-radius: 12px; background: #fbfcfe; overflow: hidden; cursor: pointer; margin: 0; }
.foto-shot input { display: none; }
.foto-shot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
.foto-shot.has { border-style: solid; border-color: var(--ok); }
.foto-shot.has img { display: block; }
.foto-shot.new { border-color: var(--brand-2); }
.foto-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); font-size: .8rem; }
.foto-empty i { font-size: 1.8rem; color: var(--brand-2); }
.foto-shot.has .foto-empty { display: none; }
.foto-cap { display: flex; flex-direction: column; align-items: center; text-align: center; margin-top: 6px; font-size: .85rem; line-height: 1.3; }
.foto-cap label { cursor: pointer; }

.save-bar { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 14px 0 6px; display: flex; gap: 8px; flex-wrap: wrap; z-index: 5; }
@media (max-width: 991.98px) { .save-bar { bottom: calc(70px + env(safe-area-inset-bottom)); } }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art {
  background: radial-gradient(circle at 80% 10%, rgba(255, 194, 14, .35), transparent 40%), linear-gradient(140deg, #0b3d91, #1565d8);
  color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
}
.login-art h1 { font-size: 2.2rem; font-weight: 800; line-height: 1.15; letter-spacing: -.02em; }
.login-art ul { list-style: none; padding: 0; margin: 24px 0 0; }
.login-art li { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; opacity: .92; }
.login-art li i { background: rgba(255, 255, 255, .15); width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.login-form .box { width: 100%; max-width: 380px; }
@media (max-width: 767.98px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { padding: 28px 22px; }
  .login-art h1 { font-size: 1.5rem; }
  .login-art ul, .login-art .foot { display: none; }
}

.alert { border: 0; border-radius: 12px; }
.offcanvas { border-radius: 16px 0 0 16px; }

/* Hak cipta & versi di bawah menu */
.app-credit { margin-top: 10px; text-align: center; font-size: .72rem; color: rgba(255, 255, 255, .55); letter-spacing: .02em; }
.app-credit.light { margin-top: 16px; color: #94a3b8; }
