/* =========================================================
   PostOnSocial — design system
   Uses logical properties so the same CSS works for RTL & LTR
   ========================================================= */
:root {
  --bg: #f4f5fb;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, rgba(139, 92, 246, .10), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(236, 72, 153, .07), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --surface-3: #eef0f8;
  --border: #e6e8f2;
  --text: #161a36;
  --text-2: #3c4166;
  --muted: #6e7398;
  --primary: #6d5efc;
  --primary-2: #a855f7;
  --accent: #ec4899;
  --primary-soft: rgba(109, 94, 252, .1);
  --grad: linear-gradient(135deg, #6d5efc 0%, #a855f7 55%, #ec4899 100%);
  --success: #10b981; --success-soft: rgba(16, 185, 129, .12);
  --warning: #f59e0b; --warning-soft: rgba(245, 158, 11, .14);
  --danger: #ef4444;  --danger-soft: rgba(239, 68, 68, .12);
  --info: #3b82f6;    --info-soft: rgba(59, 130, 246, .12);
  --shadow-sm: 0 1px 2px rgba(22, 26, 54, .05), 0 1px 3px rgba(22, 26, 54, .06);
  --shadow: 0 6px 24px -6px rgba(22, 26, 54, .10), 0 2px 6px rgba(22, 26, 54, .04);
  --shadow-lg: 0 24px 60px -12px rgba(30, 27, 90, .25);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --sidebar-w: 268px;
  --topbar-h: 68px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --font: 'Inter', 'Cairo', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
[dir="rtl"] { --font: 'Cairo', 'Inter', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif; }

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0c18;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, rgba(139, 92, 246, .16), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(236, 72, 153, .10), transparent 60%);
  --surface: #12152a;
  --surface-2: #171a32;
  --surface-3: #1f2340;
  --border: #262a49;
  --text: #eceefb;
  --text-2: #c6c9e6;
  --muted: #8f94bb;
  --primary-soft: rgba(139, 125, 255, .16);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 8px 28px -8px rgba(0, 0, 0, .5);
  --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .6);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.6; color: var(--text);
  background: var(--bg-grad), var(--bg); background-attachment: fixed;
  -webkit-font-smoothing: antialiased; transition: background-color .3s, color .3s;
}
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.3; font-weight: 700; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1rem; }
code, pre, .mono { font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace; }
::selection { background: rgba(109, 94, 252, .25); }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.text-center { text-align: center; }
.text-end { text-align: end; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.nowrap { white-space: nowrap; }
.w-100 { width: 100%; }
.mt-0 { margin-top: 0 } .mt-1 { margin-top: .5rem } .mt-2 { margin-top: 1rem } .mt-3 { margin-top: 1.5rem }
.mb-0 { margin-bottom: 0 } .mb-1 { margin-bottom: .5rem } .mb-2 { margin-bottom: 1rem } .mb-3 { margin-bottom: 1.5rem }
.flex { display: flex; align-items: center; gap: .6rem; }
.flex-wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }

/* ---------- View transitions between pages ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out .22s var(--ease) both; }
::view-transition-new(root) { animation: vt-in .38s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }
body.leaving .content { opacity: 0; transform: translateY(8px); transition: opacity .18s, transform .18s; }

/* ---------- Animations ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.94) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { 100% { transform: translateX(100%); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 currentColor; } 50% { box-shadow: 0 0 0 4px transparent; } }
@keyframes floaty { 0%, 100% { transform: translateY(0) rotate(var(--r, 0deg)); } 50% { transform: translateY(-14px) rotate(var(--r, 0deg)); } }
@keyframes blob { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(40px, -30px) scale(1.1); } 66% { transform: translate(-30px, 20px) scale(.92); } }
@keyframes gradientMove { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

.anim-in { animation: fadeUp .6s var(--ease) both; }
.stagger > * { animation: fadeUp .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--sidebar-w); z-index: 40;
  background: var(--surface); border-inline-end: 1px solid var(--border);
  display: flex; flex-direction: column; transition: transform .35s var(--ease);
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-size: 20px;
  background: var(--grad); background-size: 200% 200%; animation: gradientMove 6s ease infinite;
  box-shadow: 0 8px 20px -6px rgba(109, 94, 252, .6);
}
[dir="rtl"] .brand-logo i { transform: scaleX(-1); }
.brand-light { color: #fff; }
.workspace-chip {
  margin: 6px 14px 8px; padding: 10px 12px; display: flex; gap: 10px; align-items: center;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2);
}
.ws-info { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.ws-info strong { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-info small { color: var(--muted); font-size: .75rem; }
.nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 9px; }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 16px 12px 6px; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 12px; margin: 2px 0; border-radius: 11px;
  color: var(--text-2); font-weight: 500; transition: background .2s, color .2s, transform .2s var(--ease);
  animation: slideIn .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 25ms);
}
[dir="rtl"] .nav-link { animation-name: fadeIn; }
.nav-link i { font-size: 20px; color: var(--muted); transition: color .2s, transform .3s var(--ease); }
.nav-link:hover { background: var(--surface-3); color: var(--text); transform: translateX(3px); }
[dir="rtl"] .nav-link:hover { transform: translateX(-3px); }
.nav-link:hover i { color: var(--primary); transform: scale(1.1); }
.nav-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-link.active i { color: var(--primary); }
.nav-link.active::before {
  content: ''; position: absolute; inset-inline-start: -12px; top: 8px; bottom: 8px; width: 4px;
  border-start-end-radius: 4px; border-end-end-radius: 4px; background: var(--grad);
}
.sidebar-foot { padding: 12px 14px 16px; }
.upgrade-card {
  display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 14px; color: #fff;
  background: var(--grad); background-size: 200% 200%; animation: gradientMove 8s ease infinite;
  box-shadow: 0 10px 24px -10px rgba(168, 85, 247, .7); transition: transform .3s var(--ease);
}
.upgrade-card:hover { transform: translateY(-2px); }
.upgrade-card i { font-size: 24px; }
.upgrade-card div { display: flex; flex-direction: column; line-height: 1.3; }
.upgrade-card small { opacity: .85; font-size: .75rem; }
.sidebar-backdrop { display: none; }

.main { flex: 1; min-width: 0; margin-inline-start: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 14px;
  padding: 0 28px; background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 1.25rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.content { padding: 26px 28px 60px; width: 100%; max-width: 1480px; margin: 0 auto; transition: opacity .2s, transform .2s; }

.impersonate-bar {
  position: sticky; top: 0; z-index: 60; background: #f59e0b; color: #1f1300; padding: 8px 16px; font-weight: 600;
  display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.btn {
  --b: var(--surface); position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--border); background: var(--b); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; user-select: none;
  transition: transform .2s var(--ease), box-shadow .25s, background .2s, border-color .2s, color .2s;
}
.btn i { font-size: 18px; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled, .btn.loading { opacity: .65; pointer-events: none; }
.btn.loading::after {
  content: ''; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent;
  animation: spin .7s linear infinite; margin-inline-start: 4px;
}
.btn-primary { background: var(--grad); background-size: 160% 160%; color: #fff; border: 0; box-shadow: 0 8px 20px -8px rgba(109, 94, 252, .65); }
.btn-primary:hover { background-position: 100% 50%; box-shadow: 0 12px 28px -8px rgba(168, 85, 247, .7); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); box-shadow: none; }
.btn-outline { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary-soft); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-soft-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-light { background: #fff; color: #1b1b1b; border-color: transparent; }
.btn-sm { height: 34px; padding: 0 12px; font-size: .85rem; border-radius: 10px; }
.btn-xs { height: 28px; padding: 0 9px; font-size: .78rem; border-radius: 8px; }
.btn-lg { height: 52px; padding: 0 26px; font-size: 1rem; border-radius: 14px; }
.btn-block { width: 100%; }
.btn .ripple { position: absolute; border-radius: 50%; transform: scale(0); background: rgba(255, 255, 255, .45); animation: ripple .6s linear; pointer-events: none; }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); cursor: pointer; font-size: 19px; transition: all .2s var(--ease);
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary); transform: translateY(-1px) rotate(-4deg); }
.icon-btn.sm { width: 32px; height: 32px; font-size: 16px; border-radius: 9px; }
.flag { font-size: 18px; line-height: 1; }
[data-theme="dark"] .theme-dark-icon, :root:not([data-theme="dark"]) .theme-light-icon { display: none; }

.user-btn { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; color: var(--text); font: inherit; }
[dir="rtl"] .user-btn { padding: 4px 4px 4px 10px; }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; text-align: start; }
.user-meta small { color: var(--muted); font-size: .72rem; }

/* ---------- Avatars ---------- */
.avatar {
  width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center; flex-shrink: 0;
  background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: .9rem; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; border-radius: 10px; font-size: .78rem; }
.avatar-lg { width: 56px; height: 56px; border-radius: 16px; font-size: 1.2rem; }
.avatar.grad { background: var(--grad); color: #fff; }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); inset-inline-end: 0; min-width: 200px; padding: 6px; z-index: 50;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.98); transform-origin: top; transition: all .2s var(--ease);
}
.dropdown.open .dropdown-menu { opacity: 1; visibility: visible; transform: none; }
.dropdown-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--text-2); font-weight: 500; cursor: pointer; background: none; border: 0; width: 100%; font: inherit; text-align: start; }
.dropdown-item:hover, .dropdown-item.active { background: var(--surface-3); color: var(--text); }
.dropdown-item i { font-size: 18px; }
.dropdown-header { padding: 8px 12px; display: flex; flex-direction: column; line-height: 1.3; }
.dropdown-header small { color: var(--muted); }
.dropdown-divider { height: 1px; background: var(--border); margin: 6px 0; }

/* ---------- Cards & grid ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  transition: box-shadow .3s, transform .3s var(--ease), border-color .3s;
}
.card-hover:hover { box-shadow: var(--shadow); transform: translateY(-3px); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { margin: 0; display: flex; align-items: center; gap: 8px; }
.card-head h3 i { color: var(--primary); }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h2 { font-size: 1.5rem; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* stat cards */
.stat-card { padding: 20px; position: relative; overflow: hidden; }
.stat-card .stat-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; margin-bottom: 14px; }
.stat-card .stat-value { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.stat-card .stat-label { color: var(--muted); font-weight: 500; }
.stat-card::after {
  content: ''; position: absolute; inset-inline-end: -40px; top: -40px; width: 130px; height: 130px; border-radius: 50%;
  background: currentColor; opacity: .06; transition: transform .6s var(--ease);
}
.stat-card:hover::after { transform: scale(1.3); }
.tone-primary { color: var(--primary); } .tone-primary .stat-icon { background: var(--primary-soft); }
.tone-success { color: var(--success); } .tone-success .stat-icon { background: var(--success-soft); }
.tone-warning { color: var(--warning); } .tone-warning .stat-icon { background: var(--warning-soft); }
.tone-danger { color: var(--danger); } .tone-danger .stat-icon { background: var(--danger-soft); }
.tone-info { color: var(--info); } .tone-info .stat-icon { background: var(--info-soft); }
.stat-card .stat-value, .stat-card .stat-label { color: var(--text); }
.stat-card .stat-label { color: var(--muted); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-warning { background: var(--warning-soft); color: #c27c06; }
[data-theme="dark"] .badge-warning { color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: var(--surface-3); color: var(--muted); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-warning .dot, .badge-info .dot { animation: pulse 1.8s infinite; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 7px; background: var(--surface-3); color: var(--text-2); font-size: .75rem; font-weight: 600; font-family: ui-monospace, Consolas, monospace; }

/* platform icon chips */
.pf { width: 30px; height: 30px; border-radius: 9px; display: inline-grid; place-items: center; color: #fff; font-size: 17px; flex-shrink: 0; }
.pf-facebook { background: #1877f2; }
.pf-instagram { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285aeb 90%); }
.pf-youtube { background: #ff0000; }
.pf-tiktok { background: #111; box-shadow: inset -2px -2px 0 #25f4ee, inset 2px 2px 0 #fe2c55; }
.pf.lg { width: 46px; height: 46px; border-radius: 13px; font-size: 24px; }
.pf.sm { width: 22px; height: 22px; border-radius: 6px; font-size: 13px; }
.pf.off { filter: grayscale(1); opacity: .35; }
.pf-stack { display: inline-flex; }
.pf-stack .pf { border: 2px solid var(--surface); margin-inline-start: -6px; }
.pf-stack .pf:first-child { margin-inline-start: 0; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .9rem; color: var(--text-2); }
.form-hint { display: block; color: var(--muted); font-size: .8rem; margin-top: 5px; }
.input, .select, .textarea {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit; outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.textarea { height: auto; min-height: 110px; padding: 12px 14px; resize: vertical; line-height: 1.7; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236e7398' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-inline-end: 36px; }
[dir="rtl"] .select { background-position: left 12px center; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px var(--primary-soft); }
.input.is-invalid, .textarea.is-invalid { border-color: var(--danger); }
.invalid-text { color: var(--danger); font-size: .8rem; margin-top: 5px; display: block; }
.input-icon { position: relative; }
.input-icon > i { position: absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 18px; pointer-events: none; }
.input-icon .input { padding-inline-start: 40px; }
.input-icon .toggle-pass { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; font-size: 18px; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.input-color { width: 56px; padding: 4px; height: 44px; cursor: pointer; }

.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 500; }
.check input { appearance: none; width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--border); background: var(--surface); display: grid; place-items: center; cursor: pointer; transition: all .2s; flex-shrink: 0; margin: 0; }
.check input:checked { background: var(--primary); border-color: var(--primary); }
.check input:checked::after { content: ''; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { appearance: none; width: 44px; height: 24px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border); position: relative; cursor: pointer; transition: background .25s; margin: 0; flex-shrink: 0; }
.switch input::after { content: ''; position: absolute; top: 2px; inset-inline-start: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .3s var(--ease); }
.switch input:checked { background: var(--primary); border-color: var(--primary); }
.switch input:checked::after { transform: translateX(20px); }
[dir="rtl"] .switch input:checked::after { transform: translateX(-20px); }

/* Segmented control */
.segmented { display: inline-flex; padding: 4px; border-radius: 13px; background: var(--surface-3); gap: 2px; flex-wrap: wrap; }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 10px; font-weight: 600; color: var(--muted); transition: all .25s var(--ease); }
.segmented input:checked + span { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: start; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .2s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }
.cell-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-user div { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.cell-user small { color: var(--muted); }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.filters .input, .filters .select { height: 38px; width: auto; min-width: 150px; border-radius: 10px; }
.filters .input-icon { flex: 1; min-width: 200px; }
.filters .input-icon .input { width: 100%; }
.tabs { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tab { position: relative; padding: 14px 14px; color: var(--muted); font-weight: 600; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; cursor: pointer; border: 0; background: none; font: inherit; }
.tab .count { background: var(--surface-3); color: var(--text-2); border-radius: 999px; padding: 0 8px; font-size: .75rem; }
.tab::after { content: ''; position: absolute; inset-inline: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--grad); transform: scaleX(0); transition: transform .3s var(--ease); }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); }
.tab.active::after { transform: scaleX(1); }
.tab.active .count { background: var(--primary-soft); color: var(--primary); }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 6px; justify-content: center; padding: 16px; flex-wrap: wrap; }
.pagination a { min-width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--border); color: var(--text-2); font-weight: 600; transition: all .2s; padding: 0 8px; }
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination a.active { background: var(--grad); color: #fff; border-color: transparent; }
.pagination .dots { align-self: center; color: var(--muted); }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 56px 24px; }
.empty-icon { width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 26px; display: grid; place-items: center; font-size: 38px; color: var(--primary); background: var(--primary-soft); animation: floaty 4s ease-in-out infinite; }
.empty-state h3 { font-size: 1.2rem; }
.empty-state p { color: var(--muted); max-width: 440px; margin: 0 auto 18px; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(10, 12, 30, .45); backdrop-filter: blur(6px); opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s; }
.modal.open { opacity: 1; visibility: visible; }
.modal-dialog { width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); transform: scale(.94) translateY(12px); transition: transform .35s var(--ease); }
.modal.open .modal-dialog { transform: none; }
.modal-sm { max-width: 420px; }
.modal-lg { max-width: 820px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 22px; border-top: 1px solid var(--border); }
.confirm-icon { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 14px; display: grid; place-items: center; font-size: 30px; background: var(--danger-soft); color: var(--danger); }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; z-index: 100; bottom: 20px; inset-inline-end: 20px; display: flex; flex-direction: column; gap: 10px; max-width: calc(100vw - 40px); }
.toast { display: flex; align-items: flex-start; gap: 12px; min-width: 280px; max-width: 420px; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: toastIn .45s var(--ease) both; position: relative; overflow: hidden; }
.toast.out { animation: toastOut .3s ease forwards; }
.toast i { font-size: 22px; }
.toast .t-msg { flex: 1; font-weight: 500; }
.toast::after { content: ''; position: absolute; bottom: 0; inset-inline-start: 0; height: 3px; width: 100%; background: currentColor; opacity: .5; animation: toastBar 5s linear forwards; transform-origin: left; }
[dir="rtl"] .toast::after { transform-origin: right; }
.toast.success { color: var(--success); } .toast.error { color: var(--danger); } .toast.info { color: var(--info); } .toast.warning { color: var(--warning); }
.toast .t-msg { color: var(--text); }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px) scale(.95); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.95); } }
@keyframes toastBar { to { transform: scaleX(0); } }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 13px; border: 1px solid transparent; margin-bottom: 16px; }
.alert i { font-size: 20px; margin-top: 1px; }
.alert-info { background: var(--info-soft); color: var(--text); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.alert-info i { color: var(--info); }
.alert-warning { background: var(--warning-soft); color: var(--text); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.alert-warning i { color: var(--warning); }
.alert-danger { background: var(--danger-soft); color: var(--text); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-danger i { color: var(--danger); }
.alert-success { background: var(--success-soft); color: var(--text); }
.alert-success i { color: var(--success); }
.alert ul { margin: 4px 0 0; padding-inline-start: 18px; }

/* ---------- Skeleton ---------- */
.skeleton { position: relative; overflow: hidden; background: var(--surface-3); border-radius: 8px; }
.skeleton::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .5), transparent); animation: shimmer 1.4s infinite; }
[data-theme="dark"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent); }

/* ---------- Progress ---------- */
.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--grad); transition: width .8s var(--ease); }

/* ---------- Dashboard ---------- */
.welcome-card { position: relative; overflow: hidden; padding: 26px 28px; color: #fff; border: 0; background: var(--grad); background-size: 200% 200%; animation: gradientMove 10s ease infinite; }
.welcome-card h2 { font-size: 1.5rem; }
.welcome-card p { opacity: .9; margin-bottom: 16px; max-width: 520px; }
.welcome-card .deco { position: absolute; inset-inline-end: 24px; bottom: -20px; font-size: 150px; opacity: .15; animation: floaty 6s ease-in-out infinite; --r: -12deg; }
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); transition: background .2s; }
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--surface-2); }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); display: block; }
.list-item .li-sub { color: var(--muted); font-size: .8rem; }
.time-chip { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 50px; height: 50px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); line-height: 1.1; flex-shrink: 0; }
.time-chip strong { font-size: 1.05rem; }
.time-chip small { font-size: .66rem; text-transform: uppercase; font-weight: 700; }
.chart-box { position: relative; height: 280px; }

/* ---------- Composer ---------- */
.composer textarea.textarea { min-height: 190px; font-size: 1rem; border: 0; background: transparent; padding: 0; box-shadow: none !important; }
.composer-box { border: 1px solid var(--border); border-radius: 16px; background: var(--surface-2); padding: 14px 16px; transition: border-color .2s, box-shadow .2s; }
.composer-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); background: var(--surface); }
.composer-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 10px; border-top: 1px dashed var(--border); margin-top: 10px; flex-wrap: wrap; }
.char-count { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.char-count.over { color: var(--danger); font-weight: 700; }
.dropzone { display: block; position: relative; border: 2px dashed var(--border); border-radius: 16px; padding: 26px; text-align: center; cursor: pointer; transition: all .25s var(--ease); background: var(--surface-2); }
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); transform: scale(1.01); }
.dropzone i { font-size: 34px; color: var(--primary); display: block; margin-bottom: 6px; transition: transform .3s var(--ease); }
.dropzone:hover i { transform: translateY(-4px); }
.dropzone input { display: none; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 12px; }
.media-thumb { position: relative; aspect-ratio: 1; border-radius: 13px; overflow: hidden; background: var(--surface-3); animation: scaleIn .4s var(--ease) both; border: 1px solid var(--border); }
.media-thumb img, .media-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-thumb .mt-type { position: absolute; top: 6px; inset-inline-start: 6px; background: rgba(0, 0, 0, .55); color: #fff; border-radius: 7px; padding: 1px 6px; font-size: .7rem; display: flex; gap: 3px; align-items: center; }
.media-thumb .mt-remove { position: absolute; top: 6px; inset-inline-end: 6px; width: 26px; height: 26px; border-radius: 8px; border: 0; background: rgba(0, 0, 0, .6); color: #fff; cursor: pointer; display: grid; place-items: center; opacity: 0; transition: opacity .2s; }
.media-thumb:hover .mt-remove { opacity: 1; }
.media-thumb .mt-progress { position: absolute; inset: auto 8px 8px; height: 5px; border-radius: 9px; background: rgba(255, 255, 255, .35); overflow: hidden; }
.media-thumb .mt-progress span { display: block; height: 100%; width: 0; background: #fff; transition: width .2s; }
.media-thumb.selected { outline: 3px solid var(--primary); outline-offset: -3px; }
@media (hover: none) { .media-thumb .mt-remove { opacity: 1; } }

.target-page { border: 1px solid var(--border); border-radius: 14px; padding: 12px; margin-bottom: 10px; transition: border-color .2s, background .2s; }
.target-page.has-selected { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); background: var(--primary-soft); }
.target-page-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.target-page-head strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-dot { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; }
.acc-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.acc-chip { position: relative; cursor: pointer; }
.acc-chip input { position: absolute; opacity: 0; pointer-events: none; }
.acc-chip span.chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px 5px 5px; border-radius: 11px; border: 1.5px solid var(--border); background: var(--surface); font-size: .82rem; font-weight: 600; transition: all .25s var(--ease); color: var(--text-2); }
[dir="rtl"] .acc-chip span.chip { padding: 5px 5px 5px 10px; }
.acc-chip span.chip .pf { width: 24px; height: 24px; font-size: 14px; border-radius: 7px; filter: grayscale(1); opacity: .5; transition: all .25s; }
.acc-chip input:checked + span.chip { border-color: var(--primary); color: var(--text); box-shadow: 0 4px 14px -6px rgba(109, 94, 252, .55); transform: translateY(-1px); }
.acc-chip input:checked + span.chip .pf { filter: none; opacity: 1; }
.acc-chip input:disabled + span.chip { opacity: .5; cursor: not-allowed; }
.acc-chip .chk { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--border); display: grid; place-items: center; font-size: 10px; color: transparent; transition: all .2s; }
.acc-chip input:checked + span.chip .chk { background: var(--primary); border-color: var(--primary); color: #fff; }

.preview-tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.preview-tabs button { border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 4px; cursor: pointer; transition: all .2s; }
.preview-tabs button.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.preview-card { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); overflow: hidden; animation: fadeIn .3s; }
.preview-card .pv-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.preview-card .pv-head .avatar { border-radius: 50%; }
.preview-card .pv-text { padding: 0 14px 12px; white-space: pre-wrap; word-break: break-word; font-size: .92rem; }
.preview-card .pv-media { background: #000; display: grid; gap: 2px; grid-template-columns: repeat(2, 1fr); }
.preview-card .pv-media.one { grid-template-columns: 1fr; }
.preview-card .pv-media img, .preview-card .pv-media video { width: 100%; height: 100%; max-height: 360px; object-fit: cover; display: block; aspect-ratio: 1; }
.preview-card .pv-media.one img, .preview-card .pv-media.one video { aspect-ratio: auto; }
.preview-card .pv-link { margin: 0 14px 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-card .pv-actions { display: flex; justify-content: space-around; padding: 10px; border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; }
.preview-card.vertical .pv-media { aspect-ratio: 9/16; max-height: 460px; grid-template-columns: 1fr; }
.preview-card.vertical .pv-media img, .preview-card.vertical .pv-media video { aspect-ratio: 9/16; max-height: 460px; }
.preview-empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.sticky-side { position: sticky; top: calc(var(--topbar-h) + 16px); }
.publish-bar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.schedule-box { overflow: hidden; max-height: 0; opacity: 0; transition: max-height .4s var(--ease), opacity .3s, margin .3s; }
.schedule-box.open { max-height: 200px; opacity: 1; margin-top: 14px; }
.collapse-head { display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; }
.collapse-head i.chev { transition: transform .3s var(--ease); }
.collapse.open .collapse-head i.chev { transform: rotate(180deg); }
.collapse-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .35s var(--ease); }
.collapse-body > div { overflow: hidden; }
.collapse.open .collapse-body { grid-template-rows: 1fr; }

/* ---------- Posts list ---------- */
.post-row { display: flex; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--border); align-items: flex-start; transition: background .2s; }
.post-row:hover { background: var(--surface-2); }
.post-row:last-child { border-bottom: 0; }
.post-thumb { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; background: var(--surface-3); flex-shrink: 0; display: grid; place-items: center; color: var(--muted); font-size: 24px; overflow: hidden; }
.post-thumb img, .post-thumb video { width: 100%; height: 100%; object-fit: cover; }
.post-main { flex: 1; min-width: 0; }
.post-title { font-weight: 600; color: var(--text); display: block; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.post-meta { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: .8rem; margin-top: 6px; }
.post-meta span { display: inline-flex; gap: 4px; align-items: center; }
.post-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.target-list { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.target-pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 2px; border-radius: 9px; background: var(--surface-3); font-size: .74rem; font-weight: 600; }
[dir="rtl"] .target-pill { padding: 2px 2px 2px 8px; }
.target-pill .pf { width: 20px; height: 20px; font-size: 12px; border-radius: 6px; }
.target-pill.st-published { background: var(--success-soft); color: var(--success); }
.target-pill.st-failed { background: var(--danger-soft); color: var(--danger); }
.target-pill.st-pending, .target-pill.st-publishing { background: var(--warning-soft); color: #c27c06; }

/* ---------- Calendar ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.cal-head h3 { margin: 0; font-size: 1.2rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { padding: 10px; text-align: center; font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cal-day { min-height: 118px; padding: 8px; border-inline-end: 1px solid var(--border); border-bottom: 1px solid var(--border); position: relative; transition: background .2s; }
.cal-day:nth-child(7n) { border-inline-end: 0; }
.cal-day:hover { background: var(--surface-2); }
.cal-day.other { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.cal-day.other .cal-num { opacity: .4; }
.cal-num { font-weight: 700; font-size: .85rem; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; }
.cal-day.today .cal-num { background: var(--grad); color: #fff; }
.cal-add { position: absolute; top: 8px; inset-inline-end: 8px; opacity: 0; transition: opacity .2s; }
.cal-day:hover .cal-add { opacity: 1; }
.cal-event { display: flex; align-items: center; gap: 5px; margin-top: 4px; padding: 3px 6px; border-radius: 7px; font-size: .74rem; font-weight: 600; background: var(--primary-soft); color: var(--primary); overflow: hidden; white-space: nowrap; transition: transform .2s; animation: fadeUp .4s var(--ease) both; }
.cal-event:hover { transform: translateX(2px); }
.cal-event.st-published { background: var(--success-soft); color: var(--success); }
.cal-event.st-failed, .cal-event.st-partial { background: var(--danger-soft); color: var(--danger); }
.cal-event.st-draft { background: var(--surface-3); color: var(--muted); }
.cal-event .ev-time { opacity: .75; font-variant-numeric: tabular-nums; }
.cal-event .ev-text { overflow: hidden; text-overflow: ellipsis; }
.cal-more { font-size: .72rem; color: var(--muted); margin-top: 3px; display: block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- Pages (brands) ---------- */
.brand-card { padding: 20px; position: relative; overflow: hidden; }
.brand-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--c, var(--primary)); }
.brand-card-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.brand-card-head h3 { margin: 0; font-size: 1.05rem; }
.brand-avatar { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 1.1rem; background: var(--c, var(--primary)); box-shadow: 0 8px 18px -8px var(--c, var(--primary)); flex-shrink: 0; }
.brand-platforms { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0; }
.brand-pf { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 12px; background: var(--surface-2); font-size: .7rem; color: var(--muted); font-weight: 600; text-align: center; }
.brand-pf.on { color: var(--success); }
.acc-card { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.acc-card-head { display: flex; gap: 12px; align-items: center; }
.acc-card-head h3 { margin: 0; }
.acc-connected { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--success-soft); }
.acc-connected img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.help-steps { margin: 0; padding-inline-start: 18px; color: var(--text-2); font-size: .85rem; }
.help-steps li { margin-bottom: 4px; }
.copy-field { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 12px; border-radius: 10px; background: var(--surface-3); font-family: ui-monospace, Consolas, monospace; font-size: .78rem; word-break: break-all; }
[dir="rtl"] .copy-field { padding: 6px 12px 6px 6px; direction: ltr; }
.copy-field span { flex: 1; min-width: 0; }

/* ---------- Roles ---------- */
.perm-group { border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.perm-group h4 { margin: 0 0 10px; font-size: .9rem; display: flex; justify-content: space-between; align-items: center; }
.perm-group .check { display: flex; margin-bottom: 8px; font-size: .88rem; }

/* ---------- Logs timeline ---------- */
.log-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-size: 18px; flex-shrink: 0; }
pre.code, .code-block { background: #0f1226; color: #d7dbff; padding: 16px; border-radius: 13px; overflow: auto; font-size: .8rem; line-height: 1.6; margin: 0; direction: ltr; text-align: left; white-space: pre; }
.code-block .k { color: #c792ea; } .code-block .s { color: #c3e88d; } .code-block .n { color: #f78c6c; } .code-block .c { color: #697098; }

/* ---------- API docs ---------- */
.endpoint { border: 1px solid var(--border); border-radius: 14px; margin-bottom: 12px; overflow: hidden; }
.endpoint-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; background: var(--surface-2); direction: ltr; }
.endpoint-head .path { font-family: ui-monospace, Consolas, monospace; font-weight: 600; font-size: .88rem; flex: 1; }
.endpoint-head .desc { color: var(--muted); font-size: .85rem; }
[dir="rtl"] .endpoint-head .desc { direction: rtl; }
.method { font-family: ui-monospace, monospace; font-weight: 800; font-size: .72rem; padding: 3px 8px; border-radius: 7px; min-width: 58px; text-align: center; }
.m-get { background: var(--info-soft); color: var(--info); }
.m-post { background: var(--success-soft); color: var(--success); }
.m-put, .m-patch { background: var(--warning-soft); color: #c27c06; }
.m-delete { background: var(--danger-soft); color: var(--danger); }
.endpoint-body { padding: 14px; border-top: 1px solid var(--border); }
.key-reveal { padding: 16px; border-radius: 14px; background: var(--success-soft); border: 1px dashed var(--success); animation: scaleIn .4s var(--ease); }

/* ---------- Auth pages ---------- */
.auth-body { min-height: 100vh; }
.auth-wrap { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth-art { position: relative; overflow: hidden; background: #0f0b2e; color: #fff; display: flex; align-items: center; padding: 48px; }
.auth-art .blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .75; animation: blob 14s ease-in-out infinite; }
.auth-art .b1 { width: 420px; height: 420px; background: #6d5efc; top: -80px; inset-inline-start: -60px; }
.auth-art .b2 { width: 360px; height: 360px; background: #ec4899; bottom: -60px; inset-inline-end: -40px; animation-delay: -4s; }
.auth-art .b3 { width: 300px; height: 300px; background: #a855f7; top: 40%; inset-inline-start: 40%; animation-delay: -8s; }
.auth-art-inner { position: relative; z-index: 2; max-width: 520px; }
.auth-art h2 { font-size: 2.3rem; line-height: 1.25; margin: 34px 0 14px; font-weight: 800; }
.auth-art p { opacity: .82; font-size: 1.05rem; }
.floating-cards { position: relative; height: 220px; margin-top: 30px; }
.float-card { position: absolute; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 16px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .2); backdrop-filter: blur(14px); font-weight: 600; box-shadow: 0 20px 40px -12px rgba(0, 0, 0, .4); animation: floaty 5s ease-in-out infinite; }
.float-card .ok { color: #34d399; font-size: 20px; }
.fc1 { top: 0; inset-inline-start: 0; --r: -3deg; }
.fc2 { top: 80px; inset-inline-start: 38%; animation-delay: -1.6s; --r: 2deg; }
.fc3 { top: 160px; inset-inline-start: 8%; animation-delay: -3s; --r: -1deg; }
.auth-form-side { display: flex; flex-direction: column; padding: 24px 48px; background: var(--surface); }
.auth-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.auth-top-actions { display: flex; gap: 8px; margin-inline-start: auto; }
.auth-card { width: 100%; max-width: 420px; margin: auto; padding: 30px 0; }
.auth-card h1 { font-size: 1.8rem; font-weight: 800; letter-spacing: -.02em; }
.auth-card .sub { color: var(--muted); margin-bottom: 26px; }
.auth-foot { text-align: center; margin-top: 20px; color: var(--muted); }
.divider-text { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .8rem; margin: 18px 0; }
.divider-text::before, .divider-text::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ---------- Landing ---------- */
.landing { overflow-x: hidden; }
.l-nav { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 5vw; backdrop-filter: blur(14px); background: color-mix(in srgb, var(--bg) 70%, transparent); }
.l-nav .links { display: flex; gap: 8px; align-items: center; }
.hero { position: relative; text-align: center; padding: 90px 5vw 70px; }
.hero .blob { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .35; animation: blob 16s ease-in-out infinite; z-index: -1; }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.8rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.15; max-width: 900px; margin: 18px auto; }
.grad-text { background: var(--grad); background-size: 200% 200%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: gradientMove 6s ease infinite; }
.hero p { font-size: 1.15rem; color: var(--muted); max-width: 640px; margin: 0 auto 30px; }
.hero .cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-weight: 600; font-size: .85rem; }
.hero-platforms { display: flex; gap: 14px; justify-content: center; margin-top: 44px; }
.hero-platforms .pf { animation: floaty 4s ease-in-out infinite; }
.hero-platforms .pf:nth-child(2) { animation-delay: -1s; } .hero-platforms .pf:nth-child(3) { animation-delay: -2s; } .hero-platforms .pf:nth-child(4) { animation-delay: -3s; }
.section { padding: 60px 5vw; max-width: 1240px; margin: 0 auto; }
.section-title { text-align: center; margin-bottom: 40px; }
.section-title h2 { font-size: 2rem; font-weight: 800; }
.feature { padding: 26px; }
.feature .f-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 26px; color: #fff; background: var(--grad); margin-bottom: 16px; box-shadow: 0 10px 24px -10px rgba(109, 94, 252, .7); transition: transform .4s var(--ease); }
.feature:hover .f-icon { transform: rotate(-8deg) scale(1.08); }
.feature h3 { font-size: 1.1rem; }
.feature p { color: var(--muted); margin: 0; }
.plan-card { padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.plan-card.featured { border: 2px solid transparent; background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--grad) border-box; transform: scale(1.03); }
.plan-price { font-size: 2.4rem; font-weight: 800; }
.plan-price small { font-size: .9rem; color: var(--muted); font-weight: 500; }
.plan-features { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.plan-features li { display: flex; gap: 8px; align-items: center; }
.plan-features i { color: var(--success); }
.l-footer { text-align: center; padding: 30px; color: var(--muted); border-top: 1px solid var(--border); }
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.reveal.visible { opacity: 1; transform: none; }

/* ---------- Install ---------- */
.install-steps { display: flex; gap: 8px; margin-bottom: 20px; }
.install-steps span { flex: 1; height: 5px; border-radius: 9px; background: var(--surface-3); }
.install-steps span.on { background: var(--grad); }

/* ---------- Responsive ---------- */
.only-mobile { display: none !important; }
@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1fr) 340px; }
}
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  body.sidebar-open .sidebar { transform: none; }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(10, 12, 30, .45); backdrop-filter: blur(3px); opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s; }
  body.sidebar-open .sidebar-backdrop { opacity: 1; visibility: visible; }
  .main { margin-inline-start: 0; }
  .only-mobile { display: inline-grid !important; }
  .brand.only-mobile { display: inline-flex !important; }
  .grid-main, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .sticky-side { position: static; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-form-side { padding: 20px 24px; }
}
@media (max-width: 760px) {
  .content { padding: 18px 16px 50px; }
  .topbar { padding: 0 16px; gap: 10px; }
  .topbar-title h1 { font-size: 1.05rem; }
  .grid-2, .grid-4, .form-row, .form-row-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-4.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat-card { padding: 16px; }
  .stat-card .stat-value { font-size: 1.5rem; }
  .hide-sm { display: none !important; }
  .user-btn { padding: 3px; }
  .page-head h2 { font-size: 1.25rem; }
  .post-row { flex-wrap: wrap; }
  .post-side { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }
  .cal-day { min-height: 74px; padding: 4px; }
  .cal-event .ev-text, .cal-event .ev-time { display: none; }
  .cal-event { justify-content: center; padding: 3px; }
  .cal-dow { font-size: .65rem; padding: 8px 2px; }
  .filters .select, .filters .input { min-width: 0; flex: 1 1 140px; }
  .table-cards thead { display: none; }
  .table-cards tr { display: block; border-bottom: 1px solid var(--border); padding: 10px 0; }
  .table-cards td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 6px 16px; }
  .table-cards td::before { content: attr(data-label); color: var(--muted); font-size: .78rem; font-weight: 600; }
  .table-cards td.actions-cell::before { content: none; }
  .table .actions { justify-content: flex-start; }
  .modal-dialog { border-radius: 18px; }
  .brand-platforms { grid-template-columns: repeat(4, 1fr); }
  .toast-stack { inset-inline: 12px; bottom: 12px; }
  .toast { min-width: 0; max-width: none; }
}
@media (max-width: 480px) {
  .hide-xs { display: none !important; }
  .btn { padding: 0 14px; }
  .publish-bar .btn { flex: 1; }
}
