﻿/* خط Cairo (ملف داخل المشروع - يعمل بدون إنترنت). الترخيص: Content/fonts/Cairo-OFL.txt */
@font-face {
    font-family: "Cairo";
    src: url("fonts/Cairo.woff") format("woff");
    font-weight: 200 1000;
    font-style: normal;
    font-display: swap;
}

/* ملف التنسيق الوحيد للنظام - بدون أي مكتبات خارجية */
:root {
    --side: #0f2233;
    --side-2: #1a3247;
    --side-text: #c3d0dc;
    --accent: #0e7c86;
    --accent-dark: #0a5f67;
    --bg: #f3f5f7;
    --line: #dfe4ea;
    --ink: #1f2933;
    --muted: #6b7783;
    --danger: #d64545;
    --card: #fff;
    --hover: #e8ecf0;
    --zebra: #fafbfc;
    --accent-soft: #dff3f4;
    --accent-soft-2: #e8f6f7;
    --accent-ring: rgba(14, 124, 134, .2);
}

/* ---------- لون النظام (من إعدادات النظام): class على body ---------- */
body.theme-blue   { --accent: #1d6fd6; --accent-dark: #1557ad; --side: #0f1f3a; --side-2: #1a3157; --accent-soft: #e1ecfb; --accent-soft-2: #edf4fd; --accent-ring: rgba(29, 111, 214, .2); }
body.theme-green  { --accent: #1f8f5a; --accent-dark: #176f45; --side: #10261c; --side-2: #1b3a2c; --accent-soft: #e0f3e8; --accent-soft-2: #ecf8f1; --accent-ring: rgba(31, 143, 90, .2); }
body.theme-purple { --accent: #7a4bc4; --accent-dark: #5f38a0; --side: #1f1633; --side-2: #31234f; --accent-soft: #ece4f8; --accent-soft-2: #f4eefb; --accent-ring: rgba(122, 75, 196, .2); }
body.theme-red    { --accent: #c0392b; --accent-dark: #992d22; --side: #2a1414; --side-2: #422020; --accent-soft: #fbe6e3; --accent-soft-2: #fdf1ef; --accent-ring: rgba(192, 57, 43, .2); }
body.theme-orange { --accent: #e8731a; --accent-dark: #c95f10; --side: #1c2733; --side-2: #26333f; --accent-soft: #fdebdb; --accent-soft-2: #fdf1e6; --accent-ring: rgba(232, 115, 26, .2); }
body.theme-gray   { --accent: #475569; --accent-dark: #334155; --side: #111827; --side-2: #1f2937; --accent-soft: #e5e9ef; --accent-soft-2: #f1f4f7; --accent-ring: rgba(71, 85, 105, .2); }

/* ---------- الوضع الليلي: data-theme على html (الزر في الشريط العلوي، والاختيار محفوظ في المتصفح) ---------- */
html[data-theme="dark"] {
    --bg: #0f1720; --card: #17212b; --line: #2b3947; --ink: #e6edf3; --muted: #93a1b0;
    --hover: #22303d; --zebra: rgba(255, 255, 255, .025);
    color-scheme: dark;
}
html[data-theme="dark"] body { --accent-soft: rgba(255, 255, 255, .09); --accent-soft-2: rgba(255, 255, 255, .06); }
html[data-theme="dark"] .badge-accent, html[data-theme="dark"] a.chip-link, html[data-theme="dark"] .btn-add,
html[data-theme="dark"] a.tile:hover, html[data-theme="dark"] .find-item { color: #8fd8de; }
html[data-theme="dark"] .badge-ok { background: rgba(46, 158, 91, .2); color: #7bd9a3; }
html[data-theme="dark"] .badge-warn, html[data-theme="dark"] a.chip-warn { background: rgba(240, 165, 0, .18); color: #f3c969; }
html[data-theme="dark"] .badge-off { background: rgba(255, 255, 255, .08); }
html[data-theme="dark"] .badge-danger { background: rgba(214, 69, 69, .2); color: #f19a9a; }
html[data-theme="dark"] .alert-warning, html[data-theme="dark"] .card-warn { background: rgba(240, 165, 0, .1); border-color: rgba(240, 165, 0, .4); color: var(--ink); }
html[data-theme="dark"] .table tr.group-row td { background: rgba(255, 255, 255, .05); }
html[data-theme="dark"] .slip-net { background: #000; }
html[data-theme="dark"] .logo-preview { background: #fff; }
@media print {
    html[data-theme="dark"] { --bg: #fff; --card: #fff; --line: #dfe4ea; --ink: #1f2933; --muted: #6b7783; --zebra: #fff; color-scheme: light; }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;
    font-size: 15px; line-height: 1.6;
    background: var(--bg); color: var(--ink);
}
h1, h2, h3, p { margin-top: 0; }
button, input, select, textarea { font: inherit; }

.ic {
    width: 1.2em; height: 1.2em; flex-shrink: 0; vertical-align: -.22em;
    fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- عناصر عامة ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 16px; border: 1px solid transparent; border-radius: 8px;
    background: var(--card); color: var(--ink); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-accent:hover, .btn-accent:focus { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-light { background: var(--bg); border-color: var(--line); }
.btn-light:hover { background: var(--hover); }
.btn-danger-outline { border-color: var(--danger); color: var(--danger); }
.btn-danger-outline:hover { background: var(--danger); color: #fff; }

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 4px; font-weight: 600; font-size: 14px; }
.input {
    display: block; width: 100%; padding: 8px 12px;
    border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink);
}
.input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.input-icon { position: relative; }
.input-icon .ic { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-icon .input { padding-inline-start: 38px; }

.alert { padding: 12px 16px; border-radius: 8px; border: 1px solid; }
.alert-warning { background: #fff7e0; border-color: #f3d98b; color: #6b5200; }

/* ---------- الهيكل ---------- */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.sidebar {
    background: var(--side); color: var(--side-text);
    width: 250px; flex-shrink: 0;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 16px; color: #fff; text-decoration: none;
    font-weight: 700; font-size: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.brand .ic { color: var(--accent); width: 26px; height: 26px; }

.menu { padding: 10px 8px 24px; }
.menu-home, .menu-group {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 10px 12px; border: 0; border-radius: 8px; background: none;
    color: var(--side-text); text-decoration: none; text-align: start; cursor: pointer;
}
.menu-home:hover, .menu-group:hover { background: var(--side-2); color: #fff; }
.menu-home.active { background: var(--accent); color: #fff; }
.menu-group .chev { margin-inline-start: auto; width: 14px; height: 14px; transition: transform .2s; }
.menu-group.open { color: #fff; }
.menu-group.open .chev { transform: rotate(180deg); }
.menu-sub { display: none; padding-bottom: 6px; }
.menu-group.open + .menu-sub { display: block; }

.menu-link {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 12px; margin-inline-start: 26px; border-radius: 0 6px 6px 0;
    color: var(--side-text); text-decoration: none; font-size: 14px;
    border-inline-start: 2px solid rgba(255, 255, 255, .1);
}
[dir="rtl"] .menu-link { border-radius: 6px 0 0 6px; }
a.menu-link:hover { background: var(--side-2); color: #fff; }
.menu-link.active { color: #fff; border-inline-start-color: var(--accent); background: var(--side-2); }
.menu-link.soon { opacity: .5; cursor: default; }
.soon small { font-size: 11px; }

.topbar {
    display: flex; align-items: center; gap: 12px;
    background: var(--card); border-bottom: 1px solid var(--line);
    padding: 10px 20px; position: sticky; top: 0; z-index: 10;
}
.menu-btn { display: none; padding: 6px 10px; }
.page-title { font-size: 19px; font-weight: 700; margin: 0; flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 8px; }
.chip { background: var(--bg); border-radius: 20px; padding: 4px 12px; font-size: 13px; color: var(--muted); white-space: nowrap; }

.content { padding: 20px; }
.backdrop { display: none; }

/* موبايل وتابلت: القائمة تنزلق من الجنب */
@media (max-width: 991px) {
    .menu-btn { display: inline-flex; }
    .sidebar {
        position: fixed; top: 0; bottom: 0; inset-inline-start: 0; z-index: 40;
        transform: translateX(100%); transition: transform .25s;
    }
    [dir="ltr"] .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: none; }
    .backdrop.show { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .45); }
}
@media (max-width: 575px) {
    .content { padding: 16px; }
    .topbar { padding: 10px 16px; }
    .chip { display: none; }
}

/* ---------- الرئيسية ---------- */
.welcome { font-size: 17px; margin-bottom: 20px; }
.tiles-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; color: var(--muted); margin: 22px 0 10px; }
.tiles-title .ic { color: var(--accent); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.tile {
    display: flex; flex-direction: column; justify-content: center;
    min-height: 62px; padding: 10px 14px;
    background: var(--card); border: 1px solid var(--line); border-radius: 10px;
    color: var(--ink); text-decoration: none; font-weight: 600;
    border-inline-start: 3px solid var(--accent);
}
a.tile:hover { border-color: var(--accent); color: var(--accent-dark); box-shadow: 0 2px 8px rgba(0, 0, 0, .06); }
.tile.soon { border-inline-start-color: var(--line); color: var(--muted); opacity: .8; font-weight: 400; }

/* ---------- تسجيل الدخول ---------- */
.login-body {
    display: flex; align-items: center; justify-content: center; padding: 16px;
    background: linear-gradient(135deg, var(--side) 0%, var(--side-2) 100%);
}
.login-body form { width: 100%; max-width: 380px; }
.login-card { background: var(--card); border-radius: 14px; padding: 32px 28px; box-shadow: 0 12px 40px rgba(0, 0, 0, .3); }
.login-logo {
    width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%;
    background: var(--accent); color: #fff;
    display: flex; align-items: center; justify-content: center;
}
.login-logo .ic { width: 34px; height: 34px; }
.login-title { font-size: 20px; font-weight: 700; text-align: center; margin: 0 0 4px; }
.login-sub { text-align: center; color: var(--muted); margin-bottom: 24px; }

/* ---------- رسائل Popup ---------- */
.msg-overlay {
    position: fixed; inset: 0; z-index: 100; padding: 16px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, .5);
}
.msg-box {
    width: 100%; max-width: 340px; padding: 24px 20px; text-align: center;
    background: var(--card); border-radius: 14px; border-top: 5px solid var(--accent);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .3);
}
.msg-box .msg-icon { width: 46px; height: 46px; margin-bottom: 6px; }
.msg-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.msg-text { color: var(--muted); margin-bottom: 18px; white-space: pre-line; overflow-wrap: anywhere; }
.msg-box .btn { min-width: 110px; }
.msg-warning { border-top-color: #f0a500; } .msg-warning .msg-icon { color: #f0a500; }
.msg-error { border-top-color: var(--danger); } .msg-error .msg-icon { color: var(--danger); }
.msg-success { border-top-color: #2e9e5b; } .msg-success .msg-icon { color: #2e9e5b; }
.msg-info { border-top-color: #2f7fd1; } .msg-info .msg-icon { color: #2f7fd1; }

/* ---------- شاشات البيانات ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 16px; }
.form-grid .field { margin: 0; min-width: 0; }
.check { display: flex; align-items: center; gap: 6px; }
.form-grid .check { padding-top: 28px; }
.check input { width: 17px; height: 17px; }
.check-grid .check { padding-top: 0; }
input[type=checkbox] { accent-color: var(--accent); }
.check label { margin: 0; font-weight: 400; }
.form-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; align-items: center; }
.toolbar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .field { margin: 0; }
.toolbar .input { min-width: 120px; }
.hint { font-size: 13px; color: var(--muted); }
.input-sm { padding: 4px 8px; font-size: 14px; }
.input[disabled], .input[readonly] { background: var(--bg); color: var(--muted); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; border: 0; }
.table th {
    background: var(--bg); text-align: start; padding: 8px 10px; font-weight: 600;
    white-space: nowrap; border: 0; border-bottom: 1px solid var(--line);
}
.table td { padding: 7px 10px; border: 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tfoot td, .table tr.total td { font-weight: 700; background: var(--bg); border-top: 1px solid var(--line); }
.table tr.group-row td { background: #fbf3ea; font-weight: 700; }
.table .center, .table th.center { text-align: center; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--danger); }
.strong { font-weight: 700; }
.actions { display: flex; gap: 6px; white-space: nowrap; }
.empty { padding: 20px; text-align: center; color: var(--muted); }

.badge { display: inline-block; padding: 1px 10px; border-radius: 20px; font-size: 12px; white-space: nowrap; }
.badge-ok { background: #e3f4ea; color: #1d7a43; }
.badge-off { background: #eceff2; color: var(--muted); }
.badge-warn { background: #fff3d6; color: #8a6100; }
.badge-accent { background: var(--accent-soft); color: var(--accent-dark); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font-size: 20px; font-weight: 700; }

/* ---------- مفردات المرتب (للطباعة) ---------- */
.slip-body { background: var(--bg); padding: 20px; }
.slip { max-width: 720px; margin: 0 auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.slip-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; border-bottom: 2px solid var(--ink); padding-bottom: 12px; margin-bottom: 16px; }
.slip-head h1 { font-size: 20px; margin: 0; }
.slip-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 6px 20px; margin-bottom: 16px; }
.slip-info span { color: var(--muted); }
.slip h2 { font-size: 15px; margin: 18px 0 6px; }
.slip-net { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; padding: 12px 16px; background: var(--ink); color: #fff; border-radius: 10px; font-size: 18px; font-weight: 700; }
.slip-sign { display: flex; justify-content: space-between; margin-top: 40px; color: var(--muted); }
@media print {
    .no-print { display: none !important; }
    .slip-body { background: var(--card); padding: 0; }
    .slip { border: 0; padding: 0; max-width: none; }
    .slip-net { background: var(--card); color: #000; border: 2px solid #000; }
}

/* طباعة أي شاشة: المحتوى فقط بدون القائمة والأزرار */
@media print {
    .sidebar, .topbar, .backdrop { display: none !important; }
    body { background: var(--card); }
    .content { padding: 0; }
    .card { border: 0; padding: 0; }
    .table-wrap { overflow: visible; }
}

/* عمودين جنب بعض (يتحولوا لعمود واحد في الموبايل) */
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.cols-2 > .card { margin-bottom: 0; }
.cols-2 { margin-bottom: 16px; }
@media (max-width: 800px) { .cols-2 { grid-template-columns: 1fr; } }
.toolbar .grow { flex: 1; min-width: 160px; }
.table tr.selected td { background: var(--accent-soft-2); }
.muted { color: var(--muted); }
.cols-2 > * { min-width: 0; }
/* عناصر الإدخال المباشرة داخل شريط الأدوات تأخذ عرضها الطبيعي، و grow يملأ الباقي */
.toolbar > .input { width: auto; flex: 0 1 auto; max-width: 100%; }
.toolbar > .input.grow { flex: 1 1 160px; }

/* ---------- أمر الشغل ---------- */
.toolbar .field.grow { flex: 1 1 220px; min-width: 0; }
.toolbar .field.narrow { width: 110px; }
.toolbar .field.narrow .input { min-width: 0; }
textarea.input { resize: vertical; min-height: 70px; }
a.badge { text-decoration: none; cursor: pointer; }
a.badge.aspNetDisabled { cursor: default; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photo { border: 1px solid var(--line); border-radius: 10px; padding: 6px; text-align: center; }
.photo img { width: 100%; height: 120px; object-fit: cover; border-radius: 6px; display: block; }
.photo-caption { font-size: 12px; color: var(--muted); min-height: 18px; margin: 4px 0; overflow-wrap: anywhere; }
input[type=file] { max-width: 100%; }

/* ---------- طباعة أمر الشغل ---------- */
.slip-box { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 8px; min-height: 44px; white-space: pre-line; }
.slip-totals { margin-inline-start: auto; width: 280px; max-width: 100%; }

/* ---------- نافذة الاختيارات (الخطوة التالية) ---------- */
.msg-box.msg-choices { max-width: 400px; }
.choice-list { display: grid; gap: 8px; }
.choice-list .btn { width: 100%; justify-content: center; }

/* ---------- مقاسات طباعة الفاتورة ---------- */
.size-tabs { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.size-tabs a { padding: 7px 14px; text-decoration: none; color: var(--ink); background: var(--card); font-weight: 600; }
.size-tabs a + a { border-inline-start: 1px solid var(--line); }
.size-tabs a.active { background: var(--ink); color: #fff; }
.slip-logo { max-height: 80px; max-width: 200px; display: block; margin-bottom: 6px; }
.slip-brand { display: flex; align-items: center; gap: 14px; }
.slip-brand .slip-logo { margin-bottom: 0; }
.slip-footer { margin: 16px 0 0; padding-top: 10px; border-top: 1px dashed var(--line); text-align: center; }
.slip-footer p { margin: 0 0 4px; white-space: pre-line; }
.slip-footer .hint { margin: 0; }

.slip.size-a4 { max-width: 210mm; }
.slip.size-a5 { max-width: 148mm; padding: 16px; font-size: 13px; }
.slip.size-a5 .slip-head h1 { font-size: 17px; }
.slip.size-a5 .table th, .slip.size-a5 .table td { padding: 5px 6px; }
.slip.size-a5 .slip-logo { max-height: 60px; max-width: 150px; }
.slip.size-a5 .slip-sign { margin-top: 24px; }

.slip.size-receipt { max-width: 80mm; padding: 8px; font-size: 12px; line-height: 1.45; border-radius: 0; color: #000; }
.slip.size-receipt .slip-head { display: block; text-align: center; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px dashed #000; }
.slip.size-receipt .slip-head > div { text-align: center !important; }
.slip.size-receipt .slip-brand { display: block; }
.slip.size-receipt .slip-logo { max-height: 55px; max-width: 60mm; margin: 0 auto 4px; }
.slip.size-receipt .slip-head h1 { font-size: 15px; }
.slip.size-receipt .slip-info { display: block; margin-bottom: 6px; }
.slip.size-receipt .slip-info span, .slip.size-receipt .hint, .slip.size-receipt .slip-sign { color: #000; }
.slip.size-receipt .table { font-size: 12px; }
.slip.size-receipt .table th, .slip.size-receipt .table td { padding: 3px 2px; border-color: #000; background: none; }
.slip.size-receipt .col-idx, .slip.size-receipt .col-disc, .slip.size-receipt .unit { display: none; }
.slip.size-receipt .slip-totals { width: 100%; margin-top: 6px !important; }
.slip.size-receipt .slip-totals tr.total td { font-size: 14px; font-weight: 700; border-top: 1px dashed #000; border-bottom: 1px dashed #000; }
.slip.size-receipt .badge { background: none; border: 1px solid #000; color: #000; padding: 0 6px; }
.slip.size-receipt .slip-footer { margin-top: 8px; padding-top: 6px; border-top-color: #000; }
.slip.size-receipt .slip-sign { display: block; margin-top: 8px; text-align: center; }
.slip.size-receipt .slip-sign .sign-line { display: none; }
.logo-preview { max-height: 90px; max-width: 220px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: var(--card); display: block; }
@media print {
    .slip.size-receipt { max-width: 76mm; margin: 0; padding: 0; }
    .slip.size-a5, .slip.size-a4 { max-width: none; }
}

/* ---------- زر الإضافة (+) بجانب القوائم ---------- */
.with-add { display: flex; gap: 6px; align-items: stretch; }
.with-add > .input { flex: 1 1 auto; min-width: 0; }
.btn-add { flex: 0 0 auto; padding: 0 12px; font-size: 20px; font-weight: 700; line-height: 1; color: var(--accent-dark); }
.btn-add:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* نافذة التسجيل السريع (iframe فوق الشاشة) */
.frame-overlay {
    position: fixed; inset: 0; z-index: 90; padding: 16px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, .55);
}
.frame-box {
    width: 100%; max-width: 1000px; height: 92vh; display: flex; flex-direction: column;
    background: var(--card); border-radius: 14px; overflow: hidden; box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
}
.frame-box.small { max-width: 420px; height: 250px; }
.frame-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 16px; background: var(--side); color: #fff; font-weight: 700;
}
.frame-head button { background: none; border: 0; color: #fff; font-size: 24px; line-height: 1; cursor: pointer; padding: 0 6px; }
.frame-box iframe { flex: 1; width: 100%; border: 0; background: var(--bg); }
@media (max-width: 700px) { .frame-overlay { padding: 0; } .frame-box { height: 100vh; border-radius: 0; } .frame-box.small { height: 320px; } }

/* الصفحة داخل نافذة التسجيل: بدون القائمة والشريط العلوي */
body.popup .sidebar, body.popup .topbar, body.popup .backdrop { display: none !important; }
body.popup .content { padding: 14px; }
.quick-body { background: var(--card); padding: 18px; }

/* ---------- واتساب / الضمان ---------- */
.btn-whatsapp { background: #1fa855; border-color: #1fa855; color: #fff; font-weight: 600; }
.btn-whatsapp:hover { background: #17863f; border-color: #17863f; color: #fff; }
.card-warn { border-inline-start: 4px solid #f0a500; background: #fffaf0; }
.slip-warranty { margin-top: 12px; padding: 8px 12px; border: 1px dashed var(--line); border-radius: 8px; font-size: 13px; }
.slip.size-receipt .slip-warranty { border-color: #000; border-radius: 0; padding: 4px; font-size: 11px; }

/* ---------- عدسة البحث بجانب القوائم ---------- */
.btn-find { flex: 0 0 auto; padding: 0 10px; color: var(--muted); }
.btn-find .ic { width: 17px; height: 17px; }
.btn-find:hover { color: var(--accent-dark); }
.toolbar > .with-add { flex: 0 1 auto; }
.toolbar > .with-add > .input { width: auto; }
.msg-box.find-box { max-width: 440px; text-align: start; border-top-color: var(--accent); padding: 16px; }
.find-list { display: grid; gap: 4px; max-height: 50vh; overflow-y: auto; margin: 10px 0; }
.find-item { text-align: start; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); cursor: pointer; font: inherit; }
.find-item:hover, .find-item:focus { border-color: var(--accent); background: var(--accent-soft-2); outline: 0; }
.find-item.current { border-color: var(--accent); font-weight: 700; }
.msg-box.find-box .find-close { width: 100%; }
.text-danger { color: var(--danger); }
a.chip-link { text-decoration: none; color: var(--accent-dark); background: var(--accent-soft); font-weight: 600; }

/* ---------- ملصقات الباركود ---------- */
.labels { display: flex; flex-wrap: wrap; gap: 4px; }
.labels .label {
    box-sizing: border-box; padding: 1.5mm; background: var(--card); border: 1px dashed var(--line); overflow: hidden;
    display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
    color: #000; line-height: 1.15; page-break-inside: avoid;
}
.label-company { font-size: 7pt; white-space: nowrap; overflow: hidden; max-width: 100%; }
.label-name { font-size: 8pt; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.labels .barcode { width: 100%; flex: 1 1 auto; min-height: 6mm; max-height: 14mm; display: block; direction: ltr; }
.labels .barcode[data-invalid]::after { content: "!"; }
.label-code { font-size: 7pt; letter-spacing: 1px; direction: ltr; }
.label-price { font-size: 9pt; font-weight: 700; }
@media print {
    .labels { gap: 0; }
    .labels.labels-roll { display: block; }
    .card.no-print { display: none !important; }
}
a.chip-warn { text-decoration: none; background: #fff3d6; color: #8a6100; font-weight: 600; }
.badge-danger { background: #fde4e4; color: #b02a2a; }

/* ---------- شريط تصدير الجداول ---------- */
.export-bar { display: flex; align-items: center; gap: 6px; justify-content: flex-end; margin: 0 0 8px; font-size: 13px; color: var(--muted); }

/* ---------- اللوحة الرئيسية ---------- */
.dash-stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 22px; }
a.stat-link { text-decoration: none; color: inherit; display: block; border-inline-start: 4px solid var(--accent); transition: box-shadow .15s; }
a.stat-link:hover { box-shadow: 0 3px 10px rgba(0, 0, 0, .08); }
a.stat-link .stat-value { font-size: 24px; }
a.stat-link.stat-ok { border-inline-start-color: #2e9e5b; } a.stat-link.stat-ok .stat-value { color: #1d7a43; }
a.stat-link.stat-warn { border-inline-start-color: #f0a500; } a.stat-link.stat-warn .stat-value { color: #8a6100; }
a.stat-link.stat-danger { border-inline-start-color: var(--danger); } a.stat-link.stat-danger .stat-value { color: var(--danger); }

/* ============================================================
   تطوير الشكل: الجداول، الرسائل الخفيفة، أيقونات الأزرار، الموبايل
   ============================================================ */

/* ---------- الجداول: صفوف متبادلة، تمييز عند المرور، ورأس ثابت مع التمرير ---------- */
.table tr:nth-child(even) td { background: var(--zebra); }
.table tr:hover td { background: var(--accent-soft-2); }
.table tfoot td, .table tr.total td, .table tr.total:hover td { background: var(--bg); }
.table-wrap { max-height: 72vh; overflow: auto; }
.table-wrap .table th { position: sticky; top: 0; z-index: 2; }
.slip .table tr:nth-child(even) td, .slip .table tr:hover td { background: none; }
@media print { .table-wrap { max-height: none; overflow: visible; } .table tr:nth-child(even) td { background: none; } }

/* ---------- الرسائل الخفيفة (تم الحفظ...) ---------- */
.toast-stack { position: fixed; bottom: 20px; inset-inline-start: 20px; z-index: 120; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 40px)); }
.toast {
    display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px;
    background: #1d7a43; color: #fff; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
    animation: toast-in .2s ease-out; cursor: pointer; overflow-wrap: anywhere;
}
.toast .ic { width: 20px; height: 20px; }
.toast.toast-info { background: #2f7fd1; }
.toast.hide { opacity: 0; transition: opacity .3s; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@media print { .toast-stack { display: none; } }

/* ---------- زر الوضع الليلي واختصارات الكيبورد ---------- */
.theme-toggle { width: 34px; height: 34px; padding: 0; border-radius: 50%; }
.theme-toggle .ic { width: 17px; height: 17px; }
.kbd { display: inline-block; padding: 0 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; font-size: 11px; background: var(--card); color: var(--muted); }
.menu-keys { padding: 0 16px 20px; font-size: 12px; color: var(--side-text); opacity: .75; line-height: 2; }
.menu-keys .kbd { background: transparent; border-color: rgba(255, 255, 255, .25); color: inherit; }

/* ---------- شاشة الدخول ---------- */
.login-body { background: radial-gradient(circle at 20% 15%, var(--accent) 0%, transparent 45%), linear-gradient(135deg, var(--side) 0%, var(--side-2) 100%); min-height: 100vh; }
.login-photo { display: block; max-width: 180px; max-height: 90px; margin: 0 auto 14px; }
.login-card { position: relative; }
.login-foot { text-align: center; color: rgba(255, 255, 255, .7); font-size: 12px; margin-top: 14px; }

/* ---------- اللوحة الرئيسية: بطاقات بأيقونات + رسم المبيعات ---------- */
a.stat-link { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-inline-start-width: 1px; border-inline-start-color: var(--line); border-radius: 14px; padding: 14px 16px; }
a.stat-link.stat-ok, a.stat-link.stat-warn, a.stat-link.stat-danger { border-inline-start-color: var(--line); }
.stat-bubble { width: 46px; height: 46px; border-radius: 12px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }
.stat-bubble .ic { width: 24px; height: 24px; }
.stat-ok .stat-bubble { background: rgba(46, 158, 91, .15); color: #2e9e5b; }
.stat-warn .stat-bubble { background: rgba(240, 165, 0, .18); color: #c98a00; }
.stat-danger .stat-bubble { background: rgba(214, 69, 69, .14); color: var(--danger); }
.chart-bars { display: flex; align-items: flex-end; gap: 12px; height: 170px; padding: 22px 4px 26px; }
.chart-bar { flex: 1; min-width: 0; position: relative; border-radius: 6px 6px 0 0; background: linear-gradient(var(--accent), var(--accent-dark)); min-height: 2px; }
.chart-bar b { position: absolute; top: -20px; left: 0; right: 0; text-align: center; font-size: 11px; white-space: nowrap; color: var(--ink); }
.chart-bar span { position: absolute; bottom: -24px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--muted); white-space: nowrap; }
.chart-bar.today { outline: 2px solid var(--accent-ring); outline-offset: 2px; }

/* ---------- لوحة الورشة ---------- */
.board { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: 12px; align-items: start; overflow-x: auto; padding-bottom: 6px; }
.board-col { background: var(--hover); border-radius: 14px; padding: 10px; min-width: 0; }
.board-col h3 { font-size: 14px; margin: 2px 6px 10px; display: flex; justify-content: space-between; align-items: center; }
.board-col h3 span { background: var(--card); border-radius: 20px; padding: 1px 10px; font-size: 12px; }
.board-card { display: block; text-decoration: none; color: var(--ink); background: var(--card); border-radius: 12px; padding: 11px 12px; margin-bottom: 9px; border-inline-start: 4px solid var(--accent); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.board-card:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, .14); }
.board-card .plate { font-weight: 800; font-size: 15px; }
.board-card .car { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-card .row { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.board-card .tech { background: var(--accent-soft); color: var(--accent-dark); border-radius: 20px; padding: 1px 9px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[data-theme="dark"] .board-card .tech { color: #8fd8de; }
.board-card.late { border-inline-start-color: var(--danger); } .board-card.late .due { color: var(--danger); font-weight: 700; }
.board-card.ok { border-inline-start-color: #2e9e5b; }
.board-card.wait { border-inline-start-color: #f0a500; }
.board-empty { text-align: center; color: var(--muted); font-size: 12px; padding: 10px 0; }

/* ---------- الموبايل: أزرار أكبر، والجداول تتحول لكروت ---------- */
@media (max-width: 640px) {
    .btn { padding: 10px 16px; }
    .btn-sm { padding: 7px 12px; font-size: 14px; }
    .input { padding: 10px 12px; font-size: 16px; }      /* 16px يمنع تكبير الصفحة في iPhone عند الكتابة */
    .toolbar > .btn, .form-actions > .btn { flex: 1 1 auto; }
    .board { grid-template-columns: repeat(5, 78vw); }
    .table-wrap { max-height: none; }

    table.as-cards, table.as-cards tbody, table.as-cards tr, table.as-cards td { display: block; width: 100%; }
    table.as-cards tr.head-row { display: none; }
    table.as-cards tr { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; padding: 6px 10px; background: var(--card); }
    table.as-cards td { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px dashed var(--line); padding: 7px 0; background: none !important; text-align: end; white-space: normal; }
    table.as-cards tr td:last-child { border-bottom: 0; }
    table.as-cards td::before { content: attr(data-label); font-weight: 600; color: var(--muted); font-size: 13px; text-align: start; flex: 0 0 auto; }
    table.as-cards td[data-label=""]::before { display: none; }
    table.as-cards td[data-label=""] { justify-content: flex-end; }
    table.as-cards td .input { width: auto; max-width: 60vw; }
}

/* ---------- أيقونات الأزرار (بتتضاف تلقائي من app.js حسب نص الزر) ---------- */
.btn.bi { background-repeat: no-repeat; background-size: 16px 16px; background-position: right 11px center; padding-inline-start: 34px; }
[dir="ltr"] .btn.bi { background-position: left 11px center; }
.btn-sm.bi { background-size: 14px 14px; background-position: right 8px center; padding-inline-start: 28px; }
td .btn.bi-only, .actions .btn.bi-only { font-size: 0; width: 32px; height: 30px; padding: 0; background-position: center; background-size: 15px 15px; border: 1px solid var(--line); }
.btn.bi-save { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%231f2933%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpolyline points=%2220 6 9 17 4 12%22/%3E%3C/svg%3E"); }
html[data-theme="dark"] .btn.bi-save { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23e6edf3%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpolyline points=%2220 6 9 17 4 12%22/%3E%3C/svg%3E"); }
.btn-accent.bi-save, .btn-whatsapp.bi-save, html[data-theme="dark"] .btn-accent.bi-save, html[data-theme="dark"] .btn-whatsapp.bi-save, .btn-danger-outline.bi-save:hover { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23ffffff%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpolyline points=%2220 6 9 17 4 12%22/%3E%3C/svg%3E"); }
.btn-danger-outline.bi-save, html[data-theme="dark"] .btn-danger-outline.bi-save { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23d64545%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpolyline points=%2220 6 9 17 4 12%22/%3E%3C/svg%3E"); }
.btn.bi-plus { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%231f2933%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cline x1=%2212%22 y1=%225%22 x2=%2212%22 y2=%2219%22/%3E%3Cline x1=%225%22 y1=%2212%22 x2=%2219%22 y2=%2212%22/%3E%3C/svg%3E"); }
html[data-theme="dark"] .btn.bi-plus { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23e6edf3%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cline x1=%2212%22 y1=%225%22 x2=%2212%22 y2=%2219%22/%3E%3Cline x1=%225%22 y1=%2212%22 x2=%2219%22 y2=%2212%22/%3E%3C/svg%3E"); }
.btn-accent.bi-plus, .btn-whatsapp.bi-plus, html[data-theme="dark"] .btn-accent.bi-plus, html[data-theme="dark"] .btn-whatsapp.bi-plus, .btn-danger-outline.bi-plus:hover { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23ffffff%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cline x1=%2212%22 y1=%225%22 x2=%2212%22 y2=%2219%22/%3E%3Cline x1=%225%22 y1=%2212%22 x2=%2219%22 y2=%2212%22/%3E%3C/svg%3E"); }
.btn-danger-outline.bi-plus, html[data-theme="dark"] .btn-danger-outline.bi-plus { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23d64545%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cline x1=%2212%22 y1=%225%22 x2=%2212%22 y2=%2219%22/%3E%3Cline x1=%225%22 y1=%2212%22 x2=%2219%22 y2=%2212%22/%3E%3C/svg%3E"); }
.btn.bi-search { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%231f2933%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Ccircle cx=%2211%22 cy=%2211%22 r=%227%22/%3E%3Cline x1=%2221%22 y1=%2221%22 x2=%2216.65%22 y2=%2216.65%22/%3E%3C/svg%3E"); }
html[data-theme="dark"] .btn.bi-search { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23e6edf3%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Ccircle cx=%2211%22 cy=%2211%22 r=%227%22/%3E%3Cline x1=%2221%22 y1=%2221%22 x2=%2216.65%22 y2=%2216.65%22/%3E%3C/svg%3E"); }
.btn-accent.bi-search, .btn-whatsapp.bi-search, html[data-theme="dark"] .btn-accent.bi-search, html[data-theme="dark"] .btn-whatsapp.bi-search, .btn-danger-outline.bi-search:hover { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23ffffff%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Ccircle cx=%2211%22 cy=%2211%22 r=%227%22/%3E%3Cline x1=%2221%22 y1=%2221%22 x2=%2216.65%22 y2=%2216.65%22/%3E%3C/svg%3E"); }
.btn-danger-outline.bi-search, html[data-theme="dark"] .btn-danger-outline.bi-search { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23d64545%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Ccircle cx=%2211%22 cy=%2211%22 r=%227%22/%3E%3Cline x1=%2221%22 y1=%2221%22 x2=%2216.65%22 y2=%2216.65%22/%3E%3C/svg%3E"); }
.btn.bi-trash { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%231f2933%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpolyline points=%223 6 5 6 21 6%22/%3E%3Cpath d=%22M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6%22/%3E%3Cpath d=%22M10 11v6M14 11v6%22/%3E%3Cpath d=%22M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2%22/%3E%3C/svg%3E"); }
html[data-theme="dark"] .btn.bi-trash { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23e6edf3%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpolyline points=%223 6 5 6 21 6%22/%3E%3Cpath d=%22M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6%22/%3E%3Cpath d=%22M10 11v6M14 11v6%22/%3E%3Cpath d=%22M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2%22/%3E%3C/svg%3E"); }
.btn-accent.bi-trash, .btn-whatsapp.bi-trash, html[data-theme="dark"] .btn-accent.bi-trash, html[data-theme="dark"] .btn-whatsapp.bi-trash, .btn-danger-outline.bi-trash:hover { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23ffffff%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpolyline points=%223 6 5 6 21 6%22/%3E%3Cpath d=%22M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6%22/%3E%3Cpath d=%22M10 11v6M14 11v6%22/%3E%3Cpath d=%22M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2%22/%3E%3C/svg%3E"); }
.btn-danger-outline.bi-trash, html[data-theme="dark"] .btn-danger-outline.bi-trash { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23d64545%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpolyline points=%223 6 5 6 21 6%22/%3E%3Cpath d=%22M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6%22/%3E%3Cpath d=%22M10 11v6M14 11v6%22/%3E%3Cpath d=%22M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2%22/%3E%3C/svg%3E"); }
.btn.bi-print { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%231f2933%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpolyline points=%226 9 6 2 18 2 18 9%22/%3E%3Cpath d=%22M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2%22/%3E%3Crect x=%226%22 y=%2214%22 width=%2212%22 height=%228%22/%3E%3C/svg%3E"); }
html[data-theme="dark"] .btn.bi-print { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23e6edf3%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpolyline points=%226 9 6 2 18 2 18 9%22/%3E%3Cpath d=%22M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2%22/%3E%3Crect x=%226%22 y=%2214%22 width=%2212%22 height=%228%22/%3E%3C/svg%3E"); }
.btn-accent.bi-print, .btn-whatsapp.bi-print, html[data-theme="dark"] .btn-accent.bi-print, html[data-theme="dark"] .btn-whatsapp.bi-print, .btn-danger-outline.bi-print:hover { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23ffffff%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpolyline points=%226 9 6 2 18 2 18 9%22/%3E%3Cpath d=%22M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2%22/%3E%3Crect x=%226%22 y=%2214%22 width=%2212%22 height=%228%22/%3E%3C/svg%3E"); }
.btn-danger-outline.bi-print, html[data-theme="dark"] .btn-danger-outline.bi-print { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23d64545%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpolyline points=%226 9 6 2 18 2 18 9%22/%3E%3Cpath d=%22M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2%22/%3E%3Crect x=%226%22 y=%2214%22 width=%2212%22 height=%228%22/%3E%3C/svg%3E"); }
.btn.bi-edit { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%231f2933%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M12 20h9%22/%3E%3Cpath d=%22M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z%22/%3E%3C/svg%3E"); }
html[data-theme="dark"] .btn.bi-edit { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23e6edf3%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M12 20h9%22/%3E%3Cpath d=%22M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z%22/%3E%3C/svg%3E"); }
.btn-accent.bi-edit, .btn-whatsapp.bi-edit, html[data-theme="dark"] .btn-accent.bi-edit, html[data-theme="dark"] .btn-whatsapp.bi-edit, .btn-danger-outline.bi-edit:hover { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23ffffff%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M12 20h9%22/%3E%3Cpath d=%22M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z%22/%3E%3C/svg%3E"); }
.btn-danger-outline.bi-edit, html[data-theme="dark"] .btn-danger-outline.bi-edit { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23d64545%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M12 20h9%22/%3E%3Cpath d=%22M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z%22/%3E%3C/svg%3E"); }
.btn.bi-eye { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%231f2933%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z%22/%3E%3Ccircle cx=%2212%22 cy=%2212%22 r=%223%22/%3E%3C/svg%3E"); }
html[data-theme="dark"] .btn.bi-eye { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23e6edf3%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z%22/%3E%3Ccircle cx=%2212%22 cy=%2212%22 r=%223%22/%3E%3C/svg%3E"); }
.btn-accent.bi-eye, .btn-whatsapp.bi-eye, html[data-theme="dark"] .btn-accent.bi-eye, html[data-theme="dark"] .btn-whatsapp.bi-eye, .btn-danger-outline.bi-eye:hover { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23ffffff%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z%22/%3E%3Ccircle cx=%2212%22 cy=%2212%22 r=%223%22/%3E%3C/svg%3E"); }
.btn-danger-outline.bi-eye, html[data-theme="dark"] .btn-danger-outline.bi-eye { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23d64545%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z%22/%3E%3Ccircle cx=%2212%22 cy=%2212%22 r=%223%22/%3E%3C/svg%3E"); }
.btn.bi-chat { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%231f2933%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z%22/%3E%3C/svg%3E"); }
html[data-theme="dark"] .btn.bi-chat { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23e6edf3%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z%22/%3E%3C/svg%3E"); }
.btn-accent.bi-chat, .btn-whatsapp.bi-chat, html[data-theme="dark"] .btn-accent.bi-chat, html[data-theme="dark"] .btn-whatsapp.bi-chat, .btn-danger-outline.bi-chat:hover { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23ffffff%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z%22/%3E%3C/svg%3E"); }
.btn-danger-outline.bi-chat, html[data-theme="dark"] .btn-danger-outline.bi-chat { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23d64545%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z%22/%3E%3C/svg%3E"); }
.btn.bi-clock { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%231f2933%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Ccircle cx=%2212%22 cy=%2212%22 r=%2210%22/%3E%3Cpolyline points=%2212 6 12 12 16 14%22/%3E%3C/svg%3E"); }
html[data-theme="dark"] .btn.bi-clock { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23e6edf3%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Ccircle cx=%2212%22 cy=%2212%22 r=%2210%22/%3E%3Cpolyline points=%2212 6 12 12 16 14%22/%3E%3C/svg%3E"); }
.btn-accent.bi-clock, .btn-whatsapp.bi-clock, html[data-theme="dark"] .btn-accent.bi-clock, html[data-theme="dark"] .btn-whatsapp.bi-clock, .btn-danger-outline.bi-clock:hover { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23ffffff%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Ccircle cx=%2212%22 cy=%2212%22 r=%2210%22/%3E%3Cpolyline points=%2212 6 12 12 16 14%22/%3E%3C/svg%3E"); }
.btn-danger-outline.bi-clock, html[data-theme="dark"] .btn-danger-outline.bi-clock { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23d64545%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Ccircle cx=%2212%22 cy=%2212%22 r=%2210%22/%3E%3Cpolyline points=%2212 6 12 12 16 14%22/%3E%3C/svg%3E"); }
td .btn.bi-chat.bi-only { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%231fa855%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z%22/%3E%3C/svg%3E"); }
@media print { .btn.bi { background-image: none !important; } }

/* ============================================================
   شاشات البيع والمشتريات وأمر الشغل: متصفح الأصناف + الفاتورة
   ============================================================ */
.pos { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 780px); gap: 14px; align-items: start; margin-bottom: 14px; }
.pos .card { margin: 0; }
.pos.pos-single { grid-template-columns: minmax(0, 1fr); max-width: 900px; }
@media (max-width: 1150px) { .pos { grid-template-columns: minmax(0, 1fr); } }

.head-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.head-strip .field { margin: 0; }

/* متصفح الأصناف */
.browse-search { display: flex; gap: 8px; margin-bottom: 10px; }
.browse-search .input { flex: 1; min-width: 0; }
.browse-tabs { display: flex; flex-wrap: wrap; border-bottom: 2px solid var(--line); }
a.browse-tab { padding: 9px 16px; font-weight: 700; color: var(--muted); text-decoration: none; margin-bottom: -2px; border-bottom: 3px solid transparent; }
a.browse-tab:hover { color: var(--ink); }
a.browse-tab.on { color: var(--accent-dark); border-bottom-color: var(--accent); }
a.browse-tab.pk { color: #a86b00; }
a.browse-tab.pk.on { border-bottom-color: #d99a1c; }
.browse { display: block; }
.browse-cats { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
a.browse-cat { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; font-size: 13px; color: var(--ink); text-decoration: none; border: 1px solid var(--line); border-radius: 999px; }
a.browse-cat:hover { background: var(--hover); }
a.browse-cat i { font-style: normal; color: var(--muted); font-size: 12px; }
a.browse-cat.on { background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; border-color: var(--accent); }
.browse-list { flex: 1; min-width: 0; max-height: 64vh; overflow: auto; }
.browse-items { width: 100%; border-collapse: collapse; }
.browse-items th { position: sticky; top: 0; background: var(--card); font-size: 12px; color: var(--muted); text-align: start; padding: 8px 12px; border-bottom: 1px solid var(--line); font-weight: 600; white-space: nowrap; }
.browse-items td { padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.browse-items tr.pick-row { cursor: pointer; }
.browse-items tr.pick-row:hover td { background: var(--hover); }
.browse-items tr.pick-row.sel td { background: var(--accent-soft-2); }
.browse-items a.pick-link { color: var(--ink); font-weight: 700; text-decoration: none; display: block; }
.browse-items .in-cart { color: var(--accent-dark); font-weight: 800; white-space: nowrap; }
.browse-more { display: block; padding: 8px 12px; }
.kind { font-size: 11px; border-radius: 999px; padding: 1px 8px; background: var(--hover); color: var(--muted); white-space: nowrap; }
.kind-service { background: var(--accent-soft); color: var(--accent-dark); }
.kind-package { background: #fff4e0; color: #8a5a00; }

/* الفاتورة (يسار الشاشة) */
.cart .card-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cart .field { margin-bottom: 8px; }
.cart-lines { overflow-x: auto; }
.cart-sec { font-weight: 800; font-size: 13px; color: var(--muted); margin: 10px 0 2px; }
.cart-line { padding: 9px 0; border-bottom: 1px solid var(--line); }
.cart-name { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 700; }
.cart-name .unit { font-weight: 400; color: var(--muted); font-size: 12px; }
a.cart-x { flex: none; width: 24px; height: 24px; line-height: 22px; text-align: center; border-radius: 50%; color: var(--danger); text-decoration: none; font-size: 18px; }
a.cart-x:hover { background: var(--hover); }
.cart-edit { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 6px; align-items: end; margin-top: 6px; }
.cart-edit label { display: block; font-size: 11px; color: var(--muted); }
.cart-edit .input { width: 100%; padding: 4px 8px; text-align: center; min-height: 0; }
.cart-edit .line-total { font-weight: 800; white-space: nowrap; padding-bottom: 5px; min-width: 96px; text-align: end; font-size: 15.5px; }
.cart-tech { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.cart-tech .input { flex: 1; min-width: 0; padding: 4px 8px; min-height: 0; font-size: 13px; }
.cart-empty { padding: 22px 0; text-align: center; color: var(--muted); }
.cart-totals { margin-top: 10px; }
.cart-totals .tot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; font-size: 14.5px; }
.cart-totals .tot .input { width: 100px; padding: 4px 8px; text-align: center; min-height: 0; }
.savebar { display: flex; gap: 10px; align-items: stretch; margin-top: 10px; position: sticky; bottom: 0; z-index: 3; background: var(--card); padding: 8px 0; }
.savebar .cnt { background: var(--hover); border-radius: 10px; padding: 8px 12px; text-align: center; font-size: 12px; color: var(--muted); }
.savebar .cnt b { display: block; font-size: 17px; color: var(--ink); }
.savebar .net { flex: 1; background: var(--side); color: #fff; border-radius: 10px; padding: 8px 12px; text-align: center; font-size: 12px; }
.savebar .net b { display: block; font-size: 20px; }
.savebar .btn { padding-top: 0; padding-bottom: 0; font-size: 16px; min-width: 96px; }

/* نافذة السداد */
.pay-overlay { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 80; padding: 16px; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .5); }
.pay-box { width: 100%; max-width: 480px; max-height: 94vh; overflow: auto; padding: 20px; background: var(--card); border-radius: 14px; border-top: 5px solid var(--accent); box-shadow: 0 12px 40px rgba(0, 0, 0, .3); }
.pay-title { display: flex; justify-content: space-between; align-items: center; font-size: 18px; font-weight: 800; margin-bottom: 12px; }
.pay-net { background: var(--side); color: #fff; border-radius: 10px; padding: 10px; text-align: center; font-size: 13px; margin-bottom: 12px; }
.pay-net b { display: block; font-size: 24px; }
.pay-box .field { margin-bottom: 10px; }
.radio-row { display: block; padding: 2px 0; line-height: 2; }
.radio-row input { margin-inline-end: 6px; accent-color: var(--accent); vertical-align: middle; }
.radio-row label { cursor: pointer; display: inline; font-weight: 400; }
.pay-remaining { display: flex; justify-content: space-between; padding: 8px 0; font-weight: 700; border-top: 1px solid var(--line); }

@media (max-width: 640px) {
    .cart-edit { grid-template-columns: 1fr 1fr 1fr; }
    .cart-edit .line-total { grid-column: 1 / -1; }
}
@media print { .pay-overlay, .browse-card { display: none !important; } }

/* زر "عرض المحذوف" فوق جداول البيانات (مدير النظام) */
.trash-bar { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.trash-bar:empty { display: none; }


/* ============================================================
   تحديث: سطور الفاتورة في سطر واحد، الإجماليات في سطر، عدسة العميل، التابات، مؤشر التحميل
   ============================================================ */
.browse-items td.pick-name { font-weight: 700; }

/* بنود الفاتورة / أمر الشغل: كل بند في سطر واحد */
table.lines { width: 100%; border-collapse: collapse; }
table.lines th { font-size: 12px; color: var(--muted); text-align: start; font-weight: 600; padding: 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.lines td { padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.lines tr.line-row:nth-child(even) td { background: var(--zebra); }
table.lines .nm { font-weight: 800; color: var(--accent-dark); font-size: 15px; }
table.lines .nm .unit { font-weight: 400; color: var(--muted); font-size: 12px; }
table.lines .input { width: 100%; padding: 4px 6px; min-height: 0; text-align: center; }
table.lines select.input { text-align: start; font-size: 13px; }
table.lines tr.sec td { background: var(--hover); font-weight: 800; font-size: 13px; color: var(--muted); padding: 5px 8px; }
table.lines td.line-total { font-weight: 800; white-space: nowrap; text-align: end; }
table.lines .c-emp { width: 150px; } table.lines .c-qty { width: 66px; } table.lines .c-price { width: 90px; }
table.lines .c-disc { width: 76px; } table.lines .c-total { width: 92px; } table.lines .c-done { width: 150px; } table.lines .c-x { width: 28px; }
@media (max-width: 640px) { table.lines { min-width: 560px; } }

/* مجموع البنود + الخصم + نسبة الضريبة + الضريبة في سطر واحد */
.tot-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.tot-row .tot-cell { background: var(--zebra); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; }
.tot-row label, .tot-row .tot-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.tot-row b { font-size: 16px; }
.tot-row .input { width: 100%; padding: 3px 8px; min-height: 0; text-align: center; }
@media (max-width: 640px) { .tot-row { grid-template-columns: 1fr 1fr; } }

/* رأس الفاتورة: الرقم والوقت */
.doc-no { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.doc-no strong { font-size: 17px; }
.doc-no .hint { font-size: 13px; }

/* عدسة بحث العميل */
.btn-lens { width: 42px; padding: 0; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.cp-search { gap: 6px; margin-top: 6px; }
.cp-search .input { flex: 1; min-width: 0; }

/* أمر الشغل: الشريط العلوي والتابات */
.wo-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.wo-head h2 { margin: 0; font-size: 18px; }
.wo-head .meta { color: var(--muted); font-size: 14px; }
.wo-head .meta b { color: var(--ink); }
.wo-head .sp { flex: 1; }
.wo-actions { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.wo-actions .field { margin: 0; }
.wo-actions .input { min-height: 0; padding: 5px 8px; }
.ptabs { display: flex; flex-wrap: wrap; margin: 0 0 14px; padding: 0 8px; background: var(--card); border: 1px solid var(--line); border-bottom: 2px solid var(--line); border-radius: 12px 12px 0 0; }
a.ptab { padding: 11px 18px; font-weight: 700; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -2px; display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
a.ptab:hover { color: var(--ink); }
a.ptab.on { color: var(--accent-dark); border-bottom-color: var(--accent); }
a.ptab i { font-style: normal; font-size: 12px; background: var(--hover); border-radius: 999px; padding: 1px 8px; color: var(--muted); }
a.ptab.on i { background: var(--accent-soft); color: var(--accent-dark); }
a.ptab i:empty { display: none; }
.tab-pane { display: none; }
.tab-pane.on { display: block; }
.wo-new { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.wo-new .card { margin: 0 0 14px; }
@media (max-width: 1000px) { .wo-new { grid-template-columns: minmax(0, 1fr); } }
.sec-title { font-weight: 800; font-size: 14px; color: var(--accent-dark); margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.g4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.g2 > .field, .g4 > .field { margin: 0; }
@media (max-width: 800px) { .g2, .g4 { grid-template-columns: 1fr; } }
.info-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.info-row span { color: var(--muted); }
.info-row:last-of-type { border: 0; }
.big-save { width: 100%; padding: 14px; font-size: 17px; margin-top: 14px; }

/* مؤشر التحميل أثناء طلبات Ajax */
.ajax-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 200; background: var(--accent); transform-origin: left; animation: ajaxbar 1.1s ease-in-out infinite; display: none; }
body.busy .ajax-bar { display: block; }
body.busy .pos, body.busy .ptabs, body.busy .pay-box { cursor: progress; }
@keyframes ajaxbar { 0% { transform: scaleX(.05); opacity: 1; } 70% { transform: scaleX(.8); opacity: 1; } 100% { transform: scaleX(1); opacity: .3; } }
@media print { .ptabs, .wo-actions, .ajax-bar { display: none !important; } .tab-pane { display: block !important; } }

/* المرتجعات: جدول بنود الفاتورة واسع وملخص المرتجع جنبه */
.pos.pos-return { grid-template-columns: minmax(0, 1fr) 380px; }
@media (max-width: 1150px) { .pos.pos-return { grid-template-columns: minmax(0, 1fr); } }
.pos.pos-return .savebar { position: static; }

/* =====================================================================
   القائمة العلوية (بدل القائمة الجانبية) - Site.master
   الألوان من متغيرات الثيم (--side / --accent) فكل الثيمات والوضع الليلي شغالين
   ===================================================================== */
.app.app-top { display: block; }
.topnav {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 6px;
    min-height: 54px; padding: 0 14px;
    background: var(--side); color: var(--side-text);
}
.topnav .brand { padding: 0 4px; border: 0; font-size: 15px; white-space: nowrap; max-width: 200px; }
.topnav .brand span { overflow: hidden; text-overflow: ellipsis; }
.topnav .brand .ic { width: 24px; height: 24px; }

.nav { display: flex; align-items: stretch; gap: 2px; flex: 1; min-width: 0; }
.nav-item { position: relative; display: flex; }
.nav-home, .nav-btn {
    display: flex; align-items: center; gap: 6px;
    height: 54px; padding: 0 11px; border: 0; border-bottom: 3px solid transparent;
    background: none; color: var(--side-text); text-decoration: none; white-space: nowrap; cursor: pointer;
}
.nav-home-text { display: none; }
.nav-home:hover, .nav-btn:hover, .nav-item.open > .nav-btn { background: var(--side-2); color: #fff; }
.nav-home.active, .nav-item.active > .nav-btn { color: #fff; border-bottom-color: var(--accent); }
.nav-btn .chev { width: 12px; height: 12px; opacity: .7; transition: transform .2s; }
.nav-item.open > .nav-btn .chev { transform: rotate(180deg); }

/* القائمة المنسدلة: عمود لكل قسم (الفواتير = البيع + المشتريات) */
.nav-drop {
    display: none; position: absolute; top: 100%; inset-inline-start: 0; z-index: 30;
    min-width: 220px; padding: 8px; gap: 8px;
    background: var(--card); color: var(--ink); border: 1px solid var(--line); border-top: 0;
    border-radius: 0 0 12px 12px; box-shadow: 0 12px 30px rgba(0, 0, 0, .18);
}
.nav-item.open > .nav-drop { display: grid; }
.nav-drop.cols-2 { grid-template-columns: 1fr 1fr; min-width: 420px; }
.nav-sec { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.nav-sec + .nav-sec { border-inline-start: 1px solid var(--line); padding-inline-start: 8px; }
.nav-sec-title { padding: 2px 10px 6px; font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.nav-link {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    width: 100%; padding: 7px 10px; border: 0; border-radius: 7px; background: none;
    color: var(--ink); text-decoration: none; font-size: 14px; text-align: start; white-space: nowrap; cursor: pointer;
}
.nav-link:hover { background: var(--hover); }
.nav-link.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.nav-link .kbd { font-size: 11px; }
.nav-link .ic { color: var(--muted); }
.nav-logout, .nav-logout .ic { color: var(--danger); }
html[data-theme="dark"] .nav-link.active { color: #8fd8de; }

/* المستخدم والوردية على الطرف */
.topnav .topbar-user { gap: 6px; margin-inline-start: auto; }
.topnav .chip { background: rgba(255, 255, 255, .1); color: var(--side-text); }
.topnav a.chip-link:hover { background: rgba(255, 255, 255, .18); color: #fff; }
.nav-user .nav-drop { inset-inline-start: auto; inset-inline-end: 0; }
.nav-user-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }

.nav-toggle { display: none; background: rgba(255, 255, 255, .1); color: var(--side-text); border-color: transparent; padding: 6px 10px; }

/* عنوان الشاشة تحت القائمة */
.page-head { padding: 16px 20px 0; }
.page-head .page-title { font-size: 20px; }
.page-head + .content { padding-top: 12px; }

/* شاشات أصغر: نخفي اسم المركز، وبعدين القائمة تتقفل في زر */
@media (max-width: 1380px) {
    .topnav .brand span { display: none; }
    .nav-home, .nav-btn { padding: 0 9px; }
}
@media (max-width: 1180px) {
    .nav-toggle { display: inline-flex; }
    .nav {
        display: none; position: absolute; top: 100%; inset-inline: 0;
        flex-direction: column; gap: 0; padding: 6px 10px 12px;
        max-height: calc(100vh - 54px); overflow-y: auto;
        background: var(--side); box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
    }
    .topnav.show .nav { display: flex; }
    .nav-item { flex-direction: column; }
    .nav-home, .nav-btn { height: 44px; width: 100%; border-bottom: 0; border-radius: 8px; }
    .nav-home-text { display: inline; }
    .nav-home.active, .nav-item.active > .nav-btn { background: var(--side-2); }
    .nav-btn .chev { margin-inline-start: auto; }
    .nav .nav-drop {
        position: static; min-width: 0; box-shadow: none; border: 0; border-radius: 8px;
        background: var(--side-2); color: var(--side-text); margin: 2px 0 6px;
    }
    .nav .nav-drop.cols-2 { grid-template-columns: 1fr; min-width: 0; }
    .nav .nav-sec + .nav-sec { border-inline-start: 0; padding-inline-start: 0; border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 6px; }
    .nav .nav-sec-title { color: var(--side-text); opacity: .7; }
    .nav .nav-link { color: var(--side-text); }
    .nav .nav-link:hover, .nav .nav-link.active { background: rgba(255, 255, 255, .1); color: #fff; }
}
@media (max-width: 575px) {
    .page-head { padding: 12px 16px 0; }
    .nav-user-name { display: none; }
}

@media print {
    .topnav, .page-head { display: none !important; }
}
body.popup .topnav, body.popup .page-head { display: none !important; }

/* =====================================================================
   شاشات البيانات بعمودين (زي Hawai): الفورم على جنب والقائمة جنبه
   <div class="split"> <asp:Panel CssClass="card split-form">..</asp:Panel> <div class="card">..</div> </div>
   ===================================================================== */
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; align-items: start; }
.split > .card { margin-bottom: 0; }
/* رأس الكارت (أول عنوان فيه بس، مش العناوين الفرعية جوه الفورم) */
.split .card > div.card-title:first-of-type { margin: -16px -16px 14px; padding: 11px 16px; background: var(--bg); border-bottom: 1px solid var(--line); border-radius: 12px 12px 0 0; font-size: 15px; }
.split .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.split .form-grid .wide { grid-column: 1 / -1; }
.split-form { position: sticky; top: 70px; max-height: calc(100vh - 86px); overflow-y: auto; }
/* العمود اليمين لما فيه أكتر من كارت (الفورم + كارت تابع له) والعمود الشمال (القائمة وأي ملخصات) */
.split-side { position: sticky; top: 70px; max-height: calc(100vh - 86px); overflow-y: auto; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.split-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.split-side > .card, .split-main > .card, .split-main > div > .card { margin-bottom: 0; }
.split-side .split-form { position: static; max-height: none; overflow: visible; }
.split .table-wrap { max-height: calc(100vh - 250px); }

/* "تفاصيل أكتر": الحقول اللي مش بتتملا كل مرة */
.more { grid-column: 1 / -1; border: 1px dashed var(--line); border-radius: 10px; padding: 0 12px; }
.more > summary { cursor: pointer; padding: 9px 0; color: var(--accent); font-weight: 600; font-size: 14px; list-style: none; }
.more > summary::-webkit-details-marker { display: none; }
.more > summary::before { content: "+ "; }
.more[open] > summary::before { content: "− "; }
.more[open] { padding-bottom: 12px; }
.more .form-grid { margin-top: 2px; }

@media (max-width: 1100px) {
    .split { grid-template-columns: minmax(0, 1fr); }
    .split-form, .split-side { position: static; max-height: none; overflow: visible; }
    .split .table-wrap { max-height: 72vh; }
}
@media (max-width: 520px) {
    .split .form-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- شاشات البحث وشاشات التسجيل المنفصلة ---------- */
.list-card .table-wrap { max-height: none; }
.list-card .toolbar { align-items: center; }
.row-link { color: inherit; text-decoration: none; }
.row-link:hover { color: var(--accent); text-decoration: underline; }
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.pager-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 32px; padding: 0 10px;
    border: 1px solid var(--line); border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 13px; background: var(--card); }
a.pager-btn:hover { border-color: var(--accent); color: var(--accent); }
.pager-btn.current { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.pager-btn.disabled { opacity: .45; }
.pager-gap { color: var(--muted); padding: 0 2px; }
.pager-size { margin-inline-start: auto; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.pager-size .input { min-width: 0; width: auto; padding-block: 4px; }
.edit-card { max-width: 1100px; }
.edit-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.edit-head .card-title { margin: 0; font-size: 18px; }
.edit-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 10px; margin-bottom: 6px; }
a.stat { color: inherit; text-decoration: none; display: block; }
a.stat:hover { border-color: var(--accent); }
.edit-summary .stat-label, .edit-summary .stat-value { display: block; }
.edit-summary .stat-value { font-size: 17px; margin-top: 2px; }
.form-sec { font-weight: 700; font-size: 14px; color: var(--accent); margin: 18px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.form-actions .grow { flex: 1; }
body.popup .edit-card { max-width: none; }
.filter-chip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 10px; border-radius: 8px; background: var(--accent-soft); }
/* نص طويل في الجدول (زي سبب الزيارة): يتلف على أكتر من سطر بعرض مريح */
.table td.cell-text { min-width: 220px; max-width: 420px; white-space: pre-line; }
/* أمر الشغل: عمود التنفيذ (بدأ / المدة / تمت) */
table.lines .done-box { display: flex; align-items: center; gap: 4px; }
table.lines .done-box .minutes { width: 56px; min-width: 0; padding-inline: 6px; text-align: center; }
table.lines .done-cell .hint { font-size: 11px; margin-top: 2px; }
/* قائمة اختيارات (مربعات الشاشة الرئيسية في الإعدادات) */
ul.check-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px 16px; }
ul.check-list li { display: flex; align-items: center; gap: 6px; }
ul.check-list input { width: 17px; height: 17px; margin: 0; }

/* شاشة الترخيص: الموديولات المرخّصة */
.text-ok { color: #1d7a43; font-weight: 700; }
html[data-theme="dark"] .text-ok { color: #7bd9a3; }

