/* ══════════════════════════════════════════════
   نظافة — المتغيرات والأنماط الأساسية
   ══════════════════════════════════════════════ */

/* ─── المتغيرات (Light Mode) ─── */
:root {
  /* الألوان الأساسية */
  --color-primary:        #1B5E20;
  --color-primary-light:  #2E7D32;
  --color-primary-mid:    #388E3C;
  --color-accent:         #4CAF50;
  --color-accent-light:   #81C784;
  --color-accent-pale:    #E8F5E9;

  /* ألوان الحالة */
  --color-success:        #43A047;
  --color-success-bg:     #E8F5E9;
  --color-warning:        #F57F17;
  --color-warning-bg:     #FFF8E1;
  --color-danger:         #C62828;
  --color-danger-bg:      #FFEBEE;
  --color-danger-light:   #EF5350;
  --color-info:           #0277BD;
  --color-info-bg:        #E1F5FE;

  /* ألوان النص */
  --color-text:           #1A1A1A;
  --color-text-secondary: #555555;
  --color-text-muted:     #888888;
  --color-text-inverse:   #FFFFFF;

  /* ألوان الخلفية */
  --color-bg:             #F5F7F5;
  --color-surface:        #FFFFFF;
  --color-surface-2:      #F0F4F0;
  --color-border:         #D8E4D8;
  --color-border-light:   #EAF0EA;

  /* الخطوط */
  --font-arabic:    'Cairo', 'Segoe UI', system-ui, sans-serif;
  --font-latin:     'Inter', 'Segoe UI', system-ui, sans-serif;

  /* الأحجام */
  --font-xs:    0.75rem;   /* 12px */
  --font-sm:    0.8125rem; /* 13px */
  --font-base:  0.9375rem; /* 15px */
  --font-md:    1rem;      /* 16px */
  --font-lg:    1.125rem;  /* 18px */
  --font-xl:    1.375rem;  /* 22px */
  --font-2xl:   1.75rem;   /* 28px */
  --font-3xl:   2.25rem;   /* 36px */

  /* المسافات */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* الزوايا */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  20px;
  --radius-full: 9999px;

  /* الظلال */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.08);
  --shadow-xl:  0 16px 40px rgba(0,0,0,0.14);

  /* التخطيط */
  --topbar-height:    60px;
  --bottomnav-height: 64px;
  --max-content:      640px;

  /* الانتقالات */
  --transition-fast:   150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow:   350ms ease;
}

/* ─── الوضع الداكن ─── */
[data-theme="dark"] {
  --color-primary:        #81C784;
  --color-primary-light:  #A5D6A7;
  --color-accent:         #66BB6A;
  --color-accent-light:   #A5D6A7;
  --color-accent-pale:    #1B3A1D;

  --color-success:        #66BB6A;
  --color-success-bg:     #1B3A1D;
  --color-warning:        #FFB74D;
  --color-warning-bg:     #3A2B00;
  --color-danger:         #EF5350;
  --color-danger-bg:      #3B1010;
  --color-danger-light:   #EF5350;
  --color-info:           #4FC3F7;
  --color-info-bg:        #0D2A3B;

  --color-text:           #E8F5E9;
  --color-text-secondary: #B0BEC5;
  --color-text-muted:     #78909C;
  --color-text-inverse:   #1A1A1A;

  --color-bg:             #0E1A0E;
  --color-surface:        #162416;
  --color-surface-2:      #1E301E;
  --color-border:         #2A3D2A;
  --color-border-light:   #243524;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.35);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.4);
  --shadow-xl:  0 16px 40px rgba(0,0,0,0.5);
}

/* ─── إعادة الضبط الأساسية ─── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-arabic);
  font-size: var(--font-base);
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  direction: rtl;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: lining-nums;
  -moz-font-feature-settings: "lnum";
  -webkit-font-feature-settings: "lnum";
  font-feature-settings: "lnum";
}

/* ─── الأرقام العربية في العرض ─── */
.arabic-num {
  font-feature-settings: "lnum";
}

/* ─── الروابط ─── */
a {
  color: inherit;
  text-decoration: none;
}

/* ─── الصور ─── */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ─── النماذج ─── */
input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* ─── المساعد: إخفاء ─── */
.hidden {
  display: none !important;
}

/* ══════════════════════════════════════════════
   شاشة التحميل — أنيميشن الكنس
   ══════════════════════════════════════════════ */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(ellipse at 50% 45%, #1a5c20 0%, #0a2e10 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}

/* ─── جزيئات الغبار العائمة ─── */
.ls-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ls-p {
  position: absolute;
  left: var(--x);
  top:  var(--y);
  width:  var(--z);
  height: var(--z);
  border-radius: 50%;
  background: rgba(165, 214, 167, 0.35);
  animation: ls-float 3s ease-in-out var(--s) infinite alternate,
             ls-broom-scatter 1.4s ease-in 0.3s forwards;
}

@keyframes ls-float {
  from { transform: translateY(0) scale(1);   opacity: 0.3; }
  to   { transform: translateY(-18px) scale(1.3); opacity: 0.7; }
}

@keyframes ls-broom-scatter {
  0%   { opacity: 0.5; transform: translateY(0); }
  60%  { opacity: 0.5; transform: translateY(0); }
  80%  { opacity: 0;   transform: translateY(-40px) translateX(-30px); }
  100% { opacity: 0;   transform: translateY(-80px) translateX(-60px); }
}

/* ─── المكنسة ─── */
.ls-broom {
  position: absolute;
  bottom: 14%;
  width: 90px;
  filter: drop-shadow(0 4px 16px rgba(76,175,80,0.4));
  animation: ls-sweep 1.1s cubic-bezier(0.22, 0.61, 0.36, 1) 0.2s forwards;
  transform: translateX(60vw);
  will-change: transform;
}

@keyframes ls-sweep {
  0%   { transform: translateX(60vw)  rotate(0deg); }
  30%  { transform: translateX(20vw)  rotate(-3deg); }
  65%  { transform: translateX(-10vw) rotate(2deg); }
  100% { transform: translateX(-70vw) rotate(-1deg); }
}

/* ─── خط التنظيف خلف المكنسة ─── */
.ls-clean-trail {
  position: absolute;
  bottom: 14%;
  left: 0;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, transparent, rgba(165,214,167,0.6), rgba(255,255,255,0.3));
  animation: ls-trail 1.1s ease-in 0.2s forwards;
  border-radius: 0 2px 2px 0;
}

@keyframes ls-trail {
  0%   { width: 0;    opacity: 0; }
  20%  { opacity: 1; }
  100% { width: 75%;  opacity: 0.4; }
}

/* ─── المحتوى المركزي ─── */
.ls-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: ls-content-appear 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.85s both;
}

@keyframes ls-content-appear {
  from { opacity: 0; transform: scale(0.8) translateY(16px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}

/* ─── اللوجو وحلقات التوهج ─── */
.ls-logo-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ls-glow-ring {
  position: absolute;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 2px solid rgba(76, 175, 80, 0.5);
  animation: ls-ring-expand 1.8s ease-out 1.3s infinite;
}

.ls-glow-ring-2 {
  border-color: rgba(165, 214, 167, 0.3);
  animation-delay: 1.6s;
}

@keyframes ls-ring-expand {
  0%   { transform: scale(0.9); opacity: 0.8; }
  100% { transform: scale(2);   opacity: 0; }
}

.ls-logo-svg {
  position: relative;
  z-index: 1;
  border-radius: 20px;
  box-shadow: 0 0 0 3px rgba(76,175,80,0.3),
              0 8px 32px rgba(0,0,0,0.4);
}

/* لمعة على اللوجو بعد الكنس */
.ls-shine {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background: linear-gradient(135deg,
    rgba(255,255,255,0.35) 0%,
    rgba(255,255,255,0) 50%,
    rgba(255,255,255,0) 100%);
  animation: ls-shine-move 2.5s ease 1.4s infinite;
  z-index: 2;
  pointer-events: none;
}

@keyframes ls-shine-move {
  0%   { background-position: -100% -100%; opacity: 0; }
  30%  { opacity: 1; }
  60%  { background-position: 200% 200%; opacity: 0; }
  100% { opacity: 0; }
}

/* ─── الاسم والوصف ─── */
.ls-title {
  font-size: 2rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 16px rgba(0,0,0,0.4);
  animation: ls-title-reveal 0.6s ease 1.1s both;
}

@keyframes ls-title-reveal {
  from { opacity: 0; clip-path: inset(0 100% 0 0); }
  to   { opacity: 1; clip-path: inset(0 0%   0 0); }
}

.ls-subtitle {
  font-size: 0.875rem;
  color: rgba(165, 214, 167, 0.85);
  animation: ls-fade-up 0.6s ease 1.3s both;
}

@keyframes ls-fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── نقاط التحميل ─── */
.ls-dots-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  animation: ls-fade-up 0.4s ease 1.5s both;
}

.ls-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(165, 214, 167, 0.6);
  animation: ls-dot-bounce 1.2s ease-in-out 1.6s infinite;
}

.ls-dot:nth-child(2) { animation-delay: 1.75s; }
.ls-dot:nth-child(3) { animation-delay: 1.9s;  }

@keyframes ls-dot-bounce {
  0%, 60%, 100% { transform: translateY(0);    opacity: 0.4; }
  30%            { transform: translateY(-8px); opacity: 1;   }
}

/* ─── بريق ما بعد الكنس ─── */
.ls-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ls-sparkle {
  position: absolute;
  left: var(--sx);
  top:  var(--sy);
  width: 6px;
  height: 6px;
  animation: ls-sparkle-pop 0.6s ease var(--sd) 1 forwards;
  opacity: 0;
}

.ls-sparkle::before,
.ls-sparkle::after {
  content: '';
  position: absolute;
  background: #A5D6A7;
  border-radius: 2px;
}

.ls-sparkle::before {
  width: 2px; height: 100%;
  left: 50%; top: 0;
  transform: translateX(-50%);
}

.ls-sparkle::after {
  width: 100%; height: 2px;
  left: 0; top: 50%;
  transform: translateY(-50%);
}

@keyframes ls-sparkle-pop {
  0%   { opacity: 0; transform: scale(0) rotate(0deg);   }
  40%  { opacity: 1; transform: scale(1.8) rotate(30deg); }
  70%  { opacity: 0.7; transform: scale(1.2) rotate(45deg); }
  100% { opacity: 0; transform: scale(0) rotate(90deg);  }
}

/* ══════════════════════════════════════════════
   شاشة تسجيل الدخول
   ══════════════════════════════════════════════ */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: linear-gradient(145deg, var(--color-primary) 0%, var(--color-primary-mid) 50%, #1a7a1f 100%);
  overflow: auto;
}

.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(76,175,80,0.3) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(27,94,32,0.4) 0%, transparent 60%);
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  background: rgba(255,255,255,0.97);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-6);
  box-shadow: var(--shadow-xl);
  text-align: center;
}

[data-theme="dark"] .login-card {
  background: rgba(22,36,22,0.97);
}

.login-brand {
  margin-bottom: var(--space-8);
}

.brand-icon {
  display: inline-flex;
  margin-bottom: var(--space-4);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.brand-name {
  font-size: var(--font-3xl);
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: -0.5px;
  margin-bottom: var(--space-2);
}

.brand-tagline {
  font-size: var(--font-sm);
  color: var(--color-text-secondary);
}

.login-features {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
  text-align: right;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--font-sm);
  color: var(--color-text-secondary);
  background: var(--color-surface-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
}

.feature-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.login-note {
  margin-top: var(--space-4);
  font-size: var(--font-xs);
  color: var(--color-text-muted);
}

/* ══════════════════════════════════════════════
   هيكل التطبيق
   ══════════════════════════════════════════════ */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ─── الشريط العلوي ─── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  gap: var(--space-3);
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition-normal);
}

.topbar-start {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  font-size: var(--font-md);
  color: var(--color-primary);
}

.topbar-title {
  font-size: var(--font-md);
  font-weight: 600;
  color: var(--color-text);
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-end {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

/* ─── المحتوى الرئيسي ─── */
.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: calc(var(--bottomnav-height) + var(--space-4));
}

/* ─── الصفحات ─── */
.page {
  display: block;
  min-height: calc(100vh - var(--topbar-height) - var(--bottomnav-height));
  min-height: calc(100dvh - var(--topbar-height) - var(--bottomnav-height));
}

.page-body {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* ─── شريط التنقل السفلي ─── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--bottomnav-height);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 var(--space-2);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
  transition: background-color var(--transition-normal);

  /* Safe area for mobile */
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1;
  min-width: 0;
  padding: var(--space-2) var(--space-1);
  color: var(--color-text-muted);
  border-radius: var(--radius-md);
  transition: color var(--transition-fast), background-color var(--transition-fast);
  cursor: pointer;
}

.nav-item span {
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
}

.nav-item svg {
  transition: transform var(--transition-fast);
}

.nav-item:hover {
  color: var(--color-accent);
}

.nav-item.active {
  color: var(--color-primary);
}

.nav-item.active svg {
  stroke: var(--color-primary);
  transform: scale(1.1);
}

/* ══════════════════════════════════════════════
   لوحة التحكم (Dashboard)
   ══════════════════════════════════════════════ */

/* بطاقة الشهر الرئيسية */
.month-card {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-mid) 100%);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-5);
  color: white;
  box-shadow: var(--shadow-md);
}

.month-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.month-label {
  font-size: var(--font-xs);
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-1);
}

.month-name {
  font-size: var(--font-xl);
  font-weight: 700;
}

.month-nav {
  display: flex;
  gap: var(--space-1);
}

.btn-icon-sm {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.2);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.btn-icon-sm:hover {
  background: rgba(255,255,255,0.35);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.stat-item {
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  backdrop-filter: blur(4px);
}

.stat-value {
  display: block;
  font-size: var(--font-2xl);
  font-weight: 800;
  line-height: 1.1;
}

.stat-label {
  display: block;
  font-size: var(--font-xs);
  opacity: 0.8;
  margin-top: var(--space-1);
}

.stat-paid { background: rgba(129,199,132,0.25); }
.stat-due  { background: rgba(255,183,77,0.25); }

/* شريط التقدم */
.progress-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.progress-bar {
  height: 8px;
  background: rgba(255,255,255,0.25);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #A5D6A7;
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.progress-label {
  font-size: var(--font-xs);
  opacity: 0.85;
  text-align: center;
}

/* بطاقة الغسلة القادمة */
.upcoming-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  box-shadow: var(--shadow-sm);
}

.upcoming-icon {
  font-size: 1.75rem;
  flex-shrink: 0;
}

.upcoming-info {
  flex: 1;
}

.upcoming-title {
  font-size: var(--font-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}

.upcoming-date {
  font-size: var(--font-md);
  font-weight: 600;
  color: var(--color-text);
}

.upcoming-badge {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--font-xs);
  font-weight: 600;
  background: var(--color-accent-pale);
  color: var(--color-primary);
  flex-shrink: 0;
}

/* عنوان القسم */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title {
  font-size: var(--font-md);
  font-weight: 700;
  color: var(--color-text);
}

.section-link {
  font-size: var(--font-sm);
  color: var(--color-accent);
  font-weight: 500;
}

/* ══════════════════════════════════════════════
   قائمة الغسلات
   ══════════════════════════════════════════════ */
.wash-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.wash-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.wash-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-border);
}

.wash-card-type {
  font-size: 1.5rem;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent-pale);
  border-radius: var(--radius-md);
}

.wash-card-info {
  flex: 1;
  min-width: 0;
}

.wash-card-title {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 2px;
}

.wash-card-date {
  font-size: var(--font-xs);
  color: var(--color-text-muted);
}

.wash-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

.wash-card-end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
  flex-shrink: 0;
}

.wash-card-price {
  font-size: var(--font-md);
  font-weight: 700;
  color: var(--color-text);
}

/* ── الشارات ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}

.badge-paid {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.badge-unpaid {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.badge-extra {
  background: var(--color-info-bg);
  color: var(--color-info);
}

.badge-type {
  background: var(--color-accent-pale);
  color: var(--color-primary);
}

/* ═══ الحالة الفارغة ═══ */
.empty-state {
  text-align: center;
  padding: var(--space-10) var(--space-4);
  color: var(--color-text-muted);
}

.empty-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: var(--space-3);
}

.empty-state p {
  font-size: var(--font-md);
  margin-bottom: var(--space-2);
}

.empty-sub {
  font-size: var(--font-sm) !important;
  color: var(--color-text-muted);
}

.empty-state-sm {
  text-align: center;
  padding: var(--space-6) var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--font-sm);
}

/* ══════════════════════════════════════════════
   فلتر السجل
   ══════════════════════════════════════════════ */
.filter-bar {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  box-shadow: var(--shadow-sm);
}

.filter-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

/* ══════════════════════════════════════════════
   التقرير
   ══════════════════════════════════════════════ */
.report-month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-sm);
}

.report-month-title {
  font-size: var(--font-lg);
  font-weight: 700;
  color: var(--color-text);
}

.report-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.report-stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  box-shadow: var(--shadow-sm);
}

.report-stat-paid {
  background: var(--color-success-bg);
  border-color: var(--color-success-bg);
}

.report-stat-due {
  background: var(--color-warning-bg);
  border-color: var(--color-warning-bg);
}

.report-stat-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.report-stat-value {
  display: block;
  font-size: var(--font-lg);
  font-weight: 800;
  color: var(--color-text);
  line-height: 1.1;
}

.report-stat-label {
  display: block;
  font-size: var(--font-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

.report-type-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.report-type-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border-light);
}

.report-type-row:last-child {
  border-bottom: none;
}

.report-type-name {
  font-size: var(--font-sm);
  color: var(--color-text);
  flex: 1;
}

.report-type-count {
  font-size: var(--font-sm);
  color: var(--color-text-muted);
}

.report-type-price {
  font-size: var(--font-sm);
  font-weight: 700;
  color: var(--color-text);
}

.report-rating-display {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) 0;
}

.report-rating-stars {
  font-size: 1.5rem;
  color: #F59E0B;
  letter-spacing: 2px;
}

.report-rating-value {
  font-size: var(--font-md);
  font-weight: 600;
  color: var(--color-text);
}

/* ══════════════════════════════════════════════
   تبويبات التقرير
   ══════════════════════════════════════════════ */
#report-monthly-view,
#report-yearly-view {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.report-tabs {
  display: flex;
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-1);
  gap: var(--space-1);
  box-shadow: var(--shadow-sm);
}

.report-tab {
  flex: 1;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.report-tab.active {
  background: var(--color-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

/* ══════════════════════════════════════════════
   شريط التبويبات + زر التصدير
   ══════════════════════════════════════════════ */
.report-tabs-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.report-tabs-row .report-tabs {
  flex: 1;
}

.export-btn {
  flex-shrink: 0;
  white-space: nowrap;
  font-size: var(--font-xs);
  padding: var(--space-2) var(--space-3);
}

/* ══════════════════════════════════════════════
   مودال التصدير
   ══════════════════════════════════════════════ */
.export-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

/* ══════════════════════════════════════════════
   منطقة الخطر
   ══════════════════════════════════════════════ */
.danger-zone-card {
  border-color: var(--color-danger) !important;
  border-width: 1.5px !important;
}

.danger-zone-title {
  color: var(--color-danger) !important;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.danger-zone-desc {
  font-size: var(--font-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
  line-height: 1.6;
}

.btn-danger {
  background: var(--color-danger);
  color: white;
  border: none;
}

.btn-danger:hover {
  background: #c0392b;
}

/* ══════════════════════════════════════════════
   مخطط الأشهر (bar chart بسيط بـ CSS)
   ══════════════════════════════════════════════ */
.months-chart {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  height: 120px;
  padding-top: var(--space-3);
}

.chart-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  height: 100%;
  justify-content: flex-end;
}

.chart-bar {
  width: 100%;
  background: var(--color-accent);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  min-height: 4px;
  transition: height var(--transition-slow);
  position: relative;
}

.chart-bar.current-month {
  background: var(--color-primary);
}

.chart-bar-label {
  font-size: 9px;
  color: var(--color-text-muted);
  text-align: center;
  white-space: nowrap;
}

.chart-bar-value {
  font-size: 9px;
  color: var(--color-text-muted);
  font-weight: 600;
}

/* ══════════════════════════════════════════════
   قائمة أشهر السنة
   ══════════════════════════════════════════════ */
.year-months-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.year-month-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-2);
  border-radius: var(--radius-md);
  transition: background-color var(--transition-fast);
}

.year-month-row:hover {
  background: var(--color-surface-2);
}

.year-month-name {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--color-text);
  width: 80px;
  flex-shrink: 0;
}

.year-month-bar-wrap {
  flex: 1;
  height: 8px;
  background: var(--color-border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.year-month-bar {
  height: 100%;
  background: var(--color-accent);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.year-month-stats {
  display: flex;
  gap: var(--space-3);
  flex-shrink: 0;
}

.year-month-count {
  font-size: var(--font-xs);
  color: var(--color-text-muted);
  min-width: 40px;
  text-align: center;
}

.year-month-amount {
  font-size: var(--font-xs);
  font-weight: 700;
  color: var(--color-text);
  min-width: 60px;
  text-align: left;
}

/* ══════════════════════════════════════════════
   الإعدادات
   ══════════════════════════════════════════════ */
.worker-display {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
}

.worker-avatar {
  font-size: 2rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent-pale);
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.worker-info {
  flex: 1;
}

.worker-name {
  font-size: var(--font-md);
  font-weight: 600;
  color: var(--color-text);
}

.worker-phone {
  font-size: var(--font-sm);
  color: var(--color-text-muted);
  direction: ltr;
  text-align: right;
}

.worker-form {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border-light);
}

/* رأس بطاقة مع زر */
.form-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.form-card-header .form-card-title {
  margin-bottom: 0;
}

.wash-types-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.wash-type-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.wash-type-row:hover {
  background: var(--color-accent-pale);
}

.wash-type-info {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
}

.wash-type-emoji {
  font-size: 1.3rem;
  line-height: 1;
}

.wash-type-actions {
  display: flex;
  gap: var(--space-1);
  align-items: center;
}

.wash-type-actions .btn-icon {
  width: 30px;
  height: 30px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-light);
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
}

.wash-type-actions .btn-icon:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-accent-pale);
}

.wash-type-actions .btn-icon.danger:hover {
  border-color: var(--color-danger);
  color: var(--color-danger);
  background: rgba(231, 76, 60, 0.07);
}

/* منتقي الأيقونة */
.icon-selected-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.icon-preview {
  font-size: 2rem;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface-2);
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast);
}

.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
  padding: var(--space-2);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  margin-top: var(--space-2);
}

.icon-picker-btn {
  font-size: 1.4rem;
  padding: 6px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: center;
  line-height: 1;
  transition: all var(--transition-fast);
}

.icon-picker-btn:hover {
  background: var(--color-accent-pale);
  transform: scale(1.2);
}

.icon-picker-btn.selected {
  border-color: var(--color-primary);
  background: var(--color-accent-pale);
}

.account-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  margin-bottom: var(--space-4);
}

.account-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  object-fit: cover;
  flex-shrink: 0;
}

.account-name {
  font-size: var(--font-md);
  font-weight: 600;
  color: var(--color-text);
}

.account-email {
  font-size: var(--font-sm);
  color: var(--color-text-muted);
  direction: ltr;
  text-align: right;
}

/* تفاصيل الغسلة */
.wash-detail-content {
  padding: var(--space-4) 0;
}

.wash-detail-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border-light);
  gap: var(--space-4);
}

.wash-detail-row:last-child {
  border-bottom: none;
}

.wash-detail-label {
  font-size: var(--font-sm);
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.wash-detail-value {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--color-text);
  text-align: left;
}

.wash-detail-photo {
  width: 100%;
  border-radius: var(--radius-md);
  margin-top: var(--space-3);
  object-fit: cover;
  max-height: 220px;
}

.wash-detail-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

/* ══════════════════════════════════════════════
   تحميل المزيد
   ══════════════════════════════════════════════ */
.load-more {
  text-align: center;
  padding: var(--space-4) 0;
}

/* ══════════════════════════════════════════════
   الأنيميشنات
   ══════════════════════════════════════════════ */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.85; transform: scale(1.05); }
}

@keyframes slideUp {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes toastIn {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.page-enter {
  animation: slideUp var(--transition-normal) ease;
}

/* ══════════════════════════════════════════════
   التكيّف مع الشاشات الكبيرة
   ══════════════════════════════════════════════ */
@media (min-width: 640px) {
  .stat-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .report-summary {
    grid-template-columns: repeat(4, 1fr);
  }

  .login-card {
    padding: var(--space-10) var(--space-8);
  }
}

@media (min-width: 768px) {
  :root {
    --bottomnav-height: 72px;
  }

  .topbar-brand span {
    display: inline;
  }
}

/* ══════════════════════════════════════════════
   تحسينات إمكانية الوصول
   ══════════════════════════════════════════════ */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ══════════════════════════════════════════════
   جولة الشرح التعليمية
   ══════════════════════════════════════════════ */

/* زر الاستفهام */
.tour-help-btn {
  position: relative;
}

.tour-help-btn::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--color-primary);
  opacity: 0;
  animation: tour-pulse 2.5s ease-in-out 3 forwards;
}

@keyframes tour-pulse {
  0%, 100% { transform: scale(1);   opacity: 0; }
  50%       { transform: scale(1.3); opacity: 0.5; }
}

/* طبقة الخلفية المعتمة */
.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  pointer-events: none;
  background: transparent;
}

.tour-overlay.active {
  pointer-events: all;
}

/* Spotlight — الدائرة المضيئة */
.tour-spotlight {
  position: fixed;
  z-index: 2001;
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.72);
  transition: all 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.tour-spotlight.no-target {
  width: 0 !important;
  height: 0 !important;
  border-radius: 50%;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.82);
}

/* بطاقة الشرح */
.tour-card {
  position: fixed;
  z-index: 2002;
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  width: min(340px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  box-sizing: border-box;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.08);
  transition: top 0.45s cubic-bezier(0.4, 0, 0.2, 1),
              left 0.45s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.45s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.25s ease;
  animation: tour-card-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  /* منع الخروج خارج الشاشة */
  overflow: hidden;
}

@keyframes tour-card-in {
  from { opacity: 0; scale: 0.94; }
  to   { opacity: 1; scale: 1; }
}

.tour-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

/* نقاط التقدم */
.tour-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.tour-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-border);
  transition: all 0.3s ease;
}

.tour-dot.active {
  background: var(--color-primary);
  width: 20px;
  border-radius: 4px;
}

.tour-dot.done {
  background: var(--color-primary);
  opacity: 0.4;
}

/* زر تخطى */
.tour-skip-btn {
  font-size: var(--font-xs);
  color: var(--color-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}

.tour-skip-btn:hover {
  color: var(--color-danger);
}

/* أيقونة الخطوة */
.tour-icon {
  font-size: 2.2rem;
  margin-bottom: var(--space-2);
  display: block;
  animation: tour-icon-bounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s both;
}

@keyframes tour-icon-bounce {
  from { transform: scale(0) rotate(-15deg); }
  to   { transform: scale(1) rotate(0deg); }
}

.tour-title {
  font-size: var(--font-lg);
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: var(--space-2);
  line-height: 1.3;
}

.tour-desc {
  font-size: var(--font-sm);
  color: var(--color-text-muted);
  line-height: 1.7;
  margin-bottom: var(--space-4);
}

.tour-footer {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}

/* سهم التوجيه */
.tour-arrow {
  position: fixed;
  z-index: 2003;
  width: 0;
  height: 0;
  pointer-events: none;
  transition: all 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.tour-arrow-up {
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid var(--color-surface);
}

.tour-arrow-down {
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid var(--color-surface);
}

/* ══════════════════════════════════════════════
   صفحة الطباعة / PDF
   ══════════════════════════════════════════════ */
.print-page {
  direction: rtl;
  font-family: 'Cairo', 'Segoe UI', sans-serif;
  color: #1a1a1a;
  max-width: 900px;
  margin: 0 auto;
  padding: 32px;
}

.print-header {
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 3px solid #1B5E20;
  padding-bottom: 20px;
  margin-bottom: 28px;
}

.print-logo {
  width: 52px;
  height: 52px;
  background: #1B5E20;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #A5D6A7;
  font-size: 28px;
  flex-shrink: 0;
}

.print-header-info h1 {
  font-size: 22px;
  font-weight: 800;
  color: #1B5E20;
  margin: 0 0 4px;
}

.print-header-info p {
  font-size: 13px;
  color: #666;
  margin: 0;
}

.print-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.print-stat {
  background: #f8faf8;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}

.print-stat-value {
  font-size: 20px;
  font-weight: 800;
  color: #1B5E20;
  display: block;
}

.print-stat-label {
  font-size: 12px;
  color: #888;
  margin-top: 4px;
  display: block;
}

.print-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.print-table th {
  background: #1B5E20;
  color: white;
  padding: 10px 12px;
  text-align: right;
  font-weight: 600;
}

.print-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #eee;
  text-align: right;
}

.print-table tr:nth-child(even) td {
  background: #f9f9f9;
}

.print-badge-paid {
  background: #e8f5e9;
  color: #2e7d32;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.print-badge-unpaid {
  background: #fff8e1;
  color: #e65100;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.print-footer {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid #e0e0e0;
  font-size: 12px;
  color: #aaa;
  text-align: center;
}
