﻿/* ==========================================================================
   دادبان وکیل — پنل مدیریت
   Theme: navy / gold (هماهنگ با سایت اصلی)
   ========================================================================== */

:root {
  --navy-50: #f2f6fb;
  --navy-100: #e4ecf5;
  --navy-200: #c3d5e8;
  --navy-300: #95b3d4;
  --navy-500: #3f6d9e;
  --navy-700: #25466b;
  --navy-800: #223c59;
  --navy-900: #1f3350;
  --navy-950: #0d1b2a;

  --gold-50: #fbf8ef;
  --gold-100: #f5edd6;
  --gold-200: #ead9ac;
  --gold-300: #ddc079;
  --gold-400: #d0a64f;
  --gold-500: #c1923a;
  --gold-600: #a8782f;
  --gold-700: #865d29;

  --bg: #f4f6f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1b2a3c;
  --text-muted: #5c6b7e;
  --danger: #b3261e;
  --danger-bg: #fee9e7;
  --success: #1a7f4b;
  --success-bg: #e3f6ec;

  --shadow-sm: 0 1px 2px rgb(13 27 42 / 0.05);
  --shadow-md: 0 1px 3px rgb(13 27 42 / 0.05), 0 10px 30px rgb(13 27 42 / 0.07);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}

a {
  color: var(--navy-700);
  text-decoration: none;
}

/* ------------------------------- Layout -------------------------------- */

.app {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* Overlay (mobile) */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgb(13 27 42 / 0.55);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.overlay.on {
  opacity: 1;
  pointer-events: auto;
}

/* Sidebar */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background:
    radial-gradient(ellipse 90% 55% at 100% -10%, rgb(193 146 58 / 0.12), transparent),
    linear-gradient(180deg, var(--navy-950) 0%, var(--navy-900) 100%);
  color: #cbd8e7;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  transition: width 0.22s ease;
  z-index: 70;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 16px 13px;
  border-bottom: 1px solid rgb(255 255 255 / 0.08);
}

.brand-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
  color: var(--navy-950);
  border-radius: 12px;
  box-shadow: 0 4px 14px rgb(193 146 58 / 0.35), inset 0 0 0 1px rgb(255 255 255 / 0.14);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.4;
  min-width: 0;
}

.brand-name {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
}

.brand-sub {
  font-size: 11px;
  color: var(--navy-300);
}

.sidebar-close {
  display: none;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--navy-700);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: var(--navy-100);
  color: var(--navy-900);
}

.icon-btn svg {
  width: 19px;
  height: 19px;
}

.icon-btn.sidebar-close {
  color: var(--navy-300);
}

.icon-btn.sidebar-close:hover {
  background: rgb(255 255 255 / 0.1);
  color: #fff;
}

/* جستجوی منو */
.nav-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 14px 4px;
  padding: 8px 12px;
  border: 1px solid rgb(255 255 255 / 0.1);
  border-radius: 12px;
  background: rgb(255 255 255 / 0.05);
  color: var(--navy-300);
  transition: border-color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

.nav-search:focus-within {
  border-color: var(--gold-500);
  background: rgb(255 255 255 / 0.08);
}

.nav-search > svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  color: #fff;
}

.nav-search input::placeholder {
  color: var(--navy-300);
}

.nav-search-clear {
  width: 18px;
  height: 18px;
  display: none;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.14);
  color: var(--navy-200);
  cursor: pointer;
  flex-shrink: 0;
}

.nav-search.has-value .nav-search-clear {
  display: grid;
}

.nav-search-clear:hover {
  background: var(--danger);
  color: #fff;
}

.nav-search-clear svg {
  width: 12px;
  height: 12px;
}

/* ---------- ناوبری (ساب‌منو) ---------- */

.nav {
  flex: 1;
  padding: 10px 12px 20px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav::-webkit-scrollbar {
  width: 7px;
}

.nav::-webkit-scrollbar-track {
  background: transparent;
}

.nav::-webkit-scrollbar-thumb {
  background: rgb(255 255 255 / 0.12);
  border-radius: 999px;
}

.nav::-webkit-scrollbar-thumb:hover {
  background: rgb(255 255 255 / 0.22);
}

.nav-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--navy-400);
  letter-spacing: 1px;
  margin: 14px 10px 8px;
  text-transform: uppercase;
}

.nav-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to left, rgb(255 255 255 / 0.12), transparent);
}

.nav-group {
  margin-bottom: 2px;
}

.nav-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #b9c9da;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: start;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-head:hover {
  background: rgb(255 255 255 / 0.06);
  color: #fff;
}

.nav-group.open > .nav-head {
  background: rgb(255 255 255 / 0.045);
  color: #fff;
}

.nav-head .txt {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: start;
}

.nav-head .caret {
  margin-inline-start: auto;
  display: grid;
  place-items: center;
  color: var(--navy-400);
  transition: transform 0.2s ease, color 0.15s ease;
}

.nav-head .caret svg {
  width: 16px;
  height: 16px;
}

.nav-group.open > .nav-head .caret {
  transform: rotate(180deg);
  color: var(--gold-400);
}

.min {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.min svg {
  width: 17px;
  height: 17px;
}

.nav-sub {
  position: relative;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease;
}

/* فقط بعد از پایان انیمیشن باز شدن، اسکرول فعال می‌شود (جلوگیری از فلیکر اسکرول‌بار) */
.nav-sub.scrolled {
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-sub.scrolled::-webkit-scrollbar {
  width: 5px;
}

.nav-sub.scrolled::-webkit-scrollbar-track {
  background: transparent;
}

.nav-sub.scrolled::-webkit-scrollbar-thumb {
  background: rgb(255 255 255 / 0.12);
  border-radius: 999px;
}

.nav-sub::before {
  content: "";
  position: absolute;
  inset-inline-start: 25px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: rgb(255 255 255 / 0.09);
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 11px;
  color: #b9c9da;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.nav-link:hover {
  background: rgb(255 255 255 / 0.06);
  color: #fff;
}

.nav-link.active {
  background: linear-gradient(90deg, rgb(193 146 58 / 0.17), rgb(193 146 58 / 0.05));
  color: var(--gold-300);
  box-shadow: inset 0 0 0 1px rgb(193 146 58 / 0.2);
  font-weight: 700;
}

.nav-link.active::before {
  content: "";
  position: absolute;
  inset-inline-end: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 58%;
  border-radius: 999px;
  background: var(--gold-500);
  box-shadow: 0 0 10px rgb(193 146 58 / 0.6);
}

.nav-link.sub {
  padding-inline-start: 40px;
  font-size: 12.5px;
}

.nav-link.sub .min {
  width: 16px;
  height: 16px;
}

.nav-link.sub .min svg {
  width: 14px;
  height: 14px;
  color: var(--navy-400);
}

.nav-link.sub:hover .min svg,
.nav-link.sub.active .min svg {
  color: var(--gold-400);
}

.nav-results {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-results:empty {
  display: none;
}

.nav-empty {
  padding: 24px 8px;
  text-align: center;
  font-size: 12px;
  color: var(--navy-400);
}

/* ---------- حالت باریک (mini) ---------- */

body.sidebar-mini .sidebar {
  width: 74px;
}

body.sidebar-mini .brand {
  justify-content: center;
  padding-inline: 8px;
}

body.sidebar-mini .brand-inner {
  justify-content: center;
}

body.sidebar-mini .brand-text,
body.sidebar-mini .nav-label,
body.sidebar-mini .topbar-collapse span {
  display: none;
}

body.sidebar-mini .topbar-collapse svg {
  transform: scaleX(-1);
}

body.sidebar-mini .nav-head,
body.sidebar-mini .nav-results > .nav-link {
  justify-content: center;
  padding-inline: 8px;
}

body.sidebar-mini .nav-head .txt,
body.sidebar-mini .nav-link .txt,
body.sidebar-mini .caret,
body.sidebar-mini .nav-search input,
body.sidebar-mini .nav-search-clear,
body.sidebar-mini .sf-txt {
  display: none;
}

body.sidebar-mini .nav-search {
  justify-content: center;
  padding: 8px;
  margin-inline: 10px;
}

body.sidebar-mini .nav-search.has-value {
  display: none;
}

body.sidebar-mini .min {
  width: 26px;
  height: 26px;
}

body.sidebar-mini .min svg {
  width: 18px;
  height: 18px;
}

body.sidebar-mini .nav {
  padding-inline: 10px;
}

body.sidebar-mini .sidebar-foot {
  text-align: center;
  padding: 12px 8px;
}

body.sidebar-mini .sf-row {
  justify-content: center;
}

/* زیرمنو به‌صورت flyout در حالت باریک */
body.sidebar-mini .nav-group {
  position: relative;
}

body.sidebar-mini .nav-group .nav-sub {
  position: absolute;
  inset-inline-end: 100%;
  top: 0;
  margin-inline-end: 6px;
  width: 224px;
  max-height: none !important;
  overflow: visible;
  padding: 8px;
  background: linear-gradient(180deg, var(--navy-800), var(--navy-900));
  border: 1px solid rgb(255 255 255 / 0.1);
  border-radius: 14px;
  box-shadow: 0 18px 44px rgb(0 0 0 / 0.4);
  opacity: 0;
  visibility: hidden;
  transform: translateX(8px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  z-index: 90;
}

body.sidebar-mini .nav-group .nav-sub::before {
  display: none;
}

body.sidebar-mini .nav-group:hover .nav-sub,
body.sidebar-mini .nav-group:focus-within .nav-sub {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

body.sidebar-mini .nav-group .nav-sub .nav-link {
  padding-inline-start: 10px;
  font-size: 13px;
}

/* ---------- فوتر سایدبار ---------- */

.sidebar-foot {
  padding: 13px 16px;
  border-top: 1px solid rgb(255 255 255 / 0.08);
  font-size: 11px;
  color: var(--navy-300);
}

.sf-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sf-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgb(26 127 75 / 0.22);
  flex-shrink: 0;
}

/* Main */
.main-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 62px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  background: rgb(255 255 255 / 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.topbar-start,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.page-id {
  display: flex;
  flex-direction: column;
  line-height: 1.4;
  min-width: 0;
}

.page-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--navy-950);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-date {
  font-size: 11px;
  color: var(--text-muted);
}

.topbar-menu {
  display: none;
}

.topbar-collapse {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: auto;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--navy-600);
  font-size: 12px;
  font-weight: 700;
}

.topbar-collapse svg {
  transition: transform 0.2s ease;
}

.topbar-collapse:hover {
  border-color: var(--navy-300);
  color: var(--navy-900);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--navy-700), var(--navy-950));
  color: var(--gold-300);
  font-weight: 800;
  font-size: 15px;
  box-shadow: 0 2px 8px rgb(13 27 42 / 0.18);
  flex-shrink: 0;
}

.uc-info {
  line-height: 1.5;
}

.u-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy-950);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.u-role {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.u-role svg {
  width: 12px;
  height: 12px;
  color: var(--success);
}

.main {
  flex: 1;
  min-width: 0;
  padding: 24px 28px 48px;
  width: 100%;
}

/* ------------------------------ Buttons ------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-sm svg {
  width: 14px;
  height: 14px;
}

.btn-primary {
  background: var(--navy-900);
  color: #fff;
}

.btn-primary:hover {
  background: var(--navy-800);
}

.btn-gold {
  background: var(--gold-500);
  color: var(--navy-950);
}

.btn-gold:hover {
  background: var(--gold-400);
}

.btn-ghost {
  background: var(--navy-50);
  color: var(--navy-700);
  border: 1px solid var(--navy-100);
}

.btn-ghost:hover {
  background: var(--navy-100);
}

.btn-danger-ghost {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #f3c8c8;
}

.btn-danger-ghost:hover {
  background: #fcdcd8;
}

.btn-logout {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #f3c8c8;
}

.btn-logout:hover {
  background: #fcdcd8;
}

.btn-icon-left svg {
  margin-inline-start: -4px;
}

/* ------------------------------ Toolbar ------------------------------- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.search-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search-form input {
  min-width: 260px;
}

.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.filter-bar .field {
  margin-bottom: 0;
}

.filter-bar .actions {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-bottom: 1px;
}

/* -------------------------------- Card -------------------------------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 22px 0;
}

.card-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--navy-950);
}

.hint {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-muted);
}

/* is-empty placeholder inside contenteditable editors */
[data-placeholder]:empty::before,
.is-empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}

/* -------------------------------- Table ------------------------------- */

.table-wrap {
  overflow-x: auto;
  padding: 6px 6px 6px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th {
  text-align: right;
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--navy-50);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table th:first-child {
  border-radius: 0 10px 10px 0;
}

.table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f0f3f7;
  vertical-align: middle;
}

.table tbody tr {
  transition: background 0.12s ease;
}

.table tbody tr:hover {
  background: var(--navy-50);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.cell-strong {
  font-weight: 700;
  color: var(--navy-950);
}

.cell-muted {
  color: var(--text-muted);
  font-size: 12px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.b-green { background: var(--success-bg); color: var(--success); }
.b-red { background: var(--danger-bg); color: var(--danger); }
.b-gold { background: var(--gold-50); color: var(--gold-700); }
.b-blue { background: var(--navy-50); color: var(--navy-700); }
.b-gray { background: #eef1f5; color: #6b7986; }

/* Empty state */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 13px;
}

.empty .empty-ico {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 16px;
  background: var(--navy-50);
  color: var(--navy-400);
}

.empty .empty-ico svg {
  width: 25px;
  height: 25px;
}

.empty .emoji {
  display: block;
  font-size: 34px;
  margin-bottom: 8px;
}

/* ----------------------------- Pagination ----------------------------- */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 22px 18px;
  border-top: 1px solid #f0f3f7;
  font-size: 12px;
  color: var(--text-muted);
}

.pagination nav {
  display: flex;
  gap: 4px;
  align-items: center;
}

.pagination nav a,
.pagination nav span.active {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  background: var(--navy-50);
  color: var(--navy-700);
  font-weight: 700;
  font-size: 12px;
}

.pagination nav a:hover {
  background: var(--navy-100);
}

.pagination nav .active {
  background: var(--gold-500);
  color: var(--navy-950);
}

.pagination nav .disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ------------------------------ Stats grid ----------------------------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-ico {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-ico svg {
  width: 23px;
  height: 23px;
}

.stat-ico.navy {
  background: var(--navy-50);
  color: var(--navy-700);
}

.stat-ico.green {
  background: var(--success-bg);
  color: var(--success);
}

.stat-ico.gold {
  background: var(--gold-50);
  color: var(--gold-700);
}

.stat-ico.red {
  background: var(--danger-bg);
  color: var(--danger);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--navy-950);
}

.stat-unit {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

/* ------------------------------- Forms -------------------------------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 20px;
  padding: 18px 22px;
}

.field {
  margin-bottom: 0;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy-800);
  margin-bottom: 7px;
}

.field .req {
  color: var(--danger);
  font-weight: 700;
  margin-left: 2px;
}

.field .hint {
  margin-top: 5px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--card);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--gold-400);
  box-shadow: 0 0 0 3px rgb(193 146 58 / 0.14);
}

.field textarea {
  resize: vertical;
  min-height: 100px;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

.field .readonly-value {
  width: 100%;
  max-height: 420px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafafa;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.7;
  direction: ltr;
  text-align: left;
  white-space: pre-wrap;
  word-break: break-word;
}

.field .readonly-value pre {
  margin: 0;
  font: inherit;
  white-space: pre-wrap;
  word-break: break-word;
}

input[type="search"] {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
}

input[type="search"]:focus {
  outline: none;
  border-color: var(--gold-400);
  box-shadow: 0 0 0 3px rgb(193 146 58 / 0.15);
}

input[type="time"],
input[type="date"] {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
}

.checkbox-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox-line input {
  width: 16px;
  height: 16px;
  accent-color: var(--gold-500);
}

.error {
  color: var(--danger);
  font-size: 11px;
  margin-top: 4px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px 22px;
  border-top: 1px solid #f0f3f7;
  padding-top: 18px;
}

/* ----------------------------- Rich text ------------------------------ */

.richtext-wrap {
  grid-column: 1 / -1;
}

.richtext-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 8px;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  background: var(--navy-50);
}

.richtext-toolbar button {
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 5px 9px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--navy-800);
  cursor: pointer;
}

.richtext-toolbar button:hover {
  background: var(--navy-100);
}

.richtext-toolbar .sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 4px;
}

.richtext-editor {
  min-height: 260px;
  border: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.9;
}

.richtext-editor:focus {
  outline: none;
  border-color: var(--gold-400);
}

/* ---------------------- چیدمان ویرایشگر (قالب وردپرسی) ---------------------- */

.post-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
  margin-bottom: 20px;
}

.post-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}


/* ---------------- متاباکس انتشار (سبک وردپرس) ---------------- */

.post-box--publish .post-box-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.publish-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.publish-actions .btn-block {
  width: 100%;
}

.publish-actions .is-outline {
  background: var(--card);
  color: var(--navy-800);
  border: 1px solid var(--border);
}

.publish-actions .is-outline:hover {
  background: var(--navy-50);
}

.publish-foot {
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  display: flex;
  justify-content: flex-end;
}

.post-status-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--navy-50);
  color: var(--navy-700);
  border: 1px solid var(--navy-100);
}

.post-status-pill.is-published {
  background: #e9f9ef;
  color: #1a7f47;
  border-color: #bce8cd;
}

.post-status-pill.is-draft {
  background: #fff7e6;
  color: #94700d;
  border-color: #f3e2b0;
}

.post-status-pill.is-archived {
  background: var(--navy-50);
  color: var(--navy-500);
  border-color: var(--border);
}

/* ---------------- درخت دسته‌بندی (سبک وردپرس) ---------------- */

.cat-tree-box {
  border: 1px solid var(--navy-200);
  border-radius: 10px;
  background: #fff;
  padding: 10px 12px;
  max-height: 260px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.cat-tree-box::-webkit-scrollbar {
  width: 8px;
}

.cat-tree-box::-webkit-scrollbar-thumb {
  background: var(--navy-300);
  border-radius: 8px;
}

.cat-tree-box::-webkit-scrollbar-track {
  background: var(--navy-100);
  border-radius: 8px;
}

.cat-tree {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cat-tree .cat-tree {
  margin-top: 4px;
}

.cat-tree-item {
  margin-bottom: 4px;
}

.cat-check-line {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 8px;
}

.cat-check-line:hover {
  background: var(--navy-50);
}

.cat-check-line input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--gold-500);
  margin: 0;
  flex-shrink: 0;
}

.cat-check-name {
  font-size: 13px;
  color: var(--navy-900);
  font-weight: 500;
}

.cat-check-name.is-inactive {
  color: var(--navy-400);
}

.cat-check-count {
  font-size: 11px;
  color: var(--navy-400);
}

.cat-cell-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 320px;
}

@media (max-width: 1080px) {
  .post-layout {
    grid-template-columns: 1fr;
  }
}

/* -------------------------------- Alerts ------------------------------- */

.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 20px;
}

.alert svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.alert-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #bfe3d0;
}

.alert-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #f3c8c8;
}

.alert-warning {
  background: #fff7e0;
  color: #8a6110;
  border: 1px solid #f2e2ae;
}

.alert-warning code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  background: rgb(138 97 16 / 0.08);
  padding: 1px 6px;
  border-radius: 6px;
}

/* ------------------------------- Login --------------------------------- */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(ellipse 60% 45% at 78% -10%, rgb(193 146 58 / 0.14), transparent),
    radial-gradient(ellipse 45% 40% at 8% 0%, rgb(61 109 158 / 0.12), transparent),
    linear-gradient(140deg, var(--navy-950) 0%, var(--navy-900) 45%, var(--navy-800) 100%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.35);
}

.login-brand {
  text-align: center;
  margin-bottom: 26px;
}

.login-brand .brand-mark {
  margin: 0 auto 14px;
  width: 56px;
  height: 56px;
  font-size: 28px;
  border-radius: 16px;
}

.login-brand h1 {
  font-size: 20px;
  font-weight: 800;
  color: var(--navy-950);
  margin-bottom: 4px;
}

.login-brand p {
  font-size: 13px;
  color: var(--text-muted);
}

.login-card .btn {
  margin-top: 6px;
}

.login-card .field {
  margin-bottom: 16px;
}

/* ------------------------------ Responsive ----------------------------- */

@media (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .topbar {
    padding-inline: 16px;
  }

  .topbar-menu {
    display: grid;
  }

  .topbar-collapse {
    display: none;
  }

  .sidebar-close {
    display: grid;
  }

  .page-date,
  .uc-info {
    display: none;
  }

  .sidebar {
    position: fixed;
    inset-block: 0;
    right: 0;
    z-index: 80;
    width: 264px;
    transform: translateX(100%);
    transition: transform 0.24s ease;
    box-shadow: -18px 0 50px rgb(0 0 0 / 0.3);
  }

  .sidebar.is-mobile-open {
    transform: translateX(0);
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 16px;
  }

  .topbar {
    padding: 0 12px;
    height: 56px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .pagination {
    flex-direction: column;
    align-items: flex-start;
  }

  .btn-icon-left span {
    display: none;
  }

  .topbar-actions .btn-ghost {
    width: 38px;
    padding: 0;
  }
}

/* ---------------------- تاریخ‌پیکر شمسی ---------------------- */

.jdp {
  position: relative;
}

.jdp-hidden {
  display: none !important;
}

.jdp-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.jdp-input[readonly] {
  cursor: pointer;
  background: #fff;
}

.jdp-input,
.jdp-time {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.jdp-input:focus,
.jdp-time:focus {
  outline: none;
  border-color: var(--gold-400);
  box-shadow: 0 0 0 3px rgb(193 146 58 / 0.15);
}

.jdp-time {
  max-width: 110px;
  text-align: center;
  direction: ltr;
}

.jdp-clear {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.jdp-clear:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-bg);
}

.jdp-pop {
  position: absolute;
  inset-inline-start: 0;
  top: calc(100% + 6px);
  z-index: 60;
  width: 280px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgb(13 27 42 / 0.16);
  padding: 12px;
  display: none;
}

.jdp-pop.open {
  display: block;
}

.jdp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}

.jdp-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--navy-950);
}

.jdp-nav {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--navy-800);
  font-size: 16px;
  cursor: pointer;
}

.jdp-nav:hover {
  border-color: var(--gold-400);
  color: var(--gold-600);
}

.jdp-wk {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 4px;
}

.jdp-wk span {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 4px 0;
}

.jdp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.jdp-blank {
  padding: 6px 0;
}

.jdp-day {
  display: grid;
  place-items: center;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.jdp-day:hover {
  background: var(--navy-100);
}

.jdp-day.today {
  color: var(--gold-700);
  font-weight: 800;
}

.jdp-day.sel {
  background: var(--gold-500);
  color: #fff;
  font-weight: 800;
}

.jdp-foot {
  margin-top: 8px;
  border-top: 1px solid #f0f3f7;
  padding-top: 8px;
  text-align: center;
}

.jdp-today {
  border: none;
  background: var(--navy-50);
  color: var(--navy-800);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 8px;
  cursor: pointer;
}

.jdp-today:hover {
  background: var(--navy-100);
}

/* ---------------------- برچسب‌ها (tags) ---------------------- */

.tag-editor {
  width: 100%;
}

.tag-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--navy-50);
  border: 1px solid var(--navy-200);
  color: var(--navy-800);
  border-radius: 999px;
  padding: 4px 6px 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

.tag-x {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: var(--navy-200);
  color: var(--navy-900);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.tag-x:hover {
  background: var(--danger);
  color: #fff;
}

.tag-input {
  flex: 1;
  min-width: 160px;
  border: none !important;
  outline: none;
  box-shadow: none !important;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 13px;
  background: transparent;
}

/* ---------------------- فهرست رشته‌ها ---------------------- */

.strlist .sl-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.sl-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sl-item {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
}

/* ---------------------- فهرست فیلدها ---------------------- */

.fieldlist .fl-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.fl-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr 130px auto auto;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--navy-50);
}

.fl-row input,
.fl-row select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  background: #fff;
}

.fl-row .checkbox-line {
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------------------- بندهای بدنه قالب ---------------------- */

.clauselist .cl-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 10px;
}

.cl-row {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--navy-50);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cl-title {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  background: #fff;
}

.cl-body {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.9;
  resize: vertical;
  min-height: 90px;
  background: #fff;
}

.cl-row .btn {
  align-self: flex-end;
}

@media (max-width: 860px) {
  .fl-row {
    grid-template-columns: 1fr;
  }
}

/* ---------------------- تقویم اسلات‌ها ---------------------- */

.slots-calendar {
  width: 100%;
  padding: 0 22px 22px;
}

.sl-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.sl-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sl-title {
  min-width: 150px;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  color: var(--navy-950);
}

.sl-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.sl-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-inline-end: 6px;
}

.lg-free {
  background: var(--success);
}

.lg-booked {
  background: var(--gold-500);
}

.sl-wk {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 6px;
}

.sl-wk span {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 4px 0;
}

.sl-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  position: relative;
  min-height: 320px;
}

.sl-day {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #fff;
}

.sl-day.is-blank {
  border-color: transparent;
  background: transparent;
  min-height: 0;
}

.sl-day.is-today {
  border-color: var(--gold-400);
  box-shadow: 0 0 0 2px rgb(193 146 58 / 0.12);
}

.sl-num {
  font-size: 12px;
  font-weight: 800;
  color: var(--navy-800);
}

.sl-day.is-today .sl-num {
  color: var(--gold-700);
}

.sl-events {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
  flex: 1;
}

.sl-ev {
  border: none;
  border-radius: 6px;
  padding: 3px 6px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  text-align: start;
  cursor: pointer;
  direction: ltr;
}

.sl-ev.is-free {
  background: var(--success-bg);
  color: var(--success);
}

.sl-ev.is-booked {
  background: var(--navy-100);
  color: var(--navy-800);
}

.sl-ev:hover {
  filter: brightness(0.95);
}

.sl-more {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}

.sl-loading::after {
  content: 'در حال بارگذاری...';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgb(255 255 255 / 0.72);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  border-radius: 12px;
  z-index: 2;
}

.sl-msg {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  padding: 24px;
}

@media (max-width: 640px) {
  .sl-grid {
    display: block;
    min-height: 0;
  }

  .sl-day {
    min-height: 0;
  }

  .sl-day.is-blank {
    display: none;
  }

  .sl-events {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sl-legend {
    display: none;
  }
}

/* ---------------------- انتخابگر سرچی (کاربر/دسته‌بندی) ---------------------- */

.sel-search.is-hidden {
  display: none;
}

.search-select {
  position: relative;
  width: 100%;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-field:focus-within {
  border-color: var(--accent, #c9a24b);
  box-shadow: 0 0 0 3px rgb(201 162 75 / 0.15);
}

.search-display {
  flex: 0 0 auto;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.search-query {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
}

.search-query::placeholder {
  color: var(--text-muted);
}

.search-clear {
  flex: 0 0 auto;
  display: inline-block;
  width: 20px;
  height: 20px;
  line-height: 18px;
  text-align: center;
  border: 0;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
}

.search-clear:hover {
  background: var(--danger);
  color: #fff;
}

.search-dropdown {
  display: none;
  position: absolute;
  z-index: 60;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 32px rgb(15 23 42 / 0.16);
}

.search-item {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  background: #fff;
  text-align: right;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.search-item:hover,
.search-item.is-selected {
  background: rgb(201 162 75 / 0.12);
  font-weight: 700;
}

/* پیشنهادهای برچسب (دسته‌بندی‌های موجود) */

.tag-suggest {
  position: absolute;
  z-index: 60;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 32px rgb(15 23 42 / 0.16);
}

.tag-editor {
  position: relative;
}

.tag-suggest-item {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  background: #fff;
  text-align: right;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.tag-suggest-item:hover {
  background: rgb(201 162 75 / 0.12);
  font-weight: 700;
}
/* ---------- Article Categories (WordPress-style hierarchy) ---------- */
.cat-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.cat-form-col .card-body {
  padding: 18px 20px;
}

.cat-table td {
  vertical-align: middle;
}

.cat-table .badge {
  font-size: 11px;
}

.cat-indent {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.cat-indent-prefix {
  color: var(--navy-400);
  font-weight: 700;
  display: inline-grid;
  place-items: center;
}

.cat-check,
.cat-check-all {
  accent-color: var(--navy-700);
  cursor: pointer;
}

.cat-row.cat-highlight td {
  background: var(--gold-100);
  animation: cat-pulse 1.6s ease;
}

@keyframes cat-pulse {
  0% { background: var(--gold-200); }
  100% { background: var(--gold-100); }
}

.cat-edit-row td {
  background: var(--navy-50);
  box-shadow: inset 0 -2px 0 var(--gold-500);
}

.cat-inline-form {
  width: 100%;
}

.cat-inline-fields {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 90px auto;
  gap: 6px 14px;
  align-items: end;
  padding: 6px 0 4px;
}

@media (max-width: 1200px) {
  .cat-layout { grid-template-columns: 280px minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .cat-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .cat-form-col { order: -1; }
  .cat-inline-fields {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

@media (max-width: 640px) {
  .cat-inline-fields { grid-template-columns: 1fr; }
}

/* ==========================================================================
   ���� ����� / �������� ����� (�Ș ��ρ��)
   ========================================================================== */

.media-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.media-toolbar {
  margin-bottom: 0;
  gap: 12px;
}

.media-search {
  min-width: 260px;
}

.media-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--navy-50);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
}

.media-tab {
  border: 0;
  background: transparent;
  padding: 7px 16px;
  border-radius: 9px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.14s ease;
}

.media-tab:hover {
  color: var(--navy-900);
}

.media-tab.active {
  background: var(--card);
  color: var(--navy-950);
  box-shadow: var(--shadow-sm);
}

/* ����� ��� */
.media-dropzone {
  border: 2px dashed var(--navy-300);
  border-radius: 16px;
  background: var(--navy-50);
}

.media-dropzone.is-over {
  border-color: var(--gold-500);
  background: var(--gold-50);
}

.dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 34px 20px;
  text-align: center;
  color: var(--navy-800);
  cursor: pointer;
}

.dropzone-inner p {
  font-weight: 700;
}

.dropzone-note {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

/* صف آپلود چندفایلی — نوار پیشرفت جداگانه هر فایل */
.upload-queue {
  margin: 14px 16px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  text-align: right;
  cursor: default;
  overflow: hidden;
}

.upload-queue-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--navy-50);
  font-weight: 700;
  font-size: 13px;
  color: var(--navy-900);
}

.upload-queue-head .uq-title {
  flex: 1;
}

.upload-queue-head .uq-summary {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.uq-close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  cursor: pointer;
}

.uq-close:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.upload-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow: auto;
  padding: 10px;
}

.upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-size: 12px;
}

.upload-row.is-waiting .upload-track {
  opacity: 0.45;
}

.upload-name {
  flex: 0 1 240px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--navy-900);
}

.upload-track {
  flex: 1;
  height: 8px;
  background: var(--navy-100);
  border-radius: 99px;
  overflow: hidden;
}

.upload-bar {
  width: 0;
  height: 100%;
  background: var(--navy-500);
  border-radius: 99px;
  transition: width 0.15s ease;
}

.upload-pct {
  flex: 0 0 46px;
  text-align: center;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.upload-row.is-done .upload-bar {
  background: var(--success);
}

.upload-row.is-done .upload-pct {
  color: var(--success);
  font-weight: 700;
}

.upload-row.is-error {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.upload-row.is-error .upload-track,
.upload-row.is-error .upload-pct {
  display: none;
}

.upload-err {
  flex: 1;
  color: var(--danger);
  font-weight: 600;
}

.upload-queue-foot {
  padding: 9px 14px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px dashed var(--border);
}

.upload-queue-foot.has-fail {
  color: var(--danger);
  font-weight: 600;
}

/* ������: ���� + ������ */
.media-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
}

.media-main {
  min-width: 0;
}

/* ���� ������ */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px;
}

.media-grid-item {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.media-grid-item:hover {
  border-color: var(--gold-400);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.media-grid-item.is-selected {
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgb(193 146 58 / 0.22);
}

.media-thumb {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, var(--navy-100), var(--navy-50));
  overflow: hidden;
}

.media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.media-thumb.file {
  background: linear-gradient(160deg, var(--navy-900), var(--navy-800));
  color: var(--gold-300);
  position: relative;
}

.media-thumb.file svg {
  width: 34px;
  height: 34px;
}

.ext-chip {
  position: absolute;
  bottom: 8px;
  inset-inline-start: 8px;
  font-size: 10px;
  font-weight: 800;
  color: var(--navy-950);
  background: var(--gold-400);
  border-radius: 6px;
  padding: 2px 7px;
  text-transform: uppercase;
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-filename {
  padding: 8px 10px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: rtl;
  text-align: right;
}

.media-grid-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 70px 20px;
  color: var(--text-muted);
  text-align: center;
}

.media-grid-loading {
  text-align: center;
  color: var(--text-muted);
  padding: 18px;
  font-size: 13px;
}

.media-load-more {
  display: block;
  margin: 16px auto 0;
}

/* ��� ������ */
.media-details {
  position: sticky;
  top: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 220px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.media-detail-empty {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 30px 0;
}

.media-detail-prev .media-thumb {
  aspect-ratio: 16 / 9;
  border-radius: 10px;
}

.media-detail-prev .thumb-lg.file svg {
  width: 44px;
  height: 44px;
}

.media-detail-file {
  font-weight: 800;
  font-size: 14px;
  color: var(--navy-950);
  word-break: break-word;
}

.media-detail-rename {
  display: flex;
  gap: 6px;
}

.media-detail-rename input {
  flex: 1;
  min-width: 0;
  font-size: 12px;
}

.media-detail-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.media-detail-meta span {
  font-weight: 700;
  color: var(--text);
}

.media-detail-row input {
  width: 100%;
  direction: ltr;
  text-align: left;
  font-size: 11px;
  background: var(--navy-50);
}

.media-detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

/* ------------- �����Ȑ� ����� ------------- */
.media-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgb(13 27 42 / 0.6);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.media-picker-backdrop[hidden],
.media-dropzone[hidden],
[data-media-details][hidden],
.media-grid-loading[hidden],
.media-load-more[hidden],
.media-grid-empty[hidden],
.media-picker-empty[hidden],
.media-picker-loading[hidden] {
  display: none;
}

body.media-modal-open {
  overflow: hidden;
}

.media-picker {
  width: min(1080px, 100%);
  height: min(660px, 100%);
  background: var(--card);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgb(13 27 42 / 0.35);
  animation: media-pop 0.18s ease;
}

@keyframes media-pop {
  from { transform: scale(0.97); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.media-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.picker-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
  color: var(--navy-950);
}

.picker-title svg {
  width: 18px;
  height: 18px;
  color: var(--gold-600);
}

.media-picker-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--navy-50);
}

.media-picker-toolbar input {
  flex: 1;
  min-width: 0;
}

.media-picker-toolbar .picker-upload-btn {
  flex-shrink: 0;
}

/* ناحیهٔ آپلود داخل انتخابگر رسانه */
.media-picker-dropzone {
  margin: 12px 18px 0;
  max-height: 44vh;
  overflow: auto;
}

.media-picker-dropzone .dropzone-inner {
  padding: 20px;
}

.media-picker-dropzone .upload-queue {
  margin: 12px 0 0;
}

.media-picker-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

.media-picker-grid {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
  gap: 12px;
  align-content: start;
  padding: 16px;
}

.media-picker-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-muted);
  text-align: center;
}

.media-picker-side {
  width: 260px;
  flex-shrink: 0;
  border-inline-start: 1px solid var(--border);
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--navy-50);
}

.media-picker-side-empty {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  padding: 40px 8px;
}

.media-picker-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--card);
}

.picker-selected {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-actions {
  display: flex;
  gap: 8px;
}

/* ------------- ����� �� ����� ------------- */
.media-insert-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.media-url-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.media-url-box > input {
  direction: ltr;
  text-align: left;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 12px;
}

.media-url-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.media-url-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
}

.media-url-preview img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.media-url-preview.is-file {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1000px) {
  .media-layout { grid-template-columns: 1fr; }
  .media-details { position: static; max-height: none; }
  .media-picker-side { width: 220px; }
}

@media (max-width: 720px) {
  .media-picker-body { flex-direction: column; }
  .media-picker-side {
    width: 100%;
    border-inline-start: none;
    border-top: 1px solid var(--border);
    max-height: 200px;
  }
  .media-picker-toolbar { flex-wrap: wrap; }
  .media-toolbar { flex-direction: column; align-items: stretch; }
}

/* =================== Instagram (admin) =================== */

.ig-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(135deg, #faf0ff, #fff);
}

.ig-hero-info { display: flex; align-items: center; gap: 16px; }

.ig-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  flex-shrink: 0;
}

.ig-actions .btn {
  justify-content: center;
  min-width: 210px;
}

.ig-actions .btn svg {
  width: 17px;
  height: 17px;
}

@media (max-width: 600px) {
  .ig-actions,
  .ig-actions .btn {
    width: 100%;
  }
}

.ig-logo {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
  box-shadow: 0 8px 22px rgba(220, 39, 67, 0.28);
}
.ig-logo svg { width: 26px; height: 26px; }

.ig-hero h2 { margin: 0 0 4px; font-size: 17px; font-weight: 800; color: var(--text-strong); }
.ig-hero p { margin: 0; font-size: 13px; line-height: 1.9; color: var(--text-muted); max-width: 620px; }

.ig-status {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.ig-status .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.ig-status.ok { background: var(--success-bg); color: var(--success); }
.ig-status.no { background: var(--destructive-bg, #fdecec); color: var(--danger, #c0392b); }

.ig-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  padding: 20px;
}

.ig-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.ig-card:hover { box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08); transform: translateY(-2px); }

.ig-card-thumb { position: relative; height: 150px; background: var(--navy-50); }
.ig-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ig-card-no {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 12px;
}

.ig-type-badge {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.ig-card-body { padding: 12px 14px 14px; }
.ig-card-caption {
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--text-strong);
  min-height: 46px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ig-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--text-muted);
}
.ig-card-meta a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--navy-700);
  font-weight: 700;
  text-decoration: none;
}
.ig-card-meta a:hover { color: var(--gold-700); }
.ig-card-meta a svg { width: 13px; height: 13px; }

@media (max-width: 600px) {
  .ig-hero { flex-direction: column; align-items: flex-start; }
}

/* ---------------- تنظیمات سئو ---------------- */
.seo-page { display: flex; flex-direction: column; gap: 18px; }
.seo-preview {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  padding: 14px 18px;
  max-width: 600px;
  box-shadow: 0 2px 10px rgba(13, 27, 42, 0.04);
}
.seo-preview-title { color: #1a0dab; font-size: 15px; font-weight: 700; line-height: 1.6; }
.seo-preview-url { color: #0d652d; font-size: 12.5px; margin-top: 2px; direction: ltr; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seo-preview-desc { color: #4d5156; font-size: 13px; line-height: 1.8; margin-top: 4px; }

/* ---------------- پاسخ خودکار اینستاگرام ---------------- */
.alert-info {
  background: var(--info-bg, #e8f2fd);
  color: var(--info, #1d6fb8);
  border: 1px solid #cfe4f7;
}
.alert-info code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  background: rgb(29 111 184 / 0.1);
  padding: 1px 6px;
  border-radius: 6px;
  direction: ltr;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-strong);
  cursor: pointer;
}
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #d4d9e0;
  transition: background 0.2s ease;
}
.switch .slider::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  inset-inline-start: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgb(0 0 0 / 0.2);
  transition: inset-inline-start 0.2s ease;
}
.switch input:checked + .slider { background: var(--success, #16a34a); }
.switch input:checked + .slider::before { inset-inline-start: 23px; }

.ig-autoreply-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.ig-autoreply-row:last-child { border-bottom: 0; }
.ig-autoreply-id {
  flex-shrink: 0;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 11.5px;
  color: var(--text-muted);
  background: var(--navy-50);
  padding: 3px 8px;
  border-radius: 8px;
}
.ig-autoreply-text {
  flex: 1;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ig-autoreply-time {
  flex-shrink: 0;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* قوانین پاسخ‌دهی کلمه‌ای اینستاگرام */
.ig-rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
  padding: 4px;
}
.ig-rules-channel { margin: 0; }
.ig-rules-channel .card-head .card-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ig-rules-channel .card-title svg { width: 17px; height: 17px; }
.ig-rule-add {
  border-bottom: 1px solid var(--border);
  padding: 0 16px 14px;
  margin-bottom: 10px;
  gap: 12px;
}
.ig-rule-add .field { margin-bottom: 0; }
.ig-rule {
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: 0 16px 10px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease;
}
.ig-rule:hover { box-shadow: var(--shadow-md); }
.ig-rule > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  flex-wrap: wrap;
}
.ig-rule > summary::-webkit-details-marker { display: none; }
.ig-rule > summary::after {
  content: "▾";
  color: var(--text-muted);
  font-size: 11px;
  margin-inline-start: auto;
  transition: transform 0.15s ease;
}
.ig-rule[open] > summary { border-bottom: 1px solid var(--border); }
.ig-rule[open] > summary::after { transform: rotate(180deg); }
.ig-rule-id {
  flex-shrink: 0;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 11.5px;
  color: var(--text-muted);
  background: var(--navy-50);
  padding: 2px 7px;
  border-radius: 7px;
}
.ig-rule-kw {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1 1 180px;
  min-width: 120px;
}
.ig-kw {
  background: var(--gold-50);
  color: var(--gold-700);
  border: 1px solid var(--gold-200);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  line-height: 1.6;
}
.ig-kw--all {
  background: var(--success-bg);
  color: var(--success);
  border-color: #bfe0d3;
}
.ig-rule-reply {
  color: var(--text-muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 40%;
}
.ig-rule-off {
  font-size: 11px;
  color: var(--danger);
  background: var(--danger-bg);
  padding: 2px 8px;
  border-radius: 999px;
}
.ig-rule-hint {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.8;
}
.ig-rule-body {
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: start;
}
.ig-rule-body .field { margin-bottom: 10px; }
.ig-rule-body .form-actions { padding: 0; margin: 0; }
.ig-rule-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}
.ig-rule-toggle .switch-row { gap: 8px; font-size: 12.5px; }
.ig-rules-channel .empty { margin: 0 16px 16px; padding: 22px 10px; }
@media (max-width: 720px) {
  .ig-rule-body { grid-template-columns: 1fr; }
  .ig-rule-side { flex-direction: row; }
  .ig-rule-reply { max-width: 100%; }
}

/* ------------------------- قراردادهای کاربران ------------------------- */

.btn-block { width: 100%; justify-content: center; }

.field-error {
  display: block;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--danger);
}

.cur-body { padding: 18px 22px; }

/* هدر صفحه */
.hero-card {
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--navy-950) 0%, var(--navy-800) 100%);
  box-shadow: var(--shadow-md);
  color: #fff;
}
.hero-card::before {
  content: "";
  position: absolute;
  top: -140px;
  inset-inline-end: -80px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(208 166 79 / 0.28), transparent 70%);
  pointer-events: none;
}
.hero-inner {
  position: relative;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.hero-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid rgb(255 255 255 / 0.25);
  border-radius: 10px;
  color: #e8eef6;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s ease;
}
.hero-back:hover {
  background: rgb(255 255 255 / 0.1);
  color: #fff;
}
.hero-eyebrow {
  font-size: 12px;
  color: var(--navy-300);
}
.hero-title {
  margin-top: 4px;
  font-size: 21px;
  font-weight: 800;
  line-height: 1.6;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.1);
  border: 1px solid rgb(255 255 255 / 0.16);
  font-size: 12px;
  color: #dfe8f2;
}
.hero-chip svg {
  width: 13px;
  height: 13px;
  color: var(--gold-300);
}
.hero-chip b {
  color: #fff;
  font-weight: 700;
}
.hero-decision {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.9;
}
.hero-decision.ok {
  background: rgb(227 246 236 / 0.12);
  border: 1px solid rgb(26 127 75 / 0.5);
  color: #d6f5e6;
}
.hero-decision.bad {
  background: rgb(254 233 231 / 0.12);
  border: 1px solid rgb(179 38 30 / 0.55);
  color: #ffe3e0;
}
.hero-decision svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 3px;
}

/* سند قرارداد */
.doc-card .card-head { padding-bottom: 14px; }
.doc-paper {
  margin: 0 22px 22px;
  background: #fff;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 14px;
  overflow: hidden;
}
.doc-paper .doc-title::before {
  content: "";
  display: block;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gold-400), var(--gold-600));
  margin-bottom: 12px;
}
.doc-inner {
  padding: 34px 38px 30px;
}
.doc-title {
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  color: var(--navy-950);
  line-height: 1.8;
}
.doc-title small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}
.doc-divider {
  width: 64px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gold-400), var(--gold-600));
  margin: 14px auto;
}
.doc-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--navy-900);
  padding: 0 4px 14px;
  margin-bottom: 22px;
}
.doc-meta strong { color: var(--navy-950); }
.doc-meta svg { width: 14px; height: 14px; vertical-align: -2px; color: var(--gold-500); }
.doc-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 10px;
}
.doc-party {
  background: var(--navy-50);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
}
.doc-party span {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.doc-party strong { font-size: 13.5px; color: var(--navy-950); }
.doc-clauses {
  list-style: none;
  margin: 0;
  padding: 0;
}
.doc-clause {
  display: flex;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px dashed var(--border);
}
.doc-clause:first-child { padding-top: 4px; }
.doc-clause:last-child { border-bottom: none; }
.doc-clause-num {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--gold-100);
  color: var(--gold-700);
  font-size: 14px;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.doc-clause-body { min-width: 0; }
.doc-clause h4 {
  font-size: 15px;
  font-weight: 800;
  color: var(--navy-900);
  margin-bottom: 4px;
}
.doc-clause p {
  margin: 0;
  font-size: 13.5px;
  line-height: 2.15;
  color: var(--text);
  text-align: justify;
  white-space: pre-line;
}
.doc-free {
  font-size: 13.5px;
  line-height: 2.15;
  color: var(--text);
  text-align: justify;
  white-space: pre-line;
}
.doc-empty { padding: 44px 10px; }
.doc-sign {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-top: 28px;
}
.doc-sign-col {
  text-align: center;
  padding-top: 10px;
  border-top: 1px dashed var(--gold-500);
  font-size: 12px;
  color: var(--text-muted);
}

/* دکمه‌های سند */
.doc-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* مراحل گردش کار */
.stepper {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: flex;
  justify-content: space-between;
}
.stepper li {
  position: relative;
  flex: 1;
  text-align: center;
  min-width: 0;
}
.stepper li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 14px;
  inset-inline-start: calc(50% + 18px);
  width: calc(100% - 36px);
  height: 2px;
  background: var(--navy-100);
  border-radius: 2px;
}
.stepper-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--navy-100);
  color: var(--text-muted);
  transition: background 0.15s ease, color 0.15s ease;
}
.stepper-dot svg { width: 13px; height: 13px; }
.stepper-label {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
}
.stepper li.active .stepper-dot {
  background: var(--navy-900);
  color: #fff;
  box-shadow: 0 0 0 4px rgb(31 51 80 / 0.12);
}
.stepper li.done .stepper-dot {
  background: var(--gold-400);
  color: #fff;
}
.stepper li.red .stepper-dot {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 0 0 4px rgb(179 38 30 / 0.12);
}
.stepper li.active .stepper-label,
.stepper li.done .stepper-label,
.stepper li.red .stepper-label {
  color: var(--navy-900);
  font-weight: 700;
}

/* نسخه‌های قرارداد */
.rev-list { list-style: none; margin: 0; padding: 0; }
.rev-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 8px;
  transition: background 0.12s ease;
}
.rev-item:hover { background: var(--navy-50); }
.rev-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold-400);
  flex-shrink: 0;
}
.rev-item.muted .rev-dot { background: var(--navy-200); }
.rev-ver { font-size: 12px; font-weight: 800; color: var(--navy-900); min-width: 72px; }
.rev-date { margin-inline-start: auto; font-size: 11.5px; color: var(--text-muted); }

/* کارت کاربر */
.member {
  display: flex;
  align-items: center;
  gap: 12px;
}
.member-avatar {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--navy-700), var(--navy-950));
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.member-name { font-size: 14.5px; font-weight: 800; color: var(--navy-950); }
.member-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* جدول جزئیات */
.dlist { display: flex; flex-direction: column; }
.dlist-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f3f7;
}
.dlist-row:last-child { border-bottom: none; }
.dlist-label { font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
.dlist-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy-950);
  overflow-wrap: anywhere;
  text-align: left;
  direction: rtl;
}
.dlist-value .badge { font-weight: 400; }

@media (max-width: 720px) {
  .doc-parties,
  .doc-sign { grid-template-columns: 1fr; }
  .doc-inner { padding: 24px 18px 22px; }
  .dlist-row { flex-direction: column; align-items: flex-start; gap: 2px; }
  .dlist-value { text-align: right; }
}

@media print {
  body { background: #fff !important; }
  .hero-card,
  .post-side,
  .toolbar,
  .topbar,
  .sidebar,
  .doc-card .card-head { display: none !important; }
  .post-layout { display: block !important; }
  .doc-card { border: none; box-shadow: none; margin: 0 !important; }
  .doc-paper { margin: 0 !important; border: none; }
}

/* ===== virarish user contract edit ===== */
.hero-chip.warn { background: rgba(200,140,20,.12); color: #b7791f; border-color: rgba(200,140,20,.35); }
.field-space > label { display:flex; align-items:center; gap:6px; margin-bottom:8px; font-size:12.5px; font-weight:600; color:var(--text); }
.sec-row { border:1px solid var(--border); border-radius:10px; padding:12px 12px 10px; margin-bottom:10px; background:#f8fafc; }
.sec-row > input,
.sec-row > textarea { width:100%; }
.sec-row > input { margin-bottom:8px; }
.sec-actions { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:8px; }
.sec-order { font-size:12px; color:var(--text-muted); }
.sec-order b { color:var(--text); }

/* =====================================================================
 * فرم‌های ویرایشگر (formLayout = split) — دوره، مقاله، ویدیو
 * تمام قواعد این بخش زیر .post-layout محدود می‌شوند تا به شش‌دها فرم
 * سادهٔ پنل و به کارت‌ها/دکمه‌های مشترک دست نزنند.
 * ===================================================================== */

/* --- نوار هویت بالای فرم --- */
.post-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.post-top-id {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.post-top-kind {
  font-size: 14px;
  font-weight: 800;
  color: var(--navy-950);
}

.post-top-state {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* --- بلوک‌های ستون اصلی: عنوان با خط زیرین، بدنه در شبکهٔ سیال --- */
.post-section + .post-section {
  margin-top: 28px;
}

.post-section-title {
  margin: 0 0 16px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 800;
  color: var(--navy-950);
}

.post-section-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px 20px;
}

.post-section-body .field {
  margin-bottom: 0;
}

/* این دو، قاعدهٔ .post-main .field.full را باطل می‌کنند که grid-column را auto می‌کرد. */
.post-main .post-section-body .field.full,
.post-main .post-section-body .field.title-field {
  grid-column: 1 / -1;
}

.post-section-body .field label {
  font-size: 13px;
}

.post-section-body .field input,
.post-section-body .field select,
.post-section-body .field textarea {
  font-size: 14px;
  padding: 10px 13px;
}

/* --- عنوان: درشت‌تر، چون سرلوحهٔ سند است --- */
.post-main .title-field input {
  font-size: 22px;
  padding: 16px 18px;
}

/* --- راهنمای حالت خالیِ ویرایشگر (پیش‌تر data-placeholder خوانده نمی‌شد) --- */
.post-main .richtext-editor.is-empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}

/* --- شمارندهٔ کاراکتر خلاصه --- */
.post-counter {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.post-counter.is-near {
  color: var(--gold-500);
  font-weight: 700;
}

.post-counter.is-over {
  color: var(--danger);
  font-weight: 700;
}

/* --- ستون کناری ثابت (sticky) و بدون اسکرول داخلی.
       اگر ستون بلندتر از صفحه باشد، اسکریپت فرم مقدار `top` را پایین
       می‌آورد تا ته ستون (جعبهٔ انتشار) هم در دید بماند. --- */
.post-side.is-sticky {
  position: sticky;
  top: 18px;
  align-self: start;
}

/* --- جعبهٔ انتشار: پنل اصلی، با لبهٔ طلایی --- */
.post-box--publish {
  border-top: 3px solid var(--gold-500);
  background: linear-gradient(180deg, #fff 0%, var(--card) 100%);
}

.post-box--publish .card-head {
  padding-top: 15px;
}

.post-box--publish .card-title {
  color: var(--navy-900);
}

/* --- سلسله‌مراتب دکمه‌ها: اصلی، ثانویه، سوم --- */
.publish-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.publish-actions .btn-block {
  text-align: center;
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 700;
  border-radius: 10px;
}

.publish-actions .btn-gold {
  background: var(--gold-500);
  color: #fff;
  border: 1px solid var(--gold-600);
  box-shadow: 0 1px 2px rgb(180 130 40 / 0.25);
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
}

.publish-actions .btn-gold:hover {
  background: var(--gold-600);
  box-shadow: 0 2px 6px rgb(180 130 40 / 0.35);
}

.publish-actions .btn-gold:active {
  transform: scale(0.985);
}

.publish-actions .is-outline {
  background: transparent;
  color: var(--navy-700);
  border: 1px solid var(--border);
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.publish-actions .is-outline:hover {
  background: var(--navy-50);
  border-color: var(--navy-300);
  color: var(--navy-900);
}

.publish-actions .is-quiet {
  background: transparent;
  color: var(--navy-600);
  border: 1px solid transparent;
  transition: color 0.12s ease, background 0.12s ease;
}

.publish-actions .is-quiet:hover {
  background: var(--navy-50);
  color: var(--navy-800);
}

.publish-actions .is-quiet.is-active {
  color: var(--navy-900);
  background: var(--navy-100);
}

/* =====================================================================
 *  Luxury navy/gold theme — split editor (courses / articles / videos)
 *  This block only targets the split-layout form, so simple resource
 *  forms, tables, and the rest of the panel stay untouched.
 * ===================================================================== */

.post-layout {
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
}

/* --- نوار هویت صفحه: هدر سرمه‌ای برجسته با لبهٔ طلایی --- */
.post-top {
  position: relative;
  align-items: center;
  padding: 20px 26px;
  margin-bottom: 22px;
  border: none;
  border-radius: 18px;
  color: #fff;
  background:
    radial-gradient(120% 170% at 100% 0%, rgb(193 146 58 / 0.30), transparent 58%),
    linear-gradient(120deg, var(--navy-950) 0%, var(--navy-800) 100%);
  box-shadow: 0 16px 36px -14px rgb(13 27 42 / 0.55);
  overflow: hidden;
}

.post-top::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: linear-gradient(180deg, var(--gold-300), var(--gold-600));
}

.post-top-id {
  align-items: center;
  gap: 12px;
}

.post-top-kind {
  color: #fff;
  font-size: 18px;
  letter-spacing: 0.2px;
}

.post-top-state {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: #f0e2c2;
  background: rgb(193 146 58 / 0.18);
  border: 1px solid rgb(193 146 58 / 0.38);
}

.post-top .btn {
  background: rgb(255 255 255 / 0.08);
  border: 1px solid rgb(255 255 255 / 0.22);
  color: #eaf0f7;
}

.post-top .btn:hover {
  background: rgb(255 255 255 / 0.16);
  border-color: rgb(255 255 255 / 0.36);
}

/* --- ستون اصلی: هر بخش یک کارت برجسته --- */
.post-main {
  gap: 20px;
}

.post-section {
  position: relative;
  padding: 22px 22px 24px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 1px 2px rgb(13 27 42 / 0.04), 0 14px 30px -20px rgb(13 27 42 / 0.40);
}

.post-section + .post-section {
  margin-top: 0;
}

.post-section-title {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 0 20px;
  padding-bottom: 0;
  border-bottom: none;
  font-size: 15px;
  font-weight: 800;
  color: var(--navy-900);
}

.post-section-title::before {
  content: "";
  width: 4px;
  height: 20px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--gold-400), var(--gold-600));
  box-shadow: 0 0 0 4px rgb(193 146 58 / 0.12);
}

/* --- ورودی‌ها: نرم، روشن و با فوکوس طلایی --- */
.post-layout .field label {
  margin-bottom: 8px;
  color: var(--navy-800);
}

.post-layout .field input,
.post-layout .field select,
.post-layout .field textarea {
  padding: 11px 14px;
  border: 1px solid #e4eaf2;
  border-radius: 12px;
  background: #fbfcfe;
  box-shadow: inset 0 1px 2px rgb(13 27 42 / 0.02);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.post-layout .field input:hover,
.post-layout .field select:hover,
.post-layout .field textarea:hover {
  border-color: #cfdae8;
}

.post-layout .field input:focus,
.post-layout .field select:focus,
.post-layout .field textarea:focus {
  outline: none;
  border-color: var(--gold-400);
  background: #fff;
  box-shadow: 0 0 0 3px rgb(193 146 58 / 0.16);
}

.post-main .title-field input {
  padding: 16px 18px;
  font-size: 21px;
  font-weight: 700;
  background: #fff;
}

/* --- ویرایشگر متن --- */
.post-layout .richtext-toolbar {
  padding: 9px 10px;
  border: 1px solid #e4eaf2;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(180deg, #f7fafd, #eef3f9);
}

.post-layout .richtext-editor {
  min-height: 280px;
  border: 1px solid #e4eaf2;
  border-top: none;
  border-radius: 0 0 12px 12px;
}

/* --- ستون کناری: کارت‌های تمیز با سرستون مشخص --- */
.post-side .card {
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgb(13 27 42 / 0.04), 0 14px 30px -22px rgb(13 27 42 / 0.40);
  overflow: hidden;
}

.post-side .card-head {
  padding: 15px 18px;
  background: linear-gradient(180deg, #f7fafd, #f1f5fa);
  border-bottom: 1px solid var(--border);
}

.post-side .card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--navy-900);
}

.post-side .card-title::before {
  content: "";
  width: 3px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--gold-400), var(--gold-600));
}

.post-side .post-box-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.post-side .post-box-body .field {
  margin-bottom: 0;
}

/* --- جعبهٔ انتشار: سرستون سرمه‌ای + دکمهٔ طلایی برجسته --- */
.post-side .post-box--publish {
  border-top: none;
  background: var(--card);
}

.post-side .post-box--publish .card-head {
  padding: 15px 18px;
  background: linear-gradient(135deg, var(--navy-900), var(--navy-800));
  border-bottom: none;
}

.post-side .post-box--publish .card-title,
.post-side .post-box--publish .card-title::before {
  color: #fff;
}

.post-side .post-box--publish .post-status-pill {
  background: rgb(255 255 255 / 0.14);
  color: #fff;
  border-color: rgb(255 255 255 / 0.22);
}

.publish-actions .btn-block {
  padding: 11px 14px;
  border-radius: 12px;
}

.publish-actions .btn-gold {
  background: linear-gradient(180deg, var(--gold-400), var(--gold-600));
  color: #2a1c05;
  border: none;
  box-shadow: 0 8px 18px -8px rgb(168 120 47 / 0.85);
}

.publish-actions .btn-gold:hover {
  background: linear-gradient(180deg, var(--gold-300), var(--gold-500));
}

.publish-actions .is-outline {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--navy-800);
}

.publish-actions .is-outline:hover {
  background: var(--navy-50);
  border-color: var(--navy-200);
}

