/* ==========================================================================
   نمایشگر اکسل — سیستم طراحی حرفه‌ای نسخه ۲
   پالت: Indigo + Slate | تم روشن و تاریک | RTL | فونت وزیرمتن
   ========================================================================== */

/* ---------- فونت وزیرمتن (لوکال) ---------- */
@font-face { font-family: 'Vazirmatn'; src: url('fonts/Vazirmatn-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('fonts/Vazirmatn-Medium.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('fonts/Vazirmatn-SemiBold.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('fonts/Vazirmatn-Bold.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('fonts/Vazirmatn-ExtraBold.woff2') format('woff2'); font-weight: 800; font-style: normal; font-display: swap; }

/* ---------- توکن‌های طراحی ---------- */
:root {
  --font: 'Vazirmatn', Tahoma, 'Segoe UI', sans-serif;

  --bg:            #f6f8f7;
  --bg-grad:       radial-gradient(1100px 500px at 85% -10%, rgba(15,157,88,.07), transparent 60%),
                   radial-gradient(900px 420px at 0% 110%, rgba(2,136,209,.05), transparent 55%);
  --card:          #ffffff;
  --card-2:        #f8fafc;
  --text:          #0f172a;
  --text-2:        #334155;
  --muted:         #64748b;
  --faint:         #94a3b8;
  --line:          #e2e8f0;
  --line-2:        #eef2f7;

  --primary:       #188038;
  --primary-2:     #0d652d;
  --primary-soft:  #e6f4ea;
  --primary-softer:#f0f8f2;
  --ring:          rgba(24,128,56,.16);

  --success:       #059669;
  --success-soft:  #ecfdf5;
  --danger:        #dc2626;
  --danger-soft:   #fef2f2;
  --warn:          #d97706;
  --warn-soft:     #fffbeb;
  --info:          #0284c7;
  --info-soft:     #f0f9ff;

  --sidebar-bg:    #101731;
  --sidebar-bg-2:  #0c1024;
  --sidebar-text:  #9aa6c3;
  --sidebar-line:  rgba(148,163,184,.14);

  --radius:    16px;
  --radius-md: 12px;
  --radius-sm: 9px;

  --shadow-sm: 0 1px 2px rgba(15,23,42,.05);
  --shadow:    0 1px 2px rgba(15,23,42,.04), 0 6px 20px -6px rgba(15,23,42,.08);
  --shadow-lg: 0 20px 50px -18px rgba(15,23,42,.25);
  --ring-sh:   0 0 0 3px var(--ring);

  --topbar-h: 60px;
  --sidebar-w: 258px;
}

html[data-theme="dark"] {
  --bg:            #0b1120;
  --bg-grad:       radial-gradient(1100px 500px at 85% -10%, rgba(52,168,83,.10), transparent 60%),
                   radial-gradient(900px 420px at 0% 110%, rgba(20,184,166,.07), transparent 55%);
  --card:          #111a2e;
  --card-2:        #16203a;
  --text:          #e7ecf6;
  --text-2:        #c3cde0;
  --muted:         #8b97b0;
  --faint:         #64748b;
  --line:          #24304d;
  --line-2:        #1d2942;

  --primary:       #81c995;
  --primary-2:     #5bb974;
  --primary-soft:  rgba(129,201,149,.16);
  --primary-softer:rgba(129,201,149,.09);
  --ring:          rgba(129,201,149,.25);

  --success:       #34d399;
  --success-soft:  rgba(16,185,129,.14);
  --danger:        #f87171;
  --danger-soft:   rgba(239,68,68,.14);
  --warn:          #fbbf24;
  --warn-soft:     rgba(245,158,11,.13);
  --info:          #38bdf8;
  --info-soft:     rgba(14,165,233,.13);

  --sidebar-bg:    #0d1428;
  --sidebar-bg-2:  #090e1e;
  --sidebar-text:  #8fa0c2;
  --sidebar-line:  rgba(148,163,184,.12);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
  --shadow:    0 1px 2px rgba(0,0,0,.3), 0 8px 24px -8px rgba(0,0,0,.5);
  --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.65);
}

/* ---------- پایه ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  font-family: var(--font);
  font-size: 14.5px; line-height: 1.75;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body { background-image: var(--bg-grad); background-attachment: fixed; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--primary); color: #fff; }

.ic { flex: none; vertical-align: middle; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

kbd.kbd {
  font-family: var(--font); font-size: 10.5px; color: var(--muted);
  background: var(--card-2); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 6px;
}

/* ==========================================================================
   پوسته: سایدبار + محتوای اصلی
   ========================================================================== */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex: none;
  background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2));
  color: var(--sidebar-text);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: rgba(148,163,184,.25) transparent;
}
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(148,163,184,.25); border-radius: 4px; }

.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 20px 18px; color: #fff;
  border-bottom: 1px solid var(--sidebar-line);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), #0f9d58);
  color: #fff; border-radius: 12px;
  box-shadow: 0 6px 16px -4px rgba(24,128,56,.5);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.45; min-width: 0; }
.brand-text b { font-size: 14.5px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { font-size: 11px; color: var(--sidebar-text); }

.side-nav { padding: 14px 12px; flex: 1 1 auto; }
.nav-section {
  font-size: 10.5px; font-weight: 600; letter-spacing: .4px;
  color: var(--faint); text-transform: uppercase;
  padding: 14px 10px 6px;
}
.nav-section:first-child { padding-top: 2px; }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9.5px 12px; margin: 2px 0;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text); font-size: 13.5px; font-weight: 500;
  position: relative; transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(148,163,184,.1); color: #fff; text-decoration: none; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(52,168,83,.24), rgba(52,168,83,.08));
  color: #fff; font-weight: 600;
}
.nav-item.active::before {
  content: ''; position: absolute; inset-inline-start: -12px; top: 20%; bottom: 20%;
  width: 3.5px; border-radius: 4px; background: var(--primary);
}
.nav-item .ic { opacity: .85; }
.nav-item.active .ic { color: #81c995; opacity: 1; }

.side-foot {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--sidebar-line);
}
.side-user { display: flex; align-items: center; gap: 10px; }
.side-user-info { display: flex; flex-direction: column; line-height: 1.4; min-width: 0; flex: 1; }
.side-user-info b { font-size: 13px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-info small { font-size: 11px; color: var(--sidebar-text); }
.side-logout {
  color: var(--sidebar-text); width: 32px; height: 32px; flex: none;
  display: grid; place-items: center; border-radius: 8px;
  transition: background .15s, color .15s;
}
.side-logout:hover { background: rgba(248,113,113,.15); color: #f87171; text-decoration: none; }
.side-version { margin-top: 12px; font-size: 10.5px; color: var(--faint); text-align: center; }

.avatar {
  width: 38px; height: 38px; flex: none; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: linear-gradient(135deg, #34a853, #0f9d58);
  color: #fff; font-weight: 700; font-size: 15px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.18);
}
.avatar-sm { width: 30px; height: 30px; font-size: 12.5px; }

/* ---------- ناحیه اصلی ---------- */
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-2);
}
.topbar-title { font-size: 15.5px; font-weight: 700; margin: 0; color: var(--text); }
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 12px; }
.topbar-user { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-2); }
.topbar-user b { font-weight: 600; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  display: inline-grid; place-items: center;
  background: transparent; border: 1px solid var(--line);
  color: var(--text-2); cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.icon-btn:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.menu-btn { display: none; }

/* سوییچ تم */
.theme-ic-moon { display: none; }
html[data-theme="dark"] .theme-ic-sun { display: none; }
html[data-theme="dark"] .theme-ic-moon { display: inline-flex; }

.content {
  width: 100%; max-width: 1420px; margin: 0 auto;
  padding: 24px 22px 40px;
  flex: 1 1 auto;
}
.app-foot {
  text-align: center; font-size: 11.5px; color: var(--faint);
  padding: 10px 16px 18px;
}

.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 60;
  background: rgba(2,6,23,.55); backdrop-filter: blur(2px);
}

/* ==========================================================================
   اجزای صفحه
   ========================================================================== */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.page-title { font-size: 22px; font-weight: 800; margin: 0 0 3px; letter-spacing: -.2px; }
.page-sub { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.page-sub .dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); display: inline-block; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--muted); border-radius: 999px;
  padding: 3px 11px; font-size: 11.5px; font-weight: 500;
  box-shadow: var(--shadow-sm);
}
.chip .ic { color: var(--primary); }

/* ---------- کارت ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.card.narrow { max-width: 500px; }
.card > h3, .card-head h3 { margin: 0; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.card > h3 .ic, .card-head .ic { color: var(--primary); }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.card-head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 13px; }

/* ---------- کارت‌های آماری ---------- */
.cards {
  display: grid; gap: 14px; margin-bottom: 18px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
.card.stat {
  margin-bottom: 0; padding: 16px 18px;
  display: flex; flex-direction: column; gap: 2px;
  position: relative; overflow: hidden;
  transition: transform .18s, box-shadow .18s;
}
.card.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card.stat::after {
  content: ''; position: absolute; inset-inline-start: 0; top: 0; bottom: 0;
  width: 3.5px; background: var(--primary); opacity: .85;
}
.card.stat.stat-green::after { background: var(--success); }
.card.stat.stat-amber::after { background: var(--warn); }
.card.stat.stat-sky::after { background: var(--info); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.stat-ico {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
}
.stat-ico.green { background: var(--success-soft); color: var(--success); }
.stat-ico.amber { background: var(--warn-soft); color: var(--warn); }
.stat-ico.sky { background: var(--info-soft); color: var(--info); }
.stat-value {
  font-size: 24px; font-weight: 800; letter-spacing: -.3px;
  font-variant-numeric: tabular-nums; line-height: 1.4;
}
.stat-value.accent { color: var(--primary); }
.stat-extra { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.stat-extra b { color: var(--text-2); font-weight: 600; }

/* ---------- فرم‌ها ---------- */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 6px; color: var(--text-2); }
.form-hint { display: block; font-size: 11.5px; color: var(--faint); margin-top: 5px; }

input[type=text], input[type=password], select, input[type=file] {
  width: 100%; padding: 10px 13px;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; font-weight: 500;
  background: var(--card); color: var(--text);
  transition: border-color .15s, box-shadow .15s, background .15s;
  color-scheme: light dark;
}
input::placeholder { color: var(--faint); font-weight: 400; }
input:focus, select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: var(--ring-sh);
}
input[dir=ltr] { text-align: left; direction: ltr; }
.checkbox-row label { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.checkbox-row input[type=checkbox] { width: auto; accent-color: var(--primary); }

/* فیلد رمز با دکمه نمایش */
.pass-wrap { position: relative; }
.pass-wrap input { padding-inline-end: 42px; }
.pass-toggle {
  position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border: none; background: transparent; cursor: pointer;
  display: grid; place-items: center; color: var(--faint); border-radius: 7px;
}
.pass-toggle:hover { color: var(--primary); background: var(--primary-soft); }

/* ---------- دکمه‌ها ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1.5px solid transparent; border-radius: 10px; cursor: pointer;
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  padding: 9.5px 18px; transition: all .16s;
  text-decoration: none !important; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; box-shadow: 0 4px 14px -4px rgba(24,128,56,.45);
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 6px 18px -4px rgba(24,128,56,.55); }
.btn-success { background: linear-gradient(135deg, #10b981, #059669); color: #fff; box-shadow: 0 4px 14px -4px rgba(5,150,105,.45); }
.btn-success:hover { filter: brightness(1.07); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-soft:hover { background: var(--primary); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-2); border-color: var(--line); }
.btn-ghost:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ---------- نشان‌ها ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 999px; padding: 2.5px 10px;
  font-size: 11px; font-weight: 700; line-height: 1.7;
}
.badge-admin { background: var(--warn-soft); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.badge-ok { background: var(--success-soft); color: var(--success); }
.badge-off { background: var(--danger-soft); color: var(--danger); }
.badge-role { background: var(--primary-soft); color: var(--primary); }
.badge-neutral { background: var(--card-2); color: var(--muted); border: 1px solid var(--line); }

.tag {
  display: inline-block; background: var(--card-2); color: var(--text-2);
  border: 1px solid var(--line-2);
  border-radius: 999px; padding: 1.5px 10px; font-size: 11px; font-weight: 500; margin: 2px;
}
.tag.num { background: var(--primary-soft); color: var(--primary); border-color: transparent; font-weight: 600; }

/* ---------- هشدارها ---------- */
.alert {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 16px; border-radius: var(--radius-md);
  margin-bottom: 16px; font-size: 13.5px; border: 1px solid;
  line-height: 1.8;
}
.alert .ic { margin-top: 4px; flex: none; }
.alert-ok { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.alert-ok b { color: var(--success); }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-error b { color: var(--danger); }
.alert .alert-body { flex: 1; min-width: 0; }
.alert a { color: inherit; font-weight: 700; text-decoration: underline; }

/* ---------- توست ---------- */
.toast-stack {
  position: fixed; bottom: 20px; inset-inline-start: 20px; z-index: 100;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 12px 16px; font-size: 13px; font-weight: 500;
  min-width: 240px; max-width: 360px;
  animation: toast-in .25s ease both;
}
.toast .ic { color: var(--primary); }
.toast.success .ic { color: var(--success); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.toast.hide { opacity: 0; transform: translateY(8px); transition: all .25s; }

/* ---------- جستجو و فیلتر ---------- */
.search-row { position: relative; margin-bottom: 14px; }
.search-row .ic { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-start: 14px; color: var(--faint); pointer-events: none; }
.search-row input { padding-inline-start: 42px; font-size: 14.5px; padding-block: 12px; border-radius: var(--radius-md); }
.search-row input:focus { box-shadow: var(--ring-sh); }

details.filters-detail { border-top: 1px dashed var(--line); padding-top: 12px; }
details.filters-detail > summary {
  cursor: pointer; list-style: none;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  padding: 6px 12px; margin: -2px 0 2px; border-radius: 8px;
  user-select: none;
}
details.filters-detail > summary::-webkit-details-marker { display: none; }
details.filters-detail > summary:hover { background: var(--primary-softer); color: var(--primary); }
details.filters-detail > summary .caret { transition: transform .18s; display: inline-flex; }
details.filters-detail[open] > summary .caret { transform: rotate(90deg); }
.filter-count {
  background: var(--primary); color: #fff; font-size: 10.5px; font-weight: 700;
  border-radius: 999px; padding: 0 7px; line-height: 1.8;
}

.filters-grid {
  display: grid; gap: 12px; padding-top: 12px;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
}
.filter-cell label {
  display: block; font-size: 11px; font-weight: 600; color: var(--muted);
  margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.filter-cell input, .filter-cell select { padding: 7.5px 11px; font-size: 13px; }
.num-filter { display: flex; gap: 6px; }
.num-filter select { width: 62px; flex: none; padding-inline: 4px; }
.num-filter input { flex: 1; min-width: 0; }

/* ---------- جدول داده ---------- */
.table-card { padding: 0; overflow: hidden; }
.table-card > .card-head { padding: 16px 18px 0; margin-bottom: 10px; }
.table-scroll { overflow: auto; max-height: 66vh; overscroll-behavior: contain; }

.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.data-table th {
  position: sticky; top: 0; z-index: 5;
  background: var(--card-2); color: var(--muted);
  padding: 11px 14px; text-align: right;
  font-weight: 700; font-size: 11.5px; letter-spacing: .1px;
  border-bottom: 1.5px solid var(--line); white-space: nowrap;
}
.data-table th a { color: var(--text-2); display: inline-flex; align-items: center; gap: 5px; }
.data-table th a:hover { color: var(--primary); text-decoration: none; }
.data-table th .sort-ind {
  display: inline-block; width: 9px; font-size: 9px; line-height: 1;
  color: var(--primary); transform: translateY(-1px);
}
.data-table th.th-sort-asc .sort-ind::after  { content: '▲'; }
.data-table th.th-sort-desc .sort-ind::after { content: '▼'; }
.data-table th.is-num a, .data-table td.is-num { text-align: left; font-variant-numeric: tabular-nums; }
.data-table td {
  padding: 9.5px 14px; border-bottom: 1px solid var(--line-2);
  max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text-2);
}
.data-table tbody tr { transition: background .12s; }
.data-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--card-2) 55%, transparent); }
.data-table tbody tr:hover { background: var(--primary-softer); }
.data-table tbody tr:hover td { color: var(--text); }
.data-table td.rownum, .data-table th.rownum {
  color: var(--faint); font-size: 11.5px; text-align: center; width: 56px;
  font-variant-numeric: tabular-nums;
}
.no-rows { text-align: center; color: var(--muted); padding: 34px !important; }

/* ---------- صفحه‌بندی ---------- */
.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 18px; border-top: 1px solid var(--line-2); flex-wrap: wrap;
  background: color-mix(in srgb, var(--card-2) 60%, transparent);
}
.pager-info { color: var(--muted); font-size: 12px; }
.pager-links { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.pager-links a, .pager-links .current, .pager-links .dots {
  min-width: 33px; padding: 5px 9px; text-align: center;
  border-radius: 8px; font-size: 12.5px; font-weight: 500;
  font-variant-numeric: tabular-nums;
  display: inline-flex; align-items: center; justify-content: center; gap: 3px;
}
.pager-links a { background: var(--card); border: 1px solid var(--line); color: var(--text-2); }
.pager-links a:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); text-decoration: none; }
.pager-links .current {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; font-weight: 700; box-shadow: 0 3px 10px -3px rgba(24,128,56,.45);
}
.pager-links .dots { color: var(--faint); border: none; }
.pager-per { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.pager-per select { width: auto; padding: 5px 9px; font-size: 12.5px; }

/* ---------- صفحه ورود ---------- */
.login-body { min-height: 100vh; display: flex; }

.login-hero {
  flex: 1 1 52%;
  background:
    radial-gradient(800px 460px at 80% -10%, rgba(52,168,83,.30), transparent 60%),
    radial-gradient(700px 420px at 10% 110%, rgba(2,136,209,.18), transparent 55%),
    linear-gradient(160deg, #0b1f14 0%, #0d3b24 55%, #14532d 100%);
  color: #c8e6d2;
  display: none; flex-direction: column; justify-content: center;
  padding: 60px 7vw;
  position: relative; overflow: hidden;
}
.login-hero::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(148,163,184,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148,163,184,.07) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 70% 30%, #000 20%, transparent 75%);
}
.login-hero > * { position: relative; }

.login-hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(52,168,83,.16); border: 1px solid rgba(52,168,83,.38);
  color: #b7e4c7; font-size: 12px; font-weight: 600;
  border-radius: 999px; padding: 6px 14px; width: fit-content; margin-bottom: 26px;
}
.login-hero h2 { color: #fff; font-size: 27px; font-weight: 800; line-height: 1.55; margin: 0 0 12px; }
.login-hero h2 em { font-style: normal; color: #8fdfae; }
.login-hero p { font-size: 14px; margin: 0 0 34px; max-width: 400px; }

.login-features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 15px; }
.login-features li { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; }
.login-features .feat-ico {
  width: 34px; height: 34px; flex: none; border-radius: 10px;
  background: rgba(52,168,83,.16); border: 1px solid rgba(52,168,83,.32);
  display: grid; place-items: center; color: #8fdfae;
}
.login-features b { color: #ecfaf1; display: block; font-size: 13.5px; }
.login-features span { font-size: 12px; color: #8fbfa2; }

.login-pane {
  flex: 1 1 48%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 20px;
}
.login-wrap { width: 100%; max-width: 400px; }
.login-wrap.wide { max-width: 520px; }

.login-logo {
  width: 52px; height: 52px; margin: 0 auto 16px;
  display: grid; place-items: center; border-radius: 15px;
  background: linear-gradient(135deg, var(--primary), #0f9d58); color: #fff;
  box-shadow: 0 10px 26px -8px rgba(24,128,56,.55);
}
.login-title { text-align: center; font-size: 19.5px; font-weight: 800; margin: 0 0 4px; }
.login-sub { text-align: center; color: var(--muted); font-size: 12.5px; margin: 0 0 24px; }
.login-foot { text-align: center; color: var(--faint); font-size: 11.5px; margin-top: 18px; }
.login-foot .ic { vertical-align: -3px; margin-inline-end: 4px; }

.login-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: 30px 28px;
  box-shadow: var(--shadow-lg);
}

.section-title {
  font-size: 12.5px; font-weight: 700; color: var(--primary);
  margin: 22px 0 12px; padding-top: 16px;
  border-top: 1px dashed var(--line);
  display: flex; align-items: center; gap: 7px;
}

/* ---------- آپلود ---------- */
.upload-zone {
  display: block;
  border: 2px dashed var(--line);
  border-radius: var(--radius-md);
  background: var(--card-2);
  padding: 34px 20px;
  text-align: center; cursor: pointer;
  transition: border-color .18s, background .18s;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary); background: var(--primary-softer);
}
.upload-zone .up-ico {
  width: 52px; height: 52px; margin: 0 auto 12px;
  border-radius: 14px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
}
.upload-zone b { display: block; font-size: 14px; margin-bottom: 3px; }
.upload-zone small { color: var(--muted); font-size: 12px; }
.upload-zone input[type=file] { display: none; }
.upload-filechip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--primary-soft); color: var(--primary);
  border-radius: 10px; padding: 8px 14px; font-size: 13px; font-weight: 600;
  margin-top: 12px;
}

.import-progress {
  display: flex; gap: 14px; align-items: center; margin-top: 16px;
  padding: 15px 17px;
  background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 28%, transparent);
  border-radius: var(--radius-md);
}
.import-progress .spinner {
  width: 24px; height: 24px; flex: none;
  border: 3px solid color-mix(in srgb, var(--warn) 35%, transparent);
  border-top-color: var(--warn); border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- جدول اطلاعات ---------- */
.info-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.info-table th {
  text-align: right; color: var(--muted); font-weight: 600; width: 140px;
  padding: 10px 0; vertical-align: top; border-bottom: 1px dashed var(--line);
}
.info-table td { padding: 10px 0; border-bottom: 1px dashed var(--line); color: var(--text-2); }
.info-table tr:last-child th, .info-table tr:last-child td { border-bottom: none; }
.cols-cell { line-height: 2.4; }

/* ---------- حالت خالی ---------- */
.empty-state { text-align: center; padding: 60px 25px; }
.empty-ico {
  width: 76px; height: 76px; margin: 0 auto 18px;
  border-radius: 22px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
  box-shadow: 0 14px 34px -14px rgba(24,128,56,.4);
}
.empty-state h2 { margin: 0 0 6px; font-size: 17px; font-weight: 700; }
.empty-state p { color: var(--muted); margin: 0 0 22px; font-size: 13.5px; }

/* ---------- متفرقه ---------- */
.toolbar { display: flex; gap: 8px; margin-bottom: 14px; }
.user-create { display: grid; grid-template-columns: 1.1fr 1.1fr 1.2fr auto; gap: 12px; align-items: end; }
.user-create .form-group { margin-bottom: 0; }
.inline { display: inline-flex; gap: 6px; align-items: center; margin: 2px 0; }
.mini-input { width: 110px !important; padding: 5px 9px !important; font-size: 12px !important; }
.actions { white-space: nowrap; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell b { font-weight: 600; }

.ip-cell { font-family: ui-monospace, 'Vazirmatn', monospace; font-size: 12.5px; letter-spacing: .3px; }

/* حالت اسکلت بارگذاری */
.skeleton {
  background: linear-gradient(90deg, var(--card-2) 25%, var(--line-2) 50%, var(--card-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: 8px; color: transparent !important; user-select: none;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ==========================================================================
   ریسپانسیو
   ========================================================================== */
@media (min-width: 993px) {
  .login-hero { display: flex; }
}
@media (max-width: 1200px) {
  .data-table td { max-width: 240px; }
}
@media (max-width: 992px) {
  .menu-btn { display: inline-grid; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; right: 0; z-index: 70;
    transform: translateX(105%);
    transition: transform .22s ease;
  }
  .sidebar.open { transform: translateX(0) !important; box-shadow: var(--shadow-lg); }
  .sidebar-overlay.show { display: block; }
  .topbar { padding: 0 14px; }
  .content { padding: 18px 14px 34px; }
  .topbar-user b, .topbar-user .badge { display: none; }
  .user-create { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .user-create { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr 1fr; }
  .page-title { font-size: 19px; }
  .data-table td { max-width: 170px; }
  .pager-info { width: 100%; }
}

/* ---------- چاپ ---------- */
@media print {
  .sidebar, .topbar, .app-foot, .pager, .card.filters, .btn { display: none !important; }
  .table-scroll { max-height: none; overflow: visible; }
  body { background: #fff; }
}

/* ==========================================================================
   حالت صفحه‌گسترده (به سبک Google Sheets) — نسخه ۳
   گرید حرفی A/B/C + شماره ردیف + نوار فرمول + منوها + نوار وضعیت
   ========================================================================== */

body.gs-mode {
  --gs-green:      #0f9d58;
  --gs-green-2:    #188038;
  --gs-green-dark: #0d652d;
  --gs-line:       #e1e3e1;   /* خطوط گرید */
  --gs-line-2:     #d9dadb;
  --gs-head-bg:    #f8f9fa;   /* ردیف حروف و شماره */
  --gs-head-txt:   #3c4043;
  --gs-chrome:     #ffffff;   /* بدنه و نوارها */
  --gs-chrome-2:   #f8f9fa;
  --gs-hover:      #f1f3f4;
  --gs-sel:        #1a73e8;   /* قاب سلول انتخاب‌شده */
  --gs-sel-hd:     #d3e3fd;   /* هایلایت سرستون/شماره ردیف */
  --gs-sel-soft:   rgba(26,115,232,.07);
  --gs-txt:        #202124;
  --gs-txt-2:      #5f6368;
  --gs-ltr:        30px;      /* ارتفاع ردیف حروف */
}
html[data-theme="dark"] body.gs-mode {
  --gs-green:      #5bb974;
  --gs-green-2:    #81c995;
  --gs-green-dark: #a8dab5;
  --gs-line:       #3c4043;
  --gs-line-2:     #46484b;
  --gs-head-bg:    #282a2d;
  --gs-head-txt:   #e8eaed;
  --gs-chrome:     #202124;
  --gs-chrome-2:   #292a2d;
  --gs-hover:      #35363a;
  --gs-sel:        #8ab4f8;
  --gs-sel-hd:     rgba(138,180,248,.30);
  --gs-sel-soft:   rgba(138,180,248,.10);
  --gs-txt:        #e8eaed;
  --gs-txt-2:      #9aa0a6;
}

/* ---------- اسکلت تمام‌صفحه ---------- */
body.gs-mode { overflow: hidden; height: 100dvh; }
.gs-mode .main { height: 100dvh; }
.gs-mode .content {
  max-width: none; margin: 0; padding: 0;
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
}
.gs-mode .app-foot { display: none; }

/* کشوی منو (مثل اپ‌های گوگل، از لبه شروع خطوط کشیده می‌شود) */
.gs-mode .sidebar {
  position: fixed; top: 0; bottom: 0;
  inset-inline-start: 0; inset-inline-end: auto;  /* RTL: لبه راست */
  z-index: 80; width: min(300px, 86vw); height: 100dvh;
  transform: translateX(110%);                    /* بیرون از صفحه، سمت راست */
  transition: transform .24s ease;
  box-shadow: var(--shadow-lg);
}
.gs-mode .sidebar.open { transform: translateX(0); }
.gs-mode .sidebar-overlay { z-index: 79; }

/* ---------- نوار بالا (نام سند) ---------- */
.gs-mode .topbar {
  height: 54px; flex: none;
  background: var(--gs-chrome);
  border-bottom: 1px solid var(--gs-line);
  backdrop-filter: none; -webkit-backdrop-filter: none;
  padding: 0 14px; gap: 10px;
}
.gs-mode .topbar-title {
  font-size: 15.5px; font-weight: 700; color: var(--gs-txt);
  max-width: 38vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gs-mode .menu-btn { border-color: transparent; color: var(--gs-txt-2); }
.gs-mode .menu-btn:hover { background: var(--gs-hover); border-color: transparent; }
.topbar-docmark { display: inline-flex; color: var(--gs-green); flex: none; }
.gs-mode .icon-btn { border-color: transparent; }
.gs-mode .icon-btn:hover { background: var(--gs-hover); }
.topbar-savestate {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: var(--gs-txt-2); margin-inline-start: 2px;
  white-space: nowrap;
}
.topbar-savestate .ic { color: var(--gs-green); }

/* ---------- نوار منو ---------- */
.gs-menubar {
  flex: none; display: flex; align-items: center; gap: 2px;
  padding: 3px 12px;
  background: var(--gs-chrome);
  border-bottom: 1px solid var(--gs-line);
}
.gs-menu { position: relative; }
.gs-menu > summary {
  list-style: none; cursor: pointer; user-select: none;
  padding: 5px 11px; border-radius: 6px;
  font-size: 13px; font-weight: 500; color: var(--gs-txt-2);
  transition: background .12s;
}
.gs-menu > summary::-webkit-details-marker { display: none; }
.gs-menu > summary:hover, .gs-menu[open] > summary { background: var(--gs-hover); color: var(--gs-txt); }

/* پاپ‌آپ منوها (JS در حالت fixed قرارش می‌دهد) */
.gs-menu-pop {
  position: absolute; top: calc(100% + 5px); inset-inline-start: 0;
  min-width: 235px; max-height: 72vh; overflow-y: auto;
  background: var(--gs-chrome);
  border: 1px solid var(--gs-line-2);
  border-radius: 10px;
  box-shadow: 0 10px 34px -8px rgba(0,0,0,.28), 0 2px 8px rgba(0,0,0,.08);
  padding: 6px; z-index: 95;
}
.gs-menu-pop a, .gs-menu-pop button {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 7.5px 12px; border: 0; background: none;
  border-radius: 7px; cursor: pointer; text-align: start;
  font-family: inherit; font-size: 13px; color: var(--gs-txt);
  text-decoration: none; line-height: 1.5;
}
.gs-menu-pop a:hover, .gs-menu-pop button:hover { background: var(--gs-hover); text-decoration: none; }
.gs-menu-pop a .ic, .gs-menu-pop button .ic { color: var(--gs-txt-2); flex: none; }
.gs-menu-pop a span, .gs-menu-pop button span { display: flex; flex-direction: column; min-width: 0; }
.gs-menu-pop a small, .gs-menu-pop button small {
  font-size: 11px; color: var(--gs-txt-2); font-weight: 400;
}
.gs-menu-sep { height: 1px; background: var(--gs-line); margin: 6px 6px; }

/* ---------- نوار ابزار ---------- */
.gs-toolbar {
  flex: none; display: flex; align-items: center; gap: 3px; flex-wrap: nowrap;
  padding: 5px 12px;
  background: var(--gs-chrome);
  border-bottom: 1px solid var(--gs-line);
  overflow-x: auto; overflow-y: visible;
  scrollbar-width: none;
}
.gs-toolbar::-webkit-scrollbar { display: none; }
.gs-flex { flex: 1 1 0; min-width: 8px; }
.gs-sep { width: 1px; height: 20px; background: var(--gs-line); margin: 0 7px; flex: none; }

.gs-search {
  display: flex; align-items: center; gap: 8px;
  flex: 0 1 340px; min-width: 170px; height: 32px;
  border: 1px solid var(--gs-line-2); border-radius: 16px;
  padding: 0 12px; background: var(--gs-chrome);
  color: var(--gs-txt-2);
  transition: border-color .15s, box-shadow .15s;
}
.gs-search:focus-within { border-color: var(--gs-green); box-shadow: 0 0 0 3px var(--ring); }
.gs-search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font-family: inherit; font-size: 12.5px; color: var(--gs-txt);
}
.gs-search input::placeholder { color: var(--gs-faint); }
.gs-search-clear { display: inline-flex; color: var(--gs-txt-2); border-radius: 50%; padding: 2px; }
.gs-search-clear:hover { background: var(--gs-hover); }

.gs-tbtn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px; flex: none;
  border: 0; border-radius: 6px; cursor: pointer;
  background: transparent; color: var(--gs-txt-2);
  font-family: inherit; font-size: 12.5px; font-weight: 500;
  text-decoration: none; white-space: nowrap;
  transition: background .12s;
}
.gs-tbtn:hover { background: var(--gs-hover); color: var(--gs-txt); text-decoration: none; }
.gs-tbtn.on { background: var(--primary-soft); color: var(--gs-green-2); font-weight: 600; }
.gs-tbtn-green {
  background: var(--gs-green-2); color: #fff; border-radius: 15px; padding: 0 13px;
}
.gs-tbtn-green:hover { background: var(--gs-green-dark); color: #fff; filter: brightness(1.05); }
html[data-theme="dark"] .gs-tbtn-green { color: #10241a; }
html[data-theme="dark"] .gs-tbtn-green:hover { color: #10241a; }
.gs-badge {
  display: inline-grid; place-items: center;
  min-width: 16px; height: 16px; padding: 0 5px;
  border-radius: 8px; background: var(--gs-green-2); color: #fff;
  font-size: 10.5px; font-weight: 700;
}

.gs-per { display: flex; align-items: center; gap: 8px; flex: none; }
.gs-per label { font-size: 12px; color: var(--gs-txt-2); white-space: nowrap; }
.gs-per select {
  height: 30px; border: 1px solid var(--gs-line-2); border-radius: 6px;
  background: var(--gs-chrome); color: var(--gs-txt);
  font-family: inherit; font-size: 12.5px; padding: 0 6px; cursor: pointer;
}

/* ---------- پنل فیلتر پیشرفته ---------- */
.gs-filterpanel {
  flex: none; border-bottom: 1px solid var(--gs-line);
  background: var(--gs-chrome-2);
  padding: 10px 16px 14px;
  max-height: 40vh; overflow-y: auto;
}
.gs-filter-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 10px;
}
.gs-filter-head h3 {
  margin: 0; font-size: 13px; font-weight: 700; color: var(--gs-txt);
  display: flex; align-items: center; gap: 7px;
}
.gs-filter-head h3 .ic { color: var(--gs-green-2); }
.gs-filter-actions { display: flex; align-items: center; gap: 8px; }
.gs-filter-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 9px 12px;
}
.gs-filterpanel .filter-cell label {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; color: var(--gs-txt-2); margin-bottom: 4px;
}
.gs-mini-letter {
  display: inline-grid; place-items: center; min-width: 18px; height: 16px;
  padding: 0 4px; border-radius: 4px; direction: ltr;
  background: var(--gs-head-bg); border: 1px solid var(--gs-line);
  font-size: 10px; font-weight: 700; color: var(--gs-head-txt);
}
.gs-filterpanel .filter-cell input[type=text],
.gs-filterpanel .num-filter select,
.gs-filterpanel .num-filter input {
  height: 30px; border: 1px solid var(--gs-line-2); border-radius: 6px;
  background: var(--gs-chrome); color: var(--gs-txt);
  font-family: inherit; font-size: 12.5px; padding: 0 9px; width: 100%;
}
.gs-filterpanel .filter-cell input:focus,
.gs-filterpanel .num-filter select:focus,
.gs-filterpanel .num-filter input:focus {
  outline: 0; border-color: var(--gs-green); box-shadow: 0 0 0 3px var(--ring);
}
.gs-filterpanel .num-filter { display: flex; gap: 6px; }
.gs-filterpanel .num-filter select { width: 58px; flex: none; }

/* ---------- نوار فرمول ---------- */
.gs-formula {
  flex: none; display: flex; align-items: stretch;
  height: 34px; background: var(--gs-chrome);
  border-bottom: 1px solid var(--gs-line);
  font-size: 12.5px;
}
.gs-namebox {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 76px; padding: 0 12px;
  border-inline-end: 1px solid var(--gs-line);
  font-weight: 700; color: var(--gs-txt); letter-spacing: .4px;
}
.gs-fx {
  display: inline-flex; align-items: center;
  padding: 0 12px; border-inline-end: 1px solid var(--gs-line);
  font-style: italic; color: var(--gs-faint); user-select: none;
}
.gs-fxval {
  flex: 1; display: flex; align-items: center;
  padding: 0 13px; min-width: 0;
  color: var(--gs-txt); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gs-fxval:empty::before { content: ''; }

/* ---------- گرید ---------- */
.gs-gridwrap {
  flex: 1 1 auto; min-height: 0; min-width: 0;
  overflow: auto; position: relative;
  background: var(--gs-chrome);
  scrollbar-width: thin;
}
.gs-grid {
  border-collapse: separate; border-spacing: 0;
  min-width: 100%; font-size: 13px; line-height: 1.6;
}
.gs-grid th, .gs-grid td {
  border-bottom: 1px solid var(--gs-line);
  border-inline-end: 1px solid var(--gs-line);
  padding: 0;
}
.gs-grid thead th:first-child, .gs-grid tbody td:first-child { border-inline-start: 1px solid var(--gs-line); }

/* ردیف حروف */
.gs-tr-letters th.gs-letter {
  position: sticky; top: 0; z-index: 30;
  height: var(--gs-ltr);
  background: var(--gs-head-bg);
}
th.gs-letter .gs-colmenu { height: 100%; }
th.gs-letter summary {
  list-style: none; cursor: pointer; user-select: none;
  height: 100%; display: flex; align-items: center; justify-content: center; gap: 4px;
  padding: 0 8px; transition: background .12s;
}
th.gs-letter summary::-webkit-details-marker { display: none; }
th.gs-letter summary:hover, th.gs-letter details[open] summary { background: var(--gs-hover); }
.gs-letter-lbl { font-weight: 700; font-size: 11.5px; color: var(--gs-head-txt); letter-spacing: .3px; }
.gs-caret {
  width: 0; height: 0; flex: none;
  border-inline-start: 4px solid transparent; border-inline-end: 4px solid transparent;
  border-top: 5px solid currentColor; opacity: 0; color: var(--gs-head-txt);
  transition: opacity .12s;
}
th.gs-letter summary:hover .gs-caret, th.gs-letter details[open] .gs-caret { opacity: .6; }
th.gs-letter.sorted { background: var(--primary-softer); }
th.gs-letter.sorted .gs-letter-lbl { color: var(--gs-green-2); }
th.gs-letter .gs-menu-pop-col { min-width: 215px; }

/* خانه گوشه */
.gs-corner {
  position: sticky; top: 0; inset-inline-start: 0; z-index: 45;
  width: 46px; min-width: 46px;
  background: var(--gs-head-bg); border-inline-end: 1px solid var(--gs-line-2) !important;
}
.gs-corner-btn { width: 100%; height: 100%; background: transparent; border: 0; cursor: pointer; display: block; }
.gs-corner-btn:hover { background: var(--gs-hover); }

/* ردیف نام ستون‌ها */
.gs-tr-names th.gs-name {
  position: sticky; top: var(--gs-ltr); z-index: 25;
  height: 38px; background: var(--gs-chrome);
  border-bottom: 1px solid var(--gs-line-2);
  box-shadow: 0 1px 0 var(--gs-line);
}
.gs-name a {
  display: flex; align-items: center; gap: 6px;
  height: 100%; padding: 0 11px;
  color: var(--gs-txt); text-decoration: none; font-weight: 700; font-size: 12.5px;
  min-width: 0;
}
.gs-name a:hover { background: var(--gs-hover); }
.gs-name-txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sort-ind {
  width: 0; height: 0; flex: none; display: none;
  border-inline-start: 4.5px solid transparent; border-inline-end: 4.5px solid transparent;
}
.th-sort-asc .sort-ind  { display: inline-block; border-bottom: 6px solid var(--gs-green-2); }
.th-sort-desc .sort-ind { display: inline-block; border-top: 6px solid var(--gs-green-2); }
th.gs-name.is-num a { justify-content: flex-end; }
th.gs-name.is-num a { flex-direction: row; }

/* ستون شماره ردیف */
td.gs-rownum {
  position: sticky; inset-inline-start: 0; z-index: 20;
  min-width: 46px; width: 46px;
  background: var(--gs-head-bg);
  color: var(--gs-head-txt); font-size: 11px; font-weight: 500;
  text-align: center; padding: 0 6px;
}

/* سلول‌ها */
td.gs-cell {
  background: var(--gs-chrome); color: var(--gs-txt);
  height: 30px; padding: 0 11px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 108px; max-width: 320px;
  cursor: cell; user-select: none;
}
td.gs-cell.is-num {
  text-align: left; direction: ltr;
  font-variant-numeric: tabular-nums; color: var(--gs-txt);
}
tbody tr:hover td.gs-cell { background: var(--gs-hover); }
td.gs-cell.sel {
  background: var(--gs-sel-soft);
  box-shadow: inset 0 0 0 2px var(--gs-sel);
}
.gs-grid .hl { background: var(--gs-sel-hd) !important; }
td.gs-rownum.hl { color: #174ea6; font-weight: 700; }
html[data-theme="dark"] td.gs-rownum.hl { color: #8ab4f8; }
th.gs-letter.hl, th.gs-name.hl { background: var(--gs-sel-hd) !important; }

/* حالت خالی */
.gs-no-rows {
  padding: 56px 24px !important; text-align: center;
  color: var(--gs-txt-2); font-size: 13px;
  height: auto !important;
}
.gs-no-rows .ic { vertical-align: -4px; margin-inline-end: 6px; color: var(--gs-faint); }

/* ---------- نوار پایین: برگه‌ها + وضعیت + صفحه‌بندی ---------- */
.gs-bottom {
  flex: none; display: flex; align-items: stretch;
  height: 42px; background: var(--gs-chrome-2);
  border-top: 1px solid var(--gs-line);
  padding: 0 8px; gap: 4px; min-width: 0;
}
.gs-tabs { display: flex; align-items: stretch; flex: none; }
.gs-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 14px; font-size: 12.5px; color: var(--gs-txt-2);
  border-bottom: 3px solid transparent; user-select: none; white-space: nowrap;
}
.gs-tab .ic { color: var(--gs-txt-2); }
.gs-tab.active {
  color: var(--gs-green-2); font-weight: 700;
  border-bottom-color: var(--gs-green);
}
.gs-tab.active .ic { color: var(--gs-green-2); }

.gs-status {
  flex: 1 1 auto; display: flex; align-items: center; gap: 7px;
  padding: 0 12px; overflow-x: auto; scrollbar-width: none; min-width: 60px;
}
.gs-status::-webkit-scrollbar { display: none; }
.gs-chip {
  flex: none; display: inline-flex; align-items: center; gap: 5px;
  background: var(--gs-chrome); border: 1px solid var(--gs-line);
  border-radius: 12px; padding: 1.5px 11px;
  font-size: 11.5px; color: var(--gs-txt-2); white-space: nowrap;
}
.gs-chip b { color: var(--gs-txt); font-weight: 700; }
.gs-chip-sum { border-color: var(--primary-soft); background: var(--primary-softer); }
.gs-chip-sum b { color: var(--gs-green-2); }

.gs-pager {
  flex: none; display: flex; align-items: center; gap: 2px;
  padding: 0 4px; border-inline-start: 1px solid var(--gs-line);
}
.gs-pagebtn {
  width: 27px; height: 27px; border-radius: 6px;
  display: inline-grid; place-items: center;
  color: var(--gs-txt-2); text-decoration: none; cursor: pointer;
}
.gs-pagebtn:hover { background: var(--gs-hover); color: var(--gs-txt); text-decoration: none; }
.gs-pagebtn.is-dis { opacity: .35; pointer-events: none; }
.gs-pagelabel { font-size: 12px; color: var(--gs-txt-2); margin: 0 7px; white-space: nowrap; }

/* ---------- واکنش‌گرایی ---------- */
@media (max-width: 992px) {
  .topbar-savestate { display: none; }
  .gs-mode .topbar-title { max-width: 46vw; }
  .gs-per label { display: none; }
  .gs-menubar { padding: 3px 8px; }
  .gs-toolbar { padding: 5px 8px; }
  .gs-status { padding: 0 6px; }
}
@media (max-width: 640px) {
  .gs-tbtn span:not(.gs-badge) { display: none; }  /* فقط آیکون‌ها */
  .gs-tbtn { padding: 0 8px; }
  .gs-search { flex: 1 1 130px; }
  .gs-pagelabel { margin: 0 3px; font-size: 11px; }
  .gs-tab { padding: 0 10px; }
  .gs-bottom { padding: 0 4px; }
  td.gs-cell { max-width: 220px; }
}

/* ---------- چاپ ---------- */
@media print {
  body.gs-mode { overflow: visible; height: auto; background: #fff; }
  .gs-mode .topbar, .gs-menubar, .gs-toolbar, .gs-formula,
  .gs-filterpanel, .gs-bottom, .gs-mode .sidebar, .sidebar-overlay,
  .toast-stack { display: none !important; }
  .gs-mode .main, .gs-mode .content { height: auto; display: block; }
  .gs-gridwrap { overflow: visible !important; }
  .gs-grid th, .gs-grid td { position: static !important; }
  .gs-grid { font-size: 10.5px; }
  .gs-grid th { background: #eee !important; }
  .gs-grid th, .gs-grid td { border-color: #999 !important; }
  td.gs-cell { white-space: normal; max-width: none; height: auto; padding: 3px 7px; }
  td.gs-rownum { position: static; }
}
