/* ITQAN quotation / invoice: viewing document (.iq) and editing screen (.iq-edit) */

@font-face {
    font-family: "Noto Kufi Arabic";
    src: url("../fonts/itqan/NotoKufiArabic-Variable.ttf") format("truetype");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

.iq,
.iq-edit {
    --iq-navy: #0a2240;
    --iq-green: #0f7a4c;
    --iq-ink: #1a2533;
    --iq-muted: #6b7684;
    --iq-line: #dde3ea;
    --iq-rule: #0a2240;
    --iq-field: #cfd7e0;
    --iq-soft: #f7f9fb;
    --iq-radius: 6px;
    --iq-font: "Noto Kufi Arabic", sans-serif;
    color: var(--iq-ink);
    font-size: 13.5px;
    font-weight: 400;
    line-height: 1.75;
}

/* The theme sets its own font stack with !important on headings, cards, tables and form controls. */
.iq,
.iq-edit,
:is(.iq, .iq-edit) *:not(i):not(.mdi):not([class^="ti-"]):not([class*=" ti-"]):not([class^="icon-"]):not([class*=" icon-"]) {
    font-family: var(--iq-font) !important;
}

.iq *,
.iq-edit * {
    box-sizing: border-box;
}

.iq-ltr {
    direction: ltr;
    unicode-bidi: isolate;
}

/* ---------- shared building blocks ---------- */

.iq-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 36px;
    background: var(--iq-navy);
    border-bottom: 3px solid var(--iq-green);
    color: #fff;
}

.iq-brand {
    display: flex;
    align-items: center;
    gap: 18px;
}

.iq-brand__logo {
    background: #fff;
    border-radius: 4px;
    padding: 6px 10px;
}

.iq-brand__logo img {
    display: block;
    height: 52px;
    width: auto;
}

.iq-brand__name {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.5;
}

.iq-brand__en {
    font-size: 11.5px;
    font-weight: 400;
    color: #b9c7d8;
    letter-spacing: .02em;
}

.iq-brand__reg {
    margin-top: 2px;
    font-size: 11.5px;
    color: #b9c7d8;
}

.iq-brand__reg b {
    color: #fff;
    font-weight: 500;
}

.iq-title {
    text-align: end;
}

.iq-title h2 {
    margin: 0;
    color: #fff;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.4;
}

.iq-title h2 .iq-ltr {
    font-size: 13px;
    font-weight: 400;
    color: #b9c7d8;
}

.iq-title__en {
    display: block;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .28em;
    color: #b9c7d8;
    text-transform: uppercase;
}

.iq-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 26px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--iq-line);
    font-size: 14px;
    font-weight: 700;
    color: var(--iq-navy);
}

.iq-section-title::before {
    content: "";
    width: 4px;
    height: 16px;
    background: var(--iq-green);
}

.iq-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.iq-card {
    border: 1px solid var(--iq-line);
    border-radius: var(--iq-radius);
    overflow: hidden;
}

.iq-card h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 10px 16px;
    background: var(--iq-soft);
    border-bottom: 1px solid var(--iq-line);
    font-size: 13.5px;
    font-weight: 700;
    color: var(--iq-navy);
}

.iq-card dl {
    margin: 0;
    padding: 4px 16px 8px;
}

.iq-card dl div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid #eef1f4;
}

.iq-card dl div:last-child {
    border-bottom: 0;
}

.iq-card dt {
    font-weight: 400;
    color: var(--iq-muted);
    white-space: nowrap;
}

.iq-card dd {
    margin: 0;
    font-weight: 500;
    text-align: end;
    overflow-wrap: anywhere;
}

.iq-terms {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 20px;
}

.iq-terms ol {
    margin: 0;
    padding: 4px 0 0;
    padding-inline-start: 22px;
    list-style: arabic-indic;
}

.iq-terms li {
    text-align: start;
    padding: 3px 0;
    padding-inline-start: 4px;
}

.iq-terms li::marker {
    color: var(--iq-green);
    font-weight: 700;
}

.iq-bank {
    border: 1px solid var(--iq-line);
    border-top: 3px solid var(--iq-navy);
    border-radius: var(--iq-radius);
    padding: 14px 16px;
    background: var(--iq-soft);
    color: var(--iq-muted);
    font-size: 12.5px;
}

.iq-bank h5 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 4px;
    color: var(--iq-navy);
    font-size: 13.5px;
    font-weight: 700;
}

.iq-bank .iban {
    display: block;
    direction: ltr;
    margin-top: 8px;
    padding: 8px 10px;
    border: 1px solid var(--iq-line);
    border-radius: 4px;
    background: #fff;
    color: var(--iq-ink);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .06em;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

/* ---------- viewing document ---------- */

.invoice-wrapper:has(> .iq) {
    background: transparent !important;
    box-shadow: none !important;
    border: 0 !important;
    padding: 8px 0 !important;
    backdrop-filter: none !important;
}

.iq {
    max-width: 900px;
    margin: 0 auto 18px;
    background: #fff;
    border: 1px solid var(--iq-line);
    border-radius: var(--iq-radius);
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(10, 34, 64, .06);
}

.iq-body {
    padding: 28px 36px 10px;
}

.iq-body > .iq-cards,
.iq-body > .iq-meta,
.iq-body > .iq-items,
.iq-body > .iq-summary,
.iq-body > .iq-terms {
    margin-bottom: 24px;
}

.iq-body > .iq-section-title {
    margin-top: 0;
}

.iq-meta {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border: 1px solid var(--iq-line);
    border-radius: var(--iq-radius);
    overflow: hidden;
}

.iq-meta > div {
    padding: 10px 16px;
    border-inline-start: 1px solid var(--iq-line);
    font-size: 11.5px;
    color: var(--iq-muted);
}

.iq-meta > div:first-child {
    border-inline-start: 0;
}

.iq-meta b {
    display: block;
    margin-top: 2px;
    font-size: 14px;
    font-weight: 600;
    color: var(--iq-ink);
}

.iq-items {
    width: 100%;
    border-collapse: collapse;
}

.iq-items th {
    padding: 10px 12px;
    border-top: 2px solid var(--iq-rule);
    border-bottom: 1px solid var(--iq-rule);
    background: var(--iq-soft);
    color: var(--iq-navy);
    font-size: 12px;
    font-weight: 700;
    text-align: start;
}

.iq-items td {
    padding: 12px;
    border-bottom: 1px solid var(--iq-line);
    vertical-align: top;
}

.iq-items .n {
    width: 40px;
    text-align: center;
    color: var(--iq-muted);
}

.iq-items .num {
    text-align: end;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.iq-items .c {
    text-align: center;
}

.iq-items .desc {
    font-weight: 500;
}

.iq-items .desc small {
    display: block;
    margin-top: 2px;
    font-size: 11.5px;
    font-weight: 400;
    color: var(--iq-muted);
}

.iq-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 20px;
    align-items: start;
}

.iq-proof {
    display: flex;
    gap: 16px;
    align-items: stretch;
}

.iq-qr {
    flex: 0 0 auto;
    border: 1px solid var(--iq-line);
    border-radius: var(--iq-radius);
    padding: 8px;
    background: #fff;
}

.iq-qr img {
    display: block;
    width: 112px;
    height: 112px;
}

.iq-words {
    flex: 1 1 auto;
    padding: 12px 16px;
    border: 1px solid var(--iq-line);
    border-inline-start: 3px solid var(--iq-green);
    border-radius: var(--iq-radius);
    font-size: 12px;
    color: var(--iq-muted);
    text-align: start;
}

.iq-words b {
    display: block;
    margin-top: 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--iq-ink);
}

.iq-totals div {
    display: flex;
    justify-content: space-between;
    padding: 9px 4px;
    border-bottom: 1px solid var(--iq-line);
    color: var(--iq-muted);
}

.iq-totals div b {
    color: var(--iq-ink);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.iq-totals .grand {
    margin-top: 6px;
    padding: 12px 14px;
    border: 0;
    border-radius: 4px;
    background: var(--iq-navy);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
}

.iq-totals .grand b {
    color: #fff;
    font-size: 17px;
    font-weight: 700;
}

.iq-signs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 32px;
    margin: 12px 0 30px;
}

.iq-signs div {
    height: 78px;
    border-bottom: 1px solid var(--iq-ink);
    font-size: 12px;
    font-weight: 600;
    color: var(--iq-muted);
}

.iq-foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 22px;
    padding: 14px 36px;
    border-top: 1px solid var(--iq-line);
    background: var(--iq-soft);
    font-size: 12px;
    color: var(--iq-muted);
}

.iq-foot span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.iq-foot i {
    color: var(--iq-navy);
    font-size: 15px;
}

.iq-foot b {
    color: var(--iq-navy);
    font-weight: 700;
}

/* ---------- editing screen ---------- */

.invoice-wrapper.iq-edit {
    max-width: 980px;
    margin-inline: auto;
    padding: 0 !important;
    overflow: hidden;
    background: #fff !important;
    border: 1px solid var(--iq-line) !important;
    border-radius: var(--iq-radius) !important;
    box-shadow: 0 2px 12px rgba(10, 34, 64, .06) !important;
}

.iq-edit > .row {
    margin: 0;
    padding: 0 32px 26px;
}

.iq-edit .iq-head {
    padding: 18px 32px;
}

.iq-edit .iq-brand__logo img {
    height: 40px;
}

.iq-edit .iq-title h2 {
    font-size: 20px;
}

.iq-edit-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 3px 12px;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.iq-edit-badge i {
    font-size: 14px;
}

.iq-edit-hint {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 20px 32px 0;
    padding: 10px 14px;
    border: 1px solid #ecdcae;
    border-inline-start: 3px solid #b8860b;
    border-radius: 4px;
    background: #fdfaf1;
    color: #5c4700;
    font-size: 13px;
}

.iq-edit-hint i {
    font-size: 17px;
    color: #b8860b;
}

.iq-edit-parties {
    margin: 20px 32px 0;
}

.iq-edit #invoice-dates-wrapper {
    margin: 0 !important;
}

.iq-edit .invoice-dates {
    float: none !important;
    width: 100%;
}

.iq-edit .invoice-dates table,
.iq-edit .invoice-dates tbody {
    display: grid;
    width: 100%;
}

.iq-edit .invoice-dates tbody {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.iq-edit .invoice-dates tr {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.iq-edit .invoice-dates td {
    padding: 0 !important;
    text-align: start !important;
    font-size: 12px;
    color: var(--iq-muted);
}

.iq-edit .form-control {
    min-height: 40px;
    border: 1px solid var(--iq-field);
    border-radius: 4px;
    background: #fff;
    font-size: 13.5px;
    font-weight: 400;
}

.iq-edit .form-control:focus {
    border-color: var(--iq-navy);
    box-shadow: 0 0 0 2px rgba(10, 34, 64, .10);
}

.iq-edit .form-control[readonly],
.iq-edit .form-control[disabled] {
    background: var(--iq-soft);
    color: var(--iq-navy);
    font-weight: 600;
}

.iq-edit .invoice-table-wrapper {
    margin-top: 0 !important;
    overflow-x: auto;
}

.iq-edit .invoice-table {
    width: 100%;
    margin-bottom: 0;
    border-collapse: collapse;
}

.iq-edit .invoice-table th,
.iq-edit .invoice-table td {
    min-width: 0 !important;
    width: auto;
}

.iq-edit .invoice-table thead th {
    padding: 10px 8px;
    border: 0;
    border-top: 2px solid var(--iq-rule);
    border-bottom: 1px solid var(--iq-rule);
    background: var(--iq-soft) !important;
    color: var(--iq-navy) !important;
    font-size: 12px;
    font-weight: 700;
    text-align: start !important;
}

.iq-edit .invoice-table tbody td {
    padding: 12px 6px;
    border-top: 0;
    border-bottom: 1px solid var(--iq-line);
    vertical-align: top;
}

.iq-edit .invoice-table input.form-control {
    padding: 6px 8px;
    direction: ltr;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.iq-edit .invoice-table .x-action {
    width: 34px;
}

.iq-edit .invoice-table .x-description {
    min-width: 170px !important;
    width: 45%;
}

.iq-edit .invoice-table .x-quantity {
    min-width: 72px !important;
    width: 80px;
}

.iq-edit .invoice-table .x-rate,
.iq-edit .invoice-table .x-price,
.iq-edit .invoice-table .x-total {
    min-width: 112px !important;
    width: 130px;
}

/* The unit is always «خدمة»; the column stays in the DOM because the line templates submit lineitem_unit. */
.iq-edit .invoice-table .x-unit {
    display: none;
}

.iq-edit .invoice-item-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding-top: 0 !important;
}

.iq-edit .invoice-item-actions .btn {
    padding: 7px 14px;
    border: 1px solid var(--iq-field);
    border-radius: 4px;
    background: #fff;
    color: var(--iq-navy);
    font-size: 12.5px;
    font-weight: 500;
}

.iq-edit .invoice-item-actions .btn:hover {
    border-color: var(--iq-navy);
}

.iq-edit .invoice-item-actions .btn i {
    color: var(--iq-green) !important;
}

.iq-edit #bill-totals-wrapper > .pull-right {
    float: none !important;
    max-width: 340px;
    margin: 8px 0 0 !important;
    margin-inline-start: auto !important;
}

.iq-edit .invoice-total-table {
    width: 100%;
    border-collapse: collapse;
}

.iq-edit .invoice-total-table td {
    padding: 9px 4px !important;
    border-bottom: 1px solid var(--iq-line);
    font-size: 13.5px;
    color: var(--iq-muted);
}

.iq-edit .invoice-total-table td:last-child {
    text-align: end;
    color: var(--iq-ink);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.iq-edit #billing-sums-total-container td {
    padding: 12px 14px !important;
    border-bottom: 0;
    background: var(--iq-navy);
    color: #fff !important;
    font-size: 15px;
    font-weight: 700;
}

.iq-edit #billing-sums-total-container td,
.iq-edit #billing-sums-total-container td span {
    font-size: 15px !important;
    white-space: nowrap;
}

.iq-edit .bill-taxes-discounts-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 0 0 !important;
}

.iq-edit .bill-taxes-discounts-container .btn {
    margin: 0 !important;
    padding: 5px 12px !important;
    border: 1px solid var(--iq-field);
    border-radius: 4px;
    background: #fff;
    color: var(--iq-muted);
    font-size: 12px;
    font-weight: 400;
}

.iq-edit-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 26px;
    padding-top: 16px;
    border-top: 1px solid var(--iq-line);
}

.iq-edit-actions p {
    margin: 0;
    color: var(--iq-muted);
    font-size: 12.5px;
}

.iq-edit-actions .btn {
    padding: 8px 20px;
    border-radius: 4px;
    font-weight: 500;
}

.iq-edit-actions #billing-save-button {
    background: var(--iq-navy);
    border-color: var(--iq-navy);
    color: #fff;
}

/* ---------- responsive / print ---------- */

@media (max-width: 991px) {
    .iq-summary,
    .iq-terms {
        grid-template-columns: 1fr;
    }

    .iq-meta {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .iq-meta > div:nth-child(3) {
        border-inline-start: 0;
    }

    .iq-meta > div:nth-child(n + 3) {
        border-top: 1px solid var(--iq-line);
    }
}

@media (max-width: 767px) {
    .iq-edit > .row {
        padding: 0 16px 20px;
    }

    .iq-edit-parties,
    .iq-edit-hint {
        margin-inline: 16px;
    }

    .iq-edit .invoice-dates tbody {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .iq-head,
    .iq-body,
    .iq-foot {
        padding-inline: 18px;
    }

    .iq-title {
        text-align: start;
    }

    .iq-cards,
    .iq-signs {
        grid-template-columns: 1fr;
    }

    .iq-proof {
        flex-direction: column;
    }

    .iq-items thead {
        display: none;
    }

    .iq-items,
    .iq-items tbody,
    .iq-items tr,
    .iq-items td {
        display: block;
        width: 100%;
    }

    .iq-items tr {
        padding: 8px 0;
        border-bottom: 1px solid var(--iq-line);
    }

    .iq-items td {
        padding: 3px 12px;
        border: 0;
        text-align: start !important;
    }

    .iq-items td[data-label]::before {
        content: attr(data-label) ": ";
        color: var(--iq-muted);
    }

    .iq-items .n {
        display: none;
    }
}

@media print {
    .iq {
        max-width: none;
        border: 0;
        box-shadow: none;
    }

    .iq-head,
    .iq-totals .grand,
    .iq-items th {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
