/*
 * Layar pembeli ala ESB (layar.js, 2026-10-16) — token yang sama dengan style.css dan
 * pos/DESIGN.md: flat tanpa bayangan, permukaan putih bergaris rambut, satu aksen emerald
 * (ikut warna tema toko lewat --primary). Bilah tab, layar penuh (pesanan & cari), lembar
 * kategori, baris pesanan, kartu ringkasan, modal sukses, kartu bill tab Pesanan.
 */

/* --- Bilah tab bawah: Menu | Pesanan --- */
:root { --tabbar: 0px; }
body.bertab { --tabbar: calc(60px + env(safe-area-inset-bottom)); }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; height: var(--tabbar); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--hairline); }
.tabbar__inner { max-width: 640px; margin: 0 auto; height: 60px; display: flex; }
.tabbar__item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; background: none;
  color: var(--body); font-size: 12px; line-height: 16px; font-weight: 500; cursor: pointer; padding: 0; }
.tabbar__item[aria-current="page"] { color: var(--primary-text); font-weight: 600; }
.tabbar__item[aria-current="page"] .ikon { color: var(--primary); }
.tabbar__ikon { position: relative; display: grid; }
.tabbar__lencana { position: absolute; top: -6px; left: 15px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--primary); color: #fff; font-size: 11px; line-height: 18px; font-weight: 700; text-align: center; }
.tabbar__lencana:empty { display: none; }
/* Halaman yang bertab: isi dan bilah keranjang naik setinggi bilah tab. */
body.bertab .page { padding-bottom: calc(104px + var(--tabbar)); }
body.bertab .page:has(.cartbar__ajakan) { padding-bottom: calc(132px + var(--tabbar)); }
body.bertab .page:has(.cartbar .saran) { padding-bottom: calc(212px + var(--tabbar)); }
body.bertab .page:has(.cartbar .saran):has(.cartbar__ajakan) { padding-bottom: calc(240px + var(--tabbar)); }
body.bertab .cartbar { bottom: var(--tabbar); padding-bottom: 12px; }

/* --- Toolbar: tombol cari (membuka layar cari) & pemilih kategori --- */
.cari-tombol { flex: 1 1 160px; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--outline); border-radius: 10px; background: var(--surface); color: var(--muted); font-size: 16px; text-align: left; cursor: pointer; }
.cari-tombol .ikon { color: var(--body); flex: none; }
.cari-tombol span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kategori-pilih { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; margin-top: 10px;
  padding: 8px 12px; border: 1px solid var(--hairline); border-radius: 10px; background: var(--surface); color: var(--primary-text);
  font-weight: 600; font-size: 15px; text-align: left; cursor: pointer; }
.kategori-pilih__teks { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kategori-pilih .ikon { flex: none; color: var(--body); }

/* --- Lembar kategori: baris penuh, yang aktif terisi emerald bercentang (isi = tepi) --- */
.kategori__judul { font-size: 18px; line-height: 24px; font-weight: 700; margin: 0 0 12px; }
.kategori__daftar { display: grid; gap: 8px; }
.kategori__baris { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; padding: 12px 16px;
  border: 1px solid var(--hairline); border-radius: 12px; background: var(--surface); color: var(--ink); font-weight: 600; font-size: 15px;
  line-height: 20px; text-align: left; cursor: pointer; }
.kategori__baris[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.kategori__baris .ikon { flex: none; }

/* --- Lembar: bilah atas lengket (pegangan + ×) berlatar padat. Uji HP 2026-10-16: tombol ×
   yang mengambang menutupi "Wajib pilih 1" saat lembar digulir — kini isi lewat DI BAWAH
   bilah, tidak pernah tertimpa tombol. Bilah dan kaki melekat ke TEPI lembar (sticky diinset
   padding wadah gulir: top −8px, bottom −16px), tanpa celah tempat isi mengintip. --- */
.sheet { position: relative; }
.sheet__atas { position: sticky; top: -8px; z-index: 3; display: flex; align-items: center; justify-content: flex-end; height: 52px;
  margin: -8px -16px 0; padding: 0 10px; background: var(--surface); }
.sheet__foot { bottom: calc(-16px - env(safe-area-inset-bottom)); }
.sheet__atas .sheet__grip { position: absolute; left: 50%; top: 8px; margin: 0; transform: translateX(-50%); }
.sheet__tutup { flex: none; display: grid; place-items: center; width: 40px; height: 40px; margin: 0;
  border: 1px solid var(--hairline); border-radius: 50%; background: var(--surface); color: var(--ink); cursor: pointer; padding: 0; }
.sheet__photo--kosong { aspect-ratio: 3 / 1; background: var(--primary-soft); color: var(--primary-text); display: grid; place-items: center;
  font-size: 40px; font-weight: 700; }

/* --- Layar penuh (tab Pesanan, cari): kepala, badan bergulir, kaki lengket --- */
.layar { position: fixed; inset: 0; z-index: 8; background: var(--canvas); display: flex; flex-direction: column; }
.layar__atas { flex: none; display: flex; align-items: center; gap: 4px; min-height: 56px; padding: 6px 8px; background: var(--surface); border-bottom: 1px solid var(--hairline); }
.layar__atas-inner { width: 100%; max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: 4px; }
.layar__kembali { flex: none; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 12px; background: none; color: var(--ink); cursor: pointer; }
.layar__judul { flex: 1; min-width: 0; font-size: 18px; line-height: 24px; font-weight: 600; text-align: center; margin-right: 44px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* `tengah` membungkus badan supaya pil "Gulir ke bawah" selalu tepat di atas kaki, berapa pun
   tinggi kakinya (di HP 320 px tombol kirim turun ke baris sendiri). */
.layar__tengah { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.layar__badan { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.layar__kolom { max-width: 640px; margin: 0 auto; padding-bottom: 24px; }
.layar__bawah { flex: none; background: var(--surface); border-top: 1px solid var(--hairline); padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); }
.layar__bawah-inner { max-width: 608px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.layar__total-blok { flex: 1 1 120px; min-width: 0; }
.layar__total-label { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--body); }
.layar__total { font-size: 20px; line-height: 26px; font-weight: 700; white-space: nowrap; }
.layar__ket { font-size: 12px; line-height: 16px; color: var(--muted); }
.layar__ket:empty { display: none; }
/* Tombol di sebelah total selama muat; "Kirim lewat WhatsApp" di HP sempit turun selebar bilah. */
.layar__bawah .btn { flex: 1 1 10em; min-height: 52px; min-width: 0; }
.layar .saran { margin: 12px 16px 0; }
.layar .saran__daftar { margin: 0; padding: 0; }
.layar .field, .layar .notice, .layar .error, .layar .captcha--tampil, .layar .promo-ajakan, .layar > .small { margin-left: 16px; margin-right: 16px; }
.layar .error:empty { display: none; }
.layar__isian { padding: 4px 16px 0; }
.layar__isian .field { margin-left: 0; margin-right: 0; }
.layar__isian .notice { margin-left: 0; margin-right: 0; }
.layar__isian .error { margin: 12px 0 0; }
.layar__isian .promo-ajakan { margin-left: 0; margin-right: 0; }
.layar__isian > .small { margin: 12px 0 0; }
/* "Gulir ke bawah" — pil gelap di atas kaki, hanya selama isian pemesan masih di bawah layar
   (`tampilGulir`, IntersectionObserver). Hanya pil itu sendiri yang menerima ketukan. Layar
   pendek (HP mendatar): tanpa pil — ia menutupi seperlima isi yang terlihat. */
.gulir { position: absolute; left: 50%; transform: translateX(-50%); bottom: 12px; z-index: 2; pointer-events: auto;
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 0; border-radius: 999px; background: var(--ink); color: #fff;
  font-size: 14px; line-height: 20px; font-weight: 600; cursor: pointer; }
.gulir[hidden] { display: none; }
@media (max-height: 520px) { .gulir { display: none; } }
/* Toast di atas kaki layar penuh dan pil gulir (nilai di elemen menang atas yang diwariskan body). */
.toast--layar { --toast-bottom: 224px; --tabbar: 0px; }

/* --- Tab Pesanan (keranjang): kepala "Pesanan (N) · Tambah item", baris, stepper --- */
.pesanan__kepala { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 16px 16px 8px; }
.pesanan__judul { font-size: 18px; line-height: 24px; font-weight: 700; }
.pesanan__tambah { flex: none; min-height: 40px; padding: 6px 12px; border: 1.5px solid var(--primary); border-radius: 10px; background: var(--surface);
  color: var(--primary-text); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; }
.pesanan__daftar { margin: 0 16px; background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px; padding: 0 14px; }
.baris { padding: 12px 0; border-top: 1px solid var(--hairline); }
.baris:first-child { border-top: 0; }
.baris__kepala { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.baris__nama { flex: 1; min-width: 0; font-weight: 600; font-size: 15px; line-height: 20px; padding-top: 2px; overflow-wrap: anywhere; }
.baris__ubah { flex: none; display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 4px 12px; margin-top: -4px;
  border: 1px solid var(--hairline); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600; cursor: pointer; }
.baris__ubah .ikon { color: var(--body); }
.baris__sub { color: var(--body); font-size: 13px; line-height: 18px; margin-top: 2px; }
.baris__catatan { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 13px; line-height: 18px; color: var(--body); }
.baris__catatan .ikon { flex: none; color: var(--muted); }
.baris__catatan span { min-width: 0; overflow-wrap: anywhere; }
.baris__catatan--kosong { color: var(--muted); font-style: italic; }
.baris__kaki { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }
.baris__harga { font-weight: 700; font-size: 15px; line-height: 20px; }
.baris__harga--promo { display: flex; flex-direction: column; }
.baris__harga--promo > span { color: var(--primary-text); }
.baris__harga .harga-lama--baris { margin: 0; }
.baris .stepper { flex: none; }

/* --- Kartu ringkasan: Subtotal · Promo · Biaya lain ▾ · Ongkir · Pembulatan · Total --- */
.ringkasan { margin: 12px 16px 0; background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px; padding: 12px 16px 10px; }
.ringkasan__judul { font-size: 16px; line-height: 22px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.ringkasan__baris { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px dashed var(--hairline); font-size: 15px; line-height: 20px; }
.ringkasan__baris > span:last-child { white-space: nowrap; font-variant-numeric: tabular-nums; }
.ringkasan__judul + .ringkasan__baris { border-top: 0; }
.ringkasan__baris--promo { color: var(--primary-text); font-weight: 600; }
.ringkasan__baris--total { font-weight: 700; font-size: 17px; line-height: 22px; }
.ringkasan__lain > summary { list-style: none; cursor: pointer; }
.ringkasan__lain > summary::-webkit-details-marker { display: none; }
.ringkasan__lipat { display: inline-flex; align-items: center; gap: 4px; }
.ringkasan__lipat .ikon { color: var(--body); transition: transform .15s; }
.ringkasan__lain[open] .ringkasan__lipat .ikon { transform: rotate(180deg); }
.ringkasan__rinci { padding-bottom: 4px; }
.ringkasan__rinci .ringkasan__baris { padding: 3px 0 3px 12px; border-top: 0; font-size: 14px; line-height: 18px; color: var(--body); }
.ringkasan__catatan { margin-top: 6px; font-size: 13px; line-height: 18px; color: var(--body); }
/* Rincian di dalam kartu pesanan (tab Pesanan sesudah terkirim): baris yang sama tanpa kartu. */
.ringkasan--polos { margin: 4px 0 0; border: 0; border-radius: 0; padding: 0; }
.ringkasan--polos > .ringkasan__baris:first-child { border-top: 1px solid var(--hairline); }

/* --- Layar cari: kotak cari di kepala, baris menu dengan tombol "Tambah" bergaris --- */
.cari__kotak { position: relative; flex: 1; min-width: 0; }
.cari__kotak .ikon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--body); pointer-events: none; }
.cari__input { width: 100%; height: 44px; border: 1px solid var(--outline); border-radius: 10px; background: var(--surface); padding: 0 12px 0 40px; font-size: 16px; }
.cari__input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.cari__input::-webkit-search-cancel-button { -webkit-appearance: none; }
.cari__hasil { background: var(--surface); }
.cari__baris { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--hairline); }
.cari__buka { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.cari__buka:disabled { cursor: default; }
.cari__baris--off .cari__foto { filter: grayscale(1); opacity: .55; }
.cari__baris--off .cari__nama, .cari__baris--off .cari__harga { color: var(--body); }
.cari__foto { width: 56px; height: 56px; border-radius: 10px; flex: none; object-fit: cover; background: var(--disabled); display: grid; place-items: center; color: var(--muted); font-weight: 700; font-size: 16px; }
.cari__foto--kosong { background: var(--primary-soft); color: var(--primary-text); }
.cari__isi { flex: 1; min-width: 0; }
.cari__nama { font-weight: 600; font-size: 15px; line-height: 20px; overflow-wrap: anywhere; }
.cari__harga { font-weight: 700; margin-top: 2px; }
.cari__hint { color: var(--body); font-size: 13px; line-height: 18px; }
.cari__tambah { flex: none; min-height: 44px; padding: 8px 16px; border: 1.5px solid var(--primary); border-radius: 12px; background: var(--surface);
  color: var(--primary-text); font-weight: 600; font-size: 14px; cursor: pointer; }
.cari__tambah:disabled { border-color: var(--hairline); color: var(--muted); cursor: default; }
.cari__kosong { padding: 48px 24px; text-align: center; color: var(--body); }

/* --- Modal sukses (di lembar bawah): ilustrasi flat, judul, satu kalimat, Oke --- */
.sukses { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 4px 0 4px; }
.sukses__gambar { display: grid; margin-bottom: 4px; }
.sukses__judul { font-size: 20px; line-height: 26px; font-weight: 700; }
.sukses__teks { color: var(--body); }
.sukses .btn { margin-top: 8px; }

/* --- Tab Pesanan kosong --- */
.pesanan-kosong { display: grid; justify-items: center; gap: 8px; }
.pesanan-kosong__ikon { width: 72px; height: 72px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; margin-bottom: 4px; }
.pesanan-kosong .btn { margin-top: 8px; }

/* --- Tab Pesanan sesudah terkirim: kartu bill, ronde, kaki total --- */
.bill { margin: 12px 16px 0; background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px; overflow: hidden; }
.bill__band { padding: 10px 16px; background: var(--primary-soft); color: var(--primary-text); text-align: center; font-weight: 700; font-size: 16px; line-height: 22px; }
.bill__kolom { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; }
.bill__kolom > div { min-width: 0; }
.bill__kolom > div:last-child:not(:first-child) { text-align: right; }
.bill__label { color: var(--body); font-size: 13px; line-height: 18px; }
.bill__nilai { font-weight: 700; font-size: 16px; line-height: 22px; overflow-wrap: anywhere; }
.ronde__kepala { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin: -14px -16px 8px; padding: 10px 16px;
  background: var(--canvas); border-bottom: 1px solid var(--hairline); }
.ronde__judul { font-weight: 700; font-size: 15px; line-height: 20px; margin: 0; }
.ronde__meta { display: inline-flex; align-items: center; gap: 8px; color: var(--body); font-size: 13px; line-height: 18px; white-space: nowrap; }
.line__qty { min-width: 32px; height: 24px; padding: 0 6px; border-radius: 6px; background: var(--primary-soft); color: var(--primary-text);
  font-size: 13px; line-height: 24px; font-weight: 700; text-align: center; flex: none; }
.bilah-total { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bilah-total__blok { min-width: 0; }
.bilah-total__label { font-size: 13px; line-height: 18px; color: var(--body); font-weight: 600; }
.bilah-total__angka { font-size: 22px; line-height: 28px; font-weight: 700; white-space: nowrap; }
.bilah-total__ket { font-size: 12px; line-height: 16px; color: var(--muted); }
.bilah-total__cara { flex: none; padding: 10px 14px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-text); font-weight: 600; font-size: 14px; line-height: 20px; text-align: center; }
