/* MAP-N1 — mobile-first, rombak total */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue: #0071e3;
  --blue-dark: #0058b0;
  --green: #1a7f37;
  --green-bg: #d4f7dd;
  --red: #cf1322;
  --red-bg: #fff1f0;
  --orange: #c45c00;
  --orange-bg: #fff7e6;
  --gray0: #f7f7f5;
  --gray1: #eeeeec;
  --gray2: #d8d8d6;
  --gray3: #aaaaaa;
  --gray4: #666666;
  --gray5: #222222;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 3px rgba(0,0,0,.10);
}

body {
  font-family: -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray0);
  color: var(--gray5);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

/* ── Topbar ── */
.topbar {
  background: #111;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 200;
}
.topbar-title { flex: 1; font-size: 15px; font-weight: 700; }
.topbar-sub   { font-size: 11px; color: #888; margin-top: 1px; }

/* ── Container ── */
.wrap { max-width: 540px; margin: 0 auto; padding: 14px 12px 100px; }

/* ── Card ── */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray2);
  margin-bottom: 14px;
  overflow: hidden;
}
.card-hd {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--gray1);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-hd h2 { font-size: 15px; font-weight: 700; flex: 1; }
.card-hd .badge-count {
  font-size: 12px;
  font-weight: 700;
  background: var(--gray1);
  color: var(--gray4);
  padding: 2px 9px;
  border-radius: 20px;
}
.card-bd { padding: 16px; }

/* ── Form ── */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--gray4);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 6px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1.5px solid var(--gray2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--gray5);
  background: #fff;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,113,227,.15);
}
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24'%3E%3Cpath fill='%23888' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 38px;
}
.field textarea { resize: vertical; min-height: 88px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Checklist ── */
.checklist { list-style: none; }
.checklist li {
  display: flex;
  align-items: center;
  gap: 0;
  border-bottom: 1px solid var(--gray1);
  min-height: 64px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.checklist li:last-child { border-bottom: none; }

/* The big tap area = entire row */
.checklist li label {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Hide native checkbox */
.checklist li input[type=checkbox] { display: none; }

/* Custom big checkbox */
.chk-box {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 8px;
  border: 2px solid var(--gray2);
  background: var(--gray0);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s;
}
.chk-box svg { display: none; }

/* Checked state */
.checklist li.ck label .chk-box {
  background: var(--green);
  border-color: var(--green);
}
.checklist li.ck label .chk-box svg { display: block; }
.checklist li.ck .chk-text { color: var(--green); text-decoration: line-through; text-decoration-color: #86efac; }

.chk-text p { font-size: 14px; font-weight: 600; color: var(--gray5); }
.chk-text small { font-size: 12px; color: var(--gray3); }
.checklist li.ck .chk-text p { color: var(--green); }

/* ── Photo slots ── */
.photo-list { display: flex; flex-direction: column; gap: 12px; }

.pslot {
  border: 1.5px solid var(--gray2);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}
.pslot-hd {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray1);
  background: var(--gray0);
}
.pslot-hd .pico { font-size: 20px; }
.pslot-hd .ptitle { font-size: 13px; font-weight: 700; flex: 1; }
.pslot-hd .pstat { font-size: 12px; color: var(--gray3); font-weight: 600; }
.pslot-hd .pstat.ok { color: var(--green); }

.pslot-preview {
  position: relative;
  background: var(--gray1);
  display: none;
}
.pslot-preview img { width: 100%; max-height: 220px; object-fit: cover; display: block; }
.pslot-preview .del-btn {
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(0,0,0,.6);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pslot-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px;
}

/* Real clickable button-labels for file inputs */
.pbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid var(--gray2);
  background: var(--gray0);
  color: var(--gray5);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  text-align: center;
  line-height: 1;
  /* NO pointer-events block here */
}
.pbtn:active { opacity: .7; transform: scale(.97); }
.pbtn.cam { border-color: var(--blue); color: var(--blue); background: #f0f6ff; }
.pbtn.gal { border-color: #7c3aed; color: #7c3aed; background: #f5f3ff; }
/* The hidden file input sits absolutely on top, full size, fully transparent */
.pbtn-wrap { position: relative; overflow: hidden; border-radius: var(--radius-sm); }
.pbtn-wrap input[type=file] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 100px; /* force large hit area on iOS */
  z-index: 2;
}

/* ── Badges ── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.b-done     { background: var(--green-bg); color: var(--green); }
.b-progress { background: var(--orange-bg); color: var(--orange); }
.b-pending  { background: var(--red-bg); color: var(--red); }
.b-new      { background: #e0f2fe; color: #0369a1; }
.b-ok       { background: var(--green-bg); color: var(--green); }
.b-rev      { background: var(--orange-bg); color: var(--orange); }

/* ── Alert ── */
.alert {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid;
}
.alert-ok  { background: var(--green-bg); color: var(--green); border-color: #86efac; }
.alert-err { background: var(--red-bg); color: var(--red); border-color: #fca5a5; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 13px 22px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid transparent;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  text-decoration: none;
  transition: opacity .15s, transform .1s;
}
.btn:active { opacity: .8; transform: scale(.97); }
.btn-blue  { background: var(--blue); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-red   { background: var(--red); color: #fff; }
.btn-ghost { background: transparent; color: var(--gray5); border-color: var(--gray2); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-full { width: 100%; }

/* ── Fixed save bar ── */
.savebar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1px solid var(--gray2);
  padding: 12px 16px;
  display: flex;
  gap: 10px;
  z-index: 199;
  box-shadow: 0 -2px 12px rgba(0,0,0,.08);
}
.savebar .btn-blue { flex: 1; padding: 15px; font-size: 16px; border-radius: 12px; }
.savebar .btn-ghost { padding: 15px 16px; border-radius: 12px; }

/* ── Admin table ── */
.admin-wrap { max-width: 1100px; margin: 0 auto; padding: 16px 14px 40px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  background: var(--gray0);
  padding: 9px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray4);
  border-bottom: 2px solid var(--gray2);
}
table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--gray1); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tr:hover td { background: var(--gray0); }

.pbar { background: var(--gray2); border-radius: 20px; height: 7px; overflow: hidden; }
.pbar-fill { height: 100%; background: var(--green); border-radius: 20px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px,1fr)); gap: 10px; margin-bottom: 16px; }
.stat-card { background: #fff; border: 1px solid var(--gray2); border-radius: var(--radius-sm); padding: 14px; text-align: center; }
.stat-card .n { font-size: 28px; font-weight: 800; line-height: 1; }
.stat-card .l { font-size: 11px; color: var(--gray3); text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }
.n-green { color: var(--green); }
.n-orange { color: var(--orange); }
.n-red { color: var(--red); }
.n-blue { color: var(--blue); }

@media (max-width: 540px) {
  .row2 { grid-template-columns: 1fr; }
}
