﻿/* =====================================================================
   مسار الأركان — بوابة الطلبات
   نظام تصميم مستقل يعتمد نفس لوحة الذهبي/الأبيض الخاصة بالموقع التعريفي.
   RTL أصلي، وتخطيط متجاوب: شريط جانبي على سطح المكتب، شريط سفلي على الجوال.
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@600;700;800&family=Tajawal:wght@400;500;700&display=swap');

/* نفس خط العناوين الفاخر المستخدم في الموقع التعريفي */
@font-face {
  font-family: "Sultan Medium";
  src: url("../assets/fonts/Sultan-Medium.TTF") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  /* الأسطح */
  --paper: #FFFFFF;
  --cream: #F5F2EC;
  --butter: #EFEBE1;
  --butter-2: #E9E4D8;
  --sand: #E4DFD3;
  --sand-2: #D4CDBC;

  /* الحبر */
  --ink: #000000;
  --ink-2: #232C36;
  --muted: #6B6255;
  --muted-2: #8A8174;
  --muted-light: #E4DFD3;

  /* الذهبي */
  --gold: #A98A00;
  --gold-ink: #7A6400;
  --gold-light: #FFDE17;
  --gold-soft: #FFF6C2;
  --gold-deep: #4F4100;

  /* حالات */
  --ok: #1B7A46;
  --ok-soft: #E4F5EC;
  --warn: #A8710A;
  --warn-soft: #FFF3D6;
  --danger: #A32118;
  --danger-soft: #FCE9E7;
  --info: #185C8C;
  --info-soft: #E6F1F9;

  --grad-page: linear-gradient(180deg, #FAF8F3 0%, #F5F2EC 55%, #EFEBE1 100%);
  --grad-gold: linear-gradient(135deg, #FFE95C, #FFDE17 45%, #F0CF00 100%);
  --grad-gold-soft: linear-gradient(140deg, #FFFEF6, #FFFBE2 45%, #FFF4C0);
  --grad-text: linear-gradient(94deg, #000000 0%, #232C36 55%, #000000 100%);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 8px rgba(0, 0, 0, .04);
  --shadow: 0 2px 6px rgba(0, 0, 0, .07), 0 14px 34px -14px rgba(35, 44, 54, .22);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, .09), 0 30px 70px -28px rgba(35, 44, 54, .34);
  --ring: 0 0 0 3px rgba(255, 222, 23, .38);

  --radius: 3px;
  --radius-sm: 3px;
  --radius-xs: 2px;
  --radius-pill: 999px;

  --ease: cubic-bezier(.22, .61, .36, 1);
  --sidebar-w: 268px;
  --topbar-h: 68px;
  --gutter: clamp(16px, 3.4vw, 34px);
  --wrap: 1380px;

  --font-display: "Sultan Medium", 'Cairo', 'Tajawal', Arial, sans-serif;
  --font-body: 'Tajawal', 'Cairo', 'Segoe UI', Tahoma, sans-serif;
}

/* ------------------------------------------------------------- الأساس */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body.portal {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--grad-page);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
  overflow-x: clip;
}

body.portal::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(60% 45% at 88% 4%, rgba(229, 196, 110, .34), transparent 70%),
    radial-gradient(52% 40% at 6% 96%, rgba(192, 138, 30, .16), transparent 72%);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.3;
  margin: 0 0 .5em;
  letter-spacing: -.005em;
}

h1 { font-size: clamp(1.45rem, 1.15rem + 1.1vw, 2rem); }
h2 { font-size: clamp(1.2rem, 1.02rem + .62vw, 1.5rem); }
h3 { font-size: clamp(1.03rem, .96rem + .28vw, 1.18rem); }

p { margin: 0 0 1em; }

a { color: var(--gold-ink); text-decoration: none; transition: color .2s var(--ease); }
a:hover { color: var(--gold-deep); }

.grad-text {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  padding-block-end: .08em;
}

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--radius-xs);
}

.hide-sm { display: inline; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ====================================================================
   1. صفحات الدخول والتسجيل — تخطيط مركزي
   ==================================================================== */
.auth-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  align-items: stretch;
}

.auth-aside {
  position: relative;
  overflow: hidden;
  padding: clamp(32px, 5vw, 64px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
linear-gradient(168deg, #000000 0%, #16202A 42%, #232C36 100%);
  color: #F5F2EC;
}

.auth-aside::after {
  content: '';
  position: absolute;
  inset-block-start: -22%;
  inset-inline-end: -18%;
  width: 62%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 222, 23, .20), transparent 68%);
}

.auth-aside .brand-mark {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.28rem;
  color: #F5F2EC;
}

.auth-aside .brand-mark svg { width: 42px; height: 42px; flex: none; }

.auth-copy { position: relative; z-index: 1; max-width: 34ch; }
.auth-copy h2 { color: #FFFFFF; font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.15rem); }
.auth-copy p { color: rgba(245, 242, 236, .84); font-size: .98rem; }

.auth-steps {
  position: relative;
  z-index: 1;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.auth-steps li {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: .9rem;
  color: rgba(255, 248, 231, .9);
}

.auth-steps b {
  flex: none;
  width: 27px; height: 27px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(255, 248, 231, .14);
  border: 1px solid rgba(229, 196, 110, .46);
  font-family: var(--font-display);
  font-size: .8rem;
  color: var(--gold-light);
}

.auth-main {
  display: grid;
  place-items: center;
  padding: clamp(28px, 5vw, 56px) var(--gutter);
}

.auth-card {
  width: 100%;
  max-width: 452px;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(10px);
  border: 1px solid var(--muted-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: clamp(24px, 4vw, 38px);
}

.auth-card h1 { margin-bottom: .25em; }
.auth-card .sub { color: var(--muted); font-size: .94rem; margin-bottom: 1.6em; }

.auth-alt {
  margin: 1.4em 0 0;
  padding-top: 1.2em;
  border-top: 1px solid var(--muted-light);
  text-align: center;
  font-size: .92rem;
  color: var(--muted);
}

.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 1em;
  font-size: .88rem;
  color: var(--muted-2);
}

/* ====================================================================
   2. هيكل البوابة — شريط علوي + شريط جانبي + منطقة المحتوى
   ==================================================================== */
.portal-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  grid-template-rows: var(--topbar-h) minmax(0, 1fr);
  grid-template-areas:
    'topbar topbar'
    'side   main';
}

/* ------------------------------------------------- الشريط العلوي */
.portal-topbar {
  grid-area: topbar;
  position: sticky;
  inset-block-start: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 14px;
  padding-inline: var(--gutter);
  background: rgba(255, 253, 246, .86);
  backdrop-filter: blur(14px) saturate(1.3);
  border-block-end: 1px solid var(--muted-light);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .7) inset;
}

.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.06rem;
  color: var(--ink);
  white-space: nowrap;
}

.portal-brand svg { width: 34px; height: 34px; flex: none; color: var(--gold); }
.portal-brand small {
  display: block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: .68rem;
  letter-spacing: .04em;
  color: var(--muted-2);
  line-height: 1.2;
}

.topbar-spacer { flex: 1 1 auto; min-width: 0; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

/* زر القائمة على الجوال */
.portal-menu-btn {
  display: none;
  flex: none;
  width: 46px; height: 46px;
  border: 1px solid var(--muted-light);
  border-radius: var(--radius-xs);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}

.portal-menu-btn:hover { background: var(--butter); border-color: var(--gold-light); }
.portal-menu-btn svg { width: 22px; height: 22px; }

/* الإشعارات */
.notif-wrap { position: relative; }

.notif-btn {
  position: relative;
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border: 1px solid var(--muted-light);
  border-radius: var(--radius-xs);
  background: var(--paper);
  color: var(--ink-2);
  cursor: pointer;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}

.notif-btn:hover { background: var(--butter); border-color: var(--gold-light); }
.notif-btn svg { width: 21px; height: 21px; }

.notif-badge {
  position: absolute;
  inset-block-start: 5px;
  inset-inline-start: 5px;
  min-width: 19px; height: 19px;
  padding: 0 5px;
  display: grid; place-items: center;
  border-radius: var(--radius-pill);
  background: var(--danger);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--cream);
}

.notif-panel {
  position: absolute;
  inset-block-start: calc(100% + 10px);
  inset-inline-start: auto;
  inset-inline-end: 0;
  width: min(360px, calc(100vw - 32px));
  max-height: 440px;
  overflow-y: auto;
  padding: 8px;
  background: var(--paper);
  border: 1px solid var(--muted-light);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity .22s var(--ease), transform .22s var(--ease), visibility .22s;
}

.notif-panel.open { opacity: 1; visibility: visible; transform: none; }

.notif-panel h4 {
  margin: 4px 8px 8px;
  font-size: .82rem;
  letter-spacing: .04em;
  color: var(--muted-2);
  text-transform: uppercase;
}

.notif-item {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  color: var(--ink-2);
  transition: background .18s var(--ease);
}

.notif-item:hover { background: var(--butter); }
.notif-item strong { display: block; font-size: .92rem; font-weight: 600; }
.notif-item span { display: block; font-size: .83rem; color: var(--muted); }
.notif-item time { font-size: .74rem; color: var(--muted-2); }
.notif-item.unread { background: var(--butter-2); }

/* قائمة المستخدم */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--muted-light);
  border-radius: var(--radius-pill);
  background: var(--paper);
  cursor: pointer;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}

.user-chip:hover { border-color: var(--gold-light); box-shadow: var(--shadow-sm); }

.avatar {
  flex: none;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--grad-gold);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: .82rem;
  letter-spacing: .02em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .4);
}

.user-chip .who { text-align: start; line-height: 1.25; min-width: 0; }
.user-chip .who b { display: block; font-size: .88rem; font-weight: 600; }
.user-chip .who span { display: block; font-size: .74rem; color: var(--muted-2); }

/* ------------------------------------------------- الشريط الجانبي */
.portal-side {
  grid-area: side;
  position: sticky;
  inset-block-start: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 22px 16px 32px;
  background: rgba(255, 255, 255, .62);
  border-inline-end: 1px solid var(--muted-light);
  scrollbar-width: thin;
}

.side-group + .side-group { margin-top: 22px; }

.side-group h5 {
  margin: 0 12px 8px;
  font-family: var(--font-body);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.side-nav { display: grid; gap: 3px; }

.side-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 46px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: .95rem;
  font-weight: 500;
  transition: background .2s var(--ease), color .2s var(--ease);
}

.side-link svg { width: 20px; height: 20px; flex: none; opacity: .68; }
.side-link:hover { background: var(--butter); color: var(--gold-deep); }
.side-link:hover svg { opacity: 1; }

.side-link.active {
  background: var(--grad-gold-soft);
  color: var(--gold-deep);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--gold-soft);
}

.side-link.active svg { opacity: 1; color: var(--gold); }

.side-link.active::before {
  content: '';
  position: absolute;
  inset-inline-end: 0;
  inset-block: 9px;
  width: 3px;
  border-radius: var(--radius-pill);
  background: var(--grad-gold);
}

.side-link .count {
  margin-inline-start: auto;
  min-width: 24px;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--sand);
  color: var(--gold-deep);
  font-size: .76rem;
  font-weight: 700;
  text-align: center;
}

.side-link.active .count { background: var(--gold); color: #fff; }

.side-cta {
  margin: 18px 4px 0;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--grad-gold-soft);
  border: 1px solid var(--gold-soft);
  text-align: center;
}

.side-cta p { font-size: .85rem; color: var(--gold-deep); margin-bottom: .8em; }

/* ------------------------------------------------- منطقة المحتوى */
.portal-main {
  grid-area: main;
  min-width: 0;
  padding: clamp(20px, 3vw, 34px) var(--gutter) clamp(48px, 7vw, 80px);
}

.portal-main > .wrap { max-width: var(--wrap); margin-inline: auto; }

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 20px;
  margin-bottom: clamp(18px, 2.6vw, 28px);
}

.page-head .titles { flex: 1 1 320px; min-width: 0; }
.page-head h1 { margin-bottom: .18em; }
.page-head .sub { margin: 0; color: var(--muted); font-size: .95rem; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 9px; }

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font-size: .82rem;
  color: var(--muted-2);
}

.crumbs a { color: var(--muted); }
.crumbs span[aria-hidden] { opacity: .5; }

/* الشريط السفلي على الجوال */
.mobile-tabbar { display: none; }

/* ====================================================================
   3. المكوّنات
   ==================================================================== */

/* ------------------------------------------------------------ الأزرار */
.btn {
  --btn-bg: var(--paper);
  --btn-fg: var(--ink);
  --btn-bd: var(--muted-light);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 11px 20px;
  border: 1px solid var(--btn-bd);
  border-radius: var(--radius-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-body);
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .24s var(--ease),
              background .22s var(--ease), border-color .22s var(--ease), color .22s var(--ease);
}

.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn[disabled], .btn.is-disabled {
  opacity: .5; cursor: not-allowed; transform: none; box-shadow: none;
}

.btn-gold {
  --btn-bd: transparent;
  --btn-fg: #000000;
  background: var(--grad-gold);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18), inset 0 1px 0 rgba(255, 255, 255, .5);
}

.btn-gold:hover { box-shadow: 0 10px 26px -8px rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255, 255, 255, .55); }

.btn-outline { --btn-bd: var(--gold); --btn-fg: var(--gold-ink); background: transparent; }
.btn-outline:hover { background: var(--butter); }

.btn-ghost { --btn-bd: transparent; --btn-fg: var(--muted); background: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--butter); color: var(--ink); box-shadow: none; transform: none; }

.btn-ok { --btn-bd: transparent; --btn-fg: #fff; background: linear-gradient(140deg, #24935A, #176B3D); }
.btn-danger { --btn-bd: var(--danger); --btn-fg: var(--danger); background: var(--danger-soft); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { min-height: 38px; padding: 8px 15px; font-size: .87rem; }
.btn-block { width: 100%; }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* ------------------------------------------------------------ البطاقات */
.card {
  background: rgba(255, 255, 255, .86);
  border: 1px solid var(--muted-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: clamp(18px, 2.4vw, 26px);
}

.card + .card { margin-top: 18px; }

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--muted-light);
}

.card-head h2, .card-head h3 { margin: 0; flex: 1 1 200px; min-width: 0; }
.card-head .actions { display: flex; flex-wrap: wrap; gap: 8px; }

.card-gold {
  background: var(--grad-gold-soft);
  border-color: var(--gold-soft);
}

/* ------------------------------------------------- بطاقات الأرقام */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: clamp(12px, 1.6vw, 18px);
  margin-bottom: clamp(20px, 2.8vw, 30px);
}

/* Keep wide dashboards on an even grid instead of a ragged last row. */
@media (min-width: 1025px) {
  .stat-grid:has(> :nth-child(5):last-child) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stat-grid:has(> :nth-child(6):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.stat {
  position: relative;
  overflow: hidden;
  padding: 20px 20px 18px;
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--muted-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform .26s var(--ease), box-shadow .26s var(--ease), border-color .26s var(--ease);
}

.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--gold-soft); }

.stat::after {
  content: '';
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  height: 3px;
  background: var(--grad-gold);
  opacity: .85;
}

.stat .label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .84rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}

.stat .label svg { width: 17px; height: 17px; color: var(--gold); flex: none; }

.stat .value {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.7rem, 1.4rem + 1vw, 2.3rem);
  line-height: 1.1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stat .value small { font-size: .46em; font-weight: 600; color: var(--muted); margin-inline-start: 4px; }
.stat .hint { margin: 4px 0 0; font-size: .8rem; color: var(--muted-2); }

.stat.is-warn::after { background: linear-gradient(135deg, #FFDE17, #A8710A); }
.stat.is-danger::after { background: linear-gradient(135deg, #E2766C, #A32118); }
.stat.is-ok::after { background: linear-gradient(135deg, #5FC28C, #1B7A46); }

/* -------------------------------------------------------- الشارات */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  background: var(--butter-2);
  border: 1px solid var(--gold-soft);
  color: var(--gold-deep);
  font-size: .79rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.badge-ok { background: var(--ok-soft); border-color: #BCE4CE; color: var(--ok); }
.badge-warn { background: var(--warn-soft); border-color: #EBD98F; color: var(--warn); }
.badge-danger { background: var(--danger-soft); border-color: #F3C9C4; color: var(--danger); }
.badge-info { background: var(--info-soft); border-color: #C2DCEE; color: var(--info); }
.badge-muted { background: #EFEBE1; border-color: var(--muted-light); color: var(--muted); }
.badge-plain::before { display: none; }

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--gold-light);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .01em;
}

/* --------------------------------------------- شريط تقدّم المراحل */
.progress {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--muted-light);
  overflow: hidden;
}

.progress > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--grad-gold);
  transition: width .6s var(--ease);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: .82rem;
  color: var(--muted);
}

.progress-label b { color: var(--gold-deep); font-variant-numeric: tabular-nums; }

/* ------------------------------------------- مخطّط دورة العمل (6 مراحل) */
.flow {
  display: grid;
  gap: 0;
  counter-reset: flow;
}

.flow-step {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 0 16px;
  padding-bottom: 22px;
}

.flow-step:last-child { padding-bottom: 0; }

/* الخط الواصل — على اليمين في RTL */
.flow-step::before {
  content: '';
  position: absolute;
  inset-block-start: 44px;
  inset-block-end: 0;
  inset-inline-start: 21px;
  width: 2px;
  background: var(--muted-light);
}

.flow-step:last-child::before { display: none; }

.flow-step .dot {
  position: relative;
  z-index: 1;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--muted-light);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: .98rem;
  color: var(--muted-2);
  transition: background .3s var(--ease), border-color .3s var(--ease), color .3s var(--ease);
}

.flow-step .dot svg { width: 20px; height: 20px; }

.flow-step .body { padding-block-start: 8px; min-width: 0; }
.flow-step .body h4 { margin: 0 0 2px; font-size: 1rem; }
.flow-step .body p { margin: 0; font-size: .87rem; color: var(--muted); }
.flow-step .body time { display: block; margin-top: 4px; font-size: .78rem; color: var(--muted-2); }

.flow-step.is-done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.flow-step.is-done::before { background: linear-gradient(180deg, var(--ok), var(--gold-light)); }
.flow-step.is-done .body h4 { color: var(--ink-2); }

.flow-step.is-active .dot {
  background: var(--grad-gold);
  border-color: var(--gold);
  color: #fff;
  box-shadow: 0 0 0 5px rgba(192, 138, 30, .16);
}

.flow-step.is-active .body h4 { color: var(--gold-deep); }

.flow-step.is-rejected .dot { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

@media (prefers-reduced-motion: no-preference) {
  .flow-step.is-active .dot { animation: pulse-gold 2.6s var(--ease) infinite; }
}

@keyframes pulse-gold {
  0%, 100% { box-shadow: 0 0 0 5px rgba(192, 138, 30, .16); }
  50% { box-shadow: 0 0 0 10px rgba(192, 138, 30, .05); }
}

/* نسخة أفقية مختصرة للمراحل — تظهر أعلى تفاصيل الطلب */
.flow-mini {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.flow-mini > div {
  flex: 1 0 auto;
  min-width: 120px;
  padding: 9px 12px;
  border-radius: var(--radius-xs);
  background: var(--paper);
  border: 1px solid var(--muted-light);
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.4;
}

.flow-mini > div b { display: block; font-size: .82rem; color: var(--ink-2); font-weight: 600; }
.flow-mini > div.is-done { background: var(--ok-soft); border-color: #BCE4CE; }
.flow-mini > div.is-done b { color: var(--ok); }
.flow-mini > div.is-active { background: var(--grad-gold-soft); border-color: var(--gold); }
.flow-mini > div.is-active b { color: var(--gold-deep); }
.flow-mini > div.is-rejected { background: var(--danger-soft); border-color: #E7B9B4; }
.flow-mini > div.is-rejected b { color: var(--danger); }

/* ----------------------------------------------------- سجل الأحداث */
.timeline { list-style: none; margin: 0; padding: 0; }

.timeline li {
  position: relative;
  padding: 0 30px 18px 0;
  border-inline-start: 0;
}

.timeline li::before {
  content: '';
  position: absolute;
  inset-inline-end: 7px;
  inset-block-start: 8px;
  inset-block-end: -8px;
  width: 2px;
  background: var(--muted-light);
}

.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::before { display: none; }

.timeline li::after {
  content: '';
  position: absolute;
  inset-inline-end: 2px;
  inset-block-start: 7px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--gold);
}

.timeline .ev-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}

.timeline .ev-head b { font-size: .92rem; font-weight: 600; }
.timeline .ev-head time { font-size: .76rem; color: var(--muted-2); }
.timeline p { margin: 2px 0 0; font-size: .88rem; color: var(--muted); }

.timeline li[data-type='rejected']::after { border-color: var(--danger); }
.timeline li[data-type='approved']::after,
.timeline li[data-type='completed']::after { border-color: var(--ok); }

/* --------------------------------------------------------- الجداول */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--muted-light);
  background: rgba(255, 255, 255, .88);
  -webkit-overflow-scrolling: touch;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
}

table.data th, table.data td {
  padding: 13px 16px;
  text-align: start;
  vertical-align: middle;
  border-bottom: 1px solid var(--muted-light);
}

table.data thead th {
  position: sticky;
  inset-block-start: 0;
  background: var(--butter);
  font-family: var(--font-body);
  font-size: .81rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--gold-deep);
  white-space: nowrap;
  z-index: 1;
}

table.data tbody tr { transition: background .18s var(--ease); }
table.data tbody tr:hover { background: var(--cream); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data td.tight { white-space: nowrap; }
table.data .order-no { font-weight: 700; color: var(--gold-deep); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------ بطاقات الطلبات */
.order-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: clamp(12px, 1.6vw, 18px);
}

.order-card {
  display: block;
  padding: 18px;
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--muted-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  transition: transform .24s var(--ease), box-shadow .24s var(--ease), border-color .24s var(--ease);
}

.order-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--gold-soft);
  color: var(--ink);
}

.order-card .top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.order-card .top .order-no {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: .95rem;
  color: var(--gold-deep);
  font-variant-numeric: tabular-nums;
}

.order-card .top .badge { margin-inline-start: auto; }
.order-card h3 { margin: 0 0 6px; font-size: 1.04rem; }
.order-card .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-bottom: 12px;
  font-size: .82rem;
  color: var(--muted);
}

.order-card .meta span { display: inline-flex; align-items: center; gap: 5px; }
.order-card .meta svg { width: 15px; height: 15px; opacity: .6; }

/* ----------------------------------------------------- النماذج */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px 18px;
}

.field { display: grid; gap: 6px; min-width: 0; }
.field.span-2 { grid-column: 1 / -1; }

.field > label {
  font-size: .88rem;
  font-weight: 600;
  color: var(--ink-2);
}

.field > label .req { color: var(--danger); margin-inline-start: 2px; }
.field .help { font-size: .79rem; color: var(--muted-2); }

.field input[type='text'],
.field input[type='email'],
.field input[type='tel'],
.field input[type='password'],
.field input[type='number'],
.field input[type='date'],
.field input[type='file'],
.field select,
.field textarea,
input.inp, select.inp, textarea.inp {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--muted-light);
  border-radius: var(--radius-sm);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
  appearance: none;
}

.field textarea, textarea.inp { min-height: 118px; resize: vertical; line-height: 1.7; }

.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--sand-2); }

.field input:focus, .field select:focus, .field textarea:focus,
input.inp:focus, select.inp:focus, textarea.inp:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: var(--ring);
  background: var(--cream);
}

.field select, select.inp {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1.5 7 7.5l6-6' fill='none' stroke='%23776B52' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 16px center;
  background-size: 13px;
  padding-inline-start: 40px;
}

.field input::placeholder, .field textarea::placeholder { color: var(--muted-2); opacity: .8; }

.field .err { font-size: .8rem; color: var(--danger); font-weight: 600; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: .9rem;
  color: var(--ink-2);
  cursor: pointer;
  min-height: 46px;
  padding-block: 10px;
}

.check input[type='checkbox'], .check input[type='radio'] {
  flex: none;
  width: 21px; height: 21px;
  margin: 1px 0 0;
  accent-color: var(--gold);
  cursor: pointer;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--muted-light);
}

.form-actions .spacer { flex: 1 1 auto; }

fieldset.group {
  margin: 0 0 22px;
  padding: 0;
  border: 0;
}

fieldset.group > legend {
  padding: 0;
  margin-bottom: 14px;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--gold-deep);
}

/* اختيار بطاقات (نوع الخدمة) */
.pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.pick {
  position: relative;
  display: block;
  padding: 14px;
  border: 1px solid var(--muted-light);
  border-radius: var(--radius-sm);
  background: var(--paper);
  cursor: pointer;
  text-align: center;
  font-size: .9rem;
  font-weight: 600;
  color: var(--ink-2);
  transition: border-color .2s var(--ease), background .2s var(--ease), transform .2s var(--ease);
}

.pick:hover { border-color: var(--gold-light); background: var(--butter); }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick svg { display: block; width: 26px; height: 26px; margin: 0 auto 7px; color: var(--gold); }

.pick.is-on, .pick input:checked + span {
  border-color: var(--gold);
  background: var(--grad-gold-soft);
  color: var(--gold-deep);
}

/* اختيار عبر RadioButtonList — نفس مظهر .pick */
.pick-list input[type='radio'] {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px;
  pointer-events: none;
}

.pick-list label {
  display: block;
  padding: 14px;
  border: 1px solid var(--muted-light);
  border-radius: var(--radius-sm);
  background: var(--paper);
  cursor: pointer;
  text-align: center;
  font-size: .9rem;
  font-weight: 600;
  color: var(--ink-2);
  transition: border-color .2s var(--ease), background .2s var(--ease), color .2s var(--ease);
}

.pick-list label:hover { border-color: var(--gold-light); background: var(--butter); }

.pick-list input[type='radio']:checked + label {
  border-color: var(--gold);
  background: var(--grad-gold-soft);
  color: var(--gold-deep);
  box-shadow: inset 0 0 0 1px var(--gold-soft);
}

.pick-list input[type='radio']:focus-visible + label {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ------------------------------------------------------ الرسائل */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px 16px;
  margin-bottom: 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gold-soft);
  background: var(--butter-2);
  color: var(--gold-deep);
  font-size: .93rem;
  line-height: 1.65;
}

.alert svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.alert strong { display: block; font-weight: 700; }
.alert-ok { background: var(--ok-soft); border-color: #BCE4CE; color: #15603A; }
.alert-danger { background: var(--danger-soft); border-color: #F3C9C4; color: #8A1C14; }
.alert-info { background: var(--info-soft); border-color: #C2DCEE; color: #12466B; }

/* -------------------------------------------------- الحالة الفارغة */
.empty {
  padding: clamp(34px, 6vw, 62px) 24px;
  text-align: center;
  border: 1px dashed var(--sand-2);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .6);
}

.empty svg {
  width: 56px; height: 56px;
  margin-bottom: 14px;
  color: var(--gold-light);
}

.empty h3 { margin-bottom: .3em; }
.empty p { max-width: 42ch; margin-inline: auto; color: var(--muted); font-size: .93rem; }
.empty .btn { margin-top: 16px; }

/* ------------------------------------------------------- الملفات */
.file-list { display: grid; gap: 9px; }

.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid var(--muted-light);
  border-radius: var(--radius-sm);
  background: var(--paper);
  transition: border-color .2s var(--ease), background .2s var(--ease);
}

.file-row:hover { border-color: var(--gold-light); background: var(--cream); }

.file-row .ext {
  flex: none;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: var(--radius-xs);
  background: var(--grad-gold-soft);
  border: 1px solid var(--gold-soft);
  font-family: var(--font-display);
  font-size: .68rem;
  font-weight: 800;
  color: var(--gold-deep);
  letter-spacing: .02em;
}

.file-row .info { flex: 1 1 auto; min-width: 0; }
.file-row .info b {
  display: block;
  font-size: .91rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-row .info span { font-size: .78rem; color: var(--muted-2); }
.file-row .grab { flex: none; }

/* الفاتورة */
.invoice-lines { display: grid; gap: 2px; margin-bottom: 14px; }

.invoice-lines > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 2px;
  font-size: .93rem;
  border-bottom: 1px dashed var(--muted-light);
}

.invoice-lines > div span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; }
.invoice-lines > div.total {
  margin-top: 6px;
  padding: 13px 14px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--grad-gold-soft);
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--gold-deep);
}

/* التبويبات */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  padding-bottom: 2px;
  overflow-x: auto;
  border-bottom: 1px solid var(--muted-light);
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

/* تلميح بصري يوضّح أن شريط التبويبات قابل للتمرير أفقياً على الشاشات الضيقة */
.tabs-wrap {
  position: relative;
}

.tabs-wrap::after {
  content: '';
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 34px;
  pointer-events: none;
  background: linear-gradient(to left, rgba(255, 253, 246, 0), rgba(255, 253, 246, .96));
  opacity: 0;
  transition: opacity var(--t, .24s) var(--ease);
}

.tabs-wrap.is-scrollable::after { opacity: 1; }

@media (max-width: 520px) {
  .tabs { gap: 2px; }
  .tab { padding: 11px 13px; font-size: .88rem; }
}

.tab {
  flex: none;
  min-height: 44px;
  padding: 11px 17px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  font-family: var(--font-body);
  font-size: .93rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}

.tab:hover { color: var(--ink); }
.tab.active { color: var(--gold-deep); border-bottom-color: var(--gold); }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade-in .3s var(--ease); }

@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* شبكة عمودين للتفاصيل */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: clamp(16px, 2vw, 24px);
  align-items: start;
}

/* قائمة تعريفية */
.defs { display: grid; gap: 0; margin: 0; }

.defs > div {
  display: grid;
  grid-template-columns: minmax(108px, 34%) minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--muted-light);
  font-size: .91rem;
}

.defs > div:last-child { border-bottom: 0; }
.defs dt { color: var(--muted); }
.defs dd { margin: 0; font-weight: 600; color: var(--ink-2); min-width: 0; }

/* أدوات الترشيح */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--muted-light);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .8);
}

.filters .field { flex: 1 1 180px; }
.filters .go { flex: none; }

/* شريط سفلي ثابت للأزرار الحاسمة على الجوال */
.action-bar { display: contents; }

/* ====================================================================
   4. التجاوب
   ==================================================================== */

/* ---------- لوحي عريض: شريط جانبي أضيق ---------- */
@media (max-width: 1180px) {
  :root { --sidebar-w: 228px; }
  .split { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
}

/* ---------- لوحي: الشريط الجانبي يصبح درجاً منزلقاً ---------- */
@media (max-width: 1024px) {
  :root { --topbar-h: 64px; }

  .portal-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      'topbar'
      'main';
  }

  .portal-menu-btn { display: inline-flex; }

  .portal-side {
    position: fixed;
    inset-block: 0;
    inset-inline-end: 0;
    z-index: 200;
    width: min(320px, 86vw);
    height: 100vh;
    padding-block-start: 22px;
    background: var(--cream);
    border-inline-end: 0;
    border-inline-start: 1px solid var(--muted-light);
    box-shadow: var(--shadow-lg);
    transform: translateX(105%);
    visibility: hidden;
    transition: transform .42s var(--ease), visibility .42s;
    overscroll-behavior: contain;
  }

  body.side-open .portal-side { transform: none; visibility: visible; }

  .side-scrim {
    position: fixed;
    inset: 0;
    z-index: 190;
    background: rgba(26, 21, 9, .46);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .38s var(--ease), visibility .38s;
  }

  body.side-open .side-scrim { opacity: 1; visibility: visible; }
  body.side-open { overflow: hidden; }

  .side-close {
    display: grid;
    place-items: center;
    width: 44px; height: 44px;
    margin: 0 0 12px auto;
    border: 1px solid var(--muted-light);
    border-radius: var(--radius-xs);
    background: var(--paper);
    color: var(--ink);
    cursor: pointer;
  }

  .side-close svg { width: 20px; height: 20px; }

  .split { grid-template-columns: minmax(0, 1fr); }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); }
}

@media (min-width: 1025px) {
  .side-close, .side-scrim { display: none; }
}

/* ---------- جوال كبير ---------- */
@media (max-width: 768px) {
  body.portal { font-size: 15px; }

  .auth-shell { grid-template-columns: minmax(0, 1fr); }
  .auth-aside {
    order: 2;
    padding: 30px var(--gutter) 38px;
    gap: 24px;
  }
  .auth-aside .brand-mark { display: none; }
  .auth-main { order: 1; padding-block: 34px 30px; }
  .auth-card { border: 0; box-shadow: none; background: transparent; backdrop-filter: none; padding: 0; }

  .page-head { align-items: flex-start; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1 1 auto; }

  .user-chip .who { display: none; }
  .user-chip { padding: 5px; gap: 0; }

  .portal-brand small { display: none; }
  .hide-sm { display: none; }

  /* الجداول تتحوّل إلى بطاقات مكدّسة */
  .table-wrap { border: 0; background: none; overflow: visible; }

  table.data { font-size: .9rem; }
  table.data thead { display: none; }

  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }

  table.data tr {
    margin-bottom: 12px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, .92);
    border: 1px solid var(--muted-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
  }

  table.data tr:hover { background: rgba(255, 255, 255, .96); }

  table.data td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 7px 0;
    border-bottom: 1px dashed var(--muted-light);
    text-align: start;
  }

  table.data td:last-child { border-bottom: 0; padding-bottom: 0; }
  table.data td:first-child { padding-top: 0; }

  /* عنوان العمود يأتي من data-th */
  table.data td::before {
    content: attr(data-th);
    flex: none;
    font-size: .79rem;
    font-weight: 600;
    color: var(--muted-2);
  }

  table.data td[data-th='']::before, table.data td.no-label::before { display: none; }
  table.data td.no-label { justify-content: flex-start; }

  .defs > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .defs dt { font-size: .82rem; }

  .form-actions { flex-direction: column-reverse; align-items: stretch; }
  .form-actions .btn { width: 100%; }
  .form-actions .spacer { display: none; }

  .filters { padding: 14px; }
  .filters .field { flex: 1 1 100%; }
  .filters .go, .filters .go .btn { width: 100%; }

  /* شريط تبويب سفلي — وصول سريع بإصبع واحد */
  .mobile-tabbar {
    position: fixed;
    inset-block-end: 0;
    inset-inline: 0;
    z-index: 150;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 2px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255, 253, 246, .94);
    backdrop-filter: blur(14px) saturate(1.3);
    border-block-start: 1px solid var(--muted-light);
    box-shadow: 0 -6px 24px -12px rgba(110, 74, 13, .34);
  }

  .mobile-tabbar a {
    display: grid;
    place-items: center;
    gap: 3px;
    min-height: 54px;
    padding: 6px 4px;
    border-radius: var(--radius-xs);
    color: var(--muted);
    font-size: .7rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
  }

  .mobile-tabbar a svg { width: 22px; height: 22px; }
  .mobile-tabbar a.active { color: var(--gold-deep); background: var(--butter-2); }
  .mobile-tabbar a:active { background: rgba(255, 255, 255, .08); }

  .portal-main { padding-block-end: calc(84px + env(safe-area-inset-bottom)); }

  /* الأزرار الحاسمة تثبت أسفل الشاشة داخل تفاصيل الطلب */
  .action-bar {
    position: sticky;
    inset-block-end: calc(76px + env(safe-area-inset-bottom));
    z-index: 120;
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 18px;
    padding: 12px;
    background: rgba(255, 253, 246, .95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--gold-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }

  .action-bar .btn { flex: 1 1 140px; }
}

/* ---------- جوال صغير ---------- */
@media (max-width: 520px) {
  :root { --gutter: 14px; --radius: 15px; }

  body.portal { line-height: 1.7; }

  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 15px 14px 13px; }
  .stat .label { font-size: .78rem; }
  .stat .value { font-size: clamp(1.4rem, 1.1rem + 2.4vw, 1.8rem); }
  .stat .hint { display: none; }

  .order-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .pick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .card { padding: 16px 14px; border-radius: var(--radius); }
  .card-head { margin-bottom: 13px; padding-bottom: 11px; }

  .flow-step { grid-template-columns: 36px minmax(0, 1fr); gap: 0 12px; }
  .flow-step .dot { width: 36px; height: 36px; font-size: .88rem; }
  .flow-step::before { inset-inline-start: 17px; inset-block-start: 36px; }

  .notif-panel { inset-inline-start: auto; inset-inline-end: -6px; width: min(340px, calc(100vw - 24px)); }

  .mobile-tabbar a { font-size: .64rem; }
  .mobile-tabbar a svg { width: 21px; height: 21px; }
}

@media (max-width: 380px) {
  .stat-grid { grid-template-columns: minmax(0, 1fr); }
  .pick-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- تقليل الحركة ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- الطباعة (الفواتير) ---------- */
@media print {
  body.portal { background: #fff; }
  body.portal::before,
  .portal-topbar, .portal-side, .mobile-tabbar, .side-scrim,
  .page-head .actions, .action-bar, .tabs, .btn { display: none !important; }
  .portal-shell { display: block; }
  .portal-main { padding: 0; }
  .card { border: 1px solid #ddd; box-shadow: none; background: #fff; }
  .split { display: block; }
}

/* ---------------------------------------------------------- notifications page */
.notif-page { display: grid; gap: 8px; }
.notif-page .notif-item {
  border: 1px solid var(--muted-light);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: var(--paper);
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.notif-page .notif-item.unread { border-color: var(--gold-light); background: var(--butter); }
.notif-item b { display: block; font-size: .95rem; font-weight: 700; color: var(--ink-2); }
.notif-item > span { display: block; font-size: .86rem; color: var(--muted); margin-top: 3px; }
.notif-page .notif-item time { display: block; margin-top: 6px; }
a.notif-item { text-decoration: none; }
a.notif-item:hover { border-color: var(--gold); }

/* --------------------------------------------------- compact inline select */
.inp-sm {
  padding: 7px 10px;
  font-size: .82rem;
  min-height: 0;
  min-width: 118px;
}


/* =====================================================================
   طبقة الهوية الأصلية — شريط علوي وجانبي بلون الحبر/الفولاذ مع لمسة نحاسية
   ملحقة في النهاية لتتفوق في ترتيب الأسبقية.
   ===================================================================== */

/* ------------------------------------------------- الشريط العلوي الداكن */
.portal-topbar {
  background: rgba(18, 24, 31, .96);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border-block-end: 1px solid var(--line-dark, #33404D);
  box-shadow: none;
}

.portal-brand { color: #F5F2EC; }
.portal-brand small, .portal-brand span small { color: #9AA6B2; }

.portal-menu-btn {
  color: #F5F2EC;
  border-color: transparent;
  background: transparent;
}
.portal-menu-btn:hover { border-color: #33404D; color: var(--gold-light); }

.notif-btn { color: #F5F2EC; border-color: transparent; background: transparent; }
.notif-btn:hover { border-color: #33404D; color: var(--gold-light); }

.user-chip {
  background: rgba(255, 255, 255, .06);
  border-color: #33404D;
  color: #F5F2EC;
}
.user-chip:hover { border-color: var(--gold-light); background: rgba(255, 255, 255, .1); }
.user-chip .who b { color: #F5F2EC; }
.user-chip .who span { color: #9AA6B2; }

.portal-topbar .btn-ghost { --btn-fg: #9AA6B2; }
.portal-topbar .btn-ghost:hover { background: rgba(255, 255, 255, .08); color: #F5F2EC; }

/* ------------------------------------------------- الشريط الجانبي الداكن */
.portal-side {
  background: #1A222B;
  border-inline-end: 1px solid #33404D;
}

.side-group h5 { color: #7E8B99; }

.side-link { color: #C3CBD3; border-inline-start: 2px solid transparent; }
.side-link svg { opacity: .6; }
.side-link:hover {
  background: rgba(255, 255, 255, .06);
  color: #F5F2EC;
}
.side-link:hover svg { opacity: 1; }

.side-link.active {
  background: rgba(255, 222, 23, .1);
  color: var(--gold-light);
  box-shadow: none;
}
.side-link.active svg { color: var(--gold-light); opacity: 1; }
.side-link.active::before { background: var(--gold-light); }

.side-link .count { background: rgba(255, 255, 255, .12); color: #F5F2EC; }
.side-link.active .count { background: var(--gold-light); color: #000; }

.side-cta {
  background: rgba(255, 255, 255, .05);
  border: 1px solid #33404D;
}
.side-cta p { color: #9AA6B2; }

.side-close { color: #F5F2EC; }
.side-close:hover { color: var(--gold-light); }

/* ------------------------------------------------- الشريط السفلي للجوال */
@media (max-width: 900px) {
  .mobile-tabbar {
    background: rgba(18, 24, 31, .97);
    border-block-start: 1px solid #33404D;
  }
  .mobile-tabbar a { color: #9AA6B2; }
  .mobile-tabbar a.active { color: var(--gold-light); background: rgba(255, 222, 23, .12); }
}

/* الأحرف على الخلفية النحاسية تكون بالحبر الأسود لضمان الوضوح */
.avatar { color: #000000; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.auth-steps b { background: rgba(0, 0, 0, .35); border-color: rgba(255, 222, 23, .5); }

/* الوهج الذهبي المحيط يُستبدل بلمسة نحاسية خفيفة على ورق الموقع الأصلي */
body.portal::before {
  background:
    radial-gradient(60% 45% at 88% 4%, rgba(255, 222, 23, .10), transparent 70%),
    radial-gradient(52% 40% at 6% 96%, rgba(35, 44, 54, .05), transparent 72%);
}

/* روابط النص بلون نحاسي قابل للقراءة على الورق الفاتح */
a { color: var(--gold-ink); }
a:hover { color: #000000; }

/* ------------------------------------------------- ضمانات التجاوز الأفقي */
.portal-main > .wrap, .table-wrap, .card, .stat { min-width: 0; max-width: 100%; }
.table-wrap { overflow-x: auto; }

/* لوحة الإشعارات: تُثبَّت على الشاشة في الأحجام الصغيرة حتى لا تتجاوز الحدود */
@media (max-width: 720px) {
  .notif-panel {
    position: fixed;
    inset-block-start: calc(var(--topbar-h) + 6px);
    inset-inline: auto;
    left: 10px;
    right: 10px;
    width: auto;
    max-width: none;
    max-height: calc(100vh - var(--topbar-h) - 20px);
  }
}

/* الهواتف الصغيرة: الشريط العلوي يكتفي بالأيقونات */
@media (max-width: 420px) {
  :root { --gutter: 12px; }
  .portal-topbar { gap: 8px; }
  .topbar-actions { gap: 6px; }
  .user-chip { padding-inline: 5px; gap: 0; }
  .user-chip .who { display: none; }
  .portal-brand { font-size: .96rem; }
  .portal-brand svg { width: 30px; height: 30px; }
  .notif-panel { max-width: calc(100vw - 16px); }
}

/* الجذر يمنع أي تمرير أفقي عارض */
html { overflow-x: clip; max-width: 100%; }
.split > *, .portal-shell > * { min-width: 0; }

/* الشاشات الضيقة جداً: تصغير الشريط العلوي أكثر */
@media (max-width: 370px) {
  :root { --gutter: 10px; }
  .portal-topbar { gap: 6px; padding-inline: 10px; }
  .topbar-actions { gap: 4px; }
  .portal-brand small { display: none; }
  .portal-brand { font-size: .9rem; }
  .portal-topbar .btn-ghost { padding-inline: 8px; }
  .portal-topbar .btn-ghost .hide-sm { display: none; }
}

/* الأزرار بزوايا حادة 3px مثل الموقع الأصلي، لا كبسولات */
.btn { border-radius: var(--radius); }
.btn-gold::after, .btn::after { border-radius: inherit; }
/* construction portal refresh */
.portal-kicker{display:block;color:#b68b4c;font-size:.76rem;font-weight:800;letter-spacing:.12em}.portal-page-head{display:flex;align-items:flex-end;justify-content:space-between;gap:24px;margin-bottom:28px}.portal-page-head h1{font-size:clamp(2rem,4vw,3rem);margin:10px 0 4px}.portal-page-head p{color:#778078;margin:0}.estimate-layout{display:grid;grid-template-columns:minmax(0,1fr) 330px;gap:24px;align-items:start}.request-card{padding:28px}.group{border:0;border-top:1px solid #e1e4df;padding:26px 0 0;margin:0 0 28px}.group legend{font-size:1.1rem;font-weight:800;padding:0 0 6px}.field-help{font-size:.88rem;color:#7a847e}.service-choice{display:grid;grid-template-columns:repeat(2,1fr);gap:12px;margin-top:18px}.service-choice label{display:flex!important;align-items:center;gap:10px;border:1px solid #e1e4df;border-radius:10px;padding:14px;background:#fbfcfa;cursor:pointer;transition:.2s}.service-choice label:hover{border-color:#b68b4c;background:#fffaf1}.service-choice input{accent-color:#b68b4c}.estimate-side{display:grid;gap:18px;position:sticky;top:20px}.estimate-card{background:#1f2421;color:#fff;padding:28px;box-shadow:0 14px 36px rgba(31,36,33,.12)}.estimate-label{color:#d7b77a;font-size:.8rem}.estimate-card strong{display:block;font-size:2.6rem;line-height:1.2;margin-top:14px;color:#fff}.estimate-card>small{color:#aab2ab}.estimate-line{display:flex;justify-content:space-between;gap:12px;border-top:1px solid rgba(255,255,255,.15);padding-top:13px;margin-top:22px;font-size:.82rem}.estimate-line b{color:#d7b77a;text-align:left}.estimate-card p{color:#aab2ab;font-size:.8rem;line-height:1.8;margin:24px 0 0}.process-card{padding:24px}.process-card ol{list-style:none;padding:0;margin:18px 0 0;display:grid;gap:16px}.process-card li{display:flex;gap:12px;align-items:center;font-size:.88rem}.process-card li b{color:#b68b4c}.service-bullets{padding:0;list-style:none;display:grid;gap:14px;margin:26px 0 0}.service-bullets li{position:relative;padding-right:25px;color:#d3d9d4;font-size:.95rem}.service-bullets li:before{content:'✓';position:absolute;right:0;color:#d7b77a;font-weight:800}.auth-aside{background:linear-gradient(150deg,#1f2421,#39443d)!important}.auth-copy h2{font-size:2rem!important;line-height:1.35}.auth-steps.service-bullets li{padding:0 28px 0 0}.auth-steps.service-bullets li:before{right:0;top:0}.auth-steps.service-bullets li:after{display:none}
@media(max-width:900px){.estimate-layout{grid-template-columns:1fr}.estimate-side{position:static}.portal-page-head{align-items:flex-start;flex-direction:column}.service-choice{grid-template-columns:1fr}}
