/* ================================================================
   style.css v30 — سیستم مدیریت داربست‌بندی
   ✅ منوی موبایل کامل مخفی در حالت بسته
   ✅ کشیدن انگشت از لبه راست
   ✅ منوی کوچک‌تر و متناسب
   ================================================================ */

:root {
  --primary: #7c3aed;
  --primary-hover: #6d28d9;
  --primary-active: #5b21b6;
  --primary-light: rgba(124, 58, 237, 0.08);
  --primary-subtle: rgba(124, 58, 237, 0.15);

  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.12);
  --danger-hover: #dc2626;
  --danger-soft: #fee2e2;
  --danger-border: #fecaca;
  --info: #0ea5e9;

  --bg: #f6f8fb;
  --bg-grid: rgba(148, 163, 184, 0.14);
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #f1f5f9;

  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;

  --border: #e5e7eb;
  --border-2: #cbd5e1;
  --border-strong: #94a3b8;

  --r-sm: 6px;
  --r: 10px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-full: 999px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 10px 10px -5px rgba(15, 23, 42, 0.04);

  --t-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --t: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark {
  --bg: #0b1220;
  --bg-grid: rgba(148, 163, 184, 0.05);
  --surface: #111a2e;
  --surface-2: #172136;
  --surface-3: #1e293b;
  --text: #e2e8f0;
  --text-2: #cbd5e1;
  --muted: #94a3b8;
  --muted-2: #64748b;
  --border: #24314a;
  --border-2: #334155;
  --border-strong: #475569;
  --primary-light: rgba(124, 58, 237, 0.18);
  --primary-subtle: rgba(124, 58, 237, 0.28);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.45), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.55), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 44px 44px;
  background-attachment: fixed;
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--primary-subtle); color: var(--primary); }

.hidden { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: var(--r-full);
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ================================================================
   صفحه ورود
   ================================================================ */
.login-page {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 20%, rgba(139, 92, 246, 0.55) 0%, transparent 45%),
    radial-gradient(circle at 85% 15%, rgba(56, 189, 248, 0.45) 0%, transparent 50%),
    radial-gradient(circle at 75% 90%, rgba(236, 72, 153, 0.45) 0%, transparent 50%),
    radial-gradient(circle at 20% 85%, rgba(16, 185, 129, 0.35) 0%, transparent 50%),
    linear-gradient(135deg, #1e1b4b 0%, #312e81 35%, #5b21b6 70%, #4c1d95 100%);
}

.login-bg-decoration {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.login-bg-decoration .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  animation: floatBlob 14s ease-in-out infinite;
}

.login-bg-decoration .blob-1 { width: 420px; height: 420px; top: -120px; right: -80px; background: radial-gradient(circle, #a78bfa 0%, transparent 70%); }
.login-bg-decoration .blob-2 { width: 360px; height: 360px; bottom: -100px; left: -60px; background: radial-gradient(circle, #38bdf8 0%, transparent 70%); animation-delay: -5s; }
.login-bg-decoration .blob-3 { width: 300px; height: 300px; top: 45%; left: 40%; background: radial-gradient(circle, #f472b6 0%, transparent 70%); animation-delay: -9s; opacity: 0.35; }

.login-bg-decoration .grid-pattern {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(circle at center, black 30%, transparent 80%);
}

@keyframes floatBlob {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, -30px) scale(1.08); }
  66% { transform: translate(-30px, 25px) scale(0.95); }
}

.login-box {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 430px;
  padding: 42px 38px 36px;
  border-radius: var(--r-xl);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 1px 0 rgba(255, 255, 255, 0.6) inset;
  text-align: center;
  animation: loginBoxIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginBoxIn {
  from { opacity: 0; transform: translateY(28px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

body.dark .login-box {
  background: rgba(17, 26, 46, 0.92);
  border-color: rgba(124, 58, 237, 0.35);
}

.login-box::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--r-xl);
  padding: 1.5px;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.8), rgba(56, 189, 248, 0.5), rgba(236, 72, 153, 0.5));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.7;
}

.login-logo-wrap { display: flex; justify-content: center; margin-bottom: 8px; }

.login-logo-img {
  display: block;
  width: min(230px, 75%);
  height: auto;
  margin: 0 auto 10px;
  object-fit: contain;
}

.login-box h1 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 4px;
  background: linear-gradient(135deg, #7c3aed 0%, #4c1d95 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.3px;
}

body.dark .login-box h1 {
  background: linear-gradient(135deg, #c4b5fd 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-subtitle {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 26px;
  letter-spacing: 0.3px;
}

.login-box .form-group { margin-bottom: 15px; text-align: right; }

.login-box .form-group label {
  font-size: 12.5px;
  color: #475569;
  font-weight: 700;
  margin-bottom: 6px;
  display: block;
}

body.dark .login-box .form-group label { color: #cbd5e1; }

.login-box input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid rgba(148, 163, 184, 0.35);
  border-radius: var(--r);
  font-family: inherit;
  font-size: 14px;
  background: rgba(248, 250, 252, 0.9);
  color: var(--text);
  transition: var(--t);
}

.login-box input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.15);
}

body.dark .login-box input {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(148, 163, 184, 0.25);
  color: #e2e8f0;
}

body.dark .login-box input:focus {
  background: rgba(15, 23, 42, 0.85);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.28);
}

.password-wrapper { position: relative; }
.password-wrapper input { padding-left: 44px !important; }

.password-wrapper .toggle-password {
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent !important;
  border: none !important;
  padding: 2px 6px !important;
  margin: 0;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  transition: var(--t);
}

.password-wrapper .toggle-password:hover {
  background: var(--primary-light) !important;
  color: var(--primary);
}

.login-box .login-submit {
  width: 100%;
  margin-top: 12px;
  padding: 14px;
  border: none;
  border-radius: var(--r);
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 8px 20px -6px rgba(124, 58, 237, 0.55);
  transition: var(--t);
  letter-spacing: 0.3px;
}

.login-box .login-submit:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 12px 26px -8px rgba(124, 58, 237, 0.75);
}

.login-box .login-submit:active { transform: translateY(0); }

.login-box .error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 12px;
  min-height: 20px;
  font-weight: 600;
}

/* ================================================================
   لایه‌بندی اصلی
   ================================================================ */
.app { display: flex; min-height: 100vh; }

/* ================================================================
   سایدبار
   ================================================================ */
.sidebar {
  width: 260px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  color: var(--text-2);
  display: flex;
  flex-direction: column;
  transition: width var(--t), transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: visible;
  box-shadow: var(--shadow-sm);
  will-change: transform;
}

.sidebar.collapsed { width: 72px; }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-text { display: none; }

/* برند */
.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 14px 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.brand-logo-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
  padding: 0 4px;
}

.brand-logo-img {
  display: block;
  width: 100%;
  max-width: 220px;
  height: auto;
  max-height: 110px;
  object-fit: contain;
  border-radius: var(--r-sm);
  transition: var(--t-fast);
}

.brand-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.brand-company {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 4px;
  word-break: break-word;
  line-height: 1.6;
  overflow-wrap: break-word;
  white-space: normal;
  width: 100%;
  text-align: center;
  font-weight: 600;
}

.sidebar.collapsed .brand-logo-wrap { padding: 0; }

.sidebar.collapsed .brand-logo-img {
  max-width: 48px;
  max-height: 48px;
}

.sidebar.collapsed .brand-text { display: none; }
.brand-title { display: none !important; }

/* ناوبری */
#mainNav {
  display: flex;
  flex-direction: column;
  padding: 12px 8px;
  gap: 4px;
  flex: 1 1 auto;
}

#mainNav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r);
  color: var(--text-2);
  text-decoration: none;
  cursor: pointer;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: 0.1px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transform: translateZ(0);
  transition:
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.35s ease,
    background-color 0.3s ease,
    color 0.3s ease;
}

#mainNav a::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(124, 58, 237, 0.15), transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: -1;
}

#mainNav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #7c3aed 0%, #a78bfa 50%, #c4b5fd 100%);
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 0 0 var(--r) var(--r);
  pointer-events: none;
}

#mainNav a:hover {
  background-color: var(--primary-light);
  color: var(--primary);
  transform: translateY(-3px) scale(1.02);
  box-shadow:
    0 10px 20px -8px rgba(124, 58, 237, 0.28),
    0 4px 8px -4px rgba(15, 23, 42, 0.06);
}

#mainNav a:hover::before { opacity: 1; }

#mainNav a:hover::after {
  transform: scaleX(1);
  transform-origin: right center;
}

#mainNav a:active { transform: translateY(-1px) scale(1); }

#mainNav a.active {
  background-color: var(--primary-light);
  color: var(--primary);
  font-weight: 800;
}

#mainNav a.active::after { transform: scaleX(1); }

.nav-icon {
  font-size: 20px;
  flex-shrink: 0;
  width: 26px;
  text-align: center;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#mainNav a:hover .nav-icon { transform: scale(1.15); }

.submenu-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 4px 22px 8px 8px;
  padding-right: 12px;
  border-right: 2px solid var(--border);
}

.submenu-group a {
  padding: 9px 10px !important;
  font-size: 14.5px !important;
  font-weight: 700 !important;
  gap: 10px !important;
  border-radius: var(--r-sm) !important;
}

.submenu-group a .nav-icon {
  font-size: 17px !important;
  min-width: 22px !important;
}

.sidebar.collapsed .submenu-group {
  margin: 2px 0;
  padding-right: 0;
  border-right: none;
}

.sidebar.collapsed .submenu-group a {
  justify-content: center;
  padding: 10px 0 !important;
}

.sidebar-footer {
  flex-shrink: 0;
  padding: 14px 12px 16px;
  border-top: 1px solid var(--border);
  text-align: center;
  line-height: 1.7;
  color: var(--muted);
  background: var(--surface);
}

.sidebar-footer .designer-label {
  font-size: 10.5px;
  color: var(--muted-2);
  margin-bottom: 2px;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.sidebar-footer .designer-name {
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 6px;
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.2px;
}

.sidebar-footer .designer-phone {
  display: inline-block;
  direction: ltr;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  background: var(--primary-light);
  border: 1px solid var(--primary-subtle);
  transition: var(--t-fast);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
}

.sidebar-footer .designer-phone:hover {
  background: var(--primary-subtle);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(124, 58, 237, 0.25);
}

.sidebar.collapsed .sidebar-footer {
  padding: 10px 4px 12px;
}

.sidebar.collapsed .sidebar-footer .designer-label,
.sidebar.collapsed .sidebar-footer .designer-name {
  display: none;
}

.sidebar.collapsed .sidebar-footer .designer-phone {
  font-size: 0;
  padding: 6px 0;
  width: 100%;
  background: transparent;
  border: none;
}

.sidebar.collapsed .sidebar-footer .designer-phone::before {
  content: '📞';
  font-size: 18px;
  display: block;
  line-height: 1;
}

.sidebar-tooltip {
  position: fixed;
  z-index: 99999;
  background: var(--text);
  color: var(--surface);
  padding: 7px 14px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--shadow-md);
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  direction: rtl;
  animation: tooltipFadeIn 0.18s ease-out;
  transform: translate(-100%, -50%);
}

.sidebar-tooltip::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -6px;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-left-color: var(--text);
}

@keyframes tooltipFadeIn {
  from { opacity: 0; transform: translate(-100%, -50%) translateX(6px); }
  to { opacity: 1; transform: translate(-100%, -50%) translateX(0); }
}

/* Overlay منوی موبایل */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.sidebar-overlay.show {
  display: block;
  opacity: 1;
}

/* ================================================================
   محتوای اصلی
   ================================================================ */
.main {
  flex: 1;
  margin-right: 260px;
  transition: margin-right var(--t);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.sidebar.collapsed ~ .main { margin-right: 72px; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
  box-shadow: var(--shadow-xs);
}

.header-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; flex: 1; }
.header-left h1 { font-size: 18px; font-weight: 700; white-space: nowrap; }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.header-clock {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.header-clock .clock-icon { font-size: 18px; line-height: 1; flex-shrink: 0; }
.header-clock .clock-text { display: flex; flex-direction: column; align-items: center; line-height: 1.35; }
.header-clock #clockTime {
  color: var(--primary);
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
}
.header-clock #clockDate { color: var(--muted); font-size: 11px; font-weight: 600; }

.user-info {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-subtle);
  padding: 6px 14px;
  border-radius: var(--r-full);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-info::before { content: '👤'; font-size: 14px; flex-shrink: 0; }

.icon-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 6px 10px;
  cursor: pointer;
  font-size: 18px;
  color: var(--text);
  transition: var(--t-fast);
}

.icon-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary-subtle);
}

.theme-toggle { display: inline-flex; align-items: center; gap: 2px; padding: 4px 8px; }
.theme-toggle .theme-icon {
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: var(--r-sm);
  opacity: 0.35;
  filter: grayscale(1);
  transition: var(--t-fast);
}
body:not(.dark) .theme-toggle .theme-icon.sun { opacity: 1; filter: none; background: var(--primary-light); }
body.dark .theme-toggle .theme-icon.moon { opacity: 1; filter: none; background: rgba(255,255,255,0.12); }
.theme-toggle:hover .theme-icon { opacity: 0.8; filter: none; }

.logout-btn {
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: var(--r);
  padding: 7px 14px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  transition: var(--t-fast);
}
.logout-btn:hover { background: var(--danger-hover); }

.page { padding: 24px; flex: 1; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.hint-text {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
  background: var(--primary-light);
  padding: 10px 14px;
  border-radius: var(--r);
  border-right: 3px solid var(--primary);
}

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.required { color: var(--danger); }

input[type="text"],
input[type="number"],
input[type="password"],
input[type="time"],
input[type="date"],
input:not([type]),
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-family: inherit;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  transition: var(--t-fast);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

textarea { resize: vertical; min-height: 80px; }

.readonly-field {
  background: var(--surface-3) !important;
  color: var(--muted) !important;
  cursor: default;
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

.search {
  max-width: 260px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-family: inherit;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
}

.form-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  margin: 20px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}

.date-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 0;
  position: relative;
  max-width: 175px;
  flex-shrink: 0;
}

.calendar-btn {
  order: 1;
  background-color: #ffffff;
  border: 1.5px solid var(--border);
  border-left: none;
  border-radius: 0;
  color: var(--text);
  padding: 0;
  cursor: pointer;
  font-size: 0;
  line-height: 1;
  transition: var(--t-fast);
  flex-shrink: 0;
  height: 34px;
  width: 36px;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image:
    url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 2v4M16 2v4'/%3E%3Crect x='3' y='6' width='18' height='16' rx='0.5' ry='0.5'/%3E%3Cline x1='3' y1='11' x2='21' y2='11'/%3E%3Crect x='7' y='14' width='2.4' height='2.4' rx='0' fill='%230f172a' stroke='none'/%3E%3Crect x='11' y='14' width='2.4' height='2.4' rx='0' fill='%230f172a' stroke='none'/%3E%3Crect x='15' y='14' width='2.4' height='2.4' rx='0' fill='%23f59e0b' stroke='none'/%3E%3Crect x='7' y='17.6' width='2.4' height='2.4' rx='0' fill='%230f172a' stroke='none'/%3E%3Crect x='11' y='17.6' width='2.4' height='2.4' rx='0' fill='%230f172a' stroke='none'/%3E%3Crect x='15' y='17.6' width='2.4' height='2.4' rx='0' fill='%230f172a' stroke='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 18px 18px;
}

.calendar-btn:hover {
  background-color: #f1f5f9;
  border-color: var(--primary);
}

body.dark .calendar-btn {
  background-color: var(--surface-2);
  border-color: var(--border);
  background-image:
    url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e2e8f0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 2v4M16 2v4'/%3E%3Crect x='3' y='6' width='18' height='16' rx='0.5' ry='0.5'/%3E%3Cline x1='3' y1='11' x2='21' y2='11'/%3E%3Crect x='7' y='14' width='2.4' height='2.4' rx='0' fill='%23e2e8f0' stroke='none'/%3E%3Crect x='11' y='14' width='2.4' height='2.4' rx='0' fill='%23e2e8f0' stroke='none'/%3E%3Crect x='15' y='14' width='2.4' height='2.4' rx='0' fill='%23fbbf24' stroke='none'/%3E%3Crect x='7' y='17.6' width='2.4' height='2.4' rx='0' fill='%23e2e8f0' stroke='none'/%3E%3Crect x='11' y='17.6' width='2.4' height='2.4' rx='0' fill='%23e2e8f0' stroke='none'/%3E%3Crect x='15' y='17.6' width='2.4' height='2.4' rx='0' fill='%23e2e8f0' stroke='none'/%3E%3C/svg%3E");
}

.date-input {
  order: 2;
  width: 105px !important;
  max-width: 105px !important;
  padding: 6px 10px !important;
  font-size: 12.5px !important;
  border-radius: 0 !important;
  cursor: pointer;
  text-align: center;
  border: 1.5px solid var(--border) !important;
  border-left: none !important;
  border-right: none !important;
  height: 34px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: var(--t-fast);
  letter-spacing: 0.3px;
}

.date-input:hover {
  background: var(--primary-light);
  border-color: var(--primary) !important;
  color: var(--primary);
}

.date-input::placeholder {
  color: var(--muted-2);
  font-weight: 500;
  font-size: 11.5px;
}

.clear-date-btn {
  order: 3;
  display: none;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #fee2e2 0%, #fecaca 100%);
  color: #b91c1c;
  border: 1.5px solid #fecaca;
  border-right: none;
  border-radius: 0;
  padding: 0;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  height: 34px;
  width: 30px;
  flex-shrink: 0;
  font-weight: 700;
  transition: var(--t-fast);
}

.date-wrapper.has-value .clear-date-btn { display: flex; }

.clear-date-btn:hover {
  background: linear-gradient(180deg, #fecaca 0%, #fca5a5 100%);
  color: #991b1b;
}

.persian-picker {
  position: absolute;
  z-index: 9999;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 12px;
  width: 280px;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
}

.pp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 4px;
}

.pp-head button {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 4px 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  transition: var(--t-fast);
}
.pp-head button:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary-subtle); }

.pp-title { font-weight: 700; font-size: 14px; color: var(--primary); }

.pp-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.pp-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }

.pp-day {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: 0 auto;
  border-radius: 50%;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  transition: var(--t-fast);
}
.pp-day:hover { background: var(--primary-light); color: var(--primary); }
.pp-day.pp-selected { background: var(--primary); color: #fff; font-weight: 700; }
.pp-day.pp-empty { cursor: default; }

.pp-foot { margin-top: 10px; text-align: center; }
.pp-today {
  background: var(--primary-light);
  color: var(--primary);
  border: none;
  border-radius: var(--r-sm);
  padding: 6px 16px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  transition: var(--t-fast);
}
.pp-today:hover { background: var(--primary); color: #fff; }

button {
  font-family: inherit;
  font-size: 14px;
  padding: 9px 18px;
  border-radius: var(--r);
  border: none;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  transition: var(--t-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
button:hover { background: var(--primary-hover); }
button:active { transform: translateY(1px); }

button.outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
button.outline:hover { background: var(--surface-2); border-color: var(--border-2); }

button.danger { background: var(--danger); }
button.danger:hover { background: var(--danger-hover); }

button.btn-success { background: var(--success); }
button.btn-success:hover { filter: brightness(0.92); }

button.btn-orange { background: var(--warning); }
button.btn-orange:hover { background: #d97706; }

button.btn-danger-outline {
  background: var(--danger-soft);
  color: #b91c1c;
  border: 1px solid var(--danger-border);
}
button.btn-danger-outline:hover {
  background: var(--danger-border);
  color: #991b1b;
}

button.btn-close-calc {
  background: var(--danger-soft);
  color: #b91c1c;
  border: 1px solid var(--danger-border);
}
button.btn-close-calc:hover {
  background: var(--danger-border);
  color: #991b1b;
}

button.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  height: 34px;
  border-radius: var(--r-sm);
  white-space: nowrap;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface);
}

#customersTableWrapper,
#projectsTableWrapper {
  max-height: calc(100vh - 320px);
  min-height: 260px;
  overflow-y: auto;
  overflow-x: auto;
}

#customersTable thead th,
#projectsTable thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--surface-2);
  box-shadow: 0 1px 0 var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 600px;
}

thead { background: var(--surface-2); }

th {
  padding: 12px 14px;
  text-align: right;
  font-weight: 700;
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr { transition: var(--t-fast); }
tbody tr:hover { background: var(--primary-light); }
tbody tr:last-child td { border-bottom: none; }

tfoot td {
  padding: 12px 14px;
  font-weight: 700;
  background: var(--surface-2);
  border-top: 2px solid var(--border);
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  background: var(--primary-light);
  color: var(--primary);
}
.badge.success { background: var(--success-light); color: var(--success); }
.badge.warning { background: var(--warning-light); color: var(--warning); }
.badge.danger { background: var(--danger-light); color: var(--danger); }

#customersTable tbody tr.row-selected {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.12), rgba(16, 185, 129, 0.03));
  box-shadow: inset -4px 0 0 var(--success);
}
#customersTable tbody tr.row-selected:hover {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.18), rgba(16, 185, 129, 0.06));
}

#projectsTable thead th.sortable {
  cursor: pointer;
  user-select: none;
  transition: var(--t-fast);
}
#projectsTable thead th.sortable:hover {
  background: var(--primary-light);
  color: var(--primary);
}
#projectsTable thead th.sortable .sort-icon {
  display: inline-block;
  font-size: 10px;
  color: var(--primary);
  margin-right: 4px;
  min-width: 10px;
  vertical-align: middle;
}

#reportsInvoicesTable th,
#reportsInvoicesTable td { white-space: nowrap; }
#reportsInvoicesTable tbody tr:hover { background: var(--primary-light); }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--r);
  color: var(--muted);
}
.empty-state .empty-icon { font-size: 56px; margin-bottom: 16px; opacity: 0.6; }
.empty-state h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.empty-state p { font-size: 13.5px; max-width: 320px; line-height: 1.7; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.35s ease,
    border-color 0.35s ease;
  overflow: hidden;
  cursor: default;
  isolation: isolate;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(124, 58, 237, 0.12), transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: -1;
}

.card::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #7c3aed 0%, #a78bfa 50%, #c4b5fd 100%);
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 0 0 var(--r) var(--r);
}

.card:hover {
  transform: translateY(-6px) scale(1.03);
  box-shadow:
    0 16px 32px -8px rgba(124, 58, 237, 0.28),
    0 8px 16px -4px rgba(15, 23, 42, 0.08);
  border-color: var(--primary-subtle);
}

.card:hover::before { opacity: 1; }
.card:hover::after { transform: scaleX(1); transform-origin: right center; }

.card h3 {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 600;
  transition: color 0.3s ease;
}

.card:hover h3 { color: var(--primary); }

.card p {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  transition: transform 0.3s ease, color 0.3s ease;
}

.card:hover p {
  color: var(--primary);
  transform: scale(1.05);
  transform-origin: right center;
}

body.dark .card::before {
  background: radial-gradient(circle at top right, rgba(167, 139, 250, 0.18), transparent 70%);
}
body.dark .card:hover {
  box-shadow:
    0 16px 32px -8px rgba(124, 58, 237, 0.45),
    0 8px 16px -4px rgba(0, 0, 0, 0.5);
}

.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.chart-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 20px 12px;
  box-shadow: var(--shadow-sm);
  position: relative;
  height: 360px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chart-box h3 {
  font-size: 14px;
  margin-bottom: 10px;
  color: var(--text);
  flex-shrink: 0;
  line-height: 1.4;
}

.chart-canvas-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

.chart-canvas-wrap canvas {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.recent-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.recent-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.recent-box h3 { font-size: 14px; margin-bottom: 14px; color: var(--text); }

.recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
  transition: var(--t-fast);
}
.recent-item:hover {
  background: var(--primary-light);
  padding-right: 8px;
  border-radius: var(--r-sm);
}
.recent-item:last-child { border-bottom: none; }

.report-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--surface-3);
  padding: 4px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  width: fit-content;
  flex-wrap: wrap;
}

.report-tabs .tab {
  padding: 8px 18px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  transition: var(--t-fast);
  white-space: nowrap;
}
.report-tabs .tab.active { background: var(--primary); color: #fff; }
.report-tabs .tab:hover:not(.active) { background: var(--surface); color: var(--text); }

.report-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.report-filters label { font-size: 13px; font-weight: 600; color: var(--muted); }
.report-filters select { max-width: 160px; padding: 8px 12px; font-size: 13px; }

.report-filters .report-customer-search {
  max-width: 220px;
  padding: 8px 12px;
  font-size: 13px;
  flex-shrink: 0;
}

.report-panel { animation: fadeIn 0.3s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.financial-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.fin-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  text-align: center;
  transition:
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.35s ease,
    border-color 0.35s ease;
  overflow: hidden;
  cursor: default;
  isolation: isolate;
}

.fin-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(124, 58, 237, 0.1), transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: -1;
}

.fin-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #7c3aed 0%, #a78bfa 100%);
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 0 0 var(--r) var(--r);
}

.fin-card:hover {
  transform: translateY(-6px) scale(1.04);
  box-shadow:
    0 16px 32px -8px rgba(124, 58, 237, 0.28),
    0 8px 16px -4px rgba(15, 23, 42, 0.08);
  border-color: var(--primary-subtle);
}

.fin-card:hover::before { opacity: 1; }
.fin-card:hover::after { transform: scaleX(1); }

.fin-card h4 {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  transition: color 0.3s ease;
}
.fin-card:hover h4 { color: var(--primary); }

.fin-card p {
  font-size: 18px;
  font-weight: 800;
  transition: transform 0.3s ease, color 0.3s ease;
}
.fin-card:hover p { transform: scale(1.06); }

.fin-card.success { border-color: var(--success); }
.fin-card.success p { color: var(--success); }
.fin-card.success::after { background: linear-gradient(90deg, #10b981 0%, #34d399 100%); }
.fin-card.success:hover {
  box-shadow: 0 16px 32px -8px rgba(16, 185, 129, 0.3), 0 8px 16px -4px rgba(15, 23, 42, 0.08);
  border-color: var(--success);
}
.fin-card.success:hover h4 { color: var(--success); }

.fin-card.warning { border-color: var(--warning); }
.fin-card.warning p { color: var(--warning); }
.fin-card.warning::after { background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%); }
.fin-card.warning:hover {
  box-shadow: 0 16px 32px -8px rgba(245, 158, 11, 0.3), 0 8px 16px -4px rgba(15, 23, 42, 0.08);
}
.fin-card.warning:hover h4 { color: var(--warning); }

.fin-card.danger { border-color: var(--danger); }
.fin-card.danger p { color: var(--danger); }
.fin-card.danger::after { background: linear-gradient(90deg, #ef4444 0%, #f87171 100%); }
.fin-card.danger:hover {
  box-shadow: 0 16px 32px -8px rgba(239, 68, 68, 0.3), 0 8px 16px -4px rgba(15, 23, 42, 0.08);
}
.fin-card.danger:hover h4 { color: var(--danger); }

.status-filter { display: none; }

.import-container { max-width: 700px; margin: 0 auto; }

.import-hero {
  text-align: center;
  padding: 30px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 20px;
}
.import-icon { font-size: 48px; margin-bottom: 12px; }
.import-hero h2 { font-size: 20px; margin-bottom: 8px; }
.import-hero p { color: var(--muted); font-size: 14px; }

.import-upload {
  border: 2px dashed var(--border);
  border-radius: var(--r);
  padding: 30px;
  text-align: center;
  background: var(--surface);
  transition: var(--t-fast);
  cursor: pointer;
  margin-bottom: 20px;
}
.import-upload:hover,
.import-upload.drag-active {
  border-color: var(--primary);
  background: var(--primary-light);
}
.upload-label { cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.upload-icon { font-size: 40px; }
.upload-text strong { display: block; font-size: 15px; color: var(--primary); }
.upload-text span { font-size: 13px; color: var(--muted); }

.import-preview, .import-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 24px;
  margin-bottom: 20px;
}
.import-preview h3, .import-result h3 { margin-bottom: 16px; font-size: 16px; }

.preview-stats, .result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.preview-stat, .result-item {
  background: var(--surface-2);
  padding: 16px;
  border-radius: var(--r);
  text-align: center;
}
.preview-stat .label, .result-item .label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.preview-stat .value, .result-item .value { font-size: 24px; font-weight: 800; color: var(--primary); }
.result-item.warn .value { color: var(--warning); }

.preview-actions { display: flex; gap: 10px; justify-content: center; }
.result-errors {
  background: var(--danger-light);
  padding: 14px;
  border-radius: var(--r);
  margin-top: 12px;
  font-size: 13px;
}
.result-errors ul { margin-top: 8px; padding-right: 20px; }
.result-errors li { margin-bottom: 4px; color: var(--danger); }

.import-error-box {
  background: var(--danger-light);
  border: 1.5px solid var(--danger-border);
  border-radius: var(--r);
  padding: 16px 20px;
  margin-bottom: 16px;
}

.import-error-list {
  margin: 0;
  padding-right: 22px;
  color: #991b1b;
  font-size: 13px;
  line-height: 2;
  max-height: 400px;
  overflow-y: auto;
}

.import-error-list li {
  padding: 2px 0;
  border-bottom: 1px dashed rgba(239, 68, 68, 0.2);
}

.import-error-list li:last-child { border-bottom: none; }

.settings-full {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 32px 36px;
  box-shadow: var(--shadow-sm);
}

.settings-full h2 {
  font-size: 22px;
  margin-bottom: 24px;
  color: var(--primary);
  padding-bottom: 14px;
  border-bottom: 2px solid var(--primary-light);
  font-weight: 800;
}

.settings-section {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px 24px;
  margin-bottom: 20px;
}

.settings-section h3 {
  font-size: 15px;
  margin-bottom: 16px;
  color: var(--text);
  font-weight: 700;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}

.settings-save-btn {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  margin: 8px 0 20px;
  border-radius: var(--r);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 28px;
  width: 100%;
  max-width: 680px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-content h2 { font-size: 18px; margin-bottom: 20px; color: var(--primary); }

.close {
  position: absolute;
  top: 16px;
  left: 16px;
  font-size: 24px;
  cursor: pointer;
  color: var(--muted);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--t-fast);
}
.close:hover { background: var(--surface-2); color: var(--danger); }

.projects-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 8px;
}

.inv-select-all {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 8px;
  background: var(--primary-light);
  border: 1px solid var(--primary-subtle);
  border-radius: var(--r);
  cursor: pointer;
  font-weight: 700;
  color: var(--primary);
  transition: var(--t-fast);
  user-select: none;
}

.inv-select-all:hover { background: var(--primary-subtle); }

.inv-select-all input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
  flex-shrink: 0;
}

#modal.win-style-modal .modal-content {
  background: transparent;
  padding: 0;
  max-width: 780px;
  width: 100%;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: none;
  border-radius: 0;
  animation: none;
}

#modal.win-style-modal .modal-content > .close { display: none; }

.win-dialog {
  background: var(--surface-3);
  border-radius: var(--r-lg);
  box-shadow:
    0 24px 60px rgba(15, 23, 42, 0.35),
    0 4px 12px rgba(15, 23, 42, 0.15),
    0 0 0 1px var(--primary-subtle);
  overflow: hidden;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  direction: rtl;
  animation: winDialogIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  width: 100%;
}

@keyframes winDialogIn {
  from { opacity: 0; transform: scale(0.96) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.win-titlebar {
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 60%, #4338ca 100%);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  min-height: 52px;
  box-shadow: 0 2px 8px rgba(76, 29, 149, 0.25);
}

.win-titlebar-left { display: flex; align-items: center; gap: 10px; }
.win-title-icon { font-size: 22px; line-height: 1; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.25)); }
.win-title {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
  letter-spacing: 0.2px;
}

.win-close-btn {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: var(--r);
  color: #ffffff;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: var(--t-fast);
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  min-width: auto;
  box-shadow: none;
}

.win-close-btn:hover { background: #ef4444; transform: scale(1.05); }

.win-body { padding: 26px 32px 20px; background: var(--surface); }

.win-row { display: flex; align-items: center; margin-bottom: 16px; gap: 14px; }
.win-row-top { align-items: flex-start; }
.win-row-top .win-label { padding-top: 10px; }

.win-label {
  font-size: 13.5px;
  color: var(--text-2);
  min-width: 140px;
  text-align: right;
  white-space: nowrap;
  font-weight: 600;
  flex-shrink: 0;
  line-height: 1.5;
}

.win-label.required::after { content: ' *'; color: #dc2626; font-weight: 700; }

.win-input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  font-size: 14px;
  border-radius: var(--r);
  height: 42px;
  color: var(--text);
  min-width: 0;
  transition: var(--t-fast);
  font-weight: 500;
}

.win-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--primary-light);
}
.win-input[readonly] {
  background: var(--surface-3);
  color: var(--muted);
  cursor: not-allowed;
  border-color: var(--border);
}

textarea.win-input {
  height: auto;
  min-height: 80px;
  resize: vertical;
  padding: 10px 14px;
  line-height: 1.7;
}

select.win-input {
  cursor: pointer;
  padding: 10px 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  background-size: 10px;
  appearance: none;
  -webkit-appearance: none;
  padding-left: 32px;
}

.win-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
  min-width: 32px;
  text-align: center;
  user-select: none;
  opacity: 0.85;
}

.win-actions {
  background: var(--surface-2);
  padding: 16px 32px 22px;
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.win-btn {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 11px 20px;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  font-size: 14px;
  color: var(--text-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 150px;
  transition: var(--t-fast);
  font-weight: 600;
  line-height: 1.4;
  box-shadow: var(--shadow-xs);
}

.win-btn:hover {
  border-color: var(--border-2);
  background: var(--surface-2);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.win-btn-icon { font-size: 16px; line-height: 1; }

.win-btn-save {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: transparent;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
.win-btn-save:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  border-color: transparent;
  color: #ffffff;
}

.win-btn-close {
  color: #b91c1c;
  background: var(--danger-soft);
  border-color: var(--danger-border);
}
.win-btn-close:hover {
  background: var(--danger-border);
  border-color: #fca5a5;
  color: #991b1b;
}

.win-btn-delete {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border-color: transparent;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}
.win-btn-delete:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  border-color: transparent;
  color: #ffffff;
}

.calc-modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 800px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalIn 0.25s ease;
}

.calc-header {
  background: var(--primary-light);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.calc-header h3 {
  margin: 0;
  color: var(--primary);
  font-size: 16px;
  font-weight: 700;
}

.calc-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  transition: var(--t-fast);
}
.calc-close:hover { background: var(--danger-light); color: var(--danger); }

.calc-body { padding: 24px; }

.calc-footer {
  background: var(--surface-2);
  padding: 16px 24px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

.selected-customer-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  padding: 6px 8px 6px 10px;
  border-radius: var(--r-md);
  font-size: 12px;
  font-weight: 700;
  white-space: normal;
  max-width: 320px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
  animation: chipIn 0.3s ease;
  text-align: right;
}

@keyframes chipIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.selected-customer-chip-text {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  overflow: hidden;
  line-height: 1.35;
  text-align: right;
  flex: 1;
  min-width: 0;
}

.selected-customer-chip-text .chip-name {
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.selected-customer-chip-text .chip-address {
  font-size: 10.5px;
  font-weight: 500;
  opacity: 0.95;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.selected-customer-chip button {
  background: rgba(255, 255, 255, 0.25);
  border: none;
  color: #fff;
  padding: 0;
  font-size: 12px;
  cursor: pointer;
  min-width: 20px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--t-fast);
  box-shadow: none;
  flex-shrink: 0;
}

.selected-customer-chip button:hover {
  background: rgba(255, 255, 255, 0.45);
  transform: scale(1.1);
  color: #fff;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: var(--surface);
  padding: 12px 24px;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  transition: var(--t);
  pointer-events: none;
  box-shadow: var(--shadow-lg);
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); color: #fff; }

/* ================================================================
   واکنش‌گرا — موبایل
   ================================================================ */
@media (max-width: 1024px) {
  .grid4 { grid-template-columns: 1fr 1fr; }
  .recent-grid { grid-template-columns: 1fr; }
}

/* ================================================================
   ✅ موبایل — سایدبار فقط آیکون، ثابت، بدون دکمه باز/بسته
   ================================================================ */
@media (max-width: 768px) {
  /* سایدبار همیشه به صورت آیکون‌-only */
  .sidebar {
    width: 68px !important;
    transform: translateX(0) !important;
    visibility: visible !important;
    pointer-events: auto !important;
    box-shadow: none !important;
    border-left: 1px solid var(--border);
    border-radius: 0;
    transition: none !important;
  }

  /* مخفی کردن متن‌ها */
  .sidebar .brand-text,
  .sidebar .nav-text,
  .sidebar .sidebar-footer .designer-label,
  .sidebar .sidebar-footer .designer-name {
    display: none !important;
  }

  /* لوگوی کوچک */
  .sidebar .brand-logo-wrap { padding: 0; }
  .sidebar .brand-logo-img {
    max-width: 44px !important;
    max-height: 44px !important;
  }

  /* آیتم‌های منو فقط آیکون */
  .sidebar #mainNav a {
    justify-content: center !important;
    padding: 12px 0 !important;
    gap: 0 !important;
    font-size: 0 !important;
  }

  .sidebar #mainNav a .nav-icon {
    font-size: 22px !important;
    width: auto !important;
    text-align: center;
  }

  .sidebar #mainNav a::after {
    height: 2px;
  }

  /* زیرمنو */
  .sidebar .submenu-group {
    margin: 2px 0 !important;
    padding-right: 0 !important;
    border-right: none !important;
  }

  .sidebar .submenu-group a {
    justify-content: center !important;
    padding: 10px 0 !important;
    gap: 0 !important;
    font-size: 0 !important;
  }

  .sidebar .submenu-group a .nav-icon {
    font-size: 19px !important;
    min-width: auto !important;
  }

  /* فوتر */
  .sidebar .sidebar-footer {
    padding: 10px 4px 12px !important;
  }

  .sidebar .sidebar-footer .designer-phone {
    font-size: 0 !important;
    padding: 8px 0 !important;
    width: 100% !important;
    background: transparent !important;
    border: none !important;
  }

  .sidebar .sidebar-footer .designer-phone::before {
    content: '📞';
    font-size: 20px;
    display: block;
    line-height: 1;
  }

  /* محتوا */
  .main {
    margin-right: 68px !important;
  }

  /* مخفی کردن دکمه همبرگر روی موبایل */
  .header-left > .icon-btn {
    display: none !important;
  }

  /* مخفی کردن overlay */
  .sidebar-overlay {
    display: none !important;
  }

  /* سایر تنظیمات واکنش‌گرا */
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search { max-width: 100%; }
  .report-tabs { width: 100%; overflow-x: auto; }
  .report-filters { flex-direction: column; align-items: stretch; }
  .preview-stats, .result-grid { grid-template-columns: 1fr; }
  header { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
  .header-actions { flex-wrap: wrap; }
  .header-clock { display: none; }
  .date-wrapper { max-width: 100%; }
  .date-input { width: 100% !important; max-width: 100% !important; flex: 1; }
  .chart-box { height: 320px; }
  #customersTableWrapper, #projectsTableWrapper { max-height: calc(100vh - 380px); }
  .login-box { padding: 32px 24px; }
  .sidebar-tooltip { display: none !important; }
  .selected-customer-chip { max-width: 200px; font-size: 11px; padding: 4px 6px; }
  .selected-customer-chip-text .chip-address { font-size: 9.5px; }
  .settings-full { padding: 20px 16px; }
  .settings-section { padding: 16px; }
  .calc-modal { max-width: 100%; border-radius: 0; }
  .calc-body { padding: 16px; }
  .calc-footer { flex-direction: column; }
  .calc-footer button { width: 100%; justify-content: center; }
  .win-body { padding: 20px 18px 16px; }
  .win-actions {
    padding: 14px 18px 18px;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
  }
  .win-btn { width: 100%; justify-content: center; }
  .win-row { flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
  .win-label { min-width: 100%; margin-bottom: 4px; font-size: 13px; }
  .win-icon { display: none; }
  .win-input { width: 100%; height: 44px; }
  .win-title { font-size: 14px; }
  .card:hover, .fin-card:hover { transform: translateY(-3px) scale(1.01); }
  #mainNav a:hover { transform: translateY(-1px) scale(1.01); }
  .submenu-group a { font-size: 13.5px !important; }
}

@media (max-width: 480px) {
  .chart-box { height: 280px; }
  .login-box { padding: 28px 20px; }
  .login-box h1 { font-size: 22px; }
}

/* ================================================================
   زیرمنوهای غیرفعال (بدون انتخاب مشتری)
   ================================================================ */
#mainNav a.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.8);
}

#mainNav a.disabled::after {
  transform: scaleX(0) !important;
}

#mainNav a.disabled:hover {
  background-color: transparent !important;
  color: var(--muted) !important;
  transform: none !important;
  box-shadow: none !important;
}

#mainNav a.disabled:hover .nav-icon {
  transform: none !important;
}

#mainNav a.disabled::before {
  opacity: 0 !important;
}

/* موبایل */
@media (max-width: 768px) {
  #mainNav a.disabled {
    opacity: 0.3;
  }
}