/* Survee — token: tinta (teal gelap), kertas dingin, kuning meteran untuk aksi utama. */
:root {
  --ink: #14313A; --ink-2: #2B4A53; --paper: #F3F5F4; --surface: #FFFFFF; --line: #D3DBD9; --line-2: #E6EBEA;
  --muted: #5B6B70; --tape: #F2B705; --tape-2: #E0A800; --tape-ink: #2A2000;
  --ok: #2E7D4F; --ok-bg: #E7F3EC; --warn: #8A5A00; --warn-bg: #FFF4D6; --bad: #B42318; --bad-bg: #FDECEA; --info: #1F5F8B; --info-bg: #E6F0F7;
  --r-sm: 4px; --r-md: 8px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --tap: 44px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.45; color: var(--ink); background: var(--paper); font-variant-numeric: tabular-nums; }
a { color: var(--info); }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.1rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; margin: 14px 0 6px; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.bad { color: var(--bad); }
.warn { color: var(--warn); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--tape); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ---------- topbar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 0 16px; min-height: 56px; background: var(--ink); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.mark, .login-mark { display: inline-block; width: 26px; height: 14px; border-radius: 2px; background: linear-gradient(var(--tape), var(--tape)) bottom / 100% 55% no-repeat, repeating-linear-gradient(90deg, var(--ink) 0 1.5px, var(--tape) 1.5px 5px); }
.topnav { display: flex; gap: 2px; overflow-x: auto; flex: 1; }
.topnav a { color: #CFE0E2; text-decoration: none; padding: 16px 10px; font-size: .95rem; white-space: nowrap; border-bottom: 3px solid transparent; }
.topnav a.on { color: #fff; border-bottom-color: var(--tape); }
.topnav a:hover { color: #fff; }
.sync { margin-left: auto; border: 0; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .8rem; cursor: pointer; white-space: nowrap; background: rgba(255,255,255,.12); color: #fff; }
.sync.ok::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #6FD39A; margin-right: 6px; }
.sync.wait { background: var(--tape); color: var(--tape-ink); }
.sync.off { background: #53666B; }
.sync.bad { background: var(--bad); }
.role-surveyor .topnav { display: none; }
.bottomnav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.bottomnav a { flex: 1; text-align: center; padding: 14px 4px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .9rem; border-top: 3px solid transparent; }
.bottomnav a.on { color: var(--ink); border-top-color: var(--tape); }
@media (min-width: 900px) { .role-surveyor .topnav { display: flex; } .bottomnav { display: none; } }

main#view { max-width: 760px; margin: 0 auto; padding: 16px 16px 120px; outline: none; }
.role-admin main#view, .role-penilai main#view { max-width: 1180px; padding-bottom: 60px; }

/* ---------- page head ---------- */
.page-head { margin: 4px 0 16px; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.addr { margin: 6px 0 2px; }
.note { background: var(--surface); border-left: 3px solid var(--tape); padding: 8px 12px; margin-top: 10px; }
.back { display: inline-block; margin-bottom: 8px; color: var(--muted); text-decoration: none; font-size: .9rem; padding: 6px 0; }
.back::before { content: '‹ '; }
.sec-n { display: inline-grid; place-items: center; min-width: 28px; height: 28px; border-radius: var(--r-sm); background: var(--tape); color: var(--tape-ink); font-size: .95rem; vertical-align: 3px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 0 16px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: .95rem; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--ink-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--tape); border-color: var(--tape-2); color: var(--tape-ink); }
.btn.primary:hover { background: #FFC61A; }
.btn.danger { color: var(--bad); border-color: #EFB5AE; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--info); }
.btn.ghost:hover { background: var(--info-bg); }
.btn.small { min-height: 34px; padding: 0 10px; font-size: .85rem; }
.btn.block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---------- chips & banners ---------- */
.chip { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .78rem; font-weight: 650; white-space: nowrap; }
.tone-todo { background: var(--warn-bg); color: var(--warn); }
.tone-bad { background: var(--bad-bg); color: var(--bad); }
.tone-info { background: var(--info-bg); color: var(--info); }
.tone-ok { background: var(--ok-bg); color: var(--ok); }
.tone-done { background: var(--ink); color: #fff; }
.banner { display: block; padding: 12px 14px; border-radius: var(--r-md); margin: 10px 0; text-decoration: none; color: var(--ink); border: 1px solid; }
.banner.bad { background: var(--bad-bg); border-color: #F2C3BD; }
.banner.warn { background: var(--warn-bg); border-color: #F0DA9E; }
.banner.info { background: var(--info-bg); border-color: #BCD4E6; }
.banner p, .banner ul { margin: 6px 0 0; }
.banner-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* ---------- lists ---------- */
.group { margin: 22px 0; }
.group-title { display: flex; align-items: center; gap: 8px; font-size: .95rem; font-weight: 650; color: var(--ink-2); margin-bottom: 8px; }
.count { display: inline-block; min-width: 22px; padding: 0 6px; border-radius: 999px; background: var(--line-2); color: var(--muted); font-size: .78rem; text-align: center; margin-left: 4px; }
.rows { list-style: none; margin: 0 0 12px; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.rows li + li { border-top: 1px solid var(--line-2); }
.row { display: flex; gap: 12px; justify-content: space-between; padding: 14px; color: inherit; text-decoration: none; }
a.row:hover { background: #FAFBFB; }
.row-title { font-weight: 650; }
.row-sub { color: var(--ink-2); font-size: .9rem; }
.row-meta { color: var(--muted); font-size: .8rem; margin-top: 2px; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-align: right; flex-shrink: 0; }
.row-due { font-size: .8rem; color: var(--muted); }
.row-due.late { color: var(--bad); font-weight: 650; }
.rows.compact .row { padding: 10px 14px; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-md); }

/* ---------- tape progress (signature) ---------- */
.tape { display: flex; height: 18px; margin: 16px 0 6px; border-radius: 2px; background: var(--tape); overflow: hidden; box-shadow: inset 0 -1px 0 var(--tape-2); }
.tick { flex: 1; position: relative; border-right: 2px solid var(--tape-ink); }
.tick:last-child { border-right: 0; }
.tick::after { content: ''; position: absolute; left: 50%; top: 0; height: 6px; border-left: 1px solid var(--tape-ink); }
.tick.done { background: var(--ink); }
.tick.done::after { border-color: var(--tape); }
.steps { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.steps li + li { border-top: 1px solid var(--line-2); }
.step { display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 10px; padding: 13px 14px; color: inherit; text-decoration: none; }
.step:hover { background: #FAFBFB; }
.step-n { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-sm); border: 1.5px solid var(--line); font-weight: 650; font-size: .9rem; color: var(--muted); }
.step.done .step-n { background: var(--ink); border-color: var(--ink); color: #fff; }
.step-t { font-weight: 600; }
.step-note { font-size: .82rem; color: var(--warn); text-align: right; }
.step.done .step-note { color: var(--muted); }

/* ---------- form ---------- */
.fields { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.lbl { font-weight: 600; font-size: .95rem; }
.req { color: var(--bad); }
.hint { font-size: .82rem; color: var(--muted); }
.err { font-size: .85rem; color: var(--bad); min-height: 0; }
input[type=text], input[type=tel], input[type=date], input[type=month], input[type=password], input[type=search], select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px; font: inherit; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: var(--r-sm); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--ink-2); outline: none; box-shadow: 0 0 0 3px rgba(242,183,5,.45); }
.field.missing > input, .field.missing select, .field.missing textarea, .field.missing .with-unit input { border-color: var(--bad); background: #FFFAFA; }
.field.missing .seg button { border-color: #EFB5AE; }
.with-unit { display: flex; align-items: stretch; }
.with-unit input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.with-unit .unit { display: flex; align-items: center; padding: 0 12px; border: 1.5px solid var(--line); border-left: 0; border-radius: 0 var(--r-sm) var(--r-sm) 0; background: var(--line-2); color: var(--muted); font-size: .9rem; white-space: nowrap; }
.with-unit.pre .unit { order: -1; border-left: 1.5px solid var(--line); border-right: 0; border-radius: var(--r-sm) 0 0 var(--r-sm); }
.with-unit.pre input { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { min-height: var(--tap); padding: 0 14px; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: inherit; font-size: .92rem; cursor: pointer; }
.seg button.on { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.seg.multi button.on::before { content: '✓ '; }
.computed { padding: 10px 12px; background: var(--line-2); border-radius: var(--r-sm); font-weight: 650; }
.lain { margin-top: 2px; }
.gps { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1.5px dashed var(--line); border-radius: var(--r-md); background: var(--surface); }
.gps-val strong { font-size: 1.05rem; }
.manual summary { cursor: pointer; color: var(--info); font-size: .9rem; padding: 4px 0; }
.manual[open] { display: flex; flex-direction: column; gap: 8px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.floors { display: flex; flex-direction: column; gap: 8px; }
.floor { display: grid; grid-template-columns: 80px 1fr auto; gap: 8px; align-items: center; }
.floor-n { color: var(--muted); font-size: .9rem; }
.repeat { display: flex; flex-direction: column; gap: 12px; }
.rep-item { position: relative; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.rep-item legend { padding: 0 6px; font-weight: 650; color: var(--ink-2); }
.rep-del { position: absolute; top: 4px; right: 6px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; margin-top: 8px; }
.toggle input { width: 20px; height: 20px; }
.save-state { min-height: 1em; }
.flash { animation: flash 1.4s ease-out; }
@keyframes flash { 0% { background: var(--warn-bg); } 100% { background: transparent; } }
.sec-body { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; }
.sec-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }
.sticky-actions { position: sticky; bottom: 64px; margin-top: 18px; padding: 10px 0; background: linear-gradient(to top, var(--paper) 70%, transparent); }
@media (min-width: 900px) { .sticky-actions { bottom: 0; } }

/* ---------- kriteria ---------- */
.krit { list-style: none; margin: 12px 0 0; padding: 0; }
.krit-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.krit-main { display: flex; gap: 10px; }
.krit-id { color: var(--muted); font-size: .8rem; padding-top: 2px; min-width: 38px; }
.krit-res { font-weight: 700; text-align: right; max-width: 7em; }
.krit-side { grid-column: 1 / -1; padding-left: 48px; display: flex; flex-direction: column; gap: 2px; }
.krit-src { font-size: .85rem; }
.r-ya .krit-res, tr.r-ya .res { color: var(--bad); }
.r-cek .krit-res, tr.r-cek .res { color: var(--warn); }
.r-kurang .krit-res, tr.r-kurang .res { color: var(--muted); font-weight: 500; }
tr.r-ya { background: #FFF8F7; }

/* ---------- foto ---------- */
.foto { display: flex; flex-direction: column; gap: 4px; }
.foto-row { padding: 12px 0; border-top: 1px solid var(--line-2); }
.foto-row.need .foto-head span:first-child { color: var(--bad); }
.foto-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 8px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.thumb { position: relative; margin: 0; }
.thumb img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--r-sm); background: var(--line-2); display: block; }
.thumb figcaption { font-size: .75rem; color: var(--muted); margin-top: 3px; }
.thumb figcaption.far { color: var(--bad); font-weight: 600; }
.thumb-del { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: rgba(20,49,58,.8); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }

/* ---------- baca-saja ---------- */
.kv { margin: 0; }
.kv-row { display: grid; grid-template-columns: minmax(140px, 40%) 1fr; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line-2); }
.kv-row:first-child { border-top: 0; }
.kv dt { color: var(--muted); font-size: .9rem; }
.kv dd { margin: 0; }
.kv-row.missing dd { color: var(--bad); font-weight: 600; }
.kv-group { padding: 8px 0; border-top: 1px solid var(--line-2); }
.kv-group > dt { font-weight: 650; margin-bottom: 6px; }
.kv-group > dd { margin: 0; }
.kv-item { border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 8px 12px; margin-bottom: 8px; }
.kv-item-title { font-weight: 650; color: var(--ink-2); margin-bottom: 4px; }

/* ---------- penilai ---------- */
.review-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
.toc { display: none; }
@media (min-width: 1000px) {
  .review-grid { grid-template-columns: 190px 1fr; }
  .toc { display: flex; flex-direction: column; position: sticky; top: 72px; align-self: start; gap: 2px; }
  .toc a { padding: 6px 10px; color: var(--ink-2); text-decoration: none; border-left: 2px solid var(--line); font-size: .9rem; }
  .toc a:hover { border-left-color: var(--tape); background: var(--surface); }
}
.rblock { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; margin-bottom: 14px; scroll-margin-top: 70px; }
.rblock > h2 { margin-bottom: 10px; }
.signals { list-style: none; padding: 0; margin: 0; }
.signals li { padding: 8px 12px 8px 14px; border-left: 4px solid; margin-bottom: 6px; border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.s-bad { border-color: var(--bad) !important; background: var(--bad-bg); }
.s-warn { border-color: var(--tape-2) !important; background: var(--warn-bg); }
.issues summary { cursor: pointer; color: var(--bad); font-weight: 600; margin-top: 10px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.gal { margin: 0; border: 1px solid var(--line-2); border-radius: var(--r-md); overflow: hidden; }
.gal.far { border-color: var(--bad); }
.gal-img { display: block; padding: 0; border: 0; background: none; width: 100%; cursor: zoom-in; }
.gal img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: var(--line-2); }
.gal figcaption { display: flex; flex-direction: column; padding: 8px 10px; font-size: .82rem; gap: 2px; }
.gal-missing { aspect-ratio: 4/3; display: grid; place-items: center; background: var(--bad-bg); color: var(--bad); }
img.full { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; }
.hist { display: grid; gap: 20px; }
@media (min-width: 800px) { .hist { grid-template-columns: 1fr 1fr; } }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0; border-top: 1px solid var(--line-2); }
.diff .from { color: var(--bad); text-decoration: line-through; text-decoration-color: rgba(180,35,24,.4); }
.diff .to { color: var(--ok); font-weight: 600; }

/* ---------- tabel ---------- */
.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.rblock .tbl-wrap, .modal .tbl-wrap { border: 0; }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; font-weight: 650; color: var(--muted); font-size: .82rem; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-top: 1px solid var(--line-2); vertical-align: top; }
.tbl td.num { text-align: right; white-space: nowrap; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover { background: #FAFBFB; }
.tbl tr.inactive td { color: var(--muted); }
.tbl .amb { width: 80px; min-height: 36px; padding: 6px 8px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.toolbar input[type=search] { max-width: 340px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tabs button { min-height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); font: inherit; font-size: .9rem; cursor: pointer; color: var(--ink-2); }
.tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tabs button.on .count { background: rgba(255,255,255,.2); color: #fff; }
.panels { display: grid; gap: 14px; }
@media (min-width: 900px) { .panels { grid-template-columns: 1fr 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.panel .field, .panel .row2 { width: 100%; }
.map { height: 64vh; min-height: 360px; border-radius: var(--r-md); border: 1px solid var(--line); background: #DDE5E3; }
.legend { display: flex; gap: 16px; margin-bottom: 8px; font-size: .9rem; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.dot.obj { background: var(--info); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--info); }
.dot.pb { background: var(--tape); border: 2px solid var(--ink); }

/* ---------- modal & toast ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(20,49,58,.45); display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--surface); width: 100%; max-width: 680px; max-height: 92vh; overflow-y: auto; padding: 20px; border-radius: 12px 12px 0 0; }
@media (min-width: 700px) { .modal-wrap { align-items: center; } .modal { border-radius: 12px; } }
.modal > h2 { margin-bottom: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; position: sticky; bottom: -20px; background: var(--surface); padding: 12px 0 0; }
.form-grid { display: grid; gap: 12px; }
@media (min-width: 600px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .wide { grid-column: 1 / -1; } }
.issue-group { margin: 10px 0; }
.issue-group a { font-weight: 650; }
.issue-group ul { margin: 4px 0; padding-left: 20px; }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 60; max-width: calc(100% - 32px); padding: 12px 16px; border-radius: var(--r-md); background: var(--ink); color: #fff; font-size: .92rem; box-shadow: 0 6px 24px rgba(20,49,58,.25); transition: opacity .4s; }
.toast.bad { background: var(--bad); }
.toast.warn { background: #6B4A00; }
.toast.ok { background: var(--ok); }
.toast.out { opacity: 0; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--ink); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 12px; padding: 28px 24px; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { font-size: 1.7rem; }
.login-mark { width: 56px; height: 24px; background: linear-gradient(var(--tape), var(--tape)) bottom / 100% 55% no-repeat, repeating-linear-gradient(90deg, var(--ink) 0 2px, var(--tape) 2px 8px); }

.krit-cfg td:last-child { white-space: nowrap; }
