/* ================================================================
   منصة حضور — رصد ومتابعة مهام
   نظام تصميم مؤسسي متقدم مستوحى من هوية منصة الصحة (health.sa)
   RTL · IBM Plex Sans Arabic / Tajawal · Teal & Cyan Accents · Animated Micro-Interactions
   ================================================================ */

:root {
  /* ألوان منصة الصحة السعودية وتدرجاتها الرسمية */
  --health-cyan: #0093d5;
  --health-cyan-hover: #0284c7;
  --health-cyan-active: #0369a1;
  --health-cyan-soft: rgba(0, 147, 213, 0.10);
  --health-cyan-glow: rgba(0, 147, 213, 0.28);

  --health-teal: #006778;
  --health-teal-dark: #0e2f38;
  --health-teal-soft: rgba(0, 103, 120, 0.12);

  --health-lime: #84cc16;
  --health-lime-soft: rgba(132, 204, 22, 0.14);
  --health-lime-glow: rgba(132, 204, 22, 0.45);

  --health-navy: #0e1e38;
  --health-navy-dark: #081120;
  --health-slate: #162c4a;

  /* نظام الألوان السطحية المستوحى من health.sa */
  --health-canvas: #f8fafc;
  --health-surface: #ffffff;
  --health-surface-card: #ffffff;
  --health-surface-elevated: #ffffff;
  --health-surface-muted: #f1f5f9;
  --health-surface-hover: rgba(0, 147, 213, 0.04);
  --health-surface-glass: rgba(255, 255, 255, 0.88);

  --health-border: rgba(14, 30, 56, 0.08);
  --health-border-strong: rgba(0, 147, 213, 0.24);
  --health-border-glass: rgba(255, 255, 255, 0.6);

  --health-text: #0e1e38;
  --health-text-secondary: #334155;
  --health-text-muted: #64748b;
  --health-text-inverse: #ffffff;

  /* ألوان الحالات المؤسسية */
  --success: #059669;
  --success-bg: rgba(5, 150, 105, 0.12);
  --success-fg: #047857;

  --warning: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.12);
  --warning-fg: #b45309;

  --danger: #e11d48;
  --danger-bg: rgba(225, 29, 72, 0.12);
  --danger-fg: #be123c;

  --info: #0093d5;
  --info-bg: rgba(0, 147, 213, 0.10);
  --info-fg: #0284c7;

  --neutral: #64748b;
  --neutral-bg: rgba(100, 116, 139, 0.12);
  --neutral-fg: #475569;

  --purple: #7c3aed;
  --purple-bg: rgba(124, 58, 237, 0.12);
  --purple-fg: #6d28d9;

  /* المتغيرات الأساسية للمنصة */
  --bg: var(--health-canvas);
  --surface: var(--health-surface);
  --surface-2: var(--health-surface-muted);
  --surface-hover: var(--health-surface-hover);
  --border: var(--health-border);
  --border-strong: var(--health-border-strong);
  --text: var(--health-text);
  --text-secondary: var(--health-text-secondary);
  --text-muted: var(--health-text-muted);
  --text-inverse: var(--health-text-inverse);
  --primary: var(--health-cyan);
  --primary-hover: var(--health-cyan-hover);
  --primary-soft: var(--health-cyan-soft);
  --primary-glow: var(--health-cyan-glow);
  --secondary: var(--health-teal);
  --accent-lime: var(--health-lime);

  /* حواف منحنية عصرية بنمط health.sa (1.5rem / 24px) */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --radius-pill: 9999px;

  /* ظلال مؤسسية بطابع أزرق نيلي ناعم */
  --shadow-sm: 0 1px 3px rgba(14, 30, 56, 0.04), 0 1px 2px rgba(14, 30, 56, 0.02);
  --shadow: 0 4px 20px -2px rgba(14, 30, 56, 0.06), 0 1px 4px -1px rgba(14, 30, 56, 0.02);
  --shadow-lg: 0 16px 40px -4px rgba(0, 147, 213, 0.12), 0 4px 12px -2px rgba(14, 30, 56, 0.04);
  --shadow-float: 0 24px 60px -8px rgba(14, 30, 56, 0.18), 0 8px 24px -4px rgba(0, 147, 213, 0.12);

  --header-h: 62px;
  --nav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: "IBM Plex Sans Arabic", "Tajawal", -apple-system, BlinkMacSystemFont, "Plus Jakarta Sans", system-ui, sans-serif;
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
}

/* الوضع الداكن المستوحى من health.sa dark theme */
[data-theme="dark"] {
  --health-canvas: #09121f;
  --health-surface: #0f1c30;
  --health-surface-card: #12213a;
  --health-surface-elevated: #162947;
  --health-surface-muted: #13243d;
  --health-surface-hover: rgba(0, 147, 213, 0.08);
  --health-surface-glass: rgba(15, 28, 48, 0.88);

  --health-border: rgba(255, 255, 255, 0.08);
  --health-border-strong: rgba(0, 147, 213, 0.32);
  --health-border-glass: rgba(255, 255, 255, 0.12);

  --health-text: #f8fafc;
  --health-text-secondary: #cbd5e1;
  --health-text-muted: #8496ad;

  --primary: #38bdf8;
  --primary-hover: #0ea5e9;
  --primary-soft: rgba(56, 189, 248, 0.16);
  --primary-glow: rgba(56, 189, 248, 0.35);

  --success-bg: rgba(5, 150, 105, 0.2);
  --success-fg: #6ee7b7;
  --warning-bg: rgba(217, 119, 6, 0.2);
  --warning-fg: #fde047;
  --danger-bg: rgba(225, 29, 72, 0.2);
  --danger-fg: #fda4af;
  --info-bg: rgba(56, 189, 248, 0.2);
  --info-fg: #bae6fd;
  --neutral-bg: rgba(148, 163, 184, 0.16);
  --neutral-fg: #e2e8f0;
  --purple-bg: rgba(168, 85, 247, 0.2);
  --purple-fg: #e9d5ff;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 16px 44px -4px rgba(0, 0, 0, 0.85);
  --shadow-float: 0 24px 64px -8px rgba(0, 0, 0, 0.95);
}

/* ============ حركات وتأثيرات الأيقونات (health.sa Micro-Animations) ============ */
@keyframes healthFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

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

@keyframes healthRadar {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(132, 204, 22, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(132, 204, 22, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(132, 204, 22, 0); }
}

@keyframes healthOrbit {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes iconHoverBounce {
  0% { transform: scale(1); }
  35% { transform: scale(1.18) translateY(-4px); }
  70% { transform: scale(1.08) translateY(-2px); }
  100% { transform: scale(1.12) translateY(-3px); }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  color-scheme: light dark;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.6;
  min-height: 100dvh;
  letter-spacing: -0.012em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

[dir="ltr"] { text-align: left; }
button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  letter-spacing: inherit;
}
button { cursor: pointer; border: none; background: none; }
a { color: var(--primary); text-decoration: none; transition: all .18s var(--ease-spring); }
a:hover { opacity: .88; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.3; letter-spacing: -0.025em; }
p { margin: 0 0 .5rem; }
ul { margin: 0; padding: 0; list-style: none; }

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-soft), 0 0 0 2px var(--primary);
  border-radius: var(--radius-sm);
}

/* ============ شاشة الإقلاع (health.sa Institutional Boot) ============ */
.boot-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  background: var(--bg);
  z-index: 9999;
}
.boot-logo .health-emblem {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #162c4a 0%, #0e1e38 100%);
  display: grid;
  place-items: center;
  box-shadow: 0 16px 36px rgba(0, 147, 213, 0.22);
  border: 1px solid rgba(0, 147, 213, 0.35);
  animation: healthFloat 3s ease-in-out infinite;
}
.boot-logo .health-emblem-svg {
  width: 54px;
  height: 54px;
}
.boot-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-top: 4px;
}
.boot-tagline {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: -0.01em;
}
.spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-right-color: var(--accent-lime);
  border-radius: 50%;
  animation: spin .75s linear infinite;
  margin-top: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ الهيكل العام والشريط العلوي (health.sa Frosted Topbar) ============ */
.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  height: var(--header-h);
  background: var(--health-surface-glass);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  transition: background .2s ease, border-color .2s ease;
  position: sticky;
}
.topbar::after {
  content: '';
  position: absolute;
  bottom: -1px;
  inset-inline: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--primary) 30%, var(--accent-lime) 70%, transparent 100%);
  opacity: 0.65;
  pointer-events: none;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.health-logo-badge {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  transition: transform .25s var(--ease-spring);
}
.health-logo-badge:hover {
  transform: scale(1.08) rotate(3deg);
}
.health-logo-svg {
  width: 38px;
  height: 38px;
  filter: drop-shadow(0 3px 8px var(--primary-glow));
}
.health-live-dot {
  animation: healthRadar 2s infinite ease-out;
  transform-origin: center;
}
.topbar__brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.topbar__brand-text .brand-title {
  font-weight: 700;
  font-size: 15.5px;
  color: var(--text);
  letter-spacing: -0.02em;
}
.topbar__brand-text .brand-sub {
  font-weight: 500;
  font-size: 11px;
  color: var(--primary);
  opacity: 0.9;
}
.topbar__title {
  font-size: 15px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-inline-start: auto;
}
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  position: relative;
  font-size: 16px;
  transition: all .2s var(--ease-spring);
  background: transparent;
}
.icon-btn:hover {
  background: var(--surface-hover);
  color: var(--primary);
  transform: scale(1.1) translateY(-1px);
  box-shadow: 0 4px 14px var(--primary-soft);
}
.icon-btn:active {
  transform: scale(0.95);
}
.icon-btn .badge {
  position: absolute;
  top: 1px;
  inset-inline-end: 1px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--danger);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  border-radius: 999px;
  display: grid;
  place-items: center;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(225, 29, 72, 0.4);
}

.layout {
  flex: 1;
  display: flex;
  min-height: 0;
}
.sidebar { display: none; }
.main {
  flex: 1;
  min-width: 0;
  padding: 16px 14px calc(var(--nav-h) + var(--safe-bottom) + 16px);
}

/* ============ شاشة الدخول بهوية health.sa ============ */
.health-login-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 18px;
  background: radial-gradient(ellipse at 50% 15%, #13243d 0%, #0c182a 55%, #070e19 100%);
  position: relative;
  overflow: hidden;
}
.health-aurora-cyan {
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 147, 213, 0.22) 0%, transparent 68%);
  top: -180px;
  left: calc(50% - 300px);
  pointer-events: none;
  animation: healthFloat 6s ease-in-out infinite alternate;
}
.health-aurora-lime {
  position: absolute;
  width: 440px;
  height: 440px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(132, 204, 22, 0.12) 0%, transparent 70%);
  bottom: -100px;
  right: -100px;
  pointer-events: none;
}
.health-login-card-container {
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 2;
}
.health-lang-chip {
  font-size: 12px;
  padding: 5px 14px;
  min-height: 30px;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border-radius: var(--radius-pill);
  transition: all .2s ease;
}
.health-lang-chip:hover {
  background: rgba(0, 147, 213, 0.25);
  border-color: var(--primary);
}
.health-brand-hero {
  text-align: center;
  color: #ffffff;
  margin-bottom: 26px;
}
.health-login-emblem {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #1c3558 0%, #0d1e35 100%);
  border: 1px solid rgba(0, 147, 213, 0.35);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 28px rgba(0, 147, 213, 0.25);
  margin-bottom: 16px;
  position: relative;
  animation: healthFloat 4s ease-in-out infinite;
}
.health-login-svg {
  width: 68px;
  height: 68px;
}
.health-orbit-ring {
  animation: healthOrbit 20s linear infinite;
  transform-origin: center;
}
.health-login-title {
  font-size: 30px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.03em;
  color: #ffffff;
  font-family: var(--font);
}
.health-login-subtitle {
  color: #94a3b8;
  font-size: 14.5px;
  margin: 6px 0 0;
  font-weight: 500;
}
.health-gov-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  background: rgba(0, 147, 213, 0.12);
  border: 1px solid rgba(0, 147, 213, 0.28);
  font-size: 11.5px;
  color: #7dd3fc;
  font-weight: 600;
}
.health-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-lime);
  box-shadow: 0 0 8px var(--accent-lime);
  animation: healthRadar 2s infinite ease-out;
}
.health-glass-card {
  background: #0d1d33;
  border: 1px solid rgba(0, 147, 213, 0.28);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65), inset 0 1px 1px rgba(255, 255, 255, 0.14);
  padding: 30px 26px;
  color: #f8fafc;
}
@supports ((-webkit-backdrop-filter: blur(12px)) or (backdrop-filter: blur(12px))) {
  .health-glass-card {
    background: rgba(13, 29, 51, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
}
.health-input {
  background: rgba(8, 17, 31, 0.6) !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  color: #ffffff !important;
  border-radius: var(--radius) !important;
  font-family: var(--font);
  transition: all .2s ease;
}
.health-input:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(0, 147, 213, 0.3) !important;
}
.health-btn-login {
  background: linear-gradient(135deg, #0093d5 0%, #0076aa 100%) !important;
  border: none !important;
  box-shadow: 0 8px 25px rgba(0, 147, 213, 0.45) !important;
  font-weight: 700;
  transition: all .2s var(--ease-spring);
}
.health-btn-login:hover {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0, 147, 213, 0.55) !important;
}

/* ============ التنقل السفلي للهواتف (iOS Tab Bar) ============ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  inset-inline: 0;
  z-index: 90;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--apple-surface-glass);
  backdrop-filter: saturate(180%) blur(25px);
  -webkit-backdrop-filter: saturate(180%) blur(25px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: stretch;
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  padding: 4px 2px;
  min-width: 0;
  position: relative;
  transition: color .15s ease;
}
.bottom-nav a .ic {
  font-size: 19px;
  line-height: 1;
  transition: transform .15s var(--ease-apple);
}
.bottom-nav a.active {
  color: var(--primary);
  font-weight: 600;
}
.bottom-nav a.active .ic {
  transform: scale(1.1);
}
.bottom-nav a .dot {
  position: absolute;
  top: 6px;
  inset-inline-end: calc(50% - 14px);
  width: 7px;
  height: 7px;
  background: var(--danger);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--danger);
}

/* ============ البطاقات (Apple Widgets / Continuous Squircles) ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
  transition: transform .2s var(--ease-apple), box-shadow .2s var(--ease-apple), border-color .2s ease;
  position: relative;
}
.card + .card { margin-top: 14px; }
.card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.card__title {
  font-size: 15.5px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  color: var(--text);
  letter-spacing: -0.015em;
}
.card__sub {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 400;
}

.section-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 22px 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-title:first-child { margin-top: 0; }

/* ============ بطاقات المؤشرات (Apple Stat Widgets) ============ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  min-height: 94px;
  transition: transform .18s var(--ease-apple), box-shadow .18s var(--ease-apple), border-color .18s ease;
}
.stat::before {
  content: '';
  position: absolute;
  top: 0;
  inset-inline-start: 0;
  width: 4px;
  bottom: 0;
  background: linear-gradient(180deg, var(--c, var(--primary)) 0%, var(--accent-lime) 100%);
  border-radius: 2px;
}
.stat__label {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat__value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--text);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.stat__meta {
  font-size: 11.5px;
  color: var(--text-muted);
}
.stat--clickable {
  cursor: pointer;
}
.stat--clickable:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px -4px rgba(0, 147, 213, 0.14);
  border-color: var(--border-strong);
}
.stat--clickable:active {
  transform: scale(0.98);
}

/* ============ الشارات (health.sa System Badges) ============ */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.4;
  letter-spacing: -0.01em;
}
.badge-status.success { background: var(--success-bg); color: var(--success-fg); }
.badge-status.warning { background: var(--warning-bg); color: var(--warning-fg); }
.badge-status.danger  { background: var(--danger-bg);  color: var(--danger-fg); }
.badge-status.info    { background: var(--info-bg);    color: var(--info-fg); }
.badge-status.neutral { background: var(--neutral-bg); color: var(--neutral-fg); }
.badge-status.purple  { background: var(--purple-bg);  color: var(--purple-fg); }

/* ============ الأزرار الكبسولية (health.sa Pill Buttons) ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  transition: all .18s var(--ease-spring);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  color: var(--text);
  transform: translateY(-1px);
}
.btn:active {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
}
.btn--primary {
  background: linear-gradient(135deg, #0093d5 0%, #0076aa 100%);
  border-color: #0093d5;
  color: #ffffff;
  box-shadow: 0 4px 14px var(--primary-glow);
}
.btn--primary:hover {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border-color: #0284c7;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--primary-glow);
}
.btn--success {
  background: var(--success);
  border-color: var(--success);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(52, 199, 89, 0.3);
}
.btn--success:hover {
  filter: brightness(0.95);
  box-shadow: 0 4px 14px rgba(52, 199, 89, 0.4);
}
.btn--danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(255, 59, 48, 0.3);
}
.btn--danger:hover {
  filter: brightness(0.95);
  box-shadow: 0 4px 14px rgba(255, 59, 48, 0.4);
}
.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--primary);
  box-shadow: none;
}
.btn--ghost:hover {
  background: var(--primary-soft);
  color: var(--primary);
}
.btn--sm {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
}
.btn--block { width: 100%; }
.btn--xl {
  min-height: 54px;
  font-size: 16.5px;
  border-radius: var(--radius-pill);
}
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row--end { justify-content: flex-end; }

/* ============ حقول الإدخال (Apple Inputs & Forms) ============ */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.field .req { color: var(--danger); margin-inline-start: 2px; }
.field .hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.field .err { font-size: 12px; color: var(--danger); margin-top: 4px; font-weight: 500; }

.input, .select, .textarea {
  width: 100%;
  min-height: 42px;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  transition: all .16s var(--ease-apple);
  font-size: 14px;
}
.textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.6;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px var(--danger-bg);
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%2386868b' d='M5 6 0 0h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  padding-inline-start: 14px;
  padding-inline-end: 36px;
}
[dir="ltr"] .select {
  background-position: right 14px center;
}
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  cursor: pointer;
}
.checkbox-row input[type=checkbox] {
  width: 19px;
  height: 19px;
  accent-color: var(--primary);
  border-radius: 5px;
  cursor: pointer;
}
.switch-list { display: flex; flex-direction: column; gap: 2px; }
.switch-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.switch-item:last-child { border-bottom: none; }
.switch-item__text { flex: 1; min-width: 0; }
.switch-item__text b { display: block; font-size: 14px; font-weight: 600; color: var(--text); }
.switch-item__text span { font-size: 12px; color: var(--text-muted); }

/* ============ أشرطة التقدم (Apple Progress Bars) ============ */
.progress {
  height: 7px;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress__bar {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-pill);
  transition: width .5s var(--ease-apple);
}
.progress--lg { height: 10px; }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .progress { flex: 1; }
.progress-row .val {
  font-size: 12px;
  font-weight: 600;
  min-width: 40px;
  text-align: end;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* ============ الجداول وقوائم البيانات ============ */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  background: var(--surface);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 13.5px;
  min-width: 520px;
}
table.data th {
  text-align: start;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 12px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr {
  transition: background .12s ease;
}
table.data tbody tr:hover { background: var(--apple-surface-hover); }
table.data .num { font-variant-numeric: tabular-nums; }

/* ============ قوائم العناصر (Apple List Views) ============ */
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
  transition: all .16s var(--ease-apple);
}
.list-item--link { cursor: pointer; }
.list-item--link:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.list-item__body { flex: 1; min-width: 0; }
.list-item__title {
  font-weight: 600;
  font-size: 14.5px;
  margin-bottom: 3px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item__meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.list-item__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

/* الأفاتار الشخصي (Apple Memoji / Capsule Monogram) */
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(0, 113, 227, 0.15) 0%, rgba(0, 113, 227, 0.05) 100%);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 13.5px;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--border);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm { width: 28px; height: 28px; font-size: 11px; }
.avatar--lg {
  width: 68px;
  height: 68px;
  font-size: 22px;
  border-radius: 50%;
  box-shadow: var(--shadow);
}

/* ============ الحالات الفارغة (Apple Empty States) ============ */
.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty__icon {
  font-size: 44px;
  margin-bottom: 12px;
  opacity: .8;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.08));
}
.empty__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.015em;
}
.empty__text { font-size: 13.5px; margin-bottom: 16px; }

/* ============ هياكل التحميل (Apple Shimmer) ============ */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0 } 100% { background-position: -200% 0 } }
.sk-line { height: 12px; margin-bottom: 8px; }
.sk-card { height: 90px; border-radius: var(--radius-lg); }

/* ============ التنبيهات المنبثقة (Dynamic Island Style Toasts) ============ */
.toast-stack {
  position: fixed;
  top: 16px;
  inset-inline: 16px;
  z-index: 9500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: rgba(29, 29, 31, 0.92);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: toast-drop .28s var(--ease-apple);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  max-width: 480px;
  width: fit-content;
}
.toast.success { border-color: rgba(52, 199, 89, 0.4); }
.toast.danger { border-color: rgba(255, 59, 48, 0.4); }
.toast.warning { border-color: rgba(255, 149, 0, 0.4); }
.toast .x {
  opacity: .7;
  font-size: 14px;
  line-height: 1;
  color: #fff;
  padding: 2px;
  margin-inline-start: 4px;
  transition: opacity .15s;
}
.toast .x:hover { opacity: 1; }
@keyframes toast-drop { from { opacity: 0; transform: translateY(-16px) scale(0.95); } to { opacity: 1; transform: none; } }

/* ============ النوافذ المنبثقة (iOS Sheets & macOS Modals) ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 8500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade .2s ease;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: var(--surface);
  width: 100%;
  max-width: 560px;
  max-height: 90dvh;
  overflow-y: auto;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  animation: slide-up .3s var(--ease-apple);
  padding-bottom: var(--safe-bottom);
  box-shadow: var(--shadow-float);
  border: 1px solid var(--border);
  border-bottom: none;
}
@keyframes slide-up { from { transform: translateY(100%) } to { transform: none } }
.modal__head {
  position: sticky;
  top: 0;
  background: var(--apple-surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 2;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.modal__head::before {
  content: '';
  position: absolute;
  top: 6px;
  inset-inline: calc(50% - 18px);
  width: 36px;
  height: 4px;
  background: var(--apple-border-strong);
  border-radius: var(--radius-pill);
}
.modal__title {
  font-size: 16px;
  font-weight: 600;
  flex: 1;
  color: var(--text);
  letter-spacing: -0.015em;
}
.modal__body { padding: 20px 18px; }
.modal__foot {
  position: sticky;
  bottom: 0;
  background: var(--apple-surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding: 14px 18px;
  display: flex;
  gap: 10px;
}
.modal__foot .btn { flex: 1; }

/* ============ الفلاتر والكبسولات (Apple Filter Chips) ============ */
.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 14px;
  -webkit-overflow-scrolling: touch;
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--text-muted);
  flex-shrink: 0;
  min-height: 34px;
  transition: all .16s var(--ease-apple);
}
.chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}
.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--apple-blue-glow);
}
.search-bar {
  position: relative;
  margin-bottom: 14px;
}
.search-bar .input {
  padding-inline-start: 38px;
  background: var(--surface);
  border-radius: var(--radius-pill);
}
.search-bar .ic {
  position: absolute;
  inset-inline-start: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* ============ التبويبات المقسّمة (Apple Segmented Controls) ============ */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1;
  text-align: center;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-pill);
  white-space: nowrap;
  transition: all .18s var(--ease-apple);
  border: none;
}
.tab:hover { color: var(--text); }
.tab.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ============ شاشة الحضور الكبيرة (Apple Watch Ultra / Dynamic Island Widget) ============ */
.punch {
  background: linear-gradient(145deg, #1c1c1e 0%, #121214 60%, #08080a 100%);
  color: #ffffff;
  border-radius: var(--radius-xl);
  padding: 26px 20px;
  text-align: center;
  box-shadow: 0 20px 48px -10px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.12);
  position: relative;
  overflow: hidden;
}
.punch::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius-xl);
  padding: 1px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.02) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.punch::after {
  content: '';
  position: absolute;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 113, 227, 0.18) 0%, transparent 70%);
  top: -80px;
  inset-inline-end: -60px;
  pointer-events: none;
}
.punch__clock {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: #ffffff;
  text-shadow: 0 2px 16px rgba(255, 255, 255, 0.15);
  direction: ltr;
  display: inline-block;
  unicode-bidi: isolate;
}
.punch__date {
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.75);
  margin-top: 4px;
}
.punch__state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 14px 0 6px;
  padding: 5px 14px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 500;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.punch__action {
  margin-top: 16px;
  position: relative;
  z-index: 1;
}
.punch__btn {
  width: 100%;
  min-height: 56px;
  border-radius: var(--radius-pill);
  font-size: 17px;
  font-weight: 600;
  background: #ffffff;
  color: #1d1d1f;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  transition: all .16s var(--ease-apple);
  border: none;
}
.punch__btn:hover {
  transform: scale(1.02);
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(255, 255, 255, 0.2);
}
.punch__btn:active {
  transform: scale(0.97);
}
.punch__btn--out {
  background: #ff453a;
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(255, 69, 58, 0.35);
}
.punch__btn--out:hover {
  background: #ff3b30;
  box-shadow: 0 12px 30px rgba(255, 69, 58, 0.45);
}
.punch__btn:disabled { opacity: .65; transform: none; }
.punch__times {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 18px;
  position: relative;
  z-index: 1;
}
.punch__times div {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 10px 4px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.punch__times .lbl {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
}
.punch__times .val {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
  color: #ffffff;
  direction: ltr;
  display: inline-block;
  unicode-bidi: isolate;
}

/* ============ الإجراءات السريعة (Apple Squircle Action Widgets) ============ */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.quick {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  box-shadow: var(--shadow);
  min-height: 90px;
  justify-content: center;
  text-align: center;
  transition: all .18s var(--ease-apple);
  position: relative;
}
.quick:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 28px -4px rgba(0, 147, 213, 0.18);
  border-color: var(--primary-soft);
  background: var(--surface-hover);
}
.quick:active { transform: scale(0.96); }
.quick .ic {
  font-size: 26px;
  transition: transform .24s var(--ease-spring), filter .24s ease;
}
.quick:hover .ic {
  transform: scale(1.22) translateY(-2px);
  filter: drop-shadow(0 6px 14px rgba(0, 147, 213, 0.35));
}
.quick .cnt {
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  box-shadow: 0 2px 8px rgba(225, 29, 72, 0.45);
}

/* ============ الخط الزمني (Apple Timeline) ============ */
.timeline { position: relative; padding-inline-start: 22px; }
.timeline::before {
  content: '';
  position: absolute;
  inset-block: 6px;
  inset-inline-start: 6px;
  width: 2px;
  background: var(--border-strong);
  border-radius: 1px;
}
.timeline__item { position: relative; padding-bottom: 18px; }
.timeline__item::before {
  content: '';
  position: absolute;
  inset-inline-start: -19px;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c, var(--primary));
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px var(--c, var(--primary));
}
.timeline__title { font-size: 14px; font-weight: 600; color: var(--text); }
.timeline__meta { font-size: 12px; color: var(--text-muted); }

/* ============ التنبيهات الاستباقية ============ */
.alert-item {
  border-inline-start: 4px solid var(--c, var(--warning));
  background: var(--surface);
  border: 1px solid var(--border);
  border-inline-start-width: 4px;
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}
.alert-item__head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.alert-item__title { font-weight: 600; font-size: 14px; flex: 1; color: var(--text); }
.alert-item__reason { font-size: 13px; color: var(--text-muted); }

/* ============ المساعد الذكي (Apple Intelligence Style Chat) ============ */
.chat { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.bubble {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  max-width: 88%;
  font-size: 14px;
  line-height: 1.65;
  box-shadow: var(--shadow-sm);
}
.bubble--user {
  background: var(--primary);
  color: #ffffff;
  align-self: flex-start;
  border-start-start-radius: 4px;
}
.bubble--bot {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  align-self: flex-end;
  border-start-end-radius: 4px;
}
.bubble b { font-weight: 600; }
.chat-input {
  display: flex;
  gap: 10px;
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding: 10px 0;
}
.chat-input .input { flex: 1; border-radius: var(--radius-pill); }

/* ============ التقويم (Apple Calendar View) ============ */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 0;
  text-transform: uppercase;
}
.cal-day {
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 44px;
  overflow: hidden;
  transition: border-color .15s ease;
}
.cal-day.other { opacity: .35; }
.cal-day.today {
  border-color: var(--primary);
  border-width: 2px;
  box-shadow: 0 0 0 2px var(--primary-soft);
}
.cal-day__n { font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cal-day__dots { display: flex; flex-wrap: wrap; gap: 3px; }
.cal-dot { width: 5px; height: 5px; border-radius: 50%; }

/* ============ العناصر المساعدة والتخطيط ============ */
.row { display: flex; align-items: center; gap: 8px; }
.row--between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-muted); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.bold { font-weight: 600; }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 14px; }
.mt-3 { margin-top: 22px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 14px; }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }
.hide { display: none !important; }
.chart-box { position: relative; height: 220px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.kv:last-child { border-bottom: none; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; font-weight: 600; text-align: end; color: var(--text); }
.pill-group { display: flex; gap: 8px; flex-wrap: wrap; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}
.pagination .info { font-size: 13px; color: var(--text-muted); }

/* ============ البحث الشامل (macOS Spotlight Search) ============ */
.search-panel {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 9200;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 60px;
  animation: fade .2s ease;
}
.search-panel-box {
  width: 90%;
  max-width: 620px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-float);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 75vh;
}
.search-panel__head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--surface);
}
.search-panel__head .input {
  border: none;
  font-size: 16px;
  background: transparent;
  padding: 0;
  box-shadow: none;
}
.search-panel__head .input:focus {
  box-shadow: none;
  border: none;
}
.search-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
}
.search-group { margin-bottom: 18px; }
.search-group__label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

/* ============ الشاشات الكبيرة والمكتبية (macOS Desktop Experience) ============ */
@media (min-width: 600px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .quick-grid { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .modal-backdrop { align-items: center; }
  .modal {
    border-radius: var(--radius-xl);
    max-height: 86dvh;
    border-bottom: 1px solid var(--border);
  }
  .modal__head::before { display: none; }
  .toast-stack {
    top: auto;
    bottom: 24px;
    inset-inline-start: auto;
    inset-inline-end: 24px;
    align-items: flex-end;
  }
}

@media (min-width: 1000px) {
  :root { --nav-h: 0px; }
  .bottom-nav { display: none; }
  .layout {
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
  }
  .sidebar {
    display: block;
    width: 250px;
    flex-shrink: 0;
    background: transparent;
    border-inline-end: 1px solid var(--border);
    padding: 20px 14px;
    position: sticky;
    top: var(--header-h);
    height: calc(100dvh - var(--header-h));
    overflow-y: auto;
  }
  .sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 4px;
    position: relative;
    transition: all .2s var(--ease-spring);
  }
  .sidebar a:hover {
    background: var(--surface-hover);
    color: var(--primary);
    transform: translateX(-3px);
  }
  .sidebar a:hover .ic {
    transform: scale(1.22) rotate(4deg);
    filter: drop-shadow(0 4px 8px var(--primary-glow));
  }
  .sidebar a.active {
    background: linear-gradient(135deg, rgba(0, 147, 213, 0.12) 0%, rgba(0, 103, 120, 0.08) 100%);
    color: var(--primary);
    font-weight: 700;
    border-inline-start: 3px solid var(--primary);
  }
  .sidebar a.active .ic {
    transform: scale(1.18);
    filter: drop-shadow(0 2px 6px var(--primary-glow));
  }
  .sidebar a .ic {
    font-size: 18px;
    width: 22px;
    text-align: center;
    transition: transform .22s var(--ease-spring), filter .22s ease;
  }
  .sidebar a .dot {
    width: 8px;
    height: 8px;
    background: var(--accent-lime);
    border-radius: 50%;
    margin-inline-start: auto;
    box-shadow: 0 0 8px var(--accent-lime);
    animation: healthRadar 2s infinite ease-out;
  }
  .sidebar__group {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 14px 12px 6px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }
  .main { padding: 26px 30px 48px; }
  .punch { max-width: 680px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .quick-grid { grid-template-columns: repeat(6, 1fr); }
  .cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
  .cols-2 .card + .card { margin-top: 0; }
  .cols-2 > div > .card + .card { margin-top: 14px; }
  .chart-box { height: 280px; }
  table.data { min-width: 0; }
}

@media (min-width: 1400px) {
  .stat-grid { grid-template-columns: repeat(5, 1fr); }
}

@media print {
  .topbar, .bottom-nav, .sidebar, .no-print, .btn, .filters { display: none !important; }
  .main { padding: 0; }
  body { background: #fff; font-size: 12px; }
  .card { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
  table.data { min-width: 0; font-size: 11px; }
  table.data th { background: #f1f5f9 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-header { display: block !important; margin-bottom: 12px; text-align: center; }
}
.print-header { display: none; }

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

/* قائمة «المزيد» في ملف الموظف */
.more-menu { position: relative; display: inline-block; }
.more-menu > summary { list-style: none; cursor: pointer; }
.more-menu > summary::-webkit-details-marker { display: none; }
.more-menu__list {
  position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 30;
  display: flex; flex-direction: column; gap: 4px; min-width: 190px; padding: 6px;
  background: var(--surface, var(--bg-card)); border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px); box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
}
.more-menu__list .btn { justify-content: flex-start; width: 100%; }

/* ============ استقرار الهواتف والأجهزة الذكية (Mobile WebKit Stability) ============ */
@media (max-width: 640px) {
  .health-aurora-cyan,
  .health-aurora-lime {
    display: none !important;
  }
  .health-orbit-ring,
  .health-login-emblem,
  .health-pulse {
    animation: none !important;
  }
  .health-glass-card {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: #0d1e34 !important;
    border: 1px solid rgba(0, 147, 213, 0.32) !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6) !important;
    padding: 24px 18px !important;
  }
  .topbar {
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
  }
  .bottom-nav {
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
  }
}
