/* ============================================================
   Skin Home Clinic — Design System
   بدون وابستگی به CDN — فقط منابع محلی
   ============================================================ */

/* --- Fonts ------------------------------------------------- */
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-500.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-700.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}

/* --- Variables --------------------------------------------- */
:root {
  --primary:      #e11d48;
  --primary-dark: #be123c;
  --primary-light:#fff1f2;
  --sidebar-bg:   #111827;
  --sidebar-hover:#1f2937;
  --sidebar-active:#e11d48;
  --bg:           #f8fafc;
  --surface:      #ffffff;
  --border:       #e2e8f0;
  --text:         #1e293b;
  --text-muted:   #64748b;
  --text-light:   #94a3b8;
  --success:      #16a34a;
  --warning:      #d97706;
  --danger:       #dc2626;
  --info:         #2563eb;
  --radius:       10px;
  --radius-lg:    16px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:       0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
  --shadow-lg:    0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.04);
  --sidebar-w:    240px;
}

/* --- Reset ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Vazirmatn', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  direction: rtl;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}
img, svg { display: block; }

/* --- Layout ------------------------------------------------ */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* --- Sidebar ----------------------------------------------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-logo-title {
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-logo-mark {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.sidebar-logo-sub {
  color: #6b7280;
  font-size: .72rem;
  margin-top: 2px;
}
.sidebar-nav { flex: 1; padding: 10px 10px; }
.sidebar-section {
  padding: 14px 8px 6px;
  color: #4b5563;
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: #9ca3af;
  font-size: .85rem;
  font-weight: 500;
  transition: background .15s, color .15s;
  cursor: pointer;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--sidebar-hover); color: #e5e7eb; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item .badge {
  margin-right: auto;
  background: rgba(255,255,255,.15);
  color: #fff;
  font-size: .68rem;
  padding: 1px 7px;
  border-radius: 20px;
}
.nav-item.active .badge { background: rgba(255,255,255,.3); }

/* ── زیرمنوی سایدبار ── */
.nav-group { margin-bottom: 2px; }
.nav-sub-wrap {
  border-right: 2px solid rgba(255,255,255,.18);
  margin-right: 20px;
  padding-right: 8px;
  margin-top: 1px;
  margin-bottom: 4px;
}
.nav-sub-item {
  display: flex !important;
  align-items: center !important;
  flex-direction: row !important;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  color: #f1f5f9;
  font-size: .82rem;
  font-weight: 600;
  transition: background .15s, color .15s;
  text-decoration: none;
  margin-bottom: 1px;
  overflow: hidden;
}
.nav-sub-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-sub-item.active { color: #fff; background: rgba(255,255,255,.14); }
.nav-sub-item svg {
  width: 14px !important;
  height: 14px !important;
  min-width: 14px;
  min-height: 14px;
  flex-shrink: 0;
  display: inline-block !important;
}
.sidebar-user {
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-avatar {
  width: 34px; height: 34px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: .85rem;
  flex-shrink: 0;
}
.sidebar-user-name { color: #e5e7eb; font-size: .82rem; font-weight: 600; }
.sidebar-user-role { color: #6b7280; font-size: .72rem; }
.sidebar-user-logout {
  margin-right: auto;
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 5px;
  border-radius: 6px;
  transition: color .15s, background .15s;
  display: flex;
}
.sidebar-user-logout:hover { color: #ef4444; background: rgba(239,68,68,.1); }
.sidebar-user-logout svg { width: 17px; height: 17px; }

/* --- Main -------------------------------------------------- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.topbar-title { font-size: .95rem; font-weight: 600; color: var(--text); }
.topbar-meta { color: var(--text-muted); font-size: .8rem; display: flex; align-items: center; gap: 16px; }
.page-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 24px; }

/* --- Alert / Flash ---------------------------------------- */
.alert {
  padding: 11px 14px;
  border-radius: var(--radius);
  font-size: .85rem;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.alert svg { width: 17px; height: 17px; flex-shrink: 0; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.alert-danger  { background: #fff1f2; border: 1px solid #fecdd3; color: #be123c; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }

/* --- Cards ------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-size: .92rem; font-weight: 600; color: var(--text); }
.card-body { padding: 20px; }

/* --- Stat Cards -------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.pink   { background: #fff1f2; color: var(--primary); }
.stat-icon.blue   { background: #eff6ff; color: #2563eb; }
.stat-icon.green  { background: #f0fdf4; color: #16a34a; }
.stat-icon.orange { background: #fff7ed; color: #ea580c; }
.stat-icon.purple { background: #faf5ff; color: #7c3aed; }
.stat-icon.red    { background: #fee2e2; color: #dc2626; }
.stat-label { color: var(--text-muted); font-size: .78rem; margin-bottom: 3px; }
.stat-value { color: var(--text); font-size: 1.5rem; font-weight: 700; line-height: 1; }
.stat-sub   { color: var(--text-light); font-size: .74rem; margin-top: 4px; }
.stat-sub.up   { color: var(--success); }
.stat-sub.down { color: var(--danger); }

/* --- Table ------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
thead th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 10px 16px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafbfc; }

/* --- Badges / Tags ---------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: .73rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-green   { background: #dcfce7; color: #15803d; }
.badge-red     { background: #fee2e2; color: #dc2626; }
.badge-blue    { background: #dbeafe; color: #1d4ed8; }
.badge-yellow  { background: #fef9c3; color: #854d0e; }
.badge-gray    { background: #f1f5f9; color: #475569; }
.badge-orange  { background: #ffedd5; color: #c2410c; }
.badge-purple  { background: #f3e8ff; color: #7e22ce; }
.badge-pink    { background: #fff1f2; color: #be123c; }
/* semantic aliases */
.badge-primary   { background: #dbeafe; color: #1d4ed8; }
.badge-success   { background: #dcfce7; color: #15803d; }
.badge-danger    { background: #fee2e2; color: #dc2626; }
.badge-info      { background: #e0f2fe; color: #0369a1; }
.badge-warning   { background: #fef9c3; color: #854d0e; }
.badge-secondary { background: #f1f5f9; color: #475569; }

/* --- Apt action buttons (reusable) */
.apt-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 6px; font-size: .75rem;
  font-weight: 600; cursor: pointer; border: 1px solid var(--border);
  background: none; font-family: inherit; white-space: nowrap;
  text-decoration: none; color: var(--text); transition: background .12s;
}
.apt-btn:hover         { background: var(--bg); }
.apt-btn-info          { color: #0369a1; border-color: #bae6fd; }
.apt-btn-info:hover    { background: #e0f2fe; }
.apt-btn-success       { color: #15803d; border-color: #bbf7d0; }
.apt-btn-success:hover { background: #dcfce7; }
.apt-btn-cancel        { color: #dc2626; border-color: #fecaca; }
.apt-btn-cancel:hover  { background: #fee2e2; }

/* --- Buttons ----------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-family: inherit;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
  white-space: nowrap;
  line-height: 1.4;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg); }
.btn-danger  { background: #fee2e2; color: #dc2626; border-color: #fecaca; }
.btn-danger:hover  { background: #fecaca; }
.btn-ghost   { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 5px 11px; font-size: .78rem; }
.btn-lg { padding: 11px 22px; font-size: .95rem; }
.btn-icon { padding: 7px; width: 34px; height: 34px; justify-content: center; }
.btn-icon svg { width: 17px; height: 17px; }

/* --- Forms ------------------------------------------------- */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-label .req { color: var(--primary); }
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: .88rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  direction: rtl;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(225,29,72,.1);
}
.form-control::placeholder { color: #cbd5e1; }
.form-control.is-invalid { border-color: var(--danger); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 10px center; background-size: 20px; padding-left: 36px; }
.form-hint  { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: .75rem; color: var(--danger); margin-top: 4px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
.form-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 16px; }

/* --- Page header ------------------------------------------ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.page-header-title { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.page-header-sub   { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }

/* --- Search bar ------------------------------------------- */
.search-wrap {
  position: relative;
  flex: 1;
  max-width: 400px;
}
.search-icon {
  position: absolute;
  top: 50%; right: 12px;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
}
.search-icon svg { width: 17px; height: 17px; }
.search-input {
  width: 100%;
  padding: 8px 38px 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: .85rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(225,29,72,.1);
}

/* --- Pagination ------------------------------------------- */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}
.page-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  font-size: .82rem;
  color: var(--text-muted);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: all .15s;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn svg { width: 14px; height: 14px; }

/* --- Modal / Drawer --------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: .95rem; font-weight: 700; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px;
  border-radius: 6px; display: flex;
  transition: color .15s, background .15s;
}
.modal-close:hover { color: var(--danger); background: #fee2e2; }
.modal-close svg { width: 20px; height: 20px; }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* --- Empty state ------------------------------------------ */
.empty-state {
  padding: 48px 20px;
  text-align: center;
}
.empty-icon {
  width: 56px; height: 56px;
  background: var(--bg);
  border-radius: 50%;
  margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
}
.empty-icon svg { width: 26px; height: 26px; color: var(--text-light); }
.empty-title { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.empty-sub   { font-size: .82rem; color: var(--text-muted); }

/* --- Login page ------------------------------------------- */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #fff1f2 0%, #fff 50%, #f0f9ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 20px 40px -10px rgba(0,0,0,.1), 0 8px 16px -4px rgba(0,0,0,.05);
  width: 100%;
  max-width: 400px;
  overflow: hidden;
}
.login-header {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  padding: 32px 32px 28px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.login-header::before {
  content: '';
  position: absolute;
  top: -30px; left: -30px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.login-header::after {
  content: '';
  position: absolute;
  bottom: -20px; right: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.login-logo {
  width: 60px; height: 60px;
  background: rgba(255,255,255,.2);
  border-radius: 16px;
  margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  position: relative; z-index: 1;
}
.login-title {
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  position: relative; z-index: 1;
}
.login-subtitle {
  color: rgba(255,255,255,.7);
  font-size: .8rem;
  margin-top: 4px;
  position: relative; z-index: 1;
}
.login-body { padding: 28px 28px 24px; }
.login-form-title {
  font-size: .95rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 20px;
  color: var(--text);
}
.login-submit {
  width: 100%;
  padding: 11px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
  margin-top: 6px;
}
.login-submit:hover  { background: var(--primary-dark); }
.login-submit:active { transform: scale(.99); }
.login-footer {
  padding: 12px;
  text-align: center;
  color: var(--text-light);
  font-size: .74rem;
  border-top: 1px solid var(--border);
}

/* --- Patient page ----------------------------------------- */
.patient-header-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.patient-avatar {
  width: 56px; height: 56px;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
}
.patient-name { font-size: 1.05rem; font-weight: 700; }
.patient-file-no { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }
.patient-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* --- Tabs -------------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-item {
  padding: 9px 16px;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.tab-item:hover { color: var(--text); }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* --- Utilities --------------------------------------------- */
.d-flex       { display: flex; }
.d-grid       { display: grid; }
.d-none       { display: none; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1  { gap: 4px; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.mt-1   { margin-top: 4px; }
.mt-2   { margin-top: 8px; }
.mt-3   { margin-top: 12px; }
.mt-4   { margin-top: 16px; }
.mb-2   { margin-bottom: 8px; }
.mb-3   { margin-bottom: 12px; }
.mb-4   { margin-bottom: 16px; }
.mr-auto{ margin-right: auto; }
.ml-auto{ margin-left: auto; }
.text-sm     { font-size: .82rem; }
.text-xs     { font-size: .74rem; }
.text-muted  { color: var(--text-muted); }
.text-light  { color: var(--text-light); }
.font-bold   { font-weight: 700; }
.font-medium { font-weight: 500; }
.w-full      { width: 100%; }
.rounded     { border-radius: var(--radius); }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Settings / Payroll hub cards ── */
.settings-hub {
  display:grid; grid-template-columns:repeat(auto-fill, minmax(300px, 1fr)); gap:14px;
}
.settings-card {
  display:flex; align-items:center; gap:14px;
  background:#fff; border:1px solid var(--border); border-radius:12px;
  padding:16px 18px; text-decoration:none; color:inherit;
  transition:border-color .15s, box-shadow .15s, transform .15s;
}
.settings-card:hover { border-color:var(--primary); box-shadow:0 4px 14px rgba(0,0,0,.07); transform:translateY(-1px); }
.settings-card-icon { width:44px; height:44px; border-radius:10px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.settings-card-icon svg { width:22px; height:22px; }
.settings-card-body { flex:1; min-width:0; }
.settings-card-title { font-weight:600; font-size:.95rem; margin-bottom:2px; }
.settings-card-desc { font-size:.78rem; color:var(--text-muted); line-height:1.5; }
.settings-card-meta { font-size:.72rem; color:var(--primary); font-weight:600; margin-top:4px; }
.settings-card-arrow { width:16px; height:16px; color:var(--text-muted); flex-shrink:0; transition:transform .15s; }
.settings-card:hover .settings-card-arrow { transform:translateX(-3px); color:var(--primary); }

/* ── Financial hub cards ── */
.fin-hub { display:grid; grid-template-columns:repeat(auto-fill, minmax(280px, 1fr)); gap:12px; }
.fin-card {
  display:flex; align-items:center; gap:12px;
  background:#fff; border:1px solid var(--border); border-radius:10px;
  padding:14px 16px; text-decoration:none; color:inherit;
  transition:border-color .15s, box-shadow .15s;
}
.fin-card:hover { border-color:var(--primary); box-shadow:0 3px 10px rgba(0,0,0,.06); }
.fin-card-featured { border-color:var(--primary); background:#fafffe; }
.fin-card-icon { width:38px; height:38px; border-radius:9px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.fin-card-icon svg { width:20px; height:20px; }
.fin-card-body { flex:1; min-width:0; }
.fin-card-title { font-weight:600; font-size:.9rem; margin-bottom:2px; display:flex; align-items:center; gap:6px; }
.fin-card-desc { font-size:.75rem; color:var(--text-muted); line-height:1.4; }
.fin-card-tag { font-size:.65rem; background:var(--primary); color:#fff; padding:1px 6px; border-radius:8px; }
.fin-card-arrow { width:15px; height:15px; color:var(--text-muted); flex-shrink:0; }

/* ── Responsive table wrapper — prevents full-page horizontal scroll ── */
.table-wrap { overflow-x:auto; -webkit-overflow-scrolling:touch; max-width:100%; }

/* ═══════════════════════════════════════════════
   MOBILE RESPONSIVE — sidebar as drawer on mobile
   ═══════════════════════════════════════════════ */
@media (max-width: 800px) {

  /* sidebar: fixed drawer, hidden off right edge (RTL) */
  .sidebar {
    position: fixed;
    top: 0; right: 0;
    height: 100vh;
    z-index: 600;
    transform: translateX(100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    box-shadow: -4px 0 24px rgba(0,0,0,.25);
  }
  .sidebar.mob-open {
    transform: translateX(0);
  }

  /* overlay behind open sidebar */
  .mob-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.48);
    z-index: 599;
  }
  .mob-overlay.mob-open { display: block; }

  /* main content takes full width */
  .main-content { width: 100%; }

  /* topbar: tighter, show hamburger */
  .topbar { padding: 0 14px; }
  .topbar-meta { display: none; }
  .mob-hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text);
    flex-shrink: 0;
  }
  .mob-hamburger svg { width: 20px; height: 20px; }

  /* page body: less padding */
  .page-body { padding: 14px 12px; }

  /* stat cards: 2 per row */
  .stats-grid { grid-template-columns: 1fr 1fr !important; }

  /* tables: scroll horizontally */
  .table-wrap, .card-body table { overflow-x: auto; display: block; }
  .table { min-width: 600px; }

  /* grids: single column */
  .settings-hub,
  .fhub-grid { grid-template-columns: 1fr !important; }

  /* page header: stack */
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-header .btn { align-self: flex-start; }

  /* hide topbar clock text on very small */
  #topbar-clock { display: none; }

  /* forms: full width */
  .form-control { font-size: 16px; } /* prevent iOS zoom */
}

/* desktop: hide hamburger */
@media (min-width: 801px) {
  .mob-hamburger { display: none !important; }
  .mob-overlay   { display: none !important; }
}

/* ══════════════════════════════════════════
   چاپ / خروجی PDF (از طریق دیالوگ چاپ مرورگر)
══════════════════════════════════════════ */
@media print {
  .no-print, .sidebar, .mob-overlay, .topbar { display: none !important; }
  body, .app-shell, .main-content { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  .main-content { width: 100% !important; }
  .page-body { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid; }
  table { break-inside: auto; }
  tr { break-inside: avoid; break-after: auto; }
}
