/* ═══════════════════════════════════════════════════════════════
   لمسة رفاه — نظام التصميم الموحّد v2 (Ivory Seal)
   هوية واحدة للويب والتطبيق مأخوذة من الشعار الرسمي:
   الحديقة (الإجراء) · الذهب (التمييز) · الماء (المعلومة) على أرضية عاجية.
   RTL أصيل بالخصائص المنطقية — لا انعكاس بصري بالـ transform
   ═══════════════════════════════════════════════════════════════ */

:root {
  color-scheme: light;
  /* الأرضيات والأسطح — عاجي دافئ */
  --ground:       #F6F3EC;
  --surface:      #FFFDF8;
  --surface-2:    #F1ECE1;
  --surface-3:    #E7E0D2;
  --ink:          #1F1B17;
  --ink-muted:    #5C5348;
  --ink-faint:    #8A7F70;

  /* الحديقة — لون الإجراء الأساسي (من الشعار) */
  --accent:       #24704B;
  --accent-hover: #1C5138;
  --accent-soft:  #E3EFE7;
  --accent-glow:  rgba(36, 112, 75, 0.20);
  --accent-gradient: linear-gradient(135deg, #2D7D54 0%, #1C5138 100%);

  /* الذهب — للتمييز والقيم المالية فقط */
  --brass:        #C4A035;
  --brass-deep:   #8C6E1C;
  --brass-soft:   #F7F0DC;
  --brass-glow:   rgba(196, 160, 53, 0.22);
  --brass-gradient: linear-gradient(135deg, #D4AD42 0%, #9F7920 100%);

  /* الماء — للمعلومات والموقع */
  --water:        #2F7FAE;
  --water-soft:   #E2EEF6;

  --line:         #E2D9C8;
  --line-strong:  #CFC3AD;

  /* ألوان الحالات — منفصلة عن لون الهوية */
  --s-draft:     #8A7F70;
  --s-hold:      #B8901F;
  --s-pending:   #C77A12;
  --s-confirmed: #24704B;
  --s-checkedin: #2F7FAE;
  --s-completed: #5B6B8C;
  --s-cancelled: #B3453A;
  --s-noshow:    #8A7F70;

  --danger:  #B3453A;
  --warning: #C77A12;
  --success: #24704B;
  --info:    #2F7FAE;

  /* المقاييس */
  --r-xs: 6px;  --r-sm: 8px;  --r-md: 12px;  --r-lg: 16px;  --r-xl: 20px;  --r-full: 9999px;
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;

  --shadow-sm: 0 1px 2px rgba(31,27,23,.05);
  --shadow:    0 1px 2px rgba(31,27,23,.04), 0 6px 20px rgba(31,27,23,.05);
  --shadow-lg: 0 18px 48px rgba(31,27,23,.14), 0 3px 8px rgba(31,27,23,.06);
  --shadow-glow: 0 0 0 4px var(--accent-glow);

  --font-display: "Readex Pro", "IBM Plex Sans Arabic", "Segoe UI", system-ui, sans-serif;
  --font-body:    "IBM Plex Sans Arabic", "Segoe UI", system-ui, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, monospace;

  --sidebar-w: 264px;
  --header-h: 68px;
  --glass-bg: rgba(255, 253, 248, 0.86);
  --glass-blur: blur(16px) saturate(160%);

  --ease-smooth: cubic-bezier(0.2, 0, 0, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 120ms;
  --dur: 200ms;
}

[data-theme="dark"] {
  color-scheme: dark;
  --ground:       #0D1311;
  --surface:      #141C19;
  --surface-2:    #1A2420;
  --surface-3:    #23302B;
  --ink:          #ECEFEA;
  --ink-muted:    #A4B0A9;
  --ink-faint:    #74827B;

  --accent:       #5CB88A;
  --accent-hover: #7BCDA2;
  --accent-soft:  #16291F;
  --accent-glow:  rgba(92, 184, 138, 0.26);
  --accent-gradient: linear-gradient(135deg, #5CB88A 0%, #2D7D54 100%);

  --brass:        #DDBB5E;
  --brass-deep:   #D2AC45;
  --brass-soft:   #2A2414;
  --brass-glow:   rgba(221, 187, 94, 0.28);
  --brass-gradient: linear-gradient(135deg, #DDBB5E 0%, #B88A28 100%);

  --water:        #6DB3DC;
  --water-soft:   #12232E;

  --line:         #26332E;
  --line-strong:  #34443D;

  --s-draft:     #8A968F;
  --s-hold:      #DDBB5E;
  --s-pending:   #E9A447;
  --s-confirmed: #5CB88A;
  --s-checkedin: #6DB3DC;
  --s-completed: #9AA8C4;
  --s-cancelled: #E07467;
  --s-noshow:    #8A968F;

  --danger:  #E07467;
  --warning: #E9A447;
  --success: #5CB88A;
  --info:    #6DB3DC;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow:    0 1px 2px rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 18px 48px rgba(0,0,0,.6), 0 2px 6px rgba(0,0,0,.4);
  --glass-bg: rgba(20, 28, 25, 0.86);
  --glass-blur: blur(18px) saturate(160%);
}

/* ── الأساسيات والتأسيس ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  direction: rtl;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -.015em;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: 26px; font-weight: 700; color: var(--ink); }
h2 { font-size: 20px; color: var(--ink); }
h3 { font-size: 17px; }
h4 { font-size: 15px; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease, opacity 0.2s ease;
}
a:hover {
  color: var(--accent-hover);
  text-decoration: none;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.mono, .num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  direction: ltr;
  display: inline-block;
  text-align: start;
}

/* ── تخطيط الهيكل الخارجي (Shell Layout) ─────────────────────── */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

/* ── الشريط الجانبي الفخم ───────────────────────────────────── */
.sidebar {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-inline-start: 1px solid var(--line);
  padding: var(--sp-6) var(--sp-4);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  z-index: 90;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 var(--sp-2) var(--sp-6);
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  flex: none;
  background: var(--accent-gradient);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  box-shadow: 0 4px 12px var(--accent-glow);
  transition: transform 0.3s ease;
}
.brand:hover .brand-mark {
  transform: rotate(-8deg) scale(1.05);
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
  color: var(--ink);
}
.brand-sub {
  font-size: 11px;
  color: var(--brass);
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.1em;
}

.nav-group {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--ink-faint);
  padding: var(--sp-4) var(--sp-2) var(--sp-2);
  text-transform: uppercase;
  font-family: var(--font-mono);
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px var(--sp-3);
  border-radius: var(--r-md);
  color: var(--ink-muted);
  font-size: 14px;
  font-weight: 500;
  border-inline-start: 3px solid transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-link:hover {
  background: var(--surface-2);
  color: var(--ink);
  text-decoration: none;
  padding-inline-start: calc(var(--sp-3) + 3px);
}
.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  border-inline-start-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.nav-icon {
  width: 20px;
  height: 20px;
  flex: none;
  stroke-width: 2;
  transition: transform 0.2s ease;
}
.nav-link:hover .nav-icon {
  transform: scale(1.08);
}
.nav-badge {
  margin-inline-start: auto;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--r-full);
  background: var(--accent-soft);
  color: var(--accent);
}
.nav-link .badge {
  margin-inline-start: auto;
}

/* مؤشر النبض البصري للحالات الحية */
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.55; }
}
.dot-pulse {
  animation: pulse-dot 2s infinite ease-in-out;
  display: inline-block;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── شريط الترويسة العلوي الفاخر (Premium Topbar) ───────────── */
.topbar {
  height: var(--header-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-6);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 80;
}
.topbar h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-faint);
}
.topbar-breadcrumb a {
  color: var(--ink-muted);
}
.topbar-breadcrumb a:hover {
  color: var(--accent);
}
.topbar-breadcrumb .sep {
  opacity: 0.5;
  font-size: 11px;
}
.topbar-spacer {
  margin-inline-start: auto;
}

/* حبة الوردية المباشرة (Shift Status Pill) */
.shift-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--r-full);
  font-size: 12.5px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  transition: all 0.2s ease;
  text-decoration: none;
}
.shift-pill:hover {
  border-color: var(--line-strong);
  background: var(--surface-3);
  text-decoration: none;
}
.shift-pill.open {
  background: color-mix(in srgb, var(--success) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--success) 30%, transparent);
  color: var(--success);
}
.shift-pill.closed {
  background: color-mix(in srgb, var(--warning) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--warning) 30%, transparent);
  color: var(--warning);
}

/* ساعة التوقيت المباشرة */
.live-clock {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface-2);
  border-radius: var(--r-full);
  border: 1px solid var(--line);
}

/* ── المحتوى الأساسي ────────────────────────────────────────── */
.content {
  padding: var(--sp-6) var(--sp-8);
  flex: 1;
  min-width: 0;
}
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-bottom: var(--sp-6);
  border-bottom: 1px solid var(--line);
  padding-bottom: var(--sp-4);
}
.page-head .actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  align-items: center;
}
.page-dek {
  color: var(--ink-muted);
  font-size: 13.5px;
  margin-top: 4px;
}

/* ── البطاقات الفاخرة (Premium Cards) ────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--line-strong);
}
.card-head {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: linear-gradient(to bottom, var(--surface), var(--surface-2));
}
.card-head h3 {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--ink);
}
.card-head .actions {
  margin-inline-start: auto;
  display: flex;
  gap: var(--sp-2);
}
.card-body {
  padding: var(--sp-5);
}
.card-body.tight {
  padding: var(--sp-3);
}

.grid {
  display: grid;
  gap: var(--sp-4);
}
.g-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.g-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.g-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* ── بطاقات المؤشرات المبتكرة (KPI Cards) ───────────────────── */
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-5);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}
.kpi::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 4px;
  background: var(--line-strong);
  transition: width 0.3s ease;
}
.kpi:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--line-strong);
}
.kpi:hover::before {
  width: 6px;
}
.kpi-accent::before { background: var(--accent-gradient); }
.kpi-warn::before { background: var(--brass-gradient); }
.kpi-danger::before { background: var(--danger); }

.kpi-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.kpi-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.25;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.kpi-value.sm {
  font-size: 22px;
}
.kpi-meta {
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.kpi-accent { color: var(--accent); }
.kpi-warn { color: var(--brass); }
.kpi-danger { color: var(--danger); }

/* شريط التقدم المرئي داخل الـ KPI */
.kpi-progress {
  height: 6px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  margin-top: 10px;
  overflow: hidden;
}
.kpi-progress-bar {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--accent-gradient);
  transition: width 0.6s var(--ease-spring);
}
.kpi-progress-bar.warn { background: var(--brass-gradient); }
.kpi-progress-bar.danger { background: var(--danger); }

/* مركز الإجراءات الذكي (Smart Action Center) */
.action-center {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.action-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--line-strong);
  transition: all 0.2s ease;
}
.action-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  background: var(--surface);
  border-color: var(--line-strong);
}
.action-item.urgent {
  border-inline-start-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 5%, var(--surface));
}
.action-item.warn {
  border-inline-start-color: var(--warning);
  background: color-mix(in srgb, var(--warning) 5%, var(--surface));
}
.action-item.info {
  border-inline-start-color: var(--info);
  background: color-mix(in srgb, var(--info) 5%, var(--surface));
}
.action-item-body {
  flex: 1;
  min-width: 0;
}
.action-item-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}
.action-item-meta {
  font-size: 12px;
  color: var(--ink-muted);
}
.action-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* شرائح الفلاتر السريعة (Segmented Filter Chips) */
.filter-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 4px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
}
.chip {
  padding: 6px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip:hover {
  color: var(--ink);
  background: var(--surface-3);
}
.chip.active {
  background: var(--surface);
  color: var(--accent);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.chip-count {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: var(--r-full);
  background: var(--accent-soft);
  color: var(--accent);
}

/* أزرار المدد السريعة للحجز بالساعات (Duration Presets) */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.preset-btn {
  padding: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  border-radius: var(--r-md);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.preset-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.preset-btn.active {
  border-color: var(--accent);
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
}
.preset-btn .preset-sub {
  font-size: 11px;
  font-weight: 400;
  display: block;
  opacity: 0.85;
}

/* بطاقة الضيف السريعة (Guest Mini Card) */
.guest-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: all 0.2s ease;
}
.guest-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.guest-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--r-full);
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  flex: none;
}
.guest-avatar.vip {
  background: var(--brass-soft);
  color: var(--brass);
}

/* ── الجداول الاحترافية (Modern Tables) ─────────────────────── */
.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--sp-4);
  box-sizing: border-box;
}
.card > .table-wrap {
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  border: none;
  box-shadow: none;
  margin-bottom: 0;
}
table {
  width: 100% !important;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
  text-align: start;
}
thead {
  background: var(--surface-2);
}
thead th {
  background: var(--surface-2);
  text-align: start;
  white-space: nowrap;
  padding: 13px 16px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
  border-bottom: 1px solid var(--line-strong);
}
tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  transition: background-color 0.15s ease;
  color: var(--ink);
  text-align: start;
}
tbody tr:last-child td {
  border-bottom: none;
}
tbody tr:hover td {
  background: var(--surface-2);
}
tfoot th, tfoot td {
  background: var(--surface-2);
  padding: 14px 16px;
  font-family: var(--font-display);
  font-weight: 700;
  border-top: 1px solid var(--line-strong);
  text-align: start;
}
th.num, td.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: start;
}
th.center, td.center {
  text-align: center;
}
th.action-col, td.action-col {
  text-align: end;
  white-space: nowrap;
  width: 1%;
}

/* ── الشارات (Badges) ──────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--r-full);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--ink-muted);
  border: 1px solid var(--line);
}
.badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.st-draft     { color: var(--s-draft);     background: color-mix(in srgb, var(--s-draft) 10%, transparent);     border-color: color-mix(in srgb, var(--s-draft) 25%, transparent); }
.st-hold      { color: var(--s-hold);      background: color-mix(in srgb, var(--s-hold) 10%, transparent);      border-color: color-mix(in srgb, var(--s-hold) 25%, transparent); }
.st-pending_deposit { color: var(--s-pending); background: color-mix(in srgb, var(--s-pending) 10%, transparent); border-color: color-mix(in srgb, var(--s-pending) 25%, transparent); }
.st-confirmed { color: var(--s-confirmed); background: color-mix(in srgb, var(--s-confirmed) 10%, transparent); border-color: color-mix(in srgb, var(--s-confirmed) 25%, transparent); }
.st-checked_in{ color: var(--s-checkedin); background: color-mix(in srgb, var(--s-checkedin) 10%, transparent); border-color: color-mix(in srgb, var(--s-checkedin) 25%, transparent); }
.st-completed { color: var(--s-completed); background: color-mix(in srgb, var(--s-completed) 10%, transparent); border-color: color-mix(in srgb, var(--s-completed) 25%, transparent); }
.st-cancelled { color: var(--s-cancelled); background: color-mix(in srgb, var(--s-cancelled) 10%, transparent); border-color: color-mix(in srgb, var(--s-cancelled) 25%, transparent); }
.st-no_show   { color: var(--s-noshow);    background: color-mix(in srgb, var(--s-noshow) 10%, transparent);    border-color: color-mix(in srgb, var(--s-noshow) 25%, transparent); }

.badge-vip {
  color: var(--brass);
  background: var(--brass-soft);
  border-color: color-mix(in srgb, var(--brass) 30%, transparent);
}
.badge-danger {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  border-color: color-mix(in srgb, var(--danger) 25%, transparent);
}

/* ── الأزرار التفاعلية (Interactive Buttons) ────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  min-height: 42px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
  text-decoration: none;
}
.btn:active {
  transform: scale(0.97);
}
.btn:disabled, .btn[aria-busy="true"] {
  opacity: .55;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(36, 112, 75, 0.15);
}
.btn-primary:hover {
  background: var(--accent-gradient);
  opacity: 0.95;
  box-shadow: 0 6px 16px rgba(36, 112, 75, 0.25);
  border-color: transparent;
}
.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  opacity: .95;
  background: var(--danger);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-muted);
}
.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.btn-sm {
  padding: 6px 14px;
  min-height: 32px;
  font-size: 13px;
  border-radius: var(--r-sm);
}
.btn-block {
  width: 100%;
}

/* ── النماذج وحقول الإدخال (Inputs & Forms) ─────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--sp-4);
}
.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
}
.field .hint {
  font-size: 12px;
  color: var(--ink-faint);
}
.field .err {
  font-size: 12.5px;
  color: var(--danger);
  font-weight: 500;
}

.input, .select, .textarea {
  width: 100%;
  padding: 10px 14px;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.input[aria-invalid="true"], .select[aria-invalid="true"] {
  border-color: var(--danger);
}
.input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 4px rgba(196, 67, 54, 0.15);
}
.textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.7;
}
.input.num-input {
  font-family: var(--font-mono);
  direction: ltr;
  text-align: start;
}

.field-row {
  display: grid;
  gap: var(--sp-3);
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  cursor: pointer;
  user-select: none;
}
.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── التنبيهات (Alerts) ──────────────────────────────────────── */
.alert {
  padding: 14px var(--sp-5);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  border-inline-start-width: 4px;
  font-size: 14px;
  margin-bottom: var(--sp-4);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
}
.alert-success {
  background: color-mix(in srgb, var(--success) 6%, var(--surface));
  border-inline-start-color: var(--success);
}
.alert-error {
  background: color-mix(in srgb, var(--danger) 6%, var(--surface));
  border-inline-start-color: var(--danger);
}
.alert-warning {
  background: color-mix(in srgb, var(--warning) 6%, var(--surface));
  border-inline-start-color: var(--warning);
}
.alert-info {
  background: color-mix(in srgb, var(--info) 6%, var(--surface));
  border-inline-start-color: var(--info);
}

/* ── الحالة الفارغة (Empty State) ───────────────────────────── */
.empty {
  text-align: center;
  padding: var(--sp-10) var(--sp-6);
  color: var(--ink-muted);
}
.empty h3 {
  color: var(--ink);
  margin-bottom: 8px;
  font-size: 18px;
}
.empty p {
  max-width: 48ch;
  margin: 0 auto var(--sp-4);
  font-size: 14px;
  color: var(--ink-faint);
}

/* ── التقويم (Calendar System) ───────────────────────────────── */
.cal {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.cal-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.cal-scroll {
  overflow-x: auto;
  min-height: 420px;
  background: var(--surface);
}
.cal-grid {
  min-width: auto;
  position: relative;
}
.cal-grid.hidden,
.cal-agenda.hidden {
  display: none !important;
}
.cal-agenda {
  padding: var(--sp-4);
  min-height: 360px;
}
.cal-agenda-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}
.cal-agenda-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--line);
}
.cal-agenda-day-link {
  text-decoration: none;
  color: inherit;
}
.cal-agenda-day-link:hover strong {
  color: var(--accent);
}
.cal-agenda-day-items {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.cal-agenda-item {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, background .15s;
}
.cal-agenda-item:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.cal-agenda-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: 6px;
}
.cal-agenda-item-main {
  font-size: 14px;
  margin-bottom: 4px;
}
.cal-agenda-item-meta {
  line-height: 1.5;
}
.cal-legend {
  flex-wrap: wrap;
  gap: 8px;
}
.cal-header-row {
  display: grid;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--surface-2);
  z-index: 2;
}
.cal-header-cell {
  padding: 10px 4px;
  text-align: center;
  font-size: 12.5px;
  border-inline-start: 1px solid var(--line);
  color: var(--ink-muted);
  font-weight: 600;
}
.cal-header-cell.today {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.cal-row {
  display: grid;
  border-bottom: 1px solid var(--line);
  min-height: 70px;
  position: relative;
}
.cal-row:last-child {
  border-bottom: none;
}
.cal-unit {
  padding: var(--sp-3) var(--sp-4);
  font-size: 13.5px;
  font-weight: 600;
  border-inline-start: 1px solid var(--line);
  background: var(--surface-2);
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}
.cal-unit .swatch {
  width: 10px;
  height: 10px;
  border-radius: var(--r-sm);
  flex: none;
}
.cal-track {
  position: relative;
  grid-column: 2 / -1;
}
.cal-cell {
  border-inline-start: 1px solid var(--line);
}

.cal-slice {
  position: absolute;
  top: 8px;
  bottom: 8px;
  border-radius: var(--r-sm);
  padding: 4px 10px;
  font-size: 11.5px;
  color: #fff;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15,25,22,.15);
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: all 0.2s ease;
}
.cal-slice:hover {
  filter: brightness(1.1);
  transform: scaleY(1.04);
  z-index: 5;
  box-shadow: 0 4px 12px rgba(15,25,22,.25);
}
.cal-slice .ref {
  font-family: var(--font-mono);
  font-size: 10px;
  opacity: .85;
}
.cal-slice .who {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* وقت التجهيز — منطقة مخطّطة لا تُحجز */
.cal-buffer {
  position: absolute;
  top: 8px;
  bottom: 8px;
  border-radius: var(--r-sm);
  background-image: repeating-linear-gradient(45deg,
    var(--line-strong) 0, var(--line-strong) 2px, transparent 2px, transparent 8px);
  border: 1px dashed var(--line-strong);
  pointer-events: none;
  opacity: .75;
}

/* شبكة شهرية — إشغال يومي */
.cal-month-grid {
  min-width: auto !important;
  padding: var(--sp-4);
}
.cal-month-head,
.cal-month-body {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cal-month-dow {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-muted);
  padding: 6px 0;
}
.cal-month-cell {
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 8px;
  text-align: start;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color .15s, box-shadow .15s;
  text-decoration: none;
  color: inherit;
}
.cal-month-cell:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.cal-month-cell.today {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.cal-month-cell.busy {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.cal-month-cell.free .cal-month-free {
  color: var(--ink-muted);
  font-size: 11px;
}
.cal-month-empty {
  background: transparent;
  border: none;
  cursor: default;
  min-height: 0;
}
.cal-month-day {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
}
.cal-month-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
}
.cal-month-units {
  font-size: 10px;
  color: var(--ink-muted);
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.cal-day-group {
  margin-bottom: 16px;
}
.cal-day-group:last-child {
  margin-bottom: 0;
}
.cal-day-unit {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.cal-day-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cal-day-item {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  text-decoration: none;
  color: inherit;
}
.cal-day-item:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* يوم → شاليهات → تفاصيل */
.cal-unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-4);
}
.cal-unit-card {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  padding: var(--sp-4);
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.cal-unit-card.busy:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.cal-unit-card.free {
  opacity: .85;
  background: var(--surface-2);
}
.cal-unit-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--sp-3);
}
.cal-unit-card-head .badge {
  margin-inline-start: auto;
}
.cal-unit-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cal-unit-card-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.cal-unit-card-foot {
  margin-top: var(--sp-3);
  padding-top: var(--sp-2);
  border-top: 1px solid var(--line);
}
.cal-booking-detail-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}
.cal-booking-detail .card-body {
  padding-top: 0;
}

/* ── لوحة كانبان ──────────────────────────────────────────── */
.kanban {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--sp-4);
}
.kanban-col {
  background: var(--surface-2);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
}
.kanban-col h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: var(--sp-4);
  display: flex;
  gap: 8px;
  align-items: center;
}
.kanban-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
  font-size: 13.5px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.kanban-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.kanban-card.urgent {
  border-inline-start: 4px solid var(--danger);
}

/* ── شريط الدفعات والأسعار الجانبي ──────────────────────────── */
.summary {
  position: sticky;
  top: calc(var(--header-h) + var(--sp-5));
}
.summary-line {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 8px 0;
  font-size: 14px;
}
.summary-line + .summary-line {
  border-top: 1px dashed var(--line);
}
.summary-line .label {
  color: var(--ink-muted);
}
.summary-line .value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.summary-total {
  border-top: 2px solid var(--line-strong) !important;
  margin-top: var(--sp-3);
  padding-top: var(--sp-4) !important;
  font-size: 17px;
  font-weight: 700;
}
.summary-total .value {
  color: var(--accent);
  font-family: var(--font-display);
}

/* ── النواة والرسائل المنبثقة (Toasts) ─────────────────────────────── */
.toasts {
  position: fixed;
  inset-block-start: 24px;
  inset-inline-start: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--line-strong);
  border-inline-start: 4px solid var(--accent);
  border-radius: var(--r-md);
  padding: 14px var(--sp-5);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  max-width: 420px;
  animation: toast-in .25s cubic-bezier(0.4, 0, 0.2, 1);
}
.toast.error   { border-inline-start-color: var(--danger); }
.toast.success { border-inline-start-color: var(--success); }
.toast.warning { border-inline-start-color: var(--warning); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: none; }
}

/* ── النوافذ العائمة (Modals) ────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8,15,12,.65);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 150;
  padding: var(--sp-4);
}
.modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: min(580px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-zoom 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes modal-zoom {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
.modal-head {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  background: linear-gradient(to bottom, var(--surface), var(--surface-2));
}
.modal-head h3 {
  font-size: 16.5px;
  font-weight: 600;
}
.modal-head .close {
  margin-inline-start: auto;
}
.modal-body {
  padding: var(--sp-5);
}
.modal-foot {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--line);
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-start;
  background: var(--surface-2);
}

/* ── التبويبات (Tabs) ───────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--sp-5);
  overflow-x: auto;
}
.tab {
  padding: 10px var(--sp-5);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  background: none;
  border: none;
  font-family: var(--font-body);
  transition: all 0.2s ease;
}
.tab:hover {
  color: var(--ink);
  background: var(--surface-2);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
}
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* ── الإكمال التلقائي (Autocomplete) ──────────────────────── */
.ac-wrap {
  position: relative;
}
.ac-list {
  position: absolute;
  inset-inline: 0;
  top: calc(100% + 6px);
  z-index: 100;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  max-height: 280px;
  overflow-y: auto;
}
.ac-item {
  padding: 10px var(--sp-3);
  font-size: 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.15s ease;
}
.ac-item:last-child {
  border-bottom: none;
}
.ac-item:hover, .ac-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.ac-item .meta {
  font-size: 12px;
  color: var(--ink-faint);
}

/* ── صفحة تسجيل الدخول الفاخرة (Auth Pages) ────────────────── */
.auth-page-bg {
  background: linear-gradient(135deg, #072b24 0%, #031411 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.auth-page-bg::after {
  content: "";
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(36, 112, 75, 0.15) 0%, rgba(0,0,0,0) 70%);
  top: -100px;
  right: -100px;
  z-index: 1;
}
.auth-page-bg::before {
  content: "";
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(186, 141, 73, 0.1) 0%, rgba(0,0,0,0) 70%);
  bottom: -100px;
  left: -100px;
  z-index: 1;
}
.auth-card {
  z-index: 10;
  width: min(420px, 100%);
  background: rgba(12, 21, 18, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-xl);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  padding: var(--sp-8) var(--sp-6);
  color: #fff;
}
.auth-card .card {
  background: transparent;
  border: none;
  box-shadow: none;
}
.auth-card .card:hover {
  transform: none;
  box-shadow: none;
}
.auth-card .card-body {
  padding: 0;
}
.auth-card .input {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: none;
}
.auth-card .input:focus {
  background: rgba(255,255,255,0.08);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(92, 184, 138, 0.2);
}
.auth-card label {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
}
.auth-card h1 {
  color: #fff;
}
.auth-card .brand-mark {
  background: var(--accent-gradient);
  box-shadow: 0 4px 15px rgba(92, 184, 138, 0.4);
}

/* ── أدوات مساعدة (Utilities) ──────────────────────────────── */
.muted { color: var(--ink-muted); }
.faint { color: var(--ink-faint); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.accent { color: var(--accent); }
.danger { color: var(--danger); }
.success { color: var(--success); }
.warning { color: var(--warning); }
.row { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.row-tight { display: flex; align-items: center; gap: 6px; }
.spacer { margin-inline-start: auto; }
.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--sp-2); }
.hidden { display: none !important; }
.mt-4 { margin-top: var(--sp-4); }
.mb-4 { margin-bottom: var(--sp-4); }
.nowrap { white-space: nowrap; }

.pagination { display: flex; gap: 6px; justify-content: center; padding: var(--sp-5); flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  font-size: 13.5px; font-family: var(--font-mono); color: var(--ink-muted);
  transition: all 0.2s ease;
}
.pagination a:hover { background: var(--surface-2); text-decoration: none; border-color: var(--line-strong); }
.pagination .current { background: var(--accent-gradient); border-color: transparent; color: #fff; font-weight: 600; }

/* ── تقدم رفع الوسائط ─────────────────────────────────────── */
.upload-progress {
  margin-top: var(--sp-3);
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.upload-progress[hidden] { display: none !important; }
.upload-progress__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.upload-progress__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-progress__pct {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.upload-progress__track {
  height: 8px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  overflow: hidden;
}
.upload-progress__fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--accent-gradient);
  box-shadow: 0 1px 3px rgba(36, 112, 75, 0.2);
  transition: width 160ms cubic-bezier(0.4, 0, 0.2, 1);
}
.upload-progress.is-indeterminate .upload-progress__fill {
  width: 40%;
  animation: upload-pulse 1.2s ease-in-out infinite;
}
.upload-progress.is-processing .upload-progress__fill {
  background: var(--brass-gradient);
}
.upload-progress.is-error {
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
  background: color-mix(in srgb, var(--danger) 6%, var(--surface));
}
.upload-progress.is-error .upload-progress__fill {
  background: var(--danger);
  width: 100%;
}
.upload-progress.is-error .upload-progress__pct,
.upload-progress.is-error .upload-progress__status {
  color: var(--danger);
}
.upload-progress__status {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
}
@keyframes upload-pulse {
  50% { opacity: 0.55; }
}

/* ── شريط التنقل السفلي للأجهزة المحمولة (Mobile Bottom Bar) ─ */
.mobile-bottom-bar {
  display: none;
  position: fixed;
  bottom: 0;
  inset-inline: 0;
  height: 64px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--line);
  z-index: 100;
  justify-content: space-around;
  align-items: center;
  padding: 0 8px;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
}
.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 12px;
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--r-md);
  transition: all 0.2s ease;
  min-width: 54px;
}
.mobile-nav-item:hover, .mobile-nav-item.active {
  color: var(--accent);
  text-decoration: none;
}
.mobile-nav-item.active {
  font-weight: 700;
}
.mobile-nav-item svg {
  width: 22px;
  height: 22px;
  stroke-width: 2;
}
.mobile-nav-fab {
  margin-top: -24px;
  background: var(--accent-gradient);
  color: #fff !important;
  width: 48px;
  height: 48px;
  border-radius: var(--r-full);
  box-shadow: 0 4px 14px var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.mobile-nav-fab svg {
  width: 26px;
  height: 26px;
}

/* ── الشاشات الصغيرة (Responsive Design) ───────────────────── */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset-block: 0; inset-inline-end: 0; width: var(--sidebar-w);
    transform: translateX(-100%); transition: transform .25s cubic-bezier(0.4, 0, 0.2, 1); z-index: 100;
    box-shadow: var(--shadow-lg);
    background: var(--surface);
  }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: none !important; }
  .content { padding: var(--sp-4) var(--sp-4) 84px; }
  .summary { position: static; }
  .topbar { padding: 0 var(--sp-4); }
  .mobile-bottom-bar { display: flex; }
}

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

@media print {
  .sidebar, .topbar, .actions, .btn, .mobile-bottom-bar, .seg-tabs, .tabs, .report-filters, .cmdk-backdrop, .skip-link { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .content { padding: 0; }
  .card { border: none; box-shadow: none; }
}

/* ═══════════════════════════════════════════════════════════════
   v2 — طبقة التحسينات العالمية (UX Polish Layer)
   تُحمَّل بعد كل ما سبق؛ تعيد ضبط السلوك دون كسر الصفحات القائمة.
   ═══════════════════════════════════════════════════════════════ */

/* الطباعة الرقمية: أرقام متساوية العرض في كل مكان مالي */
body { font-size: 14.5px; text-rendering: optimizeLegibility; }
.kpi-value, .num, td.num, .money { font-variant-numeric: tabular-nums; }
::selection { background: var(--accent-glow); }

/* رابط التخطي للوحة المفاتيح */
.skip-link {
  position: absolute; inset-inline-start: 12px; top: -48px; z-index: 300;
  background: var(--ink); color: var(--surface); padding: 10px 16px;
  border-radius: var(--r-md); font-weight: 600; transition: top var(--dur) var(--ease-smooth);
}
.skip-link:focus { top: 12px; color: var(--surface); }

/* البطاقات الثابتة لا ترتفع — الحركة للعناصر القابلة للنقر فقط */
.card, .kpi { transition: border-color var(--dur) var(--ease-smooth), box-shadow var(--dur) var(--ease-smooth); }
.card:hover, .kpi:hover { transform: none; box-shadow: var(--shadow); }
.card-head { background: var(--surface); }
a.card:hover, .card.is-link:hover, a.kpi:hover {
  border-color: var(--line-strong); box-shadow: var(--shadow-lg);
}
.kpi::before { display: none; }
a.kpi { display: block; color: inherit; text-decoration: none; }

/* أزرار: ارتفاع لمس ثابت وحالة ضغط واضحة */
.btn { min-height: 40px; transition: background-color var(--dur-fast) var(--ease-smooth), border-color var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast); }
.btn:active { transform: translateY(1px); }
.btn-sm { min-height: 34px; }
.btn-gold { background: var(--brass-soft); color: var(--brass-deep); border: 1px solid color-mix(in srgb, var(--brass) 40%, transparent); }
.btn-gold:hover { background: color-mix(in srgb, var(--brass) 22%, var(--surface)); color: var(--brass-deep); }
.btn-icon { width: 40px; padding: 0; justify-content: center; }

/* الحقول: تركيز ناعم بحلقة هوية */
.input:focus, .select:focus, .textarea:focus { box-shadow: var(--shadow-glow); border-color: var(--accent); }

/* الجداول: ترويسة ثابتة وصفوف أوضح */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); }
tbody tr { transition: background-color var(--dur-fast); }
tbody tr:hover td { background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }

/* ── الشعار في الشريط الجانبي ─────────────────────────────── */
.brand-logo { height: 40px; width: auto; display: block; }
[data-theme="dark"] .brand-logo { filter: drop-shadow(0 0 1px rgba(255,255,255,.25)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }

.sidebar-user {
  margin-top: auto; padding-top: var(--sp-4); border-top: 1px solid var(--line);
}
.sidebar-user-card {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 10px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md);
}
.avatar {
  width: 34px; height: 34px; flex: none; border-radius: var(--r-full);
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: var(--brass-gradient); color: #fff; font-family: var(--font-display);
}
.sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-line { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 11.5px; font-weight: 600; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.status-line.ok { color: var(--success); }
.status-line.warn { color: var(--warning); }

/* ── الترويسة: زر البحث السريع ────────────────────────────── */
.cmdk-trigger {
  display: inline-flex; align-items: center; gap: 10px; min-height: 38px;
  padding: 0 10px 0 14px; min-width: 240px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-full);
  color: var(--ink-faint); font: inherit; font-size: 13px; cursor: pointer;
  transition: border-color var(--dur-fast), background-color var(--dur-fast);
}
.cmdk-trigger:hover { border-color: var(--line-strong); color: var(--ink-muted); }
.cmdk-trigger svg { width: 16px; height: 16px; flex: none; }
.cmdk-trigger span { flex: 1; text-align: start; }
kbd, .kbd {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600; line-height: 1;
  padding: 4px 6px; border-radius: 6px; direction: ltr;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-muted);
  box-shadow: 0 1px 0 var(--line);
}
.topbar-actions { display: flex; align-items: center; gap: var(--sp-2); }
.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center; flex: none;
  border-radius: var(--r-full); border: 1px solid transparent; background: transparent;
  color: var(--ink-muted); cursor: pointer; transition: background-color var(--dur-fast), color var(--dur-fast);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }
.menu-toggle { display: none; }

/* ── لوحة الأوامر Ctrl+K ──────────────────────────────────── */
.cmdk-backdrop {
  position: fixed; inset: 0; z-index: 400; background: rgba(15, 12, 9, 0.45);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px;
  opacity: 0; transition: opacity var(--dur) var(--ease-smooth);
}
.cmdk-backdrop.open { opacity: 1; }
.cmdk-backdrop[hidden] { display: none; }
.cmdk {
  width: min(560px, 100%); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-xl); box-shadow: var(--shadow-lg); overflow: hidden;
  transform: translateY(-8px) scale(.98); transition: transform var(--dur) var(--ease-smooth);
}
.cmdk-backdrop.open .cmdk { transform: none; }
.cmdk-input-row { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.cmdk-input-row svg { width: 20px; height: 20px; color: var(--ink-faint); flex: none; }
.cmdk-input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; font-size: 16px; color: var(--ink); }
.cmdk-list { max-height: 52vh; overflow-y: auto; padding: 6px; margin: 0; list-style: none; }
.cmdk-group { font-size: 11px; font-weight: 600; color: var(--ink-faint); padding: 10px 10px 4px; }
.cmdk-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-md);
  color: var(--ink); cursor: pointer; font-size: 14px;
}
.cmdk-item svg { width: 18px; height: 18px; color: var(--ink-faint); flex: none; }
.cmdk-item .hint { margin-inline-start: auto; font-size: 12px; color: var(--ink-faint); }
.cmdk-item[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
.cmdk-item[aria-selected="true"] svg { color: var(--accent); }
.cmdk-empty { padding: 28px 16px; text-align: center; color: var(--ink-faint); font-size: 13px; }
.cmdk-foot { display: flex; gap: 14px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-faint); background: var(--surface-2); }

/* ── خلفية الشريط الجانبي على الجوال ───────────────────────── */
.sidebar-backdrop {
  position: fixed; inset: 0; z-index: 95; background: rgba(15, 12, 9, 0.4);
  opacity: 0; pointer-events: none; transition: opacity var(--dur) var(--ease-smooth);
}
body.nav-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }

/* ── الصفحة الرئيسية v2 ───────────────────────────────────── */
.dash-hero {
  display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4);
  flex-wrap: wrap; margin-bottom: var(--sp-5);
}
.dash-hero-title { font-size: 24px; font-weight: 700; }
.dash-hero-sub { color: var(--ink-muted); font-size: 14px; margin-top: 4px; }
.dash-quick { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

.callout {
  display: flex; align-items: center; gap: var(--sp-3); padding: 14px 16px; margin-bottom: var(--sp-4);
  border-radius: var(--r-lg); border: 1px solid; background: var(--surface);
}
.callout svg { width: 22px; height: 22px; flex: none; }
.callout-body { flex: 1; min-width: 0; }
.callout-title { font-weight: 600; display: block; }
.callout-text { font-size: 13px; color: var(--ink-muted); }
.callout.warn { border-color: color-mix(in srgb, var(--warning) 40%, transparent); background: color-mix(in srgb, var(--warning) 7%, var(--surface)); }
.callout.warn svg { color: var(--warning); }

.kpi-grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: var(--sp-5); }
.kpi { padding: var(--sp-5); box-shadow: none; }
.kpi-icon {
  width: 36px; height: 36px; border-radius: var(--r-md); display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent);
}
.kpi-icon svg { width: 18px; height: 18px; }
.kpi-icon.gold { background: var(--brass-soft); color: var(--brass-deep); }
.kpi-icon.water { background: var(--water-soft); color: var(--water); }
.kpi-icon.danger { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }
.kpi-icon.warn { background: color-mix(in srgb, var(--warning) 12%, var(--surface)); color: var(--warning); }
.kpi-value { font-size: 30px; letter-spacing: -.02em; }
.kpi-value .unit { font-size: 13px; font-weight: 500; color: var(--ink-faint); margin-inline-start: 4px; letter-spacing: 0; }
.kpi-value.is-zero { color: var(--ink-faint); }
.kpi-split { display: flex; align-items: baseline; gap: 14px; }
.kpi-split b { font-weight: 700; }
.kpi-split small { font-size: 12.5px; font-weight: 500; color: var(--ink-faint); margin-inline-start: 4px; }
.meter { height: 6px; border-radius: var(--r-full); background: var(--surface-3); margin-top: 12px; overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .6s var(--ease-smooth); }

.section-head { display: flex; align-items: center; gap: var(--sp-3); margin: var(--sp-6) 0 var(--sp-3); }
.section-head h2 { font-size: 17px; }
.section-head .count {
  font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: var(--r-full);
  background: var(--surface-3); color: var(--ink-muted); font-family: var(--font-mono);
}
.section-head .actions { margin-inline-start: auto; }

/* قائمة الحركات — تتكيف مع الجوال أفضل من الجدول */
.move-list { list-style: none; margin: 0; padding: 0; }
.move-item {
  display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; align-items: center; gap: var(--sp-3);
  padding: 12px var(--sp-5); border-bottom: 1px solid var(--line);
}
.move-item:last-child { border-bottom: 0; }
.move-item:hover { background: color-mix(in srgb, var(--accent) 3%, var(--surface)); }
.move-time { font-family: var(--font-mono); font-weight: 600; font-size: 13.5px; direction: ltr; text-align: start; color: var(--ink); }
.move-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.move-who .avatar { width: 32px; height: 32px; font-size: 12px; background: var(--accent-soft); color: var(--accent); }
.move-who.out .avatar { background: var(--water-soft); color: var(--water); }
.move-name { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.move-meta { font-size: 12px; color: var(--ink-faint); display: flex; gap: 8px; flex-wrap: wrap; }
.move-side { display: flex; align-items: center; gap: var(--sp-2); }
.amount-due { color: var(--danger); font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.amount-ok { color: var(--success); font-weight: 600; font-size: 12.5px; }
.empty-inline { padding: var(--sp-8) var(--sp-5); text-align: center; color: var(--ink-faint); font-size: 13.5px; }
.empty-inline svg { width: 28px; height: 28px; display: block; margin: 0 auto 8px; opacity: .6; }

/* مخطط الإيرادات — أعمدة بمحور ومؤشر */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding-top: 8px; border-bottom: 1px solid var(--line); position: relative; }
.bars .bar {
  flex: 1; min-width: 4px; border-radius: 4px 4px 0 0; background: var(--accent);
  opacity: .85; position: relative; transition: opacity var(--dur-fast);
}
.bars .bar.zero { background: var(--surface-3); opacity: 1; }
.bars .bar:hover, .bars .bar:focus-visible { opacity: 1; outline: none; }
.bars .bar.peak { background: var(--brass); }
.bars .bar .tip {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--surface); font-size: 11.5px; white-space: nowrap;
  padding: 5px 8px; border-radius: 6px; pointer-events: none; opacity: 0; transition: opacity var(--dur-fast);
  font-family: var(--font-mono); direction: ltr; z-index: 2;
}
.bars .bar:hover .tip, .bars .bar:focus-visible .tip { opacity: 1; }
.bars-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-faint); margin-top: 8px; font-family: var(--font-mono); }
.chart-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; font-size: 13px; color: var(--ink-muted); }

/* ── هيكل التحميل (Skeleton) ──────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%; animation: skeleton 1.3s ease infinite; border-radius: var(--r-sm);
}
@keyframes skeleton { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* العربية لا تحتمل التباعد الحرفي ولا خط Mono */
.nav-group, .brand-sub { font-family: var(--font-body); letter-spacing: 0; text-transform: none; }
.nav-group { font-size: 11.5px; font-weight: 600; }
.brand-sub { font-size: 11.5px; font-weight: 500; color: var(--brass-deep); }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── شارات الحالة بنقطة ملونة ─────────────────────────────── */
.badge { font-weight: 600; }

/* ── صفحة الدخول v2 — شاشة منقسمة ─────────────────────────── */
.auth2 { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); background: var(--ground); }
.auth2-panel {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
  padding: 48px; color: #fff;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(196,160,53,.22) 0%, transparent 55%),
    radial-gradient(90% 70% at 0% 100%, rgba(74,155,200,.22) 0%, transparent 60%),
    linear-gradient(160deg, #1C5138 0%, #123726 100%);
}
.auth2-panel h2 { color: #fff; font-size: 30px; line-height: 1.35; max-width: 16ch; }
.auth2-panel p { color: rgba(255,255,255,.78); max-width: 42ch; font-size: 15px; }
.auth2-features { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; }
.auth2-features li { display: flex; gap: 10px; align-items: center; color: rgba(255,255,255,.9); font-size: 14px; }
.auth2-features svg { width: 20px; height: 20px; color: #DDBB5E; flex: none; }
.auth2-waves { position: absolute; inset-inline: -10%; bottom: -30px; width: 120%; opacity: .35; pointer-events: none; }
.auth2-foot { font-size: 12px; color: rgba(255,255,255,.55); position: relative; }
.auth2-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth2-card { width: min(400px, 100%); }
.auth2-logo { height: 84px; width: auto; display: block; margin-bottom: 28px; }
.auth2-card h1 { font-size: 24px; margin-bottom: 6px; }
.auth2-card .lead { color: var(--ink-muted); margin: 0 0 28px; font-size: 14px; }
.auth2-card .field label { font-weight: 600; color: var(--ink); }
.auth2-card .input { min-height: 48px; font-size: 15px; }
.input-affix { position: relative; }
.input-affix .input { padding-inline-end: 46px; }
.input-affix .affix-btn {
  position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border: 0; background: transparent; border-radius: var(--r-sm);
  color: var(--ink-faint); cursor: pointer; display: grid; place-items: center;
}
.input-affix .affix-btn:hover { color: var(--ink); background: var(--surface-2); }
.input-affix .affix-btn svg { width: 18px; height: 18px; }
.auth2-card .btn-primary { min-height: 50px; font-size: 15px; font-weight: 700; }
.auth2-note { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-faint); display: flex; gap: 8px; align-items: flex-start; }
.auth2-note svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.caps-warn { display: none; font-size: 12px; color: var(--warning); font-weight: 600; margin-top: 6px; }
.caps-warn.show { display: block; }

@media (max-width: 900px) {
  .auth2 { grid-template-columns: 1fr; }
  .auth2-panel { display: none; }
  .auth2-main { align-items: flex-start; padding-top: 12vh; }
}


/* ═══ v2.1 — القوائم والجداول ═══════════════════════════════════ */
/* إصلاح: ‎.num‎ كانت تجعل خلية الجدول inline-block فتنكسر الأعمدة */
td.mono, th.mono { display: table-cell; text-align: right; }
[dir="ltr"] td.mono, [dir="ltr"] th.mono { text-align: left; }
th.num, td.num { display: table-cell; direction: rtl; text-align: end; font-family: var(--font-body); }
th.num { font-family: var(--font-display); }
.money { font-family: var(--font-body); font-weight: 600; }
td.num .money, td.num .mono { direction: ltr; unicode-bidi: isolate; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* شريط البحث والفلاتر */
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.toolbar-search { position: relative; flex: 1 1 280px; min-width: 0; }
.toolbar-search svg { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-faint); pointer-events: none; }
.toolbar-search .input { padding-inline-start: 42px; min-height: 44px; border-radius: var(--r-full); }
.toolbar .btn { min-height: 44px; }
.toolbar-more { position: relative; }
.toolbar-more > summary { list-style: none; cursor: pointer; }
.toolbar-more > summary::-webkit-details-marker { display: none; }
.toolbar-more[open] > summary { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.toolbar-panel {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 30; width: min(560px, 92vw);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3);
  padding: var(--sp-4); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
}
.toolbar-panel .field { margin: 0; }
.toolbar-panel-foot { grid-column: 1 / -1; display: flex; justify-content: flex-end; }

/* تبويبات الحالة */
.seg-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: var(--sp-4); scrollbar-width: none; }
.seg-tabs::-webkit-scrollbar { display: none; }
.seg-tab {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; flex: none;
  min-height: 36px; padding: 0 14px; border-radius: var(--r-full); font-size: 13px; font-weight: 600;
  color: var(--ink-muted); background: var(--surface); border: 1px solid var(--line);
  transition: background-color var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.seg-tab:hover { color: var(--ink); border-color: var(--line-strong); text-decoration: none; }
.seg-tab.active { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.seg-tab.active .status-dot { box-shadow: 0 0 0 2px var(--ink); }
.seg-count { font-family: var(--font-mono); font-size: 11.5px; padding: 1px 7px; border-radius: var(--r-full); background: color-mix(in srgb, var(--surface) 20%, transparent); }

/* خلايا الجداول المركّبة */
.cell-guest { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-guest .avatar { width: 34px; height: 34px; font-size: 12.5px; background: var(--surface-3); color: var(--ink-muted); }
.avatar.vip { background: var(--brass-gradient); color: #fff; }
.cell-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 600; color: var(--ink); }
.cell-title a { color: var(--ink); }
.cell-title a:hover { color: var(--accent); }
.cell-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-faint); margin-top: 2px; }
.cell-sub a { color: var(--ink-muted); }
.unit-swatch { width: 9px; height: 9px; border-radius: 3px; flex: none; display: inline-block; }
.badge-xs { padding: 1px 7px; font-size: 10.5px; }
.badge-neutral { background: var(--surface-2); color: var(--ink-muted); }
tr.row-link { cursor: pointer; }

/* ترقيم الصفحات */
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin-top: var(--sp-4); }
.pager-info { font-size: 12.5px; color: var(--ink-faint); }
.pager-links { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pager-num, .pager-btn {
  min-width: 36px; height: 36px; padding: 0 10px; display: inline-grid; place-items: center;
  border-radius: var(--r-md); font-size: 13px; font-weight: 600; color: var(--ink-muted);
  border: 1px solid var(--line); background: var(--surface);
}
.pager-num:hover, .pager-btn:hover { color: var(--ink); border-color: var(--line-strong); text-decoration: none; }
.pager-num.current { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.pager-gap { color: var(--ink-faint); padding: 0 4px; }

/* الجدول يتحول إلى بطاقات على الجوال */
@media (max-width: 760px) {
  .toolbar-panel { grid-template-columns: 1fr; position: static; width: 100%; margin-top: 8px; box-shadow: none; }
  .toolbar-more { flex: 1 1 100%; order: 3; }
  .table-wrap:has(.table-cards) { border: 0; background: transparent; box-shadow: none; overflow: visible; }
  .table-cards, .table-cards tbody { display: block; }
  .table-cards thead { display: none; }
  .table-cards tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px; padding: 14px;
    margin-bottom: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  }
  .table-cards td { display: block; padding: 0; border: 0 !important; background: transparent !important; text-align: start; }
  .table-cards td:first-child { grid-column: 1 / -1; }
  .table-cards td.num { display: block; direction: rtl; font-size: 14px; text-align: start; }
  .table-cards td[data-label]:not(:first-child)::before {
    content: attr(data-label); display: block; font-size: 11.5px; color: var(--ink-faint);
    font-family: var(--font-body); font-weight: 500; margin-bottom: 2px;
  }
  /* بطاقة الحجز: الحالة بجانب الضيف، الإقامة سطر كامل، ثم المبالغ */
  .table-cards.bookings td[data-label="الضيف"] { grid-column: 1; grid-row: 1; }
  .table-cards.bookings td[data-label="الحالة"] { grid-column: 2; grid-row: 1; align-self: start; }
  .table-cards.bookings td[data-label="الحالة"]::before,
  .table-cards.bookings td[data-label="الإقامة"]::before { display: none; }
  .table-cards.bookings td[data-label="الإقامة"] { grid-column: 1 / -1; grid-row: 2; padding-top: 10px; border-top: 1px dashed var(--line) !important; }
  .table-cards.bookings td[data-label="الإجمالي"] { grid-column: 1; grid-row: 3; }
  .table-cards.bookings td[data-label="المتبقي"] { grid-column: 2; grid-row: 3; text-align: end; }
  .table-cards td.action-col { display: none; }
  .table-cards td.action-col.keep { display: flex; gap: 8px; grid-column: 1 / -1; justify-content: flex-start; padding-top: 8px; border-top: 1px dashed var(--line) !important; }
  .table-cards td.action-col.keep .btn { flex: 1; }
  .table-cards tbody tr:hover td { background: transparent; }
}


.day-nav .input { min-height: 36px; padding: 4px 10px; width: auto; }
tr.is-voided td { opacity: .45; text-decoration: line-through; }

/* ═══ v2.1 — صفحة الحجز ═════════════════════════════════════════ */
.bk-hero { display: grid; grid-template-columns: minmax(0, 1fr) 300px; }
.bk-hero-main { padding: var(--sp-6); min-width: 0; }
.bk-hero-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bk-guest { font-size: 24px; margin: 10px 0 4px; }
.bk-guest a { color: var(--ink); }
.bk-guest a:hover { color: var(--accent); }
.bk-contact { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--ink-muted); }
.bk-stay {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--sp-4);
  margin-top: var(--sp-5); padding: var(--sp-4); background: var(--surface-2); border-radius: var(--r-lg);
}
.bk-stay-point { display: flex; flex-direction: column; gap: 2px; }
.bk-stay-point:last-child { text-align: end; }
.bk-stay-label { font-size: 12px; color: var(--ink-faint); }
.bk-stay-point strong { font-family: var(--font-display); font-size: 16px; color: var(--ink); }
.bk-stay-time { font-size: 14px; color: var(--ink-muted); font-weight: 600; }
.bk-stay-line {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  padding-top: 14px;
}
.bk-stay-line::before {
  content: ""; position: absolute; top: 4px; inset-inline: 0; height: 2px; border-radius: 2px;
  background: repeating-linear-gradient(90deg, var(--line-strong) 0 6px, transparent 6px 10px);
}
.bk-stay-unit { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); font-size: 13.5px; }
.bk-stay-dur { font-size: 12px; color: var(--ink-faint); }
.bk-meta { display: flex; gap: 6px 16px; flex-wrap: wrap; margin-top: var(--sp-4); font-size: 12.5px; color: var(--ink-faint); }
.bk-hero-money { padding: var(--sp-6); border-inline-start: 1px solid var(--line); background: var(--surface-2); display: flex; flex-direction: column; }
.bk-money-row { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 0; color: var(--ink-muted); font-size: 13.5px; }
.bk-money-row strong { color: var(--ink); font-size: 15px; }
.bk-money-status { font-size: 12px; color: var(--ink-faint); margin-top: 6px; }
.bk-balance { margin-top: var(--sp-4); padding: 12px 14px; border-radius: var(--r-md); display: flex; flex-direction: column; gap: 2px; }
.bk-balance span { font-size: 12.5px; font-weight: 600; }
.bk-balance strong { font-family: var(--font-display); font-size: 24px; }
.bk-balance.due { background: color-mix(in srgb, var(--danger) 9%, var(--surface)); color: var(--danger); }
.bk-balance.ok { background: var(--accent-soft); color: var(--accent); }
.bk-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bk-actions form { margin: 0; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
details.bk-move > summary, details.report-filters > summary { list-style: none; cursor: pointer; }
details.bk-move > summary::-webkit-details-marker, details.report-filters > summary::-webkit-details-marker { display: none; }
details.bk-move > summary::after, details.report-filters > summary::after { content: "+"; font-size: 20px; color: var(--ink-faint); margin-inline-start: 8px; }
details.bk-move[open] > summary::after, details.report-filters[open] > summary::after { content: "−"; }
details.bk-move:not([open]) > summary, details.report-filters:not([open]) > summary { border-bottom: 0; }
.tabs { position: sticky; top: var(--header-h); z-index: 20; background: var(--ground); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
@media (max-width: 900px) {
  .bk-hero { grid-template-columns: 1fr; }
  .bk-hero-money { border-inline-start: 0; border-top: 1px solid var(--line); }
  .bk-hero-main, .bk-hero-money { padding: var(--sp-4); }
  .bk-guest { font-size: 20px; }
  .bk-stay { gap: var(--sp-2); padding: var(--sp-3); }
}


/* القيم العربية بخط القراءة؛ ‎.mono‎ صراحةً للأرقام والمراجع فقط */
.summary-line .value { font-family: var(--font-body); font-weight: 600; }
.summary-line .value.mono { font-family: var(--font-mono); font-weight: 500; }
/* ترويسة لا تنكسر على الجوال */
.topbar > div:not(.topbar-spacer):not(.topbar-actions) { min-width: 0; flex: 0 1 auto; }
.topbar h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) {
  .topbar-breadcrumb { display: none; }
  .topbar h1 { font-size: 16px; }
  .tabs { top: var(--header-h); }
}


/* ═══ v2.2 — نموذج الحجز ═════════════════════════════════════════ */
.bk-form { display: grid; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; gap: var(--sp-6); }
.step-num {
  width: 26px; height: 26px; border-radius: var(--r-full); flex: none; display: inline-grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; font-family: var(--font-display);
}
.step-num.gold { background: var(--brass); }
.duration-out { display: flex; align-items: center; background: var(--accent-soft); border-color: transparent; font-weight: 700; color: var(--accent); }
.bk-form-summary .card-head { background: var(--surface); }
.preset-btn { border-radius: var(--r-md); }
.preset-btn.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.bk-form-bar { display: none; }
@media (max-width: 1100px) {
  .bk-form { grid-template-columns: 1fr; }
  .bk-form-summary { position: static; }
}
@media (max-width: 900px) {
  .bk-form { padding-bottom: 72px; }
  .bk-form-summary > .card-body > .btn { display: none; }
  .bk-form-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: fixed; inset-inline: 0; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 90;
    padding: 10px 16px; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 18px rgba(0,0,0,.06);
  }
  .bk-form-bar > div { display: flex; flex-direction: column; line-height: 1.3; }
  .bk-form-bar strong { font-size: 17px; font-family: var(--font-display); }
  .bk-form-bar .btn { min-height: 46px; padding: 0 24px; }
}


/* ═══ v2.2 — التقويم ═════════════════════════════════════════════ */
.cal-month-cell.busy { background: var(--surface); }
.cal-month-cell.full { background: color-mix(in srgb, var(--brass) 10%, var(--surface)); border-color: color-mix(in srgb, var(--brass) 45%, transparent); }
.cal-month-cell.full .cal-month-count { color: var(--brass-deep); }
.cal-month-cell.today .cal-month-day {
  background: var(--accent); color: #fff; border-radius: var(--r-full); width: 28px; height: 28px;
  display: inline-grid; place-items: center; font-size: 14px;
}
.cal-month-cell.today { background: var(--surface); }
.cal-dots { display: flex; gap: 4px; flex-wrap: wrap; }
.cal-dots i { width: 8px; height: 8px; border-radius: 50%; display: block; }
.cal-month-count { font-size: 12px; font-weight: 700; color: var(--ink); }
.cal-month-units { font-size: 11px; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-legend-v2 { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; margin-top: var(--sp-4); }
.cal-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-muted); }
.cal-legend-item i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.cal-legend-item i.full-swatch { border-radius: 3px; background: color-mix(in srgb, var(--brass) 25%, var(--surface)); border: 1px solid var(--brass); }
@media (max-width: 600px) {
  .cal-month-cell { min-height: 56px; padding: 6px; }
  .cal-month-units { display: none; }
  .cal-month-count { font-size: 10.5px; }
  .cal-month-day { font-size: 13px; }
}


/* ═══ v2.2 — بطاقات الشاليهات ═══════════════════════════════════ */
.unit-grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.unit-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; display: flex; flex-direction: column; }
.unit-card.is-off { opacity: .78; }
.unit-card-band { height: 6px; }
.unit-card-body { padding: var(--sp-4) var(--sp-5); flex: 1; }
.unit-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); }
.unit-card-head h3 { font-size: 16.5px; margin: 0 0 2px; }
.unit-card-head h3 a { color: var(--ink); }
.unit-card-head h3 a:hover { color: var(--accent); }
.unit-facts { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); margin: var(--sp-4) 0 0; }
.unit-facts div { background: var(--surface-2); border-radius: var(--r-md); padding: 10px 12px; }
.unit-facts dt { font-size: 11.5px; color: var(--ink-faint); }
.unit-facts dd { margin: 2px 0 0; font-weight: 700; font-size: 15px; color: var(--ink); font-family: var(--font-display); }
.unit-card-foot { display: flex; align-items: center; gap: 2px; flex-wrap: nowrap; overflow-x: auto; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--surface-2); }
.unit-card-foot form { margin: 0; margin-inline-start: auto; }
.unit-card-foot .btn { white-space: nowrap; padding-inline: 10px; }
.icon-btn.danger { color: var(--danger); }
.icon-btn.danger:hover { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }


/* ═══ v2.3 — ملف العميل ═══════════════════════════════════════════ */
.profile-hero { padding: 0; }
.profile-id { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-5) var(--sp-6); flex-wrap: wrap; }
.profile-avatar { width: 56px; height: 56px; font-size: 22px; background: var(--accent-soft); color: var(--accent); }
.profile-name { font-size: 22px; margin: 0; }
.profile-actions { display: flex; gap: 8px; margin-inline-start: auto; flex-wrap: wrap; }
.profile-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin: 0; border-top: 1px solid var(--line); }
.profile-stats > div { padding: 14px var(--sp-6); border-inline-start: 1px solid var(--line); }
.profile-stats > div:first-child { border-inline-start: 0; }
.profile-stats dt { font-size: 12px; color: var(--ink-faint); }
.profile-stats dd { margin: 2px 0 0; font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--ink); }
.profile-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); gap: var(--sp-5); align-items: start; }
.history-item { grid-template-columns: 56px minmax(0, 1fr) auto; }
.history-date { display: flex; flex-direction: column; align-items: center; line-height: 1.1; padding: 6px 0; border-radius: var(--r-md); background: var(--surface-2); }
.history-date strong { font-family: var(--font-display); font-size: 18px; color: var(--ink); }
.history-date span { font-size: 10.5px; color: var(--ink-faint); font-family: var(--font-mono); }
.doc-tile { padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); }
.danger-zone .card-head h3 { color: var(--danger); }
@media (max-width: 1000px) {
  .profile-layout { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .profile-id { padding: var(--sp-4); }
  .profile-actions { margin-inline-start: 0; width: 100%; }
  .profile-actions .btn { flex: 1; }
  .profile-stats { grid-template-columns: 1fr 1fr; }
  .profile-stats > div { padding: 12px var(--sp-4); border-top: 1px solid var(--line); }
  .profile-stats > div:nth-child(odd) { border-inline-start: 0; }
  .history-item { grid-template-columns: 48px minmax(0, 1fr); }
  .history-item .move-side { grid-column: 2; }
}


/* ═══ v2.3 — الخط الزمني لليوم ═══════════════════════════════════ */
.day-timeline { padding: var(--sp-4) var(--sp-5); }
.tl-axis, .tl-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: var(--sp-3); }
.tl-hours { position: relative; height: 20px; border-bottom: 1px solid var(--line); }
.tl-hours span { position: absolute; bottom: 4px; transform: translateX(50%); font-size: 11px; color: var(--ink-faint); font-family: var(--font-mono); }
.tl-row { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.tl-row:last-child { border-bottom: 0; }
.tl-label-col { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-track {
  position: relative; height: 34px; border-radius: var(--r-sm);
  background: repeating-linear-gradient(90deg, var(--surface-2) 0 calc(12.5% - 1px), var(--line) calc(12.5% - 1px) 12.5%);
}
.tl-bar {
  position: absolute; top: 3px; bottom: 3px; border-radius: 6px; padding: 0 8px; overflow: hidden;
  display: flex; align-items: center; font-size: 12px; font-weight: 600; color: #fff; text-decoration: none;
  background: var(--bar, var(--accent)); box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.tl-bar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-bar:hover { filter: brightness(1.08); color: #fff; text-decoration: none; }
.tl-bar.st-hold, .tl-bar.st-pending_deposit {
  background: repeating-linear-gradient(135deg, var(--bar) 0 8px, color-mix(in srgb, var(--bar) 70%, #fff) 8px 16px);
}
.tl-bar.st-completed { opacity: .55; }
.tl-now { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--danger); border-radius: 2px; }
.tl-now::before { content: ""; position: absolute; top: -3px; inset-inline-start: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
@media (max-width: 700px) {
  .tl-axis, .tl-row { grid-template-columns: 84px minmax(0, 1fr); gap: 8px; }
  .tl-label-col { font-size: 12px; }
  .tl-hours span:nth-child(even) { display: none; }
  .tl-bar span { display: none; }
}

/* ── الاستجابة v2 ─────────────────────────────────────────── */
@media (max-width: 900px) {
  /* إصلاح: الشريط الجانبي يخرج من يمين الشاشة في RTL ويُخفى فعلياً */
  .sidebar { inset-inline-end: auto; inset-inline-start: 0; }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: none !important; }
  .menu-toggle { display: inline-grid; }
  .cmdk-trigger { min-width: 0; width: 38px; padding: 0; justify-content: center; }
  .cmdk-trigger span, .cmdk-trigger kbd { display: none; }
  .live-clock { display: none; }
  .topbar-new span { display: none; }
  .dash-hero-title { font-size: 20px; }
  .move-item { grid-template-columns: 56px minmax(0, 1fr) auto; gap: 10px; padding: 12px var(--sp-4); }
  .move-time { font-size: 12.5px; }
  .move-who .avatar { display: none; }
  .kpi-value { font-size: 26px; }
  .mobile-bottom-bar { height: calc(64px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); }
}
@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
  .kpi { padding: var(--sp-4); }
  .kpi-value { font-size: 22px; }
  .shift-pill span:last-child { display: none; }
}
