/* =============================================================================
   نظام التصميم — مستوحى من bayt.com
   ============================================================================= */

:root {
  /* الألوان الأساسية */
  --primary:        #0070EB;
  --primary-dark:   #005CE6;
  --primary-light:  #E8F2FE;
  --primary-ghost:  #F4F9FF;

  /* المحايدة */
  --bg:             #F4F4F4;
  --card:           #FFFFFF;
  --text:           #1A1A1A;
  --text-2:         #212121;
  --muted:          #828A93;
  --muted-light:    #A6AFB9;
  --label:          #0A56C4;
  --border:         #E4E7EB;
  --border-strong:  #D3D8DE;

  /* الحالات */
  --success:        #0F8A3D;
  --success-bg:     #E9F7EE;
  --warning:        #B26B00;
  --warning-bg:     #FFF6E5;
  --danger:         #D32F2F;
  --danger-bg:      #FDECEC;

  /* الأبعاد */
  --radius:         6px;
  --radius-btn:     4px;
  --radius-pill:    999px;
  --shadow:         0 -1px 10px rgba(172, 171, 171, .3);
  --shadow-lg:      0 8px 28px rgba(0, 0, 0, .12);
  --header-h:       60px;
  --sidebar-w:      248px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Vazirmatn", "Roboto", Tahoma, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 700; color: var(--text); line-height: 1.35; }
h1 { font-size: 24px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }

/* ---------- البطاقات ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card-tight { padding: 16px; }
.card-flush { padding: 0; overflow: hidden; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-head h2 { font-size: 16px; }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-btn);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); color: #fff; }

.btn-outline { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover:not(:disabled) { background: var(--primary-ghost); color: var(--primary-dark); }

.btn-ghost { background: transparent; color: var(--text-2); border-color: var(--border-strong); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #B71C1C; color: #fff; }

.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 13px 24px; font-size: 15px; }

/* ---------- الحقول ---------- */
.field { margin-bottom: 18px; }

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--label);
  letter-spacing: .01em;
}
.field label .req { color: var(--danger); margin-inline-start: 3px; font-size: 14px; }

.input, .select, .textarea {
  display: block;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-btn);
  background: #fff;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 112, 235, .12);
}
.input::placeholder { color: var(--muted-light); }
.textarea { min-height: 96px; resize: vertical; }

.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--danger); }

.field-error {
  display: none;
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--danger);
}
.field-error.show { display: block; }

.input-group { position: relative; }
.input-group .input { padding-inline-end: 42px; }
.input-group .toggle-pw {
  position: absolute;
  inset-inline-end: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: none;
  padding: 6px 8px;
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-family: inherit;
  font-weight: 700;
}
.input-group .toggle-pw:hover { color: var(--primary); }

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.checkbox input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

/* ---------- التنبيهات ---------- */
.alert {
  display: none;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-btn);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 18px;
  border-inline-start: 3px solid transparent;
}
.alert.show { display: flex; }
.alert-danger  { background: var(--danger-bg);  color: #A32020; border-color: var(--danger); }
.alert-success { background: var(--success-bg); color: #0B6E30; border-color: var(--success); }
.alert-warning { background: var(--warning-bg); color: #8A5300; border-color: var(--warning); }
.alert ul { margin: 6px 0 0; padding-inline-start: 18px; }

/* ---------- الشارات ---------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
}
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-success { background: var(--success-bg);    color: var(--success); }
.badge-warning { background: var(--warning-bg);    color: var(--warning); }
.badge-danger  { background: var(--danger-bg);     color: var(--danger); }
.badge-muted   { background: #EEF0F2;              color: var(--muted); }

/* ---------- أدوات ---------- */
.muted     { color: var(--muted); }
.text-sm   { font-size: 13px; }
.text-xs   { font-size: 12px; }
.bold      { font-weight: 700; }
.center    { text-align: center; }
.row       { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack     { display: flex; flex-direction: column; gap: 12px; }
.spacer    { flex: 1; }
.mt-0 { margin-top: 0 } .mt-1 { margin-top: 8px } .mt-2 { margin-top: 16px } .mt-3 { margin-top: 24px }
.mb-0 { margin-bottom: 0 } .mb-1 { margin-bottom: 8px } .mb-2 { margin-bottom: 16px } .mb-3 { margin-bottom: 24px }
.hidden { display: none !important; }
/* خاصية hidden الأصلية يجب أن تتغلّب على أي display يضعه صنف مثل .btn أو .card —
   بدونها كان زر مخفيّ بـ hidden يبقى ظاهرًا (اكتُشف 2026-10-01: زر «إضافة» في الباقات ظهر لمسوّقة بلا صلاحية إدارة). */
[hidden] { display: none !important; }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0;
  color: var(--muted-light);
  font-size: 12.5px;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---------- المُحمّل ---------- */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================================================
   شاشة تسجيل الدخول
   ============================================================================= */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 480px;
}

.auth-hero {
  background: linear-gradient(150deg, #0058C4 0%, var(--primary) 55%, #2D8BF5 100%);
  color: #fff;
  padding: 56px 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.auth-hero::after {
  content: "";
  position: absolute;
  inset-inline-start: -120px;
  bottom: -160px;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .07);
}
.auth-hero .brand-mark {
  width: 54px; height: 54px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .18);
  display: grid; place-items: center;
  font-size: 26px; font-weight: 700;
  margin-bottom: 28px;
}
.auth-hero h1 { color: #fff; font-size: 33px; line-height: 1.4; max-width: 15ch; }
.auth-hero p  { color: rgba(255, 255, 255, .88); font-size: 15.5px; max-width: 42ch; margin-top: 14px; }

.auth-features { list-style: none; padding: 0; margin: 36px 0 0; display: grid; gap: 14px; position: relative; }
.auth-features li { display: flex; align-items: center; gap: 11px; font-size: 14.5px; color: rgba(255, 255, 255, .95); }
.auth-features .tick {
  width: 22px; height: 22px; flex: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .22);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
}

.auth-panel {
  background: #fff;
  padding: 48px 52px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-panel .card { box-shadow: none; padding: 0; }
.auth-panel h2 { font-size: 25px; margin-bottom: 6px; }
.auth-foot { margin-top: 30px; font-size: 12.5px; color: var(--muted-light); text-align: center; }

.dev-hint {
  margin-top: 22px;
  padding: 12px 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-btn);
  background: var(--primary-ghost);
  font-size: 12.5px;
  color: var(--text-2);
}
.dev-hint code {
  font-family: "Roboto Mono", Consolas, monospace;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 12px;
  direction: ltr;
  display: inline-block;
}

@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-panel { padding: 32px 22px; min-height: 100vh; }
}

/* =============================================================================
   الهيكل العام للتطبيق — رأس + قائمة جانبية
   ============================================================================= */
.app { min-height: 100vh; }

.app-header {
  position: fixed;
  top: 0; inset-inline: 0;
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  z-index: 30;
}
.app-header .brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 15px; color: var(--text);
  width: calc(var(--sidebar-w) - 20px);
}
.app-header .brand:hover { text-decoration: none; }
.app-header .brand .mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: 17px; font-weight: 700;
}

.header-search { position: relative; flex: 1; max-width: 420px; }
.header-search .input { padding-block: 8px; background: var(--bg); border-color: transparent; }
.header-search .input:focus { background: #fff; }

.icon-btn {
  position: relative;
  width: 36px; height: 36px;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--muted);
  display: grid; place-items: center;
  cursor: pointer; font-size: 16px;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }
.icon-btn .dot {
  position: absolute; top: 6px; inset-inline-end: 7px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); border: 2px solid #fff;
}

.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 10px 5px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: #fff; cursor: pointer;
  font-family: inherit; font-size: 13px;
}
.user-chip:hover { background: var(--bg); }
.user-chip .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary-dark);
  display: grid; place-items: center; font-weight: 700; font-size: 12px;
}
.user-chip .who { text-align: start; line-height: 1.25; }
.user-chip .who .name { font-weight: 700; }
.user-chip .who .role { font-size: 11px; color: var(--muted); }

.app-sidebar {
  position: fixed;
  top: var(--header-h); bottom: 0;
  inset-inline-start: 0;
  width: var(--sidebar-w);
  background: #fff;
  border-inline-end: 1px solid var(--border);
  padding: 16px 12px;
  overflow-y: auto;
  z-index: 20;
}
.nav-group { margin-bottom: 20px; }
.nav-group .label {
  padding: 0 12px 8px;
  font-size: 11px; font-weight: 700;
  letter-spacing: .04em;
  color: var(--muted-light);
  text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-btn);
  color: var(--text-2); font-size: 14px; font-weight: 500;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 700; }
.nav-item .ico { width: 18px; text-align: center; font-size: 15px; flex: none; }
.nav-item .count {
  margin-inline-start: auto;
  background: var(--bg); color: var(--muted);
  border-radius: var(--radius-pill);
  padding: 1px 8px; font-size: 11.5px; font-weight: 700;
}
.nav-item.active .count { background: #fff; color: var(--primary-dark); }

.app-main {
  padding: calc(var(--header-h) + 24px) 24px 40px;
  margin-inline-start: var(--sidebar-w);
  max-width: 1400px;
}

.page-head { margin-bottom: 22px; }
.page-head .crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.page-head h1 { font-size: 23px; }
.page-head .sub { color: var(--muted); margin-top: 3px; font-size: 13.5px; }

/* بطاقات الإحصاءات */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.stat {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px;
  border-top: 3px solid var(--primary);
}
.stat .k { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stat .v { font-size: 27px; font-weight: 700; line-height: 1.3; margin-top: 2px; }
.stat .n { font-size: 12px; color: var(--muted-light); }
.stat.ok   { border-top-color: var(--success); }
.stat.warn { border-top-color: var(--warning); }
.stat.bad  { border-top-color: var(--danger); }

/* الجداول */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: start; padding: 11px 16px;
  background: #FAFBFC; color: var(--muted);
  font-size: 12px; font-weight: 700;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data td { padding: 13px 16px; border-bottom: 1px solid var(--border); }
table.data tbody tr:hover { background: var(--primary-ghost); }
table.data tbody tr:last-child td { border-bottom: 0; }

.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty .big { font-size: 36px; opacity: .35; margin-bottom: 10px; }

@media (max-width: 860px) {
  .app-sidebar { transform: translateX(100%); transition: transform .2s; }
  html[dir="ltr"] .app-sidebar { transform: translateX(-100%); }
  .app-sidebar.open { transform: none; }
  .app-main { margin-inline-start: 0; padding-inline: 16px; }
  .app-header .brand { width: auto; }
  .header-search { display: none; }
}

/* =============================================================================
   شريط الأدوات والفلاتر
   ============================================================================= */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 14px 16px; background: #fff;
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.toolbar .search-box { position: relative; flex: 1; min-width: 220px; }
.toolbar .search-box .input { padding-inline-start: 36px; }
.toolbar .search-box .ico {
  position: absolute; inset-inline-start: 12px; top: 50%;
  transform: translateY(-50%); color: var(--muted-light); font-size: 14px; pointer-events: none;
}
.toolbar .select { width: auto; min-width: 140px; padding-block: 9px; }
.toolbar .input  { padding-block: 9px; }

/* الترقيم */
.pager {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--border);
}
.pager-info { font-size: 12.5px; color: var(--muted); }
.pager-btns { display: flex; align-items: center; gap: 4px; }
.page-btn {
  min-width: 34px; padding: 6px 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-btn);
  background: #fff; color: var(--text-2);
  font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.page-btn:hover:not(:disabled) { background: var(--primary-ghost); border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn:disabled { opacity: .45; cursor: not-allowed; }
.page-gap { padding: 0 4px; color: var(--muted-light); }

/* أعمدة الجدول */
.cell-main { font-weight: 700; color: var(--text); }
.cell-sub  { font-size: 12px; color: var(--muted); }
.cell-actions { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }
.link-btn {
  border: 0; background: none; padding: 4px 6px; cursor: pointer;
  color: var(--primary); font-family: inherit; font-size: 13px; font-weight: 700;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }

.avatar-sq {
  width: 34px; height: 34px; border-radius: var(--radius-btn);
  background: var(--primary-light); color: var(--primary-dark);
  display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none;
}

/* شبكة النماذج */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 18px; }
.form-grid .field.full { grid-column: 1 / -1; }

.section-title {
  display: flex; align-items: center; gap: 9px;
  margin: 4px 0 18px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 15px; font-weight: 700;
}
.section-title .n {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary-dark);
  display: grid; place-items: center; font-size: 12px; flex: none;
}

/* صفوف قابلة للتكرار (أشخاص التواصل / الصفحات) */
.repeat-row {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 16px 0; margin-bottom: 12px; background: #FCFDFE;
  position: relative;
}
.repeat-row .remove {
  position: absolute; top: 10px; inset-inline-end: 10px;
  border: 0; background: none; cursor: pointer;
  color: var(--muted-light); font-size: 17px; line-height: 1; padding: 4px;
}
.repeat-row .remove:hover { color: var(--danger); }

.form-actions {
  position: sticky; bottom: 0;
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 16px 0; margin-top: 8px;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}

/* شريط جانبي متحرّك على الشاشات الصغيرة */
.sidebar-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.35); z-index: 19;
}
.sidebar-backdrop.show { display: block; }
.menu-toggle { display: none; }
@media (max-width: 860px) {
  .menu-toggle { display: grid; }
  .form-actions { position: static; background: none; }
}

/* نافذة منبثقة */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: none; align-items: center; justify-content: center; z-index: 60; padding: 20px;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 460px; padding: 24px;
  max-height: calc(100vh - 40px); overflow-y: auto; overscroll-behavior: contain;
}
.modal h3 { margin-bottom: 10px; }

/* =============================================================================
   ملخّص أخطاء النموذج
   ============================================================================= */
.alert.error-summary { display: block; }
.alert.error-summary .head { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.alert.error-summary ul { margin: 10px 0 0; padding-inline-start: 20px; }
.alert.error-summary li { margin-bottom: 5px; line-height: 1.55; }
.alert.error-summary li:last-child { margin-bottom: 0; }
.alert.error-summary a {
  color: inherit; font-weight: 700;
  text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.alert.error-summary .where { font-weight: 400; opacity: .85; }

/* إبراز الحقل الخاطئ عند القفز إليه */
.input.is-invalid, .select.is-invalid, .textarea.is-invalid {
  border-color: var(--danger);
  background: #FFFBFB;
}
@keyframes flashField {
  0%, 100% { box-shadow: 0 0 0 0 rgba(211, 47, 47, 0); }
  30%      { box-shadow: 0 0 0 4px rgba(211, 47, 47, .22); }
}
.field-flash { animation: flashField .9s ease-out 2; }

/* الصف المتكرّر الذي يحوي خطأ */
.repeat-row.has-error { border-color: var(--danger); background: #FFFBFB; }
.repeat-row .row-tag {
  position: absolute; top: 10px; inset-inline-start: 12px;
  font-size: 11.5px; font-weight: 700; color: var(--muted-light);
}
.repeat-row { padding-top: 30px; }

/* =============================================================================
   التذاكر
   ============================================================================= */
.prio { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--c); }
.prio i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }

/* شريط التقدّم */

/* النسخ */
.version { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.version.approved { border-color: var(--success); }
.version.rejected { border-color: #F3C7C7; }
.version.review   { border-color: var(--warning); box-shadow: 0 0 0 3px rgba(178,107,0,.08); }
.version-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: #FAFBFC; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.version-head .vn { font-weight: 700; font-size: 15px; }
.version-body { padding: 16px; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.file { border: 1px solid var(--border); border-radius: var(--radius-btn); overflow: hidden; background: #fff; text-decoration: none; color: inherit; display: block; }
.file:hover { border-color: var(--primary); text-decoration: none; }
.file .thumb { height: 110px; background: var(--bg); display: grid; place-items: center; font-size: 34px; overflow: hidden; }
.file .thumb img, .file .thumb video { width: 100%; height: 100%; object-fit: cover; }
.file .meta { padding: 8px 10px; font-size: 12px; }
.file .meta .n { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: start; }
.file .meta .s { color: var(--muted); }
.reject-box { background: var(--danger-bg); color: #A32020; padding: 10px 14px; border-radius: var(--radius-btn); font-size: 13px; margin-top: 12px; border-inline-start: 3px solid var(--danger); }

/* الملاحظات */
.comments { display: grid; gap: 12px; }
.comment { display: flex; gap: 12px; }
.comment .av { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--primary-light); color: var(--primary-dark); }
.comment.client .av { background: #FFF1DB; color: #8A5300; }
.comment .bubble { flex: 1; background: var(--bg); border-radius: var(--radius); padding: 10px 14px; }
.comment.internal .bubble { background: #FFFBEA; border: 1px dashed #E7C96A; }
.comment .who { font-size: 12.5px; font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.comment .who .t { color: var(--muted-light); font-weight: 400; }
.comment .body { font-size: 13.5px; margin-top: 4px; white-space: pre-wrap; }
.comment-form { display: grid; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }

/* رفع الملفات */
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); cursor: pointer; transition: .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-ghost); color: var(--primary-dark); }
.dropzone input { display: none; }
.upload-list { display: grid; gap: 6px; margin-top: 10px; }
.upload-item { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 8px 12px; background: var(--bg); border-radius: var(--radius-btn); }
.upload-item .bar { flex: 1; height: 5px; background: #fff; border-radius: 3px; overflow: hidden; }
.upload-item .bar i { display: block; height: 100%; background: var(--primary); }
.upload-item.ok .bar i { background: var(--success); }

/* خيارات الخدمة عند إنشاء تذكرة */
.svc-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.svc-opt { border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; background: #fff; transition: .12s; }
.svc-opt:hover { border-color: var(--primary); }
.svc-opt.on { border-color: var(--primary); background: var(--primary-ghost); box-shadow: 0 0 0 3px rgba(0,112,235,.12); }
.svc-opt.off { opacity: .5; cursor: not-allowed; }
.svc-opt .n { font-weight: 700; }
.svc-opt .a { font-size: 24px; font-weight: 700; color: var(--primary-dark); line-height: 1.2; }
.svc-opt .a small { font-size: 11px; color: var(--muted); font-weight: 500; }
.svc-opt .c { font-size: 11.5px; color: var(--muted); }
.svc-opt.off .a { color: var(--danger); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--border-strong); border-radius: var(--radius-pill); padding: 5px 14px; font-size: 13px; cursor: pointer; background: #fff; user-select: none; }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }

/* =============================================================================
   نوافذ الحوار الموحّدة (UI.confirm / UI.prompt / UI.choose)
   ============================================================================= */
.dlg-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); backdrop-filter: blur(2px); display: none; align-items: center; justify-content: center; z-index: 200; padding: 20px; }
.dlg-backdrop.show { display: flex; animation: dlgFade .15s ease-out; }
@keyframes dlgFade { from { opacity: 0 } to { opacity: 1 } }
.dlg { background: #fff; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.25); width: 100%; max-width: 460px; overflow: hidden; animation: dlgPop .18s cubic-bezier(.2,.9,.3,1.2); }
@keyframes dlgPop { from { transform: translateY(12px) scale(.97); opacity: 0 } to { transform: none; opacity: 1 } }
.dlg-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px 10px; }
.dlg-icon { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; flex: none; background: var(--primary-light); color: var(--primary-dark); }
.dlg.tone-danger  .dlg-icon { background: var(--danger-bg);  color: var(--danger); }
.dlg.tone-warning .dlg-icon { background: var(--warning-bg); color: var(--warning); }
.dlg.tone-success .dlg-icon { background: var(--success-bg); color: var(--success); }
.dlg-title { font-size: 16.5px; font-weight: 700; }
.dlg-body { padding: 4px 22px 8px; font-size: 14px; }
.dlg-msg { margin: 0 0 8px; line-height: 1.7; color: var(--text-2); white-space: pre-line; }
.dlg-list { margin: 6px 0 10px; padding: 0; list-style: none; display: grid; gap: 6px; }
.dlg-list li { padding: 8px 12px; background: var(--bg); border-radius: var(--radius-btn); font-size: 13.5px; display: flex; gap: 8px; }
.dlg-list li::before { content: '•'; color: var(--primary); font-weight: 700; }
.dlg.tone-danger .dlg-list li::before { color: var(--danger); }
.dlg-note { margin-top: 8px; padding: 9px 12px; border-radius: var(--radius-btn); font-size: 12.5px; background: var(--warning-bg); color: #8A5300; border-inline-start: 3px solid var(--warning); }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 22px 18px; }
.dlg-options { display: grid; gap: 8px; }
.dlg-opt { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 11px 14px; cursor: pointer; transition: .12s; }
.dlg-opt:hover { border-color: var(--primary); }
.dlg-opt.on { border-color: var(--primary); background: var(--primary-ghost); box-shadow: 0 0 0 3px rgba(0,112,235,.12); }
.dlg-opt input { margin-top: 3px; accent-color: var(--primary); }
.dlg-opt .l { font-weight: 700; } .dlg-opt .d { font-size: 12.5px; color: var(--muted); }

/* =========================================================================
   Combo — قائمة منسدلة قابلة للبحث (js/combo.js)
   ========================================================================= */
.combo { position: relative; }
.combo .combo-input { padding-inline-end: 34px; cursor: pointer; }
.combo.has-flag .combo-input { padding-inline-start: 38px; }
.combo .combo-flag { position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%); font-size: 18px; pointer-events: none; line-height: 1; }
.combo .combo-caret { position: absolute; inset-inline-end: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; cursor: pointer; user-select: none; }
.combo .combo-clear { position: absolute; inset-inline-end: 26px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); font-size: 17px; line-height: 1; cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.combo .combo-clear:hover { color: var(--danger); background: var(--danger-bg); }
.combo.disabled .combo-input { cursor: not-allowed; background: #F4F4F4; }
.combo.disabled .combo-caret { display: none; }
.combo .combo-list { display: none; position: absolute; z-index: 60; inset-inline: 0; top: calc(100% + 4px); max-height: 260px; overflow-y: auto; background: #fff; border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 4px; }
.combo.open .combo-list { display: block; }
.combo .combo-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 4px; cursor: pointer; font-size: 13.5px; }
.combo .combo-item .f { font-size: 18px; line-height: 1; }
.combo .combo-item .n { flex: 1; }
.combo .combo-item .s { color: var(--muted); font-size: 12px; }
.combo .combo-item.tone-danger .n, .combo .combo-item.tone-danger .s { color: var(--danger); } .combo .combo-item.tone-danger .n { font-weight: 700; }
.combo .combo-item.tone-warning .n, .combo .combo-item.tone-warning .s { color: #B26B00; }
.combo .combo-item:hover, .combo .combo-item.hi { background: var(--primary-light); }
.combo .combo-item.sel { font-weight: 700; color: var(--primary-dark); }
.combo .combo-item.dis { opacity: .45; cursor: not-allowed; }
.combo .combo-empty { color: var(--muted); border-bottom: 1px solid var(--border); border-radius: 0; margin-bottom: 4px; }
.combo .combo-none { padding: 12px; color: var(--muted); text-align: center; font-size: 13px; }

/* =========================================================================
   حقول التاريخ dd/mm/yyyy (js/dates.js)
   ========================================================================= */
.date-input { font-variant-numeric: tabular-nums; }
.date-input.is-invalid-date { border-color: var(--danger); background: var(--danger-bg); }
.date-pop { position: absolute; z-index: 90; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 28px rgba(0,0,0,.14); padding: 10px; width: 264px; direction: rtl; font-size: 13px; }
.date-pop .dp-head { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.date-pop .dp-nav { border: 1px solid var(--border); background: #fff; border-radius: 4px; width: 28px; height: 28px; cursor: pointer; font-size: 16px; line-height: 1; }
.date-pop .dp-sel { flex: 1; border: 1px solid var(--border); border-radius: 4px; padding: 4px 6px; font-family: inherit; font-size: 13px; background: #fff; }
.date-pop .dp-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; direction: ltr; }
.date-pop .dp-days b { text-align: center; color: var(--muted); font-size: 11px; padding: 2px 0 4px; }
.date-pop .dp-days button { border: 0; background: none; border-radius: 4px; height: 30px; cursor: pointer; font-family: inherit; font-size: 13px; color: var(--text); }
.date-pop .dp-days button:hover { background: var(--primary-light); }
.date-pop .dp-days button.today { font-weight: 700; color: var(--primary-dark); }
.date-pop .dp-days button.sel { background: var(--primary); color: #fff; font-weight: 700; }
.date-pop .dp-time { display: flex; align-items: center; gap: 6px; margin-top: 8px; direction: ltr; justify-content: flex-end; }
.date-pop .dp-time label { margin-inline-end: auto; color: var(--muted); font-size: 12px; }
.date-pop .dp-time input { width: 52px; border: 1px solid var(--border); border-radius: 4px; padding: 4px; text-align: center; font-family: inherit; }
.date-pop .dp-foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--border); }

/* =========================================================================
   الإشعارات (جرس الهيدر)
   ========================================================================= */
.notif-wrap { position: relative; }
.notif-count[hidden], .notif-panel[hidden] { display: none !important; }
.notif-count { position: absolute; top: 2px; inset-inline-end: 2px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; line-height: 1; }
.notif-panel { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; width: 360px; max-width: 92vw; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.16); z-index: 80; max-height: 70vh; overflow: auto; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.notif-item { display: block; padding: 10px 14px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: var(--primary-ghost); border-inline-start: 3px solid var(--primary); }
.notif-item .t { font-weight: 700; font-size: 13.5px; } .notif-item .b { font-size: 12.5px; color: var(--text-2); margin-top: 2px; } .notif-item .d { font-size: 11px; color: var(--muted); margin-top: 4px; }
.notif-empty { padding: 20px; text-align: center; color: var(--muted); font-size: 13px; }

/* =========================================================================
   شريط مراحل التذكرة (سير العمل) — خطوط وصل مستقلة بين الدوائر، المرحلة الحالية تنبض
   ========================================================================= */
.wf { display: flex; align-items: flex-start; padding: 10px 6px 4px; margin-bottom: 14px; overflow-x: auto; }
.wf .step { display: block; flex: 0 0 auto; width: 92px; position: relative; text-align: center; }
.wf .step .dot { width: 36px; height: 36px; border-radius: 50%; margin: 0 auto 8px; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: #fff; border: 2px solid #D5DAE0; color: #8A929B; transition: background .3s, border-color .3s, color .3s; }
.wf .step .lbl { font-size: 12.5px; color: #8A929B; white-space: nowrap; }
/* خط الوصل: عنصر مستقل يملأ الفراغ بين دائرتين ولا يمرّ فوقهما */
.wf .link { flex: 1 1 24px; min-width: 24px; height: 3px; margin-top: 17px; background: #E3E7EB; border-radius: 2px; }
.wf .link.done { background: var(--success); }
.wf .link.cur { background: linear-gradient(to left, var(--success), var(--primary)); }
[dir="ltr"] .wf .link.cur { background: linear-gradient(to right, var(--success), var(--primary)); }
.wf .step.done .dot { background: var(--success); border-color: var(--success); color: #fff; }
.wf .step.done .lbl { color: var(--success); font-weight: 600; }
.wf .step.cur .dot { background: var(--primary); border-color: var(--primary); color: #fff; animation: wfPulse 1.8s ease-out infinite; }
.wf .step.cur .lbl { color: var(--primary-dark); font-weight: 700; }
@keyframes wfPulse {
  0%   { box-shadow: 0 0 0 0 rgba(0, 112, 235, .55); }
  70%  { box-shadow: 0 0 0 14px rgba(0, 112, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 112, 235, 0); }
}
.wf-owner { display: flex; align-items: center; gap: 14px; background: linear-gradient(90deg, var(--primary-ghost), #fff); border: 1px solid var(--primary-light); border-inline-start: 4px solid var(--primary); border-radius: 8px; padding: 12px 16px; font-size: 13.5px; }
.wf-owner .av { width: 42px; height: 42px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 16px; flex: none; }
.wf-owner .who b { font-size: 14.5px; } .wf-owner .who .s { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.wf-owner.me { background: linear-gradient(90deg, var(--success-bg), #fff); border-color: #A5D6A7; border-inline-start-color: var(--success); } .wf-owner.me .av { background: var(--success); }
.wf-owner.done { background: var(--bg); border-color: var(--border); border-inline-start-color: var(--muted); } .wf-owner.done .av { background: var(--muted); }
.wf-pill { display: inline-block; font-size: 11.5px; padding: 2px 9px; border-radius: 999px; background: var(--primary-light); color: var(--primary-dark); white-space: nowrap; vertical-align: middle; }
.wf-pill.me { background: var(--success); color: #fff; font-weight: 700; animation: wfBlink 1.4s ease-in-out infinite; }
@keyframes wfBlink { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.wf-live { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-inline-end: 6px; vertical-align: middle; animation: wfPulse 1.8s ease-out infinite; }
.wf-owner.me .wf-live { background: var(--success); }

/* =========================================================================
   مواد العميل (الصور الخام) داخل التذكرة
   ========================================================================= */
.materials { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.material { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; position: relative; }
.material .thumb { display: block; height: 110px; background: #f1f3f5; display: grid; place-items: center; overflow: hidden; font-size: 28px; }
.material .thumb img, .material .thumb video { width: 100%; height: 100%; object-fit: cover; }
.material .meta { padding: 6px 8px; } .material .meta .n { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: ltr; text-align: start; }
.material .meta .s { font-size: 11px; color: var(--muted); }
.material .icon-btn { position: absolute; top: 4px; inset-inline-end: 4px; background: rgba(255,255,255,.9); border-radius: 50%; width: 24px; height: 24px; font-size: 12px; }
.rev-badge { display: inline-block; font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--bg); color: var(--text-2); }
.rev-badge.warn { background: var(--warning-bg); color: #8A5300; font-weight: 700; }
.rev-badge.paid { background: var(--danger-bg); color: var(--danger); font-weight: 700; }

/* =============================================================================
   جدول المواعيد الأسبوعي للمصمّمين (js/slot-picker.js)
   ============================================================================= */
.slot-pick { background: var(--success-bg); border: 1px solid #A5D6A7; border-radius: 8px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 12px; }
.slot-pick.none { background: var(--bg); border-color: var(--border); color: var(--muted); }
.slot-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.slot-nav .slot-week { font-weight: 700; font-size: 13.5px; }
.slot-legend { margin-inline-start: auto; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.slot-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--border-strong); margin-inline-start: 8px; }
.slot-legend i.free { background: #fff; border-color: #9CCB9F; } .slot-legend i.busy { background: #FFF1D6; border-color: #E5B65A; }
.slot-legend i.done { background: #E3F2E6; border-color: #7CB87F; } .slot-legend i.sel { background: var(--primary); border-color: var(--primary); }
.slot-table-wrap { overflow: auto; max-height: 520px; border: 1px solid var(--border); border-radius: 8px; }
.slot-table { border-collapse: separate; border-spacing: 0; font-size: 12.5px; min-width: 860px; width: 100%; table-layout: fixed; }
.slot-table th, .slot-table td { border-bottom: 1px solid var(--border); border-inline-start: 1px solid var(--border); padding: 4px; vertical-align: top; }
.slot-table th { background: var(--bg); position: sticky; top: 0; z-index: 2; text-align: center; padding: 8px 4px; font-weight: 400; color: var(--text-2); }
.slot-table th b { display: block; font-size: 13px; color: var(--text); } .slot-table th span { font-size: 11.5px; color: var(--muted); }
.slot-table th em { display: inline-block; font-style: normal; font-size: 10.5px; background: var(--primary); color: #fff; border-radius: 999px; padding: 0 8px; margin-top: 2px; }
.slot-table th.today b { color: var(--primary); } .slot-table th.off { color: var(--muted); background: #F6F6F6; }
.slot-table .tcol { width: 62px; text-align: center; color: var(--muted); font-size: 11.5px; background: var(--bg); position: sticky; inset-inline-start: 0; z-index: 1; vertical-align: middle; }
.slot-table th.tcol { z-index: 3; }
.slot-table td.today { background: #F3F8FF; } .slot-table td.off { background: #F6F6F6; text-align: center; color: var(--muted); font-size: 11px; vertical-align: middle; }
.slot-table td.off .off-lbl { opacity: .6; }
.sl-cell { display: flex; flex-direction: column; gap: 3px; min-height: 26px; }
.sl { display: block; width: 100%; box-sizing: border-box; border-radius: 5px; padding: 3px 6px; font-family: inherit; font-size: 12px; line-height: 1.4; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.sl small { font-size: 10px; opacity: .75; }
.sl.free { background: #fff; border: 1px solid #9CCB9F; color: #2E7D32; cursor: pointer; }
.sl.free:hover { background: #E8F5E9; border-color: #2E7D32; }
.sl.free.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.sl.busy { background: #FFF1D6; border: 1px solid #E5B65A; color: #7A4B00; cursor: default; }
a.sl.busy[href], a.sl.done[href] { cursor: pointer; } a.sl.busy[href]:hover { background: #FFE6B8; }
.sl.done { background: #E3F2E6; border: 1px solid #7CB87F; color: #1B5E20; }
.sl.past { background: transparent; color: #C4C9CE; border: 1px dashed #E3E7EB; }
.sl.gap { background: transparent; color: #C4C9CE; border: 1px dotted #E3E7EB; }
.sl.na { border: 0; background: transparent; }

/* Combo: تلوين صفوف بتنبيه (أحمر: أقساط متأخرة/غير مفعّل، برتقالي: بلا عقد) */
.combo-item.tone-danger .n { color: var(--danger); font-weight: 700; } .combo-item.tone-danger .s { color: var(--danger); }
.combo-item.tone-warning .n { color: #B26B00; } .combo-item.tone-warning .s { color: #B26B00; }
.combo-input.tone-danger { border-color: var(--danger); color: var(--danger); font-weight: 700; }

/* أعمدة المبالغ في كل الجداول: الرأس والخلايا بنفس المحاذاة (يسار، أرقام لاتينية ثابتة العرض) */
table.data th.money, table.data td.money, table.data th.num, table.data td.num { text-align: left; direction: ltr; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* =============================================================================
   طبقة الموبايل (قرار المستخدم 2026-09-27)
   الجداول تصير بطاقات، والعناصر تتكدّس عموديًا — يعمل مع js/mobile.js
   ============================================================================= */
@media (max-width: 720px) {
  /* --- الجداول كبطاقات --- */
  .table-wrap { overflow-x: visible; }
  table.data.mstack { display: block; width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
  table.data.mstack td, table.data.mstack td * { white-space: normal !important; overflow-wrap: anywhere; }
  table.data.mstack td > span, table.data.mstack td > div { max-width: 100%; }
  table.data.mstack thead { display: none; }
  table.data.mstack tbody, table.data.mstack tfoot { display: block; }
  table.data.mstack tr {
    display: block; background: #fff; border: 1px solid var(--border);
    border-radius: 12px; padding: 10px 12px; margin: 0 0 10px;
    box-shadow: 0 1px 2px rgba(16,24,40,.04);
  }
  table.data.mstack tbody tr:hover { background: #fff; }
  table.data.mstack td {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
    padding: 7px 0; border: 0; border-bottom: 1px dashed var(--border); text-align: start;
  }
  table.data.mstack tr td:last-child { border-bottom: 0; padding-bottom: 0; }
  table.data.mstack tr td:first-child { padding-top: 0; }
  table.data.mstack td::before {
    content: attr(data-label);
    flex: 0 0 38%; max-width: 38%;
    color: var(--muted); font-size: 12px; font-weight: 700; line-height: 1.7;
  }
  table.data.mstack td:not([data-label])::before { content: none; }
  table.data.mstack td > * { min-width: 0; }
  table.data.mstack td.num, table.data.mstack td.money { direction: ltr; text-align: end; }
  table.data.mstack td.center { justify-content: space-between; }
  /* أول خلية = عنوان البطاقة */
  table.data.mstack tbody tr td:first-child { font-weight: 600; font-size: 14.5px; padding-bottom: 9px; }
  table.data.mstack tbody tr td:first-child::before { display: none; }
  /* خلية الأدوات والخلايا الفارغة */
  table.data.mstack td.m-acts { justify-content: flex-start; flex-wrap: wrap; gap: 8px; padding-top: 10px; }
  table.data.mstack td.m-acts::before { content: none; }
  table.data.mstack td.m-empty { display: none; }
  table.data.mstack tr.m-full td { display: block; text-align: center; }
  table.data.mstack tr.m-full { padding: 0; }
  table.data.mstack .cell-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  table.data.mstack .cell-actions .link-btn { padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
  table.data.mstack tfoot tr { background: var(--bg); font-weight: 700; }

  /* --- ترويسة الصفحة والأزرار --- */
  .page-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .page-head .actions, .row-between > .actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .page-head .actions .btn, .page-head .actions > a { flex: 1 1 auto; justify-content: center; }
  h1 { font-size: 22px; }

  /* --- النماذج والفلاتر --- */
  .form-grid, .grid2, .grid2b, .layout { grid-template-columns: 1fr !important; }
  /* عناصر الشبكة لا تتمدّد بعرض محتواها فتدفع الصفحة أفقيًا */
  .layout, .grid2, .grid2b, .form-grid, .kpis, .stat-grid, .pipeline { min-width: 0; }
  .layout > *, .grid2 > *, .grid2b > *, .form-grid > *, .card, .card > *, .col, section { min-width: 0; max-width: 100%; }
  .toolbar { padding: 12px; }
  .toolbar .input, .toolbar .select, .toolbar .search-box { flex: 1 1 100%; min-width: 0; max-width: none; }
  /* صفوف الفترة (من/إلى) تلتفّ ولا تدفع الصفحة */
  .toolbar .period, .period { display: flex; flex-wrap: wrap; width: 100%; gap: 6px; }
  .period .input { width: auto !important; flex: 1 1 130px; min-width: 0; }
  .toolbar > * { max-width: 100%; }
  .input, .select, .textarea { font-size: 16px; }          /* يمنع تكبير iOS التلقائي */
  .btn { min-height: 42px; }
  .field { margin-bottom: 14px; }

  /* --- النوافذ المنبثقة --- */
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { max-width: 100%; border-radius: 16px 16px 0 0; max-height: 92vh; padding: 18px 16px; }
  .pay-modal { max-height: 94vh; }
  .pay-modal form, .pay-modal .pm-done { padding: 0 16px 18px; }
  .pm-head { padding: 16px; }
  .pm-summary { grid-template-columns: 1fr !important; padding: 12px 16px; gap: 8px; }

  /* --- بطاقات الأرقام والتبويبات --- */
  .stat-grid, .kpis, .pipeline, .cards, .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
  .kpi .v, .stat .v { font-size: 22px; }
  .kpi { padding: 12px 12px 10px; }
  .chart svg { height: 180px; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .tabs .tab { white-space: nowrap; }
  .quick { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .quick button { white-space: nowrap; }
  .app-main { padding-inline: 14px; }
  /* ترويسة مضغوطة: الصورة فقط بلا اسم/دور */
  .app-header { gap: 8px; padding: 0 12px; }
  .user-chip .who { display: none; }
  .user-chip { padding: 4px; border: 0; }
  .app-header .brand { min-width: 0; overflow: hidden; }
  .app-header .brand > span:not(.mark) { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .app-header .brand .mark, .app-header .brand img { flex: none; }
  .app-header > * { flex: none; }
  .app-header .brand { flex: 1 1 auto; }
}

/* زر ظاهر لكن غير قابل للضغط، ويحمل سبب التعطيل (قرار 2026-10-01) */
.btn.is-disabled {
  opacity: .55; cursor: not-allowed; pointer-events: none;
  background: var(--bg); color: var(--muted); border-color: var(--border);
}
.btn.is-disabled .text-xs { font-weight: 400; }

/* بند قائمة يفتح ملفًا خارجيًا (دليل الاستخدام) */
.nav-item .ext-mark { margin-inline-start: auto; font-size: 11px; opacity: .55; }

/* حقل ظاهر لكنه غير قابل للتعديل (سعر الباقة المفتوحة لغير مدير النظام) */
.input.is-locked { background: var(--bg); color: var(--muted); cursor: not-allowed; }
