*,
*::before,
*::after {
    box-sizing: border-box;
    max-width: 100%;
}
.header-brand {
    display: flex;
    align-items: center;
}
/* DESKTOP & PDF */
.logo {
    height: 65px;          /* NAIK, tapi masih rapi */
    width: auto;
    object-fit: contain;
}

/* MOBILE */
@media (max-width: 768px) {
    .logo {
        height: 48px;      /* proporsional di HP */
        width: auto;
    }
}

.item-name {
    width: 100%;
    min-height: 22px;
    border: none;
    resize: none;
    overflow: hidden;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    background: transparent;
}


.item-name-pdf {
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #525659; /* Samakan dengan background invoice.html agar konsisten */
}

.toolbar {
    text-align: center;
    margin: 15px;
}

button {
    padding: 6px 12px;
    cursor: pointer;
}

.invoice {
    width: 794px;   /* A4 width @96dpi */
    margin: 0 auto;
    background: #fff;
    padding: 30px;
    box-sizing: border-box;
    position: relative; /* Penting untuk watermark absolute */
}


.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    margin: 0;
    font-size: 28px;
}

.header h2 {
    margin: 0;
}

hr {
    margin: 15px 0;
    border: 0;
    border-top: 2px solid #333; /* Garis lebih tegas tapi modern */
}

.info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 25px; /* Tambah jarak */
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    border: none; /* Hapus border kotak penuh */
    border-bottom: 1px solid #eee; /* Ganti dengan garis bawah halus */
    padding: 10px 8px; /* Tambah padding agar lega */
    font-size: 13px;
    vertical-align: top;
}

/* Header tabel modern */
thead {
    display: table-header-group;
    background-color: #f8f9fa;
    border-bottom: 2px solid #333;
    font-weight: bold;
}

input {
    width: 100%;
    border: none;
}

/* Kotak Total Utama */
.total-box {
    max-width: 320px;
    margin-left: auto;
    margin-top: 15px;
}

.total-box .grand {
    font-size: 15px;
    margin-top: 5px;
}

.terbilang {
    margin-top: 15px;
}

.bank {
    margin-top: 15px;
    font-size: 14px;
}

.bank-row {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.bank-row img {
    height: 30px; /* Ukuran disesuaikan agar lebih proporsional */
    width: auto;
    object-fit: contain;
    margin-right: 10px;
}

.bank-row span {
    font-weight: bold;
    font-size: 16px;
}

.bank-name {
    margin-top: 5px;
    font-weight: bold;
    font-size: 15px;
}

/* PDF SAFETY */
tr {
    page-break-inside: avoid;
}
/* ===== PDF SAFE ===== */

tfoot {
    display: table-footer-group;
}

.total-box,
.terbilang,
.bank {
    page-break-inside: avoid;
}

/* jangan pakai fixed height */
.page-avoid {
    page-break-inside: avoid;
}
/* ===== MOBILE VIEW ===== */
/* Menghilangkan panah (spin buttons) pada input nomor */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
}
@media (max-width: 768px) {

    body {
        background: #fff;
    }

    .invoice {
        width: 100%;
        padding: 15px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .info {
        flex-direction: column;
        gap: 10px;
    }

    table th:nth-child(3),
    table th:nth-child(4),
    table th:nth-child(5),
    table td:nth-child(3),
    table td:nth-child(4),
    table td:nth-child(5) {
        font-size: 12px;
    }

    .toolbar {
        position: sticky;
        bottom: 0;
        background: #fff;
        padding: 10px;
        border-top: 1px solid #ccc;
    }
}
.qris {
    margin-top: 15px;
    text-align: right;
}

.qris img {
    width: 120px;
}
/* Membuat garis bawah pada nilai Sub Total sesuai Screenshot 12 */
.subtotal-line {
    border-bottom: 1px solid #000;
    display: inline-block;
    padding-bottom: 2px;
}
/* Penyelarasan Rp dan Angka agar sejajar lurus */
.total-box .row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

/* Mengatur label (sebelah kiri) agar checkbox dan teks rata tengah */
.total-box .label {
    display: flex;
    align-items: center;
    flex: 1;
    font-size: 14px;
}

/* Penyesuaian di Total Box (Bawah) */
.total-box .value {
    width: 180px;
    border-bottom: 1px solid #000;
    display: flex;
    justify-content: space-between; /* Rp kiri, Angka kanan */
    padding-bottom: 2px;
}
/* Mengatur angka agar mepet ke kanan di dalam box value */
.total-box .value span:last-child,
.total-box .value b,
.total-box .value input {
    flex: 1;
    text-align: right;
    font-variant-numeric: tabular-nums; /* Angka lebih rapi */
}
/* Mengatur input checkbox agar tidak mengambil lebar penuh */
.total-box input[type="checkbox"] {
    width: auto !important;
    margin: 0 8px 0 0;
    cursor: pointer;
}


/* Mengatur input agar tidak merusak perataan */
.total-box input[type="number"] {
    border: none;
    background: transparent;
    outline: none;
    font-family: inherit;
    font-size: inherit;
    padding: 0;
}
/* Simbol Rp dalam tabel barang */
.total::before {
    content: "Rp ";
}
.total-box .grand {
    margin-top: 6px;
    font-weight: bold;
}
/* Mengatur kolom Harga dan Total di Tabel */
#items td:nth-child(4), 
#items td:nth-child(5) {
    text-align: right;
    padding: 8px;
    min-width: 120px;
}
/* Container untuk meratakan Rp dan Angka di dalam Tabel */
.currency-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.currency-box input {
    text-align: right;
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-family: inherit;
    font-size: inherit;
}
/* Mengecilkan ukuran font pada area keterangan/notes */
.info-right textarea.item-name {
    font-size: 11px !important; /* Ukuran lebih kecil dari standar (14px) */
    line-height: 1.3;
    color: #333;
}

/* Memastikan saat di PDF tetap kecil */
.info-right .item-name-pdf {
    font-size: 11px !important;
}
/* Mengatur agar teks 'Terbilang' lebih jelas */
.terbilang {
    margin-top: 10px;
    font-size: 14px;
    min-height: 1.5em; /* Menjaga jarak meskipun kosong */
}
/* Gaya untuk informasi di bawah logo */
.header-address {
    background-color: transparent; /* Hapus background abu-abu */
    color: #333;
    text-align: center;
    padding: 10px 0;
    border-bottom: 1px solid #ddd; /* Ganti dengan garis pemisah halus */
    font-size: 12px;
    font-weight: normal;
    letter-spacing: 0.5px;
    margin-top: 10px;
    width: 100%;
}

/* FORCE DESKTOP MODE FOR PDF */
.force-desktop {
    width: 794px !important;
    padding: 30px !important;
}

.force-desktop .header {
    flex-direction: row !important;
}

.force-desktop .info {
    flex-direction: row !important;
}

/* WATERMARK LUNAS */
.watermark {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-30deg);
    font-size: 100px;
    font-weight: 900;
    color: #28a745; /* Warna Hijau Sukses */
    opacity: 0.15; /* Transparan */
    border: 10px solid #28a745;
    padding: 10px 40px;
    border-radius: 15px;
    z-index: 0;
    pointer-events: none; /* Agar bisa diklik tembus */
    font-family: sans-serif;
    letter-spacing: 10px;
    white-space: nowrap;
}
