* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f0f2f5;
    color: #333;
    padding: 10px;
}

.app-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* FORM PANEL (KIRI/ATAS) */
.form-panel {
    width: 100%;
    background: #ffffff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.form-panel h2 {
    color: #0a2540;
    margin-bottom: 12px;
    font-size: 16px;
    border-bottom: 2px solid #0a2540;
    padding-bottom: 5px;
}

.form-panel h3 {
    color: #444;
    margin: 12px 0 8px 0;
    font-size: 13px;
}

.input-group {
    margin-bottom: 10px;
}

.input-group label {
    display: block;
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 4px;
    color: #555;
}

.input-group input, 
.input-group textarea, 
.input-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
}

.input-row {
    display: flex;
    gap: 8px;
}

.input-row .input-group {
    flex: 1;
}

.inv-prefix-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
}

.inv-prefix-wrapper input {
    flex: 1;
}

.inv-badge {
    background: #e6ecf2;
    color: #0a2540;
    font-size: 11px;
    font-weight: bold;
    padding: 9px 10px;
    border-radius: 4px;
    border: 1px solid #ccc;
    white-space: nowrap;
}

hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 12px 0;
}

.item-row-input {
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 10px;
}

.btn-add {
    width: 100%;
    background-color: #e6ecf2;
    color: #0a2540;
    border: 1px dashed #0a2540;
    padding: 10px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 10px;
}

.btn-delete {
    background: #e53e3e;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    float: right;
}

.btn-group {
    margin-top: 15px;
}

.btn-pdf {
    width: 100%;
    background-color: #0a2540;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    font-size: 14px;
}

/* PRATINJAU INVOICE (KANAN/BAWAH) */
.preview-panel {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 10px;
}

.invoice-paper {
    background: #ffffff;
    width: 210mm;
    min-width: 210mm;
    min-height: 297mm;
    padding: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    box-sizing: border-box;
    margin: 0 auto;
}

/* HEADER NAVY */
.header {
    background-color: #0a2540 !important;
    color: white !important;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

.brand-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-wrapper {
    width: 60px;
    height: 60px;
    background: transparent;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.title-tosca {
    font-size: 15px;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
    font-weight: bold;
    color: #00b4d8 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

.sub-brand-orange {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #f77f00 !important;
    margin-bottom: 4px;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

.address-text {
    font-size: 8px;
    line-height: 1.3;
    opacity: 0.9;
}

.title-box {
    text-align: right;
}

.title-box h1 {
    font-size: 24px;
    letter-spacing: 1px;
}

.meta-table {
    font-size: 9px;
    margin-top: 4px;
    margin-left: auto;
}

.meta-table td {
    padding: 1px 3px;
}

.meta-section {
    padding: 15px 25px 10px 25px;
    display: flex;
    justify-content: space-between;
}

.client-card {
    width: 52%;
    background: #f8f9fa;
    border-left: 4px solid #0a2540;
    padding: 8px 10px;
}

.card-label {
    font-size: 8.5px;
    font-weight: bold;
    color: #666;
    display: block;
    margin-bottom: 3px;
}

.client-name {
    font-weight: bold;
    font-size: 11.5px;
    color: #0a2540;
    margin-bottom: 2px;
}

.client-address {
    font-size: 9.5px;
    color: #555;
    line-height: 1.3;
}

.status-card {
    width: 42%;
    text-align: right;
}

.status-badge {
    display: inline-block;
    background: #fde8e8;
    color: #9b1c1c;
    border: 1px solid #f8b4b4;
    padding: 4px 8px;
    font-weight: bold;
    border-radius: 4px;
    font-size: 9.5px;
    margin-top: 2px;
}

.status-note {
    font-size: 8px;
    color: #777;
    margin-top: 4px;
}

.items-table {
    width: calc(100% - 50px);
    margin: 12px 25px;
    border-collapse: collapse;
}

.items-table th {
    background-color: #0a2540 !important;
    color: white !important;
    padding: 7px 8px;
    font-size: 8.5px;
    text-align: left;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

.items-table td {
    padding: 8px;
    border-bottom: 1px solid #eee;
    font-size: 9.5px;
    vertical-align: top;
}

.item-name {
    font-weight: bold;
    color: #222;
    margin-bottom: 2px;
}

.item-desc {
    font-size: 8.5px;
    color: #666;
}

.total-container {
    padding: 0 25px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 8px;
}

.total-label {
    font-size: 10.5px;
    font-weight: bold;
    margin-right: 10px;
}

.total-amount {
    background: #e6dfb8 !important;
    color: #0a2540 !important;
    font-size: 13px;
    font-weight: bold;
    padding: 5px 12px;
    border-radius: 2px;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

.footer-section {
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
}

.payment-info {
    width: 52%;
    background: #f4f7f9;
    border: 1px solid #e1e8ed;
    padding: 8px 10px;
    border-radius: 4px;
}

.payment-info h4 {
    color: #0a2540;
    font-size: 8.5px;
    border-bottom: 1px solid #d0dbe5;
    padding-bottom: 2px;
    margin-bottom: 5px;
}

.payment-info p {
    font-size: 8px;
    color: #555;
    margin: 2px 0;
}

.bank-title {
    font-weight: bold;
    color: #0a2540;
}

.qris-text {
    font-style: italic;
    font-size: 7px !important;
    color: #888 !important;
    margin-top: 4px !important;
}

.signature-info {
    width: 38%;
    text-align: center;
    font-size: 9px;
}

.signature-img-wrapper {
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 4px 0;
}

.signature-img {
    max-height: 45px;
    max-width: 110px;
    object-fit: contain;
}

.signer-name {
    font-weight: bold;
    margin-top: 2px;
    text-decoration: underline;
}

.signer-title {
    font-size: 8px;
    color: #666;
}

@media (min-width: 900px) {
    .app-container {
        flex-direction: row;
    }

    .form-panel {
        flex: 1;
        max-height: 92vh;
        overflow-y: auto;
    }

    .preview-panel {
        flex: 1.4;
        overflow-x: visible;
    }
}

/* KUNCI CETAK PRINT PDF */
@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body {
        background-color: #ffffff;
        padding: 0;
        margin: 0;
    }
    
    .form-panel {
        display: none !important;
    }

    .preview-panel {
        flex: none;
        width: 100%;
        overflow: visible;
    }

    .invoice-paper {
        box-shadow: none;
        width: 100%;
        min-height: auto;
        margin: 0;
    }
}