* { box-sizing: border-box; }
body {
  margin: 0; background: #f2f5f9; color: #1c2733;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14.5px; line-height: 1.45;
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
header {
  background: linear-gradient(120deg, #0d4f8b, #1273c4);
  color: #fff; padding: 22px 0 18px; margin-bottom: 20px;
}
header h1 { margin: 0 0 4px; font-size: 21px; }
header p { margin: 0; opacity: .9; font-size: 13.5px; }

.card {
  background: #fff; border-radius: 10px; padding: 18px 20px;
  margin-bottom: 18px; box-shadow: 0 1px 3px rgba(15,40,70,.08);
}
.card h2 { margin: 0 0 12px; font-size: 16px; color: #0d4f8b; }
.hint { color: #5b6b7c; font-size: 13px; margin: 4px 0 10px; }

label { display: block; margin: 8px 0; font-weight: 600; font-size: 13px; color: #33475b; }
input, textarea, select {
  display: block; width: 100%; margin-top: 4px; padding: 7px 9px;
  border: 1px solid #c8d4e0; border-radius: 6px; font: inherit; font-weight: 400;
  background: #fbfdff;
}
input:focus, textarea:focus, select:focus { outline: 2px solid #1273c4; border-color: transparent; }
input[type="file"] { padding: 6px; background: #fff; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
@media (max-width: 720px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

details { margin: 10px 0; }
summary { cursor: pointer; font-weight: 600; color: #0d4f8b; font-size: 13.5px; }

.master-date { display: flex; align-items: end; gap: 10px; margin-bottom: 6px; }
.master-date label { flex: 0 0 220px; margin: 0; }

.btn {
  display: inline-block; border: 0; border-radius: 7px; cursor: pointer;
  font: inherit; font-weight: 600; padding: 9px 16px;
}
.btn.main { background: #0d4f8b; color: #fff; font-size: 15px; padding: 12px 22px; }
.btn.main:hover { background: #0a3f70; }
.btn.sec { background: #e3ecf5; color: #0d4f8b; }
.btn.sec:hover { background: #d2e1f0; }
.btn.danger { background: #fdecec; color: #b3261e; padding: 5px 9px; }
.btn:disabled { opacity: .55; cursor: wait; }

.tbl { width: 100%; border-collapse: collapse; margin: 8px 0; }
.tbl th { background: #eef3f9; font-size: 12px; color: #33475b; padding: 6px; border: 1px solid #d7e1ec; }
.tbl td { border: 1px solid #d7e1ec; padding: 3px; }
.tbl td input { border: 0; background: transparent; margin: 0; padding: 5px 6px; border-radius: 0; }
.tbl td input:focus { outline: 2px solid #1273c4; }
.tbl .num { width: 34px; text-align: center; color: #5b6b7c; }

.blok {
  border: 1px solid #d7e1ec; border-radius: 8px; padding: 12px 14px; margin: 12px 0;
  background: #fafcfe;
}
.blok-head { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.blok-head label { flex: 1 1 200px; margin: 0; }
.blok-head .btn { margin-bottom: 2px; }

.logsheet-holder { overflow-x: auto; margin-top: 8px; }
.logsheet { border-collapse: collapse; }
.logsheet th {
  background: #eef3f9; border: 1px solid #d7e1ec; font-size: 10.5px;
  padding: 3px 4px; color: #33475b; white-space: nowrap;
}
.logsheet td { border: 1px solid #d7e1ec; padding: 0; }
.logsheet td input, .logsheet td select {
  width: 58px; border: 0; background: transparent; margin: 0;
  padding: 5px 4px; font-size: 12.5px; border-radius: 0;
}
.logsheet td select { width: 72px; }
.logsheet td input:disabled { background: #eef1f5; }
.logsheet td input:focus { outline: 2px solid #1273c4; }

.foto-preview { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.foto-item { position: relative; width: 148px; }
.foto-item img { width: 148px; height: 100px; object-fit: cover; border-radius: 6px; border: 1px solid #c8d4e0; }
.foto-item .rm {
  position: absolute; top: -7px; right: -7px; width: 22px; height: 22px;
  border-radius: 50%; border: 0; background: #b3261e; color: #fff; cursor: pointer;
  font-size: 12px; line-height: 1;
}
.foto-item .cap-input { font-size: 11.5px; padding: 4px 6px; margin-top: 4px; }

.foto-group { border-top: 1px solid #e4ebf2; padding: 12px 0 6px; }
.foto-group:first-of-type { border-top: 0; }
.foto-group h3 { font-size: 13.5px; color: #33475b; margin: 0 0 8px; }

label.chk { display: flex; align-items: center; gap: 8px; font-weight: 600; }
label.chk input { width: auto; margin: 0; }

.doc-pick { border: 1px solid #d7e1ec; border-radius: 8px; padding: 9px 11px; margin: 5px 0; background: #fafcfe; }
.doc-pick label.chk { margin: 0 0 6px; font-size: 12.5px; }
.doc-pick small { color: #5b6b7c; font-weight: 400; }
.doc-pick .doc-date { margin-top: 0; }
.doc-pick.off { opacity: .55; }
.doc-pick.off .doc-date { background: #eef1f5; }

.btn.main.alt { background: #1273c4; }
.btn.main.alt:hover { background: #0d5a9c; }

.actions { display: flex; gap: 12px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
#status { margin-top: 10px; font-weight: 600; }
#status.ok { color: #146c2e; }
#status.err { color: #b3261e; }

/* ---- riwayat ---- */
.hist-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.hist-table th { text-align: left; background: #eef3f9; padding: 7px 8px; border-bottom: 2px solid #d7e1ec; color: #33475b; }
.hist-table td { padding: 7px 8px; border-bottom: 1px solid #e4ebf2; vertical-align: middle; }
.hist-table .aksi { display: flex; gap: 6px; flex-wrap: wrap; }
.hist-table .aksi .btn { padding: 4px 9px; font-size: 12px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; }
.badge.pdf { background: #e5f3e8; color: #146c2e; }
.badge.nopdf { background: #fdecec; color: #b3261e; }

/* ---- modal preview ---- */
.modal { position: fixed; inset: 0; background: rgba(12,25,40,.55); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 18px; }
.modal.hidden { display: none; }
.modal-box { background: #fff; border-radius: 12px; width: min(1100px, 100%);
  height: 92vh; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.35); }
.modal-head { display: flex; justify-content: space-between; align-items: center;
  gap: 10px; padding: 10px 16px; border-bottom: 1px solid #e4ebf2; flex-wrap: wrap; }
.modal-actions { display: flex; gap: 8px; align-items: center; }
.modal-actions .btn { padding: 7px 13px; font-size: 13px; text-decoration: none; }
#preview-frame { flex: 1; border: 0; width: 100%; background: #525659; }
