:root {
--bg-body: #f3f4f6;
--bg-card: #ffffff;
--text-main: #111827;
--text-muted: #6b7280;
--border: #e5e7eb;
--black: #111827;
--primary: #2563eb;
--danger: #ef4444;
--warning: #f59e0b;
--success: #10b981;
--radius-lg: 16px;
--radius-md: 8px;
}

* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Inter', sans-serif;
scroll-behavior: smooth;
}

body {
background-color: var(--bg-body);
color: var(--text-main);
display: flex;
flex-direction: column;
align-items: center;
min-height: 100vh;
}

.navbar-wrapper {
position: sticky;
top: 0;
width: 100%;
background-color: var(--bg-body);
padding: 20px 20px 10px 20px;
z-index: 1000;
display: flex;
justify-content: center;
}

.top-navbar {
width: 100%;
max-width: 1400px;
background: var(--bg-card);
border-radius: 40px;
padding: 12px 25px;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.brand-logo {
font-weight: 800;
font-size: 18px;
letter-spacing: -0.5px;
color: var(--black);
}

.nav-links {
display: flex;
background: var(--bg-body);
padding: 5px;
border-radius: 30px;
}

.nav-links button {
background: transparent;
border: none;
padding: 8px 20px;
border-radius: 25px;
font-size: 14px;
font-weight: 600;
color: var(--text-muted);
cursor: pointer;
transition: all 0.3s ease;
}

.nav-links button:hover {
color: var(--black);
}

.nav-links button.active {
background: var(--bg-card);
color: var(--text-main);
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* --- LAYOUT UTAMA --- */
.app-container {
width: 100%;
max-width: 1400px;
padding: 0 20px 40px 20px;
display: flex;
flex-direction: column;
gap: 20px;
}

.view-section {
display: none;
}

.view-section.active {
display: block;
animation: fadeInOnly 0.4s ease forwards;
}

@keyframes fadeInOnly {
from {
    opacity: 0;
}

to {
    opacity: 1;
}
}

.btn {
padding: 10px 18px;
border-radius: var(--radius-md);
font-weight: 600;
cursor: pointer;
border: 1px solid var(--border);
background: white;
font-size: 13px;
transition: all 0.2s ease;
display: inline-flex;
align-items: center;
gap: 8px;
}

.btn:hover {
background: #f9fafb;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.btn-dark {
background: var(--black);
color: white;
border-color: var(--black);
}

.btn-dark:hover {
background: #333;
}

.btn-danger-outline {
color: var(--danger);
border-color: #fecaca;
background: #fef2f2;
}

.btn-danger-outline:hover {
background: #fee2e2;
}

.header-title {
font-size: 24px;
font-weight: 700;
margin-bottom: 20px;
display: flex;
justify-content: space-between;
align-items: center;
}

.stats-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 20px;
margin-bottom: 25px;
}

.stat-card {
background: var(--bg-card);
padding: 24px;
border-radius: var(--radius-lg);
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
border: 1px solid var(--border);
}

.stat-card h4 {
font-size: 12px;
color: var(--text-muted);
font-weight: 700;
margin-bottom: 8px;
text-transform: uppercase;
letter-spacing: 0.5px;
}

.stat-card h2 {
font-size: 28px;
font-weight: 800;
color: var(--black);
}

.table-card {
background: var(--bg-card);
border-radius: var(--radius-lg);
padding: 25px;
border: 1px solid var(--border);
overflow-x: auto;
min-height: 400px;
}

table.dash-table {
width: 100%;
border-collapse: collapse;
}

table.dash-table th {
text-align: left;
padding: 15px;
border-bottom: 2px solid var(--border);
font-size: 12px;
color: var(--text-muted);
text-transform: uppercase;
font-weight: 700;
}

table.dash-table td {
padding: 15px;
border-bottom: 1px solid var(--border);
font-size: 13px;
vertical-align: middle;
}

table.dash-table tr:hover td {
background: #f9fafb;
}

.status-select {
padding: 6px 12px;
border-radius: 20px;
font-size: 11px;
font-weight: 700;
border: 1px solid transparent;
outline: none;
cursor: pointer;
text-transform: uppercase;
text-align: center;
}

.status-DRAFT {
background: #f3f4f6;
color: #4b5563;
border-color: #e5e7eb;
}

.status-UNPAID {
background: #fee2e2;
color: #991b1b;
border-color: #fecaca;
}

.status-PARTIAL {
background: #fef3c7;
color: #92400e;
border-color: #fde68a;
}

.status-PAID {
background: #dcfce3;
color: #166534;
border-color: #bbf7d0;
}

/* --- GENERATOR UI --- */
.generator-grid {
display: grid;
grid-template-columns: 1fr 1.2fr;
gap: 30px;
align-items: start;
}

.form-panel {
background: var(--bg-card);
padding: 30px;
border-radius: var(--radius-lg);
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
border: 1px solid var(--border);
}

.form-group {
margin-bottom: 18px;
}

.form-group label {
display: block;
font-size: 12px;
color: var(--text-muted);
margin-bottom: 6px;
font-weight: 600;
text-transform: uppercase;
}

.form-control {
width: 100%;
padding: 12px 15px;
border: 1px solid var(--border);
border-radius: var(--radius-md);
font-size: 14px;
outline: none;
background: #f9fafb;
transition: all 0.3s ease;
}

.form-control:focus {
border-color: var(--primary);
background: #fff;
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.grid-2 {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 15px;
}

.items-wrapper {
border: 1px dashed var(--border);
padding: 20px;
border-radius: var(--radius-md);
margin-bottom: 20px;
background: #fafafa;
}

.item-card {
background: #ffffff;
border: 1px solid #d1d5db;
border-radius: 8px;
padding: 20px;
margin-bottom: 15px;
position: relative;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.item-card .remove-btn {
position: absolute;
top: 15px;
right: 15px;
background: #fee2e2;
color: #ef4444;
border: none;
padding: 6px 12px;
border-radius: 6px;
cursor: pointer;
transition: 0.2s;
}

.item-card .remove-btn:hover {
background: #fca5a5;
}

.preview-panel {
position: sticky;
top: 100px;
}

.preview-actions {
display: flex;
gap: 10px;
justify-content: flex-end;
margin-bottom: 15px;
background: var(--bg-card);
padding: 15px;
border-radius: var(--radius-lg);
border: 1px solid var(--border);
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.02);
}

.preview-scroll-wrapper {
width: 100%;
overflow-x: auto;
border-radius: var(--radius-lg);
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
background: #e5e7eb;
padding: 20px;
display: flex;
justify-content: center;
}


#pdf-export-container {
width: 210mm;
/* A4 Width */
min-height: 297mm;
/* A4 Height */
background: #ffffff;
margin: 0;
padding: 0;
box-sizing: border-box;
display: flex;
flex-direction: column;
font-size: 12px;
color: #111827;
}

.avoid-break {
page-break-inside: avoid !important;
break-inside: avoid !important;
}

.doc-header-dark {
background: #111827;
color: #ffffff;
padding: 40px 50px;
display: flex;
justify-content: space-between;
align-items: flex-start;
}

.doc-header-blue {
background: oklch(48.8% 0.243 264.376);
color: #ffffff;
padding: 40px 50px;
display: flex;
justify-content: space-between;
align-items: flex-start;
}

.doc-brand-title {
font-size: 32px;
font-weight: 800;
letter-spacing: -1px;
margin-bottom: 5px;
color: white;
}

.doc-brand-subtitle {
font-size: 13px;
font-weight: 500;
margin-bottom: 25px;
color: #9ca3af;
text-transform: uppercase;
letter-spacing: 1px;
}

.doc-brand-contact {
font-size: 11px;
color: #d1d5db;
line-height: 1.8;
}

.doc-brand-contact i {
width: 15px;
text-align: center;
margin-right: 5px;
color: #60a5fa;
}

.doc-meta-right {
text-align: right;
}

.meta-label {
font-size: 9px;
font-weight: 700;
color: #6b7280;
text-transform: uppercase;
margin-bottom: 4px;
letter-spacing: 0.5px;
}

.meta-value {
font-size: 15px;
font-weight: 700;
margin-bottom: 15px;
border-bottom: 1px solid #374151;
padding-bottom: 4px;
display: inline-block;
min-width: 140px;
color: white;
}

.doc-body {
padding: 40px 50px;
flex-grow: 1;
display: flex;
flex-direction: column;
}

.doc-client {
margin-bottom: 40px;
background: #f9fafb;
padding: 20px;
border-left: 4px solid #2563eb;
border-radius: 4px;
}

.doc-client-title {
font-size: 10px;
font-weight: 800;
color: #6b7280;
margin-bottom: 10px;
text-transform: uppercase;
letter-spacing: 1px;
}

.doc-client-line {
font-size: 16px;
font-weight: 700;
color: #111827;
margin-bottom: 5px;
}

.doc-client-sub {
font-size: 12px;
color: #4b5563;
line-height: 1.5;
}

.doc-table {
width: 100%;
border-collapse: collapse;
margin-bottom: 30px;
}

.doc-table th {
background: #f3f4f6;
font-size: 10px;
color: #4b5563;
font-weight: 800;
text-align: left;
padding: 12px 10px;
border-bottom: 2px solid #e5e7eb;
text-transform: uppercase;
letter-spacing: 0.5px;
}

.doc-table td {
padding: 20px 10px;
border-bottom: 1px solid #e5e7eb;
vertical-align: top;
}

.item-title {
font-size: 14px;
font-weight: 700;
color: #111827;
margin-bottom: 6px;
}

.item-desc {
font-size: 12px;
color: #6b7280;
white-space: pre-wrap;
line-height: 1.5;
}

.doc-table th:nth-child(2),
.doc-table td:nth-child(2) {
text-align: center;
width: 80px;
}

.doc-table th:nth-child(3),
.doc-table td:nth-child(3) {
text-align: right;
width: 130px;
color: #4b5563;
}

.doc-table th:nth-child(4),
.doc-table td:nth-child(4) {
text-align: right;
width: 140px;
font-weight: 800;
color: #111827;
font-size: 14px;
}

.doc-bottom {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-top: 20px;
border-top: 2px solid #111827;
padding-top: 30px;
}

.doc-terms-area {
width: 48%;
}

.doc-pay-box {
background: #f8fafc;
border: 1px solid #e2e8f0;
padding: 15px;
margin-bottom: 25px;
border-radius: 6px;
}

.doc-pay-box .title {
font-size: 10px;
font-weight: 800;
color: #2563eb;
margin-bottom: 8px;
text-transform: uppercase;
letter-spacing: 0.5px;
}

.doc-pay-box .content {
font-size: 12px;
color: #334155;
line-height: 1.6;
font-weight: 600;
}

.doc-terms-list .title {
font-size: 10px;
font-weight: 800;
color: #6b7280;
margin-bottom: 8px;
text-transform: uppercase;
letter-spacing: 0.5px;
}

.doc-terms-list .content {
font-size: 10px;
color: #4b5563;
white-space: pre-wrap;
line-height: 1.6;
}

.doc-totals-area {
width: 45%;
}

.tot-row {
display: flex;
justify-content: space-between;
padding: 8px 0;
font-size: 13px;
font-weight: 600;
color: #4b5563;
}

.tot-row span:last-child {
color: #111827;
font-weight: 700;
}

.tot-row.discount {
color: #ef4444;
}

.tot-row.discount span:last-child {
color: #ef4444;
}

.tot-row.grand-total {
font-size: 16px;
font-weight: 800;
border-top: 1px solid #e5e7eb;
padding-top: 15px;
margin-top: 5px;
color: #111827;
align-items: center;
}

.tot-row.grand-total span:last-child {
font-size: 20px;
color: #111827;
}

.tot-row.dp-row {
background: #ecfdf5;
padding: 12px 15px;
border-radius: 6px;
margin-top: 15px;
color: #065f46;
font-size: 13px;
border: 1px solid #a7f3d0;
}

.tot-row.dp-row span:last-child {
color: #059669;
}

.tot-row.balance-row {
background: #fef2f2;
padding: 15px;
border-radius: 6px;
margin-top: 10px;
font-size: 16px;
font-weight: 800;
color: #991b1b;
border: 1px solid #fecaca;
align-items: center;
}

.tot-row.balance-row span:last-child {
font-size: 22px;
color: #dc2626;
}

.doc-signature {
margin-top: 60px;
text-align: center;
float: right;
width: 200px;
}

.doc-sig-name {
font-weight: 800;
font-size: 14px;
text-decoration: underline;
text-underline-offset: 4px;
color: #111827;
margin-bottom: 5px;
}

.doc-sig-role {
font-size: 11px;
color: #6b7280;
text-transform: uppercase;
font-weight: 600;
}



@media print {


@page {
    size: A4;
    margin: 0mm;
    
}


.navbar-wrapper,
.form-panel,
.preview-actions,
.header-title,
#dashboard {
    display: none !important;
}

body {
    background: white !important;
    margin: 0 !important;
    padding: 0 !important;
}

.app-container {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

.generator-grid {
    display: block !important;
}

.preview-panel {
    position: static !important;
    width: 100% !important;
    padding: 0 !important;
}

.preview-scroll-wrapper {
    box-shadow: none !important;
    background: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
    overflow: visible !important;
}

#pdf-export-container {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
}

* {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}
}