/* =====================================================
   اتحادیه نجف‌آباد - نسخه ۲
   Mobile-First + Light / Dark Mode
   ===================================================== */

:root {
  /* رنگ‌های اصلی - حالت روشن */
  --primary: #1a56db;
  --primary-hover: #1e40af;
  --primary-light: #dbeafe;
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  --info: #0284c7;

  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-header: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.05);

  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-width: 280px;
  --header-height: 64px;
  --font: 'Vazirmatn', 'Tahoma', system-ui, sans-serif;
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: #1e3a5f;
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-sidebar: #1e293b;
  --bg-header: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
  --shadow: 0 1px 3px rgba(0,0,0,.3);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.4);
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font-family: inherit; font-size: 1rem; }
ul { list-style: none; }

/* Typography */
h1,h2,h3,h4 { font-weight: 700; line-height: 1.3; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }

/* ===== Layout ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.3s ease, background var(--transition);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.sidebar.open { transform: translateX(0); }

.sidebar-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.sidebar-header img,
.sidebar-header .sidebar-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--border);
  background: var(--bg);
}
.sidebar-avatar-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.25;
  flex-shrink: 0;
}
.sidebar-header .title-multiline {
  font-weight: 700;
  font-size: 0.82rem;
  line-height: 1.45;
  display: block;
}
.sidebar-header .title { font-weight: 700; font-size: 0.95rem; line-height: 1.3; }
.sidebar-header .date { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 1rem 0.75rem; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 500;
  margin-bottom: 0.25rem;
  transition: all var(--transition);
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: var(--primary-light);
  color: var(--primary);
}
.sidebar-nav a svg { width: 20px; height: 20px; flex-shrink: 0; opacity: 0.8; }

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}
.sidebar-footer .user-name { font-weight: 600; color: var(--text); margin-bottom: 0.5rem; }

/* Overlay موبایل */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}
.sidebar-overlay.active { opacity: 1; visibility: visible; }

/* Main content */
.main-content {
  flex: 1;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.top-header {
  height: var(--header-height);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background var(--transition);
}
.header-right { display: flex; align-items: center; gap: 0.75rem; }
.header-left { display: flex; align-items: center; gap: 0.5rem; }

.menu-toggle {
  width: 40px; height: 40px;
  border: none; background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text);
}
.menu-toggle:hover { background: var(--border); }

.theme-toggle {
  width: 40px; height: 40px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text);
  transition: all var(--transition);
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }

.page-title { font-size: 1.1rem; font-weight: 700; }

/* Content area */
.content-area {
  flex: 1;
  padding: 1.25rem 1rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  transition: background var(--transition), border-color var(--transition);
}
.card + .card { margin-top: 1rem; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* Forms */
.form-group { margin-bottom: 1.1rem; }
.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  color: var(--text);
}
.form-control {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.form-control::placeholder { color: var(--text-muted); }

/* Alerts */
.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.95rem;
}
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.alert-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
[data-theme="dark"] .alert-error { background: #450a0a; color: #fca5a5; border-color: #7f1d1d; }
[data-theme="dark"] .alert-success { background: #064e3b; color: #6ee7b7; border-color: #065f46; }
[data-theme="dark"] .alert-info { background: #1e3a5f; color: #93c5fd; border-color: #1e40af; }

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }

/* ===== Landing Page ===== */
.landing-body { background: var(--bg); }
.landing-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.landing-datetime { font-size: 0.9rem; color: var(--text-muted); }
.landing-datetime .time { font-weight: 700; color: var(--text); font-size: 1.05rem; }

.hero {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
}
.hero img { max-width: 280px; margin: 0 auto 1.25rem; }
.hero h1 { font-size: 1.35rem; margin-bottom: 0.5rem; }
.hero p { color: var(--text-muted); font-size: 0.95rem; }

.grid-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 0 1rem 2.5rem;
  max-width: 1000px;
  margin: 0 auto;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: var(--shadow);
}
.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}
.feature-card .icon {
  width: 48px; height: 48px;
  margin: 0 auto 0.85rem;
  background: var(--primary-light);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
}
.feature-card h3 { font-size: 1.05rem; margin-bottom: 0.35rem; }
.feature-card p { font-size: 0.85rem; color: var(--text-muted); }

.landing-footer {
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ===== Login Page ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--bg);
}
.login-box {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}
.login-box .logo-area {
  text-align: center;
  padding: 2rem 1.5rem 1rem;
}
.login-box .logo-area img { width: 90px; margin: 0 auto 1rem; }
.login-box .logo-area h1 { font-size: 1.15rem; }

.login-tabs {
  display: flex;
  margin: 0 1.5rem;
  border-bottom: 2px solid var(--border);
}
.login-tabs button {
  flex: 1;
  padding: 0.85rem;
  border: none;
  background: none;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: color var(--transition);
}
.login-tabs button.active { color: var(--primary); }
.login-tabs button.active::after {
  content: '';
  position: absolute;
  bottom: -2px; right: 0; left: 0;
  height: 2px;
  background: var(--primary);
}

.login-form { padding: 1.5rem; }
.login-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.9rem;
}

/* ===== Responsive ===== */
@media (min-width: 640px) {
  .grid-cards { grid-template-columns: repeat(2, 1fr); }
  .hero img { max-width: 340px; }
  .hero h1 { font-size: 1.5rem; }
}

@media (min-width: 768px) {
  .content-area { padding: 1.75rem 1.5rem; }
  .grid-cards { grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
}

@media (min-width: 992px) {
  .sidebar {
    transform: translateX(0);
    position: fixed;
    right: 0;
    left: auto;
  }
  .sidebar-overlay { display: none !important; }
  .menu-toggle { display: none; }
  .app-layout { display: block; }
  .main-content {
    margin-right: var(--sidebar-width);
    margin-left: 0;
    width: auto;
  }
  .grid-cards { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1200px) {
  .grid-cards { grid-template-columns: repeat(4, 1fr); }
}

/* Utility */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.d-flex { display: flex; }
.gap-2 { gap: 0.75rem; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ===== ID Card (کارت شناسایی) ===== */
.id-card-wrapper {
  display: flex;
  justify-content: center;
  padding: 1.5rem 0;
  overflow-x: auto;
}

.id-card {
  position: relative;
  width: 340px;
  height: 215px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
  color: #fff;
  flex-shrink: 0;
}

.id-card-bg {
  position: absolute;
  inset: 0;
  opacity: 0.25;
}
.id-card-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.id-card-photo {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 88px;
  height: 110px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.7);
  background: #334155;
  z-index: 2;
}
.id-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 0.75rem;
  color: #94a3b8;
}

.id-card-details {
  position: absolute;
  top: 18px;
  left: 16px;
  right: 120px;
  z-index: 2;
  font-size: 0.78rem;
  line-height: 1.7;
}
.id-card-name {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: #fbbf24;
}
.id-card-details .label {
  color: #94a3b8;
  margin-left: 0.25rem;
}
.id-card-skills {
  margin-top: 0.35rem;
  font-size: 0.72rem;
}

.card-actions-top {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
}
.btn-success {
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  transition: background var(--transition);
}
.btn-success:hover { background: #047857; }
.btn-success:disabled { opacity: 0.6; cursor: not-allowed; }

@media (max-width: 400px) {
  .id-card {
    width: 300px;
    height: 190px;
  }
  .id-card-photo {
    width: 72px;
    height: 92px;
  }
  .id-card-details {
    right: 100px;
    font-size: 0.7rem;
  }
  .id-card-name { font-size: 0.95rem; }
}

/* ===== Tables & Discount ===== */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.data-table th,
.data-table td {
  padding: 0.75rem 0.85rem;
  text-align: right;
  border-bottom: 1px solid var(--border);
}
.data-table th {
  background: var(--bg);
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.data-table tbody tr:hover {
  background: var(--primary-light);
}

/* جدول کارت‌محور در موبایل */
@media (max-width: 640px) {
  .table-responsive { overflow-x: visible; }
  .data-table { font-size: 0.9rem; }
  .data-table thead {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
  }
  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td { display: block; width: 100%; }
  .data-table tr {
    margin-bottom: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.35rem 0.85rem;
    background: var(--bg-card);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  }
  .data-table tbody tr:hover { background: var(--bg-card); }
  .data-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    text-align: left;
    padding: 0.55rem 0;
    border-bottom: 1px dashed var(--border);
    white-space: normal;
  }
  .data-table td:last-child { border-bottom: none; }
  .data-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
    text-align: right;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .data-table td:not([data-label])::before { content: ''; }
}
.discount-box {
  padding: 1rem;
  margin-bottom: 1rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.alert-success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}
[data-theme="dark"] .alert-success {
  background: #064e3b;
  color: #a7f3d0;
  border-color: #059669;
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  transition: all var(--transition);
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #e0f2fe; color: #075985; }
.badge-muted   { background: #f1f5f9; color: #64748b; }
[data-theme="dark"] .badge-success { background: #064e3b; color: #a7f3d0; }
[data-theme="dark"] .badge-warning { background: #78350f; color: #fde68a; }
[data-theme="dark"] .badge-info    { background: #0c4a6e; color: #bae6fd; }
[data-theme="dark"] .badge-muted   { background: #334155; color: #94a3b8; }

/* ===== Landing (صفحه اصلی شبیه نسخه قدیم) ===== */
.landing-body {
  background: var(--bg);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}
.background-imagebk {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.08;
  pointer-events: none;
  z-index: 0;
}
.top-landing-header {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.25rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.header-datetime { text-align: right; }
.header-date { font-size: 0.9rem; color: var(--text-muted); }
.header-time { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.header-actions { display: flex; align-items: center; gap: 0.6rem; }
.admin-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  background: var(--primary);
  color: #fff !important;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background var(--transition);
}
.admin-login-btn:hover { background: var(--primary-hover); color: #fff !important; }

.hero-header {
  position: relative;
  z-index: 5;
  text-align: center;
  padding: 1.5rem 1rem 0.5rem;
}
.hero-header img {
  max-width: min(520px, 90vw);
  margin: 0 auto;
  height: auto;
}

.grid-container {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 1.25rem;
  max-width: 1100px;
  margin: 0 auto;
}
.landing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.1rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  text-align: center;
}
.landing-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.landing-card .card-icon {
  width: 52px; height: 52px;
  margin: 0 auto 0.75rem;
  border-radius: 14px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.landing-card h3 {
  font-size: 1rem;
  margin-bottom: 0.35rem;
  color: var(--text);
}
.landing-card p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.bottom-image {
  position: relative;
  z-index: 5;
  max-width: 900px;
  margin: 1rem auto 2rem;
  padding: 0 1rem;
}
.bottom-image img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.landing-footer {
  position: relative;
  z-index: 5;
  text-align: center;
  padding: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}

@media (min-width: 640px) {
  .grid-container { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .grid-container { grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
}

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: auto;
  padding: 0.5rem;
}
.modal-content img { max-width: 100%; max-height: 85vh; display: block; margin: 0 auto; }
.modal-close-btn {
  position: absolute; top: 0.5rem; left: 0.75rem;
  font-size: 1.75rem; cursor: pointer; color: var(--text);
  line-height: 1; z-index: 2;
}

/* Hamburger fix */
.menu-toggle {
  display: flex !important;
  z-index: 60;
  position: relative;
}
@media (min-width: 992px) {
  .menu-toggle { display: none !important; }
}
.sidebar.open {
  transform: translateX(0) !important;
  box-shadow: -8px 0 24px rgba(0,0,0,.15);
}
.sidebar-overlay.active {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto;
}

select.form-control {
  appearance: auto;
  cursor: pointer;
}

/* ===== Contract items admin & form ===== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem 1rem;
}
@media (min-width: 640px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
}
.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1rem 0;
  font-size: 0.9rem;
}
.check-row label { display: flex; align-items: center; gap: 0.4rem; cursor: pointer; }
.section-title {
  font-size: 1.05rem;
  margin: 1.5rem 0 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}
.items-select { display: flex; flex-direction: column; gap: 0.75rem; }
.item-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  overflow: hidden;
}
.item-check {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  cursor: pointer;
  flex-wrap: wrap;
}
.item-check .item-title { font-weight: 600; flex: 1; min-width: 120px; }
.item-body {
  padding: 0 1rem 1rem;
  border-top: 1px dashed var(--border);
}
.features-box {
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
}
.info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem 1.25rem;
  padding: 0.5rem 0;
  font-size: 0.95rem;
}
@media (min-width: 640px) {
  .info-grid { grid-template-columns: 1fr 1fr; }
}
.item-form .btn-block { margin-top: 1rem; }


/* ===== Accordion categories ===== */
.accordion-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  background: var(--bg-card);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.accordion-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.9rem 1rem;
  background: linear-gradient(135deg, var(--primary-light), transparent);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  text-align: right;
}
.accordion-head:hover { filter: brightness(0.98); }
.acc-icon {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s;
  position: relative;
}
.acc-icon::before {
  content: "";
  width: 8px; height: 8px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg) translate(-1px, -1px);
}
.accordion-item:not(.open) .acc-icon { transform: rotate(-90deg); }
.accordion-item.open .acc-icon { transform: rotate(0deg); }
.acc-title { flex: 1; }
.accordion-body {
  display: none;
  padding: 0.5rem 0.75rem 0.9rem;
  border-top: 1px solid var(--border);
}
.accordion-item.open .accordion-body { display: block; }

/* ===== Visual polish ===== */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.1);
}
[data-theme="dark"] {
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: #1e3a5f;
}
.sidebar-nav a.active {
  background: var(--primary-light);
  color: var(--primary);
  box-shadow: inset 3px 0 0 var(--primary);
}
[data-theme="dark"] .sidebar-nav a.active {
  background: rgba(59, 130, 246, 0.2);
  color: var(--primary);
}
.card {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #1d4ed8);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover), #1e40af);
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.item-card {
  margin-bottom: 0.5rem;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.item-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.08);
}
.topbar, .main-header {
  backdrop-filter: blur(8px);
}
input[data-jdp] {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%2563eb' stroke-width='2'%3E%3Crect x='3' y='4' width='12' height='12' rx='2'/%3E%3Cpath d='M3 8h12M7 2v4M11 2v4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.75rem center;
  padding-left: 2.25rem;
}

.sortable-list { list-style: none; margin: 0; padding: 0; }
.sortable-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem; margin-bottom: 0.5rem;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: grab;
}
.sortable-item:active { cursor: grabbing; }
.drag-handle { color: var(--text-muted); font-size: 1.1rem; user-select: none; }
.sortable-ghost { opacity: 0.5; }
.doc-img { max-width: 100%; border-radius: var(--radius); border: 1px solid var(--border); margin-top: 0.5rem; }
.action-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }

.id-card-inner {
  width: 100%; max-width: 420px; margin: 0 auto;
  background: linear-gradient(145deg, #fff, #f1f5f9);
  border: 2px solid var(--primary);
  border-radius: 16px; padding: 1.25rem;
  box-shadow: var(--shadow-lg);
}
[data-theme="dark"] .id-card-inner { background: linear-gradient(145deg, #1e293b, #0f172a); }
.id-card-header { display:flex; gap:0.75rem; align-items:center; margin-bottom:1rem; }
.id-logo { width:48px; height:48px; border-radius:10px; }
.id-title { font-weight:700; font-size:0.95rem; }
.id-sub { font-size:0.8rem; color:var(--text-muted); }
.id-card-body { display:flex; gap:1rem; align-items:flex-start; }
.id-photo { width:96px; height:96px; object-fit:cover; border-radius:12px; border:2px solid var(--border); }
.id-info { flex:1; font-size:0.88rem; line-height:1.9; }
.id-info span { color:var(--text-muted); }
.id-card-footer { margin-top:1rem; text-align:center; font-size:0.75rem; color:var(--text-muted); border-top:1px dashed var(--border); padding-top:0.5rem; }
@media print {
  .sidebar, .top-header, .card-header .btn, .theme-toggle { display:none !important; }
}

/* کارت شناسایی — قالب نسخه قدیم */
.card-wrapper { display:flex; flex-direction:column; align-items:center; padding:1rem 0.5rem; }
.card-page {
  position: relative; width: 100%; max-width: 900px; margin: 0 auto;
  container-type: inline-size; border-radius: 10px; overflow: hidden;
}
.card-page .background-image img { display:block; width:100%; height:auto; }
.card-page .details {
  position: absolute; top: 34%; right: 8%; left: 36%;
  display: flex; flex-direction: column; justify-content: flex-start; line-height: 1.9;
  color: #111;
  max-height: none;
  overflow: visible;
}
.card-page .details .card-name { font-weight: 700; font-size: 4.2cqw; margin-bottom: 4px; }
.card-page .details p { font-size: 3.1cqw; margin: 0; }
.card-page .details .card-label { font-weight: 700; font-size: 3.1cqw; }
.card-page .details .card-skills-label { font-weight: 700; font-size: 2.7cqw; display: block; }
.card-page .details .card-skills-line { font-size: 3.6cqw; }
.card-page .personal-image {
  position: absolute; top: 5%; left: 8%; width: 22%; aspect-ratio: 3/4;
  border-radius: 8px; overflow: hidden;
}
.card-page .personal-image img {
  width: 100%; height: 100%; object-fit: cover; object-position: center; display: block;
}
.card-actions { display:flex; gap:12px; width:100%; max-width:900px; margin-top:1rem; }

/* مهر و امضا و نام رئیس — پایین سمت چپ */
.card-page .card-union-footer {
  position: absolute;
  bottom: 7%;
  left: 4%;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 32%;
  max-width: 32%;
  pointer-events: none;
}
.card-page .card-union-footer .pres-imgs {
  order: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 20cqw;
  margin-bottom: 2px;
}
.card-page .card-union-footer .pres-title {
  order: 2;
  display: block;
  font-size: 2cqw;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.25;
  margin: 2px 0 0;
  white-space: nowrap;
}
.card-page .card-union-footer .pres-name {
  order: 3;
  font-size: 2.2cqw;
  font-weight: 700;
  color: #1a1a1a;
  margin-top: 1px;
  line-height: 1.3;
  white-space: nowrap;
  max-width: 100%;
}
/* مهر و امضا بزرگ‌تر با همپوشانی بیشتر */
.card-page .card-union-footer .pres-imgs img.stamp-img {
  position: absolute;
  left: 0%;
  bottom: 0;
  max-height: 18cqw;
  max-width: 55%;
  width: auto;
  object-fit: contain;
  opacity: 0.9;
  z-index: 1;
}
.card-page .card-union-footer .pres-imgs img.signature-img {
  position: absolute;
  left: 22%;
  bottom: 0;
  max-height: 16cqw;
  max-width: 78%;
  width: auto;
  object-fit: contain;
  z-index: 2;
}
/* جزئیات متن — کمی پایین‌تر و بدون برش */
.card-page .details {
  top: 34%;
  right: 8%;
  left: 36%;
  max-height: none;
  overflow: visible;
  line-height: 1.85;
}
.card-page .personal-image {
  top: 6%;
  left: 7%;
  width: 20%;
}
@media (max-width: 640px) {
  .card-page .card-union-footer {
    bottom: 4%;
    left: 5%;
    width: 28%;
    max-width: 28%;
  }
  .card-page .card-union-footer .pres-title { font-size: 2.1cqw; }
  .card-page .card-union-footer .pres-name { font-size: 2.2cqw; }
  .card-page .card-union-footer .pres-imgs { height: 18cqw; }
  .card-page .details {
    top: 32%;
    right: 5%;
    left: 38%;
    line-height: 1.7;
    max-height: none;
    overflow: visible;
  }
  .card-page .card-union-footer .pres-imgs { height: 20cqw; }
  .card-page .card-union-footer .pres-imgs img.signature-img { max-height: 15cqw; max-width: 75%; }
  .card-page .card-union-footer .pres-imgs img.stamp-img { max-height: 17cqw; }
  .card-page .card-union-footer .pres-name { font-size: 2.4cqw; }
}



/* Flash popup */
.flash-popup-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(15,23,42,0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem; backdrop-filter: blur(2px);
  transition: opacity 0.2s;
}
.flash-popup-overlay.hide { opacity: 0; pointer-events: none; }
.flash-popup-box {
  background: var(--bg-card, #fff);
  color: var(--text, #111);
  border-radius: 16px;
  padding: 1.25rem 1.35rem;
  max-width: 420px; width: 100%;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  text-align: center;
}
.flash-popup-item { font-size: 0.98rem; line-height: 1.7; margin: 0.35rem 0; }
.flash-success { color: var(--success, #059669); font-weight: 600; }
.flash-error { color: var(--danger, #dc2626); font-weight: 600; }
.flash-warning { color: var(--warning, #d97706); font-weight: 600; }
.flash-info { color: var(--primary, #2563eb); font-weight: 600; }
.badge-muted { background: #e5e7eb; color: #4b5563; }

/* کارت شناسایی — موبایل بهینه */
@media (max-width: 640px) {
  .card-wrapper {
    padding: 0.35rem 0.15rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .card-page {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    border-radius: 10px;
    /* نسبت کارت حفظ شود */
  }
  .card-page .details {
    top: 32% !important;
    right: 5% !important;
    left: 36% !important;
    line-height: 1.55 !important;
    max-height: none !important;
    overflow: visible !important;
  }
  .card-page .details .card-name { font-size: 4.5cqw !important; }
  .card-page .details p { font-size: 3.2cqw !important; }
  .card-page .details .card-label { font-size: 3.2cqw !important; }
  .card-page .personal-image {
    top: 5% !important;
    left: 5% !important;
    width: 22% !important;
  }
  .card-page .card-union-footer {
    bottom: 6% !important;
    left: 3% !important;
    width: 34% !important;
    max-width: 34% !important;
  }
  .card-page .card-union-footer .pres-imgs {
    height: 18cqw !important;
  }
  .card-page .card-union-footer .pres-imgs img.stamp-img {
    max-height: 16cqw !important;
    max-width: 52% !important;
  }
  .card-page .card-union-footer .pres-imgs img.signature-img {
    max-height: 14cqw !important;
    max-width: 75% !important;
    left: 20% !important;
  }
  .card-page .card-union-footer .pres-title { font-size: 2.3cqw !important; }
  .card-page .card-union-footer .pres-name { font-size: 2.5cqw !important; }
  .card-actions {
    flex-direction: column;
    width: 100%;
    max-width: 100%;
  }
  .card-actions .btn { width: 100%; }
  .card-mobile-hint { font-size: 0.8rem; }
}

/* داشبورد سوپر — موبایل */
@media (max-width: 768px) {
  .super-dash {
    position: static !important;
    padding: 0.5rem !important;
  }
  .super-dash .super-dash-charts {
    grid-template-columns: 1fr !important;
  }
  .super-dash .super-dash-charts > div {
    height: 140px !important;
  }
  .super-dash .super-dash-badges {
    gap: 0.3rem !important;
  }
  .filter-bar {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .filter-bar .form-control {
    max-width: 100% !important;
    width: 100% !important;
  }
  .data-table {
    font-size: 0.82rem;
  }
  .data-table th, .data-table td {
    padding: 0.4rem 0.35rem;
    white-space: nowrap;
  }
}


/* === Mobile overrides (final) === */
@media (max-width: 640px) {
  .card-wrapper { padding: 0.25rem; width: 100%; }
  .card-page { width: 100% !important; max-width: 100% !important; }
  .card-page .details {
    top: 31% !important; right: 4% !important; left: 35% !important;
    line-height: 1.5 !important; overflow: visible !important;
  }
  .card-page .personal-image { width: 24% !important; left: 4% !important; top: 5% !important; }
  .card-page .card-union-footer {
    bottom: 5.5% !important; left: 2% !important; width: 36% !important; max-width: 36% !important;
  }
  .card-actions { flex-direction: column; width: 100%; }
  .card-actions .btn { width: 100%; }
}
@media (max-width: 768px) {
  .super-dash { position: static !important; }
  .super-dash-charts { grid-template-columns: 1fr !important; display: grid !important; }
  .super-dash-charts > div { height: 150px !important; }
  .filter-bar { flex-direction: column !important; align-items: stretch !important; }
  .filter-bar .form-control, .filter-bar select, .filter-bar input { max-width: 100% !important; width: 100% !important; }
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}


/* انیمیشن انتخاب کارت ایندکس */
.landing-card {
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.35s ease, border-color 0.35s ease;
  border-width: 1.5px;
  border-style: solid;
}
.landing-card.card-pulse {
  transform: scale(1.03);
  box-shadow: 0 12px 28px rgba(26, 86, 219, 0.22);
}
.landing-card .card-icon {
  transition: background 0.35s ease, color 0.35s ease;
}
.landing-modal {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(15,23,42,0.45);
  display: none; align-items: center; justify-content: center;
  padding: 1rem; backdrop-filter: blur(2px);
}
.landing-modal-box {
  background: var(--bg-card, #fff);
  border-radius: 16px;
  padding: 1.35rem 1.25rem;
  max-width: 360px; width: 100%;
  position: relative;
  box-shadow: 0 16px 40px rgba(0,0,0,0.2);
  text-align: center;
}
.landing-modal-box h3 { margin: 0 0 1rem; }
.landing-modal-close {
  position: absolute; top: 0.45rem; left: 0.55rem;
  border: none; background: transparent; font-size: 1.4rem; cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}


/* زنگ اعلان آتلیه */
.header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  position: relative;
}
.notif-bell-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: inline-block;
}
.notif-bell-btn {
  position: relative;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  box-sizing: border-box;
  flex-shrink: 0;
}
.notif-bell-btn:hover { border-color: var(--primary); color: var(--primary); }
.notif-badge {
  position: absolute;
  top: -4px;
  left: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
  z-index: 2;
}
/* پنل اعلان وسط ناحیه ورکر (main-content) */
.notif-dropdown {
  position: fixed;
  top: 50%;
  left: 50%;
  right: auto;
  width: min(440px, calc(100vw - 32px));
  max-width: min(440px, calc(100vw - 32px));
  max-height: min(70vh, 480px);
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.22);
  z-index: 3000;
  text-align: right;
  display: none;
  transform: translate(-50%, -50%);
  box-sizing: border-box;
}
@media (min-width: 992px) {
  /* کمی به سمت محتوای اصلی (نه زیر سایدبار) */
  [dir="rtl"] .notif-dropdown {
    left: calc(50% - 120px);
  }
  [dir="ltr"] .notif-dropdown {
    left: calc(50% + 120px);
  }
}
.notif-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 2990;
  display: none;
}
.notif-backdrop.is-open { display: block; }
.notif-dropdown.is-open {
  display: block;
}
.notif-dropdown-head {
  padding: 0.65rem 0.85rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.notif-empty { padding: 1rem; color: var(--text-muted); font-size: 0.9rem; }
.notif-list { list-style: none; margin: 0; padding: 0; width: 100%; max-width: 100%; }
.notif-list li {
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  box-sizing: border-box;
}
.notif-list li.is-unread { background: var(--primary-light, #dbeafe); }
.notif-list li p {
  margin: 0.25rem 0;
  color: var(--text);
  line-height: 1.55;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  max-width: 100%;
}
.notif-list li small { color: var(--text-muted); display: block; }
.notif-list li strong {
  display: block;
  margin-bottom: 0.15rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.header-left {
  overflow: visible;
  max-width: 100%;
}
.app-header, .content-header {
  overflow-x: clip;
}

.header-logout-btn { white-space: nowrap; padding: 0.35rem 0.7rem; font-size: 0.85rem; }

@media (max-width: 768px) {
  .complaint-money-row {
    grid-template-columns: 1fr !important;
  }
}
