
:root {
  --bg: #090c12;
  --surface: #0e1219;
  --surface2: #141b24;
  --surface3: #1c2430;
  --accent: #0ea5c9;
  --accent-light: #38bdf8;
  --accent-glow: rgba(14, 165, 201, 0.22);
  --accent2: #f59e0b;
  --accent3: #f43f5e;
  --accent4: #10b981;
  --cyan: #0ea5c9;
  --text: #dde6f0;
  --text2: #7d8fa3;
  --border: rgba(255,255,255,0.07);
  --hover: rgba(14,165,201,0.08);
  --selected: rgba(14,165,201,0.15);
  --shadow: 0 4px 40px rgba(0,0,0,0.55);
  --glass: rgba(14, 18, 24, 0.85);
  --glass-border: rgba(255,255,255,0.07);
  --radius: 10px;
  --radius-lg: 14px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --sidebar-bg: linear-gradient(180deg, #0a0e14 0%, #080b10 50%, #060810 100%);
  --panel-bg: linear-gradient(180deg, #090d13 0%, #080b10 50%, #060910 100%);
  --main-bg: #0a0d14;
}
body.light-mode {
  --bg: #edf0f5;
  --surface: rgba(255,255,255,0.85);
  --surface2: rgba(241,244,249,0.8);
  --surface3: rgba(230,235,243,0.75);
  --accent: #0284c7;
  --accent-light: #0ea5c9;
  --accent-glow: rgba(2, 132, 199, 0.2);
  --accent2: #d97706;
  --accent3: #dc2626;
  --accent4: #16a34a;
  --cyan: #0284c7;
  --text: #1a202c;
  --text2: #4a5568;
  --border: rgba(0,0,0,0.06);
  --hover: rgba(2,132,199,0.06);
  --selected: rgba(2,132,199,0.1);
  --shadow: 0 2px 16px rgba(0,0,0,0.06);
  --glass: rgba(245, 248, 252, 0.85);
  --glass-border: rgba(0,0,0,0.04);
  --radius: 12px;
  --radius-lg: 16px;
  --sidebar-bg: linear-gradient(180deg, #f0f2f7 0%, #e8ecf2 40%, #e0e5ee 100%);
  --panel-bg: linear-gradient(180deg, #f2f5f9 0%, #eaeff5 50%, #e2e8f0 100%);
  --main-bg: #edf0f5;
}

/* ══ LIGHT MODE — overrides moved to bottom of file ══ */

/* Sidebar buttons — clean */
body.light-mode .sb-btn.active {
  background: linear-gradient(135deg, #0284c7 0%, #0ea5c9 50%, #38bdf8 100%);
  color: #fff;
  box-shadow: 0 3px 12px rgba(2,132,199,.25);
  border-right: 3px solid #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
body.light-mode .sb-btn.active:hover {
  box-shadow: 0 4px 16px rgba(2,132,199,.35);
  transform: translateX(-2px);
}

/* Project cards extras */
body.light-mode .pc-num {
  background: rgba(2,132,199,0.08);
  border: 1px solid rgba(2,132,199,0.1);
}
body.light-mode .project-card:hover .pc-num {
  background: linear-gradient(135deg, #0284c7, #0ea5c9);
  color: #fff;
  box-shadow: 0 2px 8px rgba(2,132,199,0.25);
}
body.light-mode .pc-expand {
  background: rgba(237,241,247,0.5);
}
body.light-mode .pc-expand:hover {
  background: rgba(2,132,199,0.06);
}

/* Action items */
body.light-mode .action-btn-item {
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(0,0,0,0.04);
  box-shadow: 0 1px 3px rgba(0,0,0,.03);
}
body.light-mode .action-btn-item:hover {
  background: rgba(255,255,255,0.9);
  box-shadow: 0 3px 10px rgba(0,0,0,.06);
  transform: translateY(-2px);
}

/* Modals — glass */
body.light-mode .modal-bg {
  background: rgba(150,165,185,0.5);
}
body.light-mode .modal {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 24px 80px rgba(0,0,0,.15), inset 0 1px 0 rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.6);
}
body.light-mode .modal-header {
  background: rgba(255,255,255,0.7);
  border-bottom-color: rgba(0,0,0,0.06);
}

/* Notifications — floating silver */
body.light-mode .notif {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06);
  border: 1px solid rgba(255,255,255,0.6);
}

/* Tabs — metallic */
body.light-mode .st-nav-item:hover:not(.active) {
  background: rgba(255,255,255,0.6);
  border-color: rgba(0,0,0,0.1);
}
body.light-mode .st-nav-item.active {
  background: linear-gradient(135deg, #0284c7, #0ea5c9);
}
body.light-mode .tabs {
  background: rgba(200,210,225,0.45);
  border: 1px solid rgba(255,255,255,0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
body.light-mode .tab:hover:not(.active) {
  background: rgba(255,255,255,0.45);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
body.light-mode .tab.active {
  background: linear-gradient(135deg, #0284c7, #0ea5c9, #38bdf8);
  box-shadow: 0 3px 12px rgba(2,132,199,.25);
}

/* Inputs — silver inset */
body.light-mode input,
body.light-mode select,
body.light-mode textarea {
  background: rgba(255,255,255,0.55);
  border: 1.5px solid rgba(0,0,0,0.08);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.04), 0 1px 0 rgba(255,255,255,0.6);
}
body.light-mode input:focus,
body.light-mode select:focus,
body.light-mode textarea:focus {
  background: rgba(255,255,255,0.8);
  border-color: #0ea5c9;
  box-shadow: 0 0 0 3px rgba(2,132,199,0.15), 0 0 20px rgba(2,132,199,0.06), inset 0 1px 2px rgba(0,0,0,0.03);
}
body.light-mode input:hover,
body.light-mode select:hover,
body.light-mode textarea:hover {
  border-color: rgba(2,132,199,0.25);
  background: rgba(255,255,255,0.65);
}

/* Buttons — silver/glass */
body.light-mode .btn-secondary {
  background: rgba(255,255,255,0.5);
  border: 1px solid rgba(0,0,0,0.08);
  color: #334155;
  box-shadow: 0 1px 3px rgba(0,0,0,.05), inset 0 1px 0 rgba(255,255,255,0.6);
}
body.light-mode .btn-secondary:hover {
  background: rgba(255,255,255,0.75);
  box-shadow: 0 4px 12px rgba(0,0,0,.08), inset 0 1px 0 rgba(255,255,255,0.8);
  transform: translateY(-2px);
}
body.light-mode .btn-ghost {
  background: rgba(255,255,255,0.35);
  color: #475569;
}
body.light-mode .btn-ghost:hover {
  background: rgba(255,255,255,0.6);
  color: #1e293b;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

/* Tables — clean glass */
body.light-mode th {
  background: linear-gradient(135deg, #e2e8f0, #dde3ed);
  color: #1e293b;
  border-bottom: 2px solid rgba(2,132,199,0.15);
}
body.light-mode tr:hover td {
  background: rgba(2,132,199,0.04);
}

/* Progress bar — silver metallic */
body.light-mode .progress-bar {
  background: rgba(200,210,225,0.5);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.08);
}
body.light-mode .progress-fill {
  background: linear-gradient(90deg, #0284c7, #0ea5c9, #38bdf8, #06b6d4);
  box-shadow: 0 1px 4px rgba(2,132,199,0.3);
}

/* Status badges — silver bg */
body.light-mode .status-new { background: rgba(2,132,199,0.12); color: #0284c7; }
body.light-mode .status-active { background: rgba(16,185,129,0.12); color: #059669; }
body.light-mode .status-done { background: rgba(217,119,6,0.12); color: #b45309; }
body.light-mode .status-paused { background: rgba(220,38,38,0.12); color: #dc2626; }

/* Dropdown — glass */
body.light-mode .nav-dropdown-menu {
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow: 0 12px 48px rgba(0,0,0,.12);
}
body.light-mode .nav-dropdown-menu button:hover {
  background: rgba(2,132,199,0.08);
}

/* Toolbar — glass */
body.light-mode .toolbar-card {
  border-top: 2px solid transparent;
  border-image: linear-gradient(90deg, #0284c7, #06b6d4, #8b5cf6) 1;
}

/* Mobile topbar — clean light */
/* (overridden at bottom of file) */

/* Perm toggles */
body.light-mode .perm-lbl {
  background: rgba(255,255,255,0.5);
  border-color: rgba(255,255,255,0.5);
}
body.light-mode .perm-lbl:hover {
  background: rgba(255,255,255,0.7);
  border-color: rgba(2,132,199,0.3);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
body.light-mode .perm-section-title {
  background: rgba(220,228,240,0.5);
  border-right-color: #0284c7;
}

/* App content background for light mode */
body.light-mode .app-content {
  background: transparent;
}

/* Logo selector */
body.light-mode .logo-option {
  background: rgba(255,255,255,0.4);
  border-color: rgba(0,0,0,0.06);
}
body.light-mode .logo-option:hover {
  background: rgba(255,255,255,0.7);
  border-color: rgba(2,132,199,0.3);
  box-shadow: 0 4px 16px rgba(2,132,199,0.1);
}
body.light-mode .logo-option.selected {
  background: rgba(2,132,199,0.08);
  border-color: #0284c7;
}

/* Badge pulse for light */
body.light-mode .badge { font-weight: 800; }

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--surface3);
  border-radius: 3px;
  transition: background 0.3s;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--surface3) transparent;
}

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  direction: rtl;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ═══════════════ Translation Overlay ═══════════════ */
#translationOverlay { display:none;position:fixed;inset:0;background:rgba(0,0,0,.62);z-index:999998;align-items:center;justify-content:center;font-family:Cairo,sans-serif; }
#translationOverlay.show { display:flex; }
#translationOverlay .tl-box {
  background:var(--surface2);border-radius:var(--radius-lg);padding:36px 44px;text-align:center;
  border:1px solid var(--glass-border);box-shadow:0 20px 60px rgba(0,0,0,.5);min-width:280px;
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
}
#translationOverlay .tl-spinner { width:48px;height:48px;border:4px solid var(--border);border-top-color:var(--accent);border-radius:50%;animation:tlspin .75s linear infinite;margin:0 auto 16px; }
@keyframes tlspin{to{transform:rotate(360deg)}}

/* ═══════════════ SIDEBAR ═══════════════ */
.sidebar {
  position: fixed; top: 0; right: 0; width: 230px; height: 100vh;
  background: var(--sidebar-bg);
  border-left: 1px solid var(--glass-border);
  display: flex; flex-direction: column; padding: 16px 14px;
  z-index: 100; overflow-y: auto; overflow-x: hidden;
  box-shadow: -6px 0 36px rgba(0,0,0,0.35);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
/* Sidebar glassmorphism + noise overlay */
.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 0%, rgba(14,165,201,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 100%, rgba(6,182,212,0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}
.sidebar::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}
.sidebar > * {
  position: relative;
  z-index: 1;
}

.sb-logo {
  display: flex; align-items: center; gap: 12px; padding: 10px 8px 20px;
  border-bottom: 1px solid var(--border); margin-bottom: 16px;
}
/* Logo theme swap: using PNG logo */
.sb-logo-name {
  font-family: Arial, Helvetica, sans-serif; font-weight: 800;
  letter-spacing: 3px; font-size: 16px; color: var(--text);
  text-shadow: 0 1px 2px rgba(0,0,0,.2);
  transition: color 0.3s;
}
.sb-logo-sub {
  font-size: 9px; color: var(--text2); letter-spacing: 1.5px;
  font-family: Arial, sans-serif; margin-top: 2px; transition: color 0.3s;
}
/* Light mode logo adjustments */
body.light-mode .sb-logo-name { color: #0f172a; text-shadow: none; }
body.light-mode .sb-logo-sub { color: #475569; }

.sb-nav { display: flex; flex-direction: column; gap: 4px; }
.sb-btn {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 10px; border: none; cursor: pointer;
  font-family: 'Cairo', sans-serif; font-size: 13px; font-weight: 600;
  color: var(--text2); background: transparent;
  transition: all 0.25s cubic-bezier(0.22,1,0.36,1); text-align: right; width: 100%;
  position: relative;
  overflow: hidden;
}
.sb-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(14,165,201,0.12) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}
.sb-btn:hover {
  background: var(--hover);
  color: var(--text);
  transform: translateX(-4px);
  text-shadow: 0 0 12px var(--accent-glow);
}
.sb-btn:hover::before {
  opacity: 1;
}
.sb-btn:active {
  transform: translateX(-2px) scale(0.97);
}
.sb-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.1);
  border-right: 3px solid rgba(255,255,255,0.8);
}
.sb-btn.active::before {
  opacity: 0;
}
.sb-btn.active::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.08));
  pointer-events: none;
}
.sb-icon { font-size: 16px; min-width: 22px; text-align: center; transition: transform 0.3s cubic-bezier(0.22,1,0.36,1); }
.sb-btn:hover .sb-icon { transform: scale(1.2) rotate(-5deg); }
.sb-btn.active .sb-icon { transform: scale(1.15); filter: drop-shadow(0 0 4px rgba(255,255,255,0.3)); }

.sb-actions {
  display: flex; gap: 6px; padding: 12px 0; border-top: 1px solid var(--border);
  justify-content: center; flex-wrap: wrap;
}
.sb-action-btn {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; border: none; cursor: pointer; font-size: 15px;
  background: var(--surface2); color: var(--text2);
  transition: all 0.25s cubic-bezier(0.22,1,0.36,1);
  position: relative;
  overflow: hidden;
}
.sb-action-btn:hover {
  background: var(--surface3);
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.sb-action-btn:active {
  transform: scale(0.92);
}

.mobile-topbar {
  display: none; position: fixed; top: 0; left: 0; right: 0; height: 50px;
  background: var(--glass); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border); z-index: 100;
  padding: 0 16px; align-items: center; gap: 8px;
}

/* App content with sidebar offset */
.app-content { margin-right: 230px; min-height: 100vh; position: relative; }

/* Background pattern with grain texture */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse at 10% 90%, rgba(14,165,201,0.05) 0%, transparent 40%),
    radial-gradient(ellipse at 90% 10%, rgba(99,102,241,0.035) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 50%, rgba(6,182,212,0.02) 0%, transparent 60%),
    var(--main-bg, var(--bg));
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.018;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* Light mode — more visible grain for brushed metal effect */
body.light-mode::after {
  opacity: 0.06;
}

/* Hide old navbar class */
.navbar { display: none !important; }

/* ═══════════════ LEGACY NAV COMPAT ═══════════════ */
.nav-btn { display: none; }
.nav-logo { display: none; }

/* ═══════════════ NAV ICON BUTTONS ═══════════════ */
.nav-icon-btn {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; border: none; cursor: pointer; font-size: 15px;
  background: var(--surface2); color: var(--text2); transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.nav-icon-btn:hover {
  background: var(--surface3);
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.nav-icon-btn:active {
  transform: scale(0.93);
}

/* ═══════════════ NAV DROPDOWN ═══════════════ */
.nav-dropdown { position: relative; }
.nav-dropdown-menu {
  display: none; position: absolute; top: 100%; left: 0; margin-top: 6px;
  background: var(--surface); border: 1px solid var(--glass-border); border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,0.04);
  min-width: 200px; z-index: 200;
  padding: 6px; overflow: hidden;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  animation: dropdownIn 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.nav-dropdown.open .nav-dropdown-menu { display: block; }
.nav-dropdown-menu button {
  display: block; width: 100%; padding: 10px 14px; border: none; background: transparent;
  color: var(--text); font-family: Cairo, sans-serif; font-size: 13px; text-align: right;
  cursor: pointer; border-radius: 8px; transition: all .2s;
}
.nav-dropdown-menu button:hover { background: var(--hover); transform: translateX(-2px); }

/* ═══════════════ BUTTON GROUPS ═══════════════ */
.btn-group {
  display: flex; align-items: center; gap: 1px;
  background: var(--border); border-radius: 8px; overflow: hidden;
}
.btn-group .btn { border-radius: 0; border: none; }
.btn-group .btn:first-child { border-radius: 8px 0 0 8px; }
.btn-group .btn:last-child { border-radius: 0 8px 8px 0; }

.btn-ghost {
  background: var(--surface2); color: var(--text2); font-size: 12px; padding: 7px 14px;
  border: none; cursor: pointer; font-family: Cairo, sans-serif; font-weight: 600;
  transition: all var(--transition);
}
.btn-ghost:hover { background: var(--surface3); color: var(--text); }

.toolbar-card { border-top: 2px solid var(--accent); }

/* ═══════════════ PROJECT CARDS ═══════════════ */
.project-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
  padding: 12px;
}
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}
.project-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--cyan), var(--accent-light));
  opacity: 0;
  transition: opacity 0.3s;
}
.project-card:hover {
  border-color: rgba(14,165,201,0.35);
  box-shadow: 0 12px 40px rgba(14,165,201,0.18), 0 0 0 1px rgba(14,165,201,0.12), 0 0 60px rgba(14,165,201,0.06);
  transform: translateY(-5px) scale(1.01);
}
.project-card:hover::before {
  opacity: 1;
}
.project-card.pc-open { border-color: var(--accent); box-shadow: 0 8px 32px rgba(14,165,201,0.18); }
.project-card.pc-open::before { opacity: 1; }

.pc-header {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px 8px;
}
.pc-num {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--surface3), var(--surface2));
  border-radius: 10px; font-weight: 800; font-size: 13px;
  color: var(--accent); flex-shrink: 0;
  border: 1px solid rgba(14,165,201,0.15);
  transition: all 0.3s;
}
.project-card:hover .pc-num {
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-glow);
}
.pc-title-area { flex: 1; min-width: 0; }
.pc-name {
  font-size: 14px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pc-contract {
  font-size: 11px; color: var(--text2); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pc-progress {
  display: flex; align-items: center; gap: 8px; padding: 4px 16px 10px;
}
.pc-progress .progress-bar { flex: 1; }
.pc-progress-txt { font-size: 12px; font-weight: 700; color: var(--accent); min-width: 36px; text-align: left; }
.pc-details {
  padding: 0 16px 14px;
  border-top: 1px solid var(--border);
  animation: pcSlideDown 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes pcSlideDown { from { opacity: 0; max-height: 0; } to { opacity: 1; max-height: 500px; } }
.pc-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px;
}
.pc-item {
  display: flex; flex-direction: column; padding: 8px 10px;
  background: var(--surface2); border-radius: 8px;
  border: 1px solid transparent;
  transition: all 0.2s;
}
.pc-item:hover {
  border-color: var(--border);
  background: var(--surface3);
}
.pc-label { font-size: 10px; color: var(--text2); margin-bottom: 2px; text-transform: uppercase; letter-spacing: 0.3px; }
.pc-val { font-size: 13px; font-weight: 600; color: var(--text); }
.pc-actions { margin-top: 12px; display: flex; justify-content: flex-end; }
.pc-expand {
  display: block; width: 100%; padding: 6px; border: none;
  background: var(--surface2); color: var(--text2); cursor: pointer;
  font-size: 10px; text-align: center; transition: all 0.2s;
}
.pc-expand:hover { background: var(--surface3); color: var(--text); }
.pc-expand-icon { font-size: 10px; transition: transform 0.25s; }
.pc-pending { border-color: rgba(8,145,178,0.3); }
.pc-pending .pc-num { background: linear-gradient(135deg, #0891b2, #06b6d4); color: #fff; border-color: transparent; }
.pc-pending:hover { border-color: #06b6d4; box-shadow: 0 8px 28px rgba(6,182,212,0.15); }

@media (max-width: 768px) {
  .project-cards-grid { grid-template-columns: 1fr; gap: 8px; padding: 8px; }
  .pc-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
}

/* ═══════════════ MAIN ═══════════════ */
.main {
  padding: 20px 24px;
  max-width: 1600px;
  margin: 0 auto;
  animation: fadeIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

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

/* ═══════════════ CARDS ═══════════════ */
.card {
  background: linear-gradient(145deg, var(--surface), rgba(15,23,42,0.6));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.card::before {
  content: '';
  position: absolute;
  top: 0; right: 0; left: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--cyan), transparent);
  opacity: 0;
  transition: opacity 0.4s;
}
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(ellipse at 50% 0%, rgba(14,165,201,0.04) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
}
.card:hover {
  box-shadow: 0 12px 40px rgba(14,165,201,0.15), 0 0 0 1px rgba(14,165,201,0.1), 0 0 60px rgba(14,165,201,0.05);
  border-color: rgba(14,165,201,0.25);
  transform: translateY(-4px);
}
.card:hover::before {
  opacity: 1;
}
.card:hover::after {
  opacity: 1;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.2px;
}

/* ═══════════════ TABLE ═══════════════ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  background: linear-gradient(180deg, var(--surface3), var(--surface2));
  color: var(--accent-light);
  padding: 11px 14px;
  text-align: right;
  font-weight: 700;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 2px solid var(--accent-glow);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
  white-space: nowrap;
  transition: background var(--transition);
}
tr:hover td {
  background: var(--hover);
}
tr.selected td {
  background: var(--selected);
}
tr:last-child td {
  border-bottom: none;
}

/* ═══════════════ INPUTS ═══════════════ */
input, select, textarea {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  width: 100%;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 4px var(--accent-glow), 0 0 24px rgba(14,165,201,0.12), 0 0 48px rgba(14,165,201,0.04);
  transform: scale(1.01);
}
input:hover, select:hover, textarea:hover {
  border-color: var(--surface3);
}
select option {
  background: var(--surface2);
  color: var(--text);
}

/* ═══════════════ BUTTONS ═══════════════ */
.btn {
  padding: 9px 18px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.08));
  pointer-events: none;
}
.btn:active {
  transform: scale(0.97);
}
/* Ripple effect */
.btn .ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  transform: scale(0);
  animation: btnRipple 0.6s ease-out;
  pointer-events: none;
}
@keyframes btnRipple {
  to { transform: scale(4); opacity: 0; }
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:hover {
  box-shadow: 0 8px 28px var(--accent-glow), 0 0 60px rgba(14,165,201,0.15);
  transform: translateY(-3px) scale(1.02);
  filter: brightness(1.1);
}
.btn-success {
  background: linear-gradient(135deg, #059669, #10b981) !important;
  color: #fff !important;
  box-shadow: 0 2px 12px rgba(16, 185, 129, 0.25);
}
.btn-success:hover {
  box-shadow: 0 8px 28px rgba(16, 185, 129, 0.4), 0 0 50px rgba(16,185,129,0.1);
  transform: translateY(-3px) scale(1.02);
  filter: brightness(1.1);
}
.btn-danger {
  background: linear-gradient(135deg, #e11d48, #f43f5e);
  color: #fff;
  box-shadow: 0 2px 12px rgba(244, 63, 94, 0.25);
}
.btn-danger:hover {
  box-shadow: 0 8px 28px rgba(244, 63, 94, 0.4), 0 0 50px rgba(244,63,94,0.1);
  transform: translateY(-3px) scale(1.02);
  filter: brightness(1.1);
}
.btn-warning {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  color: #1a1a1a;
  box-shadow: 0 2px 12px rgba(245, 158, 11, 0.25);
}
.btn-warning:hover {
  box-shadow: 0 8px 28px rgba(245, 158, 11, 0.4), 0 0 50px rgba(245,158,11,0.1);
  transform: translateY(-3px) scale(1.02);
  filter: brightness(1.1);
}
.btn-secondary {
  background: var(--surface2);
  color: var(--text2);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--surface3);
  color: var(--text);
  border-color: rgba(14,165,201,0.25);
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 8px;
}
.btn-icon {
  padding: 6px 8px;
  min-width: 32px;
  justify-content: center;
}

/* ═══════════════ BADGE ═══════════════ */
.badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  backdrop-filter: blur(4px);
}

/* ═══════════════ PROGRESS ═══════════════ */
.progress-bar {
  background: var(--surface3);
  border-radius: 20px;
  height: 8px;
  overflow: hidden;
  position: relative;
}
.progress-fill {
  height: 100%;
  border-radius: 20px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(90deg, var(--accent), var(--cyan), var(--accent-light));
  background-size: 200% 100%;
  animation: progressGradient 3s ease infinite;
  position: relative;
  overflow: hidden;
}
@keyframes progressGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.progress-fill::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2.5s infinite;
}
@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 200%; }
}

/* ═══════════════ GRID ═══════════════ */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ═══════════════ STAT CARDS ═══════════════ */
.stat-card {
  background: linear-gradient(145deg, var(--surface), rgba(15,23,42,0.7));
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  border: 1px solid var(--border);
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--cyan), var(--accent-light));
  opacity: 0.7;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.4s;
  transform: translate(20px, -20px);
}
.stat-card:hover {
  transform: translateY(-6px) scale(1.03);
  box-shadow: 0 16px 48px rgba(0,0,0,0.25), 0 0 0 1px rgba(14,165,201,0.15), 0 0 80px rgba(14,165,201,0.08);
  border-color: rgba(14,165,201,0.25);
}
.stat-card:hover::after {
  opacity: 1;
}
.stat-num {
  font-size: 32px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}
.stat-label {
  font-size: 12px;
  color: var(--text2);
  margin-top: 6px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* Stats cards entrance animation */
.stat-card { animation: statEnter 0.6s cubic-bezier(0.22, 1, 0.36, 1) backwards; }
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.12s; }
.stat-card:nth-child(3) { animation-delay: 0.19s; }
.stat-card:nth-child(4) { animation-delay: 0.26s; }
@keyframes statEnter {
  from { opacity: 0; transform: translateY(20px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ═══════════════ MODAL ═══════════════ */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: overlayFade 0.25s ease-out;
}
@keyframes modalBgIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes overlayFade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border-radius: 16px;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  animation: modalSlideUp 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: relative;
}
.modal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--cyan), var(--accent-light), var(--accent));
  background-size: 300% 100%;
  animation: gradientShift 4s ease infinite;
  border-radius: 16px 16px 0 0;
}
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(40px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
  backdrop-filter: blur(12px);
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.modal-body {
  padding: 24px;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ═══════════════ FORM ═══════════════ */
.form-group { margin-bottom: 16px; position: relative; }
.form-label {
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 6px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  transition: color 0.2s;
}
.form-group:focus-within .form-label {
  color: var(--accent);
}

/* ═══════════════ SIDE PANEL ═══════════════ */
.side-panel {
  position: fixed;
  left: 0;
  top: 0;
  width: 340px;
  height: 100vh;
  background: var(--panel-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--glass-border);
  z-index: 200;
  padding: 24px;
  overflow-y: auto;
  transform: translateX(-340px);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 8px 0 40px rgba(0,0,0,0.35);
}
/* Side panel glassmorphism overlay */
.side-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 70% 0%, rgba(6,182,212,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 30% 100%, rgba(14,165,201,0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}
.side-panel::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}
.side-panel > * {
  position: relative;
  z-index: 1;
}
.side-panel.open { transform: translateX(0); }
.side-panel-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.action-btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.action-btn-item {
  padding: 12px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
  font-family: 'Cairo', sans-serif;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  text-align: center;
  background: var(--surface2);
  color: var(--text);
  position: relative;
  overflow: hidden;
}
.action-btn-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(14,165,201,0.06));
  opacity: 0;
  transition: opacity 0.3s;
}
.action-btn-item:hover {
  background: var(--surface3);
  border-color: rgba(14,165,201,0.3);
  transform: translateY(-5px) scale(1.03);
  box-shadow: 0 10px 28px rgba(0,0,0,0.25), 0 0 40px rgba(14,165,201,0.08);
}
.action-btn-item:hover::before {
  opacity: 1;
}
.action-btn-item:active {
  transform: scale(0.97);
}

/* ═══════════════ TIMELINE / GANTT ═══════════════ */
.timeline-wrap { overflow-x: auto; }
.gantt-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  min-height: 36px;
  transition: background var(--transition);
}
.gantt-row:hover { background: var(--hover); }
.gantt-label {
  width: 200px;
  min-width: 200px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
}
.gantt-bar-wrap { flex: 1; padding: 0 8px; position: relative; height: 20px; }
.gantt-bar {
  height: 20px;
  border-radius: 6px;
  position: absolute;
  transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}
.gantt-bar:hover {
  transform: scaleY(1.3);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.gantt-header {
  display: flex;
  align-items: center;
  border-bottom: 2px solid var(--border);
  background: linear-gradient(180deg, var(--surface3), var(--surface2));
  border-radius: var(--radius) var(--radius) 0 0;
}
.gantt-months { flex: 1; display: flex; overflow: hidden; }
.gantt-month {
  flex: 1;
  text-align: center;
  padding: 6px 2px;
  font-size: 11px;
  color: var(--text2);
  font-weight: 600;
  border-right: 1px solid var(--border);
}

/* ═══════════════ TABS ═══════════════ */
.tabs {
  display: flex;
  gap: 3px;
  margin-bottom: 20px;
  background: var(--surface2);
  padding: 4px;
  border-radius: var(--radius);
  width: fit-content;
  border: 1px solid var(--border);
  position: relative;
}
.tab {
  padding: 8px 20px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  color: var(--text2);
  position: relative;
  z-index: 1;
}
.tab:hover:not(.active) {
  color: var(--text);
  background: var(--surface3);
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}

/* ═══════════════ NOTIFICATION ═══════════════ */
.notif {
  position: fixed;
  top: 74px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 28px;
  font-size: 14px;
  font-weight: 600;
  z-index: 9999;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35), 0 0 0 1px rgba(14,165,201,0.1);
  animation: toastIn 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
@keyframes notifIn {
  from { top: 50px; opacity: 0; transform: translateX(-50%) scale(0.95); }
  to { top: 74px; opacity: 1; transform: translateX(-50%) scale(1); }
}
@keyframes toastIn {
  0% { opacity: 0; transform: translateX(-50%) translateY(-30px) scale(0.9); }
  60% { transform: translateX(-50%) translateY(4px) scale(1.01); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* ═══════════════ STATUS BADGES ═══════════════ */
.status-new { background: rgba(14,165,201,0.15); color: #38bdf8; }
.status-active { background: rgba(16,185,129,0.15); color: #34d399; }
.status-done { background: rgba(245,158,11,0.15); color: #fbbf24; }
.status-paused { background: rgba(244,63,94,0.15); color: #fb7185; }

/* ═══════════════ OVERFLOW CELL ═══════════════ */
.cell-wrap {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ═══════════════ DOCUMENTS PAGE ═══════════════ */
.doc-controls-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.doc-buttons-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ═══════════════ PWA / MOBILE BOTTOM NAV ═══════════════ */
#mobileBottomNav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--surface);
  border-top: 1px solid var(--glass-border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: 4px 0;
  padding-bottom: env(safe-area-inset-bottom, 4px);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
}
#mobileBottomNav .mob-nav-items {
  display: flex;
  justify-content: space-around;
  align-items: center;
}
#mobileBottomNav .mob-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border: none;
  background: none;
  color: var(--text2);
  font-family: Cairo, sans-serif;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  border-radius: 10px;
  min-width: 56px;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
#mobileBottomNav .mob-nav-item .mob-icon {
  font-size: 20px;
  line-height: 1;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
#mobileBottomNav .mob-nav-item.active {
  color: var(--accent);
}
#mobileBottomNav .mob-nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--accent);
  border-radius: 0 0 4px 4px;
}
#mobileBottomNav .mob-nav-item.active .mob-icon {
  transform: scale(1.15);
}

/* PWA Animations */
@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ═══════════════ RESPONSIVE — TABLET ═══════════════ */
@media (max-width: 1024px) {
  .grid4 { grid-template-columns: 1fr 1fr; }
  .navbar { padding: 0 12px; gap: 4px; }
  .nav-btn { padding: 6px 10px; font-size: 11px; }
}

/* ═══════════════ RESPONSIVE — MOBILE ═══════════════ */
@media (max-width: 768px) {
  /* Hide sidebar, show mobile topbar and bottom nav */
  .sidebar { display: none !important; }
  .app-content { margin-right: 0 !important; padding-top: 56px; }
  .mobile-topbar { display: flex !important; }
  #mobileBottomNav { display: block; }

  .navbar {
    height: auto;
    padding: 6px 12px;
    gap: 4px;
    flex-wrap: wrap;
  }
  .nav-logo { font-size: 13px; flex: 1; margin: 0; }
  .navbar .nav-btn[onclick*="showPage"] { display: none; }
  .navbar .nav-btn:not([onclick*="showPage"]) {
    padding: 5px 8px;
    font-size: 10px;
  }
  /* Hide separators and less important buttons */
  .navbar > div[style*="width:1px"] { display: none; }
  .navbar .nav-btn[onclick*="exportAll"],
  .navbar label[for="importFileInput"],
  .navbar .nav-btn[onclick*="restoreFile"],
  .navbar #langToggleBtn,
  .navbar #lastSaveLabel { display: none; }

  /* Grids */
  .grid4 { grid-template-columns: 1fr 1fr; }
  .grid3 { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }

  /* Main content */
  .main {
    padding: 10px;
    padding-bottom: 80px;
  }

  /* Cards */
  .card {
    padding: 14px;
    border-radius: 12px;
  }
  .card-title { font-size: 14px; }

  /* Stats */
  .stat-card { padding: 14px 10px; }
  .stat-num { font-size: 22px; }
  .stat-label { font-size: 10px; }

  /* Tables */
  .table-wrap { margin: 0 -14px; padding: 0 14px; }
  table { font-size: 11px; }
  th, td { padding: 6px 8px; }

  /* Modals */
  .modal {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0;
    border-radius: 16px 16px 0 0;
    max-height: 90vh;
  }
  .modal-bg {
    align-items: flex-end !important;
  }

  /* Side panel */
  .side-panel { width: 100%; transform: translateX(-100%); }

  /* Buttons */
  .btn { font-size: 12px; padding: 8px 14px; min-height: 40px; }
  .btn-sm { min-height: 34px; }

  /* Form inputs */
  select, input[type="text"], input[type="number"], input[type="date"],
  input[type="email"], input[type="tel"], input[type="password"] {
    min-height: 40px;
    font-size: 14px !important;
  }

  /* Documents page */
  .doc-controls-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .doc-buttons-row { flex-direction: column; }
  .doc-buttons-row .btn { width: 100%; text-align: center; }
  #docPreviewArea .doc-page {
    font-size: 10px;
    padding: 10px !important;
  }
  #docPreviewArea .doc-table td,
  #docPreviewArea .doc-table th {
    padding: 4px 6px;
    font-size: 10px;
  }
  #docPreviewArea [style*="grid-template-columns:repeat(4"] {
    grid-template-columns: 1fr 1fr !important;
  }
  #docPreviewArea [style*="grid-template-columns:1fr 1fr;gap:16px"] {
    grid-template-columns: 1fr !important;
  }

  /* Settings tabs */
  .settings-tabs {
    flex-wrap: wrap;
    gap: 4px;
  }
  .settings-tabs .btn { font-size: 10px; padding: 6px 10px; }

  /* Login screen */
  #loginScreen > div {
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 0 !important;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  /* Notification */
  #notif {
    left: 10px !important;
    right: 10px !important;
    bottom: 70px !important;
    max-width: none !important;
  }
}

/* ═══════════════ RESPONSIVE — SMALL PHONE ═══════════════ */
@media (max-width: 480px) {
  .grid4 { grid-template-columns: 1fr !important; }
  .doc-controls-grid { grid-template-columns: 1fr; }
  .navbar { padding: 4px 8px; }
  .nav-logo { font-size: 12px; }
  .main { padding: 8px; padding-bottom: 80px; }
  .card { padding: 10px; margin-bottom: 12px; }
  .stat-card { padding: 10px 8px; }
  .stat-num { font-size: 18px; }
  .btn { font-size: 11px; padding: 7px 12px; }
  .modal-body { padding: 12px; }
  #docPreviewArea [style*="grid-template-columns:repeat(4"],
  #docPreviewArea [style*="grid-template-columns:repeat(3"] {
    grid-template-columns: 1fr !important;
  }
}

/* ═══════════════ SAFE AREAS (iPhone notch) ═══════════════ */
@supports (padding: env(safe-area-inset-top)) {
  .navbar { padding-top: env(safe-area-inset-top); }
  #mobileBottomNav { padding-bottom: env(safe-area-inset-bottom, 4px); }
  .main { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
}

/* ═══════════════ PAGE ═══════════════ */
.page { display: none; transition: opacity 0.3s ease, transform 0.3s ease; }
.page.active { display: block; animation: pageEnter 0.45s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════ PROFESSIONAL EFFECTS ═══════════════ */

/* Project cards stagger animation */
.project-card { animation: cardEnter 0.45s cubic-bezier(0.22, 1, 0.36, 1) backwards; }
.project-card:nth-child(1) { animation-delay: 0.03s; }
.project-card:nth-child(2) { animation-delay: 0.06s; }
.project-card:nth-child(3) { animation-delay: 0.09s; }
.project-card:nth-child(4) { animation-delay: 0.12s; }
.project-card:nth-child(5) { animation-delay: 0.15s; }
.project-card:nth-child(6) { animation-delay: 0.18s; }
.project-card:nth-child(7) { animation-delay: 0.21s; }
.project-card:nth-child(8) { animation-delay: 0.24s; }
@keyframes cardEnter {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Nav button ripple effect */
.nav-btn { position: relative; overflow: hidden; }
.nav-btn::before {
  content: ''; position: absolute; top: 50%; left: 50%; width: 0; height: 0;
  background: rgba(255,255,255,0.15); border-radius: 50%;
  transform: translate(-50%, -50%); transition: width 0.4s ease, height 0.4s ease;
}
.nav-btn:active::before { width: 200px; height: 200px; }

/* Status badge pulse for active projects */
.badge-جاري { animation: badgePulse 3s ease-in-out infinite; }
@keyframes badgePulse { 0%,100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.3); } 50% { box-shadow: 0 0 0 6px rgba(16,185,129,0); } }

/* ═══════════════ LIGHT MODE — EXTRA INTERACTIVE EFFECTS ═══════════════ */

/* Sidebar buttons — slide highlight on hover */
body.light-mode .sb-btn {
  position: relative;
  overflow: hidden;
}
body.light-mode .sb-btn::before {
  content: '';
  position: absolute;
  top: 0; right: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  transition: right 0.5s ease;
}
body.light-mode .sb-btn:hover::before {
  right: 100%;
}

/* Cards — shine sweep on hover */
body.light-mode .card {
  position: relative;
  overflow: hidden;
}
body.light-mode .card::after {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: linear-gradient(135deg, transparent 42%, rgba(255,255,255,0.15) 48%, rgba(255,255,255,0.25) 50%, rgba(255,255,255,0.15) 52%, transparent 58%);
  transition: transform 0.7s ease;
  transform: translateX(-100%) translateY(-100%);
  pointer-events: none;
  z-index: 1;
}
body.light-mode .card:hover::after {
  transform: translateX(30%) translateY(30%);
}

/* Stat cards — metallic shimmer */
body.light-mode .stat-card {
  position: relative;
  overflow: hidden;
}
body.light-mode .stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.6s ease;
  pointer-events: none;
}
body.light-mode .stat-card:hover::after {
  left: 150%;
}

/* Project cards — glow border pulse on hover */
body.light-mode .project-card {
  position: relative;
}
body.light-mode .project-card::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(2,132,199,0), rgba(2,132,199,0.2), rgba(6,182,212,0.15), rgba(2,132,199,0));
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: -1;
}
body.light-mode .project-card:hover::after {
  opacity: 1;
}

/* Buttons — silver press effect */
body.light-mode .btn:active {
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1) !important;
  transform: scale(0.97) !important;
}
body.light-mode .btn-primary:hover {
  box-shadow: 0 8px 28px rgba(2,132,199,0.4), 0 0 50px rgba(2,132,199,0.1);
  transform: translateY(-4px) scale(1.03);
}
body.light-mode .btn-success:hover {
  box-shadow: 0 8px 28px rgba(16,163,74,0.35), 0 0 50px rgba(16,163,74,0.08);
  transform: translateY(-4px) scale(1.03);
}
body.light-mode .btn-danger:hover {
  box-shadow: 0 8px 28px rgba(220,38,38,0.35), 0 0 50px rgba(220,38,38,0.08);
  transform: translateY(-4px) scale(1.03);
}
body.light-mode .btn-warning:hover {
  box-shadow: 0 8px 28px rgba(245,158,11,0.35), 0 0 50px rgba(245,158,11,0.08);
  transform: translateY(-4px) scale(1.03);
}

/* Modal glass entry with border shine */
body.light-mode .modal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent 10%, #0284c7 30%, #06b6d4 50%, #8b5cf6 70%, transparent 90%);
  border-radius: 16px 16px 0 0;
  z-index: 2;
}

/* Action panel buttons — bounce on hover */
body.light-mode .action-btn-item {
  transition: all 0.3s cubic-bezier(0.22,1,0.36,1);
}
body.light-mode .action-btn-item:hover {
  transform: translateY(-4px) scale(1.02);
}

/* Tabs — smooth transition with glow */
body.light-mode .tab {
  transition: all 0.3s cubic-bezier(0.22,1,0.36,1);
}
body.light-mode .tab:hover:not(.active) {
  transform: translateY(-1px);
}
body.light-mode .tab.active {
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

/* Bottom nav active glow */
body.light-mode #mobileBottomNav {
  background: rgba(210,218,230,0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
body.light-mode #mobileBottomNav .mob-nav-item.active {
  color: #0284c7;
}

/* Forms — floating feel */
body.light-mode .form-group {
  transition: transform 0.2s ease;
}

/* Scrollbar silver */
body.light-mode ::-webkit-scrollbar-thumb {
  background: rgba(150,165,185,0.5);
  border-radius: 3px;
}
body.light-mode ::-webkit-scrollbar-thumb:hover {
  background: rgba(2,132,199,0.5);
}

/* ═══════════════ MOBILE LANDSCAPE FOR MEASUREMENTS ═══════════════ */
@media (max-width: 768px) {
  /* Force modals to full screen on mobile */
  .modal-bg { align-items: flex-start !important; padding: 0 !important; }
  .modal {
    max-width: 100% !important; width: 100% !important; margin: 0 !important;
    border-radius: 0 !important; max-height: 100vh !important; height: 100vh !important;
    background: var(--bg) !important;
    overflow-y: auto !important;
  }
  .modal-body { padding: 10px !important; padding-bottom: 100px !important; background: var(--bg) !important; }
  .modal-header { background: var(--surface) !important; }
}

/* Landscape hint for measurements */
.landscape-hint {
  display: none; position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, var(--accent), var(--cyan)); color: #fff; padding: 10px 20px; border-radius: 10px;
  font-size: 12px; font-weight: 700; z-index: 100000; box-shadow: 0 4px 20px rgba(0,0,0,.3);
  animation: hintBounce 1s ease infinite alternate;
  font-family: Cairo, sans-serif; white-space: nowrap;
}
@keyframes hintBounce { from { transform: translateX(-50%) translateY(0); } to { transform: translateX(-50%) translateY(-4px); } }
@media (max-width: 768px) and (orientation: portrait) {
  .landscape-hint { display: block; }
}
@media (orientation: landscape) {
  .landscape-hint { display: none; }
}

/* ═══════════════ PRINT / DOC STYLES ═══════════════ */
@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  body > * { display: none !important; }
  .app-content { display: block !important; margin: 0 !important; padding: 0 !important; }
  .app-content > * { display: none !important; }
  /* تأكيد إظهار printArea حتى لو كان داخل app-content (specificity يهزم descendant) */
  .app-content > #printArea, body > #printArea, #printArea { display: block !important; background: #fff !important; color: #111 !important; }
  #printArea .no-print { display: none !important; }
  .no-print { display: none !important; }
  .sidebar { display: none !important; }
  .mobile-topbar { display: none !important; }
}

/* ═══════════════ Permissions toggle switches ═══════════════ */
.perm-grid { display:grid;grid-template-columns:repeat(auto-fill,minmax(175px,1fr));gap:8px;margin-bottom:16px; }
.perm-lbl {
  display:flex;align-items:center;justify-content:space-between;gap:8px;cursor:pointer;
  padding:10px 14px;background:var(--surface);border-radius:10px;border:1.5px solid var(--border);
  font-size:12px;transition:all var(--transition);user-select:none;
}
.perm-lbl:hover { border-color:var(--accent);background:var(--surface2); }
.perm-lbl input[type=checkbox] { display:none; }
.perm-toggle {
  width:38px;height:20px;background:var(--surface3);border-radius:10px;position:relative;flex-shrink:0;transition:background 0.3s;
}
.perm-toggle::after {
  content:'';position:absolute;width:16px;height:16px;background:#fff;border-radius:50%;top:2px;left:2px;
  transition:left 0.3s cubic-bezier(0.4, 0, 0.2, 1);box-shadow:0 1px 4px rgba(0,0,0,.2);
}
.perm-lbl input:checked ~ .perm-toggle { background: linear-gradient(135deg, var(--accent), var(--cyan)); }
.perm-lbl input:checked ~ .perm-toggle::after { left:20px; }
.perm-lbl.perm-danger:hover { border-color:#f43f5e; }
.perm-lbl.perm-danger input:checked ~ .perm-toggle { background: linear-gradient(135deg, #e11d48, #f43f5e); }
.perm-section-title {
  font-weight:700;font-size:12px;color:var(--text);padding:10px 14px;
  background:var(--surface3);border-radius:10px;margin-bottom:8px;
  border-right:4px solid var(--accent);display:flex;align-items:center;justify-content:space-between;
}
.perm-section-title .perm-all-toggle { font-size:10px;font-weight:400;color:var(--text2);cursor:pointer;display:flex;align-items:center;gap:5px; }

#printArea { display: none; }

/* ═══════════════ WATERMARK ═══════════════ */
.watermark {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%) rotate(-35deg);
  opacity: 0.04;
  font-size: 80px;
  font-weight: 900;
  color: var(--accent);
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
  user-select: none;
}

/* ═══════════════ LOGO SELECTOR ═══════════════ */
.logo-option {
  padding: 10px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  cursor: pointer;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.logo-option:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(14,165,201,0.15);
}
.logo-option.selected {
  border-color: var(--accent);
  background: var(--hover);
  box-shadow: 0 4px 20px var(--accent-glow), 0 0 0 1px rgba(14,165,201,0.2);
}
.logo-option img { max-height: 50px; max-width: 100%; object-fit: contain; }
.logo-option .lname { font-size: 11px; color: var(--text2); margin-top: 6px; }

/* ═══════════════ DOC PREVIEW ═══════════════ */
.doc-page {
  background: #fff;
  color: #222;
  padding: 30px;
  border-radius: var(--radius);
  max-width: 800px;
  margin: 0 auto;
  font-size: 13px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.15), 0 1px 3px rgba(0,0,0,0.08);
  position: relative;
  overflow: hidden;
}
.doc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid #1e3a5f;
  padding-bottom: 16px;
  margin-bottom: 20px;
}
.doc-logo { max-height: 70px; max-width: 160px; object-fit: contain; }
.doc-title { text-align: center; font-size: 20px; font-weight: 800; color: #1e3a5f; }
.doc-info { font-size: 11px; color: #555; text-align: left; }
.doc-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 12px; }
.doc-table th { background: #1e3a5f; color: #fff; padding: 8px; border: 1px solid #ccc; text-align: right; }
.doc-table td { padding: 7px 8px; border: 1px solid #ccc; }
.doc-table tr:nth-child(even) td { background: #f5f7ff; }
.doc-footer { border-top: 2px solid #1e3a5f; margin-top: 20px; padding-top: 12px; font-size: 11px; color: #777; text-align: center; }

.doc-watermark-grid { position:absolute; top:0; left:0; width:100%; height:100%; pointer-events:none; z-index:9; overflow:hidden; }
.doc-watermark-img { position: absolute; top: 10%; left: 10%; width: 80%; height: 80%; opacity: 0.06; object-fit: contain; object-position: center; pointer-events: none; z-index: 9; }
.doc-company-header { text-align:center; margin-bottom:4px; }
.doc-company-name-ar { font-size: 16px; font-weight: 800; color: #1e3a5f; font-family: 'Cairo', sans-serif; }
.doc-company-name-en { font-size: 11px; color: #555; font-family: Arial, sans-serif; letter-spacing: 0.5px; margin-top:2px; }

/* ═══════════════ ORG CHART TREE ═══════════════ */
.org-tree-wrap { overflow:hidden; padding:0; border:1px solid var(--border); border-radius:10px; background:var(--surface2); position:relative; }
.org-tree-zoom-bar { display:flex; gap:6px; justify-content:flex-end; padding:6px 8px; background:var(--surface); border-bottom:1px solid var(--border); }
.org-tree-zoom-bar button { font-size:11px; padding:4px 10px; }
.org-tree-scroll { overflow:auto; padding:18px 8px; max-height:75vh; }
.org-tree-inner { transform-origin:top center; transition:transform .2s ease; display:block; width:fit-content; margin:0 auto; }
/* Force entire tree to LTR so CSS lines work correctly */
.org-tree { direction:ltr !important; }
.org-tree * { direction:ltr !important; }
/* Text inside boxes stays RTL */
.org-box { direction:rtl !important; }
.org-tree, .org-tree ul { list-style:none; margin:0; padding:0; }
.org-tree ul { display:flex; justify-content:center; padding-top:22px; position:relative; }
/* vertical line from parent center down */
.org-tree ul::before { content:''; position:absolute; top:0; left:50%; border-left:2px solid #b0bec5; height:22px; }
.org-tree li { display:flex; flex-direction:column; align-items:center; position:relative; padding:22px 8px 0; }
/* vertical line from horizontal bar down to child */
.org-tree li::before { content:''; position:absolute; top:0; left:50%; width:0; height:22px; border-left:2px solid #b0bec5; }
/* horizontal bar connecting siblings */
.org-tree li::after { content:''; position:absolute; top:0; left:0; width:100%; border-top:2px solid #b0bec5; }
.org-tree li:first-child::after { left:50%; width:50%; }
.org-tree li:last-child::after { left:0; width:50%; }
.org-tree li:only-child::after { display:none; }
/* root node: no lines above */
.org-tree > li::before, .org-tree > li::after { display:none; }
.org-tree > li { padding-top:0; }

/* ── VERTICAL mode: workers under a team-leader stack vertically (compact) ── */
.org-tree ul.org-vertical { flex-direction:column; align-items:center; padding-top:14px; gap:6px; }
.org-tree ul.org-vertical::before { height:14px; }
.org-tree ul.org-vertical > li { padding:6px 0 0 0; flex-direction:row; align-items:center; }
.org-tree ul.org-vertical > li::before { display:none; }
.org-tree ul.org-vertical > li::after { top:50%; left:50%; width:14px; height:0; border-top:2px solid #b0bec5; transform:translateY(-50%); }
.org-tree ul.org-vertical > li:first-child { padding-top:6px; }
.org-tree ul.org-vertical > li:not(:first-child)::before { display:block; left:50%; top:-3px; height:8px; }

.org-box { background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:10px 14px; min-width:100px; max-width:160px; text-align:center; cursor:pointer; transition:transform .2s,box-shadow .2s; box-shadow:0 2px 8px rgba(0,0,0,.06); }
.org-box:hover { box-shadow:0 4px 10px rgba(0,0,0,.08); }
.org-tree-inner { will-change:transform; }
.org-tree, .org-tree * { backface-visibility:hidden; -webkit-backface-visibility:hidden; }
.org-box-root { min-width:150px; padding:12px 16px; }
.org-box-dept { min-width:110px; }
.org-box-emp { min-width:80px; max-width:120px; padding:5px 8px; border-radius:10px; }
.org-box-team { min-width:90px; border-style:dashed; }

/* ═══════════════ DESIGNS PAGE ═══════════════ */
/* Tree panel (left) */
.ds-tree-panel { width:250px; min-width:250px; background:var(--surface); border-left:1px solid var(--border); display:flex; flex-direction:column; overflow:hidden; }
.ds-tree-header { padding:12px 14px; background:linear-gradient(135deg,#1a3a5c,#0284c7); color:#fff; flex-shrink:0; }
.ds-tree-title { font-size:14px; font-weight:700; }
.ds-select-wrap { padding:10px 12px; border-bottom:1px solid var(--border); flex-shrink:0; }
.ds-tree-body { flex:1; overflow-y:auto; padding:6px 0; font-size:12px; }
/* Tree nodes */
.ds-tree { padding:4px 8px; }
.ds-tree-node { display:flex; align-items:center; gap:5px; padding:4px 8px; cursor:pointer; border-radius:4px; transition:background .15s; white-space:nowrap; }
.ds-tree-node:hover { background:var(--surface2); }
.ds-tree-root { font-weight:700; font-size:13px; color:var(--accent); padding:6px 8px; }
.ds-tree-icon { font-size:12px; flex-shrink:0; }
.ds-tree-text { font-size:11px; overflow:hidden; text-overflow:ellipsis; }
.ds-tree-arrow { font-size:8px; color:var(--text2); transition:transform .2s; display:inline-block; width:12px; }
.ds-tree-arrow.open { transform:rotate(90deg); }
.ds-tree-children { padding-right:12px; }
.ds-tree-info { color:var(--text2); font-size:10px; padding:2px 8px 2px 20px; }
.ds-tree-color { color:var(--accent2); }
.ds-tree-folder { font-weight:600; color:var(--text); }
.ds-tree-section { padding-right:24px; font-weight:600; color:var(--accent); }
.ds-tree-items { padding-right:36px; }
.ds-tree-items.collapsed { display:none; }
.ds-tree-sections.collapsed { display:none; }
.ds-tree-item { color:var(--text2); font-size:10px; padding:2px 8px; font-family:monospace; }

.ds-main { flex:1; overflow-y:auto; background:var(--bg); }
.ds-empty { display:flex; flex-direction:column; align-items:center; justify-content:center; height:100%; text-align:center; }
.ds-content { padding:16px 20px; }
.ds-info-bar { margin-bottom:16px; }
.ds-info-row { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; margin-bottom:12px; }
.ds-info-card { background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:12px 14px; }
.ds-info-label { font-size:10px; color:var(--text2); margin-bottom:4px; }
.ds-info-value { font-size:14px; font-weight:700; color:var(--text); }
.ds-colors-bar { display:flex; align-items:center; gap:16px; padding:12px 16px; background:var(--surface); border:1px solid var(--border); border-radius:10px; flex-wrap:wrap; }
.ds-color-chip { display:flex; align-items:center; gap:8px; }
.ds-color-dot { width:28px; height:28px; border-radius:50%; border:2px solid var(--border); flex-shrink:0; }
.ds-color-label { font-size:9px; color:var(--text2); }
.ds-color-value { font-size:12px; font-weight:600; color:var(--text); }
.ds-meas-summary { margin-right:auto; display:flex; align-items:center; gap:6px; padding:6px 14px; background:var(--accent); color:#fff; border-radius:8px; font-size:12px; font-weight:600; }
.ds-meas-count { font-size:16px; font-weight:800; }
.ds-meas-label { font-size:10px; }
.ds-meas-sep { opacity:0.4; }

.ds-sections { margin-top:16px; }
.ds-section { background:var(--surface); border:1px solid var(--border); border-radius:10px; margin-bottom:10px; overflow:hidden; }
.ds-section.collapsed .ds-section-body { display:none; }
.ds-section.collapsed .ds-section-arrow { transform:rotate(-90deg); }
.ds-section-header { display:flex; align-items:center; gap:10px; padding:12px 16px; cursor:pointer; background:var(--surface); transition:background .15s; }
.ds-section-header:hover { background:var(--surface2); }
.ds-section-arrow { font-size:10px; color:var(--text2); transition:transform .2s; }
.ds-section-name { font-size:14px; font-weight:700; color:var(--accent); flex:1; }
.ds-section-badges { display:flex; gap:6px; }
.ds-badge { font-size:10px; padding:3px 10px; border-radius:6px; background:var(--surface2); color:var(--text2); font-weight:600; }
.ds-badge-area { background:var(--accent); color:#fff; }
.ds-section-body { padding:12px 16px; border-top:1px solid var(--border); }
.ds-items-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:10px; }
.ds-item-card { background:var(--surface2); border:1px solid var(--border); border-radius:8px; padding:10px; display:flex; flex-direction:column; align-items:center; transition:transform .15s,box-shadow .15s; }
.ds-item-card:hover { transform:translateY(-2px); box-shadow:0 4px 12px rgba(0,0,0,.1); }
.ds-item-preview { display:flex; align-items:center; justify-content:center; height:70px; margin-bottom:8px; }
.ds-item-rect { border:2px solid var(--accent); border-radius:2px; background:rgba(2,132,199,.08); }
.ds-item-details { text-align:center; width:100%; }
.ds-item-dims { font-size:13px; font-weight:700; color:var(--text); font-family:monospace; }
.ds-item-area { font-size:10px; color:var(--accent2); font-weight:600; margin-top:2px; }
.ds-item-code { font-size:9px; color:var(--text2); margin-top:2px; }
.ds-item-notes { font-size:9px; color:var(--accent3); margin-top:2px; font-style:italic; }
.ds-empty-meas { text-align:center; padding:40px 20px; }

/* ═══════════════ SETTINGS TAB TRANSITIONS ═══════════════ */
.settings-tab {
  animation: fadeIn 0.25s ease-out;
}

/* ═══════════════ SELECTION HIGHLIGHT ═══════════════ */
::selection {
  background: var(--accent);
  color: #fff;
}

/* ═══════════════ TOOLTIP STYLE ═══════════════ */
[title] {
  position: relative;
}

/* ═══════════════ SIDEBAR BOTTOM SECTION ═══════════════ */
.sb-bottom {
  border-top: 1px solid var(--border);
  padding: 10px 0 6px;
  flex-shrink: 0;
}

/* ═══════════════ SPACECRAFT THEME TOGGLE BUTTON ═══════════════ */
/* Spacecraft btn is now inside .sb-actions, no fixed positioning needed */
.spacecraft-toggle-btn {
  display: none; /* old floating button hidden — now in sidebar */
}
@keyframes rocketFloat {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* ═══════════════════════════════════════════════════════════
   SPACECRAFT MODE — FUTURISTIC SPACE TECH THEME
   ═══════════════════════════════════════════════════════════ */
body.spacecraft-mode {
  --bg: #030712;
  --surface: rgba(15, 23, 42, 0.85);
  --surface2: rgba(20, 30, 55, 0.7);
  --surface3: rgba(30, 45, 75, 0.6);
  --accent: #06b6d4;
  --accent-light: #22d3ee;
  --accent-glow: rgba(6, 182, 212, 0.3);
  --accent2: #a855f7;
  --accent3: #f43f5e;
  --accent4: #10b981;
  --cyan: #06b6d4;
  --text: #e0f2fe;
  --text2: #7dd3fc;
  --border: rgba(6,182,212,0.12);
  --hover: rgba(6,182,212,0.08);
  --selected: rgba(6,182,212,0.15);
  --glass: rgba(3, 7, 18, 0.88);
  --glass-border: rgba(6,182,212,0.15);
  --sidebar-bg: linear-gradient(180deg, #050d1a 0%, #071020 50%, #040a15 100%);
  --panel-bg: linear-gradient(180deg, #060e1c 0%, #081222 50%, #050b17 100%);
  --main-bg: #040914;
}

/* Spacecraft background — deep space + nebula + tech grid */
body.spacecraft-mode::before {
  background:
    /* Tech grid lines */
    repeating-linear-gradient(0deg, rgba(6,182,212,0.03) 0px, transparent 1px, transparent 80px),
    repeating-linear-gradient(90deg, rgba(6,182,212,0.03) 0px, transparent 1px, transparent 80px),
    /* Bright stars */
    radial-gradient(1.5px 1.5px at 8% 12%, #fff, transparent),
    radial-gradient(1px 1px at 18% 38%, rgba(255,255,255,0.9), transparent),
    radial-gradient(1px 1px at 28% 72%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1.5px 1.5px at 42% 18%, #fff, transparent),
    radial-gradient(1px 1px at 55% 55%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 62% 82%, rgba(255,255,255,0.8), transparent),
    radial-gradient(1.5px 1.5px at 75% 28%, #fff, transparent),
    radial-gradient(1px 1px at 88% 65%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 95% 8%, rgba(255,255,255,0.9), transparent),
    radial-gradient(1px 1px at 35% 92%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 48% 42%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 12% 68%, rgba(255,255,255,0.6), transparent),
    /* Colored stars */
    radial-gradient(2px 2px at 15% 80%, rgba(6,182,212,0.9), transparent),
    radial-gradient(2px 2px at 90% 15%, rgba(139,92,246,0.8), transparent),
    radial-gradient(2px 2px at 50% 95%, rgba(244,63,94,0.6), transparent),
    radial-gradient(1.5px 1.5px at 72% 48%, rgba(6,182,212,0.7), transparent),
    /* Nebula clouds */
    radial-gradient(ellipse at 15% 75%, rgba(6,182,212,0.08) 0%, transparent 45%),
    radial-gradient(ellipse at 85% 25%, rgba(139,92,246,0.07) 0%, transparent 45%),
    radial-gradient(ellipse at 50% 50%, rgba(6,182,212,0.03) 0%, transparent 60%),
    radial-gradient(ellipse at 30% 20%, rgba(244,63,94,0.03) 0%, transparent 40%),
    #020610 !important;
}
body.spacecraft-mode::after {
  background-image:
    /* More twinkling stars layer */
    radial-gradient(1px 1px at 5% 22%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 22% 48%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 38% 15%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 52% 78%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 68% 32%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 82% 88%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 92% 52%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1.5px 1.5px at 3% 95%, rgba(6,182,212,0.6), transparent),
    radial-gradient(1.5px 1.5px at 97% 3%, rgba(139,92,246,0.5), transparent) !important;
  opacity: 0.8 !important;
  animation: starsFlicker 6s ease-in-out infinite alternate;
}
@keyframes starsFlicker {
  0% { opacity: 0.5; }
  33% { opacity: 0.85; }
  66% { opacity: 0.6; }
  100% { opacity: 0.75; }
}

/* Sidebar — dark cockpit panel with scan line */
body.spacecraft-mode .sidebar {
  background: linear-gradient(180deg, #050c18 0%, #030912 50%, #02060e 100%) !important;
  border-left: 1px solid rgba(6,182,212,0.25) !important;
  box-shadow: -4px 0 40px rgba(6,182,212,0.08), inset 1px 0 0 rgba(6,182,212,0.1) !important;
}
body.spacecraft-mode .sidebar::before {
  background:
    repeating-linear-gradient(0deg, transparent 0px, transparent 3px, rgba(6,182,212,0.02) 3px, rgba(6,182,212,0.02) 4px),
    linear-gradient(180deg, rgba(6,182,212,0.06) 0%, transparent 30%, rgba(139,92,246,0.04) 100%) !important;
}
/* Scanning light effect on sidebar */
body.spacecraft-mode .sidebar::after {
  background: linear-gradient(180deg, transparent 0%, rgba(6,182,212,0.06) 50%, transparent 100%) !important;
  height: 120px !important;
  width: 100% !important;
  animation: sidebarScan 6s linear infinite !important;
  opacity: 1 !important;
}
@keyframes sidebarScan {
  0% { top: -120px; }
  100% { top: 100vh; }
}

/* Navigation — holographic buttons */
body.spacecraft-mode .sb-btn {
  color: #7dd3fc;
  border: 1px solid transparent;
}
body.spacecraft-mode .sb-btn:hover {
  background: rgba(6,182,212,0.1) !important;
  color: #22d3ee;
  border-color: rgba(6,182,212,0.2);
  box-shadow: 0 0 20px rgba(6,182,212,0.1), inset 0 0 20px rgba(6,182,212,0.03);
  text-shadow: 0 0 10px rgba(6,182,212,0.5);
}
body.spacecraft-mode .sb-btn.active {
  background: linear-gradient(135deg, rgba(6,182,212,0.2), rgba(139,92,246,0.15)) !important;
  color: #22d3ee !important;
  border: 1px solid rgba(6,182,212,0.3);
  box-shadow: 0 0 24px rgba(6,182,212,0.2), 0 0 60px rgba(6,182,212,0.05), inset 0 0 30px rgba(6,182,212,0.05) !important;
  border-right: 3px solid #22d3ee !important;
  text-shadow: 0 0 12px rgba(6,182,212,0.6);
}

/* Logo — glow */
body.spacecraft-mode .sb-logo-name {
  color: #22d3ee;
  text-shadow: 0 0 12px rgba(6,182,212,0.5), 0 0 30px rgba(6,182,212,0.2);
  letter-spacing: 5px;
}
body.spacecraft-mode .sb-logo-sub {
  color: #7dd3fc;
  text-shadow: 0 0 8px rgba(6,182,212,0.3);
}
body.spacecraft-mode .sb-logo-light {
  filter: drop-shadow(0 0 12px rgba(6,182,212,0.3));
}

/* Cards — holographic panels */
body.spacecraft-mode .card {
  background: rgba(10, 18, 35, 0.8) !important;
  border: 1px solid rgba(6,182,212,0.12) !important;
  box-shadow: 0 0 0 1px rgba(6,182,212,0.05), 0 8px 32px rgba(0,0,0,0.4) !important;
}
body.spacecraft-mode .card::before {
  background: linear-gradient(90deg, transparent, rgba(6,182,212,0.2), rgba(139,92,246,0.1), transparent) !important;
}
body.spacecraft-mode .card:hover {
  border-color: rgba(6,182,212,0.3) !important;
  box-shadow: 0 0 30px rgba(6,182,212,0.1), 0 12px 40px rgba(0,0,0,0.4), 0 0 80px rgba(6,182,212,0.04) !important;
}

/* Stat cards — HUD display */
body.spacecraft-mode .stat-card {
  background: rgba(6, 12, 24, 0.85) !important;
  border: 1px solid rgba(6,182,212,0.15) !important;
}
body.spacecraft-mode .stat-card::before {
  background: linear-gradient(90deg, #06b6d4, #a855f7, #06b6d4) !important;
  height: 2px !important;
  animation: scanLine 3s linear infinite;
}
@keyframes scanLine {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}
body.spacecraft-mode .stat-card:hover {
  box-shadow: 0 0 40px rgba(6,182,212,0.15), 0 0 80px rgba(139,92,246,0.06) !important;
  border-color: rgba(6,182,212,0.35) !important;
}
body.spacecraft-mode .stat-num {
  background: linear-gradient(135deg, #06b6d4, #22d3ee, #a855f7) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  filter: drop-shadow(0 0 8px rgba(6,182,212,0.3));
}

/* Project cards — data terminals */
body.spacecraft-mode .project-card {
  background: rgba(8, 15, 30, 0.85) !important;
  border: 1px solid rgba(6,182,212,0.1) !important;
}
body.spacecraft-mode .project-card:hover {
  border-color: rgba(6,182,212,0.35) !important;
  box-shadow: 0 0 30px rgba(6,182,212,0.12), 0 8px 32px rgba(0,0,0,0.3) !important;
}
body.spacecraft-mode .pc-num {
  background: linear-gradient(135deg, rgba(6,182,212,0.15), rgba(139,92,246,0.1)) !important;
  color: #22d3ee !important;
  border: 1px solid rgba(6,182,212,0.2);
}
body.spacecraft-mode .project-card:hover .pc-num {
  background: linear-gradient(135deg, #06b6d4, #a855f7) !important;
  color: #fff !important;
  box-shadow: 0 0 16px rgba(6,182,212,0.4);
}

/* Progress bars — energy beam */
body.spacecraft-mode .progress-fill {
  background: linear-gradient(90deg, #06b6d4, #22d3ee, #a855f7, #06b6d4) !important;
  background-size: 200% 100%;
  box-shadow: 0 0 8px rgba(6,182,212,0.4), 0 0 20px rgba(6,182,212,0.15);
}

/* Buttons — neon style */
body.spacecraft-mode .btn-primary {
  background: linear-gradient(135deg, rgba(6,182,212,0.8), rgba(34,211,238,0.6)) !important;
  box-shadow: 0 0 16px rgba(6,182,212,0.3), 0 0 40px rgba(6,182,212,0.1) !important;
  border: 1px solid rgba(6,182,212,0.4);
}
body.spacecraft-mode .btn-primary:hover {
  box-shadow: 0 0 24px rgba(6,182,212,0.5), 0 0 60px rgba(6,182,212,0.15) !important;
}

/* Inputs — cockpit controls */
body.spacecraft-mode input,
body.spacecraft-mode select,
body.spacecraft-mode textarea {
  background: rgba(6, 12, 28, 0.7) !important;
  border-color: rgba(6,182,212,0.15) !important;
  color: #e0f2fe !important;
}
body.spacecraft-mode input:focus,
body.spacecraft-mode select:focus,
body.spacecraft-mode textarea:focus {
  border-color: #06b6d4 !important;
  box-shadow: 0 0 0 3px rgba(6,182,212,0.2), 0 0 24px rgba(6,182,212,0.1), 0 0 60px rgba(6,182,212,0.04) !important;
}

/* Tabs — navigation HUD */
body.spacecraft-mode .tabs {
  background: rgba(6, 12, 28, 0.6) !important;
  border-color: rgba(6,182,212,0.12) !important;
}
body.spacecraft-mode .tab.active {
  background: linear-gradient(135deg, rgba(6,182,212,0.25), rgba(139,92,246,0.15)) !important;
  color: #22d3ee !important;
  box-shadow: 0 0 16px rgba(6,182,212,0.2) !important;
  border: 1px solid rgba(6,182,212,0.25);
}

/* Modals — holographic panels */
body.spacecraft-mode .modal {
  background: rgba(6, 12, 28, 0.95) !important;
  border: 1px solid rgba(6,182,212,0.2) !important;
  box-shadow: 0 0 40px rgba(6,182,212,0.1), 0 24px 80px rgba(0,0,0,0.6) !important;
}
body.spacecraft-mode .modal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent 5%, #06b6d4 25%, #a855f7 50%, #06b6d4 75%, transparent 95%);
  z-index: 2;
  animation: scanLine 4s linear infinite;
  background-size: 200% 100%;
}
body.spacecraft-mode .modal-header {
  background: rgba(6, 12, 28, 0.9) !important;
  border-bottom-color: rgba(6,182,212,0.15) !important;
}

/* Side panel */
body.spacecraft-mode .side-panel {
  background: rgba(4, 8, 18, 0.95) !important;
  border-right: 1px solid rgba(6,182,212,0.2) !important;
  box-shadow: 8px 0 40px rgba(6,182,212,0.08) !important;
}

/* Status badges — neon glow */
body.spacecraft-mode .status-active { background: rgba(6,182,212,0.15); color: #22d3ee; box-shadow: 0 0 8px rgba(6,182,212,0.2); }
body.spacecraft-mode .status-new { background: rgba(139,92,246,0.15); color: #c084fc; box-shadow: 0 0 8px rgba(139,92,246,0.2); }
body.spacecraft-mode .status-done { background: rgba(16,185,129,0.15); color: #34d399; box-shadow: 0 0 8px rgba(16,185,129,0.2); }
body.spacecraft-mode .status-paused { background: rgba(244,63,94,0.15); color: #fb7185; box-shadow: 0 0 8px rgba(244,63,94,0.2); }

/* Notification — alert system */
body.spacecraft-mode .notif {
  background: rgba(6, 12, 28, 0.95) !important;
  border: 1px solid rgba(6,182,212,0.35) !important;
  box-shadow: 0 0 30px rgba(6,182,212,0.15), 0 8px 32px rgba(0,0,0,0.4) !important;
  color: #e0f2fe !important;
}

/* Action buttons — control deck */
body.spacecraft-mode .action-btn-item {
  background: rgba(6, 12, 28, 0.7) !important;
  border: 1px solid rgba(6,182,212,0.12) !important;
  color: #7dd3fc !important;
}
body.spacecraft-mode .action-btn-item:hover {
  background: rgba(6,182,212,0.1) !important;
  border-color: rgba(6,182,212,0.3) !important;
  box-shadow: 0 0 20px rgba(6,182,212,0.15) !important;
  color: #22d3ee !important;
}

/* Scrollbar — cyan energy */
body.spacecraft-mode ::-webkit-scrollbar-thumb {
  background: rgba(6,182,212,0.3);
}
body.spacecraft-mode ::-webkit-scrollbar-thumb:hover {
  background: rgba(6,182,212,0.6);
  box-shadow: 0 0 8px rgba(6,182,212,0.3);
}

/* ══ Settings Sidebar Nav ══ */
.st-group-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text2);
  padding: 4px 10px 2px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  opacity: 0.7;
}
.st-nav-item {
  padding: 9px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
}
.st-nav-item:hover:not(.active) {
  background: var(--surface3);
  border-color: var(--border);
  transform: translateX(-2px);
}
.st-nav-item.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff !important;
  font-weight: 700;
  box-shadow: 0 2px 12px var(--accent-glow);
  border-color: transparent;
}

/* Mobile — spacecraft & bell are now in mobile topbar, no fixed repositioning needed */

/* ═══════════════ LOGO THEME SWITCHING ═══════════════ */
/* Light mode: show dark logo, hide light logo */
body.light-mode .sb-logo-light, body.light-mode .mob-logo-light { display: none !important; }
body.light-mode .sb-logo-dark, body.light-mode .mob-logo-dark { display: inline-block !important; }
/* Dark mode: show light logo, hide dark logo */
body:not(.light-mode) .sb-logo-light, body:not(.light-mode) .mob-logo-light { display: inline-block !important; }
body:not(.light-mode) .sb-logo-dark, body:not(.light-mode) .mob-logo-dark { display: none !important; }
.sb-logo img { flex-shrink: 0; }

/* ═══════════════ IMPROVED LIGHT MODE — CORPORATE ═══════════════ */
body.light-mode {
  background: linear-gradient(145deg, #edf0f5 0%, #e2e7ef 25%, #dde3ec 50%, #e5eaf2 75%, #edf0f5 100%);
}
body.light-mode::before {
  background:
    radial-gradient(ellipse at 15% 15%, rgba(2,132,199,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 85%, rgba(99,102,241,0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 0%, rgba(255,255,255,0.3) 0%, transparent 35%),
    linear-gradient(145deg, #edf0f5, #e2e7ef, #dde3ec) !important;
}
body.light-mode .sidebar {
  background: linear-gradient(180deg, #f0f2f7 0%, #e8ecf2 30%, #e0e5ee 60%, #d8dee8 100%);
  box-shadow: -2px 0 20px rgba(0,0,0,.06), inset 1px 0 0 rgba(255,255,255,0.5);
  border-left: 1px solid rgba(0,0,0,0.04);
}
body.light-mode .sidebar::before {
  background: linear-gradient(180deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
}
body.light-mode .sidebar::after {
  opacity: 0;
}
body.light-mode .card {
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(0,0,0,0.04);
  box-shadow: 0 1px 3px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.03);
}
body.light-mode .card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,.06), 0 8px 32px rgba(0,0,0,.04);
  border-color: rgba(2,132,199,0.12);
  transform: translateY(-2px);
}
body.light-mode .stat-card {
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(0,0,0,0.04);
  box-shadow: 0 1px 3px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.03);
}
body.light-mode .stat-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 8px 24px rgba(0,0,0,.06);
  border-color: rgba(2,132,199,0.15);
}
body.light-mode .project-card {
  background: rgba(255,255,255,0.88);
  border: 1px solid rgba(0,0,0,0.04);
  box-shadow: 0 1px 3px rgba(0,0,0,.03);
}
body.light-mode .project-card:hover {
  border-color: rgba(2,132,199,0.15);
  box-shadow: 0 6px 20px rgba(0,0,0,.06);
  transform: translateY(-3px);
}
body.light-mode .mobile-topbar {
  background: rgba(240,243,248,0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
body.light-mode .sb-btn {
  color: #475569;
}
body.light-mode .sb-btn:hover {
  background: rgba(255,255,255,0.6);
  color: #1e293b;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  transform: translateX(-3px);
}
body.light-mode .sb-action-btn {
  background: rgba(255,255,255,0.6);
  color: #475569;
  border: 1px solid rgba(0,0,0,0.05);
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
body.light-mode .sb-action-btn:hover {
  background: rgba(255,255,255,0.85);
  color: #1e293b;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
body.light-mode .side-panel {
  background: rgba(245,248,252,0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 4px 0 24px rgba(0,0,0,.06);
  border-right: 1px solid rgba(0,0,0,0.04);
}

/* ═══════════════ ARCHITECTURAL BACKGROUND ═══════════════ */
.app-content {
  background-image:
    linear-gradient(135deg, rgba(136,150,170,0.03) 25%, transparent 25%),
    linear-gradient(225deg, rgba(136,150,170,0.03) 25%, transparent 25%),
    linear-gradient(45deg, rgba(136,150,170,0.02) 25%, transparent 25%),
    linear-gradient(315deg, rgba(136,150,170,0.02) 25%, transparent 25%);
  background-size: 120px 120px;
  background-position: 60px 0, 60px 0, 0 0, 0 0;
}
body:not(.light-mode) .app-content {
  background-image:
    linear-gradient(135deg, rgba(74,122,170,0.02) 25%, transparent 25%),
    linear-gradient(225deg, rgba(74,122,170,0.02) 25%, transparent 25%),
    linear-gradient(45deg, rgba(74,122,170,0.015) 25%, transparent 25%),
    linear-gradient(315deg, rgba(74,122,170,0.015) 25%, transparent 25%);
  background-size: 120px 120px;
  background-position: 60px 0, 60px 0, 0 0, 0 0;
}

/* ── Designs Page ── */
.ds-frame-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(2,132,199,0.15);
  border-color: var(--accent) !important;
}
.ds-client-item:hover {
  background: var(--surface2) !important;
}
#dsLeftPanel::-webkit-scrollbar,
#dsClientList::-webkit-scrollbar { width: 4px; }
#dsLeftPanel::-webkit-scrollbar-thumb,
#dsClientList::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Login architectural background */
#loginScreen::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.015;
  background-image:
    repeating-linear-gradient(90deg, #8896aa 0px, transparent 1px, transparent 80px),
    repeating-linear-gradient(0deg, #8896aa 0px, transparent 1px, transparent 80px),
    linear-gradient(135deg, rgba(136,150,170,0.1) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 40px 40px;
  pointer-events: none;
}

/* ═══════════ NouRmas Utility Classes ═══════════ */
.modal-sm { max-width: 440px; }
.modal-md { max-width: 640px; }
.modal-lg { max-width: 1100px; }
.modal-xl { max-width: 1400px; }
.modal-full { max-width: 97vw; }

.empty-state { display:flex; flex-direction:column; align-items:center; justify-content:center; padding:60px 24px; text-align:center; }
.empty-icon { font-size:48px; margin-bottom:16px; opacity:0.4; }
.empty-msg { font-size:16px; font-weight:700; color:var(--text); margin-bottom:6px; }
.empty-sub { font-size:13px; color:var(--text2); }

.nm-field { margin-bottom:12px; }
.nm-label { font-size:12px; color:var(--text2); margin-bottom:5px; font-weight:600; }
.nm-hint { font-size:10px; color:var(--text2); margin-top:3px; }

.nm-row-2 { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.nm-row-3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:10px; }
.nm-row-auto { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:10px; }

.nm-section { font-size:13px; font-weight:700; color:var(--text); padding:8px 0 6px; margin-top:12px; border-bottom:1px solid var(--border); }

/* Better scrollbar */
::-webkit-scrollbar { width:6px; height:6px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:rgba(14,165,201,0.2); border-radius:3px; }
::-webkit-scrollbar-thumb:hover { background:rgba(14,165,201,0.35); }

/* ═══ IPAD / TABLET TOUCH FIX ═══ */
@media (pointer: coarse) {
  /* All buttons must be at least 44px for Apple touch guidelines */
  .btn, .btn-sm, button, [onclick] {
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(14,165,201,0.2);
  }
  .btn { padding: 12px 20px; font-size: 14px; }
  .btn-sm { padding: 10px 14px; font-size: 13px; min-height: 40px; }

  /* Inputs must be 16px+ to prevent iOS zoom */
  input, select, textarea {
    font-size: 16px !important;
    min-height: 44px;
  }

  /* Checkboxes/radio larger for touch */
  input[type="checkbox"], input[type="radio"] {
    width: 22px !important;
    height: 22px !important;
    min-height: 22px;
  }

  /* Modal buttons spacing */
  .modal .btn, .modal button { margin: 2px; }

  /* Tab buttons */
  .tab, .nav-tab, .sub-tab, [role="tab"] {
    min-height: 44px;
    padding: 10px 16px;
  }

  /* Labels with checkboxes - larger tap area */
  label { padding: 4px 0; }

  /* Cards more tappable */
  .card { padding: 14px; }
}
