:root {
    --ink: #1e293b;
    --muted: #64748b;
    --accent: #0f766e;
    --accent-dark: #115e59;
    --accent-soft: #ccfbf1;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --amber: #b45309;
    --amber-soft: #fef3c7;
    --indigo: #4338ca;
    --indigo-soft: #e0e7ff;
}

body {
    background-color: var(--bg);
    color: var(--ink);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--ink);
    font-weight: 600;
}

a {
    color: var(--accent);
}
a:hover {
    color: var(--accent-dark);
}

.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 6px rgba(15, 23, 42, 0.04);
}

.btn-primary {
    background-color: var(--accent);
    border-color: var(--accent);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background-color: var(--accent-dark) !important;
    border-color: var(--accent-dark) !important;
}
.btn-outline-primary {
    color: var(--accent);
    border-color: var(--accent);
}
.btn-outline-primary:hover {
    background-color: var(--accent);
    border-color: var(--accent);
}
.btn-outline-secondary:hover {
    background-color: var(--ink);
    border-color: var(--ink);
}

/* ---------- Top navigation ---------- */
.app-navbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.app-navbar .navbar-brand {
    color: var(--ink);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}
.app-navbar .navbar-brand i {
    color: var(--accent);
    font-size: 1.25rem;
}

.app-navbar .nav-link {
    color: var(--muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem 0.85rem !important;
    border-radius: 8px;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.app-navbar .nav-link i {
    font-size: 1rem;
}
.app-navbar .nav-link:hover {
    color: var(--ink);
    background-color: var(--bg);
}
.app-navbar .nav-link.active {
    color: var(--accent);
    background-color: var(--accent-soft);
}

.app-navbar .user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
}
.app-navbar .user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-weight: 700;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ---------- Dashboard stat cards ---------- */
.stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 1.25rem;
}
.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.stat-card .stat-label {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 2px;
}
.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.2;
}
.stat-icon.stat-icon-teal { background: var(--accent-soft); color: var(--accent-dark); }
.stat-icon.stat-icon-amber { background: var(--amber-soft); color: var(--amber); }
.stat-icon.stat-icon-indigo { background: var(--indigo-soft); color: var(--indigo); }

.section-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.section-label {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.filter-divider {
    height: 40px;
    align-self: center;
    opacity: 1;
    border-left: 1px solid var(--border);
}

/* Choices.js searchable dropdown - match the app's look instead of its default blue theme */
.choices__inner {
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
    min-height: calc(1.5em + 0.75rem + 2px);
    font-size: 1rem;
}
.choices.is-focused .choices__inner,
.choices__list--dropdown {
    border-color: var(--accent);
    box-shadow: 0 0 0 0.25rem rgba(15, 118, 110, 0.15);
}
.choices__list--dropdown .choices__item--selectable.is-highlighted,
.choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
    background-color: var(--accent-soft);
    color: var(--accent-dark);
}
.choices__list--single .choices__item {
    color: var(--ink);
}

.table > :not(caption) > * > * {
    color: var(--ink);
}
.table thead th {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom-width: 1px;
    border-color: var(--border);
}

/* Invoice item table header: centered, with a light neutral background */
.invoice-box .table-bordered thead th {
    background-color: var(--bg);
    text-align: center !important;
}

.invoice-box .table-bordered {
    font-size: 0.93em;
}

.cell-currency {
    font-size: 0.85em;
    color: var(--muted);
}

.cell-amount {
    white-space: nowrap;
    width: 1%;
}

.arabic-field {
    direction: rtl;
    text-align: right;
}

.ar-label,
.ar-only-label {
    font-weight: normal;
    color: var(--muted);
    font-size: 0.85em;
}
.ar-label {
    margin-left: 3px;
}

.info-stack td {
    padding: 3px 4px;
    white-space: nowrap;
    vertical-align: top;
}

.info-stack td.ar-only-label {
    text-align: right;
}

.info-stack td:last-child {
    text-align: left;
    color: var(--ink);
    font-weight: 500;
}

.payment-details {
    text-align: right;
}

.payment-details .bank-details-table {
    margin-left: auto;
    text-align: left;
}

.invoice-box {
    background: var(--card-bg);
    padding: 30px;
    max-width: 900px;
    margin: 0 auto;
}

.invoice-box table td {
    vertical-align: top;
}

.invoice-logo {
    max-height: 80px;
    max-width: 220px;
}

.letterhead-space {
    height: 96px;
    border-bottom: 1px dashed var(--border);
    margin-bottom: 20px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.letterhead-hint {
    color: var(--muted);
    font-size: 0.8rem;
    margin-bottom: 4px;
    opacity: 0.7;
}

.qr-code-img {
    width: 105px;
    height: 105px;
}

.totals-table td {
    padding: 4px 8px;
    white-space: nowrap;
}

.totals-table tr.grand-total td {
    font-weight: bold;
    font-size: 1.15rem;
    border-top: 2px solid var(--ink);
}

.bank-details-table {
    border-collapse: collapse;
}

.bank-details-table td {
    padding: 4px 10px;
    border: 1px solid var(--border);
}

.bank-details-table td:first-child {
    color: var(--muted);
    white-space: nowrap;
    min-width: 72px;
    background-color: var(--bg);
}

/* ---------- Print styles: A4 friendly, strictly black & white ---------- */
@media print {
    .no-print {
        display: none !important;
    }

    /* Force pure black text everywhere and strip all background colors/
       shading, so the printed invoice is always plain black & white -
       regardless of the app's on-screen color scheme. */
    * {
        color: #000 !important;
        background: none !important;
        background-color: transparent !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    body {
        background: #fff;
    }
    .invoice-box {
        max-width: 100%;
        padding: 0;
    }
    .letterhead-space {
        height: 33mm;
        border-bottom: none;
    }

    /* Keep table/box borders solid black so they stay crisp on a
       black & white printer (light gray borders can wash out). */
    .table-bordered,
    .table-bordered th,
    .table-bordered td,
    .bank-details-table,
    .bank-details-table td,
    .totals-table tr.grand-total td {
        border-color: #000 !important;
    }

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