/* ============================================================
   حياة ستون — نظام التصميم (RTL أولاً)
   ============================================================ */
:root {
  --font: "Tajawal", "Cairo", "Segoe UI", system-ui, sans-serif;
  --font-display: "Cairo", "Tajawal", system-ui, sans-serif;

  --stone-900: #1c1917;
  --stone-800: #292524;
  --stone-700: #44403c;
  --stone-600: #57534e;
  --stone-500: #78716c;
  --stone-400: #a8a29e;
  --stone-300: #d6d3d1;
  --stone-200: #e7e5e4;
  --stone-100: #f5f5f4;
  --stone-50:  #fafaf9;

  --gold-700: #8a6a1f;
  --gold-600: #a67c2b;
  --gold-500: #c19a3f;
  --gold-400: #d4b262;
  --gold-100: #f6efdc;

  --green-600: #15803d; --green-100: #dcfce7;
  --red-600: #b91c1c;   --red-100: #fee2e2;
  --amber-600: #b45309; --amber-100: #fef3c7;
  --blue-600: #1d4ed8;  --blue-100: #dbeafe;

  --bg: var(--stone-50);
  --surface: #ffffff;
  --text: var(--stone-900);
  --muted: var(--stone-600);
  --border: var(--stone-200);
  --primary: var(--stone-900);
  --accent: var(--gold-600);

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(28,25,23,.06);
  --shadow: 0 4px 16px rgba(28,25,23,.08);
  --shadow-lg: 0 16px 40px rgba(28,25,23,.14);
  --container: 1200px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.7;
  color: var(--text); background: var(--bg); direction: rtl; text-align: right;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.3; margin: 0 0 .5em; font-weight: 700; color: var(--stone-900); }
h1 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); }
h2 { font-size: clamp(1.45rem, 2.6vw, 2rem); }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
a { color: var(--gold-700); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
small, .small { font-size: .875rem; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: embed; white-space: nowrap; }   /* R-65: الأرقام والمبالغ والتواريخ لا تنكسر على سطرين */
.text-center { text-align: center; }
.mt-0{margin-top:0}.mt-1{margin-top:.5rem}.mt-2{margin-top:1rem}.mt-3{margin-top:1.5rem}.mt-4{margin-top:2.5rem}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:.5rem}.mb-2{margin-bottom:1rem}.mb-3{margin-bottom:1.5rem}.mb-4{margin-bottom:2.5rem}
.pt-0{padding-top:0}.pb-0{padding-bottom:0}   /* الدورة 23 (ج-1): مستعملتان في القوالب بلا تعريف ⇒ حشوتان متتاليتان */
.hidden { display: none !important; }
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }

.container { max-width: var(--container); margin-inline: auto; padding-inline: 20px; }
.container-narrow { max-width: 820px; margin-inline: auto; padding-inline: 20px; }
.section { padding-block: 64px; }
.section-tight { padding-block: 36px; }
.section-title { margin-bottom: 32px; }
.section-title .eyebrow { color: var(--accent); font-weight: 700; letter-spacing: .04em; font-size: .85rem; margin-bottom: 6px; }
.section-title p { color: var(--muted); max-width: 640px; }

/* ---- Grid ---- */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.flex { display: flex; gap: 12px; align-items: center; }
.between { justify-content: space-between; }
.grow { flex: 1; }
@media (max-width: 960px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } .section { padding-block: 44px; } }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px; border-radius: var(--radius-sm); font-weight: 700; font-family: var(--font);
  font-size: .95rem; border: 1px solid transparent; cursor: pointer; transition: .18s; white-space: nowrap;
  text-decoration: none !important; line-height: 1.2;   /* R-65: 44px = هدف اللمس (المبدأ 1) */
}
.btn-primary { background: var(--stone-900); color: #fff; }
.btn-primary:hover { background: var(--stone-700); }
.btn-accent { background: var(--gold-600); color: #fff; }
.btn-accent:hover { background: var(--gold-700); }
.btn-outline { background: transparent; border-color: var(--stone-300); color: var(--stone-800); }
.btn-outline:hover { background: var(--stone-100); }
.btn-light { background: #fff; color: var(--stone-900); }
.btn-light:hover { background: var(--stone-100); }
.btn-danger { background: var(--red-600); color: #fff; }
.btn-danger:hover { filter: brightness(.9); }
.btn-ghost { background: transparent; color: var(--stone-700); }
.btn-ghost:hover { background: var(--stone-100); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .85rem; }   /* R-65: 36 على الحاسوب، 40 على ≤ 640px (أدناه) */
.btn-lg { min-height: 52px; padding: 13px 28px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-whatsapp { background: #25d366; color: #fff; }
.btn-whatsapp:hover { background: #1ebe5b; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }

/* ---- Cards ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-body { padding: 20px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-header h3 { margin: 0; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--stone-50); border-radius: 0 0 var(--radius) var(--radius); }
.card-hover { transition: .2s; }
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

/* ---- Product / gallery cards ---- */
.tile { overflow: hidden; display: flex; flex-direction: column; text-decoration: none !important; color: inherit; }
.tile .tile-img { aspect-ratio: 4/3; background: var(--stone-200); overflow: hidden; position: relative; }
.tile .tile-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.tile .tile-img img, .detail .gallery-main img, .detail .thumbs img, .lightbox img { -webkit-user-drag: none; user-select: none; -webkit-touch-callout: none; }
.tile:hover .tile-img img { transform: scale(1.04); }
.tile .tile-body { padding: 16px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.tile .tile-title { font-weight: 700; font-size: 1.05rem; color: var(--stone-900); }
.tile .tile-meta { color: var(--muted); font-size: .875rem; }
.tile .tile-price { margin-top: auto; font-weight: 700; color: var(--gold-700); font-size: 1.05rem; }
.tile .tile-price .unit { font-size: .8rem; color: var(--muted); font-weight: 500; }
.ribbon { position: absolute; top: 10px; inset-inline-start: 10px; background: var(--gold-600); color: #fff; font-size: .75rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.ribbon.gray { background: var(--stone-600); }

/* ---- Badges & alerts ---- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; line-height: 1.5; background: var(--stone-100); color: var(--stone-700); white-space: nowrap; }   /* R-65: لا التفاف داخل الكبسولة */
.badge-success { background: var(--green-100); color: var(--green-600); }
.badge-danger { background: var(--red-100); color: var(--red-600); }
.badge-warning { background: var(--amber-100); color: var(--amber-600); }
.badge-info { background: var(--blue-100); color: var(--blue-600); }
.badge-gold { background: var(--gold-100); }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 14px; border: 1px solid; font-weight: 500; }
.alert-success { background: var(--green-100); color: var(--green-600); border-color: #bbf7d0; }
.alert-danger { background: var(--red-100); color: var(--red-600); border-color: #fecaca; }
.alert-warning { background: var(--amber-100); color: var(--amber-600); border-color: #fde68a; }
.alert-info { background: var(--blue-100); color: var(--blue-600); border-color: #bfdbfe; }

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }
.form-group label, .label { display: block; font-weight: 700; margin-bottom: 6px; font-size: .92rem; }
.form-control, input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="tel"], input[type="date"], input[type="month"], input[type="time"], input[type="search"], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border: 1px solid var(--stone-300); border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 1rem; line-height: 1.4; background: #fff; color: var(--text); transition: .15s;   /* R-65: 44px كالزر (المبدأ 1) */
}
.form-control-sm { min-height: 36px; padding: 6px 10px; font-size: .9rem; }   /* R-65: خلايا الجداول القابلة للتحرير وأشرطة التصفية الكثيفة */
::placeholder { color: var(--stone-500); opacity: 1; }                          /* R-65: كان --stone-400 (≈ 2.5:1) */
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold-500); box-shadow: 0 0 0 3px rgba(193,154,63,.25); }
textarea { min-height: 120px; resize: vertical; }
input[type="number"], input[type="date"], input[type="month"], input[type="time"], input[type="tel"] { direction: ltr; text-align: right; }   /* month/time (حوادث السلامة، الورديات، الحضور) كانت خارج القاعدة فظهرت خاماً — طلب المالك 2026-09-18 */
.form-error { color: var(--red-600); font-size: .85rem; margin-top: 4px; }
.form-help { color: var(--muted); font-size: .85rem; margin-top: 4px; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.form-row-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }   /* ج-1: بنود بطاقة «حياة» كانت تتكدّس سطراً لكل حقل */
@media (max-width: 640px) { .form-row, .form-row-3 { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .form-row-4 { grid-template-columns: 1fr; } }
/* ج-1: نماذج التصفية (GET) صفّ ملتفّ كـ.att-filters — كانت الحقول تتكدّس بعرض كامل والزر في سطر وحده */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters .form-group { flex: 1 1 200px; margin-bottom: 0; }
.filters .form-group:last-child { flex: 0 0 auto; }
.card-header .filters { margin-bottom: 0; }
/* ج-1: معاينة «قبل/بعد» في نموذج المشروع — كانت المصغَّرة (640px) تُعرض بعرض العمود كاملاً */
.ba-thumb { width: 100%; max-height: 180px; object-fit: cover; border-radius: var(--radius-sm); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--gold-600); }
.input-group { display: flex; }
.input-group input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-group .addon { padding: 10px 14px; background: var(--stone-100); border: 1px solid var(--stone-300); border-inline-start: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); color: var(--muted); white-space: nowrap; }

/* ---- Tables ---- */
table.table { width: 100%; border-collapse: collapse; font-size: .95rem; background: #fff; }
.table th, .table td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: right; vertical-align: middle; }
.table th { background: var(--stone-50); font-weight: 700; color: var(--stone-700); font-size: .85rem; white-space: nowrap; }
.table tbody tr:hover { background: var(--stone-50); }
.table .actions { white-space: nowrap; text-align: left; }
.table tfoot td { font-weight: 700; background: var(--stone-50); }
.table-compact th, .table-compact td { padding: 8px 10px; }

/* ---- Stats ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.stat .stat-label { color: var(--muted); font-size: .85rem; font-weight: 600; }
.stat .stat-value { font-size: 1.6rem; font-weight: 800; font-family: var(--font-display); margin-top: 4px; }
.stat .stat-sub { font-size: .8rem; color: var(--muted); }
.stat.accent { border-inline-start: 4px solid var(--gold-600); }
.stat.danger { border-inline-start: 4px solid var(--red-600); }
.stat.success { border-inline-start: 4px solid var(--green-600); }

/* ---- Public header ---- */
.site-header { background: rgba(255,255,255,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none !important; color: var(--stone-900); font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; }
.brand .logo { width: 40px; height: 40px; display: grid; place-items: center; color: var(--gold-400); font-size: 1.1rem; }
.brand .sub { display: block; font-size: .7rem; color: var(--gold-700); font-weight: 600; letter-spacing: .12em; line-height: 1; }
.nav { display: flex; gap: 4px; align-items: center; }
.nav a { padding: 8px 14px; border-radius: var(--radius-sm); color: var(--stone-700); font-weight: 600; font-size: .95rem; }
.nav a:hover, .nav a.active { background: var(--stone-100); color: var(--stone-900); text-decoration: none; }
.nav-actions { display: flex; gap: 8px; align-items: center; }
.nav-toggle { display: none; background: none; border: 1px solid var(--border); border-radius: 8px; padding: 8px; cursor: pointer; }
@media (max-width: 960px) {
  .nav-toggle { display: inline-flex; }
  .nav { display: none; position: absolute; inset-inline: 0; top: 72px; background: #fff; flex-direction: column; padding: 12px 20px 20px; border-bottom: 1px solid var(--border); box-shadow: var(--shadow); align-items: stretch; }
  .nav.open { display: flex; }
  .nav-actions .btn-outline { display: none; }
  /* [Brand] على الهاتف: اسم الشركة سطر واحد بجوار الشعار الدائري ولا يلتفّ تحته */
  .site-header .brand { font-size: 1.15rem; gap: 8px; }
  .site-header .brand > span:not(.logo) { white-space: nowrap; }
  .site-header .brand .sub { font-size: .62rem; }
}

/* ---- Hero ---- */
.hero { position: relative; color: #fff; background: var(--stone-900); overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 0; background:
  radial-gradient(900px 400px at 85% 20%, rgba(193,154,63,.25), transparent 60%),
  radial-gradient(700px 400px at 10% 90%, rgba(255,255,255,.06), transparent 60%),
  repeating-linear-gradient(115deg, rgba(255,255,255,.025) 0 2px, transparent 2px 14px); }
.hero .container { position: relative; padding-block: 96px; display: grid; grid-template-columns: 1.15fr 1fr; gap: 40px; align-items: center; }
.hero h1 { color: #fff; font-size: clamp(2rem, 4.5vw, 3.4rem); margin-bottom: 16px; }
.hero h1 span { color: var(--gold-400); }
.hero p.lead { font-size: 1.15rem; color: var(--stone-300); max-width: 560px; }
.hero .hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.hero .hero-stats { display: flex; gap: 32px; margin-top: 40px; flex-wrap: wrap; }
.hero .hero-stats div strong { display: block; font-size: 1.7rem; font-family: var(--font-display); color: var(--gold-400); }
.hero .hero-stats div span { color: var(--stone-400); font-size: .9rem; }
.hero-art { aspect-ratio: 1; border-radius: 24px; background: linear-gradient(145deg, #3b3835, #1c1917 60%); box-shadow: var(--shadow-lg); position: relative; overflow: hidden; border: 1px solid rgba(255,255,255,.08); }
.hero-art .slab { position: absolute; border-radius: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.4); }
@media (max-width: 960px) { .hero .container { grid-template-columns: 1fr; padding-block: 64px; } .hero-art { display: none; } }
/* ---------- بطل الرئيسية على الهاتف (طلب المالك 2026-09-18): الأزرار الثلاثة بعرض كامل ومتساوية، والأرقام شبكة عمودين متساوية
   العنصر الأخير الفردي يأخذ السطر كله بدل أن يبقى وحيداً في عمود ---------- */
@media (max-width: 600px) {
  .hero .container { padding-block: 48px; }
  .hero .hero-cta { display: grid; grid-template-columns: 1fr; gap: 10px; }
  .hero .hero-cta .btn { width: 100%; justify-content: center; }
  .hero .hero-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 32px; }
  .hero .hero-stats > div { text-align: center; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: 12px 8px; }
  .hero .hero-stats > div strong { font-size: 1.5rem; }
  .hero .hero-stats > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
/* ---------- شريط «جاهز تبدأ مشروعك؟» والتذييل على الهاتف (طلب المالك 2026-09-18): أزرار الشريط بعرض كامل، وروابط التذييل
   عمودان متجاوران (روابط سريعة / للشركاء) بدل قائمة واحدة طويلة، والعلامة والتواصل يأخذان السطر، وشريط الحقوق في المنتصف ---------- */
@media (max-width: 640px) {
  .cta-band { padding: 24px 20px; text-align: center; }
  .cta-band > div:first-child { width: 100%; }
  .cta-band > .flex { width: 100%; flex-direction: column; gap: 10px; }
  .cta-band .btn { width: 100%; justify-content: center; }
  .site-footer { padding: 40px 0 20px; margin-top: 40px; }
  .site-footer .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 16px; }
  .site-footer .grid-4 > div:first-child, .site-footer .grid-4 > div:last-child { grid-column: 1 / -1; }
  .site-footer h4 { margin-bottom: 10px; font-size: 1rem; }
  .site-footer ul { gap: 6px; font-size: .95rem; }
  .site-footer ul li { overflow-wrap: anywhere; }
  .site-footer .bottom { flex-direction: column; align-items: center; text-align: center; gap: 6px; margin-top: 28px; }
}

/* ---- Feature blocks ---- */
.feature { display: flex; gap: 16px; }
.feature .icon { flex: none; width: 52px; height: 52px; border-radius: 14px; background: var(--gold-100); color: var(--gold-700); display: grid; place-items: center; }
.feature .icon svg { width: 26px; height: 26px; }
.feature h3 { margin-bottom: 4px; }
.feature p { color: var(--muted); margin: 0; font-size: .95rem; }

/* ---- Filter chips ---- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.chip { padding: 7px 16px; border-radius: 999px; border: 1px solid var(--stone-300); font-weight: 600; font-size: .9rem; color: var(--stone-700); background: #fff; }
.chip:hover, .chip.active { background: var(--stone-900); color: #fff; border-color: var(--stone-900); text-decoration: none; }

/* ---- Detail page ---- */
.detail { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; }
/* الصورة الرئيسية: اللوح كاملاً بلا قص (contain) — صور الألواح عادة 3:2؛ الضغط يفتح العرض المكبّر */
.detail .gallery-main { aspect-ratio: 3/2; border-radius: var(--radius); overflow: hidden; background: var(--stone-100); cursor: zoom-in; position: relative; }
.detail .gallery-main img { width: 100%; height: 100%; object-fit: contain; display: block; }
.detail .gallery-main .zoom-hint { position: absolute; bottom: 10px; inset-inline-start: 10px; background: rgba(28,25,23,.72); color: #fff; font-size: .78rem; padding: 4px 10px; border-radius: 999px; pointer-events: none; }

/* ---- Lightbox (عرض الصورة بحجمها الكامل) ---- */
.lightbox { position: fixed; inset: 0; z-index: 1000; background: rgba(12,10,9,.94); display: none; align-items: center; justify-content: center; overflow: hidden; touch-action: none; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 100vw; max-height: 100vh; width: auto; height: auto; object-fit: contain; cursor: zoom-in; transition: transform .15s ease-out; transform-origin: center center; }
.lightbox.zoomed img { max-width: none; max-height: none; cursor: grab; transition: none; }
.lightbox.zoomed.dragging img { cursor: grabbing; }
.lightbox button { position: absolute; background: rgba(255,255,255,.12); color: #fff; border: 0; width: 44px; height: 44px; border-radius: 50%; font-size: 1.4rem; line-height: 44px; text-align: center; cursor: pointer; z-index: 2; }
.lightbox button:hover { background: rgba(255,255,255,.28); }
.lightbox .lb-close { top: 14px; inset-inline-end: 14px; }
.lightbox .lb-prev { inset-inline-start: 14px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-next { inset-inline-end: 14px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-caption { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); color: #fff; font-size: .9rem; background: rgba(0,0,0,.45); padding: 6px 14px; border-radius: 999px; max-width: 90vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lightbox[data-count="1"] .lb-prev, .lightbox[data-count="1"] .lb-next { display: none; }
body.lb-lock { overflow: hidden; }
.detail .thumbs { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.detail .thumbs img { width: 84px; height: 64px; object-fit: cover; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.detail .thumbs img.active { border-color: var(--gold-600); }
.spec-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; }
.spec-list li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.spec-list li span { display: block; font-size: .8rem; color: var(--muted); }
.spec-list li strong { font-weight: 700; }
.price-box { background: var(--stone-900); color: #fff; padding: 20px 24px; border-radius: var(--radius); margin-block: 20px; }
.price-box .amount { font-size: 2rem; font-weight: 800; font-family: var(--font-display); color: var(--gold-400); }
.price-box .amount small { font-size: .9rem; color: var(--stone-300); font-weight: 500; }
@media (max-width: 860px) { .detail { grid-template-columns: 1fr; } }

/* ---- Calculator ---- */
.calc { display: grid; grid-template-columns: 1fr 380px; gap: 32px; align-items: start; }
.calc-result { position: sticky; top: 90px; background: var(--stone-900); color: #fff; border-radius: var(--radius); padding: 26px; }
.calc-result h3 { color: var(--gold-400); }
.calc-result .line { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.1); color: var(--stone-300); font-size: .95rem; }
.calc-result .total { font-size: 1.7rem; line-height: 1.3; font-weight: 800; font-family: var(--font-display); margin-top: 12px; color: #fff; }
.calc-result .note { color: var(--stone-400); font-size: .8rem; margin-top: 10px; }
@media (max-width: 900px) { .calc { grid-template-columns: 1fr; } .calc-result { position: static; } }

/* ---- CTA band ---- */
.cta-band { background: linear-gradient(120deg, var(--gold-700), var(--gold-500)); color: #fff; border-radius: var(--radius); padding: 40px; display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.cta-band h2 { color: #fff; margin: 0 0 6px; }
.cta-band p { margin: 0; color: rgba(255,255,255,.9); }

/* ---- Footer ---- */
.site-footer { background: var(--stone-900); color: var(--stone-300); padding: 56px 0 24px; margin-top: 64px; }
.site-footer h4 { color: #fff; margin-bottom: 14px; }
.site-footer a { color: var(--stone-300); }
.site-footer a:hover { color: var(--gold-400); }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.site-footer .bottom { border-top: 1px solid rgba(255,255,255,.1); margin-top: 36px; padding-top: 20px; font-size: .85rem; color: var(--stone-500); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ---- WhatsApp float ---- */
.wa-float { position: fixed; bottom: 22px; inset-inline-start: 22px; z-index: 60; width: 56px; height: 56px; border-radius: 50%; background: #25d366; color: #fff; display: grid; place-items: center; box-shadow: 0 8px 24px rgba(37,211,102,.4); }
.wa-float svg { width: 28px; height: 28px; }
.wa-float:hover { transform: scale(1.06); }

/* ---- Dashboard layout ---- */
.dash { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { background: var(--stone-900); color: var(--stone-300); padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { color: #fff; padding: 6px 10px 18px; font-size: 1.15rem; }
.sidebar .brand .sub { color: var(--gold-400); }
.sidebar .menu { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.sidebar .menu-label { font-size: .72rem; color: var(--stone-500); padding: 14px 12px 6px; letter-spacing: .08em; font-weight: 700; }
.sidebar .menu-section { display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; border-radius: 8px; }
.sidebar .menu-section:hover, .sidebar .menu-section:focus-visible { color: var(--stone-300); background: rgba(255,255,255,.05); outline: none; }
.sidebar .menu-chevron { width: 14px; height: 14px; transition: transform .2s; opacity: .8; }
.sidebar .menu-section.collapsed .menu-chevron { transform: rotate(-90deg); }
[dir="ltr"] .sidebar .menu-section.collapsed .menu-chevron { transform: rotate(90deg); }
.sidebar .menu a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--stone-300); font-weight: 600; font-size: .93rem; }
.sidebar .menu a svg { width: 18px; height: 18px; opacity: .8; }
.sidebar .menu a:hover, .sidebar .menu a.active { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.sidebar .menu a.active { background: var(--gold-600); color: #fff; }
.sidebar .user-box { margin-top: 20px; padding: 12px; border-radius: 10px; background: rgba(255,255,255,.05); font-size: .85rem; }
.sidebar .user-box strong { color: #fff; display: block; }
.dash-main { padding: 0; }
.topbar { background: #fff; border-bottom: 1px solid var(--border); padding: 14px 28px; display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 40; }
.topbar h1 { font-size: 1.35rem; margin: 0; }
.topbar .crumbs { font-size: .85rem; color: var(--muted); }
.dash-content { padding: 28px; }
.sidebar-toggle { display: none; }
@media (max-width: 960px) {
  .dash { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset-inline-start: 0; top: 0; width: 270px; transform: translateX(100%); transition: .25s; z-index: 70; }
  [dir="ltr"] .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .sidebar-toggle { display: inline-flex; }
  .dash-content { padding: 16px; }
  .topbar { padding: 12px 16px; }
}
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.toolbar form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { width: auto; min-width: 160px; }
.search-wrap { position: relative; display: inline-flex; align-items: center; }
.search-wrap input[type="search"] { padding-inline-end: 34px; width: 100%; }
.search-wrap input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search-clear { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border: 0; border-radius: 50%; background: transparent; color: var(--stone-500); display: none; place-items: center; cursor: pointer; padding: 0; }
.search-clear svg { width: 14px; height: 14px; }
.search-clear:hover, .search-clear:focus-visible { background: var(--stone-200); color: var(--stone-900); outline: none; }
.search-wrap.has-value .search-clear { display: grid; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty svg { width: 48px; height: 48px; margin: 0 auto 12px; opacity: .4; }
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 20px; }
.pagination a, .pagination span { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; font-size: .9rem; }   /* R-65: هدف لمس 40px */
.pagination .current { background: var(--stone-900); color: #fff; border-color: var(--stone-900); }
/* عمود القيمة minmax(0, 1fr) لا 1fr: القيمة الطويلة غير القابلة للكسر (بريد الدخول بصنف .num) كانت توسّع الشبكة أعرض من البطاقة
   فتخرج كل القيم خارجها (صفحة «بياناتي» — ملاحظة المالك 2026-09-19)؛ والقيمة تنكسر عند الضرورة بدل أن تفيض */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 18px; font-size: .95rem; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv dd.num { white-space: normal; }   /* المعرِّفات والبريد داخل القائمة تنكسر؛ nowrap تبقى للمبالغ والتواريخ في الجداول */
.kv .kv-note { grid-column: 1 / -1; }   /* ملاحظة تحت زوج مفتاح/قيمة تمتد على العمودين ولا تخلّ بالترتيب */
.img-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.img-grid .img-item { position: relative; width: 120px; }
.img-grid .img-item img { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.img-grid .img-item form { position: absolute; top: 4px; inset-inline-end: 4px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 10px 0 10px 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 12px; font-size: .92rem; }
.timeline li .t { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.inline-form { display: inline; }
.row-danger { background: var(--red-100) !important; }
.progress { height: 8px; background: var(--stone-200); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--gold-600); }

/* ---- Auth pages ---- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--stone-900);
  background-image: radial-gradient(800px 400px at 80% 10%, rgba(193,154,63,.22), transparent 60%); }
.auth-card { width: 100%; max-width: 440px; background: #fff; border-radius: 16px; padding: 36px 32px; box-shadow: var(--shadow-lg); }
.auth-card .brand { justify-content: center; margin-bottom: 20px; }
.auth-card h1 { font-size: 1.4rem; text-align: center; margin-bottom: 20px; }
.auth-card .foot { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 16px; }
.otp-input { text-align: center !important; letter-spacing: .4em; font-size: 1.5rem; font-weight: 700; direction: ltr; }
.secret-box { font-family: monospace; direction: ltr; text-align: center; background: var(--stone-100); padding: 10px; border-radius: 8px; letter-spacing: .1em; font-size: .95rem; word-break: break-all; }

/* ---- Invoice (print) ---- */
.invoice-sheet { background: #fff; max-width: 860px; margin: 24px auto; padding: 40px 44px; border: 1px solid var(--border); border-radius: var(--radius); }
.invoice-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; border-bottom: 3px solid var(--stone-900); padding-bottom: 20px; margin-bottom: 24px; }
.invoice-head .title { font-size: 2rem; font-weight: 800; font-family: var(--font-display); }
.invoice-head .meta { text-align: left; font-size: .9rem; color: var(--stone-700); }
.invoice-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px; font-size: .95rem; }
.invoice-parties h4 { font-size: .8rem; color: var(--muted); margin-bottom: 6px; letter-spacing: .05em; }
.invoice-totals { margin-inline-start: auto; width: 320px; margin-top: 16px; }
.invoice-totals div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--border); }   /* R-65: gap يمنع التصاق «ج.م» بالتسمية */
.invoice-totals strong, .invoice-totals .num { white-space: nowrap; }
.invoice-totals .grand { font-size: 1.25rem; font-weight: 800; border-bottom: 0; border-top: 2px solid var(--stone-900); margin-top: 4px; }
.grand-words { display: block; margin-top: 4px; padding: 8px 12px; border: 1px dashed var(--gold-400); border-radius: 8px; background: var(--gold-100); color: var(--stone-800); font-size: .88rem; font-weight: 700; line-height: 1.7; text-align: center; }
.grand-words:empty { display: none; }
.invoice-totals .grand-words { justify-content: center; border-bottom: 0; }
.invoice-status-stamp { display: inline-block; padding: 6px 18px; border: 3px solid; border-radius: 8px; font-weight: 800; font-size: 1.1rem; transform: rotate(-6deg); }
.print-bar { max-width: 860px; margin: 20px auto 0; display: flex; gap: 8px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
@media print {
  body { background: #fff; }
  .print-bar, .no-print, .wa-float, .site-header, .site-footer, .sidebar, .topbar { display: none !important; }
  .invoice-sheet { border: 0; margin: 0; padding: 0; max-width: none; border-radius: 0; }
  .dash { display: block; }
  .dash-content { padding: 0; }
  /* الطباعة كاملة دائماً: الأعمدة المخفية على الهاتف (.hide-sm) تعود، ولا قصّ للجداول داخل إطاراتها أو بطاقات الرسوم */
  .hide-sm { display: revert !important; }
  .table-wrap, .chart-card .card-body { overflow: visible !important; }
  @page { margin: 14mm; }
}

/* ---- Trust strip ---- */
.trust { background: #fff; border-block: 1px solid var(--border); }
.trust .container { display: flex; justify-content: center; gap: 40px; flex-wrap: wrap; padding-block: 18px; color: var(--stone-600); font-weight: 600; font-size: .92rem; }
.trust span { display: flex; align-items: center; gap: 8px; }
.trust svg { width: 20px; height: 20px; color: var(--gold-600); }

/* ---- Steps ---- */
.steps { counter-reset: s; display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.step { position: relative; padding: 22px 20px 20px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
.step::before { counter-increment: s; content: counter(s); position: absolute; top: -14px; inset-inline-start: 18px; width: 30px; height: 30px; border-radius: 50%; background: var(--gold-600); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: .9rem; }
.step h4 { margin: 6px 0 4px; }
.step p { margin: 0; color: var(--muted); font-size: .92rem; }
@media (max-width: 960px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } }

/* ---- Modal-ish dropzone ---- */
.dropzone { border: 2px dashed var(--stone-300); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); background: var(--stone-50); }
.dropzone input { display: block; margin: 10px auto 0; }

/* ============================================================
   [Public site] — إضافات الموقع العام (ألواح الرخام، بطاقات التواصل، ...)
   ============================================================ */
/* ألواح رخام تزيينية داخل .hero-art */
.hero-art .slab-1 { width: 58%; height: 46%; top: 8%; inset-inline-start: 6%; transform: rotate(-6deg);
  background:
    radial-gradient(120% 60% at 20% 30%, rgba(255,255,255,.55), transparent 55%),
    repeating-linear-gradient(28deg, rgba(120,113,108,.18) 0 2px, transparent 2px 30px),
    linear-gradient(160deg, #f5f5f4 0%, #d6d3d1 55%, #e7e5e4 100%); }
.hero-art .slab-2 { width: 52%; height: 44%; bottom: 8%; inset-inline-end: 6%; transform: rotate(5deg);
  background:
    radial-gradient(90% 70% at 70% 70%, rgba(255,255,255,.08), transparent 60%),
    repeating-linear-gradient(-35deg, rgba(212,178,98,.16) 0 1px, transparent 1px 22px),
    linear-gradient(145deg, #3f3a36 0%, #1c1917 60%, #2b2624 100%); }
.hero-art .slab-3 { width: 34%; height: 30%; top: 12%; inset-inline-end: 8%; transform: rotate(10deg);
  background:
    radial-gradient(80% 60% at 40% 40%, rgba(255,255,255,.45), transparent 60%),
    repeating-linear-gradient(60deg, rgba(166,124,43,.28) 0 2px, transparent 2px 18px),
    linear-gradient(135deg, #e9dcc2 0%, #c9a96a 60%, #d4b262 100%); }
.hero-art .slab-4 { width: 30%; height: 26%; bottom: 10%; inset-inline-start: 10%; transform: rotate(-12deg);
  background:
    radial-gradient(90% 60% at 60% 30%, rgba(255,255,255,.3), transparent 60%),
    repeating-linear-gradient(-15deg, rgba(120,113,108,.35) 0 1px, transparent 1px 14px),
    linear-gradient(155deg, #a8a29e 0%, #78716c 55%, #8f8883 100%); }
.hero-art .slab::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), inset 0 -20px 40px rgba(0,0,0,.12); }
/* لوح بصورة خامة حقيقية: الصورة تملأ اللوح (object-fit) بنفس المساحة والدوران؛ اسم الخامة شريط صغير أسفل اللوح */
.hero-art .slab-photo { overflow: hidden; background: var(--stone-800); }
.hero-art .slab-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-art .slab-photo::after { box-shadow: inset 0 0 0 1px rgba(255,255,255,.22), inset 0 -30px 50px rgba(0,0,0,.28); }
.hero-art .slab-name { position: absolute; bottom: 8px; inset-inline-start: 10px; z-index: 1; font-size: .7rem; font-weight: 700; color: #fff; background: rgba(28,25,23,.55); padding: 2px 8px; border-radius: 999px; letter-spacing: .02em; max-width: calc(100% - 20px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-art .slab-4 .slab-name, .hero-art .slab-3 .slab-name { font-size: .62rem; }
.hero-art .slab-3 .slab-name { bottom: auto; top: 8px; }   /* اللوح الذهبي يلامس الشعار من أسفله — الاسم أعلاه */
.hero-art .hero-tag { position: absolute; bottom: 18px; inset-inline-start: 18px; background: rgba(28,25,23,.8); color: var(--gold-400); padding: 6px 14px; border-radius: 999px; font-size: .8rem; font-weight: 700; letter-spacing: .06em; border: 1px solid rgba(255,255,255,.12); }

/* شارات جانبية على البلاطة (مخزون / مميز) */
.tile .tile-img .ribbon + .ribbon { inset-inline-start: auto; inset-inline-end: 10px; }
.tile .tile-tags { display: flex; gap: 6px; flex-wrap: wrap; }

/* توزيع أزرار الدعوة في صفحة الخامة */
.detail .cta-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.detail .lead-text { color: var(--muted); }
.price-box .muted-note { color: var(--stone-400); font-size: .85rem; margin-top: 6px; }
.price-box.ask { background: var(--gold-100); color: var(--stone-900); }
.price-box.ask .amount { color: var(--gold-700); font-size: 1.3rem; }

/* بطاقات التواصل */
.contact-card { display: flex; gap: 14px; align-items: flex-start; padding: 22px; }
.contact-card .icon { flex: none; width: 48px; height: 48px; border-radius: 12px; background: var(--stone-900); color: var(--gold-400); display: grid; place-items: center; }
.contact-card h3 { margin-bottom: 2px; font-size: 1.05rem; }
.contact-card p { margin: 0; color: var(--muted); font-size: .95rem; }
.map-card { position: relative; min-height: 260px; border-radius: var(--radius); overflow: hidden; display: grid; place-items: center; text-align: center; padding: 30px;
  background:
    linear-gradient(rgba(255,255,255,.55), rgba(255,255,255,.55)),
    repeating-linear-gradient(0deg, rgba(120,113,108,.18) 0 1px, transparent 1px 36px),
    repeating-linear-gradient(90deg, rgba(120,113,108,.18) 0 1px, transparent 1px 36px),
    var(--stone-100); border: 1px solid var(--border); }
.map-card .pin { color: var(--gold-700); }
.hours { list-style: none; padding: 0; margin: 0; }
.hours li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .95rem; }
.hours li:last-child { border-bottom: 0; }

/* الحاسبة: حقل الحقنة المخفي (honeypot) والملاحظة */
.hp-field { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.calc-result .cta { margin-top: 18px; }
.calc-result .cta .btn { width: 100%; }

/* صفحة الشكر */
.thanks-box { text-align: center; padding: 48px 24px; }
.thanks-box .check-circle { width: 76px; height: 76px; border-radius: 50%; background: var(--green-100); color: var(--green-600); display: grid; place-items: center; margin: 0 auto 18px; }
.thanks-box .check-circle svg { width: 36px; height: 36px; }

/* محتوى نصي طويل (عن الشركة، الخصوصية) */
.prose h3 { margin-top: 1.2em; }
.values-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.values-list li { display: flex; gap: 10px; align-items: flex-start; }
.values-list li svg { flex: none; color: var(--gold-600); margin-top: 4px; }
.section-alt { background: #fff; border-block: 1px solid var(--border); }
.quote-side { position: sticky; top: 90px; }
@media (max-width: 900px) { .quote-side { position: static; } }
.quote-layout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; align-items: start; }
@media (max-width: 900px) { .quote-layout { grid-template-columns: 1fr; } }

/* [Brand] الشعار الدائري (حلقة ذهبية + HayaStone) داخل .logo — الأصل static/img/icon-512.png */
.brand .logo { background: #fff; overflow: hidden; border: 0; border-radius: 50%; flex: none; }
.brand .logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sidebar .brand .logo { box-shadow: 0 0 0 2px rgba(255,255,255,.14); }
.site-header .brand .logo { width: 46px; height: 46px; }
.site-footer .brand .logo { box-shadow: 0 0 0 2px rgba(255,255,255,.14); }
.auth-card .brand .logo { width: 64px; height: 64px; }
.invoice-sheet .brand { gap: 12px; }
.invoice-sheet .brand .logo { width: 60px; height: 60px; background: transparent; }
.hero-logo { position: absolute; inset: 0; margin: auto; width: 46%; height: 46%; object-fit: contain; z-index: 2;
  filter: drop-shadow(0 18px 40px rgba(0,0,0,.5)); }
@media print { .invoice-sheet .brand .logo img { print-color-adjust: exact; -webkit-print-color-adjust: exact; } }

/* =====================================================================
   Toast — رسائل النظام (تُضاف ولا تُعدَّل قواعد .alert القديمة: ما زالت للتنبيهات الثابتة داخل الصفحات)
   ===================================================================== */
.toast-stack {
  /* أسفل الشاشة عند الطرف النهائي (يسار في RTL) — لا تحجب رأس الصفحة وأزراره؛ الأحدث في الأسفل */
  position: fixed; bottom: 16px; inset-inline-end: 16px; z-index: 1000;
  display: flex; flex-direction: column; gap: 10px; width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}
.toast-stack--inline { position: static; width: 100%; margin-bottom: 18px; }
.toast {
  --toast-accent: var(--blue-600); --toast-tint: var(--blue-100);
  position: relative; overflow: hidden; pointer-events: auto;
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start;
  padding: 14px 16px 16px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-inline-start: 4px solid var(--toast-accent);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  animation: toast-in .35s cubic-bezier(.2,.8,.2,1) both;
}
.toast-stack--inline .toast { box-shadow: var(--shadow-sm); animation: none; }
.toast-success { --toast-accent: var(--green-600); --toast-tint: var(--green-100); }
.toast-danger  { --toast-accent: var(--red-600);   --toast-tint: var(--red-100); }
.toast-warning { --toast-accent: var(--amber-600); --toast-tint: var(--amber-100); }
.toast-info    { --toast-accent: var(--blue-600);  --toast-tint: var(--blue-100); }
.toast-icon {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--toast-tint); color: var(--toast-accent); flex: none;
}
.toast-icon svg { width: 18px; height: 18px; }
.toast-body { min-width: 0; line-height: 1.55; }
.toast-title { font-weight: 700; font-size: .92rem; color: var(--toast-accent); margin-bottom: 2px; }
.toast-text { font-size: .95rem; word-break: break-word; }
.toast-text .ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.toast-text code { font-family: monospace; direction: ltr; unicode-bidi: embed; background: var(--stone-100); padding: 1px 6px; border-radius: 6px; font-size: .95em; }
.toast-close {
  appearance: none; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; margin: -4px -4px 0 0;
}
.toast-close:hover { background: var(--stone-100); color: var(--text); }
.toast-close svg { width: 16px; height: 16px; }
.toast-bar {
  position: absolute; bottom: 0; inset-inline-start: 0; height: 3px; width: 100%;
  background: var(--toast-accent); opacity: .45; transform-origin: right center;
  animation: toast-bar linear forwards; animation-duration: var(--toast-duration, 6000ms);
}
.toast:hover .toast-bar { animation-play-state: paused; }
.toast.is-leaving { animation: toast-out .3s ease-in both; }
.toast-actions { display: flex; gap: 8px; margin-top: 8px; }
.toast-actions .btn { padding: 4px 10px; font-size: .8rem; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes toast-bar { to { transform: scaleX(0); } }
@media (max-width: 640px) {
  .toast-stack { bottom: 8px; inset-inline: 8px; width: auto; }
  .toast { padding: 12px 12px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .toast, .toast.is-leaving { animation: none; }
  .toast-bar { animation: none; display: none; }
}

/* ---- حقل كلمة المرور مع زر الإظهار/الإخفاء ---- */
.password-wrap { position: relative; }
.password-wrap .form-control { padding-right: 44px; }
.password-toggle {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--muted);
  display: grid; place-items: center; cursor: pointer;
}
.password-toggle:hover, .password-toggle:focus-visible { background: var(--stone-100); color: var(--text); outline: none; }
.password-toggle svg { width: 20px; height: 20px; }
.password-toggle .ico-hide { display: none; }
.password-toggle[aria-pressed="true"] .ico-show { display: none; }
.password-toggle[aria-pressed="true"] .ico-hide { display: block; }

/* ---- SweetAlert2: مواءمة نوافذ التأكيد مع نظام التصميم ---- */
.hs-swal { font-family: var(--font); border-radius: var(--radius); padding: 28px 24px 22px; direction: rtl; }
.hs-swal-title { font-family: var(--font-display); font-size: 1.25rem; color: var(--text); }
.hs-swal-text { color: var(--muted); font-size: 1rem; line-height: 1.8; }
.hs-swal-actions { gap: 10px; margin-top: 18px; }
.hs-swal .swal2-icon { margin-top: 0; }
.hs-swal .swal2-icon.swal2-warning { border-color: var(--amber-600); color: var(--amber-600); }
.hs-swal .swal2-icon.swal2-question { border-color: var(--gold-500); color: var(--gold-600); }

/* ---- حقل البريد المقسوم (اسم الحساب + نطاق ثابت) في إنشاء مستخدم الفريق ---- */
.email-split { display: flex; align-items: stretch; }
.email-split .form-control { flex: 1; min-width: 0; border-start-end-radius: 0; border-end-end-radius: 0; text-align: left; }
.email-split .email-domain {
  display: flex; align-items: center; padding: 0 14px; background: var(--stone-100); color: var(--stone-700);
  border: 1px solid var(--stone-300); border-inline-start: 0; border-start-end-radius: var(--radius-sm); border-end-end-radius: var(--radius-sm);
  font-family: monospace; font-size: .95rem; white-space: nowrap; user-select: all;
}
.email-split .form-control:focus + .email-domain { border-color: var(--gold-500); }

/* =====================================================================
   الحضور — شاشة المشرف (هاتف أولاً) وتقويم الصنايعي
   ===================================================================== */
.att-filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
/* شريط اليوم: السابق / التاريخ الكامل / التالي */
.att-daynav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1 1 100%; }
.att-daylabel { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; padding: 0 4px; }
.att-daylabel strong { font-family: var(--font-display); }
.btn.is-disabled { opacity: .4; pointer-events: none; }
/* ملخص اليوم كبطاقات صغيرة */
.att-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.att-stat { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; border-inline-start: 4px solid var(--stone-300); }
.att-stat .num { font-size: 1.35rem; font-weight: 800; font-family: var(--font-display); line-height: 1.1; }
.att-stat span:last-child { font-size: .78rem; color: var(--muted); font-weight: 600; }
.att-stat.is-ok { border-inline-start-color: var(--green-600); }
.att-stat.is-live { border-inline-start-color: var(--blue-600); }
.att-stat.is-late { border-inline-start-color: var(--amber-600); }
.att-stat.is-warn { border-inline-start-color: var(--red-600); background: var(--red-100); }
/* رأس بطاقة الصنايعي */
.att-who { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.att-avatar { flex: none; width: 42px; height: 42px; border-radius: 50%; background: var(--stone-100); color: var(--stone-700); display: grid; place-items: center; font-weight: 800; font-family: var(--font-display); font-size: 1.1rem; border: 1px solid var(--border); }
.att-avatar.is-live { background: var(--blue-100); color: var(--blue-600); border-color: transparent; }
.att-name { font-size: 1.05rem; }
.att-status { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.att-status .badge { margin-inline-start: 0; }
.att-hours { text-align: center; min-width: 84px; padding: 6px 10px; border-radius: 10px; background: var(--stone-50); border: 1px solid var(--border); display: flex; flex-direction: column; line-height: 1.15; }
.att-hours .num { font-size: 1.3rem; font-weight: 800; font-family: var(--font-display); }
.att-hours small { font-size: .7rem; color: var(--muted); font-weight: 600; }
.att-hours.is-live { background: var(--blue-100); border-color: transparent; color: var(--blue-600); }
.att-row-none { border-inline-start-color: var(--stone-200); }
/* شارات GPS الموحّدة (شاشة المشرف وصفحة الصنايعي) */
.att-gps { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: .82rem; font-weight: 700; background: var(--stone-100); color: var(--stone-700); white-space: nowrap; }
.att-gps small { font-weight: 600; opacity: .85; }
.att-gps-on_site { background: var(--green-100); color: var(--green-600); }
.att-gps-far { background: var(--red-100); color: var(--red-600); }
.att-gps-low_accuracy { background: var(--amber-100); color: var(--amber-600); }
.att-gps-unverified { background: var(--stone-100); color: var(--stone-600); }
/* إبلاغ الهاتف */
.att-report { background: var(--blue-100); border-radius: 10px; padding: 8px 12px; justify-content: space-between; }
.att-report-text { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: .9rem; font-weight: 600; color: var(--stone-800); }
.att-report-actions { display: inline-flex; gap: 6px; flex-wrap: wrap; }
/* الجلسات: من … إلى … مدة */
.att-session { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0; border-top: 1px dashed var(--border); }
.att-sessions li.att-session:first-child { border-top: 0; }
.att-seg { display: inline-flex; align-items: center; gap: 4px; }
.att-seg > small { color: var(--muted); font-weight: 600; }
.att-dur { font-weight: 800; padding: 2px 10px; border-radius: 999px; background: var(--stone-900); color: #fff; font-size: .8rem; }
.att-session.is-open { background: var(--blue-100); border-radius: 8px; padding-inline: 8px; }
.att-mini-wrap { display: grid; gap: 4px; }
.att-mini-title { font-size: .82rem; font-weight: 700; color: var(--stone-700); }
.att-legend { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.att-filters input[type="date"], .att-filters select { width: 100%; }
.att-filters .grow { flex: 1 1 220px; }
.att-geo { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.att-geo-status { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--stone-100); color: var(--stone-700); }
.att-geo-status.is-on { background: var(--green-100); color: var(--green-600); }
.att-geo-status.is-wait { background: var(--amber-100); color: var(--amber-600); }
.att-geo-status.is-off { background: var(--red-100); color: var(--red-600); }
.att-summary { display: flex; gap: 8px; flex-wrap: wrap; }
.att-summary .badge { font-size: .85rem; padding: 6px 12px; }
.att-bulk { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.att-bulk form { margin: 0; }
.att-extra summary { list-style: none; cursor: pointer; }
.att-extra summary::-webkit-details-marker { display: none; }
.att-extra[open] { flex-basis: 100%; }
.att-extra select { min-width: 220px; }
.att-list { display: grid; gap: 12px; }
.att-row { padding: 14px 16px; border-inline-start: 4px solid var(--stone-300); }
.att-row-open { border-inline-start-color: var(--blue-600); }
.att-row-warn { border-inline-start-color: var(--red-600); }
.att-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.att-head .badge { margin-inline-start: 4px; }
.att-hours { font-weight: 700; }
.att-reports { margin-top: 8px; display: grid; gap: 6px; }
.att-report { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.att-sessions { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; font-size: .92rem; }
.att-sessions li small { color: var(--muted); margin-inline-start: 4px; }
.att-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.att-actions form { margin: 0; }
.att-actions .btn-lg { min-width: 140px; }
.att-more { flex-basis: 100%; }
.att-more summary { list-style: none; cursor: pointer; display: inline-flex; }
.att-more summary::-webkit-details-marker { display: none; }
.att-more-body { display: grid; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.att-mini { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0; }
.att-mini input[type="text"] { flex: 1 1 200px; }
.att-mini select, .att-mini input[type="time"] { width: auto; }
.att-mini label { display: inline-flex; align-items: center; gap: 4px; margin: 0; font-weight: 600; }
@media (max-width: 640px) {
  .att-actions .btn-lg { flex: 1 1 100%; }
  .att-row { padding: 12px; }
}
/* تقويم الصنايعي */
/* صفحة الصنايعي */
.att-monthnav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.att-monthnav select { width: auto; min-width: 150px; }
.att-today { font-size: .9rem; font-weight: 700; color: var(--stone-800); display: inline-flex; gap: 6px; align-items: center; }
.att-report-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.att-mylist { list-style: none; padding: 0; margin: 0; }
.att-mylist li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .92rem; flex-wrap: wrap; }
.att-mylist .att-time { font-weight: 800; font-family: var(--font-display); min-width: 52px; }
.att-mylist .att-mytext { flex: 1; display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.stats-compact { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stats-compact .stat { padding: 12px 14px; }
.stats-compact .stat-value { font-size: 1.4rem; }
.att-key { display: inline-block; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--border); font-weight: 600; color: var(--stone-800); }
.att-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.att-cal-head-short { display: none; }
.att-cal-cell.is-friday { background: var(--stone-100); }
.att-cal-cell.is-friday.st-full { background: var(--green-100); }
.att-cal-late { color: var(--amber-600); font-size: .7rem; font-weight: 700; }
/* سجل الأيام */
.att-days { list-style: none; margin: 0; padding: 0; }
.att-dayrow { display: flex; gap: 16px; padding: 12px 20px; border-top: 1px solid var(--border); border-inline-start: 4px solid var(--stone-200); align-items: flex-start; }
.att-dayrow.st-full { border-inline-start-color: var(--green-600); }
.att-dayrow.st-half, .att-dayrow.st-open { border-inline-start-color: var(--blue-600); }
.att-dayrow.st-partial { border-inline-start-color: var(--amber-600); }
.att-dayrow.st-absent { border-inline-start-color: var(--red-600); }
.att-daydate { flex: none; width: 74px; text-align: center; display: flex; flex-direction: column; line-height: 1.15; }
.att-dayname { font-size: .78rem; font-weight: 700; color: var(--gold-700); }
.att-daynum { font-size: 1.6rem; font-weight: 800; font-family: var(--font-display); }
.att-daymonth { font-size: .72rem; color: var(--muted); }
.att-dayinfo { flex: 1; min-width: 0; display: grid; gap: 6px; }
.att-daystatus { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.att-dayhours { font-weight: 800; }
.att-daysessions { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: .9rem; }
.att-daysession .num { font-weight: 700; }
.att-cal-head { text-align: center; font-size: .78rem; font-weight: 700; color: var(--muted); padding: 4px 0; }
.att-cal-cell { min-height: 74px; border: 1px solid var(--border); border-radius: 10px; padding: 6px; font-size: .78rem; background: #fff; }
.att-cal-cell.is-empty { border: 0; background: transparent; }
.att-cal-cell.is-today { border-color: var(--gold-600); box-shadow: inset 0 0 0 1px var(--gold-600); }
.att-cal-cell.is-future { opacity: .55; }
.att-cal-day { font-weight: 800; font-size: .95rem; }
.att-cal-status { font-weight: 700; margin-top: 2px; }
.att-cal-hours, .att-cal-times { color: var(--muted); font-size: .72rem; }
.att-cal-cell.st-full { background: var(--green-100); }
.att-cal-cell.st-half { background: var(--blue-100); }
.att-cal-cell.st-partial { background: var(--amber-100); }
.att-cal-cell.st-absent { background: var(--red-100); }
.att-cal-cell.st-leave { background: var(--stone-100); }
.att-cal-cell.st-open { background: var(--blue-100); }
@media (max-width: 640px) {
  .att-cal { gap: 3px; }
  .att-cal-cell { min-height: 52px; padding: 3px; font-size: .62rem; border-radius: 6px; }
  .att-cal-day { font-size: .85rem; }
  .att-cal-head-full { display: none; }
  .att-cal-head-short { display: inline; }
  .att-daynav .btn { padding: 7px 10px; }
  .att-daylabel { flex: 1 1 100%; order: -1; justify-content: center; }
  .att-stats { grid-template-columns: repeat(3, 1fr); }
  .att-hours { min-width: 70px; }
  .att-dayrow { padding: 10px 12px; gap: 10px; }
  .att-daydate { width: 58px; }
  .att-daynum { font-size: 1.3rem; }
  .att-report-btns { grid-template-columns: 1fr; }
  .att-report-head, .att-month-head { flex-wrap: wrap; }
  .att-report-head .att-today, .att-monthnav { flex: 1 1 100%; }
  .att-monthnav form { flex: 1; }
  .att-monthnav select { width: 100%; min-width: 0; }
}

/* ---- الرسوم البيانية في لوحة المدير ---- */
.charts-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.charts-toolbar h3 { display: inline-flex; align-items: center; gap: 6px; }
.charts-toolbar select { width: auto; }
.chart-card canvas { max-height: 280px; width: 100% !important; }
.chart-table { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }   /* للقارئ الشاشي */
@media print {
  .chart-card canvas, .charts-toolbar form { display: none !important; }
  .chart-table { position: static; width: 100%; height: auto; overflow: visible; clip: auto; white-space: normal; border-collapse: collapse; font-size: .85rem; }
  .chart-table th, .chart-table td { border: 1px solid #ccc; padding: 4px 8px; }
  .chart-table caption { font-weight: 700; margin-bottom: 4px; }
}

/* ---- صور الإنجاز: خط زمني ---- */
.timeline-progress { display: grid; gap: 18px; }
.tl-group { border-inline-start: 3px solid var(--gold-500); padding-inline-start: 14px; }
.tl-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; font-weight: 700; }
.timeline-progress figure { margin: 0; }
.timeline-progress figcaption { padding: 4px 2px 0; }

/* ---- تقييم العملاء: نجوم عرض + مكوّن إدخال بلا JavaScript ---- */
.stars { display: inline-flex; gap: 2px; vertical-align: middle; }
.stars .star { fill: var(--stone-200); stroke: var(--stone-300); stroke-width: 1; }
.stars .star.on { fill: var(--gold-500); stroke: var(--gold-600); }
.star-input { border: 0; padding: 0; margin: 0 0 12px; }
.star-input legend { font-weight: 700; margin-bottom: 4px; }
.star-input-row { display: inline-flex; flex-direction: row-reverse; gap: 4px; }   /* DOM: 5→1، العرض: 1→5 (RTL معكوس) */
.star-input input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.star-input label { cursor: pointer; display: inline-flex; padding: 4px; border-radius: 8px; }
.star-input label svg { fill: var(--stone-200); stroke: var(--stone-300); stroke-width: 1; transition: .12s; }
.star-input input:checked ~ label svg, .star-input label:hover svg, .star-input label:hover ~ label svg { fill: var(--gold-500); stroke: var(--gold-600); }
.star-input input:focus-visible + label { outline: 2px solid var(--gold-600); outline-offset: 2px; }
.star-input-hint { min-height: 1.2em; }

/* اختيار أيقونة الخدمة: radio + CSS بلا JavaScript */
.icon-picker { border: 0; padding: 0; margin: 0 0 16px; }
.icon-picker legend { font-weight: 700; margin-bottom: 6px; font-size: .92rem; }
.icon-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.icon-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.icon-picker label { display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 72px; padding: 10px 6px; margin: 0;
  border: 1px solid var(--stone-300); border-radius: var(--radius-sm); background: #fff; color: var(--muted); font-weight: 600; font-size: .82rem; cursor: pointer; transition: .15s; text-align: center; }
.icon-picker label:hover { border-color: var(--gold-500); color: var(--text); }
.icon-picker input:checked + label { border-color: var(--gold-600); background: var(--gold-100); box-shadow: 0 0 0 3px rgba(193,154,63,.2); }
.icon-picker input:focus-visible + label { outline: 2px solid var(--gold-600); outline-offset: 2px; }
.review-card .review-meta { margin-top: 8px; font-size: .85rem; color: var(--muted); }
.review-reply { margin-top: 8px; padding: 8px 12px; background: var(--stone-50); border-inline-start: 3px solid var(--gold-500); border-radius: 8px; font-size: .9rem; }
.review-inline { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; background: var(--stone-50); }
.review-invite { border-inline-start: 4px solid var(--gold-600); }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 600; margin: 8px 0; }

/* روابط السوشيال: هدف لمس 44px */
.social-links { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.social-links li a { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--border); color: var(--stone-700); background: #fff; transition: .18s; }
.social-links li a:hover { color: var(--gold-700); border-color: var(--gold-500); transform: translateY(-2px); text-decoration: none; }
.social-links li a svg { width: 22px; height: 22px; }
.social-links.centered { justify-content: center; }
.site-footer .social-links li a { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.18); color: #fff; }
.site-footer .social-links li a:hover { color: var(--gold-400); border-color: var(--gold-400); }
.social-band { text-align: center; padding: 28px 20px; background: var(--stone-50); border: 1px solid var(--border); border-radius: var(--radius); }
.social-band .social-links { justify-content: center; }
.social-band .social-links li a { width: 52px; height: 52px; }
.social-band .social-links li a svg { width: 26px; height: 26px; }

.card-danger { border-color: var(--red-600); }
.card-danger .card-header { background: var(--red-100); }
.card-danger h3 { color: var(--red-600); }

/* ---- المرتّبات ---- */
.payroll-table th, .payroll-table td { font-size: .85rem; }
.inline-details { display: inline-block; }
.inline-details summary { list-style: none; cursor: pointer; display: inline-flex; }
.inline-details summary::-webkit-details-marker { display: none; }
.inline-details[open] { display: block; }

/* ---- كشف الحضور الشهري ---- */
.att-sheet th.c, .att-sheet td.c { text-align: center; padding: 6px 4px; min-width: 22px; font-size: .8rem; }
.att-sheet .att-sheet-name { white-space: nowrap; }
.att-sheet .is-fri, .att-sheet .is-hol { background: var(--stone-100); }
.att-sheet td.st-full { background: var(--green-100); color: var(--green-600); font-weight: 700; }
.att-sheet td.st-half { background: var(--blue-100); color: var(--blue-600); font-weight: 700; }
.att-sheet td.st-partial { background: var(--amber-100); color: var(--amber-600); font-weight: 700; }
.att-sheet td.st-absent { background: var(--red-100); color: var(--red-600); font-weight: 700; }
.att-sheet td.st-leave { color: var(--muted); font-weight: 700; }
.sheet-wide { max-width: 1400px; }
@media print { .sheet-wide { max-width: none; } @page { size: A4 landscape; } }

/* ---- الإشعارات (R-04) ---- */
.icon-btn { position: relative; padding: 7px 9px; }
.icon-btn .icon-count { position: absolute; top: -6px; inset-inline-end: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; font-size: .7rem; line-height: 18px; display: inline-block; text-align: center; }
.bell { position: relative; }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif { display: flex; justify-content: space-between; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--stone-200); border-inline-start: 4px solid transparent; }
.notif:last-child { border-bottom: 0; }
.notif.unread { background: #fdf8ef; }
.notif.level-success { border-inline-start-color: var(--green-600); }
.notif.level-warning { border-inline-start-color: var(--amber-600); }
.notif.level-danger { border-inline-start-color: var(--red-600); }
.notif.level-info { border-inline-start-color: var(--blue-600); }
.notif-main { flex: 1; min-width: 0; }
.notif-actions { align-items: center; gap: 6px; }
@media (max-width: 640px) { .notif { flex-direction: column; } }
.text-danger { color: var(--red-600); }

/* ---- لوحة التوقيع (R-06) ---- */
.signature-pad { border: 2px dashed var(--stone-300); border-radius: 12px; background: #fff; padding: 8px; }
.signature-pad canvas { display: block; width: 100%; height: auto; touch-action: none; cursor: crosshair; border-radius: 8px; background: #fff; }
.signature-tools { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.signature-data { display: none; }

/* ---------- طلبات الصنايعية (R-07): لوحة القرار داخل الجدول ---------- */
.req-actions summary { list-style: none; cursor: pointer; display: inline-flex; }
.req-actions summary::-webkit-details-marker { display: none; }
.req-actions-panel { display: grid; gap: 8px; margin-top: 8px; min-width: 240px; text-align: right; white-space: normal; }
.req-actions-panel form { display: grid; gap: 6px; padding: 8px; border: 1px dashed var(--border); border-radius: 8px; }

/* ---------- صفحة «خدماتنا»: بطاقات مفصّلة، ضمانات التعامل، أسئلة شائعة (بلا JS) ---------- */
.hero-compact .container { padding-block: 72px; }
.service-card { display: flex; flex-direction: column; }
.service-card .card-body { flex: 1; }
.service-card .feature h3 { font-size: 1.2rem; }
.service-detail { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border); }
.service-detail p { font-size: .93rem; margin: 0 0 10px; }
.service-includes { font-size: .8rem; font-weight: 700; color: var(--gold-700); letter-spacing: .03em; margin-bottom: 6px; }
.service-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.service-list li { display: flex; gap: 8px; align-items: flex-start; font-size: .93rem; color: var(--stone-700); }
.service-list li svg { flex: none; color: var(--green-600); margin-top: 4px; }
.guarantee { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 20px; }
.guarantee .icon { width: 44px; height: 44px; border-radius: 12px; background: var(--gold-100); color: var(--gold-700); display: grid; place-items: center; margin-bottom: 12px; }
.guarantee .icon svg { width: 22px; height: 22px; }
.guarantee h3 { font-size: 1.02rem; margin: 0 0 6px; }
.guarantee p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.7; }
.faq { max-width: 860px; display: grid; gap: 10px; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 20px; }
.faq-item summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 0; font-weight: 700; color: var(--stone-900); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary svg { flex: none; color: var(--gold-600); transition: transform .2s; }
.faq-item[open] summary svg { transform: rotate(45deg); }
.faq-item[open] summary { border-bottom: 1px solid var(--border); }
.faq-body { padding: 14px 0 18px; color: var(--stone-700); line-height: 1.8; }
.faq-body p { margin: 0; }
@media (max-width: 960px) { .guarantee-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .guarantee-grid, .service-grid { grid-template-columns: 1fr; } }
/* ---------- البحث الشامل (R-60): زر المكبّر في الشريط العلوي + لوحة Ctrl+K + صفحة النتائج ---------- */
.search-open { gap: 6px; }
.search-kbd { font: 700 .7rem/1 var(--font); color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; background: var(--stone-50); }
@media (max-width: 640px) { .search-kbd { display: none; } }
.search-palette { border: 0; border-radius: var(--radius); padding: 0; width: min(640px, calc(100vw - 32px)); max-height: min(70vh, 640px); box-shadow: var(--shadow-lg); background: #fff; color: var(--text); direction: rtl; text-align: right; margin: 10vh auto auto; overflow: hidden; display: none; flex-direction: column; }
.search-palette[open] { display: flex; }
.search-palette::backdrop { background: rgba(28,25,23,.45); backdrop-filter: blur(2px); }
.search-palette-form { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); margin: 0; }
.search-palette-form svg { color: var(--muted); flex: 0 0 auto; }
.search-palette-form input[type="search"] { flex: 1; border: 0; outline: 0; font: inherit; font-size: 1.05rem; background: transparent; min-width: 0; padding: 6px 0; }
.search-palette-form input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search-palette-results { overflow: auto; padding: 6px 0; flex: 1 1 auto; }
.search-palette-results .search-group { padding: 4px 8px; }
.search-group-head { display: flex; justify-content: space-between; align-items: center; font-size: .78rem; font-weight: 700; color: var(--muted); padding: 6px 10px 2px; }
.search-group-head a { color: var(--gold-700); font-weight: 700; }
.search-hits { list-style: none; margin: 0; padding: 0; }
.search-hits a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.search-hits a:hover, .search-hits a.is-active { background: var(--stone-100); }
.search-hit-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-hit-sub { color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.search-hits .badge { margin-inline-start: auto; flex: 0 0 auto; }
.search-empty { color: var(--muted); padding: 18px 16px; margin: 0; text-align: center; }
.search-palette-foot { display: flex; justify-content: space-between; gap: 12px; padding: 8px 16px; border-top: 1px solid var(--border); font-size: .78rem; color: var(--muted); background: var(--stone-50); }
.search-palette-foot a { color: var(--gold-700); font-weight: 700; }
.card.search-group .card-header h3 { display: flex; align-items: center; gap: 8px; }
.card.search-group .search-hits a { padding: 10px 4px; border-radius: 0; border-bottom: 1px solid var(--border); }
.card.search-group .search-hits li:last-child a { border-bottom: 0; }

/* ---------- خط زمني للعميل ومتابعات (R-43): عناصر المتابعة في صفحة العميل وقائمة المتابعات ---------- */
.fu-list { list-style: none; margin: 0; padding: 0; }
.fu-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.fu-item:last-child { border-bottom: 0; }
.fu-item.fu-done { opacity: .72; }
.fu-icon { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--stone-100); color: var(--stone-700); }
.fu-icon.fu-call { background: var(--blue-100); color: var(--blue-600); }
.fu-icon.fu-visit { background: var(--green-100); color: var(--green-600); }
.fu-icon.fu-message { background: var(--gold-100); color: var(--gold-700); }
.fu-body { flex: 1; min-width: 0; }
.fu-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fu-head .t { color: var(--muted); font-size: .8rem; }
.fu-summary { margin-top: 4px; white-space: pre-line; overflow-wrap: anywhere; }
.fu-next { margin-top: 4px; font-size: .88rem; color: var(--gold-700); font-weight: 700; display: flex; align-items: center; gap: 4px; }
.fu-meta { margin-top: 4px; }
.fu-actions { display: flex; gap: 2px; flex: 0 0 auto; }
.fu-reminder { border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 8px 14px 4px; margin: 8px 0 0; }
.fu-reminder legend { font-size: .85rem; font-weight: 700; color: var(--muted); padding: 0 6px; display: flex; align-items: center; gap: 4px; }
@media (max-width: 640px) { .fu-item { flex-wrap: wrap; } .fu-actions { width: 100%; justify-content: flex-end; } }
/* ---------- مهام المراحل (R-42) ---------- */
.progress-sm { height: 6px; }
.stage-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 960px) { .stage-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .stage-grid { grid-template-columns: 1fr; } }
.stage-col { background: var(--stone-50, #fafaf9); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.stage-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.stage-head h4 { margin: 0; font-size: 1rem; }
.task-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; flex: 1; }
.task { display: flex; gap: 8px; align-items: flex-start; padding: 6px 4px; border-bottom: 1px dashed var(--border); }
.task:last-child { border-bottom: 0; }
.task-body { flex: 1; min-width: 0; }
.task-title { font-weight: 700; color: var(--stone-900); display: block; }
.task.is-done .task-title { text-decoration: line-through; color: var(--muted); font-weight: 600; }
.task.is-late .task-title { color: var(--red-700, #b91c1c); }
.task-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.task-actions { display: flex; gap: 2px; align-items: center; }
.task-check .check-btn { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--stone-400); background: #fff; color: transparent; display: grid; place-items: center; cursor: pointer; padding: 0; margin-top: 2px; }
.task-check .check-btn.on { background: var(--green-600, #16a34a); border-color: var(--green-600, #16a34a); color: #fff; }
.task-check .check-btn:hover { border-color: var(--gold-600); }
.task-add summary { list-style: none; cursor: pointer; display: inline-flex; }
.task-add summary::-webkit-details-marker { display: none; }
.task-list-lg .task { padding: 12px 6px; align-items: center; }
.row-late td:first-child { border-inline-start: 3px solid var(--red-600); }
.stage-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 640px) { .stage-bars { grid-template-columns: repeat(2, 1fr); } }
/* R-30 — مستندات الصنايعي: نموذج الرفع المضغوط وتعديل الصف داخل <details> */
.wdoc-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px 12px; align-items: end; }
.wdoc-form .form-group { margin-bottom: 0; }
.wdoc-form > label { display: grid; gap: 4px; font-size: .85rem; font-weight: 600; }
.wdoc-edit summary { list-style: none; cursor: pointer; display: inline-flex; }
.wdoc-edit summary::-webkit-details-marker { display: none; }
.wdoc-edit[open] { display: block; min-width: 320px; }
.wdoc-table td.actions { white-space: normal; }
/* ---------- مواعيد المعاينة (R-40): قائمة المواعيد، خلايا التقويم، شرائح الحالة ---------- */
.ap-list { list-style: none; margin: 0; padding: 0; }
.ap-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.ap-item:last-child { border-bottom: 0; }
.ap-item.ap-cancelled, .ap-item.ap-no_show { opacity: .65; }
.ap-when { flex: 0 0 96px; text-align: center; border-radius: var(--radius-sm); background: var(--stone-100); padding: 6px 4px; line-height: 1.2; }
.ap-when .ap-day { display: block; font-size: 1.5rem; font-weight: 800; }
.ap-when .ap-month { display: block; font-size: .7rem; color: var(--muted); }
.ap-when .ap-time { display: block; font-weight: 700; margin-top: 2px; }
.ap-item.ap-requested .ap-when { background: var(--amber-100); }
.ap-item.ap-confirmed .ap-when { background: var(--blue-100); }
.ap-item.ap-done .ap-when { background: var(--green-100); }
.ap-body { flex: 1; min-width: 0; }
.ap-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ap-meta { margin-top: 4px; }
.ap-actions { display: flex; gap: 4px; flex: 0 0 auto; align-items: center; }
.ap-pre { white-space: pre-line; overflow-wrap: anywhere; }
.ap-end { align-self: end; }
.ap-cal .att-cal-cell { opacity: 1; min-height: 88px; }
.ap-cal .att-cal-day a { color: inherit; text-decoration: none; }
.ap-cal .att-cal-day a:hover { color: var(--gold-700); }
.ap-cell.has-items { background: #fff; }
.ap-chip { display: block; font-size: .7rem; line-height: 1.25; padding: 2px 5px; border-radius: 6px; margin-top: 3px; background: var(--stone-100); color: var(--stone-700); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-chip.ap-requested { background: var(--amber-100); color: var(--amber-600); }
.ap-chip.ap-confirmed { background: var(--blue-100); color: var(--blue-600); }
.ap-chip.ap-done { background: var(--green-100); color: var(--green-600); }
.ap-chip.ap-cancelled, .ap-chip.ap-no_show { background: var(--stone-100); color: var(--muted); text-decoration: line-through; }
.ap-legend .ap-chip { display: inline-block; margin: 0 2px; }
@media (max-width: 640px) { .ap-item { flex-wrap: wrap; } .ap-when { flex-basis: 72px; } .ap-actions { width: 100%; justify-content: flex-end; } .ap-chip { font-size: .62rem; } }

/* ---------- R-22: إيصال استلام النقدية ودفتر الخزينة/البنك ---------- */
.receipt-sheet { max-width: 760px; }
.receipt-body { margin-top: 18px; font-size: 1.05rem; line-height: 2.1; }
.receipt-line { margin: 0 0 4px; padding-bottom: 4px; border-bottom: 1px dotted var(--stone-300); }
.receipt-sign { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 40px; }
.receipt-sign .sign-label { font-size: .9rem; color: var(--muted); margin-bottom: 34px; }
.receipt-sign .sign-line { border-top: 1px solid var(--stone-500); }
.cash-balance { font-size: 1.6rem; font-weight: 800; margin-bottom: 8px; }
@media print { .receipt-sheet { border: 0; margin: 0; max-width: none; } }

/* ---------- R-31: عهدة الأدوات ---------- */
.tool-status-assigned { background: var(--blue-100, #dbeafe); color: var(--blue-600, #2563eb); }
.custody-sheet .custody-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 32px; }
.custody-sheet .custody-sign img { max-width: 260px; max-height: 110px; display: block; }
.custody-sheet .sign-line { border-top: 1px solid var(--stone-500); margin-top: 40px; }
/* ---------- خطط الأقساط (R-21): جدول الخطة وحالات الأقساط ---------- */
.inst-table tr.inst-overdue td { background: var(--red-100); }
.inst-table tr.inst-paid td { color: var(--muted); }
.inst-table tfoot td { font-weight: 700; background: var(--stone-100); }
@media print { .inst-table tr.inst-overdue td { background: transparent; } }

/* ---------- R-11: مصادر العملاء ---------- */
.src-table .src-bar-col { width: 22%; min-width: 90px; }
.src-table .src-bar { display: block; height: 10px; border-radius: 5px; background: var(--brand-500, #b08b57); min-width: 2px; }
@media print { .src-table .src-bar { background: #999; -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* ---------- R-14: مقارنة الخامات وشريط قبل/بعد ---------- */
/* شريط اختيار المقارنة في الكتالوج (الحالة في الرابط — بلا JS) */
.compare-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 16px;
  border: 1px solid var(--stone-300); border-radius: var(--radius); background: var(--stone-100); }
.compare-bar-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .92rem; }
.compare-bar .chip { display: inline-flex; align-items: center; gap: 6px; }
.compare-bar .compare-drop { display: inline-flex; color: inherit; opacity: .7; }
.compare-bar .compare-drop:hover { opacity: 1; text-decoration: none; }
.tile-compare { margin-top: 8px; }
.cmp-add { display: inline-flex; align-items: center; gap: 5px; font-size: .85rem; font-weight: 600; color: var(--stone-700); }
.cmp-add:hover { text-decoration: none; color: var(--stone-900); }
.cmp-add.is-in { color: var(--brand-600, #8a6a3c); }
/* جدول المقارنة: أول عمود ثابت وتمرير أفقي على الجوال */
.cmp-wrap { overflow-x: auto; }
.cmp-table { min-width: 560px; }
.cmp-table th, .cmp-table td { vertical-align: top; text-align: start; }
.cmp-table .cmp-head { width: 22%; min-width: 130px; background: var(--stone-100); font-weight: 700; }
.cmp-table .cmp-img { display: block; aspect-ratio: 4/3; max-width: 190px; border-radius: var(--radius-sm, 8px); overflow: hidden; background: var(--stone-100); }
.cmp-table .cmp-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cmp-table .cmp-name { display: block; margin-top: 6px; font-weight: 700; }
/* شريط قبل/بعد في صفحة المشروع العامة: القسمة من متغيّر --ba (افتراضه 50% فيعمل بلا JavaScript) */
.ba-block { --ba: 50%; }
.ba { position: relative; aspect-ratio: 3/2; border-radius: var(--radius); overflow: hidden; background: var(--stone-100); }
.ba img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.ba .ba-after { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--ba)) 0 0); }
.ba .ba-line { position: absolute; top: 0; bottom: 0; left: var(--ba); width: 2px; background: #fff; box-shadow: 0 0 6px rgba(0, 0, 0, .45); pointer-events: none; }
.ba-tag { position: absolute; bottom: 10px; padding: 4px 12px; border-radius: 999px; font-size: .82rem; font-weight: 700;
  background: rgba(28, 25, 23, .72); color: #fff; }
.ba-tag-before { right: 10px; }
.ba-tag-after { left: 10px; }
.ba-control { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.ba-control input[type="range"] { flex: 1 1 220px; max-width: 420px; accent-color: var(--brand-500, #b08b57); cursor: ew-resize; }
@media (max-width: 640px) { .ba { aspect-ratio: 4/3; } }
@media print { .ba .ba-after { clip-path: none; position: static; } .ba-control, .ba .ba-line { display: none; } }
/* ============================================================
   R-64: ألوان الرسوم البيانية كمتغيّرات (يقرؤها main.js) — القيم هنا هي قيم الوضع الفاتح نفسها قبل البند.
   ============================================================ */
:root {
  --chart-ink: #44403c;          /* نص المحاور والمفاتيح */
  --chart-grid: rgba(28,25,23,.08);
  --chart-strong: #1c1917;       /* العمود الأساسي (فواتير/تعاقد) */
  --chart-soft: #d6d3d1;         /* العمود الثانوي (إجمالي الطلبات) */
  --chart-mid: #78716c;          /* الخامات */
  --chart-labor: #44403c;        /* العمالة */
  --chart-ring: #ffffff;         /* حدّ شرائح الدونات */
  /* R-64: نص الشارة الذهبية وحده — --gold-700 (#8a6a1f) على --gold-100 يعطي 4.40 وهو دون معيار WCAG AA؛
     هذه الدرجة تبلغ 5.37 بلا أي مساس بلون الروابط ولا بأزرار --gold-600/700. */
  --gold-800: #7a5d17;
}
.badge-gold { color: var(--gold-800); }
.icon-picker input:checked + label { color: var(--gold-800); }

/* ============================================================
   R-64: الوضع الداكن — يُفعَّل بـ<html data-theme="dark"> (اللوحة والبوابتان وصفحات الدخول فقط؛ الموقع العام يبقى فاتحاً).
   الطريقة: قلب سلّم --stone-* فيتبعه كل ما بُني عليه أعلاه بلا تعديل سطر واحد، ثم تصحيح الأسطح البيضاء الصريحة،
   ثم استثناء المكوّنات الداكنة بالتصميم (القائمة الجانبية، شاشة الدخول، الأزرار المعتمة) حتى لا تنقلب.
   كل ما تحت داخل @media screen: الطباعة تبقى بيضاء دائماً مهما كان الوضع (فاتورة/إيصال/كشف/تقرير).
   ============================================================ */
@media screen {
  :root[data-theme="dark"] {
    color-scheme: dark;                        /* عناصر المتصفح نفسها: التقويم، القوائم، أشرطة التمرير */
    --stone-900: #f5f2ec;                      /* كان الأدكن ⇒ صار الأفتح: نص العناوين والمتون */
    --stone-800: #e8e4dc;
    --stone-700: #d3cdc3;
    --stone-600: #b3aca1;                      /* --muted */
    --stone-500: #8f877b;
    --stone-400: #6d665c;
    --stone-300: #4a453d;                      /* حدود الحقول والأزرار المفرغة */
    --stone-200: #38342e;                      /* --border */
    --stone-100: #2a2721;                      /* خلفيات خفيفة (شارات، تمرير) */
    --stone-50:  #201e1a;                      /* رؤوس الجداول وتذييل البطاقات */
    --bg: #171512;
    --surface: #211f1b;
    --surface-2: #1b1a16;                      /* حقول الإدخال داخل البطاقات */
    --gold-700: #e3c07a;                       /* لون الروابط — لا بد أن يضيء على الداكن */
    --gold-800: #e3c07a;                       /* نص الشارة الذهبية — على --gold-100 الداكنة */
    --gold-100: #3a2f16;
    --green-600: #4ade80; --green-100: #14321f;
    --red-600: #f87171;   --red-100: #3a1c1c;
    --amber-600: #fbbf24; --amber-100: #3a2a10;
    --blue-600: #7fb3ff;  --blue-100: #17253d;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow: 0 4px 16px rgba(0,0,0,.45);
    --shadow-lg: 0 16px 40px rgba(0,0,0,.55);
    --chart-ink: #b3aca1; --chart-grid: rgba(245,242,236,.10); --chart-strong: #e3c07a;
    --chart-soft: #57534e; --chart-mid: #8f877b; --chart-labor: #b3aca1; --chart-ring: #211f1b;
  }

  /* 1) الأسطح المكتوبة بالأبيض الصريح أعلاه ⇒ سطح الوضع الداكن */
  :root[data-theme="dark"] .topbar,
  :root[data-theme="dark"] table.table,
  :root[data-theme="dark"] .stat,
  :root[data-theme="dark"] .chip,
  :root[data-theme="dark"] .pagination a,
  :root[data-theme="dark"] .pagination span,
  :root[data-theme="dark"] .auth-card,
  :root[data-theme="dark"] .invoice-sheet,
  :root[data-theme="dark"] .att-stat,
  :root[data-theme="dark"] .att-cal-cell,
  :root[data-theme="dark"] .ap-cell.has-items,
  :root[data-theme="dark"] .social-links li a,
  :root[data-theme="dark"] .signature-pad,
  :root[data-theme="dark"] .search-palette,
  :root[data-theme="dark"] .icon-picker label { background: var(--surface); }
  /* حقول الإدخال أغمق قليلاً من السطح لتبقى مميّزة داخل البطاقة */
  :root[data-theme="dark"] .ai-ask-field { background: var(--surface-2); border-color: var(--stone-700); }   /* حقل السؤال بأيقوناته (2026-09-27) */
  :root[data-theme="dark"] .form-control,
  :root[data-theme="dark"] input[type="text"], :root[data-theme="dark"] input[type="email"],
  :root[data-theme="dark"] input[type="password"], :root[data-theme="dark"] input[type="number"],
  :root[data-theme="dark"] input[type="tel"], :root[data-theme="dark"] input[type="date"],
  :root[data-theme="dark"] input[type="time"], :root[data-theme="dark"] input[type="month"],
  :root[data-theme="dark"] input[type="search"], :root[data-theme="dark"] select,
  :root[data-theme="dark"] textarea,
  :root[data-theme="dark"] .task-check .check-btn { background: var(--surface-2); }
  /* لوحة التوقيع نفسها تبقى بيضاء: صورة PNG تُحفظ وتُطبع (R-06) */
  :root[data-theme="dark"] .signature-pad canvas { background: #fff; }

  /* 2) مكوّنات داكنة بالتصميم — لا تنقلب مع السلّم */
  :root[data-theme="dark"] .sidebar { background: #100f0d; color: var(--stone-700); }
  :root[data-theme="dark"] .sidebar .menu a { color: var(--stone-700); }
  :root[data-theme="dark"] .sidebar .menu-label { color: var(--stone-500); }
  :root[data-theme="dark"] .sidebar .menu-section:hover,
  :root[data-theme="dark"] .sidebar .menu-section:focus-visible { color: var(--stone-800); }
  :root[data-theme="dark"] .auth-wrap { background: #100f0d; }
  :root[data-theme="dark"] .price-box, :root[data-theme="dark"] .calc-result { background: #100f0d; }
  :root[data-theme="dark"] .btn-primary { background: #f0ece4; color: #1c1917; }
  :root[data-theme="dark"] .btn-primary:hover { background: #ffffff; }
  :root[data-theme="dark"] .btn-light { background: var(--stone-200); color: var(--stone-900); }
  :root[data-theme="dark"] .btn-light:hover { background: var(--stone-100); }
  :root[data-theme="dark"] .btn-danger { background: #c1352f; }
  :root[data-theme="dark"] .btn-accent:hover { background: #8a6a1f; }
  :root[data-theme="dark"] .chip:hover, :root[data-theme="dark"] .chip.active,
  :root[data-theme="dark"] .pagination .current { background: #f0ece4; color: #1c1917; border-color: #f0ece4; }
  :root[data-theme="dark"] .att-dur { background: var(--stone-200); color: var(--stone-900); }
  :root[data-theme="dark"] .task-check .check-btn.on { background: #15803d; border-color: #15803d; color: #fff; }

  /* 3) حدود التنبيهات مكتوبة بألوان فاتحة صريحة أعلاه */
  :root[data-theme="dark"] .alert-success { border-color: #1f5c38; }
  :root[data-theme="dark"] .alert-danger { border-color: #7f2f2f; }
  :root[data-theme="dark"] .alert-warning { border-color: #7a5512; }
  :root[data-theme="dark"] .alert-info { border-color: #2b4a7a; }
  :root[data-theme="dark"] .row-danger { background: var(--red-100) !important; }
}

/* ============================================================
   R-64: بطاقة «آخر 20 حدثاً» في رئيسية اللوحة (المدير وحده) — جدول مضغوط بلا عمود تفاصيل ولا أي مبلغ.
   ============================================================ */
.activity-table { table-layout: fixed; }
.activity-table th, .activity-table td { padding: 7px 10px; }
.activity-table .act-when { width: 34%; white-space: nowrap; }
.activity-table .act-who { width: 22%; }
.activity-table .act-what { width: 26%; }
.activity-table .act-target { width: 18%; }
.activity-table td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-card .card-body { padding: 0; }
.activity-card .table-wrap { max-height: 420px; overflow-y: auto; }

/* زر تبديل الوضع الداكن في الشريط العلوي */
.theme-toggle svg { transition: transform .2s; }
:root[data-theme="dark"] .theme-toggle svg { transform: rotate(-20deg); }

/* ---------- R-33 الورديات: شبكة الأسبوع ---------- */
.shift-scroll { overflow-x: auto; }
.shift-grid th, .shift-grid td { vertical-align: top; min-width: 7.5rem; }
.shift-grid thead th.is-today, .shift-grid td.is-today { background: var(--gold-50, #fdf8ea); }
.shift-cell.has-plan { background: rgba(46, 125, 50, .06); }
.shift-plan { display: flex; flex-direction: column; gap: 2px; margin-bottom: 4px; }
.shift-plan small { font-size: .78rem; line-height: 1.3; }
.shift-cell-form { display: flex; flex-direction: column; gap: 4px; min-width: 12rem; }
.shift-cell-form select, .shift-cell-form input { width: 100%; }
[data-table="my-week"] tr.is-today td { font-weight: 700; }
/* ---------- R-12: المقالات ودليل الرخام والأسئلة الشائعة ---------- */
.article-grid .tile-img { aspect-ratio: 16/10; }
.article-page .article-head { margin-bottom: 20px; }
.article-page .article-head h1 { margin: 8px 0 10px; }
.article-page .article-head .lead { color: var(--muted); font-size: 1.1rem; margin-bottom: 8px; }
.article-cover { margin: 0 0 24px; }
.article-cover img { width: 100%; border-radius: var(--radius); border: 1px solid var(--border); }
.article-cover figcaption { color: var(--muted); font-size: .85rem; margin-top: 6px; text-align: center; }
.prose { font-size: 1.05rem; line-height: 1.9; }
.prose h2 { font-size: 1.45rem; margin: 1.6em 0 .5em; }
.prose h3 { font-size: 1.2rem; margin: 1.3em 0 .4em; }
.prose h4 { font-size: 1.05rem; margin: 1.1em 0 .3em; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose figure, .prose pre, .prose table { margin: 0 0 1.1em; }
.prose ul, .prose ol { padding-inline-start: 1.6em; }
.prose li { margin-bottom: .3em; }
.prose img { max-width: 100%; height: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.prose figure { margin-inline: 0; }
.prose figcaption { color: var(--muted); font-size: .85rem; margin-top: 6px; text-align: center; }
.prose blockquote { border-inline-start: 4px solid var(--gold-500); padding: 6px 16px; color: var(--stone-700); background: var(--stone-50); border-radius: var(--radius-sm); }
.prose table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 10px; text-align: right; }
.prose th { background: var(--stone-50); }
.prose pre { background: var(--stone-100); padding: 12px 14px; border-radius: var(--radius-sm); overflow-x: auto; direction: ltr; text-align: left; font-size: .9rem; }
.prose code { background: var(--stone-100); padding: 1px 5px; border-radius: 4px; font-size: .92em; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 1.6em 0; }
.prose a { text-decoration: underline; }
.faq-category { font-size: 1.15rem; margin: 28px 0 10px; color: var(--stone-700); }
.faq-list { display: grid; gap: 8px; }
.faq-list .faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 16px; }
/* قواعد صفحة /faq وحدها (.faq-list) — أسئلة صفحة «خدماتنا» (.faq) لها أيقونة svg خاصة؛ التعميم السابق أظهر «+» ثانية في منتصف السطر */
.faq-list .faq-item summary { cursor: pointer; font-weight: 700; padding: 14px 0; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq-list .faq-item summary::-webkit-details-marker { display: none; }
.faq-list .faq-item summary::after { content: "+"; color: var(--gold-600); font-weight: 800; flex: none; }
.faq-list .faq-item[open] summary::after { content: "−"; }
.faq-answer { padding-bottom: 14px; font-size: 1rem; }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; padding: 6px; border: 1px solid var(--stone-300); border-bottom: 0; border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: var(--stone-50); }
.editor-toolbar .btn { padding: 4px 8px; font-size: .8rem; }
.editor-toolbar:not([hidden]) + .editor-body { border-top-left-radius: 0; border-top-right-radius: 0; }
.editor-body { font-family: ui-monospace, Consolas, monospace; font-size: .9rem; line-height: 1.6; min-height: 320px; }
.article-image { width: 150px; }
.article-image img { width: 150px; height: 100px; }
@media (max-width: 960px) { .article-editor { grid-template-columns: 1fr; } .article-editor > .card { grid-column: 1 !important; } }

/* ---------- رأس الصفحة في اللوحات على الشاشات الصغيرة ---------- */
/* طلب المالك 2026-09-18: العنوان كان ينضغط في عمود ضيق بجوار أزرار الصفحة (مثال: «المقالات ودليل الرخام» وعدّاداتها كلمةً في كل سطر).
   الآن: أزرار الصفحة في حاوية مستقلة `.page-btns` تنزل سطراً كاملاً تحت العنوان على الشاشات الصغيرة، والأيقونات (بحث/جرس/الوضع) تبقى بجوار العنوان. */
.topbar { justify-content: flex-start; }
.topbar > .flex { flex: 1 1 auto; min-width: 0; }
.topbar > .flex > div { min-width: 0; }
.topbar h1, .topbar .crumbs { overflow-wrap: anywhere; }
.page-btns { margin-inline-start: 0; }
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; row-gap: 10px; }
  .topbar h1 { font-size: 1.1rem; line-height: 1.3; }
  .topbar .crumbs { font-size: .8rem; line-height: 1.5; }
  .topbar > .flex { flex: 1 1 0; }
  .page-actions { flex: 0 0 auto; }
  .page-btns { flex: 1 1 100%; }
  .page-btns .btn { flex: 1 1 auto; justify-content: center; }
}

/* ---------- R-61 الإجراءات الجماعية: شريط الاختيار ---------- */
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 12px; border: 1px dashed var(--border); border-radius: var(--radius-sm); background: var(--stone-50); }
.bulk-bar .bulk-all { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; cursor: pointer; margin: 0; }
.bulk-bar .form-help { flex-basis: 100%; margin: 0; }
.bulk-bar .btn[disabled] { opacity: .55; cursor: not-allowed; }
.bulk-pick { display: inline-flex; align-items: center; margin-inline-end: 6px; }
.bulk-bar input[type=checkbox], .bulk-pick input[type=checkbox], .table input[data-bulk-item] { width: 18px; height: 18px; accent-color: var(--gold-600); cursor: pointer; }

/* ---------- R-52: مفاتيح المرور ---------- */
.passkey-add { gap: .5rem; flex-wrap: wrap; }
.passkey-add .form-control { flex: 1 1 220px; }
.passkey-login .btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
/* ---------- R-62: PWA الصنايعي — شريط الاتصال وطابور الإبلاغ المحفوظ على الهاتف وسطر ضغط الصور ---------- */
.pwa-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.pwa-net { font-size: .82rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--green-100, #dcfce7); color: var(--green-600, #16a34a); }
.pwa-net.is-off { background: var(--red-100, #fee2e2); color: var(--red-600, #dc2626); }
.pwa-queue { border-color: var(--gold-400, #d4a83a); }
.pwa-queue .card-header { padding: 10px 14px; }
.pwa-queue .att-mylist { padding: 0 14px; }
.pwa-item.is-rejected .att-time { text-decoration: line-through; opacity: .7; }
.upload-compress-note { display: block; font-size: .8rem; color: var(--stone-600); margin-top: 4px; }

/* ---------- R-13 النسخة الإنجليزية: اتجاه LTR للموقع العام ---------- */
/* يعمل عندما يرسم الخادم <html lang="en" dir="ltr"> (المسارات /en/… فقط). يقلب التصريحات المرتبطة بالاتجاه؛
   الباقي flex/grid وخصائص منطقية (inline-start/end) فلا يحتاج شيئاً. اللوحة والبوابتان تبقيان RTL دائماً. */
html[dir="ltr"] body { direction: ltr; text-align: left; }
html[dir="ltr"] input[type="number"], html[dir="ltr"] input[type="date"], html[dir="ltr"] input[type="tel"] { text-align: left; }
html[dir="ltr"] .table th, html[dir="ltr"] .table td, html[dir="ltr"] .prose th, html[dir="ltr"] .prose td { text-align: left; }
html[dir="ltr"] .req-actions-panel { text-align: left; }
html[dir="ltr"] .hs-swal { direction: ltr; }
html[dir="ltr"] .star-input-row { flex-direction: row; }
html[dir="ltr"] .ba-tag-before { right: auto; left: 10px; }
html[dir="ltr"] .ba-tag-after { left: auto; right: 10px; }
html[dir="ltr"] .lang-switch, .lang-switch { font-weight: 700; letter-spacing: .02em; }
.site-footer .bottom .lang-switch { color: var(--gold-400, #d4a83a); display: inline-flex; align-items: center; gap: 6px; }   /* المبدّل في تذييل الموقع (طلب المالك 2026-09-18) */
html[dir="ltr"] [lang="ar"] { direction: rtl; unicode-bidi: isolate; display: inline-block; }
html[dir="ltr"] .muted[dir="rtl"] { text-align: left !important; }

/* ---------- R-65 الدفعة 1: عناصر الواجهة الموحَّدة (المبادئ 1–8 من docs/ui-audit-2026-09-18.md) ---------- */
/* حلقة تركيز واحدة ذهبية لكل عنصر تفاعلي (كانت الحقول وحدها) — لوحة المفاتيح فقط عبر :focus-visible */
:where(a, button, .btn, .chip, .nav a, .pagination a, summary, [tabindex]):focus-visible { outline: 3px solid rgba(193,154,63,.55); outline-offset: 2px; border-radius: 6px; }
.btn:focus-visible, .chip:focus-visible { border-radius: var(--radius-sm); }
/* زر الأيقونة وحده: 40×40 (aria-label إلزامي — الحارس) */
.btn-icon { width: 40px; min-width: 40px; height: 40px; min-height: 40px; padding: 0; }
.btn-icon svg { width: 18px; height: 18px; }
/* حالة الانشغال (main.js يضع aria-busy أثناء جلب البحث الحيّ) والتعطيل */
.btn[aria-busy="true"], [aria-busy="true"] .btn, .btn[aria-disabled="true"] { opacity: .7; pointer-events: none; cursor: progress; }
/* صف الإجراءات في نهاية النموذج: الأساسي في جهة البداية، الإلغاء بعده */
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
/* بطاقات النماذج بعرض محدود — بدل style="max-width:…" */
.card-form { max-width: 820px; }
.card-form--sm { max-width: 640px; }
.card-form--md { max-width: 720px; }
.card-form--lg { max-width: 900px; }
/* حقل الملف: يطابق بقية الحقول بدل عنصر المتصفح الخام؛ زر الاختيار بنمط btn-outline */
input[type="file"] { display: block; width: 100%; min-height: 44px; padding: 6px 8px; border: 1px dashed var(--stone-300); border-radius: var(--radius-sm); background: var(--stone-50); font-family: var(--font); font-size: .9rem; color: var(--muted); cursor: pointer; }
input[type="file"]::file-selector-button { font: inherit; font-weight: 700; color: var(--stone-800); background: #fff; border: 1px solid var(--stone-300); border-radius: 6px; padding: 6px 12px; margin-inline-end: 10px; cursor: pointer; }
input[type="file"]:hover::file-selector-button { background: var(--stone-100); }
input[type="file"]:focus-visible { outline: 3px solid rgba(193,154,63,.55); outline-offset: 2px; }
/* التواريخ والمبالغ في الجداول لا تنكسر؛ رؤوس الأعمدة كذلك (قائمة) */
.table td.num, .table .date, .money, .date { white-space: nowrap; }
/* الشريط العلوي: أزرار الصفحة بارتفاع الحقول (الشريط يستعمل btn-sm بجوار حقول 44px) */
.toolbar .btn { min-height: 44px; }
.toolbar input, .toolbar select { min-height: 44px; }
/* القائمة الإنجليزية: النصوص اللاتينية أطول — لا التفاف داخل الرابط، وقائمة الهاتف من 1100px */
html[dir="ltr"] .nav a { white-space: nowrap; padding: 8px 10px; font-size: .9rem; }
html[dir="ltr"] .site-header .brand > span:not(.logo) { white-space: nowrap; }
@media (max-width: 1100px) {
  html[dir="ltr"] .nav-toggle { display: inline-flex; }
  html[dir="ltr"] .nav { display: none; position: absolute; inset-inline: 0; top: 72px; background: #fff; flex-direction: column; padding: 12px 20px 20px; border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
  html[dir="ltr"] .nav.open { display: flex; }
  html[dir="ltr"] .nav-actions .btn-outline { display: none; }
}
/* الهاتف: أهداف اللمس والأشرطة والزر العائم */
@media (max-width: 640px) {
  .btn-sm { min-height: 40px; }                                  /* المبدأ 1: لا أقل من 40 على اللمس */
  .btn-icon { width: 40px; height: 40px; }
  .toolbar form { width: 100%; }
  .toolbar input, .toolbar select { flex: 1 1 100%; width: 100%; min-width: 0; }   /* كانت width:auto; min-width:160px ⇒ سطور بعروض مختلفة */
  .toolbar .btn { flex: 1 1 100%; }
  .form-actions .btn { flex: 1 1 auto; }
  .att-cal-cell { font-size: .7rem; }                            /* كانت .62rem */
  /* زر واتساب العائم: لا يغطّي زر الإرسال — حشو أسفل النماذج، ويختفي أثناء الكتابة في أي حقل (قرار المالك: لا إزالة) */
  body:has(.wa-float) form { padding-bottom: 8px; }
  body:has(.wa-float) main, body:has(.wa-float) .site-main { padding-bottom: 88px; }
  body:has(input:focus, textarea:focus, select:focus) .wa-float { opacity: 0; pointer-events: none; transform: translateY(20px); }
  .wa-float { transition: opacity .2s, transform .2s; }
}
/* الوضع الداكن: نظائر الدفعة 1 (داخل @media screen كبقية قواعد R-64) */
@media screen {
  :root[data-theme="dark"] input[type="file"] { background: var(--surface-2); border-color: var(--stone-300); color: var(--muted); }
  :root[data-theme="dark"] input[type="file"]::file-selector-button { background: var(--stone-100); color: var(--stone-900); border-color: var(--stone-300); }
  :root[data-theme="dark"] input[type="file"]:hover::file-selector-button { background: var(--stone-200); }
  :root[data-theme="dark"] ::placeholder { color: var(--stone-500); }
  :root[data-theme="dark"] :where(a, button, .btn, .chip, [tabindex]):focus-visible, :root[data-theme="dark"] input[type="file"]:focus-visible { outline-color: rgba(227,192,122,.7); }
}

/* ---------- R-65 الدفعة 2: أصناف بدل style= المضمَّن، وحقل الملف بماكرو file_input ---------- */
.file-field { position: relative; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 44px; padding: 6px 8px; border: 1px dashed var(--stone-300); border-radius: var(--radius-sm); background: var(--stone-50); }
.file-field .file-input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; }   /* يبقى قابلاً للنقر والتركيز فوق الحاوية كلها */
.file-field .file-pick { position: relative; z-index: 1; pointer-events: none; }
.file-field .file-name { position: relative; z-index: 1; pointer-events: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.file-field:focus-within { border-color: var(--gold-500); box-shadow: 0 0 0 3px rgba(193,154,63,.25); }
.file-field.has-file .file-name { color: var(--text); font-weight: 600; }
.pre-line { white-space: pre-line; }
.thumb { width: 56px; height: 42px; object-fit: cover; border-radius: 6px; }
.thumb-lg { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; }
.sig-img { max-width: 100%; max-height: 160px; border-bottom: 1px solid var(--stone-400); }
.sig-img--sm { max-width: 220px; max-height: 90px; }
.w-80 { width: 80px; } .w-120 { width: 120px; } .w-130 { width: 130px; } .w-5r { width: 5rem; }
.col-desc { width: 44%; }
.invoice-totals--fluid { width: auto; }
.flex-wrap { flex-wrap: wrap; } .gap-1 { gap: 4px; } .gap-3 { gap: 24px; }
.items-center { align-items: center; } .items-end { align-items: flex-end; } .justify-center { justify-content: center; }
.copy-field { font-size: .7rem; padding: 4px 6px; width: 100%; min-height: 0; }
.text-right { text-align: right; }
.list-indent { padding-inline-start: 1em; }
.steps-list { padding-inline-start: 20px; line-height: 2; }
.qr-img { margin: auto; width: 220px; border: 1px solid var(--border); border-radius: 12px; padding: 8px; background: #fff; }   /* رمز QR يبقى أبيض في الداكن — يقرؤه الهاتف */
.p-0 { padding: 0; }
.border-top { border-top: 1px solid var(--stone-200); }
.max-w-320 { max-width: 320px; }
.err-code { font-size: 5rem; font-weight: 800; font-family: var(--font-display); color: var(--gold-500); line-height: 1; }
.link-light { color: #fff; }
.footer-note { color: var(--stone-400); font-size: .92rem; }
@media screen {
  :root[data-theme="dark"] .file-field { background: var(--surface-2); border-color: var(--stone-300); }
}

/* ---------- R-65 الدفعة 3: البوابتان والموقع العام — أصناف بدل style= المضمَّن ---------- */
.sig-img--xs { max-width: 280px; max-height: 120px; }
.tool-photo { max-width: 120px; max-height: 48px; }
.grid-1 { grid-template-columns: 1fr; gap: 0; }
.card-form--xs { max-width: 620px; }
.gap-2 { gap: 14px; }
.mb-10 { margin: 0 0 10px; }
.text-sm-em { font-size: .7em; }
.text-stone-400 { color: var(--stone-400); }
.btn-outline--light { color: #fff; border-color: rgba(255,255,255,.6); }
.btn-outline--light:hover { background: rgba(255,255,255,.12); }
.bg-stone-50 { background: var(--stone-50); }
@media screen {
  :root[data-theme="dark"] .bg-stone-50 { background: var(--stone-100); }
}

/* ---------- منع تمدّد اللوحة بعرض الجداول على الهاتف (بلاغ المالك 2026-09-18: القائمة الجانبية وزر ☰ يهربان خارج الشاشة) ----------
   عنصر الشبكة لا ينكمش دون محتواه افتراضياً (min-width:auto)، فجدول بلا التفاف داخل بطاقة يمدّ عمود الشبكة والصفحة كلها
   أعرض من الشاشة. القاعدة: كل عنصر شبكة/عمود اللوحة يقبل الانكماش، والتمرير الأفقي داخل .table-wrap وحده. */
.dash-main, .dash-content, .grid > *, .grid-2 > *, .grid-3 > *, .grid-4 > *, .stats > *, .card { min-width: 0; }
/* الجدول المخفي للقارئ الشاشي تحت كل رسم (.chart-table) لا يقبل عرضاً أقل من محتواه (≈ 530px) رغم width:1px، وموضعه المطلق كان يمدّ
   الصفحة يساراً خارج الشاشة على الهاتف — يُحصر تجاوزه داخل جسم البطاقة (الطباعة تعرضه ثابتاً فلا تتأثر) */
.chart-card .card-body { position: relative; overflow: hidden; }
.table-wrap { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
@media (max-width: 960px) {
  .dash { grid-template-columns: minmax(0, 1fr); }
  .dash-main, .dash-content { max-width: 100vw; overflow-x: clip; }
}
/* الأعمدة الثانوية في القوائم الثقيلة (المشروع/الإصدار/الاستحقاق/المدفوع في الفواتير؛ الفاتورة/الطريقة/المرجع/الملاحظات/المسجِّل في المدفوعات)
   تُخفى على الهاتف بصنف .hide-sm فتبقى الأعمدة التي تُقرأ في القائمة: الرقم والعميل والمبلغ والمتبقي والحالة والإجراءات (طلب المالك 2026-09-18) */
@media (max-width: 640px) { .hide-sm { display: none !important; } .table th, .table td { padding: 8px 8px; } }
.nowrap { white-space: nowrap; }

/* ---------- R-67: شريط بريد المراسلات في البوابة + بطاقة كلمة المرور المؤقتة ---------- */
.banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.banner-warn { border-color: color-mix(in srgb, var(--warning, #b0762b) 45%, var(--border)); background: color-mix(in srgb, var(--warning, #b0762b) 10%, var(--surface)); }
.banner > span { flex: 1 1 240px; }
.card-accent { border-color: var(--accent, #b0762b); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #b0762b) 25%, transparent); }
[data-card="temp-password"] code[data-temp-pw] { font-size: 1.15rem; padding: 4px 10px; user-select: all; }

/* ---------- AI assistant (AI-01): فقاعات المحادثة — رد المساعد HTML مصيَّر على الخادم؛ سؤال المدير نص ---------- */
.ai-thread { display: grid; gap: 12px; }
.ai-msg { padding: 10px 14px; border-radius: var(--radius, 10px); border: 1px solid var(--border); max-width: 92%; }
.ai-msg-user { background: var(--stone-100, #f5f2ee); margin-inline-start: auto; }
.ai-msg-assistant { background: var(--surface, #fff); margin-inline-end: auto; }
.ai-msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-msg-assistant .ai-msg-body { white-space: normal; }
.ai-msg-body p { margin: 0 0 .6em; }
.ai-msg-body p:last-child { margin-bottom: 0; }
.ai-msg-body ul, .ai-msg-body ol { margin: 0 0 .6em; padding-inline-start: 1.4em; }
.ai-msg-sources { margin-top: 6px; }
.ai-msg-pending { opacity: .7; }
.ai-feedback { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }           /* AI-02: 👍/👎 تحت كل رد */
.ai-feedback .ai-feedback-note { flex: 1 1 160px; max-width: 320px; }
.ai-briefing-raw { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }           /* AI-02: المادة الخام للإحاطة */
.ai-briefing-raw li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.ai-briefing-raw li .btn { margin-inline-start: auto; }
/* ---------- AI-08: شريط الحوار الصوتي (Haya) ---------- */
.ai-voice-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ai-voice-status { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; }
.ai-voice-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.ai-voice-status[data-state="listening"] .ai-voice-dot { background: var(--green-600); animation: ai-voice-pulse 1.2s ease-in-out infinite; }
.ai-voice-status[data-state="thinking"] .ai-voice-dot, .ai-voice-status[data-state="tool"] .ai-voice-dot { background: var(--gold-700); }
.ai-voice-status[data-state="speaking"] .ai-voice-dot { background: var(--stone-900); animation: ai-voice-pulse .6s ease-in-out infinite; }
.ai-voice-status[data-state="connecting"] .ai-voice-dot { background: var(--gold-700); opacity: .6; }
.ai-voice-status[data-state="muted"] .ai-voice-dot { background: var(--red-600); }
@keyframes ai-voice-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.5); opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .ai-voice-dot { animation: none !important; } }
.ai-voice-hold { min-width: 200px; min-height: 48px; touch-action: none; user-select: none; }
.ai-voice-hold[aria-pressed="true"] { background: var(--green-600); color: #fff; border-color: transparent; }
.ai-voice-minutes { min-width: 220px; }
.ai-voice-minutes [data-ai-voice-bar] { width: 0; }     /* الشريط يبدأ فارغاً؛ العرض يضبطه JS من الثواني (لا style مضمَّن — حارس AI-02) */
.ai-voice-note { padding: 0 16px 12px; }
.ai-msg-voice .ai-msg-voice-tag { margin-top: 4px; }
/* ---------- AI-09: هوية Haya المرئية (المستوى 1 — قرار المالك 2026-09-20) ---------- */
/* الصورة الرمزية من شعار الموقع بمصدره الواحد (img/logo-160.webp) — CSS فقط، فتظهر بجانب فقاعات Haya المصيَّرة على الخادم وفقاعات fetch/الصوت
   في main.js بلا أي JS جديد، وفي بند القائمة الجانبية (macro nav بـavatar=true)، وفي شريط «تحدّث» بهالة تنبض بحسب الحالة (--halo). */
.haya-avatar { display: inline-block; width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto; vertical-align: middle;
  background: var(--surface, #fff) url("../img/logo-160.webp") center / 80% no-repeat; border: 1px solid var(--border); box-sizing: border-box; }
.ai-msg-assistant { position: relative; padding-inline-start: 48px; }
.ai-msg-assistant::before { content: ""; position: absolute; inset-inline-start: 12px; top: 12px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface, #fff) url("../img/logo-160.webp") center / 80% no-repeat; border: 1px solid var(--border); box-sizing: border-box; }
.ai-voice-avatar { --halo: transparent; width: 32px; height: 32px; box-shadow: 0 0 0 3px var(--halo); transition: box-shadow .2s; }
.ai-voice-status[data-state="listening"] .ai-voice-avatar { --halo: color-mix(in srgb, var(--green-600) 35%, transparent); animation: ai-voice-halo 1.2s ease-in-out infinite; }
.ai-voice-status[data-state="speaking"] .ai-voice-avatar { --halo: color-mix(in srgb, var(--gold-700) 45%, transparent); animation: ai-voice-halo .6s ease-in-out infinite; }
.ai-voice-status[data-state="thinking"] .ai-voice-avatar, .ai-voice-status[data-state="tool"] .ai-voice-avatar { --halo: color-mix(in srgb, var(--gold-700) 25%, transparent); }
@keyframes ai-voice-halo { 0%, 100% { box-shadow: 0 0 0 3px var(--halo); } 50% { box-shadow: 0 0 0 7px var(--halo); } }
@media (prefers-reduced-motion: reduce) { .ai-voice-avatar { animation: none !important; } }
/* AI-08: اختيار صوت Haya في شريط «تحدّث» (يُعطَّل أثناء جلسة مفتوحة) */
.ai-voice-pick { display: inline-flex; align-items: center; gap: 6px; }
.ai-voice-pick select { width: auto; min-width: 110px; }

/* ---- AI-09 المستوى 2: قفص حياة العائم (زر دائري + لوحة منزلقة غير حاجبة على كل شاشات اللوحة للمدير) ---- */
.haya-dock { position: fixed; inset-block-end: 18px; inset-inline-start: 18px; z-index: 60; }
.haya-dock-btn { width: 56px; height: 56px; padding: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border); box-shadow: 0 6px 20px rgba(0, 0, 0, .18); }
.haya-dock-btn:hover { box-shadow: 0 8px 26px rgba(0, 0, 0, .24); }
.haya-dock-btn .haya-avatar { width: 40px; height: 40px; border: 0; }
.haya-dock.is-open .haya-dock-btn { box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold-700) 35%, transparent); }
.haya-dock-panel { position: fixed; inset-block-end: 86px; inset-inline-start: 18px; inset-inline-end: auto; inset-block-start: auto;
  width: min(420px, calc(100vw - 36px)); max-height: min(70vh, 620px); margin: 0; padding: 0; overflow: hidden;
  display: none; flex-direction: column; border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .22); }
.haya-dock-panel[open] { display: flex; animation: haya-dock-in .16s ease-out; }
@keyframes haya-dock-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.haya-dock-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-block-end: 1px solid var(--border); }
.haya-dock-head .haya-avatar { width: 26px; height: 26px; }
/* جسم اللوحة عمود مرن: المحادثة وحدها تتقلص وتتمرر، وصندوق السؤال وشريط «تحدّث» تحته يبقيان ظاهرين دائماً (قرار المالك 2026-09-22) */
.haya-dock-body { padding: 12px; overflow-y: auto; display: flex; flex-direction: column; min-height: 0; }
.haya-dock-thread { flex: 1 1 auto; min-height: 96px; overflow-y: auto; margin-block-end: 10px; }
.haya-dock-form { flex: 0 0 auto; }
.haya-dock-form .form-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* شريط الصوت المضغوط (القفص — قرار المالك 2026-09-22: زر «اسأل» وأيقونة ميكروفون فقط): البطاقة تذوب في صف أزرار النموذج،
   الأيقونة دائرية بجوار «اسأل»، والحالة بالصورة والنقطة وحدهما (الهالة تعرض تستمع/تتكلم)؛ الضغط المطوّل والدقائق ونص الحالة تُخفى.
   :not([hidden]) حتى لا يغلب display الإخفاء الأولي قبل أن يكشفه JavaScript */
.ai-voice-compact:not([hidden]) { display: contents; }
.ai-voice-compact .ai-voice-bar { display: flex; align-items: center; gap: 8px; padding: 0; }
.ai-voice-compact .ai-voice-toggle { width: 42px; height: 42px; padding: 0; border-radius: 50%; justify-content: center; }
.ai-voice-compact .ai-voice-hold, .ai-voice-compact .ai-voice-minutes, .ai-voice-compact .ai-voice-ptt, .ai-voice-compact [data-ai-voice-state-text] { display: none; }
.ai-voice-compact .ai-voice-note { flex-basis: 100%; margin: 0; }
.ai-msg-links { display: flex; flex-wrap: wrap; gap: 6px; margin-block-start: 8px; }
/* الهاتف: لوحة تنزلق من الأسفل بعرض الشاشة، والزر أصغر قليلاً ولا يغطي أزرار الصفحة (حشوة أسفل المحتوى) */
@media (max-width: 900px) {
  .haya-dock { inset-block-end: 12px; inset-inline-start: 12px; }
  .haya-dock-btn { width: 50px; height: 50px; }
  .haya-dock-btn .haya-avatar { width: 34px; height: 34px; }
  .haya-dock-panel { inset-inline: 8px; inset-block-end: 70px; width: auto; max-height: 78vh; }
  .haya-dock-thread { max-height: 46vh; }
  .dash-content { padding-block-end: 84px; }
}
@media (prefers-reduced-motion: reduce) { .haya-dock-panel[open] { animation: none; } }

/* ---------- حقل السؤال بأيقونة الإرسال داخله (قرار المالك 2026-09-27: «مثل المحادثات العادية») + أزرار القفص أيقونات ---------- */
.ai-ask-field { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px; padding: 6px 8px 6px 10px; border: 1px solid var(--stone-300); border-radius: var(--radius-sm); background: #fff; transition: .15s; }
.ai-ask-field:focus-within { border-color: var(--gold-600); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold-600) 22%, transparent); }
.ai-ask-field .form-control { flex: 1 1 200px; min-width: 0; min-height: 44px; border: 0; border-radius: 0; padding: 8px 4px; background: transparent; box-shadow: none; }
.ai-ask-field .form-control:focus { outline: none; box-shadow: none; }
.ai-ask-tools { display: contents; }                                          /* الأيقونات عناصر صندوق الحقل نفسه في نهايته؛ ورسالة خطأ الصوت تلتفّ سطراً كاملاً تحت النص */
.ai-ask-field .ai-voice-compact .ai-voice-note { flex-basis: 100%; order: 9; margin: 0; }
.ai-ask-send { width: 36px; height: 36px; padding: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.ai-ask-send svg { transform: scaleX(-1); }                       /* سهم الإرسال نحو اتجاه الكتابة (RTL) */
.ai-ask-send[aria-busy="true"] svg { animation: ai-ask-spin 1s linear infinite; }
@keyframes ai-ask-spin { to { transform: scaleX(-1) rotate(-360deg); } }
.ai-ask-tools .ai-voice-compact .ai-voice-toggle { width: 36px; height: 36px; }
.ai-ask-tools .ai-voice-compact .ai-voice-avatar { display: none; }                  /* داخل الحقل: الميكروفون ونقطة الحالة فقط */
.ai-ask-tools .ai-voice-compact .ai-voice-status { gap: 6px; }
.ai-ask-field.has-text .ai-voice-compact, .ai-ask-field.has-text .ai-ask-mic { display: none; }   /* فيه نص ⇒ الإرسال وحده */
.ai-ask-field:not(.has-text) .ai-ask-send[data-ai-submit] { display: none; }                    /* فارغ ⇒ «تحدّث» ونقطته وحدهما */
.ai-ask-mic { display: inline-flex; align-items: center; gap: 6px; }
.haya-dock-form .ai-ask-tools { flex-wrap: nowrap; }
.haya-dock-iconbtn { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
@media (prefers-reduced-motion: reduce) { .ai-ask-send[aria-busy="true"] svg { animation: none; } }

/* ---------- فيديو المشروع في «أعمالنا» (الدورة 18) ---------- */
.video-row { margin-block: 0 14px; }                                  /* صف الزر فوق صف الإجراءات الرئيسية */
.ribbon.ribbon-end { inset-inline-start: auto; inset-inline-end: 10px; background: var(--stone-800, #292524); }   /* شارة «فيديو»: الجهة المقابلة لشارتي النوع والتميّز */

/* ---------- شارات الأقسام غير المفتوحة (الدورة 19، بند المالك الإضافي) ---------- */
/* القائمة الجانبية داكنة في الوضعين، ولون النص ثابت (#1c1917 لا --stone-900 الذي ينقلب في الوضع الداكن) ⇒ لا قاعدة للوضع الداكن هنا.
   العدد في رأس المجموعة من data-n (لا نص يغيّر مفتاح الطيّ في main.js). بلا صنف .num: اتجاهه ltr يقلب margin-inline-start. */
.sidebar .menu a .nav-badge { margin-inline-start: auto; }
.nav-badge { display: inline-block; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--gold-400); color: #1c1917; font-size: .72rem; font-weight: 800; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.sidebar .menu a.active .nav-badge { background: #fff; color: #1c1917; }
.nav-badge-sum { margin-inline-start: 8px; min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px; letter-spacing: 0; vertical-align: middle; }
.nav-badge-sum::after { content: attr(data-n); }

/* ---------- بطاقات اختصار الأقسام في الرئيسية (الدورة 20) ---------- */
/* صفّ روابط فوق البطاقات الإحصائية: لكل تجمّع فيه جديد عدّه واسمه ورابط أول قسم له جديد.
   شبكة تلتفّ تلقائياً (بلا حدّ لعدد البطاقات) وتصير عموداً على الهاتف — بلا JS ولا نمط سطري.
   الألوان بالرموز المتغيّرة مع الثيم (--surface/--border/--muted) فتتبع الوضع الداكن بلا قاعدة ثانية؛
   والاستثناء الوحيد ظلّ المرور: ظلّ فاتح لا يُرى على خلفية داكنة ⇒ قاعدة واحدة داخل @media screen. */
.shortcut-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.shortcut-card { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--surface);
                 border: 1px solid var(--border); border-inline-start: 4px solid var(--gold-400);
                 border-radius: var(--radius); color: inherit; text-decoration: none;
                 transition: border-color .15s, box-shadow .15s; }
.shortcut-card:hover, .shortcut-card:focus-visible { border-color: var(--gold-400); box-shadow: 0 2px 10px rgba(28, 25, 23, .1); }
.shortcut-n { flex: 0 0 auto; min-width: 34px; height: 34px; line-height: 34px; padding: 0 8px; border-radius: 999px;
              background: var(--gold-400); color: #1c1917; font-weight: 700; text-align: center; }
.shortcut-label { font-weight: 600; }
.shortcut-sub { flex: 1 1 auto; text-align: end; color: var(--muted); font-size: .8rem; }
@media (max-width: 480px) { .shortcut-cards { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .shortcut-card { transition: none; } }
@media screen {
  :root[data-theme="dark"] .shortcut-card:hover, :root[data-theme="dark"] .shortcut-card:focus-visible { box-shadow: 0 2px 10px rgba(0, 0, 0, .5); }
}

/* ---------- UX-03 (الدورة 22): نجمة الحقل الإلزامي (ماكرو الحقل؛ aria-hidden — الحقل نفسه يحمل required) ---------- */
.req { color: var(--red-600); font-weight: 700; margin-inline-start: 3px; }

/* ---------- UX-50 (الدورة 22): شريط الصنايعي السفلي على الهاتف + الجداول المكدّسة (table-stack) ---------- */
.worker-tabbar { display: none; }
@media (max-width: 640px) {
  .worker-tabbar { display: flex; position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 65; background: var(--surface, #fff);
    border-block-start: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom, 0); }
  .worker-tabbar a, .worker-tabbar button { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 56px; font-size: .78rem; color: var(--muted); background: none; border: 0; text-decoration: none; cursor: pointer; }
  .worker-tabbar a.active { color: var(--gold-600); font-weight: 700; }
  body:has(.worker-tabbar) .dash-content { padding-block-end: 88px; }   /* الشريط لا يغطي آخر المحتوى */
  table.table-stack thead { display: none; }
  table.table-stack, table.table-stack tbody, table.table-stack tr, table.table-stack td { display: block; width: 100%; }
  table.table-stack tr { border-block-end: 1px solid var(--border); padding: 8px 0; }
  table.table-stack td { border: 0; padding: 4px 0; }
  table.table-stack td[data-label]:not(:empty)::before { content: attr(data-label) ": "; color: var(--muted); font-size: .82rem; }
}

/* ---------- الدورة 22 (S3 · الدفعة 11): رابط التخطي (UX-06)، بديل inert للقائمة المغلقة (UX-06)، حشوة القفص على الحاسوب (UX-10)،
   شريط مراسي صفحة المشروع (UX-18)، شريط حفظ الإعدادات (UX-22)، خانات الصنايعية في الحادث (UX-39)، كشف الحضور (UX-40) ---------- */
.skip-link { position: absolute; inset-inline-start: 8px; top: -60px; z-index: 2000; background: var(--gold-600); color: #fff; padding: 8px 14px; border-radius: var(--radius-sm); }
.skip-link:focus { top: 8px; }
@media (max-width: 960px) { .sidebar:not(.open) { visibility: hidden; } .sidebar.open { visibility: visible; } }
body:has(.haya-dock:not([hidden])) .dash-content { padding-block-end: 84px; }
.anchor-bar { position: sticky; top: 64px; z-index: 30; display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 0; background: var(--bg, var(--surface)); }
.anchor-bar a { padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; font-size: .85rem; }
.settings-save-bar { position: sticky; bottom: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 12px 0; background: var(--bg, var(--surface)); border-block-start: 1px solid var(--border); }
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 12px; max-height: 240px; overflow-y: auto; }
.att-sheet .att-sheet-name { position: sticky; inset-inline-start: 0; background: var(--surface); z-index: 1; }
.att-sheet td.c { position: relative; }
.att-sheet td.c a.cell-hit { position: absolute; inset: 0; }   /* الخلية كلها رابط إلى يومها، والرمز يبقى أول محتواها */
.att-sheet td.c .h { display: block; font-size: .65rem; font-weight: 400; opacity: .8; }

/* ---------- الدورة 22 (S3 · UX-37): خطة الورديات — عمود الاسم لاصق عند التمرير الأفقي ---------- */
.shift-grid th.shift-name, .shift-grid thead th:first-child { position: sticky; inset-inline-start: 0; background: var(--surface); z-index: 1; }

/* ---------- الدورة 22 (S3 · UX-41/UX-46): بطاقة حالة اليوم في بوابة الصنايعي، ومجموعتا الطابور ---------- */
.att-status-card { padding: .6rem .8rem; border-radius: var(--radius, 10px); margin-bottom: .6rem; background: var(--stone-100); }
.att-status-card.att-state-arrive_pending, .att-status-card.att-state-leave_pending { background: var(--gold-50, #fdf8ea); }
.att-status-card.att-state-present, .att-status-card.att-state-left { background: var(--green-100); color: var(--green-600); }
.pwa-group { list-style: none; font-weight: 700; margin-top: .4rem; }

/* ============================================================
   الدورة 22 (CQ-17): الرموز الخمسة المستعملة بلا تعريف + سطح نافذة التأكيد والإشعار غير المقروء في الوضع الداكن.
   كانت `--red-700` و`--gold-50` و`--brand-500` و`--brand-600` و`--warning` بلا تعريف فتعمل قيم الاحتياط الفاتحة دائماً،
   ونافذة SweetAlert2 بيضاء بنص الوضع الداكن الفاتح. الفاتح هنا هو قيم الاحتياط نفسها حرفياً (لا تغيير مرئي)؛ الداكن من الرموز القائمة.
   حارس: tests/test_css_tokens.py (كل متغيّر مستعمل معرَّف).
   ============================================================ */
:root {
  --red-700: #b91c1c;
  --gold-50: #fdf8ea;
  --brand-500: #b08b57;
  --brand-600: #8a6a3c;
  --warning: #b0762b;
}
@media screen {
  :root[data-theme="dark"] {
    --red-700: var(--red-600);
    --gold-50: var(--gold-100);
    --brand-500: var(--gold-500);
    --brand-600: var(--gold-700);
    --warning: var(--amber-600);
  }
  :root[data-theme="dark"] .hs-swal { background: var(--surface); color: var(--text); }
  :root[data-theme="dark"] .notif.unread { background: var(--gold-100); }
}

/* ---------- منتقي «مهمة جديدة/محضر جديد» (الدورة 22 · UX-23 — إصلاح ما بعد الإغلاق 2026-09-30): الروابط كانت تحمل d-block غير المعرَّف فتلتصق في سطر واحد ---------- */
[data-card="pick-project"] a { display: block; padding: 4px 0; }

/* ---------- كشف المقاسات — شاشة الصنايعي (الدورة 24، ج-1): إدخال سريع على الهاتف، صفوف كبطاقات، أهداف لمس ≥ 44px ---------- */
[data-pieces-inplace] > * + * { margin-top: 12px; }
.pieces-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; text-align: center; }
.pieces-kpis span { display: block; font-size: 1.25rem; font-weight: 700; }
.pieces-kpis small { color: var(--muted); }
.pieces-by-material { margin: 10px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.pieces-entry-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.pieces-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 10px; }
.pieces-grid .pieces-wide { grid-column: span 2; }
.pieces-grid .form-control, .pieces-entry .form-control { min-height: 44px; }
.pieces-more { margin: 4px 0 10px; }
.pieces-more > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--brand-600); }
.pieces-edge-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.pieces-edge-btns .btn { min-height: 40px; }
.pieces-save { width: 100%; }
.pieces-group .card-header h3 { margin: 0; }
.piece-row { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px; scroll-margin-top: 80px; }
.piece-row:first-of-type { border-top: 0; }
.piece-row.is-mine { box-shadow: inset 3px 0 0 var(--brand-500); }
.piece-row.is-final { background: var(--stone-50); }
.piece-row:focus { outline: 2px solid var(--brand-500); outline-offset: -2px; }
.piece-main { min-width: 0; flex: 1 1 220px; }
.piece-size { font-size: 1.05rem; font-weight: 600; }
.piece-meta, .piece-note { overflow-wrap: anywhere; }
.piece-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.piece-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; }
.piece-actions form { margin: 0; }
.piece-edit[open] { flex-basis: 100%; }
.piece-edit > summary { list-style: none; }
.piece-edit > summary::-webkit-details-marker { display: none; }
.piece-edit[open] > form { margin-top: 10px; }
[data-pieces-form][aria-busy="true"] { opacity: .7; }
@media (max-width: 640px) {
  .pieces-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pieces-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .piece-actions { flex-basis: 100%; }
  .piece-edit[open] { order: 2; }
}

/* ---------- كشف المقاسات — صف التعديل في جدول اللوحة (ما بعد الدورة 24، ملاحظة المالك): كان النموذج داخل خلية «الإجراءات» الضيقة
   فتتكدّس حقوله. الآن في صف تالٍ بعرض الجدول، يظهر حين يُفتح زر القلم (details.piece-edit[open] في الصف السابق) عبر :has()؛
   والمتصفح الذي لا يعرف :has() يرى الصف دائماً (@supports not). على الهاتف يلتصق النموذج بحافة الشاشة داخل .table-wrap فيُقرأ كاملاً. */
.table tr.piece-edit-row { display: none; }
.table tr:has(> td > details.piece-edit[open]) + tr.piece-edit-row { display: table-row; }
@supports not selector(:has(*)) { .table tr.piece-edit-row { display: table-row; } }
.table tr.piece-edit-row > td { white-space: normal; text-align: right; background: var(--stone-50); padding: 12px 14px 16px; }
#pieces-list.table-wrap { container-type: inline-size; }   /* عرض نافذة التمرير متاح للنموذج بوحدة cqw */
.piece-edit-form { position: sticky; inset-inline-start: 0; max-width: calc(100vw - 48px); width: calc(100cqw - 28px); }   /* 28 = حشو الخلية؛ المتصفح بلا cqw يكتفي بـmax-width */
.piece-edit-form .form-row { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 12px; }
.piece-edit-form .form-control { min-height: 40px; }
.piece-edit-form > * + * { margin-top: 10px; }
.table td.actions details.piece-edit { display: inline-block; }
.table td.actions details.piece-edit > summary { list-style: none; display: inline-flex; }
.table td.actions details.piece-edit > summary::-webkit-details-marker { display: none; }

/* ---------- بنود الفاتورة والعرض وأمر التغيير على الهاتف (ملاحظة المالك بعد النشر 2026-10-03): الجدول ذو الأعمدة الستة كان يُضغط في 390px
   فيصير حقل الوصف 43px ولا يُقرأ ما كُتب. عرض أدنى للجدول (التمرير الأفقي داخل .table-wrap) وعرض أدنى لعمود الوصف. */
@media (max-width: 640px) {
  [data-invoice-items] { min-width: 720px; }
  [data-invoice-items] .col-desc { min-width: 280px; }
}

/* ---------- قسم «نخدم كل محافظات مصر» (طلب المالك 2026-10-03): قائمة المحافظات كشرائح نصية في الرئيسية والخدمات */
.areas { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.area { padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--stone-50); font-size: .95rem; }
