:root {
  --bg: #faf5ef; --surface: #faf5ef; --text: #3a3235; --muted: #6e6266; --line: #ece0da;
  --accent: #1F3A5F; --accent-d: #16304E; --accent-soft: #E4EAF2; --danger: #c04a4a;
  --sage: #4e7d54; --sage-soft: #e4efe2; --gold: #a8842e; --gold-soft: #f7ecd4;
  --shadow: 0 2px 14px rgba(90,60,60,.07); --shadow-lg: 0 20px 60px rgba(90,60,60,.18);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Cairo', 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--danger); font-size: 0.9rem; margin-top: 8px; }

/* تسجيل الدخول */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { background: #fff; padding: 40px 36px; border-radius: 28px; width: 380px; max-width: calc(100vw - 32px); text-align: center; box-shadow: var(--shadow-lg); }
.login-card h1 { color: var(--text); margin-bottom: 4px; font-size: 1.9rem; font-weight: 800; letter-spacing: -0.01em; }
.login-card a { color: var(--accent); text-decoration: none; }
.login-card a:hover { text-decoration: underline; }
.login-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }
.login-card input { padding: 13px 16px; border: 1px solid var(--line); background: var(--bg); border-radius: 14px; outline: none; font-family: inherit; font-size: 1rem; color: var(--text); }
.login-card button { padding: 13px; background: var(--accent); color: #fff; border: none; border-radius: 980px; font-family: inherit; font-size: 1rem; font-weight: 700; cursor: pointer; }
.login-card button:hover { background: var(--accent-d); }
.login-card input:focus { border-color: var(--accent); background: #fff; }
.login-card .btn { display: inline-block; padding: 12px 28px; border-radius: 980px; text-decoration: none; }

/* الهيكل */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 236px; background: #fff; color: var(--text); display: flex; flex-direction: column; padding: 22px 12px; position: sticky; top: 0; height: 100vh; border-left: 1px solid var(--line); }
.logo { font-size: 1.6rem; font-weight: 800; text-align: center; margin-bottom: 4px; letter-spacing: -0.01em; color: var(--accent-d); }
.logo small { display: block; font-size: 0.8rem; font-weight: 500; color: var(--muted); margin-top: 2px; }
.sidebar .logo { margin-bottom: 20px; }
#nav { flex: 1; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
#nav button { background: none; border: none; color: var(--text); padding: 10px 14px; text-align: right; font-family: inherit; font-size: 0.95rem; cursor: pointer; border-radius: 12px; transition: background .15s; display: flex; align-items: center; gap: 10px; }
#nav button:hover { background: var(--bg); }
#nav button.active { background: var(--accent-soft); color: var(--accent-d); font-weight: 700; }
#nav button .nav-ic { flex: 0 0 20px; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
#nav button.active .nav-ic { color: var(--accent-d); }
#nav button .nav-ic svg { width: 20px; height: 20px; }
.sidebar-footer { padding: 14px 8px 0; border-top: 1px solid var(--line); }
.user-badge { font-size: 0.9rem; margin-bottom: 8px; }
.user-badge .role { display: inline-block; background: var(--accent-soft); color: var(--accent-d); border-radius: 980px; padding: 1px 10px; font-size: 0.75rem; margin-right: 6px; font-weight: 700; }
.link-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-family: inherit; font-size: 0.85rem; display: block; margin-top: 4px; }
.link-btn:hover { color: var(--accent-d); }

/* كارت التجربة في القائمة الجانبية */
.trial-card { background: var(--accent-soft); border-radius: 16px; padding: 14px; margin-bottom: 12px; }
.trial-card .tc-t { font-weight: 800; font-size: 0.92rem; margin-bottom: 2px; }
.trial-card .tc-s { color: var(--muted); font-size: 0.8rem; margin-bottom: 10px; }
.trial-card .tc-b { display: block; text-align: center; background: var(--accent); color: #fff; border-radius: 980px; padding: 8px 10px; font-size: 0.85rem; font-weight: 700; text-decoration: none; }
.trial-card .tc-b:hover { background: var(--accent-d); }

.main { flex: 1; padding: 28px 36px 40px; overflow-x: hidden; }
.page-title { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 20px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.toolbar input, .toolbar select { padding: 10px 16px; border: 1px solid var(--line); border-radius: 14px; font-family: inherit; font-size: 0.95rem; background: #fff; outline: none; color: var(--text); }
.toolbar input:focus, .toolbar select:focus { border-color: var(--accent); }

/* الشريط العلوي */
.topbar { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar .tb-hi { flex: 1 1 260px; min-width: 200px; }
.tb-greet { font-size: 1.45rem; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.tb-greet svg { width: 24px; height: 24px; color: var(--gold); flex: 0 0 24px; }
.tb-sub { color: var(--muted); font-size: 0.9rem; margin-top: 2px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tb-sub .tb-week { background: var(--accent-soft); color: var(--accent-d); border-radius: 980px; padding: 1px 12px; font-weight: 700; font-size: 0.82rem; }
.tb-search { flex: 1 1 260px; max-width: 460px; position: relative; }
.tb-search svg { position: absolute; top: 50%; right: 14px; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.tb-search input { width: 100%; padding: 11px 42px 11px 16px; border: 1px solid var(--line); background: #fff; border-radius: 980px; outline: none; font-family: inherit; font-size: 0.93rem; color: var(--text); box-shadow: var(--shadow); }
.tb-search input:focus { border-color: var(--accent); }

/* أزرار */
.btn { padding: 9px 20px; background: var(--accent); color: #fff; border: none; border-radius: 980px; font-family: inherit; font-size: 0.95rem; font-weight: 700; cursor: pointer; }
.btn:hover { background: var(--accent-d); }
.btn.secondary { background: #f0e8e2; color: var(--text); }
.btn.secondary:hover { background: #e7dcd4; }
.btn.danger { background: var(--danger); }
.btn.small { padding: 5px 12px; font-size: 0.85rem; }

/* الجداول */
.card { background: #fff; border-radius: 22px; padding: 22px; box-shadow: var(--shadow); margin-bottom: 18px; }
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th { text-align: right; padding: 10px 12px; color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid #f4ebe6; }
tr:hover td { background: #fbf7f2; }
tr.clickable { cursor: pointer; }
.inline-select { padding: 5px 10px; border: 1px solid var(--line); border-radius: 10px; font-family: inherit; font-size: 0.85rem; background: #fff; cursor: pointer; max-width: 120px; }

/* بادجات */
.badge { display: inline-block; padding: 2px 12px; border-radius: 980px; font-size: 0.8rem; font-weight: 700; white-space: nowrap; }
.badge.st-مبدئي, .badge.st-تجهيز, .badge.ins-محتجز { background: var(--gold-soft); color: #8a6a1c; }
.badge.st-تسليم, .badge.st-تم_الاستلام { background: #efe6f7; color: #6b4a9e; }
.badge.st-استلام, .badge.st-مؤكد, .badge.ins-مدفوع { background: var(--accent-soft); color: var(--accent-d); }
.badge.st-مؤجل { background: #fbe9dd; color: #b25a2a; }
.badge.st-مراجعة, .badge.st-تم_التسليم, .badge.st-مكتمل, .badge.ins-مسترد { background: var(--sage-soft); color: #3f6b45; }
.badge.st-ملغي { background: #f9e3e3; color: var(--danger); }
.badge.ins-مش-مدفوع { background: #f9e3e3; color: var(--danger); }
.badge.ins-لا-يوجد-تأمين { background: #ece7e2; color: #8a8178; }

/* إحصائيات */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: #fff; border-radius: 22px; padding: 20px; box-shadow: var(--shadow); }
.stat-card .num { font-size: 1.8rem; font-weight: 800; color: var(--text); letter-spacing: -0.01em; }
.stat-card .lbl { color: var(--muted); font-size: 0.88rem; }

/* كروت إحصائيات الرئيسية */
.h-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.h-stat { background: #fff; border-radius: 22px; padding: 18px 20px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 14px; cursor: pointer; transition: transform .12s; }
.h-stat:hover { transform: translateY(-2px); }
.h-stat .h-ic { flex: 0 0 46px; width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center; }
.h-stat .h-ic svg { width: 22px; height: 22px; }
.h-stat .h-ic.rose { background: var(--accent-soft); color: var(--accent-d); }
.h-stat .h-ic.sage { background: var(--sage-soft); color: var(--sage); }
.h-stat .h-ic.gold { background: var(--gold-soft); color: var(--gold); }
.h-stat .h-ic.purple { background: #efe6f7; color: #6b4a9e; }
.h-stat .num { font-size: 1.55rem; font-weight: 800; line-height: 1.2; }
.h-stat .lbl { color: var(--muted); font-size: 0.85rem; }
.h-stat .sub { color: var(--sage); font-size: 0.78rem; font-weight: 700; }

/* الرئيسية: صفوف الحجوزات الجاية */
.booking-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f4ebe6; cursor: pointer; }
.booking-row:last-child { border-bottom: none; }
.bk-av { flex: 0 0 42px; width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1rem; }
.bk-av.c0 { background: var(--accent-soft); color: var(--accent-d); }
.bk-av.c1 { background: var(--sage-soft); color: var(--sage); }
.bk-av.c2 { background: var(--gold-soft); color: var(--gold); }
.bk-av.c3 { background: #efe6f7; color: #6b4a9e; }
.bk-av.c4 { background: #fbe9dd; color: #b25a2a; }
.booking-row .bk-main { flex: 1; min-width: 0; }
.booking-row .bk-name { font-weight: 800; font-size: 0.95rem; }
.booking-row .bk-det { color: var(--muted); font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pay-badge { display: inline-block; padding: 3px 12px; border-radius: 980px; font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.pay-badge.pb-gold { background: var(--gold-soft); color: #8a6a1c; }
.pay-badge.pb-pink { background: #fbe4e6; color: #b2545a; }
.pay-badge.pb-green { background: var(--sage-soft); color: #3f6b45; }
.pay-badge.pb-purple { background: #efe6f7; color: #6b4a9e; }

/* الرئيسية: إجراءات سريعة + كارت البوت */
.qa-grid { display: flex; flex-direction: column; gap: 10px; }
.qa-btn { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 16px; border: 1px solid var(--line); background: #fff; font-family: inherit; font-size: 0.95rem; font-weight: 700; color: var(--text); cursor: pointer; text-align: right; }
.qa-btn svg { width: 20px; height: 20px; flex: 0 0 20px; }
.qa-btn:hover { background: var(--bg); }
.qa-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.qa-btn.primary:hover { background: var(--accent-d); }
.bot-card { background: #fbf3dd; border: 1px solid #f0e2bb; border-radius: 16px; padding: 14px 16px; display: flex; gap: 12px; align-items: center; }
.bot-card svg { width: 26px; height: 26px; flex: 0 0 26px; color: var(--gold); }
.bot-card .bc-t { font-weight: 800; font-size: 0.92rem; }
.bot-card .bc-s { color: #7a6a3a; font-size: 0.82rem; }
.bot-card .bc-b { margin-right: auto; background: none; border: none; color: var(--gold); font-family: inherit; font-weight: 800; font-size: 0.85rem; cursor: pointer; white-space: nowrap; }
.home-cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
.home-cols .card { margin-bottom: 0; }

/* تنبيهات */
.alert-item { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 18px; padding: 14px 18px; margin-bottom: 10px; box-shadow: var(--shadow); border-right: 4px solid var(--accent); }
.alert-item.danger { border-right-color: var(--danger); }
.alert-item.important { border-right-color: var(--gold); }
.alert-item.success { border-right-color: var(--sage); }
.alert-item .kind { font-weight: 800; min-width: 110px; }
.alert-item.clickable { cursor: pointer; }

/* المحادثات */
.conv-layout { display: grid; grid-template-columns: 340px 1fr; gap: 16px; }
.conv-list { max-height: calc(100vh - 220px); overflow-y: auto; }
.conv-close { display: none; }
.conv-item { background: #fff; border-radius: 18px; box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 8px; cursor: pointer; border: 2px solid transparent; }
.conv-item.active { border-color: var(--accent); }
.conv-item .name { font-weight: 800; }
.chat-box { background: #fff; border-radius: 22px; box-shadow: var(--shadow); padding: 18px; display: flex; flex-direction: column; max-height: calc(100vh - 220px); }
.chat-messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 6px 0; }
.msg { max-width: 75%; padding: 9px 14px; border-radius: 14px; font-size: 0.93rem; line-height: 1.6; }
.msg.client { background: var(--bg); align-self: flex-start; }
.msg.bot { background: var(--accent-soft); align-self: flex-end; }
.msg.agent { background: var(--accent); color: #fff; align-self: flex-end; }
.msg .meta { display: block; font-size: 0.78rem; opacity: 0.65; margin-top: 3px; }
.chat-input { display: flex; gap: 8px; margin-top: 12px; }
.chat-input input { flex: 1; padding: 10px 16px; border: 1px solid var(--line); border-radius: 980px; outline: none; font-family: inherit; font-size: 0.95rem; background: #fff; color: var(--text); }

/* المودال */
.modal { position: fixed; inset: 0; background: rgba(58,50,53,0.4); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-box { background: #fff; border-radius: 28px; box-shadow: var(--shadow-lg); width: 640px; max-width: 100%; max-height: 90vh; overflow-y: auto; padding: 24px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.close-btn { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--muted); }

/* الفورمات */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.m-status { display: none; }
.form-grid.dates-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid .full { grid-column: 1 / -1; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus { border-color: var(--accent); background: #fff; }
.form-grid label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; padding: 10px 14px; border: 1px solid var(--line); background: var(--bg); border-radius: 14px; outline: none; font-family: inherit; font-size: 0.95rem; color: var(--text); }
.form-actions { display: flex; gap: 10px; margin-top: 16px; justify-content: flex-end; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 6px 16px; border-radius: 20px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-family: inherit; font-size: 0.88rem; color: var(--text); }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* مهام */
.task-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f4ebe6; }
.task-row.done .task-name { text-decoration: line-through; color: var(--muted); }

/* توست */
.toast { position: fixed; bottom: 24px; right: 50%; transform: translateX(50%); background: var(--text); color: #fff; padding: 12px 28px; border-radius: 980px; z-index: 8500; box-shadow: 0 8px 24px rgba(90,60,60,0.25); }
.toast.err { background: var(--danger); }

.section-title { font-size: 1.1rem; font-weight: 800; margin: 20px 0 10px; }
.summary-box { background: var(--bg); border-radius: 16px; padding: 12px 16px; font-size: 0.9rem; line-height: 1.8; }

/* شريط التنقل السفلي للموبايل */
.bottom-nav { display: none; }
.bn-sheet { position: fixed; inset: 0; background: rgba(58,50,53,0.4); z-index: 150; display: flex; align-items: flex-end; }
.bn-sheet .bn-panel { background: #fff; border-radius: 22px 22px 0 0; width: 100%; max-height: 70vh; overflow-y: auto; padding: 16px; }
.bn-panel .bn-t { font-weight: 800; margin-bottom: 10px; padding: 0 6px; }
.bn-panel button { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: none; font-family: inherit; font-size: 1rem; padding: 12px 10px; border-radius: 12px; cursor: pointer; color: var(--text); text-align: right; }
.bn-panel button:hover { background: var(--bg); }
.bn-panel button .nav-ic { width: 20px; height: 20px; color: var(--muted); display: inline-flex; }
.bn-panel button .nav-ic svg { width: 20px; height: 20px; }
.bn-panel .bn-acct { position: sticky; top: -16px; z-index: 2; background: #fff; margin: -16px -16px 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.bn-acct .bn-who { font-weight: 800; margin-bottom: 8px; }
.bn-acct .bn-who .role { font-weight: 600; font-size: .8rem; color: var(--muted); margin-inline-start: 6px; }
.bn-acct .bn-acts { display: flex; gap: 8px; }
.bn-panel .bn-acct .bn-acts button { width: auto; flex: 1; justify-content: center; padding: 10px 8px; font-size: .92rem; font-weight: 700; background: var(--bg); border-radius: 12px; }
.bn-panel .bn-acct .bn-acts #bn-logout { background: #fdecec; color: #c0392b; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { padding: 18px 14px 110px; }
  .topbar { gap: 12px; margin-bottom: 16px; }
  .tb-greet { font-size: 1.2rem; }
  .tb-search { flex-basis: 100%; max-width: none; order: 3; }
  .h-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .h-stat { padding: 14px; gap: 10px; }
  .h-stat .h-ic { flex-basis: 38px; width: 38px; height: 38px; border-radius: 12px; }
  .h-stat .num { font-size: 1.25rem; }
  .home-cols { grid-template-columns: 1fr; }
  .conv-layout { grid-template-columns: 1fr; }
  .conv-close { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--accent-d); font-size: 1rem; cursor: pointer; padding: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid.dates-3 { grid-template-columns: 1fr; }
  .m-status { display: block; margin-top: 6px; }
  .m-status .inline-select { width: 100%; font-size: .78rem; padding: 4px 6px; }
  .bottom-nav { display: flex; position: fixed; bottom: 0; right: 0; left: 0; background: #fff; border-top: 1px solid var(--line); z-index: 90; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -2px 14px rgba(90,60,60,.07); }
  .bottom-nav button { flex: 1; background: none; border: none; font-family: inherit; font-size: 0.75rem; color: var(--muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; font-weight: 700; }
  .bottom-nav button svg { width: 21px; height: 21px; }
  .bottom-nav button.active { color: var(--accent-d); }
}

.tasks-box { margin-top: 14px; }
.tasks-box summary { cursor: pointer; font-weight: 700; margin-bottom: 6px; }

/* ===== mobile audit fixes 2026-11-29 ===== */
.d-ph { display: none; }
.file-ar { display: none; }
@media (max-width: 900px) {
  /* 1) أي جدول بيتسكرول أفقي جوه الكارت بدل ما يتقطع */
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .card > .table-scroll { margin: 0 -4px; }
  /* 2) صف الفلاتر (التقارير/المصاريف/غيرها) يلتف والملفات بعرض مناسب */
  .toolbar { gap: 8px; }
  .toolbar input, .toolbar select { flex: 1 1 44%; min-width: 0; max-width: 100%; }
  .toolbar label.muted { flex: 0 0 auto; }
  /* 4) أهداف لمس أكبر */
  input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; }
  .toolbar input, .toolbar select { min-height: 38px; }
  select.inline-select { min-height: 32px; }
  .close-btn { width: 40px; height: 40px; font-size: 1.15rem; line-height: 1; border-radius: 10px; }
  /* 7) هيدر المودال ثابت فوق فتقدر تقفل من أي مكان */
  .modal-head { position: sticky; top: -2px; z-index: 6; background: #fff; padding-top: 4px; }
  /* 5) بديل عربي لحقول التاريخ/الشهر */
  .d-wrap { position: relative; display: block; width: 100%; }
  .d-wrap input[type="date"], .d-wrap input[type="month"] { width: 100%; }
  .d-ph { display: block; position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: #b3a29c; font-size: .82rem; pointer-events: none; }
  input[type="date"].is-empty::-webkit-datetime-edit, input[type="month"].is-empty::-webkit-datetime-edit { color: transparent; }
  /* 5) زرار رفع الصورة عربي */
  .file-ar { display: inline-flex; align-items: center; gap: 8px; background: #f7f0e9; border: 1px dashed #dcc9bf; border-radius: 12px; padding: 11px 16px; font-size: .85rem; color: #8a6f68; font-weight: 600; cursor: pointer; max-width: 100%; }
  .file-ar input[type="file"] { display: none; }
  .file-ar .file-ar-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
  /* 3) مساحة أسفل المحتوى فوق الشريط السفلي */
  .main { padding-bottom: 132px; }
}
@media (max-width: 900px) {
  .d-wrap input:not(.is-empty) + .d-ph { display: none; }
  .toolbar label.muted { flex: 0 0 100%; margin: 0 0 -6px; font-size: .78rem; }
  input[type="checkbox"], input[type="radio"] { width: 20px !important; height: 20px !important; }
}

/* ===== mobile audit 2 (2026-11-29) ===== */
@media (max-width: 900px) {
  /* كتالوج: عمودين وصور أصغر */
  #cat-body > div[style*="grid"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
  #cat-body > div[style*="grid"] img, #cat-body > div[style*="grid"] > .card > div[style*="height:190px"] { height: 130px !important; }
  #cat-body .card { padding: 8px !important; }
  label:has(> #cat-all) { display: flex; align-items: center; gap: 8px; flex: 0 0 100%; }
  .card:has(#cat-turn) { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .card:has(#cat-turn) > label { flex: 0 0 100%; }
  /* سجل النشاط: كل فلتر بعرض كامل */
  #af-user, #af-type, #af-from, #af-to, #af-q { width: 100%; min-height: 44px; box-sizing: border-box; font-size: 1rem; padding: 8px 10px; }
  div:has(> :is(#af-user, #af-type, #af-from, #af-to, #af-q)), div:has(> .d-wrap > :is(#af-from, #af-to)) { flex: 1 1 100% !important; min-width: 0 !important; }
  div:has(> :is(#af-user, #af-type, #af-from, #af-to, #af-q)) > label, div:has(> .d-wrap > :is(#af-from, #af-to)) > label { display: block; margin-bottom: 4px; font-size: .85rem; }
  /* ربحية القطع: عمود القطعة أوسع */
  div[style*="overflow-x:auto"] > table th:first-child, div[style*="overflow-x:auto"] > table td:first-child { min-width: 200px; }
  /* خانات الاختيار */
  input[type="checkbox"], input[type="radio"] { min-width: 20px !important; width: 20px !important; height: 20px !important; }
}
@media (max-width: 900px) {
  .toolbar input[type="checkbox"] { flex: 0 0 20px !important; min-height: 20px !important; }
}
@media (max-width: 900px) {
  .table-scroll > table td:first-child:has(> div > img[src*="/photo"]) { min-width: 210px; }
}

/* ===== polish 2026-11-29 ===== */
.pd-lbl { font-size: .8rem; color: var(--muted); margin-top: 4px; flex: 0 0 100%; width: 100%; }
body.pg-not-home .tb-week { display: none !important; }
#shops-table td:last-child > button:not(.sh-more) { display: none; }
.sh-more { min-width: 44px; font-size: 1.2rem; line-height: 1; padding: 6px 12px; }
.sh-new { background: #ff3b30; color: #fff; border-radius: 980px; padding: 0 8px; font-size: .7rem; font-weight: 700; margin-inline-start: 6px; }
#sh-menu { position: fixed; z-index: 9990; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 150px; display: flex; flex-direction: column; }
#sh-menu button { background: none; border: 0; text-align: start; padding: 11px 14px; font-family: inherit; font-size: .95rem; border-radius: 10px; cursor: pointer; color: var(--text); }
#sh-menu button:hover { background: var(--accent-soft); }
#sh-menu button.danger { color: #b3261e; }
.cal-n { display: none; }
.cal-nav { display: flex; align-items: center; gap: 10px; justify-content: center; }
.cal-nav .btn { white-space: nowrap; }
.bn-cnt { background: #ff3b30; color: #fff; border-radius: 980px; padding: 0 7px; font-size: .72rem; font-weight: 700; margin-inline-start: 6px; }
@media (max-width: 900px) {
  #cal-grid > .card > div { min-width: 0 !important; gap: 3px !important; }
  #cal-grid .cal-cell { min-height: 54px !important; padding: 3px 2px !important; text-align: center; }
  #cal-grid .cal-cell > div:not(:first-child) { display: none !important; }
  #cal-grid .cal-n { display: inline-block; background: var(--accent-soft, #f3dede); color: var(--accent-d, #8a4a4a); border-radius: 980px; padding: 0 7px; font-size: .78rem; font-weight: 700; margin-top: 4px; }
  #cal-grid .cal-h { font-size: .78rem !important; padding: 2px 0 !important; }
  .cal-nav .cal-lbl { display: none; }
  .cal-nav .btn { min-width: 44px; padding: 10px 14px; font-size: 1.1rem; }
  body.pg-own-search .tb-search { display: none; }
}

/* toast على الموبايل: عرض مناسب فوق الشريط السفلي (2026-11-29) */
@media (max-width: 900px) { .toast { width: max-content; max-width: calc(100vw - 32px); bottom: 92px; border-radius: 16px; padding: 12px 18px; text-align: center; line-height: 1.7; } }

/* المحلات على الموبايل: كارت لكل محل بدل الجدول */
@media (max-width: 700px) {
  #shops-table table, #shops-table tbody { display: block; width: 100%; }
  #shops-table thead { display: none; }
  #shops-table tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
  #shops-table td { display: block; padding: 0 !important; border: 0 !important; width: auto !important; min-width: 0 !important; }
  #shops-table td:nth-child(2), #shops-table td:nth-child(5), #shops-table td:nth-child(8), #shops-table td:nth-child(9) { display: none; }
  #shops-table td:first-child { flex: 1 1 calc(100% - 70px); order: 1; }
  #shops-table td:last-child { order: 2; margin-inline-start: auto; }
  #shops-table td:nth-child(3) { order: 3; flex: 1 1 100%; direction: ltr; text-align: start; color: var(--muted); font-size: .9rem; }
  #shops-table td:nth-child(4) { order: 4; font-size: .85rem; }
  #shops-table td:nth-child(6) { order: 5; }
  #shops-table td:nth-child(7) { order: 6; color: var(--muted); font-size: .85rem; }
}
#del-go:disabled { opacity: .35; cursor: not-allowed; filter: grayscale(.4); }
/* زر "كمّلي إعداد محلك" كان فوق تاب "أكثر" على الموبايل */
@media (max-width: 900px) { .tw-pill { bottom: calc(78px + env(safe-area-inset-bottom)) !important; left: 12px !important; padding: 8px 14px !important; font-size: .85rem !important; } }
/* الرئيسية على الموبايل: الكروت كانت أعرض من الشاشة (536px على 390) */
@media (max-width: 900px) { .home-cols { grid-template-columns: minmax(0, 1fr); } .home-cols > *, .qa-grid, .qa-grid > * { min-width: 0; max-width: 100%; } }

/* الحجوزات على الموبايل: كارت لكل حجز بدل جدول بيتسحب يمين وشمال */
@media (max-width: 700px) {
  .table-scroll > table:has(th:nth-child(10)):not(:has(th:nth-child(11))), .table-scroll > table:has(th:nth-child(10)):not(:has(th:nth-child(11))) > tbody { display: block; width: 100%; min-width: 0 !important; }
  .table-scroll > table:has(th:nth-child(10)):not(:has(th:nth-child(11))) tr:has(th) { display: none; }
  .table-scroll > table:has(th:nth-child(10)):not(:has(th:nth-child(11))) tr { display: block; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 6px 14px; margin-bottom: 12px; }
  .table-scroll > table:has(th:nth-child(10)):not(:has(th:nth-child(11))) td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 3px 0 !important; border: 0 !important; border-bottom: 1px dashed var(--line) !important; min-width: 0 !important; text-align: end; }
  .table-scroll > table:has(th:nth-child(10)):not(:has(th:nth-child(11))) td:last-child { border-bottom: 0 !important; justify-content: flex-start; }
  .table-scroll > table:has(th:nth-child(10)):not(:has(th:nth-child(11))) td::before { color: var(--muted); font-size: .8rem; flex: 0 0 auto; }
  .table-scroll > table:has(th:nth-child(10)):not(:has(th:nth-child(11))) td:nth-child(1)::before { content: 'رقم الوصل'; }
  .table-scroll > table:has(th:nth-child(10)):not(:has(th:nth-child(11))) td:nth-child(2)::before { content: 'العميل'; }
  .table-scroll > table:has(th:nth-child(10)):not(:has(th:nth-child(11))) td:nth-child(3)::before { content: 'القطع'; }
  .table-scroll > table:has(th:nth-child(10)):not(:has(th:nth-child(11))) td:nth-child(4)::before { content: 'السعر'; }
  .table-scroll > table:has(th:nth-child(10)):not(:has(th:nth-child(11))) td:nth-child(5)::before { content: 'العربون'; }
  .table-scroll > table:has(th:nth-child(10)):not(:has(th:nth-child(11))) td:nth-child(6)::before { content: 'الباقي'; }
  .table-scroll > table:has(th:nth-child(10)):not(:has(th:nth-child(11))) td:nth-child(7)::before { content: 'التسليم'; }
  .table-scroll > table:has(th:nth-child(10)):not(:has(th:nth-child(11))) td:nth-child(8)::before { content: 'الحالة'; }
  .table-scroll > table:has(th:nth-child(10)):not(:has(th:nth-child(11))) td:nth-child(9)::before { content: 'التأمين'; }
  .table-scroll > table:has(th:nth-child(10)):not(:has(th:nth-child(11))) td:nth-child(10)::before { content: 'إجراءات'; }
}
/* كروت الجداول على الموبايل (المستحقات، التقارير، المستخدمين، سجل النشاط) */
@media (max-width: 700px) {
  table.mcards, table.mcards tbody { display: block; width: 100%; min-width: 0 !important; }
  table.mcards thead, table.mcards tr:has(> th) { display: none; }
  table.mcards tr { display: block; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 6px 14px; margin-bottom: 10px; }
  table.mcards td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0 !important; border: 0 !important; border-bottom: 1px dashed var(--line) !important; min-width: 0 !important; text-align: end; overflow-wrap: anywhere; flex-wrap: wrap; }
  table.mcards td:last-child { border-bottom: 0 !important; }
  table.mcards td::before { content: attr(data-l); color: var(--muted); font-size: .8rem; flex: 0 0 auto; }
  table.mcards td[data-l=""]::before { content: none; }
  table.mcards td.mc-span { display: block; text-align: center; }
  table.mcards td.mc-span::before { content: none; }
}
@media (max-width: 700px) { .table-scroll:has(> table.mcards) { margin: 0 !important; padding: 10px !important; box-sizing: border-box; width: 100%; max-width: 100%; overflow: visible !important; } }

/* ===== quick wins 2026-11-30: حبوب الإعداد + أهداف اللمس ===== */
body.pg-not-home .tw-pill, body.modal-open .tw-pill,
body:has(#modal:not(.hidden)) .tw-pill, body:has(#confirm-overlay) .tw-pill, body:has(.bn-sheet) .tw-pill { display: none !important; }
@media (max-width: 900px) {
  .btn, .btn.small, .chip, .tw-b, .tw-chip, .tw-l, .inline-select, #sh-menu button { min-height: 44px; box-sizing: border-box; }
  .btn, .btn.small, .chip { display: inline-flex; align-items: center; justify-content: center; }
  .close-btn { min-width: 44px; min-height: 44px; }
  input[type="checkbox"] { width: 22px; height: 22px; flex: 0 0 auto; }
  label:has(input[type="checkbox"]) { min-height: 44px; display: flex; align-items: center; gap: 8px; box-sizing: border-box; }
}


/* ===== فورم الحجز على الموبايل: أقصر + زرار حفظ ثابت تحت (2026-12-01) ===== */
@media (max-width: 760px) {
  .bkf .form-grid { grid-template-columns: 1fr 1fr; gap: 8px 10px; }
  .bkf .form-grid.dates-3 { grid-template-columns: 1fr 1fr; }
  .bkf .form-grid.dates-3 > div:first-child, .bkf .bkf-cust > div:first-child { grid-column: 1 / -1; }
  .bkf .form-grid label { font-size: .78rem; margin-bottom: 2px; }
  .bkf .form-grid input, .bkf .form-grid select, .bkf .form-grid textarea { padding: 9px 11px; font-size: .92rem; border-radius: 12px; }
  .bkf .bkf-meas-grid input { width: calc(33.3% - 6px) !important; flex: 1 1 calc(33.3% - 6px); min-width: 0; }
  .bkf .muted { font-size: .72rem !important; }
  .bkf .bkf-actions { position: sticky; bottom: -24px; background: #fff; margin: 12px -24px -24px; padding: 10px 24px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); box-shadow: 0 -6px 14px rgba(90,60,60,.08); z-index: 5; }
  .bkf .bkf-actions .btn { flex: 1; min-height: 48px; font-size: 1rem; }
  .bkf .bkf-actions .btn:last-child { flex: 2; }
}

/* سجل الواتساب */
.via-tag{display:inline-block;background:#e7f6ec;color:#17673a;border-radius:10px;padding:1px 8px;font-size:12px;font-weight:700;margin-top:2px}
.wl-badge{display:inline-block;border-radius:10px;padding:2px 9px;font-size:12px;font-weight:700;white-space:nowrap}
.wl-ok{background:#e7f6ec;color:#17673a}.wl-bad{background:#fdeaea;color:#a12626}.wl-wait{background:#fff4dd;color:#8a5a00}
.wl-det{font-size:13px;min-width:180px}
@media (max-width:700px){
  .wl-table,.wl-table tbody,.wl-table tr,.wl-table td{display:block;width:100%}
  .wl-table tr:first-child{display:none}
  .wl-table tr{border:1px solid #eadfe3;border-radius:12px;margin-bottom:10px;padding:8px 10px;background:#fff}
  .wl-table td{border:0;padding:3px 0;display:flex;gap:8px;justify-content:space-between;text-align:right}
  .wl-table td::before{content:attr(data-l);color:#8a7a80;font-size:12px;flex:0 0 62px}
  .wl-table td.wl-det{display:block}.wl-table td.wl-det::before{display:block;margin-bottom:2px}
}

@media (min-width:701px){.wl-table td:first-child{white-space:nowrap}}

/* زيارات الكتالوج */
.cv-nums{display:flex;gap:10px;margin:10px 0}.cv-nums>div{flex:1;background:#f8f1f3;border-radius:12px;padding:8px 10px;text-align:center}
.cv-nums b{display:block;font-size:22px;color:#a8505f}.cv-nums span{font-size:12px;color:#8a7a80}
.cv-bars{display:flex;flex-direction:row-reverse;align-items:flex-end;gap:3px;height:70px}.cv-col{flex:1;height:100%;display:flex;align-items:flex-end}
.cv-col i{display:block;width:100%;background:#c98592;border-radius:3px 3px 0 0;min-height:2px}
.cv-chip{display:inline-block;background:#f3eaec;border-radius:10px;padding:2px 10px;margin:2px 0 2px 6px;font-size:13px}
.btn.ghost{background:#f3eaec;color:#a8505f}
