/* Generator cetak foto: gaya khusus tools ini.
   Token (--color-*, --radius-*, --control-h) & font dari index.css (MIG UI v1).
   Tampilan mengikuti Kasir SMK Fase 2: segmen & chip aktif ungu, label kecil. */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0;
  font: 14px/1.4 var(--font-sans);
  font-variant-numeric: tabular-nums;
  background: var(--color-page);
  color: var(--color-ink);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
button, input, select { font: inherit; }
:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ===== Tombol (.btn / .btn.pri) ===== */
.mig-btn {
  height: var(--control-h);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 20px;
  border: 1px solid var(--color-brand);
  border-radius: 999px;
  background: var(--color-brand);
  color: #fff;
  font-size: 16px; font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.mig-btn:hover { background: var(--color-brand-hover); border-color: var(--color-brand-hover); }
.mig-btn--secondary { background: var(--color-surface); border-color: var(--color-line); color: var(--color-ink); font-size: 14px; box-shadow: none; }
.mig-btn--secondary:hover { background: var(--color-page); border-color: var(--color-line); }
.mig-btn--lg { height: 52px; min-height: 52px; font-weight: 600; }
.mig-btn--block { width: 100%; }
.pri { margin-top: 8px; }

/* Tombol ikon bulat (.iconbtn) */
.ic {
  width: var(--control-h); height: var(--control-h);
  border: 0; border-radius: 999px;
  background: var(--color-page);
  color: var(--color-ink);
  font-size: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; flex: none;
}
.ic:hover { background: var(--color-line); }
.ic--del { font-size: 13px; }

/* Tombol bahaya tanpa latar (.btn.dng) */
.lnk {
  height: var(--control-h);
  border: 0; background: transparent;
  color: var(--color-danger-fg);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
}

/* ===== Kartu & teks ===== */
.card { background: var(--color-surface); border-radius: 32px; padding: 24px; }
.step { display: flex; flex-direction: column; gap: 16px; }
.st { font-size: 16px; font-weight: 700; }
.hint { font-size: 12px; color: var(--color-muted); margin: 0; }
.mig-badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px;
  border-radius: 999px;
  background: var(--color-brand-soft);
  color: var(--color-brand);
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
}

/* ===== Form (.lbl / .inp) ===== */
.fld { display: flex; flex-direction: column; gap: 8px; }
.lab { font-size: 11px; font-weight: 600; color: var(--color-muted); }
.mig-input {
  width: 100%;
  height: var(--control-h);
  padding: 0 20px;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-ink);
  font-size: 14px;
}
.mig-input:focus { outline: none; border: 1.5px solid var(--color-brand); box-shadow: none; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.three .mig-input { padding: 0 16px; }

/* Pilihan Mode / Isi foto / Posisi = segmen (.seg.g) */
.mig-choice {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 4px;
  border-radius: 24px;
  background: var(--color-page);
}
.mig-choice button {
  flex: 1 1 auto;
  height: 40px;
  padding: 0 14px;
  border: 0; border-radius: 999px;
  background: transparent;
  color: var(--color-ink);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.mig-choice button:hover { background: var(--color-surface); }
.mig-choice button[aria-checked=true] { background: var(--color-brand); color: #fff; }

/* Chip jumlah (.chip / .chip.on) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.mig-chip {
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--color-line); border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-ink);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
}
.mig-chip.is-active { background: var(--color-brand); border-color: var(--color-brand); color: #fff; }

.chk { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--color-ink); min-height: var(--control-h); cursor: pointer; }
.chk input { accent-color: var(--color-brand); width: 18px; height: 18px; }

summary {
  cursor: pointer;
  list-style: none;
  font-size: 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "";
  width: 8px; height: 8px; flex: none;
  border-right: 1.8px solid var(--color-muted); border-bottom: 1.8px solid var(--color-muted);
  transform: rotate(45deg) translateY(-3px);
}
details[open] summary { margin-bottom: 16px; }
details[open] summary::after { transform: rotate(-135deg) translateY(-3px); }
.adv { display: flex; flex-direction: column; gap: 16px; }

/* ===== Upload (gaya .chip.add) ===== */
.drop {
  border: 1px dashed var(--color-brand);
  background: var(--color-brand-soft);
  border-radius: 24px;
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  color: var(--color-brand);
  font-weight: 600;
}
.drop svg { display: block; margin: 0 auto 6px; width: 24px; height: 24px; }
.drop small { display: block; color: var(--color-muted); font-weight: 400; font-size: 12px; margin-top: 2px; }

.rows { max-height: 220px; overflow: auto; display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.prow { display: grid; grid-template-columns: 44px 40px minmax(0, 1fr) 44px; gap: 8px; align-items: center; font-size: 12px; color: var(--color-muted); }
.prow img { width: 44px; height: 44px; object-fit: cover; border-radius: 16px; }
.prow .mig-input { padding: 0 14px; font-size: 13px; }

.kcv { width: 100%; display: block; margin: 0 auto; border-radius: 24px; background: var(--color-page); touch-action: none; cursor: crosshair; }
.krow { display: flex; gap: 8px; flex-wrap: wrap; }
.krow .mig-btn { flex: 1; padding: 0 12px; font-size: 13px; }

/* ===== Layout ===== */
.app { display: grid; grid-template-columns: 420px minmax(0, 1fr); height: 100dvh; }
aside { display: flex; flex-direction: column; min-height: 0; background: var(--color-page); }
.head { display: flex; align-items: center; gap: 12px; padding: 20px 16px 12px; }
.logo { width: 44px; height: 44px; object-fit: contain; flex: none; border-radius: 999px; }
h1 { font-size: 20px; font-weight: 700; margin: 0; line-height: 1.25; }
.side { flex: 1; min-height: 0; overflow: auto; padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 12px; scrollbar-width: none; }

/* Ringkasan + tombol cetak (.foot) */
.foot { background: var(--color-surface); border-top: 1px solid var(--color-line); padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 4px; }
.sum { display: flex; justify-content: space-between; font-size: 13px; color: var(--color-muted); }
.sum b { color: var(--color-ink); font-weight: 600; }
.note { margin: 0; color: var(--color-danger-fg); font-size: 12px; }
.note:empty { display: none; }

main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--color-page); }
/* Bar atas (.topbar) */
.bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 24px; flex-wrap: wrap; background: var(--color-surface); }
.bl, .br { display: flex; align-items: center; gap: 12px; }
#zv { min-width: 40px; text-align: center; font-size: 13px; color: var(--color-muted); }
.stage { flex: 1; min-height: 0; overflow: auto; padding: 24px; }
#pages { display: flex; flex-direction: column; align-items: center; gap: 24px; }
.page { position: relative; background: #fff; flex: none; }
.cell { position: absolute; overflow: hidden; background: #fff; }
.cell img { width: 100%; height: 100%; display: block; }
.page svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 12px 16px; font-size: 13px; color: var(--color-muted); background: var(--color-surface); }

/* HP: satu kolom, ringkasan + tombol cetak menempel di bawah */
aside { display: contents; }
@media (min-width: 821px) { aside { display: flex; } }
@media (max-width: 820px) {
  .app { display: flex; flex-direction: column; height: auto; }
  .head { order: 1; }
  .side { order: 2; overflow: visible; }
  main { order: 3; height: auto; }
  .foot { order: 4; position: sticky; bottom: 0; z-index: 5; }
  .stage { height: 70vh; padding: 16px; }
  .bar { padding: 12px 16px; }
}

@media print {
  .app { display: block; height: auto; }
  aside, .bar, .pager, .head, .side, .foot { display: none; }
  body, main { background: #fff; display: block; height: auto; padding: 0; }
  .stage { overflow: visible; padding: 0; }
  #pages { zoom: 1 !important; display: block; }
  .page { break-after: page; }
  .page:last-child { break-after: auto; }
  .cell.empty, .ghost { display: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
