/* ============================================================
   SpareTech — Modern UI (RTL first, mobile first)
   ============================================================ */
:root {
    --ink: #102a33;
    --ink-soft: #35545e;
    --muted: #6b8088;
    --brand: #0f5c63;
    --brand-600: #127079;
    --brand-500: #1b8b93;
    --brand-100: #e3f2f2;
    --accent: #e8a33d;
    --accent-600: #d18b24;
    --danger: #d94b4b;
    --ok: #128a63;
    --warn: #c98216;
    --bg: #f3f7f8;
    --surface: #ffffff;
    --surface-2: #f8fbfb;
    --line: #e3ebee;
    --line-strong: #d3dfe3;
    --radius: 16px;
    --radius-lg: 22px;
    --shadow-sm: 0 1px 2px rgba(16, 42, 51, .06), 0 1px 3px rgba(16, 42, 51, .04);
    --shadow-md: 0 10px 30px -18px rgba(16, 42, 51, .35);
    --shadow-lg: 0 24px 60px -30px rgba(16, 42, 51, .45);
    --sidebar-w: 272px;
    --topbar-h: 64px;
    --mobile-nav-h: 70px;
    --ring: 0 0 0 .22rem rgba(27, 139, 147, .16);
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(1100px 500px at 100% -10%, rgba(27, 139, 147, .07), transparent 60%),
        radial-gradient(900px 420px at 0% 0%, rgba(232, 163, 61, .06), transparent 55%),
        var(--bg);
    font-family: "Cairo", "Segoe UI", Tahoma, "Noto Naskh Arabic", sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand); }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5 { font-weight: 700; letter-spacing: -.01em; }
.text-muted { color: var(--muted) !important; }
::selection { background: rgba(27, 139, 147, .22); }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: #c4d4d8 transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: #c4d4d8; border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- Shell ---------- */
.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- Sidebar ---------- */
.sidebar {
    width: var(--sidebar-w);
    flex: none;
    display: flex;
    flex-direction: column;
    color: #eaf3f3;
    background:
        radial-gradient(120% 60% at 0% 0%, rgba(232, 163, 61, .16), transparent 55%),
        radial-gradient(120% 70% at 100% 100%, rgba(27, 139, 147, .32), transparent 60%),
        linear-gradient(180deg, #0b2e36 0%, #0a242b 100%);
    padding: 16px 12px 20px;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-inline-end: 1px solid rgba(255, 255, 255, .06);
    scrollbar-color: rgba(255, 255, 255, .25) transparent;
}
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .22); background-clip: content-box; }

.brand-row { display: flex; align-items: flex-start; gap: 8px; flex: none; }
.brand-row .brand { flex: 1; min-width: 0; }
.brand {
    display: flex; gap: 12px; align-items: center;
    color: #fff; padding: 6px 8px 18px; margin-bottom: 4px;
}
.brand small { display: block; color: #a8c4c6; font-size: 11px; line-height: 1.4; }
.brand strong { font-size: 1.06rem; font-weight: 800; letter-spacing: .01em; }
.brand-mark {
    width: 44px; height: 44px; border-radius: 14px; flex: none;
    display: grid; place-items: center; font-size: 1.25rem;
    color: #23160a;
    background: linear-gradient(140deg, #f6c778, var(--accent));
    box-shadow: 0 10px 22px -12px rgba(232, 163, 61, .9), inset 0 1px 0 rgba(255, 255, 255, .55);
}
.sidebar-close {
    display: none; margin-inline-start: auto; border: 0; background: rgba(255, 255, 255, .1);
    color: #fff; width: 36px; height: 36px; border-radius: 11px; line-height: 1;
}

.nav-label {
    font-size: 10.5px; font-weight: 700; letter-spacing: .14em;
    text-transform: uppercase; color: #7fa2a6; margin: 18px 12px 7px;
}
.side-nav { display: flex; flex-direction: column; padding-bottom: 12px; flex: none; }
.side-nav a {
    position: relative;
    display: flex; gap: 11px; align-items: center;
    color: #d5e5e6; border-radius: 12px; padding: 9px 12px; margin-bottom: 2px;
    font-size: 14px; font-weight: 600;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}
.side-nav a i { font-size: 1.06rem; width: 22px; text-align: center; color: #8fb4b8; transition: color .18s ease; }
.side-nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.side-nav a:hover i { color: #fff; }
.side-nav a.active {
    background: linear-gradient(90deg, rgba(27, 139, 147, .35), rgba(27, 139, 147, .12));
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}
.side-nav a.active i { color: #f3c477; }
.side-nav a.active::before {
    content: ""; position: absolute; inset-inline-start: 0; top: 22%; bottom: 22%;
    width: 3px; border-radius: 99px; background: var(--accent);
}
.side-nav a.nav-pos {
    background: linear-gradient(135deg, #f2b552, var(--accent));
    color: #2a1a06; font-weight: 800; margin: 4px 0 12px;
    box-shadow: 0 12px 26px -14px rgba(232, 163, 61, .85);
}
.side-nav a.nav-pos i { color: #2a1a06; }
.side-nav a.nav-pos:hover { background: linear-gradient(135deg, #ffc66b, #f3ad44); color: #2a1a06; }
.side-nav a.nav-pos.active::before { display: none; }
.sidebar-foot {
    margin-top: auto; padding: 14px 10px 4px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    color: #9db9bc; font-size: 12px;
}

/* ---------- Topbar ---------- */
.topbar {
    display: flex; gap: 12px; align-items: center;
    padding: 10px clamp(14px, 2.2vw, 26px);
    min-height: var(--topbar-h);
    background: rgba(255, 255, 255, .82);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 20;
}
.topbar-toggle {
    display: none; border: 1px solid var(--line-strong); background: #fff;
    color: var(--ink); width: 42px; height: 42px; border-radius: 13px;
    place-items: center; font-size: 1.25rem; flex: none; box-shadow: var(--shadow-sm);
}
.search-form {
    flex: 1; max-width: 560px;
    display: flex; align-items: center; gap: 9px;
    background: var(--surface-2); border: 1px solid var(--line);
    border-radius: 999px; padding: 8px 16px;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.search-form:focus-within { border-color: var(--brand-500); background: #fff; box-shadow: var(--ring); }
.search-form i { color: var(--muted); }
.search-form input { border: 0; background: transparent; width: 100%; outline: none; color: var(--ink); font-size: 14px; }
.search-form input::placeholder { color: #93a6ac; }
.top-actions { display: flex; gap: 8px; align-items: center; margin-inline-start: auto; }
.top-actions .btn { white-space: nowrap; }
.top-icon-btn {
    width: 42px; height: 42px; border-radius: 13px; border: 1px solid var(--line);
    background: #fff; color: var(--ink-soft); display: grid; place-items: center;
    font-size: 1.05rem; position: relative; box-shadow: var(--shadow-sm);
}
.top-icon-btn:hover { color: var(--brand); border-color: #bfd6d9; background: #fbfefe; }
.user-chip {
    display: flex; align-items: center; gap: 9px; border: 1px solid var(--line);
    background: #fff; border-radius: 999px; padding: 5px 6px 5px 14px;
    color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; font-size: 14px;
    cursor: pointer;
}
html[dir="rtl"] .user-chip { padding: 5px 14px 5px 6px; }
.user-chip .avatar {
    width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
    background: linear-gradient(140deg, var(--brand-500), var(--brand));
    color: #fff; font-weight: 700; font-size: 13px; flex: none;
}
.count-dot {
    position: absolute; top: -5px; inset-inline-end: -5px;
    min-width: 19px; height: 19px; padding: 0 5px;
    display: grid; place-items: center;
    background: var(--danger); color: #fff; border-radius: 99px;
    font-size: 10px; font-weight: 700; border: 2px solid #fff;
}

/* ---------- Content ---------- */
.content {
    padding: clamp(14px, 2.2vw, 26px);
    width: 100%;
    max-width: 1560px;
    margin-inline: auto;
    flex: 1;
}
.page-head {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
    justify-content: space-between; margin-bottom: 18px;
}
.page-head h1, .page-head .h3 { margin: 0; font-size: clamp(1.35rem, 2.4vw, 1.7rem); }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.eyebrow {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
    color: var(--brand-500); margin-bottom: 2px;
}

/* ---------- Cards / panels ---------- */
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: clamp(16px, 2vw, 22px);
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}
.panel > :last-child { margin-bottom: 0; }
.panel-head {
    display: flex; justify-content: space-between; gap: 12px; align-items: center;
    flex-wrap: wrap; margin-bottom: 16px;
}
.panel-head h1, .panel-head h2, .panel-head h3 { margin: 0; }
.panel-head .h4, .panel-head .h5 { font-size: 1.15rem; }
.panel-sub { color: var(--muted); font-size: 13px; margin: -8px 0 14px; }

.hero-card {
    position: relative; overflow: hidden;
    display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between;
    background:
        radial-gradient(120% 150% at 100% 0%, rgba(232, 163, 61, .28), transparent 55%),
        radial-gradient(120% 160% at 0% 100%, rgba(27, 139, 147, .55), transparent 60%),
        linear-gradient(130deg, #0c3a43, #0f5c63 60%, #14707a);
    color: #fff; border-radius: var(--radius-lg);
    padding: clamp(18px, 2.6vw, 28px); margin-bottom: 18px;
    box-shadow: var(--shadow-lg);
}
.hero-card h1 { margin: 0 0 4px; font-size: clamp(1.3rem, 2.6vw, 1.85rem); font-weight: 800; }
.hero-card p { margin: 0; color: #cfe3e4; max-width: 46rem; }
.hero-card .hero-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.hero-card .btn-light { background: #fff; border-color: #fff; color: var(--brand); font-weight: 700; }
.hero-card .btn-outline-light { border-color: rgba(255, 255, 255, .5); }
.hero-badge {
    display: inline-flex; align-items: center; gap: 7px;
    background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .18);
    color: #fff; border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 600;
    backdrop-filter: blur(4px);
}

/* ---------- stats ---------- */
.stat-grid, .point-grid, .report-grid { display: grid; gap: 14px; }
.stat-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.point-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.report-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stat-card {
    position: relative; overflow: hidden;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: #d5e3e6; }
.stat-card::after {
    content: ""; position: absolute; inset-inline-end: -30px; top: -30px;
    width: 90px; height: 90px; border-radius: 50%;
    background: radial-gradient(circle, rgba(27, 139, 147, .10), transparent 70%);
    pointer-events: none;
}
.stat-card .stat-icon {
    width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
    background: var(--brand-100); color: var(--brand-600); font-size: 1.15rem;
    margin-bottom: 10px;
}
.stat-card span { position: relative; display: block; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.stat-card strong { position: relative; display: block; font-size: clamp(1.25rem, 2.2vw, 1.55rem); font-weight: 800; line-height: 1.25; margin-top: 2px; }
.stat-card.is-danger .stat-icon { background: #fdecec; color: var(--danger); }
.stat-card.is-warn .stat-icon { background: #fdf3e2; color: var(--warn); }
.stat-card.is-ok .stat-icon { background: #e6f7f0; color: var(--ok); }

.point-card {
    display: block; color: inherit; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: 15px 17px; box-shadow: var(--shadow-sm);
    border-inline-start: 5px solid var(--ok);
    transition: transform .18s ease, box-shadow .18s ease;
}
.point-card:hover { color: inherit; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.point-card.due { border-inline-start-color: var(--danger); }
.point-card.partial, .point-card.credit { border-inline-start-color: var(--warn); }
.point-card.current { outline: 2px solid var(--brand-500); outline-offset: 1px; }
.point-card strong { font-weight: 700; }
.point-card .amt { font-size: 1.22rem; font-weight: 800; margin-top: 2px; color: var(--ink); }
.point-card .small { color: var(--muted); }

/* alert/list */
.alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.alert-list li {
    display: flex; gap: 10px; align-items: flex-start;
    background: var(--surface-2); border: 1px solid var(--line);
    border-radius: 13px; padding: 11px 14px; font-size: 14px;
}
.alert-list li .alert-dot {
    width: 30px; height: 30px; flex: none; border-radius: 9px;
    display: grid; place-items: center; background: #fdf3e2; color: var(--warn);
}

/* ---------- Buttons / forms ---------- */
.btn {
    border-radius: 11px; font-weight: 600; font-size: 14px;
    padding: .52rem .95rem;
    transition: transform .12s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}
.btn:active { transform: translateY(1px); }
.btn-sm { border-radius: 9px; padding: .32rem .68rem; font-size: 13px; }
.btn-lg { border-radius: 14px; }
.btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-600);
    --bs-btn-hover-border-color: var(--brand-600);
    --bs-btn-active-bg: var(--brand);
    --bs-btn-active-border-color: var(--brand);
    --bs-btn-disabled-bg: var(--brand);
    --bs-btn-disabled-border-color: var(--brand);
    box-shadow: 0 10px 22px -14px rgba(15, 92, 99, .8);
}
.btn-outline-primary {
    --bs-btn-color: var(--brand-600);
    --bs-btn-border-color: #b9d5d8;
    --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand);
    --bs-btn-active-border-color: var(--brand);
    background: #fff;
}
.btn-outline-secondary {
    --bs-btn-color: var(--ink-soft);
    --bs-btn-border-color: var(--line-strong);
    --bs-btn-hover-bg: #eef3f4;
    --bs-btn-hover-border-color: #c2d1d5;
    --bs-btn-hover-color: var(--ink);
    background: #fff;
}
.btn-light { background: #fff; border: 1px solid var(--line); }
.btn-light:hover { background: #f4f9f9; border-color: var(--line-strong); }
.btn-link { text-decoration: none; }
.form-control, .form-select {
    border-radius: 11px; border-color: var(--line-strong);
    padding: .58rem .85rem; font-size: 14px; color: var(--ink);
    background-color: #fff;
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand-500);
    box-shadow: var(--ring);
}
.form-control-sm, .form-select-sm { border-radius: 9px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: .35rem; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus { border-color: var(--brand-500); box-shadow: var(--ring); }
.input-group-text { border-radius: 11px; border-color: var(--line-strong); background: var(--surface-2); }
textarea.form-control { min-height: 74px; }
.badge { border-radius: 8px; padding: .42em .62em; font-weight: 600; letter-spacing: .01em; }
.alert { border-radius: 14px; border: 1px solid transparent; padding: 12px 16px; }
.alert-success { background: #e9f8f1; border-color: #bfe8d7; color: #0b5f45; }
.alert-danger { background: #fdeeee; border-color: #f3c9c9; color: #8d2626; }
.alert-warning { background: #fdf5e5; border-color: #f0d9a8; color: #7a5006; }
.alert-info { background: #e9f4f7; border-color: #c3e1e8; color: #0b5560; }
.dropdown-menu {
    border-radius: 14px; border-color: var(--line); box-shadow: var(--shadow-md);
    padding: 6px;
}
.dropdown-item { border-radius: 9px; padding: 8px 12px; font-size: 14px; }
.dropdown-item:hover { background: var(--surface-2); }
.modal-content { border-radius: 20px; border: 0; box-shadow: var(--shadow-lg); }
.pagination, nav.mt-3.d-flex { gap: 6px; }
.pagination-bar { align-items: center; }
@media (max-width: 768px) {
    .pagination-bar { flex-wrap: nowrap !important; overflow-x: auto; padding-bottom: 4px; }
    .pagination-bar .btn { flex: 0 0 auto; }
}

/* ---------- Filters ---------- */
.filters {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
    margin-bottom: 16px; padding: 12px;
    background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px;
}
.filters .form-control, .filters .form-select { width: auto; min-width: 150px; flex: 1 1 150px; }
.filters .btn { flex: 0 0 auto; }
.date-filter { display: contents; }

/* ---------- Tables ---------- */
.table-responsive {
    border-radius: 14px; border: 1px solid var(--line);
    overflow: auto; -webkit-overflow-scrolling: touch;
    background: #fff;
}
.table { --bs-table-bg: transparent; margin-bottom: 0; color: var(--ink); }
.table > :not(caption) > * > * { padding: .7rem .8rem; border-color: var(--line); }
.table thead th {
    font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    color: var(--muted); background: var(--surface-2); white-space: nowrap;
    border-bottom: 1px solid var(--line);
}
.table tbody tr { transition: background .15s ease; }
.table tbody tr:hover { background: #f7fbfb; }
.table tbody td { vertical-align: middle; font-size: 14px; }
.table .row-missing, .table .row-missing:hover { background: #fdeeee; }
.table .row-complete, .table .row-complete:hover { background: #eaf8f1; }
.table .row-over, .table .row-over:hover { background: #fdf6e3; }
.table a { font-weight: 600; }
.line-table input, .line-table select { min-width: 90px; }

/* ---------- Login ---------- */
.auth-body {
    min-height: 100vh; min-height: 100dvh;
    display: grid; place-items: center;
    padding: 20px;
    background:
        radial-gradient(1000px 520px at 85% -10%, rgba(232, 163, 61, .24), transparent 60%),
        radial-gradient(1100px 620px at 10% 110%, rgba(27, 139, 147, .55), transparent 60%),
        linear-gradient(140deg, #08242b, #0b3a42 55%, #0f5c63);
}
.auth-shell {
    width: min(980px, 100%);
    display: grid; grid-template-columns: 1.05fr .95fr;
    background: #fff; border-radius: 26px; overflow: hidden;
    box-shadow: 0 40px 90px -40px rgba(0, 0, 0, .6);
}
.auth-visual {
    position: relative; overflow: hidden; color: #fff;
    padding: clamp(24px, 4vw, 44px);
    display: flex; flex-direction: column; gap: 22px; justify-content: space-between;
    background:
        radial-gradient(100% 120% at 100% 0%, rgba(232, 163, 61, .30), transparent 55%),
        radial-gradient(120% 140% at 0% 100%, rgba(27, 139, 147, .55), transparent 60%),
        linear-gradient(150deg, #0a2c34, #0f5c63);
}
.auth-visual .brand { padding: 0; }
.auth-visual h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 800; margin: 0 0 8px; }
.auth-visual p { color: #cfe3e4; margin: 0; max-width: 26rem; }
.auth-points { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.auth-points li { display: flex; gap: 10px; align-items: center; font-size: 14px; color: #e2f0f0; }
.auth-points i {
    width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center;
    background: rgba(255, 255, 255, .12); color: #f6c778;
}
.auth-visual .auth-foot { color: #9fc3c6; font-size: 12px; }
.auth-card {
    width: 100%; padding: clamp(24px, 4vw, 42px);
    display: flex; flex-direction: column; justify-content: center;
}
.auth-body > .auth-card {
    width: min(640px, 94vw); background: #fff; border-radius: 24px;
    box-shadow: 0 40px 90px -40px rgba(0, 0, 0, .6);
    padding: clamp(24px, 4vw, 40px);
}
.auth-card .auth-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 26px; }
.auth-card .auth-top strong { font-weight: 800; color: var(--brand); }
.auth-shell .alert { margin-bottom: 16px; }
.auth-input { position: relative; }
.auth-input > i {
    position: absolute; top: 50%; transform: translateY(-50%);
    inset-inline-start: 14px; color: var(--muted); pointer-events: none;
}
.auth-input .form-control { padding-inline-start: 42px; height: 48px; }
.auth-input .auth-toggle {
    position: absolute; top: 50%; transform: translateY(-50%);
    inset-inline-end: 8px; border: 0; background: transparent; color: var(--muted);
    width: 36px; height: 36px; border-radius: 9px;
}
.auth-submit { height: 48px; font-size: 15px; font-weight: 700; }

/* ---------- POS ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.pos-catalog { margin-bottom: 0; }
.pos-catalog-head, .pos-warehouse { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.pos-catalog-head h1 { font-size: 1.2rem; }
.pos-warehouse { font-size: 13px; color: var(--muted); font-weight: 600; }
.pos-warehouse select { min-width: 180px; }
.pos-search { position: relative; margin: 14px 0 10px; }
.pos-search i { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-start: 15px; color: var(--muted); }
.pos-search input {
    width: 100%; border: 1px solid var(--line-strong); border-radius: 13px;
    padding: 12px 14px 12px 42px; background: var(--surface-2); outline: none;
    font-size: 15px; transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
html[dir="rtl"] .pos-search input { padding: 12px 42px 12px 14px; }
.pos-search input:focus { border-color: var(--brand-500); background: #fff; box-shadow: var(--ring); }
.pos-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.pos-chip {
    border: 1px solid var(--line); background: #fff; border-radius: 999px;
    padding: 6px 14px; font-size: 13px; font-weight: 600; color: var(--ink-soft);
    transition: all .16s ease;
}
.pos-chip:hover { border-color: #b9d5d8; color: var(--brand-600); }
.pos-chip.is-on { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: 0 8px 18px -12px rgba(15, 92, 99, .9); }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; }
.pos-card {
    display: flex; flex-direction: column; gap: 3px; text-align: start;
    border: 1px solid var(--line); border-radius: 14px; background: #fff;
    padding: 13px; min-height: 122px; color: var(--ink);
    transition: transform .14s ease, box-shadow .16s ease, border-color .16s ease;
}
.pos-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.pos-card:active { transform: scale(.985); }
.pos-card.is-empty { opacity: .5; }
.pos-card .num, .pos-card .avail { color: var(--muted); font-size: 12px; }
.pos-card .num { letter-spacing: .02em; }
.pos-card strong { font-size: 14px; line-height: 1.35; }
.pos-card .price { color: var(--brand); font-weight: 800; margin-top: auto; }
.pos-ticket { position: sticky; top: calc(var(--topbar-h) + 14px); margin-bottom: 0; }
.pos-ticket h2 { font-size: 1.05rem; }
.pos-sheet-close {
    display: none; position: absolute; top: 12px; inset-inline-end: 12px;
    width: 36px; height: 36px; border-radius: 11px; border: 1px solid var(--line);
    background: var(--surface-2); color: var(--ink-soft); place-items: center; z-index: 2;
}
.pos-pay { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pos-pay label {
    border: 1px solid var(--line-strong); border-radius: 12px; padding: 10px;
    text-align: center; cursor: pointer; font-weight: 600; font-size: 14px;
    transition: all .16s ease; background: #fff;
}
.pos-pay label:hover { border-color: #b9d5d8; }
.pos-pay input { position: absolute; opacity: 0; pointer-events: none; }
.pos-pay label:has(input:checked) { background: var(--brand); color: #fff; border-color: var(--brand); }
.pos-empty { color: var(--muted); margin: 10px 0; font-size: 14px; }
.pos-lines { max-height: 300px; overflow: auto; border-radius: 12px; }
.pos-table td { vertical-align: middle; padding: 7px 4px; border-color: var(--line); }
.pos-name { font-weight: 700; font-size: 13px; }
.pos-line-meta { color: var(--muted); font-size: 11.5px; }
.pos-qty { display: flex; align-items: center; gap: 4px; }
.pos-qty button {
    width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line-strong);
    background: #fff; color: var(--ink); font-weight: 700; line-height: 1;
}
.pos-qty button:hover { background: var(--surface-2); border-color: var(--brand-500); color: var(--brand); }
.pos-qty input {
    width: 52px; height: 30px; text-align: center; border: 1px solid var(--line-strong);
    border-radius: 9px; font-size: 13px;
}
.pos-totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 10px 0 14px; font-size: 14px; }
.pos-totals strong:last-child { font-size: 1.4rem; color: var(--brand); font-weight: 800; }
.pos-checkout {
    width: 100%; padding: 13px; font-size: 1.02rem; border-radius: 13px; font-weight: 800;
}
.pos-sheet-backdrop { display: none; }
.pos-mobile-bar {
    display: none;
    position: fixed; z-index: 25; inset-inline: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(135deg, #0c3a43, var(--brand));
    color: #fff; border-radius: 16px; padding: 9px 10px 9px 16px;
    align-items: center; justify-content: space-between; gap: 10px;
    box-shadow: var(--shadow-lg);
}
html[dir="rtl"] .pos-mobile-bar { padding: 9px 16px 9px 10px; }
.pos-mobile-bar .sum { display: flex; flex-direction: column; line-height: 1.2; }
.pos-mobile-bar .sum small { color: #b9d8da; font-size: 11px; }
.pos-mobile-bar .sum strong { font-size: 1.15rem; font-weight: 800; }
.pos-mobile-bar .btn { background: var(--accent); border: 0; color: #2a1a06; font-weight: 800; border-radius: 11px; }
.pos-mobile-bar .cart-count {
    background: rgba(255, 255, 255, .18); border-radius: 99px; padding: 2px 9px;
    font-size: 12px; font-weight: 700;
}

/* ---------- Trace ---------- */
.trace-empty {
    background: #fff; border: 1px dashed var(--line-strong); border-radius: var(--radius-lg);
    text-align: center; padding: 46px 16px; color: var(--muted);
}
.trace-empty i { font-size: 2rem; color: var(--brand-500); display: block; margin-bottom: 8px; }
.trace-hero {
    display: flex; justify-content: space-between; gap: 16px; align-items: center; flex-wrap: wrap;
    background:
        radial-gradient(120% 150% at 100% 0%, rgba(232, 163, 61, .3), transparent 55%),
        linear-gradient(135deg, #0c3a43, #14707a); color: #fff;
    border-radius: var(--radius-lg); padding: 20px 22px; margin-bottom: 14px;
    box-shadow: var(--shadow-lg);
}
.trace-hero h2 { margin: 0; font-size: 1.4rem; font-weight: 800; }
.trace-hero p { margin: 4px 0 0; color: #cfe3e4; }
.trace-hero .part-no { color: #f3c477; font-size: 13px; }
.trace-now { text-align: center; background: rgba(255, 255, 255, .13); border-radius: 14px; padding: 10px 18px; min-width: 124px; }
.trace-now span { display: block; font-size: 12px; color: #cfe3e4; }
.trace-now strong { font-size: 1.8rem; font-weight: 800; }
.trace-sentence { margin: 0 0 14px; }
.trace-wait { display: inline-block; margin-inline-start: 8px; color: var(--warn); font-weight: 700; }
.trace-path { display: flex; align-items: stretch; gap: 6px; list-style: none; padding: 0 0 4px; margin: 0 0 14px; overflow: auto; }
.trace-step { flex: 1; min-width: 118px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 13px; box-shadow: var(--shadow-sm); }
.trace-step.is-quiet { opacity: .72; }
.trace-step strong { display: block; font-size: 1.25rem; font-weight: 800; }
.trace-step small, .step-label { display: block; color: var(--muted); font-size: 12px; }
.step-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-100); color: var(--brand); margin-bottom: 8px; }
.trace-join { display: grid; place-items: center; color: #a5b6ba; flex: none; }
.trace-columns { display: grid; grid-template-columns: 1.15fr .9fr 1fr; gap: 14px; }
.trace-card, .trace-place { border-top: 1px solid var(--line); padding: 11px 0; }
.trace-card:first-of-type, .trace-place:first-of-type { border-top: 0; }
.trace-metrics { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; font-size: 13px; }
.trace-bar { height: 8px; background: var(--brand-100); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.trace-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-500), var(--brand)); }
.trace-time { list-style: none; margin: 0; padding: 0; }
.trace-time li { display: grid; grid-template-columns: 16px 1fr; gap: 10px; position: relative; }
.trace-time li::before { content: ""; position: absolute; inset-inline-start: 5px; top: 16px; bottom: -4px; width: 2px; background: var(--line); }
.trace-time li:last-child::before { display: none; }
.trace-time .dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 14px; background: var(--brand-500); box-shadow: 0 0 0 4px #e7f4f4; }
.trace-time .dot.out { background: var(--danger); box-shadow: 0 0 0 4px #fde8e8; }
.trace-event { background: var(--surface-2); border-radius: 13px; padding: 10px 12px; margin-bottom: 10px; }
.qty-in { color: var(--ok); font-weight: 700; }
.qty-out { color: var(--danger); font-weight: 700; }

/* ---------- Backup ---------- */
.backup-hero {
    display: flex; justify-content: space-between; gap: 18px; align-items: center; flex-wrap: wrap;
    background:
        radial-gradient(120% 150% at 100% 0%, rgba(232, 163, 61, .3), transparent 55%),
        linear-gradient(135deg, #0c3a43, #14707a); color: #fff;
    border-radius: var(--radius-lg); padding: 24px; margin-bottom: 16px; box-shadow: var(--shadow-lg);
}
.backup-hero h1 { margin: 0; font-size: 1.6rem; font-weight: 800; }
.backup-hero p { margin: 8px 0 0; color: #cfe3e4; max-width: 42rem; }
.backup-go {
    background: linear-gradient(135deg, #f2b552, var(--accent)); color: #2a1a06; border: 0;
    border-radius: 12px; padding: 12px 20px; font-weight: 800; white-space: nowrap;
    box-shadow: 0 12px 26px -14px rgba(232, 163, 61, .85);
}
.backup-go:hover { color: #2a1a06; filter: brightness(1.04); }
.stat-grid.backup-stats { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.backup-copy {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    background: var(--surface-2); border: 1px solid var(--line);
    border-radius: 14px; padding: 12px 14px; margin-bottom: 8px;
}
.backup-copy .mark {
    width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
    background: #fff; color: var(--brand); border: 1px solid var(--line); flex: none; font-size: 1.15rem;
}
.backup-meta { color: var(--muted); font-size: 13px; }
.backup-dl { border-radius: 999px; white-space: nowrap; }
.qty-form { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.qty-form span { min-width: 7.5rem; color: var(--muted); font-size: 12px; }
.qty-form input { width: 5.2rem; }

/* ---------- Misc ---------- */
.alert-shortage {
    background: #fdf0ee; border: 1px solid #f0c4be; color: #7a241c;
    border-radius: 14px; padding: 12px 14px;
}
.print-sheet { max-width: 900px; margin: 20px auto; }
.print-head { display: flex; justify-content: space-between; border-bottom: 2px solid var(--brand); margin-bottom: 16px; padding-bottom: 8px; }

/* Mobile bottom nav */
.mobile-nav {
    display: none;
    position: fixed; z-index: 24; inset-inline: 0; bottom: 0;
    background: rgba(255, 255, 255, .94);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -10px 30px -22px rgba(16, 42, 51, .5);
}
.mobile-nav-inner { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: end; }
.mobile-nav a, .mobile-nav button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: 0; background: transparent; color: var(--muted);
    font-size: 10.5px; font-weight: 600; padding: 5px 2px; border-radius: 12px;
    text-align: center; line-height: 1.1; min-width: 0;
}
.mobile-nav a i, .mobile-nav button i { font-size: 1.2rem; }
.mobile-nav a.active, .mobile-nav button.active { color: var(--brand); }
.mobile-nav a.active i { color: var(--brand); }
.mobile-nav .nav-pos-mobile i {
    width: 44px; height: 44px; margin-top: -18px; margin-bottom: 2px;
    border-radius: 50%; display: grid; place-items: center;
    background: linear-gradient(140deg, #f6c778, var(--accent)); color: #2a1a06;
    font-size: 1.25rem; box-shadow: 0 10px 22px -10px rgba(232, 163, 61, .9);
    border: 3px solid #fff;
}
.mobile-nav .nav-pos-mobile { color: var(--brand); font-weight: 700; }
.mobile-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 29;
    background: rgba(6, 23, 28, .5);
    backdrop-filter: blur(2px);
    opacity: 0; transition: opacity .22s ease;
    pointer-events: none;
}
.mobile-overlay.show { opacity: 1; pointer-events: auto; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
    .trace-columns { grid-template-columns: 1fr; }
    .trace-join { display: none; }
}

@media (max-width: 992px) {
    :root { --topbar-h: 60px; }
    .sidebar {
        position: fixed; z-index: 30; top: 0; bottom: 0;
        inset-inline-start: 0; inset-inline-end: auto;
        width: min(84vw, 310px); height: 100dvh;
        box-shadow: var(--shadow-lg);
        transition: transform .26s cubic-bezier(.22, .61, .36, 1);
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
        visibility: hidden;
        pointer-events: none;
    }
    html[dir="rtl"] .sidebar { transform: translateX(110%); }
    html[dir="ltr"] .sidebar { transform: translateX(-110%); }
    .sidebar.open {
        transform: none !important;
        visibility: visible;
        pointer-events: auto;
    }
    .sidebar-close { display: grid; place-items: center; }
    .mobile-overlay.show { display: block; }
    body.drawer-open { overflow: hidden; }

    .topbar-toggle { display: grid; }
    .search-form { display: none; }
    .top-actions { gap: 6px; }
    .user-chip .user-name { display: none; }
    html[dir="rtl"] .user-chip { padding: 5px; }
    html[dir="ltr"] .user-chip { padding: 5px; }
    .content { padding-bottom: calc(var(--mobile-nav-h) + 28px + env(safe-area-inset-bottom)); }
    .mobile-nav { display: block; }

    .pos { grid-template-columns: 1fr; }
    .pos-ticket { display: none; position: static; top: auto; }
    .pos-ticket.is-mobile-open {
        display: block; position: fixed; z-index: 27;
        inset-inline: 0; bottom: 0; top: auto; margin: 0;
        max-height: 88dvh; overflow-y: auto;
        border-radius: 24px 24px 0 0;
        padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
        box-shadow: 0 -24px 60px -24px rgba(6, 30, 36, .55);
        animation: posSheet .24s cubic-bezier(.22, .61, .36, 1);
    }
    .pos-ticket.is-mobile-open::before {
        content: ""; position: sticky; top: -12px; display: block;
        width: 46px; height: 5px; border-radius: 99px; background: #d7e2e5;
        margin: -10px auto 14px;
    }
    .pos-sheet-close { display: grid; }
    body.pos-sheet-open { overflow: hidden; }
    body.pos-sheet-open .pos-sheet-backdrop {
        display: block; position: fixed; inset: 0; z-index: 26;
        background: rgba(6, 30, 36, .48); backdrop-filter: blur(2px);
    }
    .pos-ticket.is-mobile-open { z-index: 27; }
    .pos-mobile-bar { display: flex; bottom: calc(var(--mobile-nav-h) + 10px + env(safe-area-inset-bottom)); }
    .pos { padding-bottom: 76px; }
    .pos-lines { max-height: none; overflow: visible; }
    .pos-table, .pos-table tbody { display: block; }
    .pos-table tr {
        display: grid; grid-template-columns: 1fr 1fr auto;
        grid-template-areas: "name name remove" "qty price total";
        gap: 5px 8px; padding: 9px 0; border-bottom: 1px solid var(--line);
    }
    .pos-table td { display: block; padding: 0; border: 0; }
    .pos-table td:nth-child(1) { grid-area: name; }
    .pos-table td:nth-child(2) { grid-area: qty; }
    .pos-table td:nth-child(3) { grid-area: price; }
    .pos-table td:nth-child(3) input { width: 100%; }
    .pos-table td:nth-child(4) { grid-area: total; align-self: center; text-align: end; font-weight: 700; font-size: 13px; }
    .pos-table td:nth-child(5) { grid-area: remove; align-self: start; justify-self: end; }
    .pos-table td:nth-child(5) .btn {
        width: 32px; height: 32px; padding: 0; border-radius: 9px;
        display: grid; place-items: center; font-size: 19px; line-height: 1;
    }
    .pos-table .pos-qty { justify-content: flex-start; }
    .filters { padding: 10px; }
    .filters .form-control, .filters .form-select { flex: 1 1 100%; min-width: 0; }
    .filters .btn { flex: 1 1 100%; }
    .panel { border-radius: 18px; }
    .hero-card { border-radius: 18px; }
    .stat-card:hover { transform: none; }
    .point-card:hover { transform: none; }
    .table > :not(caption) > * > * { padding: .6rem .65rem; }
    .table tbody td { font-size: 13px; }
}

@keyframes posSheet {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

@media (max-width: 768px) {
    body { font-size: 14.5px; }
    .auth-shell { grid-template-columns: 1fr; }
    .auth-visual { display: none; }
    .auth-card { padding: 28px 22px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 13px 14px; border-radius: 14px; }
    .stat-card .stat-icon { width: 36px; height: 36px; border-radius: 11px; font-size: 1rem; margin-bottom: 7px; }
    .stat-card strong { font-size: 1.15rem; }
    .point-grid { grid-template-columns: 1fr; gap: 10px; }
    .pos-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .pos-card { min-height: 110px; padding: 11px; }
    .pos-catalog-head { flex-wrap: wrap; }
    .pos-warehouse { width: 100%; justify-content: space-between; }
    .pos-warehouse select { min-width: 0; flex: 1; }
    .panel-head { align-items: flex-start; }
    .hero-card .hero-actions { width: 100%; }
    .hero-card .hero-actions .btn { flex: 1 1 auto; }
    .trace-hero { padding: 16px; }
    .backup-hero { padding: 18px; }

    .table-cards-wrap { border: 0; background: transparent; overflow: visible; }
    .table-cards, .table-cards tbody { display: block; }
    .table-cards thead { display: none; }
    .table-cards tbody tr {
        display: block; margin-bottom: 10px; padding: 12px 14px;
        border: 1px solid var(--line); border-radius: 16px;
        background: #fff; box-shadow: var(--shadow-sm);
    }
    .table-cards tbody tr:hover { background: #fff; }
    .table-cards tbody td {
        display: flex; align-items: center; justify-content: space-between;
        gap: 14px; padding: 5px 0; border: 0; text-align: end;
    }
    .table-cards tbody td::before {
        content: attr(data-label); flex: none;
        color: var(--muted); font-size: 12px; font-weight: 600; text-align: start;
    }
    .table-cards tbody td[data-label=""]::before { display: none; }
    .table-cards tbody td[colspan] { justify-content: center; text-align: center; color: var(--muted); }
    .table-cards tbody td.cell-block { display: block; text-align: start; }
    .table-cards tbody td.cell-block::before { display: block; margin-bottom: 6px; }
    .table-cards tbody td.cell-actions {
        justify-content: flex-end; gap: 10px;
        margin-top: 4px; padding-top: 9px; border-top: 1px dashed var(--line);
    }
    .table-cards .qty-form { margin-bottom: 4px; }
    .table-cards .qty-form span { min-width: 0; flex: 1 1 auto; }
    .table-cards .qty-form input { width: 4.2rem; }
}

@media (max-width: 480px) {
    .content { padding-inline: 12px; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .stat-card strong { font-size: 1.05rem; white-space: nowrap; }
    .pos-grid { grid-template-columns: 1fr 1fr; }
    .pos-card strong { font-size: 13px; }
    .modal-dialog { margin: .5rem; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ============================================================
   Official invoice template (print) — preserved
   ============================================================ */
.eemsp {
    position: relative;
    background: #fff;
    color: #1a1a1a;
    border: 1.5px solid #222;
    padding: 12px 14px 10px;
    margin: 0 auto 16px;
    max-width: 860px;
    direction: ltr;
    font-size: 13px;
}
.eemsp-head { display: grid; grid-template-columns: 86px 1fr; gap: 6px; align-items: start; }
.eemsp-logo svg { width: 82px; height: 74px; display: block; }
.eemsp-id { text-align: center; }
.eemsp-id h1, .eemsp-id .latin { color: #c62828; margin: 0; font-weight: 800; }
.eemsp-id h1 { font-size: 1.15rem; line-height: 1.45; }
.eemsp-id .latin { letter-spacing: .03em; font-size: .95rem; margin-top: 1px; }
.eemsp-contacts {
    display: flex; justify-content: space-between; gap: 12px; align-items: flex-start;
    margin-top: 6px; text-align: start; font-size: 12px; font-weight: 700;
}
.eemsp-contacts .phones, .eemsp-contacts .places { display: flex; flex-direction: column; gap: 1px; }
.eemsp-contacts .ar { text-align: right; font-weight: 800; }
.eemsp-banner {
    display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center;
    border: 1.5px solid #222; margin-top: 8px; padding: 6px 8px;
}
.eemsp-no, .eemsp-when div { display: flex; align-items: baseline; gap: 6px; }
.eemsp-no strong, .eemsp-when strong {
    min-width: 88px; border-bottom: 1px solid #222; font-weight: 700; padding: 0 4px;
}
.eemsp-title { text-align: center; color: #c62828; font-weight: 800; line-height: 1.1; }
.eemsp-title span { display: block; font-size: 1.35rem; }
.eemsp-title small { letter-spacing: .12em; font-size: .78rem; }
.eemsp-when { justify-self: end; }
.eemsp-when em { font-style: normal; font-weight: 700; }
.eemsp-who {
    display: flex; align-items: baseline; gap: 10px;
    border: 1.5px solid #222; border-top: 0; padding: 6px 8px;
}
.eemsp-who strong { flex: 1; border-bottom: 1px solid #222; text-align: center; font-size: 1.05rem; }
.eemsp-who .ar { font-weight: 700; }
.eemsp-table { width: 100%; border-collapse: collapse; }
.eemsp-table th, .eemsp-table td { border: 1px solid #222; padding: 3px 6px; vertical-align: middle; }
.eemsp-table th { text-align: center; font-weight: 700; background: #fff; }
.eemsp-table th .ar, .eemsp-table th .en { display: block; }
.eemsp-table th .en { font-size: 11px; font-weight: 600; }
.eemsp-table th.desc, .eemsp-table th.desc .ar, .eemsp-table th.desc .en { color: #c62828; }
.eemsp-table th.amt .sub { display: flex; justify-content: space-between; border-top: 1px solid #222; margin-top: 3px; padding-top: 2px; font-size: 11px; }
.eemsp-table td.desc { text-align: right; direction: rtl; }
.eemsp-table tbody td { height: 28px; }
.eemsp-table td:nth-child(1) { width: 16%; text-align: center; }
.eemsp-table td:nth-child(3), .eemsp-table td:nth-child(4), .eemsp-table td:nth-child(5) { text-align: center; width: 12%; }
.eemsp-table td:nth-child(5) { width: 16%; font-weight: 700; }
.eemsp-grid { position: relative; }
.eemsp-grid::after {
    content: "EEMSP";
    position: absolute; inset: 0; display: grid; place-items: center;
    font-size: 4.5rem; font-weight: 800; letter-spacing: .12em;
    color: rgba(198, 40, 40, .07); pointer-events: none;
}
.eemsp-foot { border: 1.5px solid #222; border-top: 0; }
.eemsp-sum {
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
    gap: 8px; padding: 6px 10px; border-top: 1px solid #222; font-weight: 700;
}
.eemsp-sum:first-child { border-top: 0; }
.eemsp-sum strong { min-width: 88px; text-align: center; font-size: 1.15rem; }
.eemsp-sum span:last-child { text-align: right; }
.eemsp-sum.due strong { color: #9b2c2c; }
.eemsp-signs { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 12px 10px 8px; }
.eemsp-signs div { display: flex; align-items: baseline; gap: 8px; }
.eemsp-signs em { font-style: normal; font-weight: 700; }
.eemsp-signs i { flex: 1; border-bottom: 1px solid #222; height: 1px; }
.eemsp.is-cancelled .eemsp-void {
    position: absolute; inset: 38% 10% auto; text-align: center;
    color: rgba(155, 44, 44, .72); border: 4px solid rgba(155, 44, 44, .72);
    font-size: 2.4rem; font-weight: 800; transform: rotate(-8deg); padding: 4px 0;
    pointer-events: none;
}

/* ---------- Print ---------- */
@media print {
    .topbar, .sidebar, .mobile-nav, .mobile-overlay, .pos-mobile-bar, .no-print { display: none !important; }
    .content { padding: 0; max-width: none; }
    body, .paper-body { background: #fff; }
    .paper-sheet, .print-sheet { max-width: none; margin: 0; }
    .panel { border: 0; box-shadow: none; padding: 0; }
    .table-responsive { border: 0; overflow: visible; border-radius: 0; }
    .eemsp { max-width: none; margin: 0; box-shadow: none; }
    @page { size: A4; margin: 8mm; }
}
