/* ===== إدارة — Light Mode Design System ===== */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-s: #cbd5e1;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --blue: #2563eb;
  --blue-lt: #eff6ff;
  --blue-light: #eff6ff;
  --blue-dk: #1d4ed8;
  --green: #16a34a;
  --green-lt: #f0fdf4;
  --green-light: #f0fdf4;
  --amber: #d97706;
  --amber-lt: #fffbeb;
  --amber-light: #fffbeb;
  --red: #dc2626;
  --red-lt: #fef2f2;
  --red-light: #fef2f2;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.1);
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --sidebar-w: 240px;
  --header-h: 60px;
  --bottom-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --transition: 0.18s ease;
}

body.dark-mode {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #334155;
  --border: #334155;
  --border-s: #475569;
  --text: #f8fafc;
  --text-2: #cbd5e1;
  --text-3: #64748b;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
@font-face {
  font-family: 'Thamanya Sans';
  src: url('../fonts/thmanyahsans-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Thamanya Sans';
  src: url('../fonts/thmanyahsans-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Thamanya Sans';
  src: url('../fonts/thmanyahsans-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

body {
  font-family: 'Thamanya Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-s); border-radius: 3px; }

/* ── Layout ── */
.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-left: 1px solid var(--border);
  position: relative; /* Fixed position changed to relative for desktop, mobile will use fixed */
  height: 100vh;
  display: flex; flex-direction: column;
  z-index: 200;
  transition: transform var(--transition);
  flex-shrink: 0;
}

.sidebar-brand {
  height: var(--header-h);
  display: flex; align-items: center;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}

.logo-icon {
  display: flex; flex-direction: column;
  gap: 4px; padding: 2px;
}
.logo-icon span {
  display: block;
  height: 2.5px;
  background: var(--blue);
  border-radius: 2px;
  transition: width var(--transition);
}
.logo-icon span:nth-child(1) { width: 22px; }
.logo-icon span:nth-child(2) { width: 16px; }
.logo-icon span:nth-child(3) { width: 10px; }

.brand-text h1 { font-size: 1.1rem; font-weight: 800; color: var(--text); letter-spacing: -0.3px; }
.brand-text small { font-size: 0.65rem; color: var(--text-3); }

.sidebar-nav { flex: 1; padding: 0.75rem; overflow-y: auto; list-style: none; }
.sidebar-nav li { margin-bottom: 1px; }

.nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 0.6rem 0.9rem;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 0.875rem; font-weight: 500;
  transition: all var(--transition);
  cursor: pointer; border: none; background: none;
  width: 100%; text-align: right; font-family: inherit;
}
.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active { background: var(--blue-lt); color: var(--blue); font-weight: 600; }
.nav-link .ni { font-size: 1rem; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}

.main { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

/* ── Header ── */
.header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 1.5rem; gap: 12px;
  flex-shrink: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.header-actions { margin-right: auto; display: flex; align-items: center; gap: 8px; position: relative; }

.icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); cursor: pointer;
  font-size: 1rem; color: var(--text-2);
  transition: all var(--transition);
  position: relative;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }

.notif-dot {
  position: absolute; top: 5px; left: 5px;
  width: 8px; height: 8px;
  background: var(--red); border-radius: 50%;
  border: 2px solid var(--surface);
}

/* ── Notifications Dropdown ── */
.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  display: none;
}
.notif-dropdown.open { display: block; animation: fadeDown 0.18s ease; }

@keyframes fadeDown { from { opacity:0; transform: translateY(-6px); } to { opacity:1; transform: translateY(0); } }

.notif-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem; font-weight: 700;
}
.notif-list { max-height: 280px; overflow-y: auto; }
.notif-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex; gap: 10px; align-items: flex-start;
  cursor: pointer; transition: background var(--transition);
}
.notif-item:hover { background: var(--bg); }
.notif-item:last-child { border-bottom: none; }
.notif-icon { font-size: 1.1rem; margin-top: 1px; flex-shrink: 0; }
.notif-content p { font-size: 0.8rem; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.notif-content span { font-size: 0.72rem; color: var(--text-3); }
.notif-footer { padding: 0.625rem 1rem; border-top: 1px solid var(--border); text-align: center; }
.notif-footer a { font-size: 0.8rem; color: var(--blue); font-weight: 600; cursor: pointer; }

.page-content { flex: 1; padding: 1.5rem; overflow-y: auto; }

/* ── Bottom Nav Mobile ── */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(var(--bottom-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 200;
  justify-content: space-around; align-items: center;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}
.bnav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--text-3); font-size: 0.65rem; font-weight: 600;
  padding: 6px 12px; border-radius: var(--r-sm);
  background: none; border: none; font-family: inherit;
  cursor: pointer; transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.bnav-btn .ni { font-size: 1.25rem; }
.bnav-btn.active { color: var(--blue); }
.bnav-btn:active { transform: scale(0.93); }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.card-body { padding: 1.25rem; }
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 0.9rem; font-weight: 700; color: var(--text); }

/* ── Stats ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 1rem; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.1rem;
  box-shadow: var(--shadow-sm);
}
.stat-icon { font-size: 1.4rem; margin-bottom: 0.5rem; }
.stat-val { font-size: 1.3rem; font-weight: 800; color: var(--text); line-height: 1.2; }
.stat-lbl { font-size: 0.75rem; color: var(--text-3); margin-top: 2px; }
.stat-card.blue { border-top: 3px solid var(--blue); }
.stat-card.green { border-top: 3px solid var(--green); }
.stat-card.amber { border-top: 3px solid var(--amber); }
.stat-card.red { border-top: 3px solid var(--red); }

/* ── Project Umbrella ── */
.project-umbrella {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dk) 100%);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  color: #fff;
  position: relative;
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.project-umbrella::before {
  content: '';
  position: absolute; top: -40px; left: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
}
.project-umbrella::after {
  content: '';
  position: absolute; bottom: -30px; right: 20%;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
}
.proj-umb-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1rem; }
.proj-umb-name { font-size: 1rem; font-weight: 700; max-width: 70%; line-height: 1.4; }
.proj-umb-client { font-size: 0.75rem; opacity: 0.8; margin-top: 3px; }
.proj-umb-stats { display: flex; gap: 1.5rem; }
.proj-umb-stat { text-align: center; }
.proj-umb-stat-val { font-size: 1.1rem; font-weight: 800; }
.proj-umb-stat-lbl { font-size: 0.65rem; opacity: 0.75; }
.proj-progress { margin-top: 0.75rem; }
.proj-progress-bar { height: 6px; background: rgba(255,255,255,0.2); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.proj-progress-fill { height: 100%; background: #fff; border-radius: 3px; transition: width 0.6s ease; }
.proj-progress-label { display: flex; justify-content: space-between; font-size: 0.72rem; opacity: 0.85; }

/* ── Tabs ── */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 1.25rem; gap: 0; }
.tab-btn {
  padding: 0.625rem 1.25rem;
  font-family: inherit; font-size: 0.875rem; font-weight: 600;
  color: var(--text-3); border: none; background: none;
  cursor: pointer; position: relative; transition: color var(--transition);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-btn:hover { color: var(--text); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0.55rem 1.1rem;
  border-radius: var(--r-sm);
  font-family: inherit; font-size: 0.85rem; font-weight: 600;
  border: none; cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dk); }
.btn-outline { background: transparent; border: 1px solid var(--border-s); color: var(--text-2); }
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.78rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 0.95rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-white { background: #fff; color: var(--blue); font-weight: 700; }
.btn-white:hover { background: var(--blue-lt); }

/* ── Form ── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-2); margin-bottom: 0.35rem; }
.form-control {
  width: 100%; padding: 0.6rem 0.875rem;
  background: var(--surface);
  border: 1px solid var(--border-s);
  border-radius: var(--r-sm);
  color: var(--text); font-family: inherit; font-size: 0.875rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-control::placeholder { color: var(--text-3); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

/* ── Table ── */
.table-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th { background: var(--surface-2); padding: 0.7rem 1rem; text-align: right; font-weight: 700; color: var(--text-2); font-size: 0.78rem; white-space: nowrap; border-bottom: 1px solid var(--border); }
td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); color: var(--text); }
tr:last-child td { border-bottom: none; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

/* ── Responsive Table (Mobile Cards) ── */
@media (max-width: 768px) {
  .responsive-table table, .responsive-table thead, .responsive-table tbody, .responsive-table th, .responsive-table td, .responsive-table tr {
    display: block;
  }
  .responsive-table thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
  .responsive-table tr {
    border: 1px solid var(--border);
    border-radius: var(--r);
    margin-bottom: 1rem;
    background: var(--surface);
    padding: 0.5rem;
  }
  .responsive-table td {
    border: none;
    border-bottom: 1px solid var(--border-s);
    position: relative;
    padding: 0.5rem 0.5rem;
    text-align: right !important;
    min-height: 2.2rem;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 8px;
  }
  .responsive-table td:last-child {
    border-bottom: 0;
  }
  .responsive-table td::before {
    content: attr(data-label) ": ";
    font-weight: 700;
    color: var(--text-2);
    font-size: 0.8rem;
    white-space: nowrap;
  }
  .responsive-table tfoot tr {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: none;
    background: transparent;
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--border);
  }
  .responsive-table tfoot td {
    display: block;
    border: none;
    padding: 0;
    min-height: auto;
  }
  .responsive-table tfoot td::before {
    content: none;
  }
}

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 0.18rem 0.55rem; border-radius: 4px;
  font-size: 0.72rem; font-weight: 700;
}
.badge-blue { background: var(--blue-lt); color: var(--blue); }
.badge-green { background: var(--green-lt); color: var(--green); }
.badge-amber { background: var(--amber-lt); color: var(--amber); }
.badge-red { background: var(--red-lt); color: var(--red); }
.badge-gray { background: var(--bg); color: var(--text-3); }

/* ── Progress ── */
.progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--blue); border-radius: 3px; transition: width 0.6s ease; }
.progress-fill.green { background: var(--green); }
.progress-fill.amber { background: var(--amber); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.4);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  opacity: 0; visibility: hidden; transition: all 0.25s;
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  width: 100%; max-width: 500px;
  max-height: 88vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(16px) scale(0.97);
  transition: transform 0.25s;
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-body { padding: 1.25rem; }
.modal-footer { padding: 0.875rem 1.25rem; border-top: 1px solid var(--border); display: flex; gap: 8px; }

/* ── Toast ── */
.toast-wrap {
  position: fixed; top: 1.25rem; left: 50%; transform: translateX(-50%);
  z-index: 9000; display: flex; flex-direction: column; gap: 10px;
  align-items: center; pointer-events: none;
  width: max-content; min-width: 280px; max-width: 420px;
}
.toast {
  width: 100%; border-radius: 10px; overflow: hidden; position: relative;
  display: flex; align-items: stretch; pointer-events: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,.22), 0 2px 8px rgba(0,0,0,.12);
  animation: toastIn .28s cubic-bezier(.21,1.02,.73,1) forwards;
  font-size: .84rem;
}
.toast-body  { display: flex; align-items: center; gap: 10px; padding: 13px 14px; flex: 1; }
.toast-icon  { font-size: 1rem; flex-shrink: 0; font-weight: 700; }
.toast-text  { flex: 1; font-weight: 600; line-height: 1.45; direction: rtl; text-align: right; }
.toast-close {
  background: none; border: none; cursor: pointer; color: inherit;
  opacity: .65; font-size: .95rem; padding: 0 13px;
  display: flex; align-items: center; transition: opacity .15s;
}
.toast-close:hover { opacity: 1; }
.toast-bar {
  position: absolute; bottom: 0; right: 0; height: 3px;
  background: rgba(255,255,255,.45);
  animation: toastBar var(--dur, 4s) linear forwards;
}
.toast-success { background: #16a34a; color: #fff; }
.toast-error   { background: #dc2626; color: #fff; }
.toast-info    { background: #2563eb; color: #fff; }
.toast-warning { background: #d97706; color: #fff; }
.toast.toast-out { animation: toastOut .26s ease forwards; }
@keyframes toastIn  { from { opacity:0; transform:translateY(-10px) scale(.95); } to { opacity:1; transform:translateY(0) scale(1); } }
@keyframes toastOut { from { opacity:1; transform:translateY(0) scale(1); max-height:80px; } to { opacity:0; transform:translateY(-8px) scale(.95); max-height:0; margin:0; } }
@keyframes toastBar { from { width:100%; } to { width:0%; } }

/* ── Login ── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem; background: var(--bg); }
.login-box {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-logo { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 0.25rem; }
.login-logo h1 { font-size: 1.75rem; font-weight: 900; color: var(--text); }
.login-box .sub { font-size: 0.7rem; color: var(--text-3); margin-bottom: 2rem; }
.login-box .form-group { text-align: right; }

/* ── Empty ── */
.empty { text-align: center; padding: 3rem 1rem; color: var(--text-3); }
.empty .ei { font-size: 2.5rem; margin-bottom: 0.75rem; opacity: 0.5; }
.empty p { margin-bottom: 1rem; font-size: 0.875rem; }

/* ── Misc ── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.text-2 { color: var(--text-2); }
.text-sm { font-size: 0.8rem; }
.fw-7 { font-weight: 700; }
.divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

@keyframes fadeIn { from { opacity:0; transform: translateY(6px); } to { opacity:1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.25s ease; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { display: none !important; }
  .sidebar-overlay { display: none !important; }
  #menu-btn { display: none !important; }
  .main { margin-right: 0; }
  .bottom-nav { display: flex; }
  .desktop-only { display: none !important; }
}
@media (min-width: 769px) {
  .mobile-only { display: none !important; }
}

/* ═══════════════════════════════════════════════════════
   PAGE HERO — shared marker class for top banners
═══════════════════════════════════════════════════════ */
.page-hero-actions { display: flex; gap: .5rem; flex-wrap: wrap; position: relative; z-index: 2; }

/* ═══════════════════════════════════════════════════════
   FAB (Floating Action Button) — hidden on desktop
═══════════════════════════════════════════════════════ */
.fab { display: none; }

/* ═══════════════════════════════════════════════════════
   MOBILE — App-Like Experience (≤ 768px)
═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* ── Layout ── */
  .header { padding: 0 .875rem !important; }
  .header-title { font-size: .9rem; }
  .page-content {
    padding: .875rem !important;
    padding-bottom: calc(64px + var(--safe-b) + .875rem) !important;
    -webkit-overflow-scrolling: touch;
  }

  /* ── Bottom nav — app-like ── */
  .bottom-nav {
    height: calc(64px + var(--safe-b)) !important;
    box-shadow: 0 -1px 0 var(--border), 0 -8px 28px rgba(0,0,0,.07) !important;
  }
  .bnav-btn {
    min-width: 60px;
    padding: 6px 12px 2px !important;
    border-radius: 10px;
    gap: 4px !important;
  }
  .bnav-btn .ni { font-size: 1.4rem !important; }
  .bnav-btn > span:last-child { font-size: .63rem; }
  .bnav-btn.active { background: var(--blue-lt) !important; color: var(--blue) !important; }

  /* ── FAB — floating action button ── */
  .fab {
    display: flex !important;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: calc(64px + var(--safe-b) + 1rem);
    left: 1.25rem;
    width: 52px; height: 52px;
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(37,99,235,.4);
    cursor: pointer;
    z-index: 150;
    transition: transform .15s, box-shadow .15s;
    -webkit-tap-highlight-color: transparent;
  }
  .fab:active { transform: scale(.9); box-shadow: 0 2px 10px rgba(37,99,235,.35); }

  /* ── Hero banners — compact, hide description ── */
  .page-hero {
    padding: .875rem 1.1rem !important;
    border-radius: 14px !important;
    margin-bottom: .875rem !important;
  }
  .page-hero h2 { font-size: 1.1rem !important; margin-bottom: .2rem !important; }
  .page-hero > div > p,
  .page-hero > div > .hero-desc { display: none !important; }
  .page-hero-actions .btn-white { padding: .3rem .65rem; font-size: .78rem; }

  /* ── Project umbrella — compact ── */
  .project-umbrella {
    padding: 1rem 1.1rem !important;
    border-radius: 12px !important;
    margin-bottom: .875rem !important;
  }
  .proj-umb-name { font-size: .88rem !important; }
  .proj-umb-client { display: none !important; }
  .proj-umb-stats { gap: 1rem !important; }
  .proj-umb-stat-val { font-size: .95rem !important; }
  .proj-umb-stat-lbl { font-size: .6rem !important; }
  .project-umbrella .btn-white { padding: .3rem .65rem !important; font-size: .78rem !important; }

  /* ── Modal → bottom sheet ── */
  .modal-overlay { align-items: flex-end !important; padding: 0 !important; }
  .modal {
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    max-height: 92svh !important;
    transform: translateY(60px) !important;
  }
  .modal-overlay.open .modal { transform: translateY(0) !important; }
  .modal::before {
    content: '';
    display: block;
    width: 36px; height: 4px;
    background: var(--border-s, #e5e7eb);
    border-radius: 2px;
    margin: .75rem auto .25rem;
  }

  /* ── Toast — bottom of screen, full width ── */
  .toast-wrap {
    top: auto !important;
    bottom: calc(64px + var(--safe-b) + .75rem) !important;
    left: .75rem !important; right: .75rem !important;
    transform: none !important;
    width: auto !important; max-width: none !important; min-width: auto !important;
  }
  @keyframes toastInMob {
    from { opacity: 0; transform: translateY(12px) scale(.96); }
    to   { opacity: 1; transform: translateY(0)    scale(1);   }
  }
  .toast { animation: toastInMob .28s cubic-bezier(.21,1.02,.73,1) forwards !important; }

  /* ── Stats grid ── */
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: .625rem !important; }
  .stat-card { padding: .875rem !important; }
  .stat-val { font-size: 1.2rem !important; }
  .stat-lbl { font-size: .72rem; }

  /* ── Cards ── */
  .card { border-radius: 12px; }
  .card-body { padding: .875rem; }
  .card-header { padding: .75rem .875rem; }

  /* ── Tabs — horizontal scroll, no scrollbar ── */
  .tabs {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap !important;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab-btn { flex-shrink: 0; padding: .5rem .875rem !important; }

  /* ── Forms — bigger touch targets, prevent iOS zoom ── */
  .form-control { min-height: 44px; font-size: 1rem; }
  select.form-control { min-height: 44px; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; }
  .icon-btn { width: 44px; height: 44px; }

  /* ── Notif dropdown — fixed full-width ── */
  .notif-dropdown {
    position: fixed !important;
    top: var(--header-h) !important;
    left: .75rem !important; right: .75rem !important;
    width: auto !important;
    max-height: calc(100svh - var(--header-h) - 4rem);
    overflow-y: auto;
  }

  /* ── Responsive table ── */
  .responsive-table td::before { min-width: 85px; flex-shrink: 0; }

  /* ── Safe area — camera notch / Dynamic Island in PWA ── */
  .header {
    padding-top: var(--safe-t) !important;
    height: calc(var(--header-h) + var(--safe-t)) !important;
  }
  .page-content {
    padding-top: .875rem !important;
  }

  /* ── Login page — تمركز عمودي صحيح على الجوال ── */
  .login-wrap {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem 1.25rem;
    padding-top: max(env(safe-area-inset-top, 0px) + 3.5rem, 4rem);
    padding-bottom: max(env(safe-area-inset-bottom, 0px) + 2rem, 2rem);
    min-height: 100dvh;
  }
  .login-box { padding: 2rem 1.5rem !important; }

  /* ── Typography ── */
  h2 { font-size: 1.1rem; }

  /* ── Tasks — hide desktop table, show mobile cards ── */
  .tasks-desktop-table { display: none !important; }
  .tasks-mobile-cards  { display: block !important; }

  /* ── Employees — hide desktop table, show mobile cards ── */
  .emp-desktop-table  { display: none !important; }
  .emp-mobile-cards   { display: block !important; }

  /* ── Fix 2-col grids inside modals → stack vertically ── */
  .modal [style*="grid-template-columns:1fr 1fr"],
  .modal [style*="grid-template-columns: 1fr 1fr"],
  .modal [style*="grid-template-columns:1fr 1fr 1fr"],
  .modal [style*="grid-template-columns: 1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* ── Mustakhlas info grid → max 2 per row ── */
  .must-info-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  /* ── Search overlay → bottom sheet on mobile ── */
  #search-overlay { padding-top: max(env(safe-area-inset-top, 0px) + .75rem, 1rem); padding-left: 0; padding-right: 0; align-items: flex-end; }
  #search-box { border-radius: 20px 20px 0 0; max-width: 100%; max-height: 80svh; }
}

/* ── Tasks mobile cards — base (desktop hides them) ── */
.tasks-mobile-cards { display: none; }
.tasks-desktop-table { display: block; }

.task-mc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: .875rem;
  margin-bottom: .75rem;
  box-shadow: var(--shadow-sm);
}
.task-mc-card.task-mc-done {
  border-color: #bbf7d0;
  background: #f0fdf4;
}
.task-mc-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .75rem;
  flex-wrap: nowrap;
}
.task-mc-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  background: var(--blue-lt);
  color: var(--blue);
  border-radius: 50%;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.task-mc-desc {
  flex: 1;
  font-weight: 600;
  font-size: .9rem;
  color: var(--text);
  line-height: 1.35;
  min-width: 0;
}
.task-mc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem .75rem;
  margin-bottom: .75rem;
}
.task-mc-grid > div {
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.task-mc-lbl {
  font-size: .7rem;
  color: var(--text-3);
  font-weight: 500;
}
.task-mc-val {
  font-size: .88rem;
  color: var(--text);
  font-weight: 600;
}
.task-mc-curr-input {
  width: 100% !important;
  padding: .3rem .5rem !important;
  min-height: 38px !important;
}
.task-mc-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
  border-radius: 8px;
  padding: .5rem .75rem;
  margin-bottom: .625rem;
}
.task-mc-actions {
  display: flex;
  gap: .5rem;
}
.task-mc-footer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: .875rem;
  margin-top: .25rem;
}
.task-mc-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .4rem 0;
  font-size: .85rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.task-mc-footer-row:last-child { border-bottom: none; }

/* ── Employee mobile cards — base (desktop hides them) ── */
.emp-mobile-cards  { display: none; }
.emp-desktop-table { display: block; }

.emp-mc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: .875rem;
  margin-bottom: .75rem;
  box-shadow: var(--shadow-sm);
}
.emp-mc-card.emp-mc-expired { border-color: #fca5a5; background: #fff5f5; }
.emp-mc-card.emp-mc-warn    { border-color: #fcd34d; }
.emp-mc-head {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  margin-bottom: .625rem;
}
.emp-mc-name {
  font-weight: 700;
  font-size: .95rem;
  color: var(--text);
}
.emp-mc-sub {
  font-size: .78rem;
  color: var(--text-2);
  margin-top: 2px;
}
.emp-mc-ids {
  display: flex;
  gap: 1rem;
  margin-bottom: .5rem;
  font-size: .82rem;
  color: var(--text-2);
}
.emp-mc-dates {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: .5rem;
  background: var(--bg);
  border-radius: 8px;
  padding: .5rem .625rem;
  margin-bottom: .5rem;
}
.emp-mc-date-val {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 2px;
}
.emp-mc-contact {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  font-size: .8rem;
  color: var(--text-2);
  margin-bottom: .5rem;
}
.emp-mc-actions {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
}

/* ── PWA standalone — account for status bar in login ── */
@media (display-mode: standalone) {
  .login-wrap {
    padding-top: max(env(safe-area-inset-top, 44px) + 2rem, 5rem) !important;
    padding-bottom: max(env(safe-area-inset-bottom, 34px) + 1.5rem, 3rem) !important;
  }
}

/* ══════════════════════════════════════════════════════
   GLOBAL SEARCH OVERLAY
═══════════════════════════════════════════════════════ */
#search-overlay {
  position: fixed;
  inset: 0;
  z-index: 2100;
  background: rgba(0,0,0,.55);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: max(env(safe-area-inset-top, 0px) + 4.5rem, 5rem);
  padding-left: 1rem;
  padding-right: 1rem;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
#search-overlay.open { display: flex; animation: searchFadeIn .15s ease; }
@keyframes searchFadeIn { from { opacity: 0; } to { opacity: 1; } }
#search-box {
  width: 100%;
  max-width: 640px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  overflow: hidden;
  max-height: calc(100svh - 8rem);
  display: flex;
  flex-direction: column;
}
#search-input-wrap {
  display: flex;
  align-items: center;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  gap: .6rem;
}
#search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1rem;
  outline: none;
  color: var(--text);
  font-family: inherit;
}
#search-input::placeholder { color: var(--text-3); }
#search-results {
  overflow-y: auto;
  flex: 1;
  min-height: 60px;
}
.srch-group { padding: .4rem 0; }
.srch-group-title {
  padding: .3rem 1rem;
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: .04em;
}
.srch-item {
  display: flex;
  align-items: center;
  padding: .6rem 1rem;
  cursor: pointer;
  gap: .75rem;
  transition: background .1s;
  border: none;
  width: 100%;
  background: none;
  text-align: right;
  font-family: inherit;
  color: var(--text);
}
.srch-item:hover, .srch-item:focus { background: var(--bg); outline: none; }
.srch-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem;
  flex-shrink: 0;
}
.srch-name { font-weight: 600; font-size: .88rem; }
.srch-sub  { font-size: .75rem; color: var(--text-3); margin-top: 1px; }
.srch-empty { padding: 2rem; text-align: center; color: var(--text-3); font-size: .9rem; }
