:root {
  --primary: #7C3AED;
  --primary-dark: #6D28D9;
  --bg: #F1F5F9;
  --sidebar: #1E1B4B;
  --card: #FFFFFF;
  --border: #E2E8F0;
  --text: #1E293B;
  --muted: #64748B;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Vazirmatn', Tahoma, sans-serif; direction: rtl; background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font-family: inherit; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: var(--sidebar); color: #E0E7FF; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-brand { padding: 1.25rem; font-size: 1.15rem; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-sub { font-size: 0.75rem; opacity: 0.7; margin-top: 0.25rem; font-weight: 400; }
.sidebar-nav { flex: 1; padding: 0.75rem 0; overflow-y: auto; }
.nav-link { display: block; padding: 0.7rem 1.25rem; color: #E0E7FF; border: none; background: none; width: 100%; text-align: right; cursor: pointer; font-size: 0.95rem; }
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,0.1); }
.nav-link.active { border-right: 3px solid var(--primary); }
.sidebar-footer { padding: 1rem; border-top: 1px solid rgba(255,255,255,0.1); }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { background: white; border-bottom: 1px solid var(--border); padding: 1rem 1.5rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.topbar h1 { font-size: 1.2rem; }
.topbar-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.content { flex: 1; padding: 1.5rem; overflow: auto; }
.btn { padding: 0.55rem 1rem; border-radius: 8px; border: none; cursor: pointer; font-size: 0.9rem; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: white; border: 1px solid var(--border); color: var(--text); }
.btn-ghost-light { background: transparent; border: 1px solid rgba(255,255,255,0.25); color: #E0E7FF; width: 100%; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; margin-bottom: 1rem; }
.grid-sites { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.site-card { background: white; border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; transition: box-shadow 0.2s; cursor: pointer; }
.site-card:hover { box-shadow: 0 8px 24px rgba(30,27,75,0.08); }
.site-card h3 { margin-bottom: 0.35rem; }
.site-card .tag { color: var(--muted); font-size: 0.85rem; direction: ltr; text-align: right; }
.site-card .template { display: inline-block; margin-top: 0.75rem; padding: 0.2rem 0.6rem; background: #EDE9FE; color: var(--primary); border-radius: 999px; font-size: 0.75rem; }
.builder-layout { display: grid; grid-template-columns: 280px 1fr 360px; gap: 1rem; min-height: calc(100vh - 140px); }
.panel { background: white; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.panel-header { padding: 0.9rem 1rem; border-bottom: 1px solid var(--border); font-weight: 600; background: #F8FAFC; }
.panel-body { padding: 1rem; overflow-y: auto; flex: 1; }
.slot-item { border: 1px solid var(--border); border-radius: 8px; padding: 0.85rem; margin-bottom: 0.6rem; cursor: pointer; }
.slot-item:hover, .slot-item.active { border-color: var(--primary); background: #F5F3FF; }
.slot-item code { display: block; font-size: 0.72rem; color: var(--muted); margin-top: 0.25rem; direction: ltr; text-align: right; }
.preview-frame { width: 100%; flex: 1; border: none; min-height: 500px; background: white; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.35rem; font-size: 0.85rem; color: var(--muted); }
.form-group input, .form-group textarea { width: 100%; padding: 0.7rem; border: 1px solid var(--border); border-radius: 8px; }
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1E1B4B, #7C3AED); padding: 1rem; }
.login-box { background: white; border-radius: 16px; padding: 2rem; width: 100%; max-width: 420px; }
.login-box h2 { text-align: center; margin-bottom: 0.35rem; }
.login-box .subtitle { text-align: center; color: var(--muted); margin-bottom: 1.5rem; font-size: 0.9rem; }
.login-hint { background: #F8FAFC; border: 1px solid var(--border); border-radius: 10px; padding: 1rem; margin-bottom: 1.25rem; font-size: 0.85rem; line-height: 1.7; }
.login-hint strong { color: var(--primary); }
.login-hint code { background: #EDE9FE; padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.8rem; }
.empty { color: var(--muted); text-align: center; padding: 2rem; }
.badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.72rem; background: #D1FAE5; color: #059669; }
.badge-draft { background: #FEF3C7; color: #D97706; }
@media (max-width: 1100px) {
  .builder-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}
