/* نظام جرد مخازن البلاد — التنسيقات (حسب دليل الهوية البصرية لشركة البلاد) */
@font-face { font-family: "Cairo"; src: url("/static/fonts/Cairo-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Cairo"; src: url("/static/fonts/Cairo-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Cairo"; src: url("/static/fonts/Cairo-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Cairo"; src: url("/static/fonts/Cairo-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Cairo"; src: url("/static/fonts/Cairo-ExtraBold.ttf") format("truetype"); font-weight: 800; font-display: swap; }
/* Gabarito للحروف الإنجليزية والأرقام فقط، والعربي يبقى بخط Cairo */
@font-face { font-family: "Gabarito"; src: url("/static/fonts/Gabarito-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F, U+20AC; }
@font-face { font-family: "Gabarito"; src: url("/static/fonts/Gabarito-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F, U+20AC; }
@font-face { font-family: "Gabarito"; src: url("/static/fonts/Gabarito-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F, U+20AC; }
@font-face { font-family: "Gabarito"; src: url("/static/fonts/Gabarito-Bold.ttf") format("truetype"); font-weight: 700 800; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F, U+20AC; }

:root {
  --css-ok: 1;   /* يتأكد منه cssguard.js إن التنسيق انحمّل */
  /* ألوان الشركة */
  --brand-blue: #2e3192;
  --brand-green: #00bc70;
  --bg: #f1f2f6;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --border: #e3e5ef;
  --border-strong: #cdd0e0;
  --text: #1a1c3b;
  --text-2: #3e4163;
  --muted: #6c6f8c;
  --primary: #2e3192;
  --primary-700: #23266f;
  --primary-50: #eeeffa;
  --primary-100: #d4d6f1;
  --side: #2e3192;
  --side-2: #3b3fa6;
  --side-text: #d9daf4;
  --price: #a15c07;
  --price-50: #fdf3e2;
  --new: #00864f;
  --new-50: #dff6ec;
  --used: #b54708;
  --used-50: #fdf0e3;
  --danger: #c4320a;
  --danger-50: #fdece7;
  --info: #175cd3;
  --info-50: #eaf1fd;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --font: "Gabarito", "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;
  --shadow: 0 1px 2px rgba(26, 28, 59, .05), 0 1px 3px rgba(26, 28, 59, .07);
  --shadow-lg: 0 14px 34px rgba(26, 28, 59, .16);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; }
h1 { font-size: 24px; font-weight: 800; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
mark { background: #fde68a; color: inherit; border-radius: 3px; padding: 0 1px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.ic { width: 18px; height: 18px; flex: none; vertical-align: middle; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
[hidden] { display: none !important; }

/* ---------- عناصر عامة */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
  font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none !important;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); border-color: #b7c0cc; }
.btn:focus-visible, .btn-icon:focus-visible { outline: 3px solid var(--primary-100); outline-offset: 1px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-700); border-color: var(--primary-700); }
.btn-green { background: var(--brand-green); border-color: var(--brand-green); color: #fff; font-weight: 700; }
.btn-green:hover { background: #00a863; border-color: #00a863; }
.btn-price { background: var(--price); border-color: var(--price); color: #fff; }
.btn-price:hover { background: #864c05; }
.btn-danger { color: var(--danger); border-color: #f1c4b7; }
.btn-danger:hover { background: var(--danger-50); border-color: var(--danger); }
.btn-danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; gap: 6px; }
.btn-sm .ic { width: 16px; height: 16px; }
.btn-block { width: 100%; }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: transparent; color: var(--text-2); cursor: pointer;
}
.btn-icon:hover { background: var(--surface-2); border-color: var(--border); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field-label { font-size: 13px; font-weight: 700; color: var(--text-2); }
.field .req { color: var(--danger); }
.input, .field input:not([type=radio]):not([type=checkbox]):not([type=file]), .field select, .field textarea, select.input {
  width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100);
}
.hint { font-size: 12.5px; color: var(--muted); margin: 0; }
.form-error { color: var(--danger); background: var(--danger-50); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 14px; font-weight: 600; }
.form-error:empty { display: none; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head a { font-size: 13px; font-weight: 700; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap; line-height: 1.7;
}
.b-new { background: var(--new-50); color: var(--new); }
.b-used { background: var(--used-50); color: var(--used); }
.b-price { background: var(--price-50); color: var(--price); }
.b-gray { background: #eef1f5; color: var(--text-2); }
.b-info { background: var(--info-50); color: var(--info); }
.b-danger { background: var(--danger-50); color: var(--danger); }
.code-pill { font-family: Consolas, "Courier New", monospace; font-size: 12.5px; background: #eef1f5; color: var(--text-2); padding: 2px 8px; border-radius: 6px; direction: ltr; unicode-bidi: isolate; display: inline-block; }

.spinner { width: 34px; height: 34px; border: 3px solid var(--primary-100); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.boot, .loading-box { display: flex; align-items: center; justify-content: center; min-height: 50vh; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty .ic { width: 44px; height: 44px; color: var(--border-strong); margin-bottom: 8px; }
.empty h3 { color: var(--text-2); margin-bottom: 4px; }

/* ---------- الهيكل */
.layout { min-height: 100vh; }
.sidebar {
  position: fixed; top: 0; bottom: 0; right: 0; width: 264px; z-index: 40;
  background: var(--side); color: var(--side-text); display: flex; flex-direction: column;
  transition: transform .25s ease; overflow: hidden;
}
.sidebar::before {
  content: ""; position: absolute; inset: auto 0 0 0; height: 260px; pointer-events: none;
  background: url("/static/brand/pattern.svg") repeat;
  -webkit-mask-image: linear-gradient(to top, #000 10%, transparent); mask-image: linear-gradient(to top, #000 10%, transparent);
  opacity: .55;
}
.sidebar > * { position: relative; }
.brand { display: block; padding: 22px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.1); text-decoration: none !important; }
.brand-logo-img { display: block; width: 100%; max-width: 210px; height: auto; }
.brand-sub { margin-top: 10px; font-size: 12px; font-weight: 600; color: #fff; display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.1); padding: 2px 10px; border-radius: 999px; }
.brand-sub::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--brand-green); }
.nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--side-text); font-weight: 600; text-decoration: none;
}
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.active { background: #fff; color: var(--brand-blue); box-shadow: 0 4px 14px rgba(10, 12, 60, .25); }
.nav a.active::before { content: ""; position: absolute; right: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 4px 0 0 4px; background: var(--brand-green); }
.nav a.active .ic { color: var(--brand-green); }
.nav .nav-count { margin-inline-start: auto; background: var(--brand-green); color: #fff; font-size: 11px; font-weight: 800; padding: 0 7px; border-radius: 999px; line-height: 1.8; }
.sidebar-foot { padding: 12px 12px 16px; border-top: 1px solid rgba(255,255,255,.1); background: rgba(20, 22, 90, .35); }
.user-card { display: flex; align-items: center; gap: 10px; padding: 8px 8px 12px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--brand-green); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; }
.user-name { color: #fff; font-weight: 700; font-size: 14px; }
.user-role { font-size: 12px; opacity: .8; }
.side-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border: 0; background: transparent;
  color: var(--side-text); border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 14px; text-align: right;
}
.side-btn:hover { background: rgba(255,255,255,.06); color: #fff; }
.backdrop { display: none; }

.main { margin-right: 264px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 66px; display: flex; align-items: center; gap: 14px;
  padding: 0 24px; background: rgba(255,255,255,.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
  box-shadow: inset 0 3px 0 var(--brand-green);
}
.top-mark { height: 30px; width: auto; }
.top-back { display: inline-flex; align-items: center; gap: 4px; height: 40px; padding: 0 12px; flex: none; }
.top-back[hidden] { display: none; }
.top-back .ic { width: 18px; height: 18px; }
@media (max-width: 760px) { .top-back { padding: 0 9px; } .topbar { gap: 8px; } }
@media print { .top-back { display: none !important; } }
.print-head, .print-meta, .print-sign, .print-foot, .print-mark, .pframe > thead, .pframe > tfoot { display: none; }
.pframe, .pframe > tbody, .pframe > tbody > tr, .pframe > tbody > tr > td { display: block; padding: 0; border: 0; background: none; width: auto; }
.gsearch { position: relative; flex: 1; max-width: 620px; }
.gsearch > .ic { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.gsearch input {
  width: 100%; height: 42px; padding: 0 40px 0 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); outline: none;
}
.gsearch input:focus { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.suggest {
  position: absolute; top: calc(100% + 6px); right: 0; left: 0; background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; display: none;
}
.suggest.open { display: block; }
.sg-item { display: flex; align-items: center; gap: 12px; padding: 8px 12px; color: var(--text); text-decoration: none !important; cursor: pointer; }
.sg-item:hover, .sg-item.active { background: var(--primary-50); }
.sg-thumb { width: 42px; height: 42px; border-radius: 8px; background: var(--surface-2); flex: none; overflow: hidden; display: grid; place-items: center; color: var(--border-strong); }
.sg-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sg-name { font-weight: 700; font-size: 14px; }
.sg-meta { font-size: 12px; color: var(--muted); }
.sg-all { display: block; padding: 10px 12px; border-top: 1px solid var(--border); font-weight: 700; font-size: 13px; background: var(--surface-2); }
.top-actions { margin-inline-start: auto; display: flex; gap: 8px; }
.content { padding: 24px; width: 100%; max-width: 1440px; margin: 0 auto; flex: 1; }
.only-mobile { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 2px 0 0; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.head-badges { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 2px; }

/* ---------- لوحة المعلومات */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { display: flex; gap: 14px; align-items: center; padding: 18px; text-decoration: none !important; color: inherit; }
a.stat:hover { border-color: var(--primary-100); box-shadow: var(--shadow-lg); }
.stat-ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.stat-ic .ic { width: 22px; height: 22px; }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 24px; font-weight: 800; line-height: 1.25; }
.stat-value.sm { font-size: 17px; }
.t-teal { background: var(--primary-50); color: var(--primary); }
.t-blue { background: #e9eafb; color: #4a4fc0; }
.hero {
  position: relative; overflow: hidden; background: var(--brand-blue); color: #fff; border-radius: 16px;
  padding: 26px 28px; margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.hero::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 46%; background: url("/static/brand/pattern.svg") repeat; opacity: .8;
  -webkit-mask-image: linear-gradient(to right, #000 30%, transparent); mask-image: linear-gradient(to right, #000 30%, transparent); }
.hero::after { content: ""; position: absolute; left: 6%; bottom: -30px; width: 240px; height: 120px; background: url("/static/brand/mark-white.png") no-repeat center / contain; opacity: .08; }
.hero > * { position: relative; z-index: 1; }
.hero h1 { color: #fff; font-size: 26px; }
.hero p { margin: 4px 0 0; color: #dfe0f7; }
.hero .accent { color: var(--brand-green); }
.hero .btn { background: #fff; border-color: #fff; color: var(--brand-blue); }
.hero .btn:hover { background: #eef0fb; }
.t-green { background: var(--new-50); color: var(--new); }
.t-amber { background: var(--used-50); color: var(--used); }
.t-red { background: var(--danger-50); color: var(--danger); }
.t-price { background: var(--price-50); color: var(--price); }
.dash-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 16px; }
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: block; color: inherit; text-decoration: none !important; }
.bar-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin-bottom: 4px; }
.bar-top b { font-weight: 700; }
.bar { height: 8px; background: #edf1f5; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand-blue); border-radius: 99px; }
.bar.alt > i { background: var(--brand-green); }
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.activity li:last-child { border-bottom: 0; }
.act-dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.act-dot .ic { width: 16px; height: 16px; }
.act-main { font-size: 14px; }
.act-details { font-size: 13px; color: var(--muted); word-break: break-word; }

/* ---------- فلاتر البحث */
.filters { padding: 16px; margin-bottom: 16px; }
.search-big { position: relative; margin-bottom: 12px; }
.search-big > .ic { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 20px; height: 20px; }
.search-big input {
  width: 100%; height: 50px; padding: 0 46px 0 46px; border: 1px solid var(--border-strong); border-radius: 10px;
  font-size: 16px; outline: none; background: var(--surface);
}
.search-big input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.search-big .clear { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); }
.filter-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; align-items: end; }
.fl { display: flex; flex-direction: column; gap: 4px; }
.fl > span { font-size: 12px; font-weight: 700; color: var(--muted); }
.fl select, .fl input { height: 38px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0 10px; background: #fff; outline: none; min-width: 0; width: 100%; }
.fl select:focus, .fl input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.fl.active select, .fl.active input { border-color: var(--primary); background: var(--primary-50); }
.filter-tools { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.adv-row { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.range { display: flex; gap: 6px; }
.summary { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin: 0 2px 14px; font-size: 14px; color: var(--text-2); }
.summary b { color: var(--text); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; height: 38px; padding: 0 12px; cursor: pointer; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.seg button + button { border-inline-start: 1px solid var(--border); }
.seg button.on { background: var(--primary-50); color: var(--primary); }

/* ---------- بطاقات المواد */
.items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.item-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; color: inherit; text-decoration: none !important; box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.item-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--primary-100); }
.ic-img { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); }
.ic-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.noimg { width: 100%; height: 100%; display: grid; place-items: center; color: var(--border-strong); }
.noimg .ic { width: 40px; height: 40px; }
.ic-img .badge { position: absolute; top: 10px; right: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.img-count { position: absolute; bottom: 8px; left: 8px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; display: inline-flex; gap: 4px; align-items: center; }
.img-count .ic { width: 13px; height: 13px; }
.ic-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.ic-name { font-weight: 700; font-size: 15.5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ic-loc { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: flex-start; }
.ic-loc .ic { width: 15px; height: 15px; margin-top: 3px; }
.ic-foot { margin-top: auto; padding-top: 10px; display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; border-top: 1px solid var(--border); }
.qty b { font-size: 19px; font-weight: 800; }
.qty span { font-size: 13px; color: var(--muted); }
.price-tag { text-align: left; font-size: 13px; font-weight: 800; color: var(--price); }
.price-tag small { display: block; font-weight: 600; color: var(--muted); font-size: 11px; }
.price-none { font-size: 12px; color: var(--danger); font-weight: 700; }

/* ---------- الجداول */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: right; font-size: 12.5px; color: var(--muted); font-weight: 700; background: var(--surface-2); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #fafbfc; }
.tbl .num { white-space: nowrap; font-weight: 700; }
.tbl-thumb { width: 46px; height: 46px; border-radius: 8px; background: var(--surface-2); overflow: hidden; display: grid; place-items: center; color: var(--border-strong); }
.tbl-thumb img { width: 100%; height: 100%; object-fit: cover; }
.tbl a.name { font-weight: 700; color: var(--text); }
.tbl a.name:hover { color: var(--primary); }
.tbl tr.done { background: var(--new-50) !important; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }

.pager { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 20px; flex-wrap: wrap; }
.pager button { min-width: 38px; height: 38px; border: 1px solid var(--border-strong); background: #fff; border-radius: 8px; cursor: pointer; font-weight: 700; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; padding: 0 8px; }
.pager button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager button:disabled { opacity: .45; cursor: default; }
.pager .gap { color: var(--muted); padding: 0 4px; }

/* ---------- نموذج المادة */
.form-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.form-grid .card h3 { margin: 4px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.form-grid .card h3:not(:first-child) { margin-top: 22px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row2 .span2 { grid-column: 1 / -1; }
.with-add { display: flex; gap: 6px; }
.with-add select { flex: 1; }
.with-add .btn { height: 42px; width: 42px; padding: 0; flex: none; }
.cond-toggle { display: flex; gap: 10px; }
.cond-toggle label { cursor: pointer; flex: 1 1 0; min-width: 0; }
.cond-toggle input:checked + span { border-color: var(--primary); background: var(--primary-50); color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.cond-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.cond-toggle span {
  display: flex; align-items: center; justify-content: center; gap: 8px; height: 46px; border: 2px solid var(--border);
  border-radius: 10px; font-weight: 700; color: var(--muted); transition: all .15s;
}
.cond-toggle input:focus-visible + span { box-shadow: 0 0 0 3px var(--primary-100); }
.cond-toggle input[value=new]:checked + span { border-color: var(--new); background: var(--new-50); color: var(--new); }
.cond-toggle input[value=used]:checked + span { border-color: var(--used); background: var(--used-50); color: var(--used); }
.form-actions { grid-column: 1 / -1; display: flex; gap: 10px; position: sticky; bottom: 0; padding: 14px 0; background: linear-gradient(to top, var(--bg) 70%, transparent); }
.form-actions .btn-primary { min-width: 160px; }
.price-lock { display: flex; gap: 10px; align-items: flex-start; background: var(--price-50); color: var(--price); border-radius: 10px; padding: 12px 14px; font-size: 13.5px; font-weight: 600; margin-top: 16px; }

.dropzone {
  border: 2px dashed var(--border-strong); border-radius: 12px; padding: 26px 16px; text-align: center; cursor: pointer;
  color: var(--muted); transition: all .15s; background: var(--surface-2);
}
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-50); color: var(--primary); }
.dropzone .ic { width: 34px; height: 34px; margin-bottom: 6px; }
.dropzone b { display: block; color: var(--text-2); }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 10px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-2); border: 2px solid transparent; }
.thumb.primary { border-color: var(--primary); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .t-actions { position: absolute; inset: auto 4px 4px 4px; display: flex; justify-content: space-between; }
.thumb .t-actions button { width: 28px; height: 28px; border-radius: 7px; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; display: grid; place-items: center; }
.thumb .t-actions button:hover { background: rgba(0,0,0,.85); }
.thumb .t-actions .ic { width: 15px; height: 15px; }
.thumb .t-tag { position: absolute; top: 4px; right: 4px; font-size: 11px; font-weight: 800; padding: 0 7px; border-radius: 999px; background: var(--primary); color: #fff; }
.thumb .t-tag.pending { background: var(--info); }
.thumb.processing { display: grid; place-items: center; }

/* ---------- صفحة المادة */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 16px; }
.gallery { padding: 12px; }
.g-main { position: relative; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.g-main img { width: 100%; height: 100%; object-fit: contain; background: #f1f3f6; }
.g-main .noimg { cursor: default; }
.g-thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 2px; }
.g-thumbs button { width: 70px; height: 70px; flex: none; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--surface-2); }
.g-thumbs button.on { border-color: var(--primary); }
.g-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-side { display: flex; flex-direction: column; gap: 16px; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 0; }
.kv > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.kv dt { font-size: 12px; color: var(--muted); font-weight: 700; display: flex; gap: 6px; align-items: center; }
.kv dt .ic { width: 14px; height: 14px; }
.kv dd { margin: 2px 0 0; font-weight: 700; word-break: break-word; }
.kv .wide { grid-column: 1 / -1; }
.kv .big { font-size: 26px; font-weight: 800; line-height: 1.3; }
.kv .big small { font-size: 14px; color: var(--muted); font-weight: 600; }
.price-card { border-color: #f3d9ac; background: linear-gradient(180deg, #fffaf1, #fff); }
.price-card h3 { display: flex; align-items: center; gap: 8px; color: var(--price); }
.price-big { font-size: 28px; font-weight: 800; color: var(--price); line-height: 1.3; }
.price-meta { display: grid; gap: 4px; font-size: 13.5px; color: var(--text-2); margin-top: 8px; }
.price-form { display: grid; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed #efd3a2; }
.price-form .pf-row { display: grid; grid-template-columns: 1fr 130px; gap: 8px; }
.text-block { white-space: pre-wrap; word-break: break-word; color: var(--text-2); margin: 0; }
.meta-line { display: flex; flex-wrap: wrap; gap: 6px 24px; font-size: 13px; color: var(--muted); }

/* ---------- التسعير */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 10px 16px; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--primary); border-bottom-color: var(--primary); }
.tabs .badge { margin-inline-start: 6px; }
.price-inline { display: flex; gap: 6px; align-items: center; }
.price-inline input { width: 130px; height: 36px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 10px; outline: none; direction: ltr; text-align: left; }
.price-inline input:focus { border-color: var(--price); box-shadow: 0 0 0 3px var(--price-50); }
.price-inline select { height: 36px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 6px; background: #fff; }

/* ---------- المخازن */
.wh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.wh-card { display: flex; flex-direction: column; gap: 10px; }
.wh-top { display: flex; gap: 12px; align-items: flex-start; }
.wh-ic { width: 46px; height: 46px; border-radius: 12px; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; flex: none; }
.wh-ic .ic { width: 22px; height: 22px; }
.wh-name { font-size: 17px; font-weight: 800; }
.wh-loc { font-size: 13px; color: var(--muted); }
.wh-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wh-nums > div { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }
.wh-nums small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.wh-nums b { font-size: 16px; }
.wh-actions { display: flex; gap: 6px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.wh-actions .btn:first-child { flex: 1; }

.lk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.lk-add { display: flex; gap: 8px; margin-bottom: 12px; }
.lk-add input { flex: 1; }
.lk-list { list-style: none; margin: 0; padding: 0; max-height: 520px; overflow-y: auto; }
.lk-list li { display: flex; align-items: center; gap: 8px; padding: 8px 6px; border-bottom: 1px solid var(--border); }
.lk-list li:last-child { border-bottom: 0; }
.lk-list .lk-name { flex: 1; font-weight: 600; }

.role-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.role-card { padding: 14px 16px; }
.role-card h4 { font-size: 14px; margin-bottom: 4px; }
.role-card p { margin: 0; font-size: 13px; color: var(--muted); }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-end: 6px; }

/* ---------- النوافذ المنبثقة */
.modal-wrap {
  position: fixed; inset: 0; z-index: 100; background: rgba(13, 22, 33, .5); display: flex; align-items: center; justify-content: center;
  padding: 16px; opacity: 0; transition: opacity .15s;
}
.modal-wrap.show { opacity: 1; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 480px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); transform: translateY(8px); transition: transform .15s; }
.modal.wide { max-width: 640px; }
.modal-wrap.show .modal { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-start; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 14px 14px; }

.lightbox { position: fixed; inset: 0; z-index: 120; background: rgba(5, 10, 15, .92); display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: calc(100vw - 120px); max-height: calc(100vh - 100px); object-fit: contain; border-radius: 6px; }
.lb-btn { position: absolute; width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; cursor: pointer; display: grid; place-items: center; }
.lb-btn:hover { background: rgba(255,255,255,.24); }
.lb-btn .ic { width: 24px; height: 24px; }
.lb-close { top: 16px; left: 16px; }
.lb-prev { right: 16px; top: 50%; transform: translateY(-50%); }
.lb-next { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-count { position: absolute; bottom: 18px; color: #fff; font-weight: 700; background: rgba(255,255,255,.12); padding: 2px 12px; border-radius: 999px; }

#toasts { position: fixed; bottom: 20px; left: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1d1f5c; color: #fff; padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 600; max-width: 380px; border-inline-start: 4px solid var(--brand-green); animation: tin .2s ease; transition: opacity .3s, transform .3s; }
.toast.err { border-inline-start-color: #f97066; }
.toast.hide { opacity: 0; transform: translateY(8px); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

/* ---------- صفحة الدخول */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side {
  position: relative; overflow: hidden; background: var(--brand-blue);
  color: #e4e5fa; display: flex; align-items: center; justify-content: center; padding: 48px;
}
.auth-side::before { content: ""; position: absolute; inset: 0 0 0 auto; width: 34%; background: url("/static/brand/pattern.svg") repeat; opacity: .9; }
.auth-side::after { content: ""; position: absolute; left: -60px; bottom: -40px; width: 520px; height: 260px; background: url("/static/brand/mark-white.png") no-repeat center / contain; opacity: .06; }
.auth-brand { position: relative; z-index: 1; max-width: 440px; }
.auth-logo { width: 300px; max-width: 100%; height: auto; display: block; }
.auth-brand h1 { font-size: 30px; color: #fff; margin: 34px 0 8px; }
.auth-brand h1 span { color: var(--brand-green); }
.auth-brand p { font-size: 16px; opacity: .9; margin: 0 0 28px; }
.auth-feats { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.auth-feats li { display: flex; gap: 12px; align-items: center; font-weight: 600; }
.auth-feats .ic { width: 36px; height: 36px; padding: 8px; border-radius: 10px; background: rgba(0, 188, 112, .18); color: var(--brand-green); }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 32px 16px; background: url("/static/brand/pattern-light.svg") repeat; background-color: var(--bg); }
.auth-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 16px; background: #fff; padding: 32px; border-radius: 18px; box-shadow: var(--shadow-lg); border-top: 4px solid var(--brand-green); }
.auth-card-logo { width: 230px; max-width: 80%; height: auto; display: block; margin: 0 auto 6px; }
.auth-card h2 { font-size: 24px; color: var(--brand-blue); }
.auth-card .btn { height: 46px; font-size: 16px; }

/* ---------- المناقلات والطلبات */
.picker { position: relative; }
.picker > .ic { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.picker input { width: 100%; height: 44px; padding: 0 40px 0 12px; border: 1px solid var(--border-strong); border-radius: 10px; outline: none; background: #fff; }
.picker input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.picker .suggest { z-index: 20; max-height: 360px; overflow-y: auto; }
.sg-qty { text-align: center; font-weight: 800; font-size: 15px; color: var(--new); min-width: 56px; }
.sg-qty small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.sg-qty.zero { color: var(--danger); }
.tr-route { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: end; }
.tr-arrow { width: 42px; height: 42px; border-radius: 50%; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; }
.tr-show { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; text-align: center; }
.tr-show > div:not(.tr-arrow) { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.tr-show small { display: block; color: var(--muted); font-weight: 700; font-size: 12px; }
.tr-show b { font-size: 18px; }
.tr-show .tr-arrow { margin: auto; }
.qty-in { display: flex; gap: 4px; align-items: center; }
.qty-in input { width: 100px; height: 36px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 8px; outline: none; }
.qty-in input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.tbl.lines td { vertical-align: middle; }
.tbl tr.clickable { cursor: pointer; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.timeline li:last-child { border-bottom: 0; }
.tl-ic { width: 28px; height: 28px; border-radius: 50%; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; flex: none; }
.tl-ic .ic { width: 15px; height: 15px; }
.perm-box { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); }
.perm-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.perm-head b { display: inline-flex; gap: 6px; align-items: center; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.perm-group { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.perm-group h5 { margin: 0 0 2px; font-size: 13px; color: var(--primary); }
.perm-group .check { font-weight: 500; font-size: 14px; }
.wh-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.modal.wide { max-width: 760px; }

/* ---------- الوحدات الجديدة */
.nav-title { font-size: 11.5px; font-weight: 700; color: rgba(255,255,255,.55); padding: 10px 12px 2px; letter-spacing: .2px; }
.nav a { padding: 8px 12px; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 6px; }
.sidebar-foot { padding: 10px 12px !important; }
.user-card { padding: 0 !important; }
.side-icon { width: 34px; height: 34px; border-radius: 8px; border: 0; background: rgba(255,255,255,.08); color: var(--side-text); display: grid; place-items: center; cursor: pointer; flex: none; }
.side-icon:hover { background: rgba(255,255,255,.18); color: #fff; }
.code-pill { white-space: nowrap; }
.brand { padding: 16px 20px 14px !important; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.kv4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.in-qty { color: var(--new); }
.out-qty { color: var(--danger); }
.action-card { margin-bottom: 16px; border-top: 4px solid var(--brand-blue); }
.action-card.green { border-top-color: var(--brand-green); }
.action-card h3 { margin-bottom: 14px; display: flex; gap: 8px; align-items: center; }
.signs { display: none; }
.part-row { display: flex; gap: 8px; align-items: center; padding: 6px 8px; background: #fff; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; }

.veh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.veh-card { padding: 0; overflow: hidden; color: inherit; text-decoration: none !important; display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s; }
.veh-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.veh-img { position: relative; height: 140px; background: linear-gradient(135deg, var(--primary-50), #fff); display: grid; place-items: center; color: var(--primary-100); }
.veh-img .ic { width: 64px; height: 64px; }
.veh-img img { width: 100%; height: 100%; object-fit: cover; }
.veh-img .badge { position: absolute; top: 10px; right: 10px; }
.veh-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.veh-plate { display: inline-block; align-self: flex-start; font-weight: 800; font-size: 14px; background: #fff; color: var(--brand-blue); border: 2px solid var(--brand-blue); border-radius: 6px; padding: 0 10px; direction: ltr; unicode-bidi: isolate; }
.veh-plate.inline { font-size: 15px; vertical-align: middle; margin-inline-start: 6px; }
.veh-name { font-weight: 800; font-size: 16px; }
.veh-meta, .veh-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--text-2); flex-wrap: wrap; }
.veh-meta .ic, .veh-foot .ic { width: 15px; height: 15px; color: var(--muted); }
.veh-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.veh-foot { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--border); }
.veh-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.veh-photo { position: relative; width: 150px; height: 110px; border-radius: 12px; overflow: hidden; background: var(--primary-50); display: grid; place-items: center; color: var(--primary-100); flex: none; }
.veh-photo img { width: 100%; height: 100%; object-fit: cover; }
.veh-photo > .ic { width: 56px; height: 56px; }
.veh-photo-btn { position: absolute; bottom: 6px; left: 6px; width: 32px; padding: 0; }
.veh-odo { margin-top: 6px; font-size: 14px; color: var(--text-2); display: flex; gap: 6px; align-items: center; }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mini-stats > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.mini-stats small { color: var(--muted); font-weight: 700; font-size: 12px; }
.mini-stats b { font-size: 17px; }
.mini-stats span { font-size: 12px; color: var(--muted); }
.plan-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.plan { position: relative; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: #fff; }
.plan.overdue { border-color: #f4b4a3; background: #fff8f6; }
.plan.soon { border-color: #f6d3a5; background: #fffbf3; }
.plan-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 8px; }
.plan .bar > i { background: var(--brand-green); }
.plan .bar.soon > i { background: #f79009; }
.plan .bar.overdue > i { background: var(--danger); }
.plan-meta { display: flex; flex-direction: column; gap: 1px; font-size: 12.5px; color: var(--text-2); margin-top: 8px; }
.plan-act { position: absolute; left: 6px; bottom: 6px; display: flex; }
.due-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.due { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); color: inherit; text-decoration: none !important; background: #fff; margin-bottom: 6px; }
.due:hover { box-shadow: var(--shadow); }
.due.overdue { border-color: #f4b4a3; background: #fff8f6; }
.due.soon { border-color: #f6d3a5; background: #fffbf3; }
.due .badge { align-self: flex-start; }
.due span { font-size: 13px; color: var(--text-2); }
.due small { color: var(--muted); }

/* ---------- التقارير */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.kpi-top { display: flex; gap: 10px; align-items: center; }
.kpi-top .stat-ic { width: 36px; height: 36px; border-radius: 10px; }
.kpi-top .stat-ic .ic { width: 18px; height: 18px; }
.kpi-label { font-size: 13.5px; font-weight: 700; color: var(--text-2); }
.kpi-value { font-size: 24px; font-weight: 800; line-height: 1.3; }
.kpi-sub { font-size: 13px; color: var(--text-2); }
.kpi-delta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kpi-delta .badge .ic { width: 13px; height: 13px; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; margin-bottom: 20px; }
.chart-card .card-head { margin-bottom: 6px; align-items: flex-start; }
.chart-box { position: relative; }
.chart-box svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-box .ax { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart-box .ax.cur { fill: var(--text); font-weight: 700; }
.chart-box .vl { font-size: 12px; font-weight: 700; fill: var(--text); }
.chart-box .hit { cursor: default; outline: none; }
.chart-box .hit.on { fill: rgba(46, 49, 146, .06); }
.chart-tip { position: absolute; z-index: 5; background: #1d1f5c; color: #fff; font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 6px; white-space: nowrap; pointer-events: none; transform: translateY(-100%); box-shadow: var(--shadow); }
.chart-table { margin-top: 8px; max-height: 260px; overflow-y: auto; }
.rep-sect { margin-bottom: 22px; }
.rep-sect > h2 { display: flex; gap: 8px; align-items: center; margin: 4px 0 12px; color: var(--brand-blue); font-size: 19px; }
.rep-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.rep-2 .card h3, .rep-sect > .card h3 { margin-bottom: 10px; }
.rep-2 .table-wrap { box-shadow: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.share { height: 4px; background: var(--primary-50); border-radius: 4px; margin-top: 4px; overflow: hidden; }
.share > i { display: block; height: 100%; background: var(--brand-blue); border-radius: 4px; }
@media (max-width: 1100px) { .rep-2 { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .chart-grid { grid-template-columns: 1fr; } .kpi-grid { grid-template-columns: 1fr 1fr; } .kpi-value { font-size: 19px; } }

/* ---------- المشاريع ومواقع العمل */
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; font-size: 13px; color: var(--text-2); }
.chip b { color: var(--text); }
.pbar { height: 8px; background: #edf0f5; border-radius: 99px; overflow: hidden; margin: 4px 0; }
.pbar > i { display: block; height: 100%; background: var(--brand-blue); border-radius: 99px; transition: width .3s; }
.pbar.thin { height: 4px; margin: 2px 0 8px; }
.pbar.thin > i { background: #7c80cf; }
.pbar.ok > i { background: var(--new); }
.pbar.warn > i { background: var(--used); }
.pbar.over > i { background: var(--danger); }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.proj-card { display: flex; flex-direction: column; gap: 4px; color: inherit; text-decoration: none !important; transition: transform .15s, box-shadow .15s; border-top: 4px solid var(--brand-blue); }
.proj-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.proj-card h3 { margin: 4px 0 2px; font-size: 17px; }
.pc-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; margin-bottom: 6px; }
.pc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pm-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); margin-top: 6px; }
.proj-mini { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.pm { display: block; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; color: inherit; text-decoration: none !important; }
.pm:hover { border-color: var(--primary-100); }
.pm-top { display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.alert-list { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
.alert-list a { font-size: 13.5px; color: var(--danger); background: var(--danger-50); border-radius: 8px; padding: 6px 10px; display: flex; gap: 6px; align-items: center; }
.big-pct { font-size: 34px; font-weight: 800; color: var(--brand-blue); line-height: 1.2; }
.cost-list > div:not(.pbar) { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; align-items: center; }
.cost-list span { display: inline-flex; gap: 6px; align-items: center; color: var(--text-2); }
.cost-total { display: flex; justify-content: space-between; font-size: 17px; border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; }
.inv-sum { display: flex; flex-direction: column; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin: 10px 0; }
.inv-sum > div { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.inv-sum .net { border-top: 1px solid var(--border); padding-top: 6px; margin-top: 2px; font-size: 17px; color: var(--brand-blue); }
.inv-tbl td, .inv-tbl th { font-size: 12.5px; }
.sr-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.sr-card { color: inherit; text-decoration: none !important; display: flex; flex-direction: column; gap: 6px; }
.sr-card:hover { box-shadow: var(--shadow-lg); }
.sr-head { display: flex; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.sr-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.sr-text { margin: 0; font-size: 14px; color: var(--text-2); white-space: pre-wrap; }
.sr-issue { margin: 0; font-size: 13px; color: var(--used); }
.sr-photos { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.sr-photos img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.sr-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.sr-gallery button { padding: 0; border: 0; border-radius: 10px; overflow: hidden; aspect-ratio: 4/3; cursor: zoom-in; background: var(--surface-2); }
.sr-gallery img { width: 100%; height: 100%; object-fit: cover; }
.att-seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.att-seg button { border: 0; background: #fff; padding: 6px 10px; font-weight: 700; font-size: 13px; color: var(--muted); cursor: pointer; }
.att-seg button + button { border-inline-start: 1px solid var(--border); }
.att-seg button.on.present { background: var(--new-50); color: var(--new); }
.att-seg button.on.half { background: var(--used-50); color: var(--used); }
.att-seg button.on.absent { background: var(--danger-50); color: var(--danger); }
.att-seg button.on.leave { background: var(--primary-50); color: var(--primary); }
.att-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.tbl.quotes td.best { background: var(--new-50); color: var(--new); font-weight: 800; }
.tbl.quotes .sel { box-shadow: inset 0 0 0 2px var(--brand-green); }
.tbl.quotes tr.tot td { background: var(--surface-2); }
.bk-list > div { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); }
.print-only { display: none; }
.labels { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.label { display: flex; gap: 8px; align-items: center; border: 1px dashed var(--border-strong); border-radius: 8px; padding: 8px; background: #fff; break-inside: avoid; }
.label img { width: 86px; height: 86px; flex: none; }
.lb-txt { display: flex; flex-direction: column; min-width: 0; font-size: 12px; line-height: 1.45; }
.lb-txt b { font-size: 13.5px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lb-txt span { font-weight: 800; color: var(--brand-blue); }
.lb-txt small { color: var(--muted); }
.labels.sz-s { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
.labels.sz-s .label img { width: 62px; height: 62px; }
.labels.sz-s .lb-txt b { font-size: 12px; }
.labels.sz-l { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.labels.sz-l .label img { width: 130px; height: 130px; }
.labels.sz-l .lb-txt b { font-size: 16px; }
@media (max-width: 600px) { .proj-grid, .sr-list { grid-template-columns: 1fr; } .att-seg button { padding: 6px 7px; font-size: 12px; } }

/* ---------- جدول كل السلاسل */
.cs-tbl td { vertical-align: top; min-width: 190px; }
.cs-cell { display: table-cell; }
.cs-cell.own { background: #f5f6ff; }
.cs-cell .btn { margin-top: 8px; }
.cs-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 6px; }
.cs-step { display: inline-flex; flex-direction: column; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 3px 8px; line-height: 1.35; }
.cs-step b { font-size: 12.5px; }
.cs-step small { font-size: 11px; color: var(--muted); }
.cs-arrow .ic { width: 13px; height: 13px; color: var(--muted); }

.rev { border-top: 1px solid var(--border); padding: 8px 0; }
.rev summary { cursor: pointer; font-size: 13.5px; }

/* ---------- الحسابات المصرفية */
.bank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.bank-card { display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none !important; border-top: 4px solid var(--brand-blue); transition: box-shadow .15s; }
.bank-card:hover { box-shadow: var(--shadow-lg); }
.bank-card.low { border-top-color: var(--danger); }
.bk-top { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; }
.bk-top h3 { margin: 0; font-size: 16.5px; }
.bk-row { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; align-items: flex-start; }
.bk-row b { text-align: left; }
.bk-av { border-top: 1px solid var(--border); padding-top: 6px; font-size: 15.5px; color: var(--brand-blue); }
.bk-warn { color: var(--danger); font-size: 13px; font-weight: 700; display: flex; gap: 6px; align-items: center; }
.bs-tbl td { vertical-align: top; }

/* ---------- مركز الصلاحيات */
.ac-wrap { max-height: 72vh; overflow: auto; }
.ac-tbl { border-collapse: separate; border-spacing: 0; }
.ac-tbl th, .ac-tbl td { text-align: center; padding: 6px 8px; white-space: nowrap; }
.ac-tbl thead th { position: sticky; top: 0; z-index: 3; background: var(--surface); }
.ac-tbl .ac-first { position: sticky; inset-inline-start: 0; z-index: 2; background: var(--surface); text-align: start; min-width: 230px; }
.ac-tbl thead .ac-first { z-index: 4; }
.ac-user { min-width: 140px; vertical-align: bottom; }
.ac-user b { display: block; font-size: 13.5px; }
.ac-user small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 500; }
.ac-user.off { opacity: .6; }
.ac-uact { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.ac-uact .btn { font-size: 11.5px; padding: 2px 6px; justify-content: center; }
.ac-tbl input[type=checkbox] { width: 19px; height: 19px; accent-color: var(--brand-green); cursor: pointer; }
.ac-tbl tr.ac-group td { background: var(--primary-50) !important; color: var(--brand-blue); font-weight: 800; text-align: start; }
.ac-tbl tr.ac-allrow td { background: #fffbef; }
.ac-tbl tbody tr:hover td { background: var(--surface-2); }
.ac-tbl .ac-first .ic { width: 15px; height: 15px; vertical-align: -3px; color: var(--muted); }
.ac-rowbtn { border: 1px solid var(--border); background: #fff; border-radius: 6px; font-size: 11px; padding: 1px 6px; margin-inline-start: 6px; cursor: pointer; color: var(--text-2); }
.ac-na { color: var(--border-strong); font-weight: 800; }
.ac-legend { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }

/* ---------- قفل الأقسام */
.nav a.nav-locked { opacity: .5; cursor: not-allowed; }
.nav a.nav-locked:hover { background: transparent; }
.nav a.nav-locked .nav-lock { width: 14px; height: 14px; margin-inline-start: auto; flex: none; }
.lockable .lk { display: none; align-items: center; gap: 3px; color: var(--danger); font-size: 11.5px; font-weight: 700; margin-inline-start: 6px; }
.lockable .lk .ic { width: 12px; height: 12px; }
.lockable input:not(:checked) ~ .lk { display: inline-flex; }

/* ---------- تطبيق الموبايل */
.install-banner { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; padding: 12px 14px; border-inline-start: 4px solid var(--brand-green); }
.install-banner[hidden] { display: none; }
.side-icon.only-mobile { display: none; }
@media (max-width: 900px) { .side-icon.only-mobile { display: grid; } }
.install-banner img { width: 44px; height: 44px; border-radius: 12px; flex: none; }
@media (display-mode: standalone) {
  .topbar { padding-top: env(safe-area-inset-top); }
  body { overscroll-behavior-y: contain; }
}

/* ---------- التوقيع الإلكتروني وسلسلة الموافقات */
.sig-pad { position: relative; border: 2px dashed var(--border-strong); border-radius: 12px; background: #fff; touch-action: none; }
.sig-pad canvas { display: block; width: 100%; height: auto; cursor: crosshair; touch-action: none; }
.sig-line { position: absolute; inset-inline: 8%; bottom: 22%; border-bottom: 1px solid #c9ccd8; pointer-events: none; }
.sig-current { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sig-current img { max-height: 54px; max-width: 220px; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px; }
.chain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.chain > li { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; position: relative; }
.chain > li:not(:last-child)::after { content: ""; position: absolute; inset-inline-start: 15px; top: 40px; bottom: -8px; border-inline-start: 2px solid var(--border); }
.ch-no { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 800; background: var(--surface-2); border: 2px solid var(--border-strong); color: var(--muted); z-index: 1; }
.ch-no .ic { width: 16px; height: 16px; }
.chain > li.done .ch-no { background: var(--new); border-color: var(--new); color: #fff; }
.chain > li.now .ch-no { background: var(--brand-blue); border-color: var(--brand-blue); color: #fff; box-shadow: 0 0 0 4px var(--primary-50); }
.chain.edit > li { border-bottom: 1px solid var(--border); padding: 12px 0; }
.chain.edit > li::after { display: none; }
.ch-edit { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.chain > li > div { min-width: 0; }
.ch-edit select, .ch-edit input:not([type=checkbox]) { width: 100%; min-width: 0; }
.ppl-row input[type=checkbox] { width: 18px; height: 18px; flex: none; }
.ch-edit .field { margin: 0; }
.ch-edit select[multiple] { height: auto; min-height: 76px; }
.ch-edit [data-users] { grid-column: 1 / -1; order: 9; }
.ppl { max-height: 190px; overflow-y: auto; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; padding: 6px 8px; margin-top: 4px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px 14px; }
.ppl-row { display: flex !important; align-items: center; gap: 6px; padding: 5px 4px; border-radius: 6px; white-space: nowrap; }
.ppl-row:hover { background: var(--surface-2); }
.ppl-row .pn b, .ppl-row .pn small { overflow: hidden; text-overflow: ellipsis; }
.ppl-q { max-width: 320px; }
.ppl-row .pn { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.35; }
.ppl-row .pn b { font-weight: 600; font-size: 13.5px; color: var(--text); }
.ppl-row .pn small { color: var(--muted); font-size: 11.5px; font-weight: 500; }
.ppl-q { height: 34px; }
.ch-tools { display: flex; gap: 4px; padding-bottom: 6px; }
.sig-boxes { display: grid; gap: 14px; margin-top: 30px; text-align: center; }
.sig-box { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 13px; }
.sig-box .sig-img { height: 70px; width: 100%; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid var(--border-strong); padding-bottom: 2px; margin-bottom: 6px; }
.sig-box .sig-img img { max-height: 64px; max-width: 100%; }
.sig-box span { color: var(--text-2); }
.sig-box small { color: var(--muted); font-size: 11px; }
.vd-recv { margin: 22px 0 0; font-size: 13.5px; color: var(--text-2); }
.ap-record { margin-top: 26px; border: 2px solid var(--primary-100); border-radius: 12px; padding: 14px; background: #fbfbff; break-inside: avoid; }
.ap-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.ap-head h3 { margin: 0 0 2px; color: var(--brand-blue); }
.ap-qr { display: flex; gap: 10px; align-items: center; }
.ap-qr img { width: 92px; height: 92px; background: #fff; }
.ap-qr > div { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.ap-qr b { font-family: Consolas, monospace; font-size: 15px; letter-spacing: 1px; }
.ap-tbl td, .ap-tbl th { font-size: 12.5px; padding: 6px 8px; }
.ap-sig { max-height: 40px; max-width: 120px; }
.verify-ok, .verify-bad { display: flex; gap: 14px; align-items: flex-start; border-inline-start: 6px solid var(--new); }
.verify-bad { border-inline-start-color: var(--danger); }
.verify-ok > .ic, .verify-bad > .ic { width: 34px; height: 34px; flex: none; color: var(--new); }
.verify-bad > .ic { color: var(--danger); }
.verify-ok h3, .verify-bad h3 { margin: 0 0 6px; }
@media (max-width: 900px) { .ch-edit { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .sig-boxes { grid-template-columns: 1fr 1fr !important; } }
@media print { .sig-boxes { grid-template-columns: repeat(4, 1fr); } .sig-box { break-inside: avoid; } }

/* ---------- صور المستندات */
.doc-imgs { margin-top: 16px; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.doc-img { position: relative; margin: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.doc-img > button[data-i] { display: block; width: 100%; aspect-ratio: 4/3; padding: 0; border: 0; cursor: zoom-in; background: #fff; }
.doc-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.doc-img figcaption { display: flex; justify-content: space-between; gap: 4px; font-size: 11.5px; color: var(--muted); padding: 4px 8px; }
.doc-del { position: absolute; top: 6px; left: 6px; width: 30px; height: 30px; border-radius: 8px; border: 0; background: rgba(255,255,255,.92); color: var(--danger); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow); }
.doc-del .ic { width: 16px; height: 16px; }
label.btn.disabled { opacity: .55; pointer-events: none; }

/* ---------- الحسابات */
.acc-tree .tbl td { padding-top: 7px; padding-bottom: 7px; }
.acc-tree tr.grp td { background: var(--surface-2); font-weight: 700; }
.acc-tree tr.lvl1 td { background: var(--primary-50); color: var(--brand-blue); font-size: 15px; }
.acc-name { display: inline-flex; align-items: center; gap: 6px; }
.acc-tog { width: 24px; height: 24px; border: 0; background: transparent; cursor: pointer; border-radius: 6px; color: var(--muted); display: inline-grid; place-items: center; padding: 0; }
.acc-tog:hover { background: var(--border); }
.acc-tog .ic { width: 15px; height: 15px; transition: transform .15s; }
.acc-tog.open .ic { transform: rotate(-90deg); }
.acc-code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: var(--text-2); direction: ltr; unicode-bidi: isolate; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.amt-dr { color: var(--brand-blue); }
.amt-cr { color: #a2531a; }
.acc-pick { position: relative; }
.acc-pick input { width: 100%; }
.acc-pick .suggest { max-height: 300px; overflow-y: auto; }
.acc-pick .sg-item { display: flex; justify-content: space-between; gap: 8px; align-items: center; cursor: pointer; }
.acc-pick .sg-item small { color: var(--muted); }
.acc-pick .sg-item.active, .acc-pick .sg-item:hover { background: var(--primary-50); }
.jl-tbl td { vertical-align: top; }
.jl-tbl input, .jl-tbl select { width: 100%; min-width: 0; }
.jl-tbl .w-amt { width: 150px; }
.jl-tbl .w-cc { width: 180px; }
.jl-tbl tfoot td { font-weight: 800; background: var(--surface-2); }
.jl-diff { color: var(--danger); font-weight: 800; }
.jl-ok { color: var(--new); font-weight: 800; }
.voucher-doc { max-width: 900px; }
.vd-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; border-bottom: 3px solid var(--brand-green); padding-bottom: 12px; margin-bottom: 14px; }
.vd-title { font-size: 24px; font-weight: 800; color: var(--brand-blue); margin: 0; }
.vd-no { font-size: 15px; font-weight: 800; direction: ltr; unicode-bidi: isolate; }
.vd-amount { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; background: var(--primary-50); border: 1px solid var(--primary-100); border-radius: 12px; padding: 12px 16px; margin: 12px 0; }
.vd-amount b { font-size: 24px; color: var(--brand-blue); }
.vd-words { flex: 1; min-width: 220px; font-weight: 700; color: var(--text-2); }
.vd-kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 16px; margin-bottom: 12px; }
.vd-kv > div { display: flex; flex-direction: column; font-size: 14px; }
.vd-kv span { color: var(--muted); font-size: 12.5px; }
.vd-signs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-top: 46px; text-align: center; font-weight: 700; font-size: 13.5px; }
.vd-signs > div { border-top: 1px solid var(--border-strong); padding-top: 8px; }
.vd-stamp { display: inline-block; border: 2px solid currentColor; border-radius: 8px; padding: 2px 10px; font-weight: 800; transform: rotate(-4deg); }
.vd-stamp.posted { color: var(--new); }
.vd-stamp.draft { color: var(--used); }
.vd-stamp.cancelled { color: var(--danger); }
.day-block { margin-bottom: 18px; }
.day-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--brand-blue); color: #fff; border-radius: 10px 10px 0 0; padding: 8px 14px; }
.day-head h3 { margin: 0; color: #fff; font-size: 16px; }
.day-head .chip { background: rgba(255,255,255,.14); border-color: transparent; color: #fff; }
.day-head .chip b { color: #fff; }
.day-block .table-wrap { border-radius: 0 0 10px 10px; }
.db-entry td { border-top: 2px solid var(--border-strong) !important; background: var(--surface-2); }
.db-line td { font-size: 13.5px; }
.db-line td:first-child { padding-inline-start: 26px; }
.cash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.cash-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface); display: flex; flex-direction: column; gap: 3px; }
.cash-card h4 { margin: 0 0 4px; font-size: 14.5px; }
.cash-card > div { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--text-2); }
.cash-card .cl { border-top: 1px solid var(--border); padding-top: 4px; margin-top: 2px; font-size: 15px; color: var(--text); font-weight: 800; }
.fin-tbl td.lv1 { font-weight: 800; color: var(--brand-blue); }
.fin-tbl td.lv2 { font-weight: 700; padding-inline-start: 22px; }
.fin-tbl td.lv3 { padding-inline-start: 40px; }
.fin-tbl td.lv4, .fin-tbl td.lv5, .fin-tbl td.lv6 { padding-inline-start: 58px; color: var(--text-2); }
.fin-total td { font-weight: 800; background: var(--surface-2); font-size: 15px; }
.fin-net td { font-weight: 800; font-size: 17px; }
.fin-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.op-row.problem td { background: #fff8f6; }
.op-lines { font-size: 12.5px; color: var(--text-2); margin: 4px 0 0; padding: 0; list-style: none; }
.op-lines li { display: flex; gap: 8px; justify-content: space-between; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; }
.map-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
#typeSeg { flex-wrap: wrap; }
#typeSeg button { white-space: nowrap; flex: 1 1 auto; }
@media (max-width: 1100px) { .fin-2 { grid-template-columns: 1fr; } }
@media (max-width: 600px) {
  .vd-signs { grid-template-columns: 1fr 1fr; }
  .map-grid { grid-template-columns: 1fr; }
  .map-row { grid-template-columns: 1fr; }
  .jl-tbl .w-amt, .jl-tbl .w-cc { width: auto; }
}

@media print {
  .kpi-grid { grid-template-columns: repeat(4, 1fr) !important; }
  .chart-grid { grid-template-columns: 1fr 1fr !important; }
  .rep-sect, .chart-card { break-inside: avoid; }
  .signs { display: grid !important; grid-template-columns: repeat(3, 1fr); gap: 30px; margin-top: 60px; text-align: center; font-weight: 700; }
  .signs > div { border-top: 1px solid #999; padding-top: 8px; }
  .sidebar, .topbar, .no-print, .backdrop, #toasts { display: none !important; }
  /* فورمة الشركة: الترويسة والتذييل يتكررون بكل صفحة */
  @page { size: A4; margin: 7mm 9mm 5mm; }
  .pframe { display: table !important; width: 100%; border-collapse: collapse; table-layout: fixed; }
  .layout, .main, .content { min-height: 0 !important; height: auto !important; }
  #view { min-width: 0; overflow-wrap: break-word; }
  #view td:has(> .tbl-thumb), #view table:has(.tbl-thumb) > thead th:first-child { display: none !important; }   /* صور المواد الصغيرة ما إلها داعي بالورق */
  .print-sign { break-before: avoid; }
  #view .detail-grid > *, #view .card { min-width: 0; }
  #view .table-wrap { overflow: visible !important; }
  .pframe > thead { display: table-header-group !important; }
  .pframe > tbody { display: table-row-group !important; }
  .pframe > tfoot { display: table-footer-group !important; }
  .pframe > * > tr { display: table-row !important; }
  .pframe > * > tr > td { display: table-cell !important; padding: 0 !important; border: 0 !important; background: none !important; }
  .print-head { display: block !important; padding: 0 0 4mm; }
  .print-head img { width: 100%; height: auto; display: block; }
  .pf-space { height: 21mm; }
  .print-foot { display: block !important; position: fixed; left: 0; right: 0; bottom: 0; }
  .print-foot img { width: 100%; height: auto; display: block; }
  .print-mark { display: block !important; position: fixed; top: 50%; left: 50%; width: 52%; transform: translate(-50%, -50%); opacity: .06; pointer-events: none; z-index: 0; }
  .print-meta { display: flex !important; justify-content: space-between; font-weight: 700; font-size: 14px; margin: 0 0 5mm; }
  .print-meta b { display: inline-block; min-width: 34mm; border-bottom: 1px dotted #999; font-weight: 600; }
  .print-sign:not(:empty) { display: flex !important; justify-content: flex-end; margin-top: 6mm; break-inside: avoid; }
  .ps-blk { text-align: center; min-width: 64mm; font-weight: 700; color: #2E3192; }
  .ps-title { font-size: 13px; line-height: 1.55; }
  .ps-sig { height: 13mm; display: flex; align-items: center; justify-content: center; }
  .ps-sig img { max-height: 16mm; max-width: 55mm; }
  .ps-name { font-size: 14px; }
  /* تواقيع الصفحات نفسها بشكل الفورمة: الصفة فوق، مكان التوقيع، خط منقّط */
  .signs { color: #2E3192; margin-top: 8mm !important; gap: 14px !important; break-inside: avoid; font-size: 13px; }
  .signs > div { border-top: 0 !important; padding-top: 0 !important; }
  .signs > div::after { content: ""; display: block; height: 13mm; border-bottom: 1px dotted #8a8db8; margin: 0 6mm; }
  .sig-boxes { margin-top: 8mm !important; break-inside: avoid; color: #2E3192; }
  .sig-box b { color: #2E3192; font-size: 13px; }
  .sig-box .sig-img { height: 15mm !important; border-bottom: 1px dotted #8a8db8 !important; }
  .sig-box .sig-img img { max-height: 14mm !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .main { margin: 0 !important; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
  .card, .table-wrap { box-shadow: none; break-inside: avoid; }
  .detail-grid { grid-template-columns: 1fr 1fr !important; }
  .print-only { display: block !important; }
  th.print-only, td.print-only { display: table-cell !important; }
  .labels { grid-template-columns: repeat(3, 1fr) !important; gap: 4px; }
  .labels.sz-s { grid-template-columns: repeat(4, 1fr) !important; }
  .labels.sz-l { grid-template-columns: repeat(2, 1fr) !important; }
  .label { border-color: #bbb; }
  .proj-grid, .sr-list { grid-template-columns: 1fr 1fr !important; }
  .tabs { display: none; }
  .vd-signs.print-only { display: grid !important; }
  .voucher-doc { max-width: none; border: 0; padding: 0; }
  .vd-signs { margin-top: 70px; }
  .fin-2 { grid-template-columns: 1fr 1fr !important; }
  .day-block { break-inside: auto; }
  .doc-grid { grid-template-columns: repeat(4, 1fr) !important; }
}

/* ---------- الشاشات الصغيرة */
@media (max-width: 1100px) {
  .dash-grid, .detail-grid, .form-grid { grid-template-columns: minmax(0, 1fr); }   /* minmax: العمود ما يكبر أعرض من الشاشة */
  .kv4 { grid-template-columns: 1fr 1fr; }
  .row3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .main { margin-right: 0; }
  .only-mobile { display: inline-flex; }
  .topbar { padding: 0 16px; gap: 10px; }
  .content { padding: 16px; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-card { padding: 24px 20px; }
  .lk-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  h1 { font-size: 20px; }
  .hero { padding: 20px; }
  .hero h1 { font-size: 21px; }
  .hide-sm { display: none; }
  .top-actions .btn { width: 38px; height: 38px; padding: 0; }
  /* الشريط العلوي بالموبايل: لازم يدخل بعرض الشاشة (قبل كان يطلع أعرض ويزحف الصفحة لليمين) */
  .topbar { padding: 0 10px; gap: 6px; }
  .topbar .btn-icon, .topbar .top-back { width: 38px; height: 38px; padding: 0; justify-content: center; flex: none; }
  #btnHome { display: none !important; }   /* الشعار نفسه يرجّع للرئيسية */
  .top-mark { height: 26px; }
  .gsearch { flex: 1 1 0; min-width: 0; }
  .gsearch input { min-width: 0; padding: 0 34px 0 8px; height: 38px; }
  .gsearch > .ic { right: 10px; }
  .top-actions { gap: 6px; flex: none; }
  .row2, .row3, .kv4 { grid-template-columns: 1fr; }
  .row3 .field[style*="span"] { grid-column: auto !important; }
  .mini-stats { grid-template-columns: 1fr; }
  .tr-route { grid-template-columns: 1fr; }
  .tr-route .tr-arrow { transform: rotate(-90deg); margin: auto; }
  .kv { grid-template-columns: 1fr 1fr; }
  .items-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ic-body { padding: 10px; }
  .ic-name { font-size: 14px; }
  .qty b { font-size: 16px; }
  .ic-foot { flex-direction: column; align-items: flex-start; }
  .price-tag { text-align: right; }
  .filter-row { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px; gap: 10px; flex-direction: column; align-items: flex-start; }
  .stat-value { font-size: 20px; }
  .lightbox img { max-width: 100vw; }
  .lb-prev, .lb-next { top: auto; bottom: 12px; transform: none; }
  #toasts { left: 16px; right: 16px; }
}

/* اسم المستخدم الطويل أسفل القائمة: سطر واحد بدل تكسير الاسم كلمةً كلمة */
.user-card .user-name, .user-card .user-role { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* دليل ترحيل المذكرات */
.rule-box { background: var(--surface); border: 1px solid var(--border); border-inline-start: 4px solid var(--primary); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 12px; }
.rule-box select { max-width: 420px; }
.rule-info { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; color: var(--text-2); }
.rule-info b { color: var(--text); margin-inline-end: 4px; }
.chip-x { border: 0; background: none; cursor: pointer; color: var(--text-3, #888); font-size: 15px; line-height: 1; padding: 0 2px; }
.chip-x:hover { color: var(--danger); }

/* أقسام المذكرات */
.sec-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; margin-inline-end: 4px; }
.vs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.vs-card { margin: 0; display: flex; flex-direction: column; }
.vs-items { display: flex; flex-direction: column; gap: 8px; }
.vs-item { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: inherit; text-decoration: none; background: #fff; }
.vs-item:hover { border-color: var(--primary); background: var(--surface); }
.vs-item small { flex-basis: 100%; }
.vs-free { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 10px; }
.sec-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.sec-tab { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 6px 14px; cursor: pointer; font: inherit; font-size: 14px; color: var(--text-2); }
.sec-tab small { color: var(--text-3, #888); margin-inline-start: 4px; }
.sec-tab.on { border-color: var(--sc, var(--primary)); box-shadow: inset 0 -3px 0 var(--sc, var(--primary)); color: var(--text); font-weight: 600; }
.sec-chip { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; margin-inline-end: 6px; color: var(--sc); border: 1px solid var(--sc); background: #fff; }
.sec-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.sec-pick select { max-width: 320px; }
.sec-colors { display: flex; gap: 8px; flex-wrap: wrap; }
.sec-color { width: 30px; height: 30px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--border); cursor: pointer; }
.sec-color.on { box-shadow: 0 0 0 2px var(--text); }

/* تحديد المواد للحذف */
.items-grid.selecting .item-card { cursor: pointer; }
.sel-box { position: absolute; top: 8px; inset-inline-start: 8px; z-index: 2; width: 26px; height: 26px; border-radius: 7px; background: #fff; border: 2px solid var(--border-strong); display: grid; place-items: center; color: transparent; }
.sel-box svg { width: 16px; height: 16px; }
.item-card.is-sel { outline: 3px solid var(--danger); outline-offset: -3px; }
.item-card.is-sel .sel-box { background: var(--danger); border-color: var(--danger); color: #fff; }
tr.is-sel td { background: #fff1f1; }
.sel-bar { position: sticky; bottom: 12px; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; padding: 10px 14px; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 6px 24px rgba(20, 24, 60, .16); }
.sel-bar #selDel { margin-inline-start: auto; }

/* فيديو المواد */
.vid-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.vid { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #000; }
.vid video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; object-fit: contain; }
.vid-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; background: #fff; font-size: 12.5px; color: var(--text-2); }
.vid-progress { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; font-size: 14px; }
.vid-progress .bar { flex: 1; min-width: 140px; height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.vid-progress .bar i { display: block; height: 100%; background: var(--primary); transition: width .2s; }
.vid-count { top: 8px; bottom: auto; }

/* أقسام النسخ الاحتياطي */
.bk-secs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 8px 0; }
.bk-secs > div { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; background: var(--surface); }
.bk-secs b { font-size: 13px; } .bk-secs span { font-weight: 700; font-size: 16px; }

/* استيراد المواد */
.imp-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.imp-stats > div { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; background: var(--surface); }
.imp-stats b { font-size: 22px; } .imp-stats span { font-size: 13px; color: var(--text-2); }
.imp-stats .ok b { color: var(--new); } .imp-stats .bad b { color: var(--danger); }

/* المواد التي تحتاج مراجعة بعد الاستيراد */
.review-tag { position: absolute; bottom: 8px; inset-inline-start: 8px; background: var(--used); color: #fff; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; display: inline-flex; gap: 4px; align-items: center; }
.review-tag .ic { width: 12px; height: 12px; }
.imp-stats .warn b { color: var(--used); }

/* الخلاصة النهائية لعقد المقاول */
.settle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.settle-grid > div { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; background: var(--surface); }
.settle-grid span { font-size: 13px; color: var(--text-2); } .settle-grid b { font-size: 16px; }
.settle-grid .neg b { color: var(--danger); } .settle-grid .tot { border-color: var(--primary); background: #fff; } .settle-grid .tot b { font-size: 18px; color: var(--primary); }
@media print { .settle-grid > div { break-inside: avoid; } }

.cond-toggle .cond-broken input:checked + span { background: var(--danger); border-color: var(--danger); color: #fff; }

/* الذكاء المدمج: اقتراحات النظام */
.ai-hint { margin-top: 6px; }
.ai-hint[hidden] { display: none; }
.ai-chip { display: inline-flex; align-items: center; gap: 5px; border: 1px dashed var(--info); background: var(--info-50); color: var(--info);
  border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12.5px; cursor: pointer; }
.ai-chip:hover:not([disabled]) { background: var(--info); color: #fff; }
.ai-chip[disabled] { cursor: default; opacity: .85; }
.ai-chip svg { width: 13px; height: 13px; }
.ai-v { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 8px 12px; border: 1px dashed var(--info);
  background: var(--info-50); border-radius: 10px; font-size: 13px; margin: -4px 0 8px; }
.ai-v .ai-t { color: var(--info); font-weight: 700; }
.ai-price { margin-top: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
tr.ai-filled .price-inline input { border-color: var(--info); background: var(--info-50); }
.ai-flag { font-size: 13px; margin-top: 4px; display: flex; gap: 5px; align-items: flex-start; }
.ai-flag.danger { color: var(--danger); font-weight: 600; }
.ai-flag.warn { color: var(--used); }
.ai-flag svg { width: 14px; height: 14px; flex: none; margin-top: 2px; }
@media (max-width: 560px) { .cond-toggle { flex-direction: column; } }
.field[hidden] { display: none; }

.locked-val { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-weight: 600; font-size: 12.5px; }
.locked-val svg { width: 13px; height: 13px; }

/* فحوصات الجودة */
.qt-ages { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 8px 0; }
.qt-details { max-width: 280px; white-space: pre-line; }

/* طلبات الإجازة */
.lv-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.lv-steps li { border: 1px solid var(--border, #e3e6ee); border-inline-start: 4px solid #cfd4de; border-radius: 10px; padding: 8px 12px; }
.lv-steps li.done { border-inline-start-color: var(--new); }
.lv-steps li.cur { border-inline-start-color: var(--used); background: var(--used-50); }
.lv-chain-step { border: 1px solid var(--border, #e3e6ee); border-radius: 10px; padding: 12px; margin: 10px 0; }
.lv-chain-start { display: flex; gap: 6px; align-items: center; color: var(--text-2); font-weight: 600; }
.lv-users { display: flex; flex-wrap: wrap; gap: 6px 16px; }

/* القائمة الجانبية: أقسام تنفتح وتنسد */
.nav-group { display: flex; flex-direction: column; }
.nav-gh { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; margin-top: 4px; border: 0; border-radius: 10px;
  background: transparent; color: rgba(255,255,255,.88); font: inherit; font-weight: 700; cursor: pointer; text-align: start; }
.nav-gh:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-gh .nav-chev { width: 16px; height: 16px; margin-inline-start: auto; transition: transform .2s; opacity: .7; }
.nav-gh .nav-gcount + .nav-chev { margin-inline-start: 6px; }
.nav-group.open > .nav-gh .nav-chev { transform: rotate(-90deg); }
.nav-group.open > .nav-gh .nav-gcount { display: none; }
.nav-gbody { display: none; flex-direction: column; gap: 2px; padding-inline-start: 10px; border-inline-start: 1px solid rgba(255,255,255,.12); margin-inline-start: 20px; }
.nav-group.open > .nav-gbody { display: flex; }
.nav-gbody a { padding: 7px 10px; font-size: 13.5px; }
.nav-gbody a.active::before { right: -23px; }
.nav-sub { font-size: 11px; font-weight: 700; color: rgba(255,255,255,.5); padding: 8px 10px 2px; }

/* اختيار الحساب: عمود الحساب بعرض مقروء */
.jl-tbl th:nth-child(2), .jl-tbl td:nth-child(2) { min-width: 240px; }
.jl-tbl th:nth-child(3), .jl-tbl td:nth-child(3) { min-width: 140px; }
.acc-pick .sg-item { padding: 8px 10px; line-height: 1.5; }
.acc-pick .sg-item span { min-width: 0; }
.acc-pick .sg-item small { flex: none; max-width: 40%; text-align: start; }

.u-sig { white-space: nowrap; }
.u-sig img { max-height: 34px; max-width: 110px; vertical-align: middle; background: #fff; border: 1px solid #eef0f4; border-radius: 6px; }

/* حقل التاريخ يوم/شهر/سنة */
.dmy { position: relative; display: flex; align-items: center; width: 100%; min-width: 0; }
.dmy > input[type=text] { flex: 1; min-width: 0; width: 100%; padding-inline-end: 38px; text-align: right; }
.dmy > input.bad { border-color: var(--danger) !important; background: var(--danger-50); }
.dmy-btn { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--text-2);
  width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer; border-radius: 8px; }
.dmy-btn:hover { background: var(--primary-50); color: var(--primary); }
.dmy-btn svg { width: 18px; height: 18px; }
.dmy-btn:disabled { opacity: .4; cursor: default; }
.dmy > input.dmy-native { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; padding: 0; border: 0; }
@media (max-width: 420px) {
  #btnPres { display: none !important; }   /* نشاط الموظفين موجود بالقائمة (الإدارة) */
}
@media (max-width: 600px) {
  .page-head > div { min-width: 0; }
  .page-head p, .page-head .ltr, .muted .ltr, .hint .ltr, .hint a, p .ltr, li .ltr { overflow-wrap: anywhere; }   /* المسارات والروابط الطويلة تنكسر بدل ما توسّع الصفحة */
  .card-head { flex-wrap: wrap; }
  .card-head > * { min-width: 0; }
}

/* أسطر السند بالموبايل: كل سطر بطاقة (الحساب، البيان، مركز الكلفة، المبلغ) بدل جدول عريض يخفي «مركز الكلفة» */
@media (max-width: 700px) {
  .table-wrap:has(> .jl-tbl) { overflow: visible; border: 0; }
  .jl-tbl, .jl-tbl tbody, .jl-tbl tfoot { display: block; width: 100%; min-width: 0 !important; }
  .jl-tbl thead { display: none; }
  .jl-tbl tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 10px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; position: relative; background: var(--surface); }
  .jl-tbl tbody td { display: block; padding: 0 !important; border: 0 !important; min-width: 0 !important; }
  .jl-tbl tbody td[data-l]::before { content: attr(data-l); display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 3px; }
  .jl-tbl td.jl-acc, .jl-tbl td.jl-desc { grid-column: 1 / -1; }
  .jl-tbl td.jl-acc { padding-left: 40px !important; }
  .jl-tbl td.jl-no { display: none; }
  .jl-tbl td.jl-rm { position: absolute; top: 8px; left: 8px; }
  .jl-tbl tfoot tr { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .jl-tbl tfoot td { display: block; border: 0; background: none; padding: 4px 0; }
  .jl-tbl tfoot td:empty { display: none; }
}

@media (max-width: 900px) { .zoom-btn { display: none !important; } }   /* حجم العرض للحاسبات بس */

/* التقرير اليومي: الكوادر الفنية لكل مهندس */
.crew-box { border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin: 6px 0 10px; background: var(--surface-2); }
.crew-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: baseline; margin-bottom: 8px; }
.crew-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-bottom: 8px; display: grid; gap: 6px; }
.crew-top { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto auto; gap: 6px; align-items: center; }
.crew-m { display: grid; grid-template-columns: auto minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.crew-m .check { margin: 0; }
.crew-ab { color: var(--danger, #c62828); font-size: 12px; margin-top: 2px; }
@media (max-width: 600px) { .crew-top { grid-template-columns: minmax(0, 1fr) auto; } .crew-top [data-cs] { grid-column: 1; } .crew-top [data-cn] { grid-column: 1 / -1; } }
/* «بانتظارك» بالواجهة */
.mt-card { margin-bottom: 16px; border: 2px solid var(--primary); padding: 14px 16px; }
.mt-card.mt-empty { border: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--green, #1e7e45); }
.mt-card.mt-empty > [data-mtwl] { width: 100%; }
.mt-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.mt-head h2 { margin: 0; font-size: 19px; display: flex; gap: 8px; align-items: center; }
.mt-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.mt-g h3 { margin: 0 0 6px; font-size: 14px; display: flex; gap: 6px; align-items: center; }
.mt-g h3 .ic { width: 16px; height: 16px; }
.mt-sign h3, .mt-late h3 { color: var(--danger, #c62828); }
.mt-item { display: grid; gap: 1px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px; color: inherit; text-decoration: none; background: var(--surface); }
.mt-item:hover { border-color: var(--primary); }
.mt-item.urgent { border-right: 4px solid var(--danger, #c62828); }
.mt-t { font-weight: 700; font-size: 13.5px; } .mt-b { color: var(--muted); font-size: 12.5px; }
.mt-age { color: var(--muted); font-size: 11.5px; display: inline-flex; gap: 3px; align-items: center; } .mt-age .ic { width: 12px; height: 12px; }
.mt-item.urgent .mt-age { color: var(--danger, #c62828); font-weight: 700; }
.mt-watch { margin-top: 8px; font-size: 13px; }

/* صفحة «بانتظارك» */
.tk-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tk-tabs button { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; display: inline-flex; gap: 5px; align-items: center; color: var(--text); }
.tk-tabs button .ic { width: 15px; height: 15px; } .tk-tabs button.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.tk-tabs .tk-sign:not(.on), .tk-tabs .tk-late:not(.on) { color: var(--danger, #c62828); border-color: currentColor; }
.tk-g { margin-bottom: 14px; } .tk-g h2 { margin: 0 0 10px; font-size: 17px; display: flex; gap: 8px; align-items: center; }
.tk-list { display: grid; gap: 8px; }
.tk-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: 12px; color: inherit; text-decoration: none; background: var(--surface); }
.tk-item:hover { border-color: var(--primary); box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.tk-item.urgent { border-right: 5px solid var(--danger, #c62828); }
.tk-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--primary) 10%, transparent); color: var(--primary); }
.tk-item.urgent .tk-ic { background: color-mix(in srgb, var(--danger, #c62828) 10%, transparent); color: var(--danger, #c62828); }
.tk-main { display: grid; gap: 2px; min-width: 0; } .tk-main .muted { font-size: 13px; }
.tk-side { display: grid; gap: 4px; justify-items: end; } .tk-age { color: var(--muted); font-size: 12px; display: inline-flex; gap: 3px; align-items: center; } .tk-age .ic { width: 12px; height: 12px; }
.tk-item.urgent .tk-age { color: var(--danger, #c62828); font-weight: 700; }
.tk-help summary { cursor: pointer; font-weight: 800; display: flex; gap: 6px; align-items: center; }
.tk-help-body { margin-top: 10px; line-height: 1.9; } .tk-help-body ol { padding-right: 20px; }
@media (max-width: 600px) { .tk-item { grid-template-columns: auto minmax(0, 1fr); } .tk-side { grid-column: 1 / -1; grid-auto-flow: column; justify-content: space-between; } }

/* النسخة الكاملة اليومية */
.fb-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.fb-status { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 12px; }
.fb-status > div { display: grid; gap: 2px; } .fb-status span { font-size: 13.5px; }
.fb-status .ic { width: 26px; height: 26px; flex: none; }
.fb-ok { background: var(--primary-50); color: var(--brand-green, #1e7e45); border: 1px solid var(--border); }
.fb-wait { background: var(--danger-50); color: var(--danger); }
.fb-name { margin: 6px 0 12px; word-break: break-all; }
.fb-btn { width: 100%; justify-content: center; padding: 12px; font-size: 16px; }
.fb-busy { background: var(--info-50); color: var(--info); padding: 10px 12px; border-radius: var(--radius-sm); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.fb-steps { margin: 14px 0 8px; padding-inline-start: 20px; line-height: 1.9; }
.bk-takers { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 12px; margin-bottom: 14px; }
@media (max-width: 800px) { .fb-grid { grid-template-columns: minmax(0, 1fr); } }
