:root {
    --primer: #2e7d32;
    --primer-gelap: #1b5e20;
    --abu: #f4f4f4;
    --border: #ddd;
    --merah: #c62828;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: #222;
    background: #fafafa;
}

.wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 16px;
}

.site-header {
    background: var(--primer);
    color: #fff;
}
.site-header .wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    flex-wrap: wrap;
}
.site-header .brand {
    color: #fff;
    font-weight: bold;
    text-decoration: none;
    font-size: 1.2rem;
}
.site-header nav a {
    color: #fff;
    text-decoration: none;
    margin-left: 16px;
    opacity: .9;
}
.site-header nav a:hover { opacity: 1; text-decoration: underline; }

main { padding: 24px 16px 48px; }

.subtitle { color: #555; margin-top: -8px; }

.table-responsive { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}
th, td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
th { background: var(--abu); }
.text-right { text-align: right; }

.baris-nonaktif { opacity: .5; }

.badge { padding: 2px 8px; border-radius: 12px; font-size: .8rem; }
.badge-aktif { background: #e8f5e9; color: var(--primer-gelap); }
.badge-nonaktif { background: #eee; color: #777; }
.badge-diajukan { background: #fff3e0; color: #e65100; }
.badge-dikonfirmasi { background: #e3f2fd; color: #1565c0; }
.badge-selesai { background: #e8f5e9; color: var(--primer-gelap); }
.badge-ditolak, .badge-dibatalkan { background: #ffebee; color: var(--merah); }
.badge-bayar-belum_bayar { background: #fff3e0; color: #e65100; }
.badge-bayar-dp { background: #e3f2fd; color: #1565c0; }
.badge-bayar-lunas { background: #e8f5e9; color: var(--primer-gelap); }

.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}
.btn-primary { background: var(--primer); color: #fff; }
.btn-primary:hover { background: var(--primer-gelap); }
.btn-secondary { background: #eee; color: #333; }

.link-btn {
    background: none;
    border: none;
    color: var(--merah);
    cursor: pointer;
    padding: 0;
    font-size: .9rem;
    text-decoration: underline;
}

.aksi a { margin-right: 10px; }

.form-bahan { max-width: 480px; background: #fff; padding: 20px; border-radius: 6px; }
.form-row { margin-bottom: 14px; display: flex; flex-direction: column; gap: 4px; }
.form-row label { font-weight: 600; font-size: .9rem; }
.form-row input[type=text],
.form-row input[type=number],
.form-row input[type=password] {
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
}
.form-row input[type=tel],
.form-row textarea,
.form-row select {
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
}
.form-row-checkbox { flex-direction: row; align-items: center; }
.form-actions { display: flex; gap: 10px; }
.form-pesan { max-width: 640px; }

.kartu-pesan {
    max-width: 720px;
    margin-bottom: 18px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
}
.kartu-pesan h2 { margin: 16px 0 8px; font-size: 1.05rem; }
.pesan-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.isi-pesan { white-space: normal; overflow-wrap: anywhere; line-height: 1.5; }
.jawaban-admin { margin-top: 20px; padding-top: 4px; border-top: 1px solid var(--border); }
.form-jawaban { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.form-jawaban textarea { width: 100%; }

.alert { padding: 10px 14px; border-radius: 4px; margin-bottom: 16px; }
.alert-sukses { background: #e8f5e9; color: var(--primer-gelap); }
.alert-error { background: #ffebee; color: var(--merah); }
.alert-info { background: #e3f2fd; color: #1565c0; }

.hint { font-size: .8rem; color: #777; }

.baris-error { background: #ffebee; }
.baris-error select, .baris-error input { border-color: var(--merah) !important; }

.tabel-detail { margin: 8px 0; }
.tabel-detail th, .tabel-detail td { font-size: .9rem; }

button:disabled { opacity: .5; cursor: not-allowed; }

.tabel-simulasi select,
.tabel-simulasi input[type=number] {
    width: 100%;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.site-footer {
    text-align: center;
    color: #888;
    padding: 16px;
    font-size: .85rem;
}

.invoice-actions { display: flex; justify-content: flex-end; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.invoice-card { max-width: 800px; margin: 0 auto; background: #fff; border: 2px solid #b7b7b7; border-radius: 8px; box-shadow: 0 2px 8px rgba(0, 0, 0, .08); padding: 32px; }
.invoice-header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid var(--primer); padding-bottom: 16px; }
.invoice-header h1 { color: var(--primer-gelap); margin: 0; font-size: 1.7rem; }
.invoice-header p { margin: 5px 0 0; color: #666; }
.invoice-stamp { display: block; width: 100px; height: 100px; max-width: 100px; max-height: 100px; object-fit: contain; }
.invoice-title { display: flex; align-items: center; justify-content: space-between; margin: 24px 0; }
.invoice-title h2 { margin: 0; font-size: 1.45rem; }
.invoice-title strong { color: var(--primer-gelap); }
.invoice-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 22px; }
.invoice-meta div { display: flex; flex-direction: column; gap: 4px; }
.invoice-meta span, .invoice-meta small { color: #666; }
.invoice-table th, .invoice-table td { padding: 10px; }
.invoice-table tfoot td { border-top: 2px solid var(--primer); font-size: 1.05rem; }
.invoice-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 24px; }
.invoice-bottom > div { display: flex; flex-direction: column; gap: 8px; }
.invoice-bottom p { margin: 0; color: #555; white-space: pre-line; }
.invoice-footer { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--border); text-align: center; color: #666; font-size: .9rem; }
.payment-form { max-width: 800px; margin: 24px auto 0; padding: 22px; background: #fff; border: 1px solid var(--border); }
.payment-form h2 { margin-top: 0; font-size: 1.2rem; }

@media print {
    body { background: #fff; }
    .site-header, .site-footer, .no-print { display: none !important; }
    main.wrap { max-width: none; margin: 0; padding: 0; }
    .invoice-card { border: 0; max-width: none; padding: 0; }
}

@media (max-width: 600px) {
    .site-header .wrap { flex-direction: column; align-items: flex-start; }
    .site-header nav a { margin-left: 0; margin-right: 16px; }

    .tabel-simulasi,
    .tabel-simulasi tbody,
    .tabel-simulasi tfoot {
        display: block;
        width: 100%;
    }
    .tabel-simulasi thead { display: none; }
    .tabel-simulasi tbody tr {
        display: block;
        margin-bottom: 14px;
        padding: 12px;
        border: 1px solid var(--border);
        border-radius: 7px;
        background: #fff;
    }
    .tabel-simulasi tbody td {
        display: grid;
        grid-template-columns: 72px minmax(0, 1fr);
        align-items: center;
        gap: 8px;
        width: 100%;
        padding: 6px 0;
        border: 0;
    }
    .tabel-simulasi tbody td[data-label]::before {
        content: attr(data-label);
        font-size: .82rem;
        font-weight: 600;
        color: #555;
    }
    .tabel-simulasi tbody td.kolom-bahan {
        display: block;
        padding-bottom: 10px;
    }
    .tabel-simulasi tbody td.kolom-bahan::before {
        display: block;
        margin-bottom: 5px;
    }
    .tabel-simulasi tbody td.kolom-aksi {
        display: flex;
        justify-content: flex-end;
        padding-top: 9px;
    }
    .tabel-simulasi select,
    .tabel-simulasi input[type=number] {
        min-width: 0;
        font-size: 16px;
    }
    .tabel-simulasi tfoot tr {
        display: flex;
        align-items: center;
        padding: 10px 12px;
        background: var(--abu);
        border-radius: 6px;
    }
    .tabel-simulasi tfoot td {
        display: block;
        width: auto;
        padding: 0;
        border: 0;
    }
    .tabel-simulasi tfoot td.text-right { flex: 1; text-align: left; }
    .tabel-simulasi tfoot td:last-child { display: none; }
    .invoice-card { padding: 18px; }
    .invoice-header h1 { font-size: 1.35rem; }
    .invoice-stamp { width: 76px; }
    .invoice-meta, .invoice-bottom { grid-template-columns: 1fr; gap: 14px; }
}
