:root {
    --font-family-primary: "Tajawal", Tahoma, Arial, sans-serif;
    --brand-red: #c91f2f;
    --brand-black: #151515;
    --primary: #2563eb;
    --primary-400: #60a5fa;
    --primary-600: #1d4ed8;
    --primary-700: #1e40af;
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-300: #93c5fd;
    --accent-blue: #2563eb;
    --success: #15803d;
    --success-50: #f0fdf4;
    --success-800: #166534;
    --warning: #d97706;
    --warning-50: #fffbeb;
    --warning-800: #92400e;
    --danger: #b91c1c;
    --danger-50: #fef2f2;
    --danger-300: #fca5a5;
    --danger-600: #dc2626;
    --danger-800: #991b1b;
    --info: #0369a1;
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --surface-muted: #eef2f7;
    --text: #111827;
    --text-muted: #64748b;
    --border: #dbe3ee;
    --border-strong: #cbd5e1;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --focus-ring: rgba(37, 99, 235, 0.35);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 12px 30px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.11);
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
}

* {
    box-sizing: border-box;
}

html {
    direction: rtl;
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        linear-gradient(180deg, rgba(37, 99, 235, 0.04), rgba(37, 99, 235, 0) 280px),
        var(--bg);
    font-family: var(--font-family-primary);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.65;
    letter-spacing: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

button,
input,
select,
textarea {
    font: inherit;
    letter-spacing: 0;
}

button {
    cursor: pointer;
}

.container,
.page-container,
.page-content,
.container-fluid,
.main-content {
    width: min(1560px, calc(100% - 32px));
    margin-inline: auto;
}

.page-container,
.page-content,
.main-content {
    padding-block: 18px 36px;
}

.container-fluid {
    padding-inline: 0;
}

.w-100 {
    width: 100% !important;
}

.text-center {
    text-align: center !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-success {
    color: var(--success) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.text-primary {
    color: var(--primary) !important;
}

.font-bold {
    font-weight: 800 !important;
}

.font-mono {
    font-family: Consolas, "Courier New", monospace;
    direction: ltr;
    unicode-bidi: plaintext;
}

.text-sm {
    font-size: 12px !important;
}

.m-0 {
    margin: 0 !important;
}

.mb-4 {
    margin-bottom: 16px !important;
}

.mt-3 {
    margin-top: 12px !important;
}

.mt-lg {
    margin-top: 20px !important;
}

.p-0 {
    padding: 0 !important;
}

.p-3 {
    padding: 12px !important;
}

.p-5 {
    padding: 28px !important;
}

.pt-3 {
    padding-top: 12px !important;
}

.border-top {
    border-top: 1px solid var(--border) !important;
}

.border-bottom {
    border-bottom: 1px solid var(--border) !important;
}

.d-flex {
    display: flex !important;
}

.align-items-center {
    align-items: center !important;
}

.align-items-end {
    align-items: flex-end !important;
}

.justify-content-between {
    justify-content: space-between !important;
}

.justify-content-center {
    justify-content: center !important;
}

.gap-2 {
    gap: 8px !important;
}

.gap-3 {
    gap: 12px !important;
}

.row {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 12px;
}

.g-3 {
    gap: 12px !important;
}

.col-md-3 {
    grid-column: span 3;
    min-width: 0;
}

.col-md-4 {
    grid-column: span 4;
    min-width: 0;
}

.col-md-6 {
    grid-column: span 6;
    min-width: 0;
}

.col-md-12 {
    grid-column: 1 / -1;
}

.badge,
.badge-pill,
.badge-pill-gray,
.badge-text,
.result-count,
.role-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 24px;
    padding: 4px 9px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}

.badge-success,
.badge-success-soft,
.role-tag.admin {
    color: var(--success);
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.badge-warning,
.badge-warning-soft {
    color: var(--warning);
    border-color: #fde68a;
    background: #fffbeb;
}

.badge-danger,
.badge-danger-soft {
    color: var(--danger);
    border-color: #fecaca;
    background: #fef2f2;
}

.badge-info,
.badge-info-soft {
    color: var(--info);
    border-color: #bae6fd;
    background: #f0f9ff;
}

.badge-gray-soft,
.badge-secondary,
.role-tag.user {
    color: var(--text-muted);
    border-color: var(--border);
    background: var(--surface-soft);
}

.badge-purple {
    color: #6d28d9;
    border-color: #ddd6fe;
    background: #f5f3ff;
}

.no-print {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
}

.alert,
.alert-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.alert-banner {
    align-items: stretch;
    padding: 0;
    overflow: hidden;
}

.alert-banner .alert-icon {
    flex: 0 0 44px;
    display: grid;
    place-items: center;
    font-size: 17px;
}

.alert-banner .alert-content {
    flex: 1 1 auto;
    min-width: 0;
    padding: 12px 6px;
}

.alert-banner .alert-close {
    flex: 0 0 40px;
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 20px;
    line-height: 1;
    opacity: 0.72;
}

.alert-banner .alert-close:hover {
    opacity: 1;
    background: rgba(15, 23, 42, 0.05);
}

.alert-success {
    color: var(--success);
    border-color: #bbf7d0;
    background: #f0fdf4;
}

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

.amount-cell,
.amount-blue,
.amount-invoices {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.amount-positive,
.amount-net,
.amount-adjustment--positive {
    color: var(--success) !important;
    font-weight: 700;
}

.amount-negative,
.amount-red,
.amount-adjustment--negative {
    color: var(--danger) !important;
    font-weight: 700;
}

.amount-orange,
.amount-delivery {
    color: var(--warning) !important;
    font-weight: 700;
}

.amount-blue {
    color: var(--accent-blue) !important;
    font-weight: 700;
}

.empty-state {
    padding: 40px 24px;
    text-align: center;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
}

.empty-state-icon {
    color: var(--primary);
    font-size: 34px;
    margin-bottom: 10px;
}

.empty-state-title {
    margin: 0;
    color: var(--text);
    font-size: 18px;
}

.empty-state-text {
    margin: 6px 0 0;
}

.edara-return-link {
    color: #0f766e;
    font-weight: 800;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    white-space: nowrap;
}

.edara-return-link:hover,
.edara-return-link:focus-visible {
    color: #0b5f59;
    text-decoration-thickness: 2px;
}

@media (max-width: 780px) {
    .container,
    .page-container,
    .page-content,
    .container-fluid,
    .main-content {
        width: min(100% - 20px, 1480px);
    }

    body {
        font-size: 15px;
    }
}

@media (max-width: 980px) {
    .col-md-3,
    .col-md-4,
    .col-md-6 {
        grid-column: span 6;
    }
}

@media (max-width: 640px) {
    .row {
        grid-template-columns: 1fr;
    }

    .col-md-3,
    .col-md-4,
    .col-md-6,
    .col-md-12 {
        grid-column: 1 / -1;
    }
}

@media print {
    body {
        background: #fff !important;
        color: #111 !important;
    }

    .no-print,
    .main-header,
    .main-navigation,
    .action-bar,
    .quick-search-filter,
    .quick-filters-buttons,
    .view-controls-modern,
    .tabs-container {
        display: none !important;
    }
}
