/* ==========================================================================
   پنل مدیریت وب — تم تیره، راست‌به‌چپ
   ========================================================================== */

:root {
  --panel-bg: #0a1020;
  --panel-bg-soft: #0e1729;
  --panel-surface: #111c31;
  --panel-surface-2: #16233c;
  --panel-border: rgba(148, 163, 184, 0.13);
  --panel-border-strong: rgba(148, 163, 184, 0.22);

  --panel-text: #e6edf8;
  --panel-muted: #8fa3bd;

  --panel-accent: #6366f1;
  --panel-accent-2: #8b5cf6;
  --panel-accent-soft: rgba(99, 102, 241, 0.16);

  --panel-success: #22c55e;
  --panel-info: #38bdf8;
  --panel-warning: #f59e0b;
  --panel-danger: #f43f5e;

  --sidebar-width: 274px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-soft: 0 10px 30px -18px rgba(2, 6, 23, 0.9);
  --shadow-glow: 0 0 0 1px rgba(99, 102, 241, 0.28), 0 14px 36px -18px rgba(99, 102, 241, 0.55);
}

/* ---------------------------------------------------------------- پایه ---- */
* { scrollbar-width: thin; scrollbar-color: #2a3a58 transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb {
  background: #263450;
  border-radius: 99px;
}
*::-webkit-scrollbar-thumb:hover { background: #33456a; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 620px at 100% -10%, rgba(99, 102, 241, 0.13), transparent 62%),
    radial-gradient(900px 520px at 0% 110%, rgba(139, 92, 246, 0.10), transparent 60%),
    var(--panel-bg);
  background-attachment: fixed;
  color: var(--panel-text);
  font-family: Vazirmatn, "Segoe UI", Tahoma, system-ui, sans-serif;
  font-feature-settings: "ss01";
  -webkit-font-smoothing: antialiased;
}

:root { --bs-body-font-family: Vazirmatn, "Segoe UI", Tahoma, system-ui, sans-serif; }

code, pre, .font-mono { font-family: "Cascadia Code", Consolas, monospace; }

a { text-decoration: none; }

/* ------------------------------------------------------------- چیدمان ---- */
.layout {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
}

.content {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* -------------------------------------------------------- منوی کناری ---- */
.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  background: linear-gradient(180deg, #0c1526 0%, #0a1120 100%);
  border-inline-start: 1px solid var(--panel-border);
  border-inline-end: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 1040;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.15rem 1.15rem 1rem;
  border-bottom: 1px solid var(--panel-border);
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  font-size: 1.2rem;
  color: #fff;
  background: linear-gradient(135deg, var(--panel-accent), var(--panel-accent-2));
  box-shadow: 0 10px 22px -12px rgba(99, 102, 241, 0.95);
}

.brand-mark-lg {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  border-radius: 20px;
  font-size: 1.85rem;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.brand-text strong { font-size: 1.02rem; font-weight: 700; letter-spacing: -0.01em; }
.brand-text small { color: var(--panel-muted); font-size: 0.76rem; }

.sidebar-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.9rem 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.nav-heading {
  display: block;
  margin: 0.95rem 0.55rem 0.35rem;
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #6b7f9e;
  text-transform: uppercase;
}
.sidebar-nav > .nav-heading:first-child { margin-top: 0.15rem; }

.nav-link {
  /* دو ستون: آیکون | متن. زیرنویس در ردیف دومِ ستون متن می‌نشیند. */
  display: grid;
  grid-template-columns: 1.15rem minmax(0, 1fr);
  column-gap: 0.55rem;
  align-items: center;
  padding: 0.58rem 0.7rem;
  border-radius: var(--radius-sm);
  color: #b7c6dc;
  font-size: 0.905rem;
  font-weight: 500;
  line-height: 1.5;
  border: 1px solid transparent;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.nav-link > i {
  grid-column: 1;
  grid-row: 1;
  font-size: 1.02rem;
  text-align: center;
  color: #8fa3bd;
}

.nav-link > span:not(.nav-sub) {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

.nav-link:hover {
  background: rgba(148, 163, 184, 0.08);
  color: #e9f0fb;
}

.nav-link.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.24), rgba(139, 92, 246, 0.14));
  border-color: rgba(129, 140, 248, 0.34);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--panel-accent);
}
.nav-link.active > i { color: #c7d2fe; }

/* زیرنویس توضیحی؛ ردیف دومِ ستون متن */
.nav-sub {
  grid-column: 2;
  grid-row: 2;
  display: block;
  font-size: 0.68rem;
  font-weight: 400;
  color: #7e93b1;
  line-height: 1.55;
  margin-top: 0.05rem;
}
.nav-link.active .nav-sub { color: #c7d2fe; }

.sidebar-footer {
  padding: 0.85rem;
  border-top: 1px solid var(--panel-border);
  background: rgba(9, 15, 27, 0.7);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(148, 163, 184, 0.07);
  border: 1px solid var(--panel-border);
}
.user-chip > div { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.user-chip strong {
  font-size: 0.85rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-chip small { font-size: 0.7rem; color: var(--panel-muted); }

.avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #dbe4f5;
  background: rgba(99, 102, 241, 0.24);
  border: 1px solid rgba(129, 140, 248, 0.3);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.66);
  backdrop-filter: blur(2px);
  z-index: 1035;
}
.sidebar-backdrop.show { display: block; }

/* ------------------------------------------------------------ تاپ‌بار ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1.35rem;
  background: rgba(10, 16, 32, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--panel-border);
}

.topbar-title { flex: 1 1 auto; min-width: 0; }
.topbar-title h1 {
  margin: 0;
  font-size: 1.16rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.4;
}
.topbar-title p {
  margin: 0.1rem 0 0;
  font-size: 0.79rem;
  color: var(--panel-muted);
}

.topbar-actions { display: flex; align-items: center; gap: 0.45rem; }

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  color: #c3d0e4;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid var(--panel-border);
  font-size: 1.02rem;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.btn-icon:hover {
  color: #fff;
  background: var(--panel-accent-soft);
  border-color: rgba(129, 140, 248, 0.38);
}

/* ------------------------------------------------------------- صفحه ---- */
.page {
  flex: 1 1 auto;
  padding: 1.35rem;
  max-width: 1480px;
  width: 100%;
}

.page-footer {
  padding: 0.85rem 1.35rem 1.2rem;
  font-size: 0.74rem;
  color: #6b7f9e;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.page-footer .dot { opacity: 0.55; }
.page-footer code {
  color: #9db2d0;
  background: rgba(148, 163, 184, 0.1);
  border-radius: 6px;
  padding: 0.05rem 0.35rem;
  font-size: 0.72rem;
  direction: ltr;
  display: inline-block;
}

/* --------------------------------------------------------- کارت آمار ---- */
.stat-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.05rem;
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--panel-surface) 0%, var(--panel-bg-soft) 100%);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  height: 100%;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.stat-card::after {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  height: 3px;
  background: var(--tone, var(--panel-accent));
  opacity: 0.9;
}
.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--panel-border-strong);
}

.stat-icon {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  font-size: 1.22rem;
  color: var(--tone, var(--panel-accent));
  background: color-mix(in srgb, var(--tone, var(--panel-accent)) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone, var(--panel-accent)) 28%, transparent);
}

.stat-body { display: flex; flex-direction: column; gap: 0.08rem; min-width: 0; }
.stat-label { font-size: 0.78rem; color: var(--panel-muted); }
.stat-value {
  font-size: 1.42rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-hint { font-size: 0.7rem; color: #6f83a2; }

.tone-primary { --tone: #6366f1; }
.tone-info    { --tone: #38bdf8; }
.tone-success { --tone: #22c55e; }
.tone-warning { --tone: #f59e0b; }
.tone-danger  { --tone: #f43f5e; }

/* ------------------------------------------------------------- پنل‌ها ---- */
.panel {
  background: linear-gradient(170deg, var(--panel-surface) 0%, var(--panel-bg-soft) 100%);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.05rem;
  border-bottom: 1px solid var(--panel-border);
  background: rgba(148, 163, 184, 0.035);
}
.panel-head h2 {
  flex: 1 1 auto;
  margin: 0;
  font-size: 0.97rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}
.panel-head h2 i { color: var(--panel-accent); font-size: 1rem; }

.panel-body { padding: 1.05rem; }
.panel-body.p-0 { padding: 0; }

.badge-soft {
  font-size: 0.68rem;
  font-weight: 600;
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.14);
  border: 1px solid rgba(129, 140, 248, 0.26);
  border-radius: 999px;
  padding: 0.14rem 0.5rem;
  white-space: nowrap;
}

/* ------------------------------------------------------ فهرست مشخصات ---- */
.meta-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.meta-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.62rem 0.15rem;
  font-size: 0.885rem;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.14);
}
.meta-list li:last-child { border-bottom: 0; padding-bottom: 0.1rem; }
.meta-list li:first-child { padding-top: 0.1rem; }
.meta-list li > span { display: flex; align-items: center; gap: 0.5rem; color: #b9c7dd; min-width: 0; }
.meta-list li > span i { font-size: 0.92rem; }
.meta-list li strong { font-variant-numeric: tabular-nums; font-weight: 700; }

/* ---------------------------------------------------------- مینی‌آمار ---- */
.mini-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.18rem;
  padding: 0.85rem 0.6rem;
  text-align: center;
  border-radius: var(--radius-sm);
  background: rgba(148, 163, 184, 0.055);
  border: 1px solid var(--panel-border);
  height: 100%;
}
.mini-stat i { font-size: 1.15rem; }
.mini-stat strong {
  font-size: 1.28rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.mini-stat span { font-size: 0.72rem; color: var(--panel-muted); }

.progress-block .progress {
  background: rgba(148, 163, 184, 0.14);
  border-radius: 99px;
  overflow: hidden;
}
.progress-block .progress-bar {
  border-radius: 99px;
  background-image: linear-gradient(90deg, #22c55e, #4ade80);
}

/* ------------------------------------------------------------- جدول‌ها ---- */
.panel-body .table-responsive { border-radius: 0 0 var(--radius) var(--radius); }

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--panel-text);
  --bs-table-border-color: rgba(148, 163, 184, 0.11);
  --bs-table-hover-bg: rgba(99, 102, 241, 0.07);
  --bs-table-hover-color: var(--panel-text);
  margin-bottom: 0;
  font-size: 0.855rem;
}

.table > thead th {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #8598b6;
  background: rgba(148, 163, 184, 0.045);
  border-bottom: 1px solid var(--panel-border);
  padding: 0.62rem 0.85rem;
  white-space: nowrap;
}

.table > tbody td {
  padding: 0.62rem 0.85rem;
  vertical-align: middle;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}
.table > tbody tr:last-child td { border-bottom: 0; }

.table .cell-strong { font-weight: 600; color: #eaf1fb; }
.table small { font-size: 0.72rem; }
.table td[dir="ltr"] { font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------- پیل ---- */
.pill {
  display: inline-block;
  font-size: 0.71rem;
  font-weight: 600;
  line-height: 1.6;
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  white-space: nowrap;
  border: 1px solid transparent;
}
.pill-success {
  color: #6ee7a8;
  background: rgba(34, 197, 94, 0.13);
  border-color: rgba(34, 197, 94, 0.28);
}
.pill-danger {
  color: #fda4af;
  background: rgba(244, 63, 94, 0.13);
  border-color: rgba(244, 63, 94, 0.28);
}
.pill-muted {
  color: #b6c4da;
  background: rgba(148, 163, 184, 0.13);
  border-color: rgba(148, 163, 184, 0.24);
}
.pill-info {
  color: #7dd3fc;
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.28);
}
.pill-warning {
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.28);
}

/* ---------------------------------------------------------- حالت خالی ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 3rem 1rem;
  text-align: center;
  color: #6b7f9e;
}
.empty-state i { font-size: 2.1rem; opacity: 0.65; }
.empty-state p { margin: 0; font-size: 0.88rem; }

/* ==========================================================================
   فرم‌ها و صفحات مدیریتی (فاز ۲)
   ========================================================================== */

/* ------------------------------------------------------------ تب‌ها ---- */
.tab-bar {
  gap: 0.4rem;
  padding: 0.35rem;
  border-radius: var(--radius);
  background: rgba(148, 163, 184, 0.055);
  border: 1px solid var(--panel-border);
  display: inline-flex;
  flex-wrap: wrap;
  width: auto;
}

.tab-bar .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.95rem;
  border-radius: var(--radius-sm);
  color: #b7c6dc;
  font-size: 0.885rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.tab-bar .nav-link > i { color: #8fa3bd; font-size: 0.98rem; }
.tab-bar .nav-link:hover {
  background: rgba(148, 163, 184, 0.09);
  color: #e9f0fb;
}
.tab-bar .nav-link.active {
  background: linear-gradient(135deg, var(--panel-accent), var(--panel-accent-2));
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 8px 20px -12px rgba(99, 102, 241, 0.95);
}
.tab-bar .nav-link.active > i { color: #fff; }

.tab-count {
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.5;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  color: #c3d0e4;
  font-variant-numeric: tabular-nums;
}
.tab-bar .nav-link.active .tab-count {
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
}

/* ------------------------------------------------- فرم‌های داخل پنل ---- */
.panel .form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #aebdd5;
  margin-bottom: 0.3rem;
}
.panel .form-label.small { font-size: 0.74rem; }

.panel .form-control,
.panel .form-select {
  background: rgba(8, 14, 26, 0.72);
  border-color: var(--panel-border-strong);
  color: var(--panel-text);
  font-size: 0.885rem;
}
.panel .form-control::placeholder { color: #55688a; }
.panel .form-control:focus,
.panel .form-select:focus {
  background: rgba(8, 14, 26, 0.9);
  border-color: rgba(129, 140, 248, 0.6);
  box-shadow: 0 0 0 0.18rem rgba(99, 102, 241, 0.16);
  color: #fff;
}
.panel .form-control-sm,
.panel .form-select-sm { font-size: 0.83rem; padding: 0.32rem 0.55rem; }

.panel .form-select option {
  background: #111c31;
  color: var(--panel-text);
}

.panel .form-text {
  font-size: 0.71rem;
  color: #6f83a2;
  margin-top: 0.28rem;
}
.panel .form-text code {
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.12);
  padding: 0 0.25rem;
  border-radius: 4px;
}

.panel textarea.form-control { line-height: 1.85; resize: vertical; }

/* سوییچ روشن/خاموش */
.panel .form-check-input {
  background-color: rgba(148, 163, 184, 0.18);
  border-color: var(--panel-border-strong);
  cursor: pointer;
}
.panel .form-check-input:checked {
  background-color: var(--panel-accent);
  border-color: var(--panel-accent);
}
.panel .form-check-input:focus {
  border-color: rgba(129, 140, 248, 0.6);
  box-shadow: 0 0 0 0.18rem rgba(99, 102, 241, 0.16);
}
.panel .form-check-label {
  font-size: 0.78rem;
  color: #b0bfd6;
  cursor: pointer;
}

.panel .btn-primary {
  background-image: linear-gradient(135deg, var(--panel-accent), var(--panel-accent-2));
  border: 0;
  font-weight: 600;
}
.panel .btn-primary:hover { filter: brightness(1.08); }

.panel .btn-outline-secondary {
  color: #b7c6dc;
  border-color: var(--panel-border-strong);
}
.panel .btn-outline-secondary:hover {
  background: rgba(148, 163, 184, 0.14);
  border-color: rgba(148, 163, 184, 0.36);
  color: #fff;
}

.panel .btn-outline-danger {
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.36);
}
.panel .btn-outline-danger:hover {
  background: rgba(244, 63, 94, 0.16);
  border-color: rgba(244, 63, 94, 0.55);
  color: #fff;
}
.panel .btn-outline-primary {
  border-color: rgba(129, 140, 248, 0.4);
  color: #b7c0fe;
  background: transparent;
}
.panel .btn-outline-primary:hover {
  background: rgba(99, 102, 241, 0.16);
  border-color: rgba(129, 140, 248, 0.62);
  color: #fff;
}
.panel .btn-outline-warning {
  border-color: rgba(245, 158, 11, 0.38);
  color: #fcd34d;
  background: transparent;
}
.panel .btn-outline-warning:hover {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.6);
  color: #fff;
}

/* --------------------------------------------------- ردیف ویرایش داخل جدول ---- */
.col-actions { width: 1%; white-space: nowrap; }

.row-actions {
  display: flex;
  align-items: center;
  gap: 0.32rem;
  justify-content: flex-end;
}
.row-actions form { margin: 0; display: inline-flex; }
.row-actions .btn {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  font-size: 0.82rem;
}

.table > tbody > tr.edit-row > td { border-bottom: 1px solid rgba(148, 163, 184, 0.08); }
.table > tbody > tr.edit-row:last-child > td { border-bottom: 0; }

.inline-edit-form {
  padding: 0.85rem 1rem;
  background: rgba(99, 102, 241, 0.055);
  border-top: 1px dashed rgba(129, 140, 248, 0.22);
  border-bottom: 1px dashed rgba(129, 140, 248, 0.22);
}

.slug {
  font-size: 0.72rem;
  color: #9db2d0;
  background: rgba(148, 163, 184, 0.1);
  border-radius: 5px;
  padding: 0.05rem 0.32rem;
  direction: ltr;
  display: inline-block;
}

.cell-desc {
  font-size: 0.72rem;
  line-height: 1.65;
  max-width: 34ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-cell {
  display: inline-block;
  max-width: 30ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
  font-size: 0.76rem;
  color: #7dd3fc;
}
.link-cell:hover { color: #bae6fd; text-decoration: underline; }

/* پیام موفقیت/خطا کمی برجسته‌تر از فاز ۱ */
.page > .alert {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

@media (max-width: 767.98px) {
  .tab-bar { width: 100%; }
  .tab-bar .nav-item { flex: 1 1 auto; }
  .tab-bar .nav-link { justify-content: center; font-size: 0.82rem; padding: 0.45rem 0.6rem; }
  .tab-count { display: none; }
  .inline-edit-form { padding: 0.75rem; }
  .cell-desc, .link-cell { max-width: 18ch; }
  .row-actions { flex-wrap: wrap; }
  .panel .form-text { font-size: 0.7rem; }
}

/* --------------------------------------------------- هشدارها (Bootstrap) ---- */
.alert {
  border-radius: var(--radius-sm);
  border-width: 1px;
  font-size: 0.875rem;
  padding: 0.72rem 0.95rem;
}
.alert-success {
  color: #86efac;
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
}
.alert-danger {
  color: #fda4af;
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.3);
}
.alert-info {
  color: #7dd3fc;
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.3);
}
.alert-warning {
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
}
.alert .btn-close { filter: invert(1) grayscale(1) opacity(0.6); }

/* ==========================================================================
   صفحه ورود
   ========================================================================== */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  position: relative;
  overflow: hidden;
}

.auth-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
}
.auth-glow-1 {
  width: 460px;
  height: 460px;
  top: -160px;
  inset-inline-end: -120px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.42), transparent 68%);
}
.auth-glow-2 {
  width: 420px;
  height: 420px;
  bottom: -180px;
  inset-inline-start: -140px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.34), transparent 68%);
}

.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 424px;
  padding: 1.9rem 1.6rem 1.5rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(170deg, rgba(23, 35, 60, 0.94), rgba(11, 18, 33, 0.97));
  border: 1px solid var(--panel-border-strong);
  box-shadow: 0 30px 70px -34px rgba(2, 6, 23, 0.95), var(--shadow-glow);
  backdrop-filter: blur(10px);
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  text-align: center;
  margin-bottom: 1.35rem;
}
.auth-brand h1 {
  margin: 0;
  font-size: 1.24rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.auth-brand p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--panel-muted);
}

.auth-card .form-label {
  font-size: 0.79rem;
  font-weight: 600;
  color: #aebdd5;
  margin-bottom: 0.35rem;
}

.auth-card .input-group-text {
  background: rgba(148, 163, 184, 0.08);
  border-color: var(--panel-border-strong);
  color: #93a6c4;
  padding-inline: 0.85rem;
}

.auth-card .form-control {
  background: rgba(8, 14, 26, 0.75);
  border-color: var(--panel-border-strong);
  color: var(--panel-text);
  font-size: 0.94rem;
}
.auth-card .form-control::placeholder { color: #55688a; }
.auth-card .form-control:focus {
  background: rgba(8, 14, 26, 0.92);
  border-color: rgba(129, 140, 248, 0.6);
  box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.18);
  color: #fff;
}
.auth-card .input-group-lg > .form-control,
.auth-card .input-group-lg > .input-group-text { min-height: 50px; }

.auth-card .btn-primary {
  background-image: linear-gradient(135deg, var(--panel-accent), var(--panel-accent-2));
  border: 0;
  font-weight: 600;
  padding-block: 0.62rem;
  box-shadow: 0 14px 28px -16px rgba(99, 102, 241, 0.95);
}
.auth-card .btn-primary:hover { filter: brightness(1.08); }

.auth-note {
  margin: 1.15rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--panel-border);
  font-size: 0.73rem;
  color: #6f83a2;
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  text-align: start;
  line-height: 1.75;
}

/* ==========================================================================
   ریسپانسیو
   ========================================================================== */
@media (max-width: 991.98px) {
  /* در RTL منوی کناری سمت راست است؛ برای پنهان‌شدن باید به راست
     (خارج از صفحه) برود. transform فیزیکی است و منطقی نیست. */
  .sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    transform: translateX(100%);
    transition: transform 0.24s ease;
    box-shadow: -24px 0 60px -30px rgba(2, 6, 23, 0.95);
  }
  .sidebar.open { transform: translateX(0); }

  .page { padding: 1rem; }
  .topbar { padding: 0.75rem 1rem; }
  .page-footer { padding: 0.75rem 1rem 1.1rem; }
}

@media (max-width: 575.98px) {
  .stat-card { padding: 0.8rem 0.85rem; gap: 0.65rem; }
  .stat-icon { width: 40px; height: 40px; flex-basis: 40px; font-size: 1.06rem; border-radius: 12px; }
  .stat-value { font-size: 1.2rem; }
  .stat-label { font-size: 0.73rem; }
  .stat-hint { display: none; }

  .topbar-title h1 { font-size: 1.03rem; }
  .topbar-title p { font-size: 0.73rem; }

  .panel-head { padding: 0.75rem 0.85rem; }
  .panel-body { padding: 0.85rem; }
  .table { font-size: 0.8rem; }
  .table > thead th, .table > tbody td { padding: 0.52rem 0.65rem; }

  /* بدون حداقل عرض، جدول به‌جای اسکرول افقی ستون‌ها را له می‌کند و
     متن فارسی حرف‌به‌حرف می‌شکند. با min-width اسکرول افقی فعال می‌شود. */
  .panel-body .table-responsive > .table { min-width: 640px; }
  .panel-body .table-responsive > .table td,
  .panel-body .table-responsive > .table th { white-space: nowrap; }
  .panel-body .table-responsive > .table .cell-desc,
  .panel-body .table-responsive > .table .link-cell {
    white-space: normal;
    max-width: 220px;
  }

  .auth-card { padding: 1.5rem 1.15rem 1.25rem; border-radius: 16px; }
}

/* احترام به تنظیم کاهش انیمیشن */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}
