*{box-sizing:border-box}
:root{
    --navy:#0B1E4F;
    --gold:#C8A96A;
    --green:#25D366;
    --dark:#111827;
    --muted:#6b7280;
    --bg:#f4f6f9;
    --white:#fff;
}
body{
    margin:0;
    font-family:Arial,sans-serif;
    background:var(--bg);
    color:#1f2937;
    direction:rtl;
}
a{text-decoration:none}
.topbar{
    background:#061638;
    color:white;
    padding:8px 20px;
    font-size:14px;
    text-align:center;
}
.header{
    background:white;
    padding:14px 28px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    position:sticky;
    top:0;
    z-index:1000;
    box-shadow:0 8px 25px rgba(0,0,0,.08);
}
.logo{
    display:flex;
    align-items:center;
    gap:10px;
    color:var(--navy);
}
.logo-mark{
    width:44px;
    height:44px;
    border-radius:12px;
    background:linear-gradient(135deg,var(--navy),var(--gold));
    display:flex;
    align-items:center;
    justify-content:center;
    color:white;
    font-weight:bold;
    font-size:22px;
}
.logo strong{color:var(--navy);font-size:20px}
.logo span{display:block;color:var(--muted);font-size:12px}
.nav a{
    color:#111;
    margin:0 10px;
    font-weight:bold;
}
.header-actions{display:flex;gap:10px}
.btn{
    display:inline-block;
    padding:12px 18px;
    border-radius:12px;
    font-weight:bold;
    border:none;
    cursor:pointer;
}
.btn-dark{background:var(--navy);color:white}
.btn-gold{background:var(--gold);color:#111}
.btn-whatsapp{background:var(--green);color:white}
.hero{
    background:linear-gradient(rgba(11,30,79,.94),rgba(11,30,79,.94));
    color:white;
    text-align:center;
    padding:70px 20px;
}
.hero h1{font-size:40px;margin:0 0 12px}
.hero p{color:#e5e7eb;font-size:18px}
.container{
    max-width:1150px;
    margin:auto;
    padding:45px 25px;
}
.grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(250px,1fr));
    gap:20px;
}
.card{
    background:white;
    padding:25px;
    border-radius:18px;
    box-shadow:0 8px 28px rgba(0,0,0,.07);
}
.card h3,.card h2{color:var(--navy);margin-top:0}
.form-box{
    max-width:850px;
    margin:40px auto;
    background:white;
    padding:30px;
    border-radius:20px;
    box-shadow:0 10px 35px rgba(0,0,0,.08);
}
.form-grid{
    display:grid;
    grid-template-columns:repeat(2,1fr);
    gap:16px;
}
.full{grid-column:1/-1}
input,select,textarea{
    width:100%;
    padding:14px;
    border:1px solid #ddd;
    border-radius:10px;
    font-size:15px;
}
textarea{min-height:120px}
label{font-weight:bold;margin-bottom:7px;display:block}
.success{background:#e8f8ef;color:#087a34;padding:14px;border-radius:10px;margin-bottom:15px}
.error{background:#fdecec;color:#b00020;padding:14px;border-radius:10px;margin-bottom:15px}
.footer{
    background:#071227;
    color:white;
    padding:35px 25px;
    margin-top:40px;
}
.footer-wrap{
    max-width:1100px;
    margin:auto;
    display:grid;
    grid-template-columns:2fr 1fr 1fr;
    gap:25px;
}
.footer a{color:white;display:block;margin:8px 0}
.footer-copy{text-align:center;margin-top:25px}
.float-whatsapp{
    position:fixed;
    left:18px;
    bottom:18px;
    background:var(--green);
    color:white;
    padding:15px 18px;
    border-radius:50px;
    font-weight:bold;
    z-index:2000;
}
.mobile-bottom{display:none}
table{
    width:100%;
    border-collapse:collapse;
    background:white;
    border-radius:14px;
    overflow:hidden;
}
th,td{
    padding:12px;
    border-bottom:1px solid #eee;
    text-align:center;
}
th{background:var(--navy);color:white}

/* =========================
   INVOICE A4 PRINT FIX
   ========================= */

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

.invoice-actions{
    max-width:210mm;
    margin:15px auto;
    display:flex;
    gap:10px;
    flex-wrap:wrap;
}

.invoice-sheet{
    width:210mm;
    min-height:297mm;
    margin:20px auto;
    background:#fff;
    padding:12mm 13mm;
    box-sizing:border-box;
    font-family:Arial,sans-serif;
    color:#111;
    border:1px solid #ddd;
    box-shadow:0 8px 28px rgba(0,0,0,.12);
    overflow:hidden;
}

.invoice-sheet .top-area{
    display:grid;
    grid-template-columns:1.15fr .85fr;
    gap:16px;
    direction:ltr;
}

.invoice-sheet .company{
    direction:ltr;
    text-align:left;
}

.invoice-sheet .company h2{
    margin:0 0 10px;
    font-size:19px;
}

.invoice-sheet .company p{
    margin:5px 0;
    font-size:13px;
    font-weight:bold;
}

.invoice-sheet .owner-name{
    background:#dfe5ec;
    padding:6px;
    width:360px;
    text-align:center;
    font-weight:bold;
    direction:rtl;
}

.invoice-sheet .invoice-title{
    text-align:center;
}

.invoice-sheet .invoice-title h1{
    font-size:36px;
    color:var(--navy);
    margin:8px 0 14px;
}

.invoice-sheet .logo-box{
    width:220px;
    margin:0 auto;
    text-align:center;
}

.invoice-sheet .logo-icon{
    font-size:56px;
    line-height:1;
    display:block;
    margin-bottom:18px;
}

.invoice-sheet .logo-text{
    font-size:13px;
    font-weight:bold;
    direction:rtl;
    line-height:1.8;
    margin-top:0;
}

.invoice-sheet .middle-area{
    display:grid;
    grid-template-columns:1fr 360px;
    gap:22px;
    margin-top:18px;
    direction:ltr;
}

.invoice-sheet .customer-label{
    background:#dfe5ec;
    padding:7px;
    font-weight:bold;
    width:360px;
}

.invoice-sheet .customer-name,
.invoice-sheet .customer-phone{
    width:360px;
    min-height:34px;
    border:1px solid #555;
    margin-top:8px;
    display:flex;
    align-items:center;
    justify-content:center;
    font-weight:bold;
}

.invoice-sheet .customer-name{direction:rtl}
.invoice-sheet .customer-phone{direction:ltr}

.invoice-sheet .meta-table{
    width:100%;
    border-collapse:collapse;
    direction:ltr;
    font-size:13px;
}

.invoice-sheet .meta-table td{
    border:1px solid #555;
    padding:7px;
}

.invoice-sheet .meta-table td:first-child{font-weight:bold}
.invoice-sheet .meta-table td:last-child{text-align:center}

.invoice-sheet .items{
    width:100%;
    border-collapse:collapse;
    margin-top:28px;
    direction:ltr;
    font-size:13px;
    border-radius:0;
}

.invoice-sheet .items th{
    background:#071227;
    color:white;
    padding:8px;
}

.invoice-sheet .items td{
    padding:7px;
    border-bottom:1px dashed #aaa;
    text-align:center;
    height:28px;
}

.invoice-sheet .desc-cell{
    direction:rtl;
    text-align:center!important;
    font-weight:bold;
}

.invoice-sheet .category{
    color:var(--navy);
    margin-bottom:4px;
}

.invoice-sheet .note-red{
    color:#b00020;
    font-weight:bold;
    margin-top:6px;
}

.invoice-sheet .summary{
    width:330px;
    margin-left:auto;
    margin-top:42px;
    direction:ltr;
}

.invoice-sheet .summary table{
    width:100%;
    border-collapse:collapse;
    font-size:13px;
    border-radius:0;
}

.invoice-sheet .summary td{
    border:1px solid #777;
    padding:8px;
}

.invoice-sheet .net-label{
    background:#071227;
    color:white;
    font-size:16px;
    font-weight:bold;
}

.invoice-sheet .net-value{
    background:#58a91f;
    font-weight:bold;
    text-align:right;
}

.invoice-sheet .signatures{
    display:grid;
    grid-template-columns:1fr 1fr;
    margin-top:38px;
    direction:ltr;
    font-size:16px;
    font-weight:bold;
}

.invoice-sheet .footer-note{
    margin-top:30px;
    text-align:center;
    font-size:13px;
    line-height:1.6;
    font-weight:bold;
    direction:rtl;
}

.invoice-sheet .footer-note .english{
    direction:ltr;
    font-size:12px;
}

.invoice-sheet .payment-box{
    margin:16px auto 0;
    border:2px solid #555;
    border-radius:14px;
    padding:12px;
    max-width:680px;
    text-align:center;
    font-size:17px;
    font-weight:bold;
    direction:rtl;
}

@media print{
    html,body{
        width:210mm;
        height:297mm;
        margin:0!important;
        padding:0!important;
        background:white!important;
        overflow:hidden!important;
    }

    .invoice-actions,
    .topbar,
    .header,
    .footer,
    .float-whatsapp,
    .mobile-bottom,
    .sidebar,
    .top-header,
    .admin-footer{
        display:none!important;
    }

    .admin-main{
        margin:0!important;
        width:100%!important;
    }

    .admin-container,
    .container{
        padding:0!important;
        max-width:none!important;
        margin:0!important;
    }

    body{
        padding-bottom:0!important;
    }

    .invoice-sheet{
        width:210mm!important;
        height:297mm!important;
        min-height:297mm!important;
        margin:0!important;
        padding:9mm 11mm!important;
        border:none!important;
        box-shadow:none!important;
        transform:scale(.94);
        transform-origin:top center;
        page-break-inside:avoid!important;
        overflow:hidden!important;
    }

    .invoice-sheet .items{
        margin-top:22px!important;
    }

    .invoice-sheet .items td{
        height:24px!important;
        padding:5px!important;
    }

    .invoice-sheet .summary{
        margin-top:30px!important;
    }

    .invoice-sheet .signatures{
        margin-top:28px!important;
    }

    .invoice-sheet .footer-note{
        margin-top:22px!important;
    }

    .invoice-sheet .payment-box{
        margin-top:10px!important;
        padding:10px!important;
        font-size:15px!important;
    }

    table,tr,td,th,div{
        page-break-inside:avoid!important;
    }

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

@media(max-width:850px){
    .nav{display:none}
    .header{padding:12px 16px}
    .header-actions .btn-dark{display:none}
    .hero h1{font-size:30px}
    .form-grid{grid-template-columns:1fr}
    .footer-wrap{grid-template-columns:1fr;text-align:center}
    .mobile-bottom{
        display:flex;
        position:fixed;
        bottom:0;
        right:0;
        left:0;
        background:white;
        border-top:1px solid #ddd;
        z-index:1500;
        justify-content:space-around;
        padding:9px 5px;
    }
    .mobile-bottom a{
        color:var(--navy);
        font-size:13px;
        font-weight:bold;
    }
    body{padding-bottom:62px}
    .float-whatsapp{bottom:75px}
}