@font-face {
    font-family: "Noto Kufi Arabic";
    src: url("/fonts/NotoKufiArabic-Medium.ttf") format("truetype");
    font-weight: 500 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --primary: #155b7d;
    --primary-dark: #0f435d;
    --secondary: #1d7f72;
    --accent: #d99a20;
    --surface: #ffffff;
    --surface-soft: #f4f7f9;
    --border: #d9e2e8;
    --text: #0f2433;
    --muted: #647788;
    --danger: #c3262e;
    --success: #138a4f;
    --radius-lg: 22px;
    --radius-md: 14px;
    --touch-target: 48px;
}

* {
    box-sizing: border-box;
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: "Noto Kufi Arabic", "Noto Kufi Arabic Medium", Tahoma, Arial, sans-serif;
    color: var(--text);
    background: var(--surface-soft);
}

a {
    text-decoration: none;
}

img {
    -webkit-user-drag: none;
    user-select: none;
}

.erpx-notices {
    position: fixed;
    top: max(20px, env(safe-area-inset-top));
    inset-inline-start: max(16px, env(safe-area-inset-left));
    inset-inline-end: auto;
    z-index: 20000;
    display: grid;
    gap: 10px;
    width: min(450px, calc(100vw - 32px));
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    pointer-events: none;
}

html[dir="rtl"] .erpx-notices {
    inset-inline-start: max(16px, env(safe-area-inset-right));
}

.erpx-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--border);
    border-inline-start: 4px solid currentColor;
    border-radius: 10px;
    background: var(--surface);
    color: var(--primary);
    box-shadow: 0 5px 18px #00000014;
    font-size: 14px;
    line-height: 1.7;
    text-align: start;
    pointer-events: auto;
}

.erpx-notice.notice-success { color: var(--success); }
.erpx-notice.notice-error { color: var(--danger); }
.erpx-notice.notice-warning { color: #915900; }
.erpx-notice-content { flex: 1; min-width: 0; }
.erpx-notice strong { display: block; font-weight: 700; }
.erpx-notice p {
    margin: 0;
    font-size: 13px;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.erpx-notice-icon {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    border: 1px solid currentColor;
    border-radius: 50%;
}

.erpx-notice button {
    flex-shrink: 0;
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 23px;
    cursor: pointer;
}

.erpx-notice button:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

.erpx-swal-popup {
    width: min(92vw, 440px) !important;
    border-radius: 16px !important;
    padding: 22px !important;
    direction: inherit;
    font-family: "Noto Kufi Arabic", "Noto Kufi Arabic Medium", Tahoma, Arial, sans-serif !important;
    border: 1px solid rgba(21, 91, 125, .16);
    box-shadow: 0 24px 70px rgba(15, 36, 51, .22) !important;
}

.erpx-swal-title {
    color: var(--text) !important;
    font-size: 1.25rem !important;
    line-height: 1.7 !important;
    font-weight: 800 !important;
    padding: 0 !important;
}

.erpx-swal-text {
    color: var(--muted) !important;
    font-size: .96rem !important;
    line-height: 1.9 !important;
    margin: 8px 0 0 !important;
}

.erpx-swal-actions {
    gap: 10px;
    margin-top: 20px !important;
}

.erpx-swal-confirm,
.erpx-swal-cancel {
    min-width: 104px;
    min-height: 42px;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 8px 18px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

.erpx-swal-confirm {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 10px 22px rgba(21, 91, 125, .18);
}

.erpx-swal-cancel {
    color: var(--text);
    background: #fff;
    border-color: var(--border);
}

.erpx-swal-confirm:hover,
.erpx-swal-cancel:hover {
    transform: translateY(-1px);
}

.erpx-fallback-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(15, 36, 51, .42);
}

.erpx-fallback-card {
    width: min(92vw, 440px);
    border-radius: 16px;
    padding: 22px;
    background: #fff;
    border: 1px solid rgba(21, 91, 125, .16);
    box-shadow: 0 24px 70px rgba(15, 36, 51, .22);
    text-align: center;
}

.erpx-fallback-card strong {
    display: block;
    color: var(--text);
    font-size: 1.25rem;
    line-height: 1.7;
    font-weight: 800;
}

.erpx-fallback-card p {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.9;
}

.erpx-fallback-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.erpx-fallback-ok,
.erpx-fallback-cancel {
    min-width: 104px;
    min-height: 42px;
    border-radius: 10px;
    padding: 8px 18px;
    font-weight: 800;
    cursor: pointer;
}

.erpx-fallback-ok {
    color: #fff;
    background: var(--primary);
    border: 1px solid var(--primary);
}

.erpx-fallback-cancel {
    color: var(--text);
    background: #fff;
    border: 1px solid var(--border);
}

.login-shell {
    min-height: 100vh;
    background: #eef4f7;
}

.number-cell,
.num,
.amount,
.grid-input[type="number"],
.ltr {
    font-variant-numeric: tabular-nums;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: radial-gradient(circle at 22% 15%, rgba(255,255,255,.98), rgba(238,244,247,.84) 48%, rgba(222,233,240,.76));
}

.login-panel {
    direction: ltr;
    width: min(100%, 920px);
    min-height: 500px;
    display: grid;
    grid-template-columns: 44% 56%;
    background: #fff;
    border: 2px solid #0d2a3f;
    border-radius: 42px;
    overflow: hidden;
    box-shadow: 0 24px 72px rgba(15,36,51,.2);
}
/* #region login-showcase */
.login-showcase {
    direction: rtl;
    position: relative;
    display: grid;
    place-items: center;
    min-width: 0;
    padding: 28px 34px;
    background: linear-gradient(90deg, rgba(255,255,255,.98), rgba(247,250,252,.92));
    overflow: hidden;
    border-inline-start: 1px solid rgba(15,36,51,.08);
}

    .login-showcase::before, .login-showcase::after {
        content: "";
        position: absolute;
        pointer-events: none;
        opacity: .58;
        background-repeat: no-repeat;
        background-size: contain;
    }

    .login-showcase::before {
        inset-block: 0;
        inset-inline-end: 0;
        width: 170px;
        background-image: linear-gradient(92deg, transparent 18%, rgba(21,91,125,.1) 20%, transparent 23%), linear-gradient(100deg, transparent 30%, rgba(217,154,32,.42) 32%, transparent 34%);
        transform: skewX(-9deg);
    }

    .login-showcase::after {
        inset-block-end: -72px;
        inset-inline-start: -70px;
        width: 230px;
        height: 280px;
        border-radius: 50%;
        border-inline-end: 3px solid rgba(217,154,32,.42);
        border-inline-start: 20px solid rgba(21,91,125,.06);
        transform: rotate(-18deg);
}

.login-showcase-logo {
    position: relative;
    z-index: 1;
    width: min(72%, 300px);
    aspect-ratio: 1 / 1.18;
    height: auto;
    object-fit: contain;
    border-radius: 18px;
    opacity: .96;
    filter: drop-shadow(0 12px 18px rgba(15,36,51,.10));
}

.login-brand-statement {
    position: relative;
    z-index: 1;
    display: grid;
    justify-items: center;
    gap: 4px;
    color: var(--primary-dark);
    text-align: center;
}

.login-brand-statement span {
    font-size: clamp(56px, 6vw, 86px);
    font-weight: 950;
    line-height: .9;
    letter-spacing: 0;
    color: #2f3944;
}

.login-brand-statement strong {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    min-height: 32px;
    margin-top: -8px;
    border-radius: 6px;
    background: #ee6f0d;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    transform: skewX(-8deg);
}

.login-brand-statement small {
    color: #5d6b77;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.login-brand-statement p {
    margin: 18px 0 0;
    color: #ee6f0d;
    font-size: clamp(30px, 3.4vw, 46px);
    font-weight: 950;
    line-height: 1.1;
}

.login-brand-statement em {
    color: #5d6b77;
    font-size: 18px;
    font-style: normal;
    font-weight: 800;
}
/* #endregion*/
.login-card {
    direction: rtl;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.96));
    padding: 26px 30px 28px;
}
.login-title-block {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 13px;
    border-bottom: 2px solid rgba(238,111,13,.42);
    position: relative;
}

    .login-title-block::after {
        content: "";
        position: absolute;
        inset-inline-start: 0;
        bottom: -3px;
        width: 86px;
        height: 5px;
        border-radius: 999px;
        background: #ee6f0d;
    }

    .login-title-block h1 {
        margin: 0;
        color: #3b3e42;
        font-size: clamp(28px, 3.1vw, 18px);
        line-height: 1.25;
        font-weight: 900;
    }

    .login-title-block svg {
        width: 34px;
        height: 34px;
        color: #ee6f0d;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
        flex: 0 0 auto;
    }

.login-form {
    display: grid;
    gap: 9px;
}

.login-validation ul {
    margin-bottom: 0;
    padding-inline-start: 18px;
}

.login-validation:not(:empty) {
    border: 1px solid rgba(195,38,46,.35);
    border-radius: 8px;
    background: #fff5f5;
    color: var(--danger) !important;
    padding: 9px 12px;
    font-weight: 800;
}

.login-field label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text);
    font-weight: 800;
}

.login-input-wrap, .login-context-field, .login-context-select {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    grid-template-rows: 1fr;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    border: 2px solid #e5e7ea;
    border-radius: 9px;
    background: #fff;
    padding: 0 9px 0 4px;
    box-shadow: inset 0 1px 2px rgba(15,36,51,.04), 0 2px 8px rgba(15,36,51,.05);
    transition: border-color .16s, box-shadow .16s, background .16s;
}

    .login-input-wrap:focus-within {
        border-color: rgba(21,91,125,.5);
        background: #fff;
        box-shadow: 0 0 0 4px rgba(21,91,125,.08);
    }

    .login-input-wrap svg, .login-context-field svg, .login-context-select svg {
        grid-column: 2;
        grid-row: 1;
        width: 29px;
        height: 29px;
        justify-self: center;
        color: #5d6b77;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.75;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .login-input-wrap .form-control {
        grid-column: 1;
        grid-row: 1;
        min-height: 44px;
        border: 0;
        box-shadow: none;
        background: transparent;
        padding: 0 6px;
        font-weight: 800;
        color: var(--text);
        text-align: center;
    }

        .login-input-wrap .form-control::placeholder {
            color: #8b99a6;
            font-weight: 700;
        }

.password-box {
    grid-template-columns: 38px minmax(0, 1fr) 44px;
    padding-inline-start: 5px;
}

    .password-box > svg {
        grid-column: 3;
    }

    .password-box .form-control {
        grid-column: 2;
    }

.toggle-password {
    grid-column: 1;
    grid-row: 1;
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #5d6b77;
    padding: 0;
}

    .toggle-password svg {
        width: 20px;
        height: 20px;
        stroke-width: 1.8;
    }

    .toggle-password.is-visible {
        background: #e8f3f7;
        border-color: var(--primary);
    }

    .toggle-password:hover {
        border-color: var(--primary);
        background: #edf6fa;
    }

.login-context-field span, .login-context-select span {
    display: block;
    grid-column: 1;
    grid-row: 1;
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.login-context-field.is-loading {
    border-color: rgba(217,154,32,.65);
    background: #fffaf0;
}

.login-context-field.is-error {
    border-color: rgba(195,38,46,.55);
    background: #fff5f5;
}

.login-context-select.d-none {
    display: none;
}

.login-context-select .form-select {
    grid-column: 1;
    grid-row: 1;
    border: 0;
    box-shadow: none;
    min-height: 44px;
    font-weight: 800;
    text-align: center;
    background-color: transparent;
}

.login-context-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.login-context-select {
    min-height: 48px;
    padding-inline-end: 8px;
    position: relative;
}

    .login-context-select::before {
        content: "";
        position: absolute;
        inset-inline-start: 10px;
        inset-block-start: 50%;
        transform: translateY(-30%);
        width: 0;
        height: 0;
        border-inline: 5px solid transparent;
        border-top: 6px solid #6d7881;
    }

.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 12px;
    margin: 2px 0 4px;
}

.check-line {
    display: flex;
    gap: 9px;
    align-items: center;
    margin: 0;
    color: var(--muted);
    cursor: pointer;
}

    .check-line input {
        width: 16px;
        height: 16px;
        accent-color: var(--primary);
    }

.login-secure-note {
    color: var(--secondary);
    font-weight: 700;
    white-space: nowrap;
}

.login-action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 8px;
}

.login-submit, .login-cancel {
    width: 100%;
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 6px;
    font-weight: 900;
    box-shadow: 0 8px 18px rgba(15,36,51,.08);
}

    .login-submit svg {
        width: 20px;
        height: 20px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
        transform: scaleX(-1);
    }

.login-password-link {
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d4d9de;
    border-radius: 6px;
    background: #fff;
    color: #1f2d38;
    font-weight: 900;
    text-decoration: none;
}

    .login-password-link:hover {
        color: var(--primary);
        background: #f8fafb;
    }

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

    .btn-primary:hover {
        background: var(--primary-dark);
        border-color: var(--primary-dark);
    }

.btn-success {
    background: var(--success);
    border-color: var(--success);
}

.app-shell {
    display: grid;
    grid-template-columns: 316px 1fr;
    min-height: 100vh;
    background: var(--surface-soft);
}

.app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
    background: var(--surface-soft);
}

.app-shell.sidebar-collapsed .app-sidebar {
    display: none;
}

.app-sidebar {
    display: grid;
    grid-template-columns: 74px 1fr;
    grid-template-rows: auto auto 1fr;
    column-gap: 12px;
    background: #fff;
    color: var(--ink);
    padding: 12px;
    position: sticky;
    top: 0;
    height: 100vh;
    border-inline-start: 1px solid var(--border);
    box-shadow: -14px 0 34px rgba(15,36,51,.08);
    overflow: hidden;
}

.brand-box {
    display: flex;
    align-items: center;
    gap: 12px;
    grid-column: 1 / -1;
    min-height: 54px;
    padding: 0 3px 10px;
    border-bottom: 1px solid var(--border);
}

.sidebar-close {
    display: none;
}

    .brand-box img {
        width: 46px;
        height: 46px;
        object-fit: contain;
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 14px;
        padding: 4px;
    }

    .brand-box span {
        display: block;
        color: var(--muted);
        font-size: 12px;
    }

.sidebar-search {
    display: grid;
    grid-template-columns: minmax(0,1fr) 28px;
    align-items: center;
    grid-column: 1 / -1;
    gap: 8px;
    margin: 12px 0;
    padding: 0 9px;
    min-height: 40px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fbfd;
}

.sidebar-search input {
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 12px;
    font-weight: 700;
}

.sidebar-search span {
    color: var(--primary);
    font-size: 15px;
    text-align: center;
}

.module-rail {
    display: grid;
    align-content: start;
    gap: 7px;
    padding-inline-end: 8px;
    border-inline-end: 1px solid var(--border);
    overflow-y: auto;
}

.module-rail-item {
    display: grid;
    place-items: center;
    gap: 3px;
    min-height: 58px;
    padding: 6px 4px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    text-align: center;
    text-decoration: none;
    font-size: 9.5px;
    font-weight: 800;
    line-height: 1.25;
    transition: background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
}

.module-rail-item:hover,
.module-rail-item.active {
    color: var(--primary-dark);
    border-color: #c9d8e5;
    background: #f2f7fb;
    box-shadow: inset 3px 0 0 var(--primary), 0 4px 10px rgba(15,36,51,.05);
}

.module-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 27px;
    height: 27px;
    border-radius: 8px;
    background: #f4f7fb;
    color: var(--primary);
    font-size: 14px;
}

.module-icon i {
    line-height: 1;
}

.side-nav {
    display: grid;
    align-content: start;
    gap: 8px;
    min-width: 0;
    overflow-y: auto;
    padding-inline-start: 0;
}

.nav-group {
    display: none;
    gap: 5px;
}

.nav-group.is-open {
    display: grid;
}

.nav-group-title {
    margin: 0 0 6px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 900;
}

.nav-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 36px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink);
    font-weight: 900;
    font-size: 12.5px;
    text-align: start;
    padding: 4px 2px;
}

.nav-group-head b {
    color: var(--primary);
    font-size: 15px;
    transition: transform .18s ease;
}

.nav-group.is-open .nav-group-head b {
    transform: rotate(-90deg);
}

.nav-group-links {
    display: none;
    gap: 4px;
    padding: 0 6px 6px;
}

.nav-group.is-open .nav-group-links,
.nav-group-links {
    display: grid;
}

.nav-subgroup {
    display: grid;
    gap: 3px;
    border-bottom: 1px solid #edf2f5;
    padding: 1px 0 6px;
}

.nav-subgroup:last-child {
    border-bottom: 0;
}

.nav-subgroup-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 34px;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-weight: 900;
    font-size: 12.5px;
    text-align: start;
    padding: 4px 2px;
}

.nav-subgroup-head b {
    color: var(--primary);
    font-size: 14px;
    line-height: 1;
    transition: transform .18s ease;
}

.nav-subgroup.is-open .nav-subgroup-head b {
    transform: rotate(-90deg);
}

.nav-subgroup-links {
    display: none;
    gap: 3px;
    padding-inline-start: 8px;
}

.nav-subgroup.is-open .nav-subgroup-links {
    display: grid;
}

.side-nav a {
    display: flex;
    align-items: center;
    min-height: 29px;
    color: var(--muted);
    padding: 5px 9px;
    border-radius: 7px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 800;
}

.side-nav a:hover,
.side-nav a.active {
    color: var(--primary-dark);
    background: #f1f6f9;
}

.side-nav a.disabled-link {
    opacity: .55;
    cursor: not-allowed;
    pointer-events: none;
}

.app-main {
    min-width: 0;
    overflow-x: hidden;
}

.app-topbar {
    min-height: 70px;
    background: #fff;
    color: var(--ink);
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    padding: 10px 18px;
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 10px 28px rgba(15,36,51,.08);
}

.topbar-start,
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.user-menu {
    position: relative;
}

.user-menu-button {
    display: grid;
    min-width: 156px;
    max-width: 230px;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fbfd;
    color: var(--ink);
    line-height: 1.35;
    text-align: start;
}

.user-menu-button span,
.user-menu-button small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-button small {
    color: var(--muted);
}

.user-menu-dropdown {
    min-width: 250px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 18px 40px rgba(15,36,51,.16);
    text-align: start;
}

.user-menu-dropdown .dropdown-header {
    display: grid;
    gap: 3px;
    padding: 8px 10px 10px;
    color: var(--ink);
}

.user-menu-dropdown .dropdown-header small {
    color: var(--muted);
    white-space: normal;
}

.user-menu-dropdown .dropdown-item {
    border-radius: 8px;
    padding: 9px 10px;
    font-weight: 800;
    text-align: start;
}

.topbar-actions .btn-outline-light {
    color: var(--primary-dark);
    border-color: var(--border);
    background: #fff;
}

.topbar-actions .btn-outline-light:hover {
    color: #fff;
    border-color: var(--primary);
    background: var(--primary);
}

.topbar-actions .btn-light {
    color: #fff;
    border-color: var(--primary);
    background: var(--primary);
}

.topbar-actions .btn-light:hover {
    color: #fff;
    border-color: var(--primary-dark);
    background: var(--primary-dark);
}

.topbar-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px;
}

.menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fbfd;
    color: var(--primary);
    font-size: 22px;
    line-height: 1;
}

.menu-toggle:hover {
    background: #eef5f8;
}

.page-title {
    font-weight: 800;
    font-size: 18px;
    color: var(--primary-dark);
}

.page-context {
    max-width: 520px;
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-chip {
    display: grid;
    line-height: 1.4;
    min-width: 120px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fbfd;
    text-align: start;
}

    .user-chip small {
        color: var(--muted);
    }

.content-wrap {
    padding: 18px;
    max-width: 100%;
    overflow-x: hidden;
}

.page-command-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

    .page-command-bar h2 {
        margin: 0;
        color: var(--primary);
        font-size: 1.25rem;
        font-weight: 800;
    }

    .page-command-bar span {
        display: block;
        margin-top: 3px;
        color: var(--muted);
        font-size: .92rem;
    }

    .page-command-bar .btn {
        min-width: 138px;
        white-space: nowrap;
    }

.page-command-form {
    margin: 0;
}

.page-card, .welcome-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 8px 20px rgba(15,67,93,.06);
    margin-bottom: 16px;
    max-width: 100%;
    min-width: 0;
}

.table-card {
    overflow: hidden;
}

.invoice-alert {
    margin: 0 0 14px;
    padding: 12px 14px;
    border-radius: 10px;
    font-weight: 700;
}

.invoice-alert-error {
    color: #8a1f1f;
    background: #fff3f3;
    border: 1px solid #f0b5b5;
}

.invoice-alert ul {
    margin: 8px 18px 0 0;
    padding: 0;
    font-weight: 600;
}

.email-panel h2 {
    margin: 0 0 14px;
    color: var(--primary);
    font-size: 1.15rem;
    font-weight: 800;
}

.email-invoice-form .form-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: end;
}

.compact-actions {
    margin-top: 12px;
}

.muted-note {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: .9rem;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

    .details-grid > div {
        border: 1px solid var(--border);
        border-radius: 10px;
        padding: 12px 14px;
        background: #fff;
        min-width: 0;
    }

    .details-grid span {
        display: block;
        color: var(--muted);
        font-size: .82rem;
        margin-bottom: 5px;
    }

    .details-grid strong {
        display: block;
        color: var(--text);
        font-weight: 800;
        overflow-wrap: anywhere;
    }

.welcome-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

    .welcome-panel h1 {
        color: var(--primary);
        margin: 0 0 8px;
    }

.dashboard-hero {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-radius: 16px;
    padding: 22px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    box-shadow: 0 12px 28px rgba(15,67,93,.16);
}

    .dashboard-hero h1 {
        margin: 4px 0 8px;
        font-size: 26px;
        font-weight: 900;
    }

    .dashboard-hero p {
        margin: 0;
        opacity: .88;
    }

    .dashboard-hero .eyebrow {
        display: inline-flex;
        padding: 3px 10px;
        border-radius: 999px;
        background: rgba(255,255,255,.14);
        font-size: 12px;
    }

.hero-separator {
    display: inline-block;
    margin: 0 8px;
    opacity: .6;
}

.hero-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.summary-meta {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

    .summary-meta > div {
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 13px 15px;
        box-shadow: 0 6px 16px rgba(15,67,93,.05);
    }

    .summary-meta span {
        display: block;
        color: var(--muted);
        font-size: 12px;
        margin-bottom: 6px;
    }

    .summary-meta strong {
        display: block;
        color: var(--text);
        font-size: 14px;
    }

.dashboard-alert {
    border-right: 4px solid var(--danger);
    color: var(--danger);
    font-weight: 700;
}

.dashboard-section {
    margin-top: 18px;
}

.icon-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.financial-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

    .financial-grid.compact {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

        .financial-grid.compact .financial-card:nth-last-child(-n+2) {
            grid-column: span 2;
        }

.financial-card {
    position: relative;
    overflow: hidden;
    min-height: 126px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 17px;
    box-shadow: 0 8px 20px rgba(15,67,93,.06);
}

    .financial-card::before {
        content: "";
        position: absolute;
        inset-block: 0;
        inset-inline-end: 0;
        width: 5px;
        background: var(--card-accent, var(--primary));
    }

    .financial-card::after {
        content: "";
        position: absolute;
        inset-inline-start: 14px;
        inset-block-start: 14px;
        width: 42px;
        height: 42px;
        border-radius: 12px;
        background: color-mix(in srgb, var(--card-accent, var(--primary)) 14%, #fff);
    }

.card-icon {
    position: absolute;
    inset-inline-start: 23px;
    inset-block-start: 23px;
    z-index: 1;
    width: 24px;
    height: 24px;
    color: var(--card-accent, var(--primary));
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.financial-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 11px;
    padding-inline-start: 58px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.financial-card strong {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding-right: 58px;
    font-size: clamp(16px, 1.18vw, 20px);
    line-height: 1.35;
    color: var(--text);
    direction: ltr;
    text-align: right;
    unicode-bidi: plaintext;
    margin-bottom: 9px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
}

.financial-card small {
    display: block;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.7;
    padding-inline-start: 58px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tone-blue {
    --card-accent: #155b7d;
}

.tone-green, .tone-success {
    --card-accent: #138a4f;
}

.tone-red, .tone-danger {
    --card-accent: #c3262e;
}

.tone-gold {
    --card-accent: #d99a20;
}

.tone-teal {
    --card-accent: #1d7f72;
}

.tone-cyan {
    --card-accent: #1699b7;
}

.tone-orange {
    --card-accent: #ee6f0d;
}

.tone-violet {
    --card-accent: #7c4fd6;
}

.tone-slate {
    --card-accent: #607080;
}

.quick-grid, .summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

    .quick-card, .summary-grid > div {
        background: #fff;
        border: 1px solid var(--border);
        border-right: 4px solid var(--primary);
        padding: 16px;
        border-radius: 12px;
    }

        .quick-card span, .summary-grid span, .invoice-head span {
            display: block;
            color: var(--muted);
            font-size: 12px;
            margin-bottom: 6px;
        }

        .quick-card strong, .summary-grid strong, .invoice-head strong {
            font-size: 18px;
        }

.filter-grid, .form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    align-items: end;
}

.filter-actions, .form-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.responsive-table {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
}

/* Purchase operating costs stay a compact, independent grid.  On narrow
   screens it scrolls horizontally so every accounting column remains visible. */
.invoice-costs .erpx-table {
    min-width: 1080px;
}

.invoice-costs .cost-description {
    min-width: 180px;
}

.invoice-costs .cost-type,
.invoice-costs .cost-operation {
    min-width: 145px;
}

.purchase-tabs {
    display: flex;
    gap: .4rem;
    border-bottom: 1px solid var(--border-color, #d8e1ea);
    margin-bottom: .75rem;
}

.purchase-tab {
    border: 0;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: #526779;
    padding: .65rem 1rem;
    font-weight: 700;
}

.purchase-tab.is-active {
    color: #174f72;
    border-bottom-color: #1f6b94;
}

.cost-summary-inline {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
}

.cost-summary-inline span {
    background: #f1f6f9;
    border: 1px solid #d7e3ea;
    border-radius: .55rem;
    padding: .45rem .7rem;
    color: #53697a;
}

.cost-summary-inline strong {
    color: #123f5b;
    margin-inline-start: .35rem;
}

.invoice-field-party-name .supplier-name-full {
    font-size: clamp(.76rem, .9vw, .9rem);
    font-weight: 700;
    text-overflow: clip;
}

.erpx-purchase-ag-grid {
    width: 100%;
    height: clamp(280px, 42vh, 520px);
    --ag-font-family: "Noto Kufi Arabic", "Segoe UI", sans-serif;
    --ag-font-size: 12px;
    --ag-header-background-color: #e7edf6;
    --ag-header-foreground-color: #203a5d;
    --ag-row-border-color: #e5e7eb;
    --ag-odd-row-background-color: #fff;
    --ag-selected-row-background-color: #f1f0ff;
    --ag-input-focus-border-color: #6254b8;
    border: 1px solid #e5e7eb;
    border-radius: .35rem;
    overflow: hidden;
}

.erpx-purchase-costs-ag-grid {
    height: clamp(225px, 30vh, 390px);
    margin-block: .35rem .15rem;
}

.erpx-purchase-costs-ag-grid .ag-cell[col-id="description"] {
    color: #526779;
    background: #fbfcfe;
}

.erpx-purchase-costs-ag-grid .erpx-ag-cost-select {
    font-size: 12px;
}

.zatca-unit-name-form {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) auto;
    gap: .75rem;
    align-items: end;
    max-width: 760px;
}

.zatca-unit-wizard{padding:1.1rem 1.25rem}.zatca-onboarding-steps{display:grid;grid-template-columns:repeat(4,1fr);list-style:none;padding:0;margin:.85rem 0 1.15rem;position:relative}.zatca-onboarding-steps:before{content:"";position:absolute;top:19px;right:10%;left:10%;height:2px;background:#dbe4ec}.zatca-onboarding-steps li{position:relative;z-index:1;display:flex;justify-content:center;align-items:center;gap:.55rem;color:#718096}.zatca-onboarding-steps li>span{width:38px;height:38px;display:grid;place-items:center;border-radius:50%;background:#eef3f7;border:2px solid #d5e0e8;font-weight:800}.zatca-onboarding-steps li.active>span,.zatca-onboarding-steps li.done>span{background:#17658a;color:#fff;border-color:#17658a}.zatca-onboarding-steps strong,.zatca-onboarding-steps small{display:block}.zatca-onboarding-steps strong{color:#173b4f;font-size:.88rem}.zatca-onboarding-steps small{font-size:.72rem;margin-top:.1rem}.zatca-form-group-title{font-size:.92rem;color:#174f6b;display:flex;align-items:center;gap:.45rem;margin:.75rem 0 .55rem;padding-bottom:.42rem;border-bottom:1px solid #e1e8ee}.zatca-form-group-title>span,.action-number{display:inline-grid;place-items:center;width:23px;height:23px;border-radius:50%;background:#e4f0f6;color:#17658a;font-size:.75rem;font-weight:800}.zatca-fields-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.65rem .75rem}.zatca-fields-grid label{display:flex;flex-direction:column;gap:.25rem}.zatca-fields-grid label>span,.zatca-otp-field>span{font-size:.78rem;font-weight:600;color:#66788a}.zatca-fields-grid input,.zatca-fields-grid select,.zatca-otp-field input{width:100%;min-height:40px;border:1px solid #ccd8e1;border-radius:8px;padding:.5rem .65rem;background:#fff;transition:border-color .15s,box-shadow .15s}.zatca-fields-grid input:focus,.zatca-fields-grid select:focus,.zatca-otp-field input:focus{outline:0;border-color:#1c789f;box-shadow:0 0 0 3px rgba(28,120,159,.12)}.zatca-fields-grid input[readonly]{background:#f4f7f9;color:#435a68}.zatca-fields-grid .span-2{grid-column:span 2}.zatca-fields-grid .technical-field input{font-family:Consolas,"Courier New",monospace;font-size:.83rem;letter-spacing:.01em}.zatca-fields-grid .compact-field{max-width:180px}.zatca-connection-row{display:grid;grid-template-columns:190px minmax(280px,420px);align-items:end;gap:1rem;margin-top:.85rem;padding:.75rem;border:1px dashed #c8d6df;border-radius:10px;background:#f9fbfc}.zatca-switch{display:flex;align-items:center;gap:.55rem;cursor:pointer;min-height:42px}.zatca-switch input{position:absolute;opacity:0}.zatca-switch .switch-ui{width:44px;height:24px;border-radius:99px;background:#cbd5df;position:relative;transition:.2s}.zatca-switch .switch-ui:after{content:"";position:absolute;width:18px;height:18px;top:3px;right:3px;border-radius:50%;background:#fff;box-shadow:0 1px 3px #789;transition:.2s}.zatca-switch input:checked+.switch-ui{background:#21845c}.zatca-switch input:checked+.switch-ui:after{transform:translateX(-20px)}.zatca-otp-field{display:grid;grid-template-columns:1fr 150px;align-items:center;gap:.25rem .65rem}.zatca-otp-field small{grid-column:1/-1;color:#7a8996;font-size:.7rem}.zatca-otp-field input{text-align:center;letter-spacing:.28em;font-weight:700}.zatca-wizard-actions{display:flex;gap:.65rem;flex-wrap:wrap;margin-top:.9rem;padding-top:.85rem;border-top:1px solid #e4eaef}.zatca-wizard-actions .btn{min-width:185px;display:inline-flex;align-items:center;justify-content:center;gap:.45rem}.zatca-wizard-actions .btn-primary .action-number{background:rgba(255,255,255,.2);color:#fff}.zatca-stage-strip{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:0;margin-top:.8rem;border:1px solid #d4dee6;border-radius:9px;background:#f7fafc;overflow:hidden}.zatca-stage-strip span{font-size:.76rem;padding:.55rem .7rem;border-inline-start:1px solid #dfe7ed}.zatca-stage-strip span:first-child{border-inline-start:0}.zatca-stage-strip b{display:block;color:#19526e;margin-bottom:.15rem;font-size:.72rem}@media(max-width:1000px){.zatca-onboarding-steps small{display:none}.zatca-fields-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.zatca-fields-grid .technical-field{grid-column:span 1}.zatca-stage-strip{grid-template-columns:repeat(2,minmax(0,1fr))}.zatca-connection-row{grid-template-columns:1fr 1fr}}@media(max-width:600px){.zatca-unit-wizard{padding:.85rem}.zatca-onboarding-steps li{flex-direction:column;text-align:center;gap:.25rem}.zatca-onboarding-steps li>span{width:32px;height:32px}.zatca-onboarding-steps:before{top:15px}.zatca-onboarding-steps strong{font-size:.7rem}.zatca-fields-grid{grid-template-columns:1fr}.zatca-fields-grid .span-2{grid-column:span 1}.zatca-fields-grid .compact-field{max-width:none}.zatca-connection-row{grid-template-columns:1fr}.zatca-otp-field{grid-template-columns:1fr}.zatca-stage-strip{grid-template-columns:1fr}.zatca-stage-strip span{border-inline-start:0;border-bottom:1px solid #dfe7ed}.zatca-wizard-actions .btn{width:100%}}

.zatca-unit-name-form label {
    display: grid;
    gap: .4rem;
    color: #294c63;
    font-weight: 700;
}

@media (max-width: 575.98px) {
    .zatca-unit-name-form {
        grid-template-columns: 1fr;
    }
}

.erpx-purchase-ag-grid .ag-header-cell-label {
    justify-content: center;
    color: #203a5d;
    font-size: 14px;
    font-weight: 700;
}

.erpx-purchase-ag-grid .ag-header-cell-text,
.erpx-purchase-ag-grid .ag-header-icon,
.erpx-purchase-ag-grid .ag-icon {
    color: #203a5d;
}

.erpx-purchase-ag-grid .ag-header-cell {
    background: #e7edf6;
    border-inline-end: 1px solid #cfd8e6;
    border-block-end: 1px solid #c5d0df;
}

.erpx-purchase-ag-grid .ag-header-cell::after {
    content: none;
}

.erpx-purchase-ag-grid .ag-header-identity { --erpx-column-color: #60a5fa; border-block-start-color: #60a5fa; }
.erpx-purchase-ag-grid .ag-header-description { --erpx-column-color: #c4b5fd; border-block-start-color: #c4b5fd; }
.erpx-purchase-ag-grid .ag-header-unit { --erpx-column-color: #67e8f9; border-block-start-color: #67e8f9; }
.erpx-purchase-ag-grid .ag-header-quantity { --erpx-column-color: #fde047; border-block-start-color: #fde047; }
.erpx-purchase-ag-grid .ag-header-money { --erpx-column-color: #86efac; border-block-start-color: #86efac; }
.erpx-purchase-ag-grid .ag-header-discount { --erpx-column-color: #fdba74; border-block-start-color: #fdba74; }
.erpx-purchase-ag-grid .ag-header-tax { --erpx-column-color: #fca5a5; border-block-start-color: #fca5a5; }
.erpx-purchase-ag-grid .ag-header-total { --erpx-column-color: #5eead4; border-block-start-color: #5eead4; }
.erpx-purchase-ag-grid .ag-header-action { --erpx-column-color: #f87171; border-block-start-color: #f87171; }

.erpx-purchase-ag-grid .ag-cell {
    display: flex;
    align-items: center;
    border-inline-end-color: #f0f1f4;
    color: #363956;
}

.erpx-purchase-ag-grid .erpx-ag-summary-row .ag-cell {
    border-block-start: 1px solid #e5e7eb;
    background: #fff;
    color: #159947;
    font-weight: 800;
}

.erpx-purchase-ag-grid .ag-row-pinned .ag-cell[col-id="productCode"] {
    color: #2e3370;
    font-size: 13px;
}

.erpx-purchase-ag-grid .erpx-ag-pack-select {
    width: 100%;
    height: 32px;
    padding-inline: 8px;
    border: 1px solid #dedfec;
    border-radius: 5px;
    background: #fff;
    color: #2e3370;
    outline: none;
}

.erpx-purchase-ag-grid .erpx-ag-pack-select:focus {
    border-color: #6254b8;
    box-shadow: 0 0 0 2px rgba(98, 84, 184, .12);
}

.erpx-purchase-ag-grid .erpx-ag-add-line {
    padding: 0;
    border: 0;
    background: transparent;
    color: #2e3370;
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
}

.erpx-purchase-ag-grid .erpx-ag-add-line:hover {
    color: #6254b8;
}

.invoice-lines > .line-actions {
    display: none;
}

#invoiceForm .sticky-summary {
    position: static;
}

@media (min-width: 981px) {
    #invoiceForm .summary-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 8px;
        margin-block: 10px 12px;
    }

    #invoiceForm .summary-grid > div {
        min-height: 66px;
        padding: 9px 11px;
        border-radius: 8px;
        border-inline-end-width: 3px;
    }

    #invoiceForm .summary-grid span {
        margin-bottom: 2px;
        font-size: 10px;
    }

    #invoiceForm .summary-grid strong {
        font-size: 15px;
    }
}

@media (min-width: 1200px) {
    .invoice-meta .invoice-field-party-name {
        grid-column: span 5;
    }
}

@media (max-width: 767.98px) {
    .invoice-costs .edit-table,
    .invoice-costs .edit-table tbody,
    .invoice-costs .edit-table tr,
    .invoice-costs .edit-table td {
        display: revert;
    }

    .invoice-costs .edit-table thead {
        display: table-header-group;
    }

    .invoice-costs .edit-table tr {
        border: 0;
        padding: 0;
        box-shadow: none;
    }

    .invoice-costs .edit-table td::before {
        content: none;
    }
}

.erpx-table {
    width: 100%;
    border-collapse: collapse;
    min-width: min(960px, 100%);
    table-layout: auto;
    font-size: 14px;
}

    .erpx-table th {
        background: var(--primary);
        color: #fff;
        padding: 8px 8px;
        border: 1px solid #fff;
        white-space: nowrap;
        text-align: center;
        line-height: 1.35;
    }

    .erpx-table td {
        padding: 7px 8px;
        border: 1px solid var(--border);
        background: #fff;
        vertical-align: middle;
        line-height: 1.35;
    }

.erpx-table tr:nth-child(even) td {
    background: #f9fbfc;
}

.purchase-invoice-list-card .responsive-table {
    max-width: 100%;
}

.purchase-list-table {
    table-layout: fixed;
    min-width: 1080px;
}

.purchase-list-table th {
    padding: 8px 7px;
}

.purchase-list-table td {
    padding: 7px 8px;
    line-height: 1.35;
}

.purchase-list-table .purchase-col-entry {
    width: 110px;
}

.purchase-list-table .purchase-col-date {
    width: 104px;
}

.purchase-list-table .purchase-col-supplier-invoice {
    width: 120px;
}

.purchase-list-table .purchase-col-supplier {
    width: 330px;
}

.purchase-list-table .purchase-col-currency {
    width: 64px;
}

.purchase-list-table .purchase-col-amount,
.purchase-list-table .purchase-col-discount,
.purchase-list-table .purchase-col-tax,
.purchase-list-table .purchase-col-net {
    width: 112px;
}

.purchase-list-table .purchase-col-status {
    width: 76px;
}

.purchase-list-table .purchase-col-actions {
    width: 148px;
}

.purchase-list-table .row-actions {
    white-space: nowrap;
}

.purchase-list-table .row-actions .btn {
    padding: 4px 8px;
    font-size: 13px;
}

.truncate-cell {
    max-width: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nowrap {
    white-space: nowrap;
}

.ltr {
    direction: ltr;
    text-align: left;
    unicode-bidi: plaintext;
}

.status-pill {
    display: inline-flex;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
}

    .status-pill.draft {
        background: #fff7e3;
        color: #8a5c00;
    }

    .status-pill.posted {
        background: #e6f5ec;
        color: var(--success);
    }

.row-actions {
    white-space: nowrap;
}

.pager-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-top: 14px;
    color: var(--muted);
}

.unified-pager {
    align-items: center;
    flex-wrap: wrap;
    border-top: 1px solid var(--border);
    margin-top: 12px;
}

.pager-summary {
    display: grid;
    gap: 2px;
    min-width: 180px;
}

.pager-summary strong {
    color: var(--primary-dark);
    font-weight: 900;
}

.pager-summary span {
    color: var(--muted);
    font-size: 13px;
}

.pager-pages {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1 1 auto;
    flex-wrap: wrap;
}

.pager-btn,
.pager-number {
    min-width: 36px;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}

.pager-number.active {
    color: #fff;
    border-color: var(--primary);
    background: var(--primary);
}

.pager-btn.disabled,
.pager-number.disabled {
    opacity: .45;
    pointer-events: none;
}

.pager-size-form {
    margin: 0;
}

.pager-size-form label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.pager-size-form select {
    width: 78px;
    min-height: 34px;
}

.empty-inline, .empty-state {
    text-align: center;
    padding: 32px;
    color: var(--muted);
}

    .empty-state h1 {
        color: var(--primary);
        font-size: 52px;
    }

    .empty-state.danger h1 {
        color: var(--danger);
    }

.invoice-head {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
    gap: 14px;
    align-items: center;
}

.head-actions, .inline-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.zatca-unit-select {
    min-width: 240px;
    max-width: 360px;
}

.zatca-workspace-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.zatca-workspace-head h1 {
    margin: 4px 0 6px;
    color: var(--brand);
    font-size: 1.55rem;
}

.zatca-invoice-summary {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.zatca-invoice-summary > div {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fbfd;
    padding: 12px;
}

.zatca-invoice-summary span {
    display: block;
    color: var(--muted);
    font-size: .84rem;
    margin-bottom: 4px;
}

.zatca-invoice-summary strong {
    color: var(--ink);
}

.zatca-send-panel h2 {
    margin: 0 0 14px;
    color: var(--brand);
    font-size: 1.25rem;
}

.zatca-send-form {
    display: grid;
    gap: 14px;
}

.zatca-form-grid {
    grid-template-columns: minmax(260px, 1fr) minmax(220px, .7fr);
}

.zatca-status-panel {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
    align-items: start;
}

.zatca-status-panel > div {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: #f8fbfd;
}

.zatca-status-panel strong {
    display: block;
    color: var(--ink);
    margin-top: 4px;
}

.zatca-safe-message {
    margin: 12px 0 0;
    color: var(--muted);
    white-space: pre-line;
}

.zatca-page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.zatca-page-head.compact {
    margin-bottom: 12px;
}

.zatca-page-head span {
    color: var(--muted);
    font-weight: 800;
}

.zatca-page-head h1 {
    margin: 4px 0 6px;
    color: var(--brand);
    font-size: 1.55rem;
}

.zatca-page-head p {
    max-width: 780px;
    margin: 0;
    color: var(--muted);
}

.zatca-filter-card {
    margin-bottom: 14px;
}

.zatca-batch-filter {
    grid-template-columns: minmax(260px, 2fr) repeat(4, minmax(150px, 1fr)) auto;
    align-items: end;
}

.zatca-head-actions,
.zatca-command-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
}

.zatca-setup-summary,
.zatca-command-panel {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    align-items: center;
}

.zatca-batch-summary {
    grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
    margin-bottom: 14px;
}

.zatca-setup-summary > div,
.zatca-command-panel > div:not(.zatca-command-actions) {
    border-inline-start: 4px solid var(--primary);
    border-radius: 8px;
    background: #f8fbfd;
    padding: 12px;
}

.zatca-setup-summary span,
.zatca-command-panel span {
    display: block;
    color: var(--muted);
    font-size: .84rem;
}

.zatca-setup-summary strong,
.zatca-command-panel strong {
    color: var(--ink);
    font-size: 1.15rem;
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.section-title-row h2 {
    margin: 0;
    color: var(--brand);
    font-size: 1.2rem;
}

.zatca-table .select-col {
    width: 42px;
    text-align: center;
}

.zatca-row-note {
    display: block;
    max-width: 100%;
    margin-top: 5px;
    color: var(--muted);
    font-size: .78rem;
    line-height: 1.55;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.zatca-table td.zatca-readiness-cell {
    width: 320px;
    min-width: 240px;
    max-width: 360px;
    white-space: normal;
    vertical-align: top;
}

.zatca-readiness-cell .status-pill {
    display: inline-flex;
    margin-bottom: 4px;
}

.zatca-batch-form {
    display: grid;
    gap: 16px;
}

.zatca-batch-table-card {
    padding-top: 16px;
}

.zatca-table {
    min-width: 1320px;
}

.zatca-table td {
    vertical-align: middle;
}

.zatca-table .number-cell {
    font-variant-numeric: tabular-nums;
}

.invoice-meta {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: end;
}

.meta-span-1 {
    grid-column: span 1;
}

.meta-span-2 {
    grid-column: span 2;
}

.meta-span-3 {
    grid-column: span 3;
}

.meta-span-6 {
    grid-column: span 6;
}

.invoice-meta .form-control,
.invoice-meta .form-select {
    min-height: 38px;
}

.invoice-meta label {
    margin-bottom: 4px;
    color: var(--primary);
    font-size: 14px;
    font-weight: 800;
}

/* Balanced document editors: compact values stay compact while descriptive
   fields receive the available width. These rules are shared by create/edit. */
.invoice-meta {
    gap: 10px 12px;
    padding: 16px;
    background: linear-gradient(180deg, #fff 0%, #f9fbfd 100%);
}

.invoice-meta > div {
    min-width: 0;
}

.invoice-field-compact .form-control,
.invoice-field-compact .form-select {
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.invoice-meta .form-control:focus,
.invoice-meta .form-select:focus,
.master-edit-form input:focus,
.master-edit-form select:focus,
.document-form-grid input:focus,
.document-form-grid select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21, 91, 125, .12);
}

@media (max-width: 1180px) {
    .invoice-meta {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
    .invoice-meta > [class*="meta-span-"] { grid-column: span 2; }
    .invoice-meta .invoice-field-branch,
    .invoice-meta .invoice-field-party-name,
    .invoice-meta .invoice-field-remark { grid-column: span 3; }
    .invoice-meta .invoice-field-compact,
    .invoice-meta .tax-status { grid-column: span 1; }
}

@media (max-width: 700px) {
    .invoice-meta {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
        padding: 11px;
    }
    .invoice-meta > [class*="meta-span-"],
    .invoice-meta .invoice-field-compact,
    .invoice-meta .tax-status { grid-column: span 1; }
    .invoice-meta .invoice-field-branch,
    .invoice-meta .invoice-field-party-code,
    .invoice-meta .invoice-field-party-name,
    .invoice-meta .invoice-field-option,
    .invoice-meta .invoice-field-remark { grid-column: 1 / -1; }
    .invoice-meta label { font-size: 12px; }
    .invoice-meta .form-control,
    .invoice-meta .form-select { min-height: 44px; }
    .lookup-box { gap: 5px; }
    .lookup-icon-btn { min-width: 54px; padding-inline: 8px; }
}

.invoice-meta .meta-check {
    min-height: 38px;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding-inline: 8px;
}

.tax-status {
    display: grid;
    align-content: center;
    min-height: 38px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
    text-align: center;
}

.tax-status span {
    color: var(--primary);
    font-size: 13px;
    font-weight: 900;
}

.tax-status small {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
}

.tax-status.enabled {
    background: #eaf7ef;
    border-color: rgba(24,135,84,.28);
}

.tax-status.disabled {
    background: #f8fafb;
}

.span-2 {
    grid-column: span 2;
}

.lookup-box {
    display: flex;
    gap: 8px;
}

.lookup-icon-btn {
    min-width: 64px;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

    .section-title h2 {
        font-size: 17px;
        margin: 0;
        color: var(--primary);
    }

.grid-input {
    width: 100%;
    min-width: 92px;
    border: 1px solid transparent;
    background: transparent;
    padding: 6px;
}

    .grid-input:focus {
        background: #fff;
        border-color: var(--primary);
        outline: 0;
        box-shadow: 0 0 0 2px rgba(21,91,125,.12);
    }

.grid-lookup {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) 52px;
    gap: 4px;
    align-items: center;
}

    .grid-lookup .grid-input {
        min-width: 120px;
    }

.grid-lookup-btn {
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--primary);
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 12px;
    font-weight: 700;
}

    .grid-lookup-btn:hover {
        background: #e8f2f7;
        border-color: var(--primary);
    }

.modal-search-bar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin-bottom: 14px;
}

.erpx-lookup-modal-header {
    position: relative;
    min-height: 58px;
    padding-left: 54px;
}

    .erpx-lookup-modal-header .modal-title {
        width: 100%;
        margin: 0;
        text-align: right;
    }

    .erpx-lookup-modal-header .btn-close {
        position: absolute;
        left: 16px;
        top: 50%;
        margin: 0;
        transform: translateY(-50%);
    }

.lookup-results-table {
    min-width: 640px;
}

    .lookup-results-table .lookup-row {
        cursor: pointer;
    }

        .lookup-results-table .lookup-row:hover td {
            background: #eaf4f8;
        }

.edit-table td {
    padding: 3px;
}

.edit-table {
    table-layout: fixed;
    min-width: 1180px;
}

.edit-table .col-line-no {
    width: 54px;
}

.edit-table .col-product-code {
    width: 190px;
}

.edit-table .col-item-name {
    width: 270px;
}

.edit-table .col-pack {
    width: 130px;
}

.edit-table .col-packing {
    width: 118px;
}

.edit-table .col-qty {
    width: 110px;
}

.edit-table .col-price {
    width: 130px;
}

.edit-table .col-discount {
    width: 115px;
}

.edit-table .col-tax {
    width: 115px;
}

.edit-table .col-net {
    width: 130px;
}

.edit-table .col-action {
    width: 82px;
}

.edit-table th {
    white-space: nowrap;
}

.edit-table td,
.edit-table th {
    vertical-align: middle;
}

.edit-table .grid-input {
    min-width: 0;
    min-height: 34px;
    border-radius: 6px;
}

.edit-table .item-name,
.edit-table .product-code {
    min-width: 0;
}

.edit-table .row-no {
    text-align: center;
    font-weight: 800;
}

.edit-table .disc-amt,
.edit-table .line-disc-per,
.edit-table .tax-amt,
.edit-table .net-amt,
.edit-table .qty,
.edit-table .price {
    direction: ltr;
    text-align: end;
}

.line-actions {
    display: flex;
    justify-content: flex-start;
    padding-top: 14px;
}

.line-actions .btn {
    min-width: 132px;
    min-height: 40px;
    font-weight: 800;
}

.sticky-summary {
    position: sticky;
    bottom: 0;
    background: var(--surface-soft);
    padding-top: 12px;
}

.form-actions {
    justify-content: flex-start;
    margin-bottom: 24px;
}

@media (max-width: 980px) {
    .login-page {
        min-height: 100dvh;
        padding: 12px;
        align-items: start;
    }

    .login-panel {
        width: min(100%, 620px);
        min-height: 0;
        grid-template-columns: 1fr;
        border-radius: 28px;
    }

    .login-showcase {
        order: 1;
        min-height: 260px;
        padding: 18px;
        border-inline-start: 0;
        border-bottom: 1px solid rgba(15,36,51,.1);
    }

    .login-showcase-logo {
        width: min(78%, 330px);
        height: 230px;
    }

    .login-card {
        order: 2;
        padding: 22px 18px 24px;
    }

    .login-title-block {
        margin-bottom: 16px;
    }

        .login-title-block h1 {
            font-size: 18px;
        }

    .login-input-wrap {
        min-height: var(--touch-target);
    }

        .login-input-wrap .form-control {
            min-height: 46px;
        }

    .login-submit, .login-cancel, .login-password-link {
        min-height: var(--touch-target);
    }

    .login-options {
        align-items: flex-start;
        flex-direction: inherit;
    }

    .app-shell {
        grid-template-columns: 1fr;
        background: var(--surface-soft);
    }

    .app-shell.sidebar-collapsed .app-sidebar {
        display: block;
    }

    .app-sidebar {
        position: fixed;
        right: -360px;
        width: min(340px, 92vw);
        grid-template-columns: 76px 1fr;
        z-index: 100;
        transition: right .2s;
        box-shadow: -20px 0 40px rgba(15,36,51,.18);
    }

    body.sidebar-open .app-sidebar {
        right: 0;
    }

    .menu-toggle {
        display: inline-block;
    }

    .topbar-logo {
        width: 32px;
        height: 38px;
    }

    .app-topbar {
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
        padding: 10px 12px;
    }

    .topbar-start,
    .topbar-actions {
        justify-content: space-between;
        width: 100%;
    }

    .page-context {
        max-width: 210px;
    }

    .topbar-actions .btn {
        flex: 1;
        min-height: 38px;
    }

    .user-chip {
        display: none;
    }

    .filter-grid, .form-grid, .invoice-meta, .invoice-head, .quick-grid, .summary-grid, .financial-grid, .financial-grid.compact, .summary-meta, .details-grid {
        grid-template-columns: 1fr;
    }

    .meta-span-1,
    .meta-span-2,
    .meta-span-3,
    .meta-span-6 {
        grid-column: span 1;
    }

    .span-2 {
        grid-column: span 1;
    }

    .welcome-panel, .dashboard-hero {
        align-items: stretch;
        flex-direction: column;
    }

        .dashboard-hero h1 {
            font-size: 22px;
        }

    .content-wrap {
        padding: 12px;
    }

    .page-command-bar {
        align-items: stretch;
        flex-direction: column;
    }

        .page-command-bar .btn {
            width: 100%;
        }

    .page-card, .welcome-panel {
        padding: 14px;
        border-radius: 12px;
    }

    .filter-actions, .form-actions, .head-actions, .inline-form {
        flex-direction: column;
        align-items: stretch;
    }

        .filter-actions .btn, .form-actions .btn, .head-actions .btn, .inline-form .btn {
            width: 100%;
            min-height: 44px;
        }

    .zatca-workspace-head {
        flex-direction: column;
    }

    .zatca-page-head,
    .section-title-row {
        flex-direction: column;
        align-items: stretch;
    }

    .zatca-head-actions,
    .zatca-command-actions {
        justify-content: stretch;
    }

    .zatca-head-actions .btn,
    .zatca-command-actions .btn {
        width: 100%;
        min-height: 44px;
    }

    .zatca-invoice-summary,
    .zatca-status-panel,
    .zatca-form-grid,
    .zatca-setup-summary,
    .zatca-command-panel {
        grid-template-columns: 1fr;
    }

    .zatca-unit-select {
        max-width: none;
        width: 100%;
    }

    .responsive-table {
        margin-inline: -2px;
        padding-bottom: 4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .erpx-table {
        min-width: 860px;
    }

    .edit-table {
        min-width: 1060px;
    }

    .section-title {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }

        .section-title .btn {
            min-height: 44px;
        }

    .sticky-summary {
        position: static;
    }

    .modal-search-bar {
        grid-template-columns: 1fr;
    }
}

.password-page {
    max-width: 760px;
    margin-inline: auto;
}

.password-form {
    display: grid;
    gap: 18px;
}

.password-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 800;
}

.password-input {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    padding-inline-start: 5px;
}

.password-input:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(21,91,125,.08);
}

.password-input .form-control {
    grid-column: 2;
    min-height: 48px;
    border: 0;
    box-shadow: none;
}

.password-input .toggle-password {
    grid-column: 1;
}

.password-strength {
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.password-strength[data-score="0"],
.password-strength[data-score="1"] {
    color: var(--danger);
}

.password-strength[data-score="2"] {
    color: #a16207;
}

.password-strength[data-score="3"],
.password-strength[data-score="4"] {
    color: var(--success);
}

@media (max-width: 520px) {
    .login-page {
        padding: 0;
        background: #fff;
    }

    .login-panel {
        width: 100%;
        min-height: 100dvh;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .login-showcase {
        min-height: 150px;
        padding: 10px 14px;
    }

        .login-showcase::before {
            width: 118px;
            opacity: .34;
        }

        .login-showcase::after {
            width: 150px;
            height: 190px;
            opacity: .34;
        }

    .login-brand-statement span {
        font-size: 42px;
    }

    .login-brand-statement strong {
        min-width: 46px;
        min-height: 26px;
        font-size: 16px;
    }

    .login-brand-statement p {
        margin-top: 8px;
        font-size: 24px;
    }

    .login-brand-statement em,
    .login-brand-statement small {
        font-size: 12px;
    }

    .login-card {
        justify-content: flex-start;
        padding: 16px 14px 18px;
    }

    .login-title-block {
        margin-bottom: 14px;
        padding-bottom: 10px;
    }

        .login-title-block h1 {
            font-size: 18px;
        }

        .login-title-block svg {
            width: 29px;
            height: 29px;
        }

    .login-context-grid {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
    }

    .login-action-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .password-box {
        grid-template-columns: 38px minmax(0, 1fr) 42px;
    }

    .app-topbar {
        gap: 10px;
        min-height: 62px;
        padding-inline: 12px;
    }

    .page-title {
        font-size: 15px;
    }

    .brand-box img {
        width: 48px;
        height: 62px;
    }
}

@media (max-width: 760px) {
    .invoice-lines {
        padding: 12px;
    }

    .invoice-lines .responsive-table {
        overflow: visible;
        margin-inline: 0;
    }

    .edit-table {
        min-width: 0;
        table-layout: auto;
        border-collapse: separate;
        border-spacing: 0 12px;
    }

    .edit-table colgroup,
    .edit-table thead {
        display: none;
    }

    .edit-table,
    .edit-table tbody,
    .edit-table tr,
    .edit-table td {
        display: block;
        width: 100%;
    }

    .edit-table tr {
        overflow: hidden;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 10px 22px rgba(15,36,51,.06);
    }

    .edit-table td {
        display: grid;
        grid-template-columns: 104px minmax(0, 1fr);
        gap: 10px;
        align-items: center;
        min-height: 46px;
        padding: 8px 10px;
        border-bottom: 1px solid #edf2f5;
    }

    .edit-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 12px;
        font-weight: 800;
    }

    .edit-table td:last-child {
        border-bottom: 0;
    }

    .edit-table .grid-input,
    .edit-table .grid-lookup {
        width: 100%;
        min-width: 0;
    }

    .edit-table .grid-lookup {
        grid-template-columns: minmax(0, 1fr) 58px;
    }

    .edit-table .remove-line {
        width: 100%;
        min-height: 38px;
    }

    .line-actions {
        position: sticky;
        bottom: 0;
        z-index: 20;
        margin-inline: -12px;
        padding: 10px 12px;
        background: linear-gradient(180deg, rgba(246,249,251,0), var(--surface-soft) 24%);
    }

    .line-actions .btn {
        width: 100%;
        min-height: 46px;
    }

    .form-actions {
        position: sticky;
        bottom: 0;
        z-index: 21;
        padding: 10px 12px;
        margin-inline: -12px;
        background: var(--surface-soft);
        border-top: 1px solid var(--border);
    }
}

.print-template {
    display: none;
}

.print-only {
    display: none;
}

.purchase-list-print-title {
    margin-bottom: 12px;
    text-align: center;
}

.purchase-list-print-title h1 {
    margin: 0 0 4px;
    color: var(--primary-dark);
    font-size: 22px;
    font-weight: 900;
}

.purchase-list-print-title p {
    margin: 0;
    color: var(--muted);
}

.purchase-print-page {
    width: 100%;
    max-width: 210mm;
    margin: 0 auto;
    padding: 12mm;
    background: #fff;
    color: #10263a;
    font-family: Tahoma, Arial, sans-serif;
    font-size: 12px;
    line-height: 1.55;
}

.purchase-print-screen {
    box-shadow: 0 18px 50px rgba(15, 47, 74, 0.12);
    border: 1px solid #d5e2ec;
    border-radius: 10px;
}

.purchase-print-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 10px;
    margin-bottom: 12px;
}

.purchase-print-company {
    display: flex;
    gap: 12px;
    align-items: center;
}

.purchase-print-title {
    text-align: left;
}

.purchase-print-title h2 {
    margin: 0 0 4px;
    color: #5b6b7a;
    font-size: 14px;
    font-weight: 800;
}

.purchase-print-header img {
    width: 92px;
    height: auto;
    object-fit: contain;
    display: block;
    margin-bottom: 6px;
}

.purchase-print-header strong,
.purchase-print-header span {
    display: block;
}

.purchase-print-header h1 {
    margin: 0 0 4px;
    font-size: 24px;
    font-weight: 900;
    color: var(--primary-dark);
}

.purchase-print-header p {
    margin: 0;
    color: var(--muted);
}

.purchase-print-meta {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}

.purchase-print-meta-compact {
    grid-template-columns: repeat(6, 1fr);
}

.purchase-print-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.purchase-print-parties > div {
    border: 1px solid #cbd8e1;
    border-radius: 6px;
    padding: 9px 11px;
    min-height: 82px;
}

.purchase-print-parties h3 {
    margin: 0 0 8px;
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 900;
}

.purchase-print-parties p {
    margin: 0 0 4px;
}

.purchase-print-meta div,
.purchase-print-totals div,
.purchase-print-note,
.purchase-print-footer {
    border: 1px solid #cbd8e1;
    border-radius: 6px;
    padding: 7px 9px;
}

.purchase-print-meta span,
.purchase-print-totals span {
    display: block;
    color: #667789;
    font-size: 11px;
    margin-bottom: 2px;
}

.purchase-print-meta strong,
.purchase-print-totals strong {
    display: block;
    font-weight: 900;
}

.purchase-print-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0 12px;
}

.purchase-print-table thead {
    display: table-header-group;
}

.purchase-print-table tr {
    page-break-inside: avoid;
}

.purchase-print-table th {
    background: var(--primary);
    color: #fff;
    font-weight: 900;
    border: 1px solid #d8e2e8;
    padding: 7px;
    text-align: center;
    white-space: nowrap;
}

.purchase-print-table td {
    border: 1px solid #d8e2e8;
    padding: 6px;
    vertical-align: top;
}

.purchase-print-totals {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.purchase-print-bottom {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 12px;
    align-items: start;
}

.purchase-print-note {
    margin-bottom: 10px;
}

.purchase-print-footer {
    text-align: center;
    color: #44586a;
    background: #f7fafc;
}

.purchase-print-signatures {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 28px 0 10px;
}

.purchase-print-signatures div {
    border-top: 1px solid #5a6b7a;
    padding-top: 8px;
    min-height: 34px;
    text-align: center;
    font-weight: 800;
}

@media print {
    .app-sidebar, .app-topbar, .main-toolstrip, .head-actions, .btn, .no-print {
        display: none !important;
    }

    .app-shell {
        display: block;
    }

    .content-wrap {
        padding: 0;
    }

    .page-card, .summary-grid > div {
        box-shadow: none;
        border-color: #999;
    }

    body {
        background: #fff;
    }

    .purchase-print-page {
        max-width: none;
        padding: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .print-only {
        display: block;
    }

    .commercial-report-print .purchase-list-print-title {
        margin: 0 0 4mm;
        padding-bottom: 2mm;
        border-bottom: 2px solid #155b7d;
    }

    .commercial-report-print .purchase-list-print-title h1 {
        margin: 0;
        font-size: 17px;
    }

    .commercial-report-print .commercial-report-company {
        display: block;
        margin-bottom: 1mm;
        color: #10263a;
        font-size: 11px;
        font-weight: 900;
    }

    .commercial-report-print .purchase-list-print-title p {
        margin: 1mm 0 0;
        font-size: 9px;
        line-height: 1.3;
    }

    .commercial-report-print .commercial-report-filters {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 2mm 6mm;
        margin-top: 2mm;
        padding: 1.5mm 2mm;
        border: 1px solid #c7d4de;
        background: #f7f9fb;
        color: #334c5e;
        font-size: 8px;
    }

    .commercial-report-print .summary-grid {
        display: none !important;
    }

    .commercial-report-print .summary-grid > div {
        min-height: 0 !important;
        padding: 2mm 2.5mm !important;
        border: 0 !important;
        border-left: 1px solid #9fb2c1 !important;
        border-radius: 0 !important;
        background: #fff !important;
    }

    .commercial-report-print .summary-grid > div:last-child {
        border-left: 0 !important;
    }

    .commercial-report-print .summary-grid span {
        margin: 0 0 0.5mm !important;
        font-size: 8px !important;
        line-height: 1.2;
    }

    .commercial-report-print .summary-grid strong {
        font-size: 10px !important;
        line-height: 1.2;
    }

    .commercial-report-print .purchase-report-table {
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
    }

    .commercial-report-print .erpx-table {
        table-layout: fixed !important;
        font-size: 8px !important;
    }

    .commercial-report-print .erpx-table thead {
        display: table-header-group;
    }

    .commercial-report-print .erpx-table tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .commercial-report-print .erpx-table th,
    .commercial-report-print .erpx-table td {
        padding: 1.4mm 1.2mm !important;
        line-height: 1.25;
        vertical-align: middle;
        white-space: normal !important;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .commercial-report-print .commercial-report-total-row {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .commercial-report-print .commercial-report-totals {
        display: table-row-group !important;
    }

    .commercial-report-print .commercial-report-total-row th {
        background: #e7eef4 !important;
        color: #10263a !important;
        border-top: 2px solid #155b7d !important;
        font-size: 9px !important;
        font-weight: 900;
    }

    .commercial-report-footer {
        position: fixed;
        right: 0;
        bottom: -5mm;
        left: 0;
        display: flex !important;
        justify-content: flex-end;
        padding-top: 1.5mm;
        border-top: 1px solid #9fb2c1;
        color: #526777;
        font-size: 8px;
    }

    .commercial-report-page-number::after {
        content: "صفحة " counter(page);
    }
}

/* Responsive shell hardening.
   Keep these rules after the shared shell declarations so later desktop rules
   cannot restore the sidebar columns on tablet and phone viewports. */
@media screen and (max-width: 980px) {
    .app-shell,
    .app-shell.sidebar-collapsed {
        grid-template-columns: minmax(0, 1fr);
        width: 100%;
        max-width: 100%;
    }

    .app-main {
        width: 100%;
        max-width: 100vw;
    }

    .app-topbar {
        min-height: 64px;
        align-items: center;
        flex-direction: row;
        gap: 10px;
        padding: 8px 12px;
    }

    .topbar-start {
        flex: 1 1 auto;
        justify-content: flex-start;
        min-width: 0;
    }

    .topbar-actions {
        flex: 0 0 auto;
        width: auto;
    }

    .user-menu-button {
        min-width: 112px;
        max-width: 150px;
        padding: 6px 9px;
    }

    .page-title,
    .page-context {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .page-context {
        max-width: min(42vw, 260px);
    }

    .content-wrap {
        width: 100%;
        padding: 12px;
    }

    .page-card,
    .welcome-panel,
    .accounting-document-card {
        padding: 14px;
    }

    .responsive-table,
    .report-table-shell,
    .table-card {
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        scrollbar-gutter: stable;
        -webkit-overflow-scrolling: touch;
    }
}

@media screen and (min-width: 621px) and (max-width: 980px) {
    .filter-grid,
    .form-grid,
    .invoice-meta,
    .invoice-head,
    .quick-grid,
    .summary-grid,
    .financial-grid,
    .financial-grid.compact,
    .summary-meta,
    .details-grid,
    .document-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .financial-grid.compact .financial-card:nth-last-child(-n+2) {
        grid-column: span 1;
    }
}

@media screen and (max-width: 620px) {
    .app-topbar {
        gap: 7px;
        padding-inline: 8px;
    }

    .topbar-logo {
        display: none;
    }

    .topbar-start {
        gap: 7px;
    }

    .page-title {
        max-width: 42vw;
        font-size: 14px;
    }

    .page-context {
        display: none;
    }

    .user-menu-button {
        min-width: 94px;
        max-width: 108px;
        font-size: 12px;
    }

    .user-menu-dropdown {
        min-width: min(270px, calc(100vw - 20px));
    }

    .content-wrap {
        padding: 9px;
    }

    .main-toolstrip {
        padding-inline: 8px;
        scrollbar-width: thin;
    }

    .dashboard-hero {
        padding: 16px;
        border-radius: 13px;
    }

    .dashboard-hero h1 {
        font-size: 20px;
        line-height: 1.55;
    }

    .page-card,
    .welcome-panel,
    .accounting-document-card,
    .financial-card,
    .quick-card,
    .summary-grid > div {
        padding: 12px;
        border-radius: 10px;
    }

    .filter-grid,
    .form-grid,
    .invoice-meta,
    .invoice-head,
    .quick-grid,
    .summary-grid,
    .financial-grid,
    .financial-grid.compact,
    .summary-meta,
    .details-grid,
    .document-form-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    .financial-grid.compact .financial-card:nth-last-child(-n+2) {
        grid-column: span 1;
    }

    .form-control,
    .form-select,
    input,
    select,
    textarea,
    button,
    .btn {
        max-width: 100%;
    }

    .modal-dialog {
        width: auto;
        max-width: calc(100vw - 16px);
        margin: 8px;
    }

    .report-preview-shell {
        min-height: calc(100dvh - 64px);
        padding: 8px;
    }

    .report-preview-frame {
        min-height: calc(100dvh - 210px);
    }
}

/* Keep document metadata compact on phones. This final override intentionally
   follows the legacy one-column responsive rules above. */
@media screen and (max-width: 700px) {
    .form-grid.invoice-meta {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-grid.invoice-meta > [class*="meta-span-"],
    .form-grid.invoice-meta .invoice-field-compact,
    .form-grid.invoice-meta .tax-status {
        grid-column: span 1;
    }

    .form-grid.invoice-meta .invoice-field-branch,
    .form-grid.invoice-meta .invoice-field-party-code,
    .form-grid.invoice-meta .invoice-field-party-name,
    .form-grid.invoice-meta .invoice-field-option,
    .form-grid.invoice-meta .invoice-field-remark {
        grid-column: 1 / -1;
    }
}

/* Unified frontend foundation: shared shell, language direction, and table containment. */
.app-shell {
    grid-template-columns: minmax(300px, 320px) minmax(0, 1fr);
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
}

.app-main,
.content-wrap,
.page-card,
.welcome-panel,
.table-card {
    min-width: 0;
}

.app-main {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    height: 100dvh;
    overflow: hidden;
}

.main-toolstrip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 58px;
    padding: 8px 18px;
    background: linear-gradient(180deg, #ffffff, #f7fafc);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 22px rgba(15,36,51,.06);
    z-index: 45;
}

.toolstrip-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.toolstrip-spacer {
    flex: 1 1 auto;
}

.tool-btn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: var(--primary-dark);
    font-weight: 900;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 6px 14px rgba(15,36,51,.05);
}

.tool-btn:hover {
    color: var(--primary);
    border-color: rgba(21,91,125,.35);
    background: #f2f8fb;
}

.tool-btn.primary {
    color: #fff;
    border-color: var(--primary);
    background: var(--primary);
}

.tool-btn.success {
    color: #fff;
    border-color: var(--success);
    background: var(--success);
}

.tool-btn.warning {
    color: #4c3100;
    border-color: #f2c56a;
    background: #fff2cc;
}

.tool-btn.danger {
    color: #fff;
    border-color: var(--danger);
    background: var(--danger);
}

.tool-btn[disabled],
.tool-btn.disabled {
    opacity: .48;
    pointer-events: none;
}

.tool-icon {
    width: 24px;
    height: 24px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 24px;
    border-radius: 7px;
    background: rgba(21,91,125,.08);
    color: currentColor;
    font-size: 15px;
    line-height: 1;
    font-weight: 950;
}

.tool-btn.primary .tool-icon,
.tool-btn.success .tool-icon,
.tool-btn.danger .tool-icon {
    background: rgba(255,255,255,.18);
}

.tool-btn svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.content-wrap {
    width: 100%;
    max-width: 100%;
    height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.table-card,
.page-card:has(.responsive-table) {
    overflow: clip;
}

.responsive-table {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    box-shadow: inset 0 -10px 18px rgba(15,36,51,.03);
}

.erpx-table {
    width: max-content;
    min-width: 100%;
    max-width: none;
}

.erpx-table th,
.erpx-table td {
    white-space: nowrap;
}

.erpx-table td {
    max-width: 360px;
}

.erpx-table td.text-wrap,
.erpx-table .wrap-cell {
    white-space: normal;
}

.erpx-grid-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    padding: 7px 9px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}

.erpx-grid-quick-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: min(420px, 65vw);
    padding: 0 11px;
    border: 1px solid #cbd8e1;
    border-radius: 8px;
    color: #7890a2;
    font-size: 13px;
}

.erpx-grid-quick-filter input {
    width: 100%;
    min-height: 32px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
}

.erpx-grid-columns-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 5px 12px;
    border: 1px solid #b9cad6;
    border-radius: 8px;
    background: #fff;
    color: var(--primary);
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.erpx-grid-columns-button:hover,
.erpx-grid-columns-button:focus-visible {
    border-color: var(--primary);
    background: #edf6fa;
}

.erpx-configurable-grid th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.erpx-configurable-grid tbody tr:hover td {
    background: #f1f7fb;
}

.erpx-list-table-source {
    display: none;
}

.erpx-list-ag-grid {
    width: 100%;
    min-height: 150px;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    --ag-font-family: "Noto Kufi Arabic", Tahoma, Arial, sans-serif;
    --ag-font-size: 12px;
    --ag-header-background-color: #eef3f8;
    --ag-header-foreground-color: #173b55;
    --ag-row-hover-color: #edf6fb;
    --ag-selected-row-background-color: #e2f0f7;
    --ag-border-color: #d2dde5;
    --ag-row-border-color: #e0e7ec;
    --ag-header-column-separator-display: block;
    --ag-header-column-separator-color: #ccd7df;
    --ag-cell-horizontal-padding: 10px;
}

.erpx-list-ag-grid .ag-header-cell-label {
    justify-content: center;
    font-weight: 800;
}

.erpx-list-ag-grid .ag-cell {
    display: flex;
    align-items: center;
}

.erpx-ag-list-cell {
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.erpx-ag-list-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.erpx-column-hidden {
    display: none !important;
}

.erpx-column-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1090;
    background: rgba(16, 38, 58, .28);
}

.erpx-column-backdrop[hidden] {
    display: none;
}

.erpx-column-panel {
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    display: flex;
    width: min(360px, 92vw);
    flex-direction: column;
    border-inline-end: 1px solid #cfdae2;
    background: #fff;
    box-shadow: 12px 0 30px rgba(16, 38, 58, .18);
}

.erpx-column-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 18px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 18px;
}

.erpx-column-close {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
}

.erpx-column-close:hover { background: #eef3f6; }
.erpx-column-help { margin: 12px 18px 6px; color: var(--muted); font-size: 12px; }
.erpx-column-list { flex: 1 1 auto; overflow-y: auto; padding: 7px 12px; }

.erpx-column-option {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 42px;
    margin: 0;
    padding: 7px 8px;
    border-bottom: 1px solid #edf1f4;
    cursor: pointer;
    font-size: 14px;
}

.erpx-column-option:hover { background: #f5f8fa; }
.erpx-column-option input { width: 18px; height: 18px; accent-color: var(--primary); }

.erpx-column-panel-actions {
    display: flex;
    gap: 8px;
    padding: 12px 18px 18px;
    border-top: 1px solid var(--border);
}

body.erpx-column-panel-open { overflow: hidden; }

@media (max-width: 640px) {
    .erpx-grid-toolbar { padding: 5px; }
    .erpx-grid-quick-filter { min-width: 0; flex: 1 1 auto; }
    .erpx-column-panel { width: min(330px, 94vw); }
}

@media print {
    .erpx-list-table-source { display: block !important; }
}

.erpx-accounting-table-source {
    display: none;
}

.erpx-accounting-entry-grid {
    width: 100%;
    min-height: 160px;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    --ag-font-family: "Noto Kufi Arabic", Tahoma, Arial, sans-serif;
    --ag-font-size: 12px;
    --ag-header-background-color: #eaf1f6;
    --ag-header-foreground-color: #173b55;
    --ag-row-hover-color: #edf6fb;
    --ag-border-color: #d2dde5;
    --ag-row-border-color: #e0e7ec;
    --ag-cell-horizontal-padding: 5px;
}

.erpx-accounting-entry-grid .ag-header-cell-label {
    justify-content: center;
    font-weight: 800;
}

.erpx-accounting-entry-grid .ag-cell {
    display: flex;
    align-items: center;
    padding: 3px 5px;
}

.erpx-accounting-ag-cell {
    width: 100%;
}

.erpx-accounting-ag-input {
    width: 100%;
    min-height: 34px;
    padding: 5px 7px;
    border: 1px solid #cbd8e1;
    border-radius: 6px;
    background: #fff;
    font: inherit;
}

.erpx-accounting-ag-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(21, 91, 125, .12);
    outline: 0;
}

@media print {
    .erpx-accounting-table-source { display: table !important; }
}

.app-topbar {
    isolation: isolate;
    position: sticky;
    top: 0;
    flex: 0 0 auto;
}

.topbar-start {
    flex: 1 1 auto;
}

.topbar-actions {
    flex: 0 0 auto;
}

.user-menu-button {
    min-height: 46px;
}

.user-menu-action {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-menu-action-icon {
    width: 26px;
    height: 26px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 26px;
    border-radius: 7px;
    background: #eef5f8;
    color: var(--primary);
}

.user-menu-action-icon svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.user-menu-action.text-danger .user-menu-action-icon {
    background: #fff2f2;
    color: var(--danger);
}

.login-title-block h1 {
    font-size: clamp(22px, 3vw, 34px);
}

html[dir="ltr"] body {
    direction: ltr;
    text-align: left;
}

html[dir="ltr"] .login-card,
html[dir="ltr"] .login-showcase {
    direction: ltr;
}

html[dir="ltr"] .app-sidebar {
    border-inline-start: 0;
    border-inline-end: 1px solid var(--border);
    box-shadow: 14px 0 34px rgba(15,36,51,.08);
}

html[dir="ltr"] .module-rail {
    padding-inline-end: 0;
    padding-inline-start: 10px;
    border-inline-end: 0;
    border-inline-start: 1px solid var(--border);
}

html[dir="ltr"] .page-context,
html[dir="ltr"] .page-title,
html[dir="ltr"] .user-menu-button,
html[dir="ltr"] .user-menu-dropdown,
html[dir="ltr"] .side-nav a,
html[dir="ltr"] .nav-group-head,
html[dir="ltr"] .nav-subgroup-head {
    text-align: left;
}

html[dir="ltr"] .nav-subgroup-links {
    padding-inline-start: 0;
    padding-inline-end: 12px;
}

@media (max-width: 980px) {
    .main-toolstrip {
        align-items: stretch;
        overflow-x: auto;
        padding: 8px 12px;
    }

    .toolstrip-group {
        flex-wrap: nowrap;
        min-width: max-content;
    }

    .tool-btn {
        min-height: 40px;
        padding-inline: 10px;
    }

    html[dir="ltr"] .app-sidebar {
        right: auto;
        left: -360px;
        box-shadow: 20px 0 40px rgba(15,36,51,.18);
    }

    html[dir="ltr"] body.sidebar-open .app-sidebar {
        left: 0;
    }
}

@media (max-width: 760px) {
    .responsive-table {
        border-radius: 10px;
    }

    .unified-pager {
        align-items: stretch;
        flex-direction: column;
    }

    .pager-pages {
        justify-content: stretch;
    }

    .pager-btn,
    .pager-number {
        flex: 1 1 auto;
    }

    .pager-size-form label {
        justify-content: space-between;
        width: 100%;
    }

    .erpx-table:not(.edit-table) {
        min-width: 760px;
        font-size: 13px;
    }

    .erpx-table:not(.edit-table) th,
    .erpx-table:not(.edit-table) td {
        padding: 7px 6px;
    }
}

/* Compact action strip. All screen commands live here, not inside content cards. */
.main-toolstrip {
    justify-content: flex-start;
    gap: 4px;
    min-height: 38px;
    padding: 3px 12px;
    background: #fff;
    border-bottom: 1px solid #d8e2e8;
    box-shadow: 0 2px 8px rgba(15,36,51,.06);
}

.toolstrip-group {
    gap: 2px;
}

.tool-btn {
    position: relative;
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #2f3679;
    box-shadow: none;
}

.tool-btn:hover {
    color: var(--primary);
    border-color: #d4dde5;
    background: #f5f8fb;
}

.tool-btn.primary,
.tool-btn.success,
.tool-btn.warning,
.tool-btn.danger {
    color: #2f3679;
    border-color: transparent;
    background: transparent;
}

.tool-btn.primary:hover,
.tool-btn.success:hover,
.tool-btn.warning:hover,
.tool-btn.danger:hover {
    color: var(--primary);
    border-color: #d4dde5;
    background: #f5f8fb;
}

.tool-icon {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    border-radius: 5px;
    background: transparent;
    color: currentColor;
    font-size: 15px;
    line-height: 1;
    display: inline-grid;
    place-items: center;
}

.tool-icon.bi::before {
    font-size: 15px;
    line-height: 1;
}

.tool-btn.primary .tool-icon,
.tool-btn.success .tool-icon,
.tool-btn.warning .tool-icon,
.tool-btn.danger .tool-icon,
.user-menu-action-icon {
    background: transparent;
}

.tool-btn > span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.page-command-form,
.invoice-form > .form-actions,
.invoice-lines .line-actions {
    display: none !important;
}

.master-edit-form {
    min-width: 0;
}

.master-form-grid {
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 14px;
    align-items: end;
}

.master-form-grid label,
.master-form-grid > div > label,
.master-party-header label {
    display: block;
    margin-bottom: 7px;
    line-height: 1.35;
}

.required-star {
    color: #dc2626 !important;
    font-weight: 900 !important;
    margin-inline-start: 4px;
}

label .required-star,
.master-edit-form label .required-star,
.master-form-grid label .required-star,
.master-party-header label .required-star {
    color: #dc2626 !important;
    font-weight: 900 !important;
}

.master-form-grid .span-2 {
    grid-column: span 2;
}

.master-form-grid .span-3 {
    grid-column: span 3;
}

.master-form-grid .span-4 {
    grid-column: 1 / -1;
}

.compact-master-form {
    max-width: 980px;
}

.master-form-grid textarea.form-control {
    min-height: 86px;
    resize: vertical;
}

.master-note-wide textarea,
.master-note-wide textarea.form-control {
    width: 100%;
    min-height: 112px;
}

.master-form-grid .check-line {
    min-height: 40px;
    align-items: center;
}

.master-edit-form .party-movement-panel {
    display: none;
}

/* Accounting reports: compact filters and print-safe report canvas. */
.accounting-report-page {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.report-filter-card,
.accounting-report-print {
    border: 1px solid #d7e2ea;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 32px rgba(15,36,51,.06);
}

.report-filter-card {
    padding: 14px;
}

.report-filter-collapse {
    display: grid;
    gap: 12px;
}

.report-filter-collapse > summary {
    list-style: none;
    cursor: pointer;
}

.report-filter-collapse > summary::-webkit-details-marker {
    display: none;
}

.report-filter-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.report-filter-head strong {
    display: block;
    color: var(--ink);
    font-size: 18px;
    font-weight: 900;
}

.report-filter-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

.report-filter-actions .btn-primary,
.report-filter-actions .btn-secondary {
    min-height: 36px;
    padding: 7px 14px;
}

.report-filter-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(130px, 1fr));
    gap: 10px;
    align-items: end;
}

.report-filter-grid label {
    display: grid;
    gap: 5px;
    color: #26445a;
    font-weight: 800;
}

.report-filter-grid .span-2 {
    grid-column: span 2;
}

.filter-collapse-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid #d6e2ea;
    border-radius: 999px;
    background: #f7fbfd;
    color: var(--primary);
    padding: 7px 11px;
    font-size: 12px;
    font-weight: 900;
}

.report-filter-collapse[open] .filter-collapse-status {
    background: #eaf4f9;
}

.report-filter-collapse:not([open]) {
    gap: 0;
}

.report-filter-note {
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #cfe3ef;
    border-radius: 8px;
    background: #f4fbff;
    color: #1d5f7e;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 800;
}

.multi-select-filter {
    position: relative;
    min-width: 0;
    align-self: end;
}

.multi-select-filter summary {
    min-height: 38px;
    border: 1px solid #ccd9e2;
    border-radius: 8px;
    background: #fff;
    padding: 7px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    list-style: none;
    max-width: 100%;
}

.multi-select-filter summary::-webkit-details-marker {
    display: none;
}

.multi-select-filter summary small {
    display: block;
    color: #607486;
    font-size: 11px;
    font-weight: 800;
}

.multi-select-filter summary strong {
    display: block;
    max-width: min(34vw, 360px);
    color: var(--ink);
    font-size: 13px;
    font-weight: 900;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.multi-select-filter[open] summary {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 91, 125, .12);
}

.report-mode-toggle {
    min-height: 38px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    border: 0;
    padding: 0;
    margin: 0;
    align-self: end;
}

.report-mode-toggle legend {
    grid-column: 1 / -1;
    color: #26445a;
    font-size: 13px;
    font-weight: 900;
    margin-bottom: 0;
}

.report-mode-toggle label {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ccd9e2;
    border-radius: 8px;
    background: #fff;
    color: #5b7182;
    cursor: pointer;
    font-size: 13px;
    font-weight: 900;
}

.report-mode-toggle label.active {
    border-color: var(--primary);
    background: #eaf4f9;
    color: var(--primary);
    box-shadow: inset 0 0 0 1px rgba(30, 91, 125, .12);
}

.report-mode-toggle input {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    opacity: 0;
    pointer-events: none;
}

.multi-select-panel {
    position: absolute;
    z-index: 40;
    inset-inline: 0;
    top: calc(100% + 6px);
    max-height: 260px;
    overflow: auto;
    border: 1px solid #ccd9e2;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 36px rgba(16, 43, 67, .14);
    padding: 6px;
    overscroll-behavior: contain;
}

.multi-select-panel p {
    margin: 4px 6px 8px;
    color: #607486;
    font-size: 12px;
}

.multi-select-panel label {
    display: flex;
    grid-template-columns: none;
    align-items: center;
    gap: 8px;
    min-height: 30px;
    padding: 5px 7px;
    border-radius: 6px;
    color: var(--ink);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.35;
    cursor: pointer;
}

.multi-select-panel label:hover {
    background: #f1f6f9;
}

.multi-select-panel .multi-select-manual {
    display: grid;
    gap: 5px;
    margin-bottom: 8px;
    border-bottom: 1px solid #e4edf3;
    padding-bottom: 8px;
    cursor: default;
}

.multi-select-panel .multi-select-manual span {
    color: #607486;
    font-size: 12px;
}

.multi-select-panel input[type="checkbox"] {
    appearance: auto;
    width: 14px;
    height: 14px;
    min-width: 14px;
    min-height: 14px;
    flex: 0 0 14px;
    padding: 0;
    margin: 0;
    border-radius: 3px;
}

.multi-select-panel .multi-select-manual input {
    width: 100%;
    min-height: 32px;
    border: 1px solid #ccd9e2;
    border-radius: 7px;
    background: #fff;
    color: var(--ink);
    padding: 6px 8px;
    font: inherit;
}

.lookup-inline-results {
    display: grid;
    gap: 5px;
    max-height: 190px;
    overflow: auto;
    margin: 0 0 8px;
    padding: 0 0 8px;
    border-bottom: 1px solid #e4edf3;
}

.lookup-inline-results:empty {
    display: none;
}

.lookup-inline-results .lookup-result {
    grid-template-columns: 96px 1fr;
    min-height: 32px;
    padding: 6px 8px;
    font-size: 12px;
}

.lookup-inline-results .lookup-empty {
    padding: 10px;
    font-size: 12px;
}

.report-filter-grid input,
.report-filter-grid select {
    width: 100%;
    min-height: 38px;
    border: 1px solid #ccd9e2;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    padding: 7px 10px;
    font: inherit;
}

.report-filter-grid .check-filter {
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #d7e2ea;
    border-radius: 8px;
    background: #f8fbfd;
    padding: 7px 10px;
    font-size: 12px;
    line-height: 1.3;
}

.report-filter-grid .check-filter input[type="checkbox"] {
    appearance: auto;
    width: 14px;
    height: 14px;
    min-width: 14px;
    min-height: 14px;
    flex: 0 0 14px;
    margin: 0;
    padding: 0;
}

.accounting-report-print {
    padding: 16px;
    overflow: hidden;
}

.report-print-header {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr;
    gap: 14px;
    align-items: start;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 12px;
    margin-bottom: 12px;
}

.report-print-brand {
    display: grid;
    gap: 3px;
    color: var(--primary);
    font-weight: 900;
}

.report-print-brand span,
.report-print-title p,
.report-print-meta,
.report-print-footer,
.report-summary-grid span {
    color: var(--muted);
}

.report-print-title {
    text-align: center;
}

.report-print-title h1 {
    margin: 0 0 4px;
    color: var(--ink);
    font-size: 20px;
    font-weight: 900;
}

.report-print-title p {
    margin: 0;
    font-weight: 700;
}

.report-print-meta {
    display: grid;
    gap: 3px;
    font-size: 12px;
}

.report-print-meta strong {
    color: var(--ink);
}

.report-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.report-summary-grid article {
    border: 1px solid #d7e2ea;
    border-inline-start: 4px solid var(--primary);
    border-radius: 8px;
    background: #fbfdff;
    padding: 10px 12px;
}

.report-summary-grid strong {
    display: block;
    margin-top: 4px;
    color: var(--ink);
    font-size: 16px;
    font-weight: 900;
}

.report-table-shell {
    max-height: calc(100dvh - 350px);
    min-height: 260px;
    overflow: auto;
    border: 1px solid #d7e2ea;
    border-radius: 8px;
}

.accounting-report-table {
    width: 100%;
    min-width: 1060px;
    border-collapse: collapse;
    font-size: 12px;
    background: #fff;
}

.accounting-report-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--primary);
    color: #fff;
    font-weight: 900;
}

.accounting-report-table th,
.accounting-report-table td {
    border: 1px solid #d7e2ea;
    padding: 6px 7px;
    vertical-align: middle;
    white-space: nowrap;
}

.accounting-report-table tbody tr:nth-child(even) {
    background: #f8fbfd;
}

.accounting-report-table .col-no {
    width: 54px;
    text-align: center;
}

.accounting-report-table .mono {
    font-family: Consolas, "Courier New", monospace;
    direction: ltr;
    unicode-bidi: plaintext;
}

.accounting-report-table .num {
    text-align: end;
    font-variant-numeric: tabular-nums;
}

.accounting-report-table .empty-cell {
    text-align: center;
    color: var(--muted);
    padding: 28px;
}

.report-print-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    border-top: 1px solid #d7e2ea;
    margin-top: 12px;
    padding-top: 8px;
    color: #10263a;
    font-size: 11px;
    font-weight: 800;
}

.print-page-number::after {
    content: "1";
}

.accounting-list-page {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.accounting-list-card {
    min-width: 0;
    border: 1px solid #d7e2ea;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 32px rgba(15,36,51,.06);
    padding: 14px;
}

.list-print-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid #d7e2ea;
    margin-bottom: 12px;
    padding-bottom: 10px;
}

.list-print-header h2 {
    margin: 2px 0 3px;
    color: var(--ink);
    font-size: 22px;
    font-weight: 900;
}

.list-print-header p {
    margin: 0;
    color: var(--muted);
    font-weight: 700;
}

.list-count-badge {
    min-width: 120px;
    border: 1px solid #d7e2ea;
    border-radius: 8px;
    background: #f8fbfd;
    padding: 8px 10px;
    text-align: center;
}

.list-count-badge span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.list-count-badge strong {
    color: var(--ink);
    font-size: 20px;
    font-weight: 900;
}

.accounting-list-table-shell {
    max-height: calc(100dvh - 390px);
}

.accounting-list-table {
    min-width: 1180px;
}

.accounting-list-table th:nth-child(3),
.accounting-list-table td:nth-child(3),
.accounting-list-table th:nth-child(4),
.accounting-list-table td:nth-child(4) {
    min-width: 220px;
}

.accounting-list-table .wrap-cell {
    white-space: normal;
    line-height: 1.55;
}

.accounting-placeholder-page {
    display: grid;
    place-items: center;
    min-height: min(520px, calc(100dvh - 190px));
    padding: 24px;
}

.accounting-placeholder-card {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 16px;
    max-width: 760px;
    border: 1px solid #d7e2ea;
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--shadow-soft);
    padding: 24px;
}

.report-filter-switches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.compact-check-filter {
    min-height: 34px;
    display: inline-flex !important;
    grid-template-columns: none !important;
    align-items: center;
    gap: 7px !important;
    border: 1px solid #d7e2ea;
    border-radius: 8px;
    background: #f8fbfd;
    padding: 6px 10px;
    color: var(--ink) !important;
    font-size: 12px;
    font-weight: 800;
}

.compact-check-filter input[type="checkbox"] {
    appearance: auto;
    width: 14px;
    height: 14px;
    min-width: 14px;
    min-height: 14px;
    margin: 0;
}

.accounting-report-header {
    display: grid;
    gap: 12px;
    margin-bottom: 12px;
}

.accounting-report-band {
    background: var(--primary);
    color: #fff;
    text-align: center;
    font-size: 24px;
    font-weight: 900;
    line-height: 1.2;
    padding: 8px 14px;
}

.accounting-report-company {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr) 180px;
    align-items: center;
    gap: 14px;
}

.accounting-report-logo {
    min-height: 82px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.accounting-report-logo img {
    max-width: 150px;
    max-height: 82px;
    object-fit: contain;
}

.accounting-report-company-text {
    display: grid;
    gap: 5px;
    text-align: center;
    color: #10263a;
}

.accounting-report-company-text strong {
    font-size: 17px;
    font-weight: 900;
}

.accounting-report-company-text span {
    color: #435a6c;
    font-size: 12px;
    font-weight: 700;
}

.accounting-report-filter-line {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 18px;
    border: 1px solid #d4dde5;
    background: #f7f9fb;
    color: #10263a;
    padding: 8px 12px;
    font-size: 11.5px;
    font-weight: 800;
}

.statement-print .report-table-shell,
.aging-print .report-table-shell {
    max-height: calc(100dvh - 330px);
    border-radius: 0;
}

.statement-print .accounting-report-table,
.aging-print .accounting-report-table {
    min-width: 1280px;
    font-size: 11px;
}

.statement-print .accounting-report-table th,
.aging-print .accounting-report-table th {
    background: var(--primary);
    color: #fff;
}

.statement-print .accounting-report-table tfoot td,
.aging-print .accounting-report-table tfoot td {
    background: #eaf5f8;
    color: #001d31;
    font-weight: 900;
}

.placeholder-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: #edf6fb;
    color: var(--primary);
    font-size: 26px;
}

.accounting-placeholder-card h2 {
    margin: 3px 0 8px;
    color: var(--ink);
    font-size: 24px;
    font-weight: 900;
}

.accounting-placeholder-card p {
    margin: 0;
    color: var(--muted);
    font-weight: 700;
    line-height: 1.8;
}

.accounting-placeholder-card .placeholder-note {
    margin-top: 10px;
    border-radius: 8px;
    background: #fff8e7;
    color: #7b5b00;
    padding: 10px 12px;
}

.accounting-closing-page {
    display: grid;
    gap: 14px;
}

.closing-card {
    border: 1px solid #d7e2ea;
    border-radius: 10px;
    background: #fff;
    box-shadow: var(--shadow-soft);
    padding: 18px;
}

.closing-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid #e1e8ee;
    padding-bottom: 12px;
    margin-bottom: 14px;
}

.closing-header h2 {
    margin: 2px 0 6px;
    color: var(--ink);
    font-size: 24px;
    font-weight: 900;
}

.closing-header p {
    margin: 0;
    color: var(--muted);
    font-weight: 700;
}

.summary-grid.compact {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    margin-bottom: 14px;
}

.summary-card.warning {
    border-inline-start-color: #d69a00;
}

.summary-card.danger {
    border-inline-start-color: #c53535;
}

.closing-checklist {
    border: 1px solid #e1e8ee;
    border-radius: 10px;
    background: #f8fbfd;
    padding: 14px;
}

.closing-checklist h3 {
    margin: 0 0 10px;
    color: var(--ink);
    font-size: 17px;
    font-weight: 900;
}

.closing-checklist ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.closing-checklist li {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #22384b;
    font-weight: 800;
}

.closing-checklist i {
    color: #078650;
}

.closing-warning {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    border: 1px solid #f2c6c6;
    border-radius: 10px;
    background: #fff3f3;
    color: #8a1f1f;
    padding: 11px 12px;
    font-weight: 900;
}

.vat-declaration-page {
    display: grid;
    gap: 14px;
}

.vat-filter-card {
    padding: 16px 16px 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
}

.vat-filter .filter-card-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dbe7ef;
}

.vat-filter .filter-card-head span {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border-radius: 999px;
    background: #edf6fb;
    color: var(--primary);
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 900;
}

.vat-filter .filter-card-head h2 {
    margin: 0;
    color: var(--ink);
    font-size: 25px;
    line-height: 1.45;
    font-weight: 900;
}

.vat-filter-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 11px 10px;
    align-items: end;
}

.vat-filter-grid label {
    display: grid;
    gap: 6px;
    min-width: 0;
    color: var(--ink);
    font-weight: 900;
}

.vat-filter-grid label > span {
    color: #244258;
    font-size: 12px;
    line-height: 1.4;
}

.vat-filter-grid label.wide {
    grid-column: span 2;
}

.vat-field-saved {
    grid-column: span 3;
}

.vat-field-number,
.vat-field-date,
.vat-field-amount {
    grid-column: span 2;
}

.vat-field-remark {
    grid-column: span 6;
}

.vat-field-account {
    grid-column: span 6;
}

.vat-filter-actions {
    grid-column: span 8;
    align-self: end;
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    margin: 0;
}

.vat-filter-grid input,
.vat-filter-grid select {
    height: 39px;
    min-width: 0;
    border: 1px solid #cbd8e3;
    border-radius: 8px;
    background: #fff;
    padding: 6px 11px;
    color: var(--ink);
    font-weight: 800;
    box-shadow: 0 1px 0 rgba(15, 36, 51, .03);
}

.vat-filter-grid input:focus,
.vat-filter-grid select:focus {
    outline: 0;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21, 91, 125, .12);
}

.vat-filter-grid input[readonly] {
    background: #eef3f7;
    color: #586b7b;
}

.vat-filter-actions .btn-primary,
.vat-filter-actions .btn-secondary {
    min-height: 39px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 8px;
    padding: 7px 13px;
    white-space: nowrap;
    font-weight: 900;
}

.vat-declaration-sheet {
    border: 1px solid #d5e2eb;
    border-radius: 10px;
    background: #f7fcf8;
    box-shadow: var(--shadow-soft);
    padding: 16px;
}

.vat-print-title {
    background: #245f83;
    color: #fff;
    text-align: center;
    font-size: 24px;
    font-weight: 900;
    padding: 8px 12px;
    margin-bottom: 14px;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.vat-sheet-header {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr) 220px;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
    border-bottom: 2px solid #d4e7dc;
    padding-bottom: 10px;
}

.vat-print-logo img {
    max-width: 150px;
    max-height: 86px;
    object-fit: contain;
}

.vat-print-company {
    display: grid;
    gap: 4px;
    text-align: center;
}

.vat-print-company h2 {
    margin: 0;
    color: var(--ink);
    font-size: 20px;
    font-weight: 900;
}

.vat-print-company strong,
.vat-print-company span,
.vat-print-company small,
.vat-print-status small {
    color: #334a5b;
    font-weight: 800;
}

.vat-print-status {
    display: grid;
    gap: 4px;
    justify-items: stretch;
}

.vat-print-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 0;
    margin-bottom: 10px;
    border: 1px solid #d5e2eb;
    background: #fff;
}

.vat-print-meta span {
    padding: 7px 9px;
    border: 1px solid #d5e2eb;
    color: var(--ink);
    font-size: 12px;
    font-weight: 800;
}

.vat-total-tile span,
.vat-account-field span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.vat-period strong,
.vat-total-tile strong,
.vat-account-field strong {
    color: var(--ink);
    font-weight: 900;
}

.vat-issues {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    border: 1px solid #f0c3c3;
    border-radius: 8px;
    background: #fff4f4;
    color: #8a1f1f;
    padding: 9px 10px;
    margin-bottom: 12px;
    font-weight: 900;
}

.vat-issues span {
    border-radius: 999px;
    background: #fff;
    padding: 4px 9px;
    font-size: 12px;
}

.vat-grid-shell {
    overflow: auto;
    border: 1px solid #cbdbe5;
    border-radius: 8px;
    background: #fff;
}

.vat-declaration-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
    direction: rtl;
    font-size: 13px;
}

.vat-declaration-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #245f83;
    color: #fff;
    border: 1px solid #d7e4ec;
    padding: 9px 10px;
    font-weight: 900;
    text-align: center;
}

.vat-declaration-table td {
    border: 1px solid #d7e4ec;
    padding: 7px 9px;
    background: #fff;
    font-weight: 800;
}

.vat-declaration-table .line-desc {
    width: 54%;
    text-align: right;
}

.vat-declaration-table .line-no {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-inline-end: 6px;
    border-radius: 999px;
    background: #eef5f9;
    color: #245f83;
    font-size: 12px;
}

.vat-declaration-table .num {
    direction: ltr;
    text-align: left;
    font-variant-numeric: tabular-nums;
}

.vat-declaration-table tr.sales td:first-child {
    border-inline-start: 5px solid #188753;
}

.vat-declaration-table tr.purchases td:first-child {
    border-inline-start: 5px solid #b87800;
}

.vat-declaration-table tr.totals td:first-child {
    border-inline-start: 5px solid #245f83;
}

.vat-declaration-table tr.total-row td {
    background: #eaf4fb;
    font-weight: 900;
}

.vat-declaration-table tr.calculated-row td {
    background: #eefbf4;
    color: #0a6840;
}

.vat-payment-panel {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.vat-account-field,
.vat-total-tile {
    min-height: 68px;
    display: grid;
    align-content: center;
    gap: 4px;
    border: 1px solid #d5e2eb;
    border-radius: 8px;
    background: #fff;
    padding: 10px 12px;
}

.vat-account-field {
    grid-column: span 2;
}

.vat-total-tile.balance {
    background: #fff7ed;
}

.vat-print-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    color: #4b6172;
    font-size: 11px;
    font-weight: 800;
}

.vat-print-footer .page-number::after {
    content: counter(page);
}

.vat-print-footer .page-count::after {
    content: counter(pages);
}

@media (max-width: 1180px) {
    .report-filter-grid {
        grid-template-columns: repeat(3, minmax(160px, 1fr));
    }

    .report-summary-grid {
        grid-template-columns: repeat(2, minmax(160px, 1fr));
    }

    .vat-filter-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .vat-field-saved,
    .vat-field-account,
    .vat-field-remark,
    .vat-filter-actions {
        grid-column: span 6;
    }

    .vat-field-number,
    .vat-field-date,
    .vat-field-amount {
        grid-column: span 3;
    }
}

@media (max-width: 760px) {
    .report-filter-head,
    .report-print-header,
    .report-print-footer {
        grid-template-columns: 1fr;
        display: grid;
    }

    .report-filter-grid,
    .report-summary-grid {
        grid-template-columns: 1fr;
    }

    .summary-grid.compact {
        grid-template-columns: 1fr;
    }

    .vat-filter-grid,
    .vat-payment-panel {
        grid-template-columns: 1fr;
    }

    .vat-filter-grid label.wide,
    .vat-field-saved,
    .vat-field-number,
    .vat-field-date,
    .vat-field-remark,
    .vat-field-account,
    .vat-field-amount,
    .vat-filter-actions,
    .vat-account-field {
        grid-column: auto;
    }

    .vat-filter .filter-card-head {
        align-items: stretch;
        display: grid;
    }

    .vat-filter-actions {
        justify-content: stretch;
    }

    .vat-filter-actions .btn-primary,
    .vat-filter-actions .btn-secondary {
        flex: 1 1 auto;
    }

    .vat-sheet-header {
        grid-template-columns: 1fr;
    }

    .closing-header {
        display: grid;
    }

    .report-filter-grid .span-2 {
        grid-column: auto;
    }

    .report-table-shell {
        max-height: calc(100dvh - 420px);
    }

    .list-print-header,
    .accounting-placeholder-card {
        grid-template-columns: 1fr;
    }

    .list-print-header {
        display: grid;
    }
}

@media print {
    @page {
        size: A4 landscape;
        margin: 9mm;
    }

    html,
    body {
        width: auto !important;
        height: auto !important;
        overflow: visible !important;
        background: #fff !important;
    }

    .app-shell,
    .app-main,
    .content-wrap,
    .accounting-report-page {
        display: block !important;
        width: auto !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .accounting-report-print {
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        padding: 0 !important;
        overflow: visible !important;
    }

    .report-print-header {
        grid-template-columns: 1fr 1.25fr 1fr;
        page-break-inside: avoid;
    }

    .accounting-report-header {
        page-break-inside: avoid;
        gap: 8px;
    }

    .accounting-report-band {
        font-size: 18px;
        padding: 6px 10px;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .accounting-report-company {
        grid-template-columns: 150px minmax(0, 1fr) 150px;
        gap: 8px;
    }

    .accounting-report-logo {
        min-height: 66px;
    }

    .accounting-report-logo img {
        max-width: 120px;
        max-height: 66px;
    }

    .accounting-report-company-text strong {
        font-size: 14px;
    }

    .accounting-report-company-text span,
    .accounting-report-filter-line {
        font-size: 9.5px;
    }

    .accounting-report-filter-line {
        padding: 6px 8px;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .report-summary-grid {
        grid-template-columns: repeat(4, 1fr);
        page-break-inside: avoid;
    }

    .report-table-shell {
        max-height: none !important;
        min-height: 0 !important;
        overflow: visible !important;
        border: 0 !important;
    }

    .accounting-report-table {
        min-width: 0 !important;
        font-size: 8.8px;
    }

    .accounting-report-table thead {
        display: table-header-group;
    }

    .accounting-report-table tfoot {
        display: table-row-group;
    }

    .accounting-report-table tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .accounting-report-table th,
    .accounting-report-table td {
        padding: 4px 5px;
        border-color: #777;
        white-space: normal;
    }

    .accounting-report-table th {
        background: #1f5b82 !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .accounting-report-table tfoot td {
        background: #eaf5f8 !important;
        font-weight: 900;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .accounting-report-table .mono,
    .accounting-report-table .num {
        white-space: nowrap;
    }

    .report-print-footer {
        position: fixed;
        right: 9mm;
        left: 9mm;
        bottom: 4mm;
        display: grid !important;
        grid-template-columns: 1fr 1fr 1fr;
        align-items: center;
        border-top: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        color: #111 !important;
        font-size: 9px;
        font-weight: 800;
    }

    .report-print-footer span:nth-child(2) {
        text-align: center;
    }

    .report-print-footer span:nth-child(3) {
        text-align: left;
    }

    .vat-declaration-sheet {
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        background: #fff !important;
        padding: 0 0 18mm !important;
    }

    .vat-print-title {
        font-size: 19px;
        padding: 6px 10px;
        margin-bottom: 10px;
    }

    .vat-sheet-header {
        grid-template-columns: 150px minmax(0, 1fr) 190px;
        gap: 8px;
        margin-bottom: 8px;
        padding-bottom: 7px;
        page-break-inside: avoid;
    }

    .vat-print-logo img {
        max-width: 118px;
        max-height: 64px;
    }

    .vat-print-company h2 {
        font-size: 15px;
    }

    .vat-print-company strong,
    .vat-print-company span,
    .vat-print-company small,
    .vat-print-status small,
    .vat-print-meta span {
        font-size: 9.5px;
    }

    .vat-print-meta {
        grid-template-columns: repeat(2, 1fr);
        page-break-inside: avoid;
    }

    .vat-grid-shell {
        overflow: visible !important;
        border: 0 !important;
    }

    .vat-declaration-table {
        min-width: 0 !important;
        font-size: 9px;
    }

    .vat-declaration-table thead {
        display: table-header-group;
    }

    .vat-declaration-table tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .vat-declaration-table th,
    .vat-declaration-table td {
        padding: 4px 5px;
        border-color: #777;
    }

    .vat-declaration-table th {
        background: #245f83 !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .vat-declaration-table tr.total-row td,
    .vat-declaration-table tr.calculated-row td {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .vat-declaration-table .line-no {
        width: auto;
        height: auto;
        background: transparent !important;
        margin-inline-end: 4px;
    }

    .vat-payment-panel {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
        page-break-inside: avoid;
    }

    .vat-account-field,
    .vat-total-tile {
        min-height: 44px;
        padding: 6px 8px;
        border-radius: 0;
    }

    .vat-total-tile span,
    .vat-account-field span {
        font-size: 9px;
    }

    .vat-print-footer {
        position: fixed;
        right: 9mm;
        left: 9mm;
        bottom: 4mm;
        display: grid !important;
        grid-template-columns: 1fr 1fr 1fr;
        align-items: center;
        margin: 0 !important;
        padding-top: 3px;
        border-top: 1px solid #999;
        color: #111 !important;
        font-size: 9px;
    }

    .vat-print-footer span:nth-child(2) {
        text-align: center;
    }

    .vat-print-footer span:nth-child(3) {
        text-align: left;
    }

    .print-page-number::after {
        content: counter(page) " من " counter(pages);
    }

    .status-pill {
        border: 1px solid #aaa;
        background: transparent !important;
        color: #000 !important;
    }

    .accounting-list-card {
        border: 0 !important;
        box-shadow: none !important;
        padding: 0 !important;
    }

    .list-print-header {
        page-break-inside: avoid;
    }

    .unified-pager {
        display: none !important;
    }
}

.accounting-master-page {
    display: grid;
    gap: 14px;
}

.accounting-master-filters {
    grid-template-columns: minmax(280px, 520px) auto;
    align-items: end;
}

.accounting-master-filters .span-2 {
    grid-column: auto;
}

.accounting-master-table {
    max-width: 100%;
    overflow: auto;
}

.master-data-table {
    min-width: 980px;
    table-layout: fixed;
}

.master-data-table th,
.master-data-table td {
    vertical-align: middle;
}

.master-data-table th:nth-child(1),
.master-data-table td:nth-child(1) {
    width: 130px;
}

.master-data-table th:nth-child(4),
.master-data-table td:nth-child(4),
.master-data-table th:nth-child(5),
.master-data-table td:nth-child(5),
.master-data-table th:nth-child(6),
.master-data-table td:nth-child(6),
.master-data-table th:nth-child(7),
.master-data-table td:nth-child(7),
.master-data-table th:nth-child(8),
.master-data-table td:nth-child(8) {
    width: 105px;
    text-align: center;
}

.master-data-table th:last-child,
.master-data-table td:last-child {
    width: 140px;
}

.strong-code {
    font-weight: 800;
    color: var(--ink);
}

.muted-cell {
    color: var(--muted);
}

.row-command-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.inline-form {
    display: inline-flex;
    margin: 0;
}

.mini-command {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 4px 10px;
    border: 1px solid #cfdbe5;
    border-radius: 6px;
    background: #fff;
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.mini-command:hover {
    background: #f2f7fb;
    color: var(--primary-strong);
}

.mini-command.danger {
    color: var(--danger);
    border-color: #ffd0d0;
}

.validation-summary {
    margin-bottom: 14px;
    color: var(--danger);
    font-weight: 700;
}

.chart-account-workspace {
    display: grid;
    grid-template-columns: minmax(300px, 34%) minmax(0, 1fr);
    gap: 14px;
    height: calc(100dvh - 152px);
    min-height: 520px;
}

.chart-tree-panel,
.chart-details-panel {
    min-width: 0;
    min-height: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    box-shadow: var(--shadow-soft);
}

.chart-tree-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.chart-tree-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38px 38px;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.chart-tree-search input {
    min-width: 0;
    height: 38px;
    border: 1px solid #cfdbe5;
    border-radius: 8px;
    padding: 0 12px;
    font-weight: 700;
}

.chart-tree-search button {
    border: 1px solid #cfdbe5;
    border-radius: 8px;
    background: #f8fbfd;
    color: var(--primary);
}

.advanced-toggle {
    font-size: 16px;
}

.advanced-account-search {
    display: none;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding-top: 6px;
}

.advanced-account-search.open {
    display: grid;
}

.advanced-account-search label {
    display: grid;
    gap: 4px;
}

.advanced-account-search span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.advanced-account-search select {
    min-width: 0;
    height: 36px;
    border: 1px solid #cfdbe5;
    border-radius: 8px;
    padding: 0 10px;
    background: #fff;
    font-weight: 700;
}

.chart-tree-list {
    overflow: auto;
    padding: 8px;
}

.chart-tree-node {
    --tree-level: 1;
    display: grid;
    grid-template-columns: 24px 86px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    margin-bottom: 3px;
    padding: 6px 8px;
    padding-inline-start: calc(8px + (var(--tree-level) - 1) * 18px);
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--ink);
    text-decoration: none;
}

.chart-tree-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 2px 6px;
    padding: 7px 10px;
    border-radius: 8px;
    background: #f0f5f8;
    color: var(--primary-strong);
    font-weight: 900;
}

.chart-tree-group:first-child {
    margin-top: 2px;
}

.chart-tree-node:hover {
    border-color: #d7e3eb;
    background: #f7fbfd;
}

.chart-tree-node.selected {
    border-color: rgba(32, 99, 138, .34);
    background: #edf6fb;
    box-shadow: inset 4px 0 0 var(--primary);
}

.chart-tree-node.header-node {
    font-weight: 800;
}

.chart-tree-node.has-children .tree-toggle {
    cursor: pointer;
}

.chart-tree-node.is-collapsed .tree-name {
    color: var(--primary-strong);
}

.tree-toggle {
    color: var(--primary);
    text-align: center;
}

.tree-code {
    direction: ltr;
    font-family: Consolas, "Courier New", monospace;
    font-weight: 800;
    color: #4f6475;
}

.tree-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-state {
    border-radius: 999px;
    background: #fff4db;
    color: #8a6500;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 800;
}

.chart-details-panel {
    overflow: auto;
    padding: 14px;
}

.chart-message {
    grid-column: 1 / -1;
}

.account-summary-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid #d6e4ec;
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #f7fbfd 100%);
}

.account-summary-card h2 {
    margin: 3px 0;
    color: var(--ink);
    font-size: 20px;
}

.account-summary-card p {
    margin: 0;
    color: var(--muted);
}

.eyebrow {
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
}

.account-info-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(160px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.info-field {
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid #e0e9ef;
    border-radius: 8px;
    background: #fff;
}

.info-field span,
.balance-strip span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.info-field strong {
    display: block;
    margin-top: 5px;
    overflow: hidden;
    color: var(--ink);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.balance-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(160px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.balance-strip > div {
    padding: 12px;
    border: 1px solid #d7e4ec;
    border-radius: 8px;
    background: #f8fbfd;
}

.balance-strip strong {
    display: block;
    margin-top: 4px;
    color: var(--primary-strong);
    font-size: 18px;
    direction: ltr;
    text-align: right;
}

.account-tabs {
    display: grid;
    grid-template-columns: minmax(220px, .75fr) minmax(0, 1.25fr);
    gap: 12px;
    margin-top: 12px;
}

.account-tab-card {
    min-width: 0;
    border: 1px solid #dce7ee;
    border-radius: 10px;
    background: #fff;
    padding: 12px;
}

.account-tab-card h3 {
    margin: 0 0 10px;
    color: var(--ink);
    font-size: 16px;
}

.account-tab-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.8;
}

.compact-currency-table .erpx-table {
    min-width: 0;
    table-layout: fixed;
    font-size: 13px;
}

.compact-currency-table .erpx-table th,
.compact-currency-table .erpx-table td {
    padding: 7px 8px;
    white-space: normal;
}

.compact-empty {
    padding: 24px;
}

.master-edit-shell {
    display: block;
    max-width: 980px;
    margin-inline: auto;
}

.master-edit-summary,
.master-edit-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    box-shadow: var(--shadow-soft);
}

.master-edit-summary {
    padding: 16px;
    align-self: start;
}

.master-edit-summary h2 {
    margin: 6px 0 8px;
    color: var(--ink);
    font-size: 22px;
}

.master-edit-summary p {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}

.master-edit-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    background: #edf6fb;
    color: var(--primary);
    padding: 5px 10px;
    font-weight: 900;
}

.master-edit-card {
    padding: 16px;
}

.master-edit-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e1ebf1;
}

.master-edit-header h2 {
    margin: 0 0 4px;
    color: var(--ink);
    font-size: 23px;
}

.master-edit-header p {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}

.master-edit-section-title {
    margin: 0 0 14px;
    color: var(--primary-strong);
    font-size: 18px;
}

.master-edit-form input,
.master-edit-form textarea,
.master-edit-form select {
    width: 100%;
    min-height: 40px;
    border: 1px solid #97a6c0;
    border-radius: 8px;
    background: #fff;
    padding: 7px 10px;
    color: var(--ink);
    font-weight: 700;
}
.form-control:focus,
.master-edit-form input:focus,
.master-edit-form textarea:focus,
.master-edit-form select:focus,
.document-form-grid input:focus,
.document-form-grid textarea:focus,
.document-form-grid select:focus,
.grid-input:focus,
.lookup-modal-search input:focus {
    border-color: var(--brand) !important;
    box-shadow: none !important;
    outline: 0 !important;
}
.master-edit-form textarea {
    min-height: 92px;
}

.master-edit-form input[readonly] {
    background: #eef3f6;
    color: #536878;
}

.generated-code-field input {
    background: #eef7fb !important;
    border-color: #bdd8e7;
    color: var(--primary-strong) !important;
    font-family: Consolas, "Courier New", monospace;
    font-size: 18px;
    letter-spacing: 0;
}

.generated-code-field small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-weight: 700;
}

.master-edit-form label > span {
    color: var(--primary-strong);
    font-weight: 800;
}

.master-edit-form label > .required-star,
.master-form-grid label > .required-star,
.master-party-header label > .required-star {
    color: #dc2626 !important;
    font-weight: 900 !important;
}

.master-edit-form .check-line {
    display: flex;
    gap: 8px;
    justify-content: flex-start;
    border: 1px solid #dce7ee;
    border-radius: 8px;
    background: #f8fbfd;
    padding: 8px 10px;
}

.master-edit-form .check-line input {
    width: auto;
    min-height: auto;
}

.party-currency-section {
    align-self: stretch;
}

.section-inline-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    color: var(--ink);
}

.section-inline-title strong {
    display: block;
    font-size: 16px;
    font-weight: 900;
}

.section-inline-title small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.section-chip {
    border-radius: 999px;
    background: #edf5fa;
    color: var(--primary-strong);
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.master-party-card {
    display: grid;
    gap: 16px;
    padding: 18px;
}

.master-party-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid #dde8ef;
    padding-bottom: 12px;
}

.master-party-head h2 {
    margin: 0;
    color: var(--ink);
    font-size: 22px;
    font-weight: 900;
}

.master-party-header {
    align-items: end;
}

.master-tab-shell {
    border: 1px solid #d7e3ec;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}

.master-tabs {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 4px;
    border-bottom: 1px solid #d7e3ec;
    background: #f2f7fb;
    padding: 8px 10px 0;
    overflow-x: auto;
}

.master-tab {
    min-height: 38px;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    background: transparent;
    color: var(--muted);
    padding: 8px 14px;
    font-weight: 900;
    white-space: nowrap;
    cursor: pointer;
}

.master-tab:hover {
    color: var(--primary-strong);
    background: rgba(255, 255, 255, 0.65);
}

.master-tab.is-active {
    border-color: #d7e3ec;
    background: #fff;
    color: var(--primary-strong);
    box-shadow: 0 -1px 0 #fff inset;
}

.master-tab-panels {
    min-height: 330px;
    padding: 16px;
    background: #fff;
}

.master-tab-panel[hidden] {
    display: none !important;
}

.master-field-invalid {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.12) !important;
}

.erpx-validation-invalid {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.18) !important;
}

.party-currency-grid.master-field-invalid {
    border-color: #ef4444 !important;
}

.record-nav-strip {
    gap: 4px;
}

.tool-btn.icon-only {
    min-width: 34px;
    padding-inline: 8px;
}

.tool-btn.disabled {
    pointer-events: none;
    opacity: 0.38;
}

.party-movement-panel {
    display: grid;
    gap: 12px;
    margin-top: 16px;
    border-top: 1px solid #e2ebf2;
    padding-top: 14px;
}

.party-movement-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(160px, 1fr));
    gap: 10px;
}

.party-movement-summary > div {
    border: 1px solid #d7e3ec;
    border-radius: 8px;
    background: #f8fbfd;
    padding: 10px 12px;
}

.party-movement-summary span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.party-movement-summary strong {
    display: block;
    color: var(--ink);
    font-size: 17px;
    margin-top: 4px;
}

.party-movement-table {
    overflow-x: auto;
    border: 1px solid #d7e3ec;
    border-radius: 8px;
}

.party-movement-table table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}

.party-movement-table th {
    background: var(--primary);
    color: #fff;
    font-weight: 900;
    padding: 8px 10px;
    white-space: nowrap;
}

.party-movement-table td {
    border-top: 1px solid #d7e3ec;
    padding: 8px 10px;
    color: var(--ink);
    font-weight: 700;
    white-space: nowrap;
}

.party-movement-table .empty-cell {
    text-align: center;
    color: var(--muted);
    padding: 18px;
}

@media (max-width: 1100px) {
    .master-form-grid {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }
}

@media (max-width: 680px) {
    .master-form-grid {
        grid-template-columns: 1fr;
    }

    .master-form-grid .span-2,
    .master-form-grid .span-3,
    .master-form-grid .span-4 {
        grid-column: auto;
    }

    .accounting-master-filters {
        grid-template-columns: 1fr;
    }

    .chart-account-workspace {
        grid-template-columns: 1fr;
        height: auto;
    }

    .chart-tree-panel {
        min-height: 360px;
    }

    .account-info-grid,
    .balance-strip,
    .account-tabs {
        grid-template-columns: 1fr;
    }

    .master-edit-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .master-party-card {
        padding: 14px;
    }

    .master-party-head {
        align-items: flex-start;
        flex-direction: column-reverse;
    }

    .master-tabs {
        justify-content: flex-start;
    }

    .master-tab-panels {
        min-height: 0;
        padding: 12px;
    }

    .party-movement-summary {
        grid-template-columns: 1fr;
    }
}

@media print {
    .chart-account-workspace {
        display: block;
        height: auto;
        min-height: 0;
    }

    .chart-tree-panel,
    .chart-message {
        display: none !important;
    }

    .chart-details-panel {
        overflow: visible;
        border: 0;
        box-shadow: none;
        padding: 0;
    }

    .account-summary-card,
    .info-field,
    .balance-strip > div,
    .account-tab-card {
        break-inside: avoid;
        box-shadow: none;
    }

    .account-tabs {
        grid-template-columns: 1fr;
    }
}

.accounting-document-page {
    width: 100%;
    max-width: 1540px;
    margin: 0 auto;
}

.accounting-document-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    box-shadow: var(--shadow-soft);
    padding: 14px;
}

.accounting-document-header,
.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid #e2ebf2;
    padding-bottom: 12px;
    margin-bottom: 14px;
}

.accounting-document-header h2,
.section-title-row h3 {
    margin: 0;
    color: var(--ink);
}

.accounting-document-page .accounting-document-header {
    min-height: 38px;
    margin-bottom: 10px;
    padding-bottom: 8px;
}

.accounting-document-page .section-title-row {
    min-height: 42px;
    margin-bottom: 10px;
    padding: 0 2px 8px;
}

.accounting-document-page .section-title-row h3 {
    font-size: 18px;
    font-weight: 900;
}

.accounting-document-page [data-add-accounting-line] {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    padding: 6px 13px;
    border: 1px solid var(--primary);
    border-radius: 8px;
    background: #fff;
    color: var(--primary);
    font: inherit;
    font-size: 13px;
    font-weight: 900;
}

.accounting-document-page [data-add-accounting-line]:hover {
    background: #edf6fa;
}

.document-form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 10px 12px;
}

.document-form-grid label,
.document-lines-section label {
    display: grid;
    gap: 5px;
}

.document-form-grid label > span {
    color: var(--primary-strong);
    font-weight: 800;
}

.document-form-grid input,
.document-form-grid textarea,
.document-form-grid select {
    width: 100%;
    min-height: 38px;
    border: 1px solid #ccd9e2;
    border-radius: 8px;
    padding: 7px 9px;
    color: var(--ink);
    background: #fff;
    font-weight: 700;
}

.document-form-grid input[readonly],
.document-form-grid textarea[readonly] {
    background: #eef3f6;
    color: #536878;
}

.document-form-grid textarea {
    min-height: 58px;
}

.document-form-grid .span-2 {
    grid-column: span 2;
}

.document-form-grid .span-4 {
    grid-column: span 4;
}

.document-lines-section {
    margin-top: 12px;
}

.accounting-document-lines {
    min-width: 1180px;
}

.accounting-document-lines:not(.show-foreign) .foreign-only {
    display: none;
}

.accounting-document-lines .grid-input {
    width: 100%;
    min-height: 34px;
    border: 1px solid #cfdbe5;
    border-radius: 6px;
    padding: 5px 7px;
    font-weight: 700;
    background: #fff;
}

.accounting-document-lines .lookup-display {
    cursor: pointer;
    background: #fbfdff;
}

.accounting-document-lines .lookup-display::placeholder {
    color: #8193a0;
}

.accounting-document-lines .row-no {
    width: 52px;
    text-align: center;
    background: #eef3f6;
}

.accounting-document-lines .num-input {
    text-align: end;
    direction: ltr;
}

.accounting-document-lines .party-code-input {
    min-width: 110px;
}

.accounting-document-lines .partner-name-input {
    min-width: 150px;
}

.accounting-document-card.is-readonly .grid-input,
.accounting-document-card.is-readonly input,
.accounting-document-card.is-readonly textarea,
.accounting-document-card.is-readonly select {
    background: #eef3f6;
    color: #536878;
    cursor: not-allowed;
}

.lookup-modal[hidden] {
    display: none;
}

.lookup-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(10, 30, 45, 0.35);
}

.lookup-modal-panel {
    width: min(680px, 96vw);
    max-height: 78vh;
    display: grid;
    grid-template-rows: auto auto 1fr;
    gap: 12px;
    border: 1px solid #c8d7e2;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 22px 60px rgba(15, 37, 51, 0.22);
    padding: 14px;
}

.lookup-modal-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    position: relative;
    min-height: 42px;
    padding-left: 48px;
    text-align: right;
    color: var(--ink);
}

.lookup-modal-header .mini-action[data-lookup-close],
.lookup-modal-header .mini-action[data-report-lookup-close] {
    position: absolute;
    left: 0;
    top: 0;
}

.party-currency-grid {
    max-height: 260px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(214, 226, 234, 0.45);
}

.party-currency-grid table {
    width: 100%;
    border-collapse: collapse;
    min-width: 680px;
    table-layout: fixed;
}

.party-currency-grid th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--primary);
    color: #fff;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 800;
    text-align: center;
}

.party-currency-grid td {
    border-top: 1px solid #d7e3ec;
    padding: 8px 10px;
    font-weight: 700;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.party-currency-grid tr:nth-child(even) td {
    background: #f7fbfd;
}

.party-currency-grid tr.is-default td {
    background: #eef7fb;
    color: var(--primary-strong);
}

.party-currency-grid input[type="checkbox"] {
    width: 16px;
    height: 16px;
    min-height: 16px;
}

.currency-check-cell {
    width: 70px;
    text-align: center;
}

.currency-code-cell {
    width: 110px;
    text-align: center;
    direction: ltr;
    font-family: Consolas, "Courier New", monospace;
    color: var(--primary-strong);
}

.party-currency-default {
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #f8fafc;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    padding: 5px 10px;
    min-width: 92px;
}

.party-currency-item.is-default .party-currency-default {
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
}

.lookup-modal-search input {
    width: 100%;
    min-height: 42px;
    border: 1px solid #c8d7e2;
    border-radius: 8px;
    padding: 8px 12px;
    font-weight: 700;
}

.lookup-modal-results {
    overflow: auto;
    display: grid;
    gap: 6px;
    padding-inline-end: 4px;
}

.lookup-result {
    display: grid;
    grid-template-columns: 120px 1fr;
    align-items: center;
    gap: 10px;
    border: 1px solid #d7e3ec;
    border-radius: 8px;
    background: #f8fbfd;
    color: var(--ink);
    padding: 9px 10px;
    text-align: start;
    font-weight: 700;
}

.lookup-result:hover,
.lookup-result:focus {
    border-color: var(--primary);
    background: #edf6fb;
}

.lookup-code {
    direction: ltr;
    font-family: Consolas, "Courier New", monospace;
    color: var(--primary-strong);
}

.lookup-empty {
    padding: 18px;
    text-align: center;
    color: var(--muted);
    border: 1px dashed #c8d7e2;
    border-radius: 8px;
}

.accounting-document-totals {
    display: grid;
    grid-template-columns: repeat(3, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.accounting-document-totals .summary-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 64px;
    padding: 10px 14px;
    border: 1px solid #d1dee7;
    border-inline-end: 4px solid var(--primary);
    border-radius: 10px;
    background: linear-gradient(135deg, #fff, #f5f9fb);
}

.accounting-document-totals .summary-card span {
    color: #637b8b;
    font-size: 12px;
    font-weight: 800;
}

.accounting-document-totals .summary-card strong {
    direction: ltr;
    color: var(--ink);
    font-size: 17px;
    font-weight: 900;
}

.accounting-document-totals .summary-card:last-child {
    border-inline-end-color: #d39c28;
}

@media (max-width: 760px) {
    .accounting-document-page { max-width: 100%; }
    .accounting-document-card { padding: 10px; }
    .accounting-document-totals { grid-template-columns: 1fr; }
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.inline-form {
    display: inline;
}

.mini-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 30px;
    border: 1px solid #c8d7e2;
    border-radius: 6px;
    background: #fff;
    color: var(--primary-strong);
    padding: 4px 8px;
    text-decoration: none;
    font-weight: 800;
}

.mini-action.danger {
    color: #c62828;
}

.print-body {
    margin: 0;
    background: #fff;
    color: #0b2538;
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

.accounting-print-page {
    width: 100%;
    max-width: 1120px;
    margin: 24px auto;
    padding: 0 22px;
}

.print-doc-title {
    background: #245d80;
    color: #fff;
    text-align: center;
    padding: 10px;
    margin-bottom: 22px;
}

.print-doc-title h1 {
    margin: 0;
    font-size: 26px;
}

.print-company-header {
    display: grid;
    grid-template-columns: 160px 1fr;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.company-logo-box img {
    max-width: 145px;
    max-height: 100px;
    object-fit: contain;
}

.company-print-info {
    text-align: center;
    line-height: 1.7;
}

.company-print-info h2 {
    margin: 0;
    font-size: 22px;
}

.company-print-info p {
    margin: 2px 0;
    color: #34495e;
}

.print-meta-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border: 1px solid #d5e1ea;
    margin-bottom: 12px;
}

.print-meta-grid div {
    padding: 8px 10px;
    border-inline-start: 1px solid #d5e1ea;
}

.print-meta-grid span,
.print-remark span {
    display: block;
    color: #617487;
    font-size: 12px;
    font-weight: 700;
}

.print-meta-grid strong {
    display: block;
    margin-top: 3px;
    color: #0b2538;
}

.print-remark {
    border: 1px solid #d5e1ea;
    padding: 8px 10px;
    margin-bottom: 12px;
}

.print-remark p {
    margin: 4px 0 0;
}

.print-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 12px;
}

.print-table th {
    background: #245d80;
    color: #fff;
}

.print-table th,
.print-table td {
    border: 1px solid #d6e0e7;
    padding: 7px 6px;
    vertical-align: top;
    word-break: break-word;
}

.print-table tfoot th {
    background: #e8f1f7;
    color: #0b2538;
}

.print-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 18px;
    color: #475b6c;
    font-size: 12px;
}

@page {
    size: A4;
    margin: 12mm;
}

@media (max-width: 900px) {
    .document-form-grid {
        grid-template-columns: repeat(2, minmax(150px, 1fr));
    }

    .document-form-grid .span-4 {
        grid-column: span 2;
    }
}

@media (max-width: 620px) {
    .document-form-grid,
    .print-meta-grid,
    .print-company-header {
        grid-template-columns: 1fr;
    }

    .document-form-grid .span-2,
    .document-form-grid .span-4 {
        grid-column: auto;
    }
}

@media print {
    .accounting-print-page {
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .print-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
    }

    .print-table thead {
        display: table-header-group;
    }

    .print-table tr {
        break-inside: avoid;
    }
}

.required-star,
label .required-star,
label > .required-star,
.master-edit-form label .required-star,
.master-form-grid label .required-star,
.master-party-header label .required-star {
    color: #dc2626 !important;
    -webkit-text-fill-color: #dc2626 !important;
}

.master-edit-form input:focus,
.master-edit-form textarea:focus,
.master-edit-form select:focus,
.master-form-grid input:focus,
.master-form-grid textarea:focus,
.master-form-grid select:focus,
.document-form-grid input:focus,
.document-form-grid textarea:focus,
.document-form-grid select:focus {
    border-color: var(--primary) !important;
    box-shadow: none !important;
    outline: none !important;
}

.report-preview-shell {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: calc(100dvh - 150px);
    padding: 14px;
}

.report-preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #d6e2eb;
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(15, 43, 63, 0.06);
}

.report-preview-toolbar h1 {
    margin: 0;
    color: var(--primary-dark);
    font-size: 20px;
    font-weight: 800;
}

.report-preview-toolbar p {
    margin: 4px 0 0;
    color: #64748b;
    font-size: 12px;
}

.report-preview-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.report-preview-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    white-space: nowrap;
}

.report-preview-frame {
    flex: 1;
    min-height: 760px;
    width: 100%;
    background: #fff;
    border: 1px solid #d6e2eb;
    border-radius: 8px;
    box-shadow: 0 16px 40px rgba(15, 43, 63, 0.08);
}

@media (max-width: 760px) {
    .report-preview-shell {
        padding: 10px;
    }

    .report-preview-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .report-preview-actions .btn,
    .report-preview-actions a {
        flex: 1 1 auto;
        justify-content: center;
    }
}

@media print {
    .report-preview-toolbar {
        display: none !important;
    }

    .report-preview-shell {
        display: block;
        min-height: auto;
        padding: 0;
    }

    .report-preview-frame {
        min-height: 100vh;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }
}

/* Final responsive cascade: these shell rules must remain after desktop shell rules. */
@media screen and (max-width: 980px) {
    .app-shell,
    .app-shell.sidebar-collapsed {
        grid-template-columns: minmax(0, 1fr);
        width: 100%;
        max-width: 100%;
    }

    .app-main {
        width: 100%;
        max-width: 100vw;
    }

    .app-topbar {
        min-height: 64px;
        align-items: center;
        flex-direction: row;
        gap: 10px;
        padding: 8px 12px;
    }

    .topbar-start {
        flex: 1 1 auto;
        justify-content: flex-start;
        min-width: 0;
    }

    .topbar-actions {
        flex: 0 0 auto;
        width: auto;
    }

    .user-menu-button {
        min-width: 112px;
        max-width: 150px;
        padding: 6px 9px;
    }

    .content-wrap {
        width: 100%;
    }

    .brand-box {
        justify-content: space-between;
    }

    .sidebar-close {
        display: inline-grid;
        place-items: center;
        width: 38px;
        min-width: 38px;
        height: 38px;
        padding: 0;
        font-size: 25px;
        line-height: 1;
    }
}

@media screen and (max-width: 620px) {
    .app-topbar {
        gap: 7px;
        padding-inline: 8px;
    }

    .topbar-logo,
    .page-context {
        display: none;
    }

    .topbar-start {
        gap: 7px;
    }

    .page-title {
        max-width: 42vw;
        overflow: hidden;
        font-size: 14px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .user-menu-button {
        min-width: 94px;
        max-width: 108px;
        font-size: 12px;
    }
}

.zatca-company-scope{display:grid;grid-template-columns:auto auto;align-items:center;gap:.1rem .55rem;padding:.5rem .75rem;border:1px solid #cfe0e9;border-radius:9px;background:#f4f9fb;min-width:220px}.zatca-company-scope span{font-size:.72rem;color:#647b88}.zatca-company-scope strong{color:#155b7a;font-size:1rem}.zatca-company-scope small{grid-column:1/-1;color:#71838d;font-size:.65rem}@media(max-width:600px){.zatca-company-scope{width:100%;margin-top:.55rem}.zatca-unit-wizard .section-title-row{align-items:stretch}}
.zatca-local-diagnostic{margin-top:.75rem;border:1px solid #e0a9a9;border-radius:9px;background:#fff8f8;overflow:hidden}.zatca-local-diagnostic summary{cursor:pointer;padding:.65rem .8rem;color:#8b3030;font-weight:700}.zatca-local-diagnostic pre{margin:0;padding:.8rem;max-height:300px;overflow:auto;background:#17232b;color:#e8f1f5;font-size:.72rem;white-space:pre-wrap;overflow-wrap:anywhere;text-align:left}
/* Inventory item master */
.inventory-item-editor{display:grid;gap:14px}.item-master-header,.item-master-tabs{padding:14px}.erp-form-grid{display:grid;grid-template-columns:repeat(6,minmax(120px,1fr));gap:10px 12px;align-items:end}.erp-form-grid>div>label{display:block;margin:0 0 5px;color:#31536c;font-size:.82rem;font-weight:700}.erp-form-grid .span-2{grid-column:span 2}.check-field{display:flex;align-items:center;gap:7px;min-height:40px;padding:8px 10px;border:1px solid #d5e0e8;border-radius:8px;background:#f8fbfd}.compact-alert{margin:0 0 12px}.editor-tabs{display:flex;gap:4px;overflow-x:auto;border-bottom:1px solid #d4e0e8;margin:-2px -2px 12px;padding:0 2px}.editor-tabs button{white-space:nowrap;border:0;border-bottom:3px solid transparent;background:transparent;color:#547087;padding:10px 15px;font-weight:700}.editor-tabs button.active{color:#174c70;border-color:#1f6b94;background:#f3f8fb}.item-tab-panel{display:none}.item-tab-panel.active{display:block}.unit-defaults-grid{grid-template-columns:repeat(3,minmax(180px,1fr));margin-bottom:12px}.grid-section-title{display:flex;justify-content:space-between;align-items:center;gap:12px;margin:5px 0 10px}.edit-grid input.form-control,.edit-grid select.form-select{min-width:110px;height:34px;padding-block:3px}.edit-grid td{padding:4px}.item-main-grid .form-control,.item-main-grid .form-select{min-height:39px}
.movement-totals{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:10px}.movement-totals span{padding:8px 14px;border:1px solid #d6e2ea;border-radius:8px;background:#f7fafc;color:#46657a}.movement-totals strong{color:#123f5d;margin-inline-start:6px}
@media(max-width:1100px){.erp-form-grid{grid-template-columns:repeat(3,minmax(150px,1fr))}}
@media(max-width:700px){.item-master-header,.item-master-tabs{padding:10px}.erp-form-grid,.unit-defaults-grid{grid-template-columns:1fr 1fr}.erp-form-grid .span-2{grid-column:span 2}.editor-tabs button{padding:9px 11px}.grid-section-title{align-items:flex-start}.edit-grid{min-width:780px}}
@media(max-width:440px){.erp-form-grid,.unit-defaults-grid{grid-template-columns:1fr}.erp-form-grid .span-2{grid-column:span 1}}
.searchable-select{position:relative;width:100%}.searchable-select-native{position:absolute!important;inline-size:1px!important;block-size:1px!important;opacity:0!important;pointer-events:none!important}.searchable-select-control{width:100%;text-align:start;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;background-color:#fff}.searchable-select-panel{display:none;position:absolute;z-index:1080;inset-inline:0;top:calc(100% + 3px);padding:.4rem;background:#fff;border:1px solid #b8c8d7;border-radius:.55rem;box-shadow:0 12px 30px rgba(20,54,78,.18)}.searchable-select.open .searchable-select-panel{display:block}.searchable-select-input{margin-bottom:.35rem;min-height:36px!important}.searchable-select-options{max-height:230px;overflow:auto;display:grid;gap:2px}.searchable-select-option{border:0;background:transparent;border-radius:.35rem;padding:.48rem .6rem;text-align:start;color:#18384e}.searchable-select-option:hover,.searchable-select-option.selected{background:#e7f2f8;color:#0e537a}.inventory-ag-grid{width:100%;min-height:118px;max-height:420px;border-radius:10px;--ag-font-family:"Noto Kufi Arabic",Tahoma,Arial,sans-serif;--ag-font-size:12px;--ag-header-background-color:#eef3f8;--ag-header-foreground-color:#173b55;--ag-row-hover-color:#edf6fb;--ag-selected-row-background-color:#e2f0f7;--ag-border-color:#d2dde5;--ag-row-border-color:#e0e7ec;--ag-header-column-separator-display:block;--ag-header-column-separator-color:#ccd7df;--ag-odd-row-background-color:#fbfdfe}.inventory-ag-grid .ag-header-cell-label{justify-content:center;font-weight:800}.inventory-ag-grid .ag-header-cell,.inventory-ag-grid .ag-header-row{background:#eef3f8!important;color:#173b55!important}.inventory-ag-grid .ag-header-cell-text,.inventory-ag-grid .ag-header-icon{color:#173b55!important}.inventory-ag-grid .ag-floating-filter,.inventory-ag-grid .ag-floating-filter-body{background:#f8fafc!important;color:#18384e!important}.inventory-ag-grid .ag-floating-filter-input input{background:#fff!important;color:#18384e!important;border-color:#ccd7df!important}.inventory-ag-grid .ag-cell{display:flex;align-items:center;border-inline-end-color:#e7edf2}.inventory-ag-grid .ag-overlay-no-rows-center{color:#728395;font-size:.8rem}.movement-filter-grid{align-items:end}
.nav-planned-screen{display:block;padding:.42rem .75rem;color:#63798a;font-size:.76rem;border-radius:.4rem;cursor:default;position:relative}.nav-planned-screen::after{content:"قيد التجهيز";float:left;margin-inline-start:.45rem;padding:.08rem .32rem;border-radius:99px;background:#eef3f7;color:#789;font-size:.58rem;white-space:nowrap}.nav-planned-screen:hover{background:#f6f9fb;color:#3d5a6e}
@media(max-width:1350px) and (min-width:951px){.item-main-grid{grid-template-columns:repeat(4,minmax(150px,1fr))}}@media(max-width:950px) and (min-width:701px){.item-main-grid{grid-template-columns:repeat(3,minmax(150px,1fr))}.item-main-grid .span-2{grid-column:span 2}}@media(max-width:700px){.item-main-grid .form-control,.item-main-grid .form-select,.searchable-select-control{min-height:44px}.item-master-tabs{overflow:hidden}.editor-tabs{scroll-snap-type:x proximity}.editor-tabs button{scroll-snap-align:start}}
/* Opening inventory document */
.opening-summary { display:grid; grid-template-columns:repeat(2,minmax(180px,280px)); gap:.75rem; justify-content:end; margin-top:1rem; }
.opening-summary > div { background:#f8fbfd; border:1px solid #d7e2ea; border-inline-end:4px solid #245f83; border-radius:12px; padding:.65rem .9rem; display:flex; justify-content:space-between; gap:1rem; align-items:center; }
.opening-summary span { color:#64748b; font-size:.82rem; }
.opening-summary strong { color:#123c58; font-size:1rem; }
@media (max-width:700px) { .opening-summary { grid-template-columns:1fr; } }

/* Unified AG Grid presentation shared by lists, documents and entry screens. */
.erpx-unified-ag-grid {
    --ag-font-family: "Noto Kufi Arabic", Tahoma, Arial, sans-serif;
    --ag-font-size: 12px;
    --ag-header-background-color: #255d82;
    --ag-header-foreground-color: #fff;
    --ag-header-cell-hover-background-color: #1f5275;
    --ag-row-hover-color: #edf6fb;
    --ag-selected-row-background-color: #e2f0f7;
    --ag-odd-row-background-color: #f8fbfd;
    --ag-background-color: #fff;
    --ag-border-color: #ccd8e1;
    --ag-row-border-color: #dde6ec;
    --ag-header-column-separator-display: block;
    --ag-header-column-separator-color: rgba(255, 255, 255, .32);
    --ag-header-column-resize-handle-display: block;
    --ag-header-column-resize-handle-color: rgba(255, 255, 255, .75);
    --ag-cell-horizontal-padding: 10px;
}

.erpx-unified-ag-grid .ag-header {
    position: sticky;
    inset-block-start: 0;
    z-index: 6;
    background: #255d82;
}

.erpx-unified-ag-grid .ag-header-cell,
.erpx-unified-ag-grid .ag-header-row,
.erpx-unified-ag-grid .ag-header-viewport,
.erpx-unified-ag-grid .ag-pinned-left-header,
.erpx-unified-ag-grid .ag-pinned-right-header {
    background: #255d82 !important;
    color: #fff !important;
}

.erpx-unified-ag-grid .ag-header-cell-label {
    justify-content: center;
    min-width: 0;
    font-weight: 800;
    line-height: 1.45;
}

.erpx-unified-ag-grid .ag-header-cell-text {
    color: #fff !important;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: center;
}

.erpx-unified-ag-grid .ag-header-icon,
.erpx-unified-ag-grid .ag-icon,
.erpx-unified-ag-grid .ag-header-cell-menu-button,
.erpx-unified-ag-grid .ag-header-cell-filter-button { color: #fff !important; }

.erpx-unified-ag-grid .ag-row-even:not(.ag-row-pinned) { background-color: #fff; }
.erpx-unified-ag-grid .ag-row-odd:not(.ag-row-pinned) { background-color: #f8fbfd; }
.erpx-unified-ag-grid .ag-row-hover:not(.ag-row-pinned) { background-color: #edf6fb !important; }
.erpx-unified-ag-grid .ag-cell { display: flex; align-items: center; border-inline-end-color: #e3eaf0; }

@media (max-width: 767.98px) {
    .erpx-unified-ag-grid { --ag-font-size: 11px; --ag-cell-horizontal-padding: 7px; }
}

.movement-filter-panel {
    padding: .55rem .65rem;
    margin-block-end: .45rem;
    border: 1px solid #d5e1e9;
    border-radius: 12px;
    background: #f8fbfd;
}
.movement-filter-panel.movement-filter-grid { grid-template-columns:repeat(6,minmax(125px,1fr)); gap:.45rem .55rem; align-items:end; }
.movement-filter-panel label { margin:0; font-size:.74rem; }
.movement-filter-panel .form-control,.movement-filter-panel .form-select { min-height:36px; padding-block:.32rem; font-size:.8rem; }
.movement-filter-panel .check-field { min-height:36px; padding:.35rem .55rem; }
.movement-filter-panel .movement-filter-action .btn { min-height:36px; padding:.35rem .7rem; }
.movement-filter-panel.is-collapsed { display: none; }
.movement-grid-toolbar { display:flex; align-items:center; justify-content:space-between; gap:.65rem; margin-block:.65rem; }
.movement-grid-toolbar .erpx-grid-quick-filter { position:relative; flex:1 1 320px; max-width:520px; }
.movement-grid-toolbar .erpx-grid-quick-filter i { position:absolute; inset-inline-start:.75rem; top:50%; transform:translateY(-50%); color:#668296; z-index:1; }
.movement-grid-toolbar .erpx-grid-quick-filter input { padding-inline-start:2.2rem; }
.lookup-search-bar { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:.65rem; }
@media (max-width:700px) { .movement-grid-toolbar { align-items:stretch; flex-direction:column; } .movement-grid-toolbar .erpx-grid-quick-filter { max-width:none; flex-basis:auto; width:100%; } .movement-grid-toolbar .btn { width:100%; } .lookup-search-bar { grid-template-columns:1fr; } }
@media (max-width:1100px) { .movement-filter-panel.movement-filter-grid { grid-template-columns:repeat(3,minmax(135px,1fr)); } }
@media (max-width:650px) { .movement-filter-panel.movement-filter-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
.erpx-unified-ag-grid .ag-row-pinned { background:#edf5f9!important; color:#164866; font-weight:800; border-block-start:2px solid #255d82; }

.erpx-grid-shell { border:1px solid #ccd8e1; border-radius:10px; overflow:hidden; background:#fff; }
.erpx-grid-shell > .erpx-grid-toolbar { margin:0; padding:.38rem .5rem; border:0; border-radius:0; border-block-end:1px solid #d7e1e8; background:#f8fbfd; }
.erpx-grid-shell > .erpx-list-ag-grid,
.erpx-grid-shell > .erpx-accounting-entry-grid { border:0; border-radius:0; }
.erpx-grid-shell .erpx-grid-quick-filter { flex:1 1 auto; min-width:0; max-width:none; background:#fff; }
.erpx-grid-shell .erpx-grid-columns-button { flex:0 0 auto; margin-inline-start:auto; }

.invoice-grid-summary {
    position:static;
    inset:auto;
    z-index:auto;
    margin:.6rem 0 0;
    padding:.55rem 0 0;
    border-block-start:1px solid #d8e2e9;
    background:transparent;
    box-shadow:none;
}
.invoice-grid-summary > div { min-height:58px; padding:.45rem .7rem; }

.movement-filter-panel.movement-filter-grid {
    grid-template-columns:125px 145px 145px minmax(125px,1fr) minmax(140px,1.1fr) 120px 155px 120px;
    gap:.35rem .45rem;
}
.movement-filter-panel .check-field { min-height:32px; padding:.2rem .42rem; font-size:.72rem; }
.movement-filter-panel .check-field input { width:14px; height:14px; }
.movement-filter-panel .form-control,.movement-filter-panel .form-select { min-height:32px; height:32px; padding-block:.2rem; font-size:.76rem; }
.movement-filter-panel .movement-filter-action .btn { min-height:32px; padding:.25rem .55rem; font-size:.76rem; }
@media(max-width:1250px){.movement-filter-panel.movement-filter-grid{grid-template-columns:repeat(4,minmax(125px,1fr))}}
@media(max-width:700px){.movement-filter-panel.movement-filter-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
