/* =====================================================
   iOS Pro Design v3.0 — تصميم احترافي محسّن
   ألوان جذابة + خطوط عريضة + بدون تداخل
   ===================================================== */

/* ============= استيراد الخطوط ============= */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800;900&family=Tajawal:wght@400;500;700;800;900&display=swap');

/* ============= متغيرات ============= */
:root {
  /* ألوان أساسية احترافية */
  --primary: #1a1a2e;
  --primary-light: #16213e;
  --primary-accent: #0f3460;
  --accent: #e94560;
  --accent-gold: #f5b041;

  /* ألوان iOS محسّنة */
  --ios-blue: #007AFF;
  --ios-indigo: #5856D6;
  --ios-purple: #AF52DE;
  --ios-pink: #FF2D55;
  --ios-red: #FF3B30;
  --ios-orange: #FF9500;
  --ios-yellow: #FFCC00;
  --ios-green: #34C759;
  --ios-teal: #00C7BE;
  --ios-mint: #5AC8FA;

  /* خلفيات */
  --bg-main: #F0F2F5;
  --bg-card: #FFFFFF;
  --bg-soft: #F8F9FB;
  --bg-hover: #F0F2F5;

  /* نصوص */
  --text-primary: #1C1C1E;
  --text-secondary: #636366;
  --text-tertiary: #AEAEB2;
  --text-quaternary: #C7C7CC;

  /* حدود */
  --border-light: #E5E5EA;
  --border-medium: #D1D1D6;

  /* ظلال احترافية */
  --shadow-card: 0 2px 12px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.03);
  --shadow-hover: 0 8px 28px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-modal: 0 24px 80px rgba(0,0,0,0.20), 0 8px 24px rgba(0,0,0,0.08);
  --shadow-tabbar: 0 -2px 20px rgba(0,0,0,0.06);

  /* أنصاف أقطار */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 24px;
  --r-2xl: 30px;
  --r-full: 9999px;

  /* Safe area */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  --header-h: 60px;
  --tabbar-h: 64px;
  --sidebar-w: 280px;
}

/* ============= إعادة ضبط ============= */
* {
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: 'Cairo', 'Tajawal', -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background: var(--bg-main);
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.5;
  overscroll-behavior-y: none;
}

button, a, input, select, textarea, [role="button"] {
  touch-action: manipulation;
  font-family: inherit;
}

/* ============= التخطيط الرئيسي ============= */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  gap: 0;
}

/* ============= Sidebar ============= */
.sidebar {
  background: var(--bg-card);
  border-left: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 80;
}

.sidebar-header {
  padding: calc(20px + var(--safe-top)) 24px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-logo {
  flex: none;
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border-light);
}

.sidebar-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.sidebar-title {
  flex: 1;
  min-width: 0;
}

.sidebar-title b {
  display: block;
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  line-height: 1.3;
}

.sidebar-title span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.sidebar-footer {
  padding: 16px 24px calc(16px + var(--safe-bottom));
  border-top: 1px solid var(--border-light);
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 600;
}

.sidebar-visit {
  padding: 12px;
  background: var(--bg-soft);
  border-radius: var(--r-md);
  margin-bottom: 8px;
  font-size: 12px;
  line-height: 1.5;
}

.sidebar-version {
  text-align: center;
  font-size: 10px;
  color: var(--text-quaternary);
}

/* أزرار التنقل */
.np {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  margin: 2px 12px;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 48px;
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: transparent;
  width: calc(100% - 24px);
}

.np:hover {
  background: var(--bg-hover);
}

.np:active {
  transform: scale(0.97);
}

.np.on {
  background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 122, 255, 0.25);
}

.nav-icon {
  font-size: 20px;
  width: 28px;
  min-width: 28px;
  max-width: 28px;
  text-align: center;
  flex: none;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-label {
  flex: 1;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-new {
  background: var(--ios-red);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--r-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex: none;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 20px 24px 6px;
}

/* ============= المنطقة الرئيسية ============= */
.main-area {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* ============= Header ============= */
.tb {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(180%) blur(30px);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  border-bottom: 1px solid var(--border-light);
  padding: calc(8px + var(--safe-top)) 20px 8px;
  min-height: calc(var(--header-h) + var(--safe-top));
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 70;
}

.menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: var(--r-full);
  background: transparent;
  font-size: 20px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  flex: none;
  overflow: hidden;
}

.tb-title {
  flex: 1;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.global-search {
  flex: none;
  position: relative;
  width: 260px;
}

.global-search input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border: 1px solid var(--border-light);
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 600;
  background: var(--bg-soft);
  min-height: 38px;
}

.hdr-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.ib {
  width: 40px;
  height: 40px;
  min-width: 40px;
  max-width: 40px;
  border-radius: var(--r-full);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  position: relative;
  color: var(--ios-blue);
  overflow: hidden;
  flex: none;
}

.ib:hover { background: var(--bg-hover); }
.ib:active { transform: scale(0.9); }

.tu {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  border-radius: var(--r-full);
  background: var(--bg-soft);
  cursor: pointer;
  flex: none;
  overflow: hidden;
}

#uAv {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, #007AFF, #5856D6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  flex: none;
  overflow: hidden;
}

.tu-info {
  display: flex;
  flex-direction: column;
}

.tu-info b {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.tu-info span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
}

/* ============= مؤشر المزامنة ============= */
.sync-ind {
  width: 10px;
  height: 10px;
  min-width: 10px;
  border-radius: var(--r-full);
  background: var(--text-quaternary);
  flex: none;
  overflow: hidden;
}

.sync-ind.on {
  background: var(--ios-green);
  box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.4);
  animation: pulse 2s infinite;
}

.sync-ind.off { background: var(--ios-red); }
.sync-ind.sync { background: var(--ios-orange); animation: spin 0.8s linear infinite; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(52, 199, 89, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0); }
}

@keyframes spin { to { transform: rotate(360deg); } }

#syncBadge {
  font-size: 11px !important;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--r-full);
  background: var(--bg-soft);
  color: var(--text-secondary);
  white-space: nowrap;
}

#syncBadge.on { color: var(--ios-green); background: rgba(52, 199, 89, 0.1); }
#syncBadge.off { color: var(--ios-red); background: rgba(255, 59, 48, 0.1); }

/* ============= المحتوى ============= */
.cw {
  flex: 1;
  padding: 24px;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 24px);
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* ============= عناوين الصفحات ============= */
.ph {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 24px 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.ph > div { flex: 1; min-width: 200px; }

.ph .kk {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ios-blue);
  background: rgba(0, 122, 255, 0.08);
  padding: 4px 14px;
  border-radius: var(--r-full);
  margin-bottom: 8px;
}

.ph h2 {
  font-size: 26px;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.ph .pd {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.5;
}

.ph .rx {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: none;
}

/* ============= البطاقات ============= */
.cd, .card, .hr2 {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: none;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-bottom: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cd:active { transform: scale(0.99); }

.ct {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-secondary);
  padding: 18px 20px 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============= البطاقات الإحصائية ============= */
.tl2, .ti2 {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.tl2::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 5px;
  height: 100%;
  background: var(--ios-blue);
}

.tl2.t1::before { background: linear-gradient(180deg, #007AFF, #5856D6); }
.tl2.t2::before { background: linear-gradient(180deg, #34C759, #00C7BE); }
.tl2.t3::before { background: linear-gradient(180deg, #FF9500, #FF5E3A); }
.tl2.t4::before { background: linear-gradient(180deg, #AF52DE, #FF2D55); }
.tl2.t5::before { background: linear-gradient(180deg, #FFD700, #FFA500); }
.tl2.t6::before { background: linear-gradient(180deg, #5AC8FA, #007AFF); }

.tl2:active { transform: scale(0.97); }

.tl2 .kk, .ti2 .kk {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.tl2 b, .ti2 b {
  font-size: 34px;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -1px;
  display: block;
  margin-top: 6px;
  line-height: 1.1;
}

/* ============= الأزرار ============= */
.bn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 800;
  font-family: inherit;
  min-height: 48px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  cursor: pointer;
  letter-spacing: -0.2px;
}

.bn:active {
  transform: scale(0.95);
  opacity: 0.85;
}

.bn.ba { background: var(--ios-red); color: #fff; }
.bn.be { background: var(--ios-blue); color: #fff; box-shadow: 0 4px 14px rgba(0, 122, 255, 0.25); }
.bn.bo { background: var(--bg-soft); color: var(--text-primary); border: 1px solid var(--border-light); }
.bn.bg { background: var(--ios-green); color: #fff; }
.bn.bp { background: var(--ios-purple); color: #fff; }
.bn.bs { font-size: 13px; padding: 8px 14px; min-height: 38px; }

/* ============= النماذج ============= */
input, select, textarea {
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 2px solid var(--border-light);
  border-radius: var(--r-md);
  padding: 13px 16px;
  width: 100%;
  transition: all 0.2s ease;
  min-height: 48px;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ios-blue);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

input::placeholder, textarea::placeholder {
  color: var(--text-quaternary);
  font-weight: 500;
}

label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: block;
  letter-spacing: 0.2px;
}

.fl { margin-bottom: 16px; }

/* ============= الجداول ============= */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  font-weight: 600;
}

th {
  background: var(--bg-soft);
  font-size: 12px;
  font-weight: 800;
  color: var(--text-secondary);
  padding: 14px 16px;
  text-align: right;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border-light);
}

td {
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
}

tr:last-child td { border-bottom: none; }
tr:active { background: var(--bg-hover); }

/* ============= Modals (iOS Sheets) ============= */
.mb3 {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.25s ease;
}

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

.md {
  background: var(--bg-card);
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  padding-bottom: var(--safe-bottom);
  box-shadow: var(--shadow-modal);
}

@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.mh2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--border-light);
  position: relative;
  padding-top: 28px;
}

.mh2::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 5px;
  background: var(--border-medium);
  border-radius: var(--r-full);
}

.mh2 h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.mby {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.mf2 {
  display: flex;
  gap: 12px;
  padding: 16px 24px calc(20px + var(--safe-bottom));
  border-top: 1px solid var(--border-light);
  background: var(--bg-card);
}

.mf2 .bn { flex: 1; }

/* ============= Toast ============= */
#to {
  position: fixed;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 24px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  width: max-content;
  max-width: 90vw;
}

#to > * {
  background: rgba(28, 28, 30, 0.92);
  backdrop-filter: saturate(180%) blur(30px);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  color: #fff;
  padding: 14px 24px;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--shadow-modal);
  animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  border: 0.5px solid rgba(255, 255, 255, 0.1);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(30px) scale(0.85); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============= شريط التنقل السفلي ============= */
.tabbar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(30px);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  border-top: 1px solid var(--border-light);
  padding: 8px 8px calc(8px + var(--safe-bottom));
  z-index: 85;
  justify-content: space-around;
  align-items: center;
  box-shadow: var(--shadow-tabbar);
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 14px;
  border-radius: var(--r-sm);
  color: var(--text-tertiary);
  font-size: 10px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
  min-width: 48px;
  min-height: 48px;
  justify-content: center;
  cursor: pointer;
}

.tab-item:active { transform: scale(0.88); }
.tab-item.on { color: var(--ios-blue); }

.tab-icon {
  font-size: 24px;
  line-height: 1;
  width: 28px;
  min-width: 28px;
  text-align: center;
  overflow: hidden;
}

.tab-item.on .tab-icon { transform: scale(1.1); }

/* ============= Pills ============= */
.pl {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 700;
  background: var(--bg-soft);
  color: var(--text-secondary);
}

.pl.pg { background: rgba(52, 199, 89, 0.1); color: var(--ios-green); }
.pl.pr { background: rgba(255, 59, 48, 0.1); color: var(--ios-red); }
.pl.pe { background: rgba(255, 149, 0, 0.1); color: var(--ios-orange); }
.pl.pa2 { background: rgba(255, 204, 0, 0.12); color: #B8860B; }
.pl.pu { background: rgba(175, 82, 222, 0.1); color: var(--ios-purple); }
.pl.pk { background: var(--bg-soft); color: var(--text-tertiary); }

/* ============= Badges ============= */
.bbn {
  position: absolute;
  top: -2px;
  left: -2px;
  background: var(--ios-red);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border: 2.5px solid var(--bg-card);
  z-index: 10;
}

.bbn.urgent { animation: bounce 0.5s ease; }

@keyframes bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* ============= Progress Bars ============= */
.pb2 {
  height: 8px;
  background: var(--border-light);
  border-radius: var(--r-full);
  overflow: hidden;
}

.pb2 i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #007AFF, #5856D6);
  border-radius: var(--r-full);
  transition: width 0.4s ease;
}

/* ============= الإشعارات ============= */
#nd {
  position: fixed;
  top: calc(var(--safe-top) + 8px);
  left: 8px;
  right: 8px;
  max-height: calc(100vh - var(--safe-top) - 16px);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(180%) blur(40px);
  -webkit-backdrop-filter: saturate(180%) blur(40px);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-modal);
  border: 1px solid var(--border-light);
  z-index: 90;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: notifIn 0.3s ease;
}

@keyframes notifIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.notif-item {
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s ease;
  min-height: 60px;
  align-items: center;
  cursor: pointer;
}

.notif-item:active { background: var(--bg-hover); }
.notif-item:last-child { border-bottom: none; }

.notif-icon {
  font-size: 22px;
  width: 42px;
  height: 42px;
  min-width: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-soft);
  border-radius: var(--r-md);
  flex: none;
  overflow: hidden;
}

/* ============= Countdown Banner ============= */
.countdown-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
  color: #fff;
  padding: 20px 24px;
  border-radius: var(--r-lg);
  margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(0, 122, 255, 0.2);
}

.cd-icon {
  font-size: 36px;
  flex: none;
  width: 48px;
  min-width: 48px;
  text-align: center;
  overflow: hidden;
}

.cd-info { flex: 1; }
.cd-info .kk { font-size: 11px; font-weight: 700; opacity: 0.8; text-transform: uppercase; letter-spacing: 0.5px; }
.cd-info h3 { font-size: 16px; font-weight: 800; margin-top: 2px; }
.cd-info p { font-size: 12px; font-weight: 600; opacity: 0.9; margin-top: 2px; }

.cd-days {
  text-align: center;
  flex: none;
  padding: 8px 20px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--r-md);
}

.cd-days b {
  font-size: 32px;
  font-weight: 900;
  display: block;
  line-height: 1;
}

.cd-days span {
  font-size: 10px;
  font-weight: 700;
  opacity: 0.8;
}

/* ============= الإجراءات العاجلة ============= */
.urgent-actions {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
}

.urgent-actions h4 {
  font-size: 16px;
  font-weight: 800;
  color: var(--ios-red);
  margin-bottom: 14px;
}

.ua-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.ua-item:last-child { border-bottom: none; }

/* ============= صفحة الدخول ============= */
#login {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-top)) 20px calc(24px + var(--safe-bottom));
  position: relative;
  overflow: hidden;
}

#login::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 100%;
  height: 150%;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.15) 0%, transparent 60%);
  animation: float 8s ease-in-out infinite;
}

#login::after {
  content: '';
  position: absolute;
  bottom: -50%;
  left: -30%;
  width: 100%;
  height: 150%;
  background: radial-gradient(ellipse at center, rgba(255, 45, 85, 0.15) 0%, transparent 60%);
  animation: float 10s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(20px, -20px) rotate(5deg); }
}

.lc {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-modal), 0 0 0 1px rgba(255, 255, 255, 0.2);
  padding: 56px 32px 32px;
  animation: cardIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(40px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.lb {
  position: absolute;
  top: -60px;
  right: 50%;
  transform: translateX(50%);
  width: 120px;
  height: 120px;
  border-radius: var(--r-xl);
  background: #fff;
  border: 5px solid rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  box-shadow: var(--shadow-modal);
  animation: logoBounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

@keyframes logoBounce {
  0% { transform: translateX(50%) translateY(-20px) scale(0); opacity: 0; }
  60% { transform: translateX(50%) translateY(5px) scale(1.1); opacity: 1; }
  100% { transform: translateX(50%) translateY(0) scale(1); opacity: 1; }
}

.lb img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--r-lg); }

.lc h1 {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.8px;
  text-align: center;
  color: var(--text-primary);
  margin-top: 8px;
}

.ls {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  margin: 8px 0 24px;
  line-height: 1.7;
}

.le {
  background: rgba(255, 59, 48, 0.08);
  border: 1px solid rgba(255, 59, 48, 0.2);
  color: var(--ios-red);
  border-radius: var(--r-md);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 14px;
  display: none;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

.ip { position: relative; margin-bottom: 12px; }

.ip input {
  background: var(--bg-soft);
  border: 2px solid transparent;
  border-radius: var(--r-md);
  padding: 14px 48px;
  font-size: 16px;
  font-weight: 700;
  min-height: 50px;
}

.ip input:focus {
  background: var(--bg-card);
  border-color: var(--ios-blue);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.12);
}

.ip b {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  opacity: 0.5;
  width: 24px;
  text-align: center;
  pointer-events: none;
  z-index: 1;
}

.bn.ba {
  background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  padding: 15px;
  border-radius: var(--r-md);
  min-height: 52px;
  width: 100%;
  box-shadow: 0 8px 24px rgba(0, 122, 255, 0.3);
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}

.bn.ba:active { transform: scale(0.97); box-shadow: 0 4px 12px rgba(0, 122, 255, 0.2); }

.acc {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: var(--bg-soft);
  border: none;
  border-radius: var(--r-md);
  padding: 12px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  min-height: 48px;
}

.acc:hover { background: var(--bg-hover); transform: translateX(-3px); }
.acc:active { background: var(--border-light); transform: scale(0.97); }

.acc b { font-size: 14px; color: var(--text-primary); font-weight: 800; }
.acc small { font-size: 11px; color: var(--text-secondary); font-weight: 600; }
.acc i {
  font-style: normal;
  font-size: 11px;
  background: linear-gradient(135deg, #007AFF, #5856D6);
  color: #fff;
  padding: 4px 12px;
  border-radius: var(--r-full);
  font-weight: 800;
}

.at {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-secondary);
  margin: 18px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
  text-align: center;
}

/* ============= الشبكات ============= */
.f2, .g2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.f3, .g3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.f4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.qg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

/* ============= Footer ============= */
.ft2 {
  padding: 16px 24px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border-light);
}

/* ============= Scrollbar ============= */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: var(--r-full);
  border: 2px solid var(--bg-main);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ============= استجابة الشاشات ============= */

/* Desktop */
@media (min-width: 1400px) {
  .app-layout { max-width: 1600px; margin: 0 auto; }
}

/* iPad / Tablet */
@media (min-width: 768px) and (max-width: 1024px) {
  .app-layout { grid-template-columns: 240px 1fr; }
  .sidebar { width: 240px; }
  .np { padding: 10px 14px; font-size: 14px; min-height: 44px; }
  .nav-label { font-size: 14px; }
  .cw { padding: 20px 20px calc(20px + var(--safe-bottom)); }
  .ph h2 { font-size: 22px; }
}

/* Mobile */
@media (max-width: 767px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 300px;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    z-index: 80;
    border-radius: var(--r-2xl) 0 0 var(--r-2xl);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: grid; }
  .main-area { width: 100%; }
  .tabbar { display: flex; }
  .cw { padding: 16px 16px calc(var(--tabbar-h) + var(--safe-bottom) + 24px); }
  .tu-info { display: none; }
  .global-search { display: none !important; }
  .hdr-actions { margin-inline-start: auto; gap: 2px; }
  .ib { width: 38px; height: 38px; font-size: 17px; }
  .tb-title { font-size: 17px; }
  #syncBadge { display: none; }
  .f2, .f3, .f4, .g2, .g3 { grid-template-columns: 1fr; }
  .qg { grid-template-columns: repeat(2, 1fr); }
  .tl2 b, .ti2 b { font-size: 26px; }
  .ph h2 { font-size: 22px; }
  .ph { padding: 18px 20px; }
  .md { max-width: 100%; max-height: 92vh; }
  .mby { padding: 16px 18px; }
  .sidebar-footer, .ft2 { display: none; }
  .countdown-banner { flex-wrap: wrap; }
  .cd-days { flex-basis: 100%; order: 3; }
}

/* Small Mobile */
@media (max-width: 480px) {
  .cw { padding: 14px 12px calc(var(--tabbar-h) + var(--safe-bottom) + 20px); }
  .tb-title { font-size: 16px; }
  .ib { width: 36px; height: 36px; font-size: 16px; }
  .bn { font-size: 14px; padding: 11px 16px; min-height: 44px; }
  .cd { border-radius: var(--r-md); margin-bottom: 12px; }
  .tl2 { padding: 16px; }
  .tl2 b { font-size: 24px; }
  .ph { padding: 16px 18px; border-radius: var(--r-md); }
  .ph h2 { font-size: 20px; }
  .tab-item { padding: 4px 8px; font-size: 9px; }
  .tab-icon { font-size: 22px; }
}

/* Landscape */
@media (max-width: 900px) and (orientation: landscape) {
  .tb { min-height: calc(48px + var(--safe-top)); }
  .cw { padding-top: 12px; }
  .md { max-height: 95vh; }
}

/* iOS font fix */
@supports (-webkit-touch-callout: none) {
  input, select, textarea { font-size: 16px; }
}

/* Smooth scroll */
.cw, .mby, .sidebar-nav {
  -webkit-overflow-scrolling: touch;
}

/* Focus visible */
.bn:focus-visible, .np:focus-visible, .ib:focus-visible {
  outline: 2px solid var(--ios-blue);
  outline-offset: 3px;
}

/* Select styling */
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238E8E93' stroke-width='2.5'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: left 14px center;
  background-size: 18px;
  padding-left: 42px;
}

/* Checkbox */
input[type="checkbox"], input[type="radio"] {
  width: 24px;
  height: 24px;
  min-height: 24px;
  accent-color: var(--ios-blue);
  border-radius: 6px;
}

/* Print */
@media print {
  .tabbar, #nd, #to, .menu-btn, .hdr-actions, .ft2, .sidebar { display: none !important; }
  .app-layout { display: block; }
  .cw { padding: 0; max-width: 100%; }
}
