@font-face {
    font-family: 'Speda';
    src: local('Speda'), url('https://cdn.jsdelivr.net/gh/Unikurd/fonts/speda/speda.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

* {
    box-sizing: border-box;
    font-family: 'Speda', 'Tajawal', 'Noto Sans Arabic', sans-serif;
    margin: 0;
    padding: 0;
}

body {
    background-color: #cbd5e1;
    color: #000000;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    min-height: 100vh;
}

.dashboard-bar {
    width: 210mm;
    background: #ffffff;
    padding: 8px 15px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1.5px solid #000000;
}

.dashboard-title {
    font-size: 14px;
    font-weight: 800;
    color: #000000;
}

.action-buttons {
    display: flex;
    gap: 6px;
    flex-direction: row-reverse;
}

.btn {
    padding: 6px 12px;
    border: 1px solid #000000;
    cursor: pointer;
    font-weight: 800;
    font-size: 11px;
    border-radius: 4px;
    color: #ffffff;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    direction: rtl;
}

.btn:hover {
    opacity: 0.9;
}

.btn-primary { background-color: #2563eb; }
.btn-success { background-color: #16a34a; }
.btn-archive { background-color: #0284c7; }
.btn-warning { background-color: #d97706; color: white; }
.btn-danger  { background-color: #dc2626; }
.btn-small   { padding: 4px 8px; background: #000000; font-size: 11px; border-radius: 3px; }
.btn-dashboard { background-color: #475569; color: #ffffff !important; text-decoration: none; }

.page-a4 {
    width: 210mm;
    height: 297mm;
    max-height: 297mm;
    background: #ffffff;
    padding: 6mm;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
}

.a4-frame-border {
    border: 2.5px solid #000000;
    border-radius: 4px;
    padding: 8mm 10mm;
    height: 100%;
    box-sizing: border-box;
    position: relative;
}

.watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.08;
    pointer-events: none;
    z-index: 0;
}

.watermark img {
    width: 340px;
    height: auto;
    display: block;
}

.content-wrapper {
    position: relative;
    z-index: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.header-container {
    border: 2px solid #000000;
    border-radius: 6px;
    background: #ffffff;
    padding: 10px 14px 8px 14px;
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
}

.header-right { width: 38%; text-align: right; color: #000000; }
.header-right h2 { font-size: 15px; font-weight: 900; line-height: 1.2; color: #000000; }
.header-right h3 { font-size: 14px; font-weight: 900; color: #000000; margin-top: 2px; }
.header-right p  { font-size: 14px; font-weight: 800; color: #000000; }

.header-center { width: 24%; display: flex; justify-content: center; align-items: center; }
.logo-wrapper { padding: 4px; border: 1px solid #cbd5e1; border-radius: 50%; background: #ffffff; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.logo { max-width: 75px; max-height: 75px; object-fit: contain; display: block; }

.header-left { width: 38%; text-align: left; direction: ltr; color: #000000; }
.header-left h2 { font-size: 14px; font-weight: 900; line-height: 1.2; color: #000000; }
.header-left h3 { font-size: 14px; font-weight: 900; color: #000000; margin-top: 2px; }
.header-left p  { font-size: 14px; font-weight: 800; color: #000000; }

.info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f1f5f9;
    border-top: 2px solid #000000;
    margin: 6px -14px -8px -14px;
    padding: 6px 14px;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    font-size: 12.5px;
    color: #000000;
}

.date-box { font-weight: 800; }
.date-box strong { color: #0f172a; }
.date-box .sep { margin: 0 4px; color: #94a3b8; }

.order-title {
    font-size: 13.5px;
    font-weight: 900;
    color: #0f172a;
    background: #e2e8f0;
    padding: 2px 12px;
    border-radius: 12px;
    border: 1px solid #cbd5e1;
}

.order-number-box { font-weight: 800; }
.order-number-box strong { color: #1e40af; font-size: 13.5px; }

#purchaseForm {
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: space-between;
}

.form-body { display: flex; flex-direction: column; }
.form-grid { display: flex; gap: 12px; margin-bottom: 10px; width: 100%; }
.form-group { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.form-group.full-width { flex: 2; }
label { font-size: 12px; font-weight: 900; color: #000000; white-space: nowrap; }

.clean-input, .clean-select {
    width: 100%;
    height: 36px;
    border: 1.5px solid #000000;
    border-radius: 5px;
    background: #ffffff;
    padding: 4px 10px;
    font-size: 12.5px;
    font-weight: 900;
    color: #000000;
    outline: none;
    box-sizing: border-box;
    text-align: center;
    text-align-last: center;
}

.clean-input::placeholder { color: #94a3b8; font-weight: 700; text-align: center; }
.clean-select { cursor: pointer; direction: rtl; background: #ffffff url("data:image/svg+xml;utf8,<svg fill='black' height='20' viewBox='0 0 24 24' width='20' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>") no-repeat left 8px center; padding-left: 28px; padding-right: 8px; }
.bold-text { font-weight: 900 !important; }

.items-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.items-table th, .items-table td { border: 1.5px solid #000000; padding: 2px 4px; text-align: center; font-size: 12.5px; color: #000000; font-weight: 900; height: 32px; }
.items-table th { background-color: #cbd5e1; font-weight: 900; padding: 6px 4px; }
.items-table input, .items-table select { width: 100%; height: 100%; min-height: 28px; border: none; background: transparent; text-align: center; font-size: 13px; font-weight: 900; color: #000000; outline: none; padding: 2px 4px; }
.items-table input.item-name { text-align: right; padding-right: 8px; }
.items-table input:focus, .items-table select:focus { background-color: #eff6ff; border-radius: 2px; }

.table-actions { margin-top: 5px; text-align: right; }
.totals-section { display: flex; justify-content: flex-end; gap: 12px; margin-top: 8px; }
.total-box { border-radius: 5px; padding: 6px 16px; font-size: 13px; font-weight: 900; display: flex; align-items: center; gap: 8px; }
.total-box-iqd { background-color: #ecedad; color: #000103; border: 2px solid #702f0f; }
.total-box-usd { background-color: #dcfce7; color: #000103; border: 2px solid #8799c2; }
.total-amount { font-size: 15px; font-weight: 900; }

.policy-section { margin-top: 8px; border: 2px solid #dc2626; background-color: #fef2f2; border-radius: 5px; padding: 6px 12px; }
.policy-section h4 { color: #991b1b; font-size: 12.5px; font-weight: 900; margin-bottom: 3px; }
.policy-section ul { margin-right: 18px; }
.policy-section li { color: #dc2626; font-size: 12px; font-weight: 800; line-height: 1.35; }

.signatures-grid { display: flex; justify-content: space-between; margin-top: auto; padding-top: 15px; text-align: center; }
.sig-box { width: 18%; font-size: 12px; font-weight: 900; color: #000000; }
.sig-line { margin-top: 25px; border-bottom: 2px solid #000000; }

/* ==========================================
   دیزاینی نوێی مۆدێرنی ئەرشیف (Modal Archives)
   ========================================== */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    justify-content: center; align-items: center;
    z-index: 9999;
}

.modal-content.archive-theme {
    width: 90%;
    max-width: 950px;
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px 24px;
    border: 1px solid #cbd5e1;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.archive-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 16px;
}

.archive-title { font-size: 18px; font-weight: 900; color: #0f172a; }
.close-btn { cursor: pointer; font-size: 26px; font-weight: bold; color: #64748b; }
.close-btn:hover { color: #ef4444; }

.archive-controls { margin-bottom: 16px; }
.archive-search-input {
    width: 100%;
    height: 40px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 800;
    outline: none;
}
.archive-search-input:focus { border-color: #0284c7; box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15); }

.archive-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 60vh;
    overflow-y: auto;
    padding-left: 4px;
}

.archive-grid::-webkit-scrollbar { width: 6px; }
.archive-grid::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.archive-card {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease-in-out;
}

.archive-card:hover { border-color: #0284c7; box-shadow: 0 4px 10px rgba(0,0,0,0.05); }

.archive-info-main { display: flex; flex-direction: column; gap: 4px; }
.archive-card-header { display: flex; align-items: center; gap: 8px; }
.archive-badge { background: #e0f2fe; color: #0369a1; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 900; }
.archive-date { font-size: 12px; color: #64748b; font-weight: 800; }
.archive-details { font-size: 13.5px; font-weight: 900; color: #1e293b; }
.archive-subtext { font-size: 12px; color: #64748b; font-weight: 700; }

.archive-totals { display: flex; gap: 8px; align-items: center; }
.archive-price-tag { padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 900; }
.price-iqd { background: #fef9c3; color: #854d0e; }
.price-usd { background: #dcfce7; color: #166534; }

.archive-actions { display: flex; gap: 6px; }
.btn-archive-view { background: #0284c7; color: white; padding: 6px 10px; border-radius: 6px; border: none; cursor: pointer; font-weight: 800; font-size: 12px; }
.btn-archive-delete { background: #ef4444; color: white; padding: 6px 10px; border-radius: 6px; border: none; cursor: pointer; font-weight: 800; font-size: 12px; }
.btn-archive-view:hover { background: #0369a1; }
.btn-archive-delete:hover { background: #dc2626; }

@media print {
    @page { size: A4 portrait; margin: 0; }
    body { background: none !important; padding: 0 !important; margin: 0 !important; color: #000000 !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
    .no-print, .dashboard-bar, .table-actions { display: none !important; }
    .page-a4 { width: 210mm !important; height: 297mm !important; max-height: 297mm !important; box-shadow: none !important; padding: 6mm !important; border: none !important; overflow: hidden !important; }
    .a4-frame-border { border: 2.5px solid #000000 !important; height: 100% !important; padding: 6mm 8mm !important; }
    select, .clean-select { -webkit-appearance: none !important; appearance: none !important; background: none !important; padding-left: 0 !important; padding-right: 0 !important; border: 1.5px solid #000000 !important; }
    .clean-input { border: 1.5px solid #000000 !important; background: transparent !important; }
    .items-table input { background: transparent !important; border: none !important; }
}

.manager-approval-box {
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.manager-approval-box.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}