/* ==========================================================================
   بيانات علاوات وترفيعات الموظفين - Design System & Modern CSS
   ========================================================================== */

:root {
  --font-family-platform: 'Tajawal', sans-serif;
  --font-weight-light: 300;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-bold: 700;
  --font-weight-extra-bold: 800;
  --font-weight-black: 900;
  /* Theme Variables - Dark Mode Default */
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-card-hover: rgba(31, 41, 55, 0.8);
  --bg-input: #1f2937;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(99, 102, 241, 0.4);
  
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  /* Brand Accent Colors */
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-secondary: #06b6d4;
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  --accent-whatsapp: #25d366;
  --accent-whatsapp-hover: #1da851;
  
  /* Glassmorphism & Shadow */
  --glass-bg: rgba(17, 24, 39, 0.75);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-blur: blur(16px);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.4);
  --shadow-accent: 0 0 20px rgba(99, 102, 241, 0.35);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme Overrides */
[data-theme="light"] {
  --bg-primary: #f3f4f6;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: #ffffff;
  --bg-input: #f9fafb;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-highlight: rgba(99, 102, 241, 0.5);
  
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-family-platform);
  -webkit-tap-highlight-color: transparent;
}

html {
  font-family: var(--font-family-platform);
  font-synthesis: none;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

h1 { font-weight: var(--font-weight-black); }
h2 { font-weight: var(--font-weight-extra-bold); }
h3, h4, h5, h6, strong, b { font-weight: var(--font-weight-bold); }
button, input, select, textarea { font-family: var(--font-family-platform); }
button { font-weight: var(--font-weight-bold); }
input, select, textarea { font-weight: var(--font-weight-medium); }

/* Map legacy inline 600 declarations to an official Tajawal weight. */
[style*="font-weight: 600"] { font-weight: var(--font-weight-medium) !important; }

body {
  font-family: var(--font-family-platform);
  font-weight: var(--font-weight-regular);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  direction: rtl;
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(6, 182, 212, 0.08) 0%, transparent 40%);
}

html,
body {
  min-height: 100%;
  overscroll-behavior-x: none;
  touch-action: pan-y;
}

/* Safari uses the root element as the page scroller. Constrain every
 * top-level surface so no child can create a screen-wide horizontal slider. */
body > header,
body > section,
body > footer {
  max-width: 100%;
}

img,
svg,
canvas,
iframe,
video {
  max-width: 100%;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  padding: calc(0.75rem + env(safe-area-inset-top)) calc(1.5rem + env(safe-area-inset-right)) 0.75rem calc(1.5rem + env(safe-area-inset-left));
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all var(--transition-normal);
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.4rem;
  font-weight: 700;
  box-shadow: var(--shadow-accent);
}

.brand-logo img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.brand-text p {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.brand-title-short { display: none; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.institutional-banner {
  width: min(1180px, calc(100% - 2rem));
  margin: 1rem auto 0;
  padding: 0.85rem 1.25rem;
  display: grid;
  grid-template-columns: minmax(150px, 210px) minmax(240px, 1fr) minmax(150px, 210px);
  align-items: center;
  gap: 1rem;
  border: 1px solid rgba(16, 185, 129, 0.28);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(206, 17, 38, 0.08), rgba(255, 255, 255, 0.03) 48%, rgba(0, 122, 61, 0.1)),
    var(--glass-bg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.institutional-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.institutional-logo img {
  width: 76px;
  height: 76px;
  flex: 0 0 76px;
  object-fit: contain;
  border-radius: 14px;
  background: #ffffff;
  padding: 0.25rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.institutional-logo span {
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--text-secondary);
  font-weight: 700;
}

.ministry-logo { flex-direction: row-reverse; text-align: left; }
.ministry-logo img { width: 92px; flex-basis: 92px; }

.institutional-banner-title { text-align: center; min-width: 0; }
.institutional-banner-title span { color: var(--accent-success); font-weight: 700; font-size: 0.78rem; }
.institutional-banner-title h2 { margin-top: 0.2rem; font-size: clamp(1.15rem, 2.4vw, 1.9rem); font-weight: 900; line-height: 1.35; }
.institutional-banner-title p { margin-top: 0.2rem; color: var(--text-secondary); font-size: 0.78rem; }

.platform-footer {
  width: min(1180px, calc(100% - 2rem));
  margin: 1.25rem auto calc(1rem + env(safe-area-inset-bottom));
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-sm);
}

.platform-footer-credit {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.platform-footer-credit strong {
  color: var(--text-primary);
  font-family: var(--font-family-platform);
  font-size: 1rem;
  letter-spacing: 0.12em;
}

.platform-footer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.platform-footer-social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.38rem 0.62rem;
  border-radius: var(--radius-full);
  color: #ffffff;
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 700;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.platform-footer-whatsapp {
  background: linear-gradient(135deg, #25d366, #128c4a);
  box-shadow: 0 5px 16px rgba(37, 211, 102, 0.25);
}

.platform-footer-instagram {
  background: linear-gradient(135deg, #833ab4, #fd1d1d 55%, #fcb045);
  box-shadow: 0 5px 16px rgba(225, 48, 108, 0.25);
}

.platform-footer-social:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 20px rgba(99, 102, 241, 0.32);
}

.platform-footer-social i { font-size: 1rem; }
.platform-footer-social bdi { font-family: var(--font-family-platform); font-weight: var(--font-weight-medium); }

/* WhatsApp Button */
.whatsapp-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--accent-whatsapp);
  color: #ffffff !important;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: var(--font-weight-bold);
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.35);
  transition: transform var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
}

.whatsapp-btn:hover {
  background-color: var(--accent-whatsapp-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
}

.whatsapp-btn i {
  font-size: 1.1rem;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all var(--transition-fast);
}

.theme-toggle-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* User Badge */
.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
}

.role-pill {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.role-super { background: rgba(99, 102, 241, 0.2); color: #818cf8; }
.role-admin { background: rgba(6, 182, 212, 0.2); color: #22d3ee; }
.role-employee { background: rgba(16, 185, 129, 0.2); color: #34d399; }

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding-right: calc(1.5rem + env(safe-area-inset-right));
  padding-left: calc(1.5rem + env(safe-area-inset-left));
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 0.85rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-weight: var(--font-weight-bold);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  transition: all var(--transition-fast);
  text-decoration: none; /* for <a> used as tab */
  font-family: inherit;
}

.tab-btn:hover {
  color: var(--text-primary);
  text-decoration: none;
}

.tab-btn.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

.badge-count {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  font-size: 0.75rem;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-warning);
}

/* ==========================================================================
   Layout & Container
   ========================================================================== */

.main-container {
  max-width: 1350px;
  margin: 0 auto;
  padding: 1.5rem calc(1.5rem + env(safe-area-inset-right)) calc(1.5rem + env(safe-area-inset-bottom)) calc(1.5rem + env(safe-area-inset-left));
}

.tab-content {
  display: none;
  animation: fadeIn var(--transition-normal);
}

.tab-content.active {
  display: block;
}

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

/* Glass Card Component */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

/* ==========================================================================
   Executive Dashboard (لوحة التحكم التنفيذية)
   ========================================================================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
}

.stat-card.clickable {
  cursor: pointer;
  transition: all var(--transition-fast);
}

.stat-card.clickable:hover {
  transform: translateY(-4px);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-lg);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.icon-purple { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.icon-cyan { background: rgba(6, 182, 212, 0.15); color: #22d3ee; }
.icon-green { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.icon-amber { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.icon-red { background: rgba(239, 68, 68, 0.15); color: #f87171; }

.stat-info h3 {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-primary);
}

.stat-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 992px) {
  .dashboard-layout { grid-template-columns: 1fr; }
}

/* Timeline Stream */
.timeline-stream {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.timeline-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding-bottom: 0.85rem;
  border-bottom: 1px dashed var(--border-color);
}

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

.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 0.4rem;
  flex-shrink: 0;
}

.dot-primary { background: var(--accent-primary); box-shadow: 0 0 8px var(--accent-primary); }
.dot-warning { background: var(--accent-warning); box-shadow: 0 0 8px var(--accent-warning); }
.dot-success { background: var(--accent-success); box-shadow: 0 0 8px var(--accent-success); }
.dot-danger { background: var(--accent-danger); box-shadow: 0 0 8px var(--accent-danger); }

.timeline-content p {
  font-size: 0.85rem;
  color: var(--text-primary);
}

.timeline-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Data Quality Center (مركز جودة البيانات)
   ========================================================================== */

.quality-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.quality-score-badge {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(6, 182, 212, 0.15));
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
}

.score-value {
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent-success);
}

.quality-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.quality-issue-card {
  padding: 1.25rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.issue-title {
  font-weight: var(--font-weight-bold);
  font-size: 0.9rem;

}

.issue-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.issue-count {
  font-size: 1.25rem;
  font-weight: 800;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
}

/* ==========================================================================
   Single Admin Lock & Employee Table (التواجد والقفل الحصري)
   ========================================================================== */

.lock-alert-banner {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(245, 158, 11, 0.2));
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: var(--font-weight-bold);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  animation: pulseGlow 2s infinite ease-in-out;
}

@keyframes pulseGlow {
  0%, 100% { border-color: rgba(239, 68, 68, 0.4); }
  50% { border-color: rgba(239, 68, 68, 0.8); }
}

/* Data Table Styling */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 0.88rem;
}

.data-table th {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 700;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background: var(--bg-card-hover);
}

/* Status Badges */
.badge-status {
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: var(--font-weight-bold);
}

.status-active { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.status-locked { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.status-pending { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

/* ==========================================================================
   Administrative Orders Vault (مستودع الأوامر الإدارية)
   ========================================================================== */

.search-box-large {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.input-styled {
  width: 100%;
  padding: 0.75rem 1.25rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: all var(--transition-fast);
}

.input-styled:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary-hover));
  color: #ffffff;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-accent);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.excel-danger-btn {
  background: linear-gradient(135deg, #ef4444, #b91c1c) !important;
  box-shadow: 0 4px 18px rgba(239, 68, 68, 0.34) !important;
}

.excel-danger-btn:hover {
  box-shadow: 0 6px 22px rgba(239, 68, 68, 0.5) !important;
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: var(--font-weight-bold);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
}

.btn-danger,
.order-delete-one {
  border: 1px solid rgba(239, 68, 68, 0.5);
  background: linear-gradient(135deg, #dc2626, #991b1b);
  color: #ffffff;
  border-radius: var(--radius-md);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.btn-danger { padding: 0.75rem 1.1rem; }
.order-delete-one { padding: 0.2rem 0.55rem; font-size: 0.75rem; }
.btn-danger:hover, .order-delete-one:hover { transform: translateY(-1px); }
.btn-danger:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.order-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.order-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
}

.order-version-badge {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-secondary);
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.order-version-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.8rem;
  background: var(--bg-input);
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
}
.order-version-file, .order-version-actions { display: flex; align-items: center; gap: 0.4rem; }
.order-version-file { min-width: 0; }
.order-version-file > span { overflow-wrap: anywhere; }
.order-version-actions { flex-wrap: wrap; justify-content: flex-end; }
.order-select-checkbox { position: relative; flex: 0 0 22px; width: 22px; height: 22px; cursor: pointer; }
.order-select-checkbox input { position: absolute; opacity: 0; pointer-events: none; }
.order-select-checkbox span { display: block; width: 22px; height: 22px; border: 2px solid var(--text-muted); border-radius: 6px; }
.order-select-checkbox input:checked + span { border-color: var(--accent-danger); background: var(--accent-danger); }
.order-select-checkbox input:checked + span::after { content: '✓'; color: #fff; font-weight: 900; position: absolute; inset: -1px 0 0; text-align: center; }

.destructive-confirmation-modal { max-width: 440px; text-align: center; }
.destructive-confirmation-icon { font-size: 3.2rem; color: var(--accent-danger); }
.destructive-confirmation-modal h3 { margin-top: 0.45rem; font-size: 1.2rem; }
.destructive-confirmation-modal > p { margin-top: 0.45rem; color: var(--text-secondary); font-size: 0.84rem; }
.math-confirmation-question { margin: 1.15rem 0 0.7rem; font-size: 2rem; font-weight: 900; }
.destructive-confirmation-error { margin-top: 0.75rem; color: #fca5a5; }
.destructive-confirmation-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-top: 1rem; }

.backup-list-button { margin-bottom: 1.15rem; }
.modal-section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border-color); }
.modal-section-heading h3 { font-size: 1.15rem; }
.modal-section-heading p { margin-top: 0.25rem; color: var(--text-secondary); font-size: 0.78rem; }
.daily-backups-list { display: flex; flex-direction: column; gap: 0.65rem; max-height: min(55vh, 520px); overflow-y: auto; margin-top: 1rem; }
.daily-backup-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.75rem; padding: 0.8rem; background: var(--bg-input); border: 1px solid var(--border-color); border-radius: var(--radius-md); }
.daily-backup-row-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: var(--accent-success); background: rgba(16, 185, 129, 0.12); font-size: 1.3rem; }
.daily-backup-row-info strong, .daily-backup-row-info span { display: block; }
.daily-backup-row-info span { margin-top: 0.15rem; color: var(--text-secondary); font-size: 0.72rem; }
.daily-backup-loading, .daily-backup-empty { min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.35rem; color: var(--text-secondary); text-align: center; }
.daily-backup-empty i { font-size: 2.5rem; }
.daily-backup-empty strong { color: var(--text-primary); }
.daily-backup-empty.is-error i { color: var(--accent-danger); }
.modal-footer-actions { display: flex; justify-content: flex-end; padding-top: 1rem; }

/* ==========================================================================
   Login Page & OTP Modal
   ========================================================================== */

.login-wrapper {
  min-height: calc(100vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.login-card {
  width: 100%;
  max-width: 450px;
  min-width: 0;
}

.whatsapp-hero-banner {
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.15), rgba(16, 185, 129, 0.15));
  border: 1px solid rgba(37, 211, 102, 0.3);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.whatsapp-hero-banner p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 100%;
  max-width: 540px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
}

/* Scrollable Modal Layout with Sticky Header & Footer */
.modal-dialog-scrollable {
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 1.25rem 1.5rem !important;
}

.modal-header-sticky {
  flex-shrink: 0;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0.75rem;
}

.modal-body-scrollable {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.35rem;
  margin-bottom: 0.75rem;
}

.modal-body-scrollable::-webkit-scrollbar {
  width: 6px;
}

.modal-body-scrollable::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.modal-footer-sticky {
  flex-shrink: 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

/* Inline Table Cell Inputs */
.table-inline-input {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.25rem 0.4rem;
  border-radius: var(--radius-sm);
  width: 100%;
  min-width: 110px;
  transition: all var(--transition-fast);
}

.table-inline-input:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: var(--bg-input);
}

.table-inline-input:focus {
  border-color: var(--accent-primary);
  background: var(--bg-input);
  outline: none;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.otp-inputs {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  direction: ltr;
  margin: 1.25rem 0;
}

.otp-digit {
  width: 48px;
  height: 56px;
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  outline: none;
}

.otp-digit:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

/* Alert Card Note */
.alert-note-card {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(245, 158, 11, 0.15));
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  color: #fca5a5;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

/* Employee salary calculator */
.salary-calculator-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.16), rgba(99, 102, 241, 0.14));
}

.salary-calculator-hero h2 {
  margin-top: 0.45rem;
  font-size: 1.55rem;
  font-weight: 900;
}

.salary-calculator-hero p {
  margin-top: 0.35rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.salary-calculator-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--accent-success);
  font-size: 0.78rem;
  font-weight: 800;
}

.salary-net-card {
  min-width: 250px;
  padding: 1rem 1.25rem;
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: var(--radius-md);
  background: rgba(16, 185, 129, 0.13);
  text-align: center;
}

.salary-net-card span,
.salary-summary-card span {
  display: block;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
}

.salary-net-card strong {
  display: block;
  margin-top: 0.25rem;
  color: #34d399;
  font-size: 1.55rem;
  font-weight: 900;
  direction: ltr;
}

.salary-calculator-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.salary-input-card { min-width: 0; }

.salary-section-heading {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 1.15rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border-color);
}

.salary-section-heading > i {
  color: var(--accent-success);
  font-size: 1.35rem;
}

.salary-deduction-heading > i { color: var(--accent-danger); }
.salary-section-heading h3 { font-size: 1rem; font-weight: 800; }
.salary-section-heading p { margin-top: 0.15rem; color: var(--text-muted); font-size: 0.75rem; }

.salary-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.salary-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.salary-field-wide { grid-column: 1 / -1; }
.salary-field > span { color: var(--text-secondary); font-size: 0.78rem; font-weight: 700; }
.salary-field small { color: var(--text-muted); font-size: 0.68rem; }
.salary-field .input-styled { width: 100%; }

.salary-fixed-deductions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.salary-fixed-deductions > div {
  padding: 0.75rem;
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.08);
}

.salary-fixed-deductions span { display: block; color: var(--text-secondary); font-size: 0.75rem; }
.salary-fixed-deductions strong { display: block; margin-top: 0.25rem; color: #fca5a5; direction: ltr; }
.salary-reset-btn { margin-top: 1rem; width: 100%; justify-content: center; }

.salary-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.salary-summary-card {
  padding: 1rem;
  border-radius: var(--radius-md);
  text-align: center;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

.salary-summary-card strong {
  display: block;
  margin-top: 0.3rem;
  font-size: 1.2rem;
  font-weight: 900;
  direction: ltr;
}

.salary-summary-card.entitlement strong { color: #60a5fa; }
.salary-summary-card.deductions strong { color: #f87171; }
.salary-summary-card.net { border-color: rgba(16, 185, 129, 0.4); background: rgba(16, 185, 129, 0.1); }
.salary-summary-card.net strong { color: #34d399; }

.salary-breakdown-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.salary-breakdown-columns h4 { margin-bottom: 0.55rem; color: var(--text-secondary); font-size: 0.82rem; }
.salary-breakdown-row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.48rem 0; border-bottom: 1px solid var(--border-color); font-size: 0.78rem; }
.salary-breakdown-row strong { white-space: nowrap; direction: ltr; }

.salary-calculator-note {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  font-size: 0.76rem;
}

@media (max-width: 850px) {
  .salary-calculator-layout { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .salary-calculator-hero { padding: 1rem; }
  .salary-net-card { width: 100%; min-width: 0; }
  .salary-form-grid,
  .salary-fixed-deductions,
  .salary-breakdown-columns { grid-template-columns: 1fr; }
  .salary-field-wide { grid-column: auto; }
  .salary-summary-grid { grid-template-columns: 1fr; gap: 0.65rem; }
}

/* Sheet «الموحد» employee experience */
.employee-alerts-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.employee-note-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

.employee-note-alert > i { font-size: 1.35rem; margin-top: 0.1rem; }
.employee-note-alert span { display: block; color: var(--text-secondary); font-size: 0.74rem; margin-bottom: 0.2rem; }
.employee-note-alert strong { display: block; color: var(--text-primary); font-size: 0.9rem; line-height: 1.8; white-space: pre-wrap; }
.employee-note-alert.warning { border-color: rgba(245, 158, 11, 0.48); background: rgba(245, 158, 11, 0.1); }
.employee-note-alert.warning > i { color: var(--accent-warning); }
.employee-note-alert.success { border-color: rgba(16, 185, 129, 0.42); background: rgba(16, 185, 129, 0.09); }
.employee-note-alert.success > i { color: var(--accent-success); }
.employee-note-alert.info { border-color: rgba(99, 102, 241, 0.4); background: rgba(99, 102, 241, 0.09); }
.employee-note-alert.info > i { color: var(--accent-primary); }

.employee-card-identity {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin-top: 0.45rem;
  direction: rtl;
}
.employee-card-identity strong { color: var(--text-primary); direction: ltr; unicode-bidi: plaintext; }

.employee-profile-card,
.employee-profile-card-layout,
.employee-profile-info {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.employee-profile-card-layout { overflow: hidden; }
.employee-profile-info { flex: 1 1 260px; }
#empPortalName { max-width: 100%; overflow-wrap: anywhere; }
#employeePdfDownloadBtn { max-width: 100%; white-space: normal; line-height: 1.45; }

.unified-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.unified-summary-card {
  position: relative;
  min-width: 0;
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: linear-gradient(145deg, var(--bg-card), rgba(99, 102, 241, 0.06));
}
.unified-summary-card > i { color: var(--accent-primary); font-size: 1.2rem; }
.unified-summary-card span { display: block; margin-top: 0.55rem; color: var(--text-secondary); font-size: 0.72rem; }
.unified-summary-card strong { display: block; margin-top: 0.2rem; color: var(--text-primary); font-size: 0.92rem; line-height: 1.65; overflow-wrap: anywhere; }
.unified-summary-card.salary { border-color: rgba(16, 185, 129, 0.35); background: linear-gradient(145deg, var(--bg-card), rgba(16, 185, 129, 0.1)); }
.unified-summary-card.salary > i, .unified-summary-card.salary strong { color: var(--accent-success); }

.unified-fields-container { display: grid; gap: 1rem; }
.unified-detail-section {
  padding: 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}
.unified-detail-heading { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 0.85rem; }
.unified-detail-heading i { color: var(--accent-primary); font-size: 1.2rem; }
.unified-detail-heading h3 { font-size: 1rem; }
.unified-detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.7rem; }
.unified-detail-item { min-width: 0; padding: 0.75rem; border-radius: var(--radius-sm); background: var(--bg-input); border: 1px solid transparent; }
.unified-detail-item span { display: block; color: var(--text-secondary); font-size: 0.7rem; line-height: 1.55; }
.unified-detail-item strong { display: block; color: var(--text-primary); font-size: 0.84rem; line-height: 1.7; margin-top: 0.3rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.unified-detail-item.is-note { border-color: rgba(245, 158, 11, 0.24); }

.unified-actions-column { position: sticky; right: 0; z-index: 3; background: var(--bg-secondary) !important; min-width: 155px; }
.unified-row-actions { display: flex; gap: 0.35rem; }
.unified-row-actions .btn-primary, .unified-row-actions .btn-secondary { padding: 0.35rem 0.55rem; font-size: 0.72rem; white-space: nowrap; }
.unified-identity-cell .table-inline-input { direction: ltr; text-align: left; font-weight: 800; color: var(--accent-success); min-width: 145px; }
.unified-note-cell .table-inline-input { min-width: 210px; }
.unified-empty-row { text-align: center; padding: 2rem !important; color: var(--text-muted); }

.excel-import-summary { display: grid; gap: 0.45rem; font-size: 0.82rem; background: var(--bg-input); padding: 0.8rem; border-radius: var(--radius-sm); border-right: 4px solid var(--accent-success); }
.excel-import-summary i { color: var(--accent-success); margin-left: 0.3rem; }
.excel-import-warning { color: #fca5a5; }
.excel-import-warning i { color: var(--accent-warning); }

.daily-backup-status {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  margin-bottom: 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.08);
}
.daily-backup-status > i { color: var(--accent-success); font-size: 1.3rem; }
.daily-backup-status strong, .daily-backup-status span { display: block; }
.daily-backup-status strong { font-size: 0.86rem; }
.daily-backup-status span { margin-top: 0.2rem; color: var(--text-secondary); font-size: 0.74rem; line-height: 1.6; }
.daily-backup-status.error { border-color: rgba(239, 68, 68, 0.4); background: rgba(239, 68, 68, 0.08); }
.daily-backup-status.error > i { color: var(--accent-danger); }

@media (max-width: 900px) {
  .unified-summary-grid, .unified-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .institutional-banner {
    width: calc(100% - 1rem);
    grid-template-columns: 78px minmax(0, 1fr) 78px;
    gap: 0.55rem;
    padding: 0.65rem;
  }
  .institutional-logo { justify-content: center; }
  .institutional-logo img, .ministry-logo img { width: 68px; height: 68px; flex-basis: 68px; }
  .institutional-logo span { display: none; }
  .institutional-banner-title h2 { font-size: clamp(0.98rem, 4vw, 1.35rem); }
  .institutional-banner-title span, .institutional-banner-title p { font-size: 0.66rem; }
}

@media (max-width: 560px) {
  .employee-alerts-grid, .unified-summary-grid, .unified-detail-grid { grid-template-columns: 1fr; }
  .unified-summary-card, .unified-detail-section { padding: 0.85rem; }
  .unified-detail-item { padding: 0.7rem; }
  .employee-card-identity { align-items: flex-start; flex-wrap: wrap; }
  .employee-profile-card { padding: 0.9rem; }
  .employee-profile-card-layout { gap: 0.75rem !important; }
  .employee-profile-info { flex-basis: 100%; }
  #empPortalName { font-size: 1.25rem !important; line-height: 1.45; }
  #employeePdfDownloadBtn {
    display: flex;
    width: 100%;
    min-width: 0;
    padding: 0.65rem 0.75rem !important;
    justify-content: center;
    overflow-wrap: anywhere;
  }
  .institutional-banner { grid-template-columns: 58px minmax(0, 1fr) 58px; margin-top: 0.5rem; border-radius: 14px; }
  .institutional-logo img, .ministry-logo img { width: 54px; height: 54px; flex-basis: 54px; border-radius: 10px; padding: 0.15rem; }
  .institutional-banner-title h2 { font-size: 0.9rem; line-height: 1.4; }
  .institutional-banner-title span { display: none; }
  .institutional-banner-title p { font-size: 0.58rem; }
  .order-version-row { align-items: stretch; flex-direction: column; }
  .order-version-actions { justify-content: stretch; }
  .order-version-actions button { flex: 1 1 auto; min-height: 36px; }
  .daily-backup-row { grid-template-columns: auto 1fr; }
  .daily-backup-download { grid-column: 1 / -1; justify-content: center; width: 100%; }
  .destructive-confirmation-actions { grid-template-columns: 1fr; }
  .platform-footer {
    width: calc(100% - 1rem);
    margin-top: 0.75rem;
    padding: 0.55rem 0.65rem calc(0.55rem + env(safe-area-inset-bottom));
    flex-direction: column;
    text-align: center;
    gap: 0.45rem;
  }
  .platform-footer-credit {
    justify-content: center;
    flex-wrap: nowrap;
    gap: 0.3rem;
    font-size: 0.64rem;
    white-space: nowrap;
  }
  .platform-footer-credit strong { font-size: 0.82rem; }
  .platform-footer-actions {
    width: auto;
    max-width: 100%;
    display: flex;
    justify-content: center;
    gap: 0.35rem;
    flex-wrap: nowrap;
  }
  .platform-footer-social {
    width: auto;
    min-height: 30px;
    padding: 0.28rem 0.55rem;
    font-size: 0.56rem;
    line-height: 1;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
  }
  .platform-footer-social i { font-size: 0.8rem; }
}

/* Compact Header for phones, tablets and portrait screens */
@media (max-width: 1100px) {
  .app-header {
    padding: calc(0.45rem + env(safe-area-inset-top)) calc(0.65rem + env(safe-area-inset-right)) 0.45rem calc(0.65rem + env(safe-area-inset-left));
    min-height: 52px;
    gap: 0.5rem;
  }

  .brand-container {
    min-width: 0;
    flex: 1 1 auto;
    gap: 0.45rem;
  }

  .brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 1.05rem;
    flex: 0 0 34px;
  }

  .brand-text { min-width: 0; }
  .brand-text h1 {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .brand-title-full { display: none; }
  .brand-title-short { display: inline; }
  .brand-text p { display: none; }

  .header-actions {
    flex: 0 0 auto;
    gap: 0.35rem;
    min-width: 0;
  }

  #headerWhatsAppBtn {
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
    flex: 0 0 34px;
  }
  #headerWhatsAppBtn span { display: none; }

  .theme-toggle-btn {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
  }

  .user-profile-badge {
    height: 36px;
    max-width: 180px;
    padding: 0.2rem 0.35rem;
    gap: 0.3rem;
    border-radius: 12px;
    font-size: 0.76rem;
    min-width: 0;
  }

  #headerUserName {
    display: block;
    max-width: 92px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .user-profile-badge .btn-secondary {
    width: 28px;
    height: 28px;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 28px;
  }
  .logout-label { display: none; }
}

@media (max-width: 768px) {
  .main-container {
    padding: 1rem calc(1rem + env(safe-area-inset-right)) calc(1rem + env(safe-area-inset-bottom)) calc(1rem + env(safe-area-inset-left));
  }
  .nav-tabs {
    padding-right: calc(0.6rem + env(safe-area-inset-right));
    padding-left: calc(0.6rem + env(safe-area-inset-left));
    overflow-x: hidden;
    flex-wrap: wrap;
    align-items: stretch;
    scroll-snap-type: none;
  }
  .tab-btn {
    min-height: 48px;
    padding: 0.75rem 0.9rem;
    flex: 1 1 calc(50% - 0.5rem);
    min-width: 0;
    justify-content: center;
    text-align: center;
    white-space: normal;
    line-height: 1.35;
  }

  /* The employee portal has exactly three destinations. Keep all three in
     one viewport-width row without horizontal scrolling or wrapped labels. */
  #employeeTabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    width: 100%;
    max-width: 100%;
    padding-right: env(safe-area-inset-right);
    padding-left: env(safe-area-inset-left);
    overflow-x: hidden;
  }
  #employeeTabs .tab-btn {
    flex: 1 1 0;
    width: 33.333%;
    min-width: 0;
    min-height: 54px;
    padding: 0.55rem 0.2rem;
    gap: 0.2rem;
    flex-wrap: nowrap;
    white-space: nowrap;
    font-size: clamp(0.56rem, 2.55vw, 0.76rem);
    letter-spacing: -0.025em;
  }
  #employeeTabs .tab-btn i {
    flex: 0 0 auto;
    font-size: 0.9rem;
  }
}

@media (max-width: 360px) {
  .login-wrapper { padding-right: 0.6rem; padding-left: 0.6rem; }
  .login-card { padding: 1rem; }
  .whatsapp-hero-banner { padding: 0.75rem; }
  .whatsapp-hero-banner .whatsapp-btn { padding-right: 0.55rem; padding-left: 0.55rem; }
  .whatsapp-hero-banner .whatsapp-btn span { overflow-wrap: anywhere; }
  #employeeTabs .tab-btn {
    min-height: 50px;
    padding-right: 0.1rem;
    padding-left: 0.1rem;
    gap: 0.1rem;
    font-size: 0.52rem;
  }
  #employeeTabs .tab-btn i { font-size: 0.78rem; }
}

@media (max-width: 430px) {
  .app-header {
    gap: 0.3rem;
    padding-right: calc(0.45rem + env(safe-area-inset-right));
    padding-left: calc(0.45rem + env(safe-area-inset-left));
  }
  .brand-container { gap: 0.3rem; }
  .brand-logo { width: 32px; height: 32px; flex-basis: 32px; }
  .brand-text h1 { font-size: 0.78rem; }
  .header-actions { gap: 0.25rem; }
  #headerWhatsAppBtn, .theme-toggle-btn { width: 32px; height: 32px; flex-basis: 32px; }
  .user-profile-badge { max-width: 130px; height: 34px; }
  .user-profile-badge > i { display: none; }
  #headerUserName { max-width: 72px; }
  .app-header { overflow: hidden; }
  .header-actions { max-width: calc(100% - 105px); }
  .user-profile-badge { flex: 1 1 auto; min-width: 0; }
}

@media (display-mode: standalone) {
  .app-header { -webkit-user-select: none; user-select: none; }
  .main-container { padding-bottom: calc(1.25rem + env(safe-area-inset-bottom)); }
}
