/* ==================================================================
   DIALOG TOKO -- pengganti SweetAlert di halaman penjual
   ==================================================================

   Rupa mengikuti .tb (beranda usaha): hijau usaha, Plus Jakarta Sans,
   sudut 20px. Di ponsel tampil sebagai bottom sheet, sama dengan dropdown
   header. Memakai <dialog> bawaan peramban: Esc, fokus, dan latar sudah
   ditangani peramban.
   ================================================================== */

.td {
    --td-hijau: #0a7c3f;
    --td-hijau-tua: #075f30;
    --td-hijau-lembut: #e8f5ee;
    --td-merah: #dc2626;
    --td-merah-tua: #b91c1c;
    --td-merah-lembut: #fef2f2;
    --td-jingga: #c2410c;
    --td-jingga-lembut: #fff7ed;
    --td-biru: #1d4ed8;
    --td-biru-lembut: #eff6ff;
    --td-tinta: #0f172a;
    --td-abu: #64748b;
    --td-garis: #e8ecef;

    /* Posisi ditulis eksplisit: tema penjual mereset margin semua elemen,
       sehingga <dialog> kehilangan posisi tengah bawaannya dan menempel di
       kiri atas. */
    position: fixed;
    inset: 0;
    margin: auto;
    height: fit-content;
    max-height: calc(100vh - 32px);
    width: min(420px, calc(100vw - 32px));
    max-width: none;
    overflow-y: auto;
    padding: 0;
    border: 0;
    border-radius: 22px;
    background: #fff;
    color: var(--td-tinta);
    box-shadow: 0 24px 60px rgba(15, 23, 42, .25);
    font-family: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
    overflow: hidden;
}

.td::backdrop { background: rgba(15, 23, 42, .45); }

.td[open] { animation: td-muncul .16s ease-out; }

@keyframes td-muncul {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to   { opacity: 1; transform: none; }
}

.td__isi {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 24px 22px 18px;
    text-align: center;
}

.td__ikon {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    margin-bottom: 6px;
    border-radius: 18px;
    font-size: 26px;
    background: var(--td-hijau-lembut);
    color: var(--td-hijau);
}

.td--merah  .td__ikon { background: var(--td-merah-lembut);  color: var(--td-merah); }
.td--jingga .td__ikon { background: var(--td-jingga-lembut); color: var(--td-jingga); }
.td--biru   .td__ikon { background: var(--td-biru-lembut);   color: var(--td-biru); }

.td__judul {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.3;
    color: var(--td-tinta);
}

.td__teks {
    margin: 0;
    max-width: 340px;
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--td-abu);
}

.td__teks strong { color: var(--td-tinta); }

.td__pilihan { width: 100%; margin-top: 10px; text-align: left; }

.td__pilihan label {
    display: block;
    margin-bottom: 6px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--td-tinta);
}

.td .td__pilihan select {
    display: block;
    width: 100%;
    height: 46px;
    padding: 0 12px;
    border: 1px solid #dbe2e8;
    border-radius: 13px;
    background-color: #fff;
    color: var(--td-tinta);
    font-family: inherit;
    font-size: 14px;
}

.td .td__pilihan select:focus {
    outline: none;
    border-color: var(--td-hijau);
    box-shadow: 0 0 0 3px rgba(10, 124, 63, .14);
}

.td__galat {
    width: 100%;
    margin: 6px 0 0;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--td-merah-lembut);
    color: var(--td-merah-tua);
    font-size: 12.5px;
    font-weight: 600;
}

.td__galat[hidden] { display: none; }

.td__aksi {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 0 22px 22px;
}

.td__aksi--satu { grid-template-columns: 1fr; }

.td__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 46px;
    padding: 0 14px;
    border: 1px solid var(--td-garis);
    border-radius: 13px;
    background: #fff;
    color: var(--td-tinta);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.td__btn:hover { background: #f8fafc; }
.td__btn:focus-visible { outline: 2px solid var(--td-hijau); outline-offset: 2px; }
.td__btn[hidden] { display: none; }
.td__btn:disabled { opacity: .7; cursor: wait; }

.td__btn--ya { border-color: var(--td-hijau); background: var(--td-hijau); color: #fff; }
.td__btn--ya:hover { background: var(--td-hijau-tua); }
.td--merah .td__btn--ya { border-color: var(--td-merah); background: var(--td-merah); }
.td--merah .td__btn--ya:hover { background: var(--td-merah-tua); }

.td__putar {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: td-putar .7s linear infinite;
}

@keyframes td-putar { to { transform: rotate(360deg); } }

/* Ponsel: bottom sheet. */
@media (max-width: 639px) {
    .td {
        width: 100%;
        margin: auto 0 0;
        max-height: 90vh;
        border-radius: 22px 22px 0 0;
        padding-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom));
    }

    .td[open] { animation-name: td-naik; animation-duration: .2s; }

    .td__isi::before {
        content: "";
        width: 44px;
        height: 5px;
        margin: -12px 0 8px;
        border-radius: 999px;
        background: #cbd5e1;
    }
}

@keyframes td-naik {
    from { transform: translateY(30px); opacity: .6; }
    to   { transform: none; opacity: 1; }
}

/* ---------- Toast ---------- */

.td-toast {
    position: fixed;
    left: 50%;
    bottom: calc(84px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom)));
    z-index: 10080;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(420px, calc(100vw - 32px));
    padding: 12px 16px;
    border-radius: 14px;
    background: #0f172a;
    color: #fff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .3);
    font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    transform: translateX(-50%);
    animation: td-toast .2s ease-out;
}

.td-toast i { font-size: 18px; color: #4ade80; }
.td-toast--merah i { color: #f87171; }
.td-toast--biru i { color: #93c5fd; }

@keyframes td-toast {
    from { opacity: 0; transform: translate(-50%, 10px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .td[open], .td-toast { animation: none; }
    .td__putar { animation-duration: 1.5s; }
}

/* ------------------------------------------------------------------
   Ditambahkan 1.132.0 -- dipakai juga oleh halaman pembeli.
   ------------------------------------------------------------------ */

/* Kotak isian (konfirmasi({ isian })) -- rupa sama dengan .td__pilihan. */
.td__isian { width: 100%; margin-top: 10px; text-align: left; }
.td__isian label { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 700; color: var(--td-tinta); }
.td .td__isian textarea,
.td .td__isian input {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dbe2e8;
    border-radius: 13px;
    background: #fff;
    color: var(--td-tinta);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}
.td .td__isian input { height: 46px; }
.td .td__isian textarea:focus,
.td .td__isian input:focus {
    outline: none;
    border-color: var(--td-hijau);
    box-shadow: 0 0 0 3px rgba(10, 124, 63, .14);
}

/* Dialog tunggu (TokoDialog.memuat): tanpa tombol, ikon berputar. */
.td__aksi[hidden] { display: none !important; }
.td__ikon .td__putar--besar {
    display: inline-block;
    width: 26px;
    height: 26px;
    border-width: 3px;
    border-color: currentColor;
    border-right-color: transparent;
}
