* { box-sizing: border-box; }
html { scrollbar-width: none; } /* posisi kop sama di halaman pendek dan panjang */
body { margin: 0; font: 15px/1.4 system-ui, "Segoe UI", Roboto, sans-serif; color: #17201a; background: #fff; }
input, select, button { font: inherit; }
input, select, button { min-height: 40px; padding: 6px 10px; border: 1px solid #b7c0ba; border-radius: 6px; background: #fff; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #1d4ed8; outline-offset: 2px; }
[hidden] { display: none !important; }
header { display: flex; justify-content: space-between; align-items: center; min-height: 56px; padding: 8px 16px; background: #14532d; color: #fff; }
header button { color: #17201a; }
#pesan { margin: 0; padding: 0 16px; font-weight: 600; }
#pesan:not(:empty) { padding: 10px 16px; background: #fef3c7; position: sticky; top: 0; z-index: 1; }
#masuk, main { max-width: 960px; margin: 0 auto; padding: 16px; }
#masuk { max-width: 360px; }
form label { display: grid; gap: 4px; margin-bottom: 12px; }
#masuk button, .utama { width: 100%; background: #14532d; border-color: #14532d; color: #fff; }
fieldset { margin: 0 0 12px; border: 1px solid #b7c0ba; border-radius: 6px; display: flex; flex-wrap: wrap; gap: 4px 16px; }
fieldset label { display: flex; align-items: center; gap: 6px; margin: 0; min-height: 40px; }
fieldset input { min-height: 0; width: 20px; height: 20px; }
#form-kavling, #form-bayar, #form-bebas, #unggah { max-width: 420px; }
button[type=reset] { width: 100%; margin-top: 8px; }
#unggah button { margin-bottom: 16px; }
td button { margin: 2px; }
#unggah input { max-width: 100%; }
#unggah img { max-width: 100%; max-height: 120px; justify-self: start; }
img:not([src]) { display: none !important; }
.kendali { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
nav { display: flex; gap: 4px; }
nav [aria-current] { background: #14532d; border-color: #14532d; color: #fff; }
.kendali label { display: flex; align-items: center; gap: 8px; }
h1 { font-size: 1.15rem; } h2 { font-size: 1rem; margin-top: 28px; }
.gulir { overflow-x: auto; }
#angkut .kop, .kaki, .cetak-saja { display: none; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { border: 1px solid #cdd4cf; padding: 5px 8px; text-align: left; }
.angka { text-align: right; }
td input { width: 100%; min-width: 140px; }
.no { font-weight: 700; white-space: nowrap; }
.merah { background: #e11d1d; color: #fff; }
.hijau { background: #4ade80; }
.biru { background: #67e8f9; }
.kosong { background: #f3c4bd; }
.batal td { color: #6b7280; text-decoration: line-through; }
.petak { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; padding: 0; list-style: none; }
.petak li { border: 1px solid #cdd4cf; border-radius: 4px; padding: 8px 4px; text-align: center; font-weight: 700; }
#rekap td small { display: block; }
#bebas td { overflow-wrap: anywhere; }

@media (max-width: 600px) {
  nav { width: 100%; } nav button { flex: 1; padding: 6px 2px; }
  #rekap table { font-size: 11px; }
  #rekap th, #rekap td { padding: 3px; overflow-wrap: anywhere; }
  #kavling table { font-size: 12px; }
  #kavling th, #kavling td { padding: 3px; overflow-wrap: anywhere; }
  #kavling td input { min-width: 0; padding: 4px; }
  #kavling td button { padding: 4px 6px; }
  #kavling th:nth-child(2) { width: 46%; }
}
@page { size: A4 portrait; margin: 10mm; }
@page mendatar { size: A4 landscape; margin: 10mm; }
@media print {
  header, .kendali, #pesan, .cetak, .layar, section > h1 { display: none !important; }
  body { font: 11px/1.35 Arial, Helvetica, sans-serif; color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  main { max-width: none; padding: 0; }
  div.cetak-saja { display: grid; }
  span.cetak-saja { display: inline; }
  strong.cetak-saja, li.cetak-saja { display: flex; }
  tr.cetak-saja { display: table-row; }
  img.cetak-saja { display: block; }
  .gulir { overflow: visible; }
  #angkut { page: mendatar; }
  .kop, #angkut .kop { display: flex; justify-content: space-between; align-items: center; gap: 8mm; border-bottom: 1px solid #000; padding-bottom: 3mm; margin-bottom: 3mm; }
  .kop img[data-berkas="kop"] { width: 55%; max-height: 26mm; object-fit: contain; object-position: left; }
  .kop img[data-berkas="label"] { width: 30%; max-height: 22mm; object-fit: contain; object-position: right; margin-left: auto; }
  .judul { display: grid; justify-items: center; margin-bottom: 4mm; font-weight: 400; }
  .judul strong { font-size: 14px; }
  #angkut .judul strong { font-size: 18px; }
  .lembar { display: flex; border: solid #000; border-width: 1px 0 0 1px; }
  .lembar > strong { align-items: center; justify-content: center; width: 38mm; font-size: 18px; border: solid #000; border-width: 0 1px 1px 0; }
  .petak { flex: 1; grid-template-columns: repeat(20, 1fr); gap: 0; margin: 0; }
  .petak li { border: solid #000; border-width: 0 1px 1px 0; border-radius: 0; padding: 3mm 0; font-size: 18px; justify-content: center; }
  .petak .ujung { grid-column: span 6; align-items: center; }
  .kaki { display: block; break-inside: avoid; margin-top: 3mm; }
  .tempat { text-align: right; font-weight: 700; margin: 0 20mm 2mm 0; }
  .kaki > div { display: flex; justify-content: space-between; align-items: flex-start; }
  .kaki img { width: 38%; max-height: 42mm; object-fit: contain; object-position: right top; }
  .legenda { display: grid; grid-template-columns: 35% 12% 1fr; width: 50%; border: solid #000; border-width: 1px 0 0 1px; text-align: center; font-weight: 700; }
  .legenda > * { display: flex; align-items: center; justify-content: center; min-height: 10mm; border: solid #000; border-width: 0 1px 1px 0; }
  .legenda strong { grid-row: span 2; }
  th, td { border-color: #000; padding: 1.5px 5px; }
  thead .cetak-saja td { border: 0; padding: 0; }
  #rekap table { font-size: 9.5px; }
  #rekap td { white-space: nowrap; }
  tbody tr { break-inside: avoid; }
}
