/* ========================================================
   MODERN TRAVEL & FINANCIAL ERP SYSTEM - STYLESHEET
   Curated palette, Glassmorphism, Responsive RTL, Dark/Light
   ======================================================== */

:root {
  /* Typography */
  --font-main: 'Cairo', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-alt: 'Tajawal', sans-serif;

  /* Theme: Dark (Default High-end Enterprise) */
  --bg-body: #0b0f19;
  --bg-surface: #111827;
  --bg-surface-elevated: #1a2234;
  --bg-card: rgba(22, 30, 46, 0.75);
  --bg-card-hover: rgba(30, 41, 64, 0.95);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-card: rgba(255, 255, 255, 0.12);

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  /* Brand Accents (Honoring the warm gold/orange header in the original) */
  --brand-orange: #f59e0b;
  --brand-orange-gradient: linear-gradient(135deg, #d97706 0%, #f59e0b 50%, #fbbf24 100%);
  --brand-orange-glow: rgba(245, 158, 11, 0.25);

  /* Categorized Card Color Palettes */
  /* Greenish / Mint (Operational & Balances) */
  --card-green-bg: linear-gradient(145deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.03) 100%);
  --card-green-border: rgba(16, 185, 129, 0.25);
  --card-green-accent: #10b981;
  --card-green-glow: rgba(16, 185, 129, 0.18);

  /* Blue / Cyan (Financial, Statements & Treasury) */
  --card-blue-bg: linear-gradient(145deg, rgba(14, 165, 233, 0.1) 0%, rgba(2, 132, 199, 0.03) 100%);
  --card-blue-border: rgba(14, 165, 233, 0.25);
  --card-blue-accent: #0284c7;
  --card-blue-glow: rgba(14, 165, 233, 0.18);

  /* Rose / Coral (Admin, Settings, System Exit) */
  --card-red-bg: linear-gradient(145deg, rgba(244, 63, 94, 0.1) 0%, rgba(225, 29, 72, 0.03) 100%);
  --card-red-border: rgba(244, 63, 94, 0.25);
  --card-red-accent: #f43f5e;
  --card-red-glow: rgba(244, 63, 94, 0.18);

  /* Amber / Gold (Tickets & Rates) */
  --card-amber-bg: linear-gradient(145deg, rgba(245, 158, 11, 0.1) 0%, rgba(217, 119, 6, 0.03) 100%);
  --card-amber-border: rgba(245, 158, 11, 0.25);
  --card-amber-accent: #f59e0b;
  --card-amber-glow: rgba(245, 158, 11, 0.18);

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-card-hover: 0 16px 36px rgba(0, 0, 0, 0.6), 0 0 20px rgba(245, 158, 11, 0.15);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --transition-fast: 0.18s ease;
  --transition-smooth: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Light Theme Variables (Matching Image 2 Aesthetic) */
[data-theme="light"] {
  --bg-body: #f4f7fb;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  --border-subtle: #e2e8f0;
  --border-card: #eef2f6;

  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 14px 34px rgba(0, 0, 0, 0.08);
  --shadow-card-hover: 0 16px 36px rgba(0, 0, 0, 0.08);
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-body);
  color: var(--text-main);
  direction: rtl;
  text-align: right;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  transition: background-color var(--transition-smooth), color var(--transition-smooth);
}

/* Background Ambient Lighting */
.bg-decorations {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.35;
  transition: opacity 0.5s ease;
}

.orb-1 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #f59e0b 0%, rgba(245, 158, 11, 0) 70%);
  top: -100px;
  right: -50px;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #0284c7 0%, rgba(2, 132, 199, 0) 70%);
  bottom: -100px;
  left: -80px;
}

.orb-3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, #10b981 0%, rgba(16, 185, 129, 0) 70%);
  top: 40%;
  left: 30%;
  opacity: 0.15;
}

/* App Container Layout - Full Screen Utilization Without Empty Side Voids */
.app-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 16px 28px 20px 28px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

#dashboardView, #sectionPageView {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ========================================================
   TOP HEADER
   ======================================================== */
.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  margin-bottom: 12px;
}



.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-box {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background: var(--brand-orange-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 15px var(--brand-orange-glow);
  transform: rotate(-5deg);
  transition: transform var(--transition-fast);
}

.logo-box:hover .logo-icon {
  transform: rotate(0deg) scale(1.05);
}

.brand-text h1 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
  line-height: 1.2;
}

.sub-brand {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Header Center Stats */
.header-center {
  display: flex;
  align-items: center;
  gap: 16px;
}

.quick-stat-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quick-stat-badge:hover {
  border-color: var(--brand-orange);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.badge-icon {
  font-size: 1.2rem;
  color: var(--brand-orange);
}

.safe-badge .badge-icon {
  color: var(--card-green-accent);
}

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

.badge-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.badge-value {
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font-alt);
}

.text-amber { color: #f59e0b !important; }
.text-emerald { color: #10b981 !important; }
.text-blue { color: #0284c7 !important; }
.text-green { color: #10b981 !important; }
.text-muted { color: var(--text-muted) !important; }
.text-danger { color: #ef4444 !important; }

/* Header Left */
.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.datetime-display {
  text-align: left;
  padding-left: 14px;
  border-left: 1px solid var(--border-subtle);
}

.clock {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-alt);
  color: var(--text-main);
  letter-spacing: 0.5px;
}

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

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.user-profile .avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  color: var(--text-main);
  border-color: var(--brand-orange);
  background: var(--bg-surface);
  transform: translateY(-2px);
}

.exit-btn:hover {
  color: #ef4444;
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* ========================================================
   ACTIVITY & SEARCH BAR
   ======================================================== */
.activity-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  width: 100%;
  box-sizing: border-box;
  gap: 16px;
}

.pulse-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.activity-stats {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.activity-stats strong {
  color: var(--text-main);
  font-weight: 700;
}

.divider {
  color: var(--border-subtle);
}

.search-filter-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  width: 380px;
  max-width: 100%;
}

.search-filter-box i {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.search-filter-box input {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.85rem;
  width: 100%;
  outline: none;
}

.search-filter-box input::placeholder {
  color: var(--text-dim);
}

/* ========================================================
   DASHBOARD GRID (Balanced Modern Rounded Squares)
   ======================================================== */
.dashboard-wrapper {
  width: 100%;
  max-width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  flex: 1;
  padding: 6px 0 18px 0;
  width: 100%;
  box-sizing: border-box;
}

/* Core System Card Styling - Perfectly Balanced Rounded Square */
.sys-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 20px;
  padding: 15px 10px 12px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  aspect-ratio: 1 / 0.95;
  max-height: 160px;
  transition: all var(--transition-smooth);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.035), 0 1px 3px rgba(0, 0, 0, 0.02);
  user-select: none;
  overflow: hidden;
}

[data-theme="dark"] .sys-card {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.sys-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06), 0 3px 8px rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .sys-card:hover {
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.5), 0 0 16px rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.22);
  background: var(--bg-card-hover);
}

.sys-card:active {
  transform: translateY(-1px);
}

/* 1. Top Dash/Pill Bar */
.card-top-pill {
  width: 28px;
  height: 3px;
  border-radius: 5px;
  margin-bottom: 10px;
  transition: width var(--transition-fast);
}

.sys-card:hover .card-top-pill {
  width: 38px;
}

/* 2. Squircle Icon Container */
.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 10px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.sys-card:hover .card-icon {
  transform: scale(1.08);
}

/* 3. Section Title */
.card-title {
  font-size: 0.90rem;
  font-weight: 700;
  color: var(--text-main);
  text-align: center;
  line-height: 1.25;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  padding: 0 4px;
  transition: color var(--transition-fast);
}

/* ========================================================
   COLOR THEMES FOR EACH BOX (Identical to Image 2's Style)
   ======================================================== */

/* Blue / Sky Theme (e.g. قطع التذاكر, كشف حساب, اسماء الحسابات) */
.card-flight .card-top-pill,
.card-statement .card-top-pill,
.card-chart-accounts .card-top-pill {
  background: #0ea5e9;
}
.card-flight .card-icon,
.card-statement .card-icon,
.card-chart-accounts .card-icon {
  background: #e0f2fe;
  color: #0284c7;
}
[data-theme="dark"] .card-flight .card-icon,
[data-theme="dark"] .card-statement .card-icon,
[data-theme="dark"] .card-chart-accounts .card-icon {
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
}

/* Teal Theme (e.g. قطع الفيزة, السندات, صلاحيات المستخدمين) */
.card-visa .card-top-pill,
.card-vouchers .card-top-pill,
.card-permissions .card-top-pill {
  background: #14b8a6;
}
.card-visa .card-icon,
.card-vouchers .card-icon,
.card-permissions .card-icon {
  background: #ccfbf1;
  color: #0d9488;
}
[data-theme="dark"] .card-visa .card-icon,
[data-theme="dark"] .card-vouchers .card-icon,
[data-theme="dark"] .card-permissions .card-icon {
  background: rgba(20, 184, 166, 0.15);
  color: #2dd4bf;
}

/* Emerald Green Theme (e.g. المدينون والدائنون, ارصدة الحسابات) */
.card-opening-balances .card-top-pill,
.card-balances .card-top-pill {
  background: #10b981;
}
.card-opening-balances .card-icon,
.card-balances .card-icon {
  background: #d1fae5;
  color: #059669;
}
[data-theme="dark"] .card-opening-balances .card-icon,
[data-theme="dark"] .card-balances .card-icon {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

/* Orange / Amber Theme (e.g. المصروفات, راس المال, تثبيت سعر الصرف) */
.card-expenses .card-top-pill,
.card-capital .card-top-pill,
.card-exchange .card-top-pill {
  background: #f97316;
}
.card-expenses .card-icon,
.card-capital .card-icon,
.card-exchange .card-icon {
  background: #ffedd5;
  color: #ea580c;
}
[data-theme="dark"] .card-expenses .card-icon,
[data-theme="dark"] .card-capital .card-icon,
[data-theme="dark"] .card-exchange .card-icon {
  background: rgba(249, 115, 22, 0.15);
  color: #fb923c;
}

/* Purple Theme (e.g. حركة العمولات والمصروفات, حركة الصندوق, تغيير كلمة المرور) */
.card-commissions .card-top-pill,
.card-safe .card-top-pill,
.card-password .card-top-pill {
  background: #8b5cf6;
}
.card-commissions .card-icon,
.card-safe .card-icon,
.card-password .card-icon {
  background: #f3e8ff;
  color: #7c3aed;
}
[data-theme="dark"] .card-commissions .card-icon,
[data-theme="dark"] .card-safe .card-icon,
[data-theme="dark"] .card-password .card-icon {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}

/* Rose / Red Theme (e.g. كنسلة تذكرة, اغلاق البرنامج) */
.card-cancel .card-top-pill,
.card-exit .card-top-pill {
  background: #f43f5e;
}
.card-cancel .card-icon,
.card-exit .card-icon {
  background: #ffe4e6;
  color: #e11d48;
}
[data-theme="dark"] .card-cancel .card-icon,
[data-theme="dark"] .card-exit .card-icon {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
}

.font-bold {
  font-weight: 800;
}

/* ========================================================
   BOTTOM FOOTER (Stays at bottom on short pages, flows naturally on long pages)
   ======================================================== */
.main-footer {
  margin-top: auto;
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
  box-sizing: border-box;
}

.footer-left-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-left-info strong {
  color: var(--text-main);
}

.footer-shortcuts {
  display: flex;
  align-items: center;
  gap: 16px;
}

.shortcut-tip kbd {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  padding: 2px 7px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.75rem;
  color: var(--brand-orange);
  margin-left: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* ========================================================
   DEDICATED FULL PAGE VIEW SYSTEM (In-Place SPA Navigation)
   ======================================================== */
.view-screen {
  animation: fadeInView 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Page Navigation Top Bar */
.page-top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.page-nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-back-dashboard {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface-elevated);
  border: 1.5px solid var(--border-subtle);
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-back-dashboard i {
  color: var(--brand-orange);
  transition: transform var(--transition-fast);
}

.btn-back-dashboard:hover {
  background: var(--brand-orange-gradient);
  color: #fff;
  border-color: transparent;
  transform: translateX(4px);
  box-shadow: 0 4px 14px var(--brand-orange-glow);
}

.btn-back-dashboard:hover i {
  color: #fff;
  transform: translateX(4px);
}

.page-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.crumb-home {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.crumb-home:hover {
  color: var(--brand-orange);
}

.crumb-sep {
  color: var(--border-subtle);
}

.crumb-active {
  font-weight: 700;
  color: var(--text-main);
}

.btn-page-action {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
}

.btn-page-action:hover {
  border-color: var(--brand-orange);
  color: var(--brand-orange);
  background: var(--bg-surface);
}

/* Page Header Banner */
.page-header-banner {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 22px 28px;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}



.page-header-icon {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: var(--brand-orange-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  box-shadow: 0 4px 16px var(--brand-orange-glow);
  flex-shrink: 0;
}

.page-header-text h2 {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
}

.page-header-text p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Dedicated Page Content Body */
.page-content-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  min-height: 480px;
}

/* Section Action Header & Expandable Forms */
.section-action-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 14px;
}

.expandable-form-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 26px;
  box-shadow: var(--shadow-md);
  animation: slideDownSmooth 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Modal Form Controls & Data Elements */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.col-span-2 {
  grid-column: span 2;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-control {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.92rem;
  transition: all var(--transition-fast);
  outline: none;
}

.form-control:focus {
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px var(--brand-orange-glow);
}

select.form-control {
  cursor: pointer;
}

.btn-primary {
  background: var(--brand-orange-gradient);
  color: #fff;
  border: none;
  padding: 11px 24px;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px var(--brand-orange-glow);
  transition: all var(--transition-fast);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--brand-orange-glow);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  background: var(--bg-surface);
  border-color: var(--text-muted);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  border: none;
  padding: 11px 24px;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

/* Data Tables */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-top: 18px;
  background: var(--bg-surface-elevated);
}

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

.data-table th {
  background: rgba(255, 255, 255, 0.03);
  padding: 12px 16px;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  white-space: nowrap;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 600;
}

.status-pill.success {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.status-pill.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.status-pill.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.status-pill.info {
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
}

/* Summary Cards inside Modals */
.stats-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  padding: 16px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
}

.stat-box .title {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-box .value {
  font-size: 1.35rem;
  font-weight: 800;
  font-family: var(--font-alt);
  color: var(--text-main);
}

/* ========================================================
   LOCK SCREEN OVERLAY
   ======================================================== */
.lock-screen-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 10, 18, 0.94);
  backdrop-filter: blur(25px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-smooth);
}

.lock-screen-overlay.active {
  opacity: 1;
  visibility: visible;
}

.lock-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  padding: 40px;
  border-radius: var(--radius-xl);
  max-width: 440px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lock-icon-pulse {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 2px solid rgba(239, 68, 68, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  margin-bottom: 20px;
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.3);
  animation: pulse-ring 2.5s infinite;
}

.lock-card h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.lock-card p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.user-locked-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface-elevated);
  padding: 8px 18px;
  border-radius: 30px;
  font-size: 0.88rem;
  margin-bottom: 24px;
  border: 1px solid var(--border-subtle);
}

.lock-form {
  width: 100%;
}

.pin-input-group {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.pin-input-group input {
  flex: 1;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 12px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 1rem;
  text-align: center;
  letter-spacing: 2px;
  outline: none;
}

.pin-input-group input:focus {
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px var(--brand-orange-glow);
}

.btn-unlock {
  background: var(--brand-orange-gradient);
  border: none;
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.unlock-hint {
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* ========================================================
   TOAST NOTIFICATION
   ======================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-card);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  color: var(--text-main);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 420px;
  animation: toast-slide 0.3s ease-out;
}

.toast.toast-success {
  border-right: 4px solid #10b981;
}

.toast.toast-error {
  border-right: 4px solid #ef4444;
}

.toast.toast-info {
  border-right: 4px solid #0284c7;
}

.toast i {
  font-size: 1.2rem;
}

.toast.toast-success i { color: #10b981; }
.toast.toast-error i { color: #ef4444; }
.toast.toast-info i { color: #0284c7; }

@keyframes toast-slide {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ========================================================
   PRINT VIEW STYLES
   ======================================================== */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }
  .app-container, .bg-decorations, .main-header, .activity-bar, .main-footer, .modal-top .modal-actions-top {
    display: none !important;
  }
  .modal-overlay {
    position: static !important;
    background: transparent !important;
    backdrop-filter: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    padding: 0 !important;
  }
  .modal-window {
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    max-height: none !important;
    width: 100% !important;
    transform: none !important;
  }
  .modal-content-area {
    padding: 0 !important;
    overflow: visible !important;
  }
  .print-header {
    display: block !important;
    text-align: center;
    border-bottom: 2px solid #000;
    padding-bottom: 15px;
    margin-bottom: 20px;
  }
}

/* ========================================================
   UNIVERSAL RESPONSIVE DESIGN (ALL DEVICES & SCREENS)
   Laptops, Tablets, Large Mobiles, Small Mobiles
   ======================================================== */

/* Touch & Smooth Scroll Improvements */
html {
  -webkit-text-size-adjust: 100%;
}

button, .sys-card, .quick-stat-badge, .btn-icon {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* 1. Large Tablets & Small Laptops (Max 1100px) */
@media (max-width: 1100px) {
  .cards-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
  }

  .main-header {
    padding: 12px 18px;
  }

  .brand-text h1 {
    font-size: 1.2rem;
  }

  .sys-card {
    padding: 14px 10px 12px 10px;
    border-radius: 20px;
  }
}

/* 2. Medium Tablets (Max 880px) */
@media (max-width: 880px) {
  .app-container {
    padding: 12px 14px 16px 14px;
  }

  .main-footer {
    padding: 10px 16px;
  }

  .main-header {
    flex-direction: column;
    gap: 14px;
    align-items: stretch;
  }

  .header-right {
    justify-content: space-between;
  }

  .header-center {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
  }

  .quick-stat-badge {
    justify-content: center;
    padding: 8px 12px;
  }

  .header-left {
    justify-content: space-between;
    padding-top: 6px;
    border-top: 1px solid var(--border-subtle);
  }

  .activity-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .search-filter-box {
    width: 100%;
  }

  .activity-stats {
    justify-content: space-around;
    flex-wrap: wrap;
    font-size: 0.8rem;
  }

  .cards-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
  }
}

/* 3. Smartphones & Small Tablets (Max 680px) */
@media (max-width: 680px) {
  .app-container {
    padding: 8px 10px 14px 10px;
  }

  /* Two clean square cards per row for native app feel */
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 6px 0 16px 0;
  }

  .sys-card {
    padding: 14px 10px 12px 10px;
    border-radius: 18px;
    aspect-ratio: 1 / 0.95;
  }

  .card-top-pill {
    width: 26px;
    height: 3px;
    margin-bottom: 10px;
  }

  .sys-card:hover .card-top-pill {
    width: 34px;
  }

  .card-icon {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    font-size: 1.25rem;
    margin-bottom: 8px;
  }

  .card-title {
    font-size: 0.9rem;
    line-height: 1.25;
  }

  /* Mobile Header */
  .logo-icon {
    width: 42px;
    height: 42px;
    font-size: 1.25rem;
    border-radius: 11px;
  }

  .brand-text h1 {
    font-size: 1.05rem;
  }

  .sub-brand {
    font-size: 0.72rem;
  }

  .datetime-display {
    display: none; /* Hide secondary clock on small mobile to save space */
  }

  .user-profile {
    padding: 4px 8px;
  }

  .user-role {
    display: none;
  }

  .quick-stat-badge {
    padding: 6px 10px;
    gap: 8px;
  }

  .badge-icon {
    font-size: 1rem;
  }

  .badge-label {
    font-size: 0.65rem;
  }

  .badge-value {
    font-size: 0.85rem;
  }

  /* Mobile Full/Bottom Sheet Modal Experience */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal-window {
    width: 100%;
    max-width: 100%;
    height: 94vh;
    max-height: 94vh;
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
  }

  .modal-overlay.active .modal-window {
    transform: translateY(0);
  }

  .modal-top {
    padding: 14px 18px;
  }

  .modal-header-icon {
    width: 40px;
    height: 40px;
    font-size: 1.15rem;
    border-radius: 10px;
  }

  .modal-title-area h2 {
    font-size: 1.15rem;
  }

  .modal-title-area p {
    font-size: 0.76rem;
  }

  .modal-btn-print {
    display: none; /* Mobile printing usually redundant or accessible via browser */
  }

  .modal-content-area {
    padding: 16px 16px;
    -webkit-overflow-scrolling: touch;
  }

  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .form-group.col-span-2 {
    grid-column: span 1 !important;
  }

  .stats-summary-grid {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  /* Footer shortcuts hidden on touch phones */
  .footer-shortcuts {
    display: none;
  }

  .main-footer {
    flex-direction: row;
    justify-content: space-between;
    padding: 8px 12px;
    font-size: 0.72rem;
  }
}

/* 4. Extra-Small Mobile Screens (e.g. iPhone SE, Fold phones, < 380px) */
@media (max-width: 380px) {
  .cards-grid {
    gap: 10px;
  }

  .sys-card {
    min-height: 88px;
    padding: 10px 6px 8px 6px;
    border-radius: 14px;
  }

  .card-icon {
    width: 34px;
    height: 34px;
    font-size: 1.05rem;
    border-radius: 10px;
    margin-bottom: 5px;
  }

  .card-title {
    font-size: 0.82rem;
  }

  .card-top-pill {
    width: 20px;
    height: 2.5px;
    margin-bottom: 6px;
  }

  .header-center {
    grid-template-columns: 1fr;
  }
}
