/* ==========================================================================
   JosephFactory — global stylesheet (RTL, Arabic). Theme tokens from the mockup.
   ========================================================================== */
:root {
    --jf-bg: #f5f6f4;
    --jf-surface: #ffffff;
    --jf-ink: #16211f;
    --jf-ink-soft: #3c4b48;
    --jf-muted: #6b7a77;
    --jf-border: #e4e8e3;
    --jf-border-strong: #d8ddd8;

    --jf-primary: #14524f;
    --jf-primary-dark: #12312f;
    --jf-primary-tint: #eef4f3;
    --jf-accent: #b45f2b;
    --jf-accent-soft: #e0873f;

    --jf-success: #2c6a45;
    --jf-success-tint: #e9f0ec;
    --jf-warning: #b45f2b;
    --jf-warning-tint: #fdf2e9;
    --jf-danger: #b3261e;
    --jf-danger-tint: #fdecea;

    --jf-sidebar-w: 244px;
    --jf-radius: 12px;
    --jf-radius-sm: 8px;
    --jf-shadow: 0 8px 24px rgba(18, 49, 47, .10);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
    background: var(--jf-bg);
    color: var(--jf-ink);
    font-size: 14px;
}

a { color: var(--jf-primary); text-decoration: none; }
a:hover { color: var(--jf-accent); }

/* ---- Shell -------------------------------------------------------------- */
.jf-shell { display: flex; min-height: 100vh; align-items: stretch; }

.jf-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ---- Sidebar ---------------------------------------------------------- */
.jf-sidebar {
    width: var(--jf-sidebar-w);
    flex: 0 0 var(--jf-sidebar-w);
    background: var(--jf-primary-dark);
    color: #e7efec;
    padding: 22px 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    overflow-y: auto;
}

.jf-brand { padding: 0 22px; }
.jf-brand-name { font-size: 17px; font-weight: 700; }
.jf-brand-sub { font-size: 11.5px; color: #7fa39d; margin-top: 4px; }

.jf-nav { display: flex; flex-direction: column; gap: 2px; }

.jf-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 22px;
    font-size: 13.5px;
    font-weight: 600;
    color: #a9c3be;
    border-right: 3px solid transparent;
}
.jf-nav-link:hover { color: #fff; background: rgba(255, 255, 255, .04); }
.jf-nav-link.active {
    color: #fff;
    background: #1b423f;
    border-right-color: var(--jf-accent-soft);
}
.jf-nav-icon { width: 18px; text-align: center; font-size: 13px; opacity: .9; }

.jf-nav-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: 0;
    background: transparent;
    color: #a9c3be;
    padding: 11px 22px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}
.jf-nav-group-header:hover { color: #fff; }
.jf-nav-caret { margin-inline-start: auto; font-size: 11px; transition: transform .15s; }
.jf-nav-group.open .jf-nav-caret { transform: rotate(180deg); }
.jf-nav-group-body { display: none; padding-block: 2px; }
.jf-nav-group.open .jf-nav-group-body { display: block; }
.jf-nav-group-body .jf-nav-link { padding-inline-start: 34px; font-size: 13px; }

/* group header that is itself a link (e.g. الفواتير) */
.jf-nav-group-link { font-weight: 600; color: #a9c3be; }
.jf-nav-group-link .jf-nav-icon { opacity: .9; }

.jf-sidebar-backdrop { display: none; }

/* ---- Topbar ---------------------------------------------------------- */
.jf-topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 24px;
    background: var(--jf-surface);
    border-bottom: 1px solid var(--jf-border);
    position: sticky;
    top: 0;
    z-index: 20;
}
.jf-topbar-title { font-size: 15px; font-weight: 700; }
.jf-topbar-spacer { flex: 1; }
.jf-sidebar-toggle { display: none; border: 1px solid var(--jf-border-strong); background: #fff; }

/* ---- Content -------------------------------------------------------- */
.jf-content { padding: 24px 28px 56px; flex: 1; }

.jf-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.jf-page-header h1 { margin: 0; font-size: 22px; font-weight: 700; }
.jf-page-header-text { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.jf-page-header-sub { font-size: 12.5px; color: var(--jf-muted); }
.jf-page-header-actions { display: flex; gap: 8px; }

/* ---- Cards --------------------------------------------------------- */
.jf-card {
    background: var(--jf-surface);
    border: 1px solid var(--jf-border);
    border-radius: var(--jf-radius);
    padding: 20px;
    margin-bottom: 20px;
}
.jf-card--flush { padding: 0; overflow: hidden; }
.jf-card-title { font-size: 14px; font-weight: 700; margin: 0 0 14px; }
.jf-card-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--jf-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

/* ---- Forms -------------------------------------------------------- */
.jf-field { display: flex; flex-direction: column; gap: 6px; }
.jf-label { font-size: 11.5px; font-weight: 600; color: var(--jf-muted); }
.jf-form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.jf-form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.jf-form-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }

.form-control, .form-select { font-size: 13px; }
.form-control:focus, .form-select:focus {
    border-color: var(--jf-primary);
    box-shadow: 0 0 0 2px rgba(20, 82, 79, .12);
}

/* placeholders must read clearly AS placeholders — light grey + italic, never like typed text */
.form-control::placeholder,
input::placeholder,
textarea::placeholder,
.ts-control > input::placeholder,
.dataTables_filter input::placeholder {
    color: #a9b2af !important;
    opacity: 1;
    font-style: italic;
    font-weight: 400;
}
.jf-picker-btn.is-empty .jf-picker-btn-label,
.ts-control .ts-placeholder { color: #a9b2af; font-style: italic; }
.btn-primary { --bs-btn-bg: var(--jf-primary); --bs-btn-border-color: var(--jf-primary); --bs-btn-hover-bg: #0f423f; --bs-btn-hover-border-color: #0f423f; }
.btn-accent { --bs-btn-color: #fff; --bs-btn-bg: var(--jf-accent); --bs-btn-border-color: var(--jf-accent); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #9d5024; --bs-btn-hover-border-color: #9d5024; }

/* numeric / code / barcode fields read left-to-right */
.jf-ltr { direction: ltr; text-align: left; }

/* ---- Tables (right-aligned by default) --------------------------- */
table.jf-table, table.dataTable { width: 100%; border-collapse: collapse; }
table.jf-table th, table.jf-table td,
table.dataTable thead th, table.dataTable tbody td {
    text-align: right;
    padding: 10px 12px;
    font-size: 13px;
    vertical-align: middle;
}
table.jf-table thead th, table.dataTable thead th {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--jf-muted);
    background: #f7f8f6;
    border-bottom: 1px solid var(--jf-border);
    white-space: nowrap;
}
table.jf-table tbody td { border-bottom: 1px solid #f0f2ef; }
table.dataTable tbody tr:hover { background: #fafbf9; }
/* numeric columns: LTR digit order, but aligned to the (right) edge under the RTL header */
.jf-cell-num { text-align: right; direction: ltr; font-variant-numeric: tabular-nums; }
table.jf-table th, table.dataTable thead th { text-align: right; }
.jf-cell-code { text-align: right; direction: ltr; font-weight: 600; color: var(--jf-primary); }

.dataTables_wrapper { padding: 12px 16px; }

/* toolbar: search box pinned far left, length menu far right */
.jf-dt-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.jf-dt-top .dataTables_filter { margin-inline-start: auto; }
.jf-dt-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.dataTables_filter label, .dataTables_length label {
    margin: 0; font-size: 12.5px; color: var(--jf-muted);
    display: flex; align-items: center; gap: 6px;
}
.dataTables_filter input, .dataTables_length select { font-size: 13px; }
.dataTables_filter input { min-width: 220px; }

.jf-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
}
.jf-badge--raw { background: var(--jf-primary-tint); color: var(--jf-primary); }
.jf-badge--semi { background: var(--jf-warning-tint); color: var(--jf-warning); }
.jf-badge--mfg { background: var(--jf-success-tint); color: var(--jf-success); }
.jf-badge--ok { background: var(--jf-success-tint); color: var(--jf-success); }
.jf-badge--pending { background: var(--jf-warning-tint); color: var(--jf-warning); }

/* ---- Definitions / inline add forms --------------------------- */
.jf-tabs .nav-link { color: var(--jf-ink-soft); font-weight: 600; font-size: 13.5px; }
.jf-tabs .nav-link.active { color: var(--jf-primary); border-bottom-color: var(--jf-primary); }

.jf-def-add {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
    padding: 16px 18px;
    background: #fafbf9;
    border-bottom: 1px solid var(--jf-border);
}
.jf-def-add .jf-field { min-width: 150px; }
.jf-def-add .jf-field.jf-grow { flex: 1; min-width: 200px; }

.jf-row-actions { white-space: nowrap; display: flex; gap: 6px; }

.jf-segment .btn { font-size: 13px; font-weight: 600; }

/* ---- Invoice form ---------------------------------------- */
.jf-invsum { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; max-width: 760px; }
.jf-invsum-stats, .jf-invsum-money { display: flex; flex-direction: column; }
.jf-invsum .kv {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    font-size: 13px; padding: 7px 0; border-bottom: 1px dashed var(--jf-border);
}
.jf-invsum .kv:last-child { border-bottom: 0; }
.jf-invsum .kv > span:first-child { color: var(--jf-muted); }
.jf-invsum .kv b { font-variant-numeric: tabular-nums; direction: ltr; }
.jf-invsum .kv-final {
    margin-top: 4px; padding-top: 10px; border-top: 2px solid var(--jf-border); border-bottom: 0;
    font-size: 16px;
}
.jf-invsum .kv-final b { color: var(--jf-accent); font-weight: 700; }
.jf-invsum .kv-final .cur { font-size: 11px; color: var(--jf-muted); font-weight: 400; }
.jf-invsum .kv-muted { font-size: 12px; color: var(--jf-muted); }
.jf-invsum .kv-muted span:last-child { direction: ltr; }

.disc-pair { display: flex; align-items: center; gap: 8px; }
.disc-pair > i { color: var(--jf-muted); font-size: 11px; }
.disc-in { position: relative; }
.disc-in input {
    width: 88px; text-align: left; direction: ltr;
    border: 1px solid var(--jf-border-strong); border-radius: 6px;
    padding: 5px 22px 5px 9px; font-size: 13px;
}
.disc-in input:focus { outline: none; border-color: var(--jf-primary); box-shadow: 0 0 0 2px rgba(20,82,79,.12); }
.disc-in .sfx {
    position: absolute; inset-inline-start: 7px; top: 50%; transform: translateY(-50%);
    font-size: 11px; color: var(--jf-muted); pointer-events: none;
}

@media (max-width: 640px) { .jf-invsum { grid-template-columns: 1fr; gap: 12px; } }

/* ---- Manufacturing orders (collapsible cards) ---------- */
.jf-mo-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.jf-mo-filter {
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--jf-border-strong); background: #fff; color: var(--jf-ink-soft);
    border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
    transition: background .12s, color .12s, border-color .12s;
}
.jf-mo-filter span {
    font-size: 11.5px; font-weight: 700; line-height: 1;
    background: var(--jf-primary-tint); color: var(--jf-primary);
    border-radius: 999px; padding: 2px 7px; min-width: 18px; text-align: center;
}
.jf-mo-filter:hover { border-color: var(--jf-primary); color: var(--jf-primary); }
.jf-mo-filter.is-active { background: var(--jf-primary); border-color: var(--jf-primary); color: #fff; }
.jf-mo-filter.is-active span { background: rgba(255, 255, 255, .22); color: #fff; }

.jf-mo-sort {
    margin-inline-start: auto;
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--jf-border-strong); background: #fff; color: var(--jf-ink-soft);
    border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.jf-mo-sort:hover { border-color: var(--jf-primary); color: var(--jf-primary); }

.jf-mo-list { display: flex; flex-direction: column; gap: 14px; }
.jf-mo-card { background: #fff; border: 1px solid var(--jf-border); border-radius: var(--jf-radius); overflow: hidden; }
.jf-mo-card.open { border-color: #cfe0dc; }
.jf-mo-card.jf-mo-running { border-inline-start: 3px solid var(--jf-warning); }
.jf-mo-card.jf-mo-done { border-inline-start: 3px solid var(--jf-success); }
.jf-mo-card.jf-mo-highlight { animation: jf-mo-pulse 1s ease-in-out 2; }
@keyframes jf-mo-pulse {
    0%, 100% { box-shadow: none; }
    50% { box-shadow: 0 0 0 3px var(--jf-primary); }
}

.jf-mo-head { display: flex; align-items: center; gap: 16px; padding: 14px 16px; cursor: pointer; background: #fff; }
.jf-mo-card.open .jf-mo-head { background: #f7faf9; border-bottom: 1px solid var(--jf-border); }
.jf-mo-chevron { border: 1px solid var(--jf-border-strong); background: #fff; color: var(--jf-primary); border-radius: 8px; width: 30px; height: 30px; flex: 0 0 30px; cursor: pointer; transition: transform .15s; }
.jf-mo-card.open .jf-mo-chevron { transform: rotate(180deg); }
.jf-mo-head-main { flex: 1; min-width: 0; }
.jf-mo-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.jf-mo-title strong { font-size: 15px; }
.jf-mo-sub { font-size: 12px; color: var(--jf-muted); margin-top: 3px; }
.jf-mo-head-stats { display: flex; align-items: center; gap: 16px; }
.jf-mo-head-stats > div { text-align: center; font-size: 12px; }
.jf-mo-head-stats > div > span { display: block; color: var(--jf-muted); font-size: 10.5px; }
.jf-mo-head-stats > div > b { font-size: 15px; direction: ltr; }
.jf-mo-yield { position: relative; width: 44px; height: 44px; }
.jf-mo-yield svg { width: 44px; height: 44px; transform: rotate(-90deg); }
.jf-mo-yield circle { fill: none; stroke: #eef0ed; stroke-width: 5; }
.jf-mo-yield circle.bar { stroke: var(--jf-success); stroke-linecap: round; stroke-dasharray: calc(var(--yield, 0) * 1.068) 200; }
.jf-mo-yield-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 700; }

.jf-mo-body { display: none; }
.jf-mo-card.open .jf-mo-body { display: block; }
.jf-mo-section { padding: 16px; }
.jf-mo-header-form { align-items: end; }

.jf-mo-scan { padding: 14px 16px; background: var(--jf-primary-dark); color: #cfe0dc; }
.jf-mo-scan .jf-label { color: #9dbcb6; }
.jf-mo-scan-row { display: grid; grid-template-columns: 1fr 90px 110px 90px auto; gap: 10px; }
/* all inputs in the scan row share the same look as the rest of the form: white field, dark text */
.jf-mo-scan-row .form-control { background: #fff; border-color: #2c5a56; color: var(--jf-ink); }
.jf-mo-scan-msg { font-size: 11.5px; margin-top: 6px; min-height: 15px; color: #e0873f; }

.jf-mo-addline { display: flex; gap: 10px; align-items: end; padding: 14px 16px; background: #fafbf9; border-bottom: 1px solid var(--jf-border); }
.jf-mo-addline .jf-field.jf-grow { flex: 1; min-width: 180px; }
.jf-mo-addline .jf-field:not(.jf-grow) { width: 100px; }

.jf-mo-lines th, .jf-mo-lines td { padding: 7px 10px; }
.jf-mo-lines input { text-align: right; }

.jf-mo-waste { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; font-size: 12.5px; background: #fafbf9; border-bottom: 1px solid var(--jf-border); }
.jf-mo-waste.ok { background: #f2f8f4; }
.jf-mo-waste.ok .jf-mo-waste-msg { color: var(--jf-success); }
.jf-mo-waste.bad { background: #fdf3ec; }
.jf-mo-waste.bad .jf-mo-waste-msg { color: var(--jf-warning); }

.jf-mo-conv { display: flex; gap: 24px; padding: 14px 16px; border-bottom: 1px solid var(--jf-border); }
.jf-mo-conv-item span { color: var(--jf-muted); font-size: 12px; display: block; }
.jf-mo-conv-item b { font-size: 15px; direction: ltr; }

.jf-mo-invoice { display: flex; align-items: center; gap: 8px; padding: 12px 16px; font-size: 13px; background: var(--jf-primary-tint); border-bottom: 1px solid var(--jf-border); }

/* ---- manufacturing card: الأصناف الجاهزة panel ---------------- */
.jf-mo-ready { padding: 14px 16px; border-bottom: 1px solid var(--jf-border); }
.jf-mo-ready-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.jf-mo-ready-empty { font-size: 12.5px; color: var(--jf-muted); }
.jf-mo-ready-table th, .jf-mo-ready-table td { padding: 7px 10px; }

/* ---- production entry (نافذة الإدخال وطباعة الملصق) ----------- */
.jf-field--wide { grid-column: 1 / -1; }
.pe-actions { white-space: nowrap; }
.pe-actions .btn { padding: 2px 7px; }
.pe-actions .btn + .btn { margin-inline-start: 3px; }

.jf-mo-actions { display: flex; gap: 8px; align-items: center; padding: 14px 16px; flex-wrap: wrap; }

@media (max-width: 700px) {
    .jf-mo-head-stats { display: none; }
    .jf-mo-scan-row { grid-template-columns: 1fr; }
    .jf-mo-addline { flex-wrap: wrap; }
}

/* ---- Reports -------------------------------------------- */
.jf-report-card {
    display: flex; align-items: center; gap: 14px; text-decoration: none;
    color: var(--jf-ink); margin: 0;
}
.jf-report-card:hover { border-color: var(--jf-primary); color: var(--jf-ink); }
.jf-report-card i { font-size: 22px; color: var(--jf-primary); flex: 0 0 auto; }
.jf-report-title { font-weight: 700; font-size: 14px; }
.jf-report-desc { font-size: 12px; color: var(--jf-muted); margin-top: 2px; }

/* report filter form: date range on its own first line, kept compact */
.jf-report-filter .jf-daterange { padding-bottom: 12px; border-bottom: 1px solid var(--jf-border); }
.jf-report-filter .jf-daterange .jf-field { flex: 0 1 200px; max-width: 220px; }

table.dataTable tfoot .jf-total-row td,
table.jf-table tfoot .jf-total-row td {
    font-weight: 700; background: #f7f8f6; border-top: 2px solid var(--jf-border);
    text-align: right;
}
table.dataTable tfoot .jf-total-row td.jf-cell-num,
table.jf-table tfoot .jf-total-row td.jf-cell-num { text-align: right; direction: ltr; }
#linesTable td { padding: 6px 8px; vertical-align: top; }
#linesTable .rownum { text-align: center; color: var(--jf-muted); padding-top: 12px; }
#linesTable .line-amount { text-align: right; direction: ltr; padding-top: 12px; font-weight: 600; white-space: nowrap; }
.line-barcode { font-size: 11px; color: var(--jf-muted); margin-top: 3px; min-height: 14px; }

.jf-barcode-preview {
    padding: 9px 11px;
    border: 1px dashed var(--jf-border-strong);
    border-radius: var(--jf-radius-sm);
    background: #f7f8f6;
    color: var(--jf-primary);
    font-weight: 600;
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Date range ------------------------------------------------- */
.jf-daterange { display: flex; gap: 12px; flex-wrap: wrap; }
.jf-daterange .jf-field { min-width: 160px; }

/* ---- Toaster (top-right) -------------------------------------- */
.jf-toaster {
    position: fixed;
    top: 16px;
    right: 16px;
    left: auto;
    z-index: 1080;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 340px;
    max-width: calc(100vw - 32px);
    pointer-events: none;
}
.jf-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #fff;
    border: 1px solid var(--jf-border);
    border-radius: var(--jf-radius-sm);
    box-shadow: var(--jf-shadow);
    padding: 12px 14px;
    font-size: 13px;
    transform: translateX(120%);
    opacity: 0;
    transition: transform .2s ease, opacity .2s ease;
    border-right: 4px solid var(--jf-muted);
}
.jf-toast.shown { transform: translateX(0); opacity: 1; }
.jf-toast.leaving { transform: translateX(120%); opacity: 0; }
.jf-toast-icon { font-size: 15px; margin-top: 1px; }
.jf-toast-body { flex: 1; line-height: 1.5; }
.jf-toast-close { border: 0; background: transparent; color: var(--jf-muted); cursor: pointer; padding: 0; font-size: 13px; }
.jf-toast-success { border-right-color: var(--jf-success); }
.jf-toast-success .jf-toast-icon { color: var(--jf-success); }
.jf-toast-error { border-right-color: var(--jf-danger); }
.jf-toast-error .jf-toast-icon { color: var(--jf-danger); }
.jf-toast-warning { border-right-color: var(--jf-warning); }
.jf-toast-warning .jf-toast-icon { color: var(--jf-warning); }
.jf-toast-info { border-right-color: var(--jf-primary); }
.jf-toast-info .jf-toast-icon { color: var(--jf-primary); }

/* ---- Confirm modal ------------------------------------------- */
.jf-confirm-icon { font-size: 22px; margin-top: 2px; }

/* ---- Picker (modal mode) ----------------------------------- */
.jf-picker-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    background: #fff;
}
.jf-picker-btn.is-empty .jf-picker-btn-label { color: var(--jf-muted); }

/* the shared picker modal is always RTL, regardless of where it is triggered from */
#jfPickerModal .modal-content,
#jfPickerModal .modal-header,
#jfPickerModal .modal-body { direction: rtl; text-align: right; }
#jfPickerModal .modal-title { text-align: right; }
#jfPickerModal #jfPickerSearch { text-align: right; }

.jf-picker-list { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.jf-picker-item {
    display: block;
    width: 100%;
    text-align: right;
    border: 0;
    background: #fff;
    border-radius: var(--jf-radius-sm);
    padding: 10px 12px;
    cursor: pointer;
    font-size: 13.5px;
}
.jf-picker-item:hover { background: var(--jf-primary-tint); }
.jf-picker-item-label { display: block; }
.jf-picker-item-sub { display: block; font-size: 11.5px; color: var(--jf-muted); }
.jf-picker-empty, .jf-picker-list .jf-picker-empty { padding: 16px; text-align: center; color: var(--jf-muted); }

/* ---- Tom Select tweaks ------------------------------------ */
.ts-wrapper { font-family: inherit; }
.ts-control { border-radius: var(--jf-radius-sm); min-height: 38px; font-size: 13px; }
.ts-wrapper.focus .ts-control { border-color: var(--jf-primary); box-shadow: 0 0 0 2px rgba(20, 82, 79, .12); }
.ts-dropdown .active { background: var(--jf-primary-tint); color: var(--jf-primary); }
.ts-dropdown .no-results { padding: 9px 12px; color: var(--jf-muted); }

/* multi-select chips: coloured pill + × remove button */
.ts-wrapper.multi .ts-control > .item {
    background: var(--jf-primary-tint);
    color: var(--jf-primary);
    border: 1px solid #cfe0dc;
    border-radius: 6px;
    padding: 2px 6px 2px 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.ts-wrapper.multi .ts-control > .item .remove {
    border: 0;
    color: var(--jf-primary);
    background: transparent;
    padding: 0 2px;
    font-size: 14px;
    line-height: 1;
    opacity: .7;
}
.ts-wrapper.multi .ts-control > .item .remove:hover { opacity: 1; background: rgba(20,82,79,.12); border-radius: 4px; }
.ts-wrapper.multi .ts-control { gap: 4px; }
/* once something is picked, drop the "— بدون تصفية —" placeholder text */
.ts-wrapper.has-items .ts-control > input::placeholder { color: transparent !important; }
.ts-wrapper.has-items:not(.focus) .ts-control > input { width: 4px !important; min-width: 0 !important; }
/* dropdown rendered on <body> for table/modal selects — must sit above cards & modals */
.ts-dropdown { z-index: 1090; }
/* the empty "— اختر … —" choice reads as a placeholder, not a real value */
.ts-dropdown .option[data-value=""],
.ts-control .item[data-value=""] { color: #a9b2af; font-style: italic; }
select.line-item option[value=""] { color: #a9b2af; }

/* invoice line: item select + quick-pick button */
.line-item-wrap { display: flex; gap: 6px; align-items: center; }
.line-item-wrap .ts-wrapper, .line-item-wrap select { flex: 1; min-width: 0; }
.line-item-wrap .line-pick, .line-item-wrap .jf-mo-raw-pick { flex: 0 0 auto; }

/* ---- Auth pages ---------------------------------------- */
.jf-auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #12312f, #1b423f);
    padding: 24px;
}
.jf-auth-wrap { width: 380px; max-width: 100%; position: relative; z-index: 1; }

/* decorative animated Font Awesome icons behind the login card */
.jf-auth-fx { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.jf-auth-fx i {
    position: absolute;
    color: #ffffff;
    opacity: .07;
    --fa-animation-duration: var(--d, 3s);
}
.jf-auth-fx i:nth-child(1) { top: 12%; inset-inline-start: 8%; font-size: 76px; }
.jf-auth-fx i:nth-child(2) { top: 68%; inset-inline-start: 14%; font-size: 120px; opacity: .05; }
.jf-auth-fx i:nth-child(3) { top: 20%; inset-inline-end: 12%; font-size: 54px; }
.jf-auth-fx i:nth-child(4) { top: 78%; inset-inline-end: 18%; font-size: 60px; }
.jf-auth-fx i:nth-child(5) { top: 46%; inset-inline-start: 4%; font-size: 44px; opacity: .09; }
.jf-auth-fx i:nth-child(6) { top: 8%;  inset-inline-end: 40%; font-size: 34px; }
.jf-auth-fx i:nth-child(7) { top: 40%; inset-inline-end: 6%;  font-size: 50px; }
.jf-auth-fx i:nth-child(8) { top: 88%; inset-inline-start: 44%; font-size: 40px; }

@media (max-width: 640px) { .jf-auth-fx i:nth-child(2), .jf-auth-fx i:nth-child(6) { display: none; } }
@media (prefers-reduced-motion: reduce) { .jf-auth-fx i { animation: none !important; } }
.jf-auth-brand { text-align: center; color: #e7efec; margin-bottom: 20px; }
.jf-auth-logo {
    width: 56px; height: 56px; border-radius: 16px;
    background: rgba(255, 255, 255, .12); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 24px; margin-bottom: 12px;
}
.jf-auth-name { font-size: 20px; font-weight: 700; }
.jf-auth-sub { font-size: 12px; color: #9dbcb6; margin-top: 2px; }
.jf-auth-card { background: #fff; border-radius: var(--jf-radius); padding: 28px 26px; box-shadow: var(--jf-shadow); }
.jf-auth-title { font-size: 17px; font-weight: 700; margin: 0 0 18px; }

/* ---- User menu (topbar) ------------------------------- */
.jf-user-menu .btn { border: 1px solid var(--jf-border-strong); background: #fff; color: var(--jf-ink-soft); font-size: 13px; }
.jf-user-menu .btn span { margin-inline-start: 4px; }

/* ---- Placeholder page ----------------------------------- */
.jf-placeholder {
    text-align: center;
    padding: 64px 24px;
    color: var(--jf-muted);
}
.jf-placeholder i { font-size: 40px; color: var(--jf-border-strong); margin-bottom: 14px; }

/* ---- Stat tiles --------------------------------------- */
.jf-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.jf-tile { background: #fff; border: 1px solid var(--jf-border); border-radius: var(--jf-radius); padding: 16px 18px; }
.jf-tile-label { font-size: 11.5px; color: var(--jf-muted); font-weight: 600; }
.jf-tile-value { font-size: 24px; font-weight: 700; margin-top: 6px; text-align: left; direction: ltr; }
.jf-tile-sub { font-size: 11px; color: #8d9a97; margin-top: 4px; }

/* ---- Responsive -------------------------------------- */
@media (max-width: 992px) {
    .jf-sidebar {
        position: fixed;
        inset-inline-start: 0;
        top: 0;
        z-index: 1050;
        transform: translateX(100%);
        transition: transform .2s ease;
    }
    body.jf-sidebar-open .jf-sidebar { transform: translateX(0); }
    body.jf-sidebar-open .jf-sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(11, 29, 28, .5);
        z-index: 1040;
    }
    .jf-sidebar-toggle { display: inline-flex; align-items: center; }
    .jf-form-grid, .jf-form-grid-3, .jf-form-grid-2 { grid-template-columns: 1fr 1fr; }
    .jf-tiles { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 576px) {
    .jf-content { padding: 16px 14px 40px; }
    .jf-form-grid, .jf-form-grid-3, .jf-form-grid-2 { grid-template-columns: 1fr; }
    .jf-tiles { grid-template-columns: 1fr; }
    .jf-toaster { width: auto; inset-inline: 12px; }
}

/* ---- Print ----------------------------------------- */
@media print {
    .jf-sidebar, .jf-topbar, .jf-toaster, .jf-page-header-actions { display: none !important; }
    .jf-content { padding: 0; }
    body { background: #fff; }
}
