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

:root {
  --brand: #5b5bd6;
  --brand-2: #8b5cf6;
  --brand-3: #06b6d4;
  --brand-soft: #eef0ff;
  --brand-ink: #3b3bb3;
  --ink: #12142a;
  --ink-2: #2b2e4a;
  --muted: #6f7488;
  --muted-2: #9aa0b4;
  --line: #e8eaf3;
  --line-2: #f1f2f8;
  --bg: #f6f7fc;
  --surface: #ffffff;
  --success: #10b981;
  --success-soft: #e7f9f1;
  --warn: #f59e0b;
  --warn-soft: #fef5e7;
  --danger: #ef4444;
  --danger-soft: #feecec;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --shadow-xs: 0 1px 2px rgba(18, 20, 42, 0.05);
  --shadow-sm: 0 4px 14px rgba(18, 20, 42, 0.06);
  --shadow: 0 14px 40px rgba(18, 20, 42, 0.1);
  --shadow-lg: 0 30px 80px rgba(18, 20, 42, 0.16);
  --grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 52%, #06b6d4 110%);
  --font: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
h1, h2, h3, h4, h5 { margin: 0; line-height: 1.4; font-weight: 700; letter-spacing: -0.2px; }
p { margin: 0; }
::selection { background: #cfd2ff; color: #1b1d3a; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d6d9e6; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #bfc3d6; }

.container { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  background: #fff;
  color: var(--ink);
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 500;
  font-size: 14px;
  transition: 0.18s ease;
  white-space: nowrap;
  user-select: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 8px 22px rgba(99, 102, 241, 0.28);
}
.btn-primary:hover { box-shadow: 0 12px 28px rgba(99, 102, 241, 0.38); }
.btn-soft { background: var(--brand-soft); color: var(--brand-ink); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--line-2); color: var(--ink); }
.btn-outline { border-color: var(--line); background: #fff; }
.btn-outline:hover { border-color: #d5d8e8; }
.btn-danger { background: var(--danger-soft); color: #c02525; }
.btn-white { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn-lg { padding: 14px 26px; font-size: 16px; border-radius: 14px; }
.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: 11px; }
.btn-block { width: 100%; }

/* ---------------- Forms ---------------- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field > label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted-2); }
.input, .textarea, .select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfbfe;
  color: var(--ink);
  padding: 11px 14px;
  border-radius: 12px;
  outline: none;
  transition: 0.16s ease;
  font-size: 14px;
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input:focus, .textarea:focus, .select:focus {
  border-color: #b9bcf6;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}
.textarea { resize: vertical; min-height: 96px; line-height: 1.9; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%236f7488' stroke-width='2'%3E%3Cpath d='M3 5l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 14px center; padding-left: 34px; }
.switch { position: relative; display: inline-flex; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #dfe2ee; border-radius: 99px; transition: 0.2s; }
.switch span:before { content: ''; position: absolute; width: 20px; height: 20px; right: 3px; top: 3px; background: #fff; border-radius: 50%; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15); transition: 0.2s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span:before { transform: translateX(-18px); }

/* ---------------- Cards / misc ---------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-xs); }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--line-2);
  color: var(--muted);
}
.badge-open { background: var(--success-soft); color: #0b8a5f; }
.badge-pending { background: var(--warn-soft); color: #b06a00; }
.badge-closed { background: #f1f2f8; color: #7b8093; }
.badge-brand { background: var(--brand-soft); color: var(--brand-ink); }
.badge-danger { background: var(--danger-soft); color: #c02525; }

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 500;
  font-size: 14px;
  flex: none;
  overflow: hidden;
}
.avatar-sm { width: 30px; height: 30px; font-size: 12px; }
.avatar-lg { width: 46px; height: 46px; font-size: 16px; }

.divider { height: 1px; background: var(--line); border: 0; margin: 18px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.bold { font-weight: 700; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.grow { flex: 1; }
.hidden { display: none !important; }
.text-center { text-align: center; }
.ltr { direction: ltr; unicode-bidi: embed; }

/* ---------------- Modal ---------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 18, 40, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  padding: 20px;
  animation: fadeIn 0.16s ease;
}
.modal {
  background: #fff;
  border-radius: 22px;
  width: min(560px, 100%);
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.18s ease;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 22px 24px; }
.modal-foot { padding: 16px 24px 22px; display: flex; gap: 10px; justify-content: flex-start; }

/* ---------------- Toast ---------------- */
#toasts { position: fixed; bottom: 22px; left: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: #1b1d33;
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 13px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideUp 0.2s ease;
  max-width: 360px;
}
.toast.success { background: #0f7a58; }
.toast.error { background: #b3272d; }

/* ---------------- Animations ---------------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.97) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pulseDot { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-3px); opacity: 1; } }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, #eef0f7 25%, #f7f8fc 37%, #eef0f7 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 10px;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------------- Logo ---------------- */
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; letter-spacing: -0.4px; }
.logo-mark {
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--grad);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 18px rgba(99, 102, 241, 0.3);
  flex: none;
}
.logo-mark svg { width: 21px; height: 21px; color: #fff; }

@media (max-width: 640px) {
  body { font-size: 14px; }
  .container { width: calc(100% - 28px); }
}
