/* ═══════════════════════════════════════════════════════════════════════
   ابشر — تصميم لوحات التحكم (RTL)
   ⚠️ ممنوع style="" جوّا الصفحات (سياسة الأمان CSP) — كل التصميم هون
   ═══════════════════════════════════════════════════════════════════════ */
:root {
  --green: #0B5E3B;
  --green-2: #117A4E;
  --green-dark: #073F28;
  --green-deep: #052E1D;
  --orange: #FFB020;
  --orange-soft: #FFF5E0;
  --mint: #E8F5EF;
  --mint-2: #F3FAF6;
  --bg: #F3F5F4;
  --card: #FFFFFF;
  --ink: #17212B;
  --ink-2: #374151;
  --ink-soft: #6B7280;
  --ink-faint: #9CA3AF;
  --line: #E6EAE8;
  --line-2: #F0F2F1;
  --red: #C0392B;
  --red-bg: #FDECEA;
  --blue: #1D4ED8;
  --blue-bg: #EAF0FE;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-md: 0 4px 16px rgba(16, 24, 40, .07);
  --shadow-lg: 0 24px 60px rgba(5, 46, 29, .28);
  --ring: 0 0 0 4px rgba(17, 122, 78, .15);
  --sidebar-w: 264px;
  --topbar-h: 64px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ─── الأساسيات ──────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "IBM Plex Sans Arabic", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--green-2); text-decoration: none; transition: color .15s; }
a:hover { color: var(--green); }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.3; color: var(--ink); letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0 0 10px; }
img { max-width: 100%; }
::selection { background: var(--mint); color: var(--green-dark); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }

.muted { color: var(--ink-soft); }
.small { font-size: 13px; }
.ltr { direction: ltr; unicode-bidi: embed; }
.nowrap { white-space: nowrap; }
.text-end { text-align: left; }
.mt { margin-top: 18px; }
.mb { margin-bottom: 18px; }
.hidden { display: none !important; }
.icon { width: 20px; height: 20px; flex-shrink: 0; display: inline-block; vertical-align: middle; }

/* السكرول — رفيع وأنيق */
* { scrollbar-width: thin; scrollbar-color: #C9D2CD transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #C9D2CD; border-radius: 999px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #A9B6AF; }

/* ─── الهيكل ─────────────────────────────────────────────────────────── */
.layout { display: block; } /* توافق قديم */

.sidebar {
  position: fixed; top: 0; bottom: 0; inset-inline-start: 0; z-index: 30;
  width: var(--sidebar-w);
  background:
    radial-gradient(120% 60% at 100% 0%, rgba(255, 176, 32, .10) 0%, transparent 55%),
    linear-gradient(180deg, var(--green) 0%, var(--green-dark) 55%, var(--green-deep) 100%);
  color: #fff;
  display: flex; flex-direction: column;
  box-shadow: -1px 0 0 rgba(0, 0, 0, .04);
}
.sidebar * { scrollbar-color: rgba(255, 255, 255, .22) transparent; }
.sidebar ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .22); border-color: transparent; }

.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 18px 16px; border-bottom: 1px solid rgba(255, 255, 255, .09);
}
.brand-logo {
  width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0;
  background: rgba(255, 255, 255, .1); display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, .14);
}
.brand-logo img { width: 36px; height: 36px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.brand-text strong { font-size: 17px; font-weight: 700; }
.brand-text span { font-size: 12.5px; color: rgba(255, 255, 255, .68); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* توافق مع الكلاسات القديمة */
.brand-sub { font-size: 13px; color: rgba(255, 255, 255, .7); }

.nav { flex: 1; overflow-y: auto; padding: 12px 12px 18px; display: flex; flex-direction: column; gap: 2px; }
.nav-group {
  font-size: 11.5px; font-weight: 600; color: rgba(255, 255, 255, .45);
  padding: 16px 12px 6px; letter-spacing: .02em;
}
.nav a, .nav-link {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  color: rgba(255, 255, 255, .78); padding: 10px 12px; border-radius: 12px;
  font-weight: 500; font-size: 14.5px;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.nav-link .icon { opacity: .8; transition: opacity .18s; }
.nav-text { flex: 1; }
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav a:hover .icon { opacity: 1; }
.nav a.active {
  background: rgba(255, 255, 255, .13); color: #fff; font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}
.nav a.active .icon { opacity: 1; color: var(--orange); }
.nav a.active::before {
  content: ""; position: absolute; inset-inline-start: -12px; top: 9px; bottom: 9px;
  width: 4px; border-radius: 0 4px 4px 0; background: var(--orange);
}
[dir="rtl"] .nav a.active::before { border-radius: 4px 0 0 4px; }
.nav-count {
  background: var(--orange); color: var(--ink); border-radius: 999px;
  min-width: 22px; height: 22px; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 7px;
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 176, 32, .55); } 50% { box-shadow: 0 0 0 6px rgba(255, 176, 32, 0); } }

.sidebar-foot {
  display: flex; align-items: center; gap: 10px;
  margin: 0 12px 12px; padding: 12px; border-radius: 14px;
  background: rgba(0, 0, 0, .18); border: 1px solid rgba(255, 255, 255, .06);
}
.avatar {
  width: 38px; height: 38px; border-radius: 12px; flex-shrink: 0;
  background: var(--orange); color: var(--green-deep);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px;
}
.who { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.who strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who span { font-size: 12px; color: rgba(255, 255, 255, .6); }

.sidebar-backdrop { display: none; }

.main { margin-inline-start: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 28px;
  background: rgba(243, 245, 244, .82);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.topbar.scrolled { background: rgba(255, 255, 255, .9); border-bottom-color: var(--line); box-shadow: 0 2px 12px rgba(16, 24, 40, .04); }
.topbar-title { flex: 1; font-weight: 600; color: var(--ink-2); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-user { flex: 1; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink-2); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--mint); color: var(--green); border-color: #CFE7DA; }
.menu-toggle { display: none; }

.content { padding: 8px 28px 40px; max-width: 1360px; width: 100%; }

/* ─── رأس الصفحة ─────────────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin: 10px 0 22px;
}
.page-header h1 { margin: 0; font-size: 26px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb { font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; }
.content > h2 { margin-top: 6px; font-size: 16px; color: var(--ink-2); }

/* ─── البطاقات والشبكات ──────────────────────────────────────────────── */
.card {
  background: var(--card); border-radius: var(--radius); border: 1px solid var(--line);
  box-shadow: var(--shadow); padding: 22px; margin-bottom: 20px;
}
.card > h2:first-child, .card > h3:first-child { margin-bottom: 16px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: -4px 0 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line-2);
}
.card-header h2, .card-header h3 { margin: 0; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid > .card { margin-bottom: 0; }

.stat {
  position: relative; overflow: hidden;
  background: var(--card); border-radius: var(--radius); border: 1px solid var(--line);
  box-shadow: var(--shadow); padding: 18px 20px 18px;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat::after {
  content: ""; position: absolute; inset-inline-end: -26px; top: -26px;
  width: 90px; height: 90px; border-radius: 50%; background: var(--mint-2);
}
.stat-label { position: relative; z-index: 1; color: var(--ink-soft); font-size: 13px; font-weight: 500; }
.stat-value { position: relative; z-index: 1; font-size: 26px; font-weight: 700; margin-top: 6px; color: var(--ink); letter-spacing: -.01em; }
.stat::before { content: ""; position: absolute; inset-inline-start: 0; top: 18px; bottom: 18px; width: 4px; border-radius: 4px; background: var(--line); }
.stat-green::before { background: var(--green-2); }
.stat-green::after { background: var(--mint); }
.stat-orange::before { background: var(--orange); }
.stat-orange::after { background: var(--orange-soft); }
.stat-red::before { background: var(--red); }
.stat-red::after { background: var(--red-bg); }
.stat-blue::before { background: var(--blue); }
.stat-blue::after { background: var(--blue-bg); }

.dl { display: grid; grid-template-columns: 170px 1fr; gap: 0; margin: 0; }
.dl dt, .dl dd { padding: 10px 0; border-bottom: 1px solid var(--line-2); margin: 0; }
.dl dt { color: var(--ink-soft); font-size: 14px; }
.dl dd { font-weight: 500; }
.dl dt:last-of-type, .dl dd:last-of-type { border-bottom: 0; }

/* ─── الجداول ────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto; background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--line); box-shadow: var(--shadow); margin-bottom: 20px;
}
.card .table-wrap { box-shadow: none; margin-bottom: 0; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14.5px; }
.table th, .table td { padding: 13px 16px; text-align: right; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table th {
  background: #F8FAF9; font-size: 12.5px; color: var(--ink-soft); font-weight: 600;
  white-space: nowrap; border-bottom: 1px solid var(--line);
}
.table thead th:first-child { border-start-start-radius: var(--radius); }
.table thead th:last-child { border-start-end-radius: var(--radius); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover td { background: var(--mint-2); }
.table td a:not(.btn) { font-weight: 600; }
.table .actions { white-space: nowrap; display: flex; gap: 6px; justify-content: flex-start; align-items: center; }
.thumb { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; background: var(--mint); display: block; border: 1px solid var(--line); }
.thumb-lg { width: 180px; height: 120px; border-radius: 14px; object-fit: cover; background: var(--mint); display: block; border: 1px solid var(--line); }
.empty {
  text-align: center; color: var(--ink-soft); padding: 48px 16px;
  background: repeating-linear-gradient(135deg, transparent 0 12px, rgba(17, 122, 78, .025) 12px 24px);
  border-radius: var(--radius);
}
.empty::before {
  content: ""; display: block; width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 16px;
  background: var(--mint) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23117A4E' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 8v13H3V8'/%3E%3Cpath d='M1 3h22v5H1z'/%3E%3Cpath d='M10 12h4'/%3E%3C/svg%3E") center / 24px no-repeat;
}

/* ─── الأزرار ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 12px; padding: 10px 18px; min-height: 42px;
  font: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .08s;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.loading { opacity: .65; cursor: progress; }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--green); color: #fff; box-shadow: 0 1px 2px rgba(11, 94, 59, .25), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn-primary:hover { background: var(--green-2); color: #fff; }
.btn-accent { background: var(--orange); color: var(--green-deep); box-shadow: 0 1px 2px rgba(255, 176, 32, .35); }
.btn-accent:hover { background: #F5A50F; color: var(--green-deep); }
.btn-secondary { background: #EEF1EF; color: var(--ink); }
.btn-secondary:hover { background: #E3E8E5; color: var(--ink); }
.btn-outline { background: var(--card); border-color: var(--line); color: var(--ink-2); }
.btn-outline:hover { border-color: #CFE7DA; background: var(--mint-2); color: var(--green); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #A93226; color: #fff; }
.btn-danger-outline { background: var(--card); border-color: #F2C4BF; color: var(--red); }
.btn-danger-outline:hover { background: var(--red-bg); color: var(--red); }
.btn-ghost-danger { background: transparent; color: var(--ink-2); border-color: var(--line); }
.btn-ghost-danger:hover { background: var(--red-bg); color: var(--red); border-color: #F2C4BF; }
.btn-link { background: none; border: 0; color: var(--green-2); padding: 4px 0; min-height: 0; }
.btn-link:hover { color: var(--green); text-decoration: underline; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 10px; min-height: 34px; }
.btn-lg { min-height: 50px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }
.inline-form { display: inline; margin: 0; }

/* ─── الشارات ────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.4;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge-green { background: var(--mint); color: var(--green); }
.badge-orange { background: var(--orange-soft); color: #8A5A00; }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-gray { background: #EEF1EF; color: var(--ink-soft); }

/* ─── الفورمات ───────────────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.field .help { color: var(--ink-soft); font-size: 12.5px; }
.field-error, .field-validation-error { color: var(--red); font-size: 12.5px; font-weight: 500; }
input[type=text], input[type=tel], input[type=password], input[type=number], input[type=email],
input[type=url], input[type=date], input[type=datetime-local], input[type=time], input[type=search],
input:not([type]), select, textarea {
  font: inherit; font-size: 14.5px; color: var(--ink); background: #fff;
  border: 1px solid #DCE2DF; border-radius: 12px; padding: 10px 14px; width: 100%; min-height: 44px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
input:hover, select:hover, textarea:hover { border-color: #C5CEC9; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green-2); box-shadow: var(--ring); }
input:disabled, select:disabled, textarea:disabled, input[readonly] { background: #F6F8F7; color: var(--ink-soft); cursor: not-allowed; }
input[type=file] {
  font: inherit; font-size: 13.5px; width: 100%; padding: 10px; border: 1.5px dashed #CFD8D3; border-radius: 12px; background: var(--mint-2); cursor: pointer;
}
input[type=file]::file-selector-button {
  font: inherit; font-weight: 600; border: 0; border-radius: 9px; padding: 7px 14px; margin-inline-end: 10px;
  background: var(--green); color: #fff; cursor: pointer;
}
select {
  -webkit-appearance: none; appearance: none; padding-inline-end: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 16px; background-position: left 12px center;
}
textarea { min-height: 100px; resize: vertical; }
.input-validation-error { border-color: var(--red) !important; }
.input-validation-error:focus { box-shadow: 0 0 0 4px rgba(192, 57, 43, .12) !important; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--green); min-height: 0; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line-2); }

/* حقل بأيقونة (صفحة الدخول) */
.input-icon { position: relative; }
.input-icon > .icon {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  width: 19px; height: 19px; color: var(--ink-faint); pointer-events: none; transition: color .15s;
}
/* الصفحة RTL: الأيقونة يمين وزر العين يسار (حتى لو الحقل نفسه ltr) */
.input-icon input { padding-right: 44px; padding-left: 14px; min-height: 50px; border-radius: 14px; }
.input-icon:focus-within > .icon { color: var(--green-2); }
.input-action {
  position: absolute; left: 6px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; color: var(--ink-faint);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.input-action:hover, .input-action.on { color: var(--green); background: var(--mint); }
.input-icon:has(.input-action) input { padding-left: 50px; }

/* شريط الفلترة */
.toolbar {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
}
.toolbar .field { min-width: 160px; }
.toolbar .grow { flex: 1; min-width: 200px; }
.toolbar .btn { min-height: 44px; }

/* التبويبات */
.tabs {
  display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 18px;
  background: #E9EDEB; padding: 5px; border-radius: 14px; width: fit-content; max-width: 100%;
}
.tabs a {
  padding: 7px 16px; border-radius: 10px; color: var(--ink-2); font-weight: 600; font-size: 13.5px;
  transition: background .15s, color .15s, box-shadow .15s;
}
.tabs a:hover { color: var(--green); background: rgba(255, 255, 255, .55); }
.tabs a.active { background: #fff; color: var(--green); box-shadow: 0 1px 3px rgba(16, 24, 40, .1); }

/* ─── التنبيهات ──────────────────────────────────────────────────────── */
.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 13px 16px; border-radius: 14px; margin-bottom: 18px; font-weight: 500;
  border: 1px solid transparent; transition: opacity .5s, transform .5s;
}
.alert::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; margin-top: 9px; flex-shrink: 0; }
.alert ul { margin: 0; padding-inline-start: 18px; }
.alert-ok { background: var(--mint); color: var(--green); border-color: #CFE7DA; }
.alert-error { background: var(--red-bg); color: var(--red); border-color: #F6D0CB; }
.alert-warn { background: var(--orange-soft); color: #8A5A00; border-color: #FBE3B0; }
.alert.fade { opacity: 0; transform: translateY(-6px); }

/* كلمة سر مؤقتة بتطلع مرة وحدة */
.secret-box {
  background: linear-gradient(180deg, #FFF9EC 0%, var(--orange-soft) 100%);
  border: 2px dashed var(--orange); border-radius: var(--radius);
  padding: 20px; text-align: center; margin-bottom: 20px;
}
.secret-box code {
  display: inline-block; font-size: 26px; font-weight: 700; letter-spacing: 3px; font-family: ui-monospace, Consolas, monospace;
  direction: ltr; background: #fff; padding: 8px 20px; border-radius: 12px; margin: 10px 0; border: 1px solid #FBE3B0;
  user-select: all;
}

/* ─── الصفحات ────────────────────────────────────────────────────────── */
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 6px 0 16px; flex-wrap: wrap; }
.pager a, .pager-btn {
  display: inline-flex; align-items: center; padding: 8px 16px; border-radius: 12px; min-height: 40px;
  background: var(--card); border: 1px solid var(--line); color: var(--ink-2); font-weight: 600; font-size: 14px;
}
.pager a:hover { border-color: #CFE7DA; background: var(--mint-2); color: var(--green); }
.pager-btn.disabled { opacity: .45; pointer-events: none; }
.pager-info { color: var(--ink-soft); font-size: 13.5px; padding: 0 6px; }
.pager-info strong { color: var(--ink); }

/* ─── الطلبات بصفحة المحل ────────────────────────────────────────────── */
.order-card { position: relative; border-inline-start: 0; }
.order-card::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 16px; bottom: 16px; width: 5px; border-radius: 4px;
  background: var(--orange);
}
.order-card.status-ACCEPTED::before { background: var(--blue); }
.order-card.status-READY::before { background: var(--green-2); }
.items-list { margin: 10px 0; padding: 0; list-style: none; }
.items-list li { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.items-list li:last-child { border-bottom: 0; }

/* ─── صفحة الدخول ────────────────────────────────────────────────────── */
.auth-body { min-height: 100vh; background: var(--bg); }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }

.auth-brand {
  position: relative; overflow: hidden; color: #fff;
  background:
    radial-gradient(80% 60% at 85% 10%, rgba(255, 176, 32, .18) 0%, transparent 60%),
    radial-gradient(70% 60% at 0% 100%, rgba(17, 122, 78, .55) 0%, transparent 60%),
    linear-gradient(160deg, var(--green) 0%, var(--green-dark) 60%, var(--green-deep) 100%);
  display: flex; align-items: center; justify-content: center; padding: 48px;
}
.auth-brand::before {
  content: ""; position: absolute; inset: 0; opacity: .5;
  background-image: radial-gradient(rgba(255, 255, 255, .09) 1px, transparent 1px);
  background-size: 22px 22px;
}
.auth-brand-inner { position: relative; z-index: 1; max-width: 420px; margin-bottom: 80px; }
.auth-brand-logo {
  width: 92px; height: 92px; border-radius: 26px; margin-bottom: 28px;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}
.auth-brand-logo img { width: 70px; height: 70px; object-fit: contain; }
.auth-brand h2 { color: #fff; font-size: 34px; line-height: 1.35; margin-bottom: 14px; font-weight: 700; }
.auth-brand p { color: rgba(255, 255, 255, .78); font-size: 16px; margin-bottom: 26px; }
.auth-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.auth-points li { display: flex; align-items: center; gap: 12px; color: rgba(255, 255, 255, .9); font-weight: 500; }
.auth-points li::before {
  content: ""; width: 26px; height: 26px; border-radius: 9px; flex-shrink: 0;
  background: rgba(255, 176, 32, .18) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFB020' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.auth-skyline { position: absolute; bottom: 0; left: 0; right: 0; width: 100%; height: 140px; fill: rgba(255, 255, 255, .07); }

.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card {
  width: 100%; max-width: 420px; background: var(--card); border-radius: 24px; padding: 36px 34px;
  border: 1px solid var(--line); box-shadow: 0 10px 40px rgba(16, 24, 40, .06);
  animation: rise .5s var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.auth-head { margin-bottom: 22px; }
.auth-head h1 { font-size: 26px; margin-bottom: 6px; }
.auth-head p { margin: 0; }
.auth-card h1 { font-size: 24px; }
.auth-mobile-logo { display: none; }
.auth-note { margin: 20px 0 0; padding-top: 16px; border-top: 1px solid var(--line-2); color: var(--ink-soft); font-size: 13px; text-align: center; }
.auth-foot { color: var(--ink-faint); font-size: 12.5px; margin: 22px 0 0; }
.auth-logout { text-align: center; margin-top: 12px; }
/* توافق قديم */
.auth-logo { display: none; }

/* ─── الجوال والتابلت ───────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .sidebar { transform: translateX(105%); transition: transform .28s var(--ease); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    display: block; position: fixed; inset: 0; z-index: 25; background: rgba(5, 46, 29, .45);
    opacity: 0; pointer-events: none; transition: opacity .25s;
  }
  body.menu-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  body.menu-open { overflow: hidden; }
  .main { margin-inline-start: 0; }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .content { padding: 6px 16px 32px; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; }
  .dl dt { border-bottom: 0; padding-bottom: 0; }

  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-body { background: linear-gradient(180deg, var(--green) 0, var(--green-dark) 230px, var(--bg) 230px); }
  .auth-mobile-logo { display: flex; justify-content: center; margin: -8px 0 18px; }
  .auth-mobile-logo img { width: 84px; height: 84px; object-fit: contain; background: var(--green); border-radius: 22px; padding: 10px; }
}
@media (max-width: 560px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat { padding: 14px 16px; }
  .stat-value { font-size: 20px; }
  .topbar-user, .hide-sm { display: none; }
  .page-header h1 { font-size: 22px; }
  .card { padding: 16px; }
  .auth-card { padding: 28px 20px; border-radius: 20px; }
  .table th, .table td { padding: 11px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .sidebar, .topbar, .page-actions, .toolbar, .pager, .actions { display: none !important; }
  .main { margin: 0; }
  .card, .table-wrap, .stat { box-shadow: none; border-color: #ccc; }
}

/* ─── طلب سائق / مصدر الطلب ─────────────────────────────────────────── */
.badges { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.form-actions .toolbar { margin: 0; box-shadow: none; padding: 10px 12px; }

/* ─── الجداول على الجوال: كل سطر كرت (panel.js بيحط data-label) ───────── */
@media (max-width: 640px) {
  .table-wrap.has-stack { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .card .table-wrap.has-stack { margin: 0 -4px; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack thead { display: none; }
  .table-stack tbody tr {
    background: var(--card); border: 1px solid var(--line); border-radius: 14px;
    box-shadow: var(--shadow); margin-bottom: 12px; padding: 4px 14px;
  }
  .table-stack tbody tr:hover td { background: transparent; }
  .table-stack td {
    position: relative; text-align: left; border-bottom: 1px dashed var(--line-2);
    padding: 10px 0 10px 0; padding-inline-start: 42%; min-height: 40px; word-break: break-word;
  }
  .table-stack td::before {
    content: attr(data-label); position: absolute; inset-inline-start: 0; top: 10px; width: 40%;
    text-align: right; color: var(--ink-soft); font-size: 12.5px; font-weight: 600; line-height: 1.5;
  }
  .table-stack td[data-label=""], .table-stack td.cell-full { padding-inline-start: 0; text-align: right; }
  .table-stack td[data-label=""]::before, .table-stack td.cell-full::before { display: none; }
  .table-stack tr td:last-child { border-bottom: 0; }
  .table-stack td.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-start; padding-top: 12px; }
  .table-stack td.actions[data-label]:not([data-label=""]) { padding-inline-start: 0; padding-top: 30px; }
  .table-stack td.actions[data-label]:not([data-label=""])::before { top: 8px; width: 100%; }
  .table-stack .thumb { display: inline-block; }
  .table-stack .nowrap { white-space: normal; }
}


/* ─── تنبيه الطلبات الجديدة: شريط تفعيل الصوت + التوست (panel.js) ───────── */
.sound-bar[hidden], .order-toast[hidden] { display: none !important; }
.sound-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px;
  margin: 12px 28px 0; max-width: 1304px; padding: 10px 14px; border-radius: 12px;
  background: #FFF6E0; border: 1px solid #F5D58A; color: var(--ink); font-size: 14px;
}
.sound-bar .sound-bar-text { flex: 1 1 260px; }
.sound-bar.sound-bar-alert { background: var(--red-bg); border-color: var(--red); animation: soundBarPulse 1s ease-in-out 3; }
@keyframes soundBarPulse { 50% { transform: scale(1.015); } }

.order-toast {
  position: fixed; z-index: 60; bottom: 20px; inset-inline-end: 20px;
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  max-width: calc(100vw - 32px); padding: 14px 16px; border-radius: 14px;
  background: var(--green-dark); color: #fff; box-shadow: 0 10px 30px rgba(5, 46, 29, .35);
  animation: orderToastIn .25s ease-out;
}
.order-toast .order-toast-text { font-size: 16px; margin-inline-end: 6px; }
.order-toast .order-toast-icon { font-size: 22px; display: inline-block; }
.order-toast.ringing .order-toast-icon { animation: orderBell .6s ease-in-out infinite; }
.order-toast .btn-secondary { background: rgba(255, 255, 255, .14); color: #fff; }
.order-toast .btn-secondary:hover { background: rgba(255, 255, 255, .24); color: #fff; }
@keyframes orderToastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes orderBell { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-18deg); } 75% { transform: rotate(18deg); } }
@media (max-width: 640px) {
  .sound-bar { margin: 10px 16px 0; }
  .order-toast { inset-inline: 16px; bottom: 16px; justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) {
  .order-toast, .order-toast.ringing .order-toast-icon, .sound-bar.sound-bar-alert { animation: none; }
}
