:root {
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
  --ink: #0e1b26;
  --muted: #4a5b69;
  --navy: #0f2f4a;
  --navy-2: #1a4568;
  --green: #0b7a5a;
  --green-d: #076048;
  --blue: #1b63c4;
  --blue-soft: #dcebfc;
  --blue-head: #bcd7f6;
  --blue-line: #7fa9de;
  --white-line: #9db3a8;
  --page: #e9eef3;
  --danger: #b3261e;
  color: var(--ink);
  background: var(--page);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--page);
  color: var(--ink);
  line-height: 1.4;
}

button, input { font: inherit; }
button { cursor: pointer; }

:focus-visible { outline: 3px solid #f2b705; outline-offset: 2px; }

/* ---------- Header ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px max(20px, calc((100% - 1120px) / 2));
  color: #fff;
  background: var(--navy);
  border-bottom: 5px solid var(--green);
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  font-size: 24px;
  font-weight: 800;
}

.topbar h1 { margin: 2px 0 0; font-size: 23px; letter-spacing: .2px; }
.topbar h1 span { color: #b9d6ee; font-size: 15px; font-weight: 500; }

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .3px;
}
.topbar .eyebrow { color: #b9d6ee; }

/* ---------- Layout ---------- */
.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 24px auto 40px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  background: #fff;
  border: 2px solid var(--navy-2);
  border-radius: 14px;
}

.date-control {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  margin-top: 8px;
  color: var(--green-d);
  font-size: 22px;
}

.date-control input {
  width: 180px;
  height: 46px;
  padding: 8px 12px;
  border: 2px solid #5d7386;
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  font-weight: 650;
}

.hint { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 18px;
  border: 2px solid transparent;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 750;
  transition: background .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }

.btn-primary { color: #fff; background: var(--green); border-color: var(--green-d); }
.btn-primary:hover { background: var(--green-d); }
.btn-primary:disabled { opacity: .65; cursor: wait; }

.btn-secondary { color: var(--navy); background: #fff; border-color: var(--navy-2); }
.btn-secondary:hover { background: #dfe9f2; }

.btn-upload {
  min-height: 48px;
  color: #fff;
  background: var(--navy);
  border-color: var(--navy);
  font-size: 15px;
  cursor: pointer;
}
.btn-upload:hover { background: var(--navy-2); }

/* ---------- Summary ---------- */
.summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.summary > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: #fff;
  border: 2px solid var(--navy-2);
  border-radius: 12px;
}
.summary small { color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .4px; }
.summary strong { color: var(--navy); font-size: 26px; font-variant-numeric: tabular-nums; }

/* ---------- Report cards (selang-seling putih / biru) ---------- */
.rows { display: grid; gap: 18px; }

.report-card {
  overflow: hidden;
  border: 2px solid var(--white-line);
  border-left-width: 10px;
  border-radius: 14px;
}

.row-white { background: #ffffff; border-color: var(--green); }
.row-white .card-head { background: #e3f3ec; border-bottom: 2px solid #9fd0bd; }
.row-white .row-number { background: var(--green); }
.row-white .step-dot { background: var(--green); }

.row-blue { background: var(--blue-soft); border-color: var(--blue); }
.row-blue .card-head { background: var(--blue-head); border-bottom: 2px solid var(--blue-line); }
.row-blue .row-number { background: var(--blue); }
.row-blue .step-dot { background: var(--blue); }
.row-blue .docs-section { border-bottom-color: var(--blue-line); }
.row-blue .empty-photos { background: #eef5fd; border-color: var(--blue-line); }
.row-blue .photo-item { background: #fff; border-color: var(--blue-line); }

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 16px;
}

.row-number {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  color: #fff;
  border-radius: 9px;
  font-size: 16px;
  font-weight: 800;
}

.card-head h3 { flex: 1; margin: 0; font-size: 16px; font-weight: 750; }

.remove-row, .remove-photo {
  display: grid;
  place-items: center;
  border: 2px solid var(--danger);
  border-radius: 9px;
  color: var(--danger);
  background: #fff;
  line-height: 1;
}
.remove-row { width: 44px; height: 44px; font-size: 26px; }
.remove-row:hover, .remove-photo:hover { color: #fff; background: var(--danger); }

.entry-content { padding: 16px; }

.step-title { display: flex; align-items: center; gap: 8px; font-size: 16px; color: var(--ink); }
.step-dot {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

/* ---------- Dokumentasi (di atas) ---------- */
.docs-section {
  padding-bottom: 18px;
  border-bottom: 2px dashed var(--white-line);
}

.docs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.docs-head p { margin: 6px 0 0; }
.photo-total { color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.photo-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.empty-photos {
  grid-column: 1 / -1;
  padding: 22px 16px;
  color: var(--muted);
  background: #f3f7f5;
  border: 2px dashed var(--white-line);
  border-radius: 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
}

.photo-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  background: #f3f7f5;
  border: 2px solid var(--white-line);
  border-radius: 10px;
}
.photo-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  background: #d9e1e6;
}
.photo-item small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.remove-photo {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  font-size: 22px;
}

/* ---------- Data laporan ---------- */
.data-section { padding-top: 16px; }

.fields {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr 1.2fr;
  gap: 12px;
  margin-top: 12px;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field span { color: var(--ink); font-size: 13px; font-weight: 750; }
.field input {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 8px 12px;
  color: var(--ink);
  background: #fff;
  border: 2px solid #5d7386;
  border-radius: 10px;
  font-size: 16px; /* cegah zoom otomatis di iOS */
  outline: none;
}
.field input::placeholder { color: #7a8a97; }
.field input:focus, .date-control input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px #1b63c42e;
}
.field-wide { grid-column: 1 / -1; }

.add-row-wrap { display: flex; justify-content: center; margin: 22px 0; }
.add-row-wrap .btn { width: min(420px, 100%); }

footer {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 18px max(20px, calc((100% - 1120px) / 2));
  color: #c6d9e8;
  background: var(--navy);
  font-size: 12px;
}

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  body { padding-bottom: 88px; }
  .topbar { padding: 16px 16px; }
  .shell { width: calc(100% - 20px); margin-top: 12px; }
  .toolbar { flex-direction: column; align-items: stretch; padding: 14px; }
  .date-control { width: 100%; }
  .date-control input { flex: 1; width: auto; font-size: 16px; }

  /* Tombol export menempel di bawah layar */
  .toolbar-actions {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 20;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: #fff;
    border-top: 3px solid var(--navy);
    box-shadow: 0 -4px 14px #0f2f4a30;
  }
  .toolbar-actions .btn { width: 100%; min-height: 52px; font-size: 16px; }

  .fields { grid-template-columns: 1fr 1fr; }
  .entry-content { padding: 12px; }
  .card-head { padding: 8px 12px; }
  .report-card { border-left-width: 8px; }
  footer { padding: 14px 14px; }
}

@media (max-width: 480px) {
  .docs-head { flex-direction: column; align-items: stretch; }
  .btn-upload { width: 100%; min-height: 52px; }
  .photo-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fields { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .summary { gap: 8px; }
  .summary > div { padding: 10px 12px; }
  .summary strong { font-size: 22px; }
  footer { flex-direction: column; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
