* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f5f6f8;
  color: #1f2430;
  margin: 0;
  padding: 24px 12px;
}
.container { max-width: 1100px; margin: 0 auto; }
.container.narrow { max-width: 380px; margin-top: 60px; }
.container.cards { max-width: 1100px; }

body.halaman-gelap {
  background: #262626;
}
body.halaman-gelap h1,
body.halaman-gelap .topbar a,
body.halaman-gelap .summary {
  color: #f3f4f6;
}
body.halaman-gelap .topbar a { color: #93c5fd; }
body.halaman-gelap .filter-form {
  background: #fff;
}
.topbar { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
h1 { font-size: 1.5rem; margin: 0 0 8px; }
h2 { font-size: 1.1rem; margin-top: 32px; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
.notice { background: #dcfce7; color: #166534; padding: 10px 14px; border-radius: 8px; }
.error, ul.error { background: #fee2e2; color: #991b1b; padding: 10px 14px; border-radius: 8px; list-style: none; margin: 0; }
.grid-form, .filter-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  background: #fff;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
}
.filter-form { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); align-items: end; }
label { display: flex; flex-direction: column; font-size: 0.85rem; color: #4b5563; gap: 4px; }
.full { grid-column: 1 / -1; }
input {
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.95rem;
  background: #fff;
  color: #1f2430;
}
button {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}
button:hover { background: #1d4ed8; }
.button-link {
  display: inline-block;
  padding: 9px 14px;
  border: 1px solid #2563eb;
  border-radius: 6px;
  color: #2563eb;
  align-self: end;
}
.summary { margin: 14px 0; color: #374151; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; margin-top: 8px; }
th, td { padding: 8px 10px; border-bottom: 1px solid #e5e7eb; text-align: left; font-size: 0.9rem; }
th { background: #f3f4f6; }
.link-danger { background: none; color: #dc2626; border: none; cursor: pointer; padding: 0; font-size: 0.85rem; }
.link-danger:hover { text-decoration: underline; }
.subtitle { color: #4b5563; margin-top: -4px; }
.label-mandiri { display: block; font-size: 0.85rem; color: #4b5563; margin-bottom: 4px; }
.hint { font-size: 0.78rem; color: #6b7280; margin: -6px 0 0; }
.link-bawah { margin-top: 18px; text-align: center; }

/* Halaman depan: pilih jenis transaksi */
.pilihan-jenis {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}
.kartu-pilihan {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px 18px;
  color: inherit;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.kartu-pilihan:hover, .kartu-pilihan:active {
  background: #f3f4f6;
  border-color: #2563eb;
  text-decoration: none;
}
.kartu-pilihan-judul { font-weight: 700; font-size: 1rem; color: #1f2430; }
.kartu-pilihan-desc { font-size: 0.85rem; color: #6b7280; }

/* Badge jenis di kartu laporan */
.kartu-atas {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.badge-jenis {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-keluar { background: #dbeafe; color: #1e40af; }
.badge-masuk { background: #dcfce7; color: #166534; }
.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; border: 1px solid #e5e7eb; }
button:disabled { background: #9ca3af; cursor: not-allowed; }
select {
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.95rem;
  background: #fff;
  color: #1f2430;
}
a.button-link.full { display: block; text-align: center; margin-bottom: 8px; }

/* Laporan: tampilan kartu satu baris per laporan */
.kartu-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 14px;
}
.kartu {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  padding: 18px 20px;
}
.kartu-waktu {
  font-size: 0.78rem;
  color: #9ca3af;
}
.kartu-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 32px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 110px;
}
.field-label {
  font-weight: 700;
  font-size: 0.9rem;
  color: #1f2430;
}
.field-value {
  font-size: 0.92rem;
  color: #374151;
  word-break: break-word;
}
.kartu-galeri { margin-top: 16px; }
.kartu-media-label {
  display: block;
  font-size: 0.72rem;
  color: #9ca3af;
  margin-bottom: 8px;
}
.kartu-galeri-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.kartu-foto-tombol {
  flex: 0 0 auto;
  width: 110px;
  height: 110px;
  padding: 0;
  border: none;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  cursor: zoom-in;
  line-height: 0;
}
.kartu-foto {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.kartu-foto-kosong {
  flex: 0 0 auto;
  width: 110px;
  height: 110px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  background: #e5e7eb;
  font-size: 0.75rem;
  text-align: center;
  padding: 8px;
}
.kosong { text-align: center; color: #d1d5db; margin-top: 24px; }

@media (max-width: 640px) {
  .kartu { padding: 16px; }
  .kartu-fields {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0;
  }
  .field {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    padding: 7px 0;
    border-bottom: 1px solid #f3f4f6;
  }
  .field:last-child { border-bottom: none; }
  .field-label { flex: 0 0 auto; }
  .field-value { text-align: right; }
  .kartu-galeri-list { justify-content: center; }
}

/* Modal lihat foto penuh */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}
.modal[hidden] { display: none; }
.modal img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  background: #fff; /* supaya tanda tangan (PNG transparan) tetap terlihat jelas */
}
.modal-tutup {
  position: fixed;
  top: 14px;
  right: 18px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  z-index: 101;
}
.modal-tutup:hover { background: rgba(255, 255, 255, 0.3); }
