/* =====================================================================
   MEA ERP — Modern Engineering Co.
   Internal system theme: navy chrome, light content, teal accent,
   dense data tables. Everything is prefixed .erp- so nothing collides
   with the Mobius utility layer.
   ===================================================================== */

:root {
    --erp-navy: #0f2033;
    --erp-navy-2: #162a41;
    --erp-navy-3: #1d3550;
    --erp-bg: #f4f6f9;
    --erp-card: #ffffff;
    --erp-teal: #0e7c66;
    --erp-teal-dark: #0a6152;
    --erp-teal-soft: rgba(14, 124, 102, .1);
    --erp-line: #e3e8ef;
    --erp-line-soft: #eef2f7;
    --erp-ink: #16202b;
    --erp-body: #33414f;
    --erp-muted: #6b7a8c;
    --erp-dim: #98a4b3;
    --erp-danger: #b42318;
    --erp-danger-soft: rgba(180, 35, 24, .08);
    --erp-amber: #b54708;
    --erp-radius: 8px;
    --erp-side-w: 248px;
    --erp-top-h: 58px;
    --erp-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
    --erp-shadow-lg: 0 18px 40px -12px rgba(15, 32, 51, .35);
    --erp-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --erp-font-ar: "Segoe UI", Tahoma, "Noto Naskh Arabic", "Geeza Pro", "Arial Unicode MS", Arial, sans-serif;
    --erp-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; height: 100%; }

body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: var(--erp-bg);
    color: var(--erp-body);
    font-family: var(--erp-font);
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* the layout's mount point: no chrome of its own */
main {
    display: block;
    margin: 0;
    padding: 0;
    max-width: none;
    min-height: 100vh;
}

body[dir="rtl"],
[dir="rtl"] body,
html[dir="rtl"] body { font-family: var(--erp-font-ar); }

html[dir="rtl"] .erp-num,
html[dir="rtl"] .erp-mono,
html[dir="rtl"] .erp-pill { font-family: var(--erp-font); }

body.erp-locked { overflow: hidden; }

h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; }
a { color: var(--erp-teal); }

:focus-visible { outline: 2px solid var(--erp-teal); outline-offset: 2px; }

.erp-root,
#erp-app { min-height: 100vh; }

.erp-sr {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.erp-ic { display: block; flex: 0 0 auto; }
.erp-ic.xs { width: 14px; height: 14px; }

/* ------------------------------------------------------------------ shell */

.erp-shell {
    display: flex;
    min-height: 100vh;
    align-items: stretch;
}

.erp-side {
    position: fixed;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: var(--erp-side-w);
    display: flex;
    flex-direction: column;
    background: var(--erp-navy);
    color: #c9d6e4;
    z-index: 80;
}

.erp-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.erp-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--erp-teal);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    flex: 0 0 auto;
}

.erp-brand-mark-lg { width: 46px; height: 46px; border-radius: 10px; font-size: 14px; }

.erp-brand-tx { display: flex; flex-direction: column; min-width: 0; }
.erp-brand-tx strong { color: #fff; font-size: 14px; letter-spacing: .01em; }
.erp-brand-tx small {
    color: #8fa3b8;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.erp-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 12px 10px 18px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .2) transparent;
}

.erp-nav::-webkit-scrollbar { width: 8px; }
.erp-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); border-radius: 8px; }

.erp-nav-sec {
    padding: 12px 10px 6px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: #7d92a8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.erp-nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    margin-bottom: 2px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #c9d6e4;
    font-size: 13px;
    text-align: start;
    cursor: pointer;
}

.erp-nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }

.erp-nav-item.is-active {
    background: rgba(255, 255, 255, .1);
    color: #fff;
    font-weight: 600;
}

.erp-nav-item.is-active::before {
    content: "";
    position: absolute;
    inset-inline-start: -10px;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--erp-teal);
}

.erp-nav-tx {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.erp-side-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, .07);
    color: #7d92a8;
    font-size: 11px;
}

.erp-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--erp-teal);
    box-shadow: 0 0 0 3px rgba(14, 124, 102, .25);
    flex: 0 0 auto;
}

.erp-main {
    flex: 1 1 auto;
    min-width: 0;
    margin-inline-start: var(--erp-side-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ----------------------------------------------------------------- topbar */

.erp-top {
    position: sticky;
    top: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--erp-top-h);
    padding: 0 16px;
    background: #fff;
    border-bottom: 1px solid var(--erp-line);
}

.erp-top-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.erp-only-mobile { display: none; }

.erp-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--erp-body);
    cursor: pointer;
}

.erp-icon-btn:hover { background: var(--erp-bg); border-color: var(--erp-line); }
.erp-icon-btn.is-danger { color: var(--erp-danger); }
.erp-icon-btn.is-danger:hover { background: var(--erp-danger-soft); border-color: transparent; }

.erp-lang {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--erp-line);
    border-radius: 6px;
    background: #fff;
    color: var(--erp-body);
    font-size: 12.5px;
    cursor: pointer;
}

.erp-lang:hover { border-color: var(--erp-teal); color: var(--erp-teal); }
.erp-lang-ghost { border-color: transparent; color: var(--erp-muted); }
.erp-lang-ghost:hover { background: var(--erp-bg); }

/* -------------------------------------------------------- global search */

.erp-gs {
    position: relative;
    flex: 1 1 auto;
    max-width: 460px;
    min-width: 0;
}

.erp-gs-ic {
    position: absolute;
    inset-inline-start: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--erp-dim);
    pointer-events: none;
}

.erp-gs-input {
    width: 100%;
    height: 34px;
    padding: 0 10px;
    padding-inline-start: 34px;
    border: 1px solid var(--erp-line);
    border-radius: 6px;
    background: var(--erp-bg);
    color: var(--erp-ink);
    font-size: 13px;
}

.erp-gs-input::placeholder { color: var(--erp-dim); }
.erp-gs-input:focus { outline: none; background: #fff; border-color: var(--erp-teal); box-shadow: 0 0 0 3px var(--erp-teal-soft); }

.erp-gs-list {
    position: absolute;
    top: calc(100% + 6px);
    inset-inline-start: 0;
    width: min(460px, calc(100vw - 24px));
    max-height: 60vh;
    overflow-y: auto;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--erp-line);
    border-radius: var(--erp-radius);
    box-shadow: var(--erp-shadow-lg);
    z-index: 90;
}

.erp-gs-group + .erp-gs-group { border-top: 1px solid var(--erp-line-soft); margin-top: 4px; padding-top: 4px; }

.erp-gs-group-t {
    padding: 6px 8px 4px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--erp-muted);
}

.erp-gs-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    width: 100%;
    padding: 7px 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    text-align: start;
    cursor: pointer;
    font-size: 13px;
}

.erp-gs-item:hover,
.erp-gs-item.is-hl { background: var(--erp-teal-soft); }
.erp-gs-main { color: var(--erp-ink); font-weight: 500; }
.erp-gs-sub { color: var(--erp-muted); font-size: 12px; }
.erp-gs-none { padding: 10px; color: var(--erp-muted); font-size: 13px; }

/* -------------------------------------------------------------- user menu */

.erp-user { position: relative; }

.erp-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
}

.erp-user-btn:hover { background: var(--erp-bg); }
.erp-user-chev { color: var(--erp-dim); width: 14px; height: 14px; }

.erp-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--erp-navy);
    color: #fff;
    font-size: 11.5px;
    font-weight: 700;
    flex: 0 0 auto;
}

.erp-user-tx { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; min-width: 0; }
.erp-user-tx strong {
    color: var(--erp-ink);
    font-size: 12.5px;
    font-weight: 600;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.erp-user-tx small { color: var(--erp-muted); font-size: 11px; }

.erp-menu {
    position: absolute;
    top: calc(100% + 6px);
    inset-inline-end: 0;
    width: 220px;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--erp-line);
    border-radius: var(--erp-radius);
    box-shadow: var(--erp-shadow-lg);
    z-index: 90;
}

.erp-menu-head {
    display: flex;
    flex-direction: column;
    padding: 8px 8px 10px;
    border-bottom: 1px solid var(--erp-line-soft);
    margin-bottom: 4px;
}
.erp-menu-head strong { color: var(--erp-ink); font-size: 13px; }
.erp-menu-head small { color: var(--erp-muted); font-size: 11.5px; }

.erp-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    text-align: start;
    font-size: 13px;
    cursor: pointer;
    color: var(--erp-body);
}

.erp-menu-item:hover { background: var(--erp-bg); }
.erp-menu-item.is-danger { color: var(--erp-danger); }
.erp-menu-item.is-danger:hover { background: var(--erp-danger-soft); }

/* ------------------------------------------------------------------ pages */

.erp-content {
    flex: 1 1 auto;
    padding: 20px 24px 44px;
    min-width: 0;
}

.erp-page { max-width: 1440px; margin: 0 auto; }

.erp-page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.erp-page-title { min-width: 0; }

.erp-page-title h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--erp-ink);
    letter-spacing: -.01em;
    margin-top: 2px;
}

.erp-crumb {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--erp-muted);
}

.erp-mono { font-family: var(--erp-mono); text-transform: none; letter-spacing: 0; font-weight: 500; }

.erp-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.erp-back {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0;
    margin-bottom: 2px;
    border: 0;
    background: transparent;
    color: var(--erp-teal);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}

.erp-back:hover { color: var(--erp-teal-dark); text-decoration: underline; }

.erp-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--erp-bg);
    border: 1px solid var(--erp-line);
    color: var(--erp-muted);
    font-size: 11.5px;
    font-weight: 600;
}

/* ------------------------------------------------------------------ cards */

.erp-card {
    background: var(--erp-card);
    border: 1px solid var(--erp-line);
    border-radius: var(--erp-radius);
    box-shadow: var(--erp-shadow);
    margin-bottom: 16px;
    overflow: hidden;
}

/* the form card must not clip a pointer field's dropdown */
.erp-card-form { overflow: visible; }

.erp-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--erp-line-soft);
}

.erp-card-head h2 {
    font-size: 14px;
    font-weight: 700;
    color: var(--erp-ink);
    display: flex;
    align-items: center;
    gap: 8px;
}

.erp-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--erp-bg);
    color: var(--erp-muted);
    font-size: 11.5px;
    font-weight: 700;
}

.erp-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
    border-radius: var(--erp-radius);
    background: #f7fbfa;
    border: 1px solid #d3e8e2;
    color: #23564b;
    font-size: 12.5px;
}

.erp-note .erp-ic { margin-top: 1px; color: var(--erp-teal); }
.erp-note-inline { margin-bottom: 12px; }

/* ---------------------------------------------------------------- buttons */

.erp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--erp-line);
    border-radius: 6px;
    background: #fff;
    color: var(--erp-body);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.erp-btn:hover { border-color: var(--erp-line-strong, #cfd8e3); background: #fbfcfd; }
.erp-btn:disabled { opacity: .55; cursor: not-allowed; }

.erp-btn-primary {
    background: var(--erp-teal);
    border-color: var(--erp-teal);
    color: #fff;
}

.erp-btn-primary:hover { background: var(--erp-teal-dark); border-color: var(--erp-teal-dark); }

.erp-btn-danger {
    background: var(--erp-danger);
    border-color: var(--erp-danger);
    color: #fff;
}

.erp-btn-danger:hover { background: #8f1c13; border-color: #8f1c13; }

.erp-btn-danger-ghost { color: var(--erp-danger); border-color: #f0cfcc; background: #fff; }
.erp-btn-danger-ghost:hover { background: var(--erp-danger-soft); border-color: #e3b0ac; }

.erp-btn-ghost { background: #fff; }
.erp-btn-sm { height: 30px; padding: 0 9px; font-size: 12.5px; }
.erp-btn-block { width: 100%; }
.erp-btn .erp-ic { width: 16px; height: 16px; }

/* ---------------------------------------------------------------- toolbar */

.erp-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 16px;
    border-bottom: 1px solid var(--erp-line-soft);
}

.erp-searchbox {
    position: relative;
    flex: 1 1 240px;
    max-width: 320px;
    min-width: 180px;
}

.erp-searchbox-ic {
    position: absolute;
    inset-inline-start: 9px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--erp-dim);
    pointer-events: none;
}

.erp-searchbox input {
    width: 100%;
    height: 32px;
    padding: 0 10px;
    padding-inline-start: 32px;
    border: 1px solid var(--erp-line);
    border-radius: 6px;
    background: #fff;
    color: var(--erp-ink);
    font-size: 13px;
}

.erp-searchbox input::placeholder { color: var(--erp-dim); }
.erp-searchbox input:focus { outline: none; border-color: var(--erp-teal); box-shadow: 0 0 0 3px var(--erp-teal-soft); }

.erp-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.erp-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 28px;
    padding: 0 10px;
    border: 1px solid var(--erp-line);
    border-radius: 999px;
    background: #fff;
    color: var(--erp-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    --pc: #667085;
}

.erp-chip:hover { border-color: var(--pc); color: var(--pc); }

.erp-chip.is-active {
    background: rgba(0, 0, 0, .03);
    border-color: var(--pc);
    color: var(--pc);
    background: color-mix(in srgb, var(--pc) 10%, #fff);
}

/* ----------------------------------------------------------------- tables */

.erp-table-wrap {
    max-height: calc(100vh - 300px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.erp-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.erp-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f8fafc;
    border-bottom: 1px solid var(--erp-line);
    padding: 0;
    text-align: start;
    white-space: nowrap;
}

.erp-th-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    padding: 9px 14px;
    border: 0;
    background: transparent;
    color: var(--erp-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    text-align: start;
    cursor: pointer;
}

.erp-th-btn:hover { color: var(--erp-teal); }
.erp-th-ic { width: 13px; height: 13px; }

.erp-table tbody td {
    padding: 8px 14px;
    border-bottom: 1px solid var(--erp-line-soft);
    color: var(--erp-body);
    vertical-align: middle;
}

.erp-row { cursor: pointer; }
.erp-row:hover td { background: #f8fbfb; }
.erp-row:focus-visible { outline: 2px solid var(--erp-teal); outline-offset: -2px; }

.erp-cell-main { color: var(--erp-ink); font-weight: 600; }
.erp-num { font-variant-numeric: tabular-nums; }
.erp-dim { color: var(--erp-dim); }

.erp-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
    color: var(--pc, #667085);
    background: rgba(102, 112, 133, .1);
    border: 1px solid rgba(102, 112, 133, .28);
    background: color-mix(in srgb, var(--pc, #667085) 12%, #fff);
    border-color: color-mix(in srgb, var(--pc, #667085) 34%, #fff);
}

.erp-empty-row td { text-align: center; color: var(--erp-muted); padding: 18px 14px; }

.erp-list-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 16px;
    border-top: 1px solid var(--erp-line-soft);
    background: #fff;
}

.erp-foot-tx { color: var(--erp-muted); font-size: 12px; }
.erp-foot-ctr { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.erp-sel-label { color: var(--erp-muted); font-size: 12px; }
.erp-page-tx { color: var(--erp-muted); font-size: 12px; font-variant-numeric: tabular-nums; padding: 0 2px; }

.erp-sel {
    height: 34px;
    padding: 0 28px 0 10px;
    border: 1px solid var(--erp-line);
    border-radius: 6px;
    background: #fff;
    color: var(--erp-ink);
    font-size: 13px;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 49%, var(--erp-muted) 50%, var(--erp-muted) 60%, transparent 61%),
        linear-gradient(-45deg, transparent 49%, var(--erp-muted) 50%, var(--erp-muted) 60%, transparent 61%);
    background-position: calc(100% - 15px) 14px, calc(100% - 10px) 14px;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    cursor: pointer;
}

html[dir="rtl"] .erp-sel {
    padding: 0 10px 0 28px;
    background-position: 10px 14px, 15px 14px;
}

.erp-sel-sm { height: 30px; font-size: 12.5px; background-position: calc(100% - 13px) 12px, calc(100% - 8px) 12px; }
html[dir="rtl"] .erp-sel-sm { background-position: 8px 12px, 13px 12px; }

.erp-sel:focus { outline: none; border-color: var(--erp-teal); box-shadow: 0 0 0 3px var(--erp-teal-soft); }

/* ------------------------------------------------------------- form fields */

.erp-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
    padding: 18px 16px 20px;
}

.erp-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.erp-field.is-wide { grid-column: 1 / -1; }
.erp-field.is-check { justify-content: flex-end; }

.erp-field > label {
    font-size: 12px;
    font-weight: 600;
    color: var(--erp-body);
}

.erp-req { color: var(--erp-danger); margin-inline-start: 3px; }

.erp-input,
.erp-field > input:not([type="checkbox"]),
.erp-pw input,
.erp-dialog-body input:not([type="checkbox"]):not([type="hidden"]),
.erp-field textarea {
    width: 100%;
    min-height: 34px;
    padding: 7px 10px;
    border: 1px solid var(--erp-line);
    border-radius: 6px;
    background: #fff;
    color: var(--erp-ink);
    font-size: 13px;
    line-height: 1.4;
}

.erp-field textarea { resize: vertical; min-height: 74px; }

.erp-input:focus,
.erp-field > input:not([type="checkbox"]):focus,
.erp-pw input:focus,
.erp-dialog-body input:not([type="checkbox"]):focus,
.erp-field textarea:focus {
    outline: none;
    border-color: var(--erp-teal);
    box-shadow: 0 0 0 3px var(--erp-teal-soft);
}

.erp-input:disabled,
.erp-field textarea:disabled,
.erp-sel:disabled {
    background: #f7f9fc;
    color: var(--erp-muted);
    cursor: default;
    -webkit-text-fill-color: var(--erp-muted);
}

.erp-field.is-ro > label { color: var(--erp-muted); }
.erp-hint { font-size: 11.5px; color: var(--erp-muted); min-height: 0; }
.erp-echo { font-variant-numeric: tabular-nums; }

.erp-field.has-error .erp-input,
.erp-field.has-error textarea,
.erp-field.has-error .erp-sel { border-color: var(--erp-danger); box-shadow: 0 0 0 3px var(--erp-danger-soft); }
.erp-field.has-error > label { color: var(--erp-danger); }

/* checkbox */

.erp-check {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    font-size: 13px;
    color: var(--erp-body);
    user-select: none;
}

.erp-check input {
    position: absolute;
    inset-inline-start: 0;
    top: 50%;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
}

.erp-check-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    background: #fff;
    color: transparent;
    flex: 0 0 auto;
}

.erp-check-box .erp-ic { width: 14px; height: 14px; }
.erp-check input:checked + .erp-check-box { background: var(--erp-teal); border-color: var(--erp-teal); color: #fff; }
.erp-check input:focus-visible + .erp-check-box { outline: 2px solid var(--erp-teal); outline-offset: 2px; }
.erp-check input:disabled + .erp-check-box { background: #f1f4f8; border-color: var(--erp-line); }
.erp-check input:disabled ~ .erp-check-tx { color: var(--erp-muted); }

/* searchable pointer select */

.erp-combo { position: relative; }

.erp-combo-list {
    position: absolute;
    top: calc(100% + 4px);
    inset-inline-start: 0;
    width: 100%;
    min-width: 200px;
    max-height: 240px;
    overflow-y: auto;
    padding: 4px;
    background: #fff;
    border: 1px solid var(--erp-line);
    border-radius: var(--erp-radius);
    box-shadow: var(--erp-shadow-lg);
    z-index: 70;
}

.erp-combo-item {
    display: block;
    width: 100%;
    padding: 7px 8px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    text-align: start;
    font-size: 13px;
    color: var(--erp-body);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.erp-combo-item:hover,
.erp-combo-item.is-hl { background: var(--erp-teal-soft); color: var(--erp-ink); }
.erp-combo-none { padding: 8px; color: var(--erp-muted); font-size: 12.5px; }

/* --------------------------------------------------------------- line items */

.erp-lines-card { margin-top: 4px; }
.erp-lines-note { padding: 0 16px 10px; color: var(--erp-muted); font-size: 12px; }
.erp-lines-wrap { max-height: 46vh; }

.erp-lines-table { min-width: 720px; }
.erp-lines-table td { padding: 6px 8px; vertical-align: top; }
.erp-lines-table thead th {
    padding: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--erp-muted);
}
.erp-lines-table .erp-field { gap: 0; }
.erp-lines-table .erp-field > label { display: none; }
.erp-lines-table .erp-input,
.erp-lines-table .erp-sel { min-height: 30px; height: 30px; padding: 4px 8px; font-size: 12.5px; }
.erp-lines-table .erp-check { gap: 6px; }
.erp-col-total { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.erp-line-total { font-weight: 600; color: var(--erp-ink); font-variant-numeric: tabular-nums; }
.erp-col-x { width: 44px; text-align: end; }

.erp-totals {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px;
    border-top: 1px solid var(--erp-line-soft);
    background: #fcfdfe;
    margin-inline-start: auto;
    max-width: 320px;
    min-width: 240px;
}

.erp-totals-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 20px;
    font-size: 12.5px;
    color: var(--erp-muted);
}

.erp-totals-row strong { color: var(--erp-ink); font-variant-numeric: tabular-nums; font-weight: 600; }

.erp-totals-row.is-grand {
    padding-top: 6px;
    border-top: 1px solid var(--erp-line);
    font-size: 13.5px;
    color: var(--erp-ink);
}

.erp-totals-row.is-grand strong { font-size: 15px; }

/* ------------------------------------------------------------ states */

.erp-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 32px 16px;
    color: var(--erp-muted);
    font-size: 13px;
}

.erp-spin {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--erp-line);
    border-top-color: var(--erp-teal);
    animation: erp-spin .7s linear infinite;
}

@keyframes erp-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .erp-spin { animation-duration: 2.4s; }
    .erp-toast { transition: none; }
}

.erp-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px 20px;
    text-align: center;
    color: var(--erp-muted);
    font-size: 13px;
}

/* --------------------------------------------------------------- splash */

.erp-splash {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    background: var(--erp-navy);
}

.erp-splash .erp-spin {
    border-color: rgba(255, 255, 255, .18);
    border-top-color: var(--erp-teal);
}

/* ------------------------------------------------------------- login */

.erp-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 16px;
    background:
        radial-gradient(1100px 520px at 15% -10%, rgba(14, 124, 102, .28), transparent 60%),
        linear-gradient(160deg, #0f2033 0%, #12283f 52%, #0f2033 100%);
}

.erp-login-card {
    width: 100%;
    max-width: 380px;
    padding: 26px 24px 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 30px 70px -24px rgba(0, 0, 0, .55);
}

.erp-login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    margin-bottom: 18px;
}

.erp-login-brand h1 { font-size: 20px; font-weight: 700; color: var(--erp-ink); letter-spacing: -.01em; margin-top: 6px; }
.erp-login-brand p { font-size: 12.5px; color: var(--erp-muted); }

.erp-login-card .erp-field { margin-bottom: 12px; }
.erp-login-card .erp-btn-block { margin-top: 4px; height: 38px; }

.erp-login-foot { display: flex; justify-content: center; margin-top: 14px; }

.erp-pw { position: relative; }
.erp-pw input { padding-inline-end: 42px; }

.erp-pw-eye {
    position: absolute;
    inset-inline-end: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    color: var(--erp-muted);
}

.erp-alert {
    padding: 9px 12px;
    margin-bottom: 12px;
    border-radius: 6px;
    background: var(--erp-danger-soft);
    border: 1px solid #f0cfcc;
    color: var(--erp-danger);
    font-size: 12.5px;
}

.erp-login-note {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin-top: 14px;
    color: var(--erp-muted);
    font-size: 11.5px;
    line-height: 1.5;
}

.erp-login-note .erp-ic { width: 15px; height: 15px; margin-top: 1px; color: var(--erp-dim); }

/* ------------------------------------------------------------- toasts */

.erp-toasts {
    position: fixed;
    top: 14px;
    inset-inline-end: 14px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(360px, calc(100vw - 28px));
    pointer-events: none;
}

.erp-toast {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid var(--erp-line);
    border-inline-start: 3px solid var(--erp-muted);
    border-radius: 8px;
    box-shadow: var(--erp-shadow-lg);
    font-size: 12.5px;
    color: var(--erp-body);
    transition: opacity .2s ease, transform .2s ease;
    animation: erp-toast-in .18s ease;
}

.erp-toast.is-success { border-inline-start-color: var(--erp-teal); }
.erp-toast.is-error { border-inline-start-color: var(--erp-danger); }
.erp-toast.is-info { border-inline-start-color: #1d4ed8; }
.erp-toast.is-out { opacity: 0; transform: translateY(-6px); }
.erp-toast-ic { color: var(--erp-teal); margin-top: 1px; }
.erp-toast.is-error .erp-toast-ic { color: var(--erp-danger); }
.erp-toast.is-info .erp-toast-ic { color: #1d4ed8; }
.erp-toast-tx { flex: 1 1 auto; min-width: 0; }

@keyframes erp-toast-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------- dialogs */

.erp-ov {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 32, 51, .48);
}

.erp-dialog {
    width: 100%;
    max-width: 440px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .5);
}

.erp-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--erp-line-soft);
}

.erp-dialog-head h2 { font-size: 15px; font-weight: 700; color: var(--erp-ink); }

.erp-dialog-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.erp-dialog-tx { color: var(--erp-body); font-size: 13px; }
.erp-dialog-strong { color: var(--erp-ink); font-weight: 600; font-size: 13px; }

.erp-dialog-foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px 16px;
}

/* ------------------------------------------------------------- drawer */

.erp-drawer-ov {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 75;
    background: rgba(15, 32, 51, .45);
    opacity: 0;
    transition: opacity .18s ease;
}

.erp-drawer-ov.is-on { display: block; opacity: 1; }

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

@media (max-width: 1180px) {
    :root { --erp-side-w: 224px; }
    .erp-content { padding: 16px 18px 40px; }
    .erp-form { gap: 14px 16px; }
}

@media (max-width: 900px) {
    .erp-side {
        width: 272px;
        transform: translateX(-100%);
        visibility: hidden;
        transition: transform .2s ease, visibility .2s ease;
        box-shadow: none;
    }

    html[dir="rtl"] .erp-side { transform: translateX(100%); }

    .erp-side.is-open,
    html[dir="rtl"] .erp-side.is-open { transform: none; visibility: visible; box-shadow: 0 0 40px rgba(0, 0, 0, .4); }

    .erp-main { margin-inline-start: 0; }
    .erp-only-mobile { display: inline-flex; }
    .erp-gs { max-width: none; }
    .erp-user-tx { display: none; }
    .erp-user-chev { display: none; }
    .erp-table-wrap { max-height: none; }
    .erp-lines-wrap { max-height: none; }
}

@media (max-width: 760px) {
    .erp-form { grid-template-columns: minmax(0, 1fr); }
    .erp-page-head { align-items: flex-start; }
    .erp-page-title h1 { font-size: 18px; }
    .erp-toolbar { gap: 10px; }
    .erp-searchbox { max-width: none; flex-basis: 100%; }
    .erp-totals { max-width: none; margin-inline-start: 0; }
}

@media (max-width: 640px) {
    .erp-content { padding: 14px 12px 36px; }
    .erp-card { border-radius: 8px; }

    /* the tables become stacked cards */
    .erp-table-wrap { overflow: visible; }
    .erp-table { display: block; }
    .erp-table thead { display: none; }
    .erp-table tbody { display: block; }

    .erp-table tbody tr {
        display: block;
        margin: 10px;
        padding: 6px 10px;
        border: 1px solid var(--erp-line);
        border-radius: 8px;
        background: #fff;
    }

    .erp-table tbody td {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 14px;
        padding: 5px 0;
        border: 0;
        border-bottom: 1px dashed var(--erp-line-soft);
        text-align: end;
    }

    .erp-table tbody tr td:last-child { border-bottom: 0; }

    .erp-table tbody td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        max-width: 45%;
        color: var(--erp-muted);
        font-size: 10.5px;
        font-weight: 700;
        letter-spacing: .05em;
        text-transform: uppercase;
        text-align: start;
    }

    .erp-row:hover td { background: transparent; }
    .erp-cell-main { font-weight: 700; }
    .erp-col-total { justify-content: space-between; }

    /* line items stack the same way, with the row still editable */
    .erp-lines-table { display: block; min-width: 0; }
    .erp-lines-table tbody tr { margin: 10px; }
    .erp-lines-table tbody td { flex-direction: column; align-items: stretch; gap: 4px; text-align: start; }
    .erp-lines-table tbody td::before { max-width: none; }
    .erp-lines-table .erp-field > label { display: block; }
    .erp-lines-table .erp-input,
    .erp-lines-table .erp-sel { height: 34px; font-size: 13px; }
    .erp-lines-table .erp-col-x { align-items: flex-end; }

    .erp-list-foot { flex-direction: column; align-items: stretch; gap: 10px; }
    .erp-foot-ctr { justify-content: space-between; }
    .erp-empty { padding: 28px 14px; }
    .erp-dialog-foot { flex-direction: column-reverse; }
    .erp-dialog-foot .erp-btn { width: 100%; }
}

@media (max-width: 420px) {
    .erp-top { padding: 0 10px; gap: 8px; }
    .erp-content { padding: 12px 10px 32px; }
    .erp-actions { width: 100%; }
    .erp-actions .erp-btn { flex: 1 1 auto; }
    .erp-lang span { display: none; }
    .erp-lang { padding: 0 8px; }
    .erp-gs-input::placeholder { color: transparent; }
    .erp-brand-tx small { max-width: 150px; }
}

/* =====================================================================
   PHASE 2 — dashboard, document workflows, notifications, print
   ===================================================================== */

/* -------------------------------------------------------- notifications */

.erp-notif { position: relative; }

.erp-bell { position: relative; }

.erp-bell-count {
    position: absolute;
    top: 1px;
    inset-inline-end: 1px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--erp-danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.erp-notif-menu {
    width: 320px;
    max-width: calc(100vw - 24px);
    padding: 0;
    overflow: hidden;
}

.erp-notif-menu .erp-menu-head { padding: 10px 12px; margin: 0; }

.erp-notif-list { max-height: 340px; overflow-y: auto; padding: 4px; }

.erp-notif-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    padding: 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    text-align: start;
    cursor: pointer;
}

.erp-notif-item:hover { background: var(--erp-bg); }
.erp-notif-item.is-unread { background: #f7fbfa; }

.erp-notif-dot {
    width: 8px;
    height: 8px;
    margin-top: 5px;
    border-radius: 50%;
    background: var(--pc, #667085);
    flex: 0 0 auto;
}

.erp-notif-tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.erp-notif-tx strong { color: var(--erp-ink); font-size: 12.5px; font-weight: 600; }
.erp-notif-tx small { color: var(--erp-muted); font-size: 11px; }

/* ------------------------------------------------------- workflow bar */

.erp-wf-bar {
    position: sticky;
    top: calc(var(--erp-top-h) + 8px);
    z-index: 45;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 8px 12px;
    margin-bottom: 12px;
    background: #fff;
    border: 1px solid var(--erp-line);
    border-radius: var(--erp-radius);
    box-shadow: var(--erp-shadow);
}

.erp-wf-status { display: flex; align-items: center; gap: 8px; }

.erp-wf-label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--erp-muted);
}

.erp-wf-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ------------------------------------------------------ approval timeline */

.erp-timeline { padding: 12px 16px 16px; }
.erp-empty-tx { color: var(--erp-muted); font-size: 12.5px; }

.erp-tl { list-style: none; margin: 0; padding: 0; }

.erp-tl-row { position: relative; display: flex; gap: 10px; padding-bottom: 14px; }
.erp-tl-row:last-child { padding-bottom: 0; }

.erp-tl-row::before {
    content: "";
    position: absolute;
    inset-inline-start: 4px;
    top: 14px;
    bottom: 0;
    width: 1px;
    background: var(--erp-line);
}

.erp-tl-row:last-child::before { display: none; }

.erp-tl-dot {
    position: relative;
    z-index: 1;
    width: 9px;
    height: 9px;
    margin-top: 5px;
    border-radius: 50%;
    background: var(--pc, #667085);
    flex: 0 0 auto;
}

.erp-tl-body { min-width: 0; }
.erp-tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.erp-tl-date { color: var(--erp-muted); font-size: 11.5px; }
.erp-tl-who { color: var(--erp-ink); font-size: 12.5px; font-weight: 600; margin-top: 2px; }
.erp-tl-tx { color: var(--erp-body); font-size: 12.5px; margin-top: 2px; }

/* --------------------------------------------------------- dashboard */

.erp-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.erp-dates { display: flex; align-items: center; gap: 6px; }
.erp-dates-sep { color: var(--erp-dim); }
.erp-input-date { width: 148px; height: 30px; min-height: 30px; padding: 4px 8px; font-size: 12.5px; }
.is-hidden { display: none !important; }

.erp-dash-stamp { color: var(--erp-muted); font-size: 11.5px; margin-bottom: 10px; }

.erp-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.erp-kpi {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    background: var(--erp-card);
    border: 1px solid var(--erp-line);
    border-radius: var(--erp-radius);
    box-shadow: var(--erp-shadow);
    text-align: start;
    font: inherit;
    color: inherit;
}

.erp-kpi.is-link { cursor: pointer; }
.erp-kpi.is-link:hover { border-color: var(--erp-teal); }

.erp-kpi-t {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--erp-muted);
}

.erp-kpi-v {
    font-size: 20px;
    font-weight: 700;
    color: var(--erp-ink);
    letter-spacing: -.01em;
    font-variant-numeric: tabular-nums;
    font-family: var(--erp-font);
}

.erp-kpi-v.is-red { color: var(--erp-danger); }
.erp-kpi-s { font-size: 12px; color: var(--erp-muted); }
.erp-kpi-od { color: var(--erp-muted); font-size: 12px; }
.erp-kpi-od.is-red { color: var(--erp-danger); font-weight: 600; }

.erp-kpi-go { position: absolute; inset-inline-end: 10px; top: 10px; color: var(--erp-dim); }

.erp-kpi-list { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.erp-kpi-list li { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; color: var(--erp-body); }
.erp-kpi-list-d { color: var(--erp-muted); white-space: nowrap; }

.erp-chart { padding: 14px 16px 8px; }

.erp-chart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.erp-chart-head h2 { font-size: 14px; font-weight: 700; color: var(--erp-ink); }
.erp-legend { display: flex; align-items: center; gap: 14px; }
.erp-legend-i { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--erp-muted); }
.erp-legend-sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.erp-legend-sw.is-rev { background: #0e7c66; }
.erp-legend-sw.is-cost { background: #b54708; }

.erp-chart-svg { display: block; width: 100%; height: auto; }
.erp-chart-grid { stroke: var(--erp-line-soft); stroke-width: 1; }
.erp-chart-axis { stroke: var(--erp-line); stroke-width: 1; }
.erp-chart-ax { fill: var(--erp-muted); font-size: 10px; font-family: var(--erp-font); }
.erp-bar-rev { fill: #0e7c66; }
.erp-bar-cost { fill: #b54708; }

.erp-prog {
    display: inline-block;
    width: 84px;
    height: 6px;
    border-radius: 999px;
    background: var(--erp-line-soft);
    overflow: hidden;
    vertical-align: middle;
}

.erp-prog-bar { display: block; height: 100%; border-radius: 999px; background: var(--erp-teal); }
.erp-prog-tx { margin-inline-start: 6px; font-size: 11.5px; color: var(--erp-muted); font-variant-numeric: tabular-nums; }

.erp-link {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--erp-teal);
    font: inherit;
    font-weight: 600;
    text-align: start;
    cursor: pointer;
}

.erp-link:hover { text-decoration: underline; }

.erp-row-acts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.erp-cell-sub { margin-top: 2px; font-size: 11.5px; color: var(--erp-muted); }
.erp-toolbar-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.erp-empty-lg { padding: 52px 20px; }

.erp-empty-ic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--erp-bg);
    color: var(--erp-teal);
}

.erp-empty-ic .erp-ic { width: 22px; height: 22px; }
.erp-empty-acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* dialogue extras (comment boxes, selects) */

.erp-dialog-body textarea,
.erp-dialog-body .erp-sel { width: 100%; }

.erp-dialog-body textarea {
    min-height: 74px;
    padding: 7px 10px;
    border: 1px solid var(--erp-line);
    border-radius: 6px;
    background: #fff;
    color: var(--erp-ink);
    font-family: inherit;
    font-size: 13px;
    resize: vertical;
}

.erp-dialog-body textarea:focus {
    outline: none;
    border-color: var(--erp-teal);
    box-shadow: 0 0 0 3px var(--erp-teal-soft);
}

/* Arabic: the system stack, never a webfont, and no fake letter-spacing */

html[dir="rtl"] .erp-nav-sec,
html[dir="rtl"] .erp-th-btn,
html[dir="rtl"] .erp-kpi-t,
html[dir="rtl"] .erp-wf-label,
html[dir="rtl"] .erp-gs-group-t { letter-spacing: 0; text-transform: none; }

html[dir="rtl"] .erp-input,
html[dir="rtl"] .erp-field textarea,
html[dir="rtl"] .erp-dialog-body textarea,
html[dir="rtl"] .erp-sel,
html[dir="rtl"] .erp-searchbox input,
html[dir="rtl"] .erp-gs-input,
html[dir="rtl"] .erp-notif-tx strong,
html[dir="rtl"] .erp-tl-tx,
html[dir="rtl"] .erp-kpi-list li { font-family: var(--erp-font-ar); }

html[dir="rtl"] .erp-kpi-v,
html[dir="rtl"] .erp-chart-ax,
html[dir="rtl"] .erp-prog-tx,
html[dir="rtl"] .erp-doc-n { font-family: var(--erp-font); }

@media (max-width: 760px) {
    .erp-wf-bar { top: calc(var(--erp-top-h) + 4px); padding: 8px 10px; }
    .erp-kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
    .erp-kpi { padding: 12px; }
    .erp-kpi-v { font-size: 18px; }
    .erp-filters { width: 100%; }
    .erp-input-date { width: 132px; }
}

@media (max-width: 420px) {
    .erp-kpis { grid-template-columns: minmax(0, 1fr); }
    .erp-notif-menu { width: calc(100vw - 20px); }
}

/* =====================================================================
   PRINT — A4, one clean document
   ===================================================================== */

.erp-print-root { display: none; }

.erp-doc { color: var(--erp-ink); font-family: var(--erp-font); font-size: 11.5px; }

.erp-doc-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--erp-ink);
}

.erp-doc-co { display: flex; flex-direction: column; gap: 2px; font-size: 10.5px; color: var(--erp-body); }
.erp-doc-co strong { font-size: 15px; color: var(--erp-ink); }

.erp-doc-title { text-align: end; }
.erp-doc-title h1 {
    font-size: 17px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--erp-ink);
}
.erp-doc-no { margin-top: 2px; font-size: 12px; font-weight: 700; }

.erp-doc-meta {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px 14px;
    margin: 14px 0 16px;
}

.erp-doc-meta > div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.erp-doc-meta span {
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--erp-muted);
}
.erp-doc-meta strong { font-size: 11.5px; color: var(--erp-ink); }

.erp-doc-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.erp-doc-table th {
    padding: 6px 8px;
    border-bottom: 1px solid #cbd5e1;
    background: #f2f5f8;
    color: var(--erp-body);
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: .05em;
    text-align: start;
}
.erp-doc-table td { padding: 6px 8px; border-bottom: 1px solid var(--erp-line); vertical-align: top; }
.erp-doc-table .erp-doc-n { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.erp-doc-none { text-align: center; color: var(--erp-muted); }

.erp-doc-totals { width: 260px; margin: 12px 0 0 auto; display: flex; flex-direction: column; gap: 4px; }
.erp-doc-totals > div { display: flex; justify-content: space-between; gap: 16px; font-size: 11.5px; }
.erp-doc-totals .is-total {
    padding-top: 5px;
    border-top: 1px solid var(--erp-ink);
    font-size: 13px;
    font-weight: 700;
}

.erp-doc-notes,
.erp-doc-bank { margin-top: 16px; font-size: 11px; }
.erp-doc-notes h2,
.erp-doc-bank h2 {
    margin-bottom: 3px;
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--erp-muted);
}

.erp-doc-sign { display: flex; gap: 40px; margin-top: 34px; }
.erp-doc-sign-box {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 10.5px;
    color: var(--erp-body);
}
.erp-doc-sign-box i { display: block; height: 26px; border-bottom: 1px solid var(--erp-dim); }
.erp-doc-sign-box em { font-style: normal; font-size: 10px; color: var(--erp-muted); min-height: 12px; }

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

@media print {
    html,
    body { background: #fff !important; }

    body.erp-locked { overflow: visible; }

    /* the app chrome never reaches paper */
    .erp-side,
    .erp-top,
    .erp-drawer-ov,
    .erp-actions,
    .erp-wf-bar,
    .erp-back,
    .erp-toasts,
    .erp-chips,
    .erp-toolbar,
    .erp-list-foot,
    .erp-col-x,
    .erp-card-head .erp-btn,
    .erp-notif,
    .erp-lang,
    .erp-empty-acts { display: none !important; }

    .erp-main { margin-inline-start: 0 !important; }
    .erp-content { padding: 0 !important; }
    .erp-page { max-width: none; }
    .erp-card { box-shadow: none !important; border-color: #cfd8e3 !important; }
    .erp-table-wrap { max-height: none !important; overflow: visible !important; }
    .erp-table thead th { position: static; background: #f2f5f8; }
    .erp-row { cursor: auto; }

    /* a document page replaces the whole screen */
    body.erp-print-doc #erp-app,
    body.erp-print-doc #erp-app *,
    body.erp-print-doc .erp-toasts,
    body.erp-print-doc #erp-dialogs { display: none !important; }

    body.erp-print-doc #erp-print-root { display: block !important; }

    .erp-doc-table,
    .erp-doc-totals,
    .erp-doc-sign { page-break-inside: avoid; }
}

