:root {
    --bg-app: #0d0d1a;
    --bg-sidebar: #141428;
    --bg-card: #12122a;
    --bg-surface: #1a1a35;
    --border: #2a2a4a;
    --text-body: #e0e0e0;
    --text-muted: #8888aa;
    --accent: #6c4fbf;
    --accent-hover: #7c5fd0;
    --accent-light: #9b7fe8;
    --success-bg: #1a4a2a;
    --warn-bg: #4a3a1a;
    --info-bg: #1a2a4a;
    --danger-bg: #4a1a1a;
    --green: #4ade80;
    --blue: #60a5fa;
    --red: #f87171;
    --yellow: #facc15;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--bg-app);
    color: var(--text-body);
    font-family: Arial, sans-serif;
    line-height: 1.45;
}
[dir="rtl"] body { font-family: "Vazir", Arial, sans-serif; }

a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; }
.force-vazir, .force-vazir * { font-family: "Vazir", Arial, sans-serif !important; }

/* Layout */
.sidebar { width: 260px; overflow: hidden; flex-shrink: 0; }
[dir="ltr"] .main-content { margin-left: 260px; }
[dir="rtl"] .main-content { margin-right: 260px; }
[dir="rtl"] .sidebar { left: auto; right: 0; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3d3d6b; }

/* Utilities (local replacement for CDN classes) */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.block { display: block; }
.inline { display: inline; }
.grid { display: grid; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1 1 0%; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.fixed { position: fixed; }
.relative { position: relative; }
.absolute { position: absolute; }
.top-0 { top: 0; }
.top-5 { top: 1.25rem; }
.right-0 { right: 0; }
.right-5 { right: 1.25rem; }
.right-1\/4 { right: 25%; }
.right { right: 0; }
.left-0 { left: 0; }
.left-1\/4 { left: 25%; }
.left { left: 0; }
.bottom-0 { bottom: 0; }
.z-10 { z-index: 10; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }

.w-full { width: 100%; }
.w-fit { width: fit-content; }
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-8 { width: 2rem; }
.w-9 { width: 2.25rem; }
.w-12 { width: 3rem; }
.w-14 { width: 3.5rem; }
.w-20 { width: 5rem; }
.w-\[350px\] { width: 350px; }
.w-\[500px\] { width: 500px; }
.max-w-\[420px\] { max-width: 420px; }
.min-w-\[300px\] { min-width: 300px; }
.min-w-0 { min-width: 0; }
.h-full { height: 100%; }
.h-screen { height: 100vh; }
.min-h-screen { min-height: 100vh; }
.h-4 { height: 1rem; }
.h-8 { height: 2rem; }
.h-9 { height: 2.25rem; }
.h-12 { height: 3rem; }
.h-14 { height: 3.5rem; }
.h-20 { height: 5rem; }
.h-\[2px\] { height: 2px; }
.h-\[350px\] { height: 350px; }
.h-\[500px\] { height: 500px; }

.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2\.5 { padding: 0.625rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-2\.5 { padding-left: 0.625rem; padding-right: 0.625rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-3\.5 { padding-top: 0.875rem; padding-bottom: 0.875rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-5 { padding-top: 1.25rem; padding-bottom: 1.25rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.py-20 { padding-top: 5rem; padding-bottom: 5rem; }
.pt-3 { padding-top: 0.75rem; }
.pt-6 { padding-top: 1.5rem; }
.pb-2\.5 { padding-bottom: 0.625rem; }
.pb-3 { padding-bottom: 0.75rem; }

.m-0 { margin: 0; }
.mx-auto { margin-left: auto; margin-right: auto; }
.ml-auto { margin-left: auto; }
.ml-4 { margin-left: 1rem; }
.mt-0\.5 { margin-top: 0.125rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-7 { margin-top: 1.75rem; }
.mt-8 { margin-top: 2rem; }
.mb-0\.5 { margin-bottom: 0.125rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-1\.5 { margin-bottom: 0.375rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-7 { margin-bottom: 1.75rem; }
.mb-8 { margin-bottom: 2rem; }

.gap-1 { gap: 0.25rem; }
.gap-1\.5 { gap: 0.375rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }

.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.whitespace-nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pointer-events-none { pointer-events: none; }
.resize-y { resize: vertical; }

.rounded { border-radius: 0.25rem; }
.rounded-md { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-full { border-radius: 9999px; }
.rounded-\[10px\] { border-radius: 10px; }

.border { border: 1px solid var(--border); }
.border-left { border-left: 1px solid var(--border); }
.border-right { border-right: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.border-\[\#2a2a4a\] { border-color: var(--border); }
.border-green-700, .border-green-800 { border-color: #166534; }
.border-red-800, .hover\:border-red-700:hover { border-color: #991b1b; }
.border-yellow-700 { border-color: #a16207; }
.border-blue-700 { border-color: #1d4ed8; }

.bg-app-bg, .bg-\[\#0d0d1a\] { background-color: var(--bg-app); }
.bg-\[\#12122a\] { background-color: var(--bg-card); }
.bg-\[\#141428\] { background-color: var(--bg-sidebar); }
.bg-\[\#1a1a35\] { background-color: var(--bg-surface); }
.bg-\[\#1a2a4a\] { background-color: var(--info-bg); }
.bg-\[\#1a4a2a\] { background-color: var(--success-bg); }
.bg-\[\#2a2a4a\] { background-color: var(--border); }
.bg-\[\#4a1a1a\] { background-color: var(--danger-bg); }
.bg-\[\#4a3a1a\] { background-color: var(--warn-bg); }
.bg-\[\#6c4fbf\] { background-color: var(--accent); }
.bg-blue-500 { background-color: #3b82f6; }
.bg-green-500 { background-color: #22c55e; }
.bg-red-500 { background-color: #ef4444; }
.bg-yellow-500 { background-color: #eab308; }
.bg-white\/\[0\.03\] { background-color: rgba(255,255,255,0.03); }

.text-body-text, .text-\[\#e0e0e0\] { color: var(--text-body); }
.text-\[\#8888aa\] { color: var(--text-muted); }
.text-\[\#6c4fbf\] { color: var(--accent); }
.text-\[\#9b7fe8\] { color: var(--accent-light); }
.text-white { color: #fff; }
.text-green-300 { color: #86efac; }
.text-green-400 { color: var(--green); }
.text-blue-400 { color: var(--blue); }
.text-red-300 { color: #fca5a5; }
.text-red-400 { color: var(--red); }
.text-yellow-400 { color: var(--yellow); }
.text-purple-300 { color: #d8b4fe; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-center { text-align: center; }

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-\[9px\] { font-size: 9px; }
.text-\[10px\] { font-size: 10px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.025em; }
.tracking-wider { letter-spacing: 0.05em; }
.leading-none { line-height: 1; }
.leading-snug { line-height: 1.375; }
.leading-relaxed { line-height: 1.625; }

.no-underline { text-decoration: none; }
.list-none { list-style: none; }
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }
.opacity-50 { opacity: 0.5; }
.opacity-60 { opacity: 0.6; }
.shrink-0, .flex-shrink-0 { flex-shrink: 0; }
.last\:border-0:last-child { border: 0; }
.accent-\[\#6c4fbf\] { accent-color: var(--accent); }

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.col-span-12 { grid-column: span 12 / span 12; }

.transition-all { transition: all 0.2s ease; }
.transition-colors { transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease; }
.transition-transform { transition: transform 0.2s ease; }
.shadow-2xl { box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45); }

.hover\:bg-white\/5:hover { background-color: rgba(255,255,255,0.05); }
.hover\:bg-white\/\[0\.02\]:hover { background-color: rgba(255,255,255,0.02); }
.hover\:bg-\[\#7c5fd0\]:hover { background-color: var(--accent-hover); }
.hover\:bg-\[\#1a4a2a\]:hover { background-color: #215b33; }
.hover\:bg-\[\#1a2a4a\]:hover { background-color: #22385f; }
.hover\:bg-\[\#4a3a1a\]:hover { background-color: #5e4b22; }
.hover\:bg-\[\#6c4fbf\]\/10:hover { background-color: rgba(108, 79, 191, 0.1); }
.hover\:border-\[\#6c4fbf\]:hover,
.hover\:border-\[\#6c4fbf\]\/40:hover { border-color: var(--accent); }
.hover\:text-white:hover { color: #fff; }
.hover\:text-\[\#9b7fe8\]:hover { color: var(--accent-light); }
.hover\:text-red-400:hover { color: var(--red); }
.hover\:-translate-y-0\.5:hover { transform: translateY(-2px); }

/* App-specific helpers */
.nav-link { display: flex; align-items: center; }
.article-content { line-height: 1.8; }
.stat-value { font-variant-numeric: tabular-nums; }
.me-1 { margin-inline-end: 0.25rem; }

/* Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeInUp 0.35s ease-out both; }
.animate-in-delay-1 { animation-delay: 0.06s; }
.animate-in-delay-2 { animation-delay: 0.12s; }
.animate-in-delay-3 { animation-delay: 0.18s; }
.animate-in-delay-4 { animation-delay: 0.24s; }

/* Spinner */
@keyframes spin { to { transform: rotate(360deg); } }

/* Toasts */
@keyframes toastIn { from { opacity: 0; transform: translateX(110%); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(110%); } }
@keyframes toastProg { from { width: 100%; } to { width: 0%; } }
.toast-modern { animation: toastIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.toast-exit { animation: toastOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.toast-progress-bar { animation: toastProg 5s linear forwards; }
[dir="rtl"] .toast-container { left: 1.25rem; right: auto; }

/* Forms */
input, textarea, select {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-body);
    border-radius: 0.5rem;
    padding: 0.625rem 0.75rem;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent-hover);
    box-shadow: 0 0 0 3px rgba(124, 92, 191, 0.18);
}

/* Responsive */
@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .md\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .md\:col-span-2 { grid-column: span 2 / span 2; }
    .md\:col-span-3 { grid-column: span 3 / span 3; }
    .md\:col-span-4 { grid-column: span 4 / span 4; }
    .md\:col-span-6 { grid-column: span 6 / span 6; }
}

@media (min-width: 1280px) {
    .xl\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .xl\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    .sidebar { width: 72px; }
    .sidebar .nav-text,
    .sidebar .brand-text,
    .sidebar .user-name,
    .sidebar .lang-switch { opacity: 0; width: 0; overflow: hidden; }
    [dir="ltr"] .main-content { margin-left: 72px; }
    [dir="rtl"] .main-content { margin-right: 72px; }
    .main-content { padding: 1.25rem 1rem; }
}
